Freeze now uses playerSend instead of gmsg. Using say from console now logs correctly. Using stop from console now has a log. Masstp'd users can now tpback properly. Minor changes to the settings file. Possible onChat hook error fix.

This commit is contained in:
nossr50 2011-01-10 11:18:38 -08:00
parent ce6c242cf2
commit 03f73a0353
4 changed files with 106 additions and 73 deletions

View File

@ -272,10 +272,21 @@ private static HashMap<String, Player> hidden = new HashMap<String, Player>();
} }
} }
public static int party(Player player, String[] args){ public static int party(Player player, String[] args){
if(vUsers.getProfile(player).inParty()){ if(vUsers.getProfile(player).inParty() && args.length > 1){
player.sendMessage(Colors.Red + "You are already in a party, use /pquit to leave it"); player.sendMessage(Colors.Red + "You are already in a party, use /pquit to leave it");
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
if(vUsers.getProfile(player).inParty()){
int x = 0;
String partymembers[] = null;
for(Player p : etc.getServer().getPlayerList()){
if(vmc.inSameParty(player, p)){
partymembers[x] = p.getName();
x++;
}
}
player.sendMessage(Colors.Green + "Party Members: " + partymembers);
}
if(args[0] != null) { if(args[0] != null) {
vUsers.getProfile(player).setParty(args[0]); vUsers.getProfile(player).setParty(args[0]);
player.sendMessage(Colors.DarkPurple + "Party set to " + args[0]); player.sendMessage(Colors.DarkPurple + "Party set to " + args[0]);
@ -338,25 +349,27 @@ private static HashMap<String, Player> hidden = new HashMap<String, Player>();
public static int freeze(Player player, String[] args){ public static int freeze(Player player, String[] args){
if(player.canUseCommand("/freeze") && vConfig.getInstance().freeze()){ if(player.canUseCommand("/freeze") && vConfig.getInstance().freeze()){
if (args.length < 1){ if (args.length < 1){
vChat.gmsg(Colors.Rose + "Usage is /freeze [Player]"); player.sendMessage(Colors.Rose + "Usage is /freeze [Player]");
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
Player other = etc.getServer().matchPlayer(args[0]); Player other = etc.getServer().matchPlayer(args[0]);
if (other == null) if (other == null)
{ {
vChat.gmsg(Colors.Rose + "The player you specified could not be found"); player.sendMessage(Colors.Rose + "The player you specified could not be found");
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
if(player != other && other.hasControlOver(player)){ if(player != other && other.hasControlOver(player)){
vChat.gmsg(Colors.Rose + "The player you specified has a higher rank than you"); player.sendMessage(Colors.Rose + "The player you specified has a higher rank than you");
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
if(vConfig.getInstance().isFrozen(other.getName())){ if(vConfig.getInstance().isFrozen(other.getName())){
vConfig.getInstance().removeFrozen(other.getName()); vConfig.getInstance().removeFrozen(other.getName());
if(!vUsers.getProfile(player).isSilent())
vChat.gmsg(player.getName() + Colors.Blue + " has unfrozen " + other.getName()); vChat.gmsg(player.getName() + Colors.Blue + " has unfrozen " + other.getName());
return EXIT_SUCCESS; return EXIT_SUCCESS;
} else { } else {
vConfig.getInstance().addFrozen(other.getName()); vConfig.getInstance().addFrozen(other.getName());
if(!vUsers.getProfile(player).isSilent())
vChat.gmsg(player.getName() + Colors.Blue + " has frozen " + other.getName()); vChat.gmsg(player.getName() + Colors.Blue + " has frozen " + other.getName());
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
@ -1234,6 +1247,19 @@ private static HashMap<String, Player> hidden = new HashMap<String, Player>();
for (Player p : etc.getServer().getPlayerList()) { for (Player p : etc.getServer().getPlayerList()) {
if (!p.hasControlOver(player)) { if (!p.hasControlOver(player)) {
p.teleportTo(player); p.teleportTo(player);
double x = player.getLocation().x;
double y = player.getLocation().y;
double z = player.getLocation().z;
String x2 = Double.toString(x);
String y2 = Double.toString(y);
String z2 = Double.toString(z);
String xyz = x2+","+y2+","+z2;
vUsers.getProfile(p).setTpback(xyz);
if(p.canUseCommand("/tpback"))
{
p.sendMessage(Colors.DarkPurple + "Your previous location has been stored");
p.sendMessage(Colors.DarkPurple + "Use /tpback to return");
}
} }
} }
//Inform the user that the command has executed successfully //Inform the user that the command has executed successfully
@ -1313,7 +1339,6 @@ private static HashMap<String, Player> hidden = new HashMap<String, Player>();
{ {
//Make sure the user has access to the command //Make sure the user has access to the command
if(!player.canUseCommand("/reload")) return EXIT_FAIL; if(!player.canUseCommand("/reload")) return EXIT_FAIL;
vConfig.getInstance().loadSettings(); vConfig.getInstance().loadSettings();
return EXIT_FAIL; return EXIT_FAIL;
} }

View File

@ -83,72 +83,72 @@ public class vConfig {
try { try {
writer = new FileWriter(location); writer = new FileWriter(location);
writer.append("#This plugin is modular\r\n"); writer.append("#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.append("#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.append("#If you edit this file and save it, then use /reload it will reload the settings\r\n");
writer.write("#Chat Options\r\n"); writer.append("#Chat Options\r\n");
writer.write("#Group prefix colors apply to player brackets\r\n"); writer.append("#Group prefix colors apply to player brackets\r\n");
writer.write("groupcoloredbrackets=true\r\n"); writer.append("groupcoloredbrackets=true\r\n");
writer.write("#Allows the use of color codes following ^ symbol\r\n"); writer.append("#Allows the use of color codes following ^ symbol\r\n");
writer.write("ColoredChat=true\r\n"); writer.append("ColoredChat=true\r\n");
writer.write("#Require per player permission for quakecolors\r\n"); writer.append("#Require per player permission for quakecolors\r\n");
writer.write("colorsrequirepermissions=false\r\n"); writer.append("colorsrequirepermissions=false\r\n");
writer.write("#use /coloruse to give players permission if this is enabled\r\n"); writer.append("#use /coloruse to give players permission if this is enabled\r\n");
writer.write("#Text following a > will be colored green to mimic quoting of popular internet message boards\r\n"); writer.append("#Text following a > will be colored green to mimic quoting of popular internet message boards\r\n");
writer.write("QuotesAreGreen=true\r\n"); writer.append("QuotesAreGreen=true\r\n");
writer.write("#Turns any chat message starting with FFF automagically blood red\r\n"); writer.append("#Turns any chat message starting with FFF automagically blood red\r\n");
writer.write("FFF=true\r\n"); writer.append("FFF=true\r\n");
writer.write("\r\n"); writer.append("\r\n");
writer.write("#Admin Settings\r\n"); writer.append("#Admin Settings\r\n");
writer.write("#Enables or disables players spawning to their home location\r\n"); writer.append("#Enables or disables players spawning to their home location\r\n");
writer.write("playerspawn=true\r\n"); writer.append("playerspawn=true\r\n");
writer.write("#Enables or disables the admin only chat\r\n"); writer.append("#Enables or disables the admin only chat\r\n");
writer.write("adminchat=true\r\n"); writer.append("adminchat=true\r\n");
writer.write("#Lets non admins use admin chat if they have the /adminchat command permission\r\n"); writer.append("#Lets non admins use admin chat if they have the /adminchat command permission\r\n");
writer.write("/adminchat=true\r\n"); writer.append("/adminchat=true\r\n");
writer.write("#Enables overriding of regular /tp and /tphere to make it so you can only teleport to players with lower permissions, and only bring players of lower permissions to you\r\n"); writer.append("#Enables overriding of regular /tp and /tphere to make it so you can only teleport to players with lower permissions, and only bring players of lower permissions to you\r\n");
writer.write("/tp=true\r\n"); writer.append("/tp=true\r\n");
writer.write("/tphere=true\r\n"); writer.append("/tphere=true\r\n");
writer.write("#Mass Tp uses the same concept, anyone with this command only brings those with lower permissions to themselves\r\n"); writer.append("#Mass Tp uses the same concept, anyone with this command only brings those with lower permissions to themselves\r\n");
writer.write("/masstp=true\r\n"); writer.append("/masstp=true\r\n");
writer.write("\r\n"); writer.append("\r\n");
writer.write("#Server Settings\r\n"); writer.append("#Server Settings\r\n");
writer.write("#Enables or Disables the following commands, give groups/users permissions to use these commands for them to work\r\n"); writer.append("#Enables or Disables the following commands, give groups/users permissions to use these commands for them to work\r\n");
writer.write("/fabulous=true\r\n"); writer.append("/fabulous=true\r\n");
writer.write("/prefix=true\r\n"); writer.append("/prefix=true\r\n");
writer.write("/freeze=true\r\n"); writer.append("/freeze=true\r\n");
writer.write("/suffix=true\r\n"); writer.append("/suffix=true\r\n");
writer.write("/ignore=true\r\n"); writer.append("/ignore=true\r\n");
writer.write("/colors=true\r\n"); writer.append("/colors=true\r\n");
writer.write("/whois=true\r\n"); writer.append("/whois=true\r\n");
writer.write("/nick=true\r\n"); writer.append("/nick=true\r\n");
writer.write("/who=true\r\n"); writer.append("/who=true\r\n");
writer.write("/promote=true\r\n"); writer.append("/promote=true\r\n");
writer.write("/demote=true\r\n"); writer.append("/demote=true\r\n");
writer.write("/say=true\r\n"); writer.append("/say=true\r\n");
writer.write("/rules=true\r\n"); writer.append("/rules=true\r\n");
writer.write("/suicide=true\r\n"); writer.append("/suicide=true\r\n");
writer.write("/ezmodo=true\r\n"); writer.append("/ezmodo=true\r\n");
writer.write("#Global Messages\r\n"); writer.append("#Global Messages\r\n");
writer.write("#Enable or Disable sending announcements about sensitive commands to the entire server\r\n"); writer.append("#Enable or Disable sending announcements about sensitive commands to the entire server\r\n");
writer.write("globalmessages=true\r\n"); writer.append("globalmessages=true\r\n");
writer.write("#Adding player names to this list will have them start off in ezmodo\r\n"); writer.append("#Adding player names to this list will have them start off in ezmodo\r\n");
writer.write("ezModo=\r\n"); writer.append("ezModo=\r\n");
writer.write("#Stop fire from spreading\r\n"); writer.append("#Stop fire from spreading\r\n");
writer.write("stopFire=false\r\n"); writer.append("stopFire=false\r\n");
writer.write("#Stop lava from spreading fire"); writer.append("#Stop lava from spreading fire");
writer.write("lavaspread=false"); writer.append("lavaspread=false");
writer.write("#Blocks disabled from fire"); writer.append("#Blocks disabled from fire");
writer.write("fireblocks="); writer.append("fireblocks=");
writer.write("\r\n"); writer.append("\r\n");
writer.write("#Organize your player ranks from lowest to highest.\r\n"); writer.append("#Organize your player ranks from lowest to highest.\r\n");
writer.write("ranks=\r\n"); writer.append("ranks=\r\n");
writer.write("#Write the rules to be shown when /rules is used here, it works just like the MOTD does\r\n"); writer.append("#Write the rules to be shown when /rules is used here, it works just like the MOTD does\r\n");
writer.write("rules=Rules@#1: No griefing@#2: No griefing\r\n"); writer.append("rules=Rules@#1: No griefing@#2: No griefing\r\n");
writer.write("#The Random Death messages, seperate them by comma. All death messages start with the player name and a space.\r\n"); writer.append("#The Random Death messages, seperate them by comma. All death messages start with the player name and a space.\r\n");
writer.write("deathMessages=is no more,died horribly,went peacefully\r\n"); writer.append("deathMessages=is no more,died horribly,went peacefully\r\n");
writer.write("#Enable whether or not players can toggle party chat"); writer.append("#Enable whether or not players can toggle party chat");
writer.write("partychat=true"); writer.append("partychat=true");
writer.write("hiddendistance=1024"); writer.append("hiddendistance=1024");
} catch (Exception e) { } catch (Exception e) {
log.log(Level.SEVERE, "Exception while creating " + location, e); log.log(Level.SEVERE, "Exception while creating " + location, e);
} finally { } finally {

View File

@ -15,12 +15,14 @@ public class vListener extends PluginListener {
if(split.length > 1){ if(split.length > 1){
String args = " " + etc.combineSplit(1, split, " "); String args = " " + etc.combineSplit(1, split, " ");
vChat.gmsg(server + " " + args); vChat.gmsg(server + " " + args);
log.log(Level.INFO, "[Server] " + args);
return true; return true;
} }
return false; return false;
} }
if(split[0].equalsIgnoreCase("stop")) if(split[0].equalsIgnoreCase("stop"))
vChat.gmsg(server + " shutting down the server"); vChat.gmsg(server + " shutting down the server");
log.log(Level.INFO, "[Server] " + "shutting down the server");
return false; return false;
} }

View File

@ -1,4 +1,5 @@
import java.io.*; import java.io.*;
import java.lang.String;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
public class vmc { public class vmc {
@ -44,7 +45,8 @@ String location = "groups.txt";
String groups[] = player.getGroups(); String groups[] = player.getGroups();
String groupline[] = null; String groupline[] = null;
String prefix = Colors.White; String prefix = Colors.White;
if(vConfig.getInstance().groupcoloredbrackets() && groups[0].toString().length() > 0){ int x = 0;
if(vConfig.getInstance().groupcoloredbrackets()){
//Read the file //Read the file
properties = new PropertiesFile(location); properties = new PropertiesFile(location);
try { try {
@ -53,6 +55,10 @@ String location = "groups.txt";
log.log(Level.SEVERE, "Exception while loading " + location, e); log.log(Level.SEVERE, "Exception while loading " + location, e);
} }
//Grab the line with the same group as the player //Grab the line with the same group as the player
for(String herp : groups){
x++;
}
if(x > 0)
groupline = properties.getString(groups[0]).split(":"); groupline = properties.getString(groups[0]).split(":");
//Check if the prefix is null or not //Check if the prefix is null or not
if(!groupline[0].isEmpty()) if(!groupline[0].isEmpty())