Updates for CraftBukkit v1.4.6

This commit is contained in:
Steven Lawson 2012-12-20 21:33:22 -05:00
parent b8b755c0c7
commit ca4e64cc0e
3 changed files with 41 additions and 43 deletions

View File

@ -75,7 +75,7 @@ public class Command_saconfig extends TFM_Command
} }
else else
{ {
sender.sendMessage(ChatColor.stripColor(ChatColor.translateAlternateColorCodes('&', superadmin.toString()))); sender.sendMessage(ChatColor.GRAY + ChatColor.stripColor(ChatColor.translateAlternateColorCodes('&', superadmin.toString())));
} }
return true; return true;

View File

@ -163,8 +163,7 @@ public class TFM_BlockListener implements Listener
} }
} }
ItemStack is = new ItemStack(event.getBlockPlaced().getType(), 1, (short) 0, event.getBlockPlaced().getData()); switch (event.getBlockPlaced().getType())
switch (is.getType())
{ {
case LAVA: case LAVA:
case STATIONARY_LAVA: case STATIONARY_LAVA:
@ -252,24 +251,23 @@ public class TFM_BlockListener implements Listener
} }
} }
//This event is not in the standard Bukkit / CraftBukkit server, only my custom version. Remove it if you want to compile this plugin yourself. // @EventHandler(priority = EventPriority.NORMAL)
@EventHandler(priority = EventPriority.NORMAL) // public void onCommandBlockChangeEvent(CommandBlockChangeEvent event)
public void onCommandBlockChangeEvent(CommandBlockChangeEvent event) // {
{ // Player player = event.getPlayer();
Player player = event.getPlayer(); //
// if (!TFM_SuperadminList.isUserSuperadmin(player))
if (!TFM_SuperadminList.isUserSuperadmin(player)) // {
{ // TFM_Util.playerMsg(player, "You do not have permission to set Command Block commands.");
TFM_Util.playerMsg(player, "You do not have permission to set Command Block commands."); // event.setCancelled(true);
event.setCancelled(true); // return;
return; // }
} //
// if (!TFM_SuperadminList.isSeniorAdmin(player))
if (!TFM_SuperadminList.isSeniorAdmin(player)) // {
{ // TFM_Util.playerMsg(player, "You do not have permission to set Command Block commands.");
TFM_Util.playerMsg(player, "You do not have permission to set Command Block commands."); // event.setCancelled(true);
event.setCancelled(true); // return;
return; // }
} // }
}
} }

View File

