Archiviert
13
0

completely new lobby system

Dieser Commit ist enthalten in:
Yaruma3341 2020-01-19 16:30:48 +01:00
Ursprung be80e165f1
Commit 43d2aa69f0
39 geänderte Dateien mit 808 neuen und 1341 gelöschten Zeilen

Datei anzeigen

@ -36,8 +36,8 @@
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<configuration> <configuration>
<source>7</source> <source>8</source>
<target>7</target> <target>8</target>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>

Datei anzeigen

@ -1,37 +1,12 @@
Event: Spawn:
Join: X:
allowJoinMessage: false Y:
JoinMessage: '&e%player% &eist dem Server beigetreten!' Z:
allowFirstJoinMessage: false
FirstJoinMessage: '&e%player% &eist neu auf dem Server beigetreten!' Border:
allowQuitMessage: false MinX:
QuitMessage: '&e%player% &ehat den Server verlassen!' MinY:
Messages: MinZ:
Commands: MaxX:
SetLocationMessage: '%prefix% &7Die Positionfür &8[%display%&8] &7wurde gesetzt!' MaxY:
Prefix: '&bLobbySystem &8>> &7' MaxZ:
Items:
Lobby:
Navigator:
ID: 'COMPASS'
Display: '&bNavigator'
Slot: 1
Extras:
ID: 'CHEST'
Display: '&aExtras'
Slot: 5
Lobby-Switcher:
ID: 'NETHER_STAR'
Display: '&eServer Wechseln'
Slot: 9
Hider:
ID: 'BLAZE_ROD'
Display: '&9Spieler Verstecken'
Slot: 2
WorldMaxRadius:
minX:
minY:
minZ:
maxX:
maxY:
maxZ:

Datei anzeigen

@ -1,65 +1,46 @@
package de.steamwar.lobby; package de.steamwar.lobby;
import de.steamwar.lobby.command.buildCommand; import de.steamwar.lobby.commands.FlyCommand;
import de.steamwar.lobby.gadgets.GadgetManager; import de.steamwar.lobby.commands.ShieldCommand;
import de.steamwar.lobby.listener.*; import de.steamwar.lobby.listener.*;
import de.steamwar.lobby.manager.BackendManager; import de.steamwar.lobby.utils.Config;
import de.steamwar.lobby.manager.FileManager;
import de.steamwar.lobby.manager.LocationManager;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
public class LobbySystem extends JavaPlugin { public class LobbySystem extends JavaPlugin {
public static String prefix;
private static LobbySystem instance; private static LobbySystem instance;
private LocationManager locationManager;
private FileManager fileManager;
private BackendManager backendManager;
private GadgetManager gadgetManager;
@Override
public void onLoad() {
instance = this;
}
@Override @Override
public void onEnable() { public void onEnable() {
instance = this;
locationManager = new LocationManager(); if(Config.WorldName == null)
fileManager = new FileManager(instance); shutdown(null);
loadBackend();
prefix = backendManager.prefix;
this.getCommand("build").setExecutor(new buildCommand());
init(); init();
getCommand("fly").setExecutor(new FlyCommand());
getCommand("shield").setExecutor(new ShieldCommand());
} }
public void init() { public void init() {
PluginManager pm = Bukkit.getPluginManager(); PluginManager pm = Bukkit.getPluginManager();
pm.registerEvents(new BlockListener(), instance);
pm.registerEvents(new EntityDamageByEntityEvent(), instance);
pm.registerEvents(new FishEvent(), instance);
pm.registerEvents(new JoinEvent(), instance);
pm.registerEvents(new LobbyInteractListener(), instance);
pm.registerEvents(new LobbyInvClickManager(), instance);
pm.registerEvents(new PlayerKickEvent(), instance);
pm.registerEvents(new PlayerMoveListener(), instance); pm.registerEvents(new PlayerMoveListener(), instance);
pm.registerEvents(new ProjectileLaunchEvent(), instance); pm.registerEvents(new PlayerJoinListener(), instance);
pm.registerEvents(new QuitEvent(), instance); pm.registerEvents(new PlayerInventoryListener(), instance);
pm.registerEvents(new SneakListener(), instance); pm.registerEvents(new PlayerWorldInteractionListener(), instance);
pm.registerEvents(new TeleportEvent(), instance); pm.registerEvents(new DoubleJumpListener(), instance);
pm.registerEvents(new PlayerQuitListener(), instance); pm.registerEvents(new ParticleListener(), instance);
pm.registerEvents(new PlayerHiderListener(), instance);
pm.registerEvents(new EnderPearlListener(), instance);
pm.registerEvents(new ShieldListener(), instance);
} }
public void loadBackend() { public void shutdown(final String reason) {
backendManager = new BackendManager(); Bukkit.getOnlinePlayers().forEach(player -> player.kickPlayer(reason));
backendManager.loadBackend(fileManager); Bukkit.shutdown();
gadgetManager = new GadgetManager();
} }
@ -67,18 +48,4 @@ public class LobbySystem extends JavaPlugin {
return instance; return instance;
} }
public LocationManager getLocationManager() {
return locationManager;
}
public FileManager getFileManager() {
return fileManager;
}
public BackendManager getBackendManager() {
return backendManager;
}
public GadgetManager getGadgetManager() { return gadgetManager; }
} }

Datei anzeigen

@ -1,39 +0,0 @@
package de.steamwar.lobby.command;
import de.steamwar.lobby.LobbySystem;
import de.steamwar.lobby.inventorys.LobbyInventorys;
import de.steamwar.lobby.manager.BackendManager;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class buildCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(!(sender instanceof Player))
return false;
Player player = (Player) sender;
if(player.hasPermission("lobby.build")) {
if(!BackendManager.canBuild.contains(player)) {
BackendManager.canBuild.add(player);
LobbySystem.getInstance().getGadgetManager().removePlayerGadget(player);
LobbySystem.getInstance().getGadgetManager().removePlayerGadgetCooldown(player);
LobbyInventorys.setLobbyItems(player);
player.sendMessage(LobbySystem.prefix + "Du kannst nun auf der Lobby bauen!");
} else {
BackendManager.canBuild.remove(player);
LobbyInventorys.setLobbyItems(player);
player.sendMessage(LobbySystem.prefix + "Du kannst nun auf der Lobby nicht mehr bauen!");
}
} else
player.sendMessage(LobbySystem.prefix + "<EFBFBD>cDu darfst das nicht!");
return false;
}
}

Datei anzeigen

@ -0,0 +1,36 @@
package de.steamwar.lobby.commands;
import de.steamwar.lobby.utils.LobbyPlayer;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserGroup;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class FlyCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(!(sender instanceof Player))
return false;
Player player = (Player) sender;
SteamwarUser steamwarUser = SteamwarUser.get(player.getUniqueId());
UserGroup userGroup = steamwarUser.getUserGroup();
if(userGroup != UserGroup.Developer &&
userGroup != UserGroup.Moderator &&
userGroup != UserGroup.Admin &&
userGroup != UserGroup.Youtuber)
return false;
boolean newFlightState = player.isFlying() ? false : true;
LobbyPlayer.getLobbyPlayer(player.getUniqueId()).setFly(newFlightState);
player.setAllowFlight(newFlightState);
player.setFlying(newFlightState);
player.sendMessage("§7Du kannst jetzt " + (newFlightState ? "§afliegen§7." : "§cnicht §7mehr fliegen."));
return false;
}
}

Datei anzeigen

@ -0,0 +1,35 @@
package de.steamwar.lobby.commands;
import de.steamwar.lobby.utils.LobbyPlayer;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserGroup;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class ShieldCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(!(sender instanceof Player))
return false;
Player player = (Player) sender;
SteamwarUser steamwarUser = SteamwarUser.get(player.getUniqueId());
UserGroup userGroup = steamwarUser.getUserGroup();
if(userGroup != UserGroup.Developer &&
userGroup != UserGroup.Moderator &&
userGroup != UserGroup.Admin &&
userGroup != UserGroup.Youtuber)
return false;
LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId());
boolean newShieldState = lobbyPlayer.isShield() ? false : true;
lobbyPlayer.setShield(newShieldState);
player.sendMessage("§7Dein Schild ist jetzt " + (newShieldState ? "§aan" : "§caus") + "§7.");
return false;
}
}

Datei anzeigen

@ -1,9 +0,0 @@
package de.steamwar.lobby.gadgets;
public enum Gadget {
ENDER_PEARL,
JETPACK,
HOOK,
TNT_CANNON;
}

Datei anzeigen

@ -1,42 +0,0 @@
package de.steamwar.lobby.gadgets;
import org.bukkit.entity.Player;
import java.util.HashMap;
import java.util.Map;
public class GadgetManager {
public Map<Player, Gadget> playerGadgets = new HashMap<>();
public Map<Player, Gadget> playerGadgetCooldown = new HashMap<>();
public Gadget getPlayerGadget(Player player) {
return playerGadgets.get(player);
}
public void setPlayerGadget(Player player, Gadget gadget) {
playerGadgets.put(player, gadget);
}
public void removePlayerGadget(Player player) {
playerGadgets.remove(player);
}
public boolean hasPlayerGadget(Player player) {
return playerGadgets.containsKey(player);
}
public void setPlayerGadgetCooldown(Player player, Gadget gadget) {
playerGadgetCooldown.put(player, gadget);
}
public void removePlayerGadgetCooldown(Player player) {
playerGadgetCooldown.remove(player);
}
public boolean hasPlayerGadgetCooldown(Player player) {
return playerGadgetCooldown.containsKey(player);
}
}

