forked from SteamWar/SteamWar
Remove unused code
This commit is contained in:
+1
-2
@@ -22,7 +22,6 @@ package de.steamwar.bausystem.features.gui.editor;
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.features.gui.BauGUI;
|
||||
import de.steamwar.bausystem.linkage.BauGuiItem;
|
||||
import de.steamwar.core.TrickyTrialsWrapper;
|
||||
import de.steamwar.data.CMDs;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import de.steamwar.inventory.SWListInv;
|
||||
@@ -74,7 +73,7 @@ public class BauGuiEditor implements Listener {
|
||||
|
||||
inv.setItem(mapping.getSize() + 5, new SWItem(Material.BARRIER, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_TRASH", p), Arrays.asList(BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_TRASH_LORE", p)), false, clickType -> {
|
||||
}).getItemStack());
|
||||
inv.setItem(mapping.getSize() + 6, new SWItem(TrickyTrialsWrapper.impl.getTurtleScute(), BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_MORE", p)).getItemStack());
|
||||
inv.setItem(mapping.getSize() + 6, new SWItem(Material.TURTLE_SCUTE, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_MORE", p)).getItemStack());
|
||||
inv.setItem(mapping.getSize() + 8, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_CLOSE", p)).setCustomModelData(CMDs.BACK).getItemStack());
|
||||
|
||||
p.openInventory(inv);
|
||||
|
||||
+3
-3
@@ -20,9 +20,9 @@
|
||||
package de.steamwar.bausystem.features.loadtimer;
|
||||
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.core.TrickyTrialsWrapper;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
@@ -57,7 +57,7 @@ public class LoadtimerListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onEntitySpawn(EntitySpawnEvent event) {
|
||||
if (!getTimers().isEmpty() && event.getEntityType() == TrickyTrialsWrapper.impl.getTntEntityType()) {
|
||||
if (!getTimers().isEmpty() && event.getEntityType() == EntityType.TNT) {
|
||||
Region r = Region.getRegion(event.getLocation());
|
||||
if (hasTimer(r)) {
|
||||
getTimer(r).onTntSpawn();
|
||||
@@ -67,7 +67,7 @@ public class LoadtimerListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onEntityExplode(EntityExplodeEvent event) {
|
||||
if (!getTimers().isEmpty() && event.getEntityType() == TrickyTrialsWrapper.impl.getTntEntityType()) {
|
||||
if (!getTimers().isEmpty() && event.getEntityType() == EntityType.TNT) {
|
||||
Region r = Region.getRegion(event.getLocation());
|
||||
if (hasTimer(r)) {
|
||||
getTimer(r).onTntExplode(event);
|
||||
|
||||
+2
-2
@@ -24,7 +24,6 @@ import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.FreezeMode;
|
||||
import de.steamwar.bausystem.utils.ScoreboardElement;
|
||||
import de.steamwar.core.TrickyTrialsWrapper;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
@@ -32,6 +31,7 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.data.type.NoteBlock;
|
||||
import org.bukkit.block.data.type.Switch;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@@ -59,7 +59,7 @@ public class FreezeListener implements Listener, ScoreboardElement {
|
||||
public void onEntitySpawn(EntitySpawnEvent e) {
|
||||
if (Region.getRegion(e.getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.INACTIVE)) return;
|
||||
e.setCancelled(true);
|
||||
if (e.getEntityType() == TrickyTrialsWrapper.impl.getTntEntityType()) {
|
||||
if (e.getEntityType() == EntityType.TNT) {
|
||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
||||
e.getLocation().getBlock().setType(Material.TNT, false);
|
||||
}, 1L);
|
||||
|
||||
+3
-3
@@ -26,10 +26,10 @@ import de.steamwar.bausystem.features.script.lua.SteamWarGlobalLuaPlugin;
|
||||
import de.steamwar.bausystem.features.script.lua.libs.StorageLib;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.core.SWPlayer;
|
||||
import de.steamwar.core.TrickyTrialsWrapper;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@@ -141,7 +141,7 @@ public class EventListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onEntitySpawn(EntitySpawnEvent event) {
|
||||
if (event.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType()) {
|
||||
if (event.getEntityType() != EntityType.TNT) {
|
||||
return;
|
||||
}
|
||||
Region tntRegion = Region.getRegion(event.getLocation());
|
||||
@@ -156,7 +156,7 @@ public class EventListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onEntityExplode(EntityExplodeEvent event) {
|
||||
if (event.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType()) {
|
||||
if (event.getEntityType() != EntityType.TNT) {
|
||||
return;
|
||||
}
|
||||
Region tntRegion = Region.getRegion(event.getLocation());
|
||||
|
||||
+1
-2
@@ -22,7 +22,6 @@ package de.steamwar.bausystem.features.team.boundary;
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.region.Point;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.core.TrickyParticleWrapper;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Particle;
|
||||
@@ -53,7 +52,7 @@ public class BoundaryViewer implements Listener {
|
||||
}
|
||||
|
||||
private void showRegion(Region region, Player player) {
|
||||
drawCuboid(player, TrickyParticleWrapper.impl.getVillagerHappy(), region.getArea().getMinPoint(false), region.getArea().getMaxPoint(false));
|
||||
drawCuboid(player, Particle.HAPPY_VILLAGER, region.getArea().getMinPoint(false), region.getArea().getMaxPoint(false));
|
||||
if (!region.getTestblockArea().isEmpty()) {
|
||||
drawCuboid(player, Particle.END_ROD, region.getTestblockArea().getMinPoint(true), region.getTestblockArea().getMaxPoint(true));
|
||||
}
|
||||
|
||||
+1
-1
@@ -92,7 +92,7 @@ public class TechHiderCommand extends SWCommand implements Listener, ScoreboardE
|
||||
BauSystem.MESSAGE.sendPrefixless("TECHHIDER_ON", player, ChatMessageType.ACTION_BAR);
|
||||
}
|
||||
region.getBuildArea().forEachChunk((x, z) -> {
|
||||
CraftbukkitWrapper.impl.sendChunk(player, x, z);
|
||||
CraftbukkitWrapper.sendChunk(player, x, z);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -147,6 +147,6 @@ public class NoClipCommand extends SWCommand implements Listener {
|
||||
}
|
||||
|
||||
private static void pseudoGameMode(Player player, GameMode gameMode) {
|
||||
TinyProtocol.instance.sendPacket(player, ProtocolWrapper.impl.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.GAMEMODE, new GameProfile(player.getUniqueId(), player.getName()), gameMode));
|
||||
TinyProtocol.instance.sendPacket(player, ProtocolWrapper.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.GAMEMODE, new GameProfile(player.getUniqueId(), player.getName()), gameMode));
|
||||
}
|
||||
}
|
||||
@@ -92,7 +92,7 @@ public class XrayCommand extends SWCommand implements Listener, ScoreboardElemen
|
||||
BauSystem.MESSAGE.sendPrefixless("XRAY_ON", player, ChatMessageType.ACTION_BAR);
|
||||
}
|
||||
region.getBuildArea().forEachChunk((x, z) -> {
|
||||
CraftbukkitWrapper.impl.sendChunk(player, x, z);
|
||||
CraftbukkitWrapper.sendChunk(player, x, z);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+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();
|
||||
|
||||
@@ -84,7 +84,8 @@ public class FightWorld {
|
||||
worldChunk.heightmaps.clear();
|
||||
worldChunk.heightmaps.putAll(backupChunk.heightmaps);
|
||||
|
||||
for(Player p : Bukkit.getOnlinePlayers())
|
||||
CraftbukkitWrapper.impl.sendChunk(p, x, z);
|
||||
for(Player p : Bukkit.getOnlinePlayers()) {
|
||||
CraftbukkitWrapper.sendChunk(p, x, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.core;
|
||||
|
||||
import lombok.experimental.UtilityClass;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.contents.PlainTextContents;
|
||||
import net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket;
|
||||
import net.minecraft.network.syncher.SynchedEntityData;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@UtilityClass
|
||||
public class ChatWrapper {
|
||||
public Object stringToChatComponent(String text) {
|
||||
return MutableComponent.create(PlainTextContents.create(text));
|
||||
}
|
||||
|
||||
public Object getDataWatcherPacket(int entityId, Object... dataWatcherKeyValues) {
|
||||
ArrayList<SynchedEntityData.DataValue<?>> nativeWatchers = new ArrayList<>(1);
|
||||
for(int i = 0; i < dataWatcherKeyValues.length; i+=2) {
|
||||
nativeWatchers.add(((SynchedEntityData.DataItem<?>) BountifulWrapper.impl.getDataWatcherItem(dataWatcherKeyValues[i], dataWatcherKeyValues[i+1])).value());
|
||||
}
|
||||
|
||||
return new ClientboundSetEntityDataPacket(entityId, nativeWatchers);
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.core;
|
||||
|
||||
import lombok.experimental.UtilityClass;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@UtilityClass
|
||||
public class CommandRemover {
|
||||
private static final Map<String, Command> knownCommands = ((CraftServer) Bukkit.getServer()).getCommandMap().getKnownCommands();
|
||||
|
||||
public static void removeAll(String... cmds) {
|
||||
for (String cmd : cmds) {
|
||||
knownCommands.remove(cmd.toLowerCase());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,15 +20,15 @@
|
||||
package de.steamwar.core;
|
||||
|
||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket;
|
||||
import net.minecraft.world.level.chunk.LevelChunk;
|
||||
import net.minecraft.world.level.chunk.status.ChunkStatus;
|
||||
import org.bukkit.craftbukkit.CraftChunk;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@UtilityClass
|
||||
public class CraftbukkitWrapper {
|
||||
public static final CraftbukkitWrapper impl = new CraftbukkitWrapper();
|
||||
|
||||
public void sendChunk(Player p, int chunkX, int chunkZ) {
|
||||
LevelChunk chunk = (LevelChunk) ((CraftChunk) p.getWorld().getChunkAt(chunkX, chunkZ)).getHandle(ChunkStatus.FULL);
|
||||
TinyProtocol.instance.sendPacket(p, new ClientboundLevelChunkWithLightPacket(chunk, chunk.level.getLightEngine(), null, null, true));
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
package de.steamwar.core;
|
||||
|
||||
import lombok.experimental.UtilityClass;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.contents.PlainTextContents;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@@ -27,6 +29,6 @@ import java.util.Optional;
|
||||
public class FlatteningWrapper {
|
||||
|
||||
public Object formatDisplayName(String displayName) {
|
||||
return displayName != null ? Optional.of(ChatWrapper.stringToChatComponent(displayName)) : Optional.empty();
|
||||
return displayName != null ? Optional.of((Object) MutableComponent.create(PlainTextContents.create(displayName))) : Optional.empty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,30 +20,22 @@
|
||||
package de.steamwar.core;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import net.minecraft.network.protocol.game.ClientboundAddEntityPacket;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import net.minecraft.network.protocol.game.ClientboundPlayerInfoRemovePacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundPlayerInfoUpdatePacket;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.GameType;
|
||||
import org.bukkit.GameMode;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
|
||||
@UtilityClass
|
||||
public class ProtocolWrapper {
|
||||
|
||||
public static final Class<?> itemStack = ItemStack.class;
|
||||
public static final Class<?> spawnPacket = ClientboundAddEntityPacket.class;
|
||||
|
||||
// 0: hand, 1: offhand, 2: feet, 3: legs, 4: chest, 5: head
|
||||
public static final EquipmentSlot[] itemSlots = EquipmentSlot.values();
|
||||
|
||||
public static final ProtocolWrapper impl = new ProtocolWrapper();
|
||||
|
||||
public Object playerInfoPacketConstructor(PlayerInfoAction action, GameProfile profile, GameMode mode) {
|
||||
if(action == PlayerInfoAction.REMOVE)
|
||||
if(action == PlayerInfoAction.REMOVE) {
|
||||
return new ClientboundPlayerInfoRemovePacket(Collections.singletonList(profile.getId()));
|
||||
}
|
||||
|
||||
return new ClientboundPlayerInfoUpdatePacket(action == PlayerInfoAction.ADD ?
|
||||
EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, ClientboundPlayerInfoUpdatePacket.Action.UPDATE_GAME_MODE) : EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_GAME_MODE),
|
||||
|
||||
@@ -68,21 +68,17 @@ public class TPSWatcher {
|
||||
case TEN_SECONDS:
|
||||
return round(tps_TenSecond.tps);
|
||||
case ONE_MINUTE:
|
||||
return round(getSpigotTPS()[0]);
|
||||
return round(MinecraftServer.getServer().tps1.getAverage());
|
||||
case FIVE_MINUTES:
|
||||
return round(getSpigotTPS()[1]);
|
||||
return round(MinecraftServer.getServer().tps5.getAverage());
|
||||
case TEN_MINUTES:
|
||||
return round(getSpigotTPS()[2]);
|
||||
return round(MinecraftServer.getServer().tps15.getAverage());
|
||||
case ONE_SECOND:
|
||||
default:
|
||||
return round(tps_OneSecond.tps);
|
||||
}
|
||||
}
|
||||
|
||||
private static double[] getSpigotTPS() {
|
||||
return MinecraftServer.getServer().recentTps;
|
||||
}
|
||||
|
||||
private static double round(double d) {
|
||||
return Math.round(d * 10) / 10.0;
|
||||
}
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.core;
|
||||
|
||||
import org.bukkit.Particle;
|
||||
|
||||
public class TrickyParticleWrapper {
|
||||
public static final TrickyParticleWrapper impl = new TrickyParticleWrapper();
|
||||
|
||||
public Particle getVillagerHappy() {
|
||||
return Particle.HAPPY_VILLAGER;
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.core;
|
||||
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
public class TrickyTrialsWrapper {
|
||||
public static final TrickyTrialsWrapper impl = new TrickyTrialsWrapper();
|
||||
|
||||
public EntityType getTntEntityType() {
|
||||
return EntityType.TNT;
|
||||
}
|
||||
|
||||
public Enchantment getUnbreakingEnchantment() {
|
||||
return Enchantment.UNBREAKING;
|
||||
}
|
||||
|
||||
public Material getTurtleScute() {
|
||||
return Material.TURTLE_SCUTE;
|
||||
}
|
||||
|
||||
public String getValue(Property property) {
|
||||
return property.value();
|
||||
}
|
||||
}
|
||||
@@ -56,7 +56,7 @@ public class WorldEditRendererFallback {
|
||||
private void drawLine(Player player, boolean clipboard, Vector min, Vector max) {
|
||||
Particle particle;
|
||||
if (clipboard) {
|
||||
particle = TrickyParticleWrapper.impl.getVillagerHappy();
|
||||
particle = Particle.HAPPY_VILLAGER;
|
||||
} else {
|
||||
particle = Particle.DRAGON_BREATH;
|
||||
}
|
||||
|
||||
@@ -22,9 +22,7 @@ package de.steamwar.entity;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import de.steamwar.Reflection;
|
||||
import de.steamwar.core.BountifulWrapper;
|
||||
import de.steamwar.core.ChatWrapper;
|
||||
import de.steamwar.core.FlatteningWrapper;
|
||||
import de.steamwar.core.ProtocolWrapper;
|
||||
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
||||
import lombok.Getter;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
@@ -32,6 +30,7 @@ import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.protocol.game.*;
|
||||
import net.minecraft.network.syncher.EntityDataAccessor;
|
||||
import net.minecraft.network.syncher.EntityDataSerializers;
|
||||
import net.minecraft.network.syncher.SynchedEntityData;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.entity.Pose;
|
||||
@@ -249,9 +248,9 @@ public class REntity {
|
||||
server.updateEntity(this,getDataWatcherPacket(entityStatusWatcher,getEntityStatus()));
|
||||
}
|
||||
|
||||
private static final Function<REntity, Object> spawnPacketGenerator = entitySpawnPacketGenerator(ProtocolWrapper.spawnPacket, 2);
|
||||
private static final Function<REntity, Object> spawnPacketGenerator = entitySpawnPacketGenerator(ClientboundAddEntityPacket.class, 2);
|
||||
|
||||
private static final Reflection.Field<Integer> additionalData = Reflection.getField(ProtocolWrapper.spawnPacket, int.class, 4);
|
||||
private static final Reflection.Field<Integer> additionalData = Reflection.getField(ClientboundAddEntityPacket.class, int.class, 4);
|
||||
|
||||
private Object spawnPacketGenerator() {
|
||||
Object packet = spawnPacketGenerator.apply(this);
|
||||
@@ -332,7 +331,12 @@ public class REntity {
|
||||
}
|
||||
|
||||
protected Object getDataWatcherPacket(Object... dataWatcherKeyValues) {
|
||||
return ChatWrapper.getDataWatcherPacket(entityId, dataWatcherKeyValues);
|
||||
ArrayList<SynchedEntityData.DataValue<?>> nativeWatchers = new ArrayList<>(1);
|
||||
for(int i = 0; i < dataWatcherKeyValues.length; i+=2) {
|
||||
nativeWatchers.add(((SynchedEntityData.DataItem<?>) BountifulWrapper.impl.getDataWatcherItem(dataWatcherKeyValues[i], dataWatcherKeyValues[i+1])).value());
|
||||
}
|
||||
|
||||
return new ClientboundSetEntityDataPacket(entityId, nativeWatchers);
|
||||
}
|
||||
|
||||
private Object getTeleportPacket(){
|
||||
@@ -371,7 +375,7 @@ public class REntity {
|
||||
return new ClientboundSetEquipmentPacket(entityId, Collections.singletonList(Pair.of((EquipmentSlot) slot, CraftItemStack.asNMSCopy(stack))));
|
||||
}
|
||||
|
||||
private static final Reflection.Field<net.minecraft.world.entity.EntityType> spawnType = Reflection.getField(ProtocolWrapper.spawnPacket, net.minecraft.world.entity.EntityType.class, 0);
|
||||
private static final Reflection.Field<net.minecraft.world.entity.EntityType> spawnType = Reflection.getField(ClientboundAddEntityPacket.class, net.minecraft.world.entity.EntityType.class, 0);
|
||||
private static Function<REntity, Object> entitySpawnPacketGenerator(Class<?> spawnPacket, int posOffset) {
|
||||
BountifulWrapper.UUIDSetter uuid = BountifulWrapper.impl.getUUIDSetter(spawnPacket);
|
||||
Function<REntity, Object> packetGenerator = spawnPacketGenerator(spawnPacket, posOffset);
|
||||
|
||||
@@ -23,7 +23,6 @@ import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import de.steamwar.core.BountifulWrapper;
|
||||
import de.steamwar.core.ProtocolWrapper;
|
||||
import de.steamwar.core.TrickyTrialsWrapper;
|
||||
import de.steamwar.network.CoreNetworkHandler;
|
||||
import de.steamwar.network.NetworkSender;
|
||||
import de.steamwar.network.packets.common.PlayerSkinRequestPacket;
|
||||
@@ -61,7 +60,7 @@ public class RPlayer extends REntity {
|
||||
NetworkSender.sendOrQueue(new PlayerSkinRequestPacket(actualUUID));
|
||||
return new Property("textures", null, null);
|
||||
});
|
||||
if (TrickyTrialsWrapper.impl.getValue(skinData) != null) {
|
||||
if (skinData.value() != null) {
|
||||
GameProfile gameProfile = new GameProfile(uuid, name);
|
||||
gameProfile.getProperties().put("textures", skinData);
|
||||
return gameProfile;
|
||||
@@ -75,7 +74,7 @@ public class RPlayer extends REntity {
|
||||
@Override
|
||||
void list(Consumer<Object> packetSink) {
|
||||
saved = getGameProfile();
|
||||
packetSink.accept(ProtocolWrapper.impl.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.ADD, saved, GameMode.CREATIVE));
|
||||
packetSink.accept(ProtocolWrapper.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.ADD, saved, GameMode.CREATIVE));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -93,7 +92,7 @@ public class RPlayer extends REntity {
|
||||
@Override
|
||||
void delist(Consumer<Object> packetSink) {
|
||||
if (saved == null) saved = getGameProfile();
|
||||
packetSink.accept(ProtocolWrapper.impl.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.REMOVE, saved, GameMode.CREATIVE));
|
||||
packetSink.accept(ProtocolWrapper.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.REMOVE, saved, GameMode.CREATIVE));
|
||||
}
|
||||
|
||||
private Object getNamedSpawnPacket() {
|
||||
|
||||
@@ -19,9 +19,10 @@
|
||||
|
||||
package de.steamwar.entity;
|
||||
|
||||
import de.steamwar.core.ChatWrapper;
|
||||
import lombok.Getter;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.contents.PlainTextContents;
|
||||
import net.minecraft.network.syncher.EntityDataAccessor;
|
||||
import net.minecraft.network.syncher.EntityDataSerializers;
|
||||
import org.bukkit.Location;
|
||||
@@ -77,7 +78,7 @@ public class RTextDisplay extends RDisplay {
|
||||
private static final EntityDataAccessor<Component> textWatcher = new EntityDataAccessor<>(23, EntityDataSerializers.COMPONENT);
|
||||
private void getText(boolean ignoreDefault, BiConsumer<Object, Object> packetSink) {
|
||||
if (ignoreDefault || !text.isEmpty()) {
|
||||
packetSink.accept(textWatcher, ChatWrapper.stringToChatComponent(text));
|
||||
packetSink.accept(textWatcher, MutableComponent.create(PlainTextContents.create(text)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,10 +22,10 @@ package de.steamwar.inventory;
|
||||
import com.destroystokyo.paper.profile.PlayerProfile;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import de.steamwar.core.TrickyTrialsWrapper;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
@@ -114,7 +114,7 @@ public class SWItem {
|
||||
|
||||
itemMeta.setDisplayName(name);
|
||||
if (lore != null && !lore.isEmpty()) itemMeta.setLore(lore);
|
||||
if (enchanted) itemMeta.addEnchant(TrickyTrialsWrapper.impl.getUnbreakingEnchantment(), 10, true);
|
||||
if (enchanted) itemMeta.addEnchant(Enchantment.UNBREAKING, 10, true);
|
||||
itemStack.setItemMeta(itemMeta);
|
||||
}
|
||||
callback = c;
|
||||
@@ -205,9 +205,9 @@ public class SWItem {
|
||||
|
||||
public SWItem setEnchanted(boolean enchanted) {
|
||||
if (enchanted){
|
||||
itemMeta.addEnchant(TrickyTrialsWrapper.impl.getUnbreakingEnchantment() , 10, true);
|
||||
itemMeta.addEnchant(Enchantment.UNBREAKING, 10, true);
|
||||
} else {
|
||||
itemMeta.removeEnchant(TrickyTrialsWrapper.impl.getUnbreakingEnchantment());
|
||||
itemMeta.removeEnchant(Enchantment.UNBREAKING);
|
||||
}
|
||||
itemStack.setItemMeta(itemMeta);
|
||||
return this;
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
package de.steamwar.teamserver.listener;
|
||||
|
||||
import de.steamwar.core.TrickyTrialsWrapper;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.teamserver.Builder;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
@@ -27,6 +26,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.type.Switch;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
@@ -54,7 +54,7 @@ public class FreezeListener implements Listener {
|
||||
public void onEntitySpawn(EntitySpawnEvent e) {
|
||||
if (!freeze) return;
|
||||
e.setCancelled(true);
|
||||
if (e.getEntityType() == TrickyTrialsWrapper.impl.getTntEntityType()) {
|
||||
if (e.getEntityType() == EntityType.TNT) {
|
||||
Bukkit.getScheduler().runTaskLater(Builder.getInstance(), () -> {
|
||||
e.getLocation().getBlock().setType(Material.TNT, false);
|
||||
}, 1L);
|
||||
|
||||
@@ -192,7 +192,8 @@ public class TowerRunGame {
|
||||
|
||||
System.arraycopy(backupChunk.getSections(), 0, chunk.getSections(), 0, chunk.getSections().length);
|
||||
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
CraftbukkitWrapper.impl.sendChunk(p, x, z);
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
CraftbukkitWrapper.sendChunk(p, x, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user