Reorganized a lot of code. Added tons of comments. Change how commands are added. Encapsulated commands into their own functions. Modified some commands. Recoded others. Added personalized /who that shows name colors.

This commit is contained in:
unknown 2010-11-28 01:12:23 -06:00
parent 96ed2b100b
commit bfb48af50b
2 changed files with 0 additions and 264 deletions

View File

@ -1,134 +0,0 @@
//Contains all the java methods for vminecraft
public class other {
public static other gmsg;
public static other gmsg(String msg){
for (Player p : etc.getServer().getPlayerList()) {
if (p != null) {
p.sendMessage(msg);
}
}
return gmsg;
}
public static boolean lengthCheck(String str)
{
int length = 0;
for(int x = 0; x<str.length(); x++)
{
if("i;,.:|!".indexOf(str.charAt(x)) != -1)
{
length+=2;
}
else if("l'".indexOf(str.charAt(x)) != -1)
{
length+=3;
}
else if("tI[]".indexOf(str.charAt(x)) != -1)
{
length+=4;
}
else if("kf{}<>\"*()".indexOf(str.charAt(x)) != -1)
{
length+=5;
}
else if("hequcbrownxjmpsvazydgTHEQUCKBROWNFXJMPSVLAZYDG1234567890#\\/?$%-=_+&".indexOf(str.charAt(x)) != -1)
{
length+=6;
}
else if("@~".indexOf(str.charAt(x)) != -1)
{
length+=7;
}
else if(str.charAt(x)==' ')
{
length+=4;
}
}
if(length<=316)
{
return true;
} else { return false; }
}
public static String colorChange(char colour)
{
String color = "";
switch(colour)
{
case '0':
color = Colors.Black;
break;
case '1':
color = Colors.Navy;
break;
case '2':
color = Colors.Green;
break;
case '3':
color = Colors.Blue;
break;
case '4':
color = Colors.Red;
break;
case '5':
color = Colors.Purple;
break;
case '6':
color = Colors.Gold;
break;
case '7':
color = Colors.LightGray;
break;
case '8':
color = Colors.Gray;
break;
case '9':
color = Colors.DarkPurple;
break;
case 'a':
color = Colors.LightGreen;
break;
case 'b':
color = Colors.LightBlue;
break;
case 'c':
color = Colors.Rose;
break;
case 'd':
color = Colors.LightPurple;
break;
case 'e':
color = Colors.Yellow;
break;
case 'f':
color = Colors.White;
break;
case 'A':
color = Colors.LightGreen;
break;
case 'B':
color = Colors.LightBlue;
break;
case 'C':
color = Colors.Rose;
break;
case 'D':
color = Colors.LightPurple;
break;
case 'E':
color = Colors.Yellow;
break;
case 'F':
color = Colors.White;
break;
default:
color = Colors.White;
break;
}
return color;
}
}

View File

@ -1,130 +0,0 @@
import java.io.*;
import java.util.logging.Level;
import java.util.logging.Logger;
public class settings {
private final static Object syncLock = new Object();
protected static final Logger log = Logger.getLogger("Minecraft");
private static volatile settings instance;
static boolean toggle = true;
private boolean adminChat = false;
private boolean greentext = false;
private boolean FFF = false;
private boolean quakeColors = false;
private boolean cmdFabulous = false;
private boolean cmdPromote = false;
private boolean cmdDemote = false;
private boolean cmdWhoIs = false;
private boolean cmdRules = false;
private boolean cmdMasstp = false;
private boolean cmdTp = false;
private boolean cmdTphere = false;
private boolean globalmessages = false;
private boolean cmdSay = false;
private boolean cmdEzModo = false;
private PropertiesFile properties;
String file = "vminecraft.properties";
public String rules[] = null;
public void loadSettings() throws IOException
{
File theDir = new File("vminecraft.properties");
if(!theDir.exists())
{
String location = "vminecraft.properties";
properties = new PropertiesFile("vminecraft.properties");
FileWriter writer = null;
try {
writer = new FileWriter(location);
writer.write("#This plugin is modular\r\n");
writer.write("#Turn any features you don't want to false and they won't be running\r\n");
writer.write("#If you edit this file and save it, then use /reload it will reload the settings\r\n");
writer.write("greentext=true\r\n");
writer.write("quakeColors=true\r\n");
writer.write("cmdTphere=true\r\n");
writer.write("cmdFabulous=true\r\n");
writer.write("cmdWhoIs=true\r\n");
writer.write("cmdPromote=true\r\n");
writer.write("cmdDemote=true\r\n");
writer.write("cmdMasstp=true\r\n");
writer.write("cmdSay=true\r\n");
writer.write("cmdTp=true\r\n");
writer.write("cmdRules=true\r\n");
writer.write("globalmessages=true\r\n");
writer.write("FFF=true\r\n");
writer.write("adminchat=true\r\n");
writer.write("cmdEzModo=true\r\n");
writer.write("rules=Rules@#1: No griefing@#2: No griefing\r\n");
} catch (Exception e) {
log.log(Level.SEVERE, "Exception while creating " + location, e);
} finally {
try {
if (writer != null) {
writer.close();
}
} catch (IOException e) {
log.log(Level.SEVERE, "Exception while closing writer for " + location, e);
}
}
} else {
properties = new PropertiesFile("vminecraft.properties");
properties.load();
}
try {
adminChat = properties.getBoolean("adminchat",true);
greentext = properties.getBoolean("greentext",true);
FFF = properties.getBoolean("FFF",true);
quakeColors = properties.getBoolean("quakeColors",true);
cmdFabulous = properties.getBoolean("cmdFabulous",true);
cmdPromote = properties.getBoolean("cmdPromote",true);
cmdDemote = properties.getBoolean("cmdDemote",true);
cmdWhoIs = properties.getBoolean("cmdWhoIs",true);
cmdRules = properties.getBoolean("cmdRules",true);
cmdTp = properties.getBoolean("cmdTp",true);
cmdMasstp = properties.getBoolean("cmdMasstp",true);
cmdTphere = properties.getBoolean("cmdTphere",true);
globalmessages = properties.getBoolean("globalmessages",true);
cmdSay = properties.getBoolean("cmdSay",true);
cmdEzModo = properties.getBoolean("cmdEzModo",true);
rules = properties.getString("rules", "").split("@");
log.log(Level.INFO, "vminecraft plugin successfully loaded");
}
catch (Exception e)
{
log.log(Level.SEVERE, "vminecraft Error: ERROR LOADING PROPERTIES FILE");
}
}
public boolean adminchat() {return adminChat;}
public boolean greentext() {return greentext;}
public boolean FFF() {return FFF;}
public boolean quakeColors() {return quakeColors;}
public boolean cmdFabulous() {return cmdFabulous;}
public boolean cmdPromote() {return cmdPromote;}
public boolean cmdDemote() {return cmdDemote;}
public boolean cmdWhoIs() {return cmdWhoIs;}
public boolean cmdTp() {return cmdTp;}
public boolean cmdTphere() {return cmdTphere;}
public boolean cmdSay() {return cmdSay;}
public boolean cmdRules() {return cmdRules;}
public boolean globalmessages() {return globalmessages;}
public boolean cmdMasstp() {return cmdMasstp;}
public boolean cmdEzModo() {return cmdEzModo;}
public static settings getInstance() {
if (instance == null) {
instance = new settings();
}
return instance;
}
//Will return the rules
public String[] getRules() {
return rules;
}
}