mirror of
https://github.com/kaboomserver/extras.git
synced 2024-11-23 16:08:18 -05:00
Push outdated code
This commit is contained in:
parent
f1397f7207
commit
f68eef5c5f
2 changed files with 139 additions and 23 deletions
|
@ -24,6 +24,7 @@ import org.bukkit.attribute.Attribute;
|
||||||
import org.bukkit.attribute.AttributeInstance;
|
import org.bukkit.attribute.AttributeInstance;
|
||||||
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.block.Container;
|
import org.bukkit.block.Container;
|
||||||
import org.bukkit.block.CreatureSpawner;
|
import org.bukkit.block.CreatureSpawner;
|
||||||
|
@ -166,21 +167,30 @@ class Events implements Listener {
|
||||||
@EventHandler
|
@EventHandler
|
||||||
void onBlockPhysics(BlockPhysicsEvent event) {
|
void onBlockPhysics(BlockPhysicsEvent event) {
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
|
|
||||||
|
if (main.fallingBlockList.contains(block.getType())) {
|
||||||
|
main.fallingBlockCount++;
|
||||||
|
|
||||||
|
if (main.fallingBlockCount == 10) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
main.fallingBlockCount = 0;
|
||||||
|
}
|
||||||
|
} else if (block.getType() == Material.SOIL) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
} else if (main.nonSolidWallMountedBlockList.contains(block.getType())) {
|
||||||
World world = event.getBlock().getWorld();
|
World world = event.getBlock().getWorld();
|
||||||
int radius = 5;
|
int radius = 5;
|
||||||
int blockCount = 0;
|
int blockCount = 0;
|
||||||
|
|
||||||
for (int x = -radius; x < radius; x++) {
|
for (int x = -radius; x <= radius; x++) {
|
||||||
for (int y = -radius; y < radius; y++) {
|
for (int y = -radius; y <= radius; y++) {
|
||||||
for (int z = -radius; z < radius; z++) {
|
for (int z = -radius; z <= radius; z++) {
|
||||||
if (blockCount < 50) {
|
if (blockCount < 42) {
|
||||||
Location blockLocation = new Location(world, block.getX() + x, block.getY() + y, block.getZ() + z);
|
Location blockLocation = new Location(world, block.getX() + x, block.getY() + y, block.getZ() + z);
|
||||||
Block coordBlock = world.getBlockAt(blockLocation);
|
Block coordBlock = world.getBlockAt(blockLocation);
|
||||||
|
|
||||||
if ((coordBlock.getType() == Material.CACTUS ||
|
if (coordBlock.getType() == block.getType() ||
|
||||||
coordBlock.getType() == Material.LADDER ||
|
main.nonSolidWallMountedBlockList.contains(coordBlock.getType())) {
|
||||||
coordBlock.getType() == Material.SOIL) &&
|
|
||||||
coordBlock.getType() == block.getType()) {
|
|
||||||
blockCount++;
|
blockCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,10 +201,37 @@ class Events implements Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blockCount == 50) {
|
if (blockCount == 42) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
} else if (main.nonSolidDoubleBlockList.contains(block.getType())) {
|
||||||
|
/*if (block.getRelative(BlockFace.DOWN).getType() == Material.AIR ||
|
||||||
|
(main.nonSolidBlockList.contains(block.getRelative(BlockFace.DOWN).getType()) && block.getRelative(BlockFace.DOWN).getType() != block.getType())) {
|
||||||
|
for (int y = block.getRelative(BlockFace.UP).getY(); y <= 128; y++) {
|
||||||
|
World world = event.getBlock().getWorld();
|
||||||
|
Block coordBlock = world.getBlockAt(new Location(world, block.getX(), y, block.getZ()));
|
||||||
|
|
||||||
|
if (coordBlock.getType() == block.getType()) {
|
||||||
|
coordBlock.setType(Material.AIR, false);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
block.setType(Material.AIR, false);*/
|
||||||
|
/*} else */if (block.getRelative(BlockFace.DOWN).getType() == block.getType()) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
} else if (main.nonSolidSingularBlockList.contains(block.getType())) {
|
||||||
|
/*if (block.getRelative(BlockFace.DOWN).getType() == Material.AIR ||
|
||||||
|
main.nonSolidBlockList.contains(block.getRelative(BlockFace.DOWN).getType())) {
|
||||||
|
block.setType(Material.AIR, false);
|
||||||
|
BlockState state = block.getState();
|
||||||
|
state.setType(Material.AIR);
|
||||||
|
state.update(true, false);
|
||||||
|
}*/
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -480,9 +517,9 @@ class Events implements Listener {
|
||||||
event.disallow(Result.KICK_OTHER, "The server is throttled due to bot attacks. Please try logging in again.");
|
event.disallow(Result.KICK_OTHER, "The server is throttled due to bot attacks. Please try logging in again.");
|
||||||
main.onlineCount++;
|
main.onlineCount++;
|
||||||
}
|
}
|
||||||
} else if (!(event.getHostname().startsWith("play.kaboom.pw") &&
|
/*} else if (!(event.getHostname().startsWith("play.kaboom.pw") &&
|
||||||
event.getHostname().endsWith(":64518"))) {
|
event.getHostname().endsWith(":64518"))) {
|
||||||
event.disallow(Result.KICK_OTHER, "You connected to the server using an outdated server address/IP.\nPlease use the following address/IP:\n\nkaboom.pw");
|
event.disallow(Result.KICK_OTHER, "You connected to the server using an outdated server address/IP.\nPlease use the following address/IP:\n\nkaboom.pw");*/
|
||||||
} else {
|
} else {
|
||||||
event.allow();
|
event.allow();
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
public class Main extends JavaPlugin {
|
public class Main extends JavaPlugin {
|
||||||
int onlineCount = 0;
|
int onlineCount = 0;
|
||||||
|
int fallingBlockCount = 0;
|
||||||
HashMap<UUID, Long> commandMillisList = new HashMap<UUID, Long>();
|
HashMap<UUID, Long> commandMillisList = new HashMap<UUID, Long>();
|
||||||
HashMap<UUID, Long> interactMillisList = new HashMap<UUID, Long>();
|
HashMap<UUID, Long> interactMillisList = new HashMap<UUID, Long>();
|
||||||
HashSet<String> consoleCommandBlacklist = new HashSet<String>(Arrays.asList(new String[] {
|
HashSet<String> consoleCommandBlacklist = new HashSet<String>(Arrays.asList(new String[] {
|
||||||
|
@ -353,8 +354,86 @@ public class Main extends JavaPlugin {
|
||||||
"warps",
|
"warps",
|
||||||
"whisper",
|
"whisper",
|
||||||
}));
|
}));
|
||||||
|
HashSet<Material> fallingBlockList = new HashSet<Material>(Arrays.asList(new Material[] {
|
||||||
|
Material.ANVIL,
|
||||||
|
Material.GRAVEL,
|
||||||
|
Material.SAND,
|
||||||
|
}));
|
||||||
|
HashSet<Material> nonSolidDoubleBlockList = new HashSet<Material>(Arrays.asList(new Material[] {
|
||||||
|
Material.LONG_GRASS,
|
||||||
|
Material.SIGN_POST,
|
||||||
|
Material.WOODEN_DOOR,
|
||||||
|
Material.IRON_DOOR_BLOCK,
|
||||||
|
Material.CACTUS,
|
||||||
|
Material.SUGAR_CANE_BLOCK,
|
||||||
|
Material.CAKE_BLOCK,
|
||||||
|
Material.DAYLIGHT_DETECTOR,
|
||||||
|
Material.CARPET,
|
||||||
|
Material.DOUBLE_PLANT,
|
||||||
|
Material.STANDING_BANNER,
|
||||||
|
Material.DAYLIGHT_DETECTOR_INVERTED,
|
||||||
|
Material.SPRUCE_DOOR,
|
||||||
|
Material.BIRCH_DOOR,
|
||||||
|
Material.JUNGLE_DOOR,
|
||||||
|
Material.ACACIA_DOOR,
|
||||||
|
Material.DARK_OAK_DOOR,
|
||||||
|
}));
|
||||||
|
HashSet<Material> nonSolidSingularBlockList = new HashSet<Material>(Arrays.asList(new Material[] {
|
||||||
|
Material.SAPLING,
|
||||||
|
Material.BED_BLOCK,
|
||||||
|
Material.POWERED_RAIL,
|
||||||
|
Material.DETECTOR_RAIL,
|
||||||
|
Material.DEAD_BUSH,
|
||||||
|
Material.YELLOW_FLOWER,
|
||||||
|
Material.RED_ROSE,
|
||||||
|
Material.BROWN_MUSHROOM,
|
||||||
|
Material.RED_MUSHROOM,
|
||||||
|
Material.FIRE,
|
||||||
|
/*Material.REDSTONE_WIRE,*/
|
||||||
|
Material.CROPS,
|
||||||
|
Material.RAILS,
|
||||||
|
Material.STONE_PLATE,
|
||||||
|
Material.WOOD_PLATE,
|
||||||
|
Material.SNOW,
|
||||||
|
Material.DIODE_BLOCK_OFF,
|
||||||
|
Material.DIODE_BLOCK_ON,
|
||||||
|
Material.PUMPKIN_STEM,
|
||||||
|
Material.MELON_STEM,
|
||||||
|
Material.WATER_LILY,
|
||||||
|
Material.FLOWER_POT,
|
||||||
|
Material.CARROT,
|
||||||
|
Material.POTATO,
|
||||||
|
Material.GOLD_PLATE,
|
||||||
|
Material.IRON_PLATE,
|
||||||
|
Material.REDSTONE_COMPARATOR_OFF,
|
||||||
|
Material.REDSTONE_COMPARATOR_ON,
|
||||||
|
Material.ACTIVATOR_RAIL,
|
||||||
|
Material.BEETROOT_BLOCK,
|
||||||
|
Material.NETHER_WART_BLOCK,
|
||||||
|
}));
|
||||||
|
HashSet<Material> nonSolidWallMountedBlockList = new HashSet<Material>(Arrays.asList(new Material[] {
|
||||||
|
Material.TORCH,
|
||||||
|
Material.LADDER,
|
||||||
|
Material.WALL_SIGN,
|
||||||
|
Material.LEVER,
|
||||||
|
Material.REDSTONE_TORCH_OFF,
|
||||||
|
Material.REDSTONE_TORCH_ON,
|
||||||
|
Material.STONE_BUTTON,
|
||||||
|
Material.TRAP_DOOR,
|
||||||
|
Material.VINE,
|
||||||
|
Material.COCOA,
|
||||||
|
Material.TRIPWIRE_HOOK,
|
||||||
|
Material.WOOD_BUTTON,
|
||||||
|
Material.IRON_TRAPDOOR,
|
||||||
|
Material.WALL_BANNER,
|
||||||
|
}));
|
||||||
|
HashSet<Material> nonSolidBlockList = new HashSet<Material>();
|
||||||
|
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
|
this.nonSolidBlockList.addAll(nonSolidDoubleBlockList);
|
||||||
|
this.nonSolidBlockList.addAll(nonSolidSingularBlockList);
|
||||||
|
this.nonSolidBlockList.addAll(nonSolidWallMountedBlockList);
|
||||||
|
|
||||||
this.getCommand("clearchat").setExecutor(new CommandClearChat());
|
this.getCommand("clearchat").setExecutor(new CommandClearChat());
|
||||||
this.getCommand("console").setExecutor(new CommandConsole());
|
this.getCommand("console").setExecutor(new CommandConsole());
|
||||||
this.getCommand("destroyentities").setExecutor(new CommandDestroyEntities());
|
this.getCommand("destroyentities").setExecutor(new CommandDestroyEntities());
|
||||||
|
|
Loading…
Reference in a new issue