Changes to TODO

This commit is contained in:
cerevisiae 2010-12-20 14:10:28 -06:00
commit 0cf2c13a4e
6 changed files with 146 additions and 7 deletions

8
TODO
View File

@ -1,5 +1,4 @@
vMinecraft v1 Todo: vMinecraft v1 Todo:
! Promote and Demote (ASAP) <Cere> DIBS
+ matchPlayer taking into account nicknames and prefixes and suffixes + matchPlayer taking into account nicknames and prefixes and suffixes
+ Add [] around player tags + Add [] around player tags
+ Modify setNick to not allow players to copy other's + Modify setNick to not allow players to copy other's
@ -27,9 +26,16 @@ vMinecraft v2 Updates!
how much longer they are probated for. how much longer they are probated for.
DONE DONE
+Added /freeze command to stop players from moving
+ Quick recode of /me to use the new getName function + Quick recode of /me to use the new getName function
<<<<<<< HEAD
+ Simple Fire Antigrief + Simple Fire Antigrief
+ /prefix + /prefix
=======
+ Promote and Demote (ASAP) <Cere> DIBS
+ Simple Fire Antigrief
+ /prefix
>>>>>>> 30d6b1ac5186143118978d1d49d9be4295585464
+ /a to toggle admin chat + /a to toggle admin chat
+ Code was organized + Code was organized
+ Aliasing was added + Aliasing was added

View File

@ -13,7 +13,16 @@ public class vMinecraft extends Plugin {
vMinecraftSettings.getInstance().loadSettings(); vMinecraftSettings.getInstance().loadSettings();
vMinecraftUsers.getInstance().loadUsers(); vMinecraftUsers.getInstance().loadUsers();
vMinecraftCommands.loadCommands(); vMinecraftCommands.loadCommands();
/*while(true){
if (etc.getServer().getTime() == 0){
vMinecraftChat.gmsg(Colors.Rose + "The sun has risen, it is now safe to punch trees");
}
if (etc.getServer().getTime() == 13000){
vMinecraftChat.gmsg(Colors.Rose + "What a terrible night to have a curse");
}
}
*
*/
} }
public void disable() { public void disable() {
@ -30,6 +39,7 @@ public class vMinecraft extends Plugin {
etc.getLoader().addListener(PluginLoader.Hook.EXPLODE, listener, this, PluginListener.Priority.HIGH); etc.getLoader().addListener(PluginLoader.Hook.EXPLODE, listener, this, PluginListener.Priority.HIGH);
etc.getLoader().addListener(PluginLoader.Hook.LIQUID_DESTROY, listener, this, PluginListener.Priority.MEDIUM); etc.getLoader().addListener(PluginLoader.Hook.LIQUID_DESTROY, listener, this, PluginListener.Priority.MEDIUM);
etc.getLoader().addListener(PluginLoader.Hook.HEALTH_CHANGE, listener, this, PluginListener.Priority.MEDIUM); etc.getLoader().addListener(PluginLoader.Hook.HEALTH_CHANGE, listener, this, PluginListener.Priority.MEDIUM);
etc.getLoader().addListener(PluginLoader.Hook.PLAYER_MOVE, listener, this, PluginListener.Priority.MEDIUM);
} }
} }

View File

