Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Logging refactoring,

Added external command injection into Bukkit
  • Loading branch information...
commit 109c62e00fc09319b3055ea1663343ab6e7978eb 1 parent c364020
GuntherDW authored
Showing with 209 additions and 215 deletions.
  1. +1 −1  src/com/guntherdw/bukkit/tweakcraft/Chat/ChatHandler.java
  2. +1 −1  src/com/guntherdw/bukkit/tweakcraft/Chat/ChatMode.java
  3. +76 −22 src/com/guntherdw/bukkit/tweakcraft/Commands/CommandHandler.java
  4. +2 −2 src/com/guntherdw/bukkit/tweakcraft/Commands/Commands/AdminCommands.java
  5. +5 −5 src/com/guntherdw/bukkit/tweakcraft/Commands/Commands/ChatCommands.java
  6. +5 −11 src/com/guntherdw/bukkit/tweakcraft/Commands/Commands/EssentialsCommands.java
  7. +4 −4 src/com/guntherdw/bukkit/tweakcraft/Commands/Commands/TeleportationCommands.java
  8. +15 −15 src/com/guntherdw/bukkit/tweakcraft/Configuration/ConfigurationHandler.java
  9. +13 −13 src/com/guntherdw/bukkit/tweakcraft/DataSources/Ban/BanHandler.java
  10. +19 −27 src/com/guntherdw/bukkit/tweakcraft/Listeners/TweakcraftPlayerListener.java
  11. +5 −5 src/com/guntherdw/bukkit/tweakcraft/Packages/ItemDB.java
  12. +7 −7 src/com/guntherdw/bukkit/tweakcraft/Tools/PermissionsResolver.java
  13. +21 −26 src/com/guntherdw/bukkit/tweakcraft/TweakcraftUtils.java
  14. +3 −3 src/com/guntherdw/bukkit/tweakcraft/Util/TeleportHistory.java
  15. +0 −23 src/com/guntherdw/bukkit/tweakcraft/Worlds/Generators/FlatGen.java
  16. +0 −18 src/com/guntherdw/bukkit/tweakcraft/Worlds/Generators/PlotGen.java
  17. +9 −9 src/com/guntherdw/bukkit/tweakcraft/Worlds/TweakWorld.java
  18. +23 −23 src/com/guntherdw/bukkit/tweakcraft/Worlds/WorldManager.java
