From 53c00d6c55071a82ddd3d09f79f24b6c6a6324bc Mon Sep 17 00:00:00 2001 From: nossr50 Date: Tue, 14 Dec 2010 21:50:34 -0800 Subject: [PATCH 01/14] Cere the workhorse! --- TODO | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TODO b/TODO index d25300137..0d484c69c 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,4 @@ -vMinecraft v1 Todo: - ! Promote and Demote (ASAP) DIBS +vMinecraft v1 Todo: + matchPlayer taking into account nicknames + Modify setNick to not allow players to copy other's nicknames and account names. Also disallow Notch as a nick :P @@ -22,6 +21,7 @@ vMinecraft v2 Updates! DONE + Quick recode of /me to use the new getName function + + Promote and Demote (ASAP) DIBS + Simple Fire Antigrief + /prefix + /a to toggle admin chat From ad29bb2bbb7b64870afe47528e49fb421d88ec2a Mon Sep 17 00:00:00 2001 From: nossr50 Date: Wed, 15 Dec 2010 16:22:48 -0800 Subject: [PATCH 02/14] Added a /freeze command for fun --- vMinecraft.java | 1 + vMinecraftCommands.java | 34 +++++++++++++++++++++++++++++++++- vMinecraftListener.java | 6 ++++++ vMinecraftSettings.java | 6 ++++++ 4 files changed, 46 insertions(+), 1 deletion(-) diff --git a/vMinecraft.java b/vMinecraft.java index e55d4931c..69cc66381 100644 --- a/vMinecraft.java +++ b/vMinecraft.java @@ -30,6 +30,7 @@ public class vMinecraft extends Plugin { 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.HEALTH_CHANGE, listener, this, PluginListener.Priority.MEDIUM); + etc.getLoader().addListener(PluginLoader.Hook.PLAYER_MOVE, listener, this, PluginListener.Priority.MEDIUM); } } diff --git a/vMinecraftCommands.java b/vMinecraftCommands.java index cbb44cc08..957502a73 100644 --- a/vMinecraftCommands.java +++ b/vMinecraftCommands.java @@ -176,7 +176,39 @@ public class vMinecraftCommands{ .globalmessages()); 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")){ + if (args.length < 2){ + 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.frozenplayers.contains(other)){ + vMinecraftSettings.getInstance().removeFrozen(other.getName()); + return EXIT_SUCCESS; + } + vMinecraftSettings.getInstance().addFrozen(other.getName()); + vMinecraftChat.gmsg(player.getName() + Colors.Blue + " has frozen " + other.getName()); + return EXIT_SUCCESS; + } + return EXIT_SUCCESS; + } //===================================================================== //Function: prefix (/prefix) //Input: Player player: The player using the command diff --git a/vMinecraftListener.java b/vMinecraftListener.java index ac2f7e1d3..99e38fc6b 100644 --- a/vMinecraftListener.java +++ b/vMinecraftListener.java @@ -17,6 +17,11 @@ public class vMinecraftListener extends PluginListener { public void disable() { log.log(Level.INFO, "vMinecraft disabled"); } + public void onPlayerMove(Player player, Location from, Location to) { + if(vMinecraftSettings.frozenplayers.contains(player)){ + player.teleportTo(from); + } + } //===================================================================== //Function: onChat @@ -26,6 +31,7 @@ public class vMinecraftListener extends PluginListener { // and it is enabled //Use: Checks for quote, rage, and colors //===================================================================== + public boolean onChat(Player player, String message){ //Quote (Greentext) diff --git a/vMinecraftSettings.java b/vMinecraftSettings.java index 91508bb93..214bc694a 100644 --- a/vMinecraftSettings.java +++ b/vMinecraftSettings.java @@ -24,6 +24,7 @@ public class vMinecraftSettings { ignore = false, colors = false, nick = false, + freeze = false, cmdFabulous = false, cmdPromote = false, cmdDemote = false, @@ -43,6 +44,8 @@ public class vMinecraftSettings { cmdEzModo = false; //An array of players currently in ezmodo static ArrayList ezModo = new ArrayList(); + //An array of players currently frozen + static ArrayList frozenplayers = new ArrayList(); //An array of players currently toggled for admin chat static ArrayList adminChatList = new ArrayList(); //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("/fabulous=true\r\n"); writer.write("/prefix=true\r\n"); + writer.write("/freeze=true\r\n"); writer.write("/suffix=true\r\n"); writer.write("/ignore=true\r\n"); writer.write("/colors=true\r\n"); @@ -234,6 +238,8 @@ public class vMinecraftSettings { public void removeAdminToggled(String playerName) {adminChatList.remove(adminChatList.indexOf(playerName));} public void addEzModo(String playerName) {ezModo.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();} //Random death message method From d0c33562b4cbbeaebff41292d1e2f6d41069f2a9 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Wed, 15 Dec 2010 16:25:25 -0800 Subject: [PATCH 03/14] Added toggle for /freeze and a message when unfreezing a player. --- vMinecraftCommands.java | 3 ++- vMinecraftSettings.java | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/vMinecraftCommands.java b/vMinecraftCommands.java index 957502a73..1f6187eea 100644 --- a/vMinecraftCommands.java +++ b/vMinecraftCommands.java @@ -184,7 +184,7 @@ public class vMinecraftCommands{ //Use: Freezes a player in place //===================================================================== public static int freeze(Player player, String[] args){ - if(player.canUseCommand("/freeze")){ + if(player.canUseCommand("/freeze") && vMinecraftSettings.getInstance().freeze()){ if (args.length < 2){ vMinecraftChat.gmsg(Colors.Rose + "Usage is /freeze [Player]"); return EXIT_SUCCESS; @@ -201,6 +201,7 @@ public class vMinecraftCommands{ } if(vMinecraftSettings.frozenplayers.contains(other)){ vMinecraftSettings.getInstance().removeFrozen(other.getName()); + vMinecraftChat.gmsg(player.getName() + Colors.Blue + " has unfrozen " + other.getName()); return EXIT_SUCCESS; } vMinecraftSettings.getInstance().addFrozen(other.getName()); diff --git a/vMinecraftSettings.java b/vMinecraftSettings.java index 214bc694a..df10540ef 100644 --- a/vMinecraftSettings.java +++ b/vMinecraftSettings.java @@ -212,6 +212,7 @@ public class vMinecraftSettings { public boolean ignore() {return ignore;} public boolean colors() {return colors;} public boolean nick() {return nick;} + public boolean freeze() {return freeze;} public boolean cmdFabulous() {return cmdFabulous;} public boolean cmdPromote() {return cmdPromote;} public boolean cmdDemote() {return cmdDemote;} From 6d8214e655a9ccb0deae2532816ed764c74c402c Mon Sep 17 00:00:00 2001 From: nossr50 Date: Wed, 15 Dec 2010 16:37:18 -0800 Subject: [PATCH 04/14] Added /freeze to cl.register --- vMinecraftCommands.java | 1 + 1 file changed, 1 insertion(+) diff --git a/vMinecraftCommands.java b/vMinecraftCommands.java index 1f6187eea..4cf867179 100644 --- a/vMinecraftCommands.java +++ b/vMinecraftCommands.java @@ -55,6 +55,7 @@ public class vMinecraftCommands{ cl.register("/demote", "demote", "Demote a player one rank"); //Movement + cl.register("/freeze", "freeze"); cl.register("/tp", "teleport"); cl.register("/tphere", "tphere"); cl.register("/masstp", "masstp", "Teleports those with lower permissions to you"); From af8c4772fceca92be3dabfb2d1d2b8c1b183a11b Mon Sep 17 00:00:00 2001 From: nossr50 Date: Wed, 15 Dec 2010 16:40:23 -0800 Subject: [PATCH 05/14] Somehow I forgot to add this when making /freeze >.> --- vMinecraftSettings.java | 1 + 1 file changed, 1 insertion(+) diff --git a/vMinecraftSettings.java b/vMinecraftSettings.java index df10540ef..a4b15e654 100644 --- a/vMinecraftSettings.java +++ b/vMinecraftSettings.java @@ -158,6 +158,7 @@ public class vMinecraftSettings { ignore = properties.getBoolean("ignore",true); colors = properties.getBoolean("colors",true); nick = properties.getBoolean("nick",true); + freeze = properties.getBoolean("freeze",true); cmdFabulous = properties.getBoolean("/fabulous",true); cmdPromote = properties.getBoolean("/promote",true); cmdDemote = properties.getBoolean("/demote",true); From c1fff71e334ac59f606b2f9d9a3317e6a7ef0912 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Wed, 15 Dec 2010 16:47:34 -0800 Subject: [PATCH 06/14] Fixed a few more mistakes >.> --- vMinecraftCommands.java | 2 +- vMinecraftListener.java | 2 +- vMinecraftSettings.java | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/vMinecraftCommands.java b/vMinecraftCommands.java index 4cf867179..fb07c088c 100644 --- a/vMinecraftCommands.java +++ b/vMinecraftCommands.java @@ -186,7 +186,7 @@ public class vMinecraftCommands{ //===================================================================== public static int freeze(Player player, String[] args){ if(player.canUseCommand("/freeze") && vMinecraftSettings.getInstance().freeze()){ - if (args.length < 2){ + if (args.length < 1){ vMinecraftChat.gmsg(Colors.Rose + "Usage is /freeze [Player]"); return EXIT_SUCCESS; } diff --git a/vMinecraftListener.java b/vMinecraftListener.java index 99e38fc6b..44426e58b 100644 --- a/vMinecraftListener.java +++ b/vMinecraftListener.java @@ -18,7 +18,7 @@ public class vMinecraftListener extends PluginListener { log.log(Level.INFO, "vMinecraft disabled"); } public void onPlayerMove(Player player, Location from, Location to) { - if(vMinecraftSettings.frozenplayers.contains(player)){ + if(vMinecraftSettings.getInstance().isFrozen(player)){ player.teleportTo(from); } } diff --git a/vMinecraftSettings.java b/vMinecraftSettings.java index a4b15e654..3eb784b88 100644 --- a/vMinecraftSettings.java +++ b/vMinecraftSettings.java @@ -158,7 +158,7 @@ public class vMinecraftSettings { ignore = properties.getBoolean("ignore",true); colors = properties.getBoolean("colors",true); nick = properties.getBoolean("nick",true); - freeze = properties.getBoolean("freeze",true); + freeze = properties.getBoolean("/freeze",true); cmdFabulous = properties.getBoolean("/fabulous",true); cmdPromote = properties.getBoolean("/promote",true); cmdDemote = properties.getBoolean("/demote",true); @@ -235,6 +235,7 @@ public class vMinecraftSettings { //EzModo methods public boolean cmdEzModo() {return cmdEzModo;} 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 void removeEzModo(String playerName) {ezModo.remove(ezModo.indexOf(playerName));} public void removeAdminToggled(String playerName) {adminChatList.remove(adminChatList.indexOf(playerName));} From 019dea18e9d78399861da56e0274be015a817de7 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Wed, 15 Dec 2010 16:53:25 -0800 Subject: [PATCH 07/14] More fixes to /freeze --- vMinecraftCommands.java | 5 +++-- vMinecraftListener.java | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/vMinecraftCommands.java b/vMinecraftCommands.java index fb07c088c..9e437fecb 100644 --- a/vMinecraftCommands.java +++ b/vMinecraftCommands.java @@ -200,14 +200,15 @@ public class vMinecraftCommands{ vMinecraftChat.gmsg(Colors.Rose + "The player you specified has a higher rank than you"); return EXIT_SUCCESS; } - if(vMinecraftSettings.frozenplayers.contains(other)){ + 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; } diff --git a/vMinecraftListener.java b/vMinecraftListener.java index 44426e58b..355a39328 100644 --- a/vMinecraftListener.java +++ b/vMinecraftListener.java @@ -18,7 +18,7 @@ public class vMinecraftListener extends PluginListener { log.log(Level.INFO, "vMinecraft disabled"); } public void onPlayerMove(Player player, Location from, Location to) { - if(vMinecraftSettings.getInstance().isFrozen(player)){ + if(vMinecraftSettings.getInstance().isFrozen(player.getName())){ player.teleportTo(from); } } From 30d449803963febf163c3df22f72f0ad6dcd4df4 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Wed, 15 Dec 2010 16:56:01 -0800 Subject: [PATCH 08/14] Updated TODO to include /freeze --- TODO | 1 + 1 file changed, 1 insertion(+) diff --git a/TODO b/TODO index 0d484c69c..ad38127dd 100644 --- a/TODO +++ b/TODO @@ -20,6 +20,7 @@ vMinecraft v2 Updates! ex: Sunrise to sunset, mid-morning to noon DONE + +Added /freeze command to stop players from moving + Quick recode of /me to use the new getName function + Promote and Demote (ASAP) DIBS + Simple Fire Antigrief From 99a5f13b5e41edef2074054c744b9f8fea4f3263 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Sun, 19 Dec 2010 23:53:56 -0800 Subject: [PATCH 09/14] Added /tpback, not exactly working correctly yet. --- vMinecraftCommands.java | 28 +++++++++++++++++++ vMinecraftUsers.java | 61 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 87 insertions(+), 2 deletions(-) diff --git a/vMinecraftCommands.java b/vMinecraftCommands.java index 9e437fecb..8f4b31649 100644 --- a/vMinecraftCommands.java +++ b/vMinecraftCommands.java @@ -58,6 +58,7 @@ public class vMinecraftCommands{ cl.register("/freeze", "freeze"); cl.register("/tp", "teleport"); cl.register("/tphere", "tphere"); + cl.register("/tpback", "tpback"); cl.register("/masstp", "masstp", "Teleports those with lower permissions to you"); //Health @@ -177,6 +178,17 @@ public class vMinecraftCommands{ .globalmessages()); return EXIT_SUCCESS; } + public static int tpback(Player player, String[] args){ + if(player.canUseCommand("/tpback")){ + double x = vMinecraftUsers.getProfile(player).getTpx(); + double y = vMinecraftUsers.getProfile(player).getTpy(); + double z = vMinecraftUsers.getProfile(player).getTpz(); + player.teleportTo(x, y, z, 0, 0); + return EXIT_SUCCESS; + + } + return EXIT_SUCCESS; + } //===================================================================== //Function: prefix (/prefix) //Input: Player player: The player using the command @@ -1013,6 +1025,14 @@ public class vMinecraftCommands{ //If the player exists transport the user to the player else { + //Storing their previous location for tpback + double x = player.getLocation().x; + double y = player.getLocation().y; + double z = player.getLocation().z; + vMinecraftUsers.getProfile(player).setTpback(x, y, z); + if(player.canUseCommand("/tpback")){ + player.sendMessage(Colors.DarkPurple + "Your previous location has been stored, use /tpback to return."); + } vMinecraftChat.gmsg( player, vMinecraftChat.getName(player) + Colors.LightBlue + " has teleported to " + vMinecraftChat.getName(playerTarget)); @@ -1094,6 +1114,14 @@ public class vMinecraftCommands{ log.log(Level.INFO, player.getName() + " teleported " + player.getName() + " to their self."); playerTarget.teleportTo(player); + double x = player.getLocation().x; + double y = player.getLocation().y; + double z = player.getLocation().z; + vMinecraftUsers.getProfile(playerTarget).setTpback(x, y, z); + if(playerTarget.canUseCommand("/tpback")) + { + playerTarget.sendMessage(Colors.DarkPurple + "Your previous location has been stored, use /tpback to return."); + } } return EXIT_SUCCESS; } diff --git a/vMinecraftUsers.java b/vMinecraftUsers.java index b39e02fce..02a525b6c 100644 --- a/vMinecraftUsers.java +++ b/vMinecraftUsers.java @@ -153,6 +153,9 @@ class PlayerList nickName, tag, suffix; + private double tpx, + tpy, + tpz; private boolean dead; @@ -242,6 +245,20 @@ class PlayerList } } } + //XYZ TP Back value + //Not sure if declaring a double this way will work or not + if(character.length > 7) + { + double tpx = new Double(character[7]).doubleValue(); + } + if(character.length > 8) + { + double tpy = new Double(character[8]).doubleValue(); + } + if(character.length > 9) + { + double tpz = new Double(character[9]).doubleValue(); + } in.close(); return true; } @@ -285,7 +302,7 @@ class PlayerList writer.append(nickName + ":"); writer.append(suffix + ":"); writer.append(defaultColor + ":"); - + int i = 0; for(String ignore : ignoreList) { @@ -294,8 +311,10 @@ class PlayerList writer.append(","); } writer.append(":"); - writer.append(aliasList.toString()); + writer.append(tpx + ":"); + writer.append(tpy + ":"); + writer.append(tpz + ":"); writer.append("\r\n"); } } @@ -325,6 +344,7 @@ class PlayerList out.append(nickName + ":"); out.append(suffix + ":"); out.append(defaultColor + ":"); + int i = 0; for(String ignore : ignoreList) @@ -334,6 +354,9 @@ class PlayerList out.append(","); } out.append(":"); + out.append(tpx + ":"); + out.append(tpy + ":"); + out.append(tpz + ":"); out.append(aliasList.toString()); out.newLine(); @@ -456,6 +479,40 @@ class PlayerList tag = newTag; save(); } + //===================================================================== + //Function: setTpback + //Input: None + //Output: None + //Use: Sets a player's tpback xyz coordinates + //===================================================================== + public void setTpback(double x, double y, double z) + { + //Coordinates + x = tpx; + y = tpy; + z = tpz; + } + //===================================================================== + //Function: getTpbx + //Input: None + //Output: Double: The player's tpback x coords + //Use: Gets the x value of tpback + //===================================================================== + public double getTpx() { return tpx; } + //===================================================================== + //Function: getTpy + //Input: None + //Output: Double: The player's tpback x coords + //Use: Gets the x value of tpback + //===================================================================== + public double getTpy() { return tpy; } + //===================================================================== + //Function: getTpz + //Input: None + //Output: Double: The player's tpback x coords + //Use: Gets the x value of tpback + //===================================================================== + public double getTpz() { return tpz; } //===================================================================== //Function: getTag From c12f0a09369c533ee8fe9573792c9d1bba013c28 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Mon, 20 Dec 2010 02:58:56 -0800 Subject: [PATCH 10/14] Fixed /tpback, it also still saves to file. Should we really remove this? Also need to add saving the pitch/rotation to it too. --- vMinecraftCommands.java | 20 +++++++++++---- vMinecraftUsers.java | 55 ++++++++++------------------------------- 2 files changed, 28 insertions(+), 47 deletions(-) diff --git a/vMinecraftCommands.java b/vMinecraftCommands.java index 8f4b31649..4108c18d8 100644 --- a/vMinecraftCommands.java +++ b/vMinecraftCommands.java @@ -180,9 +180,11 @@ public class vMinecraftCommands{ } public static int tpback(Player player, String[] args){ if(player.canUseCommand("/tpback")){ - double x = vMinecraftUsers.getProfile(player).getTpx(); - double y = vMinecraftUsers.getProfile(player).getTpy(); - double z = vMinecraftUsers.getProfile(player).getTpz(); + 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); return EXIT_SUCCESS; @@ -1029,7 +1031,11 @@ public class vMinecraftCommands{ double x = player.getLocation().x; double y = player.getLocation().y; double z = player.getLocation().z; - vMinecraftUsers.getProfile(player).setTpback(x, y, 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."); } @@ -1117,7 +1123,11 @@ public class vMinecraftCommands{ double x = player.getLocation().x; double y = player.getLocation().y; double z = player.getLocation().z; - vMinecraftUsers.getProfile(playerTarget).setTpback(x, y, 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."); diff --git a/vMinecraftUsers.java b/vMinecraftUsers.java index 02a525b6c..7a50ec238 100644 --- a/vMinecraftUsers.java +++ b/vMinecraftUsers.java @@ -152,10 +152,8 @@ class PlayerList lastMessage, nickName, tag, - suffix; - private double tpx, - tpy, - tpz; + suffix, + tpxyz; private boolean dead; @@ -184,6 +182,7 @@ class PlayerList tag = new String(); nickName = new String(); suffix = new String(); + tpxyz = new String(); defaultColor = 'f'; ignoreList = new ArrayList(); aliasList = new commandList(); @@ -249,15 +248,7 @@ class PlayerList //Not sure if declaring a double this way will work or not if(character.length > 7) { - double tpx = new Double(character[7]).doubleValue(); - } - if(character.length > 8) - { - double tpy = new Double(character[8]).doubleValue(); - } - if(character.length > 9) - { - double tpz = new Double(character[9]).doubleValue(); + tpxyz = character[7]; } in.close(); return true; @@ -312,9 +303,7 @@ class PlayerList } writer.append(":"); writer.append(aliasList.toString()); - writer.append(tpx + ":"); - writer.append(tpy + ":"); - writer.append(tpz + ":"); + writer.append(tpxyz.toString()); writer.append("\r\n"); } } @@ -354,9 +343,7 @@ class PlayerList out.append(","); } out.append(":"); - out.append(tpx + ":"); - out.append(tpy + ":"); - out.append(tpz + ":"); + out.append(tpxyz + ":"); out.append(aliasList.toString()); out.newLine(); @@ -485,36 +472,20 @@ class PlayerList //Output: None //Use: Sets a player's tpback xyz coordinates //===================================================================== - public void setTpback(double x, double y, double z) + public void setTpback(String newtpback) { - //Coordinates - x = tpx; - y = tpy; - z = tpz; + tpxyz = newtpback; } //===================================================================== - //Function: getTpbx + //Function: getTpxyz //Input: None //Output: Double: The player's tpback x coords //Use: Gets the x value of tpback //===================================================================== - public double getTpx() { return tpx; } - //===================================================================== - //Function: getTpy - //Input: None - //Output: Double: The player's tpback x coords - //Use: Gets the x value of tpback - //===================================================================== - public double getTpy() { return tpy; } - //===================================================================== - //Function: getTpz - //Input: None - //Output: Double: The player's tpback x coords - //Use: Gets the x value of tpback - //===================================================================== - public double getTpz() { return tpz; } - - //===================================================================== + public String getTpxyz() + { + return tpxyz; + } //Function: getTag //Input: None //Output: String: The player tag From 3046d613aab8129bac04bc4b4538fb1a2b9a5b87 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Mon, 20 Dec 2010 03:11:15 -0800 Subject: [PATCH 11/14] Added exploit prevention to /tpback --- vMinecraftCommands.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vMinecraftCommands.java b/vMinecraftCommands.java index 4108c18d8..7f5a65cac 100644 --- a/vMinecraftCommands.java +++ b/vMinecraftCommands.java @@ -186,6 +186,12 @@ public class vMinecraftCommands{ 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 = x + "," + y + "," + z; + vMinecraftUsers.getProfile(player).setTpback(cxyz); + player.sendMessage(Colors.Rose + "/tpback data reset to spawn"); return EXIT_SUCCESS; } From 4629d0467c95655bacf5717b8bc7d60bd90f35ee Mon Sep 17 00:00:00 2001 From: nossr50 Date: Mon, 20 Dec 2010 03:17:18 -0800 Subject: [PATCH 12/14] Whoops forgot to add in /save! --- vMinecraftUsers.java | 1 + 1 file changed, 1 insertion(+) diff --git a/vMinecraftUsers.java b/vMinecraftUsers.java index 7a50ec238..96f6f6ac0 100644 --- a/vMinecraftUsers.java +++ b/vMinecraftUsers.java @@ -475,6 +475,7 @@ class PlayerList public void setTpback(String newtpback) { tpxyz = newtpback; + save(); } //===================================================================== //Function: getTpxyz From 4cdbcc053c8fdaef5fa73b725a4f23aa89032f9b Mon Sep 17 00:00:00 2001 From: nossr50 Date: Mon, 20 Dec 2010 03:31:01 -0800 Subject: [PATCH 13/14] Sometimes I don't know how I miss stuff like this. --- vMinecraft.java | 6 ++++++ vMinecraftCommands.java | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/vMinecraft.java b/vMinecraft.java index 69cc66381..02f637245 100644 --- a/vMinecraft.java +++ b/vMinecraft.java @@ -13,6 +13,12 @@ public class vMinecraft extends Plugin { vMinecraftSettings.getInstance().loadSettings(); vMinecraftUsers.getInstance().loadUsers(); vMinecraftCommands.loadCommands(); + 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"); + } } diff --git a/vMinecraftCommands.java b/vMinecraftCommands.java index 7f5a65cac..4d05447f9 100644 --- a/vMinecraftCommands.java +++ b/vMinecraftCommands.java @@ -189,7 +189,7 @@ public class vMinecraftCommands{ 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 = x + "," + y + "," + z; + String cxyz = cx + "," + cy + "," + cz; vMinecraftUsers.getProfile(player).setTpback(cxyz); player.sendMessage(Colors.Rose + "/tpback data reset to spawn"); return EXIT_SUCCESS; From 30d6b1ac5186143118978d1d49d9be4295585464 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Mon, 20 Dec 2010 03:52:31 -0800 Subject: [PATCH 14/14] Honestly, I don't remember ;_; --- vMinecraft.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/vMinecraft.java b/vMinecraft.java index 02f637245..92025c950 100644 --- a/vMinecraft.java +++ b/vMinecraft.java @@ -13,13 +13,16 @@ public class vMinecraft extends Plugin { vMinecraftSettings.getInstance().loadSettings(); vMinecraftUsers.getInstance().loadUsers(); vMinecraftCommands.loadCommands(); - if (etc.getServer().getTime() == 0){ + /*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() {