Datei anzeigen

@ -1,99 +0,0 @@
package de.steamwar.lobby.inventorys;
import de.steamwar.lobby.utils.ItemBuilder;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.inventory.Inventory;
public class ExtrasInventorys {
public static Inventory getGadgets() {
Inventory inv = Bukkit.createInventory(null, 45, "§aGadgets");
for(int i = 0; i < inv.getSize(); i++) {
inv.setItem(i, new ItemBuilder(Material.STAINED_GLASS_PANE, (short)15).setDisplayName(" ").build());
}
inv.setItem(0, new ItemBuilder(Material.ENDER_PEARL).setDisplayName("§dEnder Perle").removeAllAtributs().build());
inv.setItem(1, new ItemBuilder(Material.ELYTRA).setDisplayName("§cJetpack").removeAllAtributs().build());
inv.setItem(2, new ItemBuilder(Material.FISHING_ROD).setDisplayName("§eGreifhaken").removeAllAtributs().build());
//inv.setItem(3, new ItemBuilder(Material.getMaterial(417)).setDisplayName("<EFBFBD>cTNT Kanone").addEnchantment(Enchantment.DURABILITY, 1).removeAllAtributs().build());
return inv;
}
public static Inventory getArmorInventory() {
Inventory inv = Bukkit.createInventory(null, 45, "§8Rüstung");
for(int i = 0; i < inv.getSize(); i++) {
inv.setItem(i, new ItemBuilder(Material.STAINED_GLASS_PANE, (short)15).setDisplayName(" ").build());
}
inv.setItem(0, new ItemBuilder(Material.WOOD_HOE).setDisplayName("§0LEDER").removeAllAtributs().build());
inv.setItem(2, new ItemBuilder(Material.STONE_SPADE).setDisplayName("§8KETTE").removeAllAtributs().build());
inv.setItem(4, new ItemBuilder(Material.IRON_PICKAXE).setDisplayName("§7IRON").removeAllAtributs().build());
inv.setItem(6, new ItemBuilder(Material.GOLD_AXE).setDisplayName("§eGOLD").removeAllAtributs().build());
inv.setItem(8, new ItemBuilder(Material.DIAMOND_SWORD).setDisplayName("§bDIAMANT").removeAllAtributs().build());
inv.setItem(9, new ItemBuilder(Material.LEATHER_HELMET).setDisplayName(" ").removeAllAtributs().build());
inv.setItem(18, new ItemBuilder(Material.LEATHER_CHESTPLATE).setDisplayName(" ").removeAllAtributs().build());
inv.setItem(27, new ItemBuilder(Material.LEATHER_LEGGINGS).setDisplayName(" ").removeAllAtributs().build());
inv.setItem(36, new ItemBuilder(Material.LEATHER_BOOTS).setDisplayName(" ").removeAllAtributs().build());
inv.setItem(11, new ItemBuilder(Material.CHAINMAIL_HELMET).setDisplayName(" ").removeAllAtributs().build());
inv.setItem(20, new ItemBuilder(Material.CHAINMAIL_CHESTPLATE).setDisplayName(" ").removeAllAtributs().build());
inv.setItem(29, new ItemBuilder(Material.CHAINMAIL_LEGGINGS).setDisplayName(" ").removeAllAtributs().build());
inv.setItem(38, new ItemBuilder(Material.CHAINMAIL_BOOTS).setDisplayName(" ").removeAllAtributs().build());
inv.setItem(13, new ItemBuilder(Material.IRON_HELMET).setDisplayName(" ").removeAllAtributs().build());
inv.setItem(22, new ItemBuilder(Material.IRON_CHESTPLATE).setDisplayName(" ").removeAllAtributs().build());
inv.setItem(31, new ItemBuilder(Material.IRON_LEGGINGS).setDisplayName(" ").removeAllAtributs().build());
inv.setItem(40, new ItemBuilder(Material.IRON_BOOTS).setDisplayName(" ").removeAllAtributs().build());
inv.setItem(15, new ItemBuilder(Material.GOLD_HELMET).setDisplayName(" ").removeAllAtributs().build());
inv.setItem(24, new ItemBuilder(Material.GOLD_CHESTPLATE).setDisplayName(" ").removeAllAtributs().build());
inv.setItem(33, new ItemBuilder(Material.GOLD_LEGGINGS).setDisplayName(" ").removeAllAtributs().build());
inv.setItem(42, new ItemBuilder(Material.GOLD_BOOTS).setDisplayName(" ").removeAllAtributs().build());
inv.setItem(17, new ItemBuilder(Material.DIAMOND_HELMET).setDisplayName(" ").removeAllAtributs().build());
inv.setItem(26, new ItemBuilder(Material.DIAMOND_CHESTPLATE).setDisplayName(" ").removeAllAtributs().build());
inv.setItem(35, new ItemBuilder(Material.DIAMOND_LEGGINGS).setDisplayName(" ").removeAllAtributs().build());
inv.setItem(44, new ItemBuilder(Material.DIAMOND_BOOTS).setDisplayName(" ").removeAllAtributs().build());
return inv;
}
public static Inventory getPartikel() {
Inventory inv = Bukkit.createInventory(null, 45, "§dPartikel");
for(int i = 0; i < inv.getSize(); i++) {
inv.setItem(i, new ItemBuilder(Material.STAINED_GLASS_PANE, (short)15).setDisplayName(" ").build());
}
//
return inv;
}
public static Inventory getPets() {
Inventory inv = Bukkit.createInventory(null, 45, "<EFBFBD>8<EFBFBD> <20>ePets <20>8<EFBFBD>");
for(int i = 0; i < inv.getSize(); i++) {
inv.setItem(i, new ItemBuilder(Material.STAINED_GLASS_PANE, (short)15).setDisplayName(" ").build());
}
//
return inv;
}
}

Datei anzeigen

@ -0,0 +1,39 @@
package de.steamwar.lobby.inventorys;
import de.steamwar.lobby.utils.ItemBuilder;
import de.steamwar.lobby.utils.LobbyPlayer;
import org.bukkit.Material;
import org.bukkit.entity.Player;
public class LobbyInventory {
public static Material PLAYER_HIDER = Material.BLAZE_ROD;
public static Material PARTIKEL = Material.NAME_TAG;
public static Material ENDERPEARL_USED = Material.FIREWORK_CHARGE;
public static Material ENDERPEARL_READY = Material.ENDER_PEARL;
public static void givePlayerLobbyItems(Player player) {
LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId());
if(lobbyPlayer == null) return;
player.getInventory().setItem(2, new ItemBuilder(PLAYER_HIDER)
.setDisplayName(lobbyPlayer.getHiderState().getName())
.setUnbreakable(true)
.removeAllAtributs()
.build());
player.getInventory().setItem(4, new ItemBuilder(lobbyPlayer.isEnderPearlUsed() ? ENDERPEARL_USED : ENDERPEARL_READY)
.setDisplayName("§5Enderperle")
.setUnbreakable(true)
.removeAllAtributs()
.build());
player.getInventory().setItem(6, new ItemBuilder(PARTIKEL)
.setDisplayName("§6Partikel")
.setUnbreakable(true)
.removeAllAtributs()
.build());
}
}

Datei anzeigen