2  src/com/guntherdw/bukkit/tweakcraft/Chat/ChatHandler.java
View
@@ -181,7 +181,7 @@ public boolean canTalk(String player) {
}
if (checktime > muteTime) {
if (plugin.getConfigHandler().enableDebug)
- plugin.getLogger().info("[TweakcraftUtils] Mutes: auto-unmuting " + player + ", his mutetime was over!");
+ plugin.getLogger().info(" Mutes: auto-unmuting " + player + ", his mutetime was over!");
removeMute(player);
}
}
2  src/com/guntherdw/bukkit/tweakcraft/Chat/ChatMode.java
View
@@ -37,7 +37,7 @@
protected Logger logger = Logger.getLogger("Minecraft");
public ChatMode(ChatHandler instance) {
- subscribers = new HashSet<String>();
+ this.subscribers = new HashSet<String>();
this.chathandler = instance;
}
98 src/com/guntherdw/bukkit/tweakcraft/Commands/CommandHandler.java
View
@@ -28,13 +28,17 @@
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.PluginCommand;
+import org.bukkit.command.SimpleCommandMap;
import org.bukkit.entity.Player;
+import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile;
+import org.bukkit.plugin.SimplePluginManager;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.*;
-import java.util.logging.Logger;
/**
* @author GuntherDW
@@ -57,7 +61,11 @@
public TeleportationCommands teleportationCommands = null;
public WeatherCommands weatherCommands = null;
- private Logger logger = Logger.getLogger("Minecraft");
+ /** Bukkit Command Injection stuff **/
+ private SimplePluginManager simplePluginManager = null;
+ private SimpleCommandMap simpleCommandMap = null;
+ private Constructor<PluginCommand> pluginCommandConstructor = null;
+
private TweakcraftUtils plugin;
private Object getMethodInstance(Method method) {
@@ -113,9 +121,9 @@ public void injectCommand(Method method, Object instance, boolean injectIntoBukk
if (newCommandMap.containsKey(commandName)) {
- logger.warning("[TweakcraftUtils] Duplicate command found!");
- logger.warning("[TweakcraftUtils] Method : " + method.getName() + "!");
- logger.warning("[TweakcraftUtils] Command : " + commandName + "!");
+ plugin.getLogger().warning("Duplicate command found!");
+ plugin.getLogger().warning("Method : " + method.getName() + "!");
+ plugin.getLogger().warning("Command : " + commandName + "!");
return;
}
List<String> al = new ArrayList<String>();
@@ -126,10 +134,58 @@ public void injectCommand(Method method, Object instance, boolean injectIntoBukk
aliasCommandMap.put(alias, method);
}
-
this.commandAliases.put(commandName, al);
instanceMap.put(method, instance);
+
+ if(injectIntoBukkit) {
+ // plugin.getLogger().info("Injecting "+commandName+" into Bukkit!");
+ this.injectIntoBukkit(commandName, aliases, method, instance, annotation);
+ }
+ }
+ }
+
+ public void getBukkitCommandMap() {
+ try {
+ Object plmgr = plugin.getServer().getPluginManager();
+ if (plmgr instanceof SimplePluginManager) {
+ SimplePluginManager pluginmanager = (SimplePluginManager) plmgr;
+ Field f = SimplePluginManager.class.getDeclaredField("commandMap");
+ f.setAccessible(true);
+ SimpleCommandMap simpleCommandMap = (SimpleCommandMap) f.get(pluginmanager);
+ Constructor<PluginCommand> con = PluginCommand.class.getDeclaredConstructor(String.class, Plugin.class);
+ con.setAccessible(true);
+ this.simplePluginManager = pluginmanager;
+ this.simpleCommandMap = simpleCommandMap;
+ this.pluginCommandConstructor = con;
+ }
+ } catch (Exception e) {
+ plugin.getLogger().warning("Exception caught while getting the CommandMap, plugin command injection will NOT work!");
+ e.printStackTrace();
+ }
+
+ }
+
+ public void injectIntoBukkit(String command, String[] aliases, Method commandMethod, Object classInstance, aCommand annotation) {
+
+ if(this.simplePluginManager == null)
+ this.getBukkitCommandMap();
+
+ try {
+ if (this.simplePluginManager != null) {
+ PluginCommand cmd = pluginCommandConstructor.newInstance(command, this.plugin);
+ cmd.setAliases(Arrays.asList(aliases));
+ cmd.setPermission("tweakcraftutils."+annotation.permissionBase());
+ cmd.setDescription(annotation.description());
+ cmd.setUsage(annotation.usage());
+
+ cmd.setExecutor(plugin);
+
+ this.simpleCommandMap.register("tweakcraftutils", cmd);
+ }
+ } catch (Exception e) {
+ plugin.getLogger().warning("Exception caught while injecting '" + command + "' into Bukkit!");
+ e.printStackTrace();
}
}
@@ -162,7 +218,7 @@ public void checkCommands() {
Set<String> cmds = pluginCommands.keySet();
for (String c : cmds) {
if (!this.newCommandMap.containsKey(c) && !this.aliasCommandMap.containsKey(c))
- logger.warning("[TweakcraftUtils] WARNING: Unmapped command : " + c);
+ plugin.getLogger().warning("WARNING: Unmapped command : " + c);
}
}
}
@@ -216,17 +272,15 @@ public boolean executeCommand(CommandSender sender, String name, String[] args)
if (newCommandMap.containsKey(name) || aliasCommandMap.containsKey(name)) {
try {
- /* iCommand command = commandHandler.getCommand(cmd.getName()); */
- // public abstract boolean executeCommand(Server server, CommandSender sender, String command, String[] args, TweakcraftUtils plugin);
-
if (!runMethod(sender, name, args)) {
sender.sendMessage("This command did not go as intended!");
}
- if (sender instanceof Player) {
+ /* if (sender instanceof Player) {
final LocalPlayer lp = plugin.wrapPlayer((Player)sender);
- plugin.getLogger().info("[TweakcraftUtils] "+(lp.isInvisible()?"[INVIS] ":"") + sender.getName() + " issued: /" + name + " " + mess);
- } else
- plugin.getLogger().info("[TweakcraftUtils] CONSOLE issued: /" + name + " " + mess);
+ plugin.getLogger().info((lp.isInvisible()?"[INVIS] ":"") + sender.getName() + " issued: /" + name + " " + mess);
+ } else */
+ if(!(sender instanceof Player))
+ plugin.getLogger().info("CONSOLE issued: /" + name + " " + mess);
return true;
} /*catch (CommandNotFoundException e) {
sender.sendMessage("TweakcraftUtils error, command not found!");
@@ -234,7 +288,7 @@ public boolean executeCommand(CommandSender sender, String name, String[] args)
sender.sendMessage(ChatColor.RED + "You do not have the correct permissions for this command or usage!");
if (sender instanceof Player) {
final LocalPlayer lp = plugin.wrapPlayer((Player)sender);
- plugin.getLogger().info("[TweakcraftUtils] " + (lp.isInvisible()?"[INVIS] ":"") + ((Player) sender).getName() + " tried: /" + name + " " + mess);
+ plugin.getLogger().info((lp.isInvisible()?"[INVIS] ":"") + ((Player) sender).getName() + " tried: /" + name + " " + mess);
}
} catch (CommandUsageException e) {
sender.sendMessage(ChatColor.YELLOW + e.getMessage());
@@ -242,7 +296,7 @@ public boolean executeCommand(CommandSender sender, String name, String[] args)
sender.sendMessage(ChatColor.YELLOW + e.getMessage());
} catch (CommandException e) {
sender.sendMessage(ChatColor.YELLOW + e.getMessage());
- plugin.getLogger().info("[TweakcraftUtils] " + (sender instanceof Player ? ((Player) sender).getName() : "CONSOLE") + " got a CommandException on : /" + name + " " + mess);
+ plugin.getLogger().info((sender instanceof Player ? ((Player) sender).getName() : "CONSOLE") + " got a CommandException on : /" + name + " " + mess);
}
}
return false;
@@ -270,14 +324,14 @@ public boolean runMethod(CommandSender sender, String name, String[] args)
if (t instanceof CommandException)
throw (CommandException) t;
- logger.warning("[TweakcraftUtils] Error occured while executing command!");
- logger.warning("[TweakcraftUtils] Errornous command : "+name+" "+argsString+"!");
- logger.warning("[TweakcraftUtils] CommandSender : "+(sender instanceof Player?((Player)sender).getName():"CONSOLE"));
+ plugin.getLogger().warning("Error occured while executing command!");
+ plugin.getLogger().warning("Errornous command : " + name + " " + argsString + "!");
+ plugin.getLogger().warning("CommandSender : " + (sender instanceof Player ? ((Player) sender).getName() : "CONSOLE"));
e.printStackTrace();
} catch (IllegalAccessException e) {
- logger.warning("[TweakcraftUtils] Error occured while executing command!");
- logger.warning("[TweakcraftUtils] Errornous command : "+name+" "+argsString+"!");
- logger.warning("[TweakcraftUtils] CommandSender : "+(sender instanceof Player?((Player)sender).getName():"CONSOLE"));
+ plugin.getLogger().warning("Error occured while executing command!");
+ plugin.getLogger().warning("Errornous command : " + name + " " + argsString + "!");
+ plugin.getLogger().warning("CommandSender : " + (sender instanceof Player ? ((Player) sender).getName() : "CONSOLE"));
e.printStackTrace();
}
4 src/com/guntherdw/bukkit/tweakcraft/Commands/Commands/AdminCommands.java
View
@@ -737,7 +737,7 @@ public boolean tweakcraft(CommandSender sender, String command, String[] args)
Player player = (Player) sender;
Set<Player> lijst = plugin.getCUIPlayers();
if (lijst != null && !lijst.contains(player)) {
- plugin.getLogger().info("[TweakcraftUtils] Adding " + player.getName() + " to the CUI list!");
+ plugin.getLogger().info("Adding " + player.getName() + " to the CUI list!");
lijst.add(player);
}
@@ -748,7 +748,7 @@ public boolean tweakcraft(CommandSender sender, String command, String[] args)
Player player = (Player) sender;
Set<Player> lijst = plugin.getMod_InfDuraplayers();
if (lijst != null && !lijst.contains(player)) {
- plugin.getLogger().info("[TweakcraftUtils] Adding " + player.getName() + " to the mod_InfDura list!");
+ plugin.getLogger().info("Adding " + player.getName() + " to the mod_InfDura list!");
lijst.add(player);
}
10 src/com/guntherdw/bukkit/tweakcraft/Commands/Commands/ChatCommands.java
View
@@ -29,11 +29,8 @@
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import org.bukkit.event.player.PlayerChatEvent;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
+import java.util.*;
/**
* @author GuntherDW
@@ -276,7 +273,10 @@ public boolean chatCommand(CommandSender sender, String command, String chatMode
}
// plugin.getServer().broadcastMessage(ChatColor.WHITE + "<" + (sender instanceof Player ? ((Player) sender).getDisplayName() : ChatColor.LIGHT_PURPLE + "CONSOLE") + ChatColor.WHITE + "> " + spam);
if(sender instanceof Player) {
- PlayerChatEvent playerChatEvent = new PlayerChatEvent((Player) sender, spam);
+ Set<Player> players = new HashSet<Player>();
+ players.addAll(Arrays.asList(plugin.getServer().getOnlinePlayers()));
+
+ org.bukkit.event.player.AsyncPlayerChatEvent playerChatEvent = new org.bukkit.event.player.AsyncPlayerChatEvent(false, (Player) sender, spam, players);
plugin.getServer().getPluginManager().callEvent(playerChatEvent);
} else {
String chat = ChatColor.WHITE + "<" + ChatColor.LIGHT_PURPLE + "CONSOLE" + ChatColor.WHITE + "> " + spam;
16 src/com/guntherdw/bukkit/tweakcraft/Commands/Commands/EssentialsCommands.java
View
@@ -127,7 +127,7 @@ public boolean ban(CommandSender sender, String command, String[] realargs)
sender.sendMessage(ChatColor.YELLOW + "Kickbanning " + player.getName());
player.kickPlayer(reason);
}
- plugin.getLogger().info("[TweakcraftUtils] Banning " + playername + "!");
+ plugin.getLogger().info("Banning " + playername + "!");
handler.saveBans();
}
return true;
@@ -265,12 +265,6 @@ public boolean help(CommandSender sender, String command, String[] args)
boolean aliases = true;
String toadd = "";
for (Map.Entry<String, Method> entry : commh.getCommandMap().entrySet()) {
- // Method commandMethod = commh.getCommandMap().get(cname);
- // aCommand annotation = commandMethod.getAnnotation(aCommand.class);
- /* if (plugin.getCommand(entry.getKey()) == null) {
- System.out.println("Nullpointer for " + entry.getKey());
- continue;
- } */
if (addCommandToList(sender, entry.getValue())) {
// Fuck minecraft's font :<
@@ -330,7 +324,7 @@ public boolean help(CommandSender sender, String command, String[] args)
}
}
} else {
- plugin.getLogger().info("[TweakcraftUtils] EXTRAHELP error : " + plug + " is null!");
+ plugin.getLogger().info("EXTRAHELP error : " + plug + " is null!");
}
}
@@ -489,7 +483,7 @@ public boolean item(CommandSender sender, String command, String[] realargs)
stack.setData(Material.getMaterial(itemId).getNewData((byte) dataval));
receiver.getInventory().addItem(stack);
- plugin.getLogger().info("[TweakcraftUtils] " + giftfrom + " gave " + recvname + " " + itemAmount + "x" + itemId + " (" + itemDmg.intValue() + ")");
+ plugin.getLogger().info(giftfrom + " gave " + recvname + " " + itemAmount + "x" + itemId + " (" + itemDmg.intValue() + ")");
} else {
throw new CommandUsageException("Specified item is not valid!");
}
@@ -712,7 +706,7 @@ public boolean msg(CommandSender sender, String command, String[] args)
// plugin.setPlayerReply(playerto.getName(), ((Player) sender).getName());
}
- plugin.getLogger().info("[TweakcraftUtils] (MSG) " + clearName + " -> " + playerto.getName() + " : " + message);
+ plugin.getLogger().info("(MSG) " + clearName + " -> " + playerto.getName() + " : " + message);
} else if (args.length == 1) {
throw new CommandUsageException("I need a message!");
} else {
@@ -887,7 +881,7 @@ public boolean reply(CommandSender sender, String command, String[] args)
playerto.sendMessage("[" + player.getDisplayName() + " -> Me] " + message);
lpTo.setReplyTo(player.getName());
// plugin.setPlayerReply(playerto.getName(), player.getName());
- plugin.getLogger().info("[TweakcraftUtils] (MSG) " + player.getName() + " -> " + playerto.getName() + " : " + message);
+ plugin.getLogger().info("(MSG) " + player.getName() + " -> " + playerto.getName() + " : " + message);
} else if (args.length == 0) {
throw new CommandUsageException("I need a message!");
}
8 src/com/guntherdw/bukkit/tweakcraft/Commands/Commands/TeleportationCommands.java
View
@@ -236,7 +236,7 @@ public boolean teleportToPlayer(CommandSender sender, String command, String[] r
if (lpto.isInvisible()) {
if (!plugin.check(player, "tpinvis")) {
player.sendMessage(ChatColor.YELLOW + "Can't find player!");
- plugin.getLogger().info("[TweakcraftUtils] " + player.getName() + " tried to tp to " + p.getName() + " <invisible>!");
+ plugin.getLogger().info(player.getName() + " tried to tp to " + p.getName() + " <invisible>!");
return true;
} else {
player.sendMessage(ChatColor.AQUA + "Stealth player TP!");
@@ -265,10 +265,10 @@ public boolean teleportToPlayer(CommandSender sender, String command, String[] r
if (override)
player.sendMessage(ChatColor.RED + "Forced tp!");
- plugin.getLogger().info("[TweakcraftUtils] " + player.getName() + " teleported to " + p.getName() + "!");
+ plugin.getLogger().info(player.getName() + " teleported to " + p.getName() + "!");
} else {
p.sendMessage(player.getDisplayName() + ChatColor.LIGHT_PURPLE + " failed to teleport to you!");
- plugin.getLogger().info("[TweakcraftUtils] " + player.getName() + " failed to teleport to " + p.getName() + "!");
+ plugin.getLogger().info(player.getName() + " failed to teleport to " + p.getName() + "!");
// This doesn't happen, CraftBukkit has return true; in it's sources!
}
}
@@ -337,7 +337,7 @@ private void tpfromto(TweakcraftUtils plugin, CommandSender sender, String p1, S
} else {
player = "CONSOLE";
}
- plugin.getLogger().info("[TweakcraftUtils] " + player + " teleported " + pfrom.getName() + " to " + pto.getName() + "!");
+ plugin.getLogger().info(player + " teleported " + pfrom.getName() + " to " + pto.getName() + "!");
plugin.getTelehistory().addHistory(pfrom.getName(), pfrom.getLocation());
pfrom.teleport(pto);
}
30 src/com/guntherdw/bukkit/tweakcraft/Configuration/ConfigurationHandler.java
View
@@ -140,32 +140,32 @@ public void reloadConfig() {
}
// if(this.globalconfig==null) this.globalconfig = (YamlConfiguration) plugin.getConfig();
if (!globalconfigFile.exists()) {
- plugin.getLogger().warning("[TweakcraftUtils] No config file found, using default values!");
+ plugin.getLogger().warning("No config file found, using default values!");
return;
}
try {
globalconfig.load(globalconfigFile);
} catch (InvalidConfigurationException e) {
- plugin.getLogger().warning("[TweakcraftUtils] InvalidConfigurationException while loading config file, using old values!");
+ plugin.getLogger().warning("InvalidConfigurationException while loading config file, using old values!");
e.printStackTrace();
return;
} /* catch (FileNotFoundException e) {
- plugin.getLogger().warning("[TweakcraftUtils] No config file found, using default values!");
+ plugin.getLogger().warning("No config file found, using default values!");
e.printStackTrace();
return;
} */ catch (IOException e) {
- plugin.getLogger().warning("[TweakcraftUtils] IOException while loading config file, using old values!");
+ plugin.getLogger().warning("IOException while loading config file, using old values!");
e.printStackTrace();
return;
}
// plugin.reloadConfig();
- this.plugin.getLogger().info("[TweakcraftUtils] Parsing configuration file...");
- this.plugin.getLogger().info("[TweakcraftUtils] Config : "+globalconfigFile.getAbsolutePath());
+ this.plugin.getLogger().info("Parsing configuration file...");
+ this.plugin.getLogger().info("Config : "+globalconfigFile.getAbsolutePath());
this.enablePersistence = globalconfig.getBoolean("Persistence.enabled", true);
this.useTweakBotSeen = globalconfig.getBoolean("Persistence.useTweakBotSeen", false);
- plugin.getLogger().info("[TweakcraftUtils] Using TweakBot's seen table for /seen!");
+ plugin.getLogger().info("Using TweakBot's seen table for /seen!");
this.enableLocalChat = globalconfig.getBoolean("ChatMode.LocalChat.enabled", true);
this.localchatdistance = globalconfig.getInt("ChatMode.LocalChat.range", 200);
@@ -185,7 +185,7 @@ public void reloadConfig() {
this.enableTPBack = globalconfig.getBoolean("enableTPBack", true);
this.enableDebug = globalconfig.getBoolean("debug.enabled", false);
if(this.enableDebug) {
- plugin.getLogger().info("[TweakcraftUtils] Extra verbose messages enabled!");
+ plugin.getLogger().info("Extra verbose messages enabled!");
}
this.enableRespawnHook = globalconfig.getBoolean("respawn.enableHook", false);
@@ -200,13 +200,13 @@ public void reloadConfig() {
if(plugin.getServer().getPluginManager().getPlugin(plist) != null) {
if(!extrahelpplugin.contains(plist)) {
if(this.enableDebug)
- plugin.getLogger().info("[TweakcraftUtils] Adding "+plist+" to the /help addons.");
+ plugin.getLogger().info("Adding "+plist+" to the /help addons.");
extrahelpplugin.add(plist);
} else {
- plugin.getLogger().info("[TweakcraftUtils] WARNING: "+plist+" is on the extrahelp list multiple times!");
+ plugin.getLogger().info("WARNING: "+plist+" is on the extrahelp list multiple times!");
}
} else {
- plugin.getLogger().info("[TweakcraftUtils] WARNING: Can't find plugin with name "+plist+"! Not adding to the help list.");
+ plugin.getLogger().info("WARNING: Can't find plugin with name "+plist+"! Not adding to the help list.");
}
}
}
@@ -216,16 +216,16 @@ public void reloadConfig() {
this.extrahelphide = globalconfig.getStringList("extrahelp.hide");
if (globalconfig.getBoolean("PlayerHistory.enabled", false)) {
- plugin.getLogger().info("[TweakcraftUtils] Keeping player history!");
+ plugin.getLogger().info("Keeping player history!");
File seenFile = new File(plugin.getDataFolder(), "players.yml");
try {
this.seenconfig.load(seenFile);
this.enableSeenConfig = true;
} catch (IOException e) {
- plugin.getLogger().severe("[TweakcraftUtils] IOExeption thrown while trying to load the seen.yml file! playerhistory disabled!");
+ plugin.getLogger().severe("IOExeption thrown while trying to load the seen.yml file! playerhistory disabled!");
this.enableSeenConfig = false;
} catch (InvalidConfigurationException e) {
- plugin.getLogger().severe("[TweakcraftUtils] InvalidConfigurationException thrown while trying to load the seen.yml file! playerhistory disabled!");
+ plugin.getLogger().severe("InvalidConfigurationException thrown while trying to load the seen.yml file! playerhistory disabled!");
this.enableSeenConfig = false;
}
@@ -265,7 +265,7 @@ public void reloadConfig() {
this.enableSpamControl = globalconfig.getBoolean("spamcontrol.enable", false);
if(this.enableSpamControl) {
- plugin.getLogger().info("[TweakcraftUtils] Enabling spam control!");
+ plugin.getLogger().info("Enabling spam control!");
plugin.getChathandler().enableAntiSpam();
}
this.spamCheckTime = globalconfig.getInt("spamcontrol.checkTime", 5)*100;
26 src/com/guntherdw/bukkit/tweakcraft/DataSources/Ban/BanHandler.java
View
@@ -69,8 +69,8 @@ private void loadBans() {
}
}
banfilereader.close();
- } catch (FileNotFoundException e) { plugin.getLogger().warning("[TweakcraftUtils] Ban file not found!");
- } catch (IOException e) { plugin.getLogger().info("[TweakcraftUtils] Ban file I/O error!"); }
+ } catch (FileNotFoundException e) { plugin.getLogger().warning("Ban file not found!");
+ } catch (IOException e) { plugin.getLogger().info("Ban file I/O error!"); }
if(plugin.getConfigHandler().enablePersistence) {
List<PlayerOptions> popts = plugin.getDatabase(). find(PlayerOptions.class).where().ieq("optionname", "ban").findList();
for(PlayerOptions po : popts) {
@@ -102,17 +102,17 @@ public boolean isBanned(String playername) {
Long toTime = b.getToTime();
Double timerem = Math.floor((toTime-curTime)/1000);
String toGo = TimeTool.calcLeft(timerem.longValue());
- plugin.getLogger().info("[TweakcraftUtils] Bans: "+b.getPlayer()+" still has "+ toGo + " to go!");
+ plugin.getLogger().info("Bans: "+b.getPlayer()+" still has "+ toGo + " to go!");
}
banned = true;
}
else {
- plugin.getLogger().info("[TweakcraftUtils] Bans: auto-unbanning "+b.getPlayer()+", his bantime was over!");
+ plugin.getLogger().info("Bans: auto-unbanning "+b.getPlayer()+", his bantime was over!");
if(plugin.getConfigHandler().enableDebug) {
Long toTime = b.getToTime();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
- plugin.getLogger().info("[TweakcraftUtils] Bans: it expired at "+sdf.format(new Date(toTime))+"!");
+ plugin.getLogger().info("Bans: it expired at "+sdf.format(new Date(toTime))+"!");
}
banned = false;
unBan(b.getPlayer());
@@ -160,7 +160,7 @@ public boolean isBannedFullname(String playername) {
public boolean banPlayer(String playername, String reason) {
if (playername.trim().equals("")) {
- plugin.getLogger().info("[TweakcraftUtils] Can't ban an empty player!");
+ plugin.getLogger().info("Can't ban an empty player!");
} else {
bans.put(playername, new Ban(playername, reason));
if(plugin.getConfigHandler().enablePersistence) {
@@ -184,7 +184,7 @@ public boolean banPlayer(String player, String reason, Long duration) {
toTime = Calendar.getInstance().getTime().getTime();
toTime += duration*1000;
if (playername.trim().equals("")) {
- plugin.getLogger().info("[TweakcraftUtils] Can't ban an empty player!");
+ plugin.getLogger().info("Can't ban an empty player!");
return false;
} else {
bans.put(playername, new Ban(playername, reason, toTime));
@@ -236,12 +236,12 @@ public void unBan(String player) {
*/
public void saveBans() {
File banfile = new File(plugin.getDataFolder(), "banned-players.txt");
- plugin.getLogger().info("[TweakcraftUtils] Trying to save banlist!");
+ plugin.getLogger().info("Trying to save banlist!");
if (!banfile.exists()) {
try {
banfile.createNewFile();
} catch (IOException e) {
- plugin.getLogger().severe("[TweakcraftUtils] Failed trying to create banlist!");
+ plugin.getLogger().severe("Failed trying to create banlist!");
}
}
@@ -255,16 +255,16 @@ public void saveBans() {
}
}
banfilewriter.close();
- plugin.getLogger().info("[TweakcraftUtils] Save complete!");
+ plugin.getLogger().info("Save complete!");
} catch (FileNotFoundException e) {
- plugin.getLogger().info("[TweakcraftUtils] Ban file not found!");
+ plugin.getLogger().info("Ban file not found!");
} catch (IOException e) {
- plugin.getLogger().severe("[TweakcraftUtils] Failed trying to save banlist!");
+ plugin.getLogger().severe("Failed trying to save banlist!");
}
}
public void reloadBans() {
this.loadBans();
- plugin.getLogger().info("[TweakcraftUtils] Loaded banlist, " + bans.size() + " bans and counting!");
+ plugin.getLogger().info("Loaded banlist, " + bans.size() + " bans and counting!");
}
}
46 src/com/guntherdw/bukkit/tweakcraft/Listeners/TweakcraftPlayerListener.java
View
@@ -54,7 +54,6 @@
*/
public class TweakcraftPlayerListener implements Listener {
- //private final Logger log = Logger.getLogger("Minecraft");
private final TweakcraftUtils plugin;
private Set<String> invisplayers;
private Map<String, String> nicks;
@@ -98,7 +97,8 @@ public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
if (pcmd != null && plugin.getCommandHandler().getCommandMap().containsKey(pcmd.getName()))
go = false;
- if (pcmd == null && plugin.getConfigHandler().enableInjectedCommandsHanding) {
+
+ /* if (pcmd == null && plugin.getConfigHandler().enableInjectedCommandsHanding) {
// Check if it's been internally handled or injected
Method method = plugin.getCommandHandler().getCommand(cmd.toLowerCase());
if (method != null) {
@@ -106,7 +106,7 @@ public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
plugin.getCommandHandler().executeCommand(event.getPlayer(), cmd, args.toArray(new String[args.size()]));
return;
}
- }
+ } */
if (go && plugin.getConfigHandler().extraLogging) {
plugin.getLogger().info("[TweakLog] " + (lp.isInvisible()?"[INVIS] ":"") + event.getPlayer().getName() + " issued: " + line);
@@ -124,7 +124,6 @@ public void removeNoMountPersistence(String playername) {
public void addNoMountPersistence(String playername) {
if (plugin.getConfigHandler().enablePersistence) {
- // PlayerOptions po = new PlayerOptions();
List<PlayerOptions> popts = plugin.getDatabase().find(PlayerOptions.class).where().ieq("name", playername).ieq("optionname", "nomount").findList();
if (popts != null && !popts.isEmpty())
removeNoMountPersistence(playername);
@@ -151,11 +150,6 @@ public void setNick(String player, String nick) {
plugin.getDatabase().save(pi);
}
- /* if (plugin.getClientBridge() != null) {
- for(Player p : plugin.getServer().getOnlinePlayers()) {
- plugin.getClientBridge().getPlayerListener().sendPlayerInfo(p, lp.getBukkitPlayerSafe().getName(), true);
- }
- } */
TweakcraftUtilsEvent event = new TweakcraftUtilsEvent(TweakcraftUtilsEvent.Action.NICK_CHANGED);
event.setPlayer(lp);
plugin.getServer().getPluginManager().callEvent(event);
@@ -165,7 +159,6 @@ public boolean removeNick(String player) {
LocalPlayer lp = plugin.wrapPlayer(player);
if (lp.hasNick()) {
- System.out.println("Doing nicks.remove");
nicks.remove(player);
if (plugin.getConfigHandler().enablePersistence) {
PlayerInfo pi = plugin.getDatabase().find(PlayerInfo.class).where().ieq("name", player).findUnique();
@@ -188,7 +181,6 @@ public boolean removeNick(String player) {
return true;
} else {
- System.out.println("NOT doing nicks.remove");
return false;
}
}
@@ -299,7 +291,7 @@ public void reloadInfo() {
LocalPlayer lp = plugin.wrapPlayer(pi.getName());
if (pi.getNick() != null) {
if (plugin.getConfigHandler().enableDebug)
- plugin.getLogger().info("[TweakcraftUtils] Setting " + pi.getName() + "'s nick to " + pi.getNick());
+ plugin.getLogger().info("Setting " + pi.getName() + "'s nick to " + pi.getNick());
nicks.put(pi.getName(), pi.getNick());
pi.setNick(pi.getNick());
lp.setNick(pi.getNick());
@@ -310,12 +302,12 @@ public void reloadInfo() {
for (PlayerOptions po : playeroptions) {
if (po.getOptionname().equals("nomount")) {
if (plugin.getConfigHandler().enableDebug)
- plugin.getLogger().info("[TweakcraftUtils] Setting " + po.getName() + "'s no-ride option!");
+ plugin.getLogger().info("Setting " + po.getName() + "'s no-ride option!");
nomount.add(po.getName());
}
if (po.getOptionname().equals("mute")) {
if (plugin.getConfigHandler().enableDebug)
- plugin.getLogger().info("[TweakcraftUtils] Setting " + po.getName() + "'s mute option!");
+ plugin.getLogger().info("Setting " + po.getName() + "'s mute option!");
Long toTime = null;
try {
if (po.getOptionvalue() != null) {
@@ -328,7 +320,7 @@ public void reloadInfo() {
}
if(po.getOptionname().equals("capeurl")) {
if (plugin.getConfigHandler().enableDebug)
- plugin.getLogger().info("[TweakcraftUtils] Setting " + po.getName() + "'s CapeURL option!");
+ plugin.getLogger().info("Setting " + po.getName() + "'s CapeURL option!");
LocalPlayer lp = plugin.wrapPlayer(po.getName());
lp.setCapeURL(po.getOptionvalue());
capes.put(po.getName(), po.getOptionvalue());
@@ -349,7 +341,7 @@ public void reloadInfo() {
}
@EventHandler(priority = EventPriority.HIGH)
- public void onPlayerChat(PlayerChatEvent event) {
+ public void onPlayerChat(AsyncPlayerChatEvent event) {
if (event.isCancelled()) return;
Player player = event.getPlayer();
@@ -371,7 +363,7 @@ public void onPlayerChat(PlayerChatEvent event) {
if (!ch.canTalk(player.getName())) {
player.sendMessage(ChatColor.GOLD + "You are muted! No one can hear you.");
- plugin.getLogger().info("[TweakcraftUtils] Muted player message : <" + event.getPlayer().getName() + "> " + event.getMessage());
+ plugin.getLogger().info("Muted player message : <" + event.getPlayer().getName() + "> " + event.getMessage());
event.setCancelled(true);
return;
}
@@ -381,7 +373,7 @@ public void onPlayerChat(PlayerChatEvent event) {
counter = ch.getAntiSpam().checkSpam(player, message);
if (counter > (plugin.getConfigHandler().spamMaxMessages - 1)) {
- plugin.getLogger().info("[TweakcraftUtils] " + player.getName() + " has been auto-muted for spamming!");
+ plugin.getLogger().info(player.getName() + " has been auto-muted for spamming!");
long until = plugin.getConfigHandler().spamMuteMinutes * 60;
ch.addMute(player.getName().toLowerCase(), until);
String msg = plugin.getConfigHandler().spamMuteMessage.trim();
@@ -567,7 +559,7 @@ public void onPlayerQuit(PlayerQuitEvent event) {
try {
plugin.getConfigHandler().saveSeenConfig();
} catch (IOException ex) {
- plugin.getLogger().info("[TweakcraftUtils] Couldn't save SeenConfig file!");
+ plugin.getLogger().info("Couldn't save SeenConfig file!");
}
// plugin.getConfigHandler().getSeenconfig().save();
} else {
@@ -593,13 +585,13 @@ public void onPlayerQuit(PlayerQuitEvent event) {
}
}
if (plugin.getConfigHandler().enableDebug)
- plugin.getLogger().info("[TweakcraftUtils] Stored " + name + "'s logout!");
+ plugin.getLogger().info("Stored " + name + "'s logout!");
}
plugin.getChathandler().removePlayer(event.getPlayer());
try {
plugin.getChathandler().setPlayerchatmode(name, null);
} catch (ChatModeException e) {
- plugin.getLogger().severe("[TweakcraftUtils] Error setting ChatMode to null after the logout!");
+ plugin.getLogger().severe("Error setting ChatMode to null after the logout!");
}
@@ -634,7 +626,7 @@ public void onPlayerInteract(PlayerInteractEvent event) {
for (Integer i : bind.keySet()) {
if (i == null) {
event.getPlayer().sendMessage(ChatColor.RED + "[TweakcraftUtils] onPlayerInteract Null error!");
- plugin.getLogger().info("[TweakcraftUtils] " + playername + " triggered a i == null event!");
+ plugin.getLogger().info(playername + " triggered a i == null event!");
} else {
if (event.isCancelled()) {
@@ -721,7 +713,7 @@ public void reloadInvisTable() {
for (String s : this.invisplayers) {
LocalPlayer lp = plugin.wrapPlayer(s);
- plugin.getLogger().info("[TweakcraftUtils] Removing " + s + " from the invisble playerlist!");
+ plugin.getLogger().info("Removing " + s + " from the invisble playerlist!");
lp.setInvisible(false);
}
this.invisplayers.clear();
@@ -737,7 +729,7 @@ public void reloadInvisTable() {
LocalPlayer lp = plugin.wrapPlayer(s);
lp.setInvisible(true);
// if (plugin.getConfigHandler().enableDebug)
- plugin.getLogger().info("[TweakcraftUtils] Adding " + s + " to the invisble playerlist!");
+ plugin.getLogger().info("Adding " + s + " to the invisble playerlist!");
}
}
}
@@ -778,11 +770,11 @@ public void onPlayerPortal(PlayerPortalEvent event) {
signBlock = b;
p.sendMessage(ChatColor.YELLOW + "TweakTravel : taking you to " + (((Sign) b.getState()).getLine(1)));
} else {
- plugin.getLogger().warning("[TweakcraftUtils] Found more than one TweakTravel sign");
+ plugin.getLogger().warning("Found more than one TweakTravel sign");
Location lold = signBlock.getLocation();
Location lnew = b.getLocation();
- plugin.getLogger().warning("[TweakcraftUtils] original location : " + lold);
- plugin.getLogger().warning("[TweakcraftUtils] other : " + lnew);
+ plugin.getLogger().warning("original location : " + lold);
+ plugin.getLogger().warning("other : " + lnew);
p.sendMessage(ChatColor.RED + "WARNING: Found more than one TweakTravel sign!");
}
10 src/com/guntherdw/bukkit/tweakcraft/Packages/ItemDB.java
View
@@ -56,18 +56,18 @@ public void loadDataBase() {
Integer stacks = Integer.parseInt(split[3]);
itemmap.put(itemname, new Item(itemnr, damage, stacks));
} catch (Throwable e) {
- plugin.getLogger().info("[TweakcraftUtils] Item error at line " + line);
+ plugin.getLogger().info("Item error at line " + line);
}
}
line++;
}
} catch (FileNotFoundException e) {
- plugin.getLogger().info("[TweakcraftUtils] Item DB not found!");
- plugin.getLogger().info("[TweakcraftUtils] looked in " + plugin.getDataFolder());
+ plugin.getLogger().info("Item DB not found!");
+ plugin.getLogger().info("looked in " + plugin.getDataFolder());
} catch (IOException e) {
- plugin.getLogger().info("[TweakcraftUtils] Item DB IO error!");
+ plugin.getLogger().info("Item DB IO error!");
}
- plugin.getLogger().info("[TweakcraftUtils] Loaded item DB, " + itemmap.size() + " items found!");
+ plugin.getLogger().info("Loaded item DB, " + itemmap.size() + " items found!");
}
public Item getItem(String name) {
14 src/com/guntherdw/bukkit/tweakcraft/Tools/PermissionsResolver.java
View
@@ -48,9 +48,9 @@ public void init() {
if (!foundPlugin) tryZones();
if (!foundPlugin) tryWEPIF();
if (!foundPlugin) {
- plugin.getLogger().info("[TweakcraftUtils] DinnerPerms found, using that for permissions resolving!");
+ plugin.getLogger().info("DinnerPerms found, using that for permissions resolving!");
resolver = new BukkitPerms(this);
- plugin.getLogger().warning("[TweakcraftUtils] Use this only as a fallback please, install and/or manage a real permissions plugin!");
+ plugin.getLogger().warning("Use this only as a fallback please, install and/or manage a real permissions plugin!");
}
}
@@ -68,7 +68,7 @@ public boolean hasPermission(String world, Player player, String permissionbit)
private void tryZones() {
if(plugin.getConfigHandler().enableZones && plugin.getZones() != null) {
resolver = new ZonesPerms(this, plugin.getZones());
- plugin.getLogger().info("[TweakcraftUtils] Meaglin's Zones found, using that for permissions resolving!");
+ plugin.getLogger().info("Meaglin's Zones found, using that for permissions resolving!");
}
}
@@ -76,7 +76,7 @@ private boolean tryPermissionsEx() {
Plugin p = plugin.getServer().getPluginManager().getPlugin("PermissionsEx");
if (p != null) {
resolver = new PermsEx(this);
- plugin.getLogger().info("[TweakcraftUtils] PermissionsEx found, using that for permissions resolving!");
+ plugin.getLogger().info("PermissionsEx found, using that for permissions resolving!");
return true;
}
return false;
@@ -86,7 +86,7 @@ private boolean tryNijiPerms() {
Plugin p = plugin.getServer().getPluginManager().getPlugin("Permissions");
if (p != null) {
resolver = new NijiPerms(this, ((com.nijikokun.bukkit.Permissions.Permissions) p).getHandler());
- plugin.getLogger().info("[TweakcraftUtils] NijiPermissions found, using that for permissions resolving!");
+ plugin.getLogger().info("NijiPermissions found, using that for permissions resolving!");
return true;
}
return false;
@@ -95,8 +95,8 @@ private boolean tryNijiPerms() {
private boolean tryWEPIF() {
if (plugin.getWorldEdit() != null) {
resolver = new WEPIFPerms(this, plugin.getWorldEdit().getPermissionsResolver());
- plugin.getLogger().info("[TweakcraftUtils] WorldEdit found, using that for permissions resolving!");
- plugin.getLogger().warning("[TweakcraftUtils] Use this only as a fallback please, install and/or manage a real permissions plugin.!");
+ plugin.getLogger().info("WorldEdit found, using that for permissions resolving!");
+ plugin.getLogger().warning("Use this only as a fallback please, install and/or manage a real permissions plugin.!");
return true;
} else {
return false;
47 src/com/guntherdw/bukkit/tweakcraft/TweakcraftUtils.java
View
@@ -18,11 +18,9 @@
package com.guntherdw.bukkit.tweakcraft;
-// import com.bergerkiller.bukkit.nolagg.NoLagg;
-
import com.ensifera.animosity.craftirc.CraftIRC;
import com.ensifera.animosity.craftirc.EndPoint;
-// import com.guntherdw.bukkit.tcutilsclientbridge.TCUtilsClientBridgePlugin;
+
import com.guntherdw.bukkit.tweakcraft.Chat.ChatHandler;
import com.guntherdw.bukkit.tweakcraft.Chat.ChatMode;
import com.guntherdw.bukkit.tweakcraft.Commands.CommandHandler;
@@ -42,10 +40,14 @@
import com.guntherdw.bukkit.tweakcraft.Tools.TamerTool;
import com.guntherdw.bukkit.tweakcraft.Util.TeleportHistory;
import com.guntherdw.bukkit.tweakcraft.Worlds.WorldManager;
+
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
+
import com.zones.Zones;
+
import de.diddiz.LogBlock.LogBlock;
+
import org.bukkit.ChatColor;
import org.bukkit.World;
import org.bukkit.command.Command;
@@ -60,7 +62,6 @@
import javax.persistence.PersistenceException;
import java.io.*;
import java.util.*;
-import java.util.logging.Logger;
/**
@@ -101,7 +102,6 @@
private Set<String> donottplist;
private List<String> MOTDLines;
- protected final Logger log = Logger.getLogger("Minecraft");
protected PluginDescriptionFile pdfFile = null;
private Set<Player> cuiPlayers;
@@ -323,9 +323,9 @@ public void setupDatabase() {
if (configHandler.useTweakBotSeen)
getDatabase().find(PlayerHistoryInfo.class).findRowCount();
} catch (PersistenceException ex) {
- log.info("[TweakcraftUtils] Installing database for " + getDescription().getName() + " due to first time usage");
+ this.getLogger().info("Installing database for " + getDescription().getName() + " due to first time usage");
if (configHandler.useTweakBotSeen)
- log.info("[TweakcraftUtils] Also creating the TweakBot !seen helpen table");
+ this.getLogger().info("Also creating the TweakBot !seen helpen table");
installDDL();
}
databaseloaded = true;
@@ -428,11 +428,6 @@ public TweakcraftWorldListener getWorldListener() {
return worldListener;
}
- @Override
- public Logger getLogger() {
- return log;
- }
-
public List<String> getMOTD() {
return MOTDLines;
}
@@ -500,8 +495,8 @@ public void setupCraftIRC() {
circ = (CraftIRC) plugin;
} else {
this.getConfigHandler().enableIRC = false;
- this.getLogger().warning("[TweakcraftUtils] WARNING: Couldn't find CraftIRC, but is enabled in the config.");
- this.getLogger().warning("[TweakcraftUtils] WARNING: Disabling CraftIRC support.");
+ this.getLogger().warning("WARNING: Couldn't find CraftIRC, but is enabled in the config.");
+ this.getLogger().warning("WARNING: Disabling CraftIRC support.");
}
}
}
@@ -516,8 +511,8 @@ public void setupWorldGuard() {
wg = (WorldGuardPlugin) plugin;
} else {
this.getConfigHandler().enableWorldGuard = false;
- this.getLogger().warning("[TweakcraftUtils] WARNING: Couldn't find WorldGuard, but is enabled in the config.");
- this.getLogger().warning("[TweakcraftUtils] WARNING: Disabling WorldGuard support.");
+ this.getLogger().warning("WARNING: Couldn't find WorldGuard, but is enabled in the config.");
+ this.getLogger().warning("WARNING: Disabling WorldGuard support.");
}
}
}
@@ -532,8 +527,8 @@ public void setupZones() {
zones = (Zones) plugin;
} else {
this.getConfigHandler().enableZones = false;
- this.getLogger().warning("[TweakcraftUtils] WARNING: Couldn't find Zones, but is enabled in the config.");
- this.getLogger().warning("[TweakcraftUtils] WARNING: Disabling Zones support.");
+ this.getLogger().warning("WARNING: Couldn't find Zones, but is enabled in the config.");
+ this.getLogger().warning("WARNING: Disabling Zones support.");
}
}
}
@@ -548,8 +543,8 @@ public void setupLogBlock() {
lb = (LogBlock) plugin;
} else {
this.getConfigHandler().enableLogBlock = false;
- this.getLogger().warning("[TweakcraftUtils] WARNING: Couldn't find LogBlock, but is enabled in the config.");
- this.getLogger().warning("[TweakcraftUtils] WARNING: Disabling LogBlock support.");
+ this.getLogger().warning("WARNING: Couldn't find LogBlock, but is enabled in the config.");
+ this.getLogger().warning("WARNING: Disabling LogBlock support.");
}
}
}
@@ -584,9 +579,9 @@ public void reloadMOTD() {
}
motdfilereader.close();
} catch (FileNotFoundException e) {
- log.severe("[TweakcraftUtils] MOTD file not found!");
+ this.getLogger().severe("MOTD file not found!");
} catch (IOException e) {
- log.severe("[TweakcraftUtils] IOException occured while loadign the MOTD file!");
+ this.getLogger().severe("IOException occured while loadign the MOTD file!");
}
}
@@ -682,7 +677,7 @@ public void onEnable() {
playerListener.reloadInvisTable();
worldmanager.setupWorlds();
- log.info("[" + pdfFile.getName() + "] " + pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!");
+ this.getLogger().info("[" + pdfFile.getName() + "] " + pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!");
}
@@ -709,7 +704,7 @@ public EndPoint getLogginEndPoint() {
@Override
public void onDisable() {
instance = null;
- log.info("[" + pdfFile.getName() + "] Shutting down!");
+ this.getLogger().info("[" + pdfFile.getName() + "] Shutting down!");
// this.getDatabase().
}
@@ -727,11 +722,11 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
List<String> argsa = new ArrayList<String>();
// String[] args = new String[];
- int argc = 0;
+ //int argc = 0;
for (String a : unfilteredargs) {
if (a != null && !a.trim().equals("")) {
argsa.add(a);
- argc++;
+ // argc++;
}
}
String[] args = argsa.toArray(new String[argsa.size()]);
6 src/com/guntherdw/bukkit/tweakcraft/Util/TeleportHistory.java
View
@@ -157,13 +157,13 @@ public void addHistory(String playername, Location loc) {
}
public void clearHistory() {
- plugin.getLogger().info("[TweakcraftUtils] Clearing complete TPBack history!");
+ plugin.getLogger().info("Clearing complete TPBack history!");
this.historymap.clear();
this.historyoffset.clear();
}
public void clearFuture(String playername) {
- plugin.getLogger().info("[TweakcraftUtils] Clearing TPBack future for player " + playername + "!");
+ plugin.getLogger().info("Clearing TPBack future for player " + playername + "!");
if (historymap.containsKey(playername) && historyoffset.containsKey(playername)) {
List<Location> loclist = historymap.get(playername);
int size = loclist.size();
@@ -177,7 +177,7 @@ public void clearFuture(String playername) {
}
public void clearHistory(String playername) {
- plugin.getLogger().info("[TweakcraftUtils] Clearing TPBack history for player " + playername + "!");
+ plugin.getLogger().info("Clearing TPBack history for player " + playername + "!");
if (historymap.containsKey(playername)) {
historymap.remove(playername);
}
23 src/com/guntherdw/bukkit/tweakcraft/Worlds/Generators/FlatGen.java
View
@@ -22,7 +22,6 @@
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
-import org.bukkit.WorldType;
import org.bukkit.generator.ChunkGenerator;
import java.util.Random;
@@ -79,28 +78,6 @@ public byte getToplayer() {
return toplayer;
}
- /* @Override
- public byte[] generate(World world, Random random, int cx, int cz) {
- // byte[] result = new byte[32768];
- byte[] result = new byte[65536];
- for (int x = 0; x < 16; x++) {
- for (int z = 0; z < 16; z++) {
- for (int y = 0; y < 128; y++) {
- if (y == 0 && bedrockBottom)
- result[(x * 16 + z) * 256 + y] = (byte) 7;
- else if (y < height)
- result[(x * 16 + z) * 256 + y] = normal;
- else if (y == height)
- result[(x * 16 + z) * 256 + y] = toplayer;
- else
- result[(x * 16 + z) * 256 + y] = (byte) 0;
- }
- // result[(x * 16 + z) * 128 + y]
- }
- }
- return result;
- } */
-
@Override
@Deprecated
public byte[] generate(World world, Random random, int x, int z) {
18 src/com/guntherdw/bukkit/tweakcraft/Worlds/Generators/PlotGen.java
View
@@ -107,9 +107,6 @@ boolean isDefiniteBorder(int x, int z) {
int realChunkX = cx << 4;
int realChunkZ = cz << 4;
- /* System.out.println("cx : "+cx);
- System.out.println("cz : "+cz); */
-
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
for (int y = 0; y < maxHeight; y++) {
@@ -134,21 +131,6 @@ else if (y == height)
}
}
- /* for (int x = 0; x < 16; x++) {
- for (int z = 0; z < 16; z++) {
- for (int y = 0; y < maxHeight; y++) {
- if (y == 0 && bedrockBottom)
- setBlock(result, x, y, z, (byte) 7);
- else if (y < height)
- setBlock(result, x, y, z, normal);
- else if (y == height)
- setBlock(result, x, y, z, toplayer);
- else
- setBlock(result, x, y, z, (byte) 0);
- }
- }
- } */
-
// return null; // Default - returns null, which drives call to generate()
return result;
}
18 src/com/guntherdw/bukkit/tweakcraft/Worlds/TweakWorld.java
View
@@ -138,8 +138,8 @@ public void setDurabilityEnabled(boolean state) {
if (wm.getPlugin().getConfigHandler().enablemod_InfDura)
world.setToolDurability(state);
else {
- wm.getPlugin().getLogger().severe("[TweakcraftUtils] Tried to enable/disable tool durability for world " + world.getName() + ",");
- wm.getPlugin().getLogger().severe("[TweakcraftUtils] But either your Bukkit is not modded, or you forgot to enable it in the config!");
+ wm.getPlugin().getLogger().severe("Tried to enable/disable tool durability for world " + world.getName() + ",");
+ wm.getPlugin().getLogger().severe("But either your Bukkit is not modded, or you forgot to enable it in the config!");
}
}
@@ -201,8 +201,8 @@ public void resolvePluginChunkGenerator(String chunkGen) {
String[] split = chunkGen.split(":");
Plugin plugin = wm.getPlugin().getServer().getPluginManager().getPlugin(split[0]);
if (plugin == null) {
- wm.getPlugin().getLogger().severe("[TweakcraftUtils] Chunkgenerator error for " + world.getName() + ",");
- wm.getPlugin().getLogger().severe("[TweakcraftUtils] Couldn't find plugin with name " + split[0] + "!");
+ wm.getPlugin().getLogger().severe("Chunkgenerator error for " + world.getName() + ",");
+ wm.getPlugin().getLogger().severe("Couldn't find plugin with name " + split[0] + "!");
this.enabled = false;
return;
}
@@ -243,7 +243,7 @@ public void loadWorld(WorldManager wm, String foldername, org.bukkit.World.Envir
worldName = foldername.trim();
WorldCreator worldCreator = new WorldCreator(worldName);
if ((world = wm.getPlugin().getServer().getWorld(worldName)) == null) {
- // wm.getPlugin().getLogger().info("[TweakcraftUtils] Creating new world!");
+ // wm.getPlugin().getLogger().info("Creating new world!");
environment = env;
if (chunkgen != null)
worldCreator.generator(chunkgen);
@@ -269,11 +269,11 @@ else if (chunkGenClass != null) {
worldCreator.generator(cg);
}
} else {
- this.wm.getPlugin().getLogger().info("[TweakcraftUtils] Error in world " + worldName + "! " + chunkGenClass + " isn't a Chunk Generator class!");
+ this.wm.getPlugin().getLogger().info("Error in world " + worldName + "! " + chunkGenClass + " isn't a Chunk Generator class!");
}
}
} catch (ClassNotFoundException e) {
- this.wm.getPlugin().getLogger().info("[TweakcraftUtils] Error in world " + worldName + "! Can't find class with name " + chunkGenClass);
+ this.wm.getPlugin().getLogger().info("Error in world " + worldName + "! Can't find class with name " + chunkGenClass);
enabled = false;
} catch (InstantiationException e) {
enabled = false;
@@ -285,7 +285,7 @@ else if (chunkGenClass != null) {
}
} else {
- // wm.getPlugin().getLogger().info("[TweakcraftUtils] This world already existed!");
+ // wm.getPlugin().getLogger().info("This world already existed!");
environment = world.getEnvironment();
}
@@ -475,7 +475,7 @@ public YamlConfiguration getConfiguration() {
f.mkdirs();
f.createNewFile();
} catch (IOException e) {
- wm.getPlugin().getLogger().info("[TweakcraftUtils] Can't create world's config file!");
+ wm.getPlugin().getLogger().info("Can't create world's config file!");
return null;
}
}
46 src/com/guntherdw/bukkit/tweakcraft/Worlds/WorldManager.java
View
@@ -82,7 +82,7 @@ public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) {
if (split.length > 2) fg.setNormal(Byte.parseByte(split[2]));
if (split.length > 3) fg.setToplayer(Byte.parseByte(split[3]));
if (split.length > 4) fg.setBedrockBottom(Boolean.parseBoolean(split[4]));
- plugin.getLogger().info("[TweakcraftUtils] Utilising FlatGen for world " + worldName);
+ plugin.getLogger().info("Utilising FlatGen for world " + worldName);
return fg;
} else if (split[0].equalsIgnoreCase("plotgen")) {
PlotGen fg = new PlotGen();
@@ -91,8 +91,8 @@ public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) {
if (split.length > 3) fg.setToplayer(Byte.parseByte(split[3]));
if (split.length > 4) fg.setBedrockBottom(Boolean.parseBoolean(split[4]));
if (split.length > 5) fg.setPlotSize(Integer.parseInt(split[5]));
- plugin.getLogger().info("[TweakcraftUtils] Utilising PlotGen for world " + worldName);
- plugin.getLogger().info("[TweakcraftUtils] PlotGen PlotSize : " + fg.getPlotSize());
+ plugin.getLogger().info("Utilising PlotGen for world " + worldName);
+ plugin.getLogger().info("PlotGen PlotSize : " + fg.getPlotSize());
// System.out.println("[");
return fg;
}
@@ -118,11 +118,11 @@ public void loadMotd(String worldname) {
iWorld w = worlds.get(worldname);
w.setMOTD(lines.toArray(new String[lines.size()]));
- plugin.getLogger().info("[TweakcraftUtils] Loaded MOTD for world " + worldname + "!");
+ plugin.getLogger().info("Loaded MOTD for world " + worldname + "!");
} catch (FileNotFoundException e) {
- plugin.getLogger().warning("[TweakcraftUtils] Couldn't find MOTD for world " + worldname + "!");
+ plugin.getLogger().warning("Couldn't find MOTD for world " + worldname + "!");
} catch (IOException e) {
- plugin.getLogger().warning("[TweakcraftUtils] Error while reading MOTD for world " + worldname + "!");
+ plugin.getLogger().warning("Error while reading MOTD for world " + worldname + "!");
}
}
@@ -167,10 +167,10 @@ public void setupWorlds() {
if (!netherWorldOnline && globalConfig.getBoolean("worlds.enablenether", false)) {
String netherfolder = globalConfig.getString("worlds.netherfolder", "nether");
if (!netherfolder.equalsIgnoreCase("")) {
- plugin.getLogger().info("[TweakcraftUtils] Loading the netherworld!");
+ plugin.getLogger().info("Loading the netherworld!");
worlds.put(netherfolder, new TweakWorld(this, netherfolder, Environment.NETHER, true));
} else {
- plugin.getLogger().info("[TweakcraftUtils] The nether's folder name can't be empty!");
+ plugin.getLogger().info("The nether's folder name can't be empty!");
}
}
@@ -205,7 +205,7 @@ public void setupWorlds() {
Environment wenv = null;
if (env == null || env.equals("")) {
- plugin.getLogger().info("[TweakcraftUtils] World " + node + " does not have a valid environment definition, using \"normal\"");
+ plugin.getLogger().info("World " + node + " does not have a valid environment definition, using \"normal\"");
wenv = Environment.NORMAL;
} else if (env.equalsIgnoreCase("nether")) {
wenv = Environment.NETHER;
@@ -219,33 +219,33 @@ public void setupWorlds() {
if (wenv == null) {
- plugin.getLogger().info("[TweakcraftUtils] " + env + " isn't a correct environment name!");
+ plugin.getLogger().info(env + " isn't a correct environment name!");
} else {
- plugin.getLogger().info("[TweakcraftUtils] Adding world with name " + node + " and environmenttype " + env + "!");
- plugin.getLogger().info("[TweakcraftUtils] World " + node + " has pvp " + (pvp ? "enabled" : "disabled") + "!");
- plugin.getLogger().info("[TweakcraftUtils] World " + node + " monsters : " + (monsters ? "enabled" : "disabled") + ", animals : " + (animals ? "enabled" : "disabled") + "!");
- if (addnether) plugin.getLogger().info("[TweakcraftUtils] World " + node + " added nether world!");
- if (addtheend) plugin.getLogger().info("[TweakcraftUtils] World " + node + " added the_end world!");
- plugin.getLogger().info("[TweakcraftUtils] World " + node + " Tool Durability : " + (durability ? "enabled" : "disabled"));
- plugin.getLogger().info("[TweakcraftUtils] World " + node + " GameMode : " + (gm != null ? gm.toString().toLowerCase() : "Survival"));
- plugin.getLogger().info("[TweakcraftUtils] World " + node + " Difficulity : " + Difficulty.getByValue(difficulty).name().toLowerCase());
+ plugin.getLogger().info("Adding world with name " + node + " and environmenttype " + env + "!");
+ plugin.getLogger().info("World " + node + " has pvp " + (pvp ? "enabled" : "disabled") + "!");
+ plugin.getLogger().info("World " + node + " monsters : " + (monsters ? "enabled" : "disabled") + ", animals : " + (animals ? "enabled" : "disabled") + "!");
+ if (addnether) plugin.getLogger().info("World " + node + " added nether world!");
+ if (addtheend) plugin.getLogger().info("World " + node + " added the_end world!");
+ plugin.getLogger().info("World " + node + " Tool Durability : " + (durability ? "enabled" : "disabled"));
+ plugin.getLogger().info("World " + node + " GameMode : " + (gm != null ? gm.toString().toLowerCase() : "Survival"));
+ plugin.getLogger().info("World " + node + " Difficulity : " + Difficulty.getByValue(difficulty).name().toLowerCase());
TweakWorld tw = new TweakWorld(this, node, wenv, pvp, monsters, animals, viewdistance, durability, false);
if (difficulty != getDefaultWorld().getDifficulty().getValue())
tw.setDifficulty(difficulty);
if (gm != null) tw.setGameMode(gm);
if (chunkGenClass != null) {
- plugin.getLogger().info("[TweakcraftUtils] World " + node + " is using a custom chunkGenClass using the deprecated method!");
- plugin.getLogger().info("[TweakcraftUtils] Consider using the newer method!");
+ plugin.getLogger().info("World " + node + " is using a custom chunkGenClass using the deprecated method!");
+ plugin.getLogger().info("Consider using the newer method!");
tw.setChunkGenClass(chunkGenClass);
} else if (chunkGen != null) {
- plugin.getLogger().info("[TweakcraftUtils] World " + node + " is using a custom chunkGen!");
+ plugin.getLogger().info("World " + node + " is using a custom chunkGen!");
tw.setChunkGen(chunkGen);
}
if (worldType != null) {
WorldType type = WorldType.valueOf(worldType.toUpperCase());
if (type != null) {
- plugin.getLogger().info("[TweakcraftUtils] World " + node + " has worldType "+type.getName().toLowerCase()+"!");
+ plugin.getLogger().info("World " + node + " has worldType "+type.getName().toLowerCase()+"!");
tw.setWorldType(type);
}
}
@@ -271,7 +271,7 @@ public void setupWorlds() {
this.loadMotd(tw.getName());
}
} else {
- plugin.getLogger().info("[TweakcraftUtils] World with name " + node + " already exists!");
+ plugin.getLogger().info("World with name " + node + " already exists!");
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.