mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-29 16:46:46 +01:00
Added /myspawn, a command that will return players to their home with penalties.
This commit is contained in:
parent
f7254d3492
commit
da86708f67
@ -60,6 +60,7 @@ public class vMinecraftCommands{
|
|||||||
cl.register("/tphere", "tphere");
|
cl.register("/tphere", "tphere");
|
||||||
cl.register("/tpback", "tpback");
|
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");
|
||||||
|
cl.register("/myspawn", "myspawn");
|
||||||
|
|
||||||
//Health
|
//Health
|
||||||
cl.register("/ezmodo", "invuln", "Toggle invulnerability");
|
cl.register("/ezmodo", "invuln", "Toggle invulnerability");
|
||||||
@ -197,6 +198,28 @@ public class vMinecraftCommands{
|
|||||||
}
|
}
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
//=====================================================================
|
||||||
|
//Function: myspawn (/myspawn)
|
||||||
|
//Input: Player player: The player using the command
|
||||||
|
//Output: int: Exit Code
|
||||||
|
//Use: Returns a player to their home but with penalties
|
||||||
|
//=====================================================================
|
||||||
|
public static int myspawn(Player player, String[] args){
|
||||||
|
if(player.canUseCommand("/myspawn") && vMinecraftSettings.getInstance().playerspawn())
|
||||||
|
{
|
||||||
|
player.sendMessage(Colors.DarkPurple + "Returned to myspawn");
|
||||||
|
player.sendMessage(Colors.Red + "Penalty: Inventory Cleared");
|
||||||
|
player.setHealth(20);
|
||||||
|
Warp home = null;
|
||||||
|
home = etc.getDataSource().getHome(player.getName());
|
||||||
|
player.teleportTo(home.Location);
|
||||||
|
Inventory inv = player.getInventory();
|
||||||
|
inv.clearContents();
|
||||||
|
inv.update();
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
return EXIT_FAIL;
|
||||||
|
}
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
//Function: prefix (/prefix)
|
//Function: prefix (/prefix)
|
||||||
//Input: Player player: The player using the command
|
//Input: Player player: The player using the command
|
||||||
|
@ -96,6 +96,12 @@ public class vMinecraftListener extends PluginListener {
|
|||||||
Warp home = null;
|
Warp home = null;
|
||||||
home = etc.getDataSource().getHome(player.getName());
|
home = etc.getDataSource().getHome(player.getName());
|
||||||
player.teleportTo(home.Location);
|
player.teleportTo(home.Location);
|
||||||
|
//Makes sure the player has a custom home before telling them about /myspawn
|
||||||
|
if(etc.getServer().getSpawnLocation() != etc.getDataSource().getHome(player.getName()).Location){
|
||||||
|
player.sendMessage(Colors.DarkPurple + "Return here with /myspawn, the penalty for returning is the complete loss of inventory");
|
||||||
|
} else {
|
||||||
|
player.sendMessage(Colors.DarkPurple + "Set your own spawn with /myspawn");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
vMinecraftUsers.getProfile(player).isDead(false);
|
vMinecraftUsers.getProfile(player).isDead(false);
|
||||||
vMinecraftChat.gmsg(Colors.Gray + player.getName() + " " + vMinecraftSettings.randomDeathMsg());
|
vMinecraftChat.gmsg(Colors.Gray + player.getName() + " " + vMinecraftSettings.randomDeathMsg());
|
||||||
|
Loading…
Reference in New Issue
Block a user