diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/block/schematic/Schematic.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/block/schematic/Schematic.java index d16430c2c..b64056a47 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/block/schematic/Schematic.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/block/schematic/Schematic.java @@ -9,10 +9,10 @@ public class Schematic private final short _width; private final short _height; private final short _length; - private final byte[] _blocks; + private final short[] _blocks; private final byte[] _blockData; - public Schematic(short width, short height, short length, byte[] blocks, byte[] blockData) + public Schematic(short width, short height, short length, short[] blocks, byte[] blockData) { _width = width; _height = height; @@ -61,7 +61,7 @@ public class Schematic return y * _width * _length + z * _width + x; } - public byte getBlock(int x, int y, int z) + public short getBlock(int x, int y, int z) { return _blocks[getIndex(x, y, z)]; } @@ -86,7 +86,7 @@ public class Schematic return _length; } - public byte[] getBlocks() + public short[] getBlocks() { return _blocks; } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/block/schematic/SchematicRunnable.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/block/schematic/SchematicRunnable.java index d502baf36..95ebe63d8 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/block/schematic/SchematicRunnable.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/block/schematic/SchematicRunnable.java @@ -98,7 +98,7 @@ public class SchematicRunnable implements Runnable private void setBlock(Block block, int x, int y, int z) { - int materialId = Math.abs(_schematic.getBlock(x, y, z)); + int materialId = _schematic.getBlock(x, y, z); byte data = _schematic.getData(x, y, z); Material material = Material.getMaterial(materialId); diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/block/schematic/UtilSchematic.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/block/schematic/UtilSchematic.java index 7125f833e..96f8cbc8b 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/block/schematic/UtilSchematic.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/block/schematic/UtilSchematic.java @@ -32,9 +32,30 @@ public class UtilSchematic short width = getChildTag(schematic, "Width", ShortTag.class).getValue(); short height = getChildTag(schematic, "Height", ShortTag.class).getValue(); short length = getChildTag(schematic, "Length", ShortTag.class).getValue(); - byte[] blocks = getChildTag(schematic, "Blocks", ByteArrayTag.class).getValue(); + byte[] blockId = getChildTag(schematic, "Blocks", ByteArrayTag.class).getValue(); + byte[] addId = new byte[0]; + short[] blocks = new short[blockId.length]; byte[] blockData = getChildTag(schematic, "Data", ByteArrayTag.class).getValue(); + if (schematic.containsKey("AddBlocks")) + { + addId = getChildTag(schematic, "AddBlocks", ByteArrayTag.class).getValue(); + } + + for (int index = 0; index < blockId.length; index++) + { + if ((index >> 1) >= addId.length) + blocks[index] = (short) (blockId[index] & 0xFF); + else + { + if ((index & 1) == 0) + blocks[index] = (short) (((addId[index >> 1] & 0x0F) << 8) + (blockId[index] & 0xFF)); + else + blocks[index] = (short) (((addId[index >> 1] & 0xF0) << 4) + (blockId[index] & 0xFF)); + } + } + + return new Schematic(width, height, length, blocks, blockData); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/blockrestore/BlockRestoreMap.java b/Plugins/Mineplex.Core/src/mineplex/core/blockrestore/BlockRestoreMap.java index 37de3d7d7..925ced50c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/blockrestore/BlockRestoreMap.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/blockrestore/BlockRestoreMap.java @@ -21,7 +21,7 @@ public class BlockRestoreMap protected BlockRestoreMap(BlockRestore blockRestore) { - this(blockRestore, 200); + this(blockRestore, 50); } protected BlockRestoreMap(BlockRestore blockRestore, int blocksPerTick) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/visibility/VisibilityManager.java b/Plugins/Mineplex.Core/src/mineplex/core/visibility/VisibilityManager.java index 4336048d5..29b8bba98 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/visibility/VisibilityManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/visibility/VisibilityManager.java @@ -97,7 +97,6 @@ public class VisibilityManager extends MiniPlugin if (event.getType() != UpdateType.MIN_01) return; - System.out.println(" "); TimingManager.endTotal("VisMan update", true); TimingManager.endTotal("VisMan setVis", true); TimingManager.endTotal("VisData attemptToProcess", true); @@ -106,6 +105,5 @@ public class VisibilityManager extends MiniPlugin TimingManager.endTotal("VisData attemptToProcessUpdate lastState", true); TimingManager.endTotal("Hide Player", true); TimingManager.endTotal("Show Player", true); - System.out.println(" "); } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java index f34736245..61f5d1755 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java @@ -121,6 +121,8 @@ public class Clans extends JavaPlugin getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1); MinecraftServer.getServer().getPropertyManager().setProperty("debug", true); + + getServer().setWhitelist(false); // TODO: remove } public static String prettifyName(Material material) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java index a75a226b9..f70bf3f3c 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java @@ -10,6 +10,7 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.plugin.java.JavaPlugin; @@ -20,6 +21,7 @@ import mineplex.core.account.CoreClientManager; import mineplex.core.achievement.AchievementManager; import mineplex.core.blockrestore.BlockRestore; import mineplex.core.chat.Chat; +import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilPlayer; @@ -606,4 +608,15 @@ public class ClansManager extends MiniClientPlugin implements IRelat _blockRestore.onDisable(); _worldEvent.onDisable(); } + + @EventHandler + public void onJoin(PlayerLoginEvent event) + { + Rank rank = _clientManager.Get(event.getPlayer()).GetRank(); + if (!rank.Has(Rank.HELPER) && !event.getPlayer().isWhitelisted()) + { + event.setResult(PlayerLoginEvent.Result.KICK_OTHER); + event.setKickMessage("Only Trainee+ can join this server"); + } + } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/WorldEventManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/WorldEventManager.java index f1150bf3d..56f2cbd83 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/WorldEventManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/WorldEventManager.java @@ -248,6 +248,9 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement @EventHandler public void gear(PlayerCommandPreprocessEvent event) { + if (!event.getPlayer().isOp()) + return; + // TODO: Remove if (event.getMessage().equalsIgnoreCase("/dgear")) { diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/event/WorldEvent.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/event/WorldEvent.java index 040dd76eb..243af4d61 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/event/WorldEvent.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/event/WorldEvent.java @@ -220,6 +220,7 @@ public abstract class WorldEvent implements Listener } }); + task.setBlocksPerTick(100); task.start(); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/event/kinghill/KingHill.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/event/kinghill/KingHill.java index 4114d50f8..03f1e5de7 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/event/kinghill/KingHill.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/event/kinghill/KingHill.java @@ -28,7 +28,7 @@ public class KingHill extends WorldEvent // TODO load hills from schematic folder with extra hill data from a config file? try { - LOADED_HILLS.add(new HillData("hill.schematic", 28, 28, 28, 5, 5, 5)); + LOADED_HILLS.add(new HillData("ClansKOTHFinal.schematic", 28, 28, 28, 5, 5, 5)); } catch (IOException e) { diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/event/slimeking/SlimeBoss.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/event/slimeking/SlimeBoss.java index 5bfd7482a..3fc49866e 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/event/slimeking/SlimeBoss.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/event/slimeking/SlimeBoss.java @@ -29,7 +29,7 @@ public class SlimeBoss extends WorldEvent try { - schematic = UtilSchematic.loadSchematic(new File("schematic/PhiSlimeArena.schematic")); + schematic = UtilSchematic.loadSchematic(new File("schematic/ClansSlimeFinal.schematic")); } catch (IOException e) { diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldBlock.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldBlock.java index a9fc37918..d36309821 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldBlock.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldBlock.java @@ -207,7 +207,7 @@ public class FieldBlock extends MiniPlugin event.setCancelled(true); } - @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void BlockBreak(BlockBreakEvent event) { if (ClansManager.isFields(event.getBlock().getLocation())) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldOre.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldOre.java index 8f07206e3..89e7c93c4 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldOre.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldOre.java @@ -204,7 +204,7 @@ public class FieldOre extends MiniPlugin if (!_oreLocations.contains(event.getBlock().getLocation())) return; - + FieldOreData ore = Get(event.getBlock().getLocation()); if (ore == null) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/commands/GearCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/commands/GearCommand.java index be2293a9c..847fdb463 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/commands/GearCommand.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/commands/GearCommand.java @@ -42,7 +42,7 @@ public class GearCommand extends CommandBase public GearCommand(GearManager plugin) { - super(plugin, Rank.ALL, "gear", "custom-gear"); + super(plugin, Rank.ADMIN, "gear", "custom-gear"); _gearManager = plugin; }