@ -1,90 +0,0 @@
package de.steamwar.lobby.inventorys;
import de.steamwar.lobby.LobbySystem;
import de.steamwar.lobby.manager.FileManager;
import de.steamwar.lobby.utils.ItemBuilder;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.Inventory;
public class LobbyInventorys {
public static void setLobbyItems(Player player) {
Inventory inv = player.getInventory();
inv.clear();
player.getInventory().setArmorContents(null);
FileManager fm = LobbySystem.getInstance().getFileManager();
//inv.setItem(fm.getIntegerFromConfig("Items.Lobby.Navigator.Slot")-1, new ItemBuilder(Material.valueOf(fm.getStringFromConfig("Items.Lobby.Navigator.ID"))).setDisplayName(fm.getStringFromConfig("Items.Lobby.Navigator.Display").replaceAll("&", "<EFBFBD>")).removeAllAtributs().build());
//inv.setItem(fm.getIntegerFromConfig("Items.Lobby.Extras.Slot")-1, new ItemBuilder(Material.valueOf(fm.getStringFromConfig("Items.Lobby.Extras.ID"))).setDisplayName(fm.getStringFromConfig("Items.Lobby.Extras.Display").replaceAll("&", "§")).removeAllAtributs().build());
//inv.setItem(fm.getIntegerFromConfig("Items.Lobby.Lobby-Switcher.Slot")-1, new ItemBuilder(Material.valueOf(fm.getStringFromConfig("Items.Lobby.Lobby-Switcher.ID"))).setDisplayName(fm.getStringFromConfig("Items.Lobby.Lobby-Switcher.Display").replaceAll("&", "<EFBFBD>")).removeAllAtributs().build());
//inv.setItem(fm.getIntegerFromConfig("Items.Lobby.Hider.Slot")-1, new ItemBuilder(Material.valueOf(fm.getStringFromConfig("Items.Lobby.Hider.ID"))).setDisplayName(fm.getStringFromConfig("Items.Lobby.Hider.Display").replaceAll("&", "§")).removeAllAtributs().build());
}
public static Inventory getNavigatorInventory() {
String name = LobbySystem.getInstance().getFileManager().getStringFromConfig("Items.Lobby.Navigator.Display").replaceAll("&", "<EFBFBD>").split(" ")[0];
Inventory inv = Bukkit.createInventory(null, 45, name);
for(int i = 0; i < inv.getSize(); i++) {
inv.setItem(i, new ItemBuilder(Material.STAINED_GLASS_PANE, (short)15).setDisplayName(" ").build());
}
//inv.setItem(22, new ItemBuilder(Material.MAGMA_CREAM).setDisplayName("<EFBFBD>8<EFBFBD> <20>6Spawn <20>8<EFBFBD>").removeAllAtributs().build());
//inv.setItem(2, new ItemBuilder(Material.ELYTRA).setDisplayName("<EFBFBD>8<EFBFBD> <20>3AirShip <20>8<EFBFBD>").removeAllAtributs().build());
//inv.setItem(6, new ItemBuilder(Material.CHEST).setDisplayName("<EFBFBD>8<EFBFBD> <20>aMiniGames <20>8<EFBFBD>").removeAllAtributs().build());
//inv.setItem(19, new ItemBuilder(Material.TNT).setDisplayName("<EFBFBD>8<EFBFBD> <20>9WarGear <20>8<EFBFBD>").removeAllAtributs().build());
//inv.setItem(25, new ItemBuilder(Material.WOOD_SWORD).setDisplayName("<EFBFBD>8<EFBFBD> <20>2Survival <20>8<EFBFBD>").removeAllAtributs().build());
//inv.setItem(38, new ItemBuilder(Material.EXPLOSIVE_MINECART).setDisplayName("<EFBFBD>8<EFBFBD> <20>bMini WarGear <20>8<EFBFBD>").removeAllAtributs().build());
//inv.setItem(40, new ItemBuilder(Material.GOLD_NUGGET).setDisplayName("<EFBFBD>8<EFBFBD> <20>eT<65>gliche Belohnung <20>8<EFBFBD>").removeAllAtributs().build());
//inv.setItem(42, new ItemBuilder(Material.BOWL).setDisplayName("<EFBFBD>8<EFBFBD> <20>dBattleBox <20>8<EFBFBD>").removeAllAtributs().build());
return inv;
}
public static Inventory ExtrasInventory() {
String name = LobbySystem.getInstance().getFileManager().getStringFromConfig("Items.Lobby.Extras.Display").replaceAll("&", "<EFBFBD>").split(" ")[0];
Inventory inv = Bukkit.createInventory(null, 45, name);
for(int i = 0; i < inv.getSize(); i++) {
inv.setItem(i, new ItemBuilder(Material.STAINED_GLASS_PANE, (short)15).setDisplayName(" ").build());
}
inv.setItem(0, new ItemBuilder(Material.IRON_CHESTPLATE).setDisplayName("§9Rüstung").removeAllAtributs().build());
inv.setItem(9, new ItemBuilder(Material.PISTON_BASE).setDisplayName("§aGadgets").build());
inv.setItem(18, new ItemBuilder(Material.NETHER_STAR).setDisplayName("§dPartikel").build());
inv.setItem(27, new ItemBuilder(Material.BONE).setDisplayName("§ePets").build());
return inv;
}
public static Inventory PlayerHideInventory(Player player) {
String name = "§9Spieler Verstecken";
Inventory inv = Bukkit.createInventory(null, InventoryType.BREWING, name);
inv.setItem(0, new ItemBuilder(Material.INK_SACK, (short)10).setDisplayName("§aAlle Spieler").removeAllAtributs().build());
inv.setItem(1, new ItemBuilder(Material.INK_SACK, (short)5).setDisplayName("§5YouTuber/ Teammitglieder").removeAllAtributs().build());
inv.setItem(2, new ItemBuilder(Material.INK_SACK, (short)8).setDisplayName("§7Keine Spieler").removeAllAtributs().build());
//if(BackendManager.hideAll.contains(player)) inv.setItem(3, new ItemBuilder(Material.INK_SACK, (short)8).setDisplayName("<EFBFBD>8<EFBFBD> <20>7Keine Spieler <20>8<EFBFBD>").removeAllAtributs().build());
//if(BackendManager.hideUsers.contains(player)) inv.setItem(3, new ItemBuilder(Material.INK_SACK, (short)5).setDisplayName("<EFBFBD>7Aktuell <20>8<EFBFBD> <20>5YouTuber/ Teammitglieder <20>8<EFBFBD>").addEnchantment(Enchantment.DURABILITY, 1).removeAllAtributs().build());
//if(!(BackendManager.hideAll.contains(player) && BackendManager.hideUsers.contains(player))) inv.setItem(3, new ItemBuilder(Material.INK_SACK, (short)10).setDisplayName("<EFBFBD>7Aktuell <20>8<EFBFBD> <20>aAlle Spieler").addEnchantment(Enchantment.DURABILITY, 1).removeAllAtributs().build());
inv.setItem(4, new ItemBuilder(Material.TNT).setDisplayName("§cSilentLobby").removeAllAtributs().build());
return inv;
}
}

Datei anzeigen

@ -0,0 +1,65 @@
package de.steamwar.lobby.inventorys;
import de.steamwar.inventory.SWInventory;
import de.steamwar.inventory.SWItem;
import de.steamwar.lobby.utils.LobbyPlayer;
import org.bukkit.Effect;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
public class ParticleInventory {
public static void openParticleInventory(Player player) {
LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId());
if(lobbyPlayer == null) return;
SWInventory swInventory = new SWInventory(player, 9 * 1, "§6Partikel");
List<String> lore = new ArrayList<>();
lore.add("§aKlicken zum Auswählen");
SWItem smoke = new SWItem(Material.WEB, "§7Smoke", lore, false, clickType -> {
lobbyPlayer.setParticle(Effect.SMOKE);
player.closeInventory();
});
SWItem fire = new SWItem(Material.LAVA_BUCKET, "§cFeuer", lore, false, clickType -> {
lobbyPlayer.setParticle(Effect.LAVA_POP);
player.closeInventory();
});
SWItem heart = new SWItem(Material.INK_SACK, (byte) 1, "§cHerzen", lore, false, clickType -> {
lobbyPlayer.setParticle(Effect.HEART);
player.closeInventory();
});
SWItem water = new SWItem(Material.WATER_BUCKET, "§bWasser", lore, false, clickType -> {
lobbyPlayer.setParticle(Effect.WATERDRIP);
player.closeInventory();
});
SWItem note = new SWItem(Material.NOTE_BLOCK, "§eNoten", lore, false, clickType -> {
lobbyPlayer.setParticle(Effect.NOTE);
player.closeInventory();
});
SWItem reset = new SWItem(Material.BARRIER, "§8Keine Partikel", lore, false, clickType -> {
lobbyPlayer.setParticle(null);
player.closeInventory();
});
swInventory.setItem(1, smoke);
swInventory.setItem(2, fire);
swInventory.setItem(3, heart);
swInventory.setItem(4, water);
swInventory.setItem(5, note);
swInventory.setItem(8, reset);
swInventory.open();
}
}

Datei anzeigen

@ -1,48 +0,0 @@
package de.steamwar.lobby.listener;
import de.steamwar.lobby.manager.BackendManager;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.FoodLevelChangeEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.weather.WeatherChangeEvent;
public class BlockListener implements Listener{
@EventHandler
private void onDamage(EntityDamageEvent event) {
if(event.getEntity() instanceof Player)
event.setCancelled(true);
}
@EventHandler
private void onPlayerDropItem(PlayerDropItemEvent event) {
event.setCancelled(true);
}
@EventHandler
private void onFoodChange(FoodLevelChangeEvent event) {
event.setCancelled(true);
}
@EventHandler
private void onBuild(BlockPlaceEvent event) {
if(!BackendManager.canBuild.contains(event.getPlayer())) event.setCancelled(true);
}
@EventHandler
private void onBreak(BlockBreakEvent event) {
if(!BackendManager.canBuild.contains(event.getPlayer())) event.setCancelled(true);
}
@EventHandler
private void onwehthgerChange(WeatherChangeEvent event) {
event.setCancelled(true);
}
}

Datei anzeigen

@ -0,0 +1,58 @@
package de.steamwar.lobby.listener;
import de.steamwar.lobby.utils.LobbyPlayer;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
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 implements Listener {
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(LobbyPlayer.getLobbyPlayer(player.getUniqueId()).isFly())
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_LAUNCH, 1.0F, 1.0F);
}
@EventHandler
public void handlePlayerMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
if(LobbyPlayer.getLobbyPlayer(player.getUniqueId()).isFly())
return;
if(player.getLocation().add(0, -1, 0).getBlock().getType() == Material.AIR)
return;
player.setAllowFlight(true);
player.setFlying(false);
}
}

Datei anzeigen

@ -0,0 +1,65 @@
package de.steamwar.lobby.listener;
import de.steamwar.lobby.LobbySystem;
import de.steamwar.lobby.inventorys.LobbyInventory;
import de.steamwar.lobby.utils.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.Listener;
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 implements Listener {
@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.getInstance(), () -> {
lobbyPlayer.setEnderPearlUsed(false);
if(player == null) //in case of player leave
return;
LobbyInventory.givePlayerLobbyItems(player);
}, 20 * 5);
}
@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;
event.setCancelled(true);
}
}

Datei anzeigen

