Move debug commands over to the proper system
This commit is contained in:
parent
08bd17afe6
commit
30fb899bee
@ -1,16 +1,30 @@
|
||||
package nautilus.game.arcade.game.games.smash;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
import com.google.common.collect.Sets;
|
||||
import mineplex.core.blockrestore.BlockRestore;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.*;
|
||||
import mineplex.core.hologram.Hologram;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.ArcadeFormat;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.DebugCommand;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.GameTeam.PlayerState;
|
||||
import nautilus.game.arcade.game.games.smash.kits.*;
|
||||
import nautilus.game.arcade.game.games.smash.perks.SmashUltimate;
|
||||
import nautilus.game.arcade.game.modules.compass.CompassModule;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.EnderCrystal;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
@ -18,70 +32,19 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.BlockFadeEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.*;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
||||
import org.bukkit.event.entity.ItemSpawnEvent;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import mineplex.core.blockrestore.BlockRestore;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.hologram.Hologram;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
|
||||
import nautilus.game.arcade.ArcadeFormat;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.GameTeam.PlayerState;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitBlaze;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitChicken;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitCow;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitCreeper;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitEnderman;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitGolem;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitGuardian;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitMagmaCube;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitPig;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSheep;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSkeletalHorse;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSkeleton;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSkySquid;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSlime;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSnowman;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSpider;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitWitch;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitWitherSkeleton;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitWolf;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitZombie;
|
||||
import nautilus.game.arcade.game.games.smash.perks.SmashUltimate;
|
||||
import nautilus.game.arcade.game.modules.compass.CompassModule;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public abstract class SuperSmash extends Game
|
||||
{
|
||||
@ -128,6 +91,80 @@ public abstract class SuperSmash extends Game
|
||||
new CompassModule()
|
||||
.setGiveCompassToAlive(true)
|
||||
.register(this);
|
||||
|
||||
registerDebugCommand(new DebugCommand("cooldown", Rank.ADMIN)
|
||||
{
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
{
|
||||
Recharge.Instance.Reset(other);
|
||||
}
|
||||
|
||||
Announce(C.cWhiteB + caller.getName() + C.cAquaB + " reset cooldowns!");
|
||||
}
|
||||
});
|
||||
registerDebugCommand(new DebugCommand("nextsmash", Rank.ADMIN)
|
||||
{
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
_nextPowerup = System.currentTimeMillis() + 1000;
|
||||
Announce(C.cWhiteB + caller.getName() + C.cAquaB + " spawned a smash crystal!");
|
||||
}
|
||||
});
|
||||
registerDebugCommand(new DebugCommand("smash", Rank.ADMIN)
|
||||
{
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
giveSmashItem(caller);
|
||||
}
|
||||
});
|
||||
registerDebugCommand(new DebugCommand("kit", Rank.ADMIN)
|
||||
{
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
String kit = "";
|
||||
|
||||
for (int i = 0; i < args.length; i++)
|
||||
{
|
||||
kit += args[i] + " ";
|
||||
}
|
||||
|
||||
kit = kit.trim();
|
||||
|
||||
for (Kit kits : GetKits())
|
||||
{
|
||||
if (kit.equalsIgnoreCase(kits.GetName()))
|
||||
{
|
||||
SetKit(caller, kits, true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
caller.sendMessage(F.main("Kit", "Sorry that is not a kit!"));
|
||||
}
|
||||
});
|
||||
registerDebugCommand(new DebugCommand("lives", Rank.ADMIN)
|
||||
{
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
Announce(C.cWhiteB + caller.getName() + C.cAquaB + " reset their lives!");
|
||||
|
||||
if (!IsAlive(caller))
|
||||
{
|
||||
SetPlayerState(caller, PlayerState.IN);
|
||||
RespawnPlayer(caller);
|
||||
caller.sendMessage(F.main("Revive", "You are back in the game!"));
|
||||
}
|
||||
|
||||
_lives.put(caller, MAX_LIVES);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
@ -153,18 +190,6 @@ public abstract class SuperSmash extends Game
|
||||
{
|
||||
SetPlayerState(event.getEntity(), PlayerState.OUT);
|
||||
}
|
||||
|
||||
// I think this causes players to sometimes be invisible
|
||||
// DisguiseManager disguiseManager = Manager.GetDisguise();
|
||||
// DisguiseBase disguise =
|
||||
// disguiseManager.getActiveDisguise(event.getEntity());
|
||||
//
|
||||
// if (disguise == null)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// disguiseManager.undisguise(disguise);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -696,81 +721,4 @@ public abstract class SuperSmash extends Game
|
||||
{
|
||||
return _lives;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void debugCommands(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
if (!UtilServer.isTestServer())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
String message = event.getMessage();
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (message.startsWith("/cooldown"))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
{
|
||||
Recharge.Instance.Reset(other);
|
||||
}
|
||||
|
||||
Announce(C.cWhiteB + player.getName() + C.cAquaB + " reset cooldowns!");
|
||||
}
|
||||
else if (message.startsWith("/nextsmash"))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
|
||||
_nextPowerup = System.currentTimeMillis() + 1000;
|
||||
Announce(C.cWhiteB + player.getName() + C.cAquaB + " spawned a smash crystal!");
|
||||
}
|
||||
else if (message.startsWith("/smash"))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
|
||||
giveSmashItem(player);
|
||||
}
|
||||
else if (message.startsWith("/kit"))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
|
||||
String[] args = message.split(" ");
|
||||
String kit = "";
|
||||
|
||||
for (int i = 1; i < args.length; i++)
|
||||
{
|
||||
kit += args[i] + " ";
|
||||
}
|
||||
|
||||
kit = kit.trim();
|
||||
|
||||
for (Kit kits : GetKits())
|
||||
{
|
||||
if (kit.equalsIgnoreCase(kits.GetName()))
|
||||
{
|
||||
SetKit(player, kits, true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
player.sendMessage(F.main("Kit", "Sorry that is not a kit!"));
|
||||
}
|
||||
else if (message.startsWith("/lives"))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
|
||||
Announce(C.cWhiteB + player.getName() + C.cAquaB + " reset their lives!");
|
||||
|
||||
if (!IsAlive(player))
|
||||
{
|
||||
SetPlayerState(player, PlayerState.IN);
|
||||
RespawnPlayer(player);
|
||||
player.sendMessage(F.main("Revive", "You are back in the game!"));
|
||||
}
|
||||
|
||||
_lives.put(player, MAX_LIVES);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user