diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..5150601 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,8 @@ +image: maven:3-jdk-8 + +build: + script: "mvn clean install deploy --settings .gitlab/settings.xml" + artifacts: + name: "Core" + paths: + - "target/*.jar" \ No newline at end of file diff --git a/.gitlab/settings.xml b/.gitlab/settings.xml new file mode 100644 index 0000000..8093b52 --- /dev/null +++ b/.gitlab/settings.xml @@ -0,0 +1,18 @@ + + + + univentoEU + download + ${env.password} + + + + + + univentoEU + univentoEU Mirror Repo + http://play.univento.eu:8081/repository/public/ + * + + + \ No newline at end of file diff --git a/Core.iml b/Core.iml index 5039352..1dacef9 100644 --- a/Core.iml +++ b/Core.iml @@ -66,17 +66,16 @@ + + - - - - + diff --git a/pom.xml b/pom.xml index 52e5d39..c27db09 100644 --- a/pom.xml +++ b/pom.xml @@ -56,7 +56,7 @@ univentoEU - http://dev.joethei.de:8081/repository/univento-repo/ + http://play.univento.eu:8081/repository/univento/ diff --git a/src/main/java/eu/univento/core/Core.java b/src/main/java/eu/univento/core/Core.java index 62bbf50..859b6ab 100644 --- a/src/main/java/eu/univento/core/Core.java +++ b/src/main/java/eu/univento/core/Core.java @@ -2,18 +2,16 @@ package eu.univento.core; import eu.univento.commons.Commons; import eu.univento.commons.server.TPS; -import eu.univento.core.antihack.AntiHack; import eu.univento.core.api.Config; import eu.univento.core.api.effects.Blackscreen; import eu.univento.core.api.events.MoveEventFilter; import eu.univento.core.api.items.InventoryManager; import eu.univento.core.api.player.CustomPlayer; -import eu.univento.core.api.server.NetworkData; import eu.univento.core.api.server.ServerSettings; +import eu.univento.core.api.update.PluginUpdater; import eu.univento.core.api.utils.NettyInjection; import eu.univento.core.commands.*; import eu.univento.core.listeners.*; -import io.netty.channel.Channel; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -70,28 +68,6 @@ public class Core extends JavaPlugin implements NettyInjection.PacketHandler { return list; } - /* - @Override - public void onLoad() { - Updater updater = new Updater("https://development.univento.eu/files/Core.json", "Core", "1.2.6"); - if(updater.needsUpdate()) { - commons.getLoggingHandler().getCore().info("Downloading update"); - if(!updater.delete()) { - commons.getLoggingHandler().getCore().error("Failed deleting old file, retry"); - getServer().spigot().restart(); - }else{ - commons.getLoggingHandler().getCore().info("New version, updating"); - Bukkit.getPluginManager().disablePlugin(this); - if(!updater.download()) { - commons.getLoggingHandler().getCore().error("error while downloading new version"); - }else{ - getServer().spigot().restart(); - } - } - } - } - */ - @Override public void onEnable() { commons = new Commons(); @@ -143,7 +119,7 @@ public class Core extends JavaPlugin implements NettyInjection.PacketHandler { new Fix(this, "fix", "fix your self or other players"); new Nick(this, "nick", "nick/unnick your self"); } - AntiHack.registerListeners(); + //AntiHack.registerListeners(); new RunAs(this, "RunAs", "run commands as other players"); new SystemInfo(this, "SystemInfo", "gives info about the server system"); @@ -156,11 +132,8 @@ public class Core extends JavaPlugin implements NettyInjection.PacketHandler { new Hologram(this, "hologram", "manages holograms"); PluginMessenger pluginMessenger = new PluginMessenger(); - NetworkData networkData = new NetworkData(); Bukkit.getMessenger().registerOutgoingPluginChannel(this, "5zig_Set"); Bukkit.getMessenger().registerIncomingPluginChannel(this, "5zig_Set", pluginMessenger); - Bukkit.getMessenger().registerOutgoingPluginChannel(this, "BungeeCord"); - Bukkit.getMessenger().registerIncomingPluginChannel(this, "BungeeCord", networkData); Bukkit.getMessenger().registerOutgoingPluginChannel(this, "LABYMOD"); Bukkit.getMessenger().registerIncomingPluginChannel(this, "WDL|INIT", pluginMessenger); Bukkit.getMessenger().registerOutgoingPluginChannel(this, "WDL|CONTROL"); @@ -190,7 +163,7 @@ public class Core extends JavaPlugin implements NettyInjection.PacketHandler { } } }, 5L); - */ + this.injection = new NettyInjection(this, this.getName()); this.injection.addHandler("TIMEOUT", new NettyInjection.PacketHandler() { public Object onPacketIn(Player sender, Channel channel, Object packet) { @@ -206,7 +179,7 @@ public class Core extends JavaPlugin implements NettyInjection.PacketHandler { return packet; } }); - /* + commons.getSecurityHandler().isValidServer(getServer().getIp(), aBoolean -> { if(!aBoolean) { getServer().shutdown(); @@ -222,7 +195,7 @@ public class Core extends JavaPlugin implements NettyInjection.PacketHandler { Bukkit.getMessenger().unregisterIncomingPluginChannel(this); Bukkit.getMessenger().unregisterOutgoingPluginChannel(this); - this.injection.disable(); + //this.injection.disable(); commons.getLoggingHandler().getCore().info("\n" + "\n" + @@ -251,6 +224,7 @@ public class Core extends JavaPlugin implements NettyInjection.PacketHandler { " \n" + " \n" + "\nd"); + new PluginUpdater("Core").update(); } } \ No newline at end of file diff --git a/src/main/java/eu/univento/core/api/items/InventoryManager.java b/src/main/java/eu/univento/core/api/items/InventoryManager.java index 212d138..a4c2b5f 100644 --- a/src/main/java/eu/univento/core/api/items/InventoryManager.java +++ b/src/main/java/eu/univento/core/api/items/InventoryManager.java @@ -83,6 +83,7 @@ public class InventoryManager implements Listener{ public void onQuit(PlayerQuitEvent e) { int i = 0; CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer()); + if(inventoryList == null) return; for(ClickInventory inventory : inventoryList) { if(inventory.getPlayer() == p) { if(inventory.isInUse()) inventory.closeInventory(false); diff --git a/src/main/java/eu/univento/core/api/languages/Language.java b/src/main/java/eu/univento/core/api/languages/Language.java deleted file mode 100644 index cee0b7a..0000000 --- a/src/main/java/eu/univento/core/api/languages/Language.java +++ /dev/null @@ -1,24 +0,0 @@ -package eu.univento.core.api.languages; - -import java.util.HashMap; -import java.util.Locale; -import java.util.Map; -import java.util.ResourceBundle; - -public class Language { - - - private final ResourceBundle translation; - - public Language(String language) { - Map languages = new HashMap<>(); - languages.put("DE", Locale.GERMAN); - languages.put("EN", Locale.ENGLISH); - languages.put("IT", Locale.ITALIAN); - translation = ResourceBundle.getBundle("language", languages.get(language)); - } - - public String getWord(String keyword) { - return translation.getString(keyword); - } -} \ No newline at end of file diff --git a/src/main/java/eu/univento/core/api/languages/Language_DE.java b/src/main/java/eu/univento/core/api/languages/Language_DE.java deleted file mode 100644 index e235a78..0000000 --- a/src/main/java/eu/univento/core/api/languages/Language_DE.java +++ /dev/null @@ -1,557 +0,0 @@ -package eu.univento.core.api.languages; - -import eu.univento.commons.player.Rank; -import eu.univento.core.api.player.CustomPlayer; - -/** - * @author joethei - * @version 1.0 - */ - -class Language_DE implements Languages{ - - @Override - public String UNKNOWN_ERROR() { - return "§cEs ist ein unbekannter Fehler aufgetreten"; - } - - @Override - public String NO_PERMS() { - return "§cDu hast keine Berechtigung diesen Befehl auszuführen"; - } - - @Override - public String ERROR() { - return "§cFehler: "; - } - - @Override - public String NOT_ONLINE(String name) { - return "§7" + name + " ist §cnicht §7online"; - } - - @Override - public String KICK_RESTART() { - return "§cDer Server wurde neu gestartet"; - } - - @Override - public String KICK_FULL() { - return "§cDieser Server ist bereits voll"; - } - - @Override - public String COMMAND_NOT_FOUND() { - return "§cDieser Befehl konnte nicht gefunden werden"; - } - - @Override - public String Core_FIX_OWN() { - return "§7Du wurdest §egefixt"; - } - - @Override - public String Core_FIX_OTHER(CustomPlayer p) { - return "§7Du hast " + p.getDisplayName() + " §egefixt"; - } - - @Override - public String Core_FIX_BY_OTHER(CustomPlayer p) { - return "§7Du wurdest von " + p.getDisplayName() + " §egefixt"; - } - - @Override - public String Core_NICK_ON() { - return "§7Du hast einen §eNicknamen §7zugewiesen bekommen"; - } - - @Override - public String Core_NICK_OFF() { - return "§7Du hast nun §ckeinen §eNicknamen §7mehr"; - } - - @Override - public String Core_BUILD_ON() { - return "§7Du hast den Baumodus §abetreten"; - } - - @Override - public String Core_BUILD_OFF() { - return "§7Du hast den Baumodus §cverlassen"; - } - - @Override - public String Core_BAN_NO_REASON() { - return "§cDieser Grund exsistiert nicht"; - } - - @Override - public String Core_BAN_USAGE() { - return "§cNutze "; - } - - @Override - public String Core_BAN_BANNED(CustomPlayer p) { - return "§7Du hast " + p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + " §cgebannt"; - } - - @Override - public String Core_GM_USAGE() { - return "§7Nutze §e/gm <0 | 1 | 2 | 3>"; - } - - @Override - public String Core_GM_CHANGED() { - return "§7Dein Spielmodus wurde §ageändert"; - } - - @Override - public String Core_GLOBALMUTE_ON() { - return "§7Der Server wurde §cstumm gestellt"; - } - - @Override - public String Core_GLOBALMUTE_OFF() { - return "§7Der Server wurde §asozial §7gestellt"; - } - - @Override - public String Core_RUNAS_USAGE() { - return "§cFühre /runas "; - } - - @Override - public String Core_RUNAS_RUN(CustomPlayer p) { - return "§7Der Spieler " + p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + " §7hat deinen Befehl §eerfolgreich §7ausgeführt"; - } - - @Override - public String Core_SETRANK_USAGE() { - return "§cNutze /setrank "; - } - - @Override - public String Core_SETRANK_KICK() { - return "\n§aDu hast nun einen neuen Rang.§e\nBitte joine neu§7."; - } - - @Override - public String Core_SETRANK_NO_RANK() { - return "§cDieser Rang exsistiert nicht"; - } - - @Override - public String Core_SETRANK_SET(CustomPlayer p, Rank rank) { - return "§7Du hast dem Spieler " + p.getDisplayName() + " auf §e" + rank.toString() + " §7gesetzt"; - } - @Override - public String Core_TS_ALLREADY_VERIFIED() { - return "§cDu hast bereits einen verifizierten Account"; - } - - @Override - public String Core_TS_VERIFIED() { - return "§7Du hast deinen Account §eerfolgreich §7verifiziert"; - } - - @Override - public String Core_VANISH_ON() { - return "§7Du bist nun §aunsichtbar"; - } - - @Override - public String Core_VANISH_OFF() { - return "§7Du bist nun wieder §csichtbar"; - } - - @Override - public String Core_SERVER_MUTED() { - return "§7Der Chat ist bis auf weiteres §cgesperrt"; - } - - @Override - public String Core_CHAT_CLEARED(CustomPlayer p) { - return "§7Der Chat wurde von " + p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + " §cgereinigt"; - } - - @Override - public String Core_TAB_TITLE() { - return "§7Du spielst auf §e"; - } - - @Override - public String Lobby_PLAYERS_HIDE() { - return "§7Du kannst nun §ckeine §7Spieler mehr sehen"; - } - - @Override - public String Lobby_PLAYERS_SHOW() { - return "§7Du kannst nun §aalle §7Spieler sehen"; - } - - @Override - public String Lobby_AUTONICK_ON() { - return "§7Du §aerhälst §7nun einen automatischen §eNicknamen"; - } - - @Override - public String Lobby_AUTONICK_OFF() { - return "§7Du hast nun §ckeinen §7automatischen §eNicknamen §7mehr"; - } - - @Override - public String Lobby_FORCEFIELD_ON() { - return "§7Du hast das §eSchutzschild §aaktiviert"; - } - - @Override - public String Lobby_FORCEFIELD_OFF() { - return "§7Du hast das §eSchutzschild §cdeaktiviert"; - } - - @Override - public String Lobby_SILENT_LOBBY_ON() { - return "§7Du hast die §eSilent-Lobby §abetreten"; - } - - @Override - public String Lobby_SILENT_LOBBY_OFF() { - return "§7Du hast die §eSilent-Lobby §cverlassen"; - } - - @Override - public String Lobby_PLAYING_MUSIC_PREFIX() { - return "§6Jetzt spielt: "; - } - - @Override - public String Lobby_FOUND_ITEM_PREFIX() { - return "§7Du hast etwas §egefunden"; - } - - @Override - public String Lobby_SET_LOCATION() { - return "§aPosition wurde gesetzt"; - } - - @Override - public String Lobby_SET_LOCATION_USAGE() { - return "§cNutze /setloc "; - } - - @Override - public String Lobby_DROP_ITEM_USAGE() { - return "§cNutze /dropitem "; - } - - @Override - public String Lobby_DROP_ITEM() { - return "§aDu hast ein Item gelegt"; - } - - @Override - public String Lobby_SET_SIGN() { - return "§aNeues Status Schild erstellt"; - } - - @Override - public String Lobby_JOIN_TITLE_1() { - return "§6univento§7.§eeu"; - } - - @Override - public String Lobby_JOIN_TITLE_2() { - return "§cIch putze hier nur"; - } - - @Override - public String Lobby_PET_ADD() { - return "§7Du hast nun ein §eHaustier"; - } - - @Override - public String Lobby_PET_REMOVE() { - return "§7Du hast nun §ckein §eHaustier §7mehr"; - } - - @Override - public String Lobby_PARKOUR_ON() { - return "§7Du hast den §eParkourmodus §abetreten"; - } - - @Override - public String Lobby_PARKOUR_OFF() { - return "§7Du hast den §eParkourmodus §cverlassen"; - } - - @Override - public String LobbyItems_NAVIGATOR() { - return "§eNavigator"; - } - - @Override - public String LobbyItems_PLAYER_HIDER_ON() { - return "§cSpieler verstecken"; - } - - @Override - public String LobbyItems_PLAYER_HIDER_OFF() { - return "§aSpieler anzeigen"; - } - - @Override - public String LobbyItems_AUTO_NICK() { - return "§5AutoNick"; - } - - @Override - public String LobbyItems_SILENT_LOBBY() { - return "§cSilent-Lobby"; - } - - @Override - public String LobbyItems_FORCEFIELD() { - return "§aSchutzschild"; - } - - @Override - public String LobbyItems_FUN_CHEST() { - return "§cF§aU§eN§3Chest"; - } - - @Override - public String LobbyItems_PROFILE() { - return "§eDein Profil"; - } - - @Override - public String LobbyItems_YOUTUBER() { - return "§5Youtuber Funktionen"; - } - - @Override - public String LobbyItems_SUGGESTION() { - return "§6Vorschläge"; - } - - @Override - public String LobbyItems_SPAWN() { - return "§6Spawn"; - } - - @Override - public String LobbyItems_PREMIUMHUB() { - return "§6Premium Lobby"; - } - - @Override - public String LobbyItems_MAYA() { - return "§6Maya"; - } - - @Override - public String LobbyItems_WOOLGET() { - return "§6WoolGet"; - } - - @Override - public String LobbyItems_BUILDSERVER() { - return "§aBau-Server"; - } - - @Override - public String LobbyItems_PLAYERS_ONLINE() { - return " §6Spieler online"; - } - - @Override - public String LobbyItems_GADGETS() { - return "§6Gadgets"; - } - - @Override - public String LobbyItems_MUSIC() { - return "§6Musik"; - } - - @Override - public String LobbyItems_PARTICLE() { - return "§6Partikel"; - } - - @Override - public String LobbyItems_PETS() { - return "§6Haustiere"; - } - - @Override - public String LobbyItems_YOUR_PET() { - return "§6Dein Haustier"; - } - - @Override - public String LobbyItems_PETS_NAME() { - return "§6Namen ändern"; - } - - @Override - public String LobbyItems_PETS_AGE() { - return "§6Alter ändern"; - } - - @Override - public String LobbyItems_PETS_RIDE() { - return "§6Reiten"; - } - - @Override - public String LobbyItems_PETS_REMOVE() { - return "§6Haustier entfernen"; - } - - @Override - public String LobbyItems_PETS_PIG() { - return "§6Schwein"; - } - - @Override - public String LobbyItems_PETS_COW() { - return "§6Kuh"; - } - - @Override - public String LobbyItems_PETS_CHICKEN() { - return "§6Hühnchen"; - } - - @Override - public String LobbyItems_PETS_RABBIT() { - return "§6Hase"; - } - - @Override - public String LobbyItems_PETS_MUSHROM_COW() { - return "§6Pilzkuh"; - } - - @Override - public String LobbyItems_PLAYER_MENU() { - return " Menü"; - } - - @Override - public String LobbyItems_PLAYER_FRIEND() { - return "§6Freundschaftsanfrage senden"; - } - - @Override - public String LobbyItems_PLAYER_PARTY() { - return "§6Party Anfrage senden"; - } - - @Override - public String LobbyItems_PLAYER_PROFILE() { - return "§6Profil"; - } - - @Override - public String LobbyItems_PLAYER_STATS() { - return "§6Statistiken"; - } - - @Override - public String LobbyItems_STATS() { - return "§6Deine Statistiken"; - } - - @Override - public String LobbyItems_FRIENDS() { - return "§6Freunde"; - } - - @Override - public String LobbyItems_SETTINGS() { - return "§eEinstellungen"; - } - - @Override - public String LobbyItems_SETTINGS_FASTMENU() { - return "§6Inventar Animation"; - } - - @Override - public String LobbyItems_SETTINGS_SERVER_TELEPORT() { - return "§6Server-Teleport"; - } - - @Override - public String LobbyItems_SETTINGS_PARTY_REQUESTS() { - return "§6Party Anfragen"; - } - - @Override - public String LobbyItems_SETTINGS_FRIEND_REQUESTS() { - return "§6Freundschafts Anfragen"; - } - - @Override - public String LobbyItems_SETTINGS_CHATSOUNDS() { - return "§6Chat Geräusche"; - } - - @Override - public String LobbyItems_SETTINGS_EFFECTS() { - return "§6Effekte"; - } - - @Override - public String LobbyItems_SETTINGS_LANGUAGES() { - return "§6Sprachen"; - } - - @Override - public String LobbyItems_SETTINGS_ON() { - return "§aaktiviert"; - } - - @Override - public String LobbyItems_SETTINGS_OFF() { - return "§cdeaktiviert"; - } - - @Override - public String LobbyItems_BACK() { - return "§cZurück"; - } - - @Override - public String LobbyBoard_FOUND_SECRETS() { - return "§eVerstecke§7:"; - } - - @Override - public String LobbyBoard_COINS() { - return "§eDeine Coins§7:"; - } - - @Override - public String LobbyBoard_TS() { - return "§eTeamSpeak§7:"; - } - - @Override - public String LobbyBoard_FORUM() { - return "§eForum§7:"; - } - - @Override - public String LobbyBoard_NEW() { - return "§e§lJetzt neu:"; - } - - @Override - public String LobbyBoard_NEWS() { - return "Scheibenwischer"; - } - -} \ No newline at end of file diff --git a/src/main/java/eu/univento/core/api/languages/Language_EN.java b/src/main/java/eu/univento/core/api/languages/Language_EN.java deleted file mode 100644 index 68dbb77..0000000 --- a/src/main/java/eu/univento/core/api/languages/Language_EN.java +++ /dev/null @@ -1,556 +0,0 @@ -package eu.univento.core.api.languages; - -import eu.univento.commons.player.Rank; -import eu.univento.core.api.player.CustomPlayer; - -/** - * @author joethei - * @version 0.1 - */ -public class Language_EN implements Languages{ - - @Override - public String UNKNOWN_ERROR() { - return "§cEs ist ein unbekannter Fehler aufgetreten"; - } - - @Override - public String NO_PERMS() { - return "§cYou're not allowed do use this commons"; - } - - @Override - public String ERROR() { - return "§cERROR: "; - } - - @Override - public String NOT_ONLINE(String name) { - return "§7" + name + " is §cnot §7online"; - } - - @Override - public String KICK_RESTART() { - return "§cThe server has been restarted"; - } - - @Override - public String KICK_FULL() { - return "§cThe server is full"; - } - - @Override - public String COMMAND_NOT_FOUND() { - return "§cThis commons hasn't been found."; - } - - @Override - public String Core_FIX_OWN() { - return "§7You were §efixed"; - } - - @Override - public String Core_FIX_OTHER(CustomPlayer p) { - return "§7You §efixed " + p.getDisplayName(); - } - - @Override - public String Core_FIX_BY_OTHER(CustomPlayer p) { - return "§7You've been §efixed §7by " + p.getDisplayName(); - } - - @Override - public String Core_NICK_ON() { - return "§7You got a §enickname"; - } - - @Override - public String Core_NICK_OFF() { - return "§7Now you have §cno more keinen §enickname"; - } - - @Override - public String Core_BUILD_ON() { - return "§7You've §ajoined §7the building-mode"; - } - - @Override - public String Core_BUILD_OFF() { - return "§7You've §cleft §7the building-mode"; - } - - @Override - public String Core_BAN_NO_REASON() { - return "§cThis reason doesn't exist"; - } - - @Override - public String Core_BAN_USAGE() { - return "§cUse "; - } - - @Override - public String Core_BAN_BANNED(CustomPlayer p) { - return "§7You've §cbanned " + p.getDatabasePlayer().getRank().getColor() + p.getDisplayName(); - } - - @Override - public String Core_GM_USAGE() { - return "§7Use §e/gm <0 | 1 | 2 | 3>"; - } - - @Override - public String Core_GM_CHANGED() { - return "§7You're gamemode has been §achanged"; - } - - @Override - public String Core_GLOBALMUTE_ON() { - return "§7The server has been §cmuted"; - } - - @Override - public String Core_GLOBALMUTE_OFF() { - return "§7The server has been §aunmuted"; - } - - @Override - public String Core_RUNAS_USAGE() { - return "§cUse /runas "; - } - - @Override - public String Core_RUNAS_RUN(CustomPlayer p) { - return "§7The player " + p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + " §7has executed your commons §esuccesfully"; - } - - @Override - public String Core_SETRANK_USAGE() { - return "§cUse /setrank "; - } - - @Override - public String Core_SETRANK_KICK() { - return "\n§aYou've got a new rank,§e\nplease rejoin§7."; - } - - @Override - public String Core_SETRANK_NO_RANK() { - return "§cThis rank doesn't exist"; - } - - @Override - public String Core_SETRANK_SET(CustomPlayer p, Rank rank) { - return "§7You gave " + p.getDisplayName() + " the rank §e" + rank.toString(); - } - - @Override - public String Core_TS_ALLREADY_VERIFIED() { - return "§cYou've already had a verificated account"; - } - - @Override - public String Core_TS_VERIFIED() { - return "§7You verificated your account §esuccesfully"; - } - - @Override - public String Core_VANISH_ON() { - return "§7You are now §aunvisible"; - } - - @Override - public String Core_VANISH_OFF() { - return "§7You are now §cvisible §7again"; - } - - @Override - public String Core_SERVER_MUTED() { - return "§7The chat has been §cblocked"; - } - - @Override - public String Core_CHAT_CLEARED(CustomPlayer p) { - return "§7The chat has been §ccleaned §7by " + p.getDatabasePlayer().getRank().getColor() + p.getDisplayName(); - } - - @Override - public String Core_TAB_TITLE() { - return "§7You're playing on §e"; - } - - @Override - public String Lobby_PLAYERS_HIDE() { - return "§7You've §chidden §7all other players"; - } - - @Override - public String Lobby_PLAYERS_SHOW() { - return "§7Now you can §asee §7all other players "; - } - - @Override - public String Lobby_AUTONICK_ON() { - return "§7You'll §aget an automatical §enickname"; - } - - @Override - public String Lobby_AUTONICK_OFF() { - return "§7You're §cnot getting an automatical §enickname §eanymore"; - } - - @Override - public String Lobby_FORCEFIELD_ON() { - return "§7You §aactivated §7your §eforcefield"; - } - - @Override - public String Lobby_FORCEFIELD_OFF() { - return "§7You §cdeactivated §7your §eforcefield"; - } - - @Override - public String Lobby_SILENT_LOBBY_ON() { - return "§7You §ajoined §7the §esilent-lobby"; - } - - @Override - public String Lobby_SILENT_LOBBY_OFF() { - return "§7You §eleft §7the §esilent-lobby"; - } - - @Override - public String Lobby_PLAYING_MUSIC_PREFIX() { - return "§6Now playing: "; - } - - @Override - public String Lobby_FOUND_ITEM_PREFIX() { - return "§7You've §efound §7something"; - } - - @Override - public String Lobby_SET_LOCATION() { - return "§aPoisition has been set"; - } - - @Override - public String Lobby_SET_LOCATION_USAGE() { - return "§cUse /setloc "; - } - - @Override - public String Lobby_DROP_ITEM_USAGE() { - return "§cUse /dropitem "; - } - - @Override - public String Lobby_DROP_ITEM() { - return "§aYou set an item"; - } - - @Override - public String Lobby_SET_SIGN() { - return "§aNeues Status Schild erstellt"; - } - - @Override - public String Lobby_JOIN_TITLE_1() { - return "§6univento§7.§eeu"; - } - - @Override - public String Lobby_JOIN_TITLE_2() { - return "§cI'm just cleaning hear"; - } - - @Override - public String Lobby_PET_ADD() { - return "§7Now you have a §epet"; - } - - @Override - public String Lobby_PET_REMOVE() { - return "§7Du hast nun §ckein §eHaustier §7mehr"; - } - - @Override - public String Lobby_PARKOUR_ON() { - return "§7You §ajoined §7the §eparkour mode"; - } - - @Override - public String Lobby_PARKOUR_OFF() { - return "§7You §cleft §7the §eparkour mode"; - } - - @Override - public String LobbyItems_NAVIGATOR() { - return "§eNavigator"; - } - - @Override - public String LobbyItems_PLAYER_HIDER_ON() { - return "§cHide players"; - } - - @Override - public String LobbyItems_PLAYER_HIDER_OFF() { - return "§aShow players"; - } - - @Override - public String LobbyItems_AUTO_NICK() { - return "§5AutoNick"; - } - - @Override - public String LobbyItems_SILENT_LOBBY() { - return "§cSilent-Lobby"; - } - - @Override - public String LobbyItems_FORCEFIELD() { - return "§aForcefield"; - } - - @Override - public String LobbyItems_FUN_CHEST() { - return "§cF§aU§eN§3Chest"; - } - - @Override - public String LobbyItems_PROFILE() { - return "§eYour profile"; - } - - @Override - public String LobbyItems_YOUTUBER() { - return "§5Youtuber Funktionen"; - } - - @Override - public String LobbyItems_SUGGESTION() { - return "§6Suggestions"; - } - - @Override - public String LobbyItems_SPAWN() { - return "§6Spawn"; - } - - @Override - public String LobbyItems_PREMIUMHUB() { - return "§6Premium Lobby"; - } - - @Override - public String LobbyItems_MAYA() { - return "§6Maya"; - } - - @Override - public String LobbyItems_WOOLGET() { - return "§6WoolGet"; - } - - @Override - public String LobbyItems_BUILDSERVER() { - return "§aBuilding-server"; - } - - @Override - public String LobbyItems_PLAYERS_ONLINE() { - return " §6players online"; - } - - @Override - public String LobbyItems_GADGETS() { - return "§6Gadgets"; - } - - @Override - public String LobbyItems_MUSIC() { - return "§6Music"; - } - - @Override - public String LobbyItems_PARTICLE() { - return "§6Particles"; - } - - @Override - public String LobbyItems_PETS() { - return "§6Pets"; - } - - @Override - public String LobbyItems_YOUR_PET() { - return "§6your pet"; - } - - @Override - public String LobbyItems_PETS_NAME() { - return "§6change name"; - } - - @Override - public String LobbyItems_PETS_AGE() { - return "§6change age"; - } - - @Override - public String LobbyItems_PETS_RIDE() { - return "§6ride"; - } - - @Override - public String LobbyItems_PETS_REMOVE() { - return "§6remove pet"; - } - - @Override - public String LobbyItems_PETS_PIG() { - return "§6pig"; - } - - @Override - public String LobbyItems_PETS_COW() { - return "§6cow"; - } - - @Override - public String LobbyItems_PETS_CHICKEN() { - return "§6chicken"; - } - - @Override - public String LobbyItems_PETS_RABBIT() { - return "§6rabbit"; - } - - @Override - public String LobbyItems_PETS_MUSHROM_COW() { - return "§6mushroom-cow"; - } - - @Override - public String LobbyItems_PLAYER_MENU() { - return " menu"; - } - - @Override - public String LobbyItems_PLAYER_FRIEND() { - return "§6send freind request"; - } - - @Override - public String LobbyItems_PLAYER_PARTY() { - return "§6send party request"; - } - - @Override - public String LobbyItems_PLAYER_PROFILE() { - return "§6Profil"; - } - - @Override - public String LobbyItems_PLAYER_STATS() { - return "§6stats"; - } - - @Override - public String LobbyItems_STATS() { - return "§6Deine Statistiken"; - } - - @Override - public String LobbyItems_FRIENDS() { - return "§6friends"; - } - - @Override - public String LobbyItems_SETTINGS() { - return "§eSettings"; - } - - @Override - public String LobbyItems_SETTINGS_FASTMENU() { - return "§6inventory animations"; - } - - @Override - public String LobbyItems_SETTINGS_SERVER_TELEPORT() { - return "§6Server-Teleport"; - } - - @Override - public String LobbyItems_SETTINGS_PARTY_REQUESTS() { - return "§6party requests"; - } - - @Override - public String LobbyItems_SETTINGS_FRIEND_REQUESTS() { - return "§6friend requests"; - } - - @Override - public String LobbyItems_SETTINGS_CHATSOUNDS() { - return "§6chat sounds"; - } - - @Override - public String LobbyItems_SETTINGS_EFFECTS() { - return "§6effects"; - } - - @Override - public String LobbyItems_SETTINGS_LANGUAGES() { - return "§6languages"; - } - - @Override - public String LobbyItems_SETTINGS_ON() { - return "§aactivated"; - } - - @Override - public String LobbyItems_SETTINGS_OFF() { - return "§cdeactivated"; - } - - @Override - public String LobbyItems_BACK() { - return "§cback"; - } - - @Override - public String LobbyBoard_FOUND_SECRETS() { - return "§eSecrets§7:"; - } - - @Override - public String LobbyBoard_COINS() { - return "§eYour coins§7:"; - } - - @Override - public String LobbyBoard_TS() { - return "§eTeamSpeak§7:"; - } - - @Override - public String LobbyBoard_FORUM() { - return "§eForum§7:"; - } - - @Override - public String LobbyBoard_NEW() { - return "§e§lNew:"; - } - - @Override - public String LobbyBoard_NEWS() { - return "Scheibenwischer"; - } -} \ No newline at end of file diff --git a/src/main/java/eu/univento/core/api/languages/Language_IT.java b/src/main/java/eu/univento/core/api/languages/Language_IT.java deleted file mode 100644 index ad13af8..0000000 --- a/src/main/java/eu/univento/core/api/languages/Language_IT.java +++ /dev/null @@ -1,555 +0,0 @@ -package eu.univento.core.api.languages; - -import eu.univento.commons.player.Rank; -import eu.univento.core.api.player.CustomPlayer; - -/** - * @author joethei - * @version 0.1 - */ -public class Language_IT implements Languages{ - - @Override - public String UNKNOWN_ERROR() { - return "§cSi è presentato un errore sconosciuto"; - } - - @Override - public String NO_PERMS() { - return "§cNon hai accesso a quel commando"; - } - - @Override - public String ERROR() { - return "§cErrore: "; - } - - @Override - public String NOT_ONLINE(String name) { - return "§7" + name + " §cnon §7è online"; - } - - @Override - public String KICK_RESTART() { - return "§cIl server è stato riavviato"; - } - - @Override - public String KICK_FULL() { - return "§cQuesto server è pieno"; - } - - @Override - public String COMMAND_NOT_FOUND() { - return "§cNon è stato trovato questo commando"; - } - - @Override - public String Core_FIX_OWN() { - return "§7Tu sei stato §efissato"; - } - - @Override - public String Core_FIX_OTHER(CustomPlayer p) { - return "§7Tu hai §efissato " + p.getDisplayName(); - } - - @Override - public String Core_FIX_BY_OTHER(CustomPlayer p) { - return "§7Tu sei stato §efissato §7da" + p.getDisplayName(); - } - - @Override - public String Core_NICK_ON() { - return "§7Hai ricevuto un §eNickname"; - } - - @Override - public String Core_NICK_OFF() { - return "§7Adesso §cnon §7hai più un §eNickname"; - } - - @Override - public String Core_BUILD_ON() { - return "§7Tu sei §aentrato §7nel §emodo di costruzione"; - } - - @Override - public String Core_BUILD_OFF() { - return "§7Tu sei §auscito §7dal §emodo di costruzione"; - } - - @Override - public String Core_BAN_NO_REASON() { - return "§cQuesto motivo non esiste"; - } - - @Override - public String Core_BAN_USAGE() { - return "§cDevi usare /ban "; - } - - @Override - public String Core_BAN_BANNED(CustomPlayer p) { - return "§7Tu hai §ebannato " + p.getDatabasePlayer().getRank().getColor() + p.getDisplayName(); - } - - @Override - public String Core_GM_USAGE() { - return "§7Usi §e/gm <0 | 1 | 2 | 3>"; - } - - @Override - public String Core_GM_CHANGED() { - return "§7La tua modalitá del gioco è stata §aaggiornata"; - } - - @Override - public String Core_GLOBALMUTE_ON() { - return "§7Il server è stato messo §csilenzioso"; - } - - @Override - public String Core_GLOBALMUTE_OFF() { - return "§7Il server è stato rimesso §cnormale"; - } - - @Override - public String Core_RUNAS_USAGE() { - return "§cUsi /runas "; - } - - @Override - public String Core_RUNAS_RUN(CustomPlayer p) { - return p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + " §7ha eseguito il tuo commando"; - } - - @Override - public String Core_SETRANK_USAGE() { - return "§cUsi /setrank "; - } - - @Override - public String Core_SETRANK_KICK() { - return "\n§aHai un nuovo gruppo§e\nti prego di rientrare il server§7."; - } - - @Override - public String Core_SETRANK_NO_RANK() { - return "§cQuesto gruppo non esiste"; - } - - public String Core_SETRANK_SET(CustomPlayer p, Rank rank) { - return "§7Hai dato " + p.getDisplayName() + " il gruppo §e" + rank.toString(); - } - @Override - public String Core_TS_ALLREADY_VERIFIED() { - return "§cTu hai già un account verificato"; - } - - @Override - public String Core_TS_VERIFIED() { - return "§7Hai verificato il tuo account con §esuccesso"; - } - - @Override - public String Core_VANISH_ON() { - return "§7Adesso sei §ainvisibile §7per gli altri"; - } - - @Override - public String Core_VANISH_OFF() { - return "§7Adesso sei §crivisibile §7per gli altri"; - } - - @Override - public String Core_SERVER_MUTED() { - return "§7Il chat è stato §cmutato"; - } - - @Override - public String Core_CHAT_CLEARED(CustomPlayer p) { - return "§7La chat è stata §cpulita §7da " + p.getDatabasePlayer().getRank().getColor() + p.getDisplayName(); - } - - @Override - public String Core_TAB_TITLE() { - return "§7Stai giocando su §e"; - } - - @Override - public String Lobby_PLAYERS_HIDE() { - return "§7Adesso gli altri sono §cinvisibili §7per te"; - } - - @Override - public String Lobby_PLAYERS_SHOW() { - return "§7Adesso gli altri sono §avisibili §7per te"; - } - - @Override - public String Lobby_AUTONICK_ON() { - return "§7Adesso ti viene dato un §esoprannome §7automatico"; - } - - @Override - public String Lobby_AUTONICK_OFF() { - return "§7Adesso §cnon §7ti viene dato un più §esoprannome §7automatico"; - } - - @Override - public String Lobby_FORCEFIELD_ON() { - return "§7Hai §aattivato §7il §eForcefield"; - } - - @Override - public String Lobby_FORCEFIELD_OFF() { - return "§7Hai §cdisattivato §7il §eForcefield"; - } - - @Override - public String Lobby_SILENT_LOBBY_ON() { - return "§7Sei §aentrato §7nella §eSilent-Lobby"; - } - - @Override - public String Lobby_SILENT_LOBBY_OFF() { - return "§7Sei §cuscita §7della §eSilent-Lobby"; - } - - @Override - public String Lobby_PLAYING_MUSIC_PREFIX() { - return "§6In riproduzione: "; - } - - @Override - public String Lobby_FOUND_ITEM_PREFIX() { - return "§7Hai §etrovato §7qualcosa"; - } - - @Override - public String Lobby_SET_LOCATION() { - return "§aPosizione è stata fissata"; - } - - @Override - public String Lobby_SET_LOCATION_USAGE() { - return "§cUsi /setloc "; - } - - @Override - public String Lobby_DROP_ITEM_USAGE() { - return "§cUsi /dropitem "; - } - - @Override - public String Lobby_DROP_ITEM() { - return "§aHai messo un nuovo item qui."; - } - - @Override - public String Lobby_SET_SIGN() { - return "§aNeues Status Schild erstellt"; - } - - @Override - public String Lobby_JOIN_TITLE_1() { - return "§6univento§7.§eeu"; - } - - @Override - public String Lobby_JOIN_TITLE_2() { - return "§cIo solo pulisco qui"; - } - - @Override - public String Lobby_PET_ADD() { - return "§7Adesso hai un §eanimale domestico"; - } - - @Override - public String Lobby_PET_REMOVE() { - return "§cNon §7hai più un §eanimale domestico"; - } - - @Override - public String Lobby_PARKOUR_ON() { - return "§7Sei §aentrato §7nel §emodo del parkour"; - } - - @Override - public String Lobby_PARKOUR_OFF() { - return "§7Sei §cuscito §7del §emodo del parkour"; - } - - @Override - public String LobbyItems_NAVIGATOR() { - return "§eNavigatore"; - } - - @Override - public String LobbyItems_PLAYER_HIDER_ON() { - return "§cNascondere i giocatori"; - } - - @Override - public String LobbyItems_PLAYER_HIDER_OFF() { - return "§aMostrare i giocatori"; - } - - @Override - public String LobbyItems_AUTO_NICK() { - return "§5AutoNick"; - } - - @Override - public String LobbyItems_SILENT_LOBBY() { - return "§cSilent-Lobby"; - } - - @Override - public String LobbyItems_FORCEFIELD() { - return "§aForcefield"; - } - - @Override - public String LobbyItems_FUN_CHEST() { - return "§cF§aU§eN§3Chest"; - } - - @Override - public String LobbyItems_PROFILE() { - return "§eIl tuo profilo"; - } - - @Override - public String LobbyItems_YOUTUBER() { - return "§5Altri funzioni"; - } - - @Override - public String LobbyItems_SUGGESTION() { - return "§6Suggestioni"; - } - - @Override - public String LobbyItems_SPAWN() { - return "§6Spawn"; - } - - @Override - public String LobbyItems_PREMIUMHUB() { - return "§6Lobby dei VIP"; - } - - @Override - public String LobbyItems_MAYA() { - return "§6Maya"; - } - - @Override - public String LobbyItems_WOOLGET() { - return "§6WoolGet"; - } - - @Override - public String LobbyItems_BUILDSERVER() { - return "§aServer per costruire"; - } - - @Override - public String LobbyItems_PLAYERS_ONLINE() { - return " §6giocatori sono online"; - } - - @Override - public String LobbyItems_GADGETS() { - return "§6Gadgets"; - } - - @Override - public String LobbyItems_MUSIC() { - return "§6Musica"; - } - - @Override - public String LobbyItems_PARTICLE() { - return "§6Particelle"; - } - - @Override - public String LobbyItems_PETS() { - return "§6Animali domestici"; - } - - @Override - public String LobbyItems_YOUR_PET() { - return "§6Il tuo animale domestico"; - } - - @Override - public String LobbyItems_PETS_NAME() { - return "§6Cambiare il nome"; - } - - @Override - public String LobbyItems_PETS_AGE() { - return "§6Cambiare l'età"; - } - - @Override - public String LobbyItems_PETS_RIDE() { - return "§6Cavalcarlo"; - } - - @Override - public String LobbyItems_PETS_REMOVE() { - return "§6Cancellarlo"; - } - - @Override - public String LobbyItems_PETS_PIG() { - return "§6Maiale"; - } - - @Override - public String LobbyItems_PETS_COW() { - return "§6Mucca"; - } - - @Override - public String LobbyItems_PETS_CHICKEN() { - return "§6Gallina"; - } - - @Override - public String LobbyItems_PETS_RABBIT() { - return "§6Coniglio"; - } - - @Override - public String LobbyItems_PETS_MUSHROM_COW() { - return "§6Muucelio"; - } - - @Override - public String LobbyItems_PLAYER_MENU() { - return ": menu"; - } - - @Override - public String LobbyItems_PLAYER_FRIEND() { - return "§6Inviare una richiesta di amicizia"; - } - - @Override - public String LobbyItems_PLAYER_PARTY() { - return "§6Inviare una richiesta per una party"; - } - - @Override - public String LobbyItems_PLAYER_PROFILE() { - return "§6Il suo profilo"; - } - - @Override - public String LobbyItems_PLAYER_STATS() { - return "§6Statistiche"; - } - - @Override - public String LobbyItems_STATS() { - return "§6Le tue statistiche"; - } - - @Override - public String LobbyItems_FRIENDS() { - return "§6Amici"; - } - - @Override - public String LobbyItems_SETTINGS() { - return "§eOpzioni"; - } - - @Override - public String LobbyItems_SETTINGS_FASTMENU() { - return "§6Animazioni dell'inventario"; - } - - @Override - public String LobbyItems_SETTINGS_SERVER_TELEPORT() { - return "§6Server-Teleport"; - } - - @Override - public String LobbyItems_SETTINGS_PARTY_REQUESTS() { - return "§6Richieste per una party"; - } - - @Override - public String LobbyItems_SETTINGS_FRIEND_REQUESTS() { - return "§6Richieste di amicizia"; - } - - @Override - public String LobbyItems_SETTINGS_CHATSOUNDS() { - return "§6Suoni del chat"; - } - - @Override - public String LobbyItems_SETTINGS_EFFECTS() { - return "§6Effetti"; - } - - @Override - public String LobbyItems_SETTINGS_LANGUAGES() { - return "§6Lingue"; - } - - @Override - public String LobbyItems_SETTINGS_ON() { - return "§aattivo"; - } - - @Override - public String LobbyItems_SETTINGS_OFF() { - return "§cdisattivo"; - } - - @Override - public String LobbyItems_BACK() { - return "§cIndietro"; - } - - @Override - public String LobbyBoard_FOUND_SECRETS() { - return "§eSegreti§7:"; - } - - @Override - public String LobbyBoard_COINS() { - return "§eVenties§7:"; - } - - @Override - public String LobbyBoard_TS() { - return "§eTeamSpeak§7:"; - } - - @Override - public String LobbyBoard_FORUM() { - return "§eForum§7:"; - } - - @Override - public String LobbyBoard_NEW() { - return "§e§lNovità:"; - } - - @Override - public String LobbyBoard_NEWS() { - return "Scheibenwischer"; - } - -} \ No newline at end of file diff --git a/src/main/java/eu/univento/core/api/languages/Languages.java b/src/main/java/eu/univento/core/api/languages/Languages.java deleted file mode 100644 index 1980fec..0000000 --- a/src/main/java/eu/univento/core/api/languages/Languages.java +++ /dev/null @@ -1,125 +0,0 @@ -package eu.univento.core.api.languages; - -import eu.univento.commons.player.Rank; -import eu.univento.core.api.player.CustomPlayer; - -/** - * @author joethei - * @version 0.3 - */ -interface Languages{ - - String UNKNOWN_ERROR(); - String NO_PERMS(); - String ERROR(); - String NOT_ONLINE(String name); - String KICK_RESTART(); - String KICK_FULL(); - String COMMAND_NOT_FOUND(); - - String Core_FIX_OWN(); - String Core_FIX_OTHER(CustomPlayer p); - String Core_FIX_BY_OTHER(CustomPlayer p); - String Core_NICK_ON(); - String Core_NICK_OFF(); - String Core_BUILD_ON(); - String Core_BUILD_OFF(); - String Core_BAN_NO_REASON(); - String Core_BAN_USAGE(); - String Core_BAN_BANNED(CustomPlayer p); - String Core_GM_USAGE(); - String Core_GM_CHANGED(); - String Core_GLOBALMUTE_ON(); - String Core_GLOBALMUTE_OFF(); - String Core_RUNAS_USAGE(); - String Core_RUNAS_RUN(CustomPlayer p); - String Core_SETRANK_USAGE(); - String Core_SETRANK_KICK(); - String Core_SETRANK_NO_RANK(); - String Core_SETRANK_SET(CustomPlayer p, Rank rank); - String Core_TS_ALLREADY_VERIFIED(); - String Core_TS_VERIFIED(); - String Core_VANISH_ON(); - String Core_VANISH_OFF(); - String Core_SERVER_MUTED(); - String Core_CHAT_CLEARED(CustomPlayer p); - String Core_TAB_TITLE(); - - String Lobby_PLAYERS_HIDE(); - String Lobby_PLAYERS_SHOW(); - String Lobby_AUTONICK_ON(); - String Lobby_AUTONICK_OFF(); - String Lobby_FORCEFIELD_ON(); - String Lobby_FORCEFIELD_OFF(); - String Lobby_SILENT_LOBBY_ON(); - String Lobby_SILENT_LOBBY_OFF(); - String Lobby_PLAYING_MUSIC_PREFIX(); - String Lobby_FOUND_ITEM_PREFIX(); - String Lobby_SET_LOCATION(); - String Lobby_SET_LOCATION_USAGE(); - String Lobby_DROP_ITEM_USAGE(); - String Lobby_DROP_ITEM(); - String Lobby_SET_SIGN(); - String Lobby_JOIN_TITLE_1(); - String Lobby_JOIN_TITLE_2(); - String Lobby_PET_ADD(); - String Lobby_PET_REMOVE(); - String Lobby_PARKOUR_ON(); - String Lobby_PARKOUR_OFF(); - - String LobbyItems_NAVIGATOR(); - String LobbyItems_PLAYER_HIDER_ON(); - String LobbyItems_PLAYER_HIDER_OFF(); - String LobbyItems_AUTO_NICK(); - String LobbyItems_SILENT_LOBBY(); - String LobbyItems_FORCEFIELD(); - String LobbyItems_FUN_CHEST(); - String LobbyItems_PROFILE(); - String LobbyItems_YOUTUBER(); - String LobbyItems_SUGGESTION(); - String LobbyItems_SPAWN(); - String LobbyItems_PREMIUMHUB(); - String LobbyItems_MAYA(); - String LobbyItems_WOOLGET(); - String LobbyItems_BUILDSERVER(); - String LobbyItems_PLAYERS_ONLINE(); - String LobbyItems_GADGETS(); - String LobbyItems_MUSIC(); - String LobbyItems_PARTICLE(); - String LobbyItems_PETS(); - String LobbyItems_YOUR_PET(); - String LobbyItems_PETS_NAME(); - String LobbyItems_PETS_AGE(); - String LobbyItems_PETS_RIDE(); - String LobbyItems_PETS_REMOVE(); - String LobbyItems_PETS_PIG(); - String LobbyItems_PETS_COW(); - String LobbyItems_PETS_CHICKEN(); - String LobbyItems_PETS_RABBIT(); - String LobbyItems_PETS_MUSHROM_COW(); - String LobbyItems_PLAYER_MENU(); - String LobbyItems_PLAYER_FRIEND(); - String LobbyItems_PLAYER_PARTY(); - String LobbyItems_PLAYER_PROFILE(); - String LobbyItems_PLAYER_STATS(); - String LobbyItems_STATS(); - String LobbyItems_FRIENDS(); - String LobbyItems_SETTINGS(); - String LobbyItems_SETTINGS_FASTMENU(); - String LobbyItems_SETTINGS_SERVER_TELEPORT(); - String LobbyItems_SETTINGS_PARTY_REQUESTS(); - String LobbyItems_SETTINGS_FRIEND_REQUESTS(); - String LobbyItems_SETTINGS_CHATSOUNDS(); - String LobbyItems_SETTINGS_EFFECTS(); - String LobbyItems_SETTINGS_LANGUAGES(); - String LobbyItems_SETTINGS_ON(); - String LobbyItems_SETTINGS_OFF(); - String LobbyItems_BACK(); - - String LobbyBoard_FOUND_SECRETS(); - String LobbyBoard_COINS(); - String LobbyBoard_NEW(); - String LobbyBoard_NEWS(); - String LobbyBoard_TS(); - String LobbyBoard_FORUM(); -} \ No newline at end of file diff --git a/src/main/java/eu/univento/core/api/languages/Messages.java b/src/main/java/eu/univento/core/api/languages/Messages.java deleted file mode 100644 index 10a874a..0000000 --- a/src/main/java/eu/univento/core/api/languages/Messages.java +++ /dev/null @@ -1,315 +0,0 @@ -package eu.univento.core.api.languages; - -import eu.univento.commons.player.Rank; -import eu.univento.core.api.player.CustomPlayer; - - -/** - * @author joethei - * @version 2.0 - */ -@Deprecated -public class Messages { - - private final CustomPlayer player; - - private final Language_DE de = new Language_DE(); - private final Language_EN en = new Language_EN(); - private final Language_IT it = new Language_IT(); - - private Languages lang; - - public Messages(CustomPlayer player) { - this.player = player; - if(player.getDatabasePlayer().getSettings().getLanguage().equals("DE")) this.lang = de; - if(player.getDatabasePlayer().getSettings().getLanguage().equals("IT")) this.lang = it; - if(player.getDatabasePlayer().getSettings().getLanguage().equals("EN")) this.lang = en; - } - - public String PREFIX() { - return " §6univento §8» "; - } - public String TAB_PREFIX() { return "§8• §6U N I V E N T O §8• ";} - - public String UNKNOWN_ERROR() { - return lang.UNKNOWN_ERROR(); - } - public String NO_PERMS() { - return lang.NO_PERMS(); - } - public String ERROR() { - return lang.ERROR(); - } - public String NOT_ONLINE(String name) { - return lang.NOT_ONLINE(name); - } - public String KICK_RESTART() { - return lang.KICK_RESTART(); - } - public String KICK_FULL() { - return lang.KICK_FULL(); - } - public String COMMAND_NOT_FOUND() { - return lang.COMMAND_NOT_FOUND(); - } - - public String Core_FIX_OWN() { - return lang.Core_FIX_OWN(); - } - public String Core_FIX_OTHER(CustomPlayer p) { - return lang.Core_FIX_OTHER(p); - } - public String Core_FIX_BY_OTHER(CustomPlayer p) { - return lang.Core_FIX_BY_OTHER(p); - } - public String Core_NICK_ON() { - return lang.Core_NICK_ON(); - } - public String Core_NICK_OFF() { - return lang.Core_NICK_OFF(); - } - public String Core_BUILD_ON() { - return lang.Core_BUILD_ON(); - } - public String Core_BUILD_OFF() { - return lang.Core_BUILD_OFF(); - } - public String Core_BAN_NO_REASON() { - return lang.Core_BAN_NO_REASON(); - } - public String Core_BAN_USAGE() { - return lang.Core_BAN_USAGE(); - } - public String Core_BAN_BANNED(CustomPlayer p) { - return lang.Core_BAN_BANNED(p); - } - public String Core_GM_USAGE() { - return lang.Core_GM_USAGE(); - } - public String Core_GM_CHANGED() { - return lang.Core_GM_CHANGED(); - } - public String Core_GLOBALMUTE_ON() { - return lang.Core_GLOBALMUTE_ON(); - } - public String Core_GLOBALMUTE_OFF() { - return lang.Core_GLOBALMUTE_OFF(); - } - public String Core_RUNAS_USAGE() { - return lang.Core_RUNAS_USAGE(); - } - public String Core_RUNAS_RUN(CustomPlayer p) { - return lang.Core_RUNAS_RUN(p); - } - public String Core_SETRANK_USAGE() { - return lang.Core_SETRANK_USAGE(); - } - public String Core_SETRANK_KICK() { - return lang.Core_SETRANK_KICK(); - } - public String Core_SETRANK_NO_RANK() { - return lang.Core_SETRANK_NO_RANK(); - } - public String Core_SETRANK_SET(CustomPlayer p, Rank rank) { - return lang.Core_SETRANK_SET(p, rank); - } - public String Core_TS_ALLREADY_VERIFIED() { - return lang.Core_TS_ALLREADY_VERIFIED(); - } - public String Core_TS_VERIFIED() { - return lang.Core_TS_VERIFIED(); - } - public String Core_VANISH_ON() { - return lang.Core_VANISH_ON(); - } - public String Core_VANISH_OFF() { - return lang.Core_VANISH_OFF(); - } - public String Core_SERVER_MUTED() { - return lang.Core_SERVER_MUTED(); - } - public String Core_CHAT_CLEARED(CustomPlayer p) { return lang.Core_CHAT_CLEARED(p);} - public String Core_TAB_TITLE() { return lang.Core_TAB_TITLE(); } - - public String Lobby_PLAYERS_HIDE() { - return lang.Lobby_PLAYERS_HIDE(); - } - public String Lobby_PLAYERS_SHOW() { - return lang.Lobby_PLAYERS_SHOW(); - } - public String Lobby_AUTONICK_ON() { - return lang.Lobby_AUTONICK_ON(); - } - public String Lobby_AUTONICK_OFF() { - return lang.Lobby_AUTONICK_OFF(); - } - public String Lobby_FORCEFIELD_ON() { - return lang.Lobby_FORCEFIELD_ON(); - } - public String Lobby_FORCEFIELD_OFF() { - return lang.Lobby_FORCEFIELD_OFF(); - } - public String Lobby_SILENT_LOBBY_ON() { - return lang.Lobby_SILENT_LOBBY_ON(); - } - public String Lobby_SILENT_LOBBY_OFF() { - return lang.Lobby_SILENT_LOBBY_OFF(); - } - public String Lobby_PLAYING_MUSIC_PREFIX() { - return lang.Lobby_PLAYING_MUSIC_PREFIX(); - } - public String Lobby_FOUND_ITEM_PREFIX() { - return lang.Lobby_FOUND_ITEM_PREFIX(); - } - public String Lobby_SET_LOCATION() { - return lang.Lobby_SET_LOCATION(); - } - public String Lobby_SET_LOCATION_USAGE() { - return lang.Lobby_SET_LOCATION_USAGE(); - } - public String Lobby_DROP_ITEM_USAGE() { - return lang.Lobby_DROP_ITEM_USAGE(); - } - public String Lobby_DROP_ITEM() { - return lang.Lobby_DROP_ITEM(); - } - public String Lobby_SET_SIGN() { - return lang.Lobby_SET_SIGN(); - } - public String Lobby_JOIN_TITLE_1() { - return lang.Lobby_JOIN_TITLE_1(); - } - public String Lobby_JOIN_TITLE_2() { - return lang.Lobby_JOIN_TITLE_2(); - } - public String Lobby_PET_ADD() { - return lang.Lobby_PET_ADD(); - } - public String Lobby_PET_REMOVE() { - return lang.Lobby_PET_REMOVE(); - } - public String Lobby_PARKOUR_ON() { - return lang.Lobby_PARKOUR_ON(); - } - public String Lobby_PARKOUR_OFF() { - return lang.Lobby_PARKOUR_OFF(); - } - - public String LobbyItems_NAVIGATOR() { - return lang.LobbyItems_NAVIGATOR(); - } - public String LobbyItems_PLAYER_HIDER_ON() { - return lang.LobbyItems_PLAYER_HIDER_ON(); - } - public String LobbyItems_PLAYER_HIDER_OFF() { - return lang.LobbyItems_PLAYER_HIDER_OFF(); - } - public String LobbyItems_AUTO_NICK() { - return lang.LobbyItems_AUTO_NICK(); - } - public String LobbyItems_SILENT_LOBBY() { - return lang.LobbyItems_SILENT_LOBBY(); - } - public String LobbyItems_FORCEFIELD() { - return lang.LobbyItems_FORCEFIELD(); - } - public String LobbyItems_FUN_CHEST() { - return lang.LobbyItems_FUN_CHEST(); - } - public String LobbyItems_PROFILE() { - return lang.LobbyItems_PROFILE(); - } - public String LobbyItems_YOUTUBER() { return lang.LobbyItems_YOUTUBER(); } - public String LobbyItems_SUGGESTION() { return lang.LobbyItems_SUGGESTION(); } - public String LobbyItems_SPAWN() { - return lang.LobbyItems_SPAWN(); - } - public String LobbyItems_PREMIUMHUB() { - return lang.LobbyItems_PREMIUMHUB(); - } - public String LobbyItems_MAYA() { - return lang.LobbyItems_MAYA(); - } - public String LobbyItems_WOOLGET() { return lang.LobbyItems_WOOLGET(); } - public String LobbyItems_BUILDSERVER() { - return lang.LobbyItems_BUILDSERVER(); - } - public String LobbyItems_PLAYERS_ONLINE() { - return lang.LobbyItems_PLAYERS_ONLINE(); - } - public String LobbyItems_GADGETS() { - return lang.LobbyItems_GADGETS(); - } - public String LobbyItems_MUSIC() { - return lang.LobbyItems_MUSIC(); - } - public String LobbyItems_PARTICLE() { - return lang.LobbyItems_PARTICLE(); - } - public String LobbyItems_PETS() { - return lang.LobbyItems_PETS(); - } - public String LobbyItems_YOUR_PET() { return lang.LobbyItems_YOUR_PET(); } - public String LobbyItems_PETS_NAME() { return lang.LobbyItems_PETS_NAME(); } - public String LobbyItems_PETS_AGE() { return lang.LobbyItems_PETS_AGE(); } - public String LobbyItems_PETS_RIDE() { return lang.LobbyItems_PETS_RIDE(); } - public String LobbyItems_PETS_REMOVE() { return lang.LobbyItems_PETS_REMOVE(); } - public String LobbyItems_PETS_PIG() { return lang.LobbyItems_PETS_PIG(); } - public String LobbyItems_PETS_COW() { return lang.LobbyItems_PETS_COW(); } - public String LobbyItems_PETS_CHICKEN() { return lang.LobbyItems_PETS_CHICKEN(); } - public String LobbyItems_PETS_RABBIT() { return lang.LobbyItems_PETS_RABBIT(); } - public String LobbyItems_PETS_MUSHROM_COW () { return lang.LobbyItems_PETS_MUSHROM_COW(); } - public String LobbyItems_PLAYER_MENU() { return lang.LobbyItems_PLAYER_MENU(); } - public String LobbyItems_PLAYER_FRIEND() { return lang.LobbyItems_PLAYER_FRIEND(); } - public String LobbyItems_PLAYER_PARTY() { return lang.LobbyItems_PLAYER_PARTY(); } - public String LobbyItems_PLAYER_PROFILE() { return lang.LobbyItems_PLAYER_PROFILE(); } - public String LobbyItems_PLAYER_STATS() { return lang.LobbyItems_PLAYER_STATS();} - public String LobbyItems_STATS() { - return lang.LobbyItems_STATS(); - } - public String LobbyItems_FRIENDS() { - return lang.LobbyItems_FRIENDS(); - } - public String LobbyItems_SETTINGS() { - return lang.LobbyItems_SETTINGS(); - } - public String LobbyItems_SETTINGS_FASTMENU() { return lang.LobbyItems_SETTINGS_FASTMENU();} - public String LobbyItems_SETTINGS_SERVER_TELEPORT() { return lang.LobbyItems_SETTINGS_SERVER_TELEPORT(); } - public String LobbyItems_SETTINGS_PARTY_REQUESTS() { - return lang.LobbyItems_SETTINGS_PARTY_REQUESTS(); - } - public String LobbyItems_SETTINGS_FRIEND_REQUESTS() { - return lang.LobbyItems_SETTINGS_FRIEND_REQUESTS(); - } - public String LobbyItems_SETTINGS_CHATSOUNDS() { - return lang.LobbyItems_SETTINGS_CHATSOUNDS(); - } - public String LobbyItems_SETTINGS_EFFECTS() { - return lang.LobbyItems_SETTINGS_EFFECTS(); - } - public String LobbyItems_SETTINGS_LANGUAGES() { - return lang.LobbyItems_SETTINGS_LANGUAGES(); - } - public String LobbyItems_SETTINGS_ON() { - return lang.LobbyItems_SETTINGS_ON(); - } - public String LobbyItems_SETTINGS_OFF() { - return lang.LobbyItems_SETTINGS_OFF(); - } - public String LobbyItems_BACK() { return lang.LobbyItems_BACK(); } - - public String LobbyBoard_COINS() { return lang.LobbyBoard_COINS(); } - public String LobbyBoard_NEW() { return lang.LobbyBoard_NEW(); } - public String LobbyBoard_NEWS() { return lang.LobbyBoard_NEWS(); } - public String LobbyBoard_TS() { return lang.LobbyBoard_TS(); } - public String LobbyBoard_FORUM() { return lang.LobbyBoard_FORUM(); } - public String LobbyBoard_FOUND_SECRETS() { return lang.LobbyBoard_FOUND_SECRETS(); } - - private class Build { - public String PREFIX = "• §bTeam§3Vento • "; - } - - public static class Console{ - public static final String NOT_A_PLAYER = "You are not a valid player"; - } -} \ No newline at end of file diff --git a/src/main/java/eu/univento/core/api/map/MapDatabase.java b/src/main/java/eu/univento/core/api/map/MapDatabase.java index fbeec43..0eff9c4 100644 --- a/src/main/java/eu/univento/core/api/map/MapDatabase.java +++ b/src/main/java/eu/univento/core/api/map/MapDatabase.java @@ -1,18 +1,12 @@ package eu.univento.core.api.map; -import eu.univento.commons.server.ServerType; -import eu.univento.core.Core; -import org.bukkit.Material; - -import java.sql.SQLException; -import java.util.ArrayList; - /** * @author joethei * @version 0.1 */ public class MapDatabase { + /* public static Map getMap(String name) { final Map[] map = new Map[1]; Core.getCommons().getDatabaseManager().getAsyncMySQL().query("SELECT * FROM maps WHERE name='" + name + "' INNER JOIN builder ON map.builder = builder.id;", resultSet -> { @@ -69,4 +63,5 @@ public class MapDatabase { }); return maps; } + */ } \ No newline at end of file diff --git a/src/main/java/eu/univento/core/api/map/MapDownloader.java b/src/main/java/eu/univento/core/api/map/MapDownloader.java index 1c58e63..4e43852 100644 --- a/src/main/java/eu/univento/core/api/map/MapDownloader.java +++ b/src/main/java/eu/univento/core/api/map/MapDownloader.java @@ -24,6 +24,7 @@ public class MapDownloader { } } + /* public static World loadMap(String name) { Map map = MapDatabase.getMap(name); try { @@ -34,6 +35,7 @@ public class MapDownloader { return null; } } + */ public static World loadMap(Map map) { try { diff --git a/src/main/java/eu/univento/core/api/map/MapVoting.java b/src/main/java/eu/univento/core/api/map/MapVoting.java index 1d40713..f55b8f3 100644 --- a/src/main/java/eu/univento/core/api/map/MapVoting.java +++ b/src/main/java/eu/univento/core/api/map/MapVoting.java @@ -1,6 +1,6 @@ package eu.univento.core.api.map; -import eu.univento.commons.player.Rank; +import eu.univento.commons.player.rank.Rank; import eu.univento.core.api.items.ItemBuilder; import eu.univento.core.api.player.CustomPlayer; import org.bukkit.Bukkit; diff --git a/src/main/java/eu/univento/core/api/player/CustomPlayer.java b/src/main/java/eu/univento/core/api/player/CustomPlayer.java index 548a382..e1ff5c2 100644 --- a/src/main/java/eu/univento/core/api/player/CustomPlayer.java +++ b/src/main/java/eu/univento/core/api/player/CustomPlayer.java @@ -1,9 +1,8 @@ package eu.univento.core.api.player; import com.mojang.authlib.GameProfile; -import com.mongodb.BasicDBObject; import eu.univento.commons.player.DatabasePlayer; -import eu.univento.commons.player.Rank; +import eu.univento.commons.player.rank.Rank; import eu.univento.commons.player.warn.WarnReason; import eu.univento.core.Core; import eu.univento.core.api.Hologram; @@ -12,11 +11,10 @@ import eu.univento.core.api.chat.DefaultFontInfo; import eu.univento.core.api.effects.Blackscreen; import eu.univento.core.api.effects.Effects; import eu.univento.core.api.gui.hologram.HologramData; -import eu.univento.core.api.languages.Messages; import eu.univento.core.api.server.ServerSettings; -import eu.univento.core.api.shop.ShopItem; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; +import io.vertx.core.json.JsonObject; import lombok.Getter; import net.minecraft.server.v1_11_R1.*; import org.bukkit.*; @@ -43,7 +41,12 @@ import java.io.DataOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; import java.lang.reflect.Field; -import java.util.*; +import java.time.Instant; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.CompletableFuture; public class CustomPlayer extends CraftPlayer { @@ -62,7 +65,7 @@ public class CustomPlayer extends CraftPlayer { private CustomPlayer(Player player) { super((CraftServer) Bukkit.getServer(), ((CraftPlayer) player).getHandle()); - DATABASE_PLAYER = new DatabasePlayer(Core.getCommons(), player.getUniqueId()); + DATABASE_PLAYER = new DatabasePlayer(player.getUniqueId(), player.getName()); PLAYERS.put(player.getUniqueId(), this); PLAYER = player; gameProfile = ((CraftPlayer) player).getProfile(); @@ -70,8 +73,7 @@ public class CustomPlayer extends CraftPlayer { } public void onLeave() { - Date date = new Date(); - DATABASE_PLAYER.setInDatabase("lastOnline", date); + DATABASE_PLAYER.setInDatabase("lastOnline", Instant.now().toString()); HashMap location = new HashMap<>(); location.put("X", getLocation().getX()); @@ -80,7 +82,7 @@ public class CustomPlayer extends CraftPlayer { location.put("Yaw", getLocation().getYaw()); location.put("Pitch", getLocation().getPitch()); - if (ServerSettings.isLobby()) DATABASE_PLAYER.setInDatabase("Pos", new BasicDBObject(location)); + if (ServerSettings.isLobby()) DATABASE_PLAYER.setInDatabase("Pos", new JsonObject(location)); if (PLAYERS.containsKey(getUniqueId())) PLAYERS.remove(getUniqueId()); } @@ -116,33 +118,14 @@ public class CustomPlayer extends CraftPlayer { return DATABASE_PLAYER; } - @Override - public boolean hasPlayedBefore() { - return DATABASE_PLAYER.hasPlayedBefore(); - } + public CompletableFuture getLastLocation() { + CompletableFuture future = new CompletableFuture<>(); + DATABASE_PLAYER.getObjectFromDatabase("POS").whenComplete((entries, throwable) -> { + future.complete(new Location(Bukkit.getWorld("world"), entries.getDouble("X"), entries.getDouble("Y"), + entries.getDouble("Z"), entries.getFloat("Yaw"), entries.getFloat("Pitch"))); + }); - public void buy(ShopItem item) { - Map map = getBoughtItems(); - map.put(item, false); - setBoughtItems(map); - } - - public Map getBoughtItems() { - Map map = new HashMap<>(); - for (Map.Entry entry : DATABASE_PLAYER.getMapFromDatabase("bought").entrySet()) - map.put(ShopItem.valueOf(String.valueOf(entry.getKey())), Boolean.valueOf(String.valueOf(entry.getValue()))); - return map; - } - - private void setBoughtItems(Map map) { - Map items = new HashMap<>(); - for (Map.Entry entry : map.entrySet()) items.put(String.valueOf(entry.getKey()), entry.getValue()); - DATABASE_PLAYER.setInDatabase("bought", items); - } - - public Location getLastLocation() { - Map map = DATABASE_PLAYER.getMapFromDatabase("Pos"); - return new Location(Bukkit.getWorld("world"), (double) map.get("X"), (double) map.get("Y"), (double) map.get("Z"), (float) map.get("Yaw"), (float) map.get("Pitch")); + return future; } public void connectToServer(String server) { @@ -158,7 +141,7 @@ public class CustomPlayer extends CraftPlayer { } public void warn(WarnReason reason, CustomPlayer warner, String proof) { - DATABASE_PLAYER.warn(reason, warner.getUniqueId(), proof); + DATABASE_PLAYER.warn(reason, warner.getUniqueId().toString(), proof); } public boolean hasEmptyInventory() { @@ -173,7 +156,6 @@ public class CustomPlayer extends CraftPlayer { return openInventory; } - public void setOpenInventory(boolean openInventory) { this.openInventory = openInventory; } @@ -209,6 +191,7 @@ public class CustomPlayer extends CraftPlayer { return bar; } + @Deprecated public Hologram sendHologram(ItemStack item, Location location, String... text) { Hologram hologram = new Hologram(item, text, location); hologram.showPlayer(this); @@ -246,7 +229,7 @@ public class CustomPlayer extends CraftPlayer { sendMessage("Disguised name can only be less the 16 characters."); return; } - if(nickedPlayers.containsKey(getUniqueId())) { + if(isNicked()) { sendMessage("You are already disguised!"); return; } @@ -273,11 +256,40 @@ public class CustomPlayer extends CraftPlayer { return; } Core.getOnlinePlayers().stream().filter(p -> p.getUniqueId() != getUniqueId()).forEach(p -> { + if(p.getDatabasePlayer().isAllowed(Rank.Admin)) return; p.sendPacket(new PacketPlayOutEntityDestroy(getEntityId())); p.sendPacket(new PacketPlayOutNamedEntitySpawn(getHandle())); - Bukkit.getServer().getScheduler().runTask(Core.getInstance(), () -> p.hidePlayer(this)); - Bukkit.getServer().getScheduler().runTaskLater(Core.getInstance(), () -> p.showPlayer(this), 5); + if(p.canSee(this)) { + p.hidePlayer(this); + p.showPlayer(this); + } }); + + //respawn + sendPacket(new PacketPlayOutRespawn(getWorld().getEnvironment().getId(), getHandle().getWorld().getDifficulty(), getHandle().getWorld().getWorldData().getType(), getHandle().playerInteractManager.getGameMode())); + getHandle().playerConnection.teleport(new Location(getWorld(), getHandle().locX, getHandle().locY, getHandle().locZ, getHandle().yaw, getHandle().pitch)); + sendPacket(new PacketPlayOutSpawnPosition(getHandle().getWorld().getSpawn())); + sendPacket(new PacketPlayOutExperience(getHandle().exp, getHandle().expTotal, getHandle().expLevel)); + getHandle().updateInventory(getHandle().defaultContainer); + updateScaledHealth(); + sendPacket(new PacketPlayOutHeldItemSlot(getHandle().inventory.itemInHandIndex)); + getHandle().updateAbilities(); + for(MobEffect effect : getHandle().getEffects()) sendPacket(new PacketPlayOutEntityEffect(getHandle().getId(), effect)); + + if(this.gameProfile != profile) { + for(CustomPlayer player : Core.getOnlinePlayers()) { + if(player.getDatabasePlayer().isAllowed(Rank.Admin)) return; + player.initScoreboard(); + player.getDatabasePlayer().getRankAsync().whenComplete((rank, throwable) -> getScoreboard().getTeam(rank.getTeam()).addEntry(player.getDisplayName())); + player.getScoreboard().getTeam(Rank.Premium.getTeam()).addEntry(getDisplayName()); + } + }else { + for (CustomPlayer player : Core.getOnlinePlayers()) { + player.initScoreboard(); + getDatabasePlayer().getRankAsync().whenComplete((rank, throwable) -> player.getScoreboard().getTeam(rank.getTeam()).addEntry(getDisplayName())); + player.getDatabasePlayer().getRankAsync().whenComplete((rank, throwable) -> getScoreboard().getTeam(rank.getTeam()).addEntry(player.getDisplayName())); + } + } } public void removeNickName() { @@ -292,22 +304,20 @@ public class CustomPlayer extends CraftPlayer { } public void addExperience(int experience) { - DATABASE_PLAYER.setExperience(DATABASE_PLAYER.getExperience() + experience); - setExp(0F); - giveExp(DATABASE_PLAYER.getExperience()); - playSound(getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1.0F, 1.0F); + DATABASE_PLAYER.getExperience().whenComplete((integer, throwable) -> { + DATABASE_PLAYER.setExperience(integer + experience); + setExp(0F); + giveExp(integer + experience); + playSound(getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1.0F, 1.0F); + }); } public void substractExperience(int experience) { - DATABASE_PLAYER.setExperience(DATABASE_PLAYER.getExperience() - experience); - setExp(0F); - giveExp(DATABASE_PLAYER.getExperience()); - } - - public void refreshExperience() { - setLevel(0); - setExp(0F); - giveExp(DATABASE_PLAYER.getExperience()); + DATABASE_PLAYER.getExperience().whenComplete((integer, throwable) -> { + DATABASE_PLAYER.setExperience(integer - experience); + setExp(0F); + giveExp(integer - experience); + }); } @Deprecated @@ -331,11 +341,6 @@ public class CustomPlayer extends CraftPlayer { instance.setBaseValue(16.0D); } - @Deprecated - public Messages getMessages() { - return new Messages(this); - } - public void sendCentredMessage(Player player, String message) { if(message == null || message.equals("")) { player.sendMessage(""); @@ -444,14 +449,6 @@ public class CustomPlayer extends CraftPlayer { return null; } - @Deprecated - public void refreshTablist() { - for (CustomPlayer player : Core.getOnlinePlayers()) { - setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard()); - getScoreboard().getTeam(DATABASE_PLAYER.getRank().getTeam()).addEntry(player.getDisplayName()); - } - } - /** * * @param location location for effect diff --git a/src/main/java/eu/univento/core/api/server/ServerDatabase.java b/src/main/java/eu/univento/core/api/server/ServerDatabase.java index 051466e..29983e7 100644 --- a/src/main/java/eu/univento/core/api/server/ServerDatabase.java +++ b/src/main/java/eu/univento/core/api/server/ServerDatabase.java @@ -1,11 +1,5 @@ package eu.univento.core.api.server; -import eu.univento.commons.database.MySQL; -import eu.univento.core.Core; - -import java.sql.ResultSet; -import java.sql.SQLException; - /** * @author joethei * @version 0.1 @@ -14,6 +8,8 @@ class ServerDatabase { //TODO: cache results and use mongodb + /* + static String getIP(String name) { MySQL sql = Core.getCommons().getDatabaseManager().getMySQL(); try { @@ -55,4 +51,5 @@ class ServerDatabase { return null; } } + */ } \ No newline at end of file diff --git a/src/main/java/eu/univento/core/api/server/ServerInfo.java b/src/main/java/eu/univento/core/api/server/ServerInfo.java index 06b5fe4..0fc95c0 100644 --- a/src/main/java/eu/univento/core/api/server/ServerInfo.java +++ b/src/main/java/eu/univento/core/api/server/ServerInfo.java @@ -46,7 +46,8 @@ public class ServerInfo { } public String getMotd() { - return ServerDatabase.getMotd(name); + //return ServerDatabase.getMotd(name); + return null; } } \ No newline at end of file diff --git a/src/main/java/eu/univento/core/api/server/ServerPinger.java b/src/main/java/eu/univento/core/api/server/ServerPinger.java index c8f5a70..092581e 100644 --- a/src/main/java/eu/univento/core/api/server/ServerPinger.java +++ b/src/main/java/eu/univento/core/api/server/ServerPinger.java @@ -18,8 +18,8 @@ class ServerPinger { private String motd; public ServerPinger(String name){ - this.address = ServerDatabase.getIP(name); - this.port = ServerDatabase.getPort(name); + //this.address = ServerDatabase.getIP(name); + //this.port = ServerDatabase.getPort(name); this.timeout = 200; } diff --git a/src/main/java/eu/univento/core/api/shop/ShopMenu.java b/src/main/java/eu/univento/core/api/shop/ShopMenu.java index 9b3a88c..e5388bd 100644 --- a/src/main/java/eu/univento/core/api/shop/ShopMenu.java +++ b/src/main/java/eu/univento/core/api/shop/ShopMenu.java @@ -41,7 +41,7 @@ public class ShopMenu implements Listener{ @EventHandler public void onInventoryClick(InventoryClickEvent e) { CustomPlayer p = CustomPlayer.getPlayer((Player) e.getWhoClicked()); - items.stream().filter(shopItem -> shopItem.getItem().equals(e.getCurrentItem())).forEach(p::buy); + //items.stream().filter(shopItem -> shopItem.getItem().equals(e.getCurrentItem())).forEach(p::buy); } } \ No newline at end of file diff --git a/src/main/java/eu/univento/core/api/update/PluginUpdater.java b/src/main/java/eu/univento/core/api/update/PluginUpdater.java new file mode 100644 index 0000000..efe195a --- /dev/null +++ b/src/main/java/eu/univento/core/api/update/PluginUpdater.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2017 univento.eu - All rights reserved + * You are not allowed to use, distribute or modify this code + */ + +package eu.univento.core.api.update; + +import eu.univento.core.Core; +import org.apache.commons.io.FileUtils; +import org.gitlab.api.GitlabAPI; +import org.gitlab.api.TokenType; +import org.gitlab.api.models.GitlabBuild; +import org.gitlab.api.models.GitlabProject; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.net.URL; +import java.nio.file.Files; +import java.nio.file.StandardCopyOption; +import java.util.List; + +/** + * @author joethei + * @version 1.0 + */ +public class PluginUpdater { + + private String name; + + public PluginUpdater(String name) { + this.name = name; + } + + public void update() { + GitlabAPI api = GitlabAPI.connect(Core.getCommons().getConfigurationHandler().getString("Gitlab.Host"), Core.getCommons().getConfigurationHandler().getString("Gitlab.token"), TokenType.PRIVATE_TOKEN); + try { + GitlabProject project = api.getProject(name); + List builds = api.getProjectBuilds(project); + + File zip = new File("update", name + ".zip"); + File output = new File("update", name); + + FileUtils.copyURLToFile(new URL(builds.get(0).getDownloadUrl()), zip); + eu.univento.commons.utils.Files.unzip(zip, output); + Files.copy(new FileInputStream(new File(output, "target/" + name +".jar")), new File("update", name + ".jar").toPath(), StandardCopyOption.REPLACE_EXISTING); + FileUtils.deleteQuietly(zip); + FileUtils.deleteDirectory(output); + } catch (IOException e) { + Core.getCommons().getLoggingHandler().getCore().error("Failed while trying to update plugin: " + name); + e.printStackTrace(); + } + } +} \ No newline at end of file diff --git a/src/main/java/eu/univento/core/commands/Build.java b/src/main/java/eu/univento/core/commands/Build.java index 27ed539..cef1b6a 100644 --- a/src/main/java/eu/univento/core/commands/Build.java +++ b/src/main/java/eu/univento/core/commands/Build.java @@ -1,9 +1,8 @@ package eu.univento.core.commands; -import eu.univento.commons.player.Rank; +import eu.univento.commons.player.rank.Rank; import eu.univento.core.Core; import eu.univento.core.api.AutoCommand; -import eu.univento.core.api.languages.Messages; import eu.univento.core.api.player.CustomPlayer; import eu.univento.core.api.server.ServerSettings; import org.bukkit.GameMode; @@ -47,10 +46,10 @@ public class Build extends AutoCommand{ 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.Builder)) { if(players.containsKey(p)) { - p.sendMessage(msgs.PREFIX() + msgs.Core_BUILD_OFF()); + //p.sendMessage(msgs.PREFIX() + msgs.Core_BUILD_OFF()); ItemStack[] content = players.get(p); p.getInventory().setContents(content); @@ -58,15 +57,15 @@ public class Build extends AutoCommand{ p.setGameMode(ServerSettings.getGameMode()); }else { players.put(p, p.getInventory().getContents()); - p.sendMessage(msgs.PREFIX() + msgs.Core_BUILD_ON()); + //p.sendMessage(msgs.PREFIX() + msgs.Core_BUILD_ON()); p.getInventory().clear(); p.setGameMode(GameMode.CREATIVE); } }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 false; } diff --git a/src/main/java/eu/univento/core/commands/ChatClear.java b/src/main/java/eu/univento/core/commands/ChatClear.java index af98cd8..fdae9b3 100644 --- a/src/main/java/eu/univento/core/commands/ChatClear.java +++ b/src/main/java/eu/univento/core/commands/ChatClear.java @@ -1,9 +1,8 @@ package eu.univento.core.commands; -import eu.univento.commons.player.Rank; +import eu.univento.commons.player.rank.Rank; import eu.univento.core.Core; import eu.univento.core.api.AutoCommand; -import eu.univento.core.api.languages.Messages; import eu.univento.core.api.player.CustomPlayer; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; @@ -25,7 +24,6 @@ public class ChatClear extends AutoCommand { public boolean execute(CommandSender sender, String label, String[] args) { if(sender instanceof Player) { CustomPlayer p = CustomPlayer.getPlayer(sender.getName()); - Messages msgs = new Messages(p); if(p.getDatabasePlayer().isAllowed(Rank.Supporter)) { for(int i = 0; i <= 100; i++) { Bukkit.broadcastMessage(" "); @@ -33,15 +31,15 @@ public class ChatClear extends AutoCommand { for(Player players : Bukkit.getOnlinePlayers()) { CustomPlayer player = CustomPlayer.getPlayer(players); if (player.getDatabasePlayer().isAllowed(Rank.Supporter)) { - Messages messages = new Messages(player); - player.sendMessage(messages.Core_CHAT_CLEARED(p)); + //Messages messages = new Messages(player); + //player.sendMessage(messages.Core_CHAT_CLEARED(p)); } } }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 true; } diff --git a/src/main/java/eu/univento/core/commands/Fix.java b/src/main/java/eu/univento/core/commands/Fix.java index d5f2996..a139d8e 100644 --- a/src/main/java/eu/univento/core/commands/Fix.java +++ b/src/main/java/eu/univento/core/commands/Fix.java @@ -2,7 +2,6 @@ package eu.univento.core.commands; import eu.univento.core.Core; import eu.univento.core.api.AutoCommand; -import eu.univento.core.api.languages.Messages; import eu.univento.core.api.player.CustomPlayer; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; @@ -32,34 +31,34 @@ public class Fix extends AutoCommand{ 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(args.length == 0) { for(Player player : Bukkit.getOnlinePlayers()) { player.hidePlayer(p); player.showPlayer(p); } p.teleport(p.getLocation()); - p.sendMessage(msgs.PREFIX() + msgs.Core_FIX_OWN()); + //p.sendMessage(msgs.PREFIX() + msgs.Core_FIX_OWN()); } if(args.length == 1) { if(Bukkit.getPlayer(args[0]) != null) { CustomPlayer t = CustomPlayer.getPlayer(Bukkit.getPlayer(args[0]).getName()); - Messages tMsgs = new Messages(t); + //Messages tMsgs = new Messages(t); if(t != p) { p.hidePlayer(t); p.showPlayer(t); p.teleport(p.getLocation()); - p.sendMessage(msgs.Core_FIX_OTHER(t)); - t.sendMessage(tMsgs.Core_FIX_BY_OTHER(p)); + //p.sendMessage(msgs.Core_FIX_OTHER(t)); + //t.sendMessage(tMsgs.Core_FIX_BY_OTHER(p)); }else { p.chat("/fix"); } }else { - p.sendMessage(msgs.NOT_ONLINE(args[0])); + //p.sendMessage(msgs.NOT_ONLINE(args[0])); } } }else { - sender.sendMessage(Messages.Console.NOT_A_PLAYER); + //sender.sendMessage(Messages.Console.NOT_A_PLAYER); } return true; } diff --git a/src/main/java/eu/univento/core/commands/GameMode.java b/src/main/java/eu/univento/core/commands/GameMode.java index 00c993e..a1ea409 100644 --- a/src/main/java/eu/univento/core/commands/GameMode.java +++ b/src/main/java/eu/univento/core/commands/GameMode.java @@ -1,9 +1,8 @@ package eu.univento.core.commands; -import eu.univento.commons.player.Rank; +import eu.univento.commons.player.rank.Rank; import eu.univento.core.Core; import eu.univento.core.api.AutoCommand; -import eu.univento.core.api.languages.Messages; import eu.univento.core.api.player.CustomPlayer; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -32,20 +31,20 @@ public class GameMode extends AutoCommand{ 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.Builder)) { if(args.length == 1) { String mode = args[0]; p.setGameMode(getModeFromString(mode)); - p.sendMessage(msgs.Core_GM_CHANGED() + " auf " + p.getGameMode().name()); + //p.sendMessage(msgs.Core_GM_CHANGED() + " auf " + p.getGameMode().name()); }if(args.length == 0){ - p.sendMessage(msgs.Core_GM_USAGE()); + //p.sendMessage(msgs.Core_GM_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 true; } diff --git a/src/main/java/eu/univento/core/commands/GlobalMute.java b/src/main/java/eu/univento/core/commands/GlobalMute.java index 77563aa..d8bc7cd 100644 --- a/src/main/java/eu/univento/core/commands/GlobalMute.java +++ b/src/main/java/eu/univento/core/commands/GlobalMute.java @@ -1,9 +1,8 @@ package eu.univento.core.commands; -import eu.univento.commons.player.Rank; +import eu.univento.commons.player.rank.Rank; import eu.univento.core.Core; import eu.univento.core.api.AutoCommand; -import eu.univento.core.api.languages.Messages; import eu.univento.core.api.player.CustomPlayer; import eu.univento.core.api.server.ServerSettings; import org.bukkit.command.CommandSender; @@ -32,20 +31,20 @@ public class GlobalMute extends AutoCommand{ 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.Supporter)) { if(ServerSettings.isMute()) { ServerSettings.setMute(false); - p.sendMessage(msgs.Core_GLOBALMUTE_OFF()); + //p.sendMessage(msgs.Core_GLOBALMUTE_OFF()); }else { ServerSettings.setMute(true); - p.sendMessage(msgs.Core_GLOBALMUTE_ON()); + //p.sendMessage(msgs.Core_GLOBALMUTE_ON()); } }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; } diff --git a/src/main/java/eu/univento/core/commands/Hologram.java b/src/main/java/eu/univento/core/commands/Hologram.java index 4479575..cf89b6b 100644 --- a/src/main/java/eu/univento/core/commands/Hologram.java +++ b/src/main/java/eu/univento/core/commands/Hologram.java @@ -11,7 +11,6 @@ import eu.univento.commons.utils.Strings; import eu.univento.core.Core; import eu.univento.core.api.AutoCommand; import eu.univento.core.api.hologram.HologramManager; -import eu.univento.core.api.languages.Messages; import eu.univento.core.api.player.CustomPlayer; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -32,28 +31,28 @@ public class Hologram extends AutoCommand { public boolean execute(CommandSender sender, String label, String[] args) { if(sender instanceof Player) { CustomPlayer p = CustomPlayer.getPlayer(((Player) sender)); - if(p.getDatabasePlayer().isAllowed(Rank.JrBuilder)) { - if(args.length == 0) { + if (p.getDatabasePlayer().isAllowed(Rank.JrBuilder)) { + if (args.length == 0) { p.sendMessage("/hologram add "); p.sendMessage("/hologram remove "); p.sendMessage("/hologram list"); } - if(args.length == 1) { - if(args[0].equalsIgnoreCase("list")) { + if (args.length == 1) { + if (args[0].equalsIgnoreCase("list")) { HologramManager.getHolograms().forEach((s, hologram) -> p.sendMessage("§6" + s + hologram.getLocation().toString())); } } - if(args.length == 2) { - if(args[0].equalsIgnoreCase("remove")) { - if(HologramManager.getHologram(args[1]) != null) { + if (args.length == 2) { + if (args[0].equalsIgnoreCase("remove")) { + if (HologramManager.getHologram(args[1]) != null) { HologramManager.getHologram(args[1]).destroy(); - }else p.sendMessage("Dieses Hologram gibt es nicht"); + } else p.sendMessage("Dieses Hologram gibt es nicht"); } - }else { + } else { if (args[0].equalsIgnoreCase("add")) { - if(HologramManager.getHologram(args[1]) != null) { + if (HologramManager.getHologram(args[1]) != null) { p.sendMessage("Dieses Hologram gibt es schon"); - }else { + } else { String name = args[1]; args = Strings.remove(args, "add"); args = Strings.remove(args, name); @@ -61,10 +60,12 @@ public class Hologram extends AutoCommand { } } } - }else { + } else { p.getDatabasePlayer().getLanguage().getMessage(MessageConstant.COMMAND_NO_PERMS); - } + }/* }else sender.sendMessage(Messages.Console.NOT_A_PLAYER); + */ + } return true; } diff --git a/src/main/java/eu/univento/core/commands/Nick.java b/src/main/java/eu/univento/core/commands/Nick.java index 30a37fb..f4a8cd2 100644 --- a/src/main/java/eu/univento/core/commands/Nick.java +++ b/src/main/java/eu/univento/core/commands/Nick.java @@ -1,9 +1,8 @@ package eu.univento.core.commands; -import eu.univento.commons.player.Rank; +import eu.univento.commons.player.rank.Rank; import eu.univento.core.Core; import eu.univento.core.api.AutoCommand; -import eu.univento.core.api.languages.Messages; import eu.univento.core.api.player.CustomPlayer; import eu.univento.core.api.player.NickName; import org.bukkit.command.CommandSender; @@ -32,28 +31,28 @@ public class Nick extends AutoCommand{ public boolean execute(CommandSender sender, String label, String[] args) { if(sender instanceof Player) { CustomPlayer p = CustomPlayer.getPlayer(sender.getName()); - Messages msgs = new Messages(p); - if(p.getDatabasePlayer().isAllowed(Rank.Partner)) { + //Messages msgs = new Messages(p); + if(p.getDatabasePlayer().isAllowed(Rank.VIP)) { if(p.getDatabasePlayer().getSettings().isNicked()) { p.getScoreboard().getTeam(p.getDatabasePlayer().getRank().getTeam()).removeEntry(p.getDisplayName()); p.getDatabasePlayer().getSettings().setNickStatus(false); p.getScoreboard().getTeam(p.getDatabasePlayer().getRank().getTeam()).addEntry(p.getDisplayName()); - p.sendMessage(msgs.PREFIX() + msgs.Core_NICK_OFF()); + //p.sendMessage(msgs.PREFIX() + msgs.Core_NICK_OFF()); p.removeNickName(); }else { p.getScoreboard().getTeam(p.getDatabasePlayer().getRank().getTeam()).removeEntry(p.getDisplayName()); p.getDatabasePlayer().getSettings().setNickStatus(true); p.getScoreboard().getTeam(p.getDatabasePlayer().getRank().getTeam()).addEntry(p.getDisplayName()); - p.sendMessage(msgs.PREFIX() + msgs.Core_NICK_ON()); + //p.sendMessage(msgs.PREFIX() + msgs.Core_NICK_ON()); String nick = NickName.getRandomNick(); p.setNickName(nick); //Core.getDebugManager().sendOverlay("der Nick ist " + nick); } }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 true; } diff --git a/src/main/java/eu/univento/core/commands/RunAs.java b/src/main/java/eu/univento/core/commands/RunAs.java index 76d4b9f..56ca9df 100644 --- a/src/main/java/eu/univento/core/commands/RunAs.java +++ b/src/main/java/eu/univento/core/commands/RunAs.java @@ -1,9 +1,8 @@ package eu.univento.core.commands; -import eu.univento.commons.player.Rank; +import eu.univento.commons.player.rank.Rank; import eu.univento.core.Core; import eu.univento.core.api.AutoCommand; -import eu.univento.core.api.languages.Messages; import eu.univento.core.api.player.CustomPlayer; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; @@ -34,29 +33,29 @@ public class RunAs extends AutoCommand{ 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 >= 2) { CustomPlayer t = CustomPlayer.getPlayer(Bukkit.getPlayer(args[0]).getName()); if(t != null) { - String msg = ""; + StringBuilder msg = new StringBuilder(); for(int i = 1; i < args.length; i++) { - msg = msg + args[i] + " "; + msg.append(args[i]).append(" "); } - t.chat(msg); - p.sendMessage(msgs.Core_RUNAS_RUN(t)); + t.chat(msg.toString()); + //p.sendMessage(msgs.Core_RUNAS_RUN(t)); return true; }else { - p.sendMessage(msgs.NOT_ONLINE(args[0])); + //p.sendMessage(msgs.NOT_ONLINE(args[0])); } }else { - p.sendMessage(msgs.Core_RUNAS_USAGE()); + //p.sendMessage(msgs.Core_RUNAS_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; } diff --git a/src/main/java/eu/univento/core/commands/SetRank.java b/src/main/java/eu/univento/core/commands/SetRank.java index a3ef373..754e5be 100644 --- a/src/main/java/eu/univento/core/commands/SetRank.java +++ b/src/main/java/eu/univento/core/commands/SetRank.java @@ -1,9 +1,8 @@ package eu.univento.core.commands; -import eu.univento.commons.player.Rank; +import eu.univento.commons.player.rank.Rank; import eu.univento.core.Core; import eu.univento.core.api.AutoCommand; -import eu.univento.core.api.languages.Messages; import eu.univento.core.api.player.CustomPlayer; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; @@ -36,53 +35,53 @@ public class SetRank extends AutoCommand{ if(Bukkit.getPlayer(args[0]) != null) { CustomPlayer player = CustomPlayer.getPlayer(args[0]); if(player.getDatabasePlayer().isAllowed(rank)) { - p.sendMessage(p.getMessages().PREFIX() + "§cDer Spieler hat den Rang schon oder ist besser."); - p.sendMessage(p.getMessages().PREFIX() + "§cÄnderungen müssen in der Datenbank stattfinden."); + //p.sendMessage(p.getMessages().PREFIX() + "§cDer Spieler hat den Rang schon oder ist besser."); + //p.sendMessage(p.getMessages().PREFIX() + "§cÄnderungen müssen in der Datenbank stattfinden."); return true; } if(p.getDatabasePlayer().isAllowed(Rank.Admin)) { player.getDatabasePlayer().setRank(rank); - p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Core_SETRANK_SET(player, player.getDatabasePlayer().getRank())); + //p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Core_SETRANK_SET(player, player.getDatabasePlayer().getRank())); refreshTablist(); } if(p.getDatabasePlayer().isAllowed(Rank.SrDeveloper) && rank.equals(Rank.Developer)) { player.getDatabasePlayer().setRank(Rank.Developer); - p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Core_SETRANK_SET(player, Rank.Developer)); + //p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Core_SETRANK_SET(player, Rank.Developer)); refreshTablist(); } if(p.getDatabasePlayer().isAllowed(Rank.SrSupporter) && rank.equals(Rank.Supporter)) { player.getDatabasePlayer().setRank(Rank.Supporter); - p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Core_SETRANK_SET(player, Rank.Supporter)); + //p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Core_SETRANK_SET(player, Rank.Supporter)); refreshTablist(); } if(p.getDatabasePlayer().isAllowed(Rank.SrSupporter) && rank.equals(Rank.JrSupporter)) { player.getDatabasePlayer().setRank(Rank.JrSupporter); - p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Core_SETRANK_SET(player, Rank.JrSupporter)); + //p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Core_SETRANK_SET(player, Rank.JrSupporter)); refreshTablist(); } if(p.getDatabasePlayer().isAllowed(Rank.SrBuilder) && rank.equals(Rank.Builder)) { player.getDatabasePlayer().setRank(Rank.Builder); - p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Core_SETRANK_SET(player, Rank.Builder)); + //p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Core_SETRANK_SET(player, Rank.Builder)); refreshTablist(); } if(p.getDatabasePlayer().isAllowed(Rank.SrBuilder) && rank.equals(Rank.JrBuilder)) { player.getDatabasePlayer().setRank(Rank.JrBuilder); - p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Core_SETRANK_SET(player, Rank.JrBuilder)); + //p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Core_SETRANK_SET(player, Rank.JrBuilder)); refreshTablist(); } }else { - p.sendMessage(p.getMessages().NOT_ONLINE(args[0])); + //p.sendMessage(p.getMessages().NOT_ONLINE(args[0])); } }catch(IllegalArgumentException ex) { ex.printStackTrace(); } - p.sendMessage(p.getMessages().Core_SETRANK_NO_RANK()); + //p.sendMessage(p.getMessages().Core_SETRANK_NO_RANK()); } }else { - p.sendMessage(p.getMessages().NO_PERMS()); + //p.sendMessage(p.getMessages().NO_PERMS()); } }else { - sender.sendMessage(Messages.Console.NOT_A_PLAYER); + //sender.sendMessage(Messages.Console.NOT_A_PLAYER); } return true; } @@ -96,7 +95,7 @@ public class SetRank extends AutoCommand{ } private void refreshTablist() { - Bukkit.getScheduler().runTaskLater(Core.getInstance(), () -> Core.getOnlinePlayers().forEach(CustomPlayer::refreshTablist), 10L); + } } \ No newline at end of file diff --git a/src/main/java/eu/univento/core/commands/SystemInfo.java b/src/main/java/eu/univento/core/commands/SystemInfo.java index ad26575..27d4177 100644 --- a/src/main/java/eu/univento/core/commands/SystemInfo.java +++ b/src/main/java/eu/univento/core/commands/SystemInfo.java @@ -1,10 +1,9 @@ package eu.univento.core.commands; -import eu.univento.commons.player.Rank; +import eu.univento.commons.player.rank.Rank; import eu.univento.commons.server.TPS; import eu.univento.core.Core; import eu.univento.core.api.AutoCommand; -import eu.univento.core.api.languages.Messages; import eu.univento.core.api.player.CustomPlayer; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; @@ -36,7 +35,7 @@ public class SystemInfo extends AutoCommand{ 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.Developer)) { Runtime run = Runtime.getRuntime(); p.sendMessage("§6§l===SystemInfo <" + Bukkit.getServerName() + ">==="); @@ -58,10 +57,10 @@ public class SystemInfo extends AutoCommand{ p.sendMessage("§6avaiable cores: " + run.availableProcessors()); p.sendMessage("§6System: " + System.getenv("COMPUTERNAME")); }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; } diff --git a/src/main/java/eu/univento/core/commands/Timeout.java b/src/main/java/eu/univento/core/commands/Timeout.java index 5da1663..9af5075 100644 --- a/src/main/java/eu/univento/core/commands/Timeout.java +++ b/src/main/java/eu/univento/core/commands/Timeout.java @@ -1,10 +1,9 @@ package eu.univento.core.commands; -import eu.univento.commons.player.Rank; +import eu.univento.commons.player.rank.Rank; import eu.univento.commons.player.language.MessageConstant; import eu.univento.core.Core; import eu.univento.core.api.AutoCommand; -import eu.univento.core.api.languages.Messages; import eu.univento.core.api.player.CustomPlayer; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; @@ -46,7 +45,7 @@ public class Timeout extends AutoCommand { p.sendMessage(p.getDatabasePlayer().getLanguage().getMessage(MessageConstant.COMMAND_NO_PERMS)); } } else { - sender.sendMessage(Messages.Console.NOT_A_PLAYER); + //sender.sendMessage(Messages.Console.NOT_A_PLAYER); } return true; } diff --git a/src/main/java/eu/univento/core/commands/Vanish.java b/src/main/java/eu/univento/core/commands/Vanish.java index 47ee37c..940608a 100644 --- a/src/main/java/eu/univento/core/commands/Vanish.java +++ b/src/main/java/eu/univento/core/commands/Vanish.java @@ -1,9 +1,8 @@ package eu.univento.core.commands; -import eu.univento.commons.player.Rank; +import eu.univento.commons.player.rank.Rank; import eu.univento.core.Core; import eu.univento.core.api.AutoCommand; -import eu.univento.core.api.languages.Messages; import eu.univento.core.api.player.CustomPlayer; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; @@ -45,26 +44,26 @@ public class Vanish extends AutoCommand{ 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.JrSupporter)) { if(players.contains(p)) { for(Player players : Bukkit.getOnlinePlayers()) { players.showPlayer(p); } players.remove(p); - p.sendMessage(msgs.PREFIX() + msgs.Core_VANISH_OFF()); + //p.sendMessage(msgs.PREFIX() + msgs.Core_VANISH_OFF()); }else { for(Player players : Bukkit.getOnlinePlayers()) { players.hidePlayer(p); } players.add(p); - p.sendMessage(msgs.PREFIX() + msgs.Core_VANISH_ON()); + //p.sendMessage(msgs.PREFIX() + msgs.Core_VANISH_ON()); } }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; } diff --git a/src/main/java/eu/univento/core/listeners/Chat.java b/src/main/java/eu/univento/core/listeners/Chat.java index 26fdc24..cd5d375 100644 --- a/src/main/java/eu/univento/core/listeners/Chat.java +++ b/src/main/java/eu/univento/core/listeners/Chat.java @@ -5,7 +5,6 @@ import eu.univento.commons.player.warn.WarnReason; import eu.univento.core.Core; import eu.univento.core.api.blocks.MiniBlock; import eu.univento.core.api.customitems.swords.BestSwordEver; -import eu.univento.core.api.languages.Messages; import eu.univento.core.api.player.CustomPlayer; import eu.univento.core.api.server.ServerSettings; import eu.univento.core.api.shop.ShopItem; @@ -44,77 +43,67 @@ public class Chat implements Listener { @EventHandler public void onChat(AsyncPlayerChatEvent e) { CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer().getName()); - Messages msgs = p.getMessages(); - e.setCancelled(true); - p.getDatabasePlayer().isMuted().whenComplete((aBoolean, throwable) -> { - if (aBoolean) { - p.sendMessage(msgs.PREFIX() + msgs.Core_SERVER_MUTED()); - } else { + String message = e.getMessage(); + if (p.getDatabasePlayer().isMuted()) { + e.setCancelled(true); + } + //TODO: remove this, used for debugging + if (message.equalsIgnoreCase("bestswordever")) { + new BestSwordEver(p).addItem(); + } + if (message.equalsIgnoreCase("shopvillager")) { + ShopMenu menu = new ShopMenu(Core.getInstance(), "Shop Villager", ShopItem.TestItem); + new ShopVillager(Core.getInstance(), "Shop Villager", p.getLocation(), Villager.Profession.LIBRARIAN, menu); + } + if (message.equalsIgnoreCase("miniblock")) { + new MiniBlock(p.getLocation(), new ItemStack(Material.GRASS), 1); + new MiniBlock(p.getEyeLocation(), new ItemStack(Material.DIAMOND_SWORD), 2); + new MiniBlock(p.getWorld().getSpawnLocation(), new ItemStack(Material.WOOL), 3); + } - //TODO: remove this, used for debugging - if (e.getMessage().equalsIgnoreCase("bestswordever")) { - new BestSwordEver(p).addItem(); - } - if (e.getMessage().equalsIgnoreCase("shopvillager")) { - ShopMenu menu = new ShopMenu(Core.getInstance(), "Shop Villager", ShopItem.TestItem); - new ShopVillager(Core.getInstance(), "Shop Villager", p.getLocation(), Villager.Profession.LIBRARIAN, menu); - } - if (e.getMessage().equalsIgnoreCase("miniblock")) { - new MiniBlock(p.getLocation(), new ItemStack(Material.GRASS), 1); - new MiniBlock(p.getEyeLocation(), new ItemStack(Material.DIAMOND_SWORD), 2); - new MiniBlock(p.getWorld().getSpawnLocation(), new ItemStack(Material.WOOL), 3); - } - - if (ServerSettings.isMute()) { - if (!p.getDatabasePlayer().isAllowed(Rank.Sound)) { - e.setCancelled(true); - p.sendMessage(msgs.PREFIX() + msgs.Core_SERVER_MUTED()); - } - } - if (players.contains(p)) { - e.setCancelled(true); - p.sendMessage("§cDu musst dich bewegen bevor du chatten kannst"); - } - if (System.currentTimeMillis() - spam.get(p) < 5 * 20L) { - e.setCancelled(true); - p.sendMessage("Nicht spammen"); - spamPlayers.put(p, spamPlayers.get(p) + 1); - } - if (spamPlayers.get(p) > 100) { - p.warn(WarnReason.SPAM, null, "https://players.univento.eu/" + p.getUniqueId().toString() + "/chatlog"); - } - - char[] parts = e.getMessage().toCharArray(); - - int sum = 0; - for (char part : parts) { - sum += part; - } - double ratio = sum / parts.length; - int percent = (int) (100.0D * ratio); - - if (percent < 50) { - e.setCancelled(true); - p.sendMessage("§cKeine Caps verwenden"); - } - - String message = e.getMessage(); - if (e.getFormat().contains("%")) message = message.replace("%", "%%"); - if (p.getDatabasePlayer().isAllowed(Rank.VIP)) { - if (p.getDatabasePlayer().getSettings().isNicked() && !ServerSettings.isLobby()) { - e.setFormat(p.getDatabasePlayer().getRank().getPrefix() + p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + p.getDatabasePlayer().getRank().getSuffix() + ChatColor.translateAlternateColorCodes('&', message)); - for(CustomPlayer player : Core.getOnlinePlayers()) player.sendMessage(e.getMessage()); - } else { - e.setFormat(p.getDatabasePlayer().getRank().getPrefix() + p.getDisplayName() + p.getDatabasePlayer().getRank().getSuffix() + ChatColor.translateAlternateColorCodes('&', message)); - for(CustomPlayer player : Core.getOnlinePlayers()) player.sendMessage(e.getMessage()); - } - } else { - e.setFormat(p.getDatabasePlayer().getRank().getPrefix() + p.getDisplayName() + p.getDatabasePlayer().getRank().getSuffix() + message); - for(CustomPlayer player : Core.getOnlinePlayers()) player.sendMessage(e.getMessage()); - Core.getOnlinePlayers().stream().filter(player -> e.getMessage().toLowerCase().contains(player.getDisplayName().toLowerCase()) || e.getMessage().toLowerCase().contains(player.getName().toLowerCase())).forEach(player -> player.playSound(p.getEyeLocation(), Sound.BLOCK_NOTE_PLING, 100.0F, 1.0F)); - } + if (ServerSettings.isMute()) { + if (!p.getDatabasePlayer().isAllowed(Rank.Sound)) { + e.setCancelled(true); + p.sendMessage("Der Server ist stumm"); } - }); + } + if (players.contains(p)) { + e.setCancelled(true); + p.sendMessage("§cDu musst dich bewegen bevor du chatten kannst"); + } + if (System.currentTimeMillis() - spam.get(p) < 5 * 20L) { + e.setCancelled(true); + p.sendMessage("Nicht spammen"); + spamPlayers.put(p, spamPlayers.get(p) + 1); + } + if (spamPlayers.get(p) > 100) { + p.warn(WarnReason.SPAM, null, "https://players.univento.eu/" + p.getUniqueId().toString() + "/chatlog"); + } + + char[] parts = e.getMessage().toCharArray(); + + int sum = 0; + for (char part : parts) { + sum += part; + } + double ratio = sum / parts.length; + int percent = (int) (100.0D * ratio); + + if (percent < 50) { + e.setCancelled(true); + p.sendMessage("§cKeine Caps verwenden"); + } + if (message.contains("%")) message = message.replace("%", "%%"); + if (p.getDatabasePlayer().isAllowed(Rank.VIP)) { + if (p.getDatabasePlayer().getSettings().isNicked() && !ServerSettings.isLobby()) { + e.setFormat(p.getDatabasePlayer().getRank().getPrefix() + p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + p.getDatabasePlayer().getRank().getSuffix() + ChatColor.translateAlternateColorCodes('&', message)); + } else { + e.setFormat(p.getDatabasePlayer().getRank().getPrefix() + p.getDisplayName() + p.getDatabasePlayer().getRank().getSuffix() + ChatColor.translateAlternateColorCodes('&', message)); + } + } else { + e.setFormat(p.getDatabasePlayer().getRank().getPrefix() + p.getDisplayName() + p.getDatabasePlayer().getRank().getSuffix() + message); + Core.getOnlinePlayers().stream().filter(player -> e.getMessage().toLowerCase().contains(player.getDisplayName().toLowerCase()) || e.getMessage().toLowerCase().contains(player.getName().toLowerCase())).forEach(player -> player.playSound(p.getEyeLocation(), Sound.BLOCK_NOTE_PLING, 100.0F, 1.0F)); + } } @EventHandler diff --git a/src/main/java/eu/univento/core/listeners/Commands.java b/src/main/java/eu/univento/core/listeners/Commands.java index 4341ddc..4eeced5 100644 --- a/src/main/java/eu/univento/core/listeners/Commands.java +++ b/src/main/java/eu/univento/core/listeners/Commands.java @@ -1,6 +1,6 @@ package eu.univento.core.listeners; -import eu.univento.commons.player.Rank; +import eu.univento.commons.player.rank.Rank; import eu.univento.commons.player.language.MessageConstant; import eu.univento.core.Core; import eu.univento.core.api.player.CustomPlayer; diff --git a/src/main/java/eu/univento/core/listeners/JoinQuit.java b/src/main/java/eu/univento/core/listeners/JoinQuit.java index b5412e3..07fa3ab 100644 --- a/src/main/java/eu/univento/core/listeners/JoinQuit.java +++ b/src/main/java/eu/univento/core/listeners/JoinQuit.java @@ -2,13 +2,11 @@ package eu.univento.core.listeners; import eu.univento.commons.player.language.MessageConstant; import eu.univento.core.Core; -import eu.univento.core.api.Utils; import eu.univento.core.api.player.*; import eu.univento.core.api.server.ServerSettings; import eu.univento.core.commands.Build; import eu.univento.core.commands.Vanish; import org.bukkit.Bukkit; -import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; @@ -33,59 +31,59 @@ public class JoinQuit implements Listener { @EventHandler public void onPreLogin(AsyncPlayerPreLoginEvent e) { + /* if(!Core.getCommons().getSecurityHandler().isValidServer(e.getAddress().getHostAddress())) { e.setKickMessage("Im sorry, you can only join from our official IP: play.univento.eu"); - e.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_BANNED); + e + .setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_BANNED); } + */ } @EventHandler public void onJoin(PlayerJoinEvent e) { CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer()); - for (Player players : Bukkit.getOnlinePlayers()) { - CustomPlayer player = CustomPlayer.getPlayer(players); - if (Vanish.getPlayers().contains(player)) + p.getDatabasePlayer().load(); + for (CustomPlayer player : Core.getOnlinePlayers()) { + if (Vanish.getPlayers().contains(player)) { p.hidePlayer(player); - if (SpectateManager.contains(player)) + } + if (SpectateManager.contains(player)) { p.hidePlayer(player); + } } + HashMap labyModFeatures = new HashMap<>(); + labyModFeatures.put(LabyMod.DAMAGEINDICATOR, false); + labyModFeatures.put(LabyMod.MINIMAP_RADAR, false); + labyModFeatures.put(LabyMod.ARMOR, false); + labyModFeatures.put(LabyMod.POTIONS, false); + labyModFeatures.put(LabyMod.ANIMATIONS, false); + labyModFeatures.put(LabyMod.EXTRAS, false); + p.setLabyModFeatures(labyModFeatures); - if (!p.hasPlayedBefore()) { - firstJoin.add(p); - for (int i = 0; i <= 15; i++) - Utils.randomFirework(p.getEyeLocation()); - } - if (!p.isOnline()) { - HashMap labyModFeatures = new HashMap<>(); - labyModFeatures.put(LabyMod.DAMAGEINDICATOR, false); - labyModFeatures.put(LabyMod.MINIMAP_RADAR, false); - labyModFeatures.put(LabyMod.ARMOR, false); - labyModFeatures.put(LabyMod.POTIONS, false); - labyModFeatures.put(LabyMod.ANIMATIONS, false); - labyModFeatures.put(LabyMod.EXTRAS, false); - p.setLabyModFeatures(labyModFeatures); + p.sendMessage(BetterPvP.getCodeString()); - p.sendMessage(BetterPvP.getCodeString()); + //disable code for minimap mod + p.sendMessage("§A§n§t§i§M§i§n§i§m§a§p"); + p.sendMessage("§3 §6 §3 §6 §3 §6 §e"); + p.sendMessage("§0§0§1§2§3§5§e§f"); + p.sendMessage("§0§0§c§d§e§f"); - //disable code for minimap mod - p.sendMessage("§A§n§t§i§M§i§n§i§m§a§p"); - p.sendMessage("§3 §6 §3 §6 §3 §6 §e"); - p.sendMessage("§0§0§1§2§3§5§e§f"); - p.sendMessage("§0§0§c§d§e§f"); + assert getPayload() != null; + p.sendPluginMessage(Core.getInstance(), "schematica", getPayload()); - assert getPayload() != null; - p.sendPluginMessage(Core.getInstance(), "schematica", getPayload()); - } p.setGameMode(ServerSettings.getGameMode()); p.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard()); p.initScoreboard(); - p.sendTabHeaderAndFooter(p.getMessages().Core_TAB_TITLE() + Bukkit.getServerName(), p.getMessages().TAB_PREFIX()); - if (p.getDatabasePlayer().getSettings().isNicked() && !ServerSettings.isLobby()) { - p.setNickName(NickName.getRandomNick()); - } + //p.sendTabHeaderAndFooter(p.getMessages().Core_TAB_TITLE() + Bukkit.getServerName(), p.getMessages().TAB_PREFIX()); + p.getDatabasePlayer().getSettingsAsync().whenComplete((playerSettings, throwable) -> { + if(playerSettings.isNicked() && !ServerSettings.isLobby()) { + p.setNickName(NickName.getRandomNick()); + } + }); for (CustomPlayer player : Core.getOnlinePlayers()) { - p.getScoreboard().getTeam(player.getDatabasePlayer().getRank().getTeam()).addEntry(player.getDisplayName()); - player.getScoreboard().getTeam(p.getDatabasePlayer().getRank().getTeam()).addEntry(p.getDisplayName()); + p.getDatabasePlayer().getRankAsync().whenComplete((rank, throwable) -> player.getScoreboard().getTeam(rank.getTeam()).addEntry(p.getDisplayName())); + player.getDatabasePlayer().getRankAsync().whenComplete((rank, throwable) -> p.getScoreboard().getTeam(rank.getTeam()).addEntry(player.getDisplayName())); } p.setCollidable(false); @@ -96,20 +94,20 @@ public class JoinQuit implements Listener { @EventHandler public void onResourcePackStatus(PlayerResourcePackStatusEvent e) { CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer()); - if(e.getStatus() == PlayerResourcePackStatusEvent.Status.SUCCESSFULLY_LOADED) { - if(firstJoin.contains(p)) { + if (e.getStatus() == PlayerResourcePackStatusEvent.Status.SUCCESSFULLY_LOADED) { + if (firstJoin.contains(p)) { firstJoin.remove(p); - if(ServerSettings.isLobby()) { + if (ServerSettings.isLobby()) { //TODO: add story intro here. } } loading.remove(p); } - if(e.getStatus() == PlayerResourcePackStatusEvent.Status.FAILED_DOWNLOAD) { + if (e.getStatus() == PlayerResourcePackStatusEvent.Status.FAILED_DOWNLOAD) { p.sendMessage(p.getDatabasePlayer().getLanguage().getMessage(MessageConstant.PACK_FAILED_DOWNLOAD)); Bukkit.getScheduler().runTaskLaterAsynchronously(Core.getInstance(), p::setStoryResourcePack, 10 * 20L); } - if(e.getStatus() == PlayerResourcePackStatusEvent.Status.DECLINED) { + if (e.getStatus() == PlayerResourcePackStatusEvent.Status.DECLINED) { p.sendMessage(p.getDatabasePlayer().getLanguage().getMessage(MessageConstant.PACK_DECLINED)); Bukkit.getScheduler().runTaskLaterAsynchronously(Core.getInstance(), p::setStoryResourcePack, 10 * 20L); } @@ -120,9 +118,11 @@ public class JoinQuit implements Listener { CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer()); if (Build.getPlayers().containsKey(p)) Build.getPlayers().remove(p); - if (p.getDatabasePlayer().getSettings().isNicked() && !ServerSettings.isLobby()) { - p.removeNickName(); - } + p.getDatabasePlayer().getSettingsAsync().whenComplete((playerSettings, throwable) -> { + if(playerSettings.isNicked() && !ServerSettings.isLobby()) { + p.removeNickName(); + } + }); for (Team team : p.getScoreboard().getTeams()) { team.removeEntry(p.getDisplayName()); }