浏览代码

Added the ability for players to "spawn" at their home location, when enabled it moves a player after they have died and revived to their home location.

nossr50 14 年之前
父节点
当前提交
6a122fb0aa
共有 2 个文件被更改,包括 12 次插入1 次删除
  1. 7 1
      vMinecraftListener.java
  2. 5 0
      vMinecraftSettings.java

+ 7 - 1
vMinecraftListener.java

@@ -86,8 +86,14 @@ public class vMinecraftListener extends PluginListener {
 	//Use:		Checks for exploits and runs the commands
 	//Use:		Checks for exploits and runs the commands
 	//=====================================================================
 	//=====================================================================
     public boolean onHealthChange(Player player,int oldValue,int newValue){
     public boolean onHealthChange(Player player,int oldValue,int newValue){
-        if (player.getHealth() > 1){
+        if (player.getHealth() > 1 && vMinecraftUsers.getProfile(player).isDead()){
 	        vMinecraftUsers.getProfile(player).isDead(false);
 	        vMinecraftUsers.getProfile(player).isDead(false);
+                if(vMinecraftSettings.getInstance().playerspawn())
+                {
+                Warp home = null;
+                home = etc.getDataSource().getHome(player.getName());
+                player.teleportTo(home.Location);
+                }
         }
         }
         return false;
         return false;
     }
     }

+ 5 - 0
vMinecraftSettings.java

@@ -24,6 +24,7 @@ public class vMinecraftSettings {
 				   ignore 			= false,
 				   ignore 			= false,
 				   colors 			= false,
 				   colors 			= false,
 				   nick 			= false,
 				   nick 			= false,
+                playerspawn = false,
                 freeze = false,
                 freeze = false,
 				   cmdFabulous		= false,
 				   cmdFabulous		= false,
 				   cmdPromote		= false,
 				   cmdPromote		= false,
@@ -85,6 +86,8 @@ public class vMinecraftSettings {
                 writer.write("FFF=true\r\n");
                 writer.write("FFF=true\r\n");
                 writer.write("\r\n");
                 writer.write("\r\n");
                 writer.write("#Admin Settings\r\n");
                 writer.write("#Admin Settings\r\n");
+                writer.write("#Enables or disables players spawning to their home location");
+                writer.write("playerspawn=true\r\n");
                 writer.write("#Enables or disables the admin only chat\r\n");
                 writer.write("#Enables or disables the admin only chat\r\n");
                 writer.write("adminchat=true\r\n");
                 writer.write("adminchat=true\r\n");
                 writer.write("#Lets non admins use admin chat if they have the /adminchat command permission\r\n");
                 writer.write("#Lets non admins use admin chat if they have the /adminchat command permission\r\n");
@@ -150,6 +153,7 @@ public class vMinecraftSettings {
 
 
 		try {
 		try {
 			adminChat = properties.getBoolean("adminchat",true);
 			adminChat = properties.getBoolean("adminchat",true);
+                        playerspawn = properties.getBoolean("playerspawn",true);
 			greentext = properties.getBoolean("QuotesAreGreen",true);
 			greentext = properties.getBoolean("QuotesAreGreen",true);
 			FFF = properties.getBoolean("FFF",true);
 			FFF = properties.getBoolean("FFF",true);
 			quakeColors = properties.getBoolean("ColoredChat",true);
 			quakeColors = properties.getBoolean("ColoredChat",true);
@@ -213,6 +217,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 playerspawn() {return playerspawn;}
         public boolean freeze() {return freeze;}
         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;}