diff --git a/src/de/steamwar/lobby/LobbySystem.java b/src/de/steamwar/lobby/LobbySystem.java index 87b8a9f..d237ede 100644 --- a/src/de/steamwar/lobby/LobbySystem.java +++ b/src/de/steamwar/lobby/LobbySystem.java @@ -19,6 +19,7 @@ package de.steamwar.lobby; +import de.steamwar.lobby.command.DebugCommand; import de.steamwar.lobby.command.FlyCommand; import de.steamwar.lobby.command.HologramCommand; import de.steamwar.lobby.command.PortalCommand; @@ -27,9 +28,6 @@ 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 { @@ -52,6 +50,7 @@ public class LobbySystem extends JavaPlugin { new PortalCommand(); new HologramCommand(); new FlyCommand(); + new DebugCommand(); config = new Config(getConfig()); new PlayerConnection(); @@ -61,11 +60,6 @@ public class LobbySystem extends JavaPlugin { 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/command/DebugCommand.java b/src/de/steamwar/lobby/command/DebugCommand.java new file mode 100644 index 0000000..644a5ec --- /dev/null +++ b/src/de/steamwar/lobby/command/DebugCommand.java @@ -0,0 +1,62 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2021 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.command; + +import de.steamwar.command.SWCommand; +import de.steamwar.lobby.LobbySystem; +import de.steamwar.sql.SteamwarUser; +import org.bukkit.Bukkit; +import org.bukkit.GameMode; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerQuitEvent; + +import java.util.HashSet; +import java.util.Set; + +public class DebugCommand extends SWCommand implements Listener { + + private static final Set debugMode = new HashSet<>(); + + public static boolean debugging(Player player) { + return debugMode.contains(player); + } + + public DebugCommand() { + super("debug"); + Bukkit.getPluginManager().registerEvents(this, LobbySystem.getPlugin()); + } + + @Register + public void debug(Player player) { + SteamwarUser user = SteamwarUser.get(player.getUniqueId()); + if(!user.getUserGroup().isTeamGroup()) + return; + + debugMode.add(player); + player.setGameMode(GameMode.CREATIVE); + } + + @EventHandler + public void onLeave(PlayerQuitEvent event) { + debugMode.remove(event.getPlayer()); + } +} diff --git a/src/de/steamwar/lobby/command/FlyCommand.java b/src/de/steamwar/lobby/command/FlyCommand.java index 1ac3f76..fff7bc7 100644 --- a/src/de/steamwar/lobby/command/FlyCommand.java +++ b/src/de/steamwar/lobby/command/FlyCommand.java @@ -1,3 +1,22 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 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.command; import de.steamwar.command.SWCommand; diff --git a/src/de/steamwar/lobby/inventories/EventParticle.java b/src/de/steamwar/lobby/inventories/EventParticle.java index 98fc1c7..bd42f8e 100644 --- a/src/de/steamwar/lobby/inventories/EventParticle.java +++ b/src/de/steamwar/lobby/inventories/EventParticle.java @@ -1,3 +1,22 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 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.inventories; import de.steamwar.lobby.particle.*; diff --git a/src/de/steamwar/lobby/inventories/LobbyInventory.java b/src/de/steamwar/lobby/inventories/LobbyInventory.java index 7d3d735..6080916 100644 --- a/src/de/steamwar/lobby/inventories/LobbyInventory.java +++ b/src/de/steamwar/lobby/inventories/LobbyInventory.java @@ -1,10 +1,28 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 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.inventories; 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 { diff --git a/src/de/steamwar/lobby/inventories/ParticleInventory.java b/src/de/steamwar/lobby/inventories/ParticleInventory.java index 37f1816..dd5d7c4 100644 --- a/src/de/steamwar/lobby/inventories/ParticleInventory.java +++ b/src/de/steamwar/lobby/inventories/ParticleInventory.java @@ -1,3 +1,22 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 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.inventories; import de.steamwar.inventory.SWInventory; diff --git a/src/de/steamwar/lobby/listener/features/DoubleJumpListener.java b/src/de/steamwar/lobby/listener/features/DoubleJumpListener.java index b929b22..3df67e4 100644 --- a/src/de/steamwar/lobby/listener/features/DoubleJumpListener.java +++ b/src/de/steamwar/lobby/listener/features/DoubleJumpListener.java @@ -1,3 +1,22 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 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.listener.features; import de.steamwar.lobby.listener.BasicListener; diff --git a/src/de/steamwar/lobby/listener/features/ElytraListener.java b/src/de/steamwar/lobby/listener/features/ElytraListener.java index 5738024..e13d1f4 100644 --- a/src/de/steamwar/lobby/listener/features/ElytraListener.java +++ b/src/de/steamwar/lobby/listener/features/ElytraListener.java @@ -1,8 +1,26 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 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.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.Bukkit; import org.bukkit.Location; @@ -10,12 +28,9 @@ 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.event.player.PlayerMoveEvent; import org.bukkit.inventory.ItemStack; -import org.bukkit.util.Vector; public class ElytraListener extends BasicListener { diff --git a/src/de/steamwar/lobby/listener/features/ParticleListener.java b/src/de/steamwar/lobby/listener/features/ParticleListener.java index 48a5bb3..4de45e8 100644 --- a/src/de/steamwar/lobby/listener/features/ParticleListener.java +++ b/src/de/steamwar/lobby/listener/features/ParticleListener.java @@ -1,3 +1,22 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 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.listener.features; import de.steamwar.lobby.LobbySystem; diff --git a/src/de/steamwar/lobby/listener/features/PlayerInventoryListener.java b/src/de/steamwar/lobby/listener/features/PlayerInventoryListener.java index 45e8c75..f07d1bf 100644 --- a/src/de/steamwar/lobby/listener/features/PlayerInventoryListener.java +++ b/src/de/steamwar/lobby/listener/features/PlayerInventoryListener.java @@ -1,3 +1,22 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 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.listener.features; import de.steamwar.lobby.listener.BasicListener; diff --git a/src/de/steamwar/lobby/listener/features/PlayerMoveListener.java b/src/de/steamwar/lobby/listener/features/PlayerMoveListener.java index e88e55b..11d2e42 100644 --- a/src/de/steamwar/lobby/listener/features/PlayerMoveListener.java +++ b/src/de/steamwar/lobby/listener/features/PlayerMoveListener.java @@ -1,3 +1,22 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 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.listener.features; import de.steamwar.lobby.Config; @@ -16,7 +35,7 @@ public class PlayerMoveListener extends BasicListener { @EventHandler public void onMove(PlayerMoveEvent event) { Player player = event.getPlayer(); - Location playerLoc = player.getLocation(); + Location playerLoc = event.getTo(); if(!data.locationIsInRegion(playerLoc)) { player.teleport(new Location(Bukkit.getWorlds().get(0), Config.SpawnX, Config.SpawnY, Config.SpawnZ, Config.Yaw, Config.Pitch)); diff --git a/src/de/steamwar/lobby/listener/features/PlayerWorldInteractionListener.java b/src/de/steamwar/lobby/listener/features/PlayerWorldInteractionListener.java index 5fdecde..2b1246a 100644 --- a/src/de/steamwar/lobby/listener/features/PlayerWorldInteractionListener.java +++ b/src/de/steamwar/lobby/listener/features/PlayerWorldInteractionListener.java @@ -1,17 +1,32 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 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.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; public class PlayerWorldInteractionListener extends BasicListener { @@ -35,24 +50,5 @@ public class PlayerWorldInteractionListener extends BasicListener { 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); - } - - @EventHandler - public void playerAdvancementEvent(PlayerAdvancementDoneEvent event) { - Player p = event.getPlayer(); - Advancement advancement = event.getAdvancement(); - for(String c: advancement.getCriteria()) { - p.getAdvancementProgress(advancement).revokeCriteria(c); - } - } - } diff --git a/src/de/steamwar/lobby/util/ItemBuilder.java b/src/de/steamwar/lobby/util/ItemBuilder.java index 859bcb5..e512cde 100644 --- a/src/de/steamwar/lobby/util/ItemBuilder.java +++ b/src/de/steamwar/lobby/util/ItemBuilder.java @@ -1,3 +1,22 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 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.util; import org.bukkit.Material; diff --git a/src/de/steamwar/lobby/util/LobbyPlayer.java b/src/de/steamwar/lobby/util/LobbyPlayer.java index 31c4b73..f20ff34 100644 --- a/src/de/steamwar/lobby/util/LobbyPlayer.java +++ b/src/de/steamwar/lobby/util/LobbyPlayer.java @@ -1,3 +1,22 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 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.util; import de.steamwar.lobby.particle.SpecialParticle;