From e26791589a014c5423368c9f47b1aebc1a9069a8 Mon Sep 17 00:00:00 2001 From: Butzlabben Date: Sun, 10 Feb 2019 22:03:53 +0100 Subject: [PATCH] Made project structure prettier --- WorldSystem/.gitignore => .gitignore | 10 +- .idea/vcs.xml | 2 +- WorldSystem/.classpath | 38 - WorldSystem/.idea/misc.xml | 6 - WorldSystem/.idea/modules.xml | 8 - WorldSystem/.idea/workspace.xml | 277 ---- WorldSystem/.project | 29 - .../org.eclipse.core.resources.prefs | 12 - .../.settings/org.eclipse.jdt.core.prefs | 13 - WorldSystem/bin/config.yml | 94 -- WorldSystem/bin/de.yml | 83 - WorldSystem/bin/en.yml | 84 - WorldSystem/bin/es.yml | 84 - WorldSystem/bin/pl.yml | 84 - WorldSystem/bin/plugin.yml | 119 -- WorldSystem/bin/settings.yml | 52 - WorldSystem/src/main/resources/custom.yml | 82 - WorldSystem/src/main/resources/hu.yml | 85 -- WorldSystem/src/main/resources/nl.yml | 84 - WorldSystem/pom.xml => pom.xml | 0 .../src => src}/main/java/LICENSE.txt | 0 .../de/butzlabben/autoupdater/AutoUpdate.java | 106 +- .../butzlabben/autoupdater/AutoUpdater.java | 254 ++-- .../autoupdater/UpdateInformations.java | 0 .../de/butzlabben/inventory/CostumInv.java | 32 +- .../butzlabben/inventory/DependListener.java | 24 +- .../inventory/OrcClickListener.java | 18 +- .../de/butzlabben/inventory/OrcInventory.java | 226 +-- .../java/de/butzlabben/inventory/OrcItem.java | 278 ++-- .../de/butzlabben/inventory/OrcListener.java | 110 +- .../inventory/pages/InventoryPage.java | 148 +- .../inventory/pages/ItemConverter.java | 26 +- .../inventory/pages/PageGUICreator.java | 130 +- .../java/de/butzlabben/world/GCRunnable.java | 18 +- .../butzlabben/world/GameProfileBuilder.java | 292 ++-- .../world/WorldCheckerRunnable.java | 98 +- .../java/de/butzlabben/world/WorldSystem.java | 0 .../butzlabben/world/command/WSCommand.java | 0 .../command/WorldAdministrateCommand.java | 0 .../world/command/WorldSettingsCommands.java | 0 .../world/config/DependenceConfig.java | 324 ++-- .../de/butzlabben/world/config/Entry.java | 112 +- .../de/butzlabben/world/config/GuiConfig.java | 306 ++-- .../world/config/MessageConfig.java | 0 .../butzlabben/world/config/PluginConfig.java | 490 +++--- .../world/config/SettingsConfig.java | 368 ++--- .../butzlabben/world/config/WorldConfig.java | 0 .../de/butzlabben/world/config/WorldPerm.java | 0 .../world/event/WorldAddmemberEvent.java | 106 +- .../world/event/WorldCreateEvent.java | 106 +- .../world/event/WorldDeleteEvent.java | 98 +- .../de/butzlabben/world/event/WorldEvent.java | 54 +- .../world/event/WorldLoadEvent.java | 98 +- .../world/event/WorldRemovememberEvent.java | 104 +- .../world/event/WorldResetEvent.java | 100 +- .../world/event/WorldToggleFireEvent.java | 128 +- .../world/event/WorldToggleTntEvent.java | 128 +- .../world/event/WorldUnloadEvent.java | 74 +- .../de/butzlabben/world/gui/GuiCommand.java | 64 +- .../world/gui/PlayerOptionsGUI.java | 0 .../butzlabben/world/gui/PlayersPageGUI.java | 182 +-- .../butzlabben/world/gui/WorldChooseGUI.java | 138 +- .../butzlabben/world/gui/WorldOptionsGUI.java | 200 +-- .../butzlabben/world/gui/WorldSystemGUI.java | 118 +- .../ComingSoonClickListener.java | 34 +- .../CommandExecutorClickListener.java | 50 +- .../InventoryOpenClickListener.java | 68 +- .../world/gui/playeroption/BuildStatus.java | 44 +- .../gui/playeroption/GamemodeStatus.java | 42 +- .../gui/playeroption/TeleportStatus.java | 42 +- .../gui/playeroption/WorldEditStatus.java | 0 .../world/gui/worldoption/FireStatus.java | 70 +- .../world/gui/worldoption/TntStatus.java | 70 +- .../world/listener/BlockListener.java | 152 +- .../world/listener/CommandListener.java | 270 ++-- .../world/listener/PlayerDeathListener.java | 102 +- .../world/listener/PlayerListener.java | 74 +- .../world/listener/WorldEditListener.java | 0 .../butzlabben/world/util/TeleportUtil.java | 58 +- .../world/wrapper/AsyncCreatorAdapter.java | 90 +- .../world/wrapper/CreatorAdapter.java | 24 +- .../butzlabben/world/wrapper/SystemWorld.java | 862 +++++------ .../butzlabben/world/wrapper/WorldPlayer.java | 0 .../world/wrapper/WorldTemplate.java | 84 +- .../world/wrapper/WorldTemplateProvider.java | 78 +- .../main/java/org/bstats/bukkit/Metrics.java | 1352 ++++++++--------- .../src => src}/main/resources/1_13_gui.yml | 0 .../src => src}/main/resources/LICENSE.txt | 0 .../src => src}/main/resources/config.yml | 210 +-- .../bin => src/main/resources}/custom.yml | 162 +- .../src => src}/main/resources/de.yml | 0 .../src => src}/main/resources/en.yml | 0 .../src => src}/main/resources/es.yml | 166 +- .../src => src}/main/resources/fi.yml | 166 +- .../src => src}/main/resources/fr.yml | 0 .../bin => src/main/resources}/hu.yml | 168 +- .../bin => src/main/resources}/nl.yml | 166 +- .../src => src}/main/resources/old_gui.yml | 0 .../src => src}/main/resources/pl.yml | 166 +- .../src => src}/main/resources/plugin.yml | 0 .../src => src}/main/resources/ru.yml | 160 +- .../src => src}/main/resources/settings.yml | 118 +- .../src => src}/main/resources/zh.yml | 164 +- .../test/UpdateInformationsTest.java | 42 +- 104 files changed, 5162 insertions(+), 6396 deletions(-) rename WorldSystem/.gitignore => .gitignore (93%) delete mode 100644 WorldSystem/.classpath delete mode 100644 WorldSystem/.idea/misc.xml delete mode 100644 WorldSystem/.idea/modules.xml delete mode 100644 WorldSystem/.idea/workspace.xml delete mode 100644 WorldSystem/.project delete mode 100644 WorldSystem/.settings/org.eclipse.core.resources.prefs delete mode 100644 WorldSystem/.settings/org.eclipse.jdt.core.prefs delete mode 100644 WorldSystem/bin/config.yml delete mode 100644 WorldSystem/bin/de.yml delete mode 100644 WorldSystem/bin/en.yml delete mode 100644 WorldSystem/bin/es.yml delete mode 100644 WorldSystem/bin/pl.yml delete mode 100644 WorldSystem/bin/plugin.yml delete mode 100644 WorldSystem/bin/settings.yml delete mode 100644 WorldSystem/src/main/resources/custom.yml delete mode 100644 WorldSystem/src/main/resources/hu.yml delete mode 100644 WorldSystem/src/main/resources/nl.yml rename WorldSystem/pom.xml => pom.xml (100%) rename {WorldSystem/src => src}/main/java/LICENSE.txt (100%) rename {WorldSystem/src => src}/main/java/de/butzlabben/autoupdater/AutoUpdate.java (95%) rename {WorldSystem/src => src}/main/java/de/butzlabben/autoupdater/AutoUpdater.java (96%) rename {WorldSystem/src => src}/main/java/de/butzlabben/autoupdater/UpdateInformations.java (100%) rename {WorldSystem/src => src}/main/java/de/butzlabben/inventory/CostumInv.java (94%) rename {WorldSystem/src => src}/main/java/de/butzlabben/inventory/DependListener.java (95%) rename {WorldSystem/src => src}/main/java/de/butzlabben/inventory/OrcClickListener.java (95%) rename {WorldSystem/src => src}/main/java/de/butzlabben/inventory/OrcInventory.java (95%) rename {WorldSystem/src => src}/main/java/de/butzlabben/inventory/OrcItem.java (95%) rename {WorldSystem/src => src}/main/java/de/butzlabben/inventory/OrcListener.java (96%) rename {WorldSystem/src => src}/main/java/de/butzlabben/inventory/pages/InventoryPage.java (96%) rename {WorldSystem/src => src}/main/java/de/butzlabben/inventory/pages/ItemConverter.java (94%) rename {WorldSystem/src => src}/main/java/de/butzlabben/inventory/pages/PageGUICreator.java (96%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/GCRunnable.java (94%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/GameProfileBuilder.java (97%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/WorldCheckerRunnable.java (97%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/WorldSystem.java (100%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/command/WSCommand.java (100%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/command/WorldAdministrateCommand.java (100%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/command/WorldSettingsCommands.java (100%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/config/DependenceConfig.java (96%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/config/Entry.java (95%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/config/GuiConfig.java (96%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/config/MessageConfig.java (100%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/config/PluginConfig.java (97%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/config/SettingsConfig.java (97%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/config/WorldConfig.java (100%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/config/WorldPerm.java (100%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/event/WorldAddmemberEvent.java (94%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/event/WorldCreateEvent.java (95%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/event/WorldDeleteEvent.java (95%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/event/WorldEvent.java (94%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/event/WorldLoadEvent.java (94%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/event/WorldRemovememberEvent.java (94%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/event/WorldResetEvent.java (94%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/event/WorldToggleFireEvent.java (94%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/event/WorldToggleTntEvent.java (94%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/event/WorldUnloadEvent.java (94%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/gui/GuiCommand.java (96%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/gui/PlayerOptionsGUI.java (100%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/gui/PlayersPageGUI.java (97%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/gui/WorldChooseGUI.java (96%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/gui/WorldOptionsGUI.java (96%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/gui/WorldSystemGUI.java (96%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/gui/clicklistener/ComingSoonClickListener.java (96%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/gui/clicklistener/CommandExecutorClickListener.java (95%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/gui/clicklistener/InventoryOpenClickListener.java (95%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/gui/playeroption/BuildStatus.java (96%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/gui/playeroption/GamemodeStatus.java (96%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/gui/playeroption/TeleportStatus.java (96%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/gui/playeroption/WorldEditStatus.java (100%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/gui/worldoption/FireStatus.java (96%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/gui/worldoption/TntStatus.java (96%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/listener/BlockListener.java (96%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/listener/CommandListener.java (96%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/listener/PlayerDeathListener.java (96%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/listener/PlayerListener.java (96%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/listener/WorldEditListener.java (100%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/util/TeleportUtil.java (95%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/wrapper/AsyncCreatorAdapter.java (95%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/wrapper/CreatorAdapter.java (95%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/wrapper/SystemWorld.java (96%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/wrapper/WorldPlayer.java (100%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/wrapper/WorldTemplate.java (94%) rename {WorldSystem/src => src}/main/java/de/butzlabben/world/wrapper/WorldTemplateProvider.java (96%) rename {WorldSystem/src => src}/main/java/org/bstats/bukkit/Metrics.java (97%) rename {WorldSystem/src => src}/main/resources/1_13_gui.yml (100%) rename {WorldSystem/src => src}/main/resources/LICENSE.txt (100%) rename {WorldSystem/src => src}/main/resources/config.yml (96%) rename {WorldSystem/bin => src/main/resources}/custom.yml (93%) rename {WorldSystem/src => src}/main/resources/de.yml (100%) rename {WorldSystem/src => src}/main/resources/en.yml (100%) rename {WorldSystem/src => src}/main/resources/es.yml (97%) rename {WorldSystem/src => src}/main/resources/fi.yml (97%) rename {WorldSystem/src => src}/main/resources/fr.yml (100%) rename {WorldSystem/bin => src/main/resources}/hu.yml (97%) rename {WorldSystem/bin => src/main/resources}/nl.yml (97%) rename {WorldSystem/src => src}/main/resources/old_gui.yml (100%) rename {WorldSystem/src => src}/main/resources/pl.yml (97%) rename {WorldSystem/src => src}/main/resources/plugin.yml (100%) rename {WorldSystem/src => src}/main/resources/ru.yml (98%) rename {WorldSystem/src => src}/main/resources/settings.yml (96%) rename {WorldSystem/src => src}/main/resources/zh.yml (97%) rename {WorldSystem/src => src}/test/java/de/butzlabben/autoupdater/test/UpdateInformationsTest.java (95%) diff --git a/WorldSystem/.gitignore b/.gitignore similarity index 93% rename from WorldSystem/.gitignore rename to .gitignore index fde7bce..e833fa8 100644 --- a/WorldSystem/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ -.idea/ -.settings/ -bin/ -WorldSystem.iml -.project +.idea/ +.settings/ +bin/ +WorldSystem.iml +.project .classpath /target/ diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 35eb1dd..94a25f7 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/WorldSystem/.classpath b/WorldSystem/.classpath deleted file mode 100644 index 047ca44..0000000 --- a/WorldSystem/.classpath +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/WorldSystem/.idea/misc.xml b/WorldSystem/.idea/misc.xml deleted file mode 100644 index c14dbda..0000000 --- a/WorldSystem/.idea/misc.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/WorldSystem/.idea/modules.xml b/WorldSystem/.idea/modules.xml deleted file mode 100644 index 0c8b36c..0000000 --- a/WorldSystem/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/WorldSystem/.idea/workspace.xml b/WorldSystem/.idea/workspace.xml deleted file mode 100644 index 88faaa8..0000000 --- a/WorldSystem/.idea/workspace.xml +++ /dev/null @@ -1,277 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1524410861721 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - No facets are configured - - - - - - - - - - - - - - - 1.8 - - - - - - - - WorldSystem - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/WorldSystem/.project b/WorldSystem/.project deleted file mode 100644 index 86bd134..0000000 --- a/WorldSystem/.project +++ /dev/null @@ -1,29 +0,0 @@ - - - WorldSystem - - - - - - org.eclipse.jdt.core.javabuilder - - - - - net.sourceforge.metrics.builder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.m2e.core.maven2Nature - org.eclipse.jdt.core.javanature - net.sourceforge.metrics.nature - - diff --git a/WorldSystem/.settings/org.eclipse.core.resources.prefs b/WorldSystem/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index b6b9453..0000000 --- a/WorldSystem/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,12 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/main/java/de/butzlabben/world/WorldSystem.java=UTF-8 -encoding//src/main/java/de/butzlabben/world/command/WSCommand.java=UTF-8 -encoding//src/main/java/de/butzlabben/world/config/GuiConfig.java=Cp1252 -encoding//src/main/java/de/butzlabben/world/config/PluginConfig.java=Cp1252 -encoding//src/main/java/de/butzlabben/world/gui/clicklistener/ComingSoonClickListener.java=Cp1252 -encoding//src/main/java/de/butzlabben/world/wrapper/SystemWorld.java=Cp1252 -encoding//src/main/resources=UTF-8 -encoding//src/test/java=UTF-8 -encoding//src/test/resources=UTF-8 -encoding/=UTF-8 diff --git a/WorldSystem/.settings/org.eclipse.jdt.core.prefs b/WorldSystem/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index e24b722..0000000 --- a/WorldSystem/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,13 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.release=disabled -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/WorldSystem/bin/config.yml b/WorldSystem/bin/config.yml deleted file mode 100644 index 6dbf4c1..0000000 --- a/WorldSystem/bin/config.yml +++ /dev/null @@ -1,94 +0,0 @@ -########################################################################## -### __ __ __ _______ __ ### -### \ \ / / / / / / ___/ / / ### -### \ \ __ / /___ ___/ /___/ / /____ ______/ /______________ ### -### \ \ / \ / / __ \/ _/ / __ /__ / / / / __/ __/ ___/ _ _ / ### -### \ \/ /\ \/ / /_/ / // / /_/ /__/ / /_/ /_ / /_/ ___/ // // / ### -### \__/ \__/\____/_//_/\__,_/____/\__, /___/\__/\___/_//_//_/ ### -### ___/ / ### -### \___/ ### -########################################################################## - -# Path where the worlds will be saved -worldfolder: 'plugins/WorldSystem/Worlds' - -# Name of the template world -worldsource: '' - -# If a confirm is needed before auto-update -need_confirm: true - -# When nobody is on a world time until it get unloaded -unloadingtime: 20 - -# If true nobody can teleport or change their gamemode a WorldSystem world -# Except for players with the permissions: ws.gamemode | ws.tp.* -survival: false - -# If true players will teleported to the spawn on join -spawn_teleportation: true - -# Time in seconds until a request expires -request_expires: 20 - -# Name of the languagefile in plugins/WorldSystem/messages/ -language: en - -# Prefix which will be shown before each message -prefix: '&8[&3WorldSystem&8] &6' - -# Time in days after a not used world will be deleted -# Set to -1 to disable -delete_after: -1 - -# Whether WorldSystem should contact the Mojang authserver -# If not, some unknown playernames will not be displayed -# eg. in the gui or in /ws info -contact_authserver: true - -# Options for the LagSystem: -# period_in_seconds - how often will be checked for entities in seconds -# entities_per_world - maximal allowed entities per world -# garbagecollector - how often will be unused ram be cleared -lagsystem: - period_in_seconds: 10 - entities_per_world: 350 - garbagecollector: - use: false - period_in_minutes: 5 - -# Options for random world generation -worldgeneration: - # A seed for worldgeneration - # Set it to 0 for no seed-useage - seed: 0 - # Environment for the world - # Valid inputs are 'NORMAL', 'NETHER' and 'THE_END' - environment: NORMAL - # Type of the world eg. flat, amplified, ... - # Valid types are 'NORMAL', 'VERSION_1_1', 'FLAT', 'AMPLIFIED', 'CUSTOMIZED' or 'LARGE_BIOMES' - type: NORMAL - # Put in here the name of a generator - # If you have one from one plugin - generator: '' - -# Location where you will be teleported when you leave you world -spawn: - gamemode: 2 - spawnpoint: - world: world - x: 0 - y: 20 - z: 0 - yaw: 0 - pitch: 0 - -# Location where you spawn when you join a world -worldspawn: - use: false - spawnpoint: - x: 0 - y: 20 - z: 0 - yaw: 0 - pitch: 0 diff --git a/WorldSystem/bin/de.yml b/WorldSystem/bin/de.yml deleted file mode 100644 index fa282b9..0000000 --- a/WorldSystem/bin/de.yml +++ /dev/null @@ -1,83 +0,0 @@ -nopermission: "&cDu besitzt keine Berechtigungen!" -unknown_error: "&cEtwas lief schief..." -lagdetection: "Lags in Welt: &c%world" -wrong_usage: "&c%usage" -not_registered: "&cDieser Spieler war noch nie auf dem Server" - -world: - reseted: "Deine Welt wurde zur\u00fcckgesetzt!" - still_loaded: "&cDeine Welt ist noch geladen!" - not_on: "&cDu bist auf keiner Welt!" - created: "Deine Welt ist nun bereit. Nutze &a/ws home" - already_exists: "&cDu besitzt bereits eine Welt!" - delete: - own: "&cDeine Welt wurde entfernt!" - other: "Die Welt von &c%player&6 wurde entfernt!" - does_not_exists: - own: "&cDu besitzt keine Welt!" - other: "&cDieser Spieler besitzt keine Welt!" - setting_up: "&aBereite Welt vor..." - playerlist: "Spieler in der Welt: %players" - still_creating: "&cWelt wird noch erstellt..." - set_home: "Du hast das Home gesetzt" - -member: - removed: "Du hast &c%player&6 von deiner Welt entfernt!" - added: "Du hast &c%player&6 zu deiner Welt hinzugef\u00fcgt!" - already_added: "&cDer Spieler ist bereits Mitglied deiner Welt!" - not_added: - own: "&cDer Spieler ist kein Mitglied deiner Welt!" - other: "&cDu bist nicht zu der Welt hinzugef\u00fcgt!" - no_one_added: "&cEs sind keine Mitglieder hinzugefügt" - -request: - expired: "&cDeine Anfrage ist ausgelaufen!" - confirm: "&cBitte bestätige das Zur\u00fccksetzen: %command" - until_expire: "&cDeine Anfrage l\u00e4uft in %time Sekunden aus!" - already_sent: "&cDu hast bereits eine Anfrage gesendet!" - not_sent: "&cDu hast keine Anfrage gesendet!" - invalid_input: "&c%input ist eine ung\u00fcltige Eingabe!" - -toggle: - gamemode: - enabled: "&a%player&6 kann nun seinen Spielmodus \u00e4ndern!" - disabled: "&c%player&6 kann seinen Spielmodus nicht mehr \u00e4ndern!" - teleport: - enabled: "&a%player&6 kann sich nun teleportieren!" - disabled: "&c%player&6 kann sich nicht l\u00e4nger teleportieren!" - build: - enabled: "&a%player&6 kann nun bauen!" - disabled: "&c%player&6 kann nicht mehr bauen!" - fire: - enabled: "&aFeuer aktiviert!" - disabled: "&cFeuer deaktiviert!" - tnt: - enabled: "&aTNT-Schaden aktiviert!" - disabled: "&cTNT-Schaden deaktiviert!" - -info: - owner: "Eigent\u00fcmer: %data" - id: "ID: %data" - member: "Mitglieder: %data" - tnt: "TNT: %data" - fire: "Feuer: %data" - enabled: "&aAn" - disabled: "&cAus" - -command_help: - list: - - "/ws get &8- &7Gibt dir eine Welt" - - "/ws home &8- &7Teleportiert dich auf deine Welt" - - "/ws sethome &8- &7Setzt ein bestimmtes Home" - - "/ws gui &8- &7\u00f6ffnets das GUI-Menu wenn du der Weltenbesitzer bist" - - "/ws tp &8- &7Teleportiert dich auf eine bestimmte Welt" - - "/ws addmember &8- &7F\u00fcgt jemanden zu deiner Welt hinzu" - - "/ws delmember&8 - &7Entfernt jemanden von deiner Welt" - - "/ws tnt &8- &7Erlaubt/Verbietet TNT auf deiner Welt" - - "/ws fire &8- &7Erlaubt/Verbietet Feuer auf deiner Welt" - - "/ws togglegm &8- &7Erlaubt/Verbietet einem Spieler den Spielmodus zu wechseln" - - "/ws togglebuild &8- &7Erlaubt/Verbietet einem Spieler zu bauen" - - "/ws toggletp &8- &7Erlaubt/Verbietet einem Spieler sich zu teleportieren" - - "/ws info &8- &7Zeigt Informationen \u00fcber die Welt" - - "/ws reset &8- &7Setzt deine Welt zur\u00fcck" - delete_command: "/ws delete &8- &7L\u00f6scht eine Welt" \ No newline at end of file diff --git a/WorldSystem/bin/en.yml b/WorldSystem/bin/en.yml deleted file mode 100644 index 2391716..0000000 --- a/WorldSystem/bin/en.yml +++ /dev/null @@ -1,84 +0,0 @@ -nopermission: "&cYou do not have permission to that command!" -unknown_error: "&cSomething went wrong..." -lagdetection: "Lagdetection in world: &c%world" -wrong_usage: "&c%usage" -not_registered: "&cThis player hasn't joined yet!" - -world: - reseted: "You would was reset!" - still_loaded: "&cYour world is still loaded!" - not_on: "&cYou are not on a world!" - created: "Your world is now ready. Get there with &a/ws home" - already_exists: "&cYou already have a world!" - delete: - own: "&cYour world was deleted!" - other: "You deleted the world of &c%player&6!" - does_not_exists: - own: "&cYou don't have a world!" - other: "&cThis player doesn't has a world!" - setting_up: "&aLoading world..." - playerlist: "Players in this world: %players" - still_creating: "&cWorld is still creating" - set_home: "You set the home" - -member: - removed: "You removed &c%player&6 from your world!" - added: "You have added &c%player&6 to your world!" - already_added: "&cThis player is already a member!" - not_added: - own: "&cThis player isn't a member!" - other: "&cYou have not been added to this world!" - no_one_added: "&cThere are no members added" - -request: - expired: "&cYour request has expired!" - confirm: "WARNING - Please confirm reset of your world: %command" - until_expire: "&cYour request expires in %time seconds!" - already_sent: "&cYou already sent a request!" - not_sent: "&cYou have not sent a request!" - invalid_input: "&c%input is not a valid request!" - -toggle: - gamemode: - enabled: "&a%player&6 can now change their gamemode!" - disabled: "&c%player&6 can no longer change their gamemode!" - teleport: - enabled: "&a%player&6 can now teleport!" - disabled: "&c%player&6 can no longer teleport!" - build: - enabled: "&a%player&6 can now build!" - disabled: "&c%player&6 can no longer build!" - fire: - enabled: "&aYou activated fire!" - disabled: "&cYou deactivated fire!" - tnt: - enabled: "&aYou activated TNT-Damage!" - disabled: "&cYou deactivated TNT-Damage!" - -info: - owner: "Owner: %data" - id: "ID: %data" - member: "Member: %data" - tnt: "TNT: %data" - fire: "Fire: %data" - enabled: "&aOn" - disabled: "&cOff" - -command_help: - list: - - "/ws get &8- &7Will give you a world" - - "/ws home &8- &7Teleports you on your world" - - "/ws sethome &8- &7Sets a specific home" - - "/ws gui &8- &7Opens the GUI menu if you are the world owner" - - "/ws tp &8- &7Teleports you on a specific world" - - "/ws addmember &8- &7Adds a player to your world" - - "/ws delmember &8- &7Removes a player from your world" - - "/ws leave &8- &7Leave a world" - - "/ws tnt &8- &7Allows/Denies TNT on your world" - - "/ws fire &8- &7Allows/Denies Fire on your world" - - "/ws togglegm &8- &7Allows/Denies a player changing gamemode" - - "/ws togglebuild &8- &7Allows/Denies a player building on your world" - - "/ws toggletp &8- &7Allows/Denies a player teleporting on your world" - - "/ws info &8- &7Shows information about the world" - - "/ws reset &8- &7Will reset your world" - delete_command: "/ws delete &8- &7Will delete a world" \ No newline at end of file diff --git a/WorldSystem/bin/es.yml b/WorldSystem/bin/es.yml deleted file mode 100644 index 6074f1d..0000000 --- a/WorldSystem/bin/es.yml +++ /dev/null @@ -1,84 +0,0 @@ -nopermission: "&cNo tienes permiso." -unknown_error: "&cAlgo salio mal..." -lagdetection: "Deteccion de lag en el mundo: &c%world" -wrong_usage: "&c%usage" -not_registered: "&cEse jugador no existe." - -world: - reseted: "Tu mundo ha sido reiniciado." - still_loaded: "&cTu mundo aun esta cargando." - not_on: "&cNo estas en un mundo." - created: "Tu mundo esta listo. Ve a el con &a/ws home&6." - already_exists: "&cYa tienes un mundo." - delete: - own: "&cTu mundo ha sido eliminado" - other: "Has eliminado el mundo de &c%player&6." - does_not_exists: - own: "&cNo tienes un mundo." - other: "&cEse jugador no tiene un mundo." - setting_up: "&aConfigurando el mundo..." - playerlist: "Jugadores en este mundo: %players" - still_creating: "&cWorld is still creating" - set_home: "You set the home" - -member: - removed: "Has eliminado a &c%player&6 de tu mundo." - added: "Has agregado a &c%player&6 a tu mundo." - already_added: "&cEse jugador ya es miembro de tu mundo." - not_added: - own: "&cEse jugador no es miembro de tu mundo." - other: "&cNo estas agregado a este mundo." - no_one_added: "&cThere are no members added" - -request: - expired: "&cTu solicitud ha expirado." - confirm: "&cPor favor confirma el reinicio de tu mundo con: %command" - until_expire: "&cTu solicitud expira en %time segundos." - already_sent: "&cYa has enviado una solicitud." - not_sent: "&cNo has enviado una solicitud." - invalid_input: "&c%input no es una entrada valida." - -toggle: - gamemode: - enabled: "&a%player&6 ahora puede cambiar su modo de juego." - disabled: "&c%player&6 ya no puede cambiar su modo de juego." - teleport: - enabled: "&a%player&6 ahora puede teletransportarse." - disabled: "&c%player&6 ya no puede teletransportarse." - build: - enabled: "&a%player&6 ahora puede construir." - disabled: "&c%player&6 ya no puede construir" - fire: - enabled: "&aHas activado el fuego." - disabled: "&cHas desactivado el fuego." - tnt: - enabled: "&aHas activado la TNT." - disabled: "&cHas desactivado la TNT." - -info: - owner: "Propietario: %data" - id: "ID: %data" - member: "Miembros: %data" - tnt: "TNT: %data" - fire: "Fuego: %data" - enabled: "&aSi" - disabled: "&cNo" - -command_help: - list: - - "/ws get &8- &7Obten tu mundo" - - "/ws home &8- &7Ve a tu mundo" - - "/ws sethome &8- &7Sets a specific home" - - "/ws gui &8- &7Abre el menu de tu mundo" - - "/ws tp &8- &7Ve a un mundo especifico" - - "/ws addmember &8- &7Agrega jugadores a tu mundo" - - "/ws delmember &8- &7Elimina jugadores de tu mundo" - - "/ws leave &8- &7Salir de un mundo" - - "/ws tnt &8- &7Activa/Desactiva la TNT en tu mundo" - - "/ws fire &8- &7Activa/Desactiva el FUEGO en tu mundo" - - "/ws togglegm &8- &7Activa/Desactiva el cambio de modo" - - "/ws togglebuild &8- &7Activa/Desactiva la construccion" - - "/ws toggletp &8- &7Activa/Desactiva la teletransportacion" - - "/ws info &8- &7Muestra informacion del mundo" - - "/ws reset &8- &7Reinicia tu mundo" - delete_command: "/ws delete &8- &7Elimina tu mundo" \ No newline at end of file diff --git a/WorldSystem/bin/pl.yml b/WorldSystem/bin/pl.yml deleted file mode 100644 index 1efe5cf..0000000 --- a/WorldSystem/bin/pl.yml +++ /dev/null @@ -1,84 +0,0 @@ -nopermission: "&cNie posiadasz uprawnień do tego!" -unknown_error: "&cCoś poszło nie tak..." -lagdetection: "Wykryto laga na świecie: &c%world" -wrong_usage: "&c%usage" -not_registered: "&cTen gracz nie dołączył jeszcze na serwer!" - -world: - reseted: "Twój świat został zresetowany!" - still_loaded: "&cTwój serwer wciąż się ładuje!" - not_on: "&cNie jesteś na swoim świecie!" - created: "Twój świat jest gotowy. Dostań się na niego za pomocą &a/ws home" - already_exists: "&cJuż posiadasz swój świat!" - delete: - own: "&cTwój świat został skasowany!" - other: "Usunąłeś świat gracza: &c%player&6!" - does_not_exists: - own: "&cNie masz swojego świata!" - other: "&cTen gracz nie ma swojego świata!" - setting_up: "&aUstawianie świata..." - playerlist: "Gracze na tym świecie: %players" - still_creating: "&cWorld is still creating" - set_home: "You set the home" - -member: - removed: "Usunąłeś &c%player&6 ze swojego świata!" - added: "Dodałeś &c%player&6 na swój świat!" - already_added: "&cTen gracz jest już dodany na Twoim świecie!" - not_added: - own: "&cTen gracz nie jest dodany do Twojego świata!" - other: "&cNie jesteś dodany na ten świat!" - no_one_added: "&cThere are no members added" - -request: - expired: "&cTwoja prośba wygasła!" - confirm: "&cPotwierdź zresetowanie swojego świata komendą: %command" - until_expire: "&cTwója prośba wygaśnie za %time sek.!" - already_sent: "&cJuż wysłałeś prośbę!" - not_sent: "&cNie wysłałeś prośby!" - invalid_input: "&c%input nie jest poprawnym argumentem komendy!" - -toggle: - gamemode: - enabled: "&a%player&6 może teraz zmienić swój gamemode!" - disabled: "&c%player&6 nie może już zmienić swojego gamemode!" - teleport: - enabled: "&a%player&6 może teleportować się!" - disabled: "&c%player&6 nie może teleportować się!" - build: - enabled: "&a%player&6 może budować!" - disabled: "&c%player&6 nie może już budować!" - fire: - enabled: "&aWłączyłeś ogień!" - disabled: "&cWyłączyłeś ogień!" - tnt: - enabled: "&aWłączyłeś obrażenia od TNT!" - disabled: "&cWyłączyłeś obrażenia od TNT!" - -info: - owner: "Właściciel: %data" - id: "ID: %data" - member: "Członek: %data" - tnt: "TNT: %data" - fire: "Ogień: %data" - enabled: "&aWłączone" - disabled: "&cWyłączone" - -command_help: - list: - - "/ws get &8- &7Tworzy Twój świat" - - "/ws home &8- &7Teleportuje Cie na Twój świat" - - "/ws sethome &8- &7Sets a specific home" - - "/ws gui &8- &7Otwiera GUI świata jeżeli jesteś jego właścicielem" - - "/ws tp &8- &7Teleportuje Cie na określony świat" - - "/ws addmember &8- &7Dodaj gracza na swój świat" - - "/ws delmember &8- &7Usuń gracza ze swojego świata" - - "/ws leave &8- &7Opuść świat" - - "/ws tnt &8- &7Zezwól/Odmów TNT na swoim świecie" - - "/ws fire &8- &7Zezwól/Odmów Ogień na swoim świecie" - - "/ws togglegm &8- &7Zezwól/Odmów graczowi zmieniać swój gamemode" - - "/ws togglebuild &8- &7Zezwól/Odmów graczowi budowanie" - - "/ws toggletp &8- &7Zezwól/Odmów graczowi teleportowanie się" - - "/ws info &8- &7Pokazuje informacje o świecie" - - "/ws reset &8- &7Zresetuje Twój świat" - delete_command: "/ws delete &8- &7Usunie Twój świat" \ No newline at end of file diff --git a/WorldSystem/bin/plugin.yml b/WorldSystem/bin/plugin.yml deleted file mode 100644 index 38d81ab..0000000 --- a/WorldSystem/bin/plugin.yml +++ /dev/null @@ -1,119 +0,0 @@ -name: WorldSystem -version: 2.3.1.4 -author: Butzlabben -main: de.butzlabben.world.WorldSystem - -api-version: 1.13 - -loadbefore: [FastAsyncWorldEdit, WorldEdit] - -commands: - ws: - description: Commands for WorldSystem - usage: /ws - ws get: - usage: /ws get - permission: ws.get - ws help: - usage: /ws help - ws home: - usage: /ws home - ws sethome: - usage: /ws sethome - permission: ws.sethome - ws addmember: - usage: /ws addmember - ws delmember: - usage: /ws delmember - ws leave: - usage: /ws leave - ws tp: - usage: /ws tp - ws tnt: - usage: /ws tnt - ws fire: - usage: /ws fire - ws info: - usage: /ws info - ws togglebuild: - usage: /ws togglebuild - ws togglegm: - usage: /ws togglegm - ws toggletp: - usage: /ws toggletp - ws reset: - usage: /ws reset - ws gui: - usage: /ws gui - ws delete: - usage: /ws delete - permission: ws.delete - ws confirm: - usage: /ws confirm - permission: ws.confirm - -permissions: - ws.*: - default: op - description: Gives '*'-Perms to all Commands - children: - ws.tp.*: true - ws.get: true - ws.sethome: true - ws.tp.world: true - ws.tp.toother: true - ws.tp.other: true - ws.build: true - ws.gamemode: true - ws.delete: true - ws.lag: true - ws.big: true - ws.large: true - ws.confirm: true - ws.sethome: - default: true - description: 'You can set a different worldspawn' - ws.tp.*: - default: op - description: You can teleport everything - children: - ws.tp.toother: true - ws.tp.other: true - ws.tp.world: true - ws.build: - default: op - description: You can build on other Worlds without WorldPermissions - ws.get: - default: true - description: You can create a world via /ws get - ws.delete: - default: op - description: You can delete a world - ws.gamemode: - default: op - description: You can change GameMode on other worlds - ws.tp.other: - default: op - description: You can teleport other persons - ws.tp.toother: - default: op - description: You can teleport across worlds - ws.tp.world: - default: op - description: You can teleport to without rights World - ws.lag: - default: op - description: You can see lag messages - ws.big: - default: op - description: Gives you a bigger world (if set) - ws.large: - default: op - children: - ws.big: true - description: Gives you a even bigger world (if set) - ws.confirm: - default: op - description: You can confirm (if needed) an auto-update - -default-permission: admin \ No newline at end of file diff --git a/WorldSystem/bin/settings.yml b/WorldSystem/bin/settings.yml deleted file mode 100644 index b03b781..0000000 --- a/WorldSystem/bin/settings.yml +++ /dev/null @@ -1,52 +0,0 @@ -# Center will be at the spawn or the worldspawn -worldborder: - # If WorldSystem should change the worldborder - should_change: true - # Default size - normal: 500 - # Here you can define your own ranks, as many as you want - # The permission node will be the key and the value the size - ranks: - # For example, with the permission ws.big you will get a worldborder with the size 1000 - ws.big: 1000 - ws.bigger: 1500 - - # Set a specialized center which is not the spawn - center: - as_spawn: true - # Should the worldborder move with the home set by the owner - as_home: false - x: 0 - y: 20 - z: 0 - -# All Gamerules in 1.12 -# Not supported gamerules will be ignored -# -# If you need help, look at -# https://minecraft.gamepedia.com/Commands/gamerule - -announceAdvancements: true -commandBlockOutput: false -disableElytraMovementCheck: false -doDaylightCycle: false -doEntityDrops: true -doFireTick: true -doLimitedCrafting: false -doMobLoot: true -doMobSpawning: true -doTileDrops: false -doWeatherCycle: false -gameLoopFunction: false -keepInventory: true -logAdminCommands: true -maxCommandChainLength: 65536 -maxEntityCramming: 24 -mobGriefing: true -naturalRegeneration: true -randomTickSpeed: 3 -reducedDebugInfo: false -sendCommandFeedback: true -showDeathMessages: true -spawnRadius: 10 -spectatorsGenerateChunks: true \ No newline at end of file diff --git a/WorldSystem/src/main/resources/custom.yml b/WorldSystem/src/main/resources/custom.yml deleted file mode 100644 index da7de8d..0000000 --- a/WorldSystem/src/main/resources/custom.yml +++ /dev/null @@ -1,82 +0,0 @@ -nopermission: "" -unknown_error: "" -lagdetection: "%world" -wrong_usage: "" -not_registered: "" - -world: - reseted: "" - still_loaded: "" - not_on: "" - created: "" - already_exists: "" - delete: - own: "" - other: "%player" - does_not_exists: - own: "" - other: "" - setting_up: "" - playerlist: "%players" - still_creating: "" - set_home: "" - -member: - removed: "%player" - added: "%player" - already_added: " - not_added: - own: "" - other: "" - no_one_added - -request: - expired: "" - confirm: "%command" - until_expire: "%time" - already_sent: "" - not_sent: "" - invalid_input: "%input" - -toggle: - gamemode: - enabled: "" - disabled: "" - teleport: - enabled: "" - disabled: "" - build: - enabled: "" - disabled: "" - fire: - enabled: "" - disabled: "" - tnt: - enabled: "" - disabled: "" - -info: - owner: "%data" - id: "%data" - member: "%data" - tnt: "%data" - fire: "%data" - enabled: "" - disabled: "" - -command_help: - list: - - "" - - "" - - "" - - "" - - "" - - "" - - "" - - "" - - "" - - "" - - "" - - "" - - "" - delete_command: "" \ No newline at end of file diff --git a/WorldSystem/src/main/resources/hu.yml b/WorldSystem/src/main/resources/hu.yml deleted file mode 100644 index 8b5fcbe..0000000 --- a/WorldSystem/src/main/resources/hu.yml +++ /dev/null @@ -1,85 +0,0 @@ -nopermission: "&cNincs jogod ehhez!" -unknown_error: "&cValami elromlott..." -lagdetection: "Lagdetection a vilgban: &c%world" -wrong_usage: "&c%usage" -not_registered: "&cEz a jtkos mg nem csatlakozott!" - -world: - reseted: "A vilgod vissza lett lltva!" - still_loaded: "&cA vilgod mg mindig be van tltve!" - not_on: "&cNem vagy a vilgon!" - created: "A vilgod kszen ll. Szllj fel a &a/ws home" - already_exists: "&cMr van vilgod!" - delete: - own: "&cA vilgot trlve!" - other: "Trlte a vilgot &c%player&6 jtkostl!" - does_not_exists: - own: "&cNincs vilgod!" - other: "&cEz a jtkos nem rendelkezik vilggal!" - setting_up: "&aA vilg megteremtse..." - playerlist: "Jtkos ebben a vilgban: %player" - still_creating: "&cWorld is still creating" - set_home: "You set the home" - -member: - removed: "Trlted &c%player&6 jtkost a vilgodbl!" - added: "Hozzadtad &c%player&6 jtkost a vilgodhoz!" - already_added: "&cEz a jtkos mr tagja!" - not_added: - own: "&cEz a jtkos nem tagja!" - other: "&cNem vagy hozzadva ehhez a vilghoz" - still_creating: "&cWorld is still creating" - no_one_added: "&cThere are no members added" - -request: - expired: "&cA krelem lejrt!" - confirm: "&cKrjk, erstsd meg a vilg jraindtst: %command" - until_expire: "&cA krs lejrati ideje %time msodperc!" - already_sent: "&cMr elkldtl egy krelmet!" - not_sent: "&cNem kldtl krst!" - invalid_input: "&c%input nem rvnyes bemenet!" - -toggle: - gamemode: - enabled: "&a%player&6 most megvltoztathatja jtkmdjt!" - disabled: "&c%player&6 mr nem tudja megvltoztatni jtkmdjt!" - teleport: - enabled: "&a%player&6 most teleportlhat!" - disabled: "&c%player&6 mr nem teleportlhat!" - build: - enabled: "&a%player&6 most pthet!" - disabled: "&c%player&6 mr nem pthet!" - fire: - enabled: "&aAktivltad a tzet!" - disabled: "&cDeaktivltad a tzet!" - tnt: - enabled: "&aAktivltad a TNT-sebzst!" - disabled: "&cDeaktivltad TNT-sebzst!" - -info: - owner: "Tulajdonos: %data" - id: "ID: %data" - member: "Tag: %data" - tnt: "TNT: %data" - fire: "Tz: %data" - enabled: "&aBe" - disabled: "&cKi" - -command_help: - list: - - "/ws get &8- &7Will give you a world" - - "/ws home &8- &7Teleports you on your world" - - "/ws sethome &8- &7Sets a specific home" - - "/ws gui &8- &7Opens the GUI menu if you are the worldowner" - - "/ws tp &8- &7Teleports you on a specific world" - - "/ws addmember &8- &7Adds a player to your world" - - "/ws delmember &8- &7Removes a player from your world" - - "/ws leave &8- &7Leave a world" - - "/ws tnt &8- &7Allows/Denys TNT on your world" - - "/ws fire &8- &7Allows/Denys Fire on your world" - - "/ws togglegm &8- &7Allows/Denys a player changing gamemode" - - "/ws togglebuild &8- &7Allows/Denys a player building" - - "/ws toggletp &8- &7Allows/Denys a player teleporting" - - "/ws info &8- &7Shows information about the world" - - "/ws reset &8- &7Will reset your world" - delete_command: "/ws delete &8- &7Will delete a world" \ No newline at end of file diff --git a/WorldSystem/src/main/resources/nl.yml b/WorldSystem/src/main/resources/nl.yml deleted file mode 100644 index 6c27605..0000000 --- a/WorldSystem/src/main/resources/nl.yml +++ /dev/null @@ -1,84 +0,0 @@ -nopermission: "&cJij hebt geen rechten om dit te doen!" -unknown_error: "&cEr is iets verkeerd gegaan.." -lagdetection: "Lag gededecteerd in wereld: &c%world" -wrong_usage: "&c%gebruik" -not_registered: "&cDeze speler heeft nog nooit gejoined!" - -world: - reseted: "Jouw wereld is gereset!" - still_loaded: "&cJouw wereld is nog steeds geladen!" - not_on: "&cJij bent niet in een wereld!" - created: "Jouw wereld is gemaakt gebruik: &a/ws home" - already_exists: "&cJij hebt al een wereld!" - delete: - own: "&cJouw wereld is verwijderd!" - other: "Jij hebt de wereld verwijderd van: &c%player&6!" - does_not_exists: - own: "&cJij hebt nog geen wereld!" - other: "&cDeze speler heeft nog geen wereld!" - setting_up: "&aWereld word aangemaakt" - playerlist: "speler is in wereld: %players" - still_creating: "&cWorld is still creating" - set_home: "You set the home" - -member: - removed: "Jij hebt &c%player&6 verwijderd van jouw wereld!" - added: "Jij hebt &c%player&6 toegevoegd aan jouw wereld!" - already_added: "&cDeze speler is al toegevoegd!" - not_added: - own: "&cDeze speler is nog niet toegevoegd!" - other: "&cJij bent niet aan deze wereld toegevoegd" - no_one_added: "&cThere are no members added" - -request: - expired: "&cJouw uitnodiging is verlopen!" - confirm: "&cBevestig het verwijderen van jouw wereld: %command" - until_expire: "&cJouw uitnodiging verloopt over %time seconden!" - already_sent: "&cJij hebt al een uitnodiging verstuurd!" - not_sent: "&cJij hebt geen uitnodiging gestuurd!" - invalid_input: "&c%input is niet een command!" - -toggle: - gamemode: - enabled: "&a%player&6 kan nu zijn spelermodus veranderen!" - disabled: "&c%player&6 kan niet meer zijn spelermodus veranderen!" - teleport: - enabled: "&a%player&6 kan nu teleporteren!" - disabled: "&c%player&6 kan nu niet meer teleporteren!" - build: - enabled: "&a%player&6 kan nu bouwen!" - disabled: "&c%player&6 kan nu niet meer bouwen!" - fire: - enabled: "&aJij hebt vuur geactiveert!" - disabled: "&cJij hebt vuur gedeactiveerd!" - tnt: - enabled: "&aJij hebt TNT-schade geactiveerd!" - disabled: "&cJij hebt TNT-schade gedeactiveerd!" - -info: - owner: "Owner: %data" - id: "ID: %data" - member: "Toegevoegd: %data" - tnt: "TNT: %data" - fire: "Vuur: %data" - enabled: "&Aan" - disabled: "&cUit" - -command_help: - list: - - "/ws get &8- &7Will give you a world" - - "/ws home &8- &7Teleports you on your world" - - "/ws sethome &8- &7Sets a specific home" - - "/ws gui &8- &7Opens the GUI menu if you are the worldowner" - - "/ws tp &8- &7Teleports you on a specific world" - - "/ws addmember &8- &7Adds a player to your world" - - "/ws delmember &8- &7Removes a player from your world" - - "/ws leave &8- &7Leave a world" - - "/ws tnt &8- &7Allows/Denys TNT on your world" - - "/ws fire &8- &7Allows/Denys Fire on your world" - - "/ws togglegm &8- &7Allows/Denys a player changing gamemode" - - "/ws togglebuild &8- &7Allows/Denys a player building" - - "/ws toggletp &8- &7Allows/Denys a player teleporting" - - "/ws info &8- &7Shows information about the world" - - "/ws reset &8- &7Will reset your world" - delete_command: "/ws delete &8- &7Will delete a world" \ No newline at end of file diff --git a/WorldSystem/pom.xml b/pom.xml similarity index 100% rename from WorldSystem/pom.xml rename to pom.xml diff --git a/WorldSystem/src/main/java/LICENSE.txt b/src/main/java/LICENSE.txt similarity index 100% rename from WorldSystem/src/main/java/LICENSE.txt rename to src/main/java/LICENSE.txt diff --git a/WorldSystem/src/main/java/de/butzlabben/autoupdater/AutoUpdate.java b/src/main/java/de/butzlabben/autoupdater/AutoUpdate.java similarity index 95% rename from WorldSystem/src/main/java/de/butzlabben/autoupdater/AutoUpdate.java rename to src/main/java/de/butzlabben/autoupdater/AutoUpdate.java index 5d0be49..f38fc40 100644 --- a/WorldSystem/src/main/java/de/butzlabben/autoupdater/AutoUpdate.java +++ b/src/main/java/de/butzlabben/autoupdater/AutoUpdate.java @@ -1,53 +1,53 @@ -package de.butzlabben.autoupdater; - -import java.io.FileOutputStream; -import java.io.IOException; -import java.net.URL; -import java.nio.channels.Channels; -import java.nio.channels.FileChannel; -import java.nio.channels.ReadableByteChannel; - -/** - * @author Butzlabben - * @since 02.05.2018 - */ -public class AutoUpdate implements Runnable { - - private UpdateInformations ui; - private String jar; - - public AutoUpdate(UpdateInformations ui, String jar) { - this.ui = ui; - this.jar = jar; - } - - @Override - public void run() { - FileChannel out = null; - FileOutputStream outStream = null; - try { - - ReadableByteChannel in = Channels - .newChannel(new URL(ui.getURL()).openStream()); - outStream = new FileOutputStream(jar); - out = outStream.getChannel(); - out.transferFrom(in, 0, Long.MAX_VALUE); - } catch (Exception e) { - e.printStackTrace(); - } finally { - if (out != null) - try { - out.close(); - } catch (IOException e) { - e.printStackTrace(); - } - if (outStream != null) { - try { - outStream.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - } -} +package de.butzlabben.autoupdater; + +import java.io.FileOutputStream; +import java.io.IOException; +import java.net.URL; +import java.nio.channels.Channels; +import java.nio.channels.FileChannel; +import java.nio.channels.ReadableByteChannel; + +/** + * @author Butzlabben + * @since 02.05.2018 + */ +public class AutoUpdate implements Runnable { + + private UpdateInformations ui; + private String jar; + + public AutoUpdate(UpdateInformations ui, String jar) { + this.ui = ui; + this.jar = jar; + } + + @Override + public void run() { + FileChannel out = null; + FileOutputStream outStream = null; + try { + + ReadableByteChannel in = Channels + .newChannel(new URL(ui.getURL()).openStream()); + outStream = new FileOutputStream(jar); + out = outStream.getChannel(); + out.transferFrom(in, 0, Long.MAX_VALUE); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (out != null) + try { + out.close(); + } catch (IOException e) { + e.printStackTrace(); + } + if (outStream != null) { + try { + outStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } +} diff --git a/WorldSystem/src/main/java/de/butzlabben/autoupdater/AutoUpdater.java b/src/main/java/de/butzlabben/autoupdater/AutoUpdater.java similarity index 96% rename from WorldSystem/src/main/java/de/butzlabben/autoupdater/AutoUpdater.java rename to src/main/java/de/butzlabben/autoupdater/AutoUpdater.java index 9f04dc1..d5ecebd 100644 --- a/WorldSystem/src/main/java/de/butzlabben/autoupdater/AutoUpdater.java +++ b/src/main/java/de/butzlabben/autoupdater/AutoUpdater.java @@ -1,127 +1,127 @@ -package de.butzlabben.autoupdater; - -import java.io.File; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.HandlerList; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.plugin.Plugin; -import org.bukkit.plugin.java.JavaPlugin; - -import de.butzlabben.world.config.PluginConfig; - -/** - * @author Butzlabben - * @since 01.05.2018 - */ -public class AutoUpdater implements Listener { - - private boolean confirmed; - private boolean confirmNeed; - private static AutoUpdater instance; - private AutoUpdate au; - - public static void startAsync() { - Thread t = new Thread(() -> { - getInstance(); - }); - t.setName("update-thread-worldsystem"); - t.start(); - } - - public static synchronized AutoUpdater getInstance() { - if (instance == null) - instance = new AutoUpdater(); - return instance; - } - - private AutoUpdater() { - confirmNeed = PluginConfig.confirmNeed(); - UpdateInformations ui = UpdateInformations.getInformations(); - if (ui == null) { - Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "§cCouldn't contact autoupdate server"); - return; - } - Plugin plugin = Bukkit.getPluginManager().getPlugin(ui.getPlugin()); - if (plugin == null) - return; - String v = plugin.getDescription().getVersion(); - if (!ui.getVersion().equals(plugin.getDescription().getVersion())) { - - if (!ui.isSilent()) { - Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "Found new version. Current: " + v - + ", Available: " + ui.getVersion()); - } - // Get jar file - Method getFileMethod = null; - try { - getFileMethod = JavaPlugin.class.getDeclaredMethod("getFile"); - } catch (NoSuchMethodException | SecurityException e1) { - e1.printStackTrace(); - return; - } - getFileMethod.setAccessible(true); - File file = null; - - try { - file = (File) getFileMethod.invoke(plugin); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - e.printStackTrace(); - return; - } - - getFileMethod.setAccessible(false); - - String jar = file.getAbsolutePath(); - au = new AutoUpdate(ui, jar); - if (ui.isSilent() || !confirmNeed) { - Runtime.getRuntime().addShutdownHook(new Thread(au)); - if (!ui.isSilent()) - Bukkit.getConsoleSender().sendMessage( - PluginConfig.getPrefix() + "§aAutoupdate confirmed, §crestart §ato apply changes"); - confirmed = true; - } else { - Bukkit.getPluginManager().registerEvents(this, plugin); - for (Player p : Bukkit.getOnlinePlayers()) { - p.sendMessage( - PluginConfig.getPrefix() + "§aFound new update. Confirm autoupdate with §c/ws confirm"); - p.sendMessage(PluginConfig.getPrefix() + "§aRead changelogs: https://www.spigotmc.org/resources/49756/updates"); - } - Bukkit.getConsoleSender().sendMessage( - PluginConfig.getPrefix() + "§aFound new update. Confirm autoupdate with §c/ws confirm"); - Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "§aRead changelogs: https://www.spigotmc.org/resources/49756/updates"); - } - } else { - confirmNeed = false; - } - } - - @EventHandler - public void on(PlayerJoinEvent e) { - if (e.getPlayer().hasPermission("ws.confirm")) { - e.getPlayer().sendMessage( - PluginConfig.getPrefix() + "§aFound new update. Confirm autoupdate with §c/ws confirm"); - e.getPlayer().sendMessage(PluginConfig.getPrefix() + "§aRead changelogs: https://www.spigotmc.org/resources/49756/updates"); - } - } - - public boolean confirm() { - if (confirmNeed && !confirmed) { - Runtime.getRuntime().addShutdownHook(new Thread(au)); - confirmed = true; - HandlerList.unregisterAll(this); - return true; - } - return false; - } - - public boolean confirmed() { - return confirmed; - } - -} +package de.butzlabben.autoupdater; + +import java.io.File; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.plugin.Plugin; +import org.bukkit.plugin.java.JavaPlugin; + +import de.butzlabben.world.config.PluginConfig; + +/** + * @author Butzlabben + * @since 01.05.2018 + */ +public class AutoUpdater implements Listener { + + private boolean confirmed; + private boolean confirmNeed; + private static AutoUpdater instance; + private AutoUpdate au; + + public static void startAsync() { + Thread t = new Thread(() -> { + getInstance(); + }); + t.setName("update-thread-worldsystem"); + t.start(); + } + + public static synchronized AutoUpdater getInstance() { + if (instance == null) + instance = new AutoUpdater(); + return instance; + } + + private AutoUpdater() { + confirmNeed = PluginConfig.confirmNeed(); + UpdateInformations ui = UpdateInformations.getInformations(); + if (ui == null) { + Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "§cCouldn't contact autoupdate server"); + return; + } + Plugin plugin = Bukkit.getPluginManager().getPlugin(ui.getPlugin()); + if (plugin == null) + return; + String v = plugin.getDescription().getVersion(); + if (!ui.getVersion().equals(plugin.getDescription().getVersion())) { + + if (!ui.isSilent()) { + Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "Found new version. Current: " + v + + ", Available: " + ui.getVersion()); + } + // Get jar file + Method getFileMethod = null; + try { + getFileMethod = JavaPlugin.class.getDeclaredMethod("getFile"); + } catch (NoSuchMethodException | SecurityException e1) { + e1.printStackTrace(); + return; + } + getFileMethod.setAccessible(true); + File file = null; + + try { + file = (File) getFileMethod.invoke(plugin); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + e.printStackTrace(); + return; + } + + getFileMethod.setAccessible(false); + + String jar = file.getAbsolutePath(); + au = new AutoUpdate(ui, jar); + if (ui.isSilent() || !confirmNeed) { + Runtime.getRuntime().addShutdownHook(new Thread(au)); + if (!ui.isSilent()) + Bukkit.getConsoleSender().sendMessage( + PluginConfig.getPrefix() + "§aAutoupdate confirmed, §crestart §ato apply changes"); + confirmed = true; + } else { + Bukkit.getPluginManager().registerEvents(this, plugin); + for (Player p : Bukkit.getOnlinePlayers()) { + p.sendMessage( + PluginConfig.getPrefix() + "§aFound new update. Confirm autoupdate with §c/ws confirm"); + p.sendMessage(PluginConfig.getPrefix() + "§aRead changelogs: https://www.spigotmc.org/resources/49756/updates"); + } + Bukkit.getConsoleSender().sendMessage( + PluginConfig.getPrefix() + "§aFound new update. Confirm autoupdate with §c/ws confirm"); + Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "§aRead changelogs: https://www.spigotmc.org/resources/49756/updates"); + } + } else { + confirmNeed = false; + } + } + + @EventHandler + public void on(PlayerJoinEvent e) { + if (e.getPlayer().hasPermission("ws.confirm")) { + e.getPlayer().sendMessage( + PluginConfig.getPrefix() + "§aFound new update. Confirm autoupdate with §c/ws confirm"); + e.getPlayer().sendMessage(PluginConfig.getPrefix() + "§aRead changelogs: https://www.spigotmc.org/resources/49756/updates"); + } + } + + public boolean confirm() { + if (confirmNeed && !confirmed) { + Runtime.getRuntime().addShutdownHook(new Thread(au)); + confirmed = true; + HandlerList.unregisterAll(this); + return true; + } + return false; + } + + public boolean confirmed() { + return confirmed; + } + +} diff --git a/WorldSystem/src/main/java/de/butzlabben/autoupdater/UpdateInformations.java b/src/main/java/de/butzlabben/autoupdater/UpdateInformations.java similarity index 100% rename from WorldSystem/src/main/java/de/butzlabben/autoupdater/UpdateInformations.java rename to src/main/java/de/butzlabben/autoupdater/UpdateInformations.java diff --git a/WorldSystem/src/main/java/de/butzlabben/inventory/CostumInv.java b/src/main/java/de/butzlabben/inventory/CostumInv.java similarity index 94% rename from WorldSystem/src/main/java/de/butzlabben/inventory/CostumInv.java rename to src/main/java/de/butzlabben/inventory/CostumInv.java index eea73bd..4553008 100644 --- a/WorldSystem/src/main/java/de/butzlabben/inventory/CostumInv.java +++ b/src/main/java/de/butzlabben/inventory/CostumInv.java @@ -1,16 +1,16 @@ -package de.butzlabben.inventory; - -/** - * @author Butzlabben - * @since 28.06.2018 - */ -public class CostumInv extends OrcInventory { - - public CostumInv(String title, int rows) { - super(title, rows); - } - - public CostumInv(String title, int rows, boolean fill) { - super(title, rows, fill); - } -} +package de.butzlabben.inventory; + +/** + * @author Butzlabben + * @since 28.06.2018 + */ +public class CostumInv extends OrcInventory { + + public CostumInv(String title, int rows) { + super(title, rows); + } + + public CostumInv(String title, int rows, boolean fill) { + super(title, rows, fill); + } +} diff --git a/WorldSystem/src/main/java/de/butzlabben/inventory/DependListener.java b/src/main/java/de/butzlabben/inventory/DependListener.java similarity index 95% rename from WorldSystem/src/main/java/de/butzlabben/inventory/DependListener.java rename to src/main/java/de/butzlabben/inventory/DependListener.java index aeef102..76781c3 100644 --- a/WorldSystem/src/main/java/de/butzlabben/inventory/DependListener.java +++ b/src/main/java/de/butzlabben/inventory/DependListener.java @@ -1,12 +1,12 @@ -package de.butzlabben.inventory; - -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -import de.butzlabben.world.wrapper.WorldPlayer; - -public interface DependListener { - - public ItemStack getItemStack(Player p, WorldPlayer wp); - -} +package de.butzlabben.inventory; + +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import de.butzlabben.world.wrapper.WorldPlayer; + +public interface DependListener { + + public ItemStack getItemStack(Player p, WorldPlayer wp); + +} diff --git a/WorldSystem/src/main/java/de/butzlabben/inventory/OrcClickListener.java b/src/main/java/de/butzlabben/inventory/OrcClickListener.java similarity index 95% rename from WorldSystem/src/main/java/de/butzlabben/inventory/OrcClickListener.java rename to src/main/java/de/butzlabben/inventory/OrcClickListener.java index ca9fa1a..45ce17c 100644 --- a/WorldSystem/src/main/java/de/butzlabben/inventory/OrcClickListener.java +++ b/src/main/java/de/butzlabben/inventory/OrcClickListener.java @@ -1,9 +1,9 @@ -package de.butzlabben.inventory; - -import org.bukkit.entity.Player; - -public interface OrcClickListener { - - public void onClick(Player p, OrcInventory inv, OrcItem item); - -} +package de.butzlabben.inventory; + +import org.bukkit.entity.Player; + +public interface OrcClickListener { + + public void onClick(Player p, OrcInventory inv, OrcItem item); + +} diff --git a/WorldSystem/src/main/java/de/butzlabben/inventory/OrcInventory.java b/src/main/java/de/butzlabben/inventory/OrcInventory.java similarity index 95% rename from WorldSystem/src/main/java/de/butzlabben/inventory/OrcInventory.java rename to src/main/java/de/butzlabben/inventory/OrcInventory.java index 784d781..08278b2 100644 --- a/WorldSystem/src/main/java/de/butzlabben/inventory/OrcInventory.java +++ b/src/main/java/de/butzlabben/inventory/OrcInventory.java @@ -1,113 +1,113 @@ -package de.butzlabben.inventory; - -import java.util.HashMap; -import java.util.Map.Entry; -import java.util.Objects; - -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.InventoryType; -import org.bukkit.inventory.Inventory; - -public abstract class OrcInventory { - - protected String title; - private int rows; - private InventoryType type; - private boolean fill = false; - - protected HashMap items = new HashMap<>(); - - public OrcInventory(String title) { - Objects.requireNonNull(title, "title cannot be null"); - this.title = title; - } - - public OrcInventory(String title, int rows) { - this(title); - if (rows <= 0 || rows > 6) - throw new IllegalArgumentException("rows cannot be smaller than 1 or bigger than 6"); - this.rows = rows; - } - - public OrcInventory(String title, int rows, boolean fill) { - this(title, rows); - this.fill = fill; - if(this.fill) { - for (int i = 0; i < rows * 9; i++) { - items.put(i, OrcItem.fill); - } - } - } - - public OrcInventory(String title, InventoryType type) { - this(title); - if (type == null || type == InventoryType.CHEST) { - this.type = null; - rows = 3; - } else { - this.type = type; - } - } - - public void addItem(int slot, OrcItem item) { - if (item == null) { - removeItem(slot); - } else { - items.put(slot, item); - } - } - - public void addItem(int row, int col, OrcItem item) { - addItem(row * 9 + col, item); - } - - public void removeItem(int slot) { - items.remove(slot); - } - - public void removeItem(int row, int col) { - removeItem(row * 9 + col); - } - - public Inventory getInventory(Player p) { - return getInventory(p, title); - } - - public void redraw(Player p) { - p.closeInventory(); - p.openInventory(getInventory(p)); - } - - public Inventory getInventory(Player p, String title) { - Inventory inv; - int size; - if (type == null) { - inv = Bukkit.createInventory(null, rows * 9, title); - size = rows * 9; - } else { - inv = Bukkit.createInventory(null, type, title); - size = type.getDefaultSize(); - } - - for (Entry entry : items.entrySet()) { - if (entry.getKey() >= 0 && entry.getKey() < size) { - inv.setItem(entry.getKey(), entry.getValue().getItemStack(p)); - } else { - System.err.println("There is a problem with a configured Item!"); - } - } - - OrcListener.getInstance().register(p.getUniqueId(), this); - - return inv; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getTitle() { - return title; - } -} +package de.butzlabben.inventory; + +import java.util.HashMap; +import java.util.Map.Entry; +import java.util.Objects; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.InventoryType; +import org.bukkit.inventory.Inventory; + +public abstract class OrcInventory { + + protected String title; + private int rows; + private InventoryType type; + private boolean fill = false; + + protected HashMap items = new HashMap<>(); + + public OrcInventory(String title) { + Objects.requireNonNull(title, "title cannot be null"); + this.title = title; + } + + public OrcInventory(String title, int rows) { + this(title); + if (rows <= 0 || rows > 6) + throw new IllegalArgumentException("rows cannot be smaller than 1 or bigger than 6"); + this.rows = rows; + } + + public OrcInventory(String title, int rows, boolean fill) { + this(title, rows); + this.fill = fill; + if(this.fill) { + for (int i = 0; i < rows * 9; i++) { + items.put(i, OrcItem.fill); + } + } + } + + public OrcInventory(String title, InventoryType type) { + this(title); + if (type == null || type == InventoryType.CHEST) { + this.type = null; + rows = 3; + } else { + this.type = type; + } + } + + public void addItem(int slot, OrcItem item) { + if (item == null) { + removeItem(slot); + } else { + items.put(slot, item); + } + } + + public void addItem(int row, int col, OrcItem item) { + addItem(row * 9 + col, item); + } + + public void removeItem(int slot) { + items.remove(slot); + } + + public void removeItem(int row, int col) { + removeItem(row * 9 + col); + } + + public Inventory getInventory(Player p) { + return getInventory(p, title); + } + + public void redraw(Player p) { + p.closeInventory(); + p.openInventory(getInventory(p)); + } + + public Inventory getInventory(Player p, String title) { + Inventory inv; + int size; + if (type == null) { + inv = Bukkit.createInventory(null, rows * 9, title); + size = rows * 9; + } else { + inv = Bukkit.createInventory(null, type, title); + size = type.getDefaultSize(); + } + + for (Entry entry : items.entrySet()) { + if (entry.getKey() >= 0 && entry.getKey() < size) { + inv.setItem(entry.getKey(), entry.getValue().getItemStack(p)); + } else { + System.err.println("There is a problem with a configured Item!"); + } + } + + OrcListener.getInstance().register(p.getUniqueId(), this); + + return inv; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getTitle() { + return title; + } +} diff --git a/WorldSystem/src/main/java/de/butzlabben/inventory/OrcItem.java b/src/main/java/de/butzlabben/inventory/OrcItem.java similarity index 95% rename from WorldSystem/src/main/java/de/butzlabben/inventory/OrcItem.java rename to src/main/java/de/butzlabben/inventory/OrcItem.java index 50d6c89..d2c2384 100644 --- a/WorldSystem/src/main/java/de/butzlabben/inventory/OrcItem.java +++ b/src/main/java/de/butzlabben/inventory/OrcItem.java @@ -1,139 +1,139 @@ -package de.butzlabben.inventory; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Objects; - -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemFlag; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.ItemMeta; - -import de.butzlabben.world.wrapper.WorldPlayer; - -public class OrcItem { - - public static OrcItem enabled, disabled, coming_soon, back, fill, error = new OrcItem(Material.BARRIER, null, - "§cERROR: Item is wrong configured!", "§cPath in config: see Displayname"); - - private ItemStack is; - private OrcClickListener listener; - private DependListener depend; - private Runnable callback; - - public void setCallback(Runnable r) { - callback = r; - } - - public OrcItem(Material mat, String display, String... lore) { - setItemStack(mat, display, lore); - } - - public OrcItem(ItemStack is) { - setItemStack(is); - } - - public OrcItem(Material mat, String display, List lore) { - setItemStack(mat, (byte) 0, display, lore); - } - - public OrcItem(Material mat) { - this(new ItemStack(mat)); - } - - public OrcItem(Material material, byte data, String display, ArrayList lore) { - setItemStack(material, data, display, lore); - } - - @SuppressWarnings("deprecation") - public OrcItem setItemStack(Material mat, byte data, String display, List lore) { - is = new ItemStack(mat, 1 , data); - ItemMeta meta = is.getItemMeta(); - meta.setDisplayName(display); - meta.setLore(lore); - meta.addItemFlags(ItemFlag.HIDE_ENCHANTS); - is.setItemMeta(meta); - return this; - } - - public ItemStack getItemStack(Player p) { - if (p != null && depend != null) { - ItemStack is = depend.getItemStack(p, new WorldPlayer(p)); - if (is != null) - return is; - } - return is; - } - - public ItemStack getItemStack(Player p, WorldPlayer wp) { - if (p != null && depend != null) { - ItemStack is = depend.getItemStack(p, wp); - if (is != null) - return is; - } - return is; - } - - public ItemStack getItemStack() { - return is; - } - - public OrcItem setOnClick(OrcClickListener listener) { - this.listener = listener; - return this; - } - - public OrcItem onClick(Player p, OrcInventory inv) { - if (listener != null) { - listener.onClick(p, inv, this); - } - if (callback != null) - callback.run(); - return this; - } - - public OrcItem setDisplay(String display) { - ItemMeta meta = is.getItemMeta(); - meta.setDisplayName(display); - is.setItemMeta(meta); - return this; - } - - public OrcItem setLore(String... lore) { - ItemMeta meta = is.getItemMeta(); - meta.setLore(Arrays.asList(lore)); - is.setItemMeta(meta); - return this; - } - - public OrcItem removeLore() { - ItemMeta meta = is.getItemMeta(); - meta.setLore(null); - is.setItemMeta(meta); - return this; - } - - public OrcItem setItemStack(ItemStack is) { - Objects.requireNonNull(is, "ItemStack cannot be null"); - this.is = is; - ItemMeta meta = is.getItemMeta(); - meta.addItemFlags(ItemFlag.HIDE_ENCHANTS); - is.setItemMeta(meta); - return this; - } - - public OrcItem setItemStack(Material mat, String display, String... lore) { - return setItemStack(mat, (byte) 0, display, Arrays.asList(lore)); - } - - public OrcItem setDepend(DependListener listener) { - depend = listener; - return this; - } - - public OrcItem clone() { - return new OrcItem(is); - } -} +package de.butzlabben.inventory; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Objects; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemFlag; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; + +import de.butzlabben.world.wrapper.WorldPlayer; + +public class OrcItem { + + public static OrcItem enabled, disabled, coming_soon, back, fill, error = new OrcItem(Material.BARRIER, null, + "§cERROR: Item is wrong configured!", "§cPath in config: see Displayname"); + + private ItemStack is; + private OrcClickListener listener; + private DependListener depend; + private Runnable callback; + + public void setCallback(Runnable r) { + callback = r; + } + + public OrcItem(Material mat, String display, String... lore) { + setItemStack(mat, display, lore); + } + + public OrcItem(ItemStack is) { + setItemStack(is); + } + + public OrcItem(Material mat, String display, List lore) { + setItemStack(mat, (byte) 0, display, lore); + } + + public OrcItem(Material mat) { + this(new ItemStack(mat)); + } + + public OrcItem(Material material, byte data, String display, ArrayList lore) { + setItemStack(material, data, display, lore); + } + + @SuppressWarnings("deprecation") + public OrcItem setItemStack(Material mat, byte data, String display, List lore) { + is = new ItemStack(mat, 1 , data); + ItemMeta meta = is.getItemMeta(); + meta.setDisplayName(display); + meta.setLore(lore); + meta.addItemFlags(ItemFlag.HIDE_ENCHANTS); + is.setItemMeta(meta); + return this; + } + + public ItemStack getItemStack(Player p) { + if (p != null && depend != null) { + ItemStack is = depend.getItemStack(p, new WorldPlayer(p)); + if (is != null) + return is; + } + return is; + } + + public ItemStack getItemStack(Player p, WorldPlayer wp) { + if (p != null && depend != null) { + ItemStack is = depend.getItemStack(p, wp); + if (is != null) + return is; + } + return is; + } + + public ItemStack getItemStack() { + return is; + } + + public OrcItem setOnClick(OrcClickListener listener) { + this.listener = listener; + return this; + } + + public OrcItem onClick(Player p, OrcInventory inv) { + if (listener != null) { + listener.onClick(p, inv, this); + } + if (callback != null) + callback.run(); + return this; + } + + public OrcItem setDisplay(String display) { + ItemMeta meta = is.getItemMeta(); + meta.setDisplayName(display); + is.setItemMeta(meta); + return this; + } + + public OrcItem setLore(String... lore) { + ItemMeta meta = is.getItemMeta(); + meta.setLore(Arrays.asList(lore)); + is.setItemMeta(meta); + return this; + } + + public OrcItem removeLore() { + ItemMeta meta = is.getItemMeta(); + meta.setLore(null); + is.setItemMeta(meta); + return this; + } + + public OrcItem setItemStack(ItemStack is) { + Objects.requireNonNull(is, "ItemStack cannot be null"); + this.is = is; + ItemMeta meta = is.getItemMeta(); + meta.addItemFlags(ItemFlag.HIDE_ENCHANTS); + is.setItemMeta(meta); + return this; + } + + public OrcItem setItemStack(Material mat, String display, String... lore) { + return setItemStack(mat, (byte) 0, display, Arrays.asList(lore)); + } + + public OrcItem setDepend(DependListener listener) { + depend = listener; + return this; + } + + public OrcItem clone() { + return new OrcItem(is); + } +} diff --git a/WorldSystem/src/main/java/de/butzlabben/inventory/OrcListener.java b/src/main/java/de/butzlabben/inventory/OrcListener.java similarity index 96% rename from WorldSystem/src/main/java/de/butzlabben/inventory/OrcListener.java rename to src/main/java/de/butzlabben/inventory/OrcListener.java index 495ed31..2c1b4a6 100644 --- a/WorldSystem/src/main/java/de/butzlabben/inventory/OrcListener.java +++ b/src/main/java/de/butzlabben/inventory/OrcListener.java @@ -1,55 +1,55 @@ -package de.butzlabben.inventory; - -import java.util.HashMap; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.event.inventory.InventoryCloseEvent; - -import de.butzlabben.world.WorldSystem; - -/** - * @author Butzlabben - * @since 10.06.2018 - */ -public class OrcListener implements Listener { - - private static OrcListener instance; - - private HashMap invs = new HashMap<>(); - - public static synchronized OrcListener getInstance() { - if (instance == null) - instance = new OrcListener(); - return instance; - } - - private OrcListener() { - Bukkit.getPluginManager().registerEvents(this, WorldSystem.getInstance()); - } - - @EventHandler - public void on(InventoryClickEvent e) { - if (e.getClickedInventory() != null && invs.containsKey(e.getWhoClicked().getUniqueId())) { - e.setCancelled(true); - OrcItem item = invs.get(e.getWhoClicked().getUniqueId()).items.get(e.getSlot()); - if (item != null) - item.onClick((Player) e.getWhoClicked(), invs.get(e.getWhoClicked().getUniqueId())); - } - } - - public void register(UUID uuid, OrcInventory inv) { - invs.put(uuid, inv); - } - - @EventHandler - public void on(InventoryCloseEvent e) { - if (e.getInventory() != null && invs.containsKey(e.getPlayer().getUniqueId())) { - invs.remove(e.getPlayer().getUniqueId()); - } - } -} +package de.butzlabben.inventory; + +import java.util.HashMap; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryCloseEvent; + +import de.butzlabben.world.WorldSystem; + +/** + * @author Butzlabben + * @since 10.06.2018 + */ +public class OrcListener implements Listener { + + private static OrcListener instance; + + private HashMap invs = new HashMap<>(); + + public static synchronized OrcListener getInstance() { + if (instance == null) + instance = new OrcListener(); + return instance; + } + + private OrcListener() { + Bukkit.getPluginManager().registerEvents(this, WorldSystem.getInstance()); + } + + @EventHandler + public void on(InventoryClickEvent e) { + if (e.getClickedInventory() != null && invs.containsKey(e.getWhoClicked().getUniqueId())) { + e.setCancelled(true); + OrcItem item = invs.get(e.getWhoClicked().getUniqueId()).items.get(e.getSlot()); + if (item != null) + item.onClick((Player) e.getWhoClicked(), invs.get(e.getWhoClicked().getUniqueId())); + } + } + + public void register(UUID uuid, OrcInventory inv) { + invs.put(uuid, inv); + } + + @EventHandler + public void on(InventoryCloseEvent e) { + if (e.getInventory() != null && invs.containsKey(e.getPlayer().getUniqueId())) { + invs.remove(e.getPlayer().getUniqueId()); + } + } +} diff --git a/WorldSystem/src/main/java/de/butzlabben/inventory/pages/InventoryPage.java b/src/main/java/de/butzlabben/inventory/pages/InventoryPage.java similarity index 96% rename from WorldSystem/src/main/java/de/butzlabben/inventory/pages/InventoryPage.java rename to src/main/java/de/butzlabben/inventory/pages/InventoryPage.java index af72dc8..c590eae 100644 --- a/WorldSystem/src/main/java/de/butzlabben/inventory/pages/InventoryPage.java +++ b/src/main/java/de/butzlabben/inventory/pages/InventoryPage.java @@ -1,74 +1,74 @@ -package de.butzlabben.inventory.pages; - -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.inventory.Inventory; - -import de.butzlabben.inventory.OrcInventory; -import de.butzlabben.inventory.OrcItem; -import de.butzlabben.world.config.GuiConfig; - -/** - * @author Butzlabben - * @since 20.05.2018 - */ -public class InventoryPage extends OrcInventory { - - InventoryPage next, before = null; - - public InventoryPage(String title, int page, int pages) { - super(title, 6); - - YamlConfiguration cfg = GuiConfig.getConfig(); - String path = "options.players.currentpage"; - - OrcItem oi = new OrcItem(GuiConfig.getMaterial(cfg, path), GuiConfig.getData(cfg, path), - GuiConfig.getDisplay(cfg, path).replaceAll("%page", "" + page), GuiConfig.getLore(cfg, path)); - addItem(GuiConfig.getSlot(path), oi); - - path = "options.players.pagebefore"; - oi = GuiConfig.getItem(path); - oi.setOnClick((p, inv, item) -> { - p.closeInventory(); - p.openInventory(this.before.getInventory(p)); - }); - addItem(GuiConfig.getSlot(path), oi); - - path = "options.players.nextpage"; - oi = GuiConfig.getItem(path); - oi.setOnClick((p, inv, item) -> { - p.closeInventory(); - p.openInventory(this.next.getInventory(p)); - }); - addItem(GuiConfig.getSlot(path), oi); - } - - private int i = 0; - - @Override - public Inventory getInventory(Player p) { - return super.getInventory(p); - } - - public void addItem(OrcItem item) { - if (i > 36) { - System.err.println("More items than allowed in page view"); - return; - } - addItem(i, item); - i++; - } - - @EventHandler - public void on(InventoryClickEvent e) { - if (e.getClickedInventory() != null && e.getClickedInventory().getTitle() != null - && e.getClickedInventory().getTitle().equals(title)) { - e.setCancelled(true); - OrcItem item = items.get(e.getSlot()); - if (item != null) - item.onClick((Player) e.getWhoClicked(), this); - } - } -} +package de.butzlabben.inventory.pages; + +import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.inventory.Inventory; + +import de.butzlabben.inventory.OrcInventory; +import de.butzlabben.inventory.OrcItem; +import de.butzlabben.world.config.GuiConfig; + +/** + * @author Butzlabben + * @since 20.05.2018 + */ +public class InventoryPage extends OrcInventory { + + InventoryPage next, before = null; + + public InventoryPage(String title, int page, int pages) { + super(title, 6); + + YamlConfiguration cfg = GuiConfig.getConfig(); + String path = "options.players.currentpage"; + + OrcItem oi = new OrcItem(GuiConfig.getMaterial(cfg, path), GuiConfig.getData(cfg, path), + GuiConfig.getDisplay(cfg, path).replaceAll("%page", "" + page), GuiConfig.getLore(cfg, path)); + addItem(GuiConfig.getSlot(path), oi); + + path = "options.players.pagebefore"; + oi = GuiConfig.getItem(path); + oi.setOnClick((p, inv, item) -> { + p.closeInventory(); + p.openInventory(this.before.getInventory(p)); + }); + addItem(GuiConfig.getSlot(path), oi); + + path = "options.players.nextpage"; + oi = GuiConfig.getItem(path); + oi.setOnClick((p, inv, item) -> { + p.closeInventory(); + p.openInventory(this.next.getInventory(p)); + }); + addItem(GuiConfig.getSlot(path), oi); + } + + private int i = 0; + + @Override + public Inventory getInventory(Player p) { + return super.getInventory(p); + } + + public void addItem(OrcItem item) { + if (i > 36) { + System.err.println("More items than allowed in page view"); + return; + } + addItem(i, item); + i++; + } + + @EventHandler + public void on(InventoryClickEvent e) { + if (e.getClickedInventory() != null && e.getClickedInventory().getTitle() != null + && e.getClickedInventory().getTitle().equals(title)) { + e.setCancelled(true); + OrcItem item = items.get(e.getSlot()); + if (item != null) + item.onClick((Player) e.getWhoClicked(), this); + } + } +} diff --git a/WorldSystem/src/main/java/de/butzlabben/inventory/pages/ItemConverter.java b/src/main/java/de/butzlabben/inventory/pages/ItemConverter.java similarity index 94% rename from WorldSystem/src/main/java/de/butzlabben/inventory/pages/ItemConverter.java rename to src/main/java/de/butzlabben/inventory/pages/ItemConverter.java index 8925faf..339df87 100644 --- a/WorldSystem/src/main/java/de/butzlabben/inventory/pages/ItemConverter.java +++ b/src/main/java/de/butzlabben/inventory/pages/ItemConverter.java @@ -1,13 +1,13 @@ -package de.butzlabben.inventory.pages; - -import de.butzlabben.inventory.OrcItem; - -/** - * @author Butzlabben - * @since 21.05.2018 - */ -public interface ItemConverter { - - public OrcItem convert(T element); - -} +package de.butzlabben.inventory.pages; + +import de.butzlabben.inventory.OrcItem; + +/** + * @author Butzlabben + * @since 21.05.2018 + */ +public interface ItemConverter { + + public OrcItem convert(T element); + +} diff --git a/WorldSystem/src/main/java/de/butzlabben/inventory/pages/PageGUICreator.java b/src/main/java/de/butzlabben/inventory/pages/PageGUICreator.java similarity index 96% rename from WorldSystem/src/main/java/de/butzlabben/inventory/pages/PageGUICreator.java rename to src/main/java/de/butzlabben/inventory/pages/PageGUICreator.java index acf42a6..e859337 100644 --- a/WorldSystem/src/main/java/de/butzlabben/inventory/pages/PageGUICreator.java +++ b/src/main/java/de/butzlabben/inventory/pages/PageGUICreator.java @@ -1,65 +1,65 @@ -package de.butzlabben.inventory.pages; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.stream.Collectors; - -import org.bukkit.entity.Player; - -import de.butzlabben.inventory.OrcItem; - -/** - * @author Butzlabben - * @since 21.05.2018 - */ -public class PageGUICreator { - - private final int elementsPerPage; - private List invpages; - - public void create(String title, Collection elements, ItemConverter converter) { - List items = elements.stream().map(r -> converter.convert(r)).collect(Collectors.toList()); - if (items == null || items.size() == 0) - return; - - int pages = (int) (Math.ceil((double) (items.size() / (double) elementsPerPage) < 1 ? 1 : Math.ceil((double) items.size() / (double) elementsPerPage))); - - invpages = new ArrayList<>(pages); - - for (int i = 1; i < pages + 1; i++) { - int start = i == 1 ? 0 : elementsPerPage * (i - 1); - int end = items.size() < elementsPerPage * i ? items.size() : elementsPerPage * i; - List page = items.subList(start, end); - - InventoryPage invpage = new InventoryPage(title, i, pages); - page.forEach(invpage::addItem); - invpages.add(invpage); - } - - for (int i = 0; i < invpages.size(); i++) { - - int beforeIndex = i == 0 ? invpages.size() - 1 : i - 1; - int nextIndex = i == invpages.size() - 1 ? 0 : i + 1; - - invpages.get(i).before = invpages.get(beforeIndex); - invpages.get(i).next = invpages.get(nextIndex); - } - } - - public void show(Player p) { - p.openInventory(invpages.get(0).getInventory(p)); - } - - public PageGUICreator() { - this(4 * 9); - } - - public List getInvPages() { - return invpages; - } - - public PageGUICreator(int elementsPerPage) { - this.elementsPerPage = elementsPerPage; - } -} +package de.butzlabben.inventory.pages; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.stream.Collectors; + +import org.bukkit.entity.Player; + +import de.butzlabben.inventory.OrcItem; + +/** + * @author Butzlabben + * @since 21.05.2018 + */ +public class PageGUICreator { + + private final int elementsPerPage; + private List invpages; + + public void create(String title, Collection elements, ItemConverter converter) { + List items = elements.stream().map(r -> converter.convert(r)).collect(Collectors.toList()); + if (items == null || items.size() == 0) + return; + + int pages = (int) (Math.ceil((double) (items.size() / (double) elementsPerPage) < 1 ? 1 : Math.ceil((double) items.size() / (double) elementsPerPage))); + + invpages = new ArrayList<>(pages); + + for (int i = 1; i < pages + 1; i++) { + int start = i == 1 ? 0 : elementsPerPage * (i - 1); + int end = items.size() < elementsPerPage * i ? items.size() : elementsPerPage * i; + List page = items.subList(start, end); + + InventoryPage invpage = new InventoryPage(title, i, pages); + page.forEach(invpage::addItem); + invpages.add(invpage); + } + + for (int i = 0; i < invpages.size(); i++) { + + int beforeIndex = i == 0 ? invpages.size() - 1 : i - 1; + int nextIndex = i == invpages.size() - 1 ? 0 : i + 1; + + invpages.get(i).before = invpages.get(beforeIndex); + invpages.get(i).next = invpages.get(nextIndex); + } + } + + public void show(Player p) { + p.openInventory(invpages.get(0).getInventory(p)); + } + + public PageGUICreator() { + this(4 * 9); + } + + public List getInvPages() { + return invpages; + } + + public PageGUICreator(int elementsPerPage) { + this.elementsPerPage = elementsPerPage; + } +} diff --git a/WorldSystem/src/main/java/de/butzlabben/world/GCRunnable.java b/src/main/java/de/butzlabben/world/GCRunnable.java similarity index 94% rename from WorldSystem/src/main/java/de/butzlabben/world/GCRunnable.java rename to src/main/java/de/butzlabben/world/GCRunnable.java index 6d140cd..9249633 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/GCRunnable.java +++ b/src/main/java/de/butzlabben/world/GCRunnable.java @@ -1,9 +1,9 @@ -package de.butzlabben.world; - -public class GCRunnable implements Runnable { - - @Override - public void run() { - new Thread(() -> System.gc()).start(); - } -} +package de.butzlabben.world; + +public class GCRunnable implements Runnable { + + @Override + public void run() { + new Thread(() -> System.gc()).start(); + } +} diff --git a/WorldSystem/src/main/java/de/butzlabben/world/GameProfileBuilder.java b/src/main/java/de/butzlabben/world/GameProfileBuilder.java similarity index 97% rename from WorldSystem/src/main/java/de/butzlabben/world/GameProfileBuilder.java rename to src/main/java/de/butzlabben/world/GameProfileBuilder.java index 0e22719..e6f8f2c 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/GameProfileBuilder.java +++ b/src/main/java/de/butzlabben/world/GameProfileBuilder.java @@ -1,146 +1,146 @@ -package de.butzlabben.world; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.lang.reflect.Type; -import java.net.HttpURLConnection; -import java.net.URL; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.JsonSerializationContext; -import com.google.gson.JsonSerializer; -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.properties.Property; -import com.mojang.authlib.properties.PropertyMap; -import com.mojang.util.UUIDTypeAdapter; - -/** - * @author Butzlabben - * @since 26.02.2018 - */ -public class GameProfileBuilder { - - private static Gson gson = new GsonBuilder().disableHtmlEscaping() - .registerTypeAdapter(UUID.class, new UUIDTypeAdapter()) - .registerTypeAdapter(GameProfile.class, new GameProfileSerializer()) - .registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer()).create(); - private static HashMap cache = new HashMap<>(); - private static long cacheTime = -1L; - private static Object sync = new Object(); - - public static GameProfile fetch(UUID uuid) throws IOException { - return fetch(uuid, false); - } - - public static GameProfile fetch(UUID uuid, boolean forceNew) throws IOException { - if ((!forceNew) && (cache.containsKey(uuid)) && (((CachedProfile) cache.get(uuid)).isValid())) { - return ((CachedProfile) cache.get(uuid)).profile; - } - - HttpURLConnection connection; - synchronized (sync) { - connection = (HttpURLConnection) new URL( - String.format("https://sessionserver.mojang.com/session/minecraft/profile/%s?unsigned=false", - new Object[] { UUIDTypeAdapter.fromUUID(uuid) })).openConnection(); - connection.setReadTimeout(5000); - } - if (connection.getResponseCode() == 200) { - String json = new BufferedReader(new InputStreamReader(connection.getInputStream())).readLine(); - - GameProfile result = (GameProfile) gson.fromJson(json, GameProfile.class); - cache.put(uuid, new CachedProfile(result)); - return result; - } - if ((!forceNew) && (cache.containsKey(uuid))) { - return ((CachedProfile) cache.get(uuid)).profile; - } - throw new IOException("Could not connect to mojang servers for unknown player: " + uuid.toString()); - } - - public static GameProfile getProfile(UUID uuid, String name, String skin) { - return getProfile(uuid, name, skin, null); - } - - public static GameProfile getProfile(UUID uuid, String name, String skinUrl, String capeUrl) { - GameProfile profile = new GameProfile(uuid, name); - boolean cape = (capeUrl != null) && (!capeUrl.isEmpty()); - - List args = new ArrayList<>(); - args.add(Long.valueOf(System.currentTimeMillis())); - args.add(UUIDTypeAdapter.fromUUID(uuid)); - args.add(name); - args.add(skinUrl); - if (cape) { - args.add(capeUrl); - } - profile.getProperties().put("textures", - new Property("textures", - Base64Coder.encodeString(String.format( - cape ? "{\"timestamp\":%d,\"profileId\":\"%s\",\"profileName\":\"%s\",\"isPublic\":true,\"textures\":{\"SKIN\":{\"url\":\"%s\"},\"CAPE\":{\"url\":\"%s\"}}}" - : "{\"timestamp\":%d,\"profileId\":\"%s\",\"profileName\":\"%s\",\"isPublic\":true,\"textures\":{\"SKIN\":{\"url\":\"%s\"}}}", - args.toArray(new Object[args.size()]))))); - return profile; - } - - public static void setCacheTime(long time) { - cacheTime = time; - } - - private static class GameProfileSerializer implements JsonSerializer, JsonDeserializer { - - public GameProfile deserialize(JsonElement json, Type type, JsonDeserializationContext context) - throws JsonParseException { - JsonObject object = (JsonObject) json; - UUID id = object.has("id") ? (UUID) context.deserialize(object.get("id"), UUID.class) : null; - String name = object.has("name") ? object.getAsJsonPrimitive("name").getAsString() : null; - GameProfile profile = new GameProfile(id, name); - if (object.has("properties")) { - for (Map.Entry prop : ((PropertyMap) context.deserialize(object.get("properties"), - PropertyMap.class)).entries()) { - profile.getProperties().put((String) prop.getKey(), (Property) prop.getValue()); - } - } - return profile; - } - - public JsonElement serialize(GameProfile profile, Type type, JsonSerializationContext context) { - JsonObject result = new JsonObject(); - if (profile.getId() != null) { - result.add("id", context.serialize(profile.getId())); - } - if (profile.getName() != null) { - result.addProperty("name", profile.getName()); - } - if (!profile.getProperties().isEmpty()) { - result.add("properties", context.serialize(profile.getProperties())); - } - return result; - } - } - - private static class CachedProfile { - private GameProfile profile; - - public CachedProfile(GameProfile profile) { - this.profile = profile; - } - - public boolean isValid() { - return GameProfileBuilder.cacheTime < 0L; - } - } -} +package de.butzlabben.world; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.lang.reflect.Type; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; +import com.mojang.util.UUIDTypeAdapter; + +/** + * @author Butzlabben + * @since 26.02.2018 + */ +public class GameProfileBuilder { + + private static Gson gson = new GsonBuilder().disableHtmlEscaping() + .registerTypeAdapter(UUID.class, new UUIDTypeAdapter()) + .registerTypeAdapter(GameProfile.class, new GameProfileSerializer()) + .registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer()).create(); + private static HashMap cache = new HashMap<>(); + private static long cacheTime = -1L; + private static Object sync = new Object(); + + public static GameProfile fetch(UUID uuid) throws IOException { + return fetch(uuid, false); + } + + public static GameProfile fetch(UUID uuid, boolean forceNew) throws IOException { + if ((!forceNew) && (cache.containsKey(uuid)) && (((CachedProfile) cache.get(uuid)).isValid())) { + return ((CachedProfile) cache.get(uuid)).profile; + } + + HttpURLConnection connection; + synchronized (sync) { + connection = (HttpURLConnection) new URL( + String.format("https://sessionserver.mojang.com/session/minecraft/profile/%s?unsigned=false", + new Object[] { UUIDTypeAdapter.fromUUID(uuid) })).openConnection(); + connection.setReadTimeout(5000); + } + if (connection.getResponseCode() == 200) { + String json = new BufferedReader(new InputStreamReader(connection.getInputStream())).readLine(); + + GameProfile result = (GameProfile) gson.fromJson(json, GameProfile.class); + cache.put(uuid, new CachedProfile(result)); + return result; + } + if ((!forceNew) && (cache.containsKey(uuid))) { + return ((CachedProfile) cache.get(uuid)).profile; + } + throw new IOException("Could not connect to mojang servers for unknown player: " + uuid.toString()); + } + + public static GameProfile getProfile(UUID uuid, String name, String skin) { + return getProfile(uuid, name, skin, null); + } + + public static GameProfile getProfile(UUID uuid, String name, String skinUrl, String capeUrl) { + GameProfile profile = new GameProfile(uuid, name); + boolean cape = (capeUrl != null) && (!capeUrl.isEmpty()); + + List args = new ArrayList<>(); + args.add(Long.valueOf(System.currentTimeMillis())); + args.add(UUIDTypeAdapter.fromUUID(uuid)); + args.add(name); + args.add(skinUrl); + if (cape) { + args.add(capeUrl); + } + profile.getProperties().put("textures", + new Property("textures", + Base64Coder.encodeString(String.format( + cape ? "{\"timestamp\":%d,\"profileId\":\"%s\",\"profileName\":\"%s\",\"isPublic\":true,\"textures\":{\"SKIN\":{\"url\":\"%s\"},\"CAPE\":{\"url\":\"%s\"}}}" + : "{\"timestamp\":%d,\"profileId\":\"%s\",\"profileName\":\"%s\",\"isPublic\":true,\"textures\":{\"SKIN\":{\"url\":\"%s\"}}}", + args.toArray(new Object[args.size()]))))); + return profile; + } + + public static void setCacheTime(long time) { + cacheTime = time; + } + + private static class GameProfileSerializer implements JsonSerializer, JsonDeserializer { + + public GameProfile deserialize(JsonElement json, Type type, JsonDeserializationContext context) + throws JsonParseException { + JsonObject object = (JsonObject) json; + UUID id = object.has("id") ? (UUID) context.deserialize(object.get("id"), UUID.class) : null; + String name = object.has("name") ? object.getAsJsonPrimitive("name").getAsString() : null; + GameProfile profile = new GameProfile(id, name); + if (object.has("properties")) { + for (Map.Entry prop : ((PropertyMap) context.deserialize(object.get("properties"), + PropertyMap.class)).entries()) { + profile.getProperties().put((String) prop.getKey(), (Property) prop.getValue()); + } + } + return profile; + } + + public JsonElement serialize(GameProfile profile, Type type, JsonSerializationContext context) { + JsonObject result = new JsonObject(); + if (profile.getId() != null) { + result.add("id", context.serialize(profile.getId())); + } + if (profile.getName() != null) { + result.addProperty("name", profile.getName()); + } + if (!profile.getProperties().isEmpty()) { + result.add("properties", context.serialize(profile.getProperties())); + } + return result; + } + } + + private static class CachedProfile { + private GameProfile profile; + + public CachedProfile(GameProfile profile) { + this.profile = profile; + } + + public boolean isValid() { + return GameProfileBuilder.cacheTime < 0L; + } + } +} diff --git a/WorldSystem/src/main/java/de/butzlabben/world/WorldCheckerRunnable.java b/src/main/java/de/butzlabben/world/WorldCheckerRunnable.java similarity index 97% rename from WorldSystem/src/main/java/de/butzlabben/world/WorldCheckerRunnable.java rename to src/main/java/de/butzlabben/world/WorldCheckerRunnable.java index 9b96efb..bd7ebdd 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/WorldCheckerRunnable.java +++ b/src/main/java/de/butzlabben/world/WorldCheckerRunnable.java @@ -1,49 +1,49 @@ -package de.butzlabben.world; - -import org.bukkit.Bukkit; -import org.bukkit.OfflinePlayer; -import org.bukkit.World; -import org.bukkit.entity.Entity; -import org.bukkit.entity.Player; - -import de.butzlabben.world.config.MessageConfig; -import de.butzlabben.world.config.PluginConfig; -import de.butzlabben.world.wrapper.SystemWorld; - -public class WorldCheckerRunnable implements Runnable { - - @Override - public void run() { - for (World world : Bukkit.getWorlds()) { - if (SystemWorld.getSystemWorld(world.getName()) == null || !SystemWorld.getSystemWorld(world.getName()).isLoaded()) - continue; - int other = world.getEntities().size() - world.getPlayers().size(); - if (other > PluginConfig.getEntitysPerWorld()) { - String worldname = world.getName(); - for (Entity e : world.getEntities()) { - if (!(e instanceof Player)) { - e.remove(); - } - } - String ownerofWorld = null; - for (OfflinePlayer p : Bukkit.getOfflinePlayers()) { - if (p.getUniqueId().toString() - .equals(worldname.substring(worldname.length() - 36, worldname.length()))) - ownerofWorld = p.getName(); - } - String members = ""; - for (Player p : world.getPlayers()) { - members += p.getName() + " "; - } - for (Player p : Bukkit.getOnlinePlayers()) { - if (!p.hasPermission("ws.lag")) - continue; - p.sendMessage(MessageConfig.getLagDetection().replaceAll("%world", - ownerofWorld + " ( ID: " + world.getName().substring(2, worldname.length() - 37) + " )")); - p.sendMessage(MessageConfig.getPlayerList().replaceAll("%players", members)); - - } - } - } - } -} +package de.butzlabben.world; + +import org.bukkit.Bukkit; +import org.bukkit.OfflinePlayer; +import org.bukkit.World; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; + +import de.butzlabben.world.config.MessageConfig; +import de.butzlabben.world.config.PluginConfig; +import de.butzlabben.world.wrapper.SystemWorld; + +public class WorldCheckerRunnable implements Runnable { + + @Override + public void run() { + for (World world : Bukkit.getWorlds()) { + if (SystemWorld.getSystemWorld(world.getName()) == null || !SystemWorld.getSystemWorld(world.getName()).isLoaded()) + continue; + int other = world.getEntities().size() - world.getPlayers().size(); + if (other > PluginConfig.getEntitysPerWorld()) { + String worldname = world.getName(); + for (Entity e : world.getEntities()) { + if (!(e instanceof Player)) { + e.remove(); + } + } + String ownerofWorld = null; + for (OfflinePlayer p : Bukkit.getOfflinePlayers()) { + if (p.getUniqueId().toString() + .equals(worldname.substring(worldname.length() - 36, worldname.length()))) + ownerofWorld = p.getName(); + } + String members = ""; + for (Player p : world.getPlayers()) { + members += p.getName() + " "; + } + for (Player p : Bukkit.getOnlinePlayers()) { + if (!p.hasPermission("ws.lag")) + continue; + p.sendMessage(MessageConfig.getLagDetection().replaceAll("%world", + ownerofWorld + " ( ID: " + world.getName().substring(2, worldname.length() - 37) + " )")); + p.sendMessage(MessageConfig.getPlayerList().replaceAll("%players", members)); + + } + } + } + } +} diff --git a/WorldSystem/src/main/java/de/butzlabben/world/WorldSystem.java b/src/main/java/de/butzlabben/world/WorldSystem.java similarity index 100% rename from WorldSystem/src/main/java/de/butzlabben/world/WorldSystem.java rename to src/main/java/de/butzlabben/world/WorldSystem.java diff --git a/WorldSystem/src/main/java/de/butzlabben/world/command/WSCommand.java b/src/main/java/de/butzlabben/world/command/WSCommand.java similarity index 100% rename from WorldSystem/src/main/java/de/butzlabben/world/command/WSCommand.java rename to src/main/java/de/butzlabben/world/command/WSCommand.java diff --git a/WorldSystem/src/main/java/de/butzlabben/world/command/WorldAdministrateCommand.java b/src/main/java/de/butzlabben/world/command/WorldAdministrateCommand.java similarity index 100% rename from WorldSystem/src/main/java/de/butzlabben/world/command/WorldAdministrateCommand.java rename to src/main/java/de/butzlabben/world/command/WorldAdministrateCommand.java diff --git a/WorldSystem/src/main/java/de/butzlabben/world/command/WorldSettingsCommands.java b/src/main/java/de/butzlabben/world/command/WorldSettingsCommands.java similarity index 100% rename from WorldSystem/src/main/java/de/butzlabben/world/command/WorldSettingsCommands.java rename to src/main/java/de/butzlabben/world/command/WorldSettingsCommands.java diff --git a/WorldSystem/src/main/java/de/butzlabben/world/config/DependenceConfig.java b/src/main/java/de/butzlabben/world/config/DependenceConfig.java similarity index 96% rename from WorldSystem/src/main/java/de/butzlabben/world/config/DependenceConfig.java rename to src/main/java/de/butzlabben/world/config/DependenceConfig.java index 09d602a..984e7ed 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/config/DependenceConfig.java +++ b/src/main/java/de/butzlabben/world/config/DependenceConfig.java @@ -1,162 +1,162 @@ -package de.butzlabben.world.config; - -import java.io.File; -import java.io.IOException; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.OfflinePlayer; -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.entity.Player; - -public class DependenceConfig { - - private OfflinePlayer op; - - public DependenceConfig() { - setConfig(); - } - - @SuppressWarnings("deprecation") - public DependenceConfig(String s) { - OfflinePlayer op = null; - try { - op = Bukkit.getOfflinePlayer(UUID.fromString(s)); - } catch (Exception e) { - } - if (op == null) { - op = Bukkit.getOfflinePlayer(s); - } - this.op = op; - } - - private void setConfig() { - File dconfig = new File("plugins//WorldSystem//dependence.yml"); - YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig); - cfg.set("HighestID", -1); - try { - cfg.save(dconfig); - } catch (IOException e) { - e.printStackTrace(); - } - } - - public DependenceConfig(Player p) { - this.op = p; - refreshName(); - } - - public DependenceConfig(OfflinePlayer p) { - this.op = p; - refreshName(); - } - - public void refreshName() { - if (hasWorld()) { - File dconfig = new File("plugins//WorldSystem//dependence.yml"); - YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig); - String uuid = this.op.getUniqueId().toString(); - cfg.set("Dependences." + uuid + ".ActualName", op.getName()); - try { - cfg.save(dconfig); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - - public void createNewEntry() { - File dconfig = new File("plugins//WorldSystem//dependence.yml"); - YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig); - String uuid = this.op.getUniqueId().toString(); - int id = cfg.getInt("HighestID"); - id++; - cfg.set("HighestID", id); - cfg.set("Dependences." + uuid + ".ID", id); - cfg.set("Dependences." + uuid + ".ActualName", op.getName()); - try { - cfg.save(dconfig); - } catch (IOException e) { - e.printStackTrace(); - } - } - - public boolean hasWorld() { - File dconfig = new File("plugins//WorldSystem//dependence.yml"); - YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig); - String uuid = op.getUniqueId().toString(); - //Fix for #40 - if (cfg.isInt("Dependences." + uuid + ".ID")) - return true; - return false; - } - - public String getWorldname() { - File dconfig = new File("plugins//WorldSystem//dependence.yml"); - YamlConfiguration dcfg = YamlConfiguration.loadConfiguration(dconfig); - String uuid = op.getUniqueId().toString(); - int id = dcfg.getInt("Dependences." + uuid + ".ID"); - String worldname = "ID" + id + "-" + uuid; - return worldname; - } - - public String getWorldNamebyOfflinePlayer() { - String name = ""; - String uuid = op.getUniqueId().toString(); - File dconfig = new File("plugins//WorldSystem//dependence.yml"); - YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig); - if (cfg.getString("Dependences." + uuid + ".ActualName") == null) { - name = "n"; - } else { - name = "ID" + cfg.getInt("Dependences." + uuid + ".ID") + "-" + uuid; - } - return name; - } - - public void setLastLoaded() { - File dconfig = new File("plugins//WorldSystem//dependence.yml"); - YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig); - String uuid = op.getUniqueId().toString(); - cfg.set("Dependences." + uuid + ".last_loaded", System.currentTimeMillis()); - try { - cfg.save(dconfig); - } catch (IOException e) { - e.printStackTrace(); - } - } - - public static int getHighestID() { - File dconfig = new File("plugins//WorldSystem//dependence.yml"); - YamlConfiguration dcfg = YamlConfiguration.loadConfiguration(dconfig); - return dcfg.getInt("HighestID"); - } - - public int getID() { - File dconfig = new File("plugins//WorldSystem//dependence.yml"); - YamlConfiguration dcfg = YamlConfiguration.loadConfiguration(dconfig); - return dcfg.getInt("Dependences." + op.getUniqueId().toString() + ".ID"); - } - - public OfflinePlayer getOwner() { - return op; - } - - public static void checkWorlds() { - File dconfig = new File("plugins//WorldSystem//dependence.yml"); - YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig); - - long deleteTime = 1000 * 60 * 60 * 24 * PluginConfig.deleteAfter(); - long now = System.currentTimeMillis(); - for (String s : cfg.getConfigurationSection("Dependences").getKeys(false)) { - if (!cfg.isLong("Dependences." + s + ".last_loaded") && !cfg.isInt("Dependences." + s + ".last_loaded")) - continue; - long lastLoaded = cfg.getLong("Dependences." + s + ".last_loaded"); - long diff = now - lastLoaded; - if (diff > deleteTime) { - Bukkit.getConsoleSender().sendMessage( - PluginConfig.getPrefix() + "World of " + s + " was not loaded for too long. Deleting!"); - Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "ws delete " + s); - } - } - } -} +package de.butzlabben.world.config; + +import java.io.File; +import java.io.IOException; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.OfflinePlayer; +import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.entity.Player; + +public class DependenceConfig { + + private OfflinePlayer op; + + public DependenceConfig() { + setConfig(); + } + + @SuppressWarnings("deprecation") + public DependenceConfig(String s) { + OfflinePlayer op = null; + try { + op = Bukkit.getOfflinePlayer(UUID.fromString(s)); + } catch (Exception e) { + } + if (op == null) { + op = Bukkit.getOfflinePlayer(s); + } + this.op = op; + } + + private void setConfig() { + File dconfig = new File("plugins//WorldSystem//dependence.yml"); + YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig); + cfg.set("HighestID", -1); + try { + cfg.save(dconfig); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public DependenceConfig(Player p) { + this.op = p; + refreshName(); + } + + public DependenceConfig(OfflinePlayer p) { + this.op = p; + refreshName(); + } + + public void refreshName() { + if (hasWorld()) { + File dconfig = new File("plugins//WorldSystem//dependence.yml"); + YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig); + String uuid = this.op.getUniqueId().toString(); + cfg.set("Dependences." + uuid + ".ActualName", op.getName()); + try { + cfg.save(dconfig); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + public void createNewEntry() { + File dconfig = new File("plugins//WorldSystem//dependence.yml"); + YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig); + String uuid = this.op.getUniqueId().toString(); + int id = cfg.getInt("HighestID"); + id++; + cfg.set("HighestID", id); + cfg.set("Dependences." + uuid + ".ID", id); + cfg.set("Dependences." + uuid + ".ActualName", op.getName()); + try { + cfg.save(dconfig); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public boolean hasWorld() { + File dconfig = new File("plugins//WorldSystem//dependence.yml"); + YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig); + String uuid = op.getUniqueId().toString(); + //Fix for #40 + if (cfg.isInt("Dependences." + uuid + ".ID")) + return true; + return false; + } + + public String getWorldname() { + File dconfig = new File("plugins//WorldSystem//dependence.yml"); + YamlConfiguration dcfg = YamlConfiguration.loadConfiguration(dconfig); + String uuid = op.getUniqueId().toString(); + int id = dcfg.getInt("Dependences." + uuid + ".ID"); + String worldname = "ID" + id + "-" + uuid; + return worldname; + } + + public String getWorldNamebyOfflinePlayer() { + String name = ""; + String uuid = op.getUniqueId().toString(); + File dconfig = new File("plugins//WorldSystem//dependence.yml"); + YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig); + if (cfg.getString("Dependences." + uuid + ".ActualName") == null) { + name = "n"; + } else { + name = "ID" + cfg.getInt("Dependences." + uuid + ".ID") + "-" + uuid; + } + return name; + } + + public void setLastLoaded() { + File dconfig = new File("plugins//WorldSystem//dependence.yml"); + YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig); + String uuid = op.getUniqueId().toString(); + cfg.set("Dependences." + uuid + ".last_loaded", System.currentTimeMillis()); + try { + cfg.save(dconfig); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public static int getHighestID() { + File dconfig = new File("plugins//WorldSystem//dependence.yml"); + YamlConfiguration dcfg = YamlConfiguration.loadConfiguration(dconfig); + return dcfg.getInt("HighestID"); + } + + public int getID() { + File dconfig = new File("plugins//WorldSystem//dependence.yml"); + YamlConfiguration dcfg = YamlConfiguration.loadConfiguration(dconfig); + return dcfg.getInt("Dependences." + op.getUniqueId().toString() + ".ID"); + } + + public OfflinePlayer getOwner() { + return op; + } + + public static void checkWorlds() { + File dconfig = new File("plugins//WorldSystem//dependence.yml"); + YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig); + + long deleteTime = 1000 * 60 * 60 * 24 * PluginConfig.deleteAfter(); + long now = System.currentTimeMillis(); + for (String s : cfg.getConfigurationSection("Dependences").getKeys(false)) { + if (!cfg.isLong("Dependences." + s + ".last_loaded") && !cfg.isInt("Dependences." + s + ".last_loaded")) + continue; + long lastLoaded = cfg.getLong("Dependences." + s + ".last_loaded"); + long diff = now - lastLoaded; + if (diff > deleteTime) { + Bukkit.getConsoleSender().sendMessage( + PluginConfig.getPrefix() + "World of " + s + " was not loaded for too long. Deleting!"); + Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "ws delete " + s); + } + } + } +} diff --git a/WorldSystem/src/main/java/de/butzlabben/world/config/Entry.java b/src/main/java/de/butzlabben/world/config/Entry.java similarity index 95% rename from WorldSystem/src/main/java/de/butzlabben/world/config/Entry.java rename to src/main/java/de/butzlabben/world/config/Entry.java index 1c3fd67..de50e29 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/config/Entry.java +++ b/src/main/java/de/butzlabben/world/config/Entry.java @@ -1,56 +1,56 @@ -package de.butzlabben.world.config; - -import java.io.File; - -import org.bukkit.Bukkit; -import org.bukkit.OfflinePlayer; -import org.bukkit.configuration.file.YamlConfiguration; - -public class Entry { - - private OfflinePlayer op; - private String uuid; - private int id; - private String worldname; - - public static int entrys() { - int entrys = 0; - for(OfflinePlayer op : Bukkit.getOfflinePlayers()) { - Entry e = new Entry(op); - if(e.hasWorld()) - ++entrys; - } - return entrys; - } - - protected OfflinePlayer getOfflinePlayer() { - return op; - } - - protected int getID() { - return id; - } - - protected String getWorldname() { - return worldname; - } - - protected boolean hasWorld() { - if(worldname.equals("n")) - return false; - return true; - } - - protected Entry(OfflinePlayer op) { - uuid = op.getUniqueId().toString(); - this.op = op; - File dconfig = new File("plugins//WorldSystem//dependence.yml"); - YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig); - if (cfg.getString("Dependences." + uuid + ".ActualName") == null) { - worldname = "n"; - } else { - worldname = "ID" + cfg.getInt("Dependences." + uuid + ".ID") + " " + uuid; - id = cfg.getInt("Dependences." + uuid + ".ID"); - } - } -} +package de.butzlabben.world.config; + +import java.io.File; + +import org.bukkit.Bukkit; +import org.bukkit.OfflinePlayer; +import org.bukkit.configuration.file.YamlConfiguration; + +public class Entry { + + private OfflinePlayer op; + private String uuid; + private int id; + private String worldname; + + public static int entrys() { + int entrys = 0; + for(OfflinePlayer op : Bukkit.getOfflinePlayers()) { + Entry e = new Entry(op); + if(e.hasWorld()) + ++entrys; + } + return entrys; + } + + protected OfflinePlayer getOfflinePlayer() { + return op; + } + + protected int getID() { + return id; + } + + protected String getWorldname() { + return worldname; + } + + protected boolean hasWorld() { + if(worldname.equals("n")) + return false; + return true; + } + + protected Entry(OfflinePlayer op) { + uuid = op.getUniqueId().toString(); + this.op = op; + File dconfig = new File("plugins//WorldSystem//dependence.yml"); + YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig); + if (cfg.getString("Dependences." + uuid + ".ActualName") == null) { + worldname = "n"; + } else { + worldname = "ID" + cfg.getInt("Dependences." + uuid + ".ID") + " " + uuid; + id = cfg.getInt("Dependences." + uuid + ".ID"); + } + } +} diff --git a/WorldSystem/src/main/java/de/butzlabben/world/config/GuiConfig.java b/src/main/java/de/butzlabben/world/config/GuiConfig.java similarity index 96% rename from WorldSystem/src/main/java/de/butzlabben/world/config/GuiConfig.java rename to src/main/java/de/butzlabben/world/config/GuiConfig.java index b7cd04b..6997110 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/config/GuiConfig.java +++ b/src/main/java/de/butzlabben/world/config/GuiConfig.java @@ -1,153 +1,153 @@ -package de.butzlabben.world.config; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.nio.charset.Charset; -import java.nio.file.Files; -import java.util.ArrayList; -import java.util.List; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.plugin.java.JavaPlugin; - -import de.butzlabben.inventory.OrcItem; -import de.butzlabben.world.WorldSystem; - -public class GuiConfig { - - private GuiConfig() { - } - - private static File file; - - public static void checkConfig(File f) { - file = f; - if (file.exists() == false) { - try { - String guiFileResource; - if (WorldSystem.is1_13()) { - guiFileResource = "1_13_gui.yml"; - } else { - guiFileResource = "old_gui.yml"; - } - InputStream in = JavaPlugin.getPlugin(WorldSystem.class).getResource(guiFileResource); - Files.copy(in, file.toPath()); - } catch (IOException e) { - System.err.println("Wasn't able to create Config"); - e.printStackTrace(); - } - } - OrcItem.enabled = getEnabled(); - OrcItem.disabled = getDisabled(); - OrcItem.coming_soon = getComingSoon(); - OrcItem.back = getBack(); - OrcItem.fill = getFill(); - } - - public static YamlConfiguration getConfig() { - try { - return YamlConfiguration - .loadConfiguration(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8"))); - } catch (FileNotFoundException e) { - e.printStackTrace(); - } - return null; - } - - public static int getSlot(String path) { - YamlConfiguration cfg = getConfig(); - return (cfg.getInt(path + ".slot.row") - 1) * 9 + cfg.getInt(path + ".slot.col") - 1; - } - - public static int getState(String path) { - YamlConfiguration cfg = getConfig(); - return (cfg.getInt(path + ".state.row") - 1) * 9 + cfg.getInt(path + ".state.col") - 1; - } - - public static boolean isEnabled(String path) { - return getConfig().getBoolean(path + ".enabled", true); - } - - public static int getRows(String path) { - return getConfig().getInt(path + ".rows", 1); - } - - public static String getDisplay(FileConfiguration cfg, String path) { - return ChatColor.translateAlternateColorCodes('&', cfg.getString(path + ".display")); - } - - public static ArrayList getLore(FileConfiguration cfg, String path) { - List list = cfg.getStringList(path + ".lore"); - ArrayList colored = new ArrayList<>(list.size()); - for (String s : list) { - colored.add(ChatColor.translateAlternateColorCodes('&', s)); - } - return colored; - } - - public static byte getData(FileConfiguration cfg, String path) { - return (byte) cfg.getInt(path + ".data", 0); - } - - public static String getTitle(FileConfiguration cfg, String path) { - return cfg.getString(path + ".title"); - } - - public static Material getMaterial(FileConfiguration cfg, String path) { - try { - return Material.valueOf(cfg.getString(path + ".material").toUpperCase()); - } catch (IllegalArgumentException ex) { - Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "cUnknown material: " + path); - return null; - } - } - - public static OrcItem getItem(String path) { - YamlConfiguration cfg = getConfig(); - try { - return new OrcItem(getMaterial(cfg, path), getData(cfg, path), getDisplay(cfg, path), getLore(cfg, path)); - } catch (Exception e) { - } - try { - return new OrcItem(getMaterial(cfg, path), getDisplay(cfg, path), getLore(cfg, path)); - } catch (Exception e) { - } - return OrcItem.error.clone().setDisplay("c" + path); - } - - public static OrcItem getEnabled() { - return getItem("options.enabled"); - } - - public static OrcItem getDisabled() { - return getItem("options.disabled"); - } - - public static OrcItem getComingSoon() { - return getItem("options.coming_soon"); - } - - private static OrcItem getBack() { - return getItem("options.back"); - } - - private static OrcItem getFill() { - return getItem("options.fill"); - } - - public static boolean isFill(String path) { - return getConfig().getBoolean(path + ".fill"); - } - - public static Material getSkullItem() { - return getMaterial(getConfig(), "options.players.playerhead"); - } -} +package de.butzlabben.world.config; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.charset.Charset; +import java.nio.file.Files; +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.plugin.java.JavaPlugin; + +import de.butzlabben.inventory.OrcItem; +import de.butzlabben.world.WorldSystem; + +public class GuiConfig { + + private GuiConfig() { + } + + private static File file; + + public static void checkConfig(File f) { + file = f; + if (file.exists() == false) { + try { + String guiFileResource; + if (WorldSystem.is1_13()) { + guiFileResource = "1_13_gui.yml"; + } else { + guiFileResource = "old_gui.yml"; + } + InputStream in = JavaPlugin.getPlugin(WorldSystem.class).getResource(guiFileResource); + Files.copy(in, file.toPath()); + } catch (IOException e) { + System.err.println("Wasn't able to create Config"); + e.printStackTrace(); + } + } + OrcItem.enabled = getEnabled(); + OrcItem.disabled = getDisabled(); + OrcItem.coming_soon = getComingSoon(); + OrcItem.back = getBack(); + OrcItem.fill = getFill(); + } + + public static YamlConfiguration getConfig() { + try { + return YamlConfiguration + .loadConfiguration(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8"))); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + return null; + } + + public static int getSlot(String path) { + YamlConfiguration cfg = getConfig(); + return (cfg.getInt(path + ".slot.row") - 1) * 9 + cfg.getInt(path + ".slot.col") - 1; + } + + public static int getState(String path) { + YamlConfiguration cfg = getConfig(); + return (cfg.getInt(path + ".state.row") - 1) * 9 + cfg.getInt(path + ".state.col") - 1; + } + + public static boolean isEnabled(String path) { + return getConfig().getBoolean(path + ".enabled", true); + } + + public static int getRows(String path) { + return getConfig().getInt(path + ".rows", 1); + } + + public static String getDisplay(FileConfiguration cfg, String path) { + return ChatColor.translateAlternateColorCodes('&', cfg.getString(path + ".display")); + } + + public static ArrayList getLore(FileConfiguration cfg, String path) { + List list = cfg.getStringList(path + ".lore"); + ArrayList colored = new ArrayList<>(list.size()); + for (String s : list) { + colored.add(ChatColor.translateAlternateColorCodes('&', s)); + } + return colored; + } + + public static byte getData(FileConfiguration cfg, String path) { + return (byte) cfg.getInt(path + ".data", 0); + } + + public static String getTitle(FileConfiguration cfg, String path) { + return cfg.getString(path + ".title"); + } + + public static Material getMaterial(FileConfiguration cfg, String path) { + try { + return Material.valueOf(cfg.getString(path + ".material").toUpperCase()); + } catch (IllegalArgumentException ex) { + Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "cUnknown material: " + path); + return null; + } + } + + public static OrcItem getItem(String path) { + YamlConfiguration cfg = getConfig(); + try { + return new OrcItem(getMaterial(cfg, path), getData(cfg, path), getDisplay(cfg, path), getLore(cfg, path)); + } catch (Exception e) { + } + try { + return new OrcItem(getMaterial(cfg, path), getDisplay(cfg, path), getLore(cfg, path)); + } catch (Exception e) { + } + return OrcItem.error.clone().setDisplay("c" + path); + } + + public static OrcItem getEnabled() { + return getItem("options.enabled"); + } + + public static OrcItem getDisabled() { + return getItem("options.disabled"); + } + + public static OrcItem getComingSoon() { + return getItem("options.coming_soon"); + } + + private static OrcItem getBack() { + return getItem("options.back"); + } + + private static OrcItem getFill() { + return getItem("options.fill"); + } + + public static boolean isFill(String path) { + return getConfig().getBoolean(path + ".fill"); + } + + public static Material getSkullItem() { + return getMaterial(getConfig(), "options.players.playerhead"); + } +} diff --git a/WorldSystem/src/main/java/de/butzlabben/world/config/MessageConfig.java b/src/main/java/de/butzlabben/world/config/MessageConfig.java similarity index 100% rename from WorldSystem/src/main/java/de/butzlabben/world/config/MessageConfig.java rename to src/main/java/de/butzlabben/world/config/MessageConfig.java diff --git a/WorldSystem/src/main/java/de/butzlabben/world/config/PluginConfig.java b/src/main/java/de/butzlabben/world/config/PluginConfig.java similarity index 97% rename from WorldSystem/src/main/java/de/butzlabben/world/config/PluginConfig.java rename to src/main/java/de/butzlabben/world/config/PluginConfig.java index 8ac7e4a..f51b8e1 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/config/PluginConfig.java +++ b/src/main/java/de/butzlabben/world/config/PluginConfig.java @@ -1,245 +1,245 @@ -package de.butzlabben.world.config; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.nio.charset.Charset; -import java.nio.file.Files; -import java.nio.file.StandardCopyOption; -import java.text.SimpleDateFormat; -import java.util.Date; - -import org.bukkit.Bukkit; -import org.bukkit.GameMode; -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.WorldCreator; -import org.bukkit.World.Environment; -import org.bukkit.WorldType; -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.plugin.java.JavaPlugin; - -import de.butzlabben.world.WorldSystem; -import net.md_5.bungee.api.ChatColor; - -public class PluginConfig { - - private PluginConfig() { - } - - private static File file; - - public static void checkConfig(File f) { - file = f; - if (file.exists()) { - YamlConfiguration cfg = getConfig(); - if (false == (cfg.isString("worldfolder") && cfg.isInt("unloadingtime") - && cfg.isBoolean("survival") && cfg.isString("language") && cfg.isString("prefix") - && cfg.isInt("request_expires") && cfg.isBoolean("need_confirm") - && cfg.isBoolean("contact_authserver") && cfg.isBoolean("spawn_teleportation") - && cfg.isInt("delete_after") && cfg.isBoolean("worldtemplates.multi_choose") - && cfg.isString("worldtemplates.default") && - - cfg.isInt("lagsystem.period_in_seconds") && cfg.isInt("lagsystem.entities_per_world") - && cfg.isBoolean("lagsystem.garbagecollector.use") - && cfg.isInt("lagsystem.garbagecollector.period_in_minutes") && - - cfg.isString("worldgeneration.type") && cfg.isString("worldgeneration.environment") - && cfg.isString("worldgeneration.generator") - && (cfg.isLong("worldgeneration.seed") || cfg.isInt("worldgeneration.seed")) && - - cfg.isString("spawn.spawnpoint.world") && cfg.isInt("spawn.gamemode") - && (cfg.isDouble("spawn.spawnpoint.x") || cfg.isInt("spawn.spawnpoint.x")) - && (cfg.isDouble("spawn.spawnpoint.y") || cfg.isInt("spawn.spawnpoint.y")) - && (cfg.isDouble("spawn.spawnpoint.z") || cfg.isInt("spawn.spawnpoint.z")) - && (cfg.isDouble("spawn.spawnpoint.yaw") || cfg.isInt("spawn.spawnpoint.yaw")) - && (cfg.isDouble("spawn.spawnpoint.pitch") || cfg.isInt("spawn.spawnpoint.pitch")) && - - cfg.isBoolean("worldspawn.use") - && (cfg.isDouble("worldspawn.spawnpoint.x") || cfg.isInt("worldspawn.spawnpoint.x")) - && (cfg.isDouble("worldspawn.spawnpoint.y") || cfg.isInt("worldspawn.spawnpoint.y")) - && (cfg.isDouble("worldspawn.spawnpoint.z") || cfg.isInt("worldspawn.spawnpoint.z")) - && (cfg.isDouble("worldspawn.spawnpoint.yaw") || cfg.isInt("worldspawn.spawnpoint.yaw")) - && (cfg.isDouble("worldspawn.spawnpoint.pitch") || cfg.isInt("worldspawn.spawnpoint.pitch")))) { - try { - Files.copy(file.toPath(), - new File(file.getParentFile(), "config-broken-" - + new SimpleDateFormat("dd-MM-yyyy-HH-mm-ss").format(new Date()) + ".yml").toPath(), - StandardCopyOption.REPLACE_EXISTING); - Files.delete(file.toPath()); - System.err.println("[WorldSystem] Config is broken, creating a new one!"); - checkConfig(f); - } catch (IOException e) { - e.printStackTrace(); - } - } - } else { - try { - InputStream in = JavaPlugin.getPlugin(WorldSystem.class).getResource("config.yml"); - Files.copy(in, file.toPath()); - } catch (IOException e) { - System.err.println("Wasn't able to create Config"); - e.printStackTrace(); - } - } - - // Should fix #2 - if (getSpawn().getWorld() == null) { - Bukkit.getConsoleSender().sendMessage(getPrefix() + "cWorld is null in spawn.world!"); - } - } - - public static YamlConfiguration getConfig() { - try { - return YamlConfiguration - .loadConfiguration(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8"))); - } catch (FileNotFoundException e) { - e.printStackTrace(); - } - return null; - } - - public static int getGCPeriod() { - return getConfig().getInt("lagsystem.garbagecollector.period_in_minutes", 5); - } - - public static boolean useGC() { - return getConfig().getBoolean("lagsystem.garbagecollector.use", false); - } - - public static int getEntitysPerWorld() { - return getConfig().getInt("lagsystem.entities_per_world", 350); - } - - public static int getLagCheckPeriod() { - return getConfig().getInt("lagsystem.period_in_seconds", 10); - } - - public static boolean useWorldSpawn() { - return getConfig().getBoolean("worldspawn.use", true); - } - - public static boolean isSurvival() { - return getConfig().getBoolean("survival", false); - } - - public static int getUnloadingTime() { - return getConfig().getInt("unloadingtime", 20); - } - - private final static GameMode[] gamemodes = new GameMode[] { GameMode.SURVIVAL, GameMode.CREATIVE, - GameMode.ADVENTURE, GameMode.SPECTATOR }; - - public static GameMode getSpawnGamemode() { - return gamemodes[getConfig().getInt("spawn.gamemode", 2)]; - } - - public static String getWorlddir() { - return getConfig().getString("worldfolder", "plugins/WorldSystem/Worlds") + "/"; - } - - public static boolean isMultiChoose() { - return getConfig().getBoolean("worldtemplates.multi_choose", false); - } - - public static String getDefaultWorldTemplate() { - return getConfig().getString("worldtemplates.default", ""); - } - - public static String getLanguage() { - return getConfig().getString("language", "en"); - } - - public static String getPrefix() { - return ChatColor.translateAlternateColorCodes('&', getConfig().getString("prefix", "8[3WorldSystem8] 6")); - } - - public static Location getWorldSpawn(World w) { - return getLocation(getConfig(), "worldspawn.spawnpoint", w); - } - - public static Location getSpawn() { - YamlConfiguration cfg = getConfig(); - return getLocation(cfg, "spawn.spawnpoint", Bukkit.getWorld(cfg.getString("spawn.spawnpoint.world", "world"))); - } - - public static long getSeed() { - return getConfig().getLong("worldgeneration.seed"); - } - - public static Environment getEnvironment() { - YamlConfiguration cfg = getConfig(); - String t = cfg.getString("worldgeneration.environment"); - Environment e = Environment.NORMAL; - try { - e = Environment.valueOf(t.toUpperCase()); - } catch (Exception ex) { - System.out.println("'" + t + "' is not a valid environment"); - } - return e; - } - - public static String getGenerator() { - return getConfig().getString("worldgeneration.generator"); - } - - public static WorldType getWorldType() { - YamlConfiguration cfg = getConfig(); - String t = cfg.getString("worldgeneration.type"); - WorldType wt = WorldType.NORMAL; - try { - wt = WorldType.valueOf(t.toUpperCase()); - } catch (Exception e) { - System.err.println("'" + t + "' is not a valid worldtype"); - } - return wt; - } - - public static int getRequestExpire() { - return getConfig().getInt("request_expires", 20); - } - - private static Location getLocation(YamlConfiguration cfg, String path, World world) { - return new Location(world, cfg.getDouble(path + ".x", 0), cfg.getDouble(path + ".y", 20), - cfg.getDouble(path + ".z", 0), (float) cfg.getDouble(path + ".yaw", 0), - (float) cfg.getDouble(path + ".pitch", 0)); - } - - public static boolean confirmNeed() { - return getConfig().getBoolean("need_confirm", true); - } - - public static boolean contactAuth() { - return getConfig().getBoolean("contact_authserver", true); - } - - public static boolean spawnTeleportation() { - return getConfig().getBoolean("spawn_teleportation", true); - } - - public static boolean shouldDelete() { - return getConfig().getInt("delete_after") != -1; - } - - public static long deleteAfter() { - return getConfig().getLong("delete_after"); - } - - public static WorldCreator getWorldCreator(String worldname) { - WorldCreator creator = new WorldCreator(worldname); - long seed = PluginConfig.getSeed(); - Environment env = PluginConfig.getEnvironment(); - WorldType type = PluginConfig.getWorldType(); - if (seed != 0) - creator.seed(seed); - creator.type(type); - creator.environment(env); - String generator = PluginConfig.getGenerator(); - if (!generator.trim().isEmpty()) - creator.generator(generator); - return creator; - } -} +package de.butzlabben.world.config; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.charset.Charset; +import java.nio.file.Files; +import java.nio.file.StandardCopyOption; +import java.text.SimpleDateFormat; +import java.util.Date; + +import org.bukkit.Bukkit; +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.WorldCreator; +import org.bukkit.World.Environment; +import org.bukkit.WorldType; +import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.plugin.java.JavaPlugin; + +import de.butzlabben.world.WorldSystem; +import net.md_5.bungee.api.ChatColor; + +public class PluginConfig { + + private PluginConfig() { + } + + private static File file; + + public static void checkConfig(File f) { + file = f; + if (file.exists()) { + YamlConfiguration cfg = getConfig(); + if (false == (cfg.isString("worldfolder") && cfg.isInt("unloadingtime") + && cfg.isBoolean("survival") && cfg.isString("language") && cfg.isString("prefix") + && cfg.isInt("request_expires") && cfg.isBoolean("need_confirm") + && cfg.isBoolean("contact_authserver") && cfg.isBoolean("spawn_teleportation") + && cfg.isInt("delete_after") && cfg.isBoolean("worldtemplates.multi_choose") + && cfg.isString("worldtemplates.default") && + + cfg.isInt("lagsystem.period_in_seconds") && cfg.isInt("lagsystem.entities_per_world") + && cfg.isBoolean("lagsystem.garbagecollector.use") + && cfg.isInt("lagsystem.garbagecollector.period_in_minutes") && + + cfg.isString("worldgeneration.type") && cfg.isString("worldgeneration.environment") + && cfg.isString("worldgeneration.generator") + && (cfg.isLong("worldgeneration.seed") || cfg.isInt("worldgeneration.seed")) && + + cfg.isString("spawn.spawnpoint.world") && cfg.isInt("spawn.gamemode") + && (cfg.isDouble("spawn.spawnpoint.x") || cfg.isInt("spawn.spawnpoint.x")) + && (cfg.isDouble("spawn.spawnpoint.y") || cfg.isInt("spawn.spawnpoint.y")) + && (cfg.isDouble("spawn.spawnpoint.z") || cfg.isInt("spawn.spawnpoint.z")) + && (cfg.isDouble("spawn.spawnpoint.yaw") || cfg.isInt("spawn.spawnpoint.yaw")) + && (cfg.isDouble("spawn.spawnpoint.pitch") || cfg.isInt("spawn.spawnpoint.pitch")) && + + cfg.isBoolean("worldspawn.use") + && (cfg.isDouble("worldspawn.spawnpoint.x") || cfg.isInt("worldspawn.spawnpoint.x")) + && (cfg.isDouble("worldspawn.spawnpoint.y") || cfg.isInt("worldspawn.spawnpoint.y")) + && (cfg.isDouble("worldspawn.spawnpoint.z") || cfg.isInt("worldspawn.spawnpoint.z")) + && (cfg.isDouble("worldspawn.spawnpoint.yaw") || cfg.isInt("worldspawn.spawnpoint.yaw")) + && (cfg.isDouble("worldspawn.spawnpoint.pitch") || cfg.isInt("worldspawn.spawnpoint.pitch")))) { + try { + Files.copy(file.toPath(), + new File(file.getParentFile(), "config-broken-" + + new SimpleDateFormat("dd-MM-yyyy-HH-mm-ss").format(new Date()) + ".yml").toPath(), + StandardCopyOption.REPLACE_EXISTING); + Files.delete(file.toPath()); + System.err.println("[WorldSystem] Config is broken, creating a new one!"); + checkConfig(f); + } catch (IOException e) { + e.printStackTrace(); + } + } + } else { + try { + InputStream in = JavaPlugin.getPlugin(WorldSystem.class).getResource("config.yml"); + Files.copy(in, file.toPath()); + } catch (IOException e) { + System.err.println("Wasn't able to create Config"); + e.printStackTrace(); + } + } + + // Should fix #2 + if (getSpawn().getWorld() == null) { + Bukkit.getConsoleSender().sendMessage(getPrefix() + "cWorld is null in spawn.world!"); + } + } + + public static YamlConfiguration getConfig() { + try { + return YamlConfiguration + .loadConfiguration(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8"))); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + return null; + } + + public static int getGCPeriod() { + return getConfig().getInt("lagsystem.garbagecollector.period_in_minutes", 5); + } + + public static boolean useGC() { + return getConfig().getBoolean("lagsystem.garbagecollector.use", false); + } + + public static int getEntitysPerWorld() { + return getConfig().getInt("lagsystem.entities_per_world", 350); + } + + public static int getLagCheckPeriod() { + return getConfig().getInt("lagsystem.period_in_seconds", 10); + } + + public static boolean useWorldSpawn() { + return getConfig().getBoolean("worldspawn.use", true); + } + + public static boolean isSurvival() { + return getConfig().getBoolean("survival", false); + } + + public static int getUnloadingTime() { + return getConfig().getInt("unloadingtime", 20); + } + + private final static GameMode[] gamemodes = new GameMode[] { GameMode.SURVIVAL, GameMode.CREATIVE, + GameMode.ADVENTURE, GameMode.SPECTATOR }; + + public static GameMode getSpawnGamemode() { + return gamemodes[getConfig().getInt("spawn.gamemode", 2)]; + } + + public static String getWorlddir() { + return getConfig().getString("worldfolder", "plugins/WorldSystem/Worlds") + "/"; + } + + public static boolean isMultiChoose() { + return getConfig().getBoolean("worldtemplates.multi_choose", false); + } + + public static String getDefaultWorldTemplate() { + return getConfig().getString("worldtemplates.default", ""); + } + + public static String getLanguage() { + return getConfig().getString("language", "en"); + } + + public static String getPrefix() { + return ChatColor.translateAlternateColorCodes('&', getConfig().getString("prefix", "8[3WorldSystem8] 6")); + } + + public static Location getWorldSpawn(World w) { + return getLocation(getConfig(), "worldspawn.spawnpoint", w); + } + + public static Location getSpawn() { + YamlConfiguration cfg = getConfig(); + return getLocation(cfg, "spawn.spawnpoint", Bukkit.getWorld(cfg.getString("spawn.spawnpoint.world", "world"))); + } + + public static long getSeed() { + return getConfig().getLong("worldgeneration.seed"); + } + + public static Environment getEnvironment() { + YamlConfiguration cfg = getConfig(); + String t = cfg.getString("worldgeneration.environment"); + Environment e = Environment.NORMAL; + try { + e = Environment.valueOf(t.toUpperCase()); + } catch (Exception ex) { + System.out.println("'" + t + "' is not a valid environment"); + } + return e; + } + + public static String getGenerator() { + return getConfig().getString("worldgeneration.generator"); + } + + public static WorldType getWorldType() { + YamlConfiguration cfg = getConfig(); + String t = cfg.getString("worldgeneration.type"); + WorldType wt = WorldType.NORMAL; + try { + wt = WorldType.valueOf(t.toUpperCase()); + } catch (Exception e) { + System.err.println("'" + t + "' is not a valid worldtype"); + } + return wt; + } + + public static int getRequestExpire() { + return getConfig().getInt("request_expires", 20); + } + + private static Location getLocation(YamlConfiguration cfg, String path, World world) { + return new Location(world, cfg.getDouble(path + ".x", 0), cfg.getDouble(path + ".y", 20), + cfg.getDouble(path + ".z", 0), (float) cfg.getDouble(path + ".yaw", 0), + (float) cfg.getDouble(path + ".pitch", 0)); + } + + public static boolean confirmNeed() { + return getConfig().getBoolean("need_confirm", true); + } + + public static boolean contactAuth() { + return getConfig().getBoolean("contact_authserver", true); + } + + public static boolean spawnTeleportation() { + return getConfig().getBoolean("spawn_teleportation", true); + } + + public static boolean shouldDelete() { + return getConfig().getInt("delete_after") != -1; + } + + public static long deleteAfter() { + return getConfig().getLong("delete_after"); + } + + public static WorldCreator getWorldCreator(String worldname) { + WorldCreator creator = new WorldCreator(worldname); + long seed = PluginConfig.getSeed(); + Environment env = PluginConfig.getEnvironment(); + WorldType type = PluginConfig.getWorldType(); + if (seed != 0) + creator.seed(seed); + creator.type(type); + creator.environment(env); + String generator = PluginConfig.getGenerator(); + if (!generator.trim().isEmpty()) + creator.generator(generator); + return creator; + } +} diff --git a/WorldSystem/src/main/java/de/butzlabben/world/config/SettingsConfig.java b/src/main/java/de/butzlabben/world/config/SettingsConfig.java similarity index 97% rename from WorldSystem/src/main/java/de/butzlabben/world/config/SettingsConfig.java rename to src/main/java/de/butzlabben/world/config/SettingsConfig.java index 7648e89..d583134 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/config/SettingsConfig.java +++ b/src/main/java/de/butzlabben/world/config/SettingsConfig.java @@ -1,184 +1,184 @@ -package de.butzlabben.world.config; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.nio.charset.Charset; -import java.nio.file.Files; -import java.util.HashMap; -import java.util.List; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.entity.Player; -import org.bukkit.plugin.java.JavaPlugin; - -import de.butzlabben.world.WorldSystem; -import de.butzlabben.world.wrapper.SystemWorld; - -public class SettingsConfig { - - private static HashMap borderSizes = new HashMap<>(); - - private static File file; - - @SuppressWarnings("deprecation") - public static void editWorld(World w) { - YamlConfiguration cfg = getConfig(); - - SystemWorld sw = SystemWorld.getSystemWorld(w.getName()); - - boolean shouldChange = cfg.getBoolean("worldborder.should_change", false); - if (shouldChange) { - long size = cfg.getLong("worldborder.normal", 1000); - if (sw != null && sw.isLoaded()) { - String worldname = w.getName(); - UUID uuid = UUID.fromString(worldname.substring(worldname.length() - 36)); - Player p = Bukkit.getPlayer(uuid); - if (p != null && p.isOnline()) { - for (String string : borderSizes.keySet()) { - if (p.hasPermission(string) && size < borderSizes.get(string)) { - size = borderSizes.get(string); - } - } - } - } - - w.getWorldBorder().setSize(size); - - if (cfg.getBoolean("worldborder.center.as_spawn", true)) { - if (PluginConfig.useWorldSpawn()) { - w.getWorldBorder().setCenter(PluginConfig.getWorldSpawn(w)); - } else { - w.getWorldBorder().setCenter(w.getSpawnLocation()); - } - } else { - Location loc = new Location(w, cfg.getDouble("worldborder.center.x", 0), - cfg.getDouble("worldborder.center.y", 20), cfg.getDouble("worldborder.center.z", 0)); - w.getWorldBorder().setCenter(loc); - } - if (cfg.getBoolean("worldborder.center.as_home")) { - WorldConfig config = WorldConfig.getWorldConfig(w.getName()); - if (config.getHome() != null) - w.getWorldBorder().setCenter(config.getHome()); - } - } - - if (w.isGameRule("announceAdvancements")) - w.setGameRuleValue("announceAdvancements", cfg.getString("announceAdvancements")); - - if (w.isGameRule("commandBlockOutput")) - w.setGameRuleValue("commandBlockOutput", cfg.getString("commandBlockOutput")); - - if (w.isGameRule("disableElytraMovementCheck")) - w.setGameRuleValue("disableElytraMovementCheck", cfg.getString("disableElytraMovementCheck")); - - if (w.isGameRule("doDaylightCycle")) - w.setGameRuleValue("doDaylightCycle", cfg.getString("doDaylightCycle")); - - if (w.isGameRule("doEntityDrops")) - w.setGameRuleValue("doEntityDrops", cfg.getString("doEntityDrops")); - - if (w.isGameRule("doFireTick")) - w.setGameRuleValue("doFireTick", cfg.getString("doFireTick")); - - if (w.isGameRule("doLimitedCrafting")) - w.setGameRuleValue("doLimitedCrafting", cfg.getString("doLimitedCrafting")); - - if (w.isGameRule("doMobLoot")) - w.setGameRuleValue("doMobLoot", cfg.getString("doMobLoot")); - - if (w.isGameRule("doMobSpawning")) - w.setGameRuleValue("doMobSpawning", cfg.getString("doMobSpawning")); - - if (w.isGameRule("doTileDrops")) - w.setGameRuleValue("doTileDrops", cfg.getString("doTileDrops")); - - if (w.isGameRule("doWeatherCycle")) - w.setGameRuleValue("doWeatherCycle", cfg.getString("doWeatherCycle")); - - if (w.isGameRule("gameLoopFunction")) - w.setGameRuleValue("gameLoopFunction", cfg.getString("gameLoopFunction")); - - if (w.isGameRule("keepInventory")) - w.setGameRuleValue("keepInventory", cfg.getString("keepInventory")); - - if (w.isGameRule("logAdminCommands")) - w.setGameRuleValue("logAdminCommands", cfg.getString("logAdminCommands")); - - if (w.isGameRule("maxCommandChainLength")) - w.setGameRuleValue("maxCommandChainLength", cfg.getString("maxCommandChainLength")); - - if (w.isGameRule("maxEntityCramming")) - w.setGameRuleValue("maxEntityCramming", cfg.getString("maxEntityCramming")); - - if (w.isGameRule("mobGriefing")) - w.setGameRuleValue("mobGriefing", cfg.getString("mobGriefing")); - - if (w.isGameRule("naturalRegeneration")) - w.setGameRuleValue("naturalRegeneration", cfg.getString("naturalRegeneration")); - - if (w.isGameRule("randomTickSpeed")) - w.setGameRuleValue("randomTickSpeed", cfg.getString("randomTickSpeed")); - - if (w.isGameRule("reducedDebugInfo")) - w.setGameRuleValue("reducedDebugInfo", cfg.getString("reducedDebugInfo")); - - if (w.isGameRule("sendCommandFeedback")) - w.setGameRuleValue("sendCommandFeedback", cfg.getString("sendCommandFeedback")); - - if (w.isGameRule("showDeathMessages")) - w.setGameRuleValue("showDeathMessages", cfg.getString("showDeathMessages")); - - if (w.isGameRule("spawnRadius")) - w.setGameRuleValue("spawnRadius", cfg.getString("spawnRadius")); - - if (w.isGameRule("spectatorsGenerateChunks")) - w.setGameRuleValue("spectatorsGenerateChunks", cfg.getString("spectatorsGenerateChunks")); - } - - private static YamlConfiguration getConfig() { - try { - return YamlConfiguration - .loadConfiguration(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8"))); - } catch (FileNotFoundException e) { - e.printStackTrace(); - } - return null; - } - - public static void checkConfig() { - File file = new File(WorldSystem.getInstance().getDataFolder(), "settings.yml"); - SettingsConfig.file = file; - if (!file.exists()) { - try { - InputStream in = JavaPlugin.getPlugin(WorldSystem.class).getResource("settings.yml"); - Files.copy(in, file.toPath()); - } catch (IOException e) { - System.err.println("Wasn't able to create Config"); - e.printStackTrace(); - } - } - YamlConfiguration cfg = getConfig(); - for (String s : cfg.getConfigurationSection("worldborder.ranks").getKeys(true)) { - if (cfg.isInt("worldborder.ranks." + s) || cfg.isLong("worldborder.ranks." + s)) - borderSizes.put(s, cfg.getLong("worldborder.ranks." + s)); - } - } - /** - * @return the commands specified in settings.yml on /ws get - */ - public static List getCommandsonGet() { - YamlConfiguration cfg = getConfig(); - return cfg.getStringList("commands_on_get"); - } - - private SettingsConfig() { - } -} +package de.butzlabben.world.config; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.charset.Charset; +import java.nio.file.Files; +import java.util.HashMap; +import java.util.List; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import de.butzlabben.world.WorldSystem; +import de.butzlabben.world.wrapper.SystemWorld; + +public class SettingsConfig { + + private static HashMap borderSizes = new HashMap<>(); + + private static File file; + + @SuppressWarnings("deprecation") + public static void editWorld(World w) { + YamlConfiguration cfg = getConfig(); + + SystemWorld sw = SystemWorld.getSystemWorld(w.getName()); + + boolean shouldChange = cfg.getBoolean("worldborder.should_change", false); + if (shouldChange) { + long size = cfg.getLong("worldborder.normal", 1000); + if (sw != null && sw.isLoaded()) { + String worldname = w.getName(); + UUID uuid = UUID.fromString(worldname.substring(worldname.length() - 36)); + Player p = Bukkit.getPlayer(uuid); + if (p != null && p.isOnline()) { + for (String string : borderSizes.keySet()) { + if (p.hasPermission(string) && size < borderSizes.get(string)) { + size = borderSizes.get(string); + } + } + } + } + + w.getWorldBorder().setSize(size); + + if (cfg.getBoolean("worldborder.center.as_spawn", true)) { + if (PluginConfig.useWorldSpawn()) { + w.getWorldBorder().setCenter(PluginConfig.getWorldSpawn(w)); + } else { + w.getWorldBorder().setCenter(w.getSpawnLocation()); + } + } else { + Location loc = new Location(w, cfg.getDouble("worldborder.center.x", 0), + cfg.getDouble("worldborder.center.y", 20), cfg.getDouble("worldborder.center.z", 0)); + w.getWorldBorder().setCenter(loc); + } + if (cfg.getBoolean("worldborder.center.as_home")) { + WorldConfig config = WorldConfig.getWorldConfig(w.getName()); + if (config.getHome() != null) + w.getWorldBorder().setCenter(config.getHome()); + } + } + + if (w.isGameRule("announceAdvancements")) + w.setGameRuleValue("announceAdvancements", cfg.getString("announceAdvancements")); + + if (w.isGameRule("commandBlockOutput")) + w.setGameRuleValue("commandBlockOutput", cfg.getString("commandBlockOutput")); + + if (w.isGameRule("disableElytraMovementCheck")) + w.setGameRuleValue("disableElytraMovementCheck", cfg.getString("disableElytraMovementCheck")); + + if (w.isGameRule("doDaylightCycle")) + w.setGameRuleValue("doDaylightCycle", cfg.getString("doDaylightCycle")); + + if (w.isGameRule("doEntityDrops")) + w.setGameRuleValue("doEntityDrops", cfg.getString("doEntityDrops")); + + if (w.isGameRule("doFireTick")) + w.setGameRuleValue("doFireTick", cfg.getString("doFireTick")); + + if (w.isGameRule("doLimitedCrafting")) + w.setGameRuleValue("doLimitedCrafting", cfg.getString("doLimitedCrafting")); + + if (w.isGameRule("doMobLoot")) + w.setGameRuleValue("doMobLoot", cfg.getString("doMobLoot")); + + if (w.isGameRule("doMobSpawning")) + w.setGameRuleValue("doMobSpawning", cfg.getString("doMobSpawning")); + + if (w.isGameRule("doTileDrops")) + w.setGameRuleValue("doTileDrops", cfg.getString("doTileDrops")); + + if (w.isGameRule("doWeatherCycle")) + w.setGameRuleValue("doWeatherCycle", cfg.getString("doWeatherCycle")); + + if (w.isGameRule("gameLoopFunction")) + w.setGameRuleValue("gameLoopFunction", cfg.getString("gameLoopFunction")); + + if (w.isGameRule("keepInventory")) + w.setGameRuleValue("keepInventory", cfg.getString("keepInventory")); + + if (w.isGameRule("logAdminCommands")) + w.setGameRuleValue("logAdminCommands", cfg.getString("logAdminCommands")); + + if (w.isGameRule("maxCommandChainLength")) + w.setGameRuleValue("maxCommandChainLength", cfg.getString("maxCommandChainLength")); + + if (w.isGameRule("maxEntityCramming")) + w.setGameRuleValue("maxEntityCramming", cfg.getString("maxEntityCramming")); + + if (w.isGameRule("mobGriefing")) + w.setGameRuleValue("mobGriefing", cfg.getString("mobGriefing")); + + if (w.isGameRule("naturalRegeneration")) + w.setGameRuleValue("naturalRegeneration", cfg.getString("naturalRegeneration")); + + if (w.isGameRule("randomTickSpeed")) + w.setGameRuleValue("randomTickSpeed", cfg.getString("randomTickSpeed")); + + if (w.isGameRule("reducedDebugInfo")) + w.setGameRuleValue("reducedDebugInfo", cfg.getString("reducedDebugInfo")); + + if (w.isGameRule("sendCommandFeedback")) + w.setGameRuleValue("sendCommandFeedback", cfg.getString("sendCommandFeedback")); + + if (w.isGameRule("showDeathMessages")) + w.setGameRuleValue("showDeathMessages", cfg.getString("showDeathMessages")); + + if (w.isGameRule("spawnRadius")) + w.setGameRuleValue("spawnRadius", cfg.getString("spawnRadius")); + + if (w.isGameRule("spectatorsGenerateChunks")) + w.setGameRuleValue("spectatorsGenerateChunks", cfg.getString("spectatorsGenerateChunks")); + } + + private static YamlConfiguration getConfig() { + try { + return YamlConfiguration + .loadConfiguration(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8"))); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + return null; + } + + public static void checkConfig() { + File file = new File(WorldSystem.getInstance().getDataFolder(), "settings.yml"); + SettingsConfig.file = file; + if (!file.exists()) { + try { + InputStream in = JavaPlugin.getPlugin(WorldSystem.class).getResource("settings.yml"); + Files.copy(in, file.toPath()); + } catch (IOException e) { + System.err.println("Wasn't able to create Config"); + e.printStackTrace(); + } + } + YamlConfiguration cfg = getConfig(); + for (String s : cfg.getConfigurationSection("worldborder.ranks").getKeys(true)) { + if (cfg.isInt("worldborder.ranks." + s) || cfg.isLong("worldborder.ranks." + s)) + borderSizes.put(s, cfg.getLong("worldborder.ranks." + s)); + } + } + /** + * @return the commands specified in settings.yml on /ws get + */ + public static List getCommandsonGet() { + YamlConfiguration cfg = getConfig(); + return cfg.getStringList("commands_on_get"); + } + + private SettingsConfig() { + } +} diff --git a/WorldSystem/src/main/java/de/butzlabben/world/config/WorldConfig.java b/src/main/java/de/butzlabben/world/config/WorldConfig.java similarity index 100% rename from WorldSystem/src/main/java/de/butzlabben/world/config/WorldConfig.java rename to src/main/java/de/butzlabben/world/config/WorldConfig.java diff --git a/WorldSystem/src/main/java/de/butzlabben/world/config/WorldPerm.java b/src/main/java/de/butzlabben/world/config/WorldPerm.java similarity index 100% rename from WorldSystem/src/main/java/de/butzlabben/world/config/WorldPerm.java rename to src/main/java/de/butzlabben/world/config/WorldPerm.java diff --git a/WorldSystem/src/main/java/de/butzlabben/world/event/WorldAddmemberEvent.java b/src/main/java/de/butzlabben/world/event/WorldAddmemberEvent.java similarity index 94% rename from WorldSystem/src/main/java/de/butzlabben/world/event/WorldAddmemberEvent.java rename to src/main/java/de/butzlabben/world/event/WorldAddmemberEvent.java index d444d38..b687674 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/event/WorldAddmemberEvent.java +++ b/src/main/java/de/butzlabben/world/event/WorldAddmemberEvent.java @@ -1,53 +1,53 @@ -package de.butzlabben.world.event; - -import java.util.UUID; - -import org.bukkit.entity.Player; -import org.bukkit.event.HandlerList; - -/** - * Event for adding somebody to a world - * - * @author Butzlabben - * @since 09.05.2018 - */ -public class WorldAddmemberEvent extends WorldEvent { - - private final String worldname; - private final UUID uuid; - private Player adder; - - public WorldAddmemberEvent(UUID uuid, String worldname, Player adder) { - this.uuid = uuid; - this.worldname = worldname; - this.adder = adder; - } - - /** - * @return player who adds somebody - */ - public Player getAdding() { - return adder; - } - - /** - * @return UUID of player who gets added - */ - public UUID getUUID() { - return uuid; - } - - /** - * @return worldname for which it happens - */ - public String getWorldname() { - return worldname; - } - - @Override - public HandlerList getHandlers() { - return handlers; - } - - public final static HandlerList handlers = new HandlerList(); -} +package de.butzlabben.world.event; + +import java.util.UUID; + +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; + +/** + * Event for adding somebody to a world + * + * @author Butzlabben + * @since 09.05.2018 + */ +public class WorldAddmemberEvent extends WorldEvent { + + private final String worldname; + private final UUID uuid; + private Player adder; + + public WorldAddmemberEvent(UUID uuid, String worldname, Player adder) { + this.uuid = uuid; + this.worldname = worldname; + this.adder = adder; + } + + /** + * @return player who adds somebody + */ + public Player getAdding() { + return adder; + } + + /** + * @return UUID of player who gets added + */ + public UUID getUUID() { + return uuid; + } + + /** + * @return worldname for which it happens + */ + public String getWorldname() { + return worldname; + } + + @Override + public HandlerList getHandlers() { + return handlers; + } + + public final static HandlerList handlers = new HandlerList(); +} diff --git a/WorldSystem/src/main/java/de/butzlabben/world/event/WorldCreateEvent.java b/src/main/java/de/butzlabben/world/event/WorldCreateEvent.java similarity index 95% rename from WorldSystem/src/main/java/de/butzlabben/world/event/WorldCreateEvent.java rename to src/main/java/de/butzlabben/world/event/WorldCreateEvent.java index 1762827..e3d9d93 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/event/WorldCreateEvent.java +++ b/src/main/java/de/butzlabben/world/event/WorldCreateEvent.java @@ -1,53 +1,53 @@ -package de.butzlabben.world.event; - -import org.bukkit.WorldCreator; -import org.bukkit.entity.Player; -import org.bukkit.event.HandlerList; - -/** - * Event if a SystemWorld gets created. - * Do mix up with the WorldCreateEvent from Bukkit - * - * @author Butzlabben - * @since 09.05.2018 - */ -public class WorldCreateEvent extends WorldEvent { - - private final Player owner; - private WorldCreator worldCreator; - - public WorldCreateEvent(Player owner, WorldCreator creator) { - this.owner = owner; - this.setWorldCreator(creator); - } - - /** - * @return owner of world that gets created - */ - public Player getOwner() { - return owner; - } - - public final static HandlerList handlers = new HandlerList(); - - public final static HandlerList getHandlerList() { - return handlers; - } - - @Override - public final HandlerList getHandlers() { - return handlers; - } - - /** - * @return the worldcreator which will be used - */ - public WorldCreator getWorldCreator() { - return worldCreator; - } - - public void setWorldCreator(WorldCreator worldCreator) { - this.worldCreator = worldCreator; - } - -} +package de.butzlabben.world.event; + +import org.bukkit.WorldCreator; +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; + +/** + * Event if a SystemWorld gets created. + * Do mix up with the WorldCreateEvent from Bukkit + * + * @author Butzlabben + * @since 09.05.2018 + */ +public class WorldCreateEvent extends WorldEvent { + + private final Player owner; + private WorldCreator worldCreator; + + public WorldCreateEvent(Player owner, WorldCreator creator) { + this.owner = owner; + this.setWorldCreator(creator); + } + + /** + * @return owner of world that gets created + */ + public Player getOwner() { + return owner; + } + + public final static HandlerList handlers = new HandlerList(); + + public final static HandlerList getHandlerList() { + return handlers; + } + + @Override + public final HandlerList getHandlers() { + return handlers; + } + + /** + * @return the worldcreator which will be used + */ + public WorldCreator getWorldCreator() { + return worldCreator; + } + + public void setWorldCreator(WorldCreator worldCreator) { + this.worldCreator = worldCreator; + } + +} diff --git a/WorldSystem/src/main/java/de/butzlabben/world/event/WorldDeleteEvent.java b/src/main/java/de/butzlabben/world/event/WorldDeleteEvent.java similarity index 95% rename from WorldSystem/src/main/java/de/butzlabben/world/event/WorldDeleteEvent.java rename to src/main/java/de/butzlabben/world/event/WorldDeleteEvent.java index a037f1e..962ac2e 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/event/WorldDeleteEvent.java +++ b/src/main/java/de/butzlabben/world/event/WorldDeleteEvent.java @@ -1,49 +1,49 @@ -package de.butzlabben.world.event; - -import org.bukkit.command.CommandSender; -import org.bukkit.event.HandlerList; - -import de.butzlabben.world.wrapper.SystemWorld; - -/** - * Event if a systemworld gets deleted - * - * @author Butzlabben - * @since 09.05.2018 - */ -public class WorldDeleteEvent extends WorldEvent { - - private final SystemWorld world; - private final CommandSender executor; - - public WorldDeleteEvent(CommandSender executor, SystemWorld world) { - this.executor = executor; - this.world = world; - } - - /** - * @return get the world which will be deleted - */ - public SystemWorld getWorld() { - return world; - } - - /** - * @return get the executor of the command - */ - public CommandSender getExecutor() { - return executor; - } - - public final static HandlerList handlers = new HandlerList(); - - public final static HandlerList getHandlerList() { - return handlers; - } - - @Override - public final HandlerList getHandlers() { - return handlers; - } - -} +package de.butzlabben.world.event; + +import org.bukkit.command.CommandSender; +import org.bukkit.event.HandlerList; + +import de.butzlabben.world.wrapper.SystemWorld; + +/** + * Event if a systemworld gets deleted + * + * @author Butzlabben + * @since 09.05.2018 + */ +public class WorldDeleteEvent extends WorldEvent { + + private final SystemWorld world; + private final CommandSender executor; + + public WorldDeleteEvent(CommandSender executor, SystemWorld world) { + this.executor = executor; + this.world = world; + } + + /** + * @return get the world which will be deleted + */ + public SystemWorld getWorld() { + return world; + } + + /** + * @return get the executor of the command + */ + public CommandSender getExecutor() { + return executor; + } + + public final static HandlerList handlers = new HandlerList(); + + public final static HandlerList getHandlerList() { + return handlers; + } + + @Override + public final HandlerList getHandlers() { + return handlers; + } + +} diff --git a/WorldSystem/src/main/java/de/butzlabben/world/event/WorldEvent.java b/src/main/java/de/butzlabben/world/event/WorldEvent.java similarity index 94% rename from WorldSystem/src/main/java/de/butzlabben/world/event/WorldEvent.java rename to src/main/java/de/butzlabben/world/event/WorldEvent.java index 3cd3828..fc935db 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/event/WorldEvent.java +++ b/src/main/java/de/butzlabben/world/event/WorldEvent.java @@ -1,27 +1,27 @@ -package de.butzlabben.world.event; - -import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; - -public abstract class WorldEvent extends Event implements Cancellable { - - private boolean cancelled; - - public WorldEvent() { - } - - public WorldEvent(boolean cancel) { - setCancelled(cancel); - } - - @Override - public boolean isCancelled() { - return cancelled; - } - - @Override - public void setCancelled(boolean cancel) { - cancelled = cancel; - } - -} +package de.butzlabben.world.event; + +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; + +public abstract class WorldEvent extends Event implements Cancellable { + + private boolean cancelled; + + public WorldEvent() { + } + + public WorldEvent(boolean cancel) { + setCancelled(cancel); + } + + @Override + public boolean isCancelled() { + return cancelled; + } + + @Override + public void setCancelled(boolean cancel) { + cancelled = cancel; + } + +} diff --git a/WorldSystem/src/main/java/de/butzlabben/world/event/WorldLoadEvent.java b/src/main/java/de/butzlabben/world/event/WorldLoadEvent.java similarity index 94% rename from WorldSystem/src/main/java/de/butzlabben/world/event/WorldLoadEvent.java rename to src/main/java/de/butzlabben/world/event/WorldLoadEvent.java index e26ec0d..f113262 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/event/WorldLoadEvent.java +++ b/src/main/java/de/butzlabben/world/event/WorldLoadEvent.java @@ -1,49 +1,49 @@ -package de.butzlabben.world.event; - -import org.bukkit.entity.Player; -import org.bukkit.event.HandlerList; - -import de.butzlabben.world.wrapper.SystemWorld; - -/** - * Event for loading a world - * - * @author Butzlabben - * @since 09.05.2018 - */ -public class WorldLoadEvent extends WorldEvent { - - private final Player owner; - private final SystemWorld world; - - public WorldLoadEvent(Player owner, SystemWorld systemWorld) { - this.owner = owner; - this.world = systemWorld; - } - - /** - * @return get the world which will be loaded - */ - public SystemWorld getWorld() { - return world; - } - - /** - * @return get person which intiziated the loading - */ - public Player getOwner() { - return owner; - } - - public final static HandlerList handlers = new HandlerList(); - - public final static HandlerList getHandlerList() { - return handlers; - } - - @Override - public final HandlerList getHandlers() { - return handlers; - } - -} +package de.butzlabben.world.event; + +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; + +import de.butzlabben.world.wrapper.SystemWorld; + +/** + * Event for loading a world + * + * @author Butzlabben + * @since 09.05.2018 + */ +public class WorldLoadEvent extends WorldEvent { + + private final Player owner; + private final SystemWorld world; + + public WorldLoadEvent(Player owner, SystemWorld systemWorld) { + this.owner = owner; + this.world = systemWorld; + } + + /** + * @return get the world which will be loaded + */ + public SystemWorld getWorld() { + return world; + } + + /** + * @return get person which intiziated the loading + */ + public Player getOwner() { + return owner; + } + + public final static HandlerList handlers = new HandlerList(); + + public final static HandlerList getHandlerList() { + return handlers; + } + + @Override + public final HandlerList getHandlers() { + return handlers; + } + +} diff --git a/WorldSystem/src/main/java/de/butzlabben/world/event/WorldRemovememberEvent.java b/src/main/java/de/butzlabben/world/event/WorldRemovememberEvent.java similarity index 94% rename from WorldSystem/src/main/java/de/butzlabben/world/event/WorldRemovememberEvent.java rename to src/main/java/de/butzlabben/world/event/WorldRemovememberEvent.java index 4df1adb..8f3c1f8 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/event/WorldRemovememberEvent.java +++ b/src/main/java/de/butzlabben/world/event/WorldRemovememberEvent.java @@ -1,52 +1,52 @@ -package de.butzlabben.world.event; - -import java.util.UUID; - -import org.bukkit.entity.Player; -import org.bukkit.event.HandlerList; - -/** - * @author Butzlabben - * @since 09.05.2018 - */ -public class WorldRemovememberEvent extends WorldEvent { - - private final String worldname; - private final UUID uuid; - private Player remover; - - public WorldRemovememberEvent(UUID uuid, String worldname, Player remover) { - this.uuid = uuid; - this.worldname = worldname; - this.remover = remover; - } - - /** - * @return player who removes somebody - */ - public Player getRemoving() { - return remover; - } - - /** - * @return uuid of player who gets removed - */ - public UUID getUUID() { - return uuid; - } - - /** - * @return worldname for which it happens - */ - public String getWorldname() { - return worldname; - } - - @Override - public HandlerList getHandlers() { - return handlers; - } - - - public final static HandlerList handlers = new HandlerList(); -} +package de.butzlabben.world.event; + +import java.util.UUID; + +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; + +/** + * @author Butzlabben + * @since 09.05.2018 + */ +public class WorldRemovememberEvent extends WorldEvent { + + private final String worldname; + private final UUID uuid; + private Player remover; + + public WorldRemovememberEvent(UUID uuid, String worldname, Player remover) { + this.uuid = uuid; + this.worldname = worldname; + this.remover = remover; + } + + /** + * @return player who removes somebody + */ + public Player getRemoving() { + return remover; + } + + /** + * @return uuid of player who gets removed + */ + public UUID getUUID() { + return uuid; + } + + /** + * @return worldname for which it happens + */ + public String getWorldname() { + return worldname; + } + + @Override + public HandlerList getHandlers() { + return handlers; + } + + + public final static HandlerList handlers = new HandlerList(); +} diff --git a/WorldSystem/src/main/java/de/butzlabben/world/event/WorldResetEvent.java b/src/main/java/de/butzlabben/world/event/WorldResetEvent.java similarity index 94% rename from WorldSystem/src/main/java/de/butzlabben/world/event/WorldResetEvent.java rename to src/main/java/de/butzlabben/world/event/WorldResetEvent.java index 9994819..243bfe6 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/event/WorldResetEvent.java +++ b/src/main/java/de/butzlabben/world/event/WorldResetEvent.java @@ -1,50 +1,50 @@ -package de.butzlabben.world.event; - -import org.bukkit.command.CommandSender; -import org.bukkit.event.HandlerList; - -import de.butzlabben.world.wrapper.SystemWorld; - -/** - * Event when a world gets reset - * - * @author Butzlabben - * @since 09.05.2018 - */ -public class WorldResetEvent extends WorldEvent { - - private final SystemWorld world; - private final CommandSender executor; - - public WorldResetEvent(CommandSender executor, SystemWorld world) { - this.executor = executor; - this.world = world; - } - - /** - * @return world which gets reset - */ - public SystemWorld getWorld() { - return world; - } - - /** - * @return Executor of the command - */ - public CommandSender getExecutor() { - return executor; - } - - - - public final static HandlerList handlers = new HandlerList(); - - public final static HandlerList getHandlerList() { - return handlers; - } - - @Override - public final HandlerList getHandlers() { - return handlers; - } -} +package de.butzlabben.world.event; + +import org.bukkit.command.CommandSender; +import org.bukkit.event.HandlerList; + +import de.butzlabben.world.wrapper.SystemWorld; + +/** + * Event when a world gets reset + * + * @author Butzlabben + * @since 09.05.2018 + */ +public class WorldResetEvent extends WorldEvent { + + private final SystemWorld world; + private final CommandSender executor; + + public WorldResetEvent(CommandSender executor, SystemWorld world) { + this.executor = executor; + this.world = world; + } + + /** + * @return world which gets reset + */ + public SystemWorld getWorld() { + return world; + } + + /** + * @return Executor of the command + */ + public CommandSender getExecutor() { + return executor; + } + + + + public final static HandlerList handlers = new HandlerList(); + + public final static HandlerList getHandlerList() { + return handlers; + } + + @Override + public final HandlerList getHandlers() { + return handlers; + } +} diff --git a/WorldSystem/src/main/java/de/butzlabben/world/event/WorldToggleFireEvent.java b/src/main/java/de/butzlabben/world/event/WorldToggleFireEvent.java similarity index 94% rename from WorldSystem/src/main/java/de/butzlabben/world/event/WorldToggleFireEvent.java rename to src/main/java/de/butzlabben/world/event/WorldToggleFireEvent.java index 86358fd..eae07bf 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/event/WorldToggleFireEvent.java +++ b/src/main/java/de/butzlabben/world/event/WorldToggleFireEvent.java @@ -1,64 +1,64 @@ -package de.butzlabben.world.event; - -import org.bukkit.command.CommandSender; -import org.bukkit.event.HandlerList; - -import de.butzlabben.world.wrapper.SystemWorld; - -/** - * @author Butzlabben - * @since 09.05.2018 - */ -public class WorldToggleFireEvent extends WorldEvent { - - private final SystemWorld world; - private final CommandSender executor; - private boolean value; - - public WorldToggleFireEvent(CommandSender executor, SystemWorld world, boolean value) { - this.executor = executor; - this.world = world; - this.value = value; - } - - /** - * @return if fire now gets enabled or disabled - */ - public boolean getValue() { - return value; - } - - /** - * @param val if fire should be enabled or disabled - */ - public void setValue(boolean val) { - value = val; - } - - /** - * @return world get world - */ - public SystemWorld getWorld() { - return world; - } - - /** - * @return get executor who toggles fire - */ - public CommandSender getExecutor() { - return executor; - } - - - - public final static HandlerList handlers = new HandlerList(); - - public final static HandlerList getHandlerList() { - return handlers; - } - - @Override - public final HandlerList getHandlers() { - return handlers; - } -} +package de.butzlabben.world.event; + +import org.bukkit.command.CommandSender; +import org.bukkit.event.HandlerList; + +import de.butzlabben.world.wrapper.SystemWorld; + +/** + * @author Butzlabben + * @since 09.05.2018 + */ +public class WorldToggleFireEvent extends WorldEvent { + + private final SystemWorld world; + private final CommandSender executor; + private boolean value; + + public WorldToggleFireEvent(CommandSender executor, SystemWorld world, boolean value) { + this.executor = executor; + this.world = world; + this.value = value; + } + + /** + * @return if fire now gets enabled or disabled + */ + public boolean getValue() { + return value; + } + + /** + * @param val if fire should be enabled or disabled + */ + public void setValue(boolean val) { + value = val; + } + + /** + * @return world get world + */ + public SystemWorld getWorld() { + return world; + } + + /** + * @return get executor who toggles fire + */ + public CommandSender getExecutor() { + return executor; + } + + + + public final static HandlerList handlers = new HandlerList(); + + public final static HandlerList getHandlerList() { + return handlers; + } + + @Override + public final HandlerList getHandlers() { + return handlers; + } +} diff --git a/WorldSystem/src/main/java/de/butzlabben/world/event/WorldToggleTntEvent.java b/src/main/java/de/butzlabben/world/event/WorldToggleTntEvent.java similarity index 94% rename from WorldSystem/src/main/java/de/butzlabben/world/event/WorldToggleTntEvent.java rename to src/main/java/de/butzlabben/world/event/WorldToggleTntEvent.java index 96709e5..1ebddf8 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/event/WorldToggleTntEvent.java +++ b/src/main/java/de/butzlabben/world/event/WorldToggleTntEvent.java @@ -1,64 +1,64 @@ -package de.butzlabben.world.event; - -import org.bukkit.command.CommandSender; -import org.bukkit.event.HandlerList; - -import de.butzlabben.world.wrapper.SystemWorld; - -/** - * @author Butzlabben - * @since 09.05.2018 - */ -public class WorldToggleTntEvent extends WorldEvent { - - private final SystemWorld world; - private final CommandSender executor; - private boolean value; - - public WorldToggleTntEvent(CommandSender executor, SystemWorld world, boolean value) { - this.executor = executor; - this.world = world; - this.value = value; - } - - /** - * @return if tnt now gets enabled or disabled - */ - public boolean getValue() { - return value; - } - - /** - * @param val if tnt should be enabled or disabled - */ - public void setValue(boolean val) { - value = val; - } - - /** - * @return world get world - */ - public SystemWorld getWorld() { - return world; - } - - /** - * @return get executor who toggles tnt - */ - public CommandSender getExecutor() { - return executor; - } - - - public final static HandlerList handlers = new HandlerList(); - - public final static HandlerList getHandlerList() { - return handlers; - } - - @Override - public final HandlerList getHandlers() { - return handlers; - } - -} +package de.butzlabben.world.event; + +import org.bukkit.command.CommandSender; +import org.bukkit.event.HandlerList; + +import de.butzlabben.world.wrapper.SystemWorld; + +/** + * @author Butzlabben + * @since 09.05.2018 + */ +public class WorldToggleTntEvent extends WorldEvent { + + private final SystemWorld world; + private final CommandSender executor; + private boolean value; + + public WorldToggleTntEvent(CommandSender executor, SystemWorld world, boolean value) { + this.executor = executor; + this.world = world; + this.value = value; + } + + /** + * @return if tnt now gets enabled or disabled + */ + public boolean getValue() { + return value; + } + + /** + * @param val if tnt should be enabled or disabled + */ + public void setValue(boolean val) { + value = val; + } + + /** + * @return world get world + */ + public SystemWorld getWorld() { + return world; + } + + /** + * @return get executor who toggles tnt + */ + public CommandSender getExecutor() { + return executor; + } + + + public final static HandlerList handlers = new HandlerList(); + + public final static HandlerList getHandlerList() { + return handlers; + } + + @Override + public final HandlerList getHandlers() { + return handlers; + } + +} diff --git a/WorldSystem/src/main/java/de/butzlabben/world/event/WorldUnloadEvent.java b/src/main/java/de/butzlabben/world/event/WorldUnloadEvent.java similarity index 94% rename from WorldSystem/src/main/java/de/butzlabben/world/event/WorldUnloadEvent.java rename to src/main/java/de/butzlabben/world/event/WorldUnloadEvent.java index e8399f7..c8ea26e 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/event/WorldUnloadEvent.java +++ b/src/main/java/de/butzlabben/world/event/WorldUnloadEvent.java @@ -1,37 +1,37 @@ -package de.butzlabben.world.event; - -import org.bukkit.event.HandlerList; - -import de.butzlabben.world.wrapper.SystemWorld; - -/** - * @author Butzlabben - * @since 09.05.2018 - */ -public class WorldUnloadEvent extends WorldEvent { - - private final SystemWorld world; - - public WorldUnloadEvent(SystemWorld world) { - this.world = world; - } - - /** - * @return world which gets unloaded - */ - public SystemWorld getWorld() { - return world; - } - - public final static HandlerList handlers = new HandlerList(); - - public final static HandlerList getHandlerList() { - return handlers; - } - - @Override - public final HandlerList getHandlers() { - return handlers; - } - -} +package de.butzlabben.world.event; + +import org.bukkit.event.HandlerList; + +import de.butzlabben.world.wrapper.SystemWorld; + +/** + * @author Butzlabben + * @since 09.05.2018 + */ +public class WorldUnloadEvent extends WorldEvent { + + private final SystemWorld world; + + public WorldUnloadEvent(SystemWorld world) { + this.world = world; + } + + /** + * @return world which gets unloaded + */ + public SystemWorld getWorld() { + return world; + } + + public final static HandlerList handlers = new HandlerList(); + + public final static HandlerList getHandlerList() { + return handlers; + } + + @Override + public final HandlerList getHandlers() { + return handlers; + } + +} diff --git a/WorldSystem/src/main/java/de/butzlabben/world/gui/GuiCommand.java b/src/main/java/de/butzlabben/world/gui/GuiCommand.java similarity index 96% rename from WorldSystem/src/main/java/de/butzlabben/world/gui/GuiCommand.java rename to src/main/java/de/butzlabben/world/gui/GuiCommand.java index 6c2f194..6de1272 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/gui/GuiCommand.java +++ b/src/main/java/de/butzlabben/world/gui/GuiCommand.java @@ -1,32 +1,32 @@ -package de.butzlabben.world.gui; - -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import de.butzlabben.world.config.MessageConfig; -import de.butzlabben.world.wrapper.WorldPlayer; - -public class GuiCommand implements CommandExecutor { - - @Override - public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - if (sender instanceof Player == false) { - sender.sendMessage("You are not a player"); - return true; - } - WorldPlayer wp = new WorldPlayer((Player) sender); - if (!wp.isOnSystemWorld()) { - sender.sendMessage(MessageConfig.getNotOnWorld()); - return true; - } - if (!wp.isOwnerofWorld()) { - sender.sendMessage(MessageConfig.getNoPermission()); - return true; - } - ((Player) sender).openInventory(new WorldSystemGUI().getInventory((Player) sender)); - return true; - } - -} +package de.butzlabben.world.gui; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import de.butzlabben.world.config.MessageConfig; +import de.butzlabben.world.wrapper.WorldPlayer; + +public class GuiCommand implements CommandExecutor { + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (sender instanceof Player == false) { + sender.sendMessage("You are not a player"); + return true; + } + WorldPlayer wp = new WorldPlayer((Player) sender); + if (!wp.isOnSystemWorld()) { + sender.sendMessage(MessageConfig.getNotOnWorld()); + return true; + } + if (!wp.isOwnerofWorld()) { + sender.sendMessage(MessageConfig.getNoPermission()); + return true; + } + ((Player) sender).openInventory(new WorldSystemGUI().getInventory((Player) sender)); + return true; + } + +} diff --git a/WorldSystem/src/main/java/de/butzlabben/world/gui/PlayerOptionsGUI.java b/src/main/java/de/butzlabben/world/gui/PlayerOptionsGUI.java similarity index 100% rename from WorldSystem/src/main/java/de/butzlabben/world/gui/PlayerOptionsGUI.java rename to src/main/java/de/butzlabben/world/gui/PlayerOptionsGUI.java diff --git a/WorldSystem/src/main/java/de/butzlabben/world/gui/PlayersPageGUI.java b/src/main/java/de/butzlabben/world/gui/PlayersPageGUI.java similarity index 97% rename from WorldSystem/src/main/java/de/butzlabben/world/gui/PlayersPageGUI.java rename to src/main/java/de/butzlabben/world/gui/PlayersPageGUI.java index dc07455..fa066dc 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/gui/PlayersPageGUI.java +++ b/src/main/java/de/butzlabben/world/gui/PlayersPageGUI.java @@ -1,91 +1,91 @@ -package de.butzlabben.world.gui; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map.Entry; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.SkullMeta; -import de.butzlabben.inventory.OrcItem; -import de.butzlabben.inventory.pages.PageGUICreator; -import de.butzlabben.world.config.GuiConfig; -import de.butzlabben.world.config.MessageConfig; -import de.butzlabben.world.config.WorldConfig; - -/** - * @author Butzlabben - * @since 20.04.2018 - */ -public class PlayersPageGUI { - - @SuppressWarnings("deprecation") - public static void openGUI(Player p) { - WorldConfig config = WorldConfig.getWorldConfig(p.getWorld().getName()); - - HashMap members = config.getMembersWithNames(); - - if (members.size() == 0) { - p.sendMessage(MessageConfig.getNoMemberAdded()); - return; - } - - PageGUICreator> creator = new PageGUICreator<>(GuiConfig.getRows("options.players")); - - creator.create(GuiConfig.getTitle(GuiConfig.getConfig(), "options.players"), members.entrySet(), (entry) -> { - String name = entry.getValue(); - OrcItem oi = new OrcItem(GuiConfig.getSkullItem(), GuiConfig - .getDisplay(GuiConfig.getConfig(), "options.players.playerhead").replaceAll("%player", name)); - SkullMeta sm = (SkullMeta) oi.getItemStack().getItemMeta(); - sm.setOwner(name); - oi.getItemStack().setItemMeta(sm); - oi.setOnClick((player, inv, item) -> { - player.closeInventory(); - PlayerOptionsGUI gui = new PlayerOptionsGUI(player, name, entry.getKey()); - player.openInventory(gui.getInventory(p)); - }); - return oi; - }); - - if (GuiConfig.isEnabled("options.players.back")) { - OrcItem back = OrcItem.back.clone(); - back.setOnClick((player, inv, i) -> { - player.closeInventory(); - player.openInventory(new WorldSystemGUI().getInventory(p)); - }); - creator.getInvPages().forEach((oi) -> {oi.addItem(GuiConfig.getSlot("options.players.back"), back);}); - } - - creator.show(p); - } - - @SuppressWarnings("deprecation") - public static void preloadPlayers(WorldConfig config) { - new Thread(() -> { - int headsPerInv = GuiConfig.getRows("options.players") * 9; - HashMap members = config.getMembersWithNames(); - if (members == null || members.size() == 0) - return; - int pages = Math.round(members.size() / headsPerInv) < 1 ? 1 : Math.round(members.size() / headsPerInv); - for (int page = 0; page < pages; page++) { - int startPos = pages == 1 ? 0 : headsPerInv * (page - 1); - int length = pages == 1 ? members.size() : headsPerInv; - - ArrayList list = new ArrayList<>(members.keySet()); - - Inventory inv = Bukkit.createInventory(null, headsPerInv); - for (int i = startPos; i < startPos + length; i++) { - String name = members.get(list.get(i)); - ItemStack is = new ItemStack(GuiConfig.getSkullItem(), 1, (short) 3); - SkullMeta sm = (SkullMeta) is.getItemMeta(); - sm.setOwner(name); - is.setItemMeta(sm); - inv.addItem(is); - } - } - }).start(); - } -} +package de.butzlabben.world.gui; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map.Entry; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.SkullMeta; +import de.butzlabben.inventory.OrcItem; +import de.butzlabben.inventory.pages.PageGUICreator; +import de.butzlabben.world.config.GuiConfig; +import de.butzlabben.world.config.MessageConfig; +import de.butzlabben.world.config.WorldConfig; + +/** + * @author Butzlabben + * @since 20.04.2018 + */ +public class PlayersPageGUI { + + @SuppressWarnings("deprecation") + public static void openGUI(Player p) { + WorldConfig config = WorldConfig.getWorldConfig(p.getWorld().getName()); + + HashMap members = config.getMembersWithNames(); + + if (members.size() == 0) { + p.sendMessage(MessageConfig.getNoMemberAdded()); + return; + } + + PageGUICreator> creator = new PageGUICreator<>(GuiConfig.getRows("options.players")); + + creator.create(GuiConfig.getTitle(GuiConfig.getConfig(), "options.players"), members.entrySet(), (entry) -> { + String name = entry.getValue(); + OrcItem oi = new OrcItem(GuiConfig.getSkullItem(), GuiConfig + .getDisplay(GuiConfig.getConfig(), "options.players.playerhead").replaceAll("%player", name)); + SkullMeta sm = (SkullMeta) oi.getItemStack().getItemMeta(); + sm.setOwner(name); + oi.getItemStack().setItemMeta(sm); + oi.setOnClick((player, inv, item) -> { + player.closeInventory(); + PlayerOptionsGUI gui = new PlayerOptionsGUI(player, name, entry.getKey()); + player.openInventory(gui.getInventory(p)); + }); + return oi; + }); + + if (GuiConfig.isEnabled("options.players.back")) { + OrcItem back = OrcItem.back.clone(); + back.setOnClick((player, inv, i) -> { + player.closeInventory(); + player.openInventory(new WorldSystemGUI().getInventory(p)); + }); + creator.getInvPages().forEach((oi) -> {oi.addItem(GuiConfig.getSlot("options.players.back"), back);}); + } + + creator.show(p); + } + + @SuppressWarnings("deprecation") + public static void preloadPlayers(WorldConfig config) { + new Thread(() -> { + int headsPerInv = GuiConfig.getRows("options.players") * 9; + HashMap members = config.getMembersWithNames(); + if (members == null || members.size() == 0) + return; + int pages = Math.round(members.size() / headsPerInv) < 1 ? 1 : Math.round(members.size() / headsPerInv); + for (int page = 0; page < pages; page++) { + int startPos = pages == 1 ? 0 : headsPerInv * (page - 1); + int length = pages == 1 ? members.size() : headsPerInv; + + ArrayList list = new ArrayList<>(members.keySet()); + + Inventory inv = Bukkit.createInventory(null, headsPerInv); + for (int i = startPos; i < startPos + length; i++) { + String name = members.get(list.get(i)); + ItemStack is = new ItemStack(GuiConfig.getSkullItem(), 1, (short) 3); + SkullMeta sm = (SkullMeta) is.getItemMeta(); + sm.setOwner(name); + is.setItemMeta(sm); + inv.addItem(is); + } + } + }).start(); + } +} diff --git a/WorldSystem/src/main/java/de/butzlabben/world/gui/WorldChooseGUI.java b/src/main/java/de/butzlabben/world/gui/WorldChooseGUI.java similarity index 96% rename from WorldSystem/src/main/java/de/butzlabben/world/gui/WorldChooseGUI.java rename to src/main/java/de/butzlabben/world/gui/WorldChooseGUI.java index 6536b8e..9ed3f0f 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/gui/WorldChooseGUI.java +++ b/src/main/java/de/butzlabben/world/gui/WorldChooseGUI.java @@ -1,70 +1,70 @@ -package de.butzlabben.world.gui; - -import java.util.function.Consumer; - -import org.bukkit.entity.Player; -import de.butzlabben.inventory.OrcClickListener; -import de.butzlabben.inventory.OrcInventory; -import de.butzlabben.inventory.OrcItem; -import de.butzlabben.world.config.GuiConfig; -import de.butzlabben.world.wrapper.WorldTemplate; -import de.butzlabben.world.wrapper.WorldTemplateProvider; - -/** - * @author Butzlabben - * @since 15.12.2018 - */ -public class WorldChooseGUI extends OrcInventory { - - private final static String path = "worldchoose."; - - public WorldChooseGUI() { - this(null); - } - - public WorldChooseGUI(Consumer onClick) { - super(GuiConfig.getTitle(GuiConfig.getConfig(), "worldchoose"), GuiConfig.getRows("worldchoose"), - GuiConfig.isFill("worldchoose")); - - for (WorldTemplate template : WorldTemplateProvider.getInstace().getTemplates()) { - OrcItem icon = template.getIcon(); - if(onClick != null) - icon.setOnClick((p, inv, item) -> { - p.closeInventory(); - onClick.accept(template); - }); - int slot = template.getSlot(); - addItem(slot, icon); - } - - if (GuiConfig.isEnabled(path + "back")) { - OrcItem back = OrcItem.back.clone(); - back.setOnClick((p, inv, item) -> { - p.closeInventory(); - }); - addItem(GuiConfig.getSlot(path + "back"), back); - } - } - - public static void letChoose(Player player, Consumer template) { - player.openInventory(new WorldChooseGUI(template).getInventory(player)); - } - - public void loadItem(String subpath, OrcClickListener listener) { - if (GuiConfig.isEnabled(path + subpath) == false) - return; - OrcItem item = GuiConfig.getItem(path + subpath); - if (item != null) { - item.setOnClick(listener); - addItem(GuiConfig.getSlot(path + subpath), item); - } - } - - public void loadItem(String subpath) { - loadItem(subpath, null); - } - - public boolean canOpen(Player p) { - return true; - } +package de.butzlabben.world.gui; + +import java.util.function.Consumer; + +import org.bukkit.entity.Player; +import de.butzlabben.inventory.OrcClickListener; +import de.butzlabben.inventory.OrcInventory; +import de.butzlabben.inventory.OrcItem; +import de.butzlabben.world.config.GuiConfig; +import de.butzlabben.world.wrapper.WorldTemplate; +import de.butzlabben.world.wrapper.WorldTemplateProvider; + +/** + * @author Butzlabben + * @since 15.12.2018 + */ +public class WorldChooseGUI extends OrcInventory { + + private final static String path = "worldchoose."; + + public WorldChooseGUI() { + this(null); + } + + public WorldChooseGUI(Consumer onClick) { + super(GuiConfig.getTitle(GuiConfig.getConfig(), "worldchoose"), GuiConfig.getRows("worldchoose"), + GuiConfig.isFill("worldchoose")); + + for (WorldTemplate template : WorldTemplateProvider.getInstace().getTemplates()) { + OrcItem icon = template.getIcon(); + if(onClick != null) + icon.setOnClick((p, inv, item) -> { + p.closeInventory(); + onClick.accept(template); + }); + int slot = template.getSlot(); + addItem(slot, icon); + } + + if (GuiConfig.isEnabled(path + "back")) { + OrcItem back = OrcItem.back.clone(); + back.setOnClick((p, inv, item) -> { + p.closeInventory(); + }); + addItem(GuiConfig.getSlot(path + "back"), back); + } + } + + public static void letChoose(Player player, Consumer template) { + player.openInventory(new WorldChooseGUI(template).getInventory(player)); + } + + public void loadItem(String subpath, OrcClickListener listener) { + if (GuiConfig.isEnabled(path + subpath) == false) + return; + OrcItem item = GuiConfig.getItem(path + subpath); + if (item != null) { + item.setOnClick(listener); + addItem(GuiConfig.getSlot(path + subpath), item); + } + } + + public void loadItem(String subpath) { + loadItem(subpath, null); + } + + public boolean canOpen(Player p) { + return true; + } } \ No newline at end of file diff --git a/WorldSystem/src/main/java/de/butzlabben/world/gui/WorldOptionsGUI.java b/src/main/java/de/butzlabben/world/gui/WorldOptionsGUI.java similarity index 96% rename from WorldSystem/src/main/java/de/butzlabben/world/gui/WorldOptionsGUI.java rename to src/main/java/de/butzlabben/world/gui/WorldOptionsGUI.java index 8dd9849..a2f350f 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/gui/WorldOptionsGUI.java +++ b/src/main/java/de/butzlabben/world/gui/WorldOptionsGUI.java @@ -1,100 +1,100 @@ -package de.butzlabben.world.gui; - -import java.util.HashMap; -import java.util.UUID; - -import org.bukkit.entity.Player; -import org.bukkit.inventory.Inventory; - -import de.butzlabben.inventory.DependListener; -import de.butzlabben.inventory.OrcInventory; -import de.butzlabben.inventory.OrcItem; -import de.butzlabben.world.config.GuiConfig; -import de.butzlabben.world.gui.clicklistener.ComingSoonClickListener; -import de.butzlabben.world.gui.clicklistener.CommandExecutorClickListener; -import de.butzlabben.world.gui.worldoption.FireStatus; -import de.butzlabben.world.gui.worldoption.TntStatus; -import de.butzlabben.world.wrapper.WorldPlayer; - -public class WorldOptionsGUI extends OrcInventory { - - private final static String path = "options.world."; - - public final static HashMap data = new HashMap<>(); - - public WorldOptionsGUI() { - super(GuiConfig.getTitle(GuiConfig.getConfig(), "options.world"), GuiConfig.getRows("options.world"), GuiConfig.isFill("options.world")); - - loadItem("fire", "/ws fire", true, new FireStatus()); - loadItem("tnt", "/ws tnt", true, new TntStatus()); - - if (GuiConfig.isEnabled(path + "reset") == false) - return; - - OrcItem item = GuiConfig.getItem(path + "reset"); - if (item != null) { - item.setOnClick((p, inv, i) -> { - p.closeInventory(); - p.chat("/ws reset"); - }); - addItem(GuiConfig.getSlot(path + "reset"), item); - } - - if (GuiConfig.isEnabled(path + "back")) { - OrcItem back = OrcItem.back.clone(); - back.setOnClick((p, inv, i) -> { - p.closeInventory(); - p.openInventory(new WorldSystemGUI().getInventory(p)); - }); - addItem(GuiConfig.getSlot(path + "back"), back); - } - } - - public void loadItem(String subpath, String message, boolean state, DependListener depend) { - if (GuiConfig.isEnabled(path + subpath) == false) - return; - OrcItem item = GuiConfig.getItem(path + subpath); - if (item != null) { - if (message == null) { - item.setOnClick(new ComingSoonClickListener()); - } else { - item.setOnClick(new CommandExecutorClickListener(message)); - } - if (state) { - if (depend == null) { - addItem(GuiConfig.getState(path + subpath), OrcItem.coming_soon.clone()); - } else { - addItem(GuiConfig.getState(path + subpath), OrcItem.disabled.clone().setDepend(depend)); - } - } - addItem(GuiConfig.getSlot(path + subpath), item); - } - } - - public void loadItem(String subpath, String message, boolean state) { - loadItem(subpath, message, state, null); - } - - public void loadItem(String subpath, boolean state) { - loadItem(subpath, null, state); - } - - @Override - public Inventory getInventory(Player p, String title) { - if (data.containsKey(p.getUniqueId())) - return super.getInventory(p, title.replaceAll("%data", data.get(p.getUniqueId()))); - return super.getInventory(p, title); - } - - @Override - public Inventory getInventory(Player p) { - if (data.containsKey(p.getUniqueId())) - return super.getInventory(p, getTitle().replaceAll("%data", data.get(p.getUniqueId()))); - return super.getInventory(p, getTitle()); - } - - public boolean canOpen(Player p) { - return new WorldPlayer(p).isOwnerofWorld(); - } - -} +package de.butzlabben.world.gui; + +import java.util.HashMap; +import java.util.UUID; + +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; + +import de.butzlabben.inventory.DependListener; +import de.butzlabben.inventory.OrcInventory; +import de.butzlabben.inventory.OrcItem; +import de.butzlabben.world.config.GuiConfig; +import de.butzlabben.world.gui.clicklistener.ComingSoonClickListener; +import de.butzlabben.world.gui.clicklistener.CommandExecutorClickListener; +import de.butzlabben.world.gui.worldoption.FireStatus; +import de.butzlabben.world.gui.worldoption.TntStatus; +import de.butzlabben.world.wrapper.WorldPlayer; + +public class WorldOptionsGUI extends OrcInventory { + + private final static String path = "options.world."; + + public final static HashMap data = new HashMap<>(); + + public WorldOptionsGUI() { + super(GuiConfig.getTitle(GuiConfig.getConfig(), "options.world"), GuiConfig.getRows("options.world"), GuiConfig.isFill("options.world")); + + loadItem("fire", "/ws fire", true, new FireStatus()); + loadItem("tnt", "/ws tnt", true, new TntStatus()); + + if (GuiConfig.isEnabled(path + "reset") == false) + return; + + OrcItem item = GuiConfig.getItem(path + "reset"); + if (item != null) { + item.setOnClick((p, inv, i) -> { + p.closeInventory(); + p.chat("/ws reset"); + }); + addItem(GuiConfig.getSlot(path + "reset"), item); + } + + if (GuiConfig.isEnabled(path + "back")) { + OrcItem back = OrcItem.back.clone(); + back.setOnClick((p, inv, i) -> { + p.closeInventory(); + p.openInventory(new WorldSystemGUI().getInventory(p)); + }); + addItem(GuiConfig.getSlot(path + "back"), back); + } + } + + public void loadItem(String subpath, String message, boolean state, DependListener depend) { + if (GuiConfig.isEnabled(path + subpath) == false) + return; + OrcItem item = GuiConfig.getItem(path + subpath); + if (item != null) { + if (message == null) { + item.setOnClick(new ComingSoonClickListener()); + } else { + item.setOnClick(new CommandExecutorClickListener(message)); + } + if (state) { + if (depend == null) { + addItem(GuiConfig.getState(path + subpath), OrcItem.coming_soon.clone()); + } else { + addItem(GuiConfig.getState(path + subpath), OrcItem.disabled.clone().setDepend(depend)); + } + } + addItem(GuiConfig.getSlot(path + subpath), item); + } + } + + public void loadItem(String subpath, String message, boolean state) { + loadItem(subpath, message, state, null); + } + + public void loadItem(String subpath, boolean state) { + loadItem(subpath, null, state); + } + + @Override + public Inventory getInventory(Player p, String title) { + if (data.containsKey(p.getUniqueId())) + return super.getInventory(p, title.replaceAll("%data", data.get(p.getUniqueId()))); + return super.getInventory(p, title); + } + + @Override + public Inventory getInventory(Player p) { + if (data.containsKey(p.getUniqueId())) + return super.getInventory(p, getTitle().replaceAll("%data", data.get(p.getUniqueId()))); + return super.getInventory(p, getTitle()); + } + + public boolean canOpen(Player p) { + return new WorldPlayer(p).isOwnerofWorld(); + } + +} diff --git a/WorldSystem/src/main/java/de/butzlabben/world/gui/WorldSystemGUI.java b/src/main/java/de/butzlabben/world/gui/WorldSystemGUI.java similarity index 96% rename from WorldSystem/src/main/java/de/butzlabben/world/gui/WorldSystemGUI.java rename to src/main/java/de/butzlabben/world/gui/WorldSystemGUI.java index 3549c60..b4de290 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/gui/WorldSystemGUI.java +++ b/src/main/java/de/butzlabben/world/gui/WorldSystemGUI.java @@ -1,60 +1,60 @@ -package de.butzlabben.world.gui; - -import org.bukkit.entity.Player; -import org.bukkit.inventory.Inventory; - -import de.butzlabben.inventory.OrcClickListener; -import de.butzlabben.inventory.OrcInventory; -import de.butzlabben.inventory.OrcItem; -import de.butzlabben.world.config.GuiConfig; -import de.butzlabben.world.config.WorldConfig; -import de.butzlabben.world.gui.clicklistener.InventoryOpenClickListener; - -public class WorldSystemGUI extends OrcInventory { - - private final static String path = "worldsystem."; - - public WorldSystemGUI() { - - super(GuiConfig.getTitle(GuiConfig.getConfig(), "worldsystem"), GuiConfig.getRows("worldsystem"), GuiConfig.isFill("worldsystem")); - - loadItem("playeroptions", (p, inv, item) -> { - p.closeInventory(); - PlayersPageGUI.openGUI(p); - }); - - loadItem("worldoptions", new InventoryOpenClickListener(new WorldOptionsGUI())); - - if (GuiConfig.isEnabled(path + "back")) { - OrcItem back = OrcItem.back.clone(); - back.setOnClick((p, inv, item) -> { - p.closeInventory(); - }); - addItem(GuiConfig.getSlot(path + "back"), back); - } - } - - @Override - public Inventory getInventory(Player player) { - PlayersPageGUI.preloadPlayers(WorldConfig.getWorldConfig(player.getWorld().getName())); - return super.getInventory(player); - } - - public void loadItem(String subpath, OrcClickListener listener) { - if (GuiConfig.isEnabled(path + subpath) == false) - return; - OrcItem item = GuiConfig.getItem(path + subpath); - if (item != null) { - item.setOnClick(listener); - addItem(GuiConfig.getSlot(path + subpath), item); - } - } - - public void loadItem(String subpath) { - loadItem(subpath, null); - } - - public boolean canOpen(Player p) { - return true; - } +package de.butzlabben.world.gui; + +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; + +import de.butzlabben.inventory.OrcClickListener; +import de.butzlabben.inventory.OrcInventory; +import de.butzlabben.inventory.OrcItem; +import de.butzlabben.world.config.GuiConfig; +import de.butzlabben.world.config.WorldConfig; +import de.butzlabben.world.gui.clicklistener.InventoryOpenClickListener; + +public class WorldSystemGUI extends OrcInventory { + + private final static String path = "worldsystem."; + + public WorldSystemGUI() { + + super(GuiConfig.getTitle(GuiConfig.getConfig(), "worldsystem"), GuiConfig.getRows("worldsystem"), GuiConfig.isFill("worldsystem")); + + loadItem("playeroptions", (p, inv, item) -> { + p.closeInventory(); + PlayersPageGUI.openGUI(p); + }); + + loadItem("worldoptions", new InventoryOpenClickListener(new WorldOptionsGUI())); + + if (GuiConfig.isEnabled(path + "back")) { + OrcItem back = OrcItem.back.clone(); + back.setOnClick((p, inv, item) -> { + p.closeInventory(); + }); + addItem(GuiConfig.getSlot(path + "back"), back); + } + } + + @Override + public Inventory getInventory(Player player) { + PlayersPageGUI.preloadPlayers(WorldConfig.getWorldConfig(player.getWorld().getName())); + return super.getInventory(player); + } + + public void loadItem(String subpath, OrcClickListener listener) { + if (GuiConfig.isEnabled(path + subpath) == false) + return; + OrcItem item = GuiConfig.getItem(path + subpath); + if (item != null) { + item.setOnClick(listener); + addItem(GuiConfig.getSlot(path + subpath), item); + } + } + + public void loadItem(String subpath) { + loadItem(subpath, null); + } + + public boolean canOpen(Player p) { + return true; + } } \ No newline at end of file diff --git a/WorldSystem/src/main/java/de/butzlabben/world/gui/clicklistener/ComingSoonClickListener.java b/src/main/java/de/butzlabben/world/gui/clicklistener/ComingSoonClickListener.java similarity index 96% rename from WorldSystem/src/main/java/de/butzlabben/world/gui/clicklistener/ComingSoonClickListener.java rename to src/main/java/de/butzlabben/world/gui/clicklistener/ComingSoonClickListener.java index 95891bf..8ae866c 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/gui/clicklistener/ComingSoonClickListener.java +++ b/src/main/java/de/butzlabben/world/gui/clicklistener/ComingSoonClickListener.java @@ -1,17 +1,17 @@ -package de.butzlabben.world.gui.clicklistener; - -import org.bukkit.entity.Player; - -import de.butzlabben.inventory.OrcClickListener; -import de.butzlabben.inventory.OrcInventory; -import de.butzlabben.inventory.OrcItem; - -public class ComingSoonClickListener implements OrcClickListener { - - @Override - public void onClick(Player p, OrcInventory inv, OrcItem item) { - p.closeInventory(); - p.sendMessage("cComing soon..."); - } - -} +package de.butzlabben.world.gui.clicklistener; + +import org.bukkit.entity.Player; + +import de.butzlabben.inventory.OrcClickListener; +import de.butzlabben.inventory.OrcInventory; +import de.butzlabben.inventory.OrcItem; + +public class ComingSoonClickListener implements OrcClickListener { + + @Override + public void onClick(Player p, OrcInventory inv, OrcItem item) { + p.closeInventory(); + p.sendMessage("cComing soon..."); + } + +} diff --git a/WorldSystem/src/main/java/de/butzlabben/world/gui/clicklistener/CommandExecutorClickListener.java b/src/main/java/de/butzlabben/world/gui/clicklistener/CommandExecutorClickListener.java similarity index 95% rename from WorldSystem/src/main/java/de/butzlabben/world/gui/clicklistener/CommandExecutorClickListener.java rename to src/main/java/de/butzlabben/world/gui/clicklistener/CommandExecutorClickListener.java index ed0041e..066910e 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/gui/clicklistener/CommandExecutorClickListener.java +++ b/src/main/java/de/butzlabben/world/gui/clicklistener/CommandExecutorClickListener.java @@ -1,25 +1,25 @@ -package de.butzlabben.world.gui.clicklistener; - -import org.bukkit.entity.Player; - -import de.butzlabben.inventory.OrcClickListener; -import de.butzlabben.inventory.OrcInventory; -import de.butzlabben.inventory.OrcItem; - -public class CommandExecutorClickListener implements OrcClickListener { - - private final String message; - - public CommandExecutorClickListener(String message) { - this.message = message; - } - - @Override - public void onClick(Player p, OrcInventory inv, OrcItem item) { - p.closeInventory(); - String msg = message; - p.chat(msg); - // Fix for #9 - inv.redraw(p); - } -} +package de.butzlabben.world.gui.clicklistener; + +import org.bukkit.entity.Player; + +import de.butzlabben.inventory.OrcClickListener; +import de.butzlabben.inventory.OrcInventory; +import de.butzlabben.inventory.OrcItem; + +public class CommandExecutorClickListener implements OrcClickListener { + + private final String message; + + public CommandExecutorClickListener(String message) { + this.message = message; + } + + @Override + public void onClick(Player p, OrcInventory inv, OrcItem item) { + p.closeInventory(); + String msg = message; + p.chat(msg); + // Fix for #9 + inv.redraw(p); + } +} diff --git a/WorldSystem/src/main/java/de/butzlabben/world/gui/clicklistener/InventoryOpenClickListener.java b/src/main/java/de/butzlabben/world/gui/clicklistener/InventoryOpenClickListener.java similarity index 95% rename from WorldSystem/src/main/java/de/butzlabben/world/gui/clicklistener/InventoryOpenClickListener.java rename to src/main/java/de/butzlabben/world/gui/clicklistener/InventoryOpenClickListener.java index afcd92e..857169a 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/gui/clicklistener/InventoryOpenClickListener.java +++ b/src/main/java/de/butzlabben/world/gui/clicklistener/InventoryOpenClickListener.java @@ -1,34 +1,34 @@ -package de.butzlabben.world.gui.clicklistener; - -import org.bukkit.entity.Player; -import org.bukkit.inventory.Inventory; - -import de.butzlabben.inventory.OrcClickListener; -import de.butzlabben.inventory.OrcInventory; -import de.butzlabben.inventory.OrcItem; -import de.butzlabben.world.config.MessageConfig; - -public class InventoryOpenClickListener implements OrcClickListener { - - private final OrcInventory open; - - public InventoryOpenClickListener(OrcInventory inv) { - open = inv; - } - - @Override - public void onClick(Player p, OrcInventory inv, OrcItem item) { - p.closeInventory(); - if (open == null) { - return; - } - Inventory to = open.getInventory(p); - if (to != null) { - p.openInventory(to); - } else { - p.closeInventory(); - p.sendMessage(MessageConfig.getNoPermission()); - } - } - -} +package de.butzlabben.world.gui.clicklistener; + +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; + +import de.butzlabben.inventory.OrcClickListener; +import de.butzlabben.inventory.OrcInventory; +import de.butzlabben.inventory.OrcItem; +import de.butzlabben.world.config.MessageConfig; + +public class InventoryOpenClickListener implements OrcClickListener { + + private final OrcInventory open; + + public InventoryOpenClickListener(OrcInventory inv) { + open = inv; + } + + @Override + public void onClick(Player p, OrcInventory inv, OrcItem item) { + p.closeInventory(); + if (open == null) { + return; + } + Inventory to = open.getInventory(p); + if (to != null) { + p.openInventory(to); + } else { + p.closeInventory(); + p.sendMessage(MessageConfig.getNoPermission()); + } + } + +} diff --git a/WorldSystem/src/main/java/de/butzlabben/world/gui/playeroption/BuildStatus.java b/src/main/java/de/butzlabben/world/gui/playeroption/BuildStatus.java similarity index 96% rename from WorldSystem/src/main/java/de/butzlabben/world/gui/playeroption/BuildStatus.java rename to src/main/java/de/butzlabben/world/gui/playeroption/BuildStatus.java index f6fe65d..4197ec9 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/gui/playeroption/BuildStatus.java +++ b/src/main/java/de/butzlabben/world/gui/playeroption/BuildStatus.java @@ -1,22 +1,22 @@ -package de.butzlabben.world.gui.playeroption; - -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -import de.butzlabben.inventory.DependListener; -import de.butzlabben.inventory.OrcItem; -import de.butzlabben.world.wrapper.WorldPlayer; - -public class BuildStatus implements DependListener { - - private final WorldPlayer wp; - - public BuildStatus(WorldPlayer wp) { - this.wp = wp; - } - - @Override - public ItemStack getItemStack(Player p, WorldPlayer player) { - return wp.canBuild() ? OrcItem.enabled.getItemStack(p, wp) : OrcItem.disabled.getItemStack(p, wp); - } -} +package de.butzlabben.world.gui.playeroption; + +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import de.butzlabben.inventory.DependListener; +import de.butzlabben.inventory.OrcItem; +import de.butzlabben.world.wrapper.WorldPlayer; + +public class BuildStatus implements DependListener { + + private final WorldPlayer wp; + + public BuildStatus(WorldPlayer wp) { + this.wp = wp; + } + + @Override + public ItemStack getItemStack(Player p, WorldPlayer player) { + return wp.canBuild() ? OrcItem.enabled.getItemStack(p, wp) : OrcItem.disabled.getItemStack(p, wp); + } +} diff --git a/WorldSystem/src/main/java/de/butzlabben/world/gui/playeroption/GamemodeStatus.java b/src/main/java/de/butzlabben/world/gui/playeroption/GamemodeStatus.java similarity index 96% rename from WorldSystem/src/main/java/de/butzlabben/world/gui/playeroption/GamemodeStatus.java rename to src/main/java/de/butzlabben/world/gui/playeroption/GamemodeStatus.java index 1b72cf1..824ba3b 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/gui/playeroption/GamemodeStatus.java +++ b/src/main/java/de/butzlabben/world/gui/playeroption/GamemodeStatus.java @@ -1,22 +1,22 @@ -package de.butzlabben.world.gui.playeroption; - -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -import de.butzlabben.inventory.DependListener; -import de.butzlabben.inventory.OrcItem; -import de.butzlabben.world.wrapper.WorldPlayer; - -public class GamemodeStatus implements DependListener { - - private final WorldPlayer wp; - - public GamemodeStatus(WorldPlayer wp) { - this.wp = wp; - } - - @Override - public ItemStack getItemStack(Player p, WorldPlayer player) { - return wp.canChangeGamemode() ? OrcItem.enabled.getItemStack(p, wp) : OrcItem.disabled.getItemStack(p, wp); - } +package de.butzlabben.world.gui.playeroption; + +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import de.butzlabben.inventory.DependListener; +import de.butzlabben.inventory.OrcItem; +import de.butzlabben.world.wrapper.WorldPlayer; + +public class GamemodeStatus implements DependListener { + + private final WorldPlayer wp; + + public GamemodeStatus(WorldPlayer wp) { + this.wp = wp; + } + + @Override + public ItemStack getItemStack(Player p, WorldPlayer player) { + return wp.canChangeGamemode() ? OrcItem.enabled.getItemStack(p, wp) : OrcItem.disabled.getItemStack(p, wp); + } } \ No newline at end of file diff --git a/WorldSystem/src/main/java/de/butzlabben/world/gui/playeroption/TeleportStatus.java b/src/main/java/de/butzlabben/world/gui/playeroption/TeleportStatus.java similarity index 96% rename from WorldSystem/src/main/java/de/butzlabben/world/gui/playeroption/TeleportStatus.java rename to src/main/java/de/butzlabben/world/gui/playeroption/TeleportStatus.java index e39aaaa..74ebe56 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/gui/playeroption/TeleportStatus.java +++ b/src/main/java/de/butzlabben/world/gui/playeroption/TeleportStatus.java @@ -1,22 +1,22 @@ -package de.butzlabben.world.gui.playeroption; - -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -import de.butzlabben.inventory.DependListener; -import de.butzlabben.inventory.OrcItem; -import de.butzlabben.world.wrapper.WorldPlayer; - -public class TeleportStatus implements DependListener { - - private final WorldPlayer wp; - - public TeleportStatus(WorldPlayer wp) { - this.wp = wp; - } - - @Override - public ItemStack getItemStack(Player p, WorldPlayer player) { - return wp.canTeleport() ? OrcItem.enabled.getItemStack(p, wp) : OrcItem.disabled.getItemStack(p, wp); - } +package de.butzlabben.world.gui.playeroption; + +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import de.butzlabben.inventory.DependListener; +import de.butzlabben.inventory.OrcItem; +import de.butzlabben.world.wrapper.WorldPlayer; + +public class TeleportStatus implements DependListener { + + private final WorldPlayer wp; + + public TeleportStatus(WorldPlayer wp) { + this.wp = wp; + } + + @Override + public ItemStack getItemStack(Player p, WorldPlayer player) { + return wp.canTeleport() ? OrcItem.enabled.getItemStack(p, wp) : OrcItem.disabled.getItemStack(p, wp); + } } \ No newline at end of file diff --git a/WorldSystem/src/main/java/de/butzlabben/world/gui/playeroption/WorldEditStatus.java b/src/main/java/de/butzlabben/world/gui/playeroption/WorldEditStatus.java similarity index 100% rename from WorldSystem/src/main/java/de/butzlabben/world/gui/playeroption/WorldEditStatus.java rename to src/main/java/de/butzlabben/world/gui/playeroption/WorldEditStatus.java diff --git a/WorldSystem/src/main/java/de/butzlabben/world/gui/worldoption/FireStatus.java b/src/main/java/de/butzlabben/world/gui/worldoption/FireStatus.java similarity index 96% rename from WorldSystem/src/main/java/de/butzlabben/world/gui/worldoption/FireStatus.java rename to src/main/java/de/butzlabben/world/gui/worldoption/FireStatus.java index 827182b..05a1c7f 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/gui/worldoption/FireStatus.java +++ b/src/main/java/de/butzlabben/world/gui/worldoption/FireStatus.java @@ -1,35 +1,35 @@ -package de.butzlabben.world.gui.worldoption; - -import java.io.File; - -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -import de.butzlabben.inventory.DependListener; -import de.butzlabben.inventory.OrcItem; -import de.butzlabben.world.config.DependenceConfig; -import de.butzlabben.world.config.PluginConfig; -import de.butzlabben.world.wrapper.WorldPlayer; - -public class FireStatus implements DependListener { - - @Override - public ItemStack getItemStack(Player p, WorldPlayer wp) { - String worldname = new DependenceConfig(p).getWorldname(); - File file = new File(worldname + "/worldconfig.yml"); - if (!file.exists()) - file = new File(PluginConfig.getWorlddir() + "/worldconfig.yml"); - if (!file.exists()) - return null; - YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file); - boolean b = cfg.getBoolean("Settings.Fire"); - if (b) - return OrcItem.enabled.getItemStack(p); - - return null; - // TODO wenn enabled, dann return OrcItem.enabled.getItemStack(p, wp); - // sonst return null - } - -} +package de.butzlabben.world.gui.worldoption; + +import java.io.File; + +import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import de.butzlabben.inventory.DependListener; +import de.butzlabben.inventory.OrcItem; +import de.butzlabben.world.config.DependenceConfig; +import de.butzlabben.world.config.PluginConfig; +import de.butzlabben.world.wrapper.WorldPlayer; + +public class FireStatus implements DependListener { + + @Override + public ItemStack getItemStack(Player p, WorldPlayer wp) { + String worldname = new DependenceConfig(p).getWorldname(); + File file = new File(worldname + "/worldconfig.yml"); + if (!file.exists()) + file = new File(PluginConfig.getWorlddir() + "/worldconfig.yml"); + if (!file.exists()) + return null; + YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file); + boolean b = cfg.getBoolean("Settings.Fire"); + if (b) + return OrcItem.enabled.getItemStack(p); + + return null; + // TODO wenn enabled, dann return OrcItem.enabled.getItemStack(p, wp); + // sonst return null + } + +} diff --git a/WorldSystem/src/main/java/de/butzlabben/world/gui/worldoption/TntStatus.java b/src/main/java/de/butzlabben/world/gui/worldoption/TntStatus.java similarity index 96% rename from WorldSystem/src/main/java/de/butzlabben/world/gui/worldoption/TntStatus.java rename to src/main/java/de/butzlabben/world/gui/worldoption/TntStatus.java index 1303bd0..d69ab81 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/gui/worldoption/TntStatus.java +++ b/src/main/java/de/butzlabben/world/gui/worldoption/TntStatus.java @@ -1,35 +1,35 @@ -package de.butzlabben.world.gui.worldoption; - -import java.io.File; - -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -import de.butzlabben.inventory.DependListener; -import de.butzlabben.inventory.OrcItem; -import de.butzlabben.world.config.DependenceConfig; -import de.butzlabben.world.config.PluginConfig; -import de.butzlabben.world.wrapper.WorldPlayer; - -public class TntStatus implements DependListener { - - @Override - public ItemStack getItemStack(Player p, WorldPlayer wp) { - String worldname = new DependenceConfig(p).getWorldname(); - File file = new File(worldname + "/worldconfig.yml"); - if (!file.exists()) - file = new File(PluginConfig.getWorlddir() + "/worldconfig.yml"); - if (!file.exists()) - return null; - YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file); - boolean b = cfg.getBoolean("Settings.TNTDamage"); - if (b) - return OrcItem.enabled.getItemStack(p); - - return null; - // TODO wenn enabled, dann return OrcItem.enabled.getItemStack(p, wp); - // sonst return null - } - -} +package de.butzlabben.world.gui.worldoption; + +import java.io.File; + +import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import de.butzlabben.inventory.DependListener; +import de.butzlabben.inventory.OrcItem; +import de.butzlabben.world.config.DependenceConfig; +import de.butzlabben.world.config.PluginConfig; +import de.butzlabben.world.wrapper.WorldPlayer; + +public class TntStatus implements DependListener { + + @Override + public ItemStack getItemStack(Player p, WorldPlayer wp) { + String worldname = new DependenceConfig(p).getWorldname(); + File file = new File(worldname + "/worldconfig.yml"); + if (!file.exists()) + file = new File(PluginConfig.getWorlddir() + "/worldconfig.yml"); + if (!file.exists()) + return null; + YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file); + boolean b = cfg.getBoolean("Settings.TNTDamage"); + if (b) + return OrcItem.enabled.getItemStack(p); + + return null; + // TODO wenn enabled, dann return OrcItem.enabled.getItemStack(p, wp); + // sonst return null + } + +} diff --git a/WorldSystem/src/main/java/de/butzlabben/world/listener/BlockListener.java b/src/main/java/de/butzlabben/world/listener/BlockListener.java similarity index 96% rename from WorldSystem/src/main/java/de/butzlabben/world/listener/BlockListener.java rename to src/main/java/de/butzlabben/world/listener/BlockListener.java index 010f0d9..fb562e3 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/listener/BlockListener.java +++ b/src/main/java/de/butzlabben/world/listener/BlockListener.java @@ -1,76 +1,76 @@ -package de.butzlabben.world.listener; - -import java.io.File; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.block.BlockBurnEvent; -import org.bukkit.event.block.BlockIgniteEvent; -import org.bukkit.event.block.BlockPlaceEvent; -import org.bukkit.event.entity.EntityExplodeEvent; - -import de.butzlabben.world.config.WorldConfig; -import de.butzlabben.world.wrapper.WorldPlayer; - -public class BlockListener implements Listener { - - @EventHandler - public void onExplode(EntityExplodeEvent e) { - File file = WorldConfig.getWorldFile(e.getLocation().getWorld().getName()); - if(!file.exists()) - return; - WorldConfig wc = WorldConfig.getWorldConfig(e.getLocation().getWorld().getName()); - e.setCancelled(!wc.isTnt()); - } - - @EventHandler - public void onPlace(BlockPlaceEvent e) { - Player p = e.getPlayer(); - if (p.hasPermission("ws.build")) - return; - String worldname = p.getWorld().getName(); - WorldPlayer wp = new WorldPlayer(p, worldname); - if (!wp.isOnSystemWorld()) - return; - if(!wp.isMember()) - e.setCancelled(true); - if (!wp.isOwnerofWorld()) { - e.setCancelled(!wp.canBuild()); - } - } - - @EventHandler - public void onBreak(BlockBreakEvent e) { - Player p = e.getPlayer(); - if (p.hasPermission("ws.build")) - return; - String worldname = p.getWorld().getName(); - WorldPlayer wp = new WorldPlayer(p, worldname); - if (!wp.isOnSystemWorld()) - return; - if(!wp.isMember()) - e.setCancelled(true); - if (!wp.isOwnerofWorld()) { - e.setCancelled(!wp.canBuild()); - } - } - @EventHandler - public void onFire(BlockIgniteEvent e) { - File file = WorldConfig.getWorldFile(e.getBlock().getWorld().getName()); - if(!file.exists()) - return; - WorldConfig wc = WorldConfig.getWorldConfig(e.getBlock().getWorld().getName()); - e.setCancelled(!wc.isFire()); - } - - @EventHandler - public void onFire(BlockBurnEvent e) { - File file = WorldConfig.getWorldFile(e.getBlock().getWorld().getName()); - if(!file.exists()) - return; - WorldConfig wc = WorldConfig.getWorldConfig(e.getBlock().getWorld().getName()); - e.setCancelled(!wc.isFire()); - } -} +package de.butzlabben.world.listener; + +import java.io.File; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockBurnEvent; +import org.bukkit.event.block.BlockIgniteEvent; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.entity.EntityExplodeEvent; + +import de.butzlabben.world.config.WorldConfig; +import de.butzlabben.world.wrapper.WorldPlayer; + +public class BlockListener implements Listener { + + @EventHandler + public void onExplode(EntityExplodeEvent e) { + File file = WorldConfig.getWorldFile(e.getLocation().getWorld().getName()); + if(!file.exists()) + return; + WorldConfig wc = WorldConfig.getWorldConfig(e.getLocation().getWorld().getName()); + e.setCancelled(!wc.isTnt()); + } + + @EventHandler + public void onPlace(BlockPlaceEvent e) { + Player p = e.getPlayer(); + if (p.hasPermission("ws.build")) + return; + String worldname = p.getWorld().getName(); + WorldPlayer wp = new WorldPlayer(p, worldname); + if (!wp.isOnSystemWorld()) + return; + if(!wp.isMember()) + e.setCancelled(true); + if (!wp.isOwnerofWorld()) { + e.setCancelled(!wp.canBuild()); + } + } + + @EventHandler + public void onBreak(BlockBreakEvent e) { + Player p = e.getPlayer(); + if (p.hasPermission("ws.build")) + return; + String worldname = p.getWorld().getName(); + WorldPlayer wp = new WorldPlayer(p, worldname); + if (!wp.isOnSystemWorld()) + return; + if(!wp.isMember()) + e.setCancelled(true); + if (!wp.isOwnerofWorld()) { + e.setCancelled(!wp.canBuild()); + } + } + @EventHandler + public void onFire(BlockIgniteEvent e) { + File file = WorldConfig.getWorldFile(e.getBlock().getWorld().getName()); + if(!file.exists()) + return; + WorldConfig wc = WorldConfig.getWorldConfig(e.getBlock().getWorld().getName()); + e.setCancelled(!wc.isFire()); + } + + @EventHandler + public void onFire(BlockBurnEvent e) { + File file = WorldConfig.getWorldFile(e.getBlock().getWorld().getName()); + if(!file.exists()) + return; + WorldConfig wc = WorldConfig.getWorldConfig(e.getBlock().getWorld().getName()); + e.setCancelled(!wc.isFire()); + } +} diff --git a/WorldSystem/src/main/java/de/butzlabben/world/listener/CommandListener.java b/src/main/java/de/butzlabben/world/listener/CommandListener.java similarity index 96% rename from WorldSystem/src/main/java/de/butzlabben/world/listener/CommandListener.java rename to src/main/java/de/butzlabben/world/listener/CommandListener.java index 4cdcb35..f31a5dd 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/listener/CommandListener.java +++ b/src/main/java/de/butzlabben/world/listener/CommandListener.java @@ -1,135 +1,135 @@ -package de.butzlabben.world.listener; - -import org.bukkit.Bukkit; -import org.bukkit.World; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; -import org.bukkit.event.player.PlayerTeleportEvent; -import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; - -import de.butzlabben.world.config.MessageConfig; -import de.butzlabben.world.config.PluginConfig; -import de.butzlabben.world.config.WorldConfig; -import de.butzlabben.world.wrapper.SystemWorld; -import de.butzlabben.world.wrapper.WorldPlayer; - -public class CommandListener implements Listener { - - @EventHandler(priority = EventPriority.HIGH) - public void onTeleport(PlayerTeleportEvent e) { - Player p = e.getPlayer(); - World from = e.getFrom().getWorld(); - World to = e.getTo().getWorld(); - WorldPlayer wp = new WorldPlayer(p); - - if (from != to) - SystemWorld.tryUnloadLater(from); - - if (e.getCause() == TeleportCause.SPECTATE) { - if (from != to && WorldConfig.exists(to.getName())) { - if (!p.hasPermission("ws.tp.toother")) { - e.setCancelled(true); - p.sendMessage(MessageConfig.getNoPermission()); - return; - } - } - - if (!wp.isOnSystemWorld() || wp.isOwnerofWorld() || wp.canTeleport() || p.hasPermission("ws.tp.toother")) - return; - e.setCancelled(true); - p.sendMessage(MessageConfig.getNoPermission()); - } else if (e.getCause() == TeleportCause.COMMAND) { - if (from != to && WorldConfig.exists(to.getName())) { - if (!p.hasPermission("ws.tp.toother")) { - e.setCancelled(true); - p.sendMessage(MessageConfig.getNoPermission()); - return; - } - } - - if (!wp.isOnSystemWorld() || wp.isOwnerofWorld() || wp.canTeleport() || p.hasPermission("ws.tp.toother")) - return; - e.setCancelled(true); - p.sendMessage(MessageConfig.getNoPermission()); - } - - } - - @EventHandler(priority = EventPriority.HIGH) - public void onCmd(PlayerCommandPreprocessEvent e) { - String cmd = e.getMessage().toLowerCase(); - Player p = e.getPlayer(); - WorldPlayer wp = new WorldPlayer(p); - - if (!wp.isOnSystemWorld()) - return; - - if (cmd.startsWith("/gamemode") || cmd.startsWith("/gm")) { - if (!wp.isOnSystemWorld()) - return; - if (p.hasPermission("ws.gamemode")) - return; - if (PluginConfig.isSurvival()) { - e.setCancelled(true); - p.sendMessage(MessageConfig.getNoPermission()); - return; - } - - if (!wp.canChangeGamemode() && !wp.isOwnerofWorld()) { - p.sendMessage(MessageConfig.getNoPermission()); - e.setCancelled(true); - return; - } - } else if (cmd.startsWith("/tp") || cmd.startsWith("/teleport")) { - String[] args = e.getMessage().split(" "); - if (args.length == 2) { - if (p.hasPermission("ws.tp.toother")) - return; - if (PluginConfig.isSurvival()) { - e.setCancelled(true); - p.sendMessage(MessageConfig.getNoPermission()); - return; - } - Player a = Bukkit.getPlayer(args[1]); - if (a == null) - return; - if (p.getWorld() != a.getWorld()) { - e.setCancelled(true); - p.sendMessage(MessageConfig.getNoPermission()); - return; - } - if (wp.isOwnerofWorld()) - return; - if (!wp.canTeleport()) { - p.sendMessage(MessageConfig.getNoPermission()); - e.setCancelled(true); - return; - } - } else if (args.length == 3) { - if (!p.hasPermission("ws.tp.other")) { - p.sendMessage(MessageConfig.getNoPermission()); - e.setCancelled(true); - } - - } else if (args.length == 4) { - if (p.hasPermission("ws.tp.toother")) - return; - if (PluginConfig.isSurvival()) { - e.setCancelled(true); - p.sendMessage(MessageConfig.getNoPermission()); - return; - } - if (wp.isOwnerofWorld()) - return; - if (!wp.canTeleport()) { - p.sendMessage(MessageConfig.getNoPermission()); - e.setCancelled(true); - return; - } - } - } - } -} +package de.butzlabben.world.listener; + +import org.bukkit.Bukkit; +import org.bukkit.World; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerTeleportEvent; +import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; + +import de.butzlabben.world.config.MessageConfig; +import de.butzlabben.world.config.PluginConfig; +import de.butzlabben.world.config.WorldConfig; +import de.butzlabben.world.wrapper.SystemWorld; +import de.butzlabben.world.wrapper.WorldPlayer; + +public class CommandListener implements Listener { + + @EventHandler(priority = EventPriority.HIGH) + public void onTeleport(PlayerTeleportEvent e) { + Player p = e.getPlayer(); + World from = e.getFrom().getWorld(); + World to = e.getTo().getWorld(); + WorldPlayer wp = new WorldPlayer(p); + + if (from != to) + SystemWorld.tryUnloadLater(from); + + if (e.getCause() == TeleportCause.SPECTATE) { + if (from != to && WorldConfig.exists(to.getName())) { + if (!p.hasPermission("ws.tp.toother")) { + e.setCancelled(true); + p.sendMessage(MessageConfig.getNoPermission()); + return; + } + } + + if (!wp.isOnSystemWorld() || wp.isOwnerofWorld() || wp.canTeleport() || p.hasPermission("ws.tp.toother")) + return; + e.setCancelled(true); + p.sendMessage(MessageConfig.getNoPermission()); + } else if (e.getCause() == TeleportCause.COMMAND) { + if (from != to && WorldConfig.exists(to.getName())) { + if (!p.hasPermission("ws.tp.toother")) { + e.setCancelled(true); + p.sendMessage(MessageConfig.getNoPermission()); + return; + } + } + + if (!wp.isOnSystemWorld() || wp.isOwnerofWorld() || wp.canTeleport() || p.hasPermission("ws.tp.toother")) + return; + e.setCancelled(true); + p.sendMessage(MessageConfig.getNoPermission()); + } + + } + + @EventHandler(priority = EventPriority.HIGH) + public void onCmd(PlayerCommandPreprocessEvent e) { + String cmd = e.getMessage().toLowerCase(); + Player p = e.getPlayer(); + WorldPlayer wp = new WorldPlayer(p); + + if (!wp.isOnSystemWorld()) + return; + + if (cmd.startsWith("/gamemode") || cmd.startsWith("/gm")) { + if (!wp.isOnSystemWorld()) + return; + if (p.hasPermission("ws.gamemode")) + return; + if (PluginConfig.isSurvival()) { + e.setCancelled(true); + p.sendMessage(MessageConfig.getNoPermission()); + return; + } + + if (!wp.canChangeGamemode() && !wp.isOwnerofWorld()) { + p.sendMessage(MessageConfig.getNoPermission()); + e.setCancelled(true); + return; + } + } else if (cmd.startsWith("/tp") || cmd.startsWith("/teleport")) { + String[] args = e.getMessage().split(" "); + if (args.length == 2) { + if (p.hasPermission("ws.tp.toother")) + return; + if (PluginConfig.isSurvival()) { + e.setCancelled(true); + p.sendMessage(MessageConfig.getNoPermission()); + return; + } + Player a = Bukkit.getPlayer(args[1]); + if (a == null) + return; + if (p.getWorld() != a.getWorld()) { + e.setCancelled(true); + p.sendMessage(MessageConfig.getNoPermission()); + return; + } + if (wp.isOwnerofWorld()) + return; + if (!wp.canTeleport()) { + p.sendMessage(MessageConfig.getNoPermission()); + e.setCancelled(true); + return; + } + } else if (args.length == 3) { + if (!p.hasPermission("ws.tp.other")) { + p.sendMessage(MessageConfig.getNoPermission()); + e.setCancelled(true); + } + + } else if (args.length == 4) { + if (p.hasPermission("ws.tp.toother")) + return; + if (PluginConfig.isSurvival()) { + e.setCancelled(true); + p.sendMessage(MessageConfig.getNoPermission()); + return; + } + if (wp.isOwnerofWorld()) + return; + if (!wp.canTeleport()) { + p.sendMessage(MessageConfig.getNoPermission()); + e.setCancelled(true); + return; + } + } + } + } +} diff --git a/WorldSystem/src/main/java/de/butzlabben/world/listener/PlayerDeathListener.java b/src/main/java/de/butzlabben/world/listener/PlayerDeathListener.java similarity index 96% rename from WorldSystem/src/main/java/de/butzlabben/world/listener/PlayerDeathListener.java rename to src/main/java/de/butzlabben/world/listener/PlayerDeathListener.java index a3c055f..66ac16e 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/listener/PlayerDeathListener.java +++ b/src/main/java/de/butzlabben/world/listener/PlayerDeathListener.java @@ -1,51 +1,51 @@ -package de.butzlabben.world.listener; - -import java.util.HashMap; -import java.util.UUID; - -import org.bukkit.World; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.event.player.PlayerRespawnEvent; - -import de.butzlabben.world.config.PluginConfig; -import de.butzlabben.world.config.WorldConfig; -import de.butzlabben.world.wrapper.WorldPlayer; - -public class PlayerDeathListener implements Listener { - - private HashMap deathLocations = new HashMap<>(); - - @EventHandler - public void onDie(PlayerDeathEvent e) { - Player p = e.getEntity(); - WorldPlayer wp = new WorldPlayer(p, p.getWorld().getName()); - if (wp.isOnSystemWorld()) { - deathLocations.put(p.getUniqueId(), p.getLocation().getWorld()); - } else { - p.setGameMode(PluginConfig.getSpawnGamemode()); - } - } - - @EventHandler - public void onRespawn(PlayerRespawnEvent e) { - Player p = e.getPlayer(); - if (deathLocations.containsKey(p.getUniqueId())) { - World world = deathLocations.remove(p.getUniqueId()); - - WorldConfig config = WorldConfig.getWorldConfig(world.getName()); - - if (config.getHome() != null) { - e.setRespawnLocation(config.getHome()); - } else { - if (PluginConfig.useWorldSpawn()) { - e.setRespawnLocation(PluginConfig.getWorldSpawn(world)); - } else { - e.setRespawnLocation(world.getSpawnLocation()); - } - } - } - } -} +package de.butzlabben.world.listener; + +import java.util.HashMap; +import java.util.UUID; + +import org.bukkit.World; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.player.PlayerRespawnEvent; + +import de.butzlabben.world.config.PluginConfig; +import de.butzlabben.world.config.WorldConfig; +import de.butzlabben.world.wrapper.WorldPlayer; + +public class PlayerDeathListener implements Listener { + + private HashMap deathLocations = new HashMap<>(); + + @EventHandler + public void onDie(PlayerDeathEvent e) { + Player p = e.getEntity(); + WorldPlayer wp = new WorldPlayer(p, p.getWorld().getName()); + if (wp.isOnSystemWorld()) { + deathLocations.put(p.getUniqueId(), p.getLocation().getWorld()); + } else { + p.setGameMode(PluginConfig.getSpawnGamemode()); + } + } + + @EventHandler + public void onRespawn(PlayerRespawnEvent e) { + Player p = e.getPlayer(); + if (deathLocations.containsKey(p.getUniqueId())) { + World world = deathLocations.remove(p.getUniqueId()); + + WorldConfig config = WorldConfig.getWorldConfig(world.getName()); + + if (config.getHome() != null) { + e.setRespawnLocation(config.getHome()); + } else { + if (PluginConfig.useWorldSpawn()) { + e.setRespawnLocation(PluginConfig.getWorldSpawn(world)); + } else { + e.setRespawnLocation(world.getSpawnLocation()); + } + } + } + } +} diff --git a/WorldSystem/src/main/java/de/butzlabben/world/listener/PlayerListener.java b/src/main/java/de/butzlabben/world/listener/PlayerListener.java similarity index 96% rename from WorldSystem/src/main/java/de/butzlabben/world/listener/PlayerListener.java rename to src/main/java/de/butzlabben/world/listener/PlayerListener.java index 48c9ff9..65bba21 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/listener/PlayerListener.java +++ b/src/main/java/de/butzlabben/world/listener/PlayerListener.java @@ -1,38 +1,38 @@ -package de.butzlabben.world.listener; - -import org.bukkit.World; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -import de.butzlabben.world.config.DependenceConfig; -import de.butzlabben.world.config.PluginConfig; -import de.butzlabben.world.wrapper.SystemWorld; - -public class PlayerListener implements Listener { - - //#17 - @EventHandler(priority = EventPriority.HIGHEST) - public void onJoin(PlayerJoinEvent e) { - if (PluginConfig.spawnTeleportation()) { - Player p = e.getPlayer(); - DependenceConfig dc = new DependenceConfig(p); - if (dc.hasWorld()) { - SystemWorld sw = SystemWorld.getSystemWorld(dc.getWorldname()); - if (sw != null && !sw.isLoaded()) { - e.getPlayer().teleport(PluginConfig.getSpawn()); - } - } - } - } - - @EventHandler - public void onLeave(PlayerQuitEvent e) { - Player p = e.getPlayer(); - World w = p.getWorld(); - SystemWorld.tryUnloadLater(w); - } +package de.butzlabben.world.listener; + +import org.bukkit.World; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerQuitEvent; + +import de.butzlabben.world.config.DependenceConfig; +import de.butzlabben.world.config.PluginConfig; +import de.butzlabben.world.wrapper.SystemWorld; + +public class PlayerListener implements Listener { + + //#17 + @EventHandler(priority = EventPriority.HIGHEST) + public void onJoin(PlayerJoinEvent e) { + if (PluginConfig.spawnTeleportation()) { + Player p = e.getPlayer(); + DependenceConfig dc = new DependenceConfig(p); + if (dc.hasWorld()) { + SystemWorld sw = SystemWorld.getSystemWorld(dc.getWorldname()); + if (sw != null && !sw.isLoaded()) { + e.getPlayer().teleport(PluginConfig.getSpawn()); + } + } + } + } + + @EventHandler + public void onLeave(PlayerQuitEvent e) { + Player p = e.getPlayer(); + World w = p.getWorld(); + SystemWorld.tryUnloadLater(w); + } } \ No newline at end of file diff --git a/WorldSystem/src/main/java/de/butzlabben/world/listener/WorldEditListener.java b/src/main/java/de/butzlabben/world/listener/WorldEditListener.java similarity index 100% rename from WorldSystem/src/main/java/de/butzlabben/world/listener/WorldEditListener.java rename to src/main/java/de/butzlabben/world/listener/WorldEditListener.java diff --git a/WorldSystem/src/main/java/de/butzlabben/world/util/TeleportUtil.java b/src/main/java/de/butzlabben/world/util/TeleportUtil.java similarity index 95% rename from WorldSystem/src/main/java/de/butzlabben/world/util/TeleportUtil.java rename to src/main/java/de/butzlabben/world/util/TeleportUtil.java index 57c5f74..92e026e 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/util/TeleportUtil.java +++ b/src/main/java/de/butzlabben/world/util/TeleportUtil.java @@ -1,29 +1,29 @@ -package de.butzlabben.world.util; - -import java.util.HashMap; -import java.util.UUID; - -import org.bukkit.Location; -import org.bukkit.entity.Player; - -/** - * @author Butzlabben - * @since 13.09.2018 - */ -public class TeleportUtil { - - private static HashMap oldLocs = new HashMap<>(); - - public static void teleportPlayer(Player p, Location loc) { - // Save old player location. - // If he does another teleport he will be taken back then to the first location - if(!oldLocs.containsKey(p.getUniqueId())) { - Location oldLoc = p.getLocation(); - oldLocs.put(p.getUniqueId(), oldLoc); - } - - } - - private TeleportUtil() { - } -} +package de.butzlabben.world.util; + +import java.util.HashMap; +import java.util.UUID; + +import org.bukkit.Location; +import org.bukkit.entity.Player; + +/** + * @author Butzlabben + * @since 13.09.2018 + */ +public class TeleportUtil { + + private static HashMap oldLocs = new HashMap<>(); + + public static void teleportPlayer(Player p, Location loc) { + // Save old player location. + // If he does another teleport he will be taken back then to the first location + if(!oldLocs.containsKey(p.getUniqueId())) { + Location oldLoc = p.getLocation(); + oldLocs.put(p.getUniqueId(), oldLoc); + } + + } + + private TeleportUtil() { + } +} diff --git a/WorldSystem/src/main/java/de/butzlabben/world/wrapper/AsyncCreatorAdapter.java b/src/main/java/de/butzlabben/world/wrapper/AsyncCreatorAdapter.java similarity index 95% rename from WorldSystem/src/main/java/de/butzlabben/world/wrapper/AsyncCreatorAdapter.java rename to src/main/java/de/butzlabben/world/wrapper/AsyncCreatorAdapter.java index 97b1c23..6d3c91c 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/wrapper/AsyncCreatorAdapter.java +++ b/src/main/java/de/butzlabben/world/wrapper/AsyncCreatorAdapter.java @@ -1,45 +1,45 @@ -package de.butzlabben.world.wrapper; - -import org.bukkit.Bukkit; -import org.bukkit.Material; -import org.bukkit.WorldCreator; -import org.bukkit.block.Block; - -import com.boydti.fawe.bukkit.wrapper.AsyncWorld; -import com.boydti.fawe.util.TaskManager; - -/** - * @author Butzlabben - * @since 08.06.2018 - */ -public class AsyncCreatorAdapter implements CreatorAdapter { - - // Create worlds async to close #16 - @Override - public void create(WorldCreator creator, SystemWorld sw, Runnable r) { - TaskManager.IMP.async(new Runnable() { - @Override - public void run() { - AsyncWorld world; - if (Bukkit.getWorld(creator.name()) == null) - world = AsyncWorld.create(creator); - else - world = AsyncWorld.wrap(Bukkit.getWorld(creator.name())); - - Block block = world.getBlockAt(0, 0, 0); - block.setType(Material.BEDROCK); - - // When you are done - world.commit(); - Bukkit.getWorlds().add(world); - if (sw != null) - sw.setCreating(false); - - // Send the message - r.run(); - } - }); - return; - } - -} +package de.butzlabben.world.wrapper; + +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.WorldCreator; +import org.bukkit.block.Block; + +import com.boydti.fawe.bukkit.wrapper.AsyncWorld; +import com.boydti.fawe.util.TaskManager; + +/** + * @author Butzlabben + * @since 08.06.2018 + */ +public class AsyncCreatorAdapter implements CreatorAdapter { + + // Create worlds async to close #16 + @Override + public void create(WorldCreator creator, SystemWorld sw, Runnable r) { + TaskManager.IMP.async(new Runnable() { + @Override + public void run() { + AsyncWorld world; + if (Bukkit.getWorld(creator.name()) == null) + world = AsyncWorld.create(creator); + else + world = AsyncWorld.wrap(Bukkit.getWorld(creator.name())); + + Block block = world.getBlockAt(0, 0, 0); + block.setType(Material.BEDROCK); + + // When you are done + world.commit(); + Bukkit.getWorlds().add(world); + if (sw != null) + sw.setCreating(false); + + // Send the message + r.run(); + } + }); + return; + } + +} diff --git a/WorldSystem/src/main/java/de/butzlabben/world/wrapper/CreatorAdapter.java b/src/main/java/de/butzlabben/world/wrapper/CreatorAdapter.java similarity index 95% rename from WorldSystem/src/main/java/de/butzlabben/world/wrapper/CreatorAdapter.java rename to src/main/java/de/butzlabben/world/wrapper/CreatorAdapter.java index 9451223..334e46a 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/wrapper/CreatorAdapter.java +++ b/src/main/java/de/butzlabben/world/wrapper/CreatorAdapter.java @@ -1,12 +1,12 @@ -package de.butzlabben.world.wrapper; - -import org.bukkit.WorldCreator; - -/** - * @author Butzlabben - * @since 07.06.2018 - */ -public interface CreatorAdapter { - - public void create(WorldCreator creator, SystemWorld world, Runnable sendPlayerMessageCallback); -} +package de.butzlabben.world.wrapper; + +import org.bukkit.WorldCreator; + +/** + * @author Butzlabben + * @since 07.06.2018 + */ +public interface CreatorAdapter { + + public void create(WorldCreator creator, SystemWorld world, Runnable sendPlayerMessageCallback); +} diff --git a/WorldSystem/src/main/java/de/butzlabben/world/wrapper/SystemWorld.java b/src/main/java/de/butzlabben/world/wrapper/SystemWorld.java similarity index 96% rename from WorldSystem/src/main/java/de/butzlabben/world/wrapper/SystemWorld.java rename to src/main/java/de/butzlabben/world/wrapper/SystemWorld.java index 0e2e23b..1b4e016 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/wrapper/SystemWorld.java +++ b/src/main/java/de/butzlabben/world/wrapper/SystemWorld.java @@ -1,432 +1,432 @@ -package de.butzlabben.world.wrapper; - -import java.io.File; -import java.io.IOException; -import java.util.HashMap; - -import org.apache.commons.io.FileUtils; -import org.bukkit.Bukkit; -import org.bukkit.Chunk; -import org.bukkit.GameMode; -import org.bukkit.OfflinePlayer; -import org.bukkit.World; -import org.bukkit.WorldCreator; -import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitRunnable; - -import com.google.common.base.Preconditions; - -import de.butzlabben.world.WorldSystem; -import de.butzlabben.world.config.DependenceConfig; -import de.butzlabben.world.config.MessageConfig; -import de.butzlabben.world.config.PluginConfig; -import de.butzlabben.world.config.SettingsConfig; -import de.butzlabben.world.config.WorldConfig; -import de.butzlabben.world.event.WorldCreateEvent; -import de.butzlabben.world.event.WorldLoadEvent; -import de.butzlabben.world.event.WorldUnloadEvent; - -/** - * This class represents a systemworld, loaded or not - * - * @author Butzlabben - * @since 14.02.2018 - */ -public class SystemWorld { - - private World w; - private String worldname; - private boolean unloading = false; - private boolean creating = false; - - private static HashMap cached = new HashMap<>(); - - /** - * This method is the online way to get a system world instance - * - * @param worldname as in minecraft - * @return a systemworld instance if it is a systemworld or null if is not a - * systemworld - * @exception NullPointerException worldname == null - */ - public static SystemWorld getSystemWorld(String worldname) { - Preconditions.checkNotNull(worldname, "worldname must not be null"); - if (cached.containsKey(worldname)) - return cached.get(worldname); - SystemWorld sw = new SystemWorld(worldname); - if (sw != null && sw.exists()) { - cached.put(worldname, sw); - return sw; - } - return null; - } - - /** - * @param w a world in bukkit, no matter if systemworld or not Trys to unload a - * systemworld later, with the given delay in the config - */ - public static void tryUnloadLater(World w) { - if (w != null) - Bukkit.getScheduler().runTaskLater(WorldSystem.getInstance(), () -> { - if (w.getPlayers().size() == 0) { - SystemWorld sw = SystemWorld.getSystemWorld(w.getName()); - if (sw != null && sw.isLoaded()) - sw.unloadLater(w); - } - }, 20); - } - - private SystemWorld(String worldname) { - this.worldname = worldname; - w = Bukkit.getWorld(worldname); - } - - /** - * Trys to force-unload this world - * - * @param w associated world - * @exception NullPointerException w == null - */ - public void directUnload(World w) { - if (!Bukkit.isPrimaryThread()) { - Bukkit.getScheduler().runTask(WorldSystem.getInstance(), () -> { - directUnload(w); - }); - return; - } - Preconditions.checkNotNull(w, "world must not be null"); - unloading = true; - w.save(); - Chunk[] arrayOfChunk; - int j = (arrayOfChunk = w.getLoadedChunks()).length; - for (int i = 0; i < j; i++) { - Chunk c = arrayOfChunk[i]; - c.unload(); - } - for (Player a : w.getPlayers()) { - a.teleport(PluginConfig.getSpawn()); - a.setGameMode(PluginConfig.getSpawnGamemode()); - } - if (unloading) { - if (Bukkit.unloadWorld(w, true)) { - File worldinserver = new File(Bukkit.getWorldContainer(), worldname); - File worlddir = new File(PluginConfig.getWorlddir()); - try { - FileUtils.moveDirectoryToDirectory(worldinserver, worlddir, false); - Bukkit.getWorlds().remove(w); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - } - - /** - * Trys to unload this world later, with the given delay in the config - * - * @param w the associated world - * @exception NullPointerException w == null - */ - public void unloadLater(World w) { - if (!Bukkit.isPrimaryThread()) { - Bukkit.getScheduler().runTask(WorldSystem.getInstance(), () -> { - unloadLater(w); - }); - return; - } - Preconditions.checkNotNull(w, "world must not be null"); - WorldUnloadEvent event = new WorldUnloadEvent(this); - Bukkit.getPluginManager().callEvent(event); - if (event.isCancelled()) - return; - // Set unloading to true - unloading = true; - w.save(); - Chunk[] arrayOfChunk; - int j = (arrayOfChunk = w.getLoadedChunks()).length; - for (int i = 0; i < j; i++) { - Chunk c = arrayOfChunk[i]; - c.unload(); - } - for (Player a : w.getPlayers()) { - a.teleport(PluginConfig.getSpawn()); - a.setGameMode(PluginConfig.getSpawnGamemode()); - } - - Bukkit.getScheduler().runTaskLater(WorldSystem.getInstance(), new Runnable() { - @Override - public void run() { - // Still in world unloading process? - if (unloading && w.getPlayers().size() == 0) { - if (Bukkit.unloadWorld(w, true)) { - File worldinserver = new File(Bukkit.getWorldContainer(), worldname); - File worlddir = new File(PluginConfig.getWorlddir()); - try { - FileUtils.moveDirectoryToDirectory(worldinserver, worlddir, false); - Bukkit.getWorlds().remove(w); - unloading = false; - } catch (IOException e) { - e.printStackTrace(); - } - } - } - } - }, 20 * PluginConfig.getUnloadingTime()); - } - - /** - * Trys to load this world, and messages the player about the process - * - * @param p the player to teleport on the world - * @exception NullPointerException if p is null - * @exception IllegalArgumentException if player is not online - */ - public void load(Player p) { - if (!Bukkit.isPrimaryThread()) { - Bukkit.getScheduler().runTask(WorldSystem.getInstance(), () -> { - load(p); - }); - return; - } - Preconditions.checkNotNull(p, "player must not be null"); - Preconditions.checkArgument(p.isOnline(), "player must be online"); - - if (creating) { - p.sendMessage(MessageConfig.getWorldStillCreating()); - return; - } - - WorldLoadEvent event = new WorldLoadEvent(p, this); - Bukkit.getPluginManager().callEvent(event); - if (event.isCancelled()) - return; - - unloading = false; - - p.sendMessage(MessageConfig.getSettingUpWorld()); - - // Move World into Server dir - String worlddir = PluginConfig.getWorlddir(); - File world = new File(worlddir + "/" + worldname); - if (!world.exists()) { - world = new File(Bukkit.getWorldContainer(), worldname); - } else { - if (new File(Bukkit.getWorldContainer(), worldname).exists() - && new File(PluginConfig.getWorlddir() + "/" + worldname).exists()) { - System.err.println("World " + worldname + " exists twice!"); - // try { - // FileUtils.deleteDirectory(new - // File(Bukkit.getWorldContainer(), worldname)); - // } catch (IOException e) { - // p.sendMessage(PluginConfig.getPrefix() + "cError"); - // e.printStackTrace(); - // } - } - try { - FileUtils.moveDirectoryToDirectory(world, Bukkit.getWorldContainer(), false); - } catch (IOException e) { - System.err.println("Couldn't load world of " + p.getName()); - p.sendMessage(PluginConfig.getPrefix() + "cError: " + e.getMessage()); - e.printStackTrace(); - } - } - - if (worldname.charAt(worldname.length() - 37) == ' ') { - StringBuilder myName = new StringBuilder(worldname); - myName.setCharAt(worldname.length() - 37, '-'); - world.renameTo(new File(Bukkit.getWorldContainer(), myName.toString())); - worldname = myName.toString(); - } - - WorldCreator creator = PluginConfig.getWorldCreator(worldname); - - World w = Bukkit.getWorld(worldname); - if (w == null) - w = Bukkit.createWorld(creator); - - this.w = w; - - teleportToWorldSpawn(p); - - OfflinePlayer owner = Bukkit.getOfflinePlayer(WorldConfig.getWorldConfig(worldname).getOwner()); - DependenceConfig dc = new DependenceConfig(owner); - dc.setLastLoaded(); - } - - /** - * Trys to create a new systemworld with all entries etc. finally loads the - * world - * - * @param p Player to create the world for - * @return whether it succesfull or not - */ - public static boolean create(Player p, WorldTemplate template) { - - DependenceConfig dc = new DependenceConfig(p); - - String uuid = p.getUniqueId().toString(); - int id = DependenceConfig.getHighestID() + 1; - String worldname = "ID" + id + "-" + uuid; - - WorldCreator creator = PluginConfig.getWorldCreator(worldname); - - WorldCreateEvent event = new WorldCreateEvent(p, creator); - Bukkit.getPluginManager().callEvent(event); - if (event.isCancelled()) - return false; - - dc.createNewEntry(); - - String worlddir = PluginConfig.getWorlddir(); - File exampleworld = new File(template.getPath()); - if (new File(template.getPath() + "/uid.dat").exists()) { - new File(template.getPath() + "/uid.dat").delete(); - } - - File newworld = new File(worlddir + "/" + worldname); - - if (exampleworld.isDirectory()) - try { - FileUtils.copyDirectory(exampleworld, newworld); - } catch (IOException e) { - System.err.println("Couldn't create world for " + p.getName()); - e.printStackTrace(); - } - else - newworld.mkdirs(); - - WorldConfig.create(p); - - // Move World into Server dir - File world = new File(worlddir + "/" + worldname); - if (!world.exists()) { - world = new File(Bukkit.getWorldContainer(), worldname); - } else { - if (new File(Bukkit.getWorldContainer(), worldname).exists() - && new File(PluginConfig.getWorlddir() + "/" + worldname).exists()) { - try { - FileUtils.deleteDirectory(new File(Bukkit.getWorldContainer(), worldname)); - } catch (IOException e) { - e.printStackTrace(); - } - } - try { - FileUtils.moveDirectoryToDirectory(world, Bukkit.getWorldContainer(), false); - } catch (IOException e) { - p.sendMessage(PluginConfig.getPrefix() + "cError: " + e.getMessage()); - System.err.println("Couldn't load world of " + p.getName()); - e.printStackTrace(); - return false; - } - } - - SystemWorld sw = SystemWorld.getSystemWorld(worldname); - sw.setCreating(true); - - // Run in scheduler so method returns without delay - new BukkitRunnable() { - @Override - public void run() { - // For #16 - WorldSystem.getInstance().getAdapter().create(event.getWorldCreator(), sw, () -> { - if (p != null && p.isOnline()) { - p.sendMessage(MessageConfig.getWorldCreated()); - SettingsConfig.getCommandsonGet().stream() - .map(s -> s.replace("%player", p.getName()).replace("%world", sw.getName()) - .replace("%uuid", p.getUniqueId().toString())) - .forEach(s -> Bukkit.dispatchCommand(Bukkit.getConsoleSender(), s)); - } - }); - } - }.runTaskLater(WorldSystem.getInstance(), 1); - - return true; - } - - /** - * @return if the world is loaded - */ - public boolean isLoaded() { - File worldAsDir = new File(Bukkit.getWorldContainer(), worldname + "/worldconfig.yml"); - World w = Bukkit.getWorld(worldname); - if (worldAsDir.exists() && w != null) - return true; - return false; - } - - private boolean exists() { - File worldAsDir = new File(Bukkit.getWorldContainer(), worldname + "/worldconfig.yml"); - if (worldAsDir.exists()) { - return true; - } - worldAsDir = new File(PluginConfig.getWorlddir() + "/" + worldname + "/worldconfig.yml"); - if (worldAsDir.exists()) { - return true; - } - return false; - } - - /** - * Teleports the player to the world with the given settings in the config - * - * @param p player to teleport - * @exception NullPointerException if player is null - * @exception IllegalArgumentException if player is not online - */ - public void teleportToWorldSpawn(Player p) { - Preconditions.checkNotNull(p, "player must not be null"); - Preconditions.checkArgument(p.isOnline(), "player must be online"); - - if (creating) { - p.sendMessage(MessageConfig.getWorldStillCreating()); - return; - } - - unloading = false; - w = Bukkit.getWorld(worldname); - if (w == null) - return; - - WorldConfig config = WorldConfig.getWorldConfig(worldname); - if (config.getHome() != null) { - p.teleport(config.getHome()); - } else { - if (PluginConfig.useWorldSpawn()) { - p.teleport(PluginConfig.getWorldSpawn(w)); - } else { - p.teleport(w.getSpawnLocation()); - } - } - if (PluginConfig.isSurvival()) { - p.setGameMode(GameMode.SURVIVAL); - } else { - p.setGameMode(GameMode.CREATIVE); - } - - OfflinePlayer owner = Bukkit.getOfflinePlayer(WorldConfig.getWorldConfig(worldname).getOwner()); - DependenceConfig dc = new DependenceConfig(owner); - dc.setLastLoaded(); - } - - /** - * @return the world - */ - public World getWorld() { - return w; - } - - public void setCreating(boolean creating) { - this.creating = creating; - } - - public boolean isCreating() { - return creating; - } - - /** - * @return the worldname - */ - public String getName() { - return worldname; - } +package de.butzlabben.world.wrapper; + +import java.io.File; +import java.io.IOException; +import java.util.HashMap; + +import org.apache.commons.io.FileUtils; +import org.bukkit.Bukkit; +import org.bukkit.Chunk; +import org.bukkit.GameMode; +import org.bukkit.OfflinePlayer; +import org.bukkit.World; +import org.bukkit.WorldCreator; +import org.bukkit.entity.Player; +import org.bukkit.scheduler.BukkitRunnable; + +import com.google.common.base.Preconditions; + +import de.butzlabben.world.WorldSystem; +import de.butzlabben.world.config.DependenceConfig; +import de.butzlabben.world.config.MessageConfig; +import de.butzlabben.world.config.PluginConfig; +import de.butzlabben.world.config.SettingsConfig; +import de.butzlabben.world.config.WorldConfig; +import de.butzlabben.world.event.WorldCreateEvent; +import de.butzlabben.world.event.WorldLoadEvent; +import de.butzlabben.world.event.WorldUnloadEvent; + +/** + * This class represents a systemworld, loaded or not + * + * @author Butzlabben + * @since 14.02.2018 + */ +public class SystemWorld { + + private World w; + private String worldname; + private boolean unloading = false; + private boolean creating = false; + + private static HashMap cached = new HashMap<>(); + + /** + * This method is the online way to get a system world instance + * + * @param worldname as in minecraft + * @return a systemworld instance if it is a systemworld or null if is not a + * systemworld + * @exception NullPointerException worldname == null + */ + public static SystemWorld getSystemWorld(String worldname) { + Preconditions.checkNotNull(worldname, "worldname must not be null"); + if (cached.containsKey(worldname)) + return cached.get(worldname); + SystemWorld sw = new SystemWorld(worldname); + if (sw != null && sw.exists()) { + cached.put(worldname, sw); + return sw; + } + return null; + } + + /** + * @param w a world in bukkit, no matter if systemworld or not Trys to unload a + * systemworld later, with the given delay in the config + */ + public static void tryUnloadLater(World w) { + if (w != null) + Bukkit.getScheduler().runTaskLater(WorldSystem.getInstance(), () -> { + if (w.getPlayers().size() == 0) { + SystemWorld sw = SystemWorld.getSystemWorld(w.getName()); + if (sw != null && sw.isLoaded()) + sw.unloadLater(w); + } + }, 20); + } + + private SystemWorld(String worldname) { + this.worldname = worldname; + w = Bukkit.getWorld(worldname); + } + + /** + * Trys to force-unload this world + * + * @param w associated world + * @exception NullPointerException w == null + */ + public void directUnload(World w) { + if (!Bukkit.isPrimaryThread()) { + Bukkit.getScheduler().runTask(WorldSystem.getInstance(), () -> { + directUnload(w); + }); + return; + } + Preconditions.checkNotNull(w, "world must not be null"); + unloading = true; + w.save(); + Chunk[] arrayOfChunk; + int j = (arrayOfChunk = w.getLoadedChunks()).length; + for (int i = 0; i < j; i++) { + Chunk c = arrayOfChunk[i]; + c.unload(); + } + for (Player a : w.getPlayers()) { + a.teleport(PluginConfig.getSpawn()); + a.setGameMode(PluginConfig.getSpawnGamemode()); + } + if (unloading) { + if (Bukkit.unloadWorld(w, true)) { + File worldinserver = new File(Bukkit.getWorldContainer(), worldname); + File worlddir = new File(PluginConfig.getWorlddir()); + try { + FileUtils.moveDirectoryToDirectory(worldinserver, worlddir, false); + Bukkit.getWorlds().remove(w); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + + /** + * Trys to unload this world later, with the given delay in the config + * + * @param w the associated world + * @exception NullPointerException w == null + */ + public void unloadLater(World w) { + if (!Bukkit.isPrimaryThread()) { + Bukkit.getScheduler().runTask(WorldSystem.getInstance(), () -> { + unloadLater(w); + }); + return; + } + Preconditions.checkNotNull(w, "world must not be null"); + WorldUnloadEvent event = new WorldUnloadEvent(this); + Bukkit.getPluginManager().callEvent(event); + if (event.isCancelled()) + return; + // Set unloading to true + unloading = true; + w.save(); + Chunk[] arrayOfChunk; + int j = (arrayOfChunk = w.getLoadedChunks()).length; + for (int i = 0; i < j; i++) { + Chunk c = arrayOfChunk[i]; + c.unload(); + } + for (Player a : w.getPlayers()) { + a.teleport(PluginConfig.getSpawn()); + a.setGameMode(PluginConfig.getSpawnGamemode()); + } + + Bukkit.getScheduler().runTaskLater(WorldSystem.getInstance(), new Runnable() { + @Override + public void run() { + // Still in world unloading process? + if (unloading && w.getPlayers().size() == 0) { + if (Bukkit.unloadWorld(w, true)) { + File worldinserver = new File(Bukkit.getWorldContainer(), worldname); + File worlddir = new File(PluginConfig.getWorlddir()); + try { + FileUtils.moveDirectoryToDirectory(worldinserver, worlddir, false); + Bukkit.getWorlds().remove(w); + unloading = false; + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + }, 20 * PluginConfig.getUnloadingTime()); + } + + /** + * Trys to load this world, and messages the player about the process + * + * @param p the player to teleport on the world + * @exception NullPointerException if p is null + * @exception IllegalArgumentException if player is not online + */ + public void load(Player p) { + if (!Bukkit.isPrimaryThread()) { + Bukkit.getScheduler().runTask(WorldSystem.getInstance(), () -> { + load(p); + }); + return; + } + Preconditions.checkNotNull(p, "player must not be null"); + Preconditions.checkArgument(p.isOnline(), "player must be online"); + + if (creating) { + p.sendMessage(MessageConfig.getWorldStillCreating()); + return; + } + + WorldLoadEvent event = new WorldLoadEvent(p, this); + Bukkit.getPluginManager().callEvent(event); + if (event.isCancelled()) + return; + + unloading = false; + + p.sendMessage(MessageConfig.getSettingUpWorld()); + + // Move World into Server dir + String worlddir = PluginConfig.getWorlddir(); + File world = new File(worlddir + "/" + worldname); + if (!world.exists()) { + world = new File(Bukkit.getWorldContainer(), worldname); + } else { + if (new File(Bukkit.getWorldContainer(), worldname).exists() + && new File(PluginConfig.getWorlddir() + "/" + worldname).exists()) { + System.err.println("World " + worldname + " exists twice!"); + // try { + // FileUtils.deleteDirectory(new + // File(Bukkit.getWorldContainer(), worldname)); + // } catch (IOException e) { + // p.sendMessage(PluginConfig.getPrefix() + "cError"); + // e.printStackTrace(); + // } + } + try { + FileUtils.moveDirectoryToDirectory(world, Bukkit.getWorldContainer(), false); + } catch (IOException e) { + System.err.println("Couldn't load world of " + p.getName()); + p.sendMessage(PluginConfig.getPrefix() + "cError: " + e.getMessage()); + e.printStackTrace(); + } + } + + if (worldname.charAt(worldname.length() - 37) == ' ') { + StringBuilder myName = new StringBuilder(worldname); + myName.setCharAt(worldname.length() - 37, '-'); + world.renameTo(new File(Bukkit.getWorldContainer(), myName.toString())); + worldname = myName.toString(); + } + + WorldCreator creator = PluginConfig.getWorldCreator(worldname); + + World w = Bukkit.getWorld(worldname); + if (w == null) + w = Bukkit.createWorld(creator); + + this.w = w; + + teleportToWorldSpawn(p); + + OfflinePlayer owner = Bukkit.getOfflinePlayer(WorldConfig.getWorldConfig(worldname).getOwner()); + DependenceConfig dc = new DependenceConfig(owner); + dc.setLastLoaded(); + } + + /** + * Trys to create a new systemworld with all entries etc. finally loads the + * world + * + * @param p Player to create the world for + * @return whether it succesfull or not + */ + public static boolean create(Player p, WorldTemplate template) { + + DependenceConfig dc = new DependenceConfig(p); + + String uuid = p.getUniqueId().toString(); + int id = DependenceConfig.getHighestID() + 1; + String worldname = "ID" + id + "-" + uuid; + + WorldCreator creator = PluginConfig.getWorldCreator(worldname); + + WorldCreateEvent event = new WorldCreateEvent(p, creator); + Bukkit.getPluginManager().callEvent(event); + if (event.isCancelled()) + return false; + + dc.createNewEntry(); + + String worlddir = PluginConfig.getWorlddir(); + File exampleworld = new File(template.getPath()); + if (new File(template.getPath() + "/uid.dat").exists()) { + new File(template.getPath() + "/uid.dat").delete(); + } + + File newworld = new File(worlddir + "/" + worldname); + + if (exampleworld.isDirectory()) + try { + FileUtils.copyDirectory(exampleworld, newworld); + } catch (IOException e) { + System.err.println("Couldn't create world for " + p.getName()); + e.printStackTrace(); + } + else + newworld.mkdirs(); + + WorldConfig.create(p); + + // Move World into Server dir + File world = new File(worlddir + "/" + worldname); + if (!world.exists()) { + world = new File(Bukkit.getWorldContainer(), worldname); + } else { + if (new File(Bukkit.getWorldContainer(), worldname).exists() + && new File(PluginConfig.getWorlddir() + "/" + worldname).exists()) { + try { + FileUtils.deleteDirectory(new File(Bukkit.getWorldContainer(), worldname)); + } catch (IOException e) { + e.printStackTrace(); + } + } + try { + FileUtils.moveDirectoryToDirectory(world, Bukkit.getWorldContainer(), false); + } catch (IOException e) { + p.sendMessage(PluginConfig.getPrefix() + "cError: " + e.getMessage()); + System.err.println("Couldn't load world of " + p.getName()); + e.printStackTrace(); + return false; + } + } + + SystemWorld sw = SystemWorld.getSystemWorld(worldname); + sw.setCreating(true); + + // Run in scheduler so method returns without delay + new BukkitRunnable() { + @Override + public void run() { + // For #16 + WorldSystem.getInstance().getAdapter().create(event.getWorldCreator(), sw, () -> { + if (p != null && p.isOnline()) { + p.sendMessage(MessageConfig.getWorldCreated()); + SettingsConfig.getCommandsonGet().stream() + .map(s -> s.replace("%player", p.getName()).replace("%world", sw.getName()) + .replace("%uuid", p.getUniqueId().toString())) + .forEach(s -> Bukkit.dispatchCommand(Bukkit.getConsoleSender(), s)); + } + }); + } + }.runTaskLater(WorldSystem.getInstance(), 1); + + return true; + } + + /** + * @return if the world is loaded + */ + public boolean isLoaded() { + File worldAsDir = new File(Bukkit.getWorldContainer(), worldname + "/worldconfig.yml"); + World w = Bukkit.getWorld(worldname); + if (worldAsDir.exists() && w != null) + return true; + return false; + } + + private boolean exists() { + File worldAsDir = new File(Bukkit.getWorldContainer(), worldname + "/worldconfig.yml"); + if (worldAsDir.exists()) { + return true; + } + worldAsDir = new File(PluginConfig.getWorlddir() + "/" + worldname + "/worldconfig.yml"); + if (worldAsDir.exists()) { + return true; + } + return false; + } + + /** + * Teleports the player to the world with the given settings in the config + * + * @param p player to teleport + * @exception NullPointerException if player is null + * @exception IllegalArgumentException if player is not online + */ + public void teleportToWorldSpawn(Player p) { + Preconditions.checkNotNull(p, "player must not be null"); + Preconditions.checkArgument(p.isOnline(), "player must be online"); + + if (creating) { + p.sendMessage(MessageConfig.getWorldStillCreating()); + return; + } + + unloading = false; + w = Bukkit.getWorld(worldname); + if (w == null) + return; + + WorldConfig config = WorldConfig.getWorldConfig(worldname); + if (config.getHome() != null) { + p.teleport(config.getHome()); + } else { + if (PluginConfig.useWorldSpawn()) { + p.teleport(PluginConfig.getWorldSpawn(w)); + } else { + p.teleport(w.getSpawnLocation()); + } + } + if (PluginConfig.isSurvival()) { + p.setGameMode(GameMode.SURVIVAL); + } else { + p.setGameMode(GameMode.CREATIVE); + } + + OfflinePlayer owner = Bukkit.getOfflinePlayer(WorldConfig.getWorldConfig(worldname).getOwner()); + DependenceConfig dc = new DependenceConfig(owner); + dc.setLastLoaded(); + } + + /** + * @return the world + */ + public World getWorld() { + return w; + } + + public void setCreating(boolean creating) { + this.creating = creating; + } + + public boolean isCreating() { + return creating; + } + + /** + * @return the worldname + */ + public String getName() { + return worldname; + } } \ No newline at end of file diff --git a/WorldSystem/src/main/java/de/butzlabben/world/wrapper/WorldPlayer.java b/src/main/java/de/butzlabben/world/wrapper/WorldPlayer.java similarity index 100% rename from WorldSystem/src/main/java/de/butzlabben/world/wrapper/WorldPlayer.java rename to src/main/java/de/butzlabben/world/wrapper/WorldPlayer.java diff --git a/WorldSystem/src/main/java/de/butzlabben/world/wrapper/WorldTemplate.java b/src/main/java/de/butzlabben/world/wrapper/WorldTemplate.java similarity index 94% rename from WorldSystem/src/main/java/de/butzlabben/world/wrapper/WorldTemplate.java rename to src/main/java/de/butzlabben/world/wrapper/WorldTemplate.java index 8909d4a..a2ce6a7 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/wrapper/WorldTemplate.java +++ b/src/main/java/de/butzlabben/world/wrapper/WorldTemplate.java @@ -1,42 +1,42 @@ -package de.butzlabben.world.wrapper; - -import de.butzlabben.inventory.OrcItem; -import de.butzlabben.world.config.GuiConfig; - -/** - * @author Butzlabben - * @since 15.12.2018 - */ -public class WorldTemplate { - - private final String name; - private final OrcItem icon; - private final int slot; - - public WorldTemplate(String name) { - this.name = name; - this.icon = GuiConfig.getItem("worldchoose." + name); - this.slot = GuiConfig.getSlot("worldchoose." + name); - - icon.setOnClick((p, inv, item) -> { - p.closeInventory(); - p.chat("/ws get " + name); - }); - } - - public int getSlot() { - return slot; - } - - public OrcItem getIcon() { - return icon; - } - - public String getName() { - return name; - } - - public String getPath() { - return "plugins/WorldSystem/worldsources/" + name; - } -} +package de.butzlabben.world.wrapper; + +import de.butzlabben.inventory.OrcItem; +import de.butzlabben.world.config.GuiConfig; + +/** + * @author Butzlabben + * @since 15.12.2018 + */ +public class WorldTemplate { + + private final String name; + private final OrcItem icon; + private final int slot; + + public WorldTemplate(String name) { + this.name = name; + this.icon = GuiConfig.getItem("worldchoose." + name); + this.slot = GuiConfig.getSlot("worldchoose." + name); + + icon.setOnClick((p, inv, item) -> { + p.closeInventory(); + p.chat("/ws get " + name); + }); + } + + public int getSlot() { + return slot; + } + + public OrcItem getIcon() { + return icon; + } + + public String getName() { + return name; + } + + public String getPath() { + return "plugins/WorldSystem/worldsources/" + name; + } +} diff --git a/WorldSystem/src/main/java/de/butzlabben/world/wrapper/WorldTemplateProvider.java b/src/main/java/de/butzlabben/world/wrapper/WorldTemplateProvider.java similarity index 96% rename from WorldSystem/src/main/java/de/butzlabben/world/wrapper/WorldTemplateProvider.java rename to src/main/java/de/butzlabben/world/wrapper/WorldTemplateProvider.java index 919c194..b27eb48 100644 --- a/WorldSystem/src/main/java/de/butzlabben/world/wrapper/WorldTemplateProvider.java +++ b/src/main/java/de/butzlabben/world/wrapper/WorldTemplateProvider.java @@ -1,39 +1,39 @@ -package de.butzlabben.world.wrapper; - -import java.util.Collection; -import java.util.HashMap; - -import org.bukkit.configuration.ConfigurationSection; - -import de.butzlabben.world.config.PluginConfig; - -/** - * @author Butzlabben - * @since 16.12.2018 - */ -public class WorldTemplateProvider { - - private static WorldTemplateProvider instance = new WorldTemplateProvider(); - - public static WorldTemplateProvider getInstace() { - return instance; - } - - private HashMap templates = new HashMap<>(); - - private WorldTemplateProvider() { - ConfigurationSection section = PluginConfig.getConfig().getConfigurationSection("worldtemplates.templates"); - for(String key: section.getKeys(false)) { - String name = section.getString(key + ".name"); - templates.put(name, new WorldTemplate(name)); - } - } - - public WorldTemplate getTemplate(String key) { - return templates.get(key); - } - - public Collection getTemplates() { - return templates.values(); - } -} +package de.butzlabben.world.wrapper; + +import java.util.Collection; +import java.util.HashMap; + +import org.bukkit.configuration.ConfigurationSection; + +import de.butzlabben.world.config.PluginConfig; + +/** + * @author Butzlabben + * @since 16.12.2018 + */ +public class WorldTemplateProvider { + + private static WorldTemplateProvider instance = new WorldTemplateProvider(); + + public static WorldTemplateProvider getInstace() { + return instance; + } + + private HashMap templates = new HashMap<>(); + + private WorldTemplateProvider() { + ConfigurationSection section = PluginConfig.getConfig().getConfigurationSection("worldtemplates.templates"); + for(String key: section.getKeys(false)) { + String name = section.getString(key + ".name"); + templates.put(name, new WorldTemplate(name)); + } + } + + public WorldTemplate getTemplate(String key) { + return templates.get(key); + } + + public Collection getTemplates() { + return templates.values(); + } +} diff --git a/WorldSystem/src/main/java/org/bstats/bukkit/Metrics.java b/src/main/java/org/bstats/bukkit/Metrics.java similarity index 97% rename from WorldSystem/src/main/java/org/bstats/bukkit/Metrics.java rename to src/main/java/org/bstats/bukkit/Metrics.java index cd8a660..8be68dc 100644 --- a/WorldSystem/src/main/java/org/bstats/bukkit/Metrics.java +++ b/src/main/java/org/bstats/bukkit/Metrics.java @@ -1,677 +1,677 @@ -package org.bstats.bukkit; - -import org.bukkit.Bukkit; -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.entity.Player; -import org.bukkit.plugin.RegisteredServiceProvider; -import org.bukkit.plugin.ServicePriority; -import org.bukkit.plugin.java.JavaPlugin; -import org.json.simple.JSONArray; -import org.json.simple.JSONObject; - -import javax.net.ssl.HttpsURLConnection; -import java.io.ByteArrayOutputStream; -import java.io.DataOutputStream; -import java.io.File; -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.net.URL; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Timer; -import java.util.TimerTask; -import java.util.UUID; -import java.util.concurrent.Callable; -import java.util.logging.Level; -import java.util.zip.GZIPOutputStream; - -/** - * bStats collects some data for plugin authors. - * - * Check out https://bStats.org/ to learn more about bStats! - */ -public class Metrics { - - static { - // You can use the property to disable the check in your test environment - if (System.getProperty("bstats.relocatecheck") == null || !System.getProperty("bstats.relocatecheck").equals("false")) { - // Maven's Relocate is clever and changes strings, too. So we have to use this little "trick" ... :D - final String defaultPackage = "org.bstats.bukkit"; - final String examplePackage = ""; - // We want to make sure nobody just copy & pastes the example and use the wrong package names - if (!Metrics.class.getPackage().getName().equals(defaultPackage) && !Metrics.class.getPackage().getName().equals(examplePackage)) { - throw new IllegalStateException("bStats Metrics class has not been relocated correctly!"); - } - } - } - - // The version of this bStats class - public static final int B_STATS_VERSION = 1; - - // The url to which the data is sent - private static final String URL = "https://bStats.org/submitData/bukkit"; - - // Should failed requests be logged? - private static boolean logFailedRequests; - - // The uuid of the server - private static String serverUUID; - - // The plugin - private final JavaPlugin plugin; - - // A list with all custom charts - private final List charts = new ArrayList<>(); - - /** - * Class constructor. - * - * @param plugin The plugin which stats should be submitted. - */ - public Metrics(JavaPlugin plugin) { - if (plugin == null) { - throw new IllegalArgumentException("Plugin cannot be null!"); - } - this.plugin = plugin; - - // Get the config file - File bStatsFolder = new File(plugin.getDataFolder().getParentFile(), "bStats"); - File configFile = new File(bStatsFolder, "config.yml"); - YamlConfiguration config = YamlConfiguration.loadConfiguration(configFile); - - // Check if the config file exists - if (!config.isSet("serverUuid")) { - - // Add default values - config.addDefault("enabled", true); - // Every server gets it's unique random id. - config.addDefault("serverUuid", UUID.randomUUID().toString()); - // Should failed request be logged? - config.addDefault("logFailedRequests", false); - - // Inform the server owners about bStats - config.options().header( - "bStats collects some data for plugin authors like how many servers are using their plugins.\n" + - "To honor their work, you should not disable it.\n" + - "This has nearly no effect on the server performance!\n" + - "Check out https://bStats.org/ to learn more :)" - ).copyDefaults(true); - try { - config.save(configFile); - } catch (IOException ignored) { } - } - - // Load the data - serverUUID = config.getString("serverUuid"); - logFailedRequests = config.getBoolean("logFailedRequests", false); - if (config.getBoolean("enabled", true)) { - boolean found = false; - // Search for all other bStats Metrics classes to see if we are the first one - for (Class service : Bukkit.getServicesManager().getKnownServices()) { - try { - service.getField("B_STATS_VERSION"); // Our identifier :) - found = true; // We aren't the first - break; - } catch (NoSuchFieldException ignored) { } - } - // Register our service - Bukkit.getServicesManager().register(Metrics.class, this, plugin, ServicePriority.Normal); - if (!found) { - // We are the first! - startSubmitting(); - } - } - } - - /** - * Adds a custom chart. - * - * @param chart The chart to add. - */ - public void addCustomChart(CustomChart chart) { - if (chart == null) { - throw new IllegalArgumentException("Chart cannot be null!"); - } - charts.add(chart); - } - - /** - * Starts the Scheduler which submits our data every 30 minutes. - */ - private void startSubmitting() { - final Timer timer = new Timer(true); // We use a timer cause the Bukkit scheduler is affected by server lags - timer.scheduleAtFixedRate(new TimerTask() { - @Override - public void run() { - if (!plugin.isEnabled()) { // Plugin was disabled - timer.cancel(); - return; - } - // Nevertheless we want our code to run in the Bukkit main thread, so we have to use the Bukkit scheduler - // Don't be afraid! The connection to the bStats server is still async, only the stats collection is sync ;) - Bukkit.getScheduler().runTask(plugin, new Runnable() { - @Override - public void run() { - submitData(); - } - }); - } - }, 1000*60*5, 1000*60*30); - // Submit the data every 30 minutes, first time after 5 minutes to give other plugins enough time to start - // WARNING: Changing the frequency has no effect but your plugin WILL be blocked/deleted! - // WARNING: Just don't do it! - } - - /** - * Gets the plugin specific data. - * This method is called using Reflection. - * - * @return The plugin specific data. - */ - @SuppressWarnings("unchecked") - public JSONObject getPluginData() { - JSONObject data = new JSONObject(); - - String pluginName = plugin.getDescription().getName(); - String pluginVersion = plugin.getDescription().getVersion(); - - data.put("pluginName", pluginName); // Append the name of the plugin - data.put("pluginVersion", pluginVersion); // Append the version of the plugin - JSONArray customCharts = new JSONArray(); - for (CustomChart customChart : charts) { - // Add the data of the custom charts - JSONObject chart = customChart.getRequestJsonObject(); - if (chart == null) { // If the chart is null, we skip it - continue; - } - customCharts.add(chart); - } - data.put("customCharts", customCharts); - - return data; - } - - /** - * Gets the server specific data. - * - * @return The server specific data. - */ - @SuppressWarnings("unchecked") - private JSONObject getServerData() { - // Minecraft specific data - int playerAmount; - try { - // Around MC 1.8 the return type was changed to a collection from an array, - // This fixes java.lang.NoSuchMethodError: org.bukkit.Bukkit.getOnlinePlayers()Ljava/util/Collection; - Method onlinePlayersMethod = Class.forName("org.bukkit.Server").getMethod("getOnlinePlayers"); - playerAmount = onlinePlayersMethod.getReturnType().equals(Collection.class) - ? ((Collection) onlinePlayersMethod.invoke(Bukkit.getServer())).size() - : ((Player[]) onlinePlayersMethod.invoke(Bukkit.getServer())).length; - } catch (Exception e) { - playerAmount = Bukkit.getOnlinePlayers().size(); // Just use the new method if the Reflection failed - } - int onlineMode = Bukkit.getOnlineMode() ? 1 : 0; - String bukkitVersion = org.bukkit.Bukkit.getVersion(); - bukkitVersion = bukkitVersion.substring(bukkitVersion.indexOf("MC: ") + 4, bukkitVersion.length() - 1); - - // OS/Java specific data - String javaVersion = System.getProperty("java.version"); - String osName = System.getProperty("os.name"); - String osArch = System.getProperty("os.arch"); - String osVersion = System.getProperty("os.version"); - int coreCount = Runtime.getRuntime().availableProcessors(); - - JSONObject data = new JSONObject(); - - data.put("serverUUID", serverUUID); - - data.put("playerAmount", playerAmount); - data.put("onlineMode", onlineMode); - data.put("bukkitVersion", bukkitVersion); - - data.put("javaVersion", javaVersion); - data.put("osName", osName); - data.put("osArch", osArch); - data.put("osVersion", osVersion); - data.put("coreCount", coreCount); - - return data; - } - - /** - * Collects the data and sends it afterwards. - */ - @SuppressWarnings("unchecked") - private void submitData() { - final JSONObject data = getServerData(); - - JSONArray pluginData = new JSONArray(); - // Search for all other bStats Metrics classes to get their plugin data - for (Class service : Bukkit.getServicesManager().getKnownServices()) { - try { - service.getField("B_STATS_VERSION"); // Our identifier :) - - for (RegisteredServiceProvider provider : Bukkit.getServicesManager().getRegistrations(service)) { - try { - pluginData.add(provider.getService().getMethod("getPluginData").invoke(provider.getProvider())); - } catch (NullPointerException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) { } - } - } catch (NoSuchFieldException ignored) { } - } - - data.put("plugins", pluginData); - - // Create a new thread for the connection to the bStats server - new Thread(new Runnable() { - @Override - public void run() { - try { - // Send the data - sendData(data); - } catch (Exception e) { - // Something went wrong! :( - if (logFailedRequests) { - plugin.getLogger().log(Level.WARNING, "Could not submit plugin stats of " + plugin.getName(), e); - } - } - } - }).start(); - } - - /** - * Sends the data to the bStats server. - * - * @param data The data to send. - * @throws Exception If the request failed. - */ - private static void sendData(JSONObject data) throws Exception { - if (data == null) { - throw new IllegalArgumentException("Data cannot be null!"); - } - if (Bukkit.isPrimaryThread()) { - throw new IllegalAccessException("This method must not be called from the main thread!"); - } - HttpsURLConnection connection = (HttpsURLConnection) new URL(URL).openConnection(); - - // Compress the data to save bandwidth - byte[] compressedData = compress(data.toString()); - - // Add headers - connection.setRequestMethod("POST"); - connection.addRequestProperty("Accept", "application/json"); - connection.addRequestProperty("Connection", "close"); - connection.addRequestProperty("Content-Encoding", "gzip"); // We gzip our request - connection.addRequestProperty("Content-Length", String.valueOf(compressedData.length)); - connection.setRequestProperty("Content-Type", "application/json"); // We send our data in JSON format - connection.setRequestProperty("User-Agent", "MC-Server/" + B_STATS_VERSION); - - // Send data - connection.setDoOutput(true); - DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream()); - outputStream.write(compressedData); - outputStream.flush(); - outputStream.close(); - - connection.getInputStream().close(); // We don't care about the response - Just send our data :) - } - - /** - * Gzips the given String. - * - * @param str The string to gzip. - * @return The gzipped String. - * @throws IOException If the compression failed. - */ - private static byte[] compress(final String str) throws IOException { - if (str == null) { - return null; - } - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - GZIPOutputStream gzip = new GZIPOutputStream(outputStream); - gzip.write(str.getBytes("UTF-8")); - gzip.close(); - return outputStream.toByteArray(); - } - - /** - * Represents a custom chart. - */ - public static abstract class CustomChart { - - // The id of the chart - final String chartId; - - /** - * Class constructor. - * - * @param chartId The id of the chart. - */ - CustomChart(String chartId) { - if (chartId == null || chartId.isEmpty()) { - throw new IllegalArgumentException("ChartId cannot be null or empty!"); - } - this.chartId = chartId; - } - - @SuppressWarnings("unchecked") - private JSONObject getRequestJsonObject() { - JSONObject chart = new JSONObject(); - chart.put("chartId", chartId); - try { - JSONObject data = getChartData(); - if (data == null) { - // If the data is null we don't send the chart. - return null; - } - chart.put("data", data); - } catch (Throwable t) { - if (logFailedRequests) { - Bukkit.getLogger().log(Level.WARNING, "Failed to get data for custom chart with id " + chartId, t); - } - return null; - } - return chart; - } - - protected abstract JSONObject getChartData() throws Exception; - - } - - /** - * Represents a custom simple pie. - */ - public static class SimplePie extends CustomChart { - - private final Callable callable; - - /** - * Class constructor. - * - * @param chartId The id of the chart. - * @param callable The callable which is used to request the chart data. - */ - public SimplePie(String chartId, Callable callable) { - super(chartId); - this.callable = callable; - } - - @SuppressWarnings("unchecked") - @Override - protected JSONObject getChartData() throws Exception { - JSONObject data = new JSONObject(); - String value = callable.call(); - if (value == null || value.isEmpty()) { - // Null = skip the chart - return null; - } - data.put("value", value); - return data; - } - } - - /** - * Represents a custom advanced pie. - */ - public static class AdvancedPie extends CustomChart { - - private final Callable> callable; - - /** - * Class constructor. - * - * @param chartId The id of the chart. - * @param callable The callable which is used to request the chart data. - */ - public AdvancedPie(String chartId, Callable> callable) { - super(chartId); - this.callable = callable; - } - - @SuppressWarnings("unchecked") - @Override - protected JSONObject getChartData() throws Exception { - JSONObject data = new JSONObject(); - JSONObject values = new JSONObject(); - Map map = callable.call(); - if (map == null || map.isEmpty()) { - // Null = skip the chart - return null; - } - boolean allSkipped = true; - for (Map.Entry entry : map.entrySet()) { - if (entry.getValue() == 0) { - continue; // Skip this invalid - } - allSkipped = false; - values.put(entry.getKey(), entry.getValue()); - } - if (allSkipped) { - // Null = skip the chart - return null; - } - data.put("values", values); - return data; - } - } - - /** - * Represents a custom drilldown pie. - */ - public static class DrilldownPie extends CustomChart { - - private final Callable>> callable; - - /** - * Class constructor. - * - * @param chartId The id of the chart. - * @param callable The callable which is used to request the chart data. - */ - public DrilldownPie(String chartId, Callable>> callable) { - super(chartId); - this.callable = callable; - } - - @SuppressWarnings("unchecked") - @Override - public JSONObject getChartData() throws Exception { - JSONObject data = new JSONObject(); - JSONObject values = new JSONObject(); - Map> map = callable.call(); - if (map == null || map.isEmpty()) { - // Null = skip the chart - return null; - } - boolean reallyAllSkipped = true; - for (Map.Entry> entryValues : map.entrySet()) { - JSONObject value = new JSONObject(); - boolean allSkipped = true; - for (Map.Entry valueEntry : map.get(entryValues.getKey()).entrySet()) { - value.put(valueEntry.getKey(), valueEntry.getValue()); - allSkipped = false; - } - if (!allSkipped) { - reallyAllSkipped = false; - values.put(entryValues.getKey(), value); - } - } - if (reallyAllSkipped) { - // Null = skip the chart - return null; - } - data.put("values", values); - return data; - } - } - - /** - * Represents a custom single line chart. - */ - public static class SingleLineChart extends CustomChart { - - private final Callable callable; - - /** - * Class constructor. - * - * @param chartId The id of the chart. - * @param callable The callable which is used to request the chart data. - */ - public SingleLineChart(String chartId, Callable callable) { - super(chartId); - this.callable = callable; - } - - @SuppressWarnings("unchecked") - @Override - protected JSONObject getChartData() throws Exception { - JSONObject data = new JSONObject(); - int value = callable.call(); - if (value == 0) { - // Null = skip the chart - return null; - } - data.put("value", value); - return data; - } - - } - - /** - * Represents a custom multi line chart. - */ - public static class MultiLineChart extends CustomChart { - - private final Callable> callable; - - /** - * Class constructor. - * - * @param chartId The id of the chart. - * @param callable The callable which is used to request the chart data. - */ - public MultiLineChart(String chartId, Callable> callable) { - super(chartId); - this.callable = callable; - } - - @SuppressWarnings("unchecked") - @Override - protected JSONObject getChartData() throws Exception { - JSONObject data = new JSONObject(); - JSONObject values = new JSONObject(); - Map map = callable.call(); - if (map == null || map.isEmpty()) { - // Null = skip the chart - return null; - } - boolean allSkipped = true; - for (Map.Entry entry : map.entrySet()) { - if (entry.getValue() == 0) { - continue; // Skip this invalid - } - allSkipped = false; - values.put(entry.getKey(), entry.getValue()); - } - if (allSkipped) { - // Null = skip the chart - return null; - } - data.put("values", values); - return data; - } - - } - - /** - * Represents a custom simple bar chart. - */ - public static class SimpleBarChart extends CustomChart { - - private final Callable> callable; - - /** - * Class constructor. - * - * @param chartId The id of the chart. - * @param callable The callable which is used to request the chart data. - */ - public SimpleBarChart(String chartId, Callable> callable) { - super(chartId); - this.callable = callable; - } - - @SuppressWarnings("unchecked") - @Override - protected JSONObject getChartData() throws Exception { - JSONObject data = new JSONObject(); - JSONObject values = new JSONObject(); - Map map = callable.call(); - if (map == null || map.isEmpty()) { - // Null = skip the chart - return null; - } - for (Map.Entry entry : map.entrySet()) { - JSONArray categoryValues = new JSONArray(); - categoryValues.add(entry.getValue()); - values.put(entry.getKey(), categoryValues); - } - data.put("values", values); - return data; - } - - } - - /** - * Represents a custom advanced bar chart. - */ - public static class AdvancedBarChart extends CustomChart { - - private final Callable> callable; - - /** - * Class constructor. - * - * @param chartId The id of the chart. - * @param callable The callable which is used to request the chart data. - */ - public AdvancedBarChart(String chartId, Callable> callable) { - super(chartId); - this.callable = callable; - } - - @SuppressWarnings("unchecked") - @Override - protected JSONObject getChartData() throws Exception { - JSONObject data = new JSONObject(); - JSONObject values = new JSONObject(); - Map map = callable.call(); - if (map == null || map.isEmpty()) { - // Null = skip the chart - return null; - } - boolean allSkipped = true; - for (Map.Entry entry : map.entrySet()) { - if (entry.getValue().length == 0) { - continue; // Skip this invalid - } - allSkipped = false; - JSONArray categoryValues = new JSONArray(); - for (int categoryValue : entry.getValue()) { - categoryValues.add(categoryValue); - } - values.put(entry.getKey(), categoryValues); - } - if (allSkipped) { - // Null = skip the chart - return null; - } - data.put("values", values); - return data; - } - - } +package org.bstats.bukkit; + +import org.bukkit.Bukkit; +import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.entity.Player; +import org.bukkit.plugin.RegisteredServiceProvider; +import org.bukkit.plugin.ServicePriority; +import org.bukkit.plugin.java.JavaPlugin; +import org.json.simple.JSONArray; +import org.json.simple.JSONObject; + +import javax.net.ssl.HttpsURLConnection; +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.net.URL; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Timer; +import java.util.TimerTask; +import java.util.UUID; +import java.util.concurrent.Callable; +import java.util.logging.Level; +import java.util.zip.GZIPOutputStream; + +/** + * bStats collects some data for plugin authors. + * + * Check out https://bStats.org/ to learn more about bStats! + */ +public class Metrics { + + static { + // You can use the property to disable the check in your test environment + if (System.getProperty("bstats.relocatecheck") == null || !System.getProperty("bstats.relocatecheck").equals("false")) { + // Maven's Relocate is clever and changes strings, too. So we have to use this little "trick" ... :D + final String defaultPackage = "org.bstats.bukkit"; + final String examplePackage = ""; + // We want to make sure nobody just copy & pastes the example and use the wrong package names + if (!Metrics.class.getPackage().getName().equals(defaultPackage) && !Metrics.class.getPackage().getName().equals(examplePackage)) { + throw new IllegalStateException("bStats Metrics class has not been relocated correctly!"); + } + } + } + + // The version of this bStats class + public static final int B_STATS_VERSION = 1; + + // The url to which the data is sent + private static final String URL = "https://bStats.org/submitData/bukkit"; + + // Should failed requests be logged? + private static boolean logFailedRequests; + + // The uuid of the server + private static String serverUUID; + + // The plugin + private final JavaPlugin plugin; + + // A list with all custom charts + private final List charts = new ArrayList<>(); + + /** + * Class constructor. + * + * @param plugin The plugin which stats should be submitted. + */ + public Metrics(JavaPlugin plugin) { + if (plugin == null) { + throw new IllegalArgumentException("Plugin cannot be null!"); + } + this.plugin = plugin; + + // Get the config file + File bStatsFolder = new File(plugin.getDataFolder().getParentFile(), "bStats"); + File configFile = new File(bStatsFolder, "config.yml"); + YamlConfiguration config = YamlConfiguration.loadConfiguration(configFile); + + // Check if the config file exists + if (!config.isSet("serverUuid")) { + + // Add default values + config.addDefault("enabled", true); + // Every server gets it's unique random id. + config.addDefault("serverUuid", UUID.randomUUID().toString()); + // Should failed request be logged? + config.addDefault("logFailedRequests", false); + + // Inform the server owners about bStats + config.options().header( + "bStats collects some data for plugin authors like how many servers are using their plugins.\n" + + "To honor their work, you should not disable it.\n" + + "This has nearly no effect on the server performance!\n" + + "Check out https://bStats.org/ to learn more :)" + ).copyDefaults(true); + try { + config.save(configFile); + } catch (IOException ignored) { } + } + + // Load the data + serverUUID = config.getString("serverUuid"); + logFailedRequests = config.getBoolean("logFailedRequests", false); + if (config.getBoolean("enabled", true)) { + boolean found = false; + // Search for all other bStats Metrics classes to see if we are the first one + for (Class service : Bukkit.getServicesManager().getKnownServices()) { + try { + service.getField("B_STATS_VERSION"); // Our identifier :) + found = true; // We aren't the first + break; + } catch (NoSuchFieldException ignored) { } + } + // Register our service + Bukkit.getServicesManager().register(Metrics.class, this, plugin, ServicePriority.Normal); + if (!found) { + // We are the first! + startSubmitting(); + } + } + } + + /** + * Adds a custom chart. + * + * @param chart The chart to add. + */ + public void addCustomChart(CustomChart chart) { + if (chart == null) { + throw new IllegalArgumentException("Chart cannot be null!"); + } + charts.add(chart); + } + + /** + * Starts the Scheduler which submits our data every 30 minutes. + */ + private void startSubmitting() { + final Timer timer = new Timer(true); // We use a timer cause the Bukkit scheduler is affected by server lags + timer.scheduleAtFixedRate(new TimerTask() { + @Override + public void run() { + if (!plugin.isEnabled()) { // Plugin was disabled + timer.cancel(); + return; + } + // Nevertheless we want our code to run in the Bukkit main thread, so we have to use the Bukkit scheduler + // Don't be afraid! The connection to the bStats server is still async, only the stats collection is sync ;) + Bukkit.getScheduler().runTask(plugin, new Runnable() { + @Override + public void run() { + submitData(); + } + }); + } + }, 1000*60*5, 1000*60*30); + // Submit the data every 30 minutes, first time after 5 minutes to give other plugins enough time to start + // WARNING: Changing the frequency has no effect but your plugin WILL be blocked/deleted! + // WARNING: Just don't do it! + } + + /** + * Gets the plugin specific data. + * This method is called using Reflection. + * + * @return The plugin specific data. + */ + @SuppressWarnings("unchecked") + public JSONObject getPluginData() { + JSONObject data = new JSONObject(); + + String pluginName = plugin.getDescription().getName(); + String pluginVersion = plugin.getDescription().getVersion(); + + data.put("pluginName", pluginName); // Append the name of the plugin + data.put("pluginVersion", pluginVersion); // Append the version of the plugin + JSONArray customCharts = new JSONArray(); + for (CustomChart customChart : charts) { + // Add the data of the custom charts + JSONObject chart = customChart.getRequestJsonObject(); + if (chart == null) { // If the chart is null, we skip it + continue; + } + customCharts.add(chart); + } + data.put("customCharts", customCharts); + + return data; + } + + /** + * Gets the server specific data. + * + * @return The server specific data. + */ + @SuppressWarnings("unchecked") + private JSONObject getServerData() { + // Minecraft specific data + int playerAmount; + try { + // Around MC 1.8 the return type was changed to a collection from an array, + // This fixes java.lang.NoSuchMethodError: org.bukkit.Bukkit.getOnlinePlayers()Ljava/util/Collection; + Method onlinePlayersMethod = Class.forName("org.bukkit.Server").getMethod("getOnlinePlayers"); + playerAmount = onlinePlayersMethod.getReturnType().equals(Collection.class) + ? ((Collection) onlinePlayersMethod.invoke(Bukkit.getServer())).size() + : ((Player[]) onlinePlayersMethod.invoke(Bukkit.getServer())).length; + } catch (Exception e) { + playerAmount = Bukkit.getOnlinePlayers().size(); // Just use the new method if the Reflection failed + } + int onlineMode = Bukkit.getOnlineMode() ? 1 : 0; + String bukkitVersion = org.bukkit.Bukkit.getVersion(); + bukkitVersion = bukkitVersion.substring(bukkitVersion.indexOf("MC: ") + 4, bukkitVersion.length() - 1); + + // OS/Java specific data + String javaVersion = System.getProperty("java.version"); + String osName = System.getProperty("os.name"); + String osArch = System.getProperty("os.arch"); + String osVersion = System.getProperty("os.version"); + int coreCount = Runtime.getRuntime().availableProcessors(); + + JSONObject data = new JSONObject(); + + data.put("serverUUID", serverUUID); + + data.put("playerAmount", playerAmount); + data.put("onlineMode", onlineMode); + data.put("bukkitVersion", bukkitVersion); + + data.put("javaVersion", javaVersion); + data.put("osName", osName); + data.put("osArch", osArch); + data.put("osVersion", osVersion); + data.put("coreCount", coreCount); + + return data; + } + + /** + * Collects the data and sends it afterwards. + */ + @SuppressWarnings("unchecked") + private void submitData() { + final JSONObject data = getServerData(); + + JSONArray pluginData = new JSONArray(); + // Search for all other bStats Metrics classes to get their plugin data + for (Class service : Bukkit.getServicesManager().getKnownServices()) { + try { + service.getField("B_STATS_VERSION"); // Our identifier :) + + for (RegisteredServiceProvider provider : Bukkit.getServicesManager().getRegistrations(service)) { + try { + pluginData.add(provider.getService().getMethod("getPluginData").invoke(provider.getProvider())); + } catch (NullPointerException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) { } + } + } catch (NoSuchFieldException ignored) { } + } + + data.put("plugins", pluginData); + + // Create a new thread for the connection to the bStats server + new Thread(new Runnable() { + @Override + public void run() { + try { + // Send the data + sendData(data); + } catch (Exception e) { + // Something went wrong! :( + if (logFailedRequests) { + plugin.getLogger().log(Level.WARNING, "Could not submit plugin stats of " + plugin.getName(), e); + } + } + } + }).start(); + } + + /** + * Sends the data to the bStats server. + * + * @param data The data to send. + * @throws Exception If the request failed. + */ + private static void sendData(JSONObject data) throws Exception { + if (data == null) { + throw new IllegalArgumentException("Data cannot be null!"); + } + if (Bukkit.isPrimaryThread()) { + throw new IllegalAccessException("This method must not be called from the main thread!"); + } + HttpsURLConnection connection = (HttpsURLConnection) new URL(URL).openConnection(); + + // Compress the data to save bandwidth + byte[] compressedData = compress(data.toString()); + + // Add headers + connection.setRequestMethod("POST"); + connection.addRequestProperty("Accept", "application/json"); + connection.addRequestProperty("Connection", "close"); + connection.addRequestProperty("Content-Encoding", "gzip"); // We gzip our request + connection.addRequestProperty("Content-Length", String.valueOf(compressedData.length)); + connection.setRequestProperty("Content-Type", "application/json"); // We send our data in JSON format + connection.setRequestProperty("User-Agent", "MC-Server/" + B_STATS_VERSION); + + // Send data + connection.setDoOutput(true); + DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream()); + outputStream.write(compressedData); + outputStream.flush(); + outputStream.close(); + + connection.getInputStream().close(); // We don't care about the response - Just send our data :) + } + + /** + * Gzips the given String. + * + * @param str The string to gzip. + * @return The gzipped String. + * @throws IOException If the compression failed. + */ + private static byte[] compress(final String str) throws IOException { + if (str == null) { + return null; + } + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + GZIPOutputStream gzip = new GZIPOutputStream(outputStream); + gzip.write(str.getBytes("UTF-8")); + gzip.close(); + return outputStream.toByteArray(); + } + + /** + * Represents a custom chart. + */ + public static abstract class CustomChart { + + // The id of the chart + final String chartId; + + /** + * Class constructor. + * + * @param chartId The id of the chart. + */ + CustomChart(String chartId) { + if (chartId == null || chartId.isEmpty()) { + throw new IllegalArgumentException("ChartId cannot be null or empty!"); + } + this.chartId = chartId; + } + + @SuppressWarnings("unchecked") + private JSONObject getRequestJsonObject() { + JSONObject chart = new JSONObject(); + chart.put("chartId", chartId); + try { + JSONObject data = getChartData(); + if (data == null) { + // If the data is null we don't send the chart. + return null; + } + chart.put("data", data); + } catch (Throwable t) { + if (logFailedRequests) { + Bukkit.getLogger().log(Level.WARNING, "Failed to get data for custom chart with id " + chartId, t); + } + return null; + } + return chart; + } + + protected abstract JSONObject getChartData() throws Exception; + + } + + /** + * Represents a custom simple pie. + */ + public static class SimplePie extends CustomChart { + + private final Callable callable; + + /** + * Class constructor. + * + * @param chartId The id of the chart. + * @param callable The callable which is used to request the chart data. + */ + public SimplePie(String chartId, Callable callable) { + super(chartId); + this.callable = callable; + } + + @SuppressWarnings("unchecked") + @Override + protected JSONObject getChartData() throws Exception { + JSONObject data = new JSONObject(); + String value = callable.call(); + if (value == null || value.isEmpty()) { + // Null = skip the chart + return null; + } + data.put("value", value); + return data; + } + } + + /** + * Represents a custom advanced pie. + */ + public static class AdvancedPie extends CustomChart { + + private final Callable> callable; + + /** + * Class constructor. + * + * @param chartId The id of the chart. + * @param callable The callable which is used to request the chart data. + */ + public AdvancedPie(String chartId, Callable> callable) { + super(chartId); + this.callable = callable; + } + + @SuppressWarnings("unchecked") + @Override + protected JSONObject getChartData() throws Exception { + JSONObject data = new JSONObject(); + JSONObject values = new JSONObject(); + Map map = callable.call(); + if (map == null || map.isEmpty()) { + // Null = skip the chart + return null; + } + boolean allSkipped = true; + for (Map.Entry entry : map.entrySet()) { + if (entry.getValue() == 0) { + continue; // Skip this invalid + } + allSkipped = false; + values.put(entry.getKey(), entry.getValue()); + } + if (allSkipped) { + // Null = skip the chart + return null; + } + data.put("values", values); + return data; + } + } + + /** + * Represents a custom drilldown pie. + */ + public static class DrilldownPie extends CustomChart { + + private final Callable>> callable; + + /** + * Class constructor. + * + * @param chartId The id of the chart. + * @param callable The callable which is used to request the chart data. + */ + public DrilldownPie(String chartId, Callable>> callable) { + super(chartId); + this.callable = callable; + } + + @SuppressWarnings("unchecked") + @Override + public JSONObject getChartData() throws Exception { + JSONObject data = new JSONObject(); + JSONObject values = new JSONObject(); + Map> map = callable.call(); + if (map == null || map.isEmpty()) { + // Null = skip the chart + return null; + } + boolean reallyAllSkipped = true; + for (Map.Entry> entryValues : map.entrySet()) { + JSONObject value = new JSONObject(); + boolean allSkipped = true; + for (Map.Entry valueEntry : map.get(entryValues.getKey()).entrySet()) { + value.put(valueEntry.getKey(), valueEntry.getValue()); + allSkipped = false; + } + if (!allSkipped) { + reallyAllSkipped = false; + values.put(entryValues.getKey(), value); + } + } + if (reallyAllSkipped) { + // Null = skip the chart + return null; + } + data.put("values", values); + return data; + } + } + + /** + * Represents a custom single line chart. + */ + public static class SingleLineChart extends CustomChart { + + private final Callable callable; + + /** + * Class constructor. + * + * @param chartId The id of the chart. + * @param callable The callable which is used to request the chart data. + */ + public SingleLineChart(String chartId, Callable callable) { + super(chartId); + this.callable = callable; + } + + @SuppressWarnings("unchecked") + @Override + protected JSONObject getChartData() throws Exception { + JSONObject data = new JSONObject(); + int value = callable.call(); + if (value == 0) { + // Null = skip the chart + return null; + } + data.put("value", value); + return data; + } + + } + + /** + * Represents a custom multi line chart. + */ + public static class MultiLineChart extends CustomChart { + + private final Callable> callable; + + /** + * Class constructor. + * + * @param chartId The id of the chart. + * @param callable The callable which is used to request the chart data. + */ + public MultiLineChart(String chartId, Callable> callable) { + super(chartId); + this.callable = callable; + } + + @SuppressWarnings("unchecked") + @Override + protected JSONObject getChartData() throws Exception { + JSONObject data = new JSONObject(); + JSONObject values = new JSONObject(); + Map map = callable.call(); + if (map == null || map.isEmpty()) { + // Null = skip the chart + return null; + } + boolean allSkipped = true; + for (Map.Entry entry : map.entrySet()) { + if (entry.getValue() == 0) { + continue; // Skip this invalid + } + allSkipped = false; + values.put(entry.getKey(), entry.getValue()); + } + if (allSkipped) { + // Null = skip the chart + return null; + } + data.put("values", values); + return data; + } + + } + + /** + * Represents a custom simple bar chart. + */ + public static class SimpleBarChart extends CustomChart { + + private final Callable> callable; + + /** + * Class constructor. + * + * @param chartId The id of the chart. + * @param callable The callable which is used to request the chart data. + */ + public SimpleBarChart(String chartId, Callable> callable) { + super(chartId); + this.callable = callable; + } + + @SuppressWarnings("unchecked") + @Override + protected JSONObject getChartData() throws Exception { + JSONObject data = new JSONObject(); + JSONObject values = new JSONObject(); + Map map = callable.call(); + if (map == null || map.isEmpty()) { + // Null = skip the chart + return null; + } + for (Map.Entry entry : map.entrySet()) { + JSONArray categoryValues = new JSONArray(); + categoryValues.add(entry.getValue()); + values.put(entry.getKey(), categoryValues); + } + data.put("values", values); + return data; + } + + } + + /** + * Represents a custom advanced bar chart. + */ + public static class AdvancedBarChart extends CustomChart { + + private final Callable> callable; + + /** + * Class constructor. + * + * @param chartId The id of the chart. + * @param callable The callable which is used to request the chart data. + */ + public AdvancedBarChart(String chartId, Callable> callable) { + super(chartId); + this.callable = callable; + } + + @SuppressWarnings("unchecked") + @Override + protected JSONObject getChartData() throws Exception { + JSONObject data = new JSONObject(); + JSONObject values = new JSONObject(); + Map map = callable.call(); + if (map == null || map.isEmpty()) { + // Null = skip the chart + return null; + } + boolean allSkipped = true; + for (Map.Entry entry : map.entrySet()) { + if (entry.getValue().length == 0) { + continue; // Skip this invalid + } + allSkipped = false; + JSONArray categoryValues = new JSONArray(); + for (int categoryValue : entry.getValue()) { + categoryValues.add(categoryValue); + } + values.put(entry.getKey(), categoryValues); + } + if (allSkipped) { + // Null = skip the chart + return null; + } + data.put("values", values); + return data; + } + + } } \ No newline at end of file diff --git a/WorldSystem/src/main/resources/1_13_gui.yml b/src/main/resources/1_13_gui.yml similarity index 100% rename from WorldSystem/src/main/resources/1_13_gui.yml rename to src/main/resources/1_13_gui.yml diff --git a/WorldSystem/src/main/resources/LICENSE.txt b/src/main/resources/LICENSE.txt similarity index 100% rename from WorldSystem/src/main/resources/LICENSE.txt rename to src/main/resources/LICENSE.txt diff --git a/WorldSystem/src/main/resources/config.yml b/src/main/resources/config.yml similarity index 96% rename from WorldSystem/src/main/resources/config.yml rename to src/main/resources/config.yml index 6ec27c4..3121fc7 100644 --- a/WorldSystem/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -1,105 +1,105 @@ -########################################################################## -### __ __ __ _______ __ ### -### \ \ / / / / / / ___/ / / ### -### \ \ __ / /___ ___/ /___/ / /____ ______/ /______________ ### -### \ \ / \ / / __ \/ _/ / __ /__ / / / / __/ __/ ___/ _ _ / ### -### \ \/ /\ \/ / /_/ / // / /_/ /__/ / /_/ /_ / /_/ ___/ // // / ### -### \__/ \__/\____/_//_/\__,_/____/\__, /___/\__/\___/_//_//_/ ### -### ___/ / ### -### \___/ ### -########################################################################## - -# Path where the worlds will be saved -worldfolder: 'plugins/WorldSystem/Worlds' - -worldtemplates: - # Wheter players can decide on different templates - multi_choose: false - # If multi_choose is disabled, which template should be choosen - default: 'template_default' - templates: - # The "1" can be any key - 1: - # Name of directory in plugins/WorldSystem/worldsources - # e.g. this would be plugins/WorldSystem/worldsources/template_default - name: 'template_default' - 2: - name: 'another_template' - -# If a confirm is needed before auto-update -need_confirm: true - -# When nobody is on a world time until it get unloaded -unloadingtime: 20 - -# If true nobody can teleport or change their gamemode a WorldSystem world -# Except for players with the permissions: ws.gamemode | ws.tp.* -survival: false - -# If true players will teleported to the spawn on join -spawn_teleportation: true - -# Time in seconds until a request expires -request_expires: 20 - -# Name of the languagefile in plugins/WorldSystem/messages/ -language: en - -# Prefix which will be shown before each message -prefix: '&8[&3WorldSystem&8] &6' - -# Time in days after a not used world will be deleted -# Set to -1 to disable -delete_after: -1 - -# Whether WorldSystem should contact the Mojang authserver -# If not, some unknown playernames will not be displayed -# eg. in the gui or in /ws info -contact_authserver: true - -# Options for the LagSystem: -# period_in_seconds - how often will be checked for entities in seconds -# entities_per_world - maximal allowed entities per world -# garbagecollector - how often will be unused ram be cleared -lagsystem: - period_in_seconds: 10 - entities_per_world: 350 - garbagecollector: - use: false - period_in_minutes: 5 - -# Options for random world generation -worldgeneration: - # A seed for worldgeneration - # Set it to 0 for no seed-useage - seed: 0 - # Environment for the world - # Valid inputs are 'NORMAL', 'NETHER' and 'THE_END' - environment: NORMAL - # Type of the world eg. flat, amplified, ... - # Valid types are 'NORMAL', 'VERSION_1_1', 'FLAT', 'AMPLIFIED', 'CUSTOMIZED' or 'LARGE_BIOMES' - type: NORMAL - # Put in here the name of a generator - # If you have one from one plugin - generator: '' - -# Location where you will be teleported when you leave you world -spawn: - gamemode: 2 - spawnpoint: - world: world - x: 0 - y: 20 - z: 0 - yaw: 0 - pitch: 0 - -# Location where you spawn when you join a world -worldspawn: - use: false - spawnpoint: - x: 0 - y: 20 - z: 0 - yaw: 0 - pitch: 0 +########################################################################## +### __ __ __ _______ __ ### +### \ \ / / / / / / ___/ / / ### +### \ \ __ / /___ ___/ /___/ / /____ ______/ /______________ ### +### \ \ / \ / / __ \/ _/ / __ /__ / / / / __/ __/ ___/ _ _ / ### +### \ \/ /\ \/ / /_/ / // / /_/ /__/ / /_/ /_ / /_/ ___/ // // / ### +### \__/ \__/\____/_//_/\__,_/____/\__, /___/\__/\___/_//_//_/ ### +### ___/ / ### +### \___/ ### +########################################################################## + +# Path where the worlds will be saved +worldfolder: 'plugins/WorldSystem/Worlds' + +worldtemplates: + # Wheter players can decide on different templates + multi_choose: false + # If multi_choose is disabled, which template should be choosen + default: 'template_default' + templates: + # The "1" can be any key + 1: + # Name of directory in plugins/WorldSystem/worldsources + # e.g. this would be plugins/WorldSystem/worldsources/template_default + name: 'template_default' + 2: + name: 'another_template' + +# If a confirm is needed before auto-update +need_confirm: true + +# When nobody is on a world time until it get unloaded +unloadingtime: 20 + +# If true nobody can teleport or change their gamemode a WorldSystem world +# Except for players with the permissions: ws.gamemode | ws.tp.* +survival: false + +# If true players will teleported to the spawn on join +spawn_teleportation: true + +# Time in seconds until a request expires +request_expires: 20 + +# Name of the languagefile in plugins/WorldSystem/messages/ +language: en + +# Prefix which will be shown before each message +prefix: '&8[&3WorldSystem&8] &6' + +# Time in days after a not used world will be deleted +# Set to -1 to disable +delete_after: -1 + +# Whether WorldSystem should contact the Mojang authserver +# If not, some unknown playernames will not be displayed +# eg. in the gui or in /ws info +contact_authserver: true + +# Options for the LagSystem: +# period_in_seconds - how often will be checked for entities in seconds +# entities_per_world - maximal allowed entities per world +# garbagecollector - how often will be unused ram be cleared +lagsystem: + period_in_seconds: 10 + entities_per_world: 350 + garbagecollector: + use: false + period_in_minutes: 5 + +# Options for random world generation +worldgeneration: + # A seed for worldgeneration + # Set it to 0 for no seed-useage + seed: 0 + # Environment for the world + # Valid inputs are 'NORMAL', 'NETHER' and 'THE_END' + environment: NORMAL + # Type of the world eg. flat, amplified, ... + # Valid types are 'NORMAL', 'VERSION_1_1', 'FLAT', 'AMPLIFIED', 'CUSTOMIZED' or 'LARGE_BIOMES' + type: NORMAL + # Put in here the name of a generator + # If you have one from one plugin + generator: '' + +# Location where you will be teleported when you leave you world +spawn: + gamemode: 2 + spawnpoint: + world: world + x: 0 + y: 20 + z: 0 + yaw: 0 + pitch: 0 + +# Location where you spawn when you join a world +worldspawn: + use: false + spawnpoint: + x: 0 + y: 20 + z: 0 + yaw: 0 + pitch: 0 diff --git a/WorldSystem/bin/custom.yml b/src/main/resources/custom.yml similarity index 93% rename from WorldSystem/bin/custom.yml rename to src/main/resources/custom.yml index da7de8d..2c3377a 100644 --- a/WorldSystem/bin/custom.yml +++ b/src/main/resources/custom.yml @@ -1,82 +1,82 @@ -nopermission: "" -unknown_error: "" -lagdetection: "%world" -wrong_usage: "" -not_registered: "" - -world: - reseted: "" - still_loaded: "" - not_on: "" - created: "" - already_exists: "" - delete: - own: "" - other: "%player" - does_not_exists: - own: "" - other: "" - setting_up: "" - playerlist: "%players" - still_creating: "" - set_home: "" - -member: - removed: "%player" - added: "%player" - already_added: " - not_added: - own: "" - other: "" - no_one_added - -request: - expired: "" - confirm: "%command" - until_expire: "%time" - already_sent: "" - not_sent: "" - invalid_input: "%input" - -toggle: - gamemode: - enabled: "" - disabled: "" - teleport: - enabled: "" - disabled: "" - build: - enabled: "" - disabled: "" - fire: - enabled: "" - disabled: "" - tnt: - enabled: "" - disabled: "" - -info: - owner: "%data" - id: "%data" - member: "%data" - tnt: "%data" - fire: "%data" - enabled: "" - disabled: "" - -command_help: - list: - - "" - - "" - - "" - - "" - - "" - - "" - - "" - - "" - - "" - - "" - - "" - - "" - - "" +nopermission: "" +unknown_error: "" +lagdetection: "%world" +wrong_usage: "" +not_registered: "" + +world: + reseted: "" + still_loaded: "" + not_on: "" + created: "" + already_exists: "" + delete: + own: "" + other: "%player" + does_not_exists: + own: "" + other: "" + setting_up: "" + playerlist: "%players" + still_creating: "" + set_home: "" + +member: + removed: "%player" + added: "%player" + already_added: " + not_added: + own: "" + other: "" + no_one_added + +request: + expired: "" + confirm: "%command" + until_expire: "%time" + already_sent: "" + not_sent: "" + invalid_input: "%input" + +toggle: + gamemode: + enabled: "" + disabled: "" + teleport: + enabled: "" + disabled: "" + build: + enabled: "" + disabled: "" + fire: + enabled: "" + disabled: "" + tnt: + enabled: "" + disabled: "" + +info: + owner: "%data" + id: "%data" + member: "%data" + tnt: "%data" + fire: "%data" + enabled: "" + disabled: "" + +command_help: + list: + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" delete_command: "" \ No newline at end of file diff --git a/WorldSystem/src/main/resources/de.yml b/src/main/resources/de.yml similarity index 100% rename from WorldSystem/src/main/resources/de.yml rename to src/main/resources/de.yml diff --git a/WorldSystem/src/main/resources/en.yml b/src/main/resources/en.yml similarity index 100% rename from WorldSystem/src/main/resources/en.yml rename to src/main/resources/en.yml diff --git a/WorldSystem/src/main/resources/es.yml b/src/main/resources/es.yml similarity index 97% rename from WorldSystem/src/main/resources/es.yml rename to src/main/resources/es.yml index 6074f1d..0b6941a 100644 --- a/WorldSystem/src/main/resources/es.yml +++ b/src/main/resources/es.yml @@ -1,84 +1,84 @@ -nopermission: "&cNo tienes permiso." -unknown_error: "&cAlgo salio mal..." -lagdetection: "Deteccion de lag en el mundo: &c%world" -wrong_usage: "&c%usage" -not_registered: "&cEse jugador no existe." - -world: - reseted: "Tu mundo ha sido reiniciado." - still_loaded: "&cTu mundo aun esta cargando." - not_on: "&cNo estas en un mundo." - created: "Tu mundo esta listo. Ve a el con &a/ws home&6." - already_exists: "&cYa tienes un mundo." - delete: - own: "&cTu mundo ha sido eliminado" - other: "Has eliminado el mundo de &c%player&6." - does_not_exists: - own: "&cNo tienes un mundo." - other: "&cEse jugador no tiene un mundo." - setting_up: "&aConfigurando el mundo..." - playerlist: "Jugadores en este mundo: %players" - still_creating: "&cWorld is still creating" - set_home: "You set the home" - -member: - removed: "Has eliminado a &c%player&6 de tu mundo." - added: "Has agregado a &c%player&6 a tu mundo." - already_added: "&cEse jugador ya es miembro de tu mundo." - not_added: - own: "&cEse jugador no es miembro de tu mundo." - other: "&cNo estas agregado a este mundo." - no_one_added: "&cThere are no members added" - -request: - expired: "&cTu solicitud ha expirado." - confirm: "&cPor favor confirma el reinicio de tu mundo con: %command" - until_expire: "&cTu solicitud expira en %time segundos." - already_sent: "&cYa has enviado una solicitud." - not_sent: "&cNo has enviado una solicitud." - invalid_input: "&c%input no es una entrada valida." - -toggle: - gamemode: - enabled: "&a%player&6 ahora puede cambiar su modo de juego." - disabled: "&c%player&6 ya no puede cambiar su modo de juego." - teleport: - enabled: "&a%player&6 ahora puede teletransportarse." - disabled: "&c%player&6 ya no puede teletransportarse." - build: - enabled: "&a%player&6 ahora puede construir." - disabled: "&c%player&6 ya no puede construir" - fire: - enabled: "&aHas activado el fuego." - disabled: "&cHas desactivado el fuego." - tnt: - enabled: "&aHas activado la TNT." - disabled: "&cHas desactivado la TNT." - -info: - owner: "Propietario: %data" - id: "ID: %data" - member: "Miembros: %data" - tnt: "TNT: %data" - fire: "Fuego: %data" - enabled: "&aSi" - disabled: "&cNo" - -command_help: - list: - - "/ws get &8- &7Obten tu mundo" - - "/ws home &8- &7Ve a tu mundo" - - "/ws sethome &8- &7Sets a specific home" - - "/ws gui &8- &7Abre el menu de tu mundo" - - "/ws tp &8- &7Ve a un mundo especifico" - - "/ws addmember &8- &7Agrega jugadores a tu mundo" - - "/ws delmember &8- &7Elimina jugadores de tu mundo" - - "/ws leave &8- &7Salir de un mundo" - - "/ws tnt &8- &7Activa/Desactiva la TNT en tu mundo" - - "/ws fire &8- &7Activa/Desactiva el FUEGO en tu mundo" - - "/ws togglegm &8- &7Activa/Desactiva el cambio de modo" - - "/ws togglebuild &8- &7Activa/Desactiva la construccion" - - "/ws toggletp &8- &7Activa/Desactiva la teletransportacion" - - "/ws info &8- &7Muestra informacion del mundo" - - "/ws reset &8- &7Reinicia tu mundo" +nopermission: "&cNo tienes permiso." +unknown_error: "&cAlgo salio mal..." +lagdetection: "Deteccion de lag en el mundo: &c%world" +wrong_usage: "&c%usage" +not_registered: "&cEse jugador no existe." + +world: + reseted: "Tu mundo ha sido reiniciado." + still_loaded: "&cTu mundo aun esta cargando." + not_on: "&cNo estas en un mundo." + created: "Tu mundo esta listo. Ve a el con &a/ws home&6." + already_exists: "&cYa tienes un mundo." + delete: + own: "&cTu mundo ha sido eliminado" + other: "Has eliminado el mundo de &c%player&6." + does_not_exists: + own: "&cNo tienes un mundo." + other: "&cEse jugador no tiene un mundo." + setting_up: "&aConfigurando el mundo..." + playerlist: "Jugadores en este mundo: %players" + still_creating: "&cWorld is still creating" + set_home: "You set the home" + +member: + removed: "Has eliminado a &c%player&6 de tu mundo." + added: "Has agregado a &c%player&6 a tu mundo." + already_added: "&cEse jugador ya es miembro de tu mundo." + not_added: + own: "&cEse jugador no es miembro de tu mundo." + other: "&cNo estas agregado a este mundo." + no_one_added: "&cThere are no members added" + +request: + expired: "&cTu solicitud ha expirado." + confirm: "&cPor favor confirma el reinicio de tu mundo con: %command" + until_expire: "&cTu solicitud expira en %time segundos." + already_sent: "&cYa has enviado una solicitud." + not_sent: "&cNo has enviado una solicitud." + invalid_input: "&c%input no es una entrada valida." + +toggle: + gamemode: + enabled: "&a%player&6 ahora puede cambiar su modo de juego." + disabled: "&c%player&6 ya no puede cambiar su modo de juego." + teleport: + enabled: "&a%player&6 ahora puede teletransportarse." + disabled: "&c%player&6 ya no puede teletransportarse." + build: + enabled: "&a%player&6 ahora puede construir." + disabled: "&c%player&6 ya no puede construir" + fire: + enabled: "&aHas activado el fuego." + disabled: "&cHas desactivado el fuego." + tnt: + enabled: "&aHas activado la TNT." + disabled: "&cHas desactivado la TNT." + +info: + owner: "Propietario: %data" + id: "ID: %data" + member: "Miembros: %data" + tnt: "TNT: %data" + fire: "Fuego: %data" + enabled: "&aSi" + disabled: "&cNo" + +command_help: + list: + - "/ws get &8- &7Obten tu mundo" + - "/ws home &8- &7Ve a tu mundo" + - "/ws sethome &8- &7Sets a specific home" + - "/ws gui &8- &7Abre el menu de tu mundo" + - "/ws tp &8- &7Ve a un mundo especifico" + - "/ws addmember &8- &7Agrega jugadores a tu mundo" + - "/ws delmember &8- &7Elimina jugadores de tu mundo" + - "/ws leave &8- &7Salir de un mundo" + - "/ws tnt &8- &7Activa/Desactiva la TNT en tu mundo" + - "/ws fire &8- &7Activa/Desactiva el FUEGO en tu mundo" + - "/ws togglegm &8- &7Activa/Desactiva el cambio de modo" + - "/ws togglebuild &8- &7Activa/Desactiva la construccion" + - "/ws toggletp &8- &7Activa/Desactiva la teletransportacion" + - "/ws info &8- &7Muestra informacion del mundo" + - "/ws reset &8- &7Reinicia tu mundo" delete_command: "/ws delete &8- &7Elimina tu mundo" \ No newline at end of file diff --git a/WorldSystem/src/main/resources/fi.yml b/src/main/resources/fi.yml similarity index 97% rename from WorldSystem/src/main/resources/fi.yml rename to src/main/resources/fi.yml index 86ba97c..0497c7a 100644 --- a/WorldSystem/src/main/resources/fi.yml +++ b/src/main/resources/fi.yml @@ -1,84 +1,84 @@ -nopermission: "&cSinulla ei ole lupaa tuohon komentoon!" -unknown_error: "&cJotain meni pieleen..." -lagdetection: "Lagia havaittu maailmassa: &c%world" -wrong_usage: "&c%usage" -not_registered: "&cTämä pelaaja ei ole liittynyt vielä!" - -world: - reseted: "Maailmasi nollautui!" - still_loaded: "&cMailmasi on vieläkin ladattu!" - not_on: "&cEt ole maailmassa!" - created: "Maailmasi on nyt valmis. Pääset sinne komennolla &a/ws home" - already_exists: "&cSinulla on jo maailma!" - delete: - own: "&cMaailmasi poistettiin!" - other: "Poistit pelaajan &c%player&6 maailman&6!" - does_not_exists: - own: "&cSinulla ei ole maailmaa!" - other: "&cKyseisellä pelaajalla ei ole maailmaa!" - setting_up: "&aAlustetaan maailmaa..." - playerlist: "Pelaajat tässä maailmassa: %players" - still_creating: "&cWorld is still creating" - set_home: "You set the home" - -member: - removed: "Poistit pelaajan &c%player&6 maailmastasi!" - added: "Lisäsit pelaajan &c%player&6 maailmaasi!" - already_added: "&cKyseinen pelaaja on jo jäsen!" - not_added: - own: "&cKyseinen pelaaja ei ole jäsen!" - other: "&cSinua ei ole lisätty tähän maailmaan" - no_one_added: "&cThere are no members added" - -request: - expired: "&cPyyntösi on vanhentunut!" - confirm: "&cVahvista maailmasi nollaaminen: %command" - until_expire: "&cPyyntösi vanhentuu %time seconds sekunnin kuluttua!" - already_sent: "&cLähetit jo pyynnön!" - not_sent: "&cEt lähettänyt pyyntöä!" - invalid_input: "&cSyöte ei ole kelvollinen!" - -toggle: - gamemode: - enabled: "&a%player&6 voi nyt vaihtaa pelimuotonsa!" - disabled: "&c%player&6 ei voi enää vaihtaa pelimuotoansa!" - teleport: - enabled: "&a%player&6 voi nyt teleportata!" - disabled: "&c%player&6 ei voi enään teleportata!" - build: - enabled: "&a%player&6 voi nyt rakentaa!" - disabled: "&c%player&6 ei voi enään rakentaa!" - fire: - enabled: "&aSinä aktivoit tulen!" - disabled: "&cSinä deaktivoit tulen!" - tnt: - enabled: "&aSinä aktivoit TNT-Damagen!" - disabled: "&cSinä deaktivoit TNT-Damagen!" - -info: - owner: "Omistaja: %data" - id: "ID: %data" - member: "Jäsen: %data" - tnt: "TNT: %data" - fire: "Tuli: %data" - enabled: "&aOn" - disabled: "&cOff" - -command_help: - list: - - "/ws get &8- &7Luo sinulle maailman" - - "/ws home &8- &7Teleporttaa sinut maailmaasi" - - "/ws sethome &8- &7Sets a specific home" - - "/ws gui &8- &7Avaa sinulle valikon jos omistat tämän maailman" - - "/ws tp &8- &7Teleporttaa sinut tiettyyn maailmaan" - - "/ws addmember &8- &7Lisää pelaajan sinun maailmaasi" - - "/ws delmember &8- &7Poistaa pelaajan sinun maailmastasi" - - "/ws leave &8- &7Lähtee maailmasta" - - "/ws tnt &8- &7Sallii/Kieltää TNT sinun maailmastasi" - - "/ws fire &8- &7Sallii/Kieltää Tulen sinun maailmastasi" - - "/ws togglegm &8- &7Sallii/Kieltää pelaajan vaihtamasta pelimuotoansa" - - "/ws togglebuild &8- &7Sallii/Kieltää pelaajan rakentamasta" - - "/ws toggletp &8- &7Sallii/Kieltää pelaajan treleporttaamasta" - - "/ws info &8- &7Näyttää tietoa aktiivisesta maailmasta" - - "/ws reset &8- &7Nollaa sinun maailmasi" +nopermission: "&cSinulla ei ole lupaa tuohon komentoon!" +unknown_error: "&cJotain meni pieleen..." +lagdetection: "Lagia havaittu maailmassa: &c%world" +wrong_usage: "&c%usage" +not_registered: "&cTämä pelaaja ei ole liittynyt vielä!" + +world: + reseted: "Maailmasi nollautui!" + still_loaded: "&cMailmasi on vieläkin ladattu!" + not_on: "&cEt ole maailmassa!" + created: "Maailmasi on nyt valmis. Pääset sinne komennolla &a/ws home" + already_exists: "&cSinulla on jo maailma!" + delete: + own: "&cMaailmasi poistettiin!" + other: "Poistit pelaajan &c%player&6 maailman&6!" + does_not_exists: + own: "&cSinulla ei ole maailmaa!" + other: "&cKyseisellä pelaajalla ei ole maailmaa!" + setting_up: "&aAlustetaan maailmaa..." + playerlist: "Pelaajat tässä maailmassa: %players" + still_creating: "&cWorld is still creating" + set_home: "You set the home" + +member: + removed: "Poistit pelaajan &c%player&6 maailmastasi!" + added: "Lisäsit pelaajan &c%player&6 maailmaasi!" + already_added: "&cKyseinen pelaaja on jo jäsen!" + not_added: + own: "&cKyseinen pelaaja ei ole jäsen!" + other: "&cSinua ei ole lisätty tähän maailmaan" + no_one_added: "&cThere are no members added" + +request: + expired: "&cPyyntösi on vanhentunut!" + confirm: "&cVahvista maailmasi nollaaminen: %command" + until_expire: "&cPyyntösi vanhentuu %time seconds sekunnin kuluttua!" + already_sent: "&cLähetit jo pyynnön!" + not_sent: "&cEt lähettänyt pyyntöä!" + invalid_input: "&cSyöte ei ole kelvollinen!" + +toggle: + gamemode: + enabled: "&a%player&6 voi nyt vaihtaa pelimuotonsa!" + disabled: "&c%player&6 ei voi enää vaihtaa pelimuotoansa!" + teleport: + enabled: "&a%player&6 voi nyt teleportata!" + disabled: "&c%player&6 ei voi enään teleportata!" + build: + enabled: "&a%player&6 voi nyt rakentaa!" + disabled: "&c%player&6 ei voi enään rakentaa!" + fire: + enabled: "&aSinä aktivoit tulen!" + disabled: "&cSinä deaktivoit tulen!" + tnt: + enabled: "&aSinä aktivoit TNT-Damagen!" + disabled: "&cSinä deaktivoit TNT-Damagen!" + +info: + owner: "Omistaja: %data" + id: "ID: %data" + member: "Jäsen: %data" + tnt: "TNT: %data" + fire: "Tuli: %data" + enabled: "&aOn" + disabled: "&cOff" + +command_help: + list: + - "/ws get &8- &7Luo sinulle maailman" + - "/ws home &8- &7Teleporttaa sinut maailmaasi" + - "/ws sethome &8- &7Sets a specific home" + - "/ws gui &8- &7Avaa sinulle valikon jos omistat tämän maailman" + - "/ws tp &8- &7Teleporttaa sinut tiettyyn maailmaan" + - "/ws addmember &8- &7Lisää pelaajan sinun maailmaasi" + - "/ws delmember &8- &7Poistaa pelaajan sinun maailmastasi" + - "/ws leave &8- &7Lähtee maailmasta" + - "/ws tnt &8- &7Sallii/Kieltää TNT sinun maailmastasi" + - "/ws fire &8- &7Sallii/Kieltää Tulen sinun maailmastasi" + - "/ws togglegm &8- &7Sallii/Kieltää pelaajan vaihtamasta pelimuotoansa" + - "/ws togglebuild &8- &7Sallii/Kieltää pelaajan rakentamasta" + - "/ws toggletp &8- &7Sallii/Kieltää pelaajan treleporttaamasta" + - "/ws info &8- &7Näyttää tietoa aktiivisesta maailmasta" + - "/ws reset &8- &7Nollaa sinun maailmasi" delete_command: "/ws delete &8- &7Poistaa maailman" \ No newline at end of file diff --git a/WorldSystem/src/main/resources/fr.yml b/src/main/resources/fr.yml similarity index 100% rename from WorldSystem/src/main/resources/fr.yml rename to src/main/resources/fr.yml diff --git a/WorldSystem/bin/hu.yml b/src/main/resources/hu.yml similarity index 97% rename from WorldSystem/bin/hu.yml rename to src/main/resources/hu.yml index 8b5fcbe..0608722 100644 --- a/WorldSystem/bin/hu.yml +++ b/src/main/resources/hu.yml @@ -1,85 +1,85 @@ -nopermission: "&cNincs jogod ehhez!" -unknown_error: "&cValami elromlott..." -lagdetection: "Lagdetection a vilgban: &c%world" -wrong_usage: "&c%usage" -not_registered: "&cEz a jtkos mg nem csatlakozott!" - -world: - reseted: "A vilgod vissza lett lltva!" - still_loaded: "&cA vilgod mg mindig be van tltve!" - not_on: "&cNem vagy a vilgon!" - created: "A vilgod kszen ll. Szllj fel a &a/ws home" - already_exists: "&cMr van vilgod!" - delete: - own: "&cA vilgot trlve!" - other: "Trlte a vilgot &c%player&6 jtkostl!" - does_not_exists: - own: "&cNincs vilgod!" - other: "&cEz a jtkos nem rendelkezik vilggal!" - setting_up: "&aA vilg megteremtse..." - playerlist: "Jtkos ebben a vilgban: %player" - still_creating: "&cWorld is still creating" - set_home: "You set the home" - -member: - removed: "Trlted &c%player&6 jtkost a vilgodbl!" - added: "Hozzadtad &c%player&6 jtkost a vilgodhoz!" - already_added: "&cEz a jtkos mr tagja!" - not_added: - own: "&cEz a jtkos nem tagja!" - other: "&cNem vagy hozzadva ehhez a vilghoz" - still_creating: "&cWorld is still creating" - no_one_added: "&cThere are no members added" - -request: - expired: "&cA krelem lejrt!" - confirm: "&cKrjk, erstsd meg a vilg jraindtst: %command" - until_expire: "&cA krs lejrati ideje %time msodperc!" - already_sent: "&cMr elkldtl egy krelmet!" - not_sent: "&cNem kldtl krst!" - invalid_input: "&c%input nem rvnyes bemenet!" - -toggle: - gamemode: - enabled: "&a%player&6 most megvltoztathatja jtkmdjt!" - disabled: "&c%player&6 mr nem tudja megvltoztatni jtkmdjt!" - teleport: - enabled: "&a%player&6 most teleportlhat!" - disabled: "&c%player&6 mr nem teleportlhat!" - build: - enabled: "&a%player&6 most pthet!" - disabled: "&c%player&6 mr nem pthet!" - fire: - enabled: "&aAktivltad a tzet!" - disabled: "&cDeaktivltad a tzet!" - tnt: - enabled: "&aAktivltad a TNT-sebzst!" - disabled: "&cDeaktivltad TNT-sebzst!" - -info: - owner: "Tulajdonos: %data" - id: "ID: %data" - member: "Tag: %data" - tnt: "TNT: %data" - fire: "Tz: %data" - enabled: "&aBe" - disabled: "&cKi" - -command_help: - list: - - "/ws get &8- &7Will give you a world" - - "/ws home &8- &7Teleports you on your world" - - "/ws sethome &8- &7Sets a specific home" - - "/ws gui &8- &7Opens the GUI menu if you are the worldowner" - - "/ws tp &8- &7Teleports you on a specific world" - - "/ws addmember &8- &7Adds a player to your world" - - "/ws delmember &8- &7Removes a player from your world" - - "/ws leave &8- &7Leave a world" - - "/ws tnt &8- &7Allows/Denys TNT on your world" - - "/ws fire &8- &7Allows/Denys Fire on your world" - - "/ws togglegm &8- &7Allows/Denys a player changing gamemode" - - "/ws togglebuild &8- &7Allows/Denys a player building" - - "/ws toggletp &8- &7Allows/Denys a player teleporting" - - "/ws info &8- &7Shows information about the world" - - "/ws reset &8- &7Will reset your world" +nopermission: "&cNincs jogod ehhez!" +unknown_error: "&cValami elromlott..." +lagdetection: "Lagdetection a vilgban: &c%world" +wrong_usage: "&c%usage" +not_registered: "&cEz a jtkos mg nem csatlakozott!" + +world: + reseted: "A vilgod vissza lett lltva!" + still_loaded: "&cA vilgod mg mindig be van tltve!" + not_on: "&cNem vagy a vilgon!" + created: "A vilgod kszen ll. Szllj fel a &a/ws home" + already_exists: "&cMr van vilgod!" + delete: + own: "&cA vilgot trlve!" + other: "Trlte a vilgot &c%player&6 jtkostl!" + does_not_exists: + own: "&cNincs vilgod!" + other: "&cEz a jtkos nem rendelkezik vilggal!" + setting_up: "&aA vilg megteremtse..." + playerlist: "Jtkos ebben a vilgban: %player" + still_creating: "&cWorld is still creating" + set_home: "You set the home" + +member: + removed: "Trlted &c%player&6 jtkost a vilgodbl!" + added: "Hozzadtad &c%player&6 jtkost a vilgodhoz!" + already_added: "&cEz a jtkos mr tagja!" + not_added: + own: "&cEz a jtkos nem tagja!" + other: "&cNem vagy hozzadva ehhez a vilghoz" + still_creating: "&cWorld is still creating" + no_one_added: "&cThere are no members added" + +request: + expired: "&cA krelem lejrt!" + confirm: "&cKrjk, erstsd meg a vilg jraindtst: %command" + until_expire: "&cA krs lejrati ideje %time msodperc!" + already_sent: "&cMr elkldtl egy krelmet!" + not_sent: "&cNem kldtl krst!" + invalid_input: "&c%input nem rvnyes bemenet!" + +toggle: + gamemode: + enabled: "&a%player&6 most megvltoztathatja jtkmdjt!" + disabled: "&c%player&6 mr nem tudja megvltoztatni jtkmdjt!" + teleport: + enabled: "&a%player&6 most teleportlhat!" + disabled: "&c%player&6 mr nem teleportlhat!" + build: + enabled: "&a%player&6 most pthet!" + disabled: "&c%player&6 mr nem pthet!" + fire: + enabled: "&aAktivltad a tzet!" + disabled: "&cDeaktivltad a tzet!" + tnt: + enabled: "&aAktivltad a TNT-sebzst!" + disabled: "&cDeaktivltad TNT-sebzst!" + +info: + owner: "Tulajdonos: %data" + id: "ID: %data" + member: "Tag: %data" + tnt: "TNT: %data" + fire: "Tz: %data" + enabled: "&aBe" + disabled: "&cKi" + +command_help: + list: + - "/ws get &8- &7Will give you a world" + - "/ws home &8- &7Teleports you on your world" + - "/ws sethome &8- &7Sets a specific home" + - "/ws gui &8- &7Opens the GUI menu if you are the worldowner" + - "/ws tp &8- &7Teleports you on a specific world" + - "/ws addmember &8- &7Adds a player to your world" + - "/ws delmember &8- &7Removes a player from your world" + - "/ws leave &8- &7Leave a world" + - "/ws tnt &8- &7Allows/Denys TNT on your world" + - "/ws fire &8- &7Allows/Denys Fire on your world" + - "/ws togglegm &8- &7Allows/Denys a player changing gamemode" + - "/ws togglebuild &8- &7Allows/Denys a player building" + - "/ws toggletp &8- &7Allows/Denys a player teleporting" + - "/ws info &8- &7Shows information about the world" + - "/ws reset &8- &7Will reset your world" delete_command: "/ws delete &8- &7Will delete a world" \ No newline at end of file diff --git a/WorldSystem/bin/nl.yml b/src/main/resources/nl.yml similarity index 97% rename from WorldSystem/bin/nl.yml rename to src/main/resources/nl.yml index 6c27605..532ad1a 100644 --- a/WorldSystem/bin/nl.yml +++ b/src/main/resources/nl.yml @@ -1,84 +1,84 @@ -nopermission: "&cJij hebt geen rechten om dit te doen!" -unknown_error: "&cEr is iets verkeerd gegaan.." -lagdetection: "Lag gededecteerd in wereld: &c%world" -wrong_usage: "&c%gebruik" -not_registered: "&cDeze speler heeft nog nooit gejoined!" - -world: - reseted: "Jouw wereld is gereset!" - still_loaded: "&cJouw wereld is nog steeds geladen!" - not_on: "&cJij bent niet in een wereld!" - created: "Jouw wereld is gemaakt gebruik: &a/ws home" - already_exists: "&cJij hebt al een wereld!" - delete: - own: "&cJouw wereld is verwijderd!" - other: "Jij hebt de wereld verwijderd van: &c%player&6!" - does_not_exists: - own: "&cJij hebt nog geen wereld!" - other: "&cDeze speler heeft nog geen wereld!" - setting_up: "&aWereld word aangemaakt" - playerlist: "speler is in wereld: %players" - still_creating: "&cWorld is still creating" - set_home: "You set the home" - -member: - removed: "Jij hebt &c%player&6 verwijderd van jouw wereld!" - added: "Jij hebt &c%player&6 toegevoegd aan jouw wereld!" - already_added: "&cDeze speler is al toegevoegd!" - not_added: - own: "&cDeze speler is nog niet toegevoegd!" - other: "&cJij bent niet aan deze wereld toegevoegd" - no_one_added: "&cThere are no members added" - -request: - expired: "&cJouw uitnodiging is verlopen!" - confirm: "&cBevestig het verwijderen van jouw wereld: %command" - until_expire: "&cJouw uitnodiging verloopt over %time seconden!" - already_sent: "&cJij hebt al een uitnodiging verstuurd!" - not_sent: "&cJij hebt geen uitnodiging gestuurd!" - invalid_input: "&c%input is niet een command!" - -toggle: - gamemode: - enabled: "&a%player&6 kan nu zijn spelermodus veranderen!" - disabled: "&c%player&6 kan niet meer zijn spelermodus veranderen!" - teleport: - enabled: "&a%player&6 kan nu teleporteren!" - disabled: "&c%player&6 kan nu niet meer teleporteren!" - build: - enabled: "&a%player&6 kan nu bouwen!" - disabled: "&c%player&6 kan nu niet meer bouwen!" - fire: - enabled: "&aJij hebt vuur geactiveert!" - disabled: "&cJij hebt vuur gedeactiveerd!" - tnt: - enabled: "&aJij hebt TNT-schade geactiveerd!" - disabled: "&cJij hebt TNT-schade gedeactiveerd!" - -info: - owner: "Owner: %data" - id: "ID: %data" - member: "Toegevoegd: %data" - tnt: "TNT: %data" - fire: "Vuur: %data" - enabled: "&Aan" - disabled: "&cUit" - -command_help: - list: - - "/ws get &8- &7Will give you a world" - - "/ws home &8- &7Teleports you on your world" - - "/ws sethome &8- &7Sets a specific home" - - "/ws gui &8- &7Opens the GUI menu if you are the worldowner" - - "/ws tp &8- &7Teleports you on a specific world" - - "/ws addmember &8- &7Adds a player to your world" - - "/ws delmember &8- &7Removes a player from your world" - - "/ws leave &8- &7Leave a world" - - "/ws tnt &8- &7Allows/Denys TNT on your world" - - "/ws fire &8- &7Allows/Denys Fire on your world" - - "/ws togglegm &8- &7Allows/Denys a player changing gamemode" - - "/ws togglebuild &8- &7Allows/Denys a player building" - - "/ws toggletp &8- &7Allows/Denys a player teleporting" - - "/ws info &8- &7Shows information about the world" - - "/ws reset &8- &7Will reset your world" +nopermission: "&cJij hebt geen rechten om dit te doen!" +unknown_error: "&cEr is iets verkeerd gegaan.." +lagdetection: "Lag gededecteerd in wereld: &c%world" +wrong_usage: "&c%gebruik" +not_registered: "&cDeze speler heeft nog nooit gejoined!" + +world: + reseted: "Jouw wereld is gereset!" + still_loaded: "&cJouw wereld is nog steeds geladen!" + not_on: "&cJij bent niet in een wereld!" + created: "Jouw wereld is gemaakt gebruik: &a/ws home" + already_exists: "&cJij hebt al een wereld!" + delete: + own: "&cJouw wereld is verwijderd!" + other: "Jij hebt de wereld verwijderd van: &c%player&6!" + does_not_exists: + own: "&cJij hebt nog geen wereld!" + other: "&cDeze speler heeft nog geen wereld!" + setting_up: "&aWereld word aangemaakt" + playerlist: "speler is in wereld: %players" + still_creating: "&cWorld is still creating" + set_home: "You set the home" + +member: + removed: "Jij hebt &c%player&6 verwijderd van jouw wereld!" + added: "Jij hebt &c%player&6 toegevoegd aan jouw wereld!" + already_added: "&cDeze speler is al toegevoegd!" + not_added: + own: "&cDeze speler is nog niet toegevoegd!" + other: "&cJij bent niet aan deze wereld toegevoegd" + no_one_added: "&cThere are no members added" + +request: + expired: "&cJouw uitnodiging is verlopen!" + confirm: "&cBevestig het verwijderen van jouw wereld: %command" + until_expire: "&cJouw uitnodiging verloopt over %time seconden!" + already_sent: "&cJij hebt al een uitnodiging verstuurd!" + not_sent: "&cJij hebt geen uitnodiging gestuurd!" + invalid_input: "&c%input is niet een command!" + +toggle: + gamemode: + enabled: "&a%player&6 kan nu zijn spelermodus veranderen!" + disabled: "&c%player&6 kan niet meer zijn spelermodus veranderen!" + teleport: + enabled: "&a%player&6 kan nu teleporteren!" + disabled: "&c%player&6 kan nu niet meer teleporteren!" + build: + enabled: "&a%player&6 kan nu bouwen!" + disabled: "&c%player&6 kan nu niet meer bouwen!" + fire: + enabled: "&aJij hebt vuur geactiveert!" + disabled: "&cJij hebt vuur gedeactiveerd!" + tnt: + enabled: "&aJij hebt TNT-schade geactiveerd!" + disabled: "&cJij hebt TNT-schade gedeactiveerd!" + +info: + owner: "Owner: %data" + id: "ID: %data" + member: "Toegevoegd: %data" + tnt: "TNT: %data" + fire: "Vuur: %data" + enabled: "&Aan" + disabled: "&cUit" + +command_help: + list: + - "/ws get &8- &7Will give you a world" + - "/ws home &8- &7Teleports you on your world" + - "/ws sethome &8- &7Sets a specific home" + - "/ws gui &8- &7Opens the GUI menu if you are the worldowner" + - "/ws tp &8- &7Teleports you on a specific world" + - "/ws addmember &8- &7Adds a player to your world" + - "/ws delmember &8- &7Removes a player from your world" + - "/ws leave &8- &7Leave a world" + - "/ws tnt &8- &7Allows/Denys TNT on your world" + - "/ws fire &8- &7Allows/Denys Fire on your world" + - "/ws togglegm &8- &7Allows/Denys a player changing gamemode" + - "/ws togglebuild &8- &7Allows/Denys a player building" + - "/ws toggletp &8- &7Allows/Denys a player teleporting" + - "/ws info &8- &7Shows information about the world" + - "/ws reset &8- &7Will reset your world" delete_command: "/ws delete &8- &7Will delete a world" \ No newline at end of file diff --git a/WorldSystem/src/main/resources/old_gui.yml b/src/main/resources/old_gui.yml similarity index 100% rename from WorldSystem/src/main/resources/old_gui.yml rename to src/main/resources/old_gui.yml diff --git a/WorldSystem/src/main/resources/pl.yml b/src/main/resources/pl.yml similarity index 97% rename from WorldSystem/src/main/resources/pl.yml rename to src/main/resources/pl.yml index 1efe5cf..2b2c6e2 100644 --- a/WorldSystem/src/main/resources/pl.yml +++ b/src/main/resources/pl.yml @@ -1,84 +1,84 @@ -nopermission: "&cNie posiadasz uprawnień do tego!" -unknown_error: "&cCoś poszło nie tak..." -lagdetection: "Wykryto laga na świecie: &c%world" -wrong_usage: "&c%usage" -not_registered: "&cTen gracz nie dołączył jeszcze na serwer!" - -world: - reseted: "Twój świat został zresetowany!" - still_loaded: "&cTwój serwer wciąż się ładuje!" - not_on: "&cNie jesteś na swoim świecie!" - created: "Twój świat jest gotowy. Dostań się na niego za pomocą &a/ws home" - already_exists: "&cJuż posiadasz swój świat!" - delete: - own: "&cTwój świat został skasowany!" - other: "Usunąłeś świat gracza: &c%player&6!" - does_not_exists: - own: "&cNie masz swojego świata!" - other: "&cTen gracz nie ma swojego świata!" - setting_up: "&aUstawianie świata..." - playerlist: "Gracze na tym świecie: %players" - still_creating: "&cWorld is still creating" - set_home: "You set the home" - -member: - removed: "Usunąłeś &c%player&6 ze swojego świata!" - added: "Dodałeś &c%player&6 na swój świat!" - already_added: "&cTen gracz jest już dodany na Twoim świecie!" - not_added: - own: "&cTen gracz nie jest dodany do Twojego świata!" - other: "&cNie jesteś dodany na ten świat!" - no_one_added: "&cThere are no members added" - -request: - expired: "&cTwoja prośba wygasła!" - confirm: "&cPotwierdź zresetowanie swojego świata komendą: %command" - until_expire: "&cTwója prośba wygaśnie za %time sek.!" - already_sent: "&cJuż wysłałeś prośbę!" - not_sent: "&cNie wysłałeś prośby!" - invalid_input: "&c%input nie jest poprawnym argumentem komendy!" - -toggle: - gamemode: - enabled: "&a%player&6 może teraz zmienić swój gamemode!" - disabled: "&c%player&6 nie może już zmienić swojego gamemode!" - teleport: - enabled: "&a%player&6 może teleportować się!" - disabled: "&c%player&6 nie może teleportować się!" - build: - enabled: "&a%player&6 może budować!" - disabled: "&c%player&6 nie może już budować!" - fire: - enabled: "&aWłączyłeś ogień!" - disabled: "&cWyłączyłeś ogień!" - tnt: - enabled: "&aWłączyłeś obrażenia od TNT!" - disabled: "&cWyłączyłeś obrażenia od TNT!" - -info: - owner: "Właściciel: %data" - id: "ID: %data" - member: "Członek: %data" - tnt: "TNT: %data" - fire: "Ogień: %data" - enabled: "&aWłączone" - disabled: "&cWyłączone" - -command_help: - list: - - "/ws get &8- &7Tworzy Twój świat" - - "/ws home &8- &7Teleportuje Cie na Twój świat" - - "/ws sethome &8- &7Sets a specific home" - - "/ws gui &8- &7Otwiera GUI świata jeżeli jesteś jego właścicielem" - - "/ws tp &8- &7Teleportuje Cie na określony świat" - - "/ws addmember &8- &7Dodaj gracza na swój świat" - - "/ws delmember &8- &7Usuń gracza ze swojego świata" - - "/ws leave &8- &7Opuść świat" - - "/ws tnt &8- &7Zezwól/Odmów TNT na swoim świecie" - - "/ws fire &8- &7Zezwól/Odmów Ogień na swoim świecie" - - "/ws togglegm &8- &7Zezwól/Odmów graczowi zmieniać swój gamemode" - - "/ws togglebuild &8- &7Zezwól/Odmów graczowi budowanie" - - "/ws toggletp &8- &7Zezwól/Odmów graczowi teleportowanie się" - - "/ws info &8- &7Pokazuje informacje o świecie" - - "/ws reset &8- &7Zresetuje Twój świat" +nopermission: "&cNie posiadasz uprawnień do tego!" +unknown_error: "&cCoś poszło nie tak..." +lagdetection: "Wykryto laga na świecie: &c%world" +wrong_usage: "&c%usage" +not_registered: "&cTen gracz nie dołączył jeszcze na serwer!" + +world: + reseted: "Twój świat został zresetowany!" + still_loaded: "&cTwój serwer wciąż się ładuje!" + not_on: "&cNie jesteś na swoim świecie!" + created: "Twój świat jest gotowy. Dostań się na niego za pomocą &a/ws home" + already_exists: "&cJuż posiadasz swój świat!" + delete: + own: "&cTwój świat został skasowany!" + other: "Usunąłeś świat gracza: &c%player&6!" + does_not_exists: + own: "&cNie masz swojego świata!" + other: "&cTen gracz nie ma swojego świata!" + setting_up: "&aUstawianie świata..." + playerlist: "Gracze na tym świecie: %players" + still_creating: "&cWorld is still creating" + set_home: "You set the home" + +member: + removed: "Usunąłeś &c%player&6 ze swojego świata!" + added: "Dodałeś &c%player&6 na swój świat!" + already_added: "&cTen gracz jest już dodany na Twoim świecie!" + not_added: + own: "&cTen gracz nie jest dodany do Twojego świata!" + other: "&cNie jesteś dodany na ten świat!" + no_one_added: "&cThere are no members added" + +request: + expired: "&cTwoja prośba wygasła!" + confirm: "&cPotwierdź zresetowanie swojego świata komendą: %command" + until_expire: "&cTwója prośba wygaśnie za %time sek.!" + already_sent: "&cJuż wysłałeś prośbę!" + not_sent: "&cNie wysłałeś prośby!" + invalid_input: "&c%input nie jest poprawnym argumentem komendy!" + +toggle: + gamemode: + enabled: "&a%player&6 może teraz zmienić swój gamemode!" + disabled: "&c%player&6 nie może już zmienić swojego gamemode!" + teleport: + enabled: "&a%player&6 może teleportować się!" + disabled: "&c%player&6 nie może teleportować się!" + build: + enabled: "&a%player&6 może budować!" + disabled: "&c%player&6 nie może już budować!" + fire: + enabled: "&aWłączyłeś ogień!" + disabled: "&cWyłączyłeś ogień!" + tnt: + enabled: "&aWłączyłeś obrażenia od TNT!" + disabled: "&cWyłączyłeś obrażenia od TNT!" + +info: + owner: "Właściciel: %data" + id: "ID: %data" + member: "Członek: %data" + tnt: "TNT: %data" + fire: "Ogień: %data" + enabled: "&aWłączone" + disabled: "&cWyłączone" + +command_help: + list: + - "/ws get &8- &7Tworzy Twój świat" + - "/ws home &8- &7Teleportuje Cie na Twój świat" + - "/ws sethome &8- &7Sets a specific home" + - "/ws gui &8- &7Otwiera GUI świata jeżeli jesteś jego właścicielem" + - "/ws tp &8- &7Teleportuje Cie na określony świat" + - "/ws addmember &8- &7Dodaj gracza na swój świat" + - "/ws delmember &8- &7Usuń gracza ze swojego świata" + - "/ws leave &8- &7Opuść świat" + - "/ws tnt &8- &7Zezwól/Odmów TNT na swoim świecie" + - "/ws fire &8- &7Zezwól/Odmów Ogień na swoim świecie" + - "/ws togglegm &8- &7Zezwól/Odmów graczowi zmieniać swój gamemode" + - "/ws togglebuild &8- &7Zezwól/Odmów graczowi budowanie" + - "/ws toggletp &8- &7Zezwól/Odmów graczowi teleportowanie się" + - "/ws info &8- &7Pokazuje informacje o świecie" + - "/ws reset &8- &7Zresetuje Twój świat" delete_command: "/ws delete &8- &7Usunie Twój świat" \ No newline at end of file diff --git a/WorldSystem/src/main/resources/plugin.yml b/src/main/resources/plugin.yml similarity index 100% rename from WorldSystem/src/main/resources/plugin.yml rename to src/main/resources/plugin.yml diff --git a/WorldSystem/src/main/resources/ru.yml b/src/main/resources/ru.yml similarity index 98% rename from WorldSystem/src/main/resources/ru.yml rename to src/main/resources/ru.yml index d4b980f..53a9e2f 100644 --- a/WorldSystem/src/main/resources/ru.yml +++ b/src/main/resources/ru.yml @@ -1,83 +1,83 @@ -nopermission: "&cУ тебя нет прав!" -unknown_error: "&cЧего-то не удалось..." -lagdetection: "Лагов в мире: &c%world" -wrong_usage: "&c%usage" -not_registered: "&cЭтот игрок играет первый раз га этом сервере" - -world: - reseted: "Твой мир был возвращен!" - still_loaded: "&cТвой мир ещё загружен!" - not_on: "&cТебя нету в не каком мире!" - created: "Твой мир готов. Используй &a/ws home" - already_exists: "&cТакой мир уже существует!" - delete: - own: "&cТвой мир был удален!" - other: "Мир от &c%player&6 был удален!" - does_not_exists: - own: "&cУ тебя нету мира!" - other: "&cУ этого игрока нету мира!" - setting_up: "&aПриготовлеваю мир..." - playerlist: "Игроков в мире: %players" - still_creating: "&cWorld is still creating" - set_home: "You set the home" - -member: - removed: "Ты удалил &c%player&6 из твоего мира!" - added: "Ты добавил &c%player&6 к твоему миру!" - already_added: "&cЭтот игрок уже член твоего мира!" - not_added: - own: "&cЭтот игрок не член твоего мира!" - other: "&cТебя не добавили к этому миру" - no_one_added: "&cThere are no members added" - -request: - expired: "&cТвой запрос вытек!" - confirm: "&Подтверди сброс: %command" - until_expire: "&cТвой запрос вытечет через %time секунды!" - already_sent: "&cТы уже послал запрос!" - not_sent: "&cТы не послал запрос!" - invalid_input: "&c%input не действительный запрос!" - -toggle: - gamemode: - enabled: "&a%player&6 теперь может изменить свой режим игры!" - disabled: "&c%player&6 не может больше изменить свой режим игры!" - teleport: - enabled: "&a%player&6 теперь может телепортироваться!" - disabled: "&c%player&6 не может больше телепортироваться!" - build: - enabled: "&a%player&6 может теперь строить!" - disabled: "&c%player&6 не может больше строить!" - fire: - enabled: "&aОгонь включен!" - disabled: "&cОгонь отключен" - tnt: - enabled: "&aПовреждение через ТНТ включено!" - disabled: "&cПовреждение через ТНТ отключено!" - -info: - owner: "Владелец: %data" - id: "ID: %data" - member: "Члены: %data" - tnt: "ТНТ: %data" - fire: "Огонь: %data" - enabled: "&aВключен" - disabled: "&cОтключен" - -command_help: - list: - - "/ws get &8- &7Даст тебе мир" - - "/ws home &8- &7Телепортирует тебя в твой мир" - - "/ws sethome &8- &7Sets a specific home" - - "/ws gui &8- &7Открывает ГИП если ты владелец этого мира" - - "/ws tp &8- &7Телепортирует тебя в определенный мир" +nopermission: "&cУ тебя нет прав!" +unknown_error: "&cЧего-то не удалось..." +lagdetection: "Лагов в мире: &c%world" +wrong_usage: "&c%usage" +not_registered: "&cЭтот игрок играет первый раз га этом сервере" + +world: + reseted: "Твой мир был возвращен!" + still_loaded: "&cТвой мир ещё загружен!" + not_on: "&cТебя нету в не каком мире!" + created: "Твой мир готов. Используй &a/ws home" + already_exists: "&cТакой мир уже существует!" + delete: + own: "&cТвой мир был удален!" + other: "Мир от &c%player&6 был удален!" + does_not_exists: + own: "&cУ тебя нету мира!" + other: "&cУ этого игрока нету мира!" + setting_up: "&aПриготовлеваю мир..." + playerlist: "Игроков в мире: %players" + still_creating: "&cWorld is still creating" + set_home: "You set the home" + +member: + removed: "Ты удалил &c%player&6 из твоего мира!" + added: "Ты добавил &c%player&6 к твоему миру!" + already_added: "&cЭтот игрок уже член твоего мира!" + not_added: + own: "&cЭтот игрок не член твоего мира!" + other: "&cТебя не добавили к этому миру" + no_one_added: "&cThere are no members added" + +request: + expired: "&cТвой запрос вытек!" + confirm: "&Подтверди сброс: %command" + until_expire: "&cТвой запрос вытечет через %time секунды!" + already_sent: "&cТы уже послал запрос!" + not_sent: "&cТы не послал запрос!" + invalid_input: "&c%input не действительный запрос!" + +toggle: + gamemode: + enabled: "&a%player&6 теперь может изменить свой режим игры!" + disabled: "&c%player&6 не может больше изменить свой режим игры!" + teleport: + enabled: "&a%player&6 теперь может телепортироваться!" + disabled: "&c%player&6 не может больше телепортироваться!" + build: + enabled: "&a%player&6 может теперь строить!" + disabled: "&c%player&6 не может больше строить!" + fire: + enabled: "&aОгонь включен!" + disabled: "&cОгонь отключен" + tnt: + enabled: "&aПовреждение через ТНТ включено!" + disabled: "&cПовреждение через ТНТ отключено!" + +info: + owner: "Владелец: %data" + id: "ID: %data" + member: "Члены: %data" + tnt: "ТНТ: %data" + fire: "Огонь: %data" + enabled: "&aВключен" + disabled: "&cОтключен" + +command_help: + list: + - "/ws get &8- &7Даст тебе мир" + - "/ws home &8- &7Телепортирует тебя в твой мир" + - "/ws sethome &8- &7Sets a specific home" + - "/ws gui &8- &7Открывает ГИП если ты владелец этого мира" + - "/ws tp &8- &7Телепортирует тебя в определенный мир" - "/ws addmember &8- &7Добавляет кого-то к твоему миру" - - "/ws delmember&8 - &7Удаляет кого-то из твоего мира" - - "/ws tnt &8- &7Разрешает/Запрещает TНT на твоем мире" - - "/ws fire &8- &7Разрешает/Запрещает огонь в твоем мире" - - "/ws togglegm &8- &7Разрешает/Запрещает игроку менять режим игры" - - "/ws togglebuild &8- &7Разрешает/Запрещает игроку строить" - - "/ws toggletp &8- &7Разрешает/Запрещает игроку телепортироваться" - - "/ws info &8- &7Показывает информацию про мир" + - "/ws delmember&8 - &7Удаляет кого-то из твоего мира" + - "/ws tnt &8- &7Разрешает/Запрещает TНT на твоем мире" + - "/ws fire &8- &7Разрешает/Запрещает огонь в твоем мире" + - "/ws togglegm &8- &7Разрешает/Запрещает игроку менять режим игры" + - "/ws togglebuild &8- &7Разрешает/Запрещает игроку строить" + - "/ws toggletp &8- &7Разрешает/Запрещает игроку телепортироваться" + - "/ws info &8- &7Показывает информацию про мир" - "/ws reset &8- &7Сбрасывает твой мир" delete_command: "/ws delete &8- &7Удалает твой мир" \ No newline at end of file diff --git a/WorldSystem/src/main/resources/settings.yml b/src/main/resources/settings.yml similarity index 96% rename from WorldSystem/src/main/resources/settings.yml rename to src/main/resources/settings.yml index cc08d1d..fdea33e 100644 --- a/WorldSystem/src/main/resources/settings.yml +++ b/src/main/resources/settings.yml @@ -1,60 +1,60 @@ -# Center will be at the spawn or the worldspawn -worldborder: - # If WorldSystem should change the worldborder - should_change: true - # Default size - normal: 500 - # Here you can define your own ranks, as many as you want - # The permission node will be the key and the value the size - ranks: - # For example, with the permission ws.big you will get a worldborder with the size 1000 - ws.big: 1000 - ws.bigger: 1500 - - # Set a specialized center which is not the spawn - center: - as_spawn: true - # Should the worldborder move with the home set by the owner - as_home: false - x: 0 - y: 20 - z: 0 - - -# Commands that should be executed on /ws get when it is ready -# Placeholders: %player: Name of player, %world: Name of world, %uuid: UUID of player -commands_on_get: -#- tell %player You have got a world -#- tell %player You are now on %world - - -# All Gamerules in 1.12 -# Not supported gamerules will be ignored -# -# If you need help, look at -# https://minecraft.gamepedia.com/Commands/gamerule - -announceAdvancements: true -commandBlockOutput: false -disableElytraMovementCheck: false -doDaylightCycle: false -doEntityDrops: true -doFireTick: true -doLimitedCrafting: false -doMobLoot: true -doMobSpawning: true -doTileDrops: false -doWeatherCycle: false -gameLoopFunction: false -keepInventory: true -logAdminCommands: true -maxCommandChainLength: 65536 -maxEntityCramming: 24 -mobGriefing: true -naturalRegeneration: true -randomTickSpeed: 3 -reducedDebugInfo: false -sendCommandFeedback: true -showDeathMessages: true -spawnRadius: 10 +# Center will be at the spawn or the worldspawn +worldborder: + # If WorldSystem should change the worldborder + should_change: true + # Default size + normal: 500 + # Here you can define your own ranks, as many as you want + # The permission node will be the key and the value the size + ranks: + # For example, with the permission ws.big you will get a worldborder with the size 1000 + ws.big: 1000 + ws.bigger: 1500 + + # Set a specialized center which is not the spawn + center: + as_spawn: true + # Should the worldborder move with the home set by the owner + as_home: false + x: 0 + y: 20 + z: 0 + + +# Commands that should be executed on /ws get when it is ready +# Placeholders: %player: Name of player, %world: Name of world, %uuid: UUID of player +commands_on_get: +#- tell %player You have got a world +#- tell %player You are now on %world + + +# All Gamerules in 1.12 +# Not supported gamerules will be ignored +# +# If you need help, look at +# https://minecraft.gamepedia.com/Commands/gamerule + +announceAdvancements: true +commandBlockOutput: false +disableElytraMovementCheck: false +doDaylightCycle: false +doEntityDrops: true +doFireTick: true +doLimitedCrafting: false +doMobLoot: true +doMobSpawning: true +doTileDrops: false +doWeatherCycle: false +gameLoopFunction: false +keepInventory: true +logAdminCommands: true +maxCommandChainLength: 65536 +maxEntityCramming: 24 +mobGriefing: true +naturalRegeneration: true +randomTickSpeed: 3 +reducedDebugInfo: false +sendCommandFeedback: true +showDeathMessages: true +spawnRadius: 10 spectatorsGenerateChunks: true \ No newline at end of file diff --git a/WorldSystem/src/main/resources/zh.yml b/src/main/resources/zh.yml similarity index 97% rename from WorldSystem/src/main/resources/zh.yml rename to src/main/resources/zh.yml index 121f6e2..548e8a4 100644 --- a/WorldSystem/src/main/resources/zh.yml +++ b/src/main/resources/zh.yml @@ -1,83 +1,83 @@ -nopermission: "&c你没有权限!" -unknown_error: "&c出错..." -lagdetection: "滞后: &c%world" -wrong_usage: "&c%usage" -not_registered: "&c该玩家未在线!" - -world: - reseted: "你的世界已重置!" - still_loaded: "&c你的世界正在加载!" - not_on: "&c你未在世界里!" - created: "你的世界已准备就绪,输入 &a/ws home &6前往" - already_exists: "&c你已拥有一个世界!" - delete: - own: "&c你的世界已删除!" - other: "你删除了 &c%player &6的世界" - does_not_exists: - own: "&c你没有世界!" - other: "&c这个玩家没有世界!" - setting_up: "&a正在建立世界..." - playerlist: "玩家: %players 在这个世界上" - still_creating: "&cWorld is still creating" - set_home: "You set the home" - -member: - removed: "玩家 &c%player&6 从你的世界移除!" - added: "你添加 &c%player&6 到你的世界!" - already_added: "&c这个玩家已经在你的世界里了!" - not_added: - own: "&c该玩家未在你的世界里!" - other: "&c你未加入这个世界" - -request: - expired: "&c确认超时!" - confirm: "&c请确认,重置你的世界: %command" - until_expire: "&c请在 %time 秒,内确认!" - already_sent: "&c你已发送请求!" - not_sent: "&c你未发送请求!" - invalid_input: "&c%input 错误!" - -toggle: - gamemode: - enabled: "&a%player&6 可以改变游戏模式!" - disabled: "&c%player&6 不能游戏模式!" - teleport: - enabled: "&a%player&6 可以传送!" - disabled: "&c%player&6 不能传送!" - build: - enabled: "&a%player&6 可以建筑!" - disabled: "&c%player&6 不能建筑!" - fire: - enabled: "&a你开启了 火!" - disabled: "&c你禁用了 火!" - tnt: - enabled: "&a你开启了 TNT-爆炸!" - disabled: "&c你禁用了 TNT-爆炸!" - -info: - owner: "管理者: %data" - id: "ID: %data" - member: "成员: %data" - tnt: "TNT: %data" - fire: "火: %data" - enabled: "&a开启" - disabled: "&c关闭" - -command_help: - list: - - "/ws get &8- &7创建一个世界" - - "/ws home &8- &7返回你的世界" - - "/ws sethome &8- &7Sets a specific home" - - "/ws gui &8- &7如果你是世界管理者,使用该指令打开菜单" - - "/ws tp &8- &7传送到指定世界" - - "/ws addmember &8- &7添加一个玩家到你的世界" - - "/ws delmember &8- &7将一个玩家从你的世界删除" - - "/ws leave &8- &7离开一个世界" - - "/ws tnt &8- &7开启/禁用 TNT爆炸" - - "/ws fire &8- &7开启/禁用,火" - - "/ws togglegm &8- &7开启/禁用,玩家切换模式" - - "/ws togglebuild &8- &7开启/禁用,玩家建筑" - - "/ws toggletp &8- &7开启/禁用,玩家传送" - - "/ws info &8- &7查看世界信息" - - "/ws reset &8- &7重置你的世界" +nopermission: "&c你没有权限!" +unknown_error: "&c出错..." +lagdetection: "滞后: &c%world" +wrong_usage: "&c%usage" +not_registered: "&c该玩家未在线!" + +world: + reseted: "你的世界已重置!" + still_loaded: "&c你的世界正在加载!" + not_on: "&c你未在世界里!" + created: "你的世界已准备就绪,输入 &a/ws home &6前往" + already_exists: "&c你已拥有一个世界!" + delete: + own: "&c你的世界已删除!" + other: "你删除了 &c%player &6的世界" + does_not_exists: + own: "&c你没有世界!" + other: "&c这个玩家没有世界!" + setting_up: "&a正在建立世界..." + playerlist: "玩家: %players 在这个世界上" + still_creating: "&cWorld is still creating" + set_home: "You set the home" + +member: + removed: "玩家 &c%player&6 从你的世界移除!" + added: "你添加 &c%player&6 到你的世界!" + already_added: "&c这个玩家已经在你的世界里了!" + not_added: + own: "&c该玩家未在你的世界里!" + other: "&c你未加入这个世界" + +request: + expired: "&c确认超时!" + confirm: "&c请确认,重置你的世界: %command" + until_expire: "&c请在 %time 秒,内确认!" + already_sent: "&c你已发送请求!" + not_sent: "&c你未发送请求!" + invalid_input: "&c%input 错误!" + +toggle: + gamemode: + enabled: "&a%player&6 可以改变游戏模式!" + disabled: "&c%player&6 不能游戏模式!" + teleport: + enabled: "&a%player&6 可以传送!" + disabled: "&c%player&6 不能传送!" + build: + enabled: "&a%player&6 可以建筑!" + disabled: "&c%player&6 不能建筑!" + fire: + enabled: "&a你开启了 火!" + disabled: "&c你禁用了 火!" + tnt: + enabled: "&a你开启了 TNT-爆炸!" + disabled: "&c你禁用了 TNT-爆炸!" + +info: + owner: "管理者: %data" + id: "ID: %data" + member: "成员: %data" + tnt: "TNT: %data" + fire: "火: %data" + enabled: "&a开启" + disabled: "&c关闭" + +command_help: + list: + - "/ws get &8- &7创建一个世界" + - "/ws home &8- &7返回你的世界" + - "/ws sethome &8- &7Sets a specific home" + - "/ws gui &8- &7如果你是世界管理者,使用该指令打开菜单" + - "/ws tp &8- &7传送到指定世界" + - "/ws addmember &8- &7添加一个玩家到你的世界" + - "/ws delmember &8- &7将一个玩家从你的世界删除" + - "/ws leave &8- &7离开一个世界" + - "/ws tnt &8- &7开启/禁用 TNT爆炸" + - "/ws fire &8- &7开启/禁用,火" + - "/ws togglegm &8- &7开启/禁用,玩家切换模式" + - "/ws togglebuild &8- &7开启/禁用,玩家建筑" + - "/ws toggletp &8- &7开启/禁用,玩家传送" + - "/ws info &8- &7查看世界信息" + - "/ws reset &8- &7重置你的世界" delete_command: "/ws delete &8- &7删除一个世界" \ No newline at end of file diff --git a/WorldSystem/src/test/java/de/butzlabben/autoupdater/test/UpdateInformationsTest.java b/src/test/java/de/butzlabben/autoupdater/test/UpdateInformationsTest.java similarity index 95% rename from WorldSystem/src/test/java/de/butzlabben/autoupdater/test/UpdateInformationsTest.java rename to src/test/java/de/butzlabben/autoupdater/test/UpdateInformationsTest.java index 9f50627..163c228 100644 --- a/WorldSystem/src/test/java/de/butzlabben/autoupdater/test/UpdateInformationsTest.java +++ b/src/test/java/de/butzlabben/autoupdater/test/UpdateInformationsTest.java @@ -1,21 +1,21 @@ -package de.butzlabben.autoupdater.test; - -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; - -import de.butzlabben.autoupdater.UpdateInformations; - -/** - * @author Butzlabben - * @since 03.09.2018 - */ -public class UpdateInformationsTest { - - private final String url = "https://seagiants.eu/worldsystem/info.php?version=1.0"; - - @Test - public void testCallURL() { - assertNotNull("Failed to call URL to AutoUpdate Server", UpdateInformations.callURL(url)); - } -} +package de.butzlabben.autoupdater.test; + +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; + +import de.butzlabben.autoupdater.UpdateInformations; + +/** + * @author Butzlabben + * @since 03.09.2018 + */ +public class UpdateInformationsTest { + + private final String url = "https://seagiants.eu/worldsystem/info.php?version=1.0"; + + @Test + public void testCallURL() { + assertNotNull("Failed to call URL to AutoUpdate Server", UpdateInformations.callURL(url)); + } +}