@ -1,37 +0,0 @@
package de.steamwar.lobby.listener;
import de.steamwar.lobby.LobbySystem;
import de.steamwar.lobby.gadgets.Gadget;
import net.minecraft.server.v1_12_R1.PacketPlayOutExplosion;
import net.minecraft.server.v1_12_R1.Vec3D;
import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.entity.Snowball;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import java.util.Collections;
public class EntityDamageByEntityEvent implements Listener {
@EventHandler
public void handleProjectileHit(org.bukkit.event.entity.EntityDamageByEntityEvent event) {
if(event.getDamager() instanceof Snowball) {
event.setCancelled(true);
if(((Snowball) event.getDamager()).getShooter() instanceof Player) {
Player player = ((Player) ((Snowball) event.getDamager()).getShooter()).getPlayer();
if(LobbySystem.getInstance().getGadgetManager().getPlayerGadget(player) == Gadget.TNT_CANNON) {
for(Player allPlayers : Bukkit.getServer().getOnlinePlayers()) {
((CraftPlayer)allPlayers).getHandle().playerConnection.sendPacket(new PacketPlayOutExplosion(event.getDamager().getLocation().getBlockX(), event.getDamager().getLocation().getBlockY(), event.getDamager().getLocation().getBlockZ(), Float.MAX_VALUE, Collections.EMPTY_LIST, new Vec3D(2.5, 2.5, 2.5)));
}
player.getWorld().playSound(event.getDamager().getLocation(), Sound.ENTITY_ENDERDRAGON_FIREBALL_EXPLODE, 1, 1);
}
}
}
}
}

Datei anzeigen

@ -1,49 +0,0 @@
package de.steamwar.lobby.listener;
import de.steamwar.lobby.LobbySystem;
import de.steamwar.lobby.gadgets.Gadget;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Fish;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerFishEvent;
import org.bukkit.util.Vector;
public class FishEvent implements Listener {
@EventHandler
public void handlePlayerFish(PlayerFishEvent event) {
Player player = event.getPlayer();
if(LobbySystem.getInstance().getGadgetManager().getPlayerGadget(player) == Gadget.HOOK) {
Fish fish = event.getHook();
if(((event.getState().equals(PlayerFishEvent.State.IN_GROUND)) || (event.getState().equals(PlayerFishEvent.State.CAUGHT_ENTITY)) || (event.getState().equals(PlayerFishEvent.State.FAILED_ATTEMPT))) && (Bukkit.getWorld(event.getPlayer().getWorld().getName()).getBlockAt(fish.getLocation().getBlockX(), fish.getLocation().getBlockY() - 1, fish.getLocation().getBlockZ()).getType() != Material.AIR) && (Bukkit.getWorld(event.getPlayer().getWorld().getName()).getBlockAt(fish.getLocation().getBlockX(), fish.getLocation().getBlockY() - 1, fish.getLocation().getBlockZ()).getType() != Material.STATIONARY_WATER)) {
Location location = player.getLocation();
Location to = event.getHook().getLocation();
location.setY(location.getY() + 0.8D);
player.teleport(location);
double t = to.distance(location);
double v_x = (1.0D + 0.07D * t) * (to.getX() - location.getX()) / t;
double v_y = (1.0D + 0.03D * t) * (to.getY() - location.getY()) / t - -0.04D * t;
double v_z = (1.0D + 0.07D * t) * (to.getZ() - location.getZ()) / t;
Vector vector = player.getVelocity();
vector.setX(v_x);
vector.setY(v_y);
vector.setZ(v_z);
player.setVelocity(vector);
player.playSound(player.getLocation(), Sound.ENTITY_ITEM_BREAK, 1.0F, 1.0F);
}
}
}
}

Datei anzeigen

@ -1,50 +0,0 @@
package de.steamwar.lobby.listener;
import de.steamwar.lobby.LobbySystem;
import de.steamwar.lobby.manager.BackendManager;
import de.steamwar.lobby.manager.FileManager;
import de.warking.hunjy.Core;
import de.steamwar.lobby.inventorys.LobbyInventorys;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
public class JoinEvent implements Listener {
public BackendManager backend = LobbySystem.getInstance().getBackendManager();
public FileManager fm = LobbySystem.getInstance().getFileManager();
@EventHandler
private void onJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
if(backend.allowJoinMessage) {
if(backend.allowFisrtJoinMessage) {
if(!player.hasPlayedBefore()) {
event.setJoinMessage(backend.FisrtJoinMessage);
}
}
event.setJoinMessage(backend.JoinMessage.replaceAll("%player%", player.getName()));
}else {
event.setJoinMessage(null);
}
player.teleport(LobbySystem.getInstance().getLocationManager().loadLocation("main.lobby"));
LobbyInventorys.setLobbyItems(player);
player.setGameMode(GameMode.ADVENTURE);
//hider
for(Player workPlayer : BackendManager.hideAll) {
workPlayer.hidePlayer(player);
}
for(Player workPlayer : BackendManager.hideUsers) {
if(Core.getInstance().getPlayerManager(player).getGroupName().equalsIgnoreCase("member"))
workPlayer.hidePlayer(player);
}
}
}

Datei anzeigen

@ -1,75 +0,0 @@
package de.steamwar.lobby.listener;
import de.steamwar.lobby.LobbySystem;
import de.steamwar.lobby.gadgets.Gadget;
import de.steamwar.lobby.manager.FileManager;
import de.steamwar.lobby.utils.ItemBuilder;
import de.steamwar.lobby.inventorys.LobbyInventorys;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.entity.Snowball;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEvent;
public class LobbyInteractListener implements Listener {
// <EFBFBD><EFBFBD>
public FileManager fm = LobbySystem.getInstance().getFileManager();
@EventHandler
private void onInteract(PlayerInteractEvent event) {
if(event.getItem() != null) {
Player player = event.getPlayer();
if(event.getItem().getType() == Material.valueOf(fm.getStringFromConfig("Items.Lobby.Navigator.ID"))) {
player.openInventory(LobbyInventorys.getNavigatorInventory());
event.setCancelled(true);
}else if(event.getItem().getType() == Material.valueOf(fm.getStringFromConfig("Items.Lobby.Hider.ID"))) {
player.openInventory(LobbyInventorys.PlayerHideInventory(player));
event.setCancelled(true);
}else if(event.getItem().getType() == Material.valueOf(fm.getStringFromConfig("Items.Lobby.Extras.ID"))) {
player.openInventory(LobbyInventorys.ExtrasInventory());
event.setCancelled(true);
} else if(event.getItem().getType() == Material.ELYTRA && event.getItem().getItemMeta().getDisplayName().equalsIgnoreCase("§cJetpack")) {
event.setCancelled(true);
} else if(event.getItem().getType() ==Material.getMaterial(417) && event.getItem().getItemMeta().getDisplayName().equalsIgnoreCase("§cTNT Kanone")) {
shootTNTCanon(player);
}
} else
event.setCancelled(true);
}
public void shootTNTCanon(Player player) {
if(LobbySystem.getInstance().getGadgetManager().getPlayerGadget(player) == Gadget.TNT_CANNON && LobbySystem.getInstance().getGadgetManager().hasPlayerGadgetCooldown(player) == false) {
Snowball snowball = player.getWorld().spawn(player.getEyeLocation(), Snowball.class);
snowball.setVelocity(player.getLocation().getDirection().multiply(1.6));
snowball.setShooter(player);
player.getWorld().playSound(player.getLocation(), Sound.ENTITY_IRONGOLEM_ATTACK, 1, 1);
addCooldown(player, Gadget.TNT_CANNON);
player.getInventory().setItem(5, new ItemBuilder(Material.INK_SACK, (short)8).setDisplayName("§6Warten...").removeAllAtributs().build());
player.getItemInHand().getItemMeta().setUnbreakable(true);
}
}
private void addCooldown(final Player player, Gadget gadget) {
LobbySystem.getInstance().getGadgetManager().setPlayerGadgetCooldown(player, gadget);
Bukkit.getScheduler().scheduleSyncDelayedTask(LobbySystem.getInstance(), new Runnable() {
@Override
public void run() {
LobbySystem.getInstance().getGadgetManager().removePlayerGadgetCooldown(player);
if(LobbySystem.getInstance().getGadgetManager().getPlayerGadget(player) == Gadget.TNT_CANNON) player.getInventory().setItem(5, new ItemBuilder(Material.getMaterial(417)).setDisplayName("§cTNT Kanone").addEnchantment(Enchantment.DURABILITY, 1).removeAllAtributs().build());
}
}, 20*10);
}
}

Datei anzeigen

