mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-06-11 21:43:54 +00:00
//UNTESTED: add personal jumppads
This commit is contained in:
@ -9,7 +9,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Manage jumppads", usage = "/<command> <on | off | info | sideways <on | off> | strength <strength (1-10)>>", aliases = "launchpads,jp")
|
||||
@CommandParameters(description = "Manage jumppads", usage = "/<command> <on | off | info | sideways <on | off>>", aliases = "launchpads,jp")
|
||||
public class Command_jumppads extends FreedomCommand
|
||||
{
|
||||
|
||||
@ -25,28 +25,37 @@ public class Command_jumppads extends FreedomCommand
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("info"))
|
||||
{
|
||||
msg("Jumppads: " + (plugin.jp.getMode().isOn() ? "Enabled" : "Disabled"), ChatColor.BLUE);
|
||||
msg("Sideways: " + (plugin.jp.getMode() == Jumppads.JumpPadMode.NORMAL_AND_SIDEWAYS ? "Enabled" : "Disabled"), ChatColor.BLUE);
|
||||
msg("Strength: " + (plugin.jp.getStrength() * 10 - 1), ChatColor.BLUE);
|
||||
msg("Jumppads: " + (plugin.jp.players.get(playerSender).isOn() ? "Enabled" : "Disabled"), ChatColor.BLUE);
|
||||
msg("Sideways: " + (plugin.jp.players.get(playerSender) == Jumppads.JumpPadMode.NORMAL_AND_SIDEWAYS ? "Enabled" : "Disabled"), ChatColor.BLUE);
|
||||
return true;
|
||||
}
|
||||
|
||||
if ("off".equals(args[0]))
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Disabling Jumppads", false);
|
||||
plugin.jp.setMode(Jumppads.JumpPadMode.OFF);
|
||||
if(plugin.jp.players.get(playerSender) == Jumppads.JumpPadMode.OFF)
|
||||
{
|
||||
msg("Your jumppads are already disabled.");
|
||||
return true;
|
||||
}
|
||||
msg("Disabled your jumppads.", ChatColor.GRAY);
|
||||
plugin.jp.players.put(playerSender, Jumppads.JumpPadMode.OFF);
|
||||
}
|
||||
else
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Enabling Jumppads", false);
|
||||
plugin.jp.setMode(Jumppads.JumpPadMode.MADGEEK);
|
||||
if(plugin.jp.players.get(playerSender) != Jumppads.JumpPadMode.OFF)
|
||||
{
|
||||
msg("Your jumppads are already enabled.");
|
||||
return true;
|
||||
}
|
||||
msg("Enabled your jumpppads.", ChatColor.GRAY);
|
||||
plugin.jp.players.put(playerSender, Jumppads.JumpPadMode.MADGEEK);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (plugin.jp.getMode() == Jumppads.JumpPadMode.OFF)
|
||||
if (plugin.jp.players.get(playerSender) == Jumppads.JumpPadMode.OFF)
|
||||
{
|
||||
msg("Jumppads are currently disabled, please enable them before changing jumppads settings.");
|
||||
msg("Your jumppads are currently disabled, please enable them before changing jumppads settings.");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -54,43 +63,30 @@ public class Command_jumppads extends FreedomCommand
|
||||
{
|
||||
if ("off".equals(args[1]))
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Setting Jumppads mode to: Madgeek", false);
|
||||
plugin.jp.setMode(Jumppads.JumpPadMode.MADGEEK);
|
||||
if(plugin.jp.players.get(playerSender) == Jumppads.JumpPadMode.MADGEEK)
|
||||
{
|
||||
msg("Your jumppads are already set to normal mode.");
|
||||
return true;
|
||||
}
|
||||
msg("Set Jumppads mode to: Normal", ChatColor.GRAY);
|
||||
plugin.jp.players.put(playerSender, Jumppads.JumpPadMode.MADGEEK);
|
||||
}
|
||||
else
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Setting Jumppads mode to: Normal and Sideways", false);
|
||||
plugin.jp.setMode(Jumppads.JumpPadMode.NORMAL_AND_SIDEWAYS);
|
||||
if(plugin.jp.players.get(playerSender) == Jumppads.JumpPadMode.NORMAL_AND_SIDEWAYS)
|
||||
{
|
||||
msg("Your jumppads are already set to normal and sideways mode.");
|
||||
return true;
|
||||
}
|
||||
msg("Set Jumppads mode to: Normal and Sideways", ChatColor.GRAY);
|
||||
plugin.jp.players.put(playerSender, Jumppads.JumpPadMode.NORMAL_AND_SIDEWAYS);
|
||||
}
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("strength"))
|
||||
{
|
||||
final float strength;
|
||||
try
|
||||
{
|
||||
strength = Float.parseFloat(args[1]);
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
msg("Invalid Strength");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (strength > 10 || strength < 1)
|
||||
{
|
||||
msg("Invalid Strength: The strength may be 1 through 10.");
|
||||
return true;
|
||||
}
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Setting Jumppads strength to: " + String.valueOf(strength), false);
|
||||
plugin.jp.setStrength((strength / 10) + 0.1F);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user