SteamWar/BungeeCore
Archiviert
13
2

Varoius Team Bugfixing + FML stub

Dieser Commit ist enthalten in:
Lixfel 2019-07-29 21:01:59 +02:00
Ursprung 7a77dc30e6
Commit d5a8b275d0
3 geänderte Dateien mit 303 neuen und 12 gelöschten Zeilen

Datei anzeigen

@ -3,6 +3,7 @@ package de.steamwar.bungeecore;
import de.steamwar.bungeecore.commands.BauCommand; import de.steamwar.bungeecore.commands.BauCommand;
import de.steamwar.bungeecore.commands.ChallengeCommand; import de.steamwar.bungeecore.commands.ChallengeCommand;
import de.steamwar.bungeecore.sql.BannedUserIPs; import de.steamwar.bungeecore.sql.BannedUserIPs;
import de.steamwar.bungeecore.sql.Team;
import de.steamwar.bungeecore.sql.WarkingUser; import de.steamwar.bungeecore.sql.WarkingUser;
import net.md_5.bungee.api.AbstractReconnectHandler; import net.md_5.bungee.api.AbstractReconnectHandler;
import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ChatColor;
@ -200,6 +201,7 @@ public class PlayerListener implements Listener {
String chatsuffix = "§7» "; String chatsuffix = "§7» ";
e.setCancelled(true); e.setCancelled(true);
WarkingUser user = WarkingUser.get(sender.getUniqueId());
if(sender.hasPermission("bungeecore.group.admin")){ if(sender.hasPermission("bungeecore.group.admin")){
chatsuffix = "§7» §e"; chatsuffix = "§7» §e";
message = ChatColor.translateAlternateColorCodes('&', message); message = ChatColor.translateAlternateColorCodes('&', message);
@ -215,6 +217,9 @@ public class PlayerListener implements Listener {
} }
String msg = name + chatsuffix + message; String msg = name + chatsuffix + message;
if(user.getTeam() != 0){
msg = "§8" + Team.get(user.getTeam()).getTeamKuerzel() + " §r" + msg;
}
for(ProxiedPlayer target : ProxyServer.getInstance().getPlayers()){ for(ProxiedPlayer target : ProxyServer.getInstance().getPlayers()){
Subserver targetServer = Subserver.getSubserver(target); Subserver targetServer = Subserver.getSubserver(target);
if(target.getChatMode() == ProxiedPlayer.ChatMode.SHOWN && (targetServer == null || targetServer.getType() != Servertype.ARENA)){ if(target.getChatMode() == ProxiedPlayer.ChatMode.SHOWN && (targetServer == null || targetServer.getType() != Servertype.ARENA)){
@ -259,7 +264,8 @@ public class PlayerListener implements Listener {
} }
} }
/*@EventHandler /*
@EventHandler
public void onPluginMessageEvent(PluginMessageEvent e){ public void onPluginMessageEvent(PluginMessageEvent e){
System.out.println(e.getSender().getAddress().getHostString() + " " + e.getTag() + " " + Arrays.toString(e.getData())); System.out.println(e.getSender().getAddress().getHostString() + " " + e.getTag() + " " + Arrays.toString(e.getData()));
@ -289,7 +295,271 @@ public class PlayerListener implements Listener {
case -1: case -1:
switch(data[1]){ switch(data[1]){
case 2: case 2:
p.sendData("FML|HS", new byte[]{3, 0, 1, 97, 0, 0, 0}); 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; break;
case 3: case 3:
p.sendData("FML|HS", new byte[]{-1, 2}); p.sendData("FML|HS", new byte[]{-1, 2});
@ -307,6 +577,14 @@ public class PlayerListener implements Listener {
} }
} }
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){ private static ProxiedPlayer getPlayer(Connection c){
for(ProxiedPlayer p : ProxyServer.getInstance().getPlayers()){ for(ProxiedPlayer p : ProxyServer.getInstance().getPlayers()){
if(p.getPendingConnection().getAddress().equals(c.getAddress())){ if(p.getPendingConnection().getAddress().equals(c.getAddress())){

Datei anzeigen

@ -37,12 +37,12 @@ public class TeamCommand extends Command {
return; return;
} }
if(sender instanceof ProxiedPlayer) if(!(sender instanceof ProxiedPlayer))
return; return;
ProxiedPlayer player = (ProxiedPlayer) sender; ProxiedPlayer player = (ProxiedPlayer) sender;
WarkingUser user = WarkingUser.get(player.getUniqueId()); WarkingUser user = WarkingUser.get(player.getUniqueId());
Team team = Team.get(user.getId()); Team team = Team.get(user.getTeam());
WarkingUser target; WarkingUser target;
ProxiedPlayer p; ProxiedPlayer p;
@ -63,6 +63,7 @@ public class TeamCommand extends Command {
return; return;
Team.create(args[1], args[2], user.getId()); Team.create(args[1], args[2], user.getId());
user.setTeam(Team.get(args[1]).getTeamId());
player.sendMessage(BungeeCore.ChatPrefix + "§7Du hast das Team §e" + args[2] + " §7gegründet!"); player.sendMessage(BungeeCore.ChatPrefix + "§7Du hast das Team §e" + args[2] + " §7gegründet!");
break; break;
case "join": case "join":
@ -121,7 +122,7 @@ public class TeamCommand extends Command {
team.disband(); team.disband();
} }
player.sendMessage(BungeeCore.ChatPrefix + "§7Du hast das Team §e" + args[2] + " §7verlassen!"); player.sendMessage(BungeeCore.ChatPrefix + "§7Du hast dein Team verlassen!");
break; break;
case "invite": case "invite":
if(notLeader(player, user, team)) if(notLeader(player, user, team))
@ -143,12 +144,18 @@ public class TeamCommand extends Command {
if(!invitations.containsKey(target)) if(!invitations.containsKey(target))
invitations.put(target, new LinkedList<>()); invitations.put(target, new LinkedList<>());
if(invitations.get(target).contains(team)){
player.sendMessage(BungeeCore.ChatPrefix + "§cDu hast diesen Spieler bereits eingeladen");
return;
}
invitations.get(target).add(team); invitations.get(target).add(team);
player.sendMessage(BungeeCore.ChatPrefix + "§7Du hast §e" + args[1] + " §7in das Team eingeladen!"); player.sendMessage(BungeeCore.ChatPrefix + "§7Du hast §e" + args[1] + " §7in das Team eingeladen!");
p = ProxyServer.getInstance().getPlayer(target.getUUID()); p = ProxyServer.getInstance().getPlayer(target.getUUID());
if(p != null) if(p != null)
player.sendMessage(BungeeCore.ChatPrefix + "§7Du wurdest in das Team §e" + team.getTeamName() + " §7eingeladen!"); p.sendMessage(BungeeCore.ChatPrefix + "§7Du wurdest in das Team §e" + team.getTeamName() + " §7eingeladen!");
break; break;
case "remove": case "remove":
if(notLeader(player, user, team)) if(notLeader(player, user, team))
@ -242,18 +249,23 @@ public class TeamCommand extends Command {
player.sendMessage(BungeeCore.ChatPrefix + "§7Du hast den Spieler §e" + args[1] + " §7zum Leader gemacht!"); player.sendMessage(BungeeCore.ChatPrefix + "§7Du hast den Spieler §e" + args[1] + " §7zum Leader gemacht!");
break; break;
case "info": case "info":
if(args.length > 1){ if(args.length == 1 && user.getTeam() == 0){
team = Team.get(args[1]);
}else if(user.getTeam() == 0){
player.sendMessage(BungeeCore.ChatPrefix + "§8/§eteam info §8[§eTeamname§8]"); player.sendMessage(BungeeCore.ChatPrefix + "§8/§eteam info §8[§eTeamname§8]");
return; return;
}else if(user.getTeam() == 0 || args.length == 2){
team = Team.get(args[1]);
}
if(team == null){
player.sendMessage(BungeeCore.ChatPrefix + "§cDieses Team gibt es nicht");
return;
} }
player.sendMessage("§7Team §e" + team.getTeamName() + " §8[§e" + team.getTeamKuerzel() + "§8]"); player.sendMessage("§7Team §e" + team.getTeamName() + " §8[§e" + team.getTeamKuerzel() + "§8]");
player.sendMessage("§7Leader§8: " + WarkingUser.get(team.getTeamLeader()).getUserName()); player.sendMessage("§7Leader§8: " + WarkingUser.get(team.getTeamLeader()).getUserName());
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("$7Member§8: §e"); sb.append("§7Member§8: §e");
List<Integer> members = team.getMembers(); List<Integer> members = team.getMembers();
for(int i : members){ for(int i : members){
@ -289,7 +301,7 @@ public class TeamCommand extends Command {
} }
Team t = Team.get(arg); Team t = Team.get(arg);
if(t != null && t.getTeamId() != team.getTeamId()){ if(t != null && (team == null || t.getTeamId() != team.getTeamId())){
player.sendMessage(BungeeCore.ChatPrefix + "§cEs gibt bereits ein Team mit diesem Namen"); player.sendMessage(BungeeCore.ChatPrefix + "§cEs gibt bereits ein Team mit diesem Namen");
return true; return true;
} }

Datei anzeigen

@ -109,10 +109,11 @@ public class Team {
public int size(){ public int size(){
ResultSet rs = sql.select("SELECT COUNT(id) FROM UserData WHERE Team = " + teamId); ResultSet rs = sql.select("SELECT COUNT(id) FROM UserData WHERE Team = " + teamId);
try { try {
rs.next();
return rs.getInt("COUNT(id)"); return rs.getInt("COUNT(id)");
}catch (SQLException e) { }catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();
return 0; return 1000;
} }
} }