From 1c1697fd9adb637ecbe9bfeaa51b6f8116ae7d3b Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Sat, 12 Feb 2022 11:11:16 +0100 Subject: [PATCH 01/10] Features People, Features --- LobbySystem.iml | 50 +++++ src/de/steamwar/lobby/LobbySystem.java | 6 +- src/de/steamwar/lobby/command/FlyCommand.java | 37 ++++ .../lobby/inventories/EventParticle.java | 28 +++ .../lobby/inventories/LobbyInventory.java | 33 ++++ .../lobby/inventories/ParticleInventory.java | 181 ++++++++++++++++++ .../{Join.java => PlayerConnection.java} | 31 ++- .../listener/features/DoubleJumpListener.java | 62 ++++++ .../listener/features/EnderpearlListener.java | 64 +++++++ .../listener/features/ParticleListener.java | 46 +++++ .../features/PlayerInventoryListener.java | 33 ++++ .../listener/features/PlayerSeatListener.java | 113 +++++++++++ .../PlayerWorldInteractionListener.java | 40 ++++ .../lobby/particle/CircleParticle.java | 87 +++++++++ .../lobby/particle/CloudCircleParticle.java | 44 +++++ .../lobby/particle/CloudParticle.java | 44 +++++ .../lobby/particle/FunctionalParticle.java | 43 +++++ .../lobby/particle/ParticleFunction.java | 29 +++ .../lobby/particle/SimpleParticle.java | 62 ++++++ .../lobby/particle/SpecialParticle.java | 84 ++++++++ src/de/steamwar/lobby/util/ItemBuilder.java | 66 +++++++ src/de/steamwar/lobby/util/LobbyPlayer.java | 57 ++++++ 22 files changed, 1237 insertions(+), 3 deletions(-) create mode 100644 LobbySystem.iml create mode 100644 src/de/steamwar/lobby/command/FlyCommand.java create mode 100644 src/de/steamwar/lobby/inventories/EventParticle.java create mode 100644 src/de/steamwar/lobby/inventories/LobbyInventory.java create mode 100644 src/de/steamwar/lobby/inventories/ParticleInventory.java rename src/de/steamwar/lobby/listener/{Join.java => PlayerConnection.java} (54%) create mode 100644 src/de/steamwar/lobby/listener/features/DoubleJumpListener.java create mode 100644 src/de/steamwar/lobby/listener/features/EnderpearlListener.java create mode 100644 src/de/steamwar/lobby/listener/features/ParticleListener.java create mode 100644 src/de/steamwar/lobby/listener/features/PlayerInventoryListener.java create mode 100644 src/de/steamwar/lobby/listener/features/PlayerSeatListener.java create mode 100644 src/de/steamwar/lobby/listener/features/PlayerWorldInteractionListener.java create mode 100644 src/de/steamwar/lobby/particle/CircleParticle.java create mode 100644 src/de/steamwar/lobby/particle/CloudCircleParticle.java create mode 100644 src/de/steamwar/lobby/particle/CloudParticle.java create mode 100644 src/de/steamwar/lobby/particle/FunctionalParticle.java create mode 100644 src/de/steamwar/lobby/particle/ParticleFunction.java create mode 100644 src/de/steamwar/lobby/particle/SimpleParticle.java create mode 100644 src/de/steamwar/lobby/particle/SpecialParticle.java create mode 100644 src/de/steamwar/lobby/util/ItemBuilder.java create mode 100644 src/de/steamwar/lobby/util/LobbyPlayer.java diff --git a/LobbySystem.iml b/LobbySystem.iml new file mode 100644 index 0000000..97e2b2b --- /dev/null +++ b/LobbySystem.iml @@ -0,0 +1,50 @@ + + + + + + + SPIGOT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/de/steamwar/lobby/LobbySystem.java b/src/de/steamwar/lobby/LobbySystem.java index 56d4c27..9839c24 100644 --- a/src/de/steamwar/lobby/LobbySystem.java +++ b/src/de/steamwar/lobby/LobbySystem.java @@ -19,10 +19,11 @@ package de.steamwar.lobby; +import de.steamwar.lobby.command.FlyCommand; import de.steamwar.lobby.command.HologramCommand; import de.steamwar.lobby.command.PortalCommand; import de.steamwar.lobby.listener.Fightservers; -import de.steamwar.lobby.listener.Join; +import de.steamwar.lobby.listener.PlayerConnection; import de.steamwar.lobby.listener.Portals; import de.steamwar.message.Message; import org.bukkit.plugin.java.JavaPlugin; @@ -42,11 +43,12 @@ public class LobbySystem extends JavaPlugin { public void onEnable() { message = new Message("de.steamwar.lobby.LobbySystem", getClassLoader()); - new Join(); + new PlayerConnection(); new Fightservers(); new Portals(); new PortalCommand(); new HologramCommand(); + new FlyCommand(); config = new Config(getConfig()); } diff --git a/src/de/steamwar/lobby/command/FlyCommand.java b/src/de/steamwar/lobby/command/FlyCommand.java new file mode 100644 index 0000000..fc164ac --- /dev/null +++ b/src/de/steamwar/lobby/command/FlyCommand.java @@ -0,0 +1,37 @@ +package de.steamwar.lobby.command; + +import de.steamwar.command.SWCommand; +import de.steamwar.lobby.util.LobbyPlayer; +import de.steamwar.sql.SteamwarUser; +import de.steamwar.sql.UserGroup; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class FlyCommand extends SWCommand { + + public FlyCommand() { + super("fly"); + } + + @Register("fly") + public void flyCommand(CommandSender sender) { + if (!(sender instanceof Player)) return; + + Player player = (Player) sender; + SteamwarUser steamwarUser = SteamwarUser.get(player.getUniqueId()); + UserGroup userGroup = steamwarUser.getUserGroup(); + + if (userGroup == UserGroup.Member) { + player.sendMessage("§cUnbekannter Befehl."); + return; + } + + LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player); + boolean newFlightState = !lobbyPlayer.isFlying(); + + lobbyPlayer.setFly(newFlightState); + player.setAllowFlight(newFlightState); + player.setFlying(newFlightState); + player.sendMessage("§7Du kannst jetzt " + (newFlightState ? "§afliegen§7." : "§cnicht §7mehr fliegen.")); + } +} diff --git a/src/de/steamwar/lobby/inventories/EventParticle.java b/src/de/steamwar/lobby/inventories/EventParticle.java new file mode 100644 index 0000000..98fc1c7 --- /dev/null +++ b/src/de/steamwar/lobby/inventories/EventParticle.java @@ -0,0 +1,28 @@ +package de.steamwar.lobby.inventories; + +import de.steamwar.lobby.particle.*; +import org.bukkit.Material; +import org.bukkit.Particle; + +public enum EventParticle { + + WarGearSeason(22, new int[]{12, 285, 54}, new CloudCircleParticle(Material.ENCHANTING_TABLE, "§cVerzaubert", ParticleInventory.loreBuilder(new String[]{"Wolke", "Ring"}, "WarGearSeason Event 1., 2. oder 3. Platz"), Particle.ENCHANTMENT_TABLE, location -> location.add(0, 1.1, 0)), new SimpleParticle(Material.BOOK, "§5Verzaubert", ParticleInventory.loreBuilder(new String[0], "WarGearSeason Event"), Particle.ENCHANTMENT_TABLE)), + AirshipEvent(26, new int[]{205, 9, 54, 120, 292}, new CircleParticle(Material.SNOWBALL, "§fCloud", ParticleInventory.loreBuilder(new String[]{"Ring"}, "AirshipEvent Event 1., 2. oder 3. Platz"), Particle.CLOUD, null, location -> location.add(0, 2.2, 0)), new SimpleParticle(Material.SNOW_BLOCK, "§fCloud", ParticleInventory.loreBuilder(new String[0], "AirshipEvent Event"), Particle.CLOUD)), + HellsBellsWs(28, new int[]{205, 9, 11}, new CloudCircleParticle(Material.TNT_MINECART, "§7Smoke", ParticleInventory.loreBuilder(new String[]{"Wolke", "Ring"}, "HellsBells Event 1., 2. oder 3. Platz"), Particle.CAMPFIRE_COSY_SMOKE, location -> location.add(0, 2.2, 0)), new CircleParticle(Material.TNT, "§8Smoke", ParticleInventory.loreBuilder(new String[]{"Ring"}, "HellsBells Event"), Particle.CAMPFIRE_COSY_SMOKE, null, location -> location, 0, 0, 0, 0.01)), + Underwater(31, new int[]{9, 210, 520}, new CloudParticle(Material.PRISMARINE_CRYSTALS, "§bWasser", ParticleInventory.loreBuilder(new String[]{"Wolke"}, "Underwater Event 1., 2. oder 3. Platz"), Particle.DRIP_WATER), new SimpleParticle(Material.PRISMARINE_BRICKS, "§bWasser", ParticleInventory.loreBuilder(new String[0], "Underwater Event"), Particle.DRIP_WATER)); + + public static EventParticle[] eventParticles = values(); + + EventParticle(int event, int[] placementTeams, SpecialParticle placementParticle, SpecialParticle participationParticles) { + this.event = event; + this.placementTeams = placementTeams; + this.placementParticle = placementParticle; + this.participationParticles = participationParticles; + + } + + public final int event; + public final int[] placementTeams; + public final SpecialParticle placementParticle; + public final SpecialParticle participationParticles; +} diff --git a/src/de/steamwar/lobby/inventories/LobbyInventory.java b/src/de/steamwar/lobby/inventories/LobbyInventory.java new file mode 100644 index 0000000..ea9141c --- /dev/null +++ b/src/de/steamwar/lobby/inventories/LobbyInventory.java @@ -0,0 +1,33 @@ +package de.steamwar.lobby.inventories; + +import de.steamwar.lobby.util.ItemBuilder; +import de.steamwar.lobby.util.LobbyPlayer; +import org.bukkit.Material; +import org.bukkit.entity.Player; + +public class LobbyInventory { + + private LobbyInventory() {} + + public static Material PARTICLE = Material.NAME_TAG; + public static Material ENDERPEARL_USED = Material.FIREWORK_STAR; + public static Material ENDERPEARL_READY = Material.ENDER_PEARL; + public static Material SHIELD = Material.SHIELD; + + public static void givePlayerLobbyItems(Player player) { + LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId()); + + player.getInventory().setItem(3, new ItemBuilder(lobbyPlayer.isEnderPearlUsed() ? ENDERPEARL_USED : ENDERPEARL_READY) + .setDisplayName("§5Enderperle") + .setUnbreakable(true) + .removeAllAtributs() + .build()); + + player.getInventory().setItem(5, new ItemBuilder(PARTICLE) + .setDisplayName("§6Partikel") + .setUnbreakable(true) + .removeAllAtributs() + .build()); + } + +} diff --git a/src/de/steamwar/lobby/inventories/ParticleInventory.java b/src/de/steamwar/lobby/inventories/ParticleInventory.java new file mode 100644 index 0000000..37f1816 --- /dev/null +++ b/src/de/steamwar/lobby/inventories/ParticleInventory.java @@ -0,0 +1,181 @@ +package de.steamwar.lobby.inventories; + +import de.steamwar.inventory.SWInventory; +import de.steamwar.inventory.SWItem; +import de.steamwar.inventory.SWListInv; +import de.steamwar.lobby.particle.*; +import de.steamwar.lobby.util.LobbyPlayer; +import de.steamwar.sql.*; +import org.bukkit.Material; +import org.bukkit.Particle; +import org.bukkit.entity.Player; + +import java.util.*; +import java.util.stream.Collectors; + +public class ParticleInventory { + + private ParticleInventory() { + } + + private static final List PLAYER_PARTICLES = new ArrayList<>(); + private static final List TEAM_PARTICLES = new ArrayList<>(); + private static final List SERVERTEAM_PARTICLES = new ArrayList<>(); + + private static final List> PLAYER_PARTICLES_ENTRIES = new ArrayList<>(); + private static final List> TEAM_PARTICLES_ENTRIES = new ArrayList<>(); + private static final List> SERVERTEAM_PARTICLES_ENTRIES = new ArrayList<>(); + + static { + List defaultLore = loreBuilder(null, null); + List teamLore = loreBuilder(null, "Team beitritt"); + List serverTeamLore = loreBuilder(null, "Serverteam"); + List serverTeamLore_C = loreBuilder(new String[]{"Wolke"}, "Serverteam"); + List serverTeamLore_R = loreBuilder(new String[]{"Ring"}, "Serverteam"); + List serverTeamLore_2R = loreBuilder(new String[]{"doppel Ring"}, "Serverteam"); + List serverTeamLore_CR = loreBuilder(new String[]{"Wolke", "Ring"}, "Serverteam"); + + PLAYER_PARTICLES.add(new SimpleParticle(Material.SLIME_BLOCK, "§aSneeze", defaultLore, Particle.SNEEZE, 0.2F, 0.2F, 0.2F, 0.01)); + PLAYER_PARTICLES.add(new SimpleParticle(Material.COBWEB, "§7Smoke", defaultLore, Particle.SMOKE_NORMAL, 0.2F, 0.2F, 0.2F, 0.01)); + PLAYER_PARTICLES.add(new SimpleParticle(Material.LAVA_BUCKET, "§cFeuer", defaultLore, Particle.DRIP_LAVA)); + PLAYER_PARTICLES.add(new SimpleParticle(Material.WATER_BUCKET, "§bWasser", defaultLore, Particle.DRIP_WATER)); + PLAYER_PARTICLES.add(new FunctionalParticle(Material.RED_DYE, "§cHerzen", defaultLore, (world, player, integer) -> world.spawnParticle(Particle.HEART, player.getLocation().add(0, 2.2, 0), 5))); + PLAYER_PARTICLES.add(new FunctionalParticle(Material.NOTE_BLOCK, "§eNoten", defaultLore, (world, player, integer) -> world.spawnParticle(Particle.NOTE, player.getLocation().add(0, 2.2, 0), 5))); + PLAYER_PARTICLES.add(new SimpleParticle(Material.NAUTILUS_SHELL, "§aNautilis", defaultLore, Particle.NAUTILUS, 0.2F, 0F, 0.2F, 0.01)); + PLAYER_PARTICLES.add(new SimpleParticle(Material.SNOWBALL, "§fSnowball", defaultLore, Particle.SNOWBALL, 0.2F, 0F, 0.2F, 0.01)); + PLAYER_PARTICLES.add(new FunctionalParticle(Material.GLASS_BOTTLE, "§5Effekt", defaultLore, (world, player, time) -> { + world.spawnParticle(Particle.REDSTONE, player.getLocation().add(0.0, 0.2, 0.0), 5, 0F, 0.2F, 0F, 0.01, SpecialParticle.getParticleDust()); + })); + PLAYER_PARTICLES.add(new SimpleParticle(Material.CAMPFIRE, "§7Rauch", defaultLore, Particle.CAMPFIRE_COSY_SMOKE, 0.0F, 0.2F, 0F, 0.01)); + PLAYER_PARTICLES.add(new SimpleParticle(Material.CAULDRON, "§5Magie", defaultLore, Particle.CRIT_MAGIC, 0.2F, 0.2F, 0.2F, 0.01)); + PLAYER_PARTICLES.add(new SimpleParticle(Material.REDSTONE_BLOCK, "§4Wut", defaultLore, Particle.VILLAGER_ANGRY, 0.2F, 0.02F, 0.2F, 0.01)); + PLAYER_PARTICLES.add(new SimpleParticle(Material.SLIME_BALL, "§aSchleim", defaultLore, Particle.SLIME)); + PLAYER_PARTICLES.add(new SimpleParticle(Material.ZOMBIE_HEAD, "§7Mob", defaultLore, Particle.SPELL_MOB)); + + TEAM_PARTICLES.addAll(PLAYER_PARTICLES); + TEAM_PARTICLES.add(new SimpleParticle(Material.INK_SAC, "§8Squid", teamLore, Particle.SQUID_INK, 0.2F, 0.2F, 0.2F, 0.01)); + TEAM_PARTICLES.add(new SimpleParticle(Material.TUBE_CORAL, "§aBubble", teamLore, Particle.BUBBLE_POP, 0.2F, 0.2F, 0.2F, 0.01)); + TEAM_PARTICLES.add(new SimpleParticle(Material.HONEY_BOTTLE, "§6Honey", teamLore, Particle.DRIPPING_HONEY, 0.2F, 0.2F, 0.2F, 1)); + TEAM_PARTICLES.add(new SimpleParticle(Material.HONEYCOMB, "§6Nectar", teamLore, Particle.FALLING_NECTAR, 0.2F, 0.2F, 0.2F, 1)); + TEAM_PARTICLES.add(new FunctionalParticle(Material.FIRE_CHARGE, "§7Firework", loreBuilder(new String[]{"in Luft"}, "Team beitritt"), (world, player, time) -> { + if (world.getBlockAt(player.getLocation().subtract(0, 1, 0)).getType() == Material.AIR) { + world.spawnParticle(Particle.FIREWORKS_SPARK, player.getLocation().subtract(0, -0.2, 0), 2, 0.1F, 0.1F, 0.1F, 0.2); + } + })); + TEAM_PARTICLES.add(new SimpleParticle(Material.DRAGON_BREATH, "§5Dragon Breath", teamLore, Particle.DRAGON_BREATH, 1F, 0.02F, 1F, 0.01)); + TEAM_PARTICLES.add(new SimpleParticle(Material.SPIDER_EYE, "§5Damage", teamLore, Particle.DAMAGE_INDICATOR, 0.2F, 0F, 0.2F, 0.01)); + TEAM_PARTICLES.add(new SimpleParticle(Material.BLUE_DYE, "§dDolphin", teamLore, Particle.DOLPHIN, 0.2F, 0F, 0.2F, 0.01)); + TEAM_PARTICLES.add(new CircleParticle(Material.RED_CONCRETE, "§cHerzen", loreBuilder(new String[]{"Ring"}, "Team beitritt"), Particle.HEART, null, location -> location.add(0, 2.2, 0))); + + SERVERTEAM_PARTICLES.addAll(TEAM_PARTICLES); + SERVERTEAM_PARTICLES.add(new SimpleParticle(Material.EXPERIENCE_BOTTLE, "§5Hexe", serverTeamLore, Particle.SPELL_WITCH)); + SERVERTEAM_PARTICLES.add(new SimpleParticle(Material.ENCHANTING_TABLE, "§eZauber", serverTeamLore, Particle.ENCHANTMENT_TABLE)); + SERVERTEAM_PARTICLES.add(new SimpleParticle(Material.EMERALD_BLOCK, "§2Freude", serverTeamLore, Particle.VILLAGER_HAPPY, 0.2F, 0.2F, 0.2F, 0.01)); + SERVERTEAM_PARTICLES.add(new SimpleParticle(Material.FLINT_AND_STEEL, "§7Flammen", serverTeamLore, Particle.FLAME, 0F, 0.2F, 0F, 0.01)); + SERVERTEAM_PARTICLES.add(new SimpleParticle(Material.END_ROD, "§fEnd Rod", serverTeamLore, Particle.END_ROD, 0.2F, 0.2F, 0.2F, 0.01)); + SERVERTEAM_PARTICLES.add(new CloudParticle(Material.WHITE_WOOL, "§fCloud", serverTeamLore_C, Particle.CLOUD)); + SERVERTEAM_PARTICLES.add(new CloudParticle(Material.TOTEM_OF_UNDYING, "§aTotem", serverTeamLore_C, Particle.TOTEM)); + SERVERTEAM_PARTICLES.add(new CloudParticle(Material.WHITE_DYE, "§eZauber", serverTeamLore_C, Particle.ENCHANTMENT_TABLE)); + SERVERTEAM_PARTICLES.add(new CloudParticle(Material.FIRE_CORAL_BLOCK, "§cFlammen", serverTeamLore_C, Particle.FLAME)); + SERVERTEAM_PARTICLES.add(new CloudParticle(Material.LIME_SHULKER_BOX, "§aSneeze", serverTeamLore_C, Particle.SNEEZE)); + SERVERTEAM_PARTICLES.add(new CloudParticle(Material.GREEN_SHULKER_BOX, "§aSchleim", serverTeamLore_C, Particle.SLIME)); + SERVERTEAM_PARTICLES.add(new CloudParticle(Material.DEAD_BRAIN_CORAL_BLOCK, "§8Smoke", serverTeamLore_C, Particle.CAMPFIRE_COSY_SMOKE)); + SERVERTEAM_PARTICLES.add(new CloudParticle(Material.FIREWORK_STAR, "§5Town", serverTeamLore_C, Particle.TOWN_AURA)); + SERVERTEAM_PARTICLES.add(new CircleParticle(Material.MAGMA_BLOCK, "§cFlammen", serverTeamLore_R, Particle.FLAME, null, location -> location.add(0, 1.1, 0), 0F, 0.0F, 0F, 0.01)); + SERVERTEAM_PARTICLES.add(new CircleParticle(Material.ENCHANTED_BOOK, "§fEnchanted", serverTeamLore_R, Particle.ENCHANTMENT_TABLE, null, location -> location.add(0, 1.1, 0), 0.0F, 0.0F, 0.0F, 0.01)); + SERVERTEAM_PARTICLES.add(new CircleParticle(Material.NOTE_BLOCK, "§eNoten", serverTeamLore_R, Particle.NOTE, null, location -> location.add(0, 2.2, 0), 0.0F, 0.0F, 0.0F, 0.01)); + SERVERTEAM_PARTICLES.add(new CircleParticle(Material.GUARDIAN_SPAWN_EGG, "§bWater§7/§cFire", serverTeamLore_2R, Particle.DRIP_WATER, Particle.DRIP_LAVA, location -> location.add(0, 1.1, 0), 0.0F, 0.0F, 0.0F, 0.01)); + SERVERTEAM_PARTICLES.add(new CircleParticle(Material.DIAMOND_SWORD, "§5Magic§7/§eZauber", serverTeamLore_2R, Particle.CRIT_MAGIC, Particle.ENCHANTMENT_TABLE, location -> location.add(0, 1.1, 0), 0.0F, 0.0F, 0.0F, 0.01)); + SERVERTEAM_PARTICLES.add(new CloudCircleParticle(Material.GLOWSTONE_DUST, "§5Magic", serverTeamLore_CR, Particle.CRIT_MAGIC, location -> location.add(0, 1.1, 0))); + SERVERTEAM_PARTICLES.add(new CloudCircleParticle(Material.FIRE_CORAL, "§cFlammen", serverTeamLore_CR, Particle.FLAME, location -> location.add(0, 1.1, 0))); + SERVERTEAM_PARTICLES.add(new CloudCircleParticle(Material.FIREWORK_ROCKET, "§7Firework", serverTeamLore_CR, Particle.FIREWORKS_SPARK, location -> location.add(0, 1.1, 0))); + SERVERTEAM_PARTICLES.add(new CloudCircleParticle(Material.CYAN_DYE, "§aWater", serverTeamLore_CR, Particle.WATER_WAKE, location -> location.add(0, 1.1, 0))); + + PLAYER_PARTICLES.forEach(specialParticle -> PLAYER_PARTICLES_ENTRIES.add(new SWListInv.SWListEntry<>(specialParticle.getItem(), specialParticle))); + TEAM_PARTICLES.forEach(specialParticle -> TEAM_PARTICLES_ENTRIES.add(new SWListInv.SWListEntry<>(specialParticle.getItem(), specialParticle))); + SERVERTEAM_PARTICLES.forEach(specialParticle -> SERVERTEAM_PARTICLES_ENTRIES.add(new SWListInv.SWListEntry<>(specialParticle.getItem(), specialParticle))); + } + + private static SWInventory createInventory(Player player) { + LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId()); + SteamwarUser steamwarUser = SteamwarUser.get(player.getUniqueId()); + UserGroup userGroup = steamwarUser.getUserGroup(); + + List> particleList; + if (userGroup == UserGroup.Member) { + if (steamwarUser.getTeam() != 0) { + particleList = new ArrayList<>(TEAM_PARTICLES_ENTRIES); + } else { + if (TEAM_PARTICLES.contains(lobbyPlayer.getParticle())) { + lobbyPlayer.setParticle(null); + } + particleList = new ArrayList<>(PLAYER_PARTICLES_ENTRIES); + } + } else { + particleList = new ArrayList<>(SERVERTEAM_PARTICLES_ENTRIES); + } + + Set events = steamwarUser.getTeam() == 0 ? new HashSet<>() : TeamTeilnahme.getEvents(steamwarUser.getTeam()).stream().map(Event::getEventID).collect(Collectors.toSet()); + for (EventParticle eventParticle : EventParticle.eventParticles) { + boolean clickablePlacement = userGroup.isTeamGroup(); + clickablePlacement |= (steamwarUser.getTeam() != 0 && contains(eventParticle.placementTeams, steamwarUser.getTeam())); + if (clickablePlacement) { + particleList.add(new SWListInv.SWListEntry<>(eventParticle.placementParticle.getItem(), eventParticle.placementParticle)); + } else { + SWItem swItem = eventParticle.placementParticle.getItem(); + swItem.setName(swItem.getItemMeta().getDisplayName() + " §8- §c§lGesperrt"); + particleList.add(new SWListInv.SWListEntry<>(swItem, null)); + } + + if (eventParticle.placementTeams.length != 0 && (userGroup.isTeamGroup() || events.contains(eventParticle.event))) { + particleList.add(new SWListInv.SWListEntry<>(eventParticle.participationParticles.getItem(), eventParticle.participationParticles)); + } else { + SWItem swItem = eventParticle.participationParticles.getItem(); + swItem.setName(swItem.getItemMeta().getDisplayName() + " §8- §c§lGesperrt"); + particleList.add(new SWListInv.SWListEntry<>(swItem, null)); + } + } + + SWListInv particleSWListInv = new SWListInv<>(player, "§6Partikel", false, particleList, (clickType, particle) -> { + if (particle == null) return; + lobbyPlayer.setParticle(particle); + }); + particleSWListInv.setItem(49, Material.BARRIER, "§8Keine Partikel", new ArrayList<>(), false, clickType -> { + lobbyPlayer.setParticle(null); + }); + + return particleSWListInv; + } + + private static boolean contains(int[] ints, int element) { + for (int i : ints) { + if (i == element) return true; + } + return false; + } + + public static void openParticleInventory(Player player) { + createInventory(player).open(); + } + + public static List loreBuilder(String[] attribute, String unlocked) { + List lore = new ArrayList<>(); + lore.add(""); + if (attribute != null && attribute.length > 0) { + lore.add("§eAttribute§7:"); + for (String s : attribute) { + lore.add("§7- §f" + s); + } + lore.add(""); + } + if (unlocked != null) { + lore.add("§eFreigeschaltet durch"); + lore.add("§f" + unlocked); + lore.add(""); + } + lore.add("§eKlicken zum auswählen"); + return lore; + } + +} + diff --git a/src/de/steamwar/lobby/listener/Join.java b/src/de/steamwar/lobby/listener/PlayerConnection.java similarity index 54% rename from src/de/steamwar/lobby/listener/Join.java rename to src/de/steamwar/lobby/listener/PlayerConnection.java index 225f14b..1026d69 100644 --- a/src/de/steamwar/lobby/listener/Join.java +++ b/src/de/steamwar/lobby/listener/PlayerConnection.java @@ -21,13 +21,20 @@ package de.steamwar.lobby.listener; import de.steamwar.comms.packets.ImALobbyPacket; import de.steamwar.lobby.LobbySystem; +import de.steamwar.lobby.inventories.LobbyInventory; +import de.steamwar.lobby.util.LobbyPlayer; import org.bukkit.Bukkit; import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.entity.EnderPearl; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerKickEvent; +import org.bukkit.event.player.PlayerQuitEvent; -public class Join extends BasicListener { +public class PlayerConnection extends BasicListener { @EventHandler public void onJoin(PlayerJoinEvent e) { @@ -36,6 +43,28 @@ public class Join extends BasicListener { player.setGameMode(GameMode.ADVENTURE); player.setWalkSpeed(0.5f); + LobbyPlayer.getLobbyPlayer(player.getUniqueId()); //initialisiert einen neuen LP falls nicht vorhanden + + //TODO: Config + player.teleport(new Location(Bukkit.getWorlds().get(0), 0, 60, 0, 0, 0)); + + player.getInventory().clear(); + LobbyInventory.givePlayerLobbyItems(player); + player.setGameMode(GameMode.ADVENTURE); + player.setHealth(20); + player.setFoodLevel(20); + Bukkit.getScheduler().runTaskLater(LobbySystem.getPlugin(), () -> new ImALobbyPacket().send(player), 20); } + + @EventHandler(priority = EventPriority.HIGH) + public void handlePlayerQuit(PlayerQuitEvent event) { + event.setQuitMessage(null); + } + + @EventHandler + public void handlePlayerKick(PlayerKickEvent event) { + if(event.getReason().equals("Flying is not enabled on this server") && event.getPlayer().getVehicle() instanceof EnderPearl) + event.setCancelled(true); + } } diff --git a/src/de/steamwar/lobby/listener/features/DoubleJumpListener.java b/src/de/steamwar/lobby/listener/features/DoubleJumpListener.java new file mode 100644 index 0000000..b929b22 --- /dev/null +++ b/src/de/steamwar/lobby/listener/features/DoubleJumpListener.java @@ -0,0 +1,62 @@ +package de.steamwar.lobby.listener.features; + +import de.steamwar.lobby.listener.BasicListener; +import de.steamwar.lobby.util.LobbyPlayer; +import org.bukkit.GameMode; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerToggleFlightEvent; +import org.bukkit.util.Vector; + +public class DoubleJumpListener extends BasicListener { + + double multiplyer = 1.4; + + @EventHandler + public void handlePlayerJoin(PlayerJoinEvent event) { + Player player = event.getPlayer(); + player.setAllowFlight(true); + player.setFlying(false); + } + + @EventHandler + public void handlePlayerToggleFlight(PlayerToggleFlightEvent event) { + Player player = event.getPlayer(); + if (player.getGameMode() != GameMode.ADVENTURE && player.getGameMode() != GameMode.SURVIVAL) { + return; + } + if (LobbyPlayer.getLobbyPlayer(player).isFlying()) { + return; + } + + event.setCancelled(true); + player.setAllowFlight(false); + player.setFlying(false); + + Vector direction = player.getLocation().getDirection(); + direction.setX(direction.getX() * multiplyer); + direction.setY(direction.getY() * (multiplyer / 2)); + direction.setZ(direction.getZ() * multiplyer); + + player.setVelocity(direction.add(new Vector(0, 1.2, 0))); + player.playSound(player.getLocation(), Sound.ENTITY_FIREWORK_ROCKET_LAUNCH, 1.0F, 1.0F); + } + + @EventHandler + public void handlePlayerMove(PlayerMoveEvent event) { + Player player = event.getPlayer(); + + if(player.getLocation().add(0, -1, 0).getBlock().getType() == Material.AIR) return; + if (LobbyPlayer.getLobbyPlayer(player).isFlying()) return; + + player.setAllowFlight(true); + if (player.getGameMode() == GameMode.ADVENTURE || player.getGameMode() == GameMode.SURVIVAL) { + player.setFlying(false); + } + } + +} diff --git a/src/de/steamwar/lobby/listener/features/EnderpearlListener.java b/src/de/steamwar/lobby/listener/features/EnderpearlListener.java new file mode 100644 index 0000000..49f885d --- /dev/null +++ b/src/de/steamwar/lobby/listener/features/EnderpearlListener.java @@ -0,0 +1,64 @@ +package de.steamwar.lobby.listener.features; + +import de.steamwar.lobby.LobbySystem; +import de.steamwar.lobby.inventories.LobbyInventory; +import de.steamwar.lobby.listener.BasicListener; +import de.steamwar.lobby.util.LobbyPlayer; +import org.bukkit.Bukkit; +import org.bukkit.Sound; +import org.bukkit.entity.EnderPearl; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerTeleportEvent; +import org.bukkit.event.vehicle.VehicleExitEvent; + +public class EnderpearlListener extends BasicListener { + + @EventHandler(priority = EventPriority.NORMAL) + public void handlePlayerInteract(PlayerInteractEvent event) { + if(event.getMaterial() != LobbyInventory.ENDERPEARL_READY) return; + Action action = event.getAction(); + if(action != Action.RIGHT_CLICK_AIR && action != Action.RIGHT_CLICK_BLOCK) return; + + event.setCancelled(true); + + Player player = event.getPlayer(); + LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId()); + lobbyPlayer.setEnderPearlUsed(true); + + EnderPearl enderPearl = player.launchProjectile(EnderPearl.class); + enderPearl.setPassenger(player); + + LobbyInventory.givePlayerLobbyItems(player); + + Bukkit.getScheduler().runTaskLater(LobbySystem.getPlugin(), () -> { + lobbyPlayer.setEnderPearlUsed(false); + + if(player == null) //in case of player leave + return; + LobbyInventory.givePlayerLobbyItems(player); + }, 20 * 3); + } + + @EventHandler + public void handleVehicleExit(VehicleExitEvent event) { + if(!(event.getExited() instanceof Player)) + return; + Player player = (Player) event.getExited(); + LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId()); + + lobbyPlayer.setEnderPearlUsed(false); + LobbyInventory.givePlayerLobbyItems(player); + player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1.0F, 0.5F); + } + + @EventHandler(priority = EventPriority.NORMAL) + public void handlePlayerTeleport(PlayerTeleportEvent event) { + if(event.getCause() != PlayerTeleportEvent.TeleportCause.ENDER_PEARL) return; + if(event.getPlayer().isInsideVehicle()) return; + event.setCancelled(true); + } +} diff --git a/src/de/steamwar/lobby/listener/features/ParticleListener.java b/src/de/steamwar/lobby/listener/features/ParticleListener.java new file mode 100644 index 0000000..48a5bb3 --- /dev/null +++ b/src/de/steamwar/lobby/listener/features/ParticleListener.java @@ -0,0 +1,46 @@ +package de.steamwar.lobby.listener.features; + +import de.steamwar.lobby.LobbySystem; +import de.steamwar.lobby.inventories.LobbyInventory; +import de.steamwar.lobby.inventories.ParticleInventory; +import de.steamwar.lobby.listener.BasicListener; +import de.steamwar.lobby.particle.SpecialParticle; +import de.steamwar.lobby.util.LobbyPlayer; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerMoveEvent; + +public class ParticleListener extends BasicListener { + + private static double deg = 0; + + public ParticleListener() { + Bukkit.getScheduler().runTaskTimer(LobbySystem.getPlugin(), () -> { + deg += 0.1; + if (deg > 360) deg = 0; + }, 0, 1); + } + + @EventHandler(priority = EventPriority.NORMAL) + public void handlePlayerInteract(PlayerInteractEvent event) { + Player player = event.getPlayer(); + if (event.getMaterial() != LobbyInventory.PARTICLE) return; + + ParticleInventory.openParticleInventory(player); + } + + @EventHandler + public void handlePlayerMove(PlayerMoveEvent event) { + Player player = event.getPlayer(); + LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId()); + SpecialParticle particle = lobbyPlayer.getParticle(); + + if (particle == null) return; + particle.execute(player.getWorld(), player, deg); + } + + +} diff --git a/src/de/steamwar/lobby/listener/features/PlayerInventoryListener.java b/src/de/steamwar/lobby/listener/features/PlayerInventoryListener.java new file mode 100644 index 0000000..45e8c75 --- /dev/null +++ b/src/de/steamwar/lobby/listener/features/PlayerInventoryListener.java @@ -0,0 +1,33 @@ +package de.steamwar.lobby.listener.features; + +import de.steamwar.lobby.listener.BasicListener; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.event.player.PlayerSwapHandItemsEvent; + +public class PlayerInventoryListener extends BasicListener { + + @EventHandler + public void handlePlayerDropItem(PlayerDropItemEvent event) { + event.setCancelled(true); + } + + @EventHandler + public void handlePlayerPickupItem(PlayerPickupItemEvent event) { + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void handleInventoryClick(InventoryClickEvent event) { + event.setCancelled(true); + } + + @EventHandler + public void handlePlayerSwapHandItemsEvent(PlayerSwapHandItemsEvent event) { + event.setCancelled(true); + } + +} diff --git a/src/de/steamwar/lobby/listener/features/PlayerSeatListener.java b/src/de/steamwar/lobby/listener/features/PlayerSeatListener.java new file mode 100644 index 0000000..421ebf1 --- /dev/null +++ b/src/de/steamwar/lobby/listener/features/PlayerSeatListener.java @@ -0,0 +1,113 @@ +package de.steamwar.lobby.listener.features; + +import de.steamwar.lobby.listener.BasicListener; +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.data.Bisected; +import org.bukkit.block.data.type.Stairs; +import org.bukkit.entity.AbstractArrow; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.EntityType; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.spigotmc.event.entity.EntityDismountEvent; + +import java.util.HashSet; +import java.util.Objects; +import java.util.Set; + +public class PlayerSeatListener extends BasicListener { + + private static class SeatLocation { + + private int x; + private int y; + private int z; + + public SeatLocation(int x, int y, int z) { + this.x = x; + this.y = y; + this.z = z; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof SeatLocation)) return false; + SeatLocation that = (SeatLocation) o; + return x == that.x && + y == that.y && + z == that.z; + } + + @Override + public int hashCode() { + return Objects.hash(x, y, z); + } + + } + + private Set seats = new HashSet<>(); + + @EventHandler + public void onPlayerInteract(PlayerInteractEvent event) { + if (event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; + + if (!event.getClickedBlock().getType().name().toLowerCase().contains("stairs")) + return; + + if (event.getPlayer().getGameMode() != GameMode.ADVENTURE && event.getPlayer().getGameMode() != GameMode.SURVIVAL) + return; + + if (((Stairs) event.getClickedBlock().getBlockData()).getHalf() != Bisected.Half.BOTTOM) + return; + + if (((Stairs) event.getClickedBlock().getBlockData()).getShape() != Stairs.Shape.STRAIGHT) + return; + + if (event.getPlayer().isInsideVehicle()) + event.getPlayer().getVehicle().remove(); + + if (event.getClickedBlock().getRelative(0, 1, 0).getType() != Material.AIR) + return; + + Location location = event.getClickedBlock().getLocation(); + SeatLocation seatLocation = getSeatLocation(location); + if (seats.contains(seatLocation)) + return; + seats.add(seatLocation); + + Arrow arrow = (Arrow) event.getPlayer().getWorld().spawnEntity(location.add(0.5, 0, 0.5), EntityType.ARROW); + arrow.setGravity(false); + arrow.setPickupStatus(AbstractArrow.PickupStatus.DISALLOWED); + arrow.addPassenger(event.getPlayer()); + arrow.setPersistent(true); + } + + @EventHandler + public void onEntityDismount(EntityDismountEvent event) { + seats.remove(getSeatLocation(event.getDismounted().getLocation())); + + if (event.getEntityType() != EntityType.PLAYER) + return; + + event.getDismounted().remove(); + } + + @EventHandler + public void onPlayerQuit(PlayerQuitEvent event) { + if (event.getPlayer().isInsideVehicle()) + event.getPlayer().getVehicle().remove(); + } + + public SeatLocation getSeatLocation(Location location) { + return new SeatLocation(location.getBlockX(), location.getBlockY(), location.getBlockZ()); + } + +} + diff --git a/src/de/steamwar/lobby/listener/features/PlayerWorldInteractionListener.java b/src/de/steamwar/lobby/listener/features/PlayerWorldInteractionListener.java new file mode 100644 index 0000000..bd15fb2 --- /dev/null +++ b/src/de/steamwar/lobby/listener/features/PlayerWorldInteractionListener.java @@ -0,0 +1,40 @@ +package de.steamwar.lobby.listener.features; + +import de.steamwar.lobby.listener.BasicListener; +import org.bukkit.entity.EntityType; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.FoodLevelChangeEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerTeleportEvent; + +public class PlayerWorldInteractionListener extends BasicListener { + + @EventHandler(priority = EventPriority.LOW) + public void handlePlayerInteract(PlayerInteractEvent event) { + event.setCancelled(true); + } + + @EventHandler + public void handleEntityDamage(EntityDamageEvent event) { + if(event.getEntityType() != EntityType.PLAYER) return; + event.setCancelled(true); + } + + @EventHandler + public void handleFoodLevelChange(FoodLevelChangeEvent event) { + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOW) + public void handlePlayerTeleport(PlayerTeleportEvent event) { + PlayerTeleportEvent.TeleportCause cause = event.getCause(); + if (cause == PlayerTeleportEvent.TeleportCause.END_GATEWAY || + cause == PlayerTeleportEvent.TeleportCause.END_PORTAL || + cause == PlayerTeleportEvent.TeleportCause.NETHER_PORTAL) + event.setCancelled(true); + } + +} + diff --git a/src/de/steamwar/lobby/particle/CircleParticle.java b/src/de/steamwar/lobby/particle/CircleParticle.java new file mode 100644 index 0000000..1c76092 --- /dev/null +++ b/src/de/steamwar/lobby/particle/CircleParticle.java @@ -0,0 +1,87 @@ +/* + * + * This file is a part of the SteamWar software. + * + * Copyright (C) 2020 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.lobby.particle; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Particle; +import org.bukkit.World; +import org.bukkit.entity.Player; +import org.bukkit.util.Vector; + +import java.util.List; +import java.util.function.Function; +import java.util.function.UnaryOperator; + +public class CircleParticle extends SpecialParticle { + + private Particle particle; + private Particle particle2; + private Function locationShift; + private boolean customVelocity = false; + private float vx; + private float vy; + private float vz; + private double time = 1; + + public CircleParticle(Material material, String name, List lore, Particle particle, Particle particle2, UnaryOperator locationShift) { + super(material, name, lore); + this.particle = particle; + this.particle2 = particle2; + this.locationShift = locationShift; + } + + public CircleParticle(Material material, String name, List lore, Particle particle, Particle particle2, UnaryOperator locationShift, float vx, float vy, float vz, double time) { + super(material, name, lore); + this.particle = particle; + this.particle2 = particle2; + this.locationShift = locationShift; + customVelocity = true; + this.vx = vx; + this.vy = vy; + this.vz = vz; + this.time = time; + } + + @Override + public void particle(World world, Player player, double deg) { + Vector vector = new Vector(1, 0, 0); + vector.rotateAroundY(deg); + if (customVelocity) { + world.spawnParticle(particle, locationShift.apply(player.getLocation().add(vector)), 1, vx, vy, vz, time); + } else { + world.spawnParticle(particle, locationShift.apply(player.getLocation().add(vector)), 1); + } + + if (particle2 == null) { + return; + } + + vector.setX(-vector.getX()); + vector.setZ(-vector.getZ()); + if (customVelocity) { + world.spawnParticle(particle2, locationShift.apply(player.getLocation().add(vector)), 1, vx, vy, vz, time); + } else { + world.spawnParticle(particle2, locationShift.apply(player.getLocation().add(vector)), 1); + } + } + +} diff --git a/src/de/steamwar/lobby/particle/CloudCircleParticle.java b/src/de/steamwar/lobby/particle/CloudCircleParticle.java new file mode 100644 index 0000000..80f9ed7 --- /dev/null +++ b/src/de/steamwar/lobby/particle/CloudCircleParticle.java @@ -0,0 +1,44 @@ +/* + * + * This file is a part of the SteamWar software. + * + * Copyright (C) 2020 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.lobby.particle; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Particle; +import org.bukkit.World; +import org.bukkit.entity.Player; + +import java.util.List; +import java.util.function.UnaryOperator; + +public class CloudCircleParticle extends CircleParticle { + + public CloudCircleParticle(Material material, String name, List lore, Particle particle, UnaryOperator locationShift) { + super(material, name, lore, particle, null, locationShift, 0.0F, 0.0F, 0.0F, 0.01); + asCloud = true; + } + + @Override + public void particle(World world, Player player, double deg) { + super.particle(world, player, deg); + } + +} diff --git a/src/de/steamwar/lobby/particle/CloudParticle.java b/src/de/steamwar/lobby/particle/CloudParticle.java new file mode 100644 index 0000000..706c071 --- /dev/null +++ b/src/de/steamwar/lobby/particle/CloudParticle.java @@ -0,0 +1,44 @@ +/* + * + * This file is a part of the SteamWar software. + * + * Copyright (C) 2020 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.lobby.particle; + +import org.bukkit.Material; +import org.bukkit.Particle; +import org.bukkit.World; +import org.bukkit.entity.Player; + +import java.util.List; + +public class CloudParticle extends SpecialParticle { + + private Particle particle; + + public CloudParticle(Material material, String name, List lore, Particle particle) { + super(material, name, lore); + asCloud = true; + this.particle = particle; + } + + @Override + public void particle(World world, Player player, double deg) { + world.spawnParticle(particle, player.getLocation().subtract(0, -0.2, 0), 5, 0.5F, 0.02F, 0.5F, 0.01); + } +} diff --git a/src/de/steamwar/lobby/particle/FunctionalParticle.java b/src/de/steamwar/lobby/particle/FunctionalParticle.java new file mode 100644 index 0000000..2e11da0 --- /dev/null +++ b/src/de/steamwar/lobby/particle/FunctionalParticle.java @@ -0,0 +1,43 @@ +/* + * + * This file is a part of the SteamWar software. + * + * Copyright (C) 2020 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.lobby.particle; + +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.entity.Player; + +import java.util.List; + +public class FunctionalParticle extends SpecialParticle { + + private ParticleFunction particleFunction; + + public FunctionalParticle(Material material, String name, List lore, ParticleFunction particleFunction) { + super(material, name, lore); + this.particleFunction = particleFunction; + } + + @Override + public void particle(World world, Player player, double deg) { + particleFunction.accept(world, player, deg); + } + +} diff --git a/src/de/steamwar/lobby/particle/ParticleFunction.java b/src/de/steamwar/lobby/particle/ParticleFunction.java new file mode 100644 index 0000000..ab210ec --- /dev/null +++ b/src/de/steamwar/lobby/particle/ParticleFunction.java @@ -0,0 +1,29 @@ +/* + * + * This file is a part of the SteamWar software. + * + * Copyright (C) 2020 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.lobby.particle; + +import org.bukkit.World; +import org.bukkit.entity.Player; + +@FunctionalInterface +public interface ParticleFunction { + void accept(World world, Player player, double time); +} diff --git a/src/de/steamwar/lobby/particle/SimpleParticle.java b/src/de/steamwar/lobby/particle/SimpleParticle.java new file mode 100644 index 0000000..52c0b1d --- /dev/null +++ b/src/de/steamwar/lobby/particle/SimpleParticle.java @@ -0,0 +1,62 @@ +/* + * + * This file is a part of the SteamWar software. + * + * Copyright (C) 2020 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.lobby.particle; + +import org.bukkit.*; +import org.bukkit.entity.Player; + +import java.util.List; + +public class SimpleParticle extends SpecialParticle { + + private Particle particle; + private boolean customVelocity = false; + private float vx; + private float vy; + private float vz; + private double time = 1; + + public SimpleParticle(Material material, String name, List lore, Particle particle) { + super(material, name, lore); + this.particle = particle; + } + + public SimpleParticle(Material material, String name, List lore, Particle particle, float vx, float vy, float vz, double time) { + super(material, name, lore); + this.particle = particle; + customVelocity = true; + this.vx = vx; + this.vy = vy; + this.vz = vz; + this.time = time; + } + + @Override + public void particle(World world, Player player, double deg) { + Location location = player.getLocation().add(0.0, 0.2, 0.0); + if (customVelocity) { + world.spawnParticle(particle, location, 5, vx, vy, vz, time); + } else { + world.spawnParticle(particle, location, 5); + } + } + +} diff --git a/src/de/steamwar/lobby/particle/SpecialParticle.java b/src/de/steamwar/lobby/particle/SpecialParticle.java new file mode 100644 index 0000000..6ba8e21 --- /dev/null +++ b/src/de/steamwar/lobby/particle/SpecialParticle.java @@ -0,0 +1,84 @@ +/* + This file is a part of the SteamWar software. + + Copyright (C) 2020 SteamWar.de-Serverteam + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +*/ + +package de.steamwar.lobby.particle; + +import de.steamwar.inventory.SWItem; +import org.bukkit.Color; +import org.bukkit.Material; +import org.bukkit.Particle; +import org.bukkit.World; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +public abstract class SpecialParticle { + + private static final List EMPTY_LORE = new ArrayList<>(); + private static Random random = new Random(); + + public static Color randomColor() { + return Color.fromRGB(random.nextInt(256), random.nextInt(256), random.nextInt(256)); + } + + public static float randomSize() { + return random.nextFloat() / 2 + 1; + } + + public static Particle.DustOptions getParticleDust() { + return new Particle.DustOptions(randomColor(), randomSize()); + } + + private Material material; + private String name; + private List lore; + protected boolean asCloud = false; + + protected SpecialParticle(Material material, String name, List lore) { + if (lore == null) { + lore = EMPTY_LORE; + } + this.material = material; + this.name = name; + this.lore = lore; + } + + public final SWItem getItem() { + return new SWItem(material, name, lore, false, clickType -> {}); + } + + public final void execute(World world, Player player, double deg) { + if (asCloud) { + if (world.getBlockAt(player.getLocation().subtract(0, 1, 0)).getType() == Material.AIR) { + player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 5, 2, false, false, false)); + } else { + player.removePotionEffect(PotionEffectType.SLOW_FALLING); + return; + } + } + particle(world, player, deg); + } + + public abstract void particle(World world, Player player, double deg); + +} diff --git a/src/de/steamwar/lobby/util/ItemBuilder.java b/src/de/steamwar/lobby/util/ItemBuilder.java new file mode 100644 index 0000000..859bcb5 --- /dev/null +++ b/src/de/steamwar/lobby/util/ItemBuilder.java @@ -0,0 +1,66 @@ +package de.steamwar.lobby.util; + +import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.inventory.ItemFlag; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; + +import java.util.ArrayList; + +public class ItemBuilder { + + private ItemStack item; + private ItemMeta meta; + + public ItemBuilder(Material matrial) { + item = new ItemStack(matrial); + meta = item.getItemMeta(); + } + + + public ItemBuilder(Material matrial, int amount) { + item = new ItemStack(matrial, amount); + meta = item.getItemMeta(); + } + public ItemBuilder(Material matrial, short subid) { + item = new ItemStack(matrial, 1, subid); + meta = item.getItemMeta(); + } + + public ItemBuilder removeAllAtributs() { + meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); + meta.addItemFlags(ItemFlag.HIDE_DESTROYS); + meta.addItemFlags(ItemFlag.HIDE_UNBREAKABLE); + meta.addItemFlags(ItemFlag.HIDE_ENCHANTS); + meta.addItemFlags(ItemFlag.HIDE_PLACED_ON); + meta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS); + return this; + } + + public ItemBuilder setDisplayName(String name) { + meta.setDisplayName(name); + return this; + } + + public ItemBuilder addLore(ArrayList lore) { + meta.setLore(lore); + return this; + } + + public ItemBuilder addEnchantment(Enchantment enchantment, int level) { + meta.addEnchant(enchantment, level, true); + return this; + } + + public ItemStack build() { + item.setItemMeta(meta); + return item; + } + + public ItemBuilder setUnbreakable(boolean unbreakable) { + meta.setUnbreakable(unbreakable); + return this; + } + +} diff --git a/src/de/steamwar/lobby/util/LobbyPlayer.java b/src/de/steamwar/lobby/util/LobbyPlayer.java new file mode 100644 index 0000000..0c8c63a --- /dev/null +++ b/src/de/steamwar/lobby/util/LobbyPlayer.java @@ -0,0 +1,57 @@ +package de.steamwar.lobby.util; + +import de.steamwar.lobby.particle.SpecialParticle; +import org.bukkit.entity.Player; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +public class LobbyPlayer { + + private static Map cache = new HashMap<>(); + + private SpecialParticle specialParticle; + + private boolean enderPearlUsed; + private boolean fly; + + private LobbyPlayer(UUID uuid) { + cache.put(uuid, this); + specialParticle = null; + } + + public boolean isFlying() { + return fly; + } + + public void setFly(boolean fly) { + this.fly = fly; + } + + public SpecialParticle getParticle() { + return specialParticle; + } + + public void setParticle(SpecialParticle specialParticle) { + this.specialParticle = specialParticle; + } + + public boolean isEnderPearlUsed() { + return enderPearlUsed; + } + + public void setEnderPearlUsed(boolean enderPearlUsed) { + this.enderPearlUsed = enderPearlUsed; + } + + public static LobbyPlayer getLobbyPlayer(UUID uuid) { + LobbyPlayer lobbyPlayer = cache.get(uuid); + return lobbyPlayer == null ? new LobbyPlayer(uuid) : lobbyPlayer; + } + + public static LobbyPlayer getLobbyPlayer(Player player) { + return getLobbyPlayer(player.getUniqueId()); + } + +} -- 2.39.5 From ac39697dba3177baa1c35a15e44bf510c5a6f53f Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Sat, 12 Feb 2022 12:10:40 +0100 Subject: [PATCH 02/10] Spawn Config Option should be there now --- src/de/steamwar/lobby/Config.java | 18 ++++++++++++++++++ .../lobby/listener/PlayerConnection.java | 7 ++----- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/de/steamwar/lobby/Config.java b/src/de/steamwar/lobby/Config.java index 15ad255..f3685e5 100644 --- a/src/de/steamwar/lobby/Config.java +++ b/src/de/steamwar/lobby/Config.java @@ -26,6 +26,12 @@ import org.bukkit.configuration.serialization.ConfigurationSerialization; public class Config { + public static double SpawnX = 0; + public static double SpawnY = 0; + public static double SpawnZ = 0; + public static float Pitch = 0; + public static float Yaw = 0; + static { ConfigurationSerialization.registerClass(Portal.class); ConfigurationSerialization.registerClass(Hologram.class); @@ -38,12 +44,24 @@ public class Config { yml.getList("portals", Portal.getPortals()); yml.getList("holograms", Hologram.getHolograms()); + + SpawnX = yml.getDouble("SpawnX"); + SpawnY = yml.getDouble("SpawnY"); + SpawnZ = yml.getDouble("SpawnZ"); + Pitch = (float) yml.getDouble("Pitch"); + Yaw = (float) yml.getDouble("Yaw"); } public void save() { yml.set("portals", Portal.getPortals()); yml.set("holograms", Hologram.getHolograms()); + yml.set("SpawnX", 0); + yml.set("SpawnY", 0); + yml.set("SpawnZ", 0); + yml.set("Pitch", 0); + yml.set("Yaw", 0); + LobbySystem.getPlugin().saveConfig(); } } diff --git a/src/de/steamwar/lobby/listener/PlayerConnection.java b/src/de/steamwar/lobby/listener/PlayerConnection.java index 1026d69..071bf98 100644 --- a/src/de/steamwar/lobby/listener/PlayerConnection.java +++ b/src/de/steamwar/lobby/listener/PlayerConnection.java @@ -20,6 +20,7 @@ package de.steamwar.lobby.listener; import de.steamwar.comms.packets.ImALobbyPacket; +import de.steamwar.lobby.Config; import de.steamwar.lobby.LobbySystem; import de.steamwar.lobby.inventories.LobbyInventory; import de.steamwar.lobby.util.LobbyPlayer; @@ -42,12 +43,8 @@ public class PlayerConnection extends BasicListener { player.setGameMode(GameMode.ADVENTURE); player.setWalkSpeed(0.5f); - LobbyPlayer.getLobbyPlayer(player.getUniqueId()); //initialisiert einen neuen LP falls nicht vorhanden - - //TODO: Config - player.teleport(new Location(Bukkit.getWorlds().get(0), 0, 60, 0, 0, 0)); - + player.teleport(new Location(Bukkit.getWorlds().get(0), Config.SpawnX, Config.SpawnY, Config.SpawnZ, Config.Yaw, Config.Pitch)); player.getInventory().clear(); LobbyInventory.givePlayerLobbyItems(player); player.setGameMode(GameMode.ADVENTURE); -- 2.39.5 From ccefd3ca5ccf107f06dd45934eede21b69a3f181 Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Sat, 12 Feb 2022 12:11:06 +0100 Subject: [PATCH 03/10] Remove Unused --- src/de/steamwar/lobby/inventories/LobbyInventory.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/de/steamwar/lobby/inventories/LobbyInventory.java b/src/de/steamwar/lobby/inventories/LobbyInventory.java index ea9141c..a5a2c96 100644 --- a/src/de/steamwar/lobby/inventories/LobbyInventory.java +++ b/src/de/steamwar/lobby/inventories/LobbyInventory.java @@ -12,7 +12,6 @@ public class LobbyInventory { public static Material PARTICLE = Material.NAME_TAG; public static Material ENDERPEARL_USED = Material.FIREWORK_STAR; public static Material ENDERPEARL_READY = Material.ENDER_PEARL; - public static Material SHIELD = Material.SHIELD; public static void givePlayerLobbyItems(Player player) { LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId()); -- 2.39.5 From 8c24167358b2649fbcf10431e8e06ee8ceacb597 Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Sat, 12 Feb 2022 12:47:55 +0100 Subject: [PATCH 04/10] Dunno if this code works or not --- .../lobby/inventories/LobbyInventory.java | 14 ++-- .../listener/features/ElytraListener.java | 59 +++++++++++++++++ .../listener/features/EnderpearlListener.java | 64 ------------------- src/de/steamwar/lobby/util/LobbyPlayer.java | 15 ++--- 4 files changed, 75 insertions(+), 77 deletions(-) create mode 100644 src/de/steamwar/lobby/listener/features/ElytraListener.java delete mode 100644 src/de/steamwar/lobby/listener/features/EnderpearlListener.java diff --git a/src/de/steamwar/lobby/inventories/LobbyInventory.java b/src/de/steamwar/lobby/inventories/LobbyInventory.java index a5a2c96..08dfb68 100644 --- a/src/de/steamwar/lobby/inventories/LobbyInventory.java +++ b/src/de/steamwar/lobby/inventories/LobbyInventory.java @@ -4,20 +4,25 @@ import de.steamwar.lobby.util.ItemBuilder; import de.steamwar.lobby.util.LobbyPlayer; import org.bukkit.Material; import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; public class LobbyInventory { private LobbyInventory() {} public static Material PARTICLE = Material.NAME_TAG; - public static Material ENDERPEARL_USED = Material.FIREWORK_STAR; - public static Material ENDERPEARL_READY = Material.ENDER_PEARL; + public static Material ELYTRA_USED = Material.FIREWORK_STAR; + public static Material ELYTRA_READY = Material.ELYTRA; public static void givePlayerLobbyItems(Player player) { + + player.getInventory().setChestplate(new ItemStack(Material.AIR)); + player.getInventory().setItem(8, new ItemStack(Material.AIR)); + LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId()); - player.getInventory().setItem(3, new ItemBuilder(lobbyPlayer.isEnderPearlUsed() ? ENDERPEARL_USED : ENDERPEARL_READY) - .setDisplayName("§5Enderperle") + player.getInventory().setItem(3, new ItemBuilder(lobbyPlayer.isFlyingElytra() ? ELYTRA_USED : ELYTRA_READY) + .setDisplayName("§5Elytra") .setUnbreakable(true) .removeAllAtributs() .build()); @@ -27,6 +32,7 @@ public class LobbyInventory { .setUnbreakable(true) .removeAllAtributs() .build()); + } } diff --git a/src/de/steamwar/lobby/listener/features/ElytraListener.java b/src/de/steamwar/lobby/listener/features/ElytraListener.java new file mode 100644 index 0000000..63e56ef --- /dev/null +++ b/src/de/steamwar/lobby/listener/features/ElytraListener.java @@ -0,0 +1,59 @@ +package de.steamwar.lobby.listener.features; + +import de.steamwar.lobby.inventories.LobbyInventory; +import de.steamwar.lobby.listener.BasicListener; +import de.steamwar.lobby.util.ItemBuilder; +import de.steamwar.lobby.util.LobbyPlayer; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityToggleGlideEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; + +public class ElytraListener extends BasicListener { + + @EventHandler(priority = EventPriority.NORMAL) + public void handlePlayerInteract(PlayerInteractEvent event) { + if(event.getMaterial() != LobbyInventory.ELYTRA_READY) return; + Action action = event.getAction(); + if(action != Action.RIGHT_CLICK_AIR && action != Action.RIGHT_CLICK_BLOCK) return; + + event.setCancelled(true); + + Player player = event.getPlayer(); + LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId()); + + player.getInventory().setChestplate(new ItemStack(Material.ELYTRA)); + + LobbyInventory.givePlayerLobbyItems(player); + + lobbyPlayer.setFlyingElytra(true); + + if(event.getItem().equals(new ItemStack(Material.FIREWORK_ROCKET))) { + event.getItem().setAmount(1); + } + } + + @EventHandler(priority = EventPriority.HIGH) + public void onPlayerToggleGlide(EntityToggleGlideEvent event) { + if(!(event.getEntity() instanceof Player)) return; + Player player = (Player) event.getEntity(); + LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId()); + + if(!event.isGliding() && lobbyPlayer.isFlyingElytra()) { + lobbyPlayer.setFlyingElytra(false); + LobbyInventory.givePlayerLobbyItems(player); + } + } + + public void givePlayerFirework(Player player) { + LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId()); + + if(!lobbyPlayer.isFlyingElytra()) return; + + player.getInventory().setItem(8, new ItemBuilder(Material.FIREWORK_ROCKET, 1).setDisplayName("§5Rakete").build()); + } +} diff --git a/src/de/steamwar/lobby/listener/features/EnderpearlListener.java b/src/de/steamwar/lobby/listener/features/EnderpearlListener.java deleted file mode 100644 index 49f885d..0000000 --- a/src/de/steamwar/lobby/listener/features/EnderpearlListener.java +++ /dev/null @@ -1,64 +0,0 @@ -package de.steamwar.lobby.listener.features; - -import de.steamwar.lobby.LobbySystem; -import de.steamwar.lobby.inventories.LobbyInventory; -import de.steamwar.lobby.listener.BasicListener; -import de.steamwar.lobby.util.LobbyPlayer; -import org.bukkit.Bukkit; -import org.bukkit.Sound; -import org.bukkit.entity.EnderPearl; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.block.Action; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerTeleportEvent; -import org.bukkit.event.vehicle.VehicleExitEvent; - -public class EnderpearlListener extends BasicListener { - - @EventHandler(priority = EventPriority.NORMAL) - public void handlePlayerInteract(PlayerInteractEvent event) { - if(event.getMaterial() != LobbyInventory.ENDERPEARL_READY) return; - Action action = event.getAction(); - if(action != Action.RIGHT_CLICK_AIR && action != Action.RIGHT_CLICK_BLOCK) return; - - event.setCancelled(true); - - Player player = event.getPlayer(); - LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId()); - lobbyPlayer.setEnderPearlUsed(true); - - EnderPearl enderPearl = player.launchProjectile(EnderPearl.class); - enderPearl.setPassenger(player); - - LobbyInventory.givePlayerLobbyItems(player); - - Bukkit.getScheduler().runTaskLater(LobbySystem.getPlugin(), () -> { - lobbyPlayer.setEnderPearlUsed(false); - - if(player == null) //in case of player leave - return; - LobbyInventory.givePlayerLobbyItems(player); - }, 20 * 3); - } - - @EventHandler - public void handleVehicleExit(VehicleExitEvent event) { - if(!(event.getExited() instanceof Player)) - return; - Player player = (Player) event.getExited(); - LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId()); - - lobbyPlayer.setEnderPearlUsed(false); - LobbyInventory.givePlayerLobbyItems(player); - player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1.0F, 0.5F); - } - - @EventHandler(priority = EventPriority.NORMAL) - public void handlePlayerTeleport(PlayerTeleportEvent event) { - if(event.getCause() != PlayerTeleportEvent.TeleportCause.ENDER_PEARL) return; - if(event.getPlayer().isInsideVehicle()) return; - event.setCancelled(true); - } -} diff --git a/src/de/steamwar/lobby/util/LobbyPlayer.java b/src/de/steamwar/lobby/util/LobbyPlayer.java index 0c8c63a..31c4b73 100644 --- a/src/de/steamwar/lobby/util/LobbyPlayer.java +++ b/src/de/steamwar/lobby/util/LobbyPlayer.java @@ -1,6 +1,8 @@ package de.steamwar.lobby.util; import de.steamwar.lobby.particle.SpecialParticle; +import lombok.Getter; +import lombok.Setter; import org.bukkit.entity.Player; import java.util.HashMap; @@ -13,7 +15,10 @@ public class LobbyPlayer { private SpecialParticle specialParticle; - private boolean enderPearlUsed; + @Getter + @Setter + private boolean flyingElytra; + private boolean fly; private LobbyPlayer(UUID uuid) { @@ -37,14 +42,6 @@ public class LobbyPlayer { this.specialParticle = specialParticle; } - public boolean isEnderPearlUsed() { - return enderPearlUsed; - } - - public void setEnderPearlUsed(boolean enderPearlUsed) { - this.enderPearlUsed = enderPearlUsed; - } - public static LobbyPlayer getLobbyPlayer(UUID uuid) { LobbyPlayer lobbyPlayer = cache.get(uuid); return lobbyPlayer == null ? new LobbyPlayer(uuid) : lobbyPlayer; -- 2.39.5 From 7bd7bd52c293840468d54a86c3bbbca4c3a0ac17 Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Sun, 13 Feb 2022 12:03:06 +0100 Subject: [PATCH 05/10] Tested Shit, works now + Elytra :D --- src/de/steamwar/lobby/Config.java | 24 ++-- src/de/steamwar/lobby/LobbySystem.java | 15 ++- src/de/steamwar/lobby/command/FlyCommand.java | 8 +- .../lobby/inventories/LobbyInventory.java | 9 +- .../lobby/listener/PlayerConnection.java | 5 +- .../listener/features/ElytraListener.java | 52 ++++---- .../listener/features/PlayerSeatListener.java | 113 ------------------ .../PlayerWorldInteractionListener.java | 18 +++ 8 files changed, 74 insertions(+), 170 deletions(-) delete mode 100644 src/de/steamwar/lobby/listener/features/PlayerSeatListener.java diff --git a/src/de/steamwar/lobby/Config.java b/src/de/steamwar/lobby/Config.java index f3685e5..ab93d86 100644 --- a/src/de/steamwar/lobby/Config.java +++ b/src/de/steamwar/lobby/Config.java @@ -26,15 +26,23 @@ import org.bukkit.configuration.serialization.ConfigurationSerialization; public class Config { - public static double SpawnX = 0; - public static double SpawnY = 0; - public static double SpawnZ = 0; - public static float Pitch = 0; - public static float Yaw = 0; + public static final double SpawnX = 2; + public static final double SpawnY = 63; + public static final double SpawnZ = 2; + public static final float Pitch = 0; + public static final float Yaw = 0; static { ConfigurationSerialization.registerClass(Portal.class); ConfigurationSerialization.registerClass(Hologram.class); + + FileConfiguration yml = LobbySystem.getPlugin().getConfig(); + + /*SpawnX = yml.getDouble("SpawnX"); + SpawnY = yml.getDouble("SpawnY"); + SpawnZ = yml.getDouble("SpawnZ"); + Pitch = (float) yml.getDouble("Pitch"); + Yaw = (float) yml.getDouble("Yaw");*/ } private final FileConfiguration yml; @@ -44,12 +52,6 @@ public class Config { yml.getList("portals", Portal.getPortals()); yml.getList("holograms", Hologram.getHolograms()); - - SpawnX = yml.getDouble("SpawnX"); - SpawnY = yml.getDouble("SpawnY"); - SpawnZ = yml.getDouble("SpawnZ"); - Pitch = (float) yml.getDouble("Pitch"); - Yaw = (float) yml.getDouble("Yaw"); } public void save() { diff --git a/src/de/steamwar/lobby/LobbySystem.java b/src/de/steamwar/lobby/LobbySystem.java index 9839c24..018a84d 100644 --- a/src/de/steamwar/lobby/LobbySystem.java +++ b/src/de/steamwar/lobby/LobbySystem.java @@ -25,7 +25,11 @@ import de.steamwar.lobby.command.PortalCommand; import de.steamwar.lobby.listener.Fightservers; import de.steamwar.lobby.listener.PlayerConnection; import de.steamwar.lobby.listener.Portals; +import de.steamwar.lobby.listener.features.*; import de.steamwar.message.Message; +import org.bukkit.Bukkit; +import org.bukkit.GameRule; +import org.bukkit.World; import org.bukkit.plugin.java.JavaPlugin; public class LobbySystem extends JavaPlugin { @@ -43,7 +47,6 @@ public class LobbySystem extends JavaPlugin { public void onEnable() { message = new Message("de.steamwar.lobby.LobbySystem", getClassLoader()); - new PlayerConnection(); new Fightservers(); new Portals(); new PortalCommand(); @@ -51,6 +54,16 @@ public class LobbySystem extends JavaPlugin { new FlyCommand(); config = new Config(getConfig()); + new PlayerConnection(); + new DoubleJumpListener(); + new ElytraListener(); + new ParticleListener(); + new PlayerInventoryListener(); + new PlayerWorldInteractionListener(); + + World world = Bukkit.getWorlds().get(0); + world.setGameRule(GameRule.ANNOUNCE_ADVANCEMENTS, false); + Bukkit.getOfflinePlayer("zOnlyKroks").setWhitelisted(true); } public static LobbySystem getPlugin() { diff --git a/src/de/steamwar/lobby/command/FlyCommand.java b/src/de/steamwar/lobby/command/FlyCommand.java index fc164ac..1ac3f76 100644 --- a/src/de/steamwar/lobby/command/FlyCommand.java +++ b/src/de/steamwar/lobby/command/FlyCommand.java @@ -4,7 +4,6 @@ import de.steamwar.command.SWCommand; import de.steamwar.lobby.util.LobbyPlayer; import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.UserGroup; -import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; public class FlyCommand extends SWCommand { @@ -13,11 +12,8 @@ public class FlyCommand extends SWCommand { super("fly"); } - @Register("fly") - public void flyCommand(CommandSender sender) { - if (!(sender instanceof Player)) return; - - Player player = (Player) sender; + @Register + public void genericCommand(Player player) { SteamwarUser steamwarUser = SteamwarUser.get(player.getUniqueId()); UserGroup userGroup = steamwarUser.getUserGroup(); diff --git a/src/de/steamwar/lobby/inventories/LobbyInventory.java b/src/de/steamwar/lobby/inventories/LobbyInventory.java index 08dfb68..7d3d735 100644 --- a/src/de/steamwar/lobby/inventories/LobbyInventory.java +++ b/src/de/steamwar/lobby/inventories/LobbyInventory.java @@ -16,9 +16,6 @@ public class LobbyInventory { public static void givePlayerLobbyItems(Player player) { - player.getInventory().setChestplate(new ItemStack(Material.AIR)); - player.getInventory().setItem(8, new ItemStack(Material.AIR)); - LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId()); player.getInventory().setItem(3, new ItemBuilder(lobbyPlayer.isFlyingElytra() ? ELYTRA_USED : ELYTRA_READY) @@ -27,12 +24,16 @@ public class LobbyInventory { .removeAllAtributs() .build()); + if(lobbyPlayer.isFlyingElytra()) { + player.getInventory().setItem(4, + new ItemBuilder(Material.FIREWORK_ROCKET, 1).setDisplayName("§5Rakete").build()); + } + player.getInventory().setItem(5, new ItemBuilder(PARTICLE) .setDisplayName("§6Partikel") .setUnbreakable(true) .removeAllAtributs() .build()); - } } diff --git a/src/de/steamwar/lobby/listener/PlayerConnection.java b/src/de/steamwar/lobby/listener/PlayerConnection.java index 071bf98..0c629cd 100644 --- a/src/de/steamwar/lobby/listener/PlayerConnection.java +++ b/src/de/steamwar/lobby/listener/PlayerConnection.java @@ -37,17 +37,16 @@ import org.bukkit.event.player.PlayerQuitEvent; public class PlayerConnection extends BasicListener { - @EventHandler + @EventHandler(priority = EventPriority.HIGHEST) public void onJoin(PlayerJoinEvent e) { Player player = e.getPlayer(); - + e.setJoinMessage(null); player.setGameMode(GameMode.ADVENTURE); player.setWalkSpeed(0.5f); LobbyPlayer.getLobbyPlayer(player.getUniqueId()); //initialisiert einen neuen LP falls nicht vorhanden player.teleport(new Location(Bukkit.getWorlds().get(0), Config.SpawnX, Config.SpawnY, Config.SpawnZ, Config.Yaw, Config.Pitch)); player.getInventory().clear(); LobbyInventory.givePlayerLobbyItems(player); - player.setGameMode(GameMode.ADVENTURE); player.setHealth(20); player.setFoodLevel(20); diff --git a/src/de/steamwar/lobby/listener/features/ElytraListener.java b/src/de/steamwar/lobby/listener/features/ElytraListener.java index 63e56ef..5f13419 100644 --- a/src/de/steamwar/lobby/listener/features/ElytraListener.java +++ b/src/de/steamwar/lobby/listener/features/ElytraListener.java @@ -4,6 +4,8 @@ import de.steamwar.lobby.inventories.LobbyInventory; import de.steamwar.lobby.listener.BasicListener; import de.steamwar.lobby.util.ItemBuilder; import de.steamwar.lobby.util.LobbyPlayer; +import org.bukkit.Bukkit; +import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -11,49 +13,35 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityToggleGlideEvent; import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.inventory.ItemStack; +import org.bukkit.util.Vector; public class ElytraListener extends BasicListener { - @EventHandler(priority = EventPriority.NORMAL) + @EventHandler(priority = EventPriority.HIGHEST) public void handlePlayerInteract(PlayerInteractEvent event) { - if(event.getMaterial() != LobbyInventory.ELYTRA_READY) return; - Action action = event.getAction(); - if(action != Action.RIGHT_CLICK_AIR && action != Action.RIGHT_CLICK_BLOCK) return; - - event.setCancelled(true); - Player player = event.getPlayer(); - LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId()); + LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player); - player.getInventory().setChestplate(new ItemStack(Material.ELYTRA)); - - LobbyInventory.givePlayerLobbyItems(player); - - lobbyPlayer.setFlyingElytra(true); - - if(event.getItem().equals(new ItemStack(Material.FIREWORK_ROCKET))) { - event.getItem().setAmount(1); - } - } - - @EventHandler(priority = EventPriority.HIGH) - public void onPlayerToggleGlide(EntityToggleGlideEvent event) { - if(!(event.getEntity() instanceof Player)) return; - Player player = (Player) event.getEntity(); - LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId()); - - if(!event.isGliding() && lobbyPlayer.isFlyingElytra()) { - lobbyPlayer.setFlyingElytra(false); + if(!lobbyPlayer.isFlyingElytra()) { + player.getInventory().setChestplate(new ItemStack(Material.ELYTRA)); + player.setGliding(true); + player.teleport(new Location(Bukkit.getWorlds().get(0),player.getLocation().getX(),player.getLocation().getY() + 4, player.getLocation().getZ(), player.getLocation().getYaw(), player.getLocation().getPitch())); + lobbyPlayer.setFlyingElytra(true); LobbyInventory.givePlayerLobbyItems(player); } } - public void givePlayerFirework(Player player) { - LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId()); + @EventHandler + public void onMove(PlayerMoveEvent event) { + Player player = event.getPlayer(); + LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player); - if(!lobbyPlayer.isFlyingElytra()) return; - - player.getInventory().setItem(8, new ItemBuilder(Material.FIREWORK_ROCKET, 1).setDisplayName("§5Rakete").build()); + if(lobbyPlayer.isFlyingElytra() && player.isOnGround()) { + lobbyPlayer.setFlyingElytra(false); + player.getInventory().clear(); + LobbyInventory.givePlayerLobbyItems(player); + } } } diff --git a/src/de/steamwar/lobby/listener/features/PlayerSeatListener.java b/src/de/steamwar/lobby/listener/features/PlayerSeatListener.java deleted file mode 100644 index 421ebf1..0000000 --- a/src/de/steamwar/lobby/listener/features/PlayerSeatListener.java +++ /dev/null @@ -1,113 +0,0 @@ -package de.steamwar.lobby.listener.features; - -import de.steamwar.lobby.listener.BasicListener; -import org.bukkit.GameMode; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.block.data.Bisected; -import org.bukkit.block.data.type.Stairs; -import org.bukkit.entity.AbstractArrow; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.EntityType; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.block.Action; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.spigotmc.event.entity.EntityDismountEvent; - -import java.util.HashSet; -import java.util.Objects; -import java.util.Set; - -public class PlayerSeatListener extends BasicListener { - - private static class SeatLocation { - - private int x; - private int y; - private int z; - - public SeatLocation(int x, int y, int z) { - this.x = x; - this.y = y; - this.z = z; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof SeatLocation)) return false; - SeatLocation that = (SeatLocation) o; - return x == that.x && - y == that.y && - z == that.z; - } - - @Override - public int hashCode() { - return Objects.hash(x, y, z); - } - - } - - private Set seats = new HashSet<>(); - - @EventHandler - public void onPlayerInteract(PlayerInteractEvent event) { - if (event.getAction() != Action.RIGHT_CLICK_BLOCK) - return; - - if (!event.getClickedBlock().getType().name().toLowerCase().contains("stairs")) - return; - - if (event.getPlayer().getGameMode() != GameMode.ADVENTURE && event.getPlayer().getGameMode() != GameMode.SURVIVAL) - return; - - if (((Stairs) event.getClickedBlock().getBlockData()).getHalf() != Bisected.Half.BOTTOM) - return; - - if (((Stairs) event.getClickedBlock().getBlockData()).getShape() != Stairs.Shape.STRAIGHT) - return; - - if (event.getPlayer().isInsideVehicle()) - event.getPlayer().getVehicle().remove(); - - if (event.getClickedBlock().getRelative(0, 1, 0).getType() != Material.AIR) - return; - - Location location = event.getClickedBlock().getLocation(); - SeatLocation seatLocation = getSeatLocation(location); - if (seats.contains(seatLocation)) - return; - seats.add(seatLocation); - - Arrow arrow = (Arrow) event.getPlayer().getWorld().spawnEntity(location.add(0.5, 0, 0.5), EntityType.ARROW); - arrow.setGravity(false); - arrow.setPickupStatus(AbstractArrow.PickupStatus.DISALLOWED); - arrow.addPassenger(event.getPlayer()); - arrow.setPersistent(true); - } - - @EventHandler - public void onEntityDismount(EntityDismountEvent event) { - seats.remove(getSeatLocation(event.getDismounted().getLocation())); - - if (event.getEntityType() != EntityType.PLAYER) - return; - - event.getDismounted().remove(); - } - - @EventHandler - public void onPlayerQuit(PlayerQuitEvent event) { - if (event.getPlayer().isInsideVehicle()) - event.getPlayer().getVehicle().remove(); - } - - public SeatLocation getSeatLocation(Location location) { - return new SeatLocation(location.getBlockX(), location.getBlockY(), location.getBlockZ()); - } - -} - diff --git a/src/de/steamwar/lobby/listener/features/PlayerWorldInteractionListener.java b/src/de/steamwar/lobby/listener/features/PlayerWorldInteractionListener.java index bd15fb2..5fdecde 100644 --- a/src/de/steamwar/lobby/listener/features/PlayerWorldInteractionListener.java +++ b/src/de/steamwar/lobby/listener/features/PlayerWorldInteractionListener.java @@ -1,11 +1,15 @@ package de.steamwar.lobby.listener.features; import de.steamwar.lobby.listener.BasicListener; +import org.bukkit.Material; +import org.bukkit.advancement.Advancement; import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.FoodLevelChangeEvent; +import org.bukkit.event.player.PlayerAdvancementDoneEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerTeleportEvent; @@ -13,6 +17,11 @@ public class PlayerWorldInteractionListener extends BasicListener { @EventHandler(priority = EventPriority.LOW) public void handlePlayerInteract(PlayerInteractEvent event) { + if(event.getItem() == null) return; + if (event.getItem().getType() == Material.FIREWORK_ROCKET) { + event.getItem().setAmount(2); + return; + } event.setCancelled(true); } @@ -36,5 +45,14 @@ public class PlayerWorldInteractionListener extends BasicListener { event.setCancelled(true); } + @EventHandler + public void playerAdvancementEvent(PlayerAdvancementDoneEvent event) { + Player p = event.getPlayer(); + Advancement advancement = event.getAdvancement(); + for(String c: advancement.getCriteria()) { + p.getAdvancementProgress(advancement).revokeCriteria(c); + } + } + } -- 2.39.5 From f5150aa27c15680eaa161ddf14bf847773e4b38e Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Sun, 13 Feb 2022 13:30:05 +0100 Subject: [PATCH 06/10] Border --- src/de/steamwar/lobby/LobbySystem.java | 2 + .../listener/features/ElytraListener.java | 3 ++ .../listener/features/PlayerMoveListener.java | 52 +++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 src/de/steamwar/lobby/listener/features/PlayerMoveListener.java diff --git a/src/de/steamwar/lobby/LobbySystem.java b/src/de/steamwar/lobby/LobbySystem.java index 018a84d..87b8a9f 100644 --- a/src/de/steamwar/lobby/LobbySystem.java +++ b/src/de/steamwar/lobby/LobbySystem.java @@ -60,10 +60,12 @@ public class LobbySystem extends JavaPlugin { new ParticleListener(); new PlayerInventoryListener(); new PlayerWorldInteractionListener(); + new PlayerMoveListener(); World world = Bukkit.getWorlds().get(0); world.setGameRule(GameRule.ANNOUNCE_ADVANCEMENTS, false); Bukkit.getOfflinePlayer("zOnlyKroks").setWhitelisted(true); + Bukkit.getOfflinePlayer("LordMainex").setWhitelisted(true); } public static LobbySystem getPlugin() { diff --git a/src/de/steamwar/lobby/listener/features/ElytraListener.java b/src/de/steamwar/lobby/listener/features/ElytraListener.java index 5f13419..5738024 100644 --- a/src/de/steamwar/lobby/listener/features/ElytraListener.java +++ b/src/de/steamwar/lobby/listener/features/ElytraListener.java @@ -24,10 +24,13 @@ public class ElytraListener extends BasicListener { Player player = event.getPlayer(); LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player); + if (event.getMaterial() != LobbyInventory.ELYTRA_READY) return; + if(!lobbyPlayer.isFlyingElytra()) { player.getInventory().setChestplate(new ItemStack(Material.ELYTRA)); player.setGliding(true); player.teleport(new Location(Bukkit.getWorlds().get(0),player.getLocation().getX(),player.getLocation().getY() + 4, player.getLocation().getZ(), player.getLocation().getYaw(), player.getLocation().getPitch())); + player.setGliding(true); lobbyPlayer.setFlyingElytra(true); LobbyInventory.givePlayerLobbyItems(player); } diff --git a/src/de/steamwar/lobby/listener/features/PlayerMoveListener.java b/src/de/steamwar/lobby/listener/features/PlayerMoveListener.java new file mode 100644 index 0000000..e88e55b --- /dev/null +++ b/src/de/steamwar/lobby/listener/features/PlayerMoveListener.java @@ -0,0 +1,52 @@ +package de.steamwar.lobby.listener.features; + +import de.steamwar.lobby.Config; +import de.steamwar.lobby.listener.BasicListener; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerMoveEvent; + +public class PlayerMoveListener extends BasicListener { + + final BorderData data = new BorderData(); + + @EventHandler + public void onMove(PlayerMoveEvent event) { + Player player = event.getPlayer(); + Location playerLoc = player.getLocation(); + + if(!data.locationIsInRegion(playerLoc)) { + player.teleport(new Location(Bukkit.getWorlds().get(0), Config.SpawnX, Config.SpawnY, Config.SpawnZ, Config.Yaw, Config.Pitch)); + } + } + + public static final class BorderData { + + final World world = Bukkit.getWorlds().get(0); + + final Location loc1 = new Location(world,1337,0,1803); + final Location loc2 = new Location(world,2610,0,1800); + + private double maxX; + private double maxZ; + + private double minX; + private double minZ; + + public BorderData() { + maxX = Math.max(loc1.getX(), loc2.getX()); + maxZ = Math.max(loc1.getZ(), loc2.getZ()); + + minX = Math.min(loc1.getX(), loc2.getX()); + minZ = Math.min(loc1.getZ(), loc2.getZ()); + } + + public boolean locationIsInRegion(Location loc) { + return loc.getX() > minX && loc.getX() < maxX + && loc.getZ() > minZ && loc.getZ() < maxZ; + } + } +} -- 2.39.5 From 426b48e5d5a08e492dd3130f0cf42b441d4733f0 Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Wed, 23 Feb 2022 18:14:39 +0100 Subject: [PATCH 07/10] gitignore weoweo --- .gitignore | 2 ++ .../steamwar/lobby/listener/features/PlayerMoveListener.java | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 760fca2..2313755 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ /.idea /target /lib + +LobbySystem.iml diff --git a/src/de/steamwar/lobby/listener/features/PlayerMoveListener.java b/src/de/steamwar/lobby/listener/features/PlayerMoveListener.java index e88e55b..8272539 100644 --- a/src/de/steamwar/lobby/listener/features/PlayerMoveListener.java +++ b/src/de/steamwar/lobby/listener/features/PlayerMoveListener.java @@ -27,8 +27,8 @@ public class PlayerMoveListener extends BasicListener { final World world = Bukkit.getWorlds().get(0); - final Location loc1 = new Location(world,1337,0,1803); - final Location loc2 = new Location(world,2610,0,1800); + final Location loc1 = new Location(world,200,0,200); + final Location loc2 = new Location(world,-200,0,-200); private double maxX; private double maxZ; -- 2.39.5 From 095e1f86f32d85cd04bb4cef8e82fb962184d068 Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Wed, 23 Feb 2022 18:15:42 +0100 Subject: [PATCH 08/10] =?UTF-8?q?=E2=80=9ELobbySystem.iml=E2=80=9C=20l?= =?UTF-8?q?=C3=B6schen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LobbySystem.iml | 50 ------------------------------------------------- 1 file changed, 50 deletions(-) delete mode 100644 LobbySystem.iml diff --git a/LobbySystem.iml b/LobbySystem.iml deleted file mode 100644 index 97e2b2b..0000000 --- a/LobbySystem.iml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - SPIGOT - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file -- 2.39.5 From 19088250774a07b90441529660040c286e144e3b Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Wed, 23 Feb 2022 18:16:12 +0100 Subject: [PATCH 09/10] Formatting --- .gitignore | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitignore b/.gitignore index 2313755..eb654cd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,4 @@ - /.idea /target /lib - LobbySystem.iml -- 2.39.5 From 8681b3a6eaad6c2e0daa343b93f9f7ae1d7dbec1 Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Wed, 23 Feb 2022 18:23:03 +0100 Subject: [PATCH 10/10] gitignore --- .gitignore | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index eb654cd..56bd360 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,14 @@ -/.idea -/target -/lib -LobbySystem.iml +# Package Files +*.jar + +# Gradle +.gradle +**/build/ +!gradle/wrapper/gradle-wrapper.jar +steamwar.properties + +# IntelliJ IDEA +.idea +*.iml + +# Other -- 2.39.5