Merge branch 'rework'
# Conflicts: # pom.xml # src/de/steamwar/lobby/inventories/LobbyInventory.java # src/de/steamwar/lobby/listener/DoubleJumpListener.java
Dieser Commit ist enthalten in:
Commit
48924971d2
2
pom.xml
2
pom.xml
@ -48,7 +48,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>steamwar</groupId>
|
<groupId>steamwar</groupId>
|
||||||
<artifactId>Spigot</artifactId>
|
<artifactId>Spigot</artifactId>
|
||||||
<version>1.12</version>
|
<version>1.15</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -2,6 +2,8 @@ Spawn:
|
|||||||
X:
|
X:
|
||||||
Y:
|
Y:
|
||||||
Z:
|
Z:
|
||||||
|
Yaw:
|
||||||
|
Pitch:
|
||||||
|
|
||||||
Border:
|
Border:
|
||||||
MinX:
|
MinX:
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
package de.steamwar.lobby;
|
package de.steamwar.lobby;
|
||||||
|
|
||||||
import de.steamwar.lobby.commands.FlyCommand;
|
import de.steamwar.lobby.commands.FlyCommand;
|
||||||
import de.steamwar.lobby.commands.ShieldCommand;
|
|
||||||
import de.steamwar.lobby.listener.*;
|
import de.steamwar.lobby.listener.*;
|
||||||
import de.steamwar.lobby.utils.Config;
|
|
||||||
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;
|
||||||
@ -16,19 +14,16 @@ public class LobbySystem extends JavaPlugin {
|
|||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
instance = this;
|
instance = this;
|
||||||
|
|
||||||
if(Config.SpawnY == 0)
|
|
||||||
shutdown(null);
|
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
getCommand("fly").setExecutor(new FlyCommand());
|
getCommand("fly").setExecutor(new FlyCommand());
|
||||||
getCommand("schild").setExecutor(new ShieldCommand());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init() {
|
public void init() {
|
||||||
PluginManager pm = Bukkit.getPluginManager();
|
PluginManager pm = Bukkit.getPluginManager();
|
||||||
|
|
||||||
pm.registerEvents(new PlayerMoveListener(), instance);
|
pm.registerEvents(new PlayerMoveListener(), instance);
|
||||||
pm.registerEvents(new PlayerJoinListener(), instance);
|
pm.registerEvents(new PlayerConnectionListener(), instance);
|
||||||
pm.registerEvents(new PlayerInventoryListener(), instance);
|
pm.registerEvents(new PlayerInventoryListener(), instance);
|
||||||
pm.registerEvents(new PlayerWorldInteractionListener(), instance);
|
pm.registerEvents(new PlayerWorldInteractionListener(), instance);
|
||||||
pm.registerEvents(new DoubleJumpListener(), instance);
|
pm.registerEvents(new DoubleJumpListener(), instance);
|
||||||
@ -37,11 +32,6 @@ public class LobbySystem extends JavaPlugin {
|
|||||||
pm.registerEvents(new EnderPearlListener(), instance);
|
pm.registerEvents(new EnderPearlListener(), instance);
|
||||||
pm.registerEvents(new ShieldListener(), instance);
|
pm.registerEvents(new ShieldListener(), instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void shutdown(final String reason) {
|
|
||||||
Bukkit.getOnlinePlayers().forEach(player -> player.kickPlayer(reason));
|
|
||||||
Bukkit.shutdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static LobbySystem getInstance() {
|
public static LobbySystem getInstance() {
|
||||||
|
@ -20,10 +20,12 @@ public class FlyCommand implements CommandExecutor {
|
|||||||
SteamwarUser steamwarUser = SteamwarUser.get(player.getUniqueId());
|
SteamwarUser steamwarUser = SteamwarUser.get(player.getUniqueId());
|
||||||
UserGroup userGroup = steamwarUser.getUserGroup();
|
UserGroup userGroup = steamwarUser.getUserGroup();
|
||||||
|
|
||||||
if(userGroup != UserGroup.Developer &&
|
if(userGroup != UserGroup.Admin &&
|
||||||
userGroup != UserGroup.Moderator &&
|
userGroup != UserGroup.Moderator &&
|
||||||
userGroup != UserGroup.Admin &&
|
userGroup != UserGroup.Developer &&
|
||||||
userGroup != UserGroup.Youtuber) {
|
userGroup != UserGroup.Supporter &&
|
||||||
|
userGroup != UserGroup.Builder &&
|
||||||
|
userGroup != UserGroup.Youtuber) {
|
||||||
player.sendMessage("§cDu verfügst nicht über die benötigten Rechte!");
|
player.sendMessage("§cDu verfügst nicht über die benötigten Rechte!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1,39 +0,0 @@
|
|||||||
package de.steamwar.lobby.commands;
|
|
||||||
|
|
||||||
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.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) {
|
|
||||||
player.sendMessage("§cDu verfügst nicht über die benötigten Rechte!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId());
|
|
||||||
boolean newShieldState = !lobbyPlayer.isShield();
|
|
||||||
|
|
||||||
lobbyPlayer.setShield(newShieldState);
|
|
||||||
player.sendMessage("§7Dein Schild ist jetzt " + (newShieldState ? "§aan" : "§caus") + "§7.");
|
|
||||||
LobbyInventory.givePlayerLobbyItems(player);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,4 +1,4 @@
|
|||||||
package de.steamwar.lobby.inventorys;
|
package de.steamwar.lobby.inventories;
|
||||||
|
|
||||||
import de.steamwar.lobby.utils.ItemBuilder;
|
import de.steamwar.lobby.utils.ItemBuilder;
|
||||||
import de.steamwar.lobby.utils.LobbyPlayer;
|
import de.steamwar.lobby.utils.LobbyPlayer;
|
||||||
@ -9,15 +9,16 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
public class LobbyInventory {
|
public class LobbyInventory {
|
||||||
|
|
||||||
|
private LobbyInventory() {}
|
||||||
|
|
||||||
public static Material PLAYER_HIDER = Material.BLAZE_ROD;
|
public static Material PLAYER_HIDER = Material.BLAZE_ROD;
|
||||||
public static Material PARTIKEL = Material.NAME_TAG;
|
public static Material PARTICLE = Material.NAME_TAG;
|
||||||
public static Material ENDERPEARL_USED = Material.FIREWORK_CHARGE;
|
public static Material ENDERPEARL_USED = Material.FIREWORK_STAR;
|
||||||
public static Material ENDERPEARL_READY = Material.ENDER_PEARL;
|
public static Material ENDERPEARL_READY = Material.ENDER_PEARL;
|
||||||
public static Material SCHILD = Material.SHIELD;
|
public static Material SHIELD = Material.SHIELD;
|
||||||
|
|
||||||
public static void givePlayerLobbyItems(Player player) {
|
public static void givePlayerLobbyItems(Player player) {
|
||||||
LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId());
|
LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId());
|
||||||
if(lobbyPlayer == null) return;
|
|
||||||
|
|
||||||
player.getInventory().setItem(2, new ItemBuilder(PLAYER_HIDER)
|
player.getInventory().setItem(2, new ItemBuilder(PLAYER_HIDER)
|
||||||
.setDisplayName(lobbyPlayer.getHiderState().getName())
|
.setDisplayName(lobbyPlayer.getHiderState().getName())
|
||||||
@ -31,21 +32,23 @@ public class LobbyInventory {
|
|||||||
.removeAllAtributs()
|
.removeAllAtributs()
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
/*player.getInventory().setItem(6, new ItemBuilder(PARTIKEL)
|
player.getInventory().setItem(6, new ItemBuilder(PARTICLE)
|
||||||
.setDisplayName("§6Partikel")
|
.setDisplayName("§6Partikel")
|
||||||
.setUnbreakable(true)
|
.setUnbreakable(true)
|
||||||
.removeAllAtributs()
|
.removeAllAtributs()
|
||||||
.build());*/
|
.build());
|
||||||
|
|
||||||
|
|
||||||
UserGroup userGroup = SteamwarUser.get(player.getUniqueId()).getUserGroup();
|
UserGroup userGroup = SteamwarUser.get(player.getUniqueId()).getUserGroup();
|
||||||
if(userGroup != UserGroup.Developer &&
|
if(userGroup != UserGroup.Admin &&
|
||||||
userGroup != UserGroup.Moderator &&
|
userGroup != UserGroup.Moderator &&
|
||||||
userGroup != UserGroup.Admin &&
|
userGroup != UserGroup.Developer &&
|
||||||
|
userGroup != UserGroup.Supporter &&
|
||||||
|
userGroup != UserGroup.Builder &&
|
||||||
userGroup != UserGroup.Youtuber) {
|
userGroup != UserGroup.Youtuber) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
player.getInventory().setItem(8, new ItemBuilder(SCHILD)
|
player.getInventory().setItem(8, new ItemBuilder(SHIELD)
|
||||||
.setDisplayName("§bSchild §8| " + (lobbyPlayer.isShield() ? "§aan" : "§caus"))
|
.setDisplayName("§bSchild §8| " + (lobbyPlayer.isShield() ? "§aan" : "§caus"))
|
||||||
.setUnbreakable(true)
|
.setUnbreakable(true)
|
||||||
.removeAllAtributs()
|
.removeAllAtributs()
|
@ -1,10 +1,11 @@
|
|||||||
package de.steamwar.lobby.inventorys;
|
package de.steamwar.lobby.inventories;
|
||||||
|
|
||||||
import de.steamwar.inventory.SWInventory;
|
import de.steamwar.inventory.SWInventory;
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import de.steamwar.lobby.utils.LobbyPlayer;
|
import de.steamwar.lobby.utils.LobbyPlayer;
|
||||||
import org.bukkit.Effect;
|
import org.bukkit.Effect;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Particle;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -12,37 +13,38 @@ import java.util.List;
|
|||||||
|
|
||||||
public class ParticleInventory {
|
public class ParticleInventory {
|
||||||
|
|
||||||
|
private ParticleInventory() {}
|
||||||
|
|
||||||
public static void openParticleInventory(Player player) {
|
public static void openParticleInventory(Player player) {
|
||||||
LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId());
|
LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId());
|
||||||
if(lobbyPlayer == null) return;
|
|
||||||
|
|
||||||
SWInventory swInventory = new SWInventory(player, 9 * 1, "§6Partikel");
|
SWInventory swInventory = new SWInventory(player, 9 * 1, "§6Partikel");
|
||||||
|
|
||||||
List<String> lore = new ArrayList<>();
|
List<String> lore = new ArrayList<>();
|
||||||
lore.add("§aKlicken zum Auswählen");
|
lore.add("§aKlicken zum Auswählen");
|
||||||
|
|
||||||
SWItem smoke = new SWItem(Material.WEB, "§7Smoke", lore, false, clickType -> {
|
SWItem smoke = new SWItem(Material.COBWEB, "§7Smoke", lore, false, clickType -> {
|
||||||
lobbyPlayer.setParticle(Effect.SMOKE);
|
lobbyPlayer.setParticle(Particle.SMOKE_NORMAL);
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
});
|
});
|
||||||
|
|
||||||
SWItem fire = new SWItem(Material.LAVA_BUCKET, "§cFeuer", lore, false, clickType -> {
|
SWItem fire = new SWItem(Material.LAVA_BUCKET, "§cFeuer", lore, false, clickType -> {
|
||||||
lobbyPlayer.setParticle(Effect.LAVA_POP);
|
lobbyPlayer.setParticle(Particle.DRIP_LAVA);
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
});
|
});
|
||||||
|
|
||||||
SWItem heart = new SWItem(Material.INK_SACK, (byte) 1, "§cHerzen", lore, false, clickType -> {
|
SWItem heart = new SWItem(Material.RED_DYE, "§cHerzen", lore, false, clickType -> {
|
||||||
lobbyPlayer.setParticle(Effect.HEART);
|
lobbyPlayer.setParticle(Particle.HEART);
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
});
|
});
|
||||||
|
|
||||||
SWItem water = new SWItem(Material.WATER_BUCKET, "§bWasser", lore, false, clickType -> {
|
SWItem water = new SWItem(Material.WATER_BUCKET, "§bWasser", lore, false, clickType -> {
|
||||||
lobbyPlayer.setParticle(Effect.WATERDRIP);
|
lobbyPlayer.setParticle(Particle.DRIP_WATER);
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
});
|
});
|
||||||
|
|
||||||
SWItem note = new SWItem(Material.NOTE_BLOCK, "§eNoten", lore, false, clickType -> {
|
SWItem note = new SWItem(Material.NOTE_BLOCK, "§eNoten", lore, false, clickType -> {
|
||||||
lobbyPlayer.setParticle(Effect.NOTE);
|
lobbyPlayer.setParticle(Particle.NOTE);
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
});
|
});
|
||||||
|
|
@ -38,7 +38,7 @@ public class DoubleJumpListener implements Listener {
|
|||||||
direction.setZ(direction.getZ() * multiplyer);
|
direction.setZ(direction.getZ() * multiplyer);
|
||||||
|
|
||||||
player.setVelocity(direction.add(new Vector(0, 1.2, 0)));
|
player.setVelocity(direction.add(new Vector(0, 1.2, 0)));
|
||||||
//player.playSound(player.getLocation(), Sound.ENTITY_FIREWORK_LAUNCH, 1.0F, 1.0F);
|
player.playSound(player.getLocation(), Sound.ENTITY_FIREWORK_ROCKET_LAUNCH, 1.0F, 1.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package de.steamwar.lobby.listener;
|
package de.steamwar.lobby.listener;
|
||||||
|
|
||||||
import de.steamwar.lobby.LobbySystem;
|
import de.steamwar.lobby.LobbySystem;
|
||||||
import de.steamwar.lobby.inventorys.LobbyInventory;
|
import de.steamwar.lobby.inventories.LobbyInventory;
|
||||||
import de.steamwar.lobby.utils.LobbyPlayer;
|
import de.steamwar.lobby.utils.LobbyPlayer;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
@ -10,11 +10,9 @@ import org.bukkit.event.EventHandler;
|
|||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||||
import org.bukkit.event.vehicle.VehicleExitEvent;
|
import org.bukkit.event.vehicle.VehicleExitEvent;
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
|
|
||||||
public class EnderPearlListener implements Listener {
|
public class EnderPearlListener implements Listener {
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package de.steamwar.lobby.listener;
|
package de.steamwar.lobby.listener;
|
||||||
|
|
||||||
import de.steamwar.lobby.inventorys.LobbyInventory;
|
import de.steamwar.lobby.inventories.LobbyInventory;
|
||||||
import de.steamwar.lobby.inventorys.ParticleInventory;
|
import de.steamwar.lobby.inventories.ParticleInventory;
|
||||||
import de.steamwar.lobby.utils.LobbyPlayer;
|
import de.steamwar.lobby.utils.LobbyPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -15,7 +15,7 @@ public class ParticleListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.NORMAL)
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void handlePlayerInteract(PlayerInteractEvent event) {
|
public void handlePlayerInteract(PlayerInteractEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if(event.getMaterial() != LobbyInventory.PARTIKEL)
|
if(event.getMaterial() != LobbyInventory.PARTICLE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ParticleInventory.openParticleInventory(player);
|
ParticleInventory.openParticleInventory(player);
|
||||||
@ -25,7 +25,7 @@ public class ParticleListener implements Listener {
|
|||||||
public void handlePlayerMove(PlayerMoveEvent event) {
|
public void handlePlayerMove(PlayerMoveEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId());
|
LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId());
|
||||||
if(lobbyPlayer == null || lobbyPlayer.getParticle() == null) return;
|
if(lobbyPlayer.getParticle() == null) return;
|
||||||
|
|
||||||
player.getWorld().playEffect(player.getLocation().add(0.0D, 0.2D, 0.0D), lobbyPlayer.getParticle(), 5);
|
player.getWorld().playEffect(player.getLocation().add(0.0D, 0.2D, 0.0D), lobbyPlayer.getParticle(), 5);
|
||||||
}
|
}
|
||||||
|
47
src/de/steamwar/lobby/listener/PlayerConnectionListener.java
Normale Datei
47
src/de/steamwar/lobby/listener/PlayerConnectionListener.java
Normale Datei
@ -0,0 +1,47 @@
|
|||||||
|
package de.steamwar.lobby.listener;
|
||||||
|
|
||||||
|
import de.steamwar.lobby.inventories.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.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.player.PlayerJoinEvent;
|
||||||
|
import org.bukkit.event.player.PlayerKickEvent;
|
||||||
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
|
||||||
|
public class PlayerConnectionListener implements Listener {
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
|
public void handlePlayerJoin(PlayerJoinEvent event) {
|
||||||
|
event.setJoinMessage(null);
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
LobbyPlayer.getLobbyPlayer(player.getUniqueId()); //initialisiert einen neuen LP falls nicht vorhanden
|
||||||
|
|
||||||
|
player.teleport(new Location(Bukkit.getWorlds().get(0), Config.SpawnX, Config.SpawnY, Config.SpawnZ, Config.Yaw, Config.Pitch));
|
||||||
|
player.getInventory().clear();
|
||||||
|
LobbyInventory.givePlayerLobbyItems(player);
|
||||||
|
player.setGameMode(GameMode.ADVENTURE);
|
||||||
|
player.setHealth(20);
|
||||||
|
player.setFoodLevel(20);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
|
public void handlePlayerQuit(PlayerQuitEvent event) {
|
||||||
|
event.setQuitMessage(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void handlePlayerKick(PlayerKickEvent event) {
|
||||||
|
if(event.getReason().equals("Flying is not enabled on this server") && event.getPlayer().getVehicle() instanceof EnderPearl)
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
package de.steamwar.lobby.listener;
|
package de.steamwar.lobby.listener;
|
||||||
|
|
||||||
import de.steamwar.lobby.inventorys.LobbyInventory;
|
import de.steamwar.lobby.inventories.LobbyInventory;
|
||||||
import de.steamwar.lobby.utils.LobbyPlayer;
|
import de.steamwar.lobby.utils.LobbyPlayer;
|
||||||
import de.steamwar.sql.SteamwarUser;
|
import de.steamwar.sql.SteamwarUser;
|
||||||
import de.steamwar.sql.UserGroup;
|
import de.steamwar.sql.UserGroup;
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
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.getWorlds().get(0), Config.SpawnX, Config.SpawnY, Config.SpawnZ));
|
|
||||||
LobbyInventory.givePlayerLobbyItems(player);
|
|
||||||
player.setGameMode(GameMode.ADVENTURE);
|
|
||||||
player.setHealth(20);
|
|
||||||
player.setFoodLevel(20);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -21,7 +21,9 @@ public class PlayerMoveListener implements Listener {
|
|||||||
Bukkit.getWorlds().get(0),
|
Bukkit.getWorlds().get(0),
|
||||||
Config.SpawnX,
|
Config.SpawnX,
|
||||||
Config.SpawnY,
|
Config.SpawnY,
|
||||||
Config.SpawnZ));
|
Config.SpawnZ,
|
||||||
|
Config.Yaw,
|
||||||
|
Config.Pitch));
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isInRegion(Vector minPoint, Vector maxPoint, Vector location) {
|
private boolean isInRegion(Vector minPoint, Vector maxPoint, Vector location) {
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
package de.steamwar.lobby.listener;
|
package de.steamwar.lobby.listener;
|
||||||
|
|
||||||
import de.steamwar.lobby.LobbySystem;
|
import de.steamwar.lobby.inventories.LobbyInventory;
|
||||||
import de.steamwar.lobby.inventorys.LobbyInventory;
|
|
||||||
import de.steamwar.lobby.utils.LobbyPlayer;
|
import de.steamwar.lobby.utils.LobbyPlayer;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Effect;
|
import org.bukkit.Effect;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.EnderPearl;
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -82,7 +79,7 @@ public class ShieldListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void handlePlayerInteract(PlayerInteractEvent event) {
|
public void handlePlayerInteract(PlayerInteractEvent event) {
|
||||||
if(event.getMaterial() != LobbyInventory.SCHILD) return;
|
if(event.getMaterial() != LobbyInventory.SHIELD) return;
|
||||||
Action action = event.getAction();
|
Action action = event.getAction();
|
||||||
if(action != Action.RIGHT_CLICK_AIR && action != Action.RIGHT_CLICK_BLOCK) return;
|
if(action != Action.RIGHT_CLICK_AIR && action != Action.RIGHT_CLICK_BLOCK) return;
|
||||||
|
|
||||||
|
@ -15,9 +15,11 @@ public class Config {
|
|||||||
|
|
||||||
//Cache
|
//Cache
|
||||||
//Spawn
|
//Spawn
|
||||||
public static final int SpawnX;
|
public static final double SpawnX;
|
||||||
public static final int SpawnY;
|
public static final double SpawnY;
|
||||||
public static final int SpawnZ;
|
public static final double SpawnZ;
|
||||||
|
public static final float Yaw;
|
||||||
|
public static final float Pitch;
|
||||||
|
|
||||||
//World Border
|
//World Border
|
||||||
public static final int BorderMinX;
|
public static final int BorderMinX;
|
||||||
@ -31,13 +33,15 @@ public class Config {
|
|||||||
if(!new File(instance.getDataFolder(), "config.yml").exists()) {
|
if(!new File(instance.getDataFolder(), "config.yml").exists()) {
|
||||||
instance.saveDefaultConfig();
|
instance.saveDefaultConfig();
|
||||||
Bukkit.getLogger().log(Level.SEVERE, "Config fehlt!");
|
Bukkit.getLogger().log(Level.SEVERE, "Config fehlt!");
|
||||||
instance.shutdown(null);
|
throw new SecurityException();
|
||||||
}
|
}
|
||||||
FileConfiguration config = instance.getConfig();
|
FileConfiguration config = instance.getConfig();
|
||||||
|
|
||||||
SpawnX = config.getInt("Spawn.X");
|
SpawnX = config.getInt("Spawn.X");
|
||||||
SpawnY = config.getInt("Spawn.Y");
|
SpawnY = config.getInt("Spawn.Y");
|
||||||
SpawnZ = config.getInt("Spawn.Z");
|
SpawnZ = config.getInt("Spawn.Z");
|
||||||
|
Yaw = (float) config.getDouble("Spawn.Yaw");
|
||||||
|
Pitch = (float) config.getDouble("Spawn.Pitch");
|
||||||
|
|
||||||
BorderMinX = config.getInt("Border.MinX");
|
BorderMinX = config.getInt("Border.MinX");
|
||||||
BorderMinY = config.getInt("Border.MinY");
|
BorderMinY = config.getInt("Border.MinY");
|
||||||
|
@ -1,30 +1,22 @@
|
|||||||
package de.steamwar.lobby.utils;
|
package de.steamwar.lobby.utils;
|
||||||
|
|
||||||
import org.bukkit.Effect;
|
import org.bukkit.Particle;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class LobbyPlayer {
|
public class LobbyPlayer {
|
||||||
|
|
||||||
private static List<LobbyPlayer> cache = new ArrayList<>();
|
private static Map<UUID, LobbyPlayer> cache = new HashMap();
|
||||||
|
|
||||||
private UUID uuid;
|
|
||||||
private PlayerHiderState hiderState;
|
private PlayerHiderState hiderState;
|
||||||
private Effect particle;
|
private Particle particle;
|
||||||
private boolean fly;
|
private boolean fly;
|
||||||
private boolean enderPearlUsed;
|
private boolean enderPearlUsed;
|
||||||
private boolean shield;
|
private boolean shield;
|
||||||
|
|
||||||
public LobbyPlayer(UUID uuid) {
|
private LobbyPlayer(UUID uuid) {
|
||||||
this.uuid = uuid;
|
|
||||||
this.hiderState = PlayerHiderState.SHOW_ALL;
|
this.hiderState = PlayerHiderState.SHOW_ALL;
|
||||||
cache.add(this);
|
cache.put(uuid, this);
|
||||||
}
|
|
||||||
|
|
||||||
public UUID getUuid() {
|
|
||||||
return uuid;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerHiderState getHiderState() {
|
public PlayerHiderState getHiderState() {
|
||||||
@ -35,11 +27,11 @@ public class LobbyPlayer {
|
|||||||
this.hiderState = hiderState;
|
this.hiderState = hiderState;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Effect getParticle() {
|
public Particle getParticle() {
|
||||||
return particle;
|
return particle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setParticle(Effect particle) {
|
public void setParticle(Particle particle) {
|
||||||
this.particle = particle;
|
this.particle = particle;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,10 +87,7 @@ public class LobbyPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static LobbyPlayer getLobbyPlayer(UUID uuid) {
|
public static LobbyPlayer getLobbyPlayer(UUID uuid) {
|
||||||
for(LobbyPlayer current : cache) {
|
LobbyPlayer lobbyPlayer = cache.get(uuid);
|
||||||
if(current.getUuid().equals(uuid))
|
return lobbyPlayer == null ? new LobbyPlayer(uuid) : lobbyPlayer;
|
||||||
return current;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,5 +5,4 @@ depend: [SpigotCore]
|
|||||||
main: de.steamwar.lobby.LobbySystem
|
main: de.steamwar.lobby.LobbySystem
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
fly:
|
fly:
|
||||||
schild:
|
|
In neuem Issue referenzieren
Einen Benutzer sperren