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.BauSystem;
|
||||||
import de.steamwar.bausystem.features.gui.BauGUI;
|
import de.steamwar.bausystem.features.gui.BauGUI;
|
||||||
import de.steamwar.bausystem.linkage.BauGuiItem;
|
import de.steamwar.bausystem.linkage.BauGuiItem;
|
||||||
import de.steamwar.core.TrickyTrialsWrapper;
|
|
||||||
import de.steamwar.data.CMDs;
|
import de.steamwar.data.CMDs;
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import de.steamwar.inventory.SWListInv;
|
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 -> {
|
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());
|
}).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());
|
inv.setItem(mapping.getSize() + 8, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_CLOSE", p)).setCustomModelData(CMDs.BACK).getItemStack());
|
||||||
|
|
||||||
p.openInventory(inv);
|
p.openInventory(inv);
|
||||||
|
|||||||
+3
-3
@@ -20,9 +20,9 @@
|
|||||||
package de.steamwar.bausystem.features.loadtimer;
|
package de.steamwar.bausystem.features.loadtimer;
|
||||||
|
|
||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.core.TrickyTrialsWrapper;
|
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
@@ -57,7 +57,7 @@ public class LoadtimerListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onEntitySpawn(EntitySpawnEvent event) {
|
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());
|
Region r = Region.getRegion(event.getLocation());
|
||||||
if (hasTimer(r)) {
|
if (hasTimer(r)) {
|
||||||
getTimer(r).onTntSpawn();
|
getTimer(r).onTntSpawn();
|
||||||
@@ -67,7 +67,7 @@ public class LoadtimerListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onEntityExplode(EntityExplodeEvent event) {
|
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());
|
Region r = Region.getRegion(event.getLocation());
|
||||||
if (hasTimer(r)) {
|
if (hasTimer(r)) {
|
||||||
getTimer(r).onTntExplode(event);
|
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.Flag;
|
||||||
import de.steamwar.bausystem.region.flags.FreezeMode;
|
import de.steamwar.bausystem.region.flags.FreezeMode;
|
||||||
import de.steamwar.bausystem.utils.ScoreboardElement;
|
import de.steamwar.bausystem.utils.ScoreboardElement;
|
||||||
import de.steamwar.core.TrickyTrialsWrapper;
|
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@@ -32,6 +31,7 @@ import org.bukkit.block.Block;
|
|||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.block.data.type.NoteBlock;
|
import org.bukkit.block.data.type.NoteBlock;
|
||||||
import org.bukkit.block.data.type.Switch;
|
import org.bukkit.block.data.type.Switch;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@@ -59,7 +59,7 @@ public class FreezeListener implements Listener, ScoreboardElement {
|
|||||||
public void onEntitySpawn(EntitySpawnEvent e) {
|
public void onEntitySpawn(EntitySpawnEvent e) {
|
||||||
if (Region.getRegion(e.getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.INACTIVE)) return;
|
if (Region.getRegion(e.getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.INACTIVE)) return;
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
if (e.getEntityType() == TrickyTrialsWrapper.impl.getTntEntityType()) {
|
if (e.getEntityType() == EntityType.TNT) {
|
||||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
||||||
e.getLocation().getBlock().setType(Material.TNT, false);
|
e.getLocation().getBlock().setType(Material.TNT, false);
|
||||||
}, 1L);
|
}, 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.features.script.lua.libs.StorageLib;
|
||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.core.SWPlayer;
|
import de.steamwar.core.SWPlayer;
|
||||||
import de.steamwar.core.TrickyTrialsWrapper;
|
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@@ -141,7 +141,7 @@ public class EventListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onEntitySpawn(EntitySpawnEvent event) {
|
public void onEntitySpawn(EntitySpawnEvent event) {
|
||||||
if (event.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType()) {
|
if (event.getEntityType() != EntityType.TNT) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Region tntRegion = Region.getRegion(event.getLocation());
|
Region tntRegion = Region.getRegion(event.getLocation());
|
||||||
@@ -156,7 +156,7 @@ public class EventListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onEntityExplode(EntityExplodeEvent event) {
|
public void onEntityExplode(EntityExplodeEvent event) {
|
||||||
if (event.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType()) {
|
if (event.getEntityType() != EntityType.TNT) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Region tntRegion = Region.getRegion(event.getLocation());
|
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.BauSystem;
|
||||||
import de.steamwar.bausystem.region.Point;
|
import de.steamwar.bausystem.region.Point;
|
||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.core.TrickyParticleWrapper;
|
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Particle;
|
import org.bukkit.Particle;
|
||||||
@@ -53,7 +52,7 @@ public class BoundaryViewer implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void showRegion(Region region, Player player) {
|
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()) {
|
if (!region.getTestblockArea().isEmpty()) {
|
||||||
drawCuboid(player, Particle.END_ROD, region.getTestblockArea().getMinPoint(true), region.getTestblockArea().getMaxPoint(true));
|
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);
|
BauSystem.MESSAGE.sendPrefixless("TECHHIDER_ON", player, ChatMessageType.ACTION_BAR);
|
||||||
}
|
}
|
||||||
region.getBuildArea().forEachChunk((x, z) -> {
|
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) {
|
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);
|
BauSystem.MESSAGE.sendPrefixless("XRAY_ON", player, ChatMessageType.ACTION_BAR);
|
||||||
}
|
}
|
||||||
region.getBuildArea().forEachChunk((x, z) -> {
|
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;
|
package de.steamwar.fightsystem.commands;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import de.steamwar.core.CommandRemover;
|
|
||||||
import de.steamwar.fightsystem.Config;
|
import de.steamwar.fightsystem.Config;
|
||||||
import de.steamwar.fightsystem.FightSystem;
|
import de.steamwar.fightsystem.FightSystem;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import net.md_5.bungee.api.ChatMessageType;
|
import net.md_5.bungee.api.ChatMessageType;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.defaults.BukkitCommand;
|
import org.bukkit.command.defaults.BukkitCommand;
|
||||||
|
import org.bukkit.craftbukkit.CraftServer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.StringUtil;
|
import org.bukkit.util.StringUtil;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.Map;
|
||||||
|
|
||||||
@Linked
|
@Linked
|
||||||
public class GamemodeCommand extends BukkitCommand {
|
public class GamemodeCommand extends BukkitCommand {
|
||||||
@@ -47,11 +49,8 @@ public class GamemodeCommand extends BukkitCommand {
|
|||||||
aliases.add("gm");
|
aliases.add("gm");
|
||||||
this.setAliases(aliases);
|
this.setAliases(aliases);
|
||||||
|
|
||||||
try {
|
Map<String, Command> knownCommands = ((CraftServer) Bukkit.getServer()).getCommandMap().getKnownCommands();
|
||||||
CommandRemover.removeAll("gamemode");
|
knownCommands.remove("gamemode");
|
||||||
} catch (Exception e) {
|
|
||||||
FightSystem.getPlugin().getLogger().log(Level.SEVERE, "Failed to replace commands", e);
|
|
||||||
}
|
|
||||||
Commands.injectCommand(this);
|
Commands.injectCommand(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
package de.steamwar.fightsystem.event;
|
package de.steamwar.fightsystem.event;
|
||||||
|
|
||||||
import de.steamwar.core.TrickyTrialsWrapper;
|
|
||||||
import de.steamwar.fightsystem.Config;
|
import de.steamwar.fightsystem.Config;
|
||||||
import de.steamwar.fightsystem.FightSystem;
|
import de.steamwar.fightsystem.FightSystem;
|
||||||
import de.steamwar.fightsystem.countdown.Countdown;
|
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.fightsystem.winconditions.Winconditions;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@@ -98,13 +98,13 @@ public class HellsBells {
|
|||||||
currentDropping = Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), () -> {
|
currentDropping = Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), () -> {
|
||||||
for (int w = 0; w < width; w++) {
|
for (int w = 0; w < width; w++) {
|
||||||
if (direction.isNorthOrWest()) {
|
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 {
|
} 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) {
|
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);
|
LargeFireball fireballRed = Config.world.spawn(redStart.toLocation(Config.world), LargeFireball.class);
|
||||||
fireballRed.setDirection(vector);
|
fireballRed.setDirection(vector);
|
||||||
fireballRed.setBounce(false);
|
|
||||||
fireballRed.setIsIncendiary(false);
|
fireballRed.setIsIncendiary(false);
|
||||||
fireballRed.setYield(current.explosionSize);
|
fireballRed.setYield(current.explosionSize);
|
||||||
|
|
||||||
LargeFireball fireballBlue = Config.world.spawn(blueStart.toLocation(Config.world), LargeFireball.class);
|
LargeFireball fireballBlue = Config.world.spawn(blueStart.toLocation(Config.world), LargeFireball.class);
|
||||||
vector.setZ(vector.getZ() * -1);
|
vector.setZ(vector.getZ() * -1);
|
||||||
fireballBlue.setDirection(vector);
|
fireballBlue.setDirection(vector);
|
||||||
fireballBlue.setBounce(false);
|
|
||||||
fireballBlue.setIsIncendiary(false);
|
fireballBlue.setIsIncendiary(false);
|
||||||
fireballBlue.setYield(current.explosionSize);
|
fireballBlue.setYield(current.explosionSize);
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ public class FightWorld extends StateDependent {
|
|||||||
Config.ArenaRegion.forEachChunk((x, z) -> {
|
Config.ArenaRegion.forEachChunk((x, z) -> {
|
||||||
CraftbukkitWrapper.impl.resetChunk(Config.world, backup, x, z);
|
CraftbukkitWrapper.impl.resetChunk(Config.world, backup, x, z);
|
||||||
for(Player p : Bukkit.getOnlinePlayers()) {
|
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);
|
Bukkit.unloadWorld(backup, false);
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ package de.steamwar.fightsystem.listener;
|
|||||||
|
|
||||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||||
import de.steamwar.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import de.steamwar.core.TrickyTrialsWrapper;
|
|
||||||
import de.steamwar.fightsystem.ArenaMode;
|
import de.steamwar.fightsystem.ArenaMode;
|
||||||
import de.steamwar.fightsystem.FightSystem;
|
import de.steamwar.fightsystem.FightSystem;
|
||||||
import de.steamwar.fightsystem.events.TeamDeathEvent;
|
import de.steamwar.fightsystem.events.TeamDeathEvent;
|
||||||
@@ -226,7 +225,7 @@ public class Recording implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||||
public void onTNTSpawn(EntitySpawnEvent e){
|
public void onTNTSpawn(EntitySpawnEvent e){
|
||||||
if(e.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType())
|
if(e.getEntityType() != EntityType.TNT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GlobalRecorder.getInstance().tntSpawn(e.getEntity());
|
GlobalRecorder.getInstance().tntSpawn(e.getEntity());
|
||||||
@@ -234,7 +233,7 @@ public class Recording implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||||
public void onExplosion(EntityExplodeEvent e){
|
public void onExplosion(EntityExplodeEvent e){
|
||||||
if(e.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType())
|
if(e.getEntityType() != EntityType.TNT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Location loc = e.getLocation();
|
Location loc = e.getLocation();
|
||||||
|
|||||||
@@ -108,6 +108,6 @@ public class Spectator implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void pseudoSpectator(Player player, boolean enable) {
|
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;
|
package de.steamwar.fightsystem.listener;
|
||||||
|
|
||||||
import de.steamwar.core.TrickyTrialsWrapper;
|
|
||||||
import de.steamwar.fightsystem.ArenaMode;
|
import de.steamwar.fightsystem.ArenaMode;
|
||||||
import de.steamwar.fightsystem.Config;
|
import de.steamwar.fightsystem.Config;
|
||||||
import de.steamwar.fightsystem.fight.Fight;
|
import de.steamwar.fightsystem.fight.Fight;
|
||||||
@@ -31,6 +30,7 @@ import de.steamwar.linkage.Linked;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
@@ -58,7 +58,7 @@ public class WaterRemover implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void handleEntitySpawn(EntitySpawnEvent event) {
|
public void handleEntitySpawn(EntitySpawnEvent event) {
|
||||||
if(event.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType())
|
if(event.getEntityType() != EntityType.TNT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Location location = event.getLocation();
|
Location location = event.getLocation();
|
||||||
|
|||||||
+10
-9
@@ -20,7 +20,6 @@
|
|||||||
package de.steamwar.fightsystem.record;
|
package de.steamwar.fightsystem.record;
|
||||||
|
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
import de.steamwar.core.TrickyTrialsWrapper;
|
|
||||||
import de.steamwar.core.WorldEditWrapper;
|
import de.steamwar.core.WorldEditWrapper;
|
||||||
import de.steamwar.entity.REntity;
|
import de.steamwar.entity.REntity;
|
||||||
import de.steamwar.entity.REntityServer;
|
import de.steamwar.entity.REntityServer;
|
||||||
@@ -56,6 +55,7 @@ import org.bukkit.event.EventPriority;
|
|||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
import org.bukkit.inventory.EquipmentSlot;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
import org.bukkit.scoreboard.NameTagVisibility;
|
import org.bukkit.scoreboard.NameTagVisibility;
|
||||||
@@ -305,7 +305,7 @@ public class PacketProcessor implements Listener {
|
|||||||
private void tntSpawn() throws IOException {
|
private void tntSpawn() throws IOException {
|
||||||
int entityId = source.readInt();
|
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 {
|
private void entityVelocity() throws IOException {
|
||||||
@@ -332,26 +332,27 @@ public class PacketProcessor implements Listener {
|
|||||||
if(enchanted)
|
if(enchanted)
|
||||||
stack.addUnsafeEnchantment(Enchantment.UNBREAKING, 1);
|
stack.addUnsafeEnchantment(Enchantment.UNBREAKING, 1);
|
||||||
|
|
||||||
Object slot;
|
EquipmentSlot slot;
|
||||||
switch(slotName){
|
switch(slotName){
|
||||||
case "HEAD":
|
case "HEAD":
|
||||||
slot = de.steamwar.core.ProtocolWrapper.itemSlots[5];
|
slot = EquipmentSlot.HEAD;
|
||||||
break;
|
break;
|
||||||
case "CHEST":
|
case "CHEST":
|
||||||
slot = de.steamwar.core.ProtocolWrapper.itemSlots[4];
|
slot = EquipmentSlot.CHEST;
|
||||||
break;
|
break;
|
||||||
case "LEGS":
|
case "LEGS":
|
||||||
slot = de.steamwar.core.ProtocolWrapper.itemSlots[3];
|
slot = EquipmentSlot.LEGS;
|
||||||
break;
|
break;
|
||||||
case "FEET":
|
case "FEET":
|
||||||
slot = de.steamwar.core.ProtocolWrapper.itemSlots[2];
|
slot = EquipmentSlot.FEET;
|
||||||
break;
|
break;
|
||||||
case "OFFHAND":
|
case "OFFHAND":
|
||||||
slot = de.steamwar.core.ProtocolWrapper.itemSlots[1];
|
slot = EquipmentSlot.OFF_HAND;
|
||||||
break;
|
break;
|
||||||
case "MAINHAND":
|
case "MAINHAND":
|
||||||
default:
|
default:
|
||||||
slot = de.steamwar.core.ProtocolWrapper.itemSlots[0];
|
slot = EquipmentSlot.HAND;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
execSync(() -> entities.get(entityId).setItem(slot, stack));
|
execSync(() -> entities.get(entityId).setItem(slot, stack));
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public class BlockIdWrapper {
|
|||||||
|
|
||||||
public void trackEntity(Player player, Entity entity) {
|
public void trackEntity(Player player, Entity entity) {
|
||||||
if(entity instanceof Player)
|
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);
|
player.showEntity(FightSystem.getPlugin(), entity);
|
||||||
}
|
}
|
||||||
@@ -68,6 +68,6 @@ public class BlockIdWrapper {
|
|||||||
player.hideEntity(FightSystem.getPlugin(), entity);
|
player.hideEntity(FightSystem.getPlugin(), entity);
|
||||||
|
|
||||||
if(entity instanceof Player)
|
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;
|
return;
|
||||||
|
|
||||||
region.forEachChunk((chunkX, chunkZ) -> {
|
region.forEachChunk((chunkX, chunkZ) -> {
|
||||||
if(exclusion.chunkOutside(chunkX, chunkZ))
|
if (exclusion.chunkOutside(chunkX, chunkZ)) {
|
||||||
CraftbukkitWrapper.impl.sendChunk(player, chunkX, chunkZ);
|
CraftbukkitWrapper.sendChunk(player, chunkX, chunkZ);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -77,9 +77,9 @@ public class WorldeditWrapper {
|
|||||||
Map<BaseBlock, BaseBlock> replaceMap = new HashMap<>();
|
Map<BaseBlock, BaseBlock> replaceMap = new HashMap<>();
|
||||||
colorBlocks.forEach((base, postfix) -> replaceMap.put(base, Objects.requireNonNull(BlockTypes.get(c.name().toLowerCase() + postfix)).getDefaultState().toBaseBlock()));
|
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 x = 0; x < clipboard.getDimensions().x(); x++){
|
||||||
for(int y = 0; y < clipboard.getDimensions().getY(); y++){
|
for(int y = 0; y < clipboard.getDimensions().y(); y++){
|
||||||
for(int z = 0; z < clipboard.getDimensions().getZ(); z++){
|
for(int z = 0; z < clipboard.getDimensions().z(); z++){
|
||||||
BlockVector3 pos = minimum.add(x, y, z);
|
BlockVector3 pos = minimum.add(x, y, z);
|
||||||
BaseBlock replacement = replaceMap.get(clipboard.getFullBlock(pos));
|
BaseBlock replacement = replaceMap.get(clipboard.getFullBlock(pos));
|
||||||
if(replacement != null)
|
if(replacement != null)
|
||||||
@@ -111,7 +111,7 @@ public class WorldeditWrapper {
|
|||||||
|
|
||||||
public Vector getDimensions(Clipboard clipboard) {
|
public Vector getDimensions(Clipboard clipboard) {
|
||||||
BlockVector3 dims = clipboard.getDimensions();
|
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 {
|
public Clipboard loadChar(String charName) throws IOException {
|
||||||
|
|||||||
+3
-3
@@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
package de.steamwar.fightsystem.winconditions;
|
package de.steamwar.fightsystem.winconditions;
|
||||||
|
|
||||||
import de.steamwar.core.TrickyTrialsWrapper;
|
|
||||||
import de.steamwar.fightsystem.Config;
|
import de.steamwar.fightsystem.Config;
|
||||||
import de.steamwar.fightsystem.countdown.Countdown;
|
import de.steamwar.fightsystem.countdown.Countdown;
|
||||||
import de.steamwar.fightsystem.fight.Fight;
|
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.fightsystem.utils.SWSound;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
@@ -72,7 +72,7 @@ public class WinconditionTimeTechKO extends Wincondition implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onSpawn(EntitySpawnEvent e) {
|
public void onSpawn(EntitySpawnEvent e) {
|
||||||
if(e.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType())
|
if(e.getEntityType() != EntityType.TNT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Location location = e.getLocation();
|
Location location = e.getLocation();
|
||||||
@@ -86,7 +86,7 @@ public class WinconditionTimeTechKO extends Wincondition implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onExplode(EntityExplodeEvent e) {
|
public void onExplode(EntityExplodeEvent e) {
|
||||||
if(e.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType())
|
if(e.getEntityType() != EntityType.TNT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FightTeam spawn = spawnLocations.remove(e.getEntity().getEntityId());
|
FightTeam spawn = spawnLocations.remove(e.getEntity().getEntityId());
|
||||||
|
|||||||
+2
-2
@@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
package de.steamwar.fightsystem.winconditions;
|
package de.steamwar.fightsystem.winconditions;
|
||||||
|
|
||||||
import de.steamwar.core.TrickyTrialsWrapper;
|
|
||||||
import de.steamwar.fightsystem.Config;
|
import de.steamwar.fightsystem.Config;
|
||||||
import de.steamwar.fightsystem.countdown.Countdown;
|
import de.steamwar.fightsystem.countdown.Countdown;
|
||||||
import de.steamwar.fightsystem.fight.Fight;
|
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.fightsystem.utils.SWSound;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
@@ -72,7 +72,7 @@ public class WinconditionTimedDamageTechKO extends Wincondition implements Print
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onExplode(EntityExplodeEvent e) {
|
public void onExplode(EntityExplodeEvent e) {
|
||||||
if (e.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType())
|
if (e.getEntityType() != EntityType.TNT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Location location = e.getLocation();
|
Location location = e.getLocation();
|
||||||
|
|||||||
@@ -84,7 +84,8 @@ public class FightWorld {
|
|||||||
worldChunk.heightmaps.clear();
|
worldChunk.heightmaps.clear();
|
||||||
worldChunk.heightmaps.putAll(backupChunk.heightmaps);
|
worldChunk.heightmaps.putAll(backupChunk.heightmaps);
|
||||||
|
|
||||||
for(Player p : Bukkit.getOnlinePlayers())
|
for(Player p : Bukkit.getOnlinePlayers()) {
|
||||||
CraftbukkitWrapper.impl.sendChunk(p, x, z);
|
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;
|
package de.steamwar.core;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||||
|
import lombok.experimental.UtilityClass;
|
||||||
import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket;
|
import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket;
|
||||||
import net.minecraft.world.level.chunk.LevelChunk;
|
import net.minecraft.world.level.chunk.LevelChunk;
|
||||||
import net.minecraft.world.level.chunk.status.ChunkStatus;
|
import net.minecraft.world.level.chunk.status.ChunkStatus;
|
||||||
import org.bukkit.craftbukkit.CraftChunk;
|
import org.bukkit.craftbukkit.CraftChunk;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
@UtilityClass
|
||||||
public class CraftbukkitWrapper {
|
public class CraftbukkitWrapper {
|
||||||
public static final CraftbukkitWrapper impl = new CraftbukkitWrapper();
|
|
||||||
|
|
||||||
public void sendChunk(Player p, int chunkX, int chunkZ) {
|
public void sendChunk(Player p, int chunkX, int chunkZ) {
|
||||||
LevelChunk chunk = (LevelChunk) ((CraftChunk) p.getWorld().getChunkAt(chunkX, chunkZ)).getHandle(ChunkStatus.FULL);
|
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));
|
TinyProtocol.instance.sendPacket(p, new ClientboundLevelChunkWithLightPacket(chunk, chunk.level.getLightEngine(), null, null, true));
|
||||||
|
|||||||
@@ -20,6 +20,8 @@
|
|||||||
package de.steamwar.core;
|
package de.steamwar.core;
|
||||||
|
|
||||||
import lombok.experimental.UtilityClass;
|
import lombok.experimental.UtilityClass;
|
||||||
|
import net.minecraft.network.chat.MutableComponent;
|
||||||
|
import net.minecraft.network.chat.contents.PlainTextContents;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@@ -27,6 +29,6 @@ import java.util.Optional;
|
|||||||
public class FlatteningWrapper {
|
public class FlatteningWrapper {
|
||||||
|
|
||||||
public Object formatDisplayName(String displayName) {
|
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;
|
package de.steamwar.core;
|
||||||
|
|
||||||
import com.mojang.authlib.GameProfile;
|
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.ClientboundPlayerInfoRemovePacket;
|
||||||
import net.minecraft.network.protocol.game.ClientboundPlayerInfoUpdatePacket;
|
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 net.minecraft.world.level.GameType;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
|
||||||
|
@UtilityClass
|
||||||
public class ProtocolWrapper {
|
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) {
|
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 ClientboundPlayerInfoRemovePacket(Collections.singletonList(profile.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
return new ClientboundPlayerInfoUpdatePacket(action == PlayerInfoAction.ADD ?
|
return new ClientboundPlayerInfoUpdatePacket(action == PlayerInfoAction.ADD ?
|
||||||
EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, ClientboundPlayerInfoUpdatePacket.Action.UPDATE_GAME_MODE) : EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_GAME_MODE),
|
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:
|
case TEN_SECONDS:
|
||||||
return round(tps_TenSecond.tps);
|
return round(tps_TenSecond.tps);
|
||||||
case ONE_MINUTE:
|
case ONE_MINUTE:
|
||||||
return round(getSpigotTPS()[0]);
|
return round(MinecraftServer.getServer().tps1.getAverage());
|
||||||
case FIVE_MINUTES:
|
case FIVE_MINUTES:
|
||||||
return round(getSpigotTPS()[1]);
|
return round(MinecraftServer.getServer().tps5.getAverage());
|
||||||
case TEN_MINUTES:
|
case TEN_MINUTES:
|
||||||
return round(getSpigotTPS()[2]);
|
return round(MinecraftServer.getServer().tps15.getAverage());
|
||||||
case ONE_SECOND:
|
case ONE_SECOND:
|
||||||
default:
|
default:
|
||||||
return round(tps_OneSecond.tps);
|
return round(tps_OneSecond.tps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static double[] getSpigotTPS() {
|
|
||||||
return MinecraftServer.getServer().recentTps;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static double round(double d) {
|
private static double round(double d) {
|
||||||
return Math.round(d * 10) / 10.0;
|
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) {
|
private void drawLine(Player player, boolean clipboard, Vector min, Vector max) {
|
||||||
Particle particle;
|
Particle particle;
|
||||||
if (clipboard) {
|
if (clipboard) {
|
||||||
particle = TrickyParticleWrapper.impl.getVillagerHappy();
|
particle = Particle.HAPPY_VILLAGER;
|
||||||
} else {
|
} else {
|
||||||
particle = Particle.DRAGON_BREATH;
|
particle = Particle.DRAGON_BREATH;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,9 +22,7 @@ package de.steamwar.entity;
|
|||||||
import com.mojang.datafixers.util.Pair;
|
import com.mojang.datafixers.util.Pair;
|
||||||
import de.steamwar.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import de.steamwar.core.BountifulWrapper;
|
import de.steamwar.core.BountifulWrapper;
|
||||||
import de.steamwar.core.ChatWrapper;
|
|
||||||
import de.steamwar.core.FlatteningWrapper;
|
import de.steamwar.core.FlatteningWrapper;
|
||||||
import de.steamwar.core.ProtocolWrapper;
|
|
||||||
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import net.minecraft.core.registries.BuiltInRegistries;
|
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.protocol.game.*;
|
||||||
import net.minecraft.network.syncher.EntityDataAccessor;
|
import net.minecraft.network.syncher.EntityDataAccessor;
|
||||||
import net.minecraft.network.syncher.EntityDataSerializers;
|
import net.minecraft.network.syncher.EntityDataSerializers;
|
||||||
|
import net.minecraft.network.syncher.SynchedEntityData;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.entity.EquipmentSlot;
|
import net.minecraft.world.entity.EquipmentSlot;
|
||||||
import net.minecraft.world.entity.Pose;
|
import net.minecraft.world.entity.Pose;
|
||||||
@@ -249,9 +248,9 @@ public class REntity {
|
|||||||
server.updateEntity(this,getDataWatcherPacket(entityStatusWatcher,getEntityStatus()));
|
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() {
|
private Object spawnPacketGenerator() {
|
||||||
Object packet = spawnPacketGenerator.apply(this);
|
Object packet = spawnPacketGenerator.apply(this);
|
||||||
@@ -332,7 +331,12 @@ public class REntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected Object getDataWatcherPacket(Object... dataWatcherKeyValues) {
|
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(){
|
private Object getTeleportPacket(){
|
||||||
@@ -371,7 +375,7 @@ public class REntity {
|
|||||||
return new ClientboundSetEquipmentPacket(entityId, Collections.singletonList(Pair.of((EquipmentSlot) slot, CraftItemStack.asNMSCopy(stack))));
|
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) {
|
private static Function<REntity, Object> entitySpawnPacketGenerator(Class<?> spawnPacket, int posOffset) {
|
||||||
BountifulWrapper.UUIDSetter uuid = BountifulWrapper.impl.getUUIDSetter(spawnPacket);
|
BountifulWrapper.UUIDSetter uuid = BountifulWrapper.impl.getUUIDSetter(spawnPacket);
|
||||||
Function<REntity, Object> packetGenerator = spawnPacketGenerator(spawnPacket, posOffset);
|
Function<REntity, Object> packetGenerator = spawnPacketGenerator(spawnPacket, posOffset);
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import com.mojang.authlib.GameProfile;
|
|||||||
import com.mojang.authlib.properties.Property;
|
import com.mojang.authlib.properties.Property;
|
||||||
import de.steamwar.core.BountifulWrapper;
|
import de.steamwar.core.BountifulWrapper;
|
||||||
import de.steamwar.core.ProtocolWrapper;
|
import de.steamwar.core.ProtocolWrapper;
|
||||||
import de.steamwar.core.TrickyTrialsWrapper;
|
|
||||||
import de.steamwar.network.CoreNetworkHandler;
|
import de.steamwar.network.CoreNetworkHandler;
|
||||||
import de.steamwar.network.NetworkSender;
|
import de.steamwar.network.NetworkSender;
|
||||||
import de.steamwar.network.packets.common.PlayerSkinRequestPacket;
|
import de.steamwar.network.packets.common.PlayerSkinRequestPacket;
|
||||||
@@ -61,7 +60,7 @@ public class RPlayer extends REntity {
|
|||||||
NetworkSender.sendOrQueue(new PlayerSkinRequestPacket(actualUUID));
|
NetworkSender.sendOrQueue(new PlayerSkinRequestPacket(actualUUID));
|
||||||
return new Property("textures", null, null);
|
return new Property("textures", null, null);
|
||||||
});
|
});
|
||||||
if (TrickyTrialsWrapper.impl.getValue(skinData) != null) {
|
if (skinData.value() != null) {
|
||||||
GameProfile gameProfile = new GameProfile(uuid, name);
|
GameProfile gameProfile = new GameProfile(uuid, name);
|
||||||
gameProfile.getProperties().put("textures", skinData);
|
gameProfile.getProperties().put("textures", skinData);
|
||||||
return gameProfile;
|
return gameProfile;
|
||||||
@@ -75,7 +74,7 @@ public class RPlayer extends REntity {
|
|||||||
@Override
|
@Override
|
||||||
void list(Consumer<Object> packetSink) {
|
void list(Consumer<Object> packetSink) {
|
||||||
saved = getGameProfile();
|
saved = getGameProfile();
|
||||||
packetSink.accept(ProtocolWrapper.impl.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.ADD, saved, GameMode.CREATIVE));
|
packetSink.accept(ProtocolWrapper.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.ADD, saved, GameMode.CREATIVE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -93,7 +92,7 @@ public class RPlayer extends REntity {
|
|||||||
@Override
|
@Override
|
||||||
void delist(Consumer<Object> packetSink) {
|
void delist(Consumer<Object> packetSink) {
|
||||||
if (saved == null) saved = getGameProfile();
|
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() {
|
private Object getNamedSpawnPacket() {
|
||||||
|
|||||||
@@ -19,9 +19,10 @@
|
|||||||
|
|
||||||
package de.steamwar.entity;
|
package de.steamwar.entity;
|
||||||
|
|
||||||
import de.steamwar.core.ChatWrapper;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import net.minecraft.network.chat.Component;
|
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.EntityDataAccessor;
|
||||||
import net.minecraft.network.syncher.EntityDataSerializers;
|
import net.minecraft.network.syncher.EntityDataSerializers;
|
||||||
import org.bukkit.Location;
|
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 static final EntityDataAccessor<Component> textWatcher = new EntityDataAccessor<>(23, EntityDataSerializers.COMPONENT);
|
||||||
private void getText(boolean ignoreDefault, BiConsumer<Object, Object> packetSink) {
|
private void getText(boolean ignoreDefault, BiConsumer<Object, Object> packetSink) {
|
||||||
if (ignoreDefault || !text.isEmpty()) {
|
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.destroystokyo.paper.profile.PlayerProfile;
|
||||||
import com.google.gson.JsonArray;
|
import com.google.gson.JsonArray;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import de.steamwar.core.TrickyTrialsWrapper;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.inventory.ItemFlag;
|
import org.bukkit.inventory.ItemFlag;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
@@ -114,7 +114,7 @@ public class SWItem {
|
|||||||
|
|
||||||
itemMeta.setDisplayName(name);
|
itemMeta.setDisplayName(name);
|
||||||
if (lore != null && !lore.isEmpty()) itemMeta.setLore(lore);
|
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);
|
itemStack.setItemMeta(itemMeta);
|
||||||
}
|
}
|
||||||
callback = c;
|
callback = c;
|
||||||
@@ -205,9 +205,9 @@ public class SWItem {
|
|||||||
|
|
||||||
public SWItem setEnchanted(boolean enchanted) {
|
public SWItem setEnchanted(boolean enchanted) {
|
||||||
if (enchanted){
|
if (enchanted){
|
||||||
itemMeta.addEnchant(TrickyTrialsWrapper.impl.getUnbreakingEnchantment() , 10, true);
|
itemMeta.addEnchant(Enchantment.UNBREAKING, 10, true);
|
||||||
} else {
|
} else {
|
||||||
itemMeta.removeEnchant(TrickyTrialsWrapper.impl.getUnbreakingEnchantment());
|
itemMeta.removeEnchant(Enchantment.UNBREAKING);
|
||||||
}
|
}
|
||||||
itemStack.setItemMeta(itemMeta);
|
itemStack.setItemMeta(itemMeta);
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
package de.steamwar.teamserver.listener;
|
package de.steamwar.teamserver.listener;
|
||||||
|
|
||||||
import de.steamwar.core.TrickyTrialsWrapper;
|
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import de.steamwar.teamserver.Builder;
|
import de.steamwar.teamserver.Builder;
|
||||||
import net.md_5.bungee.api.ChatMessageType;
|
import net.md_5.bungee.api.ChatMessageType;
|
||||||
@@ -27,6 +26,7 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.data.type.Switch;
|
import org.bukkit.block.data.type.Switch;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@@ -54,7 +54,7 @@ public class FreezeListener implements Listener {
|
|||||||
public void onEntitySpawn(EntitySpawnEvent e) {
|
public void onEntitySpawn(EntitySpawnEvent e) {
|
||||||
if (!freeze) return;
|
if (!freeze) return;
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
if (e.getEntityType() == TrickyTrialsWrapper.impl.getTntEntityType()) {
|
if (e.getEntityType() == EntityType.TNT) {
|
||||||
Bukkit.getScheduler().runTaskLater(Builder.getInstance(), () -> {
|
Bukkit.getScheduler().runTaskLater(Builder.getInstance(), () -> {
|
||||||
e.getLocation().getBlock().setType(Material.TNT, false);
|
e.getLocation().getBlock().setType(Material.TNT, false);
|
||||||
}, 1L);
|
}, 1L);
|
||||||
|
|||||||
@@ -192,7 +192,8 @@ public class TowerRunGame {
|
|||||||
|
|
||||||
System.arraycopy(backupChunk.getSections(), 0, chunk.getSections(), 0, chunk.getSections().length);
|
System.arraycopy(backupChunk.getSections(), 0, chunk.getSections(), 0, chunk.getSections().length);
|
||||||
|
|
||||||
for (Player p : Bukkit.getOnlinePlayers())
|
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||||
CraftbukkitWrapper.impl.sendChunk(p, x, z);
|
CraftbukkitWrapper.sendChunk(p, x, z);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user