@ -55,8 +55,10 @@ public class vMinecraftCommands{
cl.register("/demote", "demote", "Demote a player one rank"); cl.register("/demote", "demote", "Demote a player one rank");
//Movement //Movement
cl.register("/freeze", "freeze");
cl.register("/tp", "teleport"); cl.register("/tp", "teleport");
cl.register("/tphere", "tphere"); cl.register("/tphere", "tphere");
cl.register("/tpback", "tpback");
cl.register("/masstp", "masstp", "Teleports those with lower permissions to you"); cl.register("/masstp", "masstp", "Teleports those with lower permissions to you");
//Health //Health
@ -176,7 +178,60 @@ public class vMinecraftCommands{
.globalmessages()); .globalmessages());
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
public static int tpback(Player player, String[] args){
if(player.canUseCommand("/tpback")){
String tpxyz = vMinecraftUsers.getProfile(player).getTpxyz();
String tpxyz2[] = tpxyz.split(",");
double x = Double.parseDouble(tpxyz2[0]);
double y = Double.parseDouble(tpxyz2[1]);
double z = Double.parseDouble(tpxyz2[2]);
player.teleportTo(x, y, z, 0, 0);
String cx = Double.toString(etc.getServer().getSpawnLocation().x);
String cy = Double.toString(etc.getServer().getSpawnLocation().y);
String cz = Double.toString(etc.getServer().getSpawnLocation().z);
String cxyz = cx + "," + cy + "," + cz;
vMinecraftUsers.getProfile(player).setTpback(cxyz);
player.sendMessage(Colors.Rose + "/tpback data reset to spawn");
return EXIT_SUCCESS;
}
return EXIT_SUCCESS;
}
//=====================================================================
//Function: prefix (/prefix)
//Input: Player player: The player using the command
// String[] args: The name of the player
//Output: int: Exit Code
//Use: Freezes a player in place
//=====================================================================
public static int freeze(Player player, String[] args){
if(player.canUseCommand("/freeze") && vMinecraftSettings.getInstance().freeze()){
if (args.length < 1){
vMinecraftChat.gmsg(Colors.Rose + "Usage is /freeze [Player]");
return EXIT_SUCCESS;
}
Player other = etc.getServer().matchPlayer(args[0]);
if (other == null)
{
vMinecraftChat.gmsg(Colors.Rose + "The player you specified could not be found");
return EXIT_SUCCESS;
}
if(player != other && other.hasControlOver(player)){
vMinecraftChat.gmsg(Colors.Rose + "The player you specified has a higher rank than you");
return EXIT_SUCCESS;
}
if(vMinecraftSettings.getInstance().isFrozen(other.getName())){
vMinecraftSettings.getInstance().removeFrozen(other.getName());
vMinecraftChat.gmsg(player.getName() + Colors.Blue + " has unfrozen " + other.getName());
return EXIT_SUCCESS;
} else {
vMinecraftSettings.getInstance().addFrozen(other.getName());
vMinecraftChat.gmsg(player.getName() + Colors.Blue + " has frozen " + other.getName());
return EXIT_SUCCESS;
}
}
return EXIT_SUCCESS;
}
//===================================================================== //=====================================================================
//Function: prefix (/prefix) //Function: prefix (/prefix)
//Input: Player player: The player using the command //Input: Player player: The player using the command
@ -978,6 +1033,18 @@ public class vMinecraftCommands{
//If the player exists transport the user to the player //If the player exists transport the user to the player
else { else {
//Storing their previous location for tpback
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;
vMinecraftUsers.getProfile(player).setTpback(xyz);
if(player.canUseCommand("/tpback")){
player.sendMessage(Colors.DarkPurple + "Your previous location has been stored, use /tpback to return.");
}
vMinecraftChat.gmsg( player, vMinecraftChat.getName(player) vMinecraftChat.gmsg( player, vMinecraftChat.getName(player)
+ Colors.LightBlue + " has teleported to " + Colors.LightBlue + " has teleported to "
+ vMinecraftChat.getName(playerTarget)); + vMinecraftChat.getName(playerTarget));
@ -1059,6 +1126,18 @@ public class vMinecraftCommands{
log.log(Level.INFO, player.getName() + " teleported " log.log(Level.INFO, player.getName() + " teleported "
+ player.getName() + " to their self."); + player.getName() + " to their self.");
playerTarget.teleportTo(player); playerTarget.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;
vMinecraftUsers.getProfile(playerTarget).setTpback(xyz);
if(playerTarget.canUseCommand("/tpback"))
{
playerTarget.sendMessage(Colors.DarkPurple + "Your previous location has been stored, use /tpback to return.");
}
} }
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@ -17,6 +17,11 @@ public class vMinecraftListener extends PluginListener {
public void disable() { public void disable() {
log.log(Level.INFO, "vMinecraft disabled"); log.log(Level.INFO, "vMinecraft disabled");
} }
public void onPlayerMove(Player player, Location from, Location to) {
if(vMinecraftSettings.getInstance().isFrozen(player.getName())){
player.teleportTo(from);
}
}
//===================================================================== //=====================================================================
//Function: onChat //Function: onChat
@ -26,6 +31,7 @@ public class vMinecraftListener extends PluginListener {
// and it is enabled // and it is enabled
//Use: Checks for quote, rage, and colors //Use: Checks for quote, rage, and colors
//===================================================================== //=====================================================================
public boolean onChat(Player player, String message){ public boolean onChat(Player player, String message){
//Quote (Greentext) //Quote (Greentext)

View File

@ -24,6 +24,7 @@ public class vMinecraftSettings {
ignore = false, ignore = false,
colors = false, colors = false,
nick = false, nick = false,
freeze = false,
cmdFabulous = false, cmdFabulous = false,
cmdPromote = false, cmdPromote = false,
cmdDemote = false, cmdDemote = false,
@ -43,6 +44,8 @@ public class vMinecraftSettings {
cmdEzModo = false; cmdEzModo = false;
//An array of players currently in ezmodo //An array of players currently in ezmodo
static ArrayList<String> ezModo = new ArrayList<String>(); static ArrayList<String> ezModo = new ArrayList<String>();
//An array of players currently frozen
static ArrayList<String> frozenplayers = new ArrayList<String>();
//An array of players currently toggled for admin chat //An array of players currently toggled for admin chat
static ArrayList<String> adminChatList = new ArrayList<String>(); static ArrayList<String> adminChatList = new ArrayList<String>();
//An array of blocks that won't catch on fire //An array of blocks that won't catch on fire
@ -96,6 +99,7 @@ public class vMinecraftSettings {
writer.write("#Enables or Disables the following commands, give groups/users permissions to use these commands for them to work\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.write("/fabulous=true\r\n"); writer.write("/fabulous=true\r\n");
writer.write("/prefix=true\r\n"); writer.write("/prefix=true\r\n");
writer.write("/freeze=true\r\n");
writer.write("/suffix=true\r\n"); writer.write("/suffix=true\r\n");
writer.write("/ignore=true\r\n"); writer.write("/ignore=true\r\n");
writer.write("/colors=true\r\n"); writer.write("/colors=true\r\n");
@ -154,6 +158,7 @@ public class vMinecraftSettings {
ignore = properties.getBoolean("ignore",true); ignore = properties.getBoolean("ignore",true);
colors = properties.getBoolean("colors",true); colors = properties.getBoolean("colors",true);
nick = properties.getBoolean("nick",true); nick = properties.getBoolean("nick",true);
freeze = properties.getBoolean("/freeze",true);
cmdFabulous = properties.getBoolean("/fabulous",true); cmdFabulous = properties.getBoolean("/fabulous",true);
cmdPromote = properties.getBoolean("/promote",true); cmdPromote = properties.getBoolean("/promote",true);
cmdDemote = properties.getBoolean("/demote",true); cmdDemote = properties.getBoolean("/demote",true);
@ -208,6 +213,7 @@ public class vMinecraftSettings {
public boolean ignore() {return ignore;} public boolean ignore() {return ignore;}
public boolean colors() {return colors;} public boolean colors() {return colors;}
public boolean nick() {return nick;} public boolean nick() {return nick;}
public boolean freeze() {return freeze;}
public boolean cmdFabulous() {return cmdFabulous;} public boolean cmdFabulous() {return cmdFabulous;}
public boolean cmdPromote() {return cmdPromote;} public boolean cmdPromote() {return cmdPromote;}
public boolean cmdDemote() {return cmdDemote;} public boolean cmdDemote() {return cmdDemote;}
@ -229,11 +235,14 @@ public class vMinecraftSettings {
//EzModo methods //EzModo methods
public boolean cmdEzModo() {return cmdEzModo;} public boolean cmdEzModo() {return cmdEzModo;}
public boolean isEzModo(String playerName) {return ezModo.contains(playerName);} public boolean isEzModo(String playerName) {return ezModo.contains(playerName);}
public boolean isFrozen(String playerName) {return frozenplayers.contains(playerName);}
public boolean isAdminToggled(String playerName) {return adminChatList.contains(playerName);} public boolean isAdminToggled(String playerName) {return adminChatList.contains(playerName);}
public void removeEzModo(String playerName) {ezModo.remove(ezModo.indexOf(playerName));} public void removeEzModo(String playerName) {ezModo.remove(ezModo.indexOf(playerName));}
public void removeAdminToggled(String playerName) {adminChatList.remove(adminChatList.indexOf(playerName));} public void removeAdminToggled(String playerName) {adminChatList.remove(adminChatList.indexOf(playerName));}
public void addEzModo(String playerName) {ezModo.add(playerName);} public void addEzModo(String playerName) {ezModo.add(playerName);}
public void addAdminToggled(String playerName) {adminChatList.add(playerName);} public void addAdminToggled(String playerName) {adminChatList.add(playerName);}
public void addFrozen(String playerName) {frozenplayers.add(playerName);}
public void removeFrozen (String playerName) {frozenplayers.remove(frozenplayers.indexOf(playerName));}
public String ezModoList() {return ezModo.toString();} public String ezModoList() {return ezModo.toString();}
//Random death message method //Random death message method

View File

@ -152,7 +152,8 @@ class PlayerList
lastMessage, lastMessage,
nickName, nickName,
tag, tag,
suffix; suffix,
tpxyz;
private boolean dead; private boolean dead;
@ -181,6 +182,7 @@ class PlayerList
tag = new String(); tag = new String();
nickName = new String(); nickName = new String();
suffix = new String(); suffix = new String();
tpxyz = new String();
defaultColor = 'f'; defaultColor = 'f';
ignoreList = new ArrayList<String>(); ignoreList = new ArrayList<String>();
aliasList = new commandList(); aliasList = new commandList();
@ -242,6 +244,12 @@ class PlayerList
} }
} }
} }
//XYZ TP Back value
//Not sure if declaring a double this way will work or not
if(character.length > 7)
{
tpxyz = character[7];
}
in.close(); in.close();
return true; return true;
} }
@ -285,7 +293,7 @@ class PlayerList
writer.append(nickName + ":"); writer.append(nickName + ":");
writer.append(suffix + ":"); writer.append(suffix + ":");
writer.append(defaultColor + ":"); writer.append(defaultColor + ":");
int i = 0; int i = 0;
for(String ignore : ignoreList) for(String ignore : ignoreList)
{ {
@ -294,8 +302,8 @@ class PlayerList
writer.append(","); writer.append(",");
} }
writer.append(":"); writer.append(":");
writer.append(aliasList.toString()); writer.append(aliasList.toString());
writer.append(tpxyz.toString());
writer.append("\r\n"); writer.append("\r\n");
} }
} }
@ -325,6 +333,7 @@ class PlayerList
out.append(nickName + ":"); out.append(nickName + ":");
out.append(suffix + ":"); out.append(suffix + ":");
out.append(defaultColor + ":"); out.append(defaultColor + ":");
int i = 0; int i = 0;
for(String ignore : ignoreList) for(String ignore : ignoreList)
@ -334,6 +343,7 @@ class PlayerList
out.append(","); out.append(",");
} }
out.append(":"); out.append(":");
out.append(tpxyz + ":");
out.append(aliasList.toString()); out.append(aliasList.toString());
out.newLine(); out.newLine();
@ -456,8 +466,27 @@ class PlayerList
tag = newTag; tag = newTag;
save(); save();
} }
//=====================================================================
//Function: setTpback
//Input: None
//Output: None
//Use: Sets a player's tpback xyz coordinates
//===================================================================== //=====================================================================
public void setTpback(String newtpback)
{
tpxyz = newtpback;
save();
}
//=====================================================================
//Function: getTpxyz
//Input: None
//Output: Double: The player's tpback x coords
//Use: Gets the x value of tpback
//=====================================================================
public String getTpxyz()
{
return tpxyz;
}
//Function: getTag //Function: getTag
//Input: None //Input: None
//Output: String: The player tag //Output: String: The player tag