+ refactoring

This commit is contained in:
Johannes Theiner 2017-06-04 13:44:31 +02:00
parent 5b0abbcfca
commit 93cb20bdf8
18 changed files with 197 additions and 475 deletions

View File

@ -1,6 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<module com.demonwav.mcdev.MinecraftModuleTypes="PAPER_MODULE_TYPE" org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="minecraft" name="Minecraft">
<configuration>
<autoDetectTypes>
<platformType>PAPER</platformType>
</autoDetectTypes>
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
@ -28,17 +37,54 @@
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:bukkit:1.11-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:craftbukkit:1.11-R0.1-SNAPSHOT" level="project" />
<orderEntry type="module" module-name="Core" scope="PROVIDED" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.16.10" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: co.aikar:taskchain-bukkit:3.4.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: co.aikar:taskchain-core:3.4.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.github.lordakkarin:nbt:1.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-buffer:5.0.0.Alpha2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-common:5.0.0.Alpha2" level="project" />
<orderEntry type="module" module-name="Commons" scope="PROVIDED" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.mongodb:mongo-java-driver:3.2.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.zaxxer:HikariCP:2.4.5" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.slf4j:slf4j-api:1.7.16" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: ai.api:libai:1.4.8" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.vertx:vertx-core:3.4.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-transport:4.1.8.Final" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-handler:4.1.8.Final" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-codec:4.1.8.Final" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-handler-proxy:4.1.8.Final" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-codec-socks:4.1.8.Final" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-codec-http:4.1.8.Final" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-codec-http2:4.1.8.Final" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-resolver:4.1.8.Final" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-resolver-dns:4.1.8.Final" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-codec-dns:4.1.8.Final" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.fasterxml.jackson.core:jackson-core:2.7.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.7.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.7.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.vertx:vertx-redis-client:3.4.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.vertx:vertx-mysql-postgresql-client:3.4.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.vertx:vertx-sql-common:3.4.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.scala-lang:scala-library:2.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.mauricio:postgresql-async_2.12:0.2.21" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.mauricio:db-async-common_2.12:0.2.21" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.joda:joda-convert:1.8.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.javassist:javassist:3.21.0-GA" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.mauricio:mysql-async_2.12:0.2.21" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.vertx:vertx-mongo-client:3.4.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.mongodb:mongodb-driver-async:3.4.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.mongodb:mongodb-driver-core:3.4.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.mongodb:bson:3.4.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.vertx:vertx-rabbitmq-client:3.4.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.rabbitmq:amqp-client:3.6.5" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.commons:commons-lang3:3.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-io:commons-io:2.5" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: joda-time:joda-time:2.9.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TheHolyWaffle:TeamSpeak-3-Java-API:v1.0.13" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-api:2.6.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-core:2.6.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.gpedro.integrations.slack:slack-webhook:1.2.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.16.10" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.nsp:JSkills:master-0.9.0-g8b333ec-15" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ejml:simple:0.28" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ejml:core:0.28" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ejml:dense64:0.28" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.gitlab:java-gitlab-api:1.2.7" level="project" />
</component>
</module>

View File

