diff --git a/src/main/java/pw/kaboom/extras/Main.java b/src/main/java/pw/kaboom/extras/Main.java index 710a01f..48479de 100644 --- a/src/main/java/pw/kaboom/extras/Main.java +++ b/src/main/java/pw/kaboom/extras/Main.java @@ -330,6 +330,7 @@ public class Main extends JavaPlugin { "tellraw", "minecraft:clear", + "minecraft:data", "minecraft:datapack", "minecraft:effect", "minecraft:execute", @@ -337,6 +338,7 @@ public class Main extends JavaPlugin { "minecraft:gamerule", "minecraft:me", "minecraft:msg", + "minecraft:replaceitem", "minecraft:say", "minecraft:spreadplayers", "minecraft:tell", @@ -345,6 +347,7 @@ public class Main extends JavaPlugin { "minecraft:tp", "minecraft:worldborder", "clear", + "data", "datapack", "effect", "execute", @@ -352,6 +355,7 @@ public class Main extends JavaPlugin { "gamerule", "me", "msg", + "replaceitem", "say", "spreadplayers", "tell", diff --git a/src/main/java/pw/kaboom/extras/commands/CommandJumpscare.java b/src/main/java/pw/kaboom/extras/commands/CommandJumpscare.java index 01eaed1..a783958 100644 --- a/src/main/java/pw/kaboom/extras/commands/CommandJumpscare.java +++ b/src/main/java/pw/kaboom/extras/commands/CommandJumpscare.java @@ -14,7 +14,7 @@ import org.bukkit.entity.Player; class CommandJumpscare implements CommandExecutor { private void createJumpscare(Player player) { player.spawnParticle(Particle.MOB_APPEARANCE, player.getLocation(), 4); - for (int i = 0; i < 10; ++i) { + for (int i = 0; i < 10; i++) { player.playSound(player.getLocation(), Sound.ENTITY_ENDERMAN_SCREAM, 1, 0); } } diff --git a/src/main/java/pw/kaboom/extras/modules/block/BlockCheck.java b/src/main/java/pw/kaboom/extras/modules/block/BlockCheck.java index 5cc7224..4250ec8 100644 --- a/src/main/java/pw/kaboom/extras/modules/block/BlockCheck.java +++ b/src/main/java/pw/kaboom/extras/modules/block/BlockCheck.java @@ -1,11 +1,16 @@ package pw.kaboom.extras; +import org.bukkit.block.BlockState; +import org.bukkit.block.CommandBlock; + import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.SignChangeEvent; +import org.bukkit.event.world.ChunkLoadEvent; + class BlockCheck implements Listener { @EventHandler void onBlockPlace(BlockPlaceEvent event) { @@ -19,6 +24,24 @@ class BlockCheck implements Listener { event.setCancelled(true); } } + + @EventHandler + void onChunkLoad(ChunkLoadEvent event) { + if (!event.isNewChunk()) { + try { + for (BlockState block : event.getChunk().getTileEntities()) { + if (block instanceof CommandBlock) { + block.update(); + } + } + } catch (Exception exception) { + event.getChunk().getWorld().regenerateChunk( + event.getChunk().getX(), + event.getChunk().getZ() + ); + } + } + } @EventHandler void onSignChange(SignChangeEvent event) { diff --git a/src/main/java/pw/kaboom/extras/modules/block/BlockPhysics.java b/src/main/java/pw/kaboom/extras/modules/block/BlockPhysics.java index dc939da..06b4b51 100644 --- a/src/main/java/pw/kaboom/extras/modules/block/BlockPhysics.java +++ b/src/main/java/pw/kaboom/extras/modules/block/BlockPhysics.java @@ -73,12 +73,12 @@ class BlockPhysics implements Listener { } } - /*@EventHandler + @EventHandler void onBlockPhysics(BlockPhysicsEvent event) { if (event.getSourceBlock().getState() instanceof CommandBlock) { event.getSourceBlock().getState().update(); } - }*/ + } @EventHandler void onBlockRedstone(BlockRedstoneEvent event) { diff --git a/src/main/java/pw/kaboom/extras/modules/player/PlayerConnection.java b/src/main/java/pw/kaboom/extras/modules/player/PlayerConnection.java index 4dd293f..019fc1e 100644 --- a/src/main/java/pw/kaboom/extras/modules/player/PlayerConnection.java +++ b/src/main/java/pw/kaboom/extras/modules/player/PlayerConnection.java @@ -16,6 +16,8 @@ import org.bukkit.event.Event; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; +import org.bukkit.event.inventory.InventoryCloseEvent; + import org.bukkit.event.player.AsyncPlayerPreLoginEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerKickEvent; @@ -29,8 +31,6 @@ import org.bukkit.inventory.meta.BannerMeta; import org.bukkit.plugin.java.JavaPlugin; -import com.destroystokyo.paper.event.player.PlayerConnectionCloseEvent; - class PlayerConnection implements Listener { @EventHandler void onAsyncPlayerPreLogin(AsyncPlayerPreLoginEvent event) { @@ -41,10 +41,14 @@ class PlayerConnection implements Listener { } @EventHandler - void onPlayerConnectionClose(final PlayerConnectionCloseEvent event) { - PlayerCommand.commandMillisList.remove(event.getPlayerUniqueId()); - PlayerInteract.interactMillisList.remove(event.getPlayerUniqueId()); - Main.skinInProgress.remove(event.getPlayerUniqueId()); + void onInventoryClose(InventoryCloseEvent event) { + for (int i = 0; i < 64; i++) { + //for (ItemStack item : event.getInventory().getContents()) { + System.out.println(event.getInventory().getItem(i)); + if (EntitySpawn.isIllegalItem(event.getInventory().getItem(i))) { + event.getInventory().clear(); + } + } } @EventHandler @@ -107,13 +111,9 @@ class PlayerConnection implements Listener { @EventHandler void onPlayerQuit(PlayerQuitEvent event) { - final Inventory inventory = event.getPlayer().getInventory(); - - for (ItemStack item : inventory.getContents()) { - if (EntitySpawn.isIllegalItem(item)) { - inventory.clear(); - } - } + PlayerCommand.commandMillisList.remove(event.getPlayer().getUniqueId()); + PlayerInteract.interactMillisList.remove(event.getPlayer().getUniqueId()); + Main.skinInProgress.remove(event.getPlayer().getUniqueId()); final World world = event.getPlayer().getWorld(); diff --git a/src/main/java/pw/kaboom/extras/modules/server/ServerPing.java b/src/main/java/pw/kaboom/extras/modules/server/ServerPing.java index 643f23f..9949f24 100644 --- a/src/main/java/pw/kaboom/extras/modules/server/ServerPing.java +++ b/src/main/java/pw/kaboom/extras/modules/server/ServerPing.java @@ -9,10 +9,10 @@ class ServerPing implements Listener { @EventHandler void onServerListPing(PaperServerListPingEvent event) { if (event.getClient().getProtocolVersion() == -1) { - event.setProtocolVersion(498); + event.setProtocolVersion(573); } else { event.setProtocolVersion(event.getClient().getProtocolVersion()); } - event.setVersion("1.14.4"); + event.setVersion("1.15"); } }