@ -1,278 +0,0 @@
package de.steamwar.lobby.listener;
import java.util.ArrayList;
import de.steamwar.lobby.LobbySystem;
import de.steamwar.lobby.gadgets.Gadget;
import de.steamwar.lobby.manager.BackendManager;
import de.steamwar.lobby.manager.FileManager;
import de.steamwar.lobby.utils.ItemBuilder;
import de.warking.hunjy.Core;
import de.steamwar.lobby.inventorys.ExtrasInventorys;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryType;
public class LobbyInvClickManager implements Listener{
public static ArrayList<Player> inSetup = new ArrayList<Player>();
public FileManager fm = LobbySystem.getInstance().getFileManager();
@EventHandler
private void onInvClick(InventoryClickEvent event) {
Player player = (Player)event.getWhoClicked();
if(!BackendManager.canBuild.contains(player)) {
event.setCancelled(true);
} else {
player.closeInventory();
player.sendMessage(LobbySystem.prefix + "Du kannst im Builder Modus keine Tools nutzen nutzen!");
}
//inSetup
if(inSetup.contains(player)) {
if(event.getCurrentItem() == null || event.getClickedInventory() == null || event.getClickedInventory() == player.getOpenInventory().getBottomInventory())return;
Material mat = event.getCurrentItem().getType();
String name = event.getCurrentItem().getItemMeta().getDisplayName();
String msg = LobbySystem.getInstance().getBackendManager().SetLobbyMessage.replaceAll("%display%", name);
switch (mat) {
case MAGMA_CREAM:
player.closeInventory();
LobbySystem.getInstance().getLocationManager().saveLocation("main.lobby", player.getLocation());
player.sendMessage(msg);
inSetup.remove(player);
break;
case ELYTRA:
player.closeInventory();
LobbySystem.getInstance().getLocationManager().saveLocation("navigation.airship", player.getLocation());
player.sendMessage(msg);
inSetup.remove(player);
break;
case CHEST:
player.closeInventory();
LobbySystem.getInstance().getLocationManager().saveLocation("navigation.minigame", player.getLocation());
player.sendMessage(msg);
inSetup.remove(player);
break;
case TNT:
player.closeInventory();
LobbySystem.getInstance().getLocationManager().saveLocation("navigation.wargear", player.getLocation());
player.sendMessage(msg);
inSetup.remove(player);
break;
case WOOD_SWORD:
player.closeInventory();
LobbySystem.getInstance().getLocationManager().saveLocation("navigation.survival", player.getLocation());
player.sendMessage(msg);
inSetup.remove(player);
break;
case EXPLOSIVE_MINECART:
player.closeInventory();
LobbySystem.getInstance().getLocationManager().saveLocation("navigation.miniwargear", player.getLocation());
player.sendMessage(msg);
inSetup.remove(player);
break;
case GOLD_NUGGET:
player.closeInventory();
LobbySystem.getInstance().getLocationManager().saveLocation("navigation.tb", player.getLocation());
player.sendMessage(msg);
inSetup.remove(player);
break;
case BOWL:
player.closeInventory();
LobbySystem.getInstance().getLocationManager().saveLocation("navigation.battlebox", player.getLocation());
player.sendMessage(msg);
inSetup.remove(player);
break;
default:
break;
}
}else {
if(event.getCurrentItem() == null || event.getClickedInventory() == null || event.getClickedInventory() == player.getOpenInventory().getBottomInventory())return;
Material material = event.getCurrentItem().getType();
String materialName = event.getCurrentItem().getItemMeta().getDisplayName();
//navigator
String navigatorName = fm.getStringFromConfig("Items.Lobby.Navigator.Display").replaceAll("&", "§");
if(event.getClickedInventory().getType() == InventoryType.CHEST && event.getClickedInventory().getName().equals(navigatorName)) {
switch (materialName) {
case "§6Spawn":
player.teleport(LobbySystem.getInstance().getLocationManager().loadLocation("main.lobby"));
break;
case "§3AirShip":
player.teleport(LobbySystem.getInstance().getLocationManager().loadLocation("navigation.airship"));
break;
case "§aMiniGames":
player.teleport(LobbySystem.getInstance().getLocationManager().loadLocation("navigation.minigame"));
break;
case "§9WarGear":
player.teleport(LobbySystem.getInstance().getLocationManager().loadLocation("navigation.wargear"));
break;
case "§2Survival":
player.teleport(LobbySystem.getInstance().getLocationManager().loadLocation("navigation.survival"));
break;
case "§bMini WarGear":
player.teleport(LobbySystem.getInstance().getLocationManager().loadLocation("navigation.miniwargear"));
break;
case "§eTägliche Belohnung":
player.teleport(LobbySystem.getInstance().getLocationManager().loadLocation("navigation.tb"));
break;
}
return;
}
//hide players
String hiderName = fm.getStringFromConfig("Items.Lobby.Hider.Display").replaceAll("&", "§");
if (event.getClickedInventory().getType() == InventoryType.BREWING && event.getClickedInventory().getName().equals(hiderName)) {
switch (materialName) {
case "§aAlle Spieler":
for (Player allPlayers : Bukkit.getServer().getOnlinePlayers()) {
player.showPlayer(allPlayers);
}
if(BackendManager.hideUsers.contains(player)) BackendManager.hideUsers.remove(player);
if(BackendManager.hideAll.contains(player)) BackendManager.hideAll.remove(player);
//event.getInventory().setItem(3, new ItemBuilder(Material.INK_SACK, (short)10).setDisplayName("§7Aktuell §8§ §aAlle Spieler").addEnchantment(Enchantment.DURABILITY, 1).removeAllAtributs().build());
break;
case "§5YouTuber/ Teammitglieder":
for (Player allPlayers : Bukkit.getServer().getOnlinePlayers()) {
if (Core.getInstance().getPlayerManager(allPlayers).getGroupName().equalsIgnoreCase("member")) {
player.hidePlayer(allPlayers);
} else
player.showPlayer(allPlayers);
}
if(BackendManager.hideAll.contains(player)) BackendManager.hideAll.remove(player);
if(!BackendManager.hideUsers.contains(player)) BackendManager.hideUsers.add(player);
//event.getInventory().setItem(3, new ItemBuilder(Material.INK_SACK, (short)5).setDisplayName("§7Aktuell §8§ §5YouTuber/ Teammitglieder §8§").addEnchantment(Enchantment.DURABILITY, 1).removeAllAtributs().build());
break;
case "§7Keine Spieler":
for (Player allPlayers : Bukkit.getServer().getOnlinePlayers()) {
player.hidePlayer(allPlayers);
}
if(!BackendManager.hideAll.contains(player)) BackendManager.hideAll.add(player);
if(BackendManager.hideUsers.contains(player)) BackendManager.hideUsers.remove(player);
//event.getInventory().setItem(3, new ItemBuilder(Material.INK_SACK, (short)8).setDisplayName("§7Aktuell §8§ §7Keine Spieler §8§").addEnchantment(Enchantment.DURABILITY, 1).removeAllAtributs().build());
break;
case "§cSilentLobby":
//change server
break;
}
return;
}
//Extras
String extrasName = fm.getStringFromConfig("Items.Lobby.Extras.Display").replaceAll("&", "§").split(" ")[0];
if (event.getClickedInventory().getType() == InventoryType.CHEST && event.getClickedInventory().getName().equals(extrasName)) {
switch (materialName) {
case "§9Rüstung":
player.openInventory(ExtrasInventorys.getArmorInventory());
break;
case "§aGadgets":
player.openInventory(ExtrasInventorys.getGadgets());
break;
case "§dPartikel":
player.openInventory(ExtrasInventorys.getPartikel());
break;
case "§ePets":
player.openInventory(ExtrasInventorys.getPets());
break;
}
return;
}
if(event.getClickedInventory().getType() == InventoryType.CHEST && event.getClickedInventory().getName().equals("§9Rüstung")) {
switch (materialName) {
case "§0LEDER":
player.getInventory().setHelmet(new ItemBuilder(Material.LEATHER_HELMET).setDisplayName(" ").setUnbreakable(true).removeAllAtributs().build());
player.getInventory().setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).setDisplayName(" ").setUnbreakable(true).removeAllAtributs().build());
player.getInventory().setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).setDisplayName(" ").setUnbreakable(true).removeAllAtributs().build());
player.getInventory().setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setDisplayName(" ").setUnbreakable(true).removeAllAtributs().build());
break;
case "§8KETTE":
player.getInventory().setHelmet(new ItemBuilder(Material.CHAINMAIL_HELMET).setDisplayName(" ").setUnbreakable(true).removeAllAtributs().build());
player.getInventory().setChestplate(new ItemBuilder(Material.CHAINMAIL_CHESTPLATE).setDisplayName(" ").setUnbreakable(true).removeAllAtributs().build());
player.getInventory().setLeggings(new ItemBuilder(Material.CHAINMAIL_LEGGINGS).setDisplayName(" ").setUnbreakable(true).removeAllAtributs().build());
player.getInventory().setBoots(new ItemBuilder(Material.CHAINMAIL_BOOTS).setDisplayName(" ").setUnbreakable(true).removeAllAtributs().build());
break;
case "§7IRON":
player.getInventory().setHelmet(new ItemBuilder(Material.IRON_HELMET).setDisplayName(" ").setUnbreakable(true).removeAllAtributs().build());
player.getInventory().setChestplate(new ItemBuilder(Material.IRON_CHESTPLATE).setDisplayName(" ").setUnbreakable(true).removeAllAtributs().build());
player.getInventory().setLeggings(new ItemBuilder(Material.IRON_LEGGINGS).setDisplayName(" ").setUnbreakable(true).removeAllAtributs().build());
player.getInventory().setBoots(new ItemBuilder(Material.IRON_BOOTS).setDisplayName(" ").setUnbreakable(true).removeAllAtributs().build());
break;
case "§eGOLD":
player.getInventory().setHelmet(new ItemBuilder(Material.GOLD_HELMET).setDisplayName(" ").setUnbreakable(true).removeAllAtributs().build());
player.getInventory().setChestplate(new ItemBuilder(Material.GOLD_CHESTPLATE).setDisplayName(" ").setUnbreakable(true).removeAllAtributs().build());
player.getInventory().setLeggings(new ItemBuilder(Material.GOLD_LEGGINGS).setDisplayName(" ").setUnbreakable(true).removeAllAtributs().build());
player.getInventory().setBoots(new ItemBuilder(Material.GOLD_BOOTS).setDisplayName(" ").setUnbreakable(true).removeAllAtributs().build());
break;
case "§bDIAMANT":
player.getInventory().setHelmet(new ItemBuilder(Material.DIAMOND_HELMET).setDisplayName(" ").setUnbreakable(true).removeAllAtributs().build());
player.getInventory().setChestplate(new ItemBuilder(Material.DIAMOND_CHESTPLATE).setDisplayName(" ").setUnbreakable(true).removeAllAtributs().build());
player.getInventory().setLeggings(new ItemBuilder(Material.DIAMOND_LEGGINGS).setDisplayName(" ").setUnbreakable(true).removeAllAtributs().build());
player.getInventory().setBoots(new ItemBuilder(Material.DIAMOND_BOOTS).setDisplayName(" ").setUnbreakable(true).removeAllAtributs().build());
break;
}
return;
}
//Gadgets
if(event.getClickedInventory().getType() == InventoryType.CHEST && event.getClickedInventory().getName().equals("§8§ §aGadgets §8§")) {
switch (materialName) {
case "§dEnder Perle":
player.getInventory().setItem(5, new ItemBuilder(Material.ENDER_PEARL).setDisplayName("§dEnder Perle").removeAllAtributs().build());
if(LobbySystem.getInstance().getGadgetManager().hasPlayerGadget(player)) LobbySystem.getInstance().getGadgetManager().removePlayerGadget(player);
LobbySystem.getInstance().getGadgetManager().setPlayerGadget(player, Gadget.ENDER_PEARL);
player.playSound(player.getLocation(), Sound.BLOCK_ANVIL_USE, 1, 100);
player.updateInventory();
break;
case "§cJetpack":
player.getInventory().setItem(5, new ItemBuilder(Material.ELYTRA).setDisplayName("§cJetpack").setUnbreakable(true).removeAllAtributs().build());
if(LobbySystem.getInstance().getGadgetManager().hasPlayerGadget(player)) LobbySystem.getInstance().getGadgetManager().removePlayerGadget(player);
LobbySystem.getInstance().getGadgetManager().setPlayerGadget(player, Gadget.JETPACK);
player.playSound(player.getLocation(), Sound.BLOCK_ANVIL_USE, 1, 100);
player.updateInventory();
break;
case "§eGreifhaken":
player.getInventory().setItem(5, new ItemBuilder(Material.FISHING_ROD).setDisplayName("§eGreifhaken").setUnbreakable(true).removeAllAtributs().build());
if(LobbySystem.getInstance().getGadgetManager().hasPlayerGadget(player)) LobbySystem.getInstance().getGadgetManager().removePlayerGadget(player);
LobbySystem.getInstance().getGadgetManager().setPlayerGadget(player, Gadget.HOOK);
player.playSound(player.getLocation(), Sound.BLOCK_ANVIL_USE, 1, 100);
player.updateInventory();
break;
case "§cTNT Kanone":
player.getInventory().setItem(5, new ItemBuilder(Material.getMaterial(417)).setDisplayName("§cTNT Kanone").setUnbreakable(true).addEnchantment(Enchantment.DURABILITY, 1).removeAllAtributs().build());
if(LobbySystem.getInstance().getGadgetManager().hasPlayerGadget(player)) LobbySystem.getInstance().getGadgetManager().removePlayerGadget(player);
LobbySystem.getInstance().getGadgetManager().setPlayerGadget(player, Gadget.TNT_CANNON);
player.playSound(player.getLocation(), Sound.BLOCK_ANVIL_USE, 1, 100);
player.updateInventory();
break;
}
}
}
}
}

