diff --git a/src/main/java/me/lrxh/practice/Locale.java b/src/main/java/me/lrxh/practice/Locale.java index 0177147..2382960 100644 --- a/src/main/java/me/lrxh/practice/Locale.java +++ b/src/main/java/me/lrxh/practice/Locale.java @@ -34,7 +34,7 @@ public enum Locale { QUEUE_JOIN_UNRANKED("QUEUE.JOIN_UNRANKED"), QUEUE_LEAVE_UNRANKED("QUEUE.LEAVE_UNRANKED"), QUEUE_JOIN_RANKED("QUEUE.JOIN_RANKED"), - RANKED_ERROR("RANKED.ERROR-MESSAGE"), + RANKED_ERROR("QUEUE.RANKED-ERROR-MESSAGE"), LEADERBOARD_REFRESH("LEADERBOARD.MESSAGE"), PING_YOUR("PING.YOUR"), PING_OTHERS("PING.OTHERS"), diff --git a/src/main/java/me/lrxh/practice/Practice.java b/src/main/java/me/lrxh/practice/Practice.java index 545f247..67daf16 100644 --- a/src/main/java/me/lrxh/practice/Practice.java +++ b/src/main/java/me/lrxh/practice/Practice.java @@ -75,7 +75,6 @@ public class Practice extends JavaPlugin { private boolean placeholder = false; //private SpigotHandler spigotHandler; private Hotbar hotbar; - public static Practice getInstance() { if (practice == null) { practice = new Practice(); diff --git a/src/main/java/me/lrxh/practice/profile/ProfileListener.java b/src/main/java/me/lrxh/practice/profile/ProfileListener.java index a724d60..a0a7455 100644 --- a/src/main/java/me/lrxh/practice/profile/ProfileListener.java +++ b/src/main/java/me/lrxh/practice/profile/ProfileListener.java @@ -129,6 +129,7 @@ public void onPlayerJoinEvent(PlayerJoinEvent event) { Profile.getProfiles().put(player.getUniqueId(), profile); PlayerUtil.teleportToSpawn(player); + player.setPlayerTime(profile.getOptions().time().getTime(), false); for (Player otherPlayer : Bukkit.getOnlinePlayers()) { VisibilityLogic.handle(player, otherPlayer); @@ -145,7 +146,6 @@ public void onPlayerJoinEvent(PlayerJoinEvent event) { player.setFlying(true); player.updateInventory(); } - player.setPlayerTime(profile.getOptions().time().getTime(), false); new BukkitRunnable() { @Override public void run() { diff --git a/src/main/java/me/lrxh/practice/queue/menu/QueueSelectKitMenu.java b/src/main/java/me/lrxh/practice/queue/menu/QueueSelectKitMenu.java index 9a4f5f3..f2ae625 100644 --- a/src/main/java/me/lrxh/practice/queue/menu/QueueSelectKitMenu.java +++ b/src/main/java/me/lrxh/practice/queue/menu/QueueSelectKitMenu.java @@ -66,10 +66,7 @@ public SelectQueueButton(boolean ranked) { @Override public ItemStack getButtonItem(Player player) { - ArrayList lore = new ArrayList<>(); - - lore.add(CC.translate("&7Click to queue a random kit")); - return new ItemBuilder(Material.REDSTONE_COMPARATOR).name("&aRandom Queue").lore(lore).clearEnchantments().clearFlags().clearFlags().build(); + return new ItemBuilder(Material.REDSTONE_COMPARATOR).name("&aRandom Queue").clearEnchantments().clearFlags().clearFlags().build(); } @Override diff --git a/src/main/java/me/lrxh/practice/setting/Settings.java b/src/main/java/me/lrxh/practice/setting/Settings.java index 575115a..739e8f7 100644 --- a/src/main/java/me/lrxh/practice/setting/Settings.java +++ b/src/main/java/me/lrxh/practice/setting/Settings.java @@ -13,7 +13,7 @@ public enum Settings { KILL_EFFECTS("Kill Effects", Material.DIAMOND_AXE, "Select Kill Effect."), THEME("Select Theme", Material.BOOK, "Select Color Theme."), PING_RANGE("Ping Range", Material.STICK, "Change Ping Range."), - TIME_CHANGE("Change Time", Material.LEVER, "Change Ping Range."), + TIME_CHANGE("Change Time", Material.WATCH, "Change Ping Range."), MENU_SOUNDS("Menu Sounds", Material.REDSTONE_COMPARATOR, "Toggle Menu Sounds."); private final String name; diff --git a/src/main/java/me/lrxh/practice/setting/SettingsMenu.java b/src/main/java/me/lrxh/practice/setting/SettingsMenu.java index 3fb4fce..1696ef5 100644 --- a/src/main/java/me/lrxh/practice/setting/SettingsMenu.java +++ b/src/main/java/me/lrxh/practice/setting/SettingsMenu.java @@ -41,7 +41,7 @@ public int getSize() { @Override public Filters getFilter() { - return Filters.FILL; + return Filters.valueOf(Practice.getInstance().getMenusConfig().getString("SETTINGS.FILTER")); } public boolean resetCursor() { diff --git a/src/main/java/me/lrxh/practice/util/PlayerUtil.java b/src/main/java/me/lrxh/practice/util/PlayerUtil.java index d8b1b93..3a7ff87 100644 --- a/src/main/java/me/lrxh/practice/util/PlayerUtil.java +++ b/src/main/java/me/lrxh/practice/util/PlayerUtil.java @@ -5,10 +5,14 @@ import com.comphenix.protocol.events.PacketContainer; import me.lrxh.practice.Practice; import me.lrxh.practice.profile.SpawnTeleportEvent; +import net.minecraft.server.v1_8_R3.MinecraftServer; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityStatus; +import net.minecraft.server.v1_8_R3.PacketPlayOutNamedEntitySpawn; import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -17,9 +21,13 @@ import org.bukkit.potion.PotionEffectType; import org.bukkit.util.BlockIterator; +import java.lang.reflect.Field; import java.util.UUID; public class PlayerUtil { + private static Field STATUS_PACKET_ID_FIELD; + private static Field STATUS_PACKET_STATUS_FIELD; + private static Field SPAWN_PACKET_ID_FIELD; public static void setLastAttacker(Player victim, Player attacker) { victim.setMetadata("lastAttacker", new FixedMetadataValue(Practice.getInstance(), attacker.getUniqueId())); @@ -101,30 +109,42 @@ public static void teleportToSpawn(Player player) { } public static void animateDeath(Player player) { + try { - final int radius = Bukkit.getServer().getViewDistance() * 16; + if (STATUS_PACKET_ID_FIELD == null) { + STATUS_PACKET_ID_FIELD = PacketPlayOutEntityStatus.class.getDeclaredField("a"); + STATUS_PACKET_ID_FIELD.setAccessible(true); + } - PacketContainer namedEntitySpawnPacket = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.NAMED_ENTITY_SPAWN); - namedEntitySpawnPacket.getIntegers().write(0, player.getEntityId()).write(1, -1); + if (STATUS_PACKET_STATUS_FIELD == null) { + STATUS_PACKET_STATUS_FIELD = PacketPlayOutEntityStatus.class.getDeclaredField("b"); + STATUS_PACKET_STATUS_FIELD.setAccessible(true); + } + + if (SPAWN_PACKET_ID_FIELD == null) { + SPAWN_PACKET_ID_FIELD = PacketPlayOutNamedEntitySpawn.class.getDeclaredField("a"); + SPAWN_PACKET_ID_FIELD.setAccessible(true); + } - PacketContainer entityStatusPacket = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.ENTITY_STATUS); - entityStatusPacket.getIntegers().write(0, player.getEntityId()).write(1, (int) (byte) 3); + SPAWN_PACKET_ID_FIELD.set(new PacketPlayOutNamedEntitySpawn(((CraftPlayer) player).getHandle()), -1); + STATUS_PACKET_ID_FIELD.set(new PacketPlayOutEntityStatus(), -1); + STATUS_PACKET_STATUS_FIELD.set(new PacketPlayOutEntityStatus(), (byte) 3); + + final int radius = MinecraftServer.getServer().getPlayerList().d(); for (Entity entity : player.getNearbyEntities(radius, radius, radius)) { if (!(entity instanceof Player)) { - continue; - } + Player watcher = (Player) entity; - Player watcher = (Player) entity; + if (!watcher.getUniqueId().equals(player.getUniqueId())) { + break; + } - if (!watcher.getUniqueId().equals(player.getUniqueId())) { - continue; + ((CraftPlayer) watcher).getHandle().playerConnection.sendPacket(new PacketPlayOutNamedEntitySpawn(((CraftPlayer) player).getHandle())); + ((CraftPlayer) watcher).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityStatus()); } - - ProtocolLibrary.getProtocolManager().sendServerPacket(watcher, namedEntitySpawnPacket); - ProtocolLibrary.getProtocolManager().sendServerPacket(watcher, entityStatusPacket); } - } catch (Exception ignored) { + } catch(Exception ignored){ + } } } -} diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 41e68dd..53cc210 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -1,10 +1,8 @@ MONGO: - URI: mongodb+srv://lrxh:KlR0lOFSbtAxanOi@cluster0.st1wrul.mongodb.net/?retryWrites=true&w=majority - DATABASE: practice + URI: + DATABASE: RANKED: REQUIRED-WINS: 3 - ERROR-MESSAGE: '&cYou cannot join ranked queues with less than 10 unranked 1v1 wins. - You need {0} more wins!' DEFAULT-THEME-COLOR: AQUA LEADERBOARD: ENABLE-MESSAGE: true @@ -16,88 +14,86 @@ HOTBAR_ITEMS: MATERIAL: IRON_SWORD DURABILITY: 0 NAME: '&bUnranked Queue &7(Right Click)' - LORE: [ ] + LORE: [] SLOT: 0 QUEUE_JOIN_RANKED: MATERIAL: DIAMOND_SWORD DURABILITY: 0 NAME: '&bRanked Queue &7(Right Click)' - LORE: [ ] + LORE: [] SLOT: 1 LEADERBOARDS: MATERIAL: EMERALD DURABILITY: 0 NAME: '&bLeaderboards &7(Right Click)' - LORE: [ ] + LORE: [] SLOT: 6 PARTY_CREATE: MATERIAL: NAME_TAG DURABILITY: 0 NAME: '&bCreate a Party &7(Right Click)' - LORE: [ ] + LORE: [] SLOT: 4 PROFILE_SETTINGS: MATERIAL: PAPER DURABILITY: 0 NAME: '&bProfile Menu &7(Right Click)' - LORE: [ ] + LORE: [] SLOT: 8 KIT_EDITOR: MATERIAL: BOOK DURABILITY: 0 NAME: '&bKit Editor &7(Right Click)' - LORE: [ ] + LORE: [] SLOT: 8 QUEUEING: QUEUE_LEAVE: MATERIAL: INK_SACK DURABILITY: 1 NAME: '&cLeave Queue &7(Right Click)' - LORE: [ ] + LORE: [] SLOT: 8 PARTY: PARTY_INFORMATION: MATERIAL: NETHER_STAR DURABILITY: 0 NAME: '&bParty Information &7(Right Click)' - LORE: [ ] + LORE: [] SLOT: 0 PARTY_EVENTS: MATERIAL: DIAMOND_SWORD DURABILITY: 0 NAME: '&bParty Events &7(Right Click)' - LORE: [ ] + LORE: [] SLOT: 1 OTHER_PARTIES: MATERIAL: CHEST DURABILITY: 0 NAME: '&bOther Parties &7(Right Click)' - LORE: [ ] + LORE: [] SLOT: 2 KIT_EDITOR: MATERIAL: BOOK DURABILITY: 0 NAME: '&bKit Editor &7(Right Click)' - LORE: [ ] + LORE: [] SLOT: 7 PARTY_DISBAND: MATERIAL: INK_SACK DURABILITY: 1 NAME: '&cDisaband Party &7(Right Click)' - LORE: [ ] + LORE: [] SLOT: 8 PARTY_LEAVE: MATERIAL: INK_SACK DURABILITY: 1 NAME: '&cLeave Party &7(Right Click)' - LORE: [ ] + LORE: [] SLOT: 8 SPECTATING: SPECTATE_STOP: MATERIAL: INK_SACK DURABILITY: 1 NAME: '&cLeave Match &7(Right click)' - LORE: [ ] - SLOT: 8 -ESSENTIAL: - SPAWN_LOCATION: world:0.5:52.0:0.5:0.68951416:-3.124416 + LORE: [] + SLOT: 8 \ No newline at end of file diff --git a/src/main/resources/kits.yml b/src/main/resources/kits.yml index 9f8c190..583fa3d 100644 --- a/src/main/resources/kits.yml +++ b/src/main/resources/kits.yml @@ -84,13 +84,13 @@ kits: knockback-profile: sumo Boxing: enabled: true - description: '&7First to reach 100 hits wins' + description: '&7First to 100 hits wins' icon: material: DIAMOND_CHESTPLATE durability: 0 loadout: armor: t@0:d@-1:a@0;t@0:d@-1:a@0;t@0:d@-1:a@0;t@0:d@-1:a@0; - contents: t@276;t@0;t@0;t@0;t@0;t@0;t@0;t@0;t@0;t@0;t@0;t@0;t@0;t@0;t@0;t@0;t@0;t@0;t@0;t@0;t@0;t@0;t@0;t@0;t@0;t@0;t@0;t@0;t@0;t@0;t@0;t@0;t@0;t@0;t@0;t@0; + contents: t@276:e@16@5;null;null;null;null;null;null;null;null;null;null;null;null;null;null;null;null;null;null;null;null;null;null;null;null;null;null;null;null;null;null;null;null;null;null;null; game-rules: allow-build: false spleef: false @@ -98,4 +98,23 @@ kits: health-regeneration: false hit-delay: 20 boxing: true + bedwars: false knockback-profile: boxing + BuildUHC: + enabled: true + description: '&7Ultra Hardcore' + icon: + material: LAVA_BUCKET + durability: 0 + loadout: + armor: t@313:e@4@2:e@34@3;t@312:e@0@1:e@34@3;t@311:e@0@1:e@34@3;t@310:e@4@2:e@34@3; + contents: t@276:e@16@1:e@34@3;t@346:e@34@3;t@261:e@48@2:e@34@3;t@322:a@6;t@322:a@3:dn@ยง6Golden Head;t@327;t@326;t@4:a@64;t@278;t@262:a@64;null;null;null;null;null;null;t@5:a@64;null;null;null;null;null;null;null;null;t@5:a@64;null;null;null;null;null;null;t@327;t@326;t@4:a@64;t@279; + game-rules: + allow-build: true + spleef: false + sumo: false + health-regeneration: true + hit-delay: 20 + boxing: false + bedwars: false + knockback-profile: builduhc diff --git a/src/main/resources/menus.yml b/src/main/resources/menus.yml index cd4be84..fc62b38 100644 --- a/src/main/resources/menus.yml +++ b/src/main/resources/menus.yml @@ -128,4 +128,12 @@ LEADERBOARD: LORE: - " &7* &fWins: &b" - " &7* &fLoses: &b" - - " &7* &fElo: &b" \ No newline at end of file + - " &7* &fElo: &b" +SHOP-MENU: + TITLE: "&7Coin shop" + SIZE: 27 + FILTER: FILL # THERE IS FILL AND BRODER +SHOP: + TITLE: "&7Coin shop" + SIZE: 27 + FILTER: FILL # THERE IS FILL AND BRODER \ No newline at end of file diff --git a/src/main/resources/messages.yml b/src/main/resources/messages.yml index 53b40a5..c53d0b9 100644 --- a/src/main/resources/messages.yml +++ b/src/main/resources/messages.yml @@ -25,8 +25,8 @@ OPTIONS: SHOWPLAYERS_ENABLED: '&aShowen players!' SHOWPLAYERS_DISABLED: '&cHidden all players!' KILL_EFFECTS_SELECT: '&aYou have selected {0}!' - TIME_SELECT: '&aYou have selected {0}!' THEME_SELECT: '&aYou have selected {0}!' + TIME_SELECT: '&aYou have selected {0}!' MENU_SOUNDS_ENABLED: '&aEnabled Menu sounds!' MENU_SOUNDS_DISABLED: '&cDisabled Menu sounds!' PARTY: @@ -75,9 +75,10 @@ DUEL: QUEUE: JOIN_UNRANKED: '&aYou are now queued for Unranked {0}.' LEAVE_UNRANKED: '&cYou have been removed from queue.' - JOIN_RANKED: '&aYou are now queued for &aRanked {0}. &7&o[{1} ELO]' + JOIN_RANKED: '&aYou are now queued for &aRanked {0}. &7[{1} ELO]' LEAVE_RANKED: '&cYou have been removed from queue.' RANGE_INCREMENT: '&eSearching in ELO range &7[{1} -> {2}]&e...' + RANKED-ERROR-MESSAGE: '&cYou cannot join ranked queues with less than 10 unranked 1v1 wins. You need {0} more wins!' MATCH: START: - ' '