forked from SteamWar/SteamWar
Remove unused code
This commit is contained in:
+6
-7
@@ -20,20 +20,22 @@
|
||||
package de.steamwar.fightsystem.commands;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import de.steamwar.core.CommandRemover;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.defaults.BukkitCommand;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.StringUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.Map;
|
||||
|
||||
@Linked
|
||||
public class GamemodeCommand extends BukkitCommand {
|
||||
@@ -47,11 +49,8 @@ public class GamemodeCommand extends BukkitCommand {
|
||||
aliases.add("gm");
|
||||
this.setAliases(aliases);
|
||||
|
||||
try {
|
||||
CommandRemover.removeAll("gamemode");
|
||||
} catch (Exception e) {
|
||||
FightSystem.getPlugin().getLogger().log(Level.SEVERE, "Failed to replace commands", e);
|
||||
}
|
||||
Map<String, Command> knownCommands = ((CraftServer) Bukkit.getServer()).getCommandMap().getKnownCommands();
|
||||
knownCommands.remove("gamemode");
|
||||
Commands.injectCommand(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
package de.steamwar.fightsystem.event;
|
||||
|
||||
import de.steamwar.core.TrickyTrialsWrapper;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.countdown.Countdown;
|
||||
@@ -31,6 +30,7 @@ import de.steamwar.fightsystem.utils.SWSound;
|
||||
import de.steamwar.fightsystem.winconditions.Winconditions;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import java.util.Arrays;
|
||||
@@ -98,13 +98,13 @@ public class HellsBells {
|
||||
currentDropping = Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), () -> {
|
||||
for (int w = 0; w < width; w++) {
|
||||
if (direction.isNorthOrWest()) {
|
||||
Config.world.spawnEntity(redStart.addAndToLocation(Config.world, -1 * (direction.dx * length.get() + w * direction.other().dx), 0, -1 * (direction.dz * length.get() + w * direction.other().dz)), TrickyTrialsWrapper.impl.getTntEntityType());
|
||||
Config.world.spawnEntity(redStart.addAndToLocation(Config.world, -1 * (direction.dx * length.get() + w * direction.other().dx), 0, -1 * (direction.dz * length.get() + w * direction.other().dz)), EntityType.TNT);
|
||||
|
||||
Config.world.spawnEntity(blueStart.addAndToLocation(Config.world, direction.dx * length.get() + w * direction.other().dx, 0, direction.dz * length.get() + w * direction.other().dz), TrickyTrialsWrapper.impl.getTntEntityType());
|
||||
Config.world.spawnEntity(blueStart.addAndToLocation(Config.world, direction.dx * length.get() + w * direction.other().dx, 0, direction.dz * length.get() + w * direction.other().dz), EntityType.TNT);
|
||||
} else {
|
||||
Config.world.spawnEntity(redStart.addAndToLocation(Config.world, direction.dx * length.get() + w * direction.other().dx, 0, direction.dz * length.get() + w * direction.other().dz), TrickyTrialsWrapper.impl.getTntEntityType());
|
||||
Config.world.spawnEntity(redStart.addAndToLocation(Config.world, direction.dx * length.get() + w * direction.other().dx, 0, direction.dz * length.get() + w * direction.other().dz), EntityType.TNT);
|
||||
|
||||
Config.world.spawnEntity(blueStart.addAndToLocation(Config.world, -1 * (direction.dx * length.get() + w * direction.other().dx), 0, -1 * (direction.dz * length.get() + w * direction.other().dz)), TrickyTrialsWrapper.impl.getTntEntityType());
|
||||
Config.world.spawnEntity(blueStart.addAndToLocation(Config.world, -1 * (direction.dx * length.get() + w * direction.other().dx), 0, -1 * (direction.dz * length.get() + w * direction.other().dz)), EntityType.TNT);
|
||||
}
|
||||
}
|
||||
if (length.addAndGet(-2) <= 0) {
|
||||
|
||||
@@ -113,14 +113,12 @@ public class Meteor implements Listener {
|
||||
|
||||
LargeFireball fireballRed = Config.world.spawn(redStart.toLocation(Config.world), LargeFireball.class);
|
||||
fireballRed.setDirection(vector);
|
||||
fireballRed.setBounce(false);
|
||||
fireballRed.setIsIncendiary(false);
|
||||
fireballRed.setYield(current.explosionSize);
|
||||
|
||||
LargeFireball fireballBlue = Config.world.spawn(blueStart.toLocation(Config.world), LargeFireball.class);
|
||||
vector.setZ(vector.getZ() * -1);
|
||||
fireballBlue.setDirection(vector);
|
||||
fireballBlue.setBounce(false);
|
||||
fireballBlue.setIsIncendiary(false);
|
||||
fireballBlue.setYield(current.explosionSize);
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ public class FightWorld extends StateDependent {
|
||||
Config.ArenaRegion.forEachChunk((x, z) -> {
|
||||
CraftbukkitWrapper.impl.resetChunk(Config.world, backup, x, z);
|
||||
for(Player p : Bukkit.getOnlinePlayers()) {
|
||||
de.steamwar.core.CraftbukkitWrapper.impl.sendChunk(p, x, z);
|
||||
de.steamwar.core.CraftbukkitWrapper.sendChunk(p, x, z);
|
||||
}
|
||||
});
|
||||
Bukkit.unloadWorld(backup, false);
|
||||
|
||||
@@ -21,7 +21,6 @@ package de.steamwar.fightsystem.listener;
|
||||
|
||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||
import de.steamwar.Reflection;
|
||||
import de.steamwar.core.TrickyTrialsWrapper;
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.events.TeamDeathEvent;
|
||||
@@ -226,7 +225,7 @@ public class Recording implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onTNTSpawn(EntitySpawnEvent e){
|
||||
if(e.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType())
|
||||
if(e.getEntityType() != EntityType.TNT)
|
||||
return;
|
||||
|
||||
GlobalRecorder.getInstance().tntSpawn(e.getEntity());
|
||||
@@ -234,7 +233,7 @@ public class Recording implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onExplosion(EntityExplodeEvent e){
|
||||
if(e.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType())
|
||||
if(e.getEntityType() != EntityType.TNT)
|
||||
return;
|
||||
|
||||
Location loc = e.getLocation();
|
||||
|
||||
@@ -108,6 +108,6 @@ public class Spectator implements Listener {
|
||||
}
|
||||
|
||||
private static void pseudoSpectator(Player player, boolean enable) {
|
||||
TinyProtocol.instance.sendPacket(player, ProtocolWrapper.impl.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.GAMEMODE, new GameProfile(player.getUniqueId(), player.getName()), enable ? GameMode.CREATIVE : GameMode.SPECTATOR));
|
||||
TinyProtocol.instance.sendPacket(player, ProtocolWrapper.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.GAMEMODE, new GameProfile(player.getUniqueId(), player.getName()), enable ? GameMode.CREATIVE : GameMode.SPECTATOR));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
package de.steamwar.fightsystem.listener;
|
||||
|
||||
import de.steamwar.core.TrickyTrialsWrapper;
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
@@ -31,6 +30,7 @@ import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
@@ -58,7 +58,7 @@ public class WaterRemover implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void handleEntitySpawn(EntitySpawnEvent event) {
|
||||
if(event.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType())
|
||||
if(event.getEntityType() != EntityType.TNT)
|
||||
return;
|
||||
|
||||
Location location = event.getLocation();
|
||||
|
||||
+10
-9
@@ -20,7 +20,6 @@
|
||||
package de.steamwar.fightsystem.record;
|
||||
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import de.steamwar.core.TrickyTrialsWrapper;
|
||||
import de.steamwar.core.WorldEditWrapper;
|
||||
import de.steamwar.entity.REntity;
|
||||
import de.steamwar.entity.REntityServer;
|
||||
@@ -56,6 +55,7 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
import org.bukkit.scoreboard.NameTagVisibility;
|
||||
@@ -305,7 +305,7 @@ public class PacketProcessor implements Listener {
|
||||
private void tntSpawn() throws IOException {
|
||||
int entityId = source.readInt();
|
||||
|
||||
execSync(() -> addREntity(entityId, new REntity(entityServer, TrickyTrialsWrapper.impl.getTntEntityType(), Config.SpecSpawn)));
|
||||
execSync(() -> addREntity(entityId, new REntity(entityServer, EntityType.TNT, Config.SpecSpawn)));
|
||||
}
|
||||
|
||||
private void entityVelocity() throws IOException {
|
||||
@@ -332,26 +332,27 @@ public class PacketProcessor implements Listener {
|
||||
if(enchanted)
|
||||
stack.addUnsafeEnchantment(Enchantment.UNBREAKING, 1);
|
||||
|
||||
Object slot;
|
||||
EquipmentSlot slot;
|
||||
switch(slotName){
|
||||
case "HEAD":
|
||||
slot = de.steamwar.core.ProtocolWrapper.itemSlots[5];
|
||||
slot = EquipmentSlot.HEAD;
|
||||
break;
|
||||
case "CHEST":
|
||||
slot = de.steamwar.core.ProtocolWrapper.itemSlots[4];
|
||||
slot = EquipmentSlot.CHEST;
|
||||
break;
|
||||
case "LEGS":
|
||||
slot = de.steamwar.core.ProtocolWrapper.itemSlots[3];
|
||||
slot = EquipmentSlot.LEGS;
|
||||
break;
|
||||
case "FEET":
|
||||
slot = de.steamwar.core.ProtocolWrapper.itemSlots[2];
|
||||
slot = EquipmentSlot.FEET;
|
||||
break;
|
||||
case "OFFHAND":
|
||||
slot = de.steamwar.core.ProtocolWrapper.itemSlots[1];
|
||||
slot = EquipmentSlot.OFF_HAND;
|
||||
break;
|
||||
case "MAINHAND":
|
||||
default:
|
||||
slot = de.steamwar.core.ProtocolWrapper.itemSlots[0];
|
||||
slot = EquipmentSlot.HAND;
|
||||
break;
|
||||
}
|
||||
|
||||
execSync(() -> entities.get(entityId).setItem(slot, stack));
|
||||
|
||||
@@ -59,7 +59,7 @@ public class BlockIdWrapper {
|
||||
|
||||
public void trackEntity(Player player, Entity entity) {
|
||||
if(entity instanceof Player)
|
||||
TinyProtocol.instance.sendPacket(player, ProtocolWrapper.impl.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.REMOVE, new GameProfile(entity.getUniqueId(), entity.getName()), GameMode.CREATIVE));
|
||||
TinyProtocol.instance.sendPacket(player, ProtocolWrapper.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.REMOVE, new GameProfile(entity.getUniqueId(), entity.getName()), GameMode.CREATIVE));
|
||||
|
||||
player.showEntity(FightSystem.getPlugin(), entity);
|
||||
}
|
||||
@@ -68,6 +68,6 @@ public class BlockIdWrapper {
|
||||
player.hideEntity(FightSystem.getPlugin(), entity);
|
||||
|
||||
if(entity instanceof Player)
|
||||
TinyProtocol.instance.sendPacket(player, ProtocolWrapper.impl.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.ADD, new GameProfile(entity.getUniqueId(), entity.getName()), GameMode.CREATIVE));
|
||||
TinyProtocol.instance.sendPacket(player, ProtocolWrapper.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.ADD, new GameProfile(entity.getUniqueId(), entity.getName()), GameMode.CREATIVE));
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -112,8 +112,9 @@ public class TechHiderWrapper extends StateDependent implements TechHider.Locati
|
||||
return;
|
||||
|
||||
region.forEachChunk((chunkX, chunkZ) -> {
|
||||
if(exclusion.chunkOutside(chunkX, chunkZ))
|
||||
CraftbukkitWrapper.impl.sendChunk(player, chunkX, chunkZ);
|
||||
if (exclusion.chunkOutside(chunkX, chunkZ)) {
|
||||
CraftbukkitWrapper.sendChunk(player, chunkX, chunkZ);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -77,9 +77,9 @@ public class WorldeditWrapper {
|
||||
Map<BaseBlock, BaseBlock> replaceMap = new HashMap<>();
|
||||
colorBlocks.forEach((base, postfix) -> replaceMap.put(base, Objects.requireNonNull(BlockTypes.get(c.name().toLowerCase() + postfix)).getDefaultState().toBaseBlock()));
|
||||
|
||||
for(int x = 0; x < clipboard.getDimensions().getX(); x++){
|
||||
for(int y = 0; y < clipboard.getDimensions().getY(); y++){
|
||||
for(int z = 0; z < clipboard.getDimensions().getZ(); z++){
|
||||
for(int x = 0; x < clipboard.getDimensions().x(); x++){
|
||||
for(int y = 0; y < clipboard.getDimensions().y(); y++){
|
||||
for(int z = 0; z < clipboard.getDimensions().z(); z++){
|
||||
BlockVector3 pos = minimum.add(x, y, z);
|
||||
BaseBlock replacement = replaceMap.get(clipboard.getFullBlock(pos));
|
||||
if(replacement != null)
|
||||
@@ -111,7 +111,7 @@ public class WorldeditWrapper {
|
||||
|
||||
public Vector getDimensions(Clipboard clipboard) {
|
||||
BlockVector3 dims = clipboard.getDimensions();
|
||||
return new Vector(dims.getX(), dims.getY(), dims.getZ());
|
||||
return new Vector(dims.x(), dims.y(), dims.z());
|
||||
}
|
||||
|
||||
public Clipboard loadChar(String charName) throws IOException {
|
||||
|
||||
+3
-3
@@ -19,7 +19,6 @@
|
||||
|
||||
package de.steamwar.fightsystem.winconditions;
|
||||
|
||||
import de.steamwar.core.TrickyTrialsWrapper;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.countdown.Countdown;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
@@ -32,6 +31,7 @@ import de.steamwar.fightsystem.utils.Message;
|
||||
import de.steamwar.fightsystem.utils.SWSound;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
@@ -72,7 +72,7 @@ public class WinconditionTimeTechKO extends Wincondition implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onSpawn(EntitySpawnEvent e) {
|
||||
if(e.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType())
|
||||
if(e.getEntityType() != EntityType.TNT)
|
||||
return;
|
||||
|
||||
Location location = e.getLocation();
|
||||
@@ -86,7 +86,7 @@ public class WinconditionTimeTechKO extends Wincondition implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onExplode(EntityExplodeEvent e) {
|
||||
if(e.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType())
|
||||
if(e.getEntityType() != EntityType.TNT)
|
||||
return;
|
||||
|
||||
FightTeam spawn = spawnLocations.remove(e.getEntity().getEntityId());
|
||||
|
||||
+2
-2
@@ -19,7 +19,6 @@
|
||||
|
||||
package de.steamwar.fightsystem.winconditions;
|
||||
|
||||
import de.steamwar.core.TrickyTrialsWrapper;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.countdown.Countdown;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
@@ -31,6 +30,7 @@ import de.steamwar.fightsystem.utils.Message;
|
||||
import de.steamwar.fightsystem.utils.SWSound;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
@@ -72,7 +72,7 @@ public class WinconditionTimedDamageTechKO extends Wincondition implements Print
|
||||
|
||||
@EventHandler
|
||||
public void onExplode(EntityExplodeEvent e) {
|
||||
if (e.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType())
|
||||
if (e.getEntityType() != EntityType.TNT)
|
||||
return;
|
||||
|
||||
Location location = e.getLocation();
|
||||
|
||||
Reference in New Issue
Block a user