@ -1,13 +1,10 @@
package eu.univento.lobby;
import eu.univento.core.Core;
import eu.univento.core.api.pet.NMSHandler;
import eu.univento.commons.server.ServerType;
import eu.univento.core.api.server.ServerSettings;
import eu.univento.lobby.commands.DropItem;
import eu.univento.lobby.commands.Setloc;
import eu.univento.lobby.listeners.*;
import eu.univento.lobby.utils.PetManager;
import eu.univento.lobby.utils.StatusSignManager;
import org.bukkit.Bukkit;
import org.bukkit.Difficulty;
import org.bukkit.GameMode;
@ -22,7 +19,7 @@ import org.bukkit.plugin.java.JavaPlugin;
*/
public class Lobby extends JavaPlugin{
public static Lobby instance;
private static Lobby instance;
public static Lobby getInstance() {
return instance;
@ -43,35 +40,26 @@ public class Lobby extends JavaPlugin{
pm.registerEvents(new FoundItems(), this);
pm.registerEvents(new Parkour(), this);
pm.registerEvents(new PetInteract(), this);
pm.registerEvents(new StatusSigns(), this);
pm.registerEvents(new PlayerInteract(), this);
if(ServerSettings.isDebug()) Core.getCommons().getLoggingHandler().getLobby().info("Events registriert");
new Setloc(this, "setloc", "Setzt Teleport Punkte");
new DropItem(this, "dropitem", "Setzt EasterEggs");
if(ServerSettings.isDebug()) Core.getCommons().getLoggingHandler().getLobby().info("Befehle registriert");
if(ServerSettings.isDebug()) System.out.println("Befehle registriert");
for(World w : Bukkit.getWorlds()) w.setDifficulty(Difficulty.PEACEFUL);
for(World w : Bukkit.getWorlds()) {
w.setDifficulty(Difficulty.PEACEFUL);
}
ServerSettings.setGameMode(GameMode.ADVENTURE);
ServerSettings.setLobby();
StatusSignManager.loadSigns();
StatusSignManager.updateSigns();
NMSHandler.registerEnties();
Core.getInstance().registerPlugin(this);
Core.getCommons().getLoggingHandler().getLobby().info(" Plugin ver." + getDescription().getVersion() + " gestartet");
ServerSettings.setLobby(true);
ServerSettings.setServerType(ServerType.LOBBY);
System.out.println(" Plugin ver." + getDescription().getVersion() + " gestartet");
}
@Override
public void onDisable() {
StatusSignManager.saveSigns();
PetManager.clearPets();
Core.getCommons().getLoggingHandler().getLobby().info("Plugin beendet");
System.out.println("Plugin beendet");
}
}

View File

@ -1,8 +1,7 @@
package eu.univento.lobby.commands;
import eu.univento.commons.player.Rank;
import eu.univento.commons.player.rank.Rank;
import eu.univento.core.api.AutoCommand;
import eu.univento.core.api.languages.Messages;
import eu.univento.core.api.player.CustomPlayer;
import eu.univento.lobby.Lobby;
import org.bukkit.Material;
@ -34,37 +33,37 @@ public class DropItem extends AutoCommand<Lobby>{
public boolean execute(CommandSender sender, String label, String[] args) {
if(sender instanceof Player) {
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
Messages msgs = new Messages(p);
//Messages msgs = new Messages(p);
if(p.getDatabasePlayer().isAllowed(Rank.Admin)) {
if(args.length == 1) {
if(args[0].equalsIgnoreCase("music_3")) {
ItemStack music_3 = new ItemStack(Material.RECORD_3);
p.getWorld().dropItem(p.getLocation(), music_3);
p.sendMessage(msgs.PREFIX() + msgs.Lobby_DROP_ITEM());
//p.sendMessage(msgs.PREFIX() + msgs.Lobby_DROP_ITEM());
}
if(args[0].equalsIgnoreCase("feather")) {
ItemStack feather = new ItemStack(Material.FEATHER);
p.getWorld().dropItem(p.getLocation(), feather);
p.sendMessage(msgs.PREFIX() + msgs.Lobby_DROP_ITEM());
//p.sendMessage(msgs.PREFIX() + msgs.Lobby_DROP_ITEM());
}
if(args[0].equalsIgnoreCase("hearts")) {
ItemStack hearts = new ItemStack(Material.RED_ROSE);
p.getWorld().dropItem(p.getLocation(), hearts);
p.sendMessage(msgs.PREFIX() + msgs.Lobby_DROP_ITEM());
//p.sendMessage(msgs.PREFIX() + msgs.Lobby_DROP_ITEM());
}
if(args[0].equalsIgnoreCase("sugar")) {
ItemStack sugar = new ItemStack(Material.SUGAR);
p.getWorld().dropItem(p.getLocation(), sugar);
p.sendMessage(msgs.PREFIX() + msgs.Lobby_DROP_ITEM());
//p.sendMessage(msgs.PREFIX() + msgs.Lobby_DROP_ITEM());
}
}else{
p.sendMessage(msgs.PREFIX() + msgs.Lobby_DROP_ITEM_USAGE());
//p.sendMessage(msgs.PREFIX() + msgs.Lobby_DROP_ITEM_USAGE());
}
}else{
sender.sendMessage(msgs.NO_PERMS());
//sender.sendMessage(msgs.NO_PERMS());
}
}else{
sender.sendMessage(Messages.Console.NOT_A_PLAYER);
//sender.sendMessage(Messages.Console.NOT_A_PLAYER);
}
return true;
}

View File

@ -1,9 +1,8 @@
package eu.univento.lobby.commands;
import eu.univento.commons.player.Rank;
import eu.univento.commons.player.rank.Rank;
import eu.univento.core.api.AutoCommand;
import eu.univento.core.api.Config;
import eu.univento.core.api.languages.Messages;
import eu.univento.core.api.player.CustomPlayer;
import eu.univento.lobby.Lobby;
import org.bukkit.command.CommandSender;
@ -33,19 +32,19 @@ public class Setloc extends AutoCommand<Lobby>{
public boolean execute(CommandSender sender, String label, String[] args) {
if(sender instanceof Player) {
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
Messages msgs = new Messages(p);
//Messages msgs = new Messages(p);
if(p.getDatabasePlayer().isAllowed(Rank.SrDeveloper)) {
if(args.length == 1) {
Config.write("Lobby.Locs." + args[0], p.getLocation());
p.sendMessage(msgs.PREFIX() + msgs.Lobby_SET_LOCATION());
//p.sendMessage(msgs.PREFIX() + msgs.Lobby_SET_LOCATION());
}else {
p.sendMessage(msgs.PREFIX() + msgs.Lobby_SET_LOCATION_USAGE());
//p.sendMessage(msgs.PREFIX() + msgs.Lobby_SET_LOCATION_USAGE());
}
}else {
p.sendMessage(msgs.NO_PERMS());
//p.sendMessage(msgs.NO_PERMS());
}
}else {
sender.sendMessage(Messages.Console.NOT_A_PLAYER);
//sender.sendMessage(Messages.Console.NOT_A_PLAYER);
}
return false;
}

View File

@ -1,17 +1,6 @@
package eu.univento.lobby.listeners;
import eu.univento.commons.database.MySQL;
import eu.univento.core.Core;
import eu.univento.core.api.languages.Messages;
import eu.univento.core.api.player.CustomPlayer;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerPickupItemEvent;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* handels all posible easter eggs
@ -20,6 +9,7 @@ import java.sql.SQLException;
*/
public class FoundItems implements Listener{
/*
@EventHandler
public void onItemPickup(PlayerPickupItemEvent e) {
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
@ -78,5 +68,6 @@ public class FoundItems implements Listener{
e.printStackTrace();
}
}
*/
}

View File

@ -1,6 +1,6 @@
package eu.univento.lobby.listeners;
import eu.univento.commons.player.Rank;
import eu.univento.commons.player.rank.Rank;
import eu.univento.core.Core;
import eu.univento.core.api.player.CustomPlayer;
import eu.univento.lobby.Lobby;
@ -29,25 +29,25 @@ public class ItemEvents implements Listener {
if (e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
ItemStack item = p.getItemInHand();
if (item.getType() == Material.NAME_TAG) {
if (p.getDatabasePlayer().isAllowed(Rank.Partner)) {
if (p.getDatabasePlayer().isAllowed(Rank.VIP)) {
if (p.getDatabasePlayer().getSettings().isNicked()) {
p.getDatabasePlayer().getSettings().setNickStatus(false);
p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Lobby_AUTONICK_OFF());
//p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Lobby_AUTONICK_OFF());
} else {
p.getDatabasePlayer().getSettings().setNickStatus(true);
p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Lobby_AUTONICK_ON());
//p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Lobby_AUTONICK_ON());
}
}
}
if (item.getType() == Material.EYE_OF_ENDER) {
if (p.getDatabasePlayer().isAllowed(Rank.Partner)) {
if (p.getDatabasePlayer().isAllowed(Rank.VIP)) {
if (forcefield.containsKey(p)) {
Bukkit.getScheduler().cancelTask(forcefield.get(p));
forcefield.remove(p);
p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Lobby_FORCEFIELD_OFF());
//p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Lobby_FORCEFIELD_OFF());
} else {
forcefield.put(p, force(p));
p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Lobby_FORCEFIELD_ON());
//p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Lobby_FORCEFIELD_ON());
}
}

View File

@ -1,10 +1,8 @@
package eu.univento.lobby.listeners;
import eu.univento.commons.player.Rank;
import eu.univento.core.api.Config;
import eu.univento.commons.player.rank.Rank;
import eu.univento.core.api.Hologram;
import eu.univento.core.api.player.CustomPlayer;
import eu.univento.lobby.utils.InventoryManager;
import eu.univento.lobby.utils.PetManager;
import eu.univento.lobby.utils.Scoreboards;
import org.bukkit.Bukkit;
@ -31,7 +29,6 @@ public class JoinQuit implements Listener {
@EventHandler(priority = EventPriority.HIGH)
public void onJoin(PlayerJoinEvent e) throws ClassNotFoundException, SQLException {
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
e.setJoinMessage(null);
p.setMaxHealth(10.0D);
@ -40,26 +37,23 @@ public class JoinQuit implements Listener {
p.setExp(0F);
p.setLevel(0);
if (!p.hasPlayedBefore()) {
p.teleport(Config.readLocation("Lobby.Locs.Spawn"));
}
//InventoryManager invs = new InventoryManager(p);
InventoryManager invs = new InventoryManager(p);
p.giveExp(p.getDatabasePlayer().getExperience());
p.sendTitle(10, 50, 10, p.getMessages().Lobby_JOIN_TITLE_1(), p.getMessages().Lobby_JOIN_TITLE_2());
invs.setMainInventory(false);
//p.sendTitle(10, 50, 10, p.getMessages().Lobby_JOIN_TITLE_1(), p.getMessages().Lobby_JOIN_TITLE_2());
//invs.setMainInventory(false);
if (!p.getDatabasePlayer().isAllowed(Rank.Supporter)) {
for (CustomPlayer players : PlayerHider.getHidden()) {
p.getDatabasePlayer().isAllowedAsync(Rank.Supporter).whenComplete((aBoolean, throwable) -> {
if(!aBoolean) {
for (CustomPlayer players : PlayerHider.getHidden()) {
players.hidePlayer(p);
}
}
for (CustomPlayer players : PlayerHider.getSilentlobby()) {
players.hidePlayer(p);
p.hidePlayer(players);
}
}
for (CustomPlayer players : PlayerHider.getSilentlobby()) {
players.hidePlayer(p);
p.hidePlayer(players);
}
});
String[] text = {"§e@univentoEU"};
Hologram holo = new Hologram(new ItemStack(Material.WOOD_AXE), text, p.getWorld().getSpawnLocation());
@ -68,10 +62,9 @@ public class JoinQuit implements Listener {
BossBar bar = Bukkit.createBossBar("§cAchtung, frisch gestrichen", BarColor.GREEN, BarStyle.SEGMENTED_6, BarFlag.CREATE_FOG);
bar.addPlayer(p);
p.sendActionBar(p.getMessages().LobbyBoard_NEW() + " " + p.getMessages().LobbyBoard_NEWS());
//p.sendActionBar(p.getMessages().LobbyBoard_NEW() + " " + p.getMessages().LobbyBoard_NEWS());
Scoreboards.updateScoreboard(p);
}

View File

@ -1,6 +1,6 @@
package eu.univento.lobby.listeners;
import eu.univento.commons.player.Rank;
import eu.univento.commons.player.rank.Rank;
import eu.univento.core.api.Config;
import eu.univento.core.api.player.CustomPlayer;
import eu.univento.lobby.Lobby;

View File

@ -3,20 +3,16 @@ package eu.univento.lobby.listeners;
import eu.univento.core.Core;
import eu.univento.core.api.Config;
import eu.univento.core.api.effects.Effects;
import eu.univento.core.api.languages.Messages;
import eu.univento.core.api.player.CustomPlayer;
import eu.univento.lobby.Lobby;
import eu.univento.lobby.utils.InventoryManager;
import eu.univento.lobby.utils.PetManager;
import net.minecraft.server.v1_11_R1.EnumParticle;
import org.bukkit.*;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Horse;
import org.bukkit.entity.Player;
import org.bukkit.entity.PolarBear;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.inventory.InventoryType.SlotType;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.util.Vector;
@ -39,8 +35,8 @@ public class MenuEvents implements Listener {
if (e.getWhoClicked() instanceof Player) {
CustomPlayer p = CustomPlayer.getPlayer(e.getWhoClicked().getName());
InventoryManager invs = new InventoryManager(p);
Messages msgs = new Messages(p);
if(!e.getSlotType().equals(SlotType.OUTSIDE)) {
//Messages msgs = new Messages(p);
if(!e.getSlotType().equals(SlotType.OUTSIDE) && e.getInventory().getType() == InventoryType.CHEST) {
if (e.getInventory().getName().equals(invs.getNavigatorInventory().getName())) {
if (e.getCurrentItem().getType() == Material.GOLD_BLOCK) {
teleport(p, "TheBlock");
@ -106,19 +102,19 @@ public class MenuEvents implements Listener {
if(e.getCurrentItem().getItemMeta().getDisplayName().equals("§eDeutsch")) {
p.getDatabasePlayer().getSettings().setLanguage("DE");
p.closeInventory();
p.sendMessage(msgs.PREFIX() + "§7Sprache auf §eDeutsch §7geändert");
//p.sendMessage(msgs.PREFIX() + "§7Sprache auf §eDeutsch §7geändert");
invs.setMainInventory(true);
}
if(e.getCurrentItem().getItemMeta().getDisplayName().equals("§eEnglish")) {
p.getDatabasePlayer().getSettings().setLanguage("EN");
p.closeInventory();
p.sendMessage(msgs.PREFIX() + "§7Language changed to §eenglish");
//p.sendMessage(msgs.PREFIX() + "§7Language changed to §eenglish");
invs.setMainInventory(true);
}
if(e.getCurrentItem().getItemMeta().getDisplayName().equals("§eitaliano")) {
p.getDatabasePlayer().getSettings().setLanguage("IT");
p.closeInventory();
p.sendMessage(msgs.PREFIX() + "§7Da fehlt doch noch was");
//p.sendMessage(msgs.PREFIX() + "§7Da fehlt doch noch was");
invs.setMainInventory(true);
}
}
@ -155,7 +151,7 @@ public class MenuEvents implements Listener {
if (e.getCurrentItem().getType() == Material.RECORD_3) {
p.closeInventory();
p.playSound(p.getEyeLocation(), "records.11", 100000000000.0F, 1.0F);
p.sendActionBar(msgs.Lobby_PLAYING_MUSIC_PREFIX() + ": Milky Way Stars | Janji feat. TR");
//p.sendActionBar(msgs.Lobby_PLAYING_MUSIC_PREFIX() + ": Milky Way Stars | Janji feat. TR");
}
}
if (e.getInventory().getName().equals(invs.getGadgetsInventory().getName())) {
@ -188,8 +184,7 @@ public class MenuEvents implements Listener {
}
}
/*
}if (e.getInventory().getName().equals(invs.getPetsInventory().getName())) {
e.setCancelled(true);
if(e.getCurrentItem().getItemMeta().getDisplayName().contains(msgs.LobbyItems_PETS_PIG())) {
@ -238,11 +233,13 @@ public class MenuEvents implements Listener {
PetManager.removePet(p);
p.sendMessage(msgs.PREFIX() + msgs.Lobby_PET_REMOVE());
}
*/
}else {
e.setCancelled(true);
}
}
}
}
@EventHandler

View File

@ -2,7 +2,6 @@ package eu.univento.lobby.listeners;
import eu.univento.core.Core;
import eu.univento.core.api.events.MoveEventFilter;
import eu.univento.core.api.languages.Messages;
import eu.univento.core.api.player.CustomPlayer;
import eu.univento.lobby.Lobby;
import eu.univento.lobby.utils.PetManager;
@ -29,14 +28,14 @@ public class Parkour implements Listener{
@EventHandler
public void onBlockMove(MoveEventFilter.PlayerBlockMoveEvent e) {
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
Messages msgs = new Messages(p);
//Messages msgs = new Messages(p);
Block block = p.getLocation().subtract(0.0D, 1.0D, 0.0D).getBlock();
if (block.getType() == Material.STAINED_CLAY) {
if (players.contains(p)) {
spawnRandomBlock(block.getLocation());
}else if(p.getLocation().getBlock().getType() == Material.IRON_PLATE) {
players.add(p);
p.sendMessage(msgs.PREFIX() + msgs.Lobby_PARKOUR_ON());
//p.sendMessage(msgs.PREFIX() + msgs.Lobby_PARKOUR_ON());
spawnRandomBlock(block.getLocation());
p.setWalkSpeed(0.2F);
if(PetManager.hasPet(p)) PetManager.removePet(p);
@ -44,7 +43,7 @@ public class Parkour implements Listener{
} else {
if (block.getType() != Material.AIR && players.contains(p) && block.getType() != Material.IRON_PLATE) {
players.remove(p);
p.sendMessage(msgs.PREFIX() + msgs.Lobby_PARKOUR_OFF());
//p.sendMessage(msgs.PREFIX() + msgs.Lobby_PARKOUR_OFF());
}
}
}

View File

@ -1,7 +1,6 @@
package eu.univento.lobby.listeners;
import eu.univento.core.api.gui.AnvilGUI;
import eu.univento.core.api.languages.Messages;
import eu.univento.core.api.player.CustomPlayer;
import eu.univento.lobby.utils.PetManager;
import org.bukkit.Bukkit;
@ -34,27 +33,27 @@ public class PetInteract implements Listener {
}
Inventory getInventory(CustomPlayer p) {
Messages msgs = new Messages(p);
Inventory inv = Bukkit.createInventory(p, 9, msgs.LobbyItems_YOUR_PET());
//Messages msgs = new Messages(p);
Inventory inv = Bukkit.createInventory(p, 9,"Nachricht");
ItemStack name = new ItemStack(Material.NAME_TAG);
ItemMeta nameMeta = name.getItemMeta();
nameMeta.setDisplayName(msgs.LobbyItems_PETS_NAME());
//nameMeta.setDisplayName(msgs.LobbyItems_PETS_NAME());
name.setItemMeta(nameMeta);
ItemStack baby = new ItemStack(Material.SUGAR);
ItemMeta babyMeta = baby.getItemMeta();
babyMeta.setDisplayName(msgs.LobbyItems_PETS_AGE());
//babyMeta.setDisplayName(msgs.LobbyItems_PETS_AGE());
baby.setItemMeta(babyMeta);
ItemStack mount = new ItemStack(Material.SADDLE);
ItemMeta mountMeta = mount.getItemMeta();
mountMeta.setDisplayName(msgs.LobbyItems_PETS_RIDE());
//mountMeta.setDisplayName(msgs.LobbyItems_PETS_RIDE());
mount.setItemMeta(mountMeta);
ItemStack delete = new ItemStack(Material.BARRIER);
ItemMeta deleteMeta = delete.getItemMeta();
deleteMeta.setDisplayName(msgs.LobbyItems_PETS_REMOVE());
//deleteMeta.setDisplayName(msgs.LobbyItems_PETS_REMOVE());
delete.setItemMeta(deleteMeta);
inv.setItem(0, name);
@ -69,7 +68,7 @@ public class PetInteract implements Listener {
public void onInventoryClick(InventoryClickEvent e) {
if (e.getWhoClicked() instanceof Player) {
CustomPlayer p = CustomPlayer.getPlayer(e.getWhoClicked().getName());
Messages msgs = new Messages(p);
//Messages msgs = new Messages(p);
if (e.getInventory().getName().equals(getInventory(p).getName())) {
if (e.getCurrentItem().getType() == Material.NAME_TAG) {
assert p != null;
@ -79,7 +78,6 @@ public class PetInteract implements Listener {
event.setWillClose(true);
event.setWillDestroy(true);
PetManager.setName(p, p.getDatabasePlayer().getRank().getColor() + event.getName());
p.refreshExperience();
}else{
event.setWillDestroy(true);
event.setWillClose(true);
@ -118,7 +116,7 @@ public class PetInteract implements Listener {
if (e.getCurrentItem().getType() == Material.BARRIER) {
p.closeInventory();
PetManager.removePet(p);
p.sendMessage(msgs.PREFIX() + msgs.Lobby_PET_REMOVE());
//p.sendMessage(msgs.PREFIX() + msgs.Lobby_PET_REMOVE());
}
}
}

View File

@ -1,7 +1,6 @@
package eu.univento.lobby.listeners;
import eu.univento.commons.player.Rank;
import eu.univento.core.api.languages.Messages;
import eu.univento.commons.player.rank.Rank;
import eu.univento.core.api.player.CustomPlayer;
import eu.univento.lobby.utils.InventoryManager;
import org.bukkit.Bukkit;
@ -36,20 +35,20 @@ public class PlayerHider implements Listener{
}
private ItemStack getHide(CustomPlayer p) {
Messages msgs = new Messages(p);
//Messages msgs = new Messages(p);
ItemStack hide = new ItemStack(Material.GLOWSTONE_DUST);
ItemMeta hideMeta = hide.getItemMeta();
hideMeta.setDisplayName(msgs.LobbyItems_PLAYER_HIDER_ON());
//hideMeta.setDisplayName(msgs.LobbyItems_PLAYER_HIDER_ON());
hide.setItemMeta(hideMeta);
return hide;
}
private ItemStack getShow(CustomPlayer p) {
Messages msgs = new Messages(p);
//Messages msgs = new Messages(p);
ItemStack show = new ItemStack(Material.SUGAR);
ItemMeta showMeta = show.getItemMeta();
showMeta.setDisplayName(msgs.LobbyItems_PLAYER_HIDER_OFF());
//showMeta.setDisplayName(msgs.LobbyItems_PLAYER_HIDER_OFF());
show.setItemMeta(showMeta);
return show;
@ -58,14 +57,14 @@ public class PlayerHider implements Listener{
@EventHandler
public void onInteract(PlayerInteractEvent e) throws InterruptedException {
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer().getName());
Messages msgs = new Messages(p);
//Messages msgs = new Messages(p);
if(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
ItemStack item = p.getItemInHand();
if(item.getType() == Material.SUGAR) {
hidden.remove(p);
Bukkit.getOnlinePlayers().stream().filter(players -> !silentlobby.contains(players)).forEach(p::showPlayer);
p.sendMessage(msgs.PREFIX() + msgs.Lobby_PLAYERS_SHOW());
//p.sendMessage(msgs.PREFIX() + msgs.Lobby_PLAYERS_SHOW());
p.getInventory().remove(getShow(p));
p.getInventory().addItem(getHide(p));
@ -81,7 +80,7 @@ public class PlayerHider implements Listener{
p.hidePlayer(players);
}
}
p.sendMessage(msgs.PREFIX() + msgs.Lobby_PLAYERS_HIDE());
//p.sendMessage(msgs.PREFIX() + msgs.Lobby_PLAYERS_HIDE());
p.getInventory().remove(getHide(p));
p.getInventory().addItem(getShow(p));
@ -90,13 +89,13 @@ public class PlayerHider implements Listener{
}
if(item.getType() == Material.TNT) {
if(p.getDatabasePlayer().isAllowed(Rank.Partner)) {
if(p.getDatabasePlayer().isAllowed(Rank.VIP)) {
if(silentlobby.contains(p)) {
silentlobby.remove(p);
InventoryManager invs = new InventoryManager(p);
p.getInventory().clear();
invs.setMainInventory(true);
p.sendMessage(msgs.PREFIX() + msgs.Lobby_SILENT_LOBBY_OFF());
//p.sendMessage(msgs.PREFIX() + msgs.Lobby_SILENT_LOBBY_OFF());
for(Player players : Bukkit.getOnlinePlayers()) {
p.showPlayer(players);
if(!hidden.contains(players)) {
@ -105,7 +104,7 @@ public class PlayerHider implements Listener{
}
}else {
silentlobby.add(p);
p.sendMessage(msgs.PREFIX() + msgs.Lobby_SILENT_LOBBY_ON());
//p.sendMessage(msgs.PREFIX() + msgs.Lobby_SILENT_LOBBY_ON());
for(Player players : Bukkit.getOnlinePlayers()) {
p.hidePlayer(players);
players.hidePlayer(p);

View File

@ -31,27 +31,27 @@ public class PlayerInteract implements Listener{
}
private void openInventory(CustomPlayer p, CustomPlayer clicked) {
Inventory inv = Bukkit.createInventory(p, 9, clicked.getDatabasePlayer().getRank().getColor() + clicked.getName() + "'s " + p.getMessages().LobbyItems_PLAYER_MENU());
Inventory inv = Bukkit.createInventory(p, 9, clicked.getDatabasePlayer().getRank().getColor() + clicked.getName() + "'s " + "Player Menu");
ItemStack friend = new ItemStack(Material.PUMPKIN);
ItemMeta friendMeta = friend.getItemMeta();
friendMeta.setDisplayName(p.getMessages().LobbyItems_PLAYER_FRIEND());
//friendMeta.setDisplayName(p.getMessages().LobbyItems_PLAYER_FRIEND());
friend.setItemMeta(friendMeta);
ItemStack party = new ItemStack(Material.FIREWORK);
ItemMeta partyMeta = party.getItemMeta();
partyMeta.setDisplayName(p.getMessages().LobbyItems_PLAYER_PARTY());
//partyMeta.setDisplayName(p.getMessages().LobbyItems_PLAYER_PARTY());
party.setItemMeta(partyMeta);
ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
SkullMeta meta = (SkullMeta) skull.getItemMeta();
meta.setOwner(clicked.getName());
meta.setDisplayName(p.getMessages().LobbyItems_PLAYER_PROFILE());
//meta.setDisplayName(p.getMessages().LobbyItems_PLAYER_PROFILE());
skull.setItemMeta(meta);
ItemStack stats = new ItemStack(Material.GOLD_SWORD);
ItemMeta statsMeta = stats.getItemMeta();
statsMeta.setDisplayName(p.getMessages().LobbyItems_PLAYER_STATS());
//statsMeta.setDisplayName(p.getMessages().LobbyItems_PLAYER_STATS());
stats.setItemMeta(statsMeta);
inv.setItem(0, friend);

View File

@ -1,46 +0,0 @@
package eu.univento.lobby.listeners;
import eu.univento.commons.player.Rank;
import eu.univento.core.api.languages.Messages;
import eu.univento.core.api.player.CustomPlayer;
import eu.univento.lobby.utils.StatusSign;
import eu.univento.lobby.utils.StatusSignManager;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.player.PlayerInteractEvent;
/**
* @author joethei
* @version 1.0
*/
public class StatusSigns implements Listener{
@EventHandler
public void onSignChange(SignChangeEvent e) {
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
if(e.getLine(0).equals("[join]") && p.getDatabasePlayer().isAllowed(Rank.SrDeveloper)) {
StatusSignManager.addSign(e.getLine(1), e.getBlock().getLocation());
Messages msgs = new Messages(p);
p.sendMessage(msgs.Lobby_SET_SIGN());
}
}
@EventHandler
public void onInteract(PlayerInteractEvent e) {
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
if(e.getAction() == Action.RIGHT_CLICK_BLOCK) {
Block block = e.getClickedBlock();
if(block.getType() == Material.WALL_SIGN) {
if(StatusSignManager.isStatusSign(block.getLocation())) {
StatusSign sign = StatusSignManager.getSign(block.getLocation());
assert sign != null;
p.connectToServer(sign.getServerName());
}
}
}
}
}

View File

@ -1,17 +1,17 @@
package eu.univento.lobby.utils;
import eu.univento.commons.player.Rank;
import eu.univento.commons.player.language.Language;
import eu.univento.commons.player.rank.Rank;
import eu.univento.core.api.items.ItemBuilder;
import eu.univento.core.api.player.CustomPlayer;
import eu.univento.core.api.server.ServerInfo;
import eu.univento.commons.server.ServerInfo;
import eu.univento.lobby.Lobby;
import eu.univento.lobby.listeners.FoundItems;
import org.bukkit.Bukkit;
import org.bukkit.DyeColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.SkullMeta;
@ -29,11 +29,13 @@ import java.util.List;
public class InventoryManager {
private CustomPlayer player;
private Language language;
private ItemStack empty = new ItemStack(Material.AIR);
public InventoryManager(CustomPlayer player) {
this.player = player;
this.language = player.getDatabasePlayer().getLanguage();
}
public void setMainInventory(boolean forcetime) {
@ -78,7 +80,7 @@ public class InventoryManager {
timeItem(inv, 8, skull, Sound.ENTITY_CHICKEN_EGG, 40L, false, forcetime);
timeItem(inv, 1, lobby, Sound.ENTITY_CHICKEN_EGG, 60L, false, forcetime);
timeItem(inv, 7, fun, Sound.ENTITY_CHICKEN_EGG, 80L, false, forcetime);
if (player.getDatabasePlayer().isAllowed(Rank.Partner)) {
if (player.getDatabasePlayer().isAllowed(Rank.VIP)) {
timeItem(inv, 5, youtube, Sound.ENTITY_CHICKEN_EGG, 120L, false, forcetime);
timeItem(inv, 3, adventure, Sound.ENTITY_CHICKEN_DEATH, 140L, false, forcetime);
} else {
@ -93,39 +95,13 @@ public class InventoryManager {
* @return Inventory
*/
public Inventory getNavigatorInventory() {
Inventory inv = Bukkit.createInventory(player, 45, player.getMessages().LobbyItems_NAVIGATOR());
Inventory inv = Bukkit.createInventory(player, 45, "Navigator");
inv.setItem(31, new ItemBuilder(Material.FIREWORK_CHARGE).name(language.getWord("Lobby.Menu.Nav.Spawn")).make());
ItemStack spawn = new ItemStack(Material.FIREWORK_CHARGE);
ItemMeta spawnMeta = spawn.getItemMeta();
spawnMeta.setDisplayName(player.getDatabasePlayer().getLanguage().getWord("Lobby.Menu.Nav.Spawn"));
spawnMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
spawn.setItemMeta(spawnMeta);
ItemStack strive = new ItemStack(Material.WOOL, 1, (byte) 11);
ItemMeta striveMeta = strive.getItemMeta();
striveMeta.setDisplayName(player.getDatabasePlayer().getLanguage().getWord("Lobby.Menu.Nav.Strive"));
strive.setItemMeta(striveMeta);
ItemStack hustle = new ItemStack(Material.CHAINMAIL_BOOTS);
ItemMeta hustleMeta = hustle.getItemMeta();
hustleMeta.setDisplayName(player.getDatabasePlayer().getLanguage().getWord("Lobby.Menu.Nav.Hustle"));
hustleMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
hustle.setItemMeta(hustleMeta);
ItemStack build = new ItemStack(Material.FLOWER_POT_ITEM);
ItemMeta buildMeta = build.getItemMeta();
buildMeta.setDisplayName(player.getDatabasePlayer().getLanguage().getWord("Lobby.Menu.Nav.Build"));
ArrayList<String> buildLore = new ArrayList<>();
ServerInfo buildInfo = new ServerInfo("build");
buildLore.add(buildInfo.getOnlinePlayers() + player.getMessages().LobbyItems_PLAYERS_ONLINE());
buildMeta.setLore(buildLore);
build.setItemMeta(buildMeta);
inv.setItem(21, hustle);
inv.setItem(23, strive);
inv.setItem(31, spawn);
if (player.getDatabasePlayer().isAllowed(Rank.Supporter)) inv.setItem(26, build);
if(player.getDatabasePlayer().isAllowed(Rank.Supporter)) {
ServerInfo.getServerInfo("build").whenComplete((serverInfo, throwable) ->
inv.setItem(26, new ItemBuilder(Material.FLOWER_POT_ITEM).name(language.getWord("Lobby.Menu.Nav.Build")).lore(serverInfo.getPlayers() + "Spieler online").make()));
}
return inv;
}
@ -133,25 +109,6 @@ public class InventoryManager {
public Inventory getLobbySwitcherInventory() {
Inventory inv = Bukkit.createInventory(player, 18, "Lobbys");
for (int i = 1; i <= 19; i++) {
ServerInfo info = new ServerInfo("Lobby" + i);
Material material;
if (!info.isOnline()) material = Material.BARRIER;
if (info.getOnlinePlayers() >= 50) material = Material.CHEST;
if (info.getOnlinePlayers() < 50) material = Material.ANVIL;
else material = Material.GRASS;
ItemStack item = new ItemStack(material);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName("Lobby" + i);
ArrayList<String> lore = new ArrayList<>();
lore.add(info.getOnlinePlayers() + " | " + info.getMaxPlayers());
meta.setLore(lore);
item.setItemMeta(meta);
inv.addItem(item);
}
return inv;
}
@ -205,27 +162,27 @@ public class InventoryManager {
* @return Inventory
*/
public Inventory getFunChestInventory() {
Inventory inv = Bukkit.createInventory(player, 45, player.getMessages().LobbyItems_FUN_CHEST());
Inventory inv = Bukkit.createInventory(player, 45, "FunChest");
ItemStack music = new ItemStack(Material.RECORD_3);
ItemMeta musicMeta = music.getItemMeta();
musicMeta.setLore(null);
musicMeta.setDisplayName(player.getMessages().LobbyItems_MUSIC());
//musicMeta.setDisplayName(player.getMessages().LobbyItems_MUSIC());
music.setItemMeta(musicMeta);
ItemStack gadgets = new ItemStack(Material.ARMOR_STAND);
ItemMeta gadgetsMeta = gadgets.getItemMeta();
gadgetsMeta.setDisplayName(player.getMessages().LobbyItems_GADGETS());
//gadgetsMeta.setDisplayName(player.getMessages().LobbyItems_GADGETS());
gadgets.setItemMeta(gadgetsMeta);
ItemStack particle = new ItemStack(Material.NOTE_BLOCK);
ItemMeta particleMeta = particle.getItemMeta();
particleMeta.setDisplayName(player.getMessages().LobbyItems_PARTICLE());
//particleMeta.setDisplayName(player.getMessages().LobbyItems_PARTICLE());
particle.setItemMeta(particleMeta);
ItemStack pets = new ItemStack(Material.MONSTER_EGG);
ItemMeta petsMeta = pets.getItemMeta();
petsMeta.setDisplayName(player.getMessages().LobbyItems_PETS());
//petsMeta.setDisplayName(player.getMessages().LobbyItems_PETS());
pets.setItemMeta(petsMeta);
inv.setItem(11, music);
@ -242,7 +199,7 @@ public class InventoryManager {
* @return Inventory
*/
public Inventory getMusicInventory() {
Inventory inv = Bukkit.createInventory(player, 45, player.getMessages().LobbyItems_MUSIC());
Inventory inv = Bukkit.createInventory(player, 45, "Music");
ItemStack music_3 = new ItemStack(Material.RECORD_3);
@ -254,7 +211,7 @@ public class InventoryManager {
music_3.setItemMeta(music_3Meta);
if (FoundItems.hasFound("music_3")) inv.setItem(2, music_3);
//if (FoundItems.hasFound("music_3")) inv.setItem(2, music_3);
return inv;
}
@ -265,7 +222,7 @@ public class InventoryManager {
* @return Inventory
*/
public Inventory getGadgetsInventory() {
Inventory inv = Bukkit.createInventory(player, 45, player.getMessages().LobbyItems_GADGETS());
Inventory inv = Bukkit.createInventory(player, 45, "Gadgets");
ItemStack sugar = new ItemStack(Material.SUGAR);
ItemMeta sugarMeta = sugar.getItemMeta();
@ -277,8 +234,8 @@ public class InventoryManager {
featherMeta.setDisplayName("§6Federleicht");
feather.setItemMeta(featherMeta);
if (FoundItems.hasFound("sugar")) inv.setItem(0, sugar);
if (FoundItems.hasFound("feather")) inv.setItem(1, feather);
//if (FoundItems.hasFound("sugar")) inv.setItem(0, sugar);
//if (FoundItems.hasFound("feather")) inv.setItem(1, feather);
return inv;
}
@ -289,7 +246,7 @@ public class InventoryManager {
* @return Inventory
*/
public Inventory getParticleInventory() {
Inventory inv = Bukkit.createInventory(player, 45, player.getMessages().LobbyItems_PARTICLE());
Inventory inv = Bukkit.createInventory(player, 45, "Particle");
ItemStack hearts = new ItemStack(Material.RED_ROSE);
ItemMeta heartsMeta = hearts.getItemMeta();
@ -301,38 +258,38 @@ public class InventoryManager {
lavaMeta.setDisplayName("§6Lava");
lava.setItemMeta(lavaMeta);
if (FoundItems.hasFound("hearts")) inv.setItem(0, hearts);
//if (FoundItems.hasFound("hearts")) inv.setItem(0, hearts);
//if(FoundItems.hasFound("lava", player)) inv.setItem(1, lava);
return inv;
}
public Inventory getPetsInventory() {
Inventory inv = Bukkit.createInventory(player, 45, player.getMessages().LobbyItems_PETS());
Inventory inv = Bukkit.createInventory(player, 45, "Pets");
ItemStack pig = new ItemStack(Material.MONSTER_EGG, 1, (short) 90);
ItemMeta pigMeta = pig.getItemMeta();
pigMeta.setDisplayName(player.getMessages().LobbyItems_PETS_PIG());
//pigMeta.setDisplayName(player.getMessages().LobbyItems_PETS_PIG());
pig.setItemMeta(pigMeta);
ItemStack cow = new ItemStack(Material.MONSTER_EGG, 1, (short) 92);
ItemMeta cowMeta = cow.getItemMeta();
cowMeta.setDisplayName(player.getMessages().LobbyItems_PETS_COW());
//cowMeta.setDisplayName(player.getMessages().LobbyItems_PETS_COW());
cow.setItemMeta(cowMeta);
ItemStack chicken = new ItemStack(Material.MONSTER_EGG, 1, (short) 93);
ItemMeta chickenMeta = chicken.getItemMeta();
chickenMeta.setDisplayName(player.getMessages().LobbyItems_PETS_CHICKEN());
//chickenMeta.setDisplayName(player.getMessages().LobbyItems_PETS_CHICKEN());
chicken.setItemMeta(chickenMeta);
ItemStack rabbit = new ItemStack(Material.MONSTER_EGG, 1, (short) 101);
ItemMeta rabbitMeta = rabbit.getItemMeta();
rabbitMeta.setDisplayName(player.getMessages().LobbyItems_PETS_RABBIT());
//rabbitMeta.setDisplayName(player.getMessages().LobbyItems_PETS_RABBIT());
rabbit.setItemMeta(rabbitMeta);
ItemStack mushroom = new ItemStack(Material.MONSTER_EGG, 1, (short) 96);
ItemMeta mushroomMeta = mushroom.getItemMeta();
mushroomMeta.setDisplayName(player.getMessages().LobbyItems_PETS_MUSHROM_COW());
//mushroomMeta.setDisplayName(player.getMessages().LobbyItems_PETS_MUSHROM_COW());
mushroom.setItemMeta(mushroomMeta);
ItemStack horse = new ItemStack(Material.MONSTER_EGG, 1, (short) 101);
@ -347,7 +304,7 @@ public class InventoryManager {
ItemStack delete = new ItemStack(Material.BARRIER);
ItemMeta deleteMeta = delete.getItemMeta();
deleteMeta.setDisplayName(player.getMessages().LobbyItems_PETS_REMOVE());
//deleteMeta.setDisplayName(player.getMessages().LobbyItems_PETS_REMOVE());
delete.setItemMeta(deleteMeta);
inv.setItem(0, pig);
@ -368,11 +325,11 @@ public class InventoryManager {
* @return Inventory
*/
public Inventory getProfileInventory() {
Inventory inv = Bukkit.createInventory(player, 9, player.getMessages().LobbyItems_PROFILE());
Inventory inv = Bukkit.createInventory(player, 9, "Profil");
ItemStack stats = new ItemStack(Material.COMPASS);
ItemMeta statsMeta = stats.getItemMeta();
statsMeta.setDisplayName(player.getMessages().LobbyItems_STATS());
//statsMeta.setDisplayName(player.getMessages().LobbyItems_STATS());
stats.setItemMeta(statsMeta);
ItemStack quests = new ItemStack(Material.PRISMARINE_SHARD);
@ -381,12 +338,12 @@ public class InventoryManager {
ItemStack friends = new ItemStack(Material.PUMPKIN);
ItemMeta friendsMeta = friends.getItemMeta();
friendsMeta.setDisplayName(player.getMessages().LobbyItems_FRIENDS());
//friendsMeta.setDisplayName(player.getMessages().LobbyItems_FRIENDS());
friends.setItemMeta(friendsMeta);
ItemStack settings = new ItemStack(Material.NAME_TAG);
ItemMeta settingsMeta = settings.getItemMeta();
settingsMeta.setDisplayName(player.getMessages().LobbyItems_SETTINGS());
//settingsMeta.setDisplayName(player.getMessages().LobbyItems_SETTINGS());
settings.setItemMeta(settingsMeta);
inv.setItem(0, stats);
@ -404,17 +361,17 @@ public class InventoryManager {
* @return Inventory
*/
public Inventory getSettingsInventory() {
Inventory inv = Bukkit.createInventory(player, 18, player.getMessages().LobbyItems_SETTINGS());
Inventory inv = Bukkit.createInventory(player, 18, "Settings");
ArrayList<String> on = new ArrayList<>();
on.add(player.getMessages().LobbyItems_SETTINGS_ON());
//on.add(player.getMessages().LobbyItems_SETTINGS_ON());
ArrayList<String> off = new ArrayList<>();
off.add(player.getMessages().LobbyItems_SETTINGS_OFF());
//off.add(player.getMessages().LobbyItems_SETTINGS_OFF());
ItemStack fastMenu = new ItemStack(Material.ANVIL);
ItemMeta fastMenuMeta = fastMenu.getItemMeta();
fastMenuMeta.setDisplayName(player.getMessages().LobbyItems_SETTINGS_FASTMENU());
//fastMenuMeta.setDisplayName(player.getMessages().LobbyItems_SETTINGS_FASTMENU());
if (player.getDatabasePlayer().getSettings().hasInventoryAnimationEnabled()) fastMenuMeta.addEnchant(Enchantment.ARROW_DAMAGE, 10, false);
if (player.getDatabasePlayer().getSettings().hasInventoryAnimationEnabled()) fastMenuMeta.setLore(on);
else fastMenuMeta.setLore(off);
@ -422,7 +379,7 @@ public class InventoryManager {
ItemStack teleport = new ItemStack(Material.ENDER_PEARL);
ItemMeta teleportMeta = teleport.getItemMeta();
teleportMeta.setDisplayName(player.getMessages().LobbyItems_SETTINGS_SERVER_TELEPORT());
//teleportMeta.setDisplayName(player.getMessages().LobbyItems_SETTINGS_SERVER_TELEPORT());
if (player.getDatabasePlayer().getSettings().hasTeleportAnimationEnabled()) teleportMeta.addEnchant(Enchantment.ARROW_DAMAGE, 10, false);
if (player.getDatabasePlayer().getSettings().hasTeleportAnimationEnabled()) teleportMeta.setLore(on);
else fastMenuMeta.setLore(off);
@ -430,7 +387,7 @@ public class InventoryManager {
ItemStack requestsParty = new ItemStack(Material.FIREWORK);
ItemMeta requestsPartyMeta = requestsParty.getItemMeta();
requestsPartyMeta.setDisplayName(player.getMessages().LobbyItems_SETTINGS_PARTY_REQUESTS());
//requestsPartyMeta.setDisplayName(player.getMessages().LobbyItems_SETTINGS_PARTY_REQUESTS());
if (player.getDatabasePlayer().getSettings().hasPartyRequestsEnabled()) requestsPartyMeta.addEnchant(Enchantment.ARROW_DAMAGE, 10, false);
if (player.getDatabasePlayer().getSettings().hasPartyRequestsEnabled()) requestsPartyMeta.setLore(on);
else requestsPartyMeta.setLore(off);
@ -438,7 +395,7 @@ public class InventoryManager {
ItemStack requestsFriends = new ItemStack(Material.PUMPKIN);
ItemMeta requestsFriendsMeta = requestsFriends.getItemMeta();
requestsFriendsMeta.setDisplayName(player.getMessages().LobbyItems_SETTINGS_FRIEND_REQUESTS());
//requestsFriendsMeta.setDisplayName(player.getMessages().LobbyItems_SETTINGS_FRIEND_REQUESTS());
if (player.getDatabasePlayer().getSettings().hasFriendRequestsEnabled()) requestsFriendsMeta.addEnchant(Enchantment.ARROW_DAMAGE, 10, false);
if (player.getDatabasePlayer().getSettings().hasFriendRequestsEnabled()) requestsFriendsMeta.setLore(on);
else requestsFriendsMeta.setLore(off);
@ -454,7 +411,7 @@ public class InventoryManager {
ItemStack chat = new ItemStack(Material.SIGN);
ItemMeta chatMeta = chat.getItemMeta();
chatMeta.setDisplayName(player.getMessages().LobbyItems_SETTINGS_CHATSOUNDS());
//chatMeta.setDisplayName(player.getMessages().LobbyItems_SETTINGS_CHATSOUNDS());
if (player.getDatabasePlayer().getSettings().hasChatSoundsEnabled()) chatMeta.addEnchant(Enchantment.ARROW_DAMAGE, 10, false);
if (player.getDatabasePlayer().getSettings().hasChatSoundsEnabled()) chatMeta.setLore(on);
else chatMeta.setLore(off);
@ -462,7 +419,7 @@ public class InventoryManager {
ItemStack effects = new ItemStack(Material.BLAZE_POWDER);
ItemMeta effectsMeta = effects.getItemMeta();
effectsMeta.setDisplayName(player.getMessages().LobbyItems_SETTINGS_EFFECTS());
//effectsMeta.setDisplayName(player.getMessages().LobbyItems_SETTINGS_EFFECTS());
if (player.getDatabasePlayer().getSettings().hasEffectsEnabled()) effectsMeta.addEnchant(Enchantment.ARROW_DAMAGE, 10, false);
if (player.getDatabasePlayer().getSettings().hasEffectsEnabled()) effectsMeta.setLore(on);
else effectsMeta.setLore(off);
@ -478,7 +435,7 @@ public class InventoryManager {
ItemStack languages = new ItemStack(Material.BOOK);
ItemMeta languagesMeta = languages.getItemMeta();
languagesMeta.setDisplayName(player.getMessages().LobbyItems_SETTINGS_LANGUAGES());
//languagesMeta.setDisplayName(player.getMessages().LobbyItems_SETTINGS_LANGUAGES());
languages.setItemMeta(languagesMeta);
@ -496,7 +453,7 @@ public class InventoryManager {
}
public Inventory getLanguagesInventory() {
Inventory inv = Bukkit.createInventory(player, 9, player.getMessages().LobbyItems_SETTINGS_LANGUAGES());
Inventory inv = Bukkit.createInventory(player, 9, "Languages");
ItemStack de = new ItemStack(Material.PAPER);
ItemMeta deMeta = de.getItemMeta();
@ -529,7 +486,7 @@ public class InventoryManager {
* @return Inventory
*/
public Inventory getFriendsInventory() {
Inventory inv = Bukkit.createInventory(player, 45, player.getMessages().LobbyItems_FRIENDS());
Inventory inv = Bukkit.createInventory(player, 45, "Friens");
/**
ArrayList<UUID> list = player.getFriends();
@ -549,7 +506,7 @@ public class InventoryManager {
}
public Inventory getStatsInventory() {
Inventory inv = Bukkit.createInventory(player, 45, player.getMessages().LobbyItems_STATS());
Inventory inv = Bukkit.createInventory(player, 45, "stats");
return inv;
}

View File

@ -1,6 +1,5 @@
package eu.univento.lobby.utils;
import eu.univento.core.api.languages.Messages;
import eu.univento.core.api.player.CustomPlayer;
import org.bukkit.scoreboard.DisplaySlot;
import org.bukkit.scoreboard.Objective;
@ -14,37 +13,31 @@ import org.bukkit.scoreboard.Scoreboard;
public class Scoreboards {
public static void updateScoreboard(CustomPlayer p) {
Messages msgs = p.getMessages();
//Messages msgs = p.getMessages();
Scoreboard board = p.getScoreboard();
if(board.getObjective("Lobby") != null) board.getObjective("Lobby").unregister();
Objective obj = board.registerNewObjective("Lobby", "dummy");
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
obj.setDisplayName(msgs.TAB_PREFIX());
//obj.setDisplayName(msgs.TAB_PREFIX());
Score empty = obj.getScore(" ");
empty.setScore(13);
Score coinsMsg = obj.getScore(msgs.LobbyBoard_COINS());
coinsMsg.setScore(12);
//Score coinsMsg = obj.getScore(msgs.LobbyBoard_COINS());
//coinsMsg.setScore(12);
Score coins = obj.getScore("§7" + p.getDatabasePlayer().getCoins());
coins.setScore(11);
//Score coins = obj.getScore("§7" + p.getDatabasePlayer().getCoins());
//coins.setScore(11);
Score empty1 = obj.getScore(" ");
empty1.setScore(10);
Score foundMsg = obj.getScore(msgs.LobbyBoard_FOUND_SECRETS());
foundMsg.setScore(9);
Score found = obj.getScore("§7" + p.getDatabasePlayer().getSecrets());
found.setScore(8);
Score empty2 = obj.getScore(" ");
empty2.setScore(7);
Score forumMsg = obj.getScore(msgs.LobbyBoard_FORUM());
forumMsg.setScore(6);
//Score forumMsg = obj.getScore(msgs.LobbyBoard_FORUM());
//forumMsg.setScore(6);
Score forum = obj.getScore("§7forum.univento.eu");
forum.setScore(5);
@ -52,8 +45,8 @@ public class Scoreboards {
Score empty3 = obj.getScore(" ");
empty3.setScore(4);
Score tsMsg = obj.getScore(msgs.LobbyBoard_TS());
tsMsg.setScore(3);
//Score tsMsg = obj.getScore(msgs.LobbyBoard_TS());
//tsMsg.setScore(3);
Score ts = obj.getScore("§7ts.univento.eu");
ts.setScore(2);

View File

@ -1,90 +0,0 @@
package eu.univento.lobby.utils;
import eu.univento.core.api.server.ServerInfo;
import org.bukkit.DyeColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
/**
* @author joethei
* @version 1.0
*/
public class StatusSign {
String name;
Location loc;
public StatusSign(String name, Location loc) {
this.name = name;
this.loc = loc;
}
public void update() {
ServerInfo info = new ServerInfo(this.name);
Block block = loc.getBlock();
if(block.getType() == Material.WALL_SIGN) {
Sign sign = (Sign) block.getState();
org.bukkit.material.Sign s = (org.bukkit.material.Sign) block.getState().getData();
Block behind = block.getRelative(s.getAttachedFace());
if(info.isOnline()) {
if(info.getMotd().contains("Ingame")) {
sign.setLine(0, "§8-§6*§8-");
sign.setLine(1, "§6" + info.getName());
sign.setLine(2, "§e" + info.getOnlinePlayers() + "§8/§6" + info.getMaxPlayers());
sign.setLine(3, "§6Ingame");
sign.update();
behind.setData(DyeColor.CYAN.getWoolData());
}
else if(info.getMotd().contains("Lobby")) {
if(info.getMaxPlayers() >= info.getOnlinePlayers()) {
sign.setLine(0, "§8-§2*§8-");
sign.setLine(1, "§a" + info.getName());
sign.setLine(2, "§a" + info.getOnlinePlayers() + "§8/§2" + info.getMaxPlayers());
sign.setLine(3, "§aLobby");
sign.update();
behind.setData(DyeColor.LIME.getWoolData());
}else{
sign.setLine(0, "§8-§6*§8-");
sign.setLine(1, "§7" + info.getName());
sign.setLine(2, "§a" + info.getOnlinePlayers() + "§8/§3" + info.getMaxPlayers());
sign.setLine(3, "§aLobby");
sign.update();
behind.setData(DyeColor.YELLOW.getWoolData());
}
}
else if(info.getMotd().contains("Restart")) {
sign.setLine(0, "§8-§6*§8-");
sign.setLine(1, "§cRestart");
sign.setLine(2, "§c" + info.getName());
sign.setLine(3, "§8-§6*§8-");
sign.update();
behind.setData(DyeColor.ORANGE.getWoolData());
}else{
sign.setLine(0, "§8-§6*§8-");
sign.setLine(1, "§6" + info.getName());
sign.setLine(2, "§e" + info.getOnlinePlayers() + "§8/§6" + info.getMaxPlayers());
sign.setLine(3, "§8-§6*§8-");
sign.update();
behind.setData(DyeColor.GREEN.getWoolData());
}
}else {
sign.setLine(0, "§8-§6*§8-");
sign.setLine(1, "§4Offline");
sign.setLine(2, "§e" + info.getName());
sign.setLine(3, "§8-§6*§8-");
sign.update();
behind.setData(DyeColor.RED.getWoolData());
}
}
}
public Location getLocation() {
return loc;
}
public String getServerName() {
return name;
}
}

View File

@ -1,101 +0,0 @@
package eu.univento.lobby.utils;
import eu.univento.lobby.Lobby;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
/**
* @author joethei
* @version 1.0
*/
public class StatusSignManager {
static File file = new File("plugins/Core", "signs.yml");
static FileConfiguration cfg = YamlConfiguration.loadConfiguration(file);
static ArrayList<StatusSign> signs = new ArrayList<>();
public static StatusSign getSign(String name) {
for(StatusSign sign : signs) {
if(sign.getServerName().equals(name)) {
return sign;
}
}
return null;
}
public static StatusSign getSign(Location loc) {
for(StatusSign sign : signs) {
if(sign.getLocation().equals(loc)) {
return sign;
}
}
return null;
}
public static boolean isStatusSign(Location loc) {
return getSign(loc) != null;
}
public static void addSign(String name, Location loc) {
StatusSign sign = new StatusSign(name, loc);
signs.add(sign);
}
public static void removeSign(String name) {
signs.remove(getSign(name));
}
public static void updateSigns() {
Bukkit.getScheduler().scheduleSyncRepeatingTask(Lobby.getInstance(), () -> signs.forEach(StatusSign::update), 20 * 20L, 5L);
}
public static void saveSigns() {
for(String key : cfg.getKeys(false)){
cfg.set(key,null);
}
for(StatusSign sign : signs) {
cfg.set("Sign." + sign.getServerName() + ".World", sign.getLocation().getWorld().getName());
cfg.set("Sign." + sign.getServerName() + ".X", sign.getLocation().getX());
cfg.set("Sign." + sign.getServerName() + ".Y", sign.getLocation().getY());
cfg.set("Sign." + sign.getServerName() + ".Z", sign.getLocation().getZ());
}
try {
cfg.save(file);
} catch (IOException e) {
e.printStackTrace();
}
}
public static void loadSigns() {
for(String key : cfg.getConfigurationSection("Sign").getKeys(false)) {
String world = cfg.getString("Sign." + key + ".World");
double x = cfg.getDouble("Sign." + key + ".X");
double y = cfg.getDouble("Sign." + key + ".Y");
double z = cfg.getDouble("Sign." + key + ".Z");
Location loc = new Location(Bukkit.getWorld(world), x, y, z);
addSign(key, loc);
}
}
public void loadSign(String name) {
if(cfg.contains("Sign." + name)) {
String world = cfg.getString("Sign." + name + ".World");
double x = cfg.getDouble("Sign." + name + ".X");
double y = cfg.getDouble("Sign." + name + ".Y");
double z = cfg.getDouble("Sign." + name + ".Z");
Location loc = new Location(Bukkit.getWorld(world), x, y, z);
if(!isStatusSign(loc)) {
addSign(name, loc);
}
}
}
}