TrapAlice's latest changes. Appears to have fixed a settings bug and changed logging to use log.log instead of id.a.log. Which is fine but it means we have to import our own logging system now.

Signed-off-by: nossr50 <nossr50@gmail.com>
This commit is contained in:
nossr50 2010-11-16 18:49:08 -08:00
parent 5c545f2b4f
commit 10c2a90efc
2 changed files with 19 additions and 18 deletions

View File

@ -1,5 +1,4 @@
import java.io.FileWriter; import java.io.*;
import java.io.IOException;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -28,8 +27,8 @@ public class settings {
public void loadSettings() public void loadSettings()
{ {
File theDir = new File("vminecraft.properties");
if(properties == null) if(!theDir.exists())
{ {
String location = "vminecraft.properties"; String location = "vminecraft.properties";
properties = new PropertiesFile("vminecraft.properties"); properties = new PropertiesFile("vminecraft.properties");
@ -68,6 +67,7 @@ public class settings {
} else { } else {
properties = new PropertiesFile("vminecraft.properties");
properties.load(); properties.load();
} }
@ -87,7 +87,7 @@ public class settings {
globalmessages = properties.getBoolean("globalmessages",true); globalmessages = properties.getBoolean("globalmessages",true);
cmdSay = properties.getBoolean("cmdSay",true); cmdSay = properties.getBoolean("cmdSay",true);
rules = properties.getString("rules", "").split("@"); rules = properties.getString("rules", "").split("@");
id.a.log(Level.INFO, "vminecraft plugin successfully loaded"); log.log(Level.INFO, "vminecraft plugin successfully loaded");
} }
catch (Exception e) catch (Exception e)

View File

@ -1,15 +1,16 @@
//Vminecraft plugin by nossr50 & TrapAlice //Vminecraft plugin by nossr50 & TrapAlice
import java.util.logging.Level; //Need this to use LEVEL.INFO etc import java.util.logging.Level;
import java.util.logging.Logger;
public class vminecraftListener extends PluginListener { public class vminecraftListener extends PluginListener {
protected static final Logger log = Logger.getLogger("Minecraft");
public void disable() { public void disable() {
id.a.log(Level.INFO, "vminecraft disabled"); log.log(Level.INFO, "vminecraft disabled");
} }
public void enable() { public void enable() {
settings.getInstance().loadSettings(); //Load the settings files settings.getInstance().loadSettings(); //Load the settings files
id.a.log(Level.INFO, "vminecraft enabled"); log.log(Level.INFO, "vminecraft enabled");
} }
public boolean onChat(Player player, String message){ public boolean onChat(Player player, String message){
@ -33,13 +34,13 @@ import java.util.logging.Level; //Need this to use LEVEL.INFO etc
} }
} }
} }
id.a.log(Level.INFO, "@"+temp2+message); //So you can read adminchat from the server console log.log(Level.INFO, "@"+temp2+message); //So you can read adminchat from the server console
return true; return true;
} }
//Greentext //Greentext
if (settings.getInstance().greentext()&&message.startsWith(">")) { if (settings.getInstance().greentext()&&message.startsWith(">")) {
id.a.log(Level.INFO, "<"+player.getName()+"> "+message); log.log(Level.INFO, "<"+player.getName()+"> "+message);
message = Colors.LightGreen + message; message = Colors.LightGreen + message;
message2 = temp2 + message; message2 = temp2 + message;
other.gmsg(message2); other.gmsg(message2);
@ -47,7 +48,7 @@ import java.util.logging.Level; //Need this to use LEVEL.INFO etc
} }
//FFF //FFF
if (settings.getInstance().FFF()&&message.startsWith("FFF")) { if (settings.getInstance().FFF()&&message.startsWith("FFF")) {
id.a.log(Level.INFO, "<"+player.getName()+"> "+message); log.log(Level.INFO, "<"+player.getName()+"> "+message);
message = Colors.Red + message; message = Colors.Red + message;
message2 = temp2 + message; message2 = temp2 + message;
other.gmsg(message2); other.gmsg(message2);
@ -67,7 +68,7 @@ import java.util.logging.Level; //Need this to use LEVEL.INFO etc
temp+=message.charAt(x); temp+=message.charAt(x);
} }
} }
id.a.log(Level.INFO, "<"+player.getName()+"> "+message); log.log(Level.INFO, "<"+player.getName()+"> "+message);
message = temp2 + temp + " "; message = temp2 + temp + " ";
for (Player p : etc.getServer().getPlayerList()) { for (Player p : etc.getServer().getPlayerList()) {
if (p != null) { if (p != null) {
@ -113,7 +114,7 @@ import java.util.logging.Level; //Need this to use LEVEL.INFO etc
} }
if (playerTarget != null) { if (playerTarget != null) {
id.a.log(Level.INFO, player.getName() + " teleported to " + playerTarget.getName()); log.log(Level.INFO, player.getName() + " teleported to " + playerTarget.getName());
player.teleportTo(playerTarget); player.teleportTo(playerTarget);
return true; return true;
} else { } else {
@ -141,7 +142,7 @@ import java.util.logging.Level; //Need this to use LEVEL.INFO etc
} }
if (playerTarget != null) { if (playerTarget != null) {
id.a.log(Level.INFO, player.getName() + " teleported " + player.getName() + " to their self."); log.log(Level.INFO, player.getName() + " teleported " + player.getName() + " to their self.");
playerTarget.teleportTo(player); playerTarget.teleportTo(player);
} else { } else {
player.sendMessage(Colors.Rose + "Can't find user " + split[1] + "."); player.sendMessage(Colors.Rose + "Can't find user " + split[1] + ".");
@ -195,7 +196,7 @@ import java.util.logging.Level; //Need this to use LEVEL.INFO etc
int counter=0; int counter=0;
if(other.lengthCheck(temp2)) if(other.lengthCheck(temp2))
{ {
id.a.log(Level.INFO, player.getName()+" fabulously said \""+ str+"\""); log.log(Level.INFO, player.getName()+" fabulously said \""+ str+"\"");
for(int x=0; x<str.length(); x++) for(int x=0; x<str.length(); x++)
{ {
temp+=rainbow[counter]+str.charAt(x); temp+=rainbow[counter]+str.charAt(x);
@ -271,7 +272,7 @@ import java.util.logging.Level; //Need this to use LEVEL.INFO etc
else{ else{
player.sendMessage(Colors.Rose + "Player not found"); player.sendMessage(Colors.Rose + "Player not found");
} }
id.a.log(Level.INFO, "Command used by " + player + " " + split[0] +" "+split[1]+" "); log.log(Level.INFO, "Command used by " + player + " " + split[0] +" "+split[1]+" ");
} }
} }
//Demote //Demote
@ -323,7 +324,7 @@ import java.util.logging.Level; //Need this to use LEVEL.INFO etc
else{ else{
player.sendMessage(Colors.Rose + "Player not found"); player.sendMessage(Colors.Rose + "Player not found");
} }
id.a.log(Level.INFO, "Command used by " + player + " " + split[0] +" "+split[1]+" "); log.log(Level.INFO, "Command used by " + player + " " + split[0] +" "+split[1]+" ");
return true; return true;
} }
* *