Datei anzeigen

@ -0,0 +1,34 @@
package de.steamwar.lobby.listener;
import de.steamwar.lobby.inventorys.LobbyInventory;
import de.steamwar.lobby.inventorys.ParticleInventory;
import de.steamwar.lobby.utils.LobbyPlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerMoveEvent;
public class ParticleListener implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void handlePlayerInteract(PlayerInteractEvent event) {
Player player = event.getPlayer();
if(event.getMaterial() != LobbyInventory.PARTIKEL)
return;
ParticleInventory.openParticleInventory(player);
}
@EventHandler
public void handlePlayerMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId());
if(lobbyPlayer == null || lobbyPlayer.getParticle() == null) return;
player.getWorld().playEffect(player.getLocation().add(0.0D, 0.2D, 0.0D), lobbyPlayer.getParticle(), 5);
}
}

Datei anzeigen

@ -0,0 +1,77 @@
package de.steamwar.lobby.listener;
import de.steamwar.lobby.inventorys.LobbyInventory;
import de.steamwar.lobby.utils.LobbyPlayer;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserGroup;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
public class PlayerHiderListener implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void handlePlayerInteract(PlayerInteractEvent event) {
Material material = event.getMaterial();
if(material != LobbyInventory.PLAYER_HIDER)
return;
Player player = event.getPlayer();
LobbyPlayer.getLobbyPlayer(player.getUniqueId()).nexthHiderState();
updateHider(player);
LobbyInventory.givePlayerLobbyItems(event.getPlayer());
}
@EventHandler
public void handlePlayerJoin(PlayerJoinEvent event) {
updateHider(event.getPlayer());
}
private void updateHider(Player player) {
LobbyPlayer.PlayerHiderState hiderState = LobbyPlayer.getLobbyPlayer(player.getUniqueId()).getHiderState();
Bukkit.getServer().getOnlinePlayers().forEach(currentPlayer -> {
if(currentPlayer.getUniqueId().equals(player.getUniqueId())) return;
switch (hiderState) {
case SHOW_ALL:
player.showPlayer(currentPlayer);
break;
case SHOW_TEAM:
UserGroup userGroup = SteamwarUser.get(currentPlayer.getUniqueId()).getUserGroup();
if(userGroup == UserGroup.Member)
player.hidePlayer(currentPlayer);
else
player.showPlayer(currentPlayer);
break;
case SHOW_NOBODY:
player.hidePlayer(currentPlayer);
break;
}
LobbyPlayer.PlayerHiderState cpHiderState = LobbyPlayer.getLobbyPlayer(currentPlayer.getUniqueId()).getHiderState();
switch (cpHiderState) {
case SHOW_ALL:
currentPlayer.showPlayer(player);
break;
case SHOW_TEAM:
UserGroup userGroup = SteamwarUser.get(player.getUniqueId()).getUserGroup();
if(userGroup == UserGroup.Member)
currentPlayer.hidePlayer(player);
else
currentPlayer.showPlayer(player);
break;
case SHOW_NOBODY:
currentPlayer.hidePlayer(player);
break;
}
});
}
}

Datei anzeigen

@ -0,0 +1,28 @@
package de.steamwar.lobby.listener;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
public class PlayerInventoryListener implements Listener {
@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);
}
}

Datei anzeigen

@ -0,0 +1,31 @@
package de.steamwar.lobby.listener;
import de.steamwar.lobby.inventorys.LobbyInventory;
import de.steamwar.lobby.utils.Config;
import de.steamwar.lobby.utils.LobbyPlayer;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
public class PlayerJoinListener implements Listener {
@EventHandler
public void handlePlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
if(LobbyPlayer.getLobbyPlayer(player.getUniqueId()) == null)
new LobbyPlayer(player.getUniqueId());
player.teleport(new Location(Bukkit.getWorld(Config.WorldName), Config.SpawnX, Config.SpawnY, Config.SpawnZ));
LobbyInventory.givePlayerLobbyItems(player);
player.setGameMode(GameMode.ADVENTURE);
player.setHealth(20);
player.setFoodLevel(20);
}
}

Datei anzeigen

@ -1,26 +0,0 @@
package de.steamwar.lobby.listener;
import de.steamwar.lobby.LobbySystem;
import de.steamwar.lobby.gadgets.Gadget;
import de.steamwar.lobby.manager.BackendManager;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
public class PlayerKickEvent implements Listener {
@EventHandler
public void handlePlayerKick(org.bukkit.event.player.PlayerKickEvent event) {
Player player = event.getPlayer();
if (event.getReason().equals("Flying is not enabled on this server")) {
if(LobbySystem.getInstance().getGadgetManager().getPlayerGadget(player) == Gadget.ENDER_PEARL) event.setCancelled(true);
if(LobbySystem.getInstance().getGadgetManager().getPlayerGadget(player) == Gadget.JETPACK) event.setCancelled(true);
} else {
LobbySystem.getInstance().getGadgetManager().removePlayerGadget(player);
if(BackendManager.canBuild.contains(player)) BackendManager.canBuild.remove(player);
}
}
}

Datei anzeigen

