mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 14:46:46 +01:00
Added a /freeze command for fun
This commit is contained in:
parent
53c00d6c55
commit
ad29bb2bbb
@ -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.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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,7 +176,39 @@ public class vMinecraftCommands{
|
|||||||
.globalmessages());
|
.globalmessages());
|
||||||
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")){
|
||||||
|
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)
|
//Function: prefix (/prefix)
|
||||||
//Input: Player player: The player using the command
|
//Input: Player player: The player using the command
|
||||||
|
@ -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.frozenplayers.contains(player)){
|
||||||
|
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)
|
||||||
|
@ -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");
|
||||||
@ -234,6 +238,8 @@ public class vMinecraftSettings {
|
|||||||
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
|
||||||
|
Loading…
Reference in New Issue
Block a user