From 725d22834db5b28589c1814b558e899db89fae4d Mon Sep 17 00:00:00 2001 From: Lixfel Date: Tue, 6 Aug 2019 20:41:22 +0200 Subject: [PATCH] Moddetector start & help freeze --- src/de/steamwar/bungeecore/BungeeCore.java | 2 + src/de/steamwar/bungeecore/ModSystem.java | 431 ++++++++++++++++++ .../steamwar/bungeecore/PlayerListener.java | 375 --------------- .../bungeecore/commands/ForgeCommand.java | 16 + .../bungeecore/commands/HelpCommand.java | 1 + 5 files changed, 450 insertions(+), 375 deletions(-) create mode 100644 src/de/steamwar/bungeecore/ModSystem.java create mode 100644 src/de/steamwar/bungeecore/commands/ForgeCommand.java diff --git a/src/de/steamwar/bungeecore/BungeeCore.java b/src/de/steamwar/bungeecore/BungeeCore.java index 47052a6..d5a14e1 100644 --- a/src/de/steamwar/bungeecore/BungeeCore.java +++ b/src/de/steamwar/bungeecore/BungeeCore.java @@ -78,6 +78,7 @@ public class BungeeCore extends Plugin { ); getProxy().getPluginManager().registerListener(this, new PlayerListener()); + getProxy().getPluginManager().registerListener(this, new ModSystem()); final Configuration servers = config.getSection("servers"); for(final String serverName : servers.getKeys()){ @@ -115,6 +116,7 @@ public class BungeeCore extends Plugin { addCmd(new ChallengeCommand()); addCmd(new TeamCommand()); addCmd(new ServerTeamchatCommand()); + addCmd(new ForgeCommand()); BroadCastMsgs = config.getStringList("broadcasts").toArray(new String[1]); getProxy().getScheduler().schedule(this, () -> { diff --git a/src/de/steamwar/bungeecore/ModSystem.java b/src/de/steamwar/bungeecore/ModSystem.java new file mode 100644 index 0000000..fae9a8f --- /dev/null +++ b/src/de/steamwar/bungeecore/ModSystem.java @@ -0,0 +1,431 @@ +package de.steamwar.bungeecore; + +import com.google.common.base.Charsets; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.UnpooledByteBufAllocator; +import javafx.util.Pair; +import net.md_5.bungee.api.ProxyServer; +import net.md_5.bungee.api.connection.Connection; +import net.md_5.bungee.api.connection.ProxiedPlayer; +import net.md_5.bungee.api.event.PluginMessageEvent; +import net.md_5.bungee.api.event.PostLoginEvent; +import net.md_5.bungee.api.plugin.Listener; +import net.md_5.bungee.event.EventHandler; + +import java.util.Arrays; + +public class ModSystem implements Listener { + + private static final String FMLHS; + private static final byte[] REGISTER; + private static final byte[] HELLO; + private static final byte[] MODS; + private static final byte[] REGISTRY; + private static boolean enabled; + + public static void toggleEnabled(){ + enabled = !enabled; + } + + static{ + enabled = false; + + FMLHS = "FML|HS"; + + ByteBuf buf = UnpooledByteBufAllocator.DEFAULT.directBuffer(7); + buf.writeByte(6); + buf.writeCharSequence(FMLHS, Charsets.UTF_8); + REGISTER = new byte[buf.readableBytes()]; + buf.readBytes(REGISTER); + + HELLO = new byte[]{0, 2, 0, 0, 0, 0}; + + //Packet 2, ein Mod, minecraft 1.12.2 + MODS = new byte[]{2, 1, 9, 109, 105, 110, 101, 99, 114, 97, 102, 116, 6, 49, 46, 49, 50, 46, 50}; + + ByteBuf bb = UnpooledByteBufAllocator.DEFAULT.directBuffer(100); + bb.writeByte(3); + bb.writeByte(0); + bb.writeByte(9); + bb.writeCharSequence("minecraft", Charsets.UTF_8); + bb.writeByte(253); //VarInt 253, Missing: 36, 253, 254 + bb.writeByte(1); //VarInt +128 + registerId(bb, 0, "air"); + registerId(bb, 1, "stone"); + registerId(bb, 2, "grass"); + registerId(bb, 3, "dirt"); + registerId(bb, 4, "cobblestone"); + registerId(bb, 5, "planks"); + registerId(bb, 6, "sapling"); + registerId(bb, 7, "bedrock"); + registerId(bb, 8, "flowing_water"); + registerId(bb, 9, "water"); + registerId(bb, 10, "flowing_lava"); + registerId(bb, 11, "lava"); + registerId(bb, 12, "sand"); + registerId(bb, 13, "gravel"); + registerId(bb, 14, "gold_ore"); + registerId(bb, 15, "iron_ore"); + registerId(bb, 16, "coal_ore"); + registerId(bb, 17, "log"); + registerId(bb, 18, "leaves"); + registerId(bb, 19, "sponge"); + registerId(bb, 20, "glass"); + registerId(bb, 21, "lapis_ore"); + registerId(bb, 22, "lapis_block"); + registerId(bb, 23, "dispenser"); + registerId(bb, 24, "sandstone"); + registerId(bb, 25, "noteblock"); + registerId(bb, 26, "bed"); + registerId(bb, 27, "golden_rail"); + registerId(bb, 28, "detector_rail"); + registerId(bb, 29, "sticky_piston"); + registerId(bb, 30, "web"); + registerId(bb, 31, "tallgrass"); + registerId(bb, 32, "deadbush"); + registerId(bb, 33, "piston"); + registerId(bb, 34, "piston_head"); + registerId(bb, 35, "wool"); + registerId(bb, 37, "yellow_flower"); + registerId(bb, 38, "red_flower"); + registerId(bb, 39, "brown_mushroom"); + registerId(bb, 40, "red_mushroom"); + registerId(bb, 41, "gold_block"); + registerId(bb, 42, "iron_block"); + registerId(bb, 43, "double_stone_slab"); + registerId(bb, 44, "stone_slab"); + registerId(bb, 45, "brick_block"); + registerId(bb, 46, "tnt"); + registerId(bb, 47, "bookshelf"); + registerId(bb, 48, "mossy_cobblestone"); + registerId(bb, 49, "obsidian"); + registerId(bb, 50, "torch"); + registerId(bb, 51, "fire"); + registerId(bb, 52, "mob_spawner"); + registerId(bb, 53, "oak_stairs"); + registerId(bb, 54, "chest"); + registerId(bb, 55, "redstone_wire"); + registerId(bb, 56, "diamond_ore"); + registerId(bb, 57, "diamond_block"); + registerId(bb, 58, "crafting_table"); + registerId(bb, 59, "wheat"); + registerId(bb, 60, "farmland"); + registerId(bb, 61, "furnace"); + registerId(bb, 62, "lit_furnace"); + registerId(bb, 63, "standing_sign"); + registerId(bb, 64, "wooden_door"); + registerId(bb, 65, "ladder"); + registerId(bb, 66, "rail"); + registerId(bb, 67, "stone_stairs"); + registerId(bb, 68, "wall_sign"); + registerId(bb, 69, "lever"); + registerId(bb, 70, "stone_pressure_plate"); + registerId(bb, 71, "iron_door"); + registerId(bb, 72, "wooden_pressure_plate"); + registerId(bb, 73, "redstone_ore"); + registerId(bb, 74, "lit_redstone_ore"); + registerId(bb, 75, "unlit_redstone_torch"); + registerId(bb, 76, "redstone_torch"); + registerId(bb, 77, "stone_button"); + registerId(bb, 78, "snow_layer"); + registerId(bb, 79, "ice"); + registerId(bb, 80, "snow"); + registerId(bb, 81, "cactus"); + registerId(bb, 82, "clay"); + registerId(bb, 83, "reeds"); + registerId(bb, 84, "jukebox"); + registerId(bb, 85, "fence"); + registerId(bb, 86, "pumpkin"); + registerId(bb, 87, "netherrack"); + registerId(bb, 88, "soul_sand"); + registerId(bb, 89, "glowstone"); + registerId(bb, 90, "portal"); + registerId(bb, 91, "lit_pumpkin"); + registerId(bb, 92, "cake"); + registerId(bb, 93, "unpowered_repeater"); + registerId(bb, 94, "powered_repeater"); + registerId(bb, 95, "stained_glass"); + registerId(bb, 96, "trapdoor"); + registerId(bb, 97, "monster_egg"); + registerId(bb, 98, "stonebrick"); + registerId(bb, 99, "brown_mushroom_block"); + registerId(bb, 100, "red_mushroom_block"); + registerId(bb, 101, "iron_bars"); + registerId(bb, 102, "glass_pane"); + registerId(bb, 103, "melon_block"); + registerId(bb, 104, "pumpkin_stem"); + registerId(bb, 105, "melon_stem"); + registerId(bb, 106, "vine"); + registerId(bb, 107, "fence_gate"); + registerId(bb, 108, "brick_stairs"); + registerId(bb, 109, "stone_brick_stairs"); + registerId(bb, 110, "mycelium"); + registerId(bb, 111, "waterlily"); + registerId(bb, 112, "nether_brick"); + registerId(bb, 113, "nether_brick_fence"); + registerId(bb, 114, "nether_brick_stairs"); + registerId(bb, 115, "nether_wart"); + registerId(bb, 116, "enchanting_table"); + registerId(bb, 117, "brewing_stand"); + registerId(bb, 118, "cauldron"); + registerId(bb, 119, "end_portal"); + registerId(bb, 120, "end_portal_frame"); + registerId(bb, 121, "end_stone"); + registerId(bb, 122, "dragon_egg"); + registerId(bb, 123, "redstone_lamp"); + registerId(bb, 124, "lit_redstone_lamp"); + registerId(bb, 125, "double_wooden_slab"); + registerId(bb, 126, "wooden_slab"); + registerId(bb, 127, "cocoa"); + registerId(bb, 128, "sandstone_stairs"); + registerId(bb, 129, "emerald_ore"); + registerId(bb, 130, "ender_chest"); + registerId(bb, 131, "tripwire_hook"); + registerId(bb, 132, "tripwire"); + registerId(bb, 133, "emerald_block"); + registerId(bb, 134, "spruce_stairs"); + registerId(bb, 135, "birch_stairs"); + registerId(bb, 136, "jungle_stairs"); + registerId(bb, 137, "command_block"); + registerId(bb, 138, "beacon"); + registerId(bb, 139, "cobblestone_wall"); + registerId(bb, 140, "flower_pot"); + registerId(bb, 141, "carrots"); + registerId(bb, 142, "potatoes"); + registerId(bb, 143, "wooden_button"); + registerId(bb, 144, "skull"); + registerId(bb, 145, "anvil"); + registerId(bb, 146, "trapped_chest"); + registerId(bb, 147, "light_weighted_pressure_plate"); + registerId(bb, 148, "heavy_weighted_pressure_plate"); + registerId(bb, 149, "unpowered_comparator"); + registerId(bb, 150, "powered_comparator"); + registerId(bb, 151, "daylight_detector"); + registerId(bb, 152, "redstone_block"); + registerId(bb, 153, "quartz_ore"); + registerId(bb, 154, "hopper"); + registerId(bb, 155, "quartz_block"); + registerId(bb, 156, "quartz_stairs"); + registerId(bb, 157, "activator_rail"); + registerId(bb, 158, "dropper"); + registerId(bb, 159, "stained_hardened_clay"); + registerId(bb, 160, "stained_glass_pane"); + registerId(bb, 161, "leaves2"); + registerId(bb, 162, "log2"); + registerId(bb, 163, "acacia_stairs"); + registerId(bb, 164, "dark_oak_stairs"); + registerId(bb, 165, "slime"); + registerId(bb, 166, "barrier"); + registerId(bb, 167, "iron_trapdoor"); + registerId(bb, 168, "prismarine"); + registerId(bb, 169, "sea_lantern"); + registerId(bb, 170, "hay_block"); + registerId(bb, 171, "carpet"); + registerId(bb, 172, "hardened_clay"); + registerId(bb, 173, "coal_block"); + registerId(bb, 174, "packed_ice"); + registerId(bb, 175, "double_plant"); + registerId(bb, 176, "standing_banner"); + registerId(bb, 177, "wall_banner"); + registerId(bb, 178, "daylight_detector_inverted"); + registerId(bb, 179, "red_sandstone"); + registerId(bb, 180, "red_sandstone_stairs"); + registerId(bb, 181, "double_stone_slab2"); + registerId(bb, 182, "stone_slab2"); + registerId(bb, 183, "spruce_fence_gate"); + registerId(bb, 184, "birch_fence_gate"); + registerId(bb, 185, "jungle_fence_gate"); + registerId(bb, 186, "dark_oak_fence_gate"); + registerId(bb, 187, "acacia_fence_gate"); + registerId(bb, 188, "spruce_fence"); + registerId(bb, 189, "birch_fence"); + registerId(bb, 190, "jungle_fence"); + registerId(bb, 191, "dark_oak_fence"); + registerId(bb, 192, "acacia_fence"); + registerId(bb, 193, "spruce_door"); + registerId(bb, 194, "birch_door"); + registerId(bb, 195, "jungle_door"); + registerId(bb, 196, "acacia_door"); + registerId(bb, 197, "dark_oak_door"); + registerId(bb, 198, "end_rod"); + registerId(bb, 199, "chorus_plant"); + registerId(bb, 200, "chorus_flower"); + registerId(bb, 201, "purpur_block"); + registerId(bb, 202, "purpur_pillar"); + registerId(bb, 203, "purpur_stairs"); + registerId(bb, 204, "purpur_double_slab"); + registerId(bb, 205, "purpur_slab"); + registerId(bb, 206, "end_bricks"); + registerId(bb, 207, "beetroots"); + registerId(bb, 208, "grass_path"); + registerId(bb, 209, "end_gateway"); + registerId(bb, 210, "repeating_command_block"); + registerId(bb, 211, "chain_command_block"); + registerId(bb, 212, "frosted_ice"); + registerId(bb, 213, "magma"); + registerId(bb, 214, "nether_wart_block"); + registerId(bb, 215, "red_nether_brick"); + registerId(bb, 216, "bone_block"); + registerId(bb, 217, "structure_void"); + registerId(bb, 218, "observer"); + registerId(bb, 219, "white_shulker_box"); + registerId(bb, 220, "orange_shulker_box"); + registerId(bb, 221, "magenta_shulker_box"); + registerId(bb, 222, "light_blue_shulker_box"); + registerId(bb, 223, "yellow_shulker_box"); + registerId(bb, 224, "lime_shulker_box"); + registerId(bb, 225, "pink_shulker_box"); + registerId(bb, 226, "gray_shulker_box"); + registerId(bb, 227, "silver_shulker_box"); + registerId(bb, 228, "cyan_shulker_box"); + registerId(bb, 229, "purple_shulker_box"); + registerId(bb, 230, "blue_shulker_box"); + registerId(bb, 231, "brown_shulker_box"); + registerId(bb, 232, "green_shulker_box"); + registerId(bb, 233, "red_shulker_box"); + registerId(bb, 234, "black_shulker_box"); + registerId(bb, 235, "white_glazed_terracotta"); + registerId(bb, 236, "orange_glazed_terracotta"); + registerId(bb, 237, "magenta_glazed_terracotta"); + registerId(bb, 238, "light_blue_glazed_terracotta"); + registerId(bb, 239, "yellow_glazed_terracotta"); + registerId(bb, 240, "lime_glazed_terracotta"); + registerId(bb, 241, "pink_glazed_terracotta"); + registerId(bb, 242, "gray_glazed_terracotta"); + registerId(bb, 243, "light_gray_glazed_terracotta"); + registerId(bb, 244, "cyan_glazed_terracotta"); + registerId(bb, 245, "purple_glazed_terracotta"); + registerId(bb, 246, "blue_glazed_terracotta"); + registerId(bb, 247, "brown_glazed_terracotta"); + registerId(bb, 248, "green_glazed_terracotta"); + registerId(bb, 249, "red_glazed_terracotta"); + registerId(bb, 250, "black_glazed_terracotta"); + registerId(bb, 251, "concrete"); + registerId(bb, 252, "concrete_powder"); + registerId(bb, 255, "structure_block"); + bb.writeByte(0); + bb.writeByte(0); + REGISTRY = new byte[bb.readableBytes()]; + bb.readBytes(REGISTRY); + } + + @EventHandler + public void onPostLogin(PostLoginEvent event) { + ProxiedPlayer player = event.getPlayer(); + + if(!enabled) + return; + + if(player.getPendingConnection().getVersion() > 340){ + //1.13+ + player.sendData("minecraft:register", REGISTER); + }else{ + //1.12- + player.sendData("REGISTER", REGISTER); + } + + player.sendData(FMLHS, HELLO); + } + + @EventHandler + public void onPluginMessageEvent(PluginMessageEvent e){ + System.out.println(e.getSender().getAddress().getHostString() + " " + e.getTag() + " " + Arrays.toString(e.getData())); + + if(e.getTag().equals("LMC")) { + e.setCancelled(true); + byte[] data = e.getData(); + Pair purpose = readString(data, 0); + Pair value = readString(data, purpose.getKey()); + System.out.println(purpose.getValue()); + System.out.println(value.getValue()); + return; + }else if(!e.getTag().equals(FMLHS)){ + return; + } + + if(!enabled) + return; + e.setCancelled(true); + byte[] data = e.getData(); + ProxiedPlayer p = getPlayer(e.getSender()); + if(p == null) + return; + + switch(data[0]){ + case 2: + Pair numMods = readVarInt(data, 1); + System.out.println("Number of mods: " + numMods); + int bytePos = 1 + numMods.getKey(); + for(int i = 0; i < numMods.getValue(); i++){ + byte[] name = Arrays.copyOfRange(data, bytePos + 1, bytePos + data[bytePos] + 1); + bytePos += 1 + data[bytePos]; + byte[] version = Arrays.copyOfRange(data, bytePos + 1, bytePos + data[bytePos] + 1); + bytePos += 1 + data[bytePos]; + + System.out.println(new String(name) + " " + new String(version)); + } + + p.sendData(FMLHS, MODS); + break; + case -1: + switch(data[1]){ + case 2: + p.sendData(FMLHS, REGISTRY); + break; + case 3: + p.sendData(FMLHS, new byte[]{-1, 2}); + break; + case 4: + p.sendData(FMLHS, new byte[]{-1, 3}); + break; + default: + break; + } + break; + case 1: + default: + break; + } + } + + private static void registerId(ByteBuf bb, int id, String name){ + bb.writeByte(name.length()); + bb.writeCharSequence(name, Charsets.UTF_8); + bb.writeByte(id); + if(id > 127) + bb.writeByte(1); + } + + private static ProxiedPlayer getPlayer(Connection c){ + for(ProxiedPlayer p : ProxyServer.getInstance().getPlayers()){ + if(p.getPendingConnection().getAddress().equals(c.getAddress())){ + return p; + } + } + return null; + } + + private static Pair readVarInt(byte[] array, int startPos) { + int numRead = 0; + int result = 0; + byte read; + do { + read = array[startPos + numRead]; + int value = (read & 0b01111111); + result |= (value << (7 * numRead)); + + numRead++; + if (numRead > 5) { + break; + } + } while ((read & 0b10000000) != 0); + + return new Pair<>(numRead, result); + } + + private static Pair readString(byte[] array, int startPos){ + Pair varInt = readVarInt(array, startPos); + startPos += varInt.getKey(); + return new Pair<>(varInt.getValue()+varInt.getKey(), new String(Arrays.copyOfRange(array, startPos, startPos + varInt.getValue()), Charsets.UTF_8)); + } +} diff --git a/src/de/steamwar/bungeecore/PlayerListener.java b/src/de/steamwar/bungeecore/PlayerListener.java index 60507f2..d6adf69 100644 --- a/src/de/steamwar/bungeecore/PlayerListener.java +++ b/src/de/steamwar/bungeecore/PlayerListener.java @@ -123,19 +123,6 @@ public class PlayerListener implements Listener { if(player.getPendingConnection().getVersion() < 335 || player.getPendingConnection().getVersion() > 340){ player.sendMessage(BungeeCore.ChatPrefix + "§cWir empfehlen die Minecraft-Version 1.12.2"); } -/* - ByteArrayDataOutput output = ByteStreams.newDataOutput(); - output.writeUTF("FML|HS"); - - if(player.getPendingConnection().getVersion() > 340){ - //1.13+ - player.sendData("minecraft:register", output.toByteArray()); - }else{ - //1.12- - player.sendData("REGISTER", output.toByteArray()); - } - - player.sendData("FML|HS", new byte[]{0, 2, 0, 0, 0, 0});*/ } /** To redirect players to the lobby in case of server closure. */ @@ -276,366 +263,4 @@ public class PlayerListener implements Listener { } } } - - /* - @EventHandler - public void onPluginMessageEvent(PluginMessageEvent e){ - System.out.println(e.getSender().getAddress().getHostString() + " " + e.getTag() + " " + Arrays.toString(e.getData())); - - if(!e.getTag().equals("FML|HS")){ - return; - } - e.setCancelled(true); - byte[] data = e.getData(); - ProxiedPlayer p = getPlayer(e.getSender()); - switch(data[0]){ - case 2: - int numMods = readVarInt(data, 1); - System.out.println("Number of mods: " + numMods); - int bytePos = 1 + readVarIntLength(data, 1); - for(int i = 0; i < numMods; i++){ - byte[] name = Arrays.copyOfRange(data, bytePos + 1, bytePos + data[bytePos] + 1); - bytePos += 1 + data[bytePos]; - byte[] version = Arrays.copyOfRange(data, bytePos + 1, bytePos + data[bytePos] + 1); - bytePos += 1 + data[bytePos]; - - System.out.println(new String(name) + " " + new String(version)); - } - - p.sendData("FML|HS", new byte[]{2, 0}); - //p.sendData("FML|HS", new byte[]{2, 1, 9, 109, 105, 110, 101, 99, 114, 97, 102, 116, 6, 49, 46, 49, 50, 46, 50}); - break; - case -1: - switch(data[1]){ - case 2: - ByteBuf bb = UnpooledByteBufAllocator.DEFAULT.directBuffer(100); - bb.writeByte(3); - bb.writeByte(0); - bb.writeByte(9); - bb.writeCharSequence("minecraft", Charsets.UTF_8); - bb.writeByte(253); //Missing: 36, 253, 254 - - registerId(bb, 0, "air"); - registerId(bb, 1, "stone"); - registerId(bb, 2, "grass"); - registerId(bb, 3, "dirt"); - registerId(bb, 4, "cobblestone"); - registerId(bb, 5, "planks"); - registerId(bb, 6, "sapling"); - registerId(bb, 7, "bedrock"); - registerId(bb, 8, "flowing_water"); - registerId(bb, 9, "water"); - registerId(bb, 10, "flowing_lava"); - registerId(bb, 11, "lava"); - registerId(bb, 12, "sand"); - registerId(bb, 13, "gravel"); - registerId(bb, 14, "gold_ore"); - registerId(bb, 15, "iron_ore"); - registerId(bb, 16, "coal_ore"); - registerId(bb, 17, "log"); - registerId(bb, 18, "leaves"); - registerId(bb, 19, "sponge"); - registerId(bb, 20, "glass"); - registerId(bb, 21, "lapis_ore"); - registerId(bb, 22, "lapis_block"); - registerId(bb, 23, "dispenser"); - registerId(bb, 24, "sandstone"); - registerId(bb, 25, "noteblock"); - registerId(bb, 26, "bed"); - registerId(bb, 27, "golden_rail"); - registerId(bb, 28, "detector_rail"); - registerId(bb, 29, "sticky_piston"); - registerId(bb, 30, "web"); - registerId(bb, 31, "tallgrass"); - registerId(bb, 32, "deadbush"); - registerId(bb, 33, "piston"); - registerId(bb, 34, "piston_head"); - registerId(bb, 35, "wool"); - registerId(bb, 37, "yellow_flower"); - registerId(bb, 38, "red_flower"); - registerId(bb, 39, "brown_mushroom"); - registerId(bb, 40, "red_mushroom"); - registerId(bb, 41, "gold_block"); - registerId(bb, 42, "iron_block"); - registerId(bb, 43, "double_stone_slab"); - registerId(bb, 44, "stone_slab"); - registerId(bb, 45, "brick_block"); - registerId(bb, 46, "tnt"); - registerId(bb, 47, "bookshelf"); - registerId(bb, 48, "mossy_cobblestone"); - registerId(bb, 49, "obsidian"); - registerId(bb, 50, "torch"); - registerId(bb, 51, "fire"); - registerId(bb, 52, "mob_spawner"); - registerId(bb, 53, "oak_stairs"); - registerId(bb, 54, "chest"); - registerId(bb, 55, "redstone_wire"); - registerId(bb, 56, "diamond_ore"); - registerId(bb, 57, "diamond_block"); - registerId(bb, 58, "crafting_table"); - registerId(bb, 59, "wheat"); - registerId(bb, 60, "farmland"); - registerId(bb, 61, "furnace"); - registerId(bb, 62, "lit_furnace"); - registerId(bb, 63, "standing_sign"); - registerId(bb, 64, "wooden_door"); - registerId(bb, 65, "ladder"); - registerId(bb, 66, "rail"); - registerId(bb, 67, "stone_stairs"); - registerId(bb, 68, "wall_sign"); - registerId(bb, 69, "lever"); - registerId(bb, 70, "stone_pressure_plate"); - registerId(bb, 71, "iron_door"); - registerId(bb, 72, "wooden_pressure_plate"); - registerId(bb, 73, "redstone_ore"); - registerId(bb, 74, "lit_redstone_ore"); - registerId(bb, 75, "unlit_redstone_torch"); - registerId(bb, 76, "redstone_torch"); - registerId(bb, 77, "stone_button"); - registerId(bb, 78, "snow_layer"); - registerId(bb, 79, "ice"); - registerId(bb, 80, "snow"); - registerId(bb, 81, "cactus"); - registerId(bb, 82, "clay"); - registerId(bb, 83, "reeds"); - registerId(bb, 84, "jukebox"); - registerId(bb, 85, "fence"); - registerId(bb, 86, "pumpkin"); - registerId(bb, 87, "netherrack"); - registerId(bb, 88, "soul_sand"); - registerId(bb, 89, "glowstone"); - registerId(bb, 90, "portal"); - registerId(bb, 91, "lit_pumpkin"); - registerId(bb, 92, "cake"); - registerId(bb, 93, "unpowered_repeater"); - registerId(bb, 94, "powered_repeater"); - registerId(bb, 95, "stained_glass"); - registerId(bb, 96, "trapdoor"); - registerId(bb, 97, "monster_egg"); - registerId(bb, 98, "stonebrick"); - registerId(bb, 99, "brown_mushroom_block"); - registerId(bb, 100, "red_mushroom_block"); - registerId(bb, 101, "iron_bars"); - registerId(bb, 102, "glass_pane"); - registerId(bb, 103, "melon_block"); - registerId(bb, 104, "pumpkin_stem"); - registerId(bb, 105, "melon_stem"); - registerId(bb, 106, "vine"); - registerId(bb, 107, "fence_gate"); - registerId(bb, 108, "brick_stairs"); - registerId(bb, 109, "stone_brick_stairs"); - registerId(bb, 110, "mycelium"); - registerId(bb, 111, "waterlily"); - registerId(bb, 112, "nether_brick"); - registerId(bb, 113, "nether_brick_fence"); - registerId(bb, 114, "nether_brick_stairs"); - registerId(bb, 115, "nether_wart"); - registerId(bb, 116, "enchanting_table"); - registerId(bb, 117, "brewing_stand"); - registerId(bb, 118, "cauldron"); - registerId(bb, 119, "end_portal"); - registerId(bb, 120, "end_portal_frame"); - registerId(bb, 121, "end_stone"); - registerId(bb, 122, "dragon_egg"); - registerId(bb, 123, "redstone_lamp"); - registerId(bb, 124, "lit_redstone_lamp"); - registerId(bb, 125, "double_wooden_slab"); - registerId(bb, 126, "wooden_slab"); - registerId(bb, 127, "cocoa"); - registerId(bb, 128, "sandstone_stairs"); - registerId(bb, 129, "emerald_ore"); - registerId(bb, 130, "ender_chest"); - registerId(bb, 131, "tripwire_hook"); - registerId(bb, 132, "tripwire"); - registerId(bb, 133, "emerald_block"); - registerId(bb, 134, "spruce_stairs"); - registerId(bb, 135, "birch_stairs"); - registerId(bb, 136, "jungle_stairs"); - registerId(bb, 137, "command_block"); - registerId(bb, 138, "beacon"); - registerId(bb, 139, "cobblestone_wall"); - registerId(bb, 140, "flower_pot"); - registerId(bb, 141, "carrots"); - registerId(bb, 142, "potatoes"); - registerId(bb, 143, "wooden_button"); - registerId(bb, 144, "skull"); - registerId(bb, 145, "anvil"); - registerId(bb, 146, "trapped_chest"); - registerId(bb, 147, "light_weighted_pressure_plate"); - registerId(bb, 148, "heavy_weighted_pressure_plate"); - registerId(bb, 149, "unpowered_comparator"); - registerId(bb, 150, "powered_comparator"); - registerId(bb, 151, "daylight_detector"); - registerId(bb, 152, "redstone_block"); - registerId(bb, 153, "quartz_ore"); - registerId(bb, 154, "hopper"); - registerId(bb, 155, "quartz_block"); - registerId(bb, 156, "quartz_stairs"); - registerId(bb, 157, "activator_rail"); - registerId(bb, 158, "dropper"); - registerId(bb, 159, "stained_hardened_clay"); - registerId(bb, 160, "stained_glass_pane"); - registerId(bb, 161, "leaves2"); - registerId(bb, 162, "log2"); - registerId(bb, 163, "acacia_stairs"); - registerId(bb, 164, "dark_oak_stairs"); - registerId(bb, 165, "slime"); - registerId(bb, 166, "barrier"); - registerId(bb, 167, "iron_trapdoor"); - registerId(bb, 168, "prismarine"); - registerId(bb, 169, "sea_lantern"); - registerId(bb, 170, "hay_block"); - registerId(bb, 171, "carpet"); - registerId(bb, 172, "hardened_clay"); - registerId(bb, 173, "coal_block"); - registerId(bb, 174, "packed_ice"); - registerId(bb, 175, "double_plant"); - registerId(bb, 176, "standing_banner"); - registerId(bb, 177, "wall_banner"); - registerId(bb, 178, "daylight_detector_inverted"); - registerId(bb, 179, "red_sandstone"); - registerId(bb, 180, "red_sandstone_stairs"); - registerId(bb, 181, "double_stone_slab2"); - registerId(bb, 182, "stone_slab2"); - registerId(bb, 183, "spruce_fence_gate"); - registerId(bb, 184, "birch_fence_gate"); - registerId(bb, 185, "jungle_fence_gate"); - registerId(bb, 186, "dark_oak_fence_gate"); - registerId(bb, 187, "acacia_fence_gate"); - registerId(bb, 188, "spruce_fence"); - registerId(bb, 189, "birch_fence"); - registerId(bb, 190, "jungle_fence"); - registerId(bb, 191, "dark_oak_fence"); - registerId(bb, 192, "acacia_fence"); - registerId(bb, 193, "spruce_door"); - registerId(bb, 194, "birch_door"); - registerId(bb, 195, "jungle_door"); - registerId(bb, 196, "acacia_door"); - registerId(bb, 197, "dark_oak_door"); - registerId(bb, 198, "end_rod"); - registerId(bb, 199, "chorus_plant"); - registerId(bb, 200, "chorus_flower"); - registerId(bb, 201, "purpur_block"); - registerId(bb, 202, "purpur_pillar"); - registerId(bb, 203, "purpur_stairs"); - registerId(bb, 204, "purpur_double_slab"); - registerId(bb, 205, "purpur_slab"); - registerId(bb, 206, "end_bricks"); - registerId(bb, 207, "beetroots"); - registerId(bb, 208, "grass_path"); - registerId(bb, 209, "end_gateway"); - registerId(bb, 210, "repeating_command_block"); - registerId(bb, 211, "chain_command_block"); - registerId(bb, 212, "frosted_ice"); - registerId(bb, 213, "magma"); - registerId(bb, 214, "nether_wart_block"); - registerId(bb, 215, "red_nether_brick"); - registerId(bb, 216, "bone_block"); - registerId(bb, 217, "structure_void"); - registerId(bb, 218, "observer"); - registerId(bb, 219, "white_shulker_box"); - registerId(bb, 220, "orange_shulker_box"); - registerId(bb, 221, "magenta_shulker_box"); - registerId(bb, 222, "light_blue_shulker_box"); - registerId(bb, 223, "yellow_shulker_box"); - registerId(bb, 224, "lime_shulker_box"); - registerId(bb, 225, "pink_shulker_box"); - registerId(bb, 226, "gray_shulker_box"); - registerId(bb, 227, "silver_shulker_box"); - registerId(bb, 228, "cyan_shulker_box"); - registerId(bb, 229, "purple_shulker_box"); - registerId(bb, 230, "blue_shulker_box"); - registerId(bb, 231, "brown_shulker_box"); - registerId(bb, 232, "green_shulker_box"); - registerId(bb, 233, "red_shulker_box"); - registerId(bb, 234, "black_shulker_box"); - registerId(bb, 235, "white_glazed_terracotta"); - registerId(bb, 236, "orange_glazed_terracotta"); - registerId(bb, 237, "magenta_glazed_terracotta"); - registerId(bb, 238, "light_blue_glazed_terracotta"); - registerId(bb, 239, "yellow_glazed_terracotta"); - registerId(bb, 240, "lime_glazed_terracotta"); - registerId(bb, 241, "pink_glazed_terracotta"); - registerId(bb, 242, "gray_glazed_terracotta"); - registerId(bb, 243, "light_gray_glazed_terracotta"); - registerId(bb, 244, "cyan_glazed_terracotta"); - registerId(bb, 245, "purple_glazed_terracotta"); - registerId(bb, 246, "blue_glazed_terracotta"); - registerId(bb, 247, "brown_glazed_terracotta"); - registerId(bb, 248, "green_glazed_terracotta"); - registerId(bb, 249, "red_glazed_terracotta"); - registerId(bb, 250, "black_glazed_terracotta"); - registerId(bb, 251, "concrete"); - registerId(bb, 252, "concrete_powder"); - registerId(bb, 255, "structure_block"); - - bb.writeByte(0); - bb.writeByte(0); - System.out.println(Arrays.toString(bb.array())); - p.sendData("FML|HS", bb.array()); - break; - case 3: - p.sendData("FML|HS", new byte[]{-1, 2}); - break; - case 4: - p.sendData("FML|HS", new byte[]{-1, 3}); - break; - default: - break; - } - break; - case 1: - default: - break; - } - } - - private static void registerId(ByteBuf bb, int id, String name){ - bb.writeByte(name.length()); - bb.writeCharSequence(name, Charsets.UTF_8); - bb.writeByte(id); - if(id > 127) - bb.writeByte(1); - } - - private static ProxiedPlayer getPlayer(Connection c){ - for(ProxiedPlayer p : ProxyServer.getInstance().getPlayers()){ - if(p.getPendingConnection().getAddress().equals(c.getAddress())){ - return p; - } - } - return null; - } - - private static int readVarInt(byte[] array, int startPos) { - int numRead = 0; - int result = 0; - byte read; - do { - read = array[startPos + numRead]; - int value = (read & 0b01111111); - result |= (value << (7 * numRead)); - - numRead++; - if (numRead > 5) { - break; - } - } while ((read & 0b10000000) != 0); - - return result; - } - - private static int readVarIntLength(byte[] array, int startPos) { - int numRead = 0; - byte read; - do { - read = array[startPos + numRead]; - numRead++; - if (numRead > 5) { - break; - } - } while ((read & 0b10000000) != 0); - - return numRead; - }*/ } diff --git a/src/de/steamwar/bungeecore/commands/ForgeCommand.java b/src/de/steamwar/bungeecore/commands/ForgeCommand.java new file mode 100644 index 0000000..3771a0a --- /dev/null +++ b/src/de/steamwar/bungeecore/commands/ForgeCommand.java @@ -0,0 +1,16 @@ +package de.steamwar.bungeecore.commands; + +import de.steamwar.bungeecore.ModSystem; +import net.md_5.bungee.api.CommandSender; + +public class ForgeCommand extends Command { + + public ForgeCommand() { + super("forge", "bungeecore.softreload"); + } + + @Override + public void execute(CommandSender sender, String[] args) { + ModSystem.toggleEnabled(); + } +} diff --git a/src/de/steamwar/bungeecore/commands/HelpCommand.java b/src/de/steamwar/bungeecore/commands/HelpCommand.java index aefc73d..390d97f 100644 --- a/src/de/steamwar/bungeecore/commands/HelpCommand.java +++ b/src/de/steamwar/bungeecore/commands/HelpCommand.java @@ -66,6 +66,7 @@ public class HelpCommand extends Command { sender.sendMessage("§8/§env §8- §7(de)aktiviert Nachtsicht"); sender.sendMessage("§8/§etrace §8- §7Gibt einen Überblick über den TNT-Tracer"); sender.sendMessage("§8/§eprotect §8- §7Schützt den Boden der (M)WG-Region"); + sender.sendMessage("§8/§efreeze §8- §7Unterbindet Blockupdates"); sender.sendMessage("§8/§eskull §8- §7Gibt dir den Kopf eines Spielers"); sender.sendMessage("§8/§ebauinfo §8- §7Gibt dir Informationen über den Bauserver"); sender.sendMessage("§8/§ehelp bauserver §8- §7Hilfe zum Bauserver");