mirror of
https://github.com/essentials/Essentials.git
synced 2025-09-02 19:22:37 +02:00
Removing /nuke and /antioch
This commit is contained in:
@@ -45,7 +45,6 @@ import net.ess3.settings.SettingsHolder;
|
||||
import net.ess3.settings.SpawnsHolder;
|
||||
import net.ess3.user.UserMap;
|
||||
import net.ess3.utils.ExecuteTimer;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
@@ -57,7 +56,6 @@ import org.yaml.snakeyaml.error.YAMLException;
|
||||
public class Essentials implements IEssentials
|
||||
{
|
||||
private transient ISettings settings;
|
||||
private final transient TntExplodeListener tntListener = new TntExplodeListener(this);
|
||||
private transient IJails jails;
|
||||
private transient IKits kits;
|
||||
private transient IWarps warps;
|
||||
@@ -214,8 +212,6 @@ public class Essentials implements IEssentials
|
||||
jails = new Jails(this);
|
||||
reloadList.add(jails);
|
||||
|
||||
pm.registerEvents(tntListener, this);
|
||||
|
||||
|
||||
timer = new EssentialsTimer(this);
|
||||
getPlugin().scheduleSyncRepeatingTask(timer, 1, 100);
|
||||
@@ -372,12 +368,6 @@ public class Essentials implements IEssentials
|
||||
return getServer().getOnlinePlayers().size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TntExplodeListener getTNTListener()
|
||||
{
|
||||
return tntListener;
|
||||
}
|
||||
|
||||
/*
|
||||
* @Override public PermissionsHandler getPermissionsHandler() { return permissionsHandler; }
|
||||
*/
|
||||
|
@@ -1,15 +1,12 @@
|
||||
package net.ess3.api;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
import net.ess3.EssentialsTimer;
|
||||
import net.ess3.api.server.Plugin;
|
||||
import net.ess3.api.server.Server;
|
||||
import net.ess3.api.server.World;
|
||||
import net.ess3.economy.register.Methods;
|
||||
import net.ess3.listener.TntExplodeListener;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.List;
|
||||
import net.ess3.EssentialsTimer;
|
||||
import net.ess3.economy.register.Methods;
|
||||
import net.ess3.listener.TntExplodeListener;
|
||||
import net.ess3.metrics.Metrics;
|
||||
|
||||
|
||||
@@ -51,7 +48,6 @@ public interface IEssentials extends IComponent
|
||||
//int scheduleSyncRepeatingTask(Runnable run, long delay, long period);
|
||||
//IPermissionsHandler getPermissionsHandler();
|
||||
//void reload();
|
||||
TntExplodeListener getTNTListener();
|
||||
|
||||
void setRanks(IRanks groups);
|
||||
|
||||
|
@@ -1,24 +0,0 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.api.server.Location;
|
||||
import net.ess3.utils.LocationUtil;
|
||||
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
|
||||
//TODO: Remove this?
|
||||
public class Commandantioch extends EssentialsCommand
|
||||
{
|
||||
@Override
|
||||
public void run(final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
if (args.length > 0)
|
||||
{
|
||||
ess.broadcastMessage(user, "...lobbest thou thy Holy Hand Grenade of Antioch towards thy foe,");
|
||||
ess.broadcastMessage(user, "who being naughty in My sight, shall snuff it.");
|
||||
}
|
||||
|
||||
final Location loc = LocationUtil.getTarget(user);
|
||||
loc.getWorld().spawn(loc, TNTPrimed.class);
|
||||
}
|
||||
}
|
@@ -1,54 +0,0 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.server.CommandSender;
|
||||
import net.ess3.api.server.Location;
|
||||
import net.ess3.api.server.Player;
|
||||
import net.ess3.api.server.World;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
|
||||
|
||||
public class Commandnuke extends EssentialsCommand
|
||||
{
|
||||
@Override
|
||||
protected void run(final CommandSender sender, final String commandLabel, final String[] args) throws NoSuchFieldException, NotEnoughArgumentsException
|
||||
{
|
||||
List<Player> targets;
|
||||
if (args.length > 0)
|
||||
{
|
||||
targets = new ArrayList<Player>();
|
||||
int pos = 0;
|
||||
for (String arg : args)
|
||||
{
|
||||
targets.add(getPlayer(args, pos));
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
targets = Arrays.asList(server.getOnlinePlayers());
|
||||
}
|
||||
ess.getTNTListener().enable();
|
||||
for (Player player : targets)
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
player.sendMessage(_("nuke"));
|
||||
final Location loc = player.getLocation();
|
||||
final World world = loc.getWorld();
|
||||
for (int x = -10; x <= 10; x += 5)
|
||||
{
|
||||
for (int z = -10; z <= 10; z += 5)
|
||||
{
|
||||
final Location tntloc = Location(world, loc.getBlockX() + x, world.getMaxHeight(), loc.getBlockZ() + z);
|
||||
final TNTPrimed tnt = world.spawn(tntloc, TNTPrimed.class);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,62 +0,0 @@
|
||||
package net.ess3.listener;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import net.ess3.api.IEssentials;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
|
||||
|
||||
public class TntExplodeListener implements Listener, Runnable
|
||||
{
|
||||
private final transient IEssentials ess;
|
||||
private transient AtomicBoolean enabled = new AtomicBoolean(false);
|
||||
private transient int timer = -1;
|
||||
|
||||
public TntExplodeListener(final IEssentials ess)
|
||||
{
|
||||
super();
|
||||
this.ess = ess;
|
||||
}
|
||||
|
||||
public void enable()
|
||||
{
|
||||
if (enabled.compareAndSet(false, true))
|
||||
{
|
||||
timer = ess.scheduleSyncDelayedTask(this, 1000);
|
||||
return;
|
||||
}
|
||||
if (timer != -1)
|
||||
{
|
||||
ess.getServer().getScheduler().cancelTask(timer);
|
||||
timer = ess.scheduleSyncDelayedTask(this, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onEntityExplode(final EntityExplodeEvent event)
|
||||
{
|
||||
if (!enabled.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (event.getEntity() instanceof LivingEntity)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (event.blockList().size() < 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
event.getLocation().getWorld().createExplosion(event.getLocation(), 0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
enabled.set(false);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user