@ -1,42 +1,44 @@
package de.steamwar.lobby.listener; package de.steamwar.lobby.listener;
import de.steamwar.lobby.LobbySystem; import de.steamwar.lobby.utils.Config;
import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.util.Vector;
public class PlayerMoveListener implements Listener { public class PlayerMoveListener implements Listener {
private static Location location = LobbySystem.getInstance().getLocationManager().loadLocation("main.lobby");
private static int minX = LobbySystem.getInstance().getFileManager().getIntegerFromConfig("WorldMaxRadius.minX");
private static int minY = LobbySystem.getInstance().getFileManager().getIntegerFromConfig("WorldMaxRadius.minY");
private static int minZ = LobbySystem.getInstance().getFileManager().getIntegerFromConfig("WorldMaxRadius.minZ");
private static int maxX = LobbySystem.getInstance().getFileManager().getIntegerFromConfig("WorldMaxRadius.maxX");
private static int maxY = LobbySystem.getInstance().getFileManager().getIntegerFromConfig("WorldMaxRadius.maxY");
private static int maxZ = LobbySystem.getInstance().getFileManager().getIntegerFromConfig("WorldMaxRadius.maxZ");
@EventHandler @EventHandler
public void handlePlayerMove(PlayerMoveEvent event) { public void handleWorldBorder(PlayerMoveEvent event) {
Player player = event.getPlayer(); Location to = event.getTo();
if(player.getLocation().getY() < 100) if(!isInRegion(
player.teleport(location); new Vector(Config.BorderMinX, Config.BorderMinY, Config.BorderMinZ),
new Vector(Config.BorderMaxX, Config.BorderMaxY, Config.BorderMaxZ),
Location playerLocation = player.getLocation(); to.toVector()))
int x = playerLocation.getBlockX(); event.getPlayer().teleport(new Location(
int y = playerLocation.getBlockY(); Bukkit.getWorld(Config.WorldName),
int z = playerLocation.getBlockZ(); Config.SpawnX,
Config.SpawnY,
if(x <= minX Config.SpawnZ));
|| x >= maxX
|| y <= minY
|| y >= maxY
|| z <= minZ
|| z >= maxZ)
player.teleport(location);
} }
private boolean isInRegion(Vector minPoint, Vector maxPoint, Vector location) {
int x = location.getBlockX();
int y = location.getBlockY();
int z = location.getBlockZ();
if(x >= minPoint.getBlockX()
&& x <= maxPoint.getBlockX()
&& y >= minPoint.getBlockY()
&& y <= maxPoint.getBlockY()
&& z >= minPoint.getBlockZ()
&& z <= maxPoint.getBlockZ()) {
return true;
} else
return false;
}
} }

Datei anzeigen

@ -1,15 +0,0 @@
package de.steamwar.lobby.listener;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;
public class PlayerQuitListener implements Listener {
@EventHandler
public void handlePlayerQuit(PlayerQuitEvent event) {
event.setQuitMessage("");
}
}

Datei anzeigen

@ -0,0 +1,39 @@
package de.steamwar.lobby.listener;
import org.bukkit.entity.EntityType;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
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 implements Listener {
@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);
}
}

Datei anzeigen

@ -1,56 +0,0 @@
package de.steamwar.lobby.listener;
import de.steamwar.lobby.LobbySystem;
import de.steamwar.lobby.gadgets.Gadget;
import de.steamwar.lobby.utils.ItemBuilder;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.EnderPearl;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.util.Vector;
public class ProjectileLaunchEvent implements Listener {
@EventHandler
public void handleProjectileLaunch(org.bukkit.event.entity.ProjectileLaunchEvent event) {
Entity projectile = event.getEntity();
if(projectile instanceof EnderPearl) {
final EnderPearl enderpearl = (EnderPearl)projectile;
if(enderpearl.getShooter() instanceof Player) {
final Player player = (Player)enderpearl.getShooter();
Vector vec = enderpearl.getVelocity();
vec.multiply(4);
Bukkit.getScheduler().scheduleSyncDelayedTask(LobbySystem.getInstance(), new Runnable() {
@Override
public void run() {
player.getInventory().setItem(5, new ItemBuilder(Material.INK_SACK, (short)8).setDisplayName("<EFBFBD>6Warten...").removeAllAtributs().build());
}
}, 5L);
player.updateInventory();
LobbySystem.getInstance().getGadgetManager().setPlayerGadgetCooldown(player, Gadget.ENDER_PEARL);
Bukkit.getScheduler().runTaskLater(LobbySystem.getInstance(), new Runnable() {
@Override
public void run() {
LobbySystem.getInstance().getGadgetManager().removePlayerGadgetCooldown(player);
if(!LobbySystem.getInstance().getGadgetManager().getPlayerGadget(player).equals(Gadget.ENDER_PEARL)) return;
player.getInventory().setItem(5, new ItemBuilder(Material.ENDER_PEARL).setDisplayName("<EFBFBD>dEnder Perle").removeAllAtributs().build());
}
}, 20*10);
player.setVelocity(vec);
enderpearl.setPassenger(player);
}
}
}
}

Datei anzeigen

@ -1,21 +0,0 @@
package de.steamwar.lobby.listener;
import de.steamwar.lobby.manager.BackendManager;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;
public class QuitEvent implements Listener {
@EventHandler
public void handlePlayerQuit(PlayerQuitEvent event) {
Player player = event.getPlayer();
if(BackendManager.hideAll.contains(player)) BackendManager.hideAll.remove(player);
if(BackendManager.hideUsers.contains(player)) BackendManager.hideUsers.remove(player);
if(BackendManager.canBuild.contains(player)) BackendManager.canBuild.remove(player);
}
}

Datei anzeigen

@ -0,0 +1,76 @@
package de.steamwar.lobby.listener;
import de.steamwar.lobby.utils.LobbyPlayer;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.util.Vector;
import java.util.Collection;
public class ShieldListener implements Listener {
double radius = 2.5D;
float multiplyer = 1.3F;
float height = 1.5F;
@EventHandler
public void handlePlayerMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId());
World world = player.getWorld();
Location playerLocation = event.getTo();
Collection<Entity> nearbyEntities = world.getNearbyEntities(playerLocation, radius, radius, radius);
if(lobbyPlayer.isShield()) {
for(Entity entity : nearbyEntities) {
if(!(entity instanceof Player)) {
continue;
}
Player entityPlayer = (Player) entity;
if(entityPlayer.getUniqueId() == player.getUniqueId()) {
continue;
}
world.playEffect(playerLocation, Effect.ENDER_SIGNAL, 1);
Location location = entityPlayer.getLocation();
double x = location.getX() - playerLocation.getX();
double y = location.getY() - playerLocation.getY();
double z = location.getZ() - playerLocation.getZ();
entityPlayer.setVelocity(new Vector(x, y, z).multiply(multiplyer).add(new Vector(0.0F, height, 0.0F)));
}
} else {
for(Entity entity : nearbyEntities) {
if(!(entity instanceof Player)) {
continue;
}
Player entityPlayer = (Player) entity;
LobbyPlayer entityPlayerLP = LobbyPlayer.getLobbyPlayer(entityPlayer.getUniqueId());
if(!entityPlayerLP.isShield())
continue;
world.playEffect(playerLocation, Effect.ENDER_SIGNAL, 1);
Location location = entityPlayer.getLocation();
double x = playerLocation.getX() - location.getX();
double y = playerLocation.getY() - location.getY();
double z = playerLocation.getZ() - location.getZ();
player.setVelocity(new Vector(x, y, z).multiply(multiplyer).add(new Vector(0.0F, height, 0.0F)));
}
}
}
}

Datei anzeigen

@ -1,45 +0,0 @@
package de.steamwar.lobby.listener;
import de.steamwar.lobby.LobbySystem;
import de.steamwar.lobby.gadgets.Gadget;
import org.bukkit.Effect;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerToggleSneakEvent;
import org.bukkit.scheduler.BukkitRunnable;
public class SneakListener implements Listener {
@EventHandler
public void handleSneak(PlayerToggleSneakEvent event) {
final Player player = event.getPlayer();
if(LobbySystem.getInstance().getGadgetManager().getPlayerGadget(player) == Gadget.JETPACK) {
new BukkitRunnable() {
@Override
public void run() {
if(player.isSneaking() && LobbySystem.getInstance().getGadgetManager().getPlayerGadget(player) == Gadget.JETPACK) {
player.setVelocity(player.getLocation().getDirection().multiply(0.7D).setY(0.3D));
} else
cancel();
}
}.runTaskTimer(LobbySystem.getInstance(), 1L, 4L);
new BukkitRunnable() {
@Override
public void run() {
if(player.isSneaking() && LobbySystem.getInstance().getGadgetManager().getPlayerGadget(player) == Gadget.JETPACK) {
//player.getWorld().playEffect(player.getLocation(), Effect.LAVA_POP, 10);
//player.getWorld().playEffect(player.getLocation(), Effect.LAVA_POP, 10);
player.getWorld().playEffect(player.getLocation(), Effect.LAVA_POP, 10);
player.playSound(player.getLocation(), Sound.ENTITY_FIREWORK_LAUNCH, 0.1F, 0.1F);
}
}
}.runTaskTimer(LobbySystem.getInstance(), 1L, 1L);
}
}
}

Datei anzeigen

@ -1,20 +0,0 @@
package de.steamwar.lobby.listener;
import de.steamwar.lobby.LobbySystem;
import de.steamwar.lobby.gadgets.Gadget;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerTeleportEvent;
public class TeleportEvent implements Listener {
@EventHandler
public void handlePlayerTeleport(PlayerTeleportEvent event) {
Player player = event.getPlayer();
if(event.getCause() == PlayerTeleportEvent.TeleportCause.ENDER_PEARL && LobbySystem.getInstance().getGadgetManager().getPlayerGadget(player) == Gadget.ENDER_PEARL && event.getTo().distance(player.getLocation()) <= 0) event.setCancelled(true);
}
}

Datei anzeigen

