mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-10-31 17:23:42 +01:00 
			
		
		
		
	Added /heal and /suicide. Corrected some things in the settings file.
Signed-off-by: nossr50 <nossr50@gmail.com>
This commit is contained in:
		| @@ -35,10 +35,50 @@ public class vminecraftCommands{ | |||||||
|         cl.register("/slay", "slay", "Kill target player"); |         cl.register("/slay", "slay", "Kill target player"); | ||||||
|         cl.register("/ezmodo", "invuln", "Toggle invulnerability"); |         cl.register("/ezmodo", "invuln", "Toggle invulnerability"); | ||||||
|         cl.register("/ezlist", "ezlist", "List invulnerable players"); |         cl.register("/ezlist", "ezlist", "List invulnerable players"); | ||||||
|  |         cl.register("/heal", "heal", "heal yourself or other players"); | ||||||
|  |         cl.register("/suicide", "suicide", "kill yourself... you loser"); | ||||||
|         cl.registerAlias("/playerlist", "/who"); |         cl.registerAlias("/playerlist", "/who"); | ||||||
|  |         cl.registerAlias("/suicide", "/wrists"); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     //Heal | ||||||
|  |     public static boolean heal(Player player, String[] args) | ||||||
|  |     { | ||||||
|  |         if(vminecraftSettings.getInstance().cmdHeal) | ||||||
|  |         { | ||||||
|  |             if (args[1] == null){ | ||||||
|  |             if (player.getHealth() < 20){ | ||||||
|  |                 vminecraftChat.gmsg("Your health is restored"); | ||||||
|  |                 return true; | ||||||
|  |             } | ||||||
|  |             else if (args[1] != null){ | ||||||
|  |                 Player playerTarget = etc.getServer().matchPlayer(args[1]); | ||||||
|  |                 if (playerTarget != null){ | ||||||
|  |                     playerTarget.setHealth(20); | ||||||
|  |                     vminecraftChat.gmsg(Colors.Blue + "You have healed " + playerTarget.getColor() + playerTarget.getName()); | ||||||
|  |                     vminecraftChat.gmsg(Colors.Blue + "You have been healed by " + player.getColor() + player.getName()); | ||||||
|  |                     return true; | ||||||
|  |                 } | ||||||
|  |                 else if (playerTarget == null){ | ||||||
|  |                     vminecraftChat.gmsg(Colors.Rose + "Couldn't find that player"); | ||||||
|  |                     return false; | ||||||
|  |                     } | ||||||
|  |  | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         return false; | ||||||
|  |     } | ||||||
|  |     //Suicide | ||||||
|  |     public static boolean suicide(Player player, String[] args) | ||||||
|  |     { | ||||||
|  |         if(vminecraftSettings.getInstance().cmdSuicide) | ||||||
|  |         { | ||||||
|  |             player.setHealth(0); | ||||||
|  |             return true; | ||||||
|  |         } | ||||||
|  |         return false; | ||||||
|  |     } | ||||||
| 	//===================================================================== | 	//===================================================================== | ||||||
| 	//Function:	teleport (/tp) | 	//Function:	teleport (/tp) | ||||||
| 	//Input:	Player player: The player using the command | 	//Input:	Player player: The player using the command | ||||||
|   | |||||||
| @@ -33,6 +33,8 @@ public class vminecraftSettings { | |||||||
| 				   cmdWho			= false, | 				   cmdWho			= false, | ||||||
| 				   stopFire			= false, | 				   stopFire			= false, | ||||||
| 				   stopTnt			= false, | 				   stopTnt			= false, | ||||||
|  |                                    cmdHeal  = false, | ||||||
|  |                                    cmdSuicide = false, | ||||||
| 				   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>(); | ||||||
| @@ -74,6 +76,7 @@ public class vminecraftSettings { | |||||||
| 				writer.write("cmdSay=true\r\n"); | 				writer.write("cmdSay=true\r\n"); | ||||||
| 				writer.write("cmdTp=true\r\n"); | 				writer.write("cmdTp=true\r\n"); | ||||||
| 				writer.write("cmdRules=true\r\n"); | 				writer.write("cmdRules=true\r\n"); | ||||||
|  |                                 writer.write("cmdSuicide=true\r\n"); | ||||||
| 				writer.write("globalmessages=true\r\n"); | 				writer.write("globalmessages=true\r\n"); | ||||||
| 				writer.write("FFF=true\r\n"); | 				writer.write("FFF=true\r\n"); | ||||||
| 				writer.write("adminchat=true\r\n"); | 				writer.write("adminchat=true\r\n"); | ||||||
| @@ -82,11 +85,11 @@ public class vminecraftSettings { | |||||||
| 				writer.write("ezModo=\r\n"); | 				writer.write("ezModo=\r\n"); | ||||||
| 				writer.write("#The health ezmodo people will have while in ezmodo. Don't set to 0\r\n"); | 				writer.write("#The health ezmodo people will have while in ezmodo. Don't set to 0\r\n"); | ||||||
| 				writer.write("ezHealth=30\r\n"); | 				writer.write("ezHealth=30\r\n"); | ||||||
| 				writer.write("stopFire=false"); | 				writer.write("stopFire=false\r\n"); | ||||||
|                                 writer.write("stopTnt=false"); |                                 writer.write("stopTnt=false\r\n"); | ||||||
| 				writer.write("rules=Rules@#1: No griefing@#2: No griefing\r\n"); | 				writer.write("rules=Rules@#1: No griefing@#2: No griefing\r\n"); | ||||||
|                                 writer.write("#Death messages, seperate them by comma. All death messages start with the player name and a space."); |                                 writer.write("#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"); |                                 writer.write("deathMessages=is no more,died horribly,went peacefully\r\n"); | ||||||
| 			} 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 { | ||||||
| @@ -122,6 +125,8 @@ public class vminecraftSettings { | |||||||
| 			cmdTp = properties.getBoolean("cmdTp",true); | 			cmdTp = properties.getBoolean("cmdTp",true); | ||||||
| 			cmdMasstp = properties.getBoolean("cmdMasstp",true); | 			cmdMasstp = properties.getBoolean("cmdMasstp",true); | ||||||
| 			cmdTphere = properties.getBoolean("cmdTphere",true); | 			cmdTphere = properties.getBoolean("cmdTphere",true); | ||||||
|  |                         cmdSuicide = properties.getBoolean("cmdSuicide", true); | ||||||
|  |                         cmdHeal = properties.getBoolean("cmdHeal",true); | ||||||
| 			globalmessages = properties.getBoolean("globalmessages",true); | 			globalmessages = properties.getBoolean("globalmessages",true); | ||||||
| 			cmdSay = properties.getBoolean("cmdSay",true); | 			cmdSay = properties.getBoolean("cmdSay",true); | ||||||
| 			cmdEzModo = properties.getBoolean("cmdEzModo",true); | 			cmdEzModo = properties.getBoolean("cmdEzModo",true); | ||||||
| @@ -171,6 +176,8 @@ public class vminecraftSettings { | |||||||
| 	public boolean cmdWho() {return cmdWho;} | 	public boolean cmdWho() {return cmdWho;} | ||||||
| 	public boolean stopFire() {return stopFire;} | 	public boolean stopFire() {return stopFire;} | ||||||
| 	public boolean stopTnt() {return stopTnt;} | 	public boolean stopTnt() {return stopTnt;} | ||||||
|  |         public boolean cmdSuicide() {return cmdSuicide;} | ||||||
|  |         public boolean cmdHeal() {return cmdHeal;} | ||||||
| 	 | 	 | ||||||
| 	//EzModo methods | 	//EzModo methods | ||||||
| 	public boolean isEzModo(String playerName) {return ezModo.contains(playerName);} | 	public boolean isEzModo(String playerName) {return ezModo.contains(playerName);} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 nossr50
					nossr50