@ -5,11 +5,11 @@ import java.util.Date;
import java.util.Iterator; import java.util.Iterator;
import java.util.Set; import java.util.Set;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import net.minecraft.server.v1_4_5.BanEntry; import net.minecraft.server.v1_4_6.BanEntry;
import net.minecraft.server.v1_4_5.BanList; import net.minecraft.server.v1_4_6.BanList;
import net.minecraft.server.v1_4_5.MinecraftServer; import net.minecraft.server.v1_4_6.MinecraftServer;
import net.minecraft.server.v1_4_5.PropertyManager; import net.minecraft.server.v1_4_6.PlayerList;
import net.minecraft.server.v1_4_5.ServerConfigurationManagerAbstract; import net.minecraft.server.v1_4_6.PropertyManager;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -28,14 +28,14 @@ public class TFM_ServerInterface
public static void wipeNameBans() public static void wipeNameBans()
{ {
BanList nameBans = MinecraftServer.getServer().getServerConfigurationManager().getNameBans(); BanList nameBans = MinecraftServer.getServer().getPlayerList().getNameBans();
nameBans.getEntries().clear(); nameBans.getEntries().clear();
nameBans.save(); nameBans.save();
} }
public static void wipeIpBans() public static void wipeIpBans()
{ {
BanList IPBans = MinecraftServer.getServer().getServerConfigurationManager().getIPBans(); BanList IPBans = MinecraftServer.getServer().getPlayerList().getIPBans();
IPBans.getEntries().clear(); IPBans.getEntries().clear();
IPBans.save(); IPBans.save();
} }
@ -43,7 +43,7 @@ public class TFM_ServerInterface
public static void unbanUsername(String name) public static void unbanUsername(String name)
{ {
name = name.toLowerCase().trim(); name = name.toLowerCase().trim();
BanList nameBans = MinecraftServer.getServer().getServerConfigurationManager().getNameBans(); BanList nameBans = MinecraftServer.getServer().getPlayerList().getNameBans();
nameBans.remove(name); nameBans.remove(name);
} }
@ -63,14 +63,14 @@ public class TFM_ServerInterface
{ {
ban_entry.setSource(source); ban_entry.setSource(source);
} }
BanList nameBans = MinecraftServer.getServer().getServerConfigurationManager().getNameBans(); BanList nameBans = MinecraftServer.getServer().getPlayerList().getNameBans();
nameBans.add(ban_entry); nameBans.add(ban_entry);
} }
public static boolean isNameBanned(String name) public static boolean isNameBanned(String name)
{ {
name = name.toLowerCase().trim(); name = name.toLowerCase().trim();
BanList nameBans = MinecraftServer.getServer().getServerConfigurationManager().getNameBans(); BanList nameBans = MinecraftServer.getServer().getPlayerList().getNameBans();
nameBans.removeExpired(); nameBans.removeExpired();
return nameBans.getEntries().containsKey(name); return nameBans.getEntries().containsKey(name);
} }
@ -91,21 +91,21 @@ public class TFM_ServerInterface
{ {
ban_entry.setSource(source); ban_entry.setSource(source);
} }
BanList ipBans = MinecraftServer.getServer().getServerConfigurationManager().getIPBans(); BanList ipBans = MinecraftServer.getServer().getPlayerList().getIPBans();
ipBans.add(ban_entry); ipBans.add(ban_entry);
} }
public static void unbanIP(String ip) public static void unbanIP(String ip)
{ {
ip = ip.toLowerCase().trim(); ip = ip.toLowerCase().trim();
BanList ipBans = MinecraftServer.getServer().getServerConfigurationManager().getIPBans(); BanList ipBans = MinecraftServer.getServer().getPlayerList().getIPBans();
ipBans.remove(ip); ipBans.remove(ip);
} }
public static boolean isIPBanned(String ip) public static boolean isIPBanned(String ip)
{ {
ip = ip.toLowerCase().trim(); ip = ip.toLowerCase().trim();
BanList ipBans = MinecraftServer.getServer().getServerConfigurationManager().getIPBans(); BanList ipBans = MinecraftServer.getServer().getPlayerList().getIPBans();
ipBans.removeExpired(); ipBans.removeExpired();
return ipBans.getEntries().containsKey(ip); return ipBans.getEntries().containsKey(ip);
} }
@ -113,7 +113,7 @@ public class TFM_ServerInterface
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
public static int purgeWhitelist() public static int purgeWhitelist()
{ {
Set whitelisted = MinecraftServer.getServer().getServerConfigurationManager().getWhitelisted(); Set whitelisted = MinecraftServer.getServer().getPlayerList().getWhitelisted();
int size = whitelisted.size(); int size = whitelisted.size();
whitelisted.clear(); whitelisted.clear();
return size; return size;
@ -126,9 +126,9 @@ public class TFM_ServerInterface
final Server server = TotalFreedomMod.plugin.getServer(); final Server server = TotalFreedomMod.plugin.getServer();
final ServerConfigurationManagerAbstract scm = MinecraftServer.getServer().getServerConfigurationManager(); final PlayerList player_list = MinecraftServer.getServer().getPlayerList();
final BanList banByIP = scm.getIPBans(); final BanList banByIP = player_list.getIPBans();
final BanList banByName = scm.getNameBans(); final BanList banByName = player_list.getNameBans();
final Player p = event.getPlayer(); final Player p = event.getPlayer();
@ -253,9 +253,9 @@ public class TFM_ServerInterface
return; return;
} }
if (scm.hasWhitelist) if (player_list.hasWhitelist)
{ {
if (!scm.getWhitelisted().contains(player_name.toLowerCase())) if (!player_list.getWhitelisted().contains(player_name.toLowerCase()))
{ {
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "You are not whitelisted on this server."); event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "You are not whitelisted on this server.");
return; return;