@ -1,79 +0,0 @@
package de.steamwar.lobby.manager;
import de.steamwar.lobby.LobbySystem;
import org.bukkit.entity.Player;
import java.util.ArrayList;
public class BackendManager {
public boolean allowJoinMessage;
public String JoinMessage;
public boolean allowQuitMessage;
public String QuitMessage;
public boolean allowFisrtJoinMessage;
public String FisrtJoinMessage;
public String prefix;
public String SetLobbyMessage;
public static ArrayList<Player> hideAll = new ArrayList<>();//alle Spieler verstecken
public static ArrayList<Player> hideUsers = new ArrayList<>();//nur YouTuber/Teammitglieder anzeigen
public static ArrayList<Player> canBuild = new ArrayList<>();
public BackendManager() {
}
public void loadBackend(FileManager fileManager) {
allowJoinMessage = fileManager.getBooleanFromConfig("Event.Join.allowJoinMessage");
allowFisrtJoinMessage = fileManager.getBooleanFromConfig("Event.Join.allowFirstJoinMessage");
allowQuitMessage = fileManager.getBooleanFromConfig("Event.Join.allowQuitMessage");
JoinMessage = fileManager.getStringFromConfig("Event.Join.JoinMessage");
FisrtJoinMessage = fileManager.getStringFromConfig("Event.Join.FirstJoinMessage");
QuitMessage = fileManager.getStringFromConfig("Event.Join.QuitMessage");
prefix = fileManager.getStringFromConfig("Messages.Prefix");
SetLobbyMessage = fileManager.getStringFromConfig("Messages.Commands.SetLocationMessage").replaceAll("%prefix%", prefix).replaceAll("&", "§");
}
public String checkLocations() {
LocationManager locManager = LobbySystem.getInstance().getLocationManager();
String errorCode = "";
if(!locManager.hasLocation("main.lobby")) {
errorCode += "§8[§c✕§8] §cSpawn newLine ";
}
if(!locManager.hasLocation("navigation.airship")) {
errorCode += "§8[§c✕§8] §cAirShip" + " newLine ";
}
if(!locManager.hasLocation("navigation.minigame")) {
errorCode += "§8[§c✕§8] §cSpawn" + " newLine ";
}
if(!locManager.hasLocation("navigation.wargear")) {
errorCode += "§8[§c✕§8] §cWarGear" + " newLine ";
}
if(!locManager.hasLocation("navigation.survival")) {
errorCode += "§8[§c✕§8] §cSurvival" + " newLine ";
}
if(!locManager.hasLocation("navigation.miniwargear")) {
errorCode += "§8[§c✕§8] §cMini WarGear" + " newLine ";
}
if(!locManager.hasLocation("navigation.tb")) {
errorCode += "§8[§c✕§8] §cTägliche Belohnung" + " newLine ";
}
if(!locManager.hasLocation("navigation.battlebox")) {
errorCode += "§8[§c✕§8] §cBattle Box" + " newLine ";
}
return errorCode;
}
}

Datei anzeigen

@ -1,67 +0,0 @@
package de.steamwar.lobby.manager;
import java.io.File;
import java.io.IOException;
import de.steamwar.lobby.LobbySystem;
import org.bukkit.configuration.file.FileConfiguration;
public class FileManager {
public File file;
public FileConfiguration config;
public FileManager(LobbySystem instance) {
config = instance.getConfig();
config.options().copyDefaults(true);
file = new File(instance.getDataFolder(), "config.yml");
instance.saveConfig();
}
public void reloadFiles(LobbySystem instance) {
instance.reloadConfig();
}
public void addNewPath(String path, String data) {
if(config.contains(path) || config.contains(data))
return;
config.set(path, data);
save();
}
public String getStringFromConfig(String path) {
return config.getString(path).replaceAll("&", "<EFBFBD>");
}
public int getIntegerFromConfig(String path) {
return config.getInt(path);
}
public boolean getBooleanFromConfig(String path) {
return config.getBoolean(path);
}
public File getFile() {
return file;
}
public FileConfiguration getConfig() {
return config;
}
public void save() {
try {
config.save(file);
} catch (IOException e) {
e.printStackTrace();
}
}
}

Datei anzeigen

@ -1,72 +0,0 @@
package de.steamwar.lobby.manager;
import java.io.File;
import java.io.IOException;
import de.steamwar.lobby.LobbySystem;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.configuration.file.YamlConfiguration;
public class LocationManager {
private File file;
private YamlConfiguration config;
public LocationManager() {
file = new File(LobbySystem.getInstance().getDataFolder() + "/Data/Locations", "locs.yml");
config = YamlConfiguration.loadConfiguration(file);
}
public void saveLocation(String path, Location loc) {
config.set(path + ".WORLD", loc.getWorld().getName());
config.set(path + ".X", loc.getX());
config.set(path + ".Y", loc.getY());
config.set(path + ".Z", loc.getZ());
config.set(path + ".YAW", loc.getYaw());
config.set(path + ".PITCH", loc.getPitch());
save();
}
public Location loadLocation(String path) {
World world = Bukkit.getWorld(config.getString(path + ".WORLD"));
double x = config.getDouble(path + ".X");
double y = config.getDouble(path + ".Y");
double z = config.getDouble(path + ".Z");
float yaw = (float) config.getDouble(path + ".YAW");
float pitch = (float) config.getDouble(path + ".PITCH");
return new Location(world, x, y, z, yaw, pitch);
}
public void save() {
try {
config.save(file);
} catch (IOException e) {
e.printStackTrace();
}
}
public File getFile() {
return file;
}
public YamlConfiguration getConfig() {
return config;
}
public boolean hasLocation(String string) {
if(config.contains(string))
return true;
return false;
}
}

Datei anzeigen

@ -0,0 +1,53 @@
package de.steamwar.lobby.utils;
import de.steamwar.lobby.LobbySystem;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;
import java.io.File;
import java.util.logging.Level;
public class Config {
private Config() {}
private static LobbySystem instance = LobbySystem.getInstance();
//Cache
public static final String WorldName;
//Spawn
public static final int SpawnX;
public static final int SpawnY;
public static final int SpawnZ;
//World Border
public static final int BorderMinX;
public static final int BorderMinY;
public static final int BorderMinZ;
public static final int BorderMaxX;
public static final int BorderMaxY;
public static final int BorderMaxZ;
static {
if(!new File(instance.getDataFolder(), "config.yml").exists()) {
instance.saveDefaultConfig();
Bukkit.getLogger().log(Level.SEVERE, "Config fehlt!");
instance.shutdown(null);
}
FileConfiguration config = instance.getConfig();
WorldName = config.getString("WorldName");
SpawnX = config.getInt("Spawn.X");
SpawnY = config.getInt("Spawn.Y");
SpawnZ = config.getInt("Spawn.Z");
BorderMinX = config.getInt("Border.MinX");
BorderMinY = config.getInt("Border.MinY");
BorderMinZ = config.getInt("Border.MinZ");
BorderMaxX = config.getInt("Border.MaxX");
BorderMaxY = config.getInt("Border.MaxY");
BorderMaxZ = config.getInt("Border.MaxZ");
}
}

Datei anzeigen

@ -0,0 +1,104 @@
package de.steamwar.lobby.utils;
import org.bukkit.Effect;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
public class LobbyPlayer {
private static List<LobbyPlayer> cache = new ArrayList<>();
private UUID uuid;
private PlayerHiderState hiderState;
private Effect particle;
private boolean fly;
private boolean enderPearlUsed;
private boolean shield;
public LobbyPlayer(UUID uuid) {
this.uuid = uuid;
this.hiderState = PlayerHiderState.SHOW_ALL;
cache.add(this);
}
public UUID getUuid() {
return uuid;
}
public PlayerHiderState getHiderState() {
return hiderState;
}
public void setHiderState(PlayerHiderState hiderState) {
this.hiderState = hiderState;
}
public Effect getParticle() {
return particle;
}
public void setParticle(Effect particle) {
this.particle = particle;
}
public boolean isFly() {
return fly;
}
public void setFly(boolean fly) {
this.fly = fly;
}
public boolean isEnderPearlUsed() {
return enderPearlUsed;
}
public void setEnderPearlUsed(boolean enderPearlUsed) {
this.enderPearlUsed = enderPearlUsed;
}
public boolean isShield() {
return shield;
}
public void setShield(boolean shield) {
this.shield = shield;
}
public void nexthHiderState() {
if(this.hiderState == PlayerHiderState.SHOW_ALL) {
this.hiderState = PlayerHiderState.SHOW_TEAM;
}
else if(this.hiderState == PlayerHiderState.SHOW_TEAM) {
this.hiderState = PlayerHiderState.SHOW_NOBODY;
}
else
this.hiderState = PlayerHiderState.SHOW_ALL;
}
public enum PlayerHiderState {
SHOW_ALL("§aAlle Spieler"),
SHOW_TEAM("§6Nur Teammitglieder"),
SHOW_NOBODY("§cKeine Spieler");
private String name;
private PlayerHiderState(String name) {
this.name = name;
}
public String getName() {
return name;
}
}
public static LobbyPlayer getLobbyPlayer(UUID uuid) {
for(LobbyPlayer current : cache) {
if(current.getUuid().equals(uuid))
return current;
}
return null;
}
}

Datei anzeigen

@ -1,9 +1,9 @@
name: LobbySystem name: LobbySystem
version: 1.0 version: 1.0
author: [hunjy, Yaruma3341] author: [Yaruma3341]
depend: [SpigotCore] depend: [SpigotCore]
main: de.steamwar.lobby.LobbySystem main: de.steamwar.lobby.LobbySystem
commands: commands:
build: fly:
shield: