Temporary mitigations before 1.15

This commit is contained in:
mathiascode 2019-12-11 18:59:32 +02:00
parent 91a1b47054
commit 61562aa29d
6 changed files with 45 additions and 18 deletions

View file

@ -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",

View file

@ -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);
}
}

View file

@ -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) {

View file

@ -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) {

View file

@ -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();

View file

@ -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");
}
}