Merged in develop (pull request #1)

Fixed project structure
This commit is contained in:
Daniel N 2019-02-10 21:05:57 +00:00
commit e08b8eda94
104 changed files with 5162 additions and 6396 deletions

View File

@ -1,7 +1,7 @@
.idea/ .idea/
.settings/ .settings/
bin/ bin/
WorldSystem.iml WorldSystem.iml
.project .project
.classpath .classpath
/target/ /target/

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="VcsDirectoryMappings"> <component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" /> <mapping directory="$PROJECT_DIR$" vcs="Git" />
</component> </component>
</project> </project>

View File

@ -1,38 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/WorldSystem.iml" filepath="$PROJECT_DIR$/WorldSystem.iml" />
</modules>
</component>
</project>

View File

@ -1,277 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="97a3c063-d1d2-4944-b5c0-38257b243326" name="Default" comment="" />
<ignored path="$PROJECT_DIR$/bin/" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileEditorManager">
<leaf>
<file leaf-file-name="WorldSystem.java" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/de/butzlabben/world/WorldSystem.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="272">
<caret line="57" column="39" lean-forward="true" selection-start-line="57" selection-start-column="39" selection-end-line="57" selection-end-column="39" />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="ProjectFrameBounds">
<option name="x" value="260" />
<option name="y" value="20" />
<option name="width" value="1400" />
<option name="height" value="1000" />
</component>
<component name="ProjectView">
<navigator proportions="" version="1">
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="ProjectPane">
<subPane>
<expand>
<path>
<item name="WorldSystem" type="b2602c69:ProjectViewProjectNode" />
<item name="WorldSystem" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="WorldSystem" type="b2602c69:ProjectViewProjectNode" />
<item name="WorldSystem" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="WorldSystem" type="b2602c69:ProjectViewProjectNode" />
<item name="WorldSystem" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="butzlabben" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="WorldSystem" type="b2602c69:ProjectViewProjectNode" />
<item name="WorldSystem" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="butzlabben" type="462c0819:PsiDirectoryNode" />
<item name="world" type="462c0819:PsiDirectoryNode" />
</path>
</expand>
<select />
</subPane>
</pane>
<pane id="AndroidView">
<subPane>
<expand>
<path>
<item name="WorldSystem" type="1abcf292:AndroidViewProjectNode" />
<item name="WorldSystem" type="e9137016:NonAndroidModuleNode" />
</path>
<path>
<item name="WorldSystem" type="1abcf292:AndroidViewProjectNode" />
<item name="WorldSystem" type="e9137016:NonAndroidModuleNode" />
<item name="java" type="f7eae187:NonAndroidSourceTypeNode" />
</path>
</expand>
<select />
</subPane>
</pane>
<pane id="Scope" />
<pane id="PackagesPane" />
</panes>
</component>
<component name="PropertiesComponent">
<property name="project.structure.last.edited" value="Modules" />
<property name="project.structure.proportion" value="0.0" />
<property name="project.structure.side.proportion" value="0.0" />
<property name="settings.editor.selected.configurable" value="preferences.general" />
</component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component>
<component name="RunManager">
<configuration default="true" type="Application" factoryName="Application">
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
</configuration>
<configuration default="true" type="JUnit" factoryName="JUnit">
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<patterns />
</configuration>
<configuration default="true" type="TestNG" factoryName="TestNG">
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="SUITE_NAME" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="GROUP_NAME" />
<option name="TEST_OBJECT" value="CLASS" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
<option name="OUTPUT_DIRECTORY" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<option name="USE_DEFAULT_REPORTERS" value="false" />
<option name="PROPERTIES_FILE" />
<properties />
<listeners />
</configuration>
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="97a3c063-d1d2-4944-b5c0-38257b243326" name="Default" comment="" />
<created>1524410861721</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1524410861721</updated>
</task>
<servers />
</component>
<component name="ToolWindowManager">
<frame x="260" y="20" width="1400" height="1000" extended-state="0" />
<layout>
<window_info anchor="right" id="Palette" />
<window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="right" id="Palette&#9;" />
<window_info id="Image Layers" />
<window_info anchor="right" id="Capture Analysis" />
<window_info anchor="bottom" id="Event Log" side_tool="true" />
<window_info anchor="right" id="Maven Projects" />
<window_info anchor="bottom" id="Run" order="2" />
<window_info anchor="bottom" id="Version Control" show_stripe_button="false" />
<window_info anchor="bottom" id="Terminal" />
<window_info id="Capture Tool" />
<window_info id="Designer" />
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.25" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info id="UI Designer" />
<window_info anchor="right" id="Theme Preview" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
<window_info id="Favorites" side_tool="true" />
<window_info anchor="bottom" id="Find" order="1" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Message" order="0" />
</layout>
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/src/de/butzlabben/world/WorldSystem.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="272">
<caret line="57" column="39" lean-forward="true" selection-start-line="57" selection-start-column="39" selection-end-line="57" selection-end-column="39" />
</state>
</provider>
</entry>
</component>
<component name="masterDetails">
<states>
<state key="ArtifactsStructureConfigurable.UI">
<settings>
<artifact-editor />
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="FacetStructureConfigurable.UI">
<settings>
<last-edited>No facets are configured</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="GlobalLibrariesConfigurable.UI">
<settings>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="JdkListConfigurable.UI">
<settings>
<last-edited>1.8</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="ModuleStructureConfigurable.UI">
<settings>
<last-edited>WorldSystem</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
<option value="0.6" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="ProjectLibrariesConfigurable.UI">
<settings>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project>

View File

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>WorldSystem</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>net.sourceforge.metrics.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>net.sourceforge.metrics.nature</nature>
</natures>
</projectDescription>

View File

@ -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/<project>=UTF-8

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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 <player>
ws delmember:
usage: /ws delmember <player>
ws leave:
usage: /ws leave
ws tp:
usage: /ws tp <target>
ws tnt:
usage: /ws tnt
ws fire:
usage: /ws fire
ws info:
usage: /ws info
ws togglebuild:
usage: /ws togglebuild <player>
ws togglegm:
usage: /ws togglegm <player>
ws toggletp:
usage: /ws toggletp <player>
ws reset:
usage: /ws reset
ws gui:
usage: /ws gui
ws delete:
usage: /ws delete <player>
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

View File

@ -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

View File

@ -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: ""

View File

@ -1,85 +0,0 @@
nopermission: "&cNincs jogod ehhez!"
unknown_error: "&cValami elromlott..."
lagdetection: "Lagdetection a világban: &c%world"
wrong_usage: "&c%usage"
not_registered: "&cEz a játékos még nem csatlakozott!"
world:
reseted: "A világod vissza lett állítva!"
still_loaded: "&cA világod még mindig be van töltve!"
not_on: "&cNem vagy a világon!"
created: "A világod készen áll. Szállj fel a &a/ws home"
already_exists: "&cMár van világod!"
delete:
own: "&cA világot törölve!"
other: "Törölte a világot &c%player&6 játékostól!"
does_not_exists:
own: "&cNincs világod!"
other: "&cEz a játékos nem rendelkezik világgal!"
setting_up: "&aA világ megteremtése..."
playerlist: "Játékos ebben a világban: %player"
still_creating: "&cWorld is still creating"
set_home: "You set the home"
member:
removed: "Törölted &c%player&6 játékost a világodból!"
added: "Hozzáadtad &c%player&6 játékost a világodhoz!"
already_added: "&cEz a játékos már tagja!"
not_added:
own: "&cEz a játékos nem tagja!"
other: "&cNem vagy hozzáadva ehhez a világhoz"
still_creating: "&cWorld is still creating"
no_one_added: "&cThere are no members added"
request:
expired: "&cA kérelem lejárt!"
confirm: "&cKérjük, erõsítsd meg a világ újraindítását: %command"
until_expire: "&cA kérés lejárati ideje %time másodperc!"
already_sent: "&cMár elküldtél egy kérelmet!"
not_sent: "&cNem küldtél kérést!"
invalid_input: "&c%input nem érvényes bemenet!"
toggle:
gamemode:
enabled: "&a%player&6 most megváltoztathatja játékmódját!"
disabled: "&c%player&6 már nem tudja megváltoztatni játékmódját!"
teleport:
enabled: "&a%player&6 most teleportálhat!"
disabled: "&c%player&6 már nem teleportálhat!"
build:
enabled: "&a%player&6 most építhet!"
disabled: "&c%player&6 már nem építhet!"
fire:
enabled: "&aAktiváltad a tüzet!"
disabled: "&cDeaktiváltad a tüzet!"
tnt:
enabled: "&aAktiváltad a TNT-sebzést!"
disabled: "&cDeaktiváltad TNT-sebzést!"
info:
owner: "Tulajdonos: %data"
id: "ID: %data"
member: "Tag: %data"
tnt: "TNT: %data"
fire: "Tûz: %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"

View File

@ -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"

View File

@ -1,53 +1,53 @@
package de.butzlabben.autoupdater; package de.butzlabben.autoupdater;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.net.URL; import java.net.URL;
import java.nio.channels.Channels; import java.nio.channels.Channels;
import java.nio.channels.FileChannel; import java.nio.channels.FileChannel;
import java.nio.channels.ReadableByteChannel; import java.nio.channels.ReadableByteChannel;
/** /**
* @author Butzlabben * @author Butzlabben
* @since 02.05.2018 * @since 02.05.2018
*/ */
public class AutoUpdate implements Runnable { public class AutoUpdate implements Runnable {
private UpdateInformations ui; private UpdateInformations ui;
private String jar; private String jar;
public AutoUpdate(UpdateInformations ui, String jar) { public AutoUpdate(UpdateInformations ui, String jar) {
this.ui = ui; this.ui = ui;
this.jar = jar; this.jar = jar;
} }
@Override @Override
public void run() { public void run() {
FileChannel out = null; FileChannel out = null;
FileOutputStream outStream = null; FileOutputStream outStream = null;
try { try {
ReadableByteChannel in = Channels ReadableByteChannel in = Channels
.newChannel(new URL(ui.getURL()).openStream()); .newChannel(new URL(ui.getURL()).openStream());
outStream = new FileOutputStream(jar); outStream = new FileOutputStream(jar);
out = outStream.getChannel(); out = outStream.getChannel();
out.transferFrom(in, 0, Long.MAX_VALUE); out.transferFrom(in, 0, Long.MAX_VALUE);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
if (out != null) if (out != null)
try { try {
out.close(); out.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
if (outStream != null) { if (outStream != null) {
try { try {
outStream.close(); outStream.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
} }
} }
} }

View File

@ -1,127 +1,127 @@
package de.butzlabben.autoupdater; package de.butzlabben.autoupdater;
import java.io.File; import java.io.File;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import de.butzlabben.world.config.PluginConfig; import de.butzlabben.world.config.PluginConfig;
/** /**
* @author Butzlabben * @author Butzlabben
* @since 01.05.2018 * @since 01.05.2018
*/ */
public class AutoUpdater implements Listener { public class AutoUpdater implements Listener {
private boolean confirmed; private boolean confirmed;
private boolean confirmNeed; private boolean confirmNeed;
private static AutoUpdater instance; private static AutoUpdater instance;
private AutoUpdate au; private AutoUpdate au;
public static void startAsync() { public static void startAsync() {
Thread t = new Thread(() -> { Thread t = new Thread(() -> {
getInstance(); getInstance();
}); });
t.setName("update-thread-worldsystem"); t.setName("update-thread-worldsystem");
t.start(); t.start();
} }
public static synchronized AutoUpdater getInstance() { public static synchronized AutoUpdater getInstance() {
if (instance == null) if (instance == null)
instance = new AutoUpdater(); instance = new AutoUpdater();
return instance; return instance;
} }
private AutoUpdater() { private AutoUpdater() {
confirmNeed = PluginConfig.confirmNeed(); confirmNeed = PluginConfig.confirmNeed();
UpdateInformations ui = UpdateInformations.getInformations(); UpdateInformations ui = UpdateInformations.getInformations();
if (ui == null) { if (ui == null) {
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "§cCouldn't contact autoupdate server"); Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "§cCouldn't contact autoupdate server");
return; return;
} }
Plugin plugin = Bukkit.getPluginManager().getPlugin(ui.getPlugin()); Plugin plugin = Bukkit.getPluginManager().getPlugin(ui.getPlugin());
if (plugin == null) if (plugin == null)
return; return;
String v = plugin.getDescription().getVersion(); String v = plugin.getDescription().getVersion();
if (!ui.getVersion().equals(plugin.getDescription().getVersion())) { if (!ui.getVersion().equals(plugin.getDescription().getVersion())) {
if (!ui.isSilent()) { if (!ui.isSilent()) {
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "Found new version. Current: " + v Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "Found new version. Current: " + v
+ ", Available: " + ui.getVersion()); + ", Available: " + ui.getVersion());
} }
// Get jar file // Get jar file
Method getFileMethod = null; Method getFileMethod = null;
try { try {
getFileMethod = JavaPlugin.class.getDeclaredMethod("getFile"); getFileMethod = JavaPlugin.class.getDeclaredMethod("getFile");
} catch (NoSuchMethodException | SecurityException e1) { } catch (NoSuchMethodException | SecurityException e1) {
e1.printStackTrace(); e1.printStackTrace();
return; return;
} }
getFileMethod.setAccessible(true); getFileMethod.setAccessible(true);
File file = null; File file = null;
try { try {
file = (File) getFileMethod.invoke(plugin); file = (File) getFileMethod.invoke(plugin);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
e.printStackTrace(); e.printStackTrace();
return; return;
} }
getFileMethod.setAccessible(false); getFileMethod.setAccessible(false);
String jar = file.getAbsolutePath(); String jar = file.getAbsolutePath();
au = new AutoUpdate(ui, jar); au = new AutoUpdate(ui, jar);
if (ui.isSilent() || !confirmNeed) { if (ui.isSilent() || !confirmNeed) {
Runtime.getRuntime().addShutdownHook(new Thread(au)); Runtime.getRuntime().addShutdownHook(new Thread(au));
if (!ui.isSilent()) if (!ui.isSilent())
Bukkit.getConsoleSender().sendMessage( Bukkit.getConsoleSender().sendMessage(
PluginConfig.getPrefix() + "§aAutoupdate confirmed, §crestart §ato apply changes"); PluginConfig.getPrefix() + "§aAutoupdate confirmed, §crestart §ato apply changes");
confirmed = true; confirmed = true;
} else { } else {
Bukkit.getPluginManager().registerEvents(this, plugin); Bukkit.getPluginManager().registerEvents(this, plugin);
for (Player p : Bukkit.getOnlinePlayers()) { for (Player p : Bukkit.getOnlinePlayers()) {
p.sendMessage( p.sendMessage(
PluginConfig.getPrefix() + "§aFound new update. Confirm autoupdate with §c/ws confirm"); PluginConfig.getPrefix() + "§aFound new update. Confirm autoupdate with §c/ws confirm");
p.sendMessage(PluginConfig.getPrefix() + "§aRead changelogs: https://www.spigotmc.org/resources/49756/updates"); p.sendMessage(PluginConfig.getPrefix() + "§aRead changelogs: https://www.spigotmc.org/resources/49756/updates");
} }
Bukkit.getConsoleSender().sendMessage( Bukkit.getConsoleSender().sendMessage(
PluginConfig.getPrefix() + "§aFound new update. Confirm autoupdate with §c/ws confirm"); 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"); Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "§aRead changelogs: https://www.spigotmc.org/resources/49756/updates");
} }
} else { } else {
confirmNeed = false; confirmNeed = false;
} }
} }
@EventHandler @EventHandler
public void on(PlayerJoinEvent e) { public void on(PlayerJoinEvent e) {
if (e.getPlayer().hasPermission("ws.confirm")) { if (e.getPlayer().hasPermission("ws.confirm")) {
e.getPlayer().sendMessage( e.getPlayer().sendMessage(
PluginConfig.getPrefix() + "§aFound new update. Confirm autoupdate with §c/ws confirm"); 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"); e.getPlayer().sendMessage(PluginConfig.getPrefix() + "§aRead changelogs: https://www.spigotmc.org/resources/49756/updates");
} }
} }
public boolean confirm() { public boolean confirm() {
if (confirmNeed && !confirmed) { if (confirmNeed && !confirmed) {
Runtime.getRuntime().addShutdownHook(new Thread(au)); Runtime.getRuntime().addShutdownHook(new Thread(au));
confirmed = true; confirmed = true;
HandlerList.unregisterAll(this); HandlerList.unregisterAll(this);
return true; return true;
} }
return false; return false;
} }
public boolean confirmed() { public boolean confirmed() {
return confirmed; return confirmed;
} }
} }

View File

@ -1,16 +1,16 @@
package de.butzlabben.inventory; package de.butzlabben.inventory;
/** /**
* @author Butzlabben * @author Butzlabben
* @since 28.06.2018 * @since 28.06.2018
*/ */
public class CostumInv extends OrcInventory { public class CostumInv extends OrcInventory {
public CostumInv(String title, int rows) { public CostumInv(String title, int rows) {
super(title, rows); super(title, rows);
} }
public CostumInv(String title, int rows, boolean fill) { public CostumInv(String title, int rows, boolean fill) {
super(title, rows, fill); super(title, rows, fill);
} }
} }

View File

@ -1,12 +1,12 @@
package de.butzlabben.inventory; package de.butzlabben.inventory;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import de.butzlabben.world.wrapper.WorldPlayer; import de.butzlabben.world.wrapper.WorldPlayer;
public interface DependListener { public interface DependListener {
public ItemStack getItemStack(Player p, WorldPlayer wp); public ItemStack getItemStack(Player p, WorldPlayer wp);
} }

View File

@ -1,9 +1,9 @@
package de.butzlabben.inventory; package de.butzlabben.inventory;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public interface OrcClickListener { public interface OrcClickListener {
public void onClick(Player p, OrcInventory inv, OrcItem item); public void onClick(Player p, OrcInventory inv, OrcItem item);
} }

View File

@ -1,113 +1,113 @@
package de.butzlabben.inventory; package de.butzlabben.inventory;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Objects; import java.util.Objects;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryType; import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
public abstract class OrcInventory { public abstract class OrcInventory {
protected String title; protected String title;
private int rows; private int rows;
private InventoryType type; private InventoryType type;
private boolean fill = false; private boolean fill = false;
protected HashMap<Integer, OrcItem> items = new HashMap<>(); protected HashMap<Integer, OrcItem> items = new HashMap<>();
public OrcInventory(String title) { public OrcInventory(String title) {
Objects.requireNonNull(title, "title cannot be null"); Objects.requireNonNull(title, "title cannot be null");
this.title = title; this.title = title;
} }
public OrcInventory(String title, int rows) { public OrcInventory(String title, int rows) {
this(title); this(title);
if (rows <= 0 || rows > 6) if (rows <= 0 || rows > 6)
throw new IllegalArgumentException("rows cannot be smaller than 1 or bigger than 6"); throw new IllegalArgumentException("rows cannot be smaller than 1 or bigger than 6");
this.rows = rows; this.rows = rows;
} }
public OrcInventory(String title, int rows, boolean fill) { public OrcInventory(String title, int rows, boolean fill) {
this(title, rows); this(title, rows);
this.fill = fill; this.fill = fill;
if(this.fill) { if(this.fill) {
for (int i = 0; i < rows * 9; i++) { for (int i = 0; i < rows * 9; i++) {
items.put(i, OrcItem.fill); items.put(i, OrcItem.fill);
} }
} }
} }
public OrcInventory(String title, InventoryType type) { public OrcInventory(String title, InventoryType type) {
this(title); this(title);
if (type == null || type == InventoryType.CHEST) { if (type == null || type == InventoryType.CHEST) {
this.type = null; this.type = null;
rows = 3; rows = 3;
} else { } else {
this.type = type; this.type = type;
} }
} }
public void addItem(int slot, OrcItem item) { public void addItem(int slot, OrcItem item) {
if (item == null) { if (item == null) {
removeItem(slot); removeItem(slot);
} else { } else {
items.put(slot, item); items.put(slot, item);
} }
} }
public void addItem(int row, int col, OrcItem item) { public void addItem(int row, int col, OrcItem item) {
addItem(row * 9 + col, item); addItem(row * 9 + col, item);
} }
public void removeItem(int slot) { public void removeItem(int slot) {
items.remove(slot); items.remove(slot);
} }
public void removeItem(int row, int col) { public void removeItem(int row, int col) {
removeItem(row * 9 + col); removeItem(row * 9 + col);
} }
public Inventory getInventory(Player p) { public Inventory getInventory(Player p) {
return getInventory(p, title); return getInventory(p, title);
} }
public void redraw(Player p) { public void redraw(Player p) {
p.closeInventory(); p.closeInventory();
p.openInventory(getInventory(p)); p.openInventory(getInventory(p));
} }
public Inventory getInventory(Player p, String title) { public Inventory getInventory(Player p, String title) {
Inventory inv; Inventory inv;
int size; int size;
if (type == null) { if (type == null) {
inv = Bukkit.createInventory(null, rows * 9, title); inv = Bukkit.createInventory(null, rows * 9, title);
size = rows * 9; size = rows * 9;
} else { } else {
inv = Bukkit.createInventory(null, type, title); inv = Bukkit.createInventory(null, type, title);
size = type.getDefaultSize(); size = type.getDefaultSize();
} }
for (Entry<Integer, OrcItem> entry : items.entrySet()) { for (Entry<Integer, OrcItem> entry : items.entrySet()) {
if (entry.getKey() >= 0 && entry.getKey() < size) { if (entry.getKey() >= 0 && entry.getKey() < size) {
inv.setItem(entry.getKey(), entry.getValue().getItemStack(p)); inv.setItem(entry.getKey(), entry.getValue().getItemStack(p));
} else { } else {
System.err.println("There is a problem with a configured Item!"); System.err.println("There is a problem with a configured Item!");
} }
} }
OrcListener.getInstance().register(p.getUniqueId(), this); OrcListener.getInstance().register(p.getUniqueId(), this);
return inv; return inv;
} }
public void setTitle(String title) { public void setTitle(String title) {
this.title = title; this.title = title;
} }
public String getTitle() { public String getTitle() {
return title; return title;
} }
} }

View File

@ -1,139 +1,139 @@
package de.butzlabben.inventory; package de.butzlabben.inventory;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import de.butzlabben.world.wrapper.WorldPlayer; import de.butzlabben.world.wrapper.WorldPlayer;
public class OrcItem { public class OrcItem {
public static OrcItem enabled, disabled, coming_soon, back, fill, error = new OrcItem(Material.BARRIER, null, 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"); "§cERROR: Item is wrong configured!", "§cPath in config: see Displayname");
private ItemStack is; private ItemStack is;
private OrcClickListener listener; private OrcClickListener listener;
private DependListener depend; private DependListener depend;
private Runnable callback; private Runnable callback;
public void setCallback(Runnable r) { public void setCallback(Runnable r) {
callback = r; callback = r;
} }
public OrcItem(Material mat, String display, String... lore) { public OrcItem(Material mat, String display, String... lore) {
setItemStack(mat, display, lore); setItemStack(mat, display, lore);
} }
public OrcItem(ItemStack is) { public OrcItem(ItemStack is) {
setItemStack(is); setItemStack(is);
} }
public OrcItem(Material mat, String display, List<String> lore) { public OrcItem(Material mat, String display, List<String> lore) {
setItemStack(mat, (byte) 0, display, lore); setItemStack(mat, (byte) 0, display, lore);
} }
public OrcItem(Material mat) { public OrcItem(Material mat) {
this(new ItemStack(mat)); this(new ItemStack(mat));
} }
public OrcItem(Material material, byte data, String display, ArrayList<String> lore) { public OrcItem(Material material, byte data, String display, ArrayList<String> lore) {
setItemStack(material, data, display, lore); setItemStack(material, data, display, lore);
} }
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public OrcItem setItemStack(Material mat, byte data, String display, List<String> lore) { public OrcItem setItemStack(Material mat, byte data, String display, List<String> lore) {
is = new ItemStack(mat, 1 , data); is = new ItemStack(mat, 1 , data);
ItemMeta meta = is.getItemMeta(); ItemMeta meta = is.getItemMeta();
meta.setDisplayName(display); meta.setDisplayName(display);
meta.setLore(lore); meta.setLore(lore);
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS); meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
is.setItemMeta(meta); is.setItemMeta(meta);
return this; return this;
} }
public ItemStack getItemStack(Player p) { public ItemStack getItemStack(Player p) {
if (p != null && depend != null) { if (p != null && depend != null) {
ItemStack is = depend.getItemStack(p, new WorldPlayer(p)); ItemStack is = depend.getItemStack(p, new WorldPlayer(p));
if (is != null) if (is != null)
return is; return is;
} }
return is; return is;
} }
public ItemStack getItemStack(Player p, WorldPlayer wp) { public ItemStack getItemStack(Player p, WorldPlayer wp) {
if (p != null && depend != null) { if (p != null && depend != null) {
ItemStack is = depend.getItemStack(p, wp); ItemStack is = depend.getItemStack(p, wp);
if (is != null) if (is != null)
return is; return is;
} }
return is; return is;
} }
public ItemStack getItemStack() { public ItemStack getItemStack() {
return is; return is;
} }
public OrcItem setOnClick(OrcClickListener listener) { public OrcItem setOnClick(OrcClickListener listener) {
this.listener = listener; this.listener = listener;
return this; return this;
} }
public OrcItem onClick(Player p, OrcInventory inv) { public OrcItem onClick(Player p, OrcInventory inv) {
if (listener != null) { if (listener != null) {
listener.onClick(p, inv, this); listener.onClick(p, inv, this);
} }
if (callback != null) if (callback != null)
callback.run(); callback.run();
return this; return this;
} }
public OrcItem setDisplay(String display) { public OrcItem setDisplay(String display) {
ItemMeta meta = is.getItemMeta(); ItemMeta meta = is.getItemMeta();
meta.setDisplayName(display); meta.setDisplayName(display);
is.setItemMeta(meta); is.setItemMeta(meta);
return this; return this;
} }
public OrcItem setLore(String... lore) { public OrcItem setLore(String... lore) {
ItemMeta meta = is.getItemMeta(); ItemMeta meta = is.getItemMeta();
meta.setLore(Arrays.asList(lore)); meta.setLore(Arrays.asList(lore));
is.setItemMeta(meta); is.setItemMeta(meta);
return this; return this;
} }
public OrcItem removeLore() { public OrcItem removeLore() {
ItemMeta meta = is.getItemMeta(); ItemMeta meta = is.getItemMeta();
meta.setLore(null); meta.setLore(null);
is.setItemMeta(meta); is.setItemMeta(meta);
return this; return this;
} }
public OrcItem setItemStack(ItemStack is) { public OrcItem setItemStack(ItemStack is) {
Objects.requireNonNull(is, "ItemStack cannot be null"); Objects.requireNonNull(is, "ItemStack cannot be null");
this.is = is; this.is = is;
ItemMeta meta = is.getItemMeta(); ItemMeta meta = is.getItemMeta();
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS); meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
is.setItemMeta(meta); is.setItemMeta(meta);
return this; return this;
} }
public OrcItem setItemStack(Material mat, String display, String... lore) { public OrcItem setItemStack(Material mat, String display, String... lore) {
return setItemStack(mat, (byte) 0, display, Arrays.asList(lore)); return setItemStack(mat, (byte) 0, display, Arrays.asList(lore));
} }
public OrcItem setDepend(DependListener listener) { public OrcItem setDepend(DependListener listener) {
depend = listener; depend = listener;
return this; return this;
} }
public OrcItem clone() { public OrcItem clone() {
return new OrcItem(is); return new OrcItem(is);
} }
} }

View File

@ -1,55 +1,55 @@
package de.butzlabben.inventory; package de.butzlabben.inventory;
import java.util.HashMap; import java.util.HashMap;
import java.util.UUID; import java.util.UUID;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent; import org.bukkit.event.inventory.InventoryCloseEvent;
import de.butzlabben.world.WorldSystem; import de.butzlabben.world.WorldSystem;
/** /**
* @author Butzlabben * @author Butzlabben
* @since 10.06.2018 * @since 10.06.2018
*/ */
public class OrcListener implements Listener { public class OrcListener implements Listener {
private static OrcListener instance; private static OrcListener instance;
private HashMap<UUID, OrcInventory> invs = new HashMap<>(); private HashMap<UUID, OrcInventory> invs = new HashMap<>();
public static synchronized OrcListener getInstance() { public static synchronized OrcListener getInstance() {
if (instance == null) if (instance == null)
instance = new OrcListener(); instance = new OrcListener();
return instance; return instance;
} }
private OrcListener() { private OrcListener() {
Bukkit.getPluginManager().registerEvents(this, WorldSystem.getInstance()); Bukkit.getPluginManager().registerEvents(this, WorldSystem.getInstance());
} }
@EventHandler @EventHandler
public void on(InventoryClickEvent e) { public void on(InventoryClickEvent e) {
if (e.getClickedInventory() != null && invs.containsKey(e.getWhoClicked().getUniqueId())) { if (e.getClickedInventory() != null && invs.containsKey(e.getWhoClicked().getUniqueId())) {
e.setCancelled(true); e.setCancelled(true);
OrcItem item = invs.get(e.getWhoClicked().getUniqueId()).items.get(e.getSlot()); OrcItem item = invs.get(e.getWhoClicked().getUniqueId()).items.get(e.getSlot());
if (item != null) if (item != null)
item.onClick((Player) e.getWhoClicked(), invs.get(e.getWhoClicked().getUniqueId())); item.onClick((Player) e.getWhoClicked(), invs.get(e.getWhoClicked().getUniqueId()));
} }
} }
public void register(UUID uuid, OrcInventory inv) { public void register(UUID uuid, OrcInventory inv) {
invs.put(uuid, inv); invs.put(uuid, inv);
} }
@EventHandler @EventHandler
public void on(InventoryCloseEvent e) { public void on(InventoryCloseEvent e) {
if (e.getInventory() != null && invs.containsKey(e.getPlayer().getUniqueId())) { if (e.getInventory() != null && invs.containsKey(e.getPlayer().getUniqueId())) {
invs.remove(e.getPlayer().getUniqueId()); invs.remove(e.getPlayer().getUniqueId());
} }
} }
} }

View File

@ -1,74 +1,74 @@
package de.butzlabben.inventory.pages; package de.butzlabben.inventory.pages;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import de.butzlabben.inventory.OrcInventory; import de.butzlabben.inventory.OrcInventory;
import de.butzlabben.inventory.OrcItem; import de.butzlabben.inventory.OrcItem;
import de.butzlabben.world.config.GuiConfig; import de.butzlabben.world.config.GuiConfig;
/** /**
* @author Butzlabben * @author Butzlabben
* @since 20.05.2018 * @since 20.05.2018
*/ */
public class InventoryPage extends OrcInventory { public class InventoryPage extends OrcInventory {
InventoryPage next, before = null; InventoryPage next, before = null;
public InventoryPage(String title, int page, int pages) { public InventoryPage(String title, int page, int pages) {
super(title, 6); super(title, 6);
YamlConfiguration cfg = GuiConfig.getConfig(); YamlConfiguration cfg = GuiConfig.getConfig();
String path = "options.players.currentpage"; String path = "options.players.currentpage";
OrcItem oi = new OrcItem(GuiConfig.getMaterial(cfg, path), GuiConfig.getData(cfg, path), OrcItem oi = new OrcItem(GuiConfig.getMaterial(cfg, path), GuiConfig.getData(cfg, path),
GuiConfig.getDisplay(cfg, path).replaceAll("%page", "" + page), GuiConfig.getLore(cfg, path)); GuiConfig.getDisplay(cfg, path).replaceAll("%page", "" + page), GuiConfig.getLore(cfg, path));
addItem(GuiConfig.getSlot(path), oi); addItem(GuiConfig.getSlot(path), oi);
path = "options.players.pagebefore"; path = "options.players.pagebefore";
oi = GuiConfig.getItem(path); oi = GuiConfig.getItem(path);
oi.setOnClick((p, inv, item) -> { oi.setOnClick((p, inv, item) -> {
p.closeInventory(); p.closeInventory();
p.openInventory(this.before.getInventory(p)); p.openInventory(this.before.getInventory(p));
}); });
addItem(GuiConfig.getSlot(path), oi); addItem(GuiConfig.getSlot(path), oi);
path = "options.players.nextpage"; path = "options.players.nextpage";
oi = GuiConfig.getItem(path); oi = GuiConfig.getItem(path);
oi.setOnClick((p, inv, item) -> { oi.setOnClick((p, inv, item) -> {
p.closeInventory(); p.closeInventory();
p.openInventory(this.next.getInventory(p)); p.openInventory(this.next.getInventory(p));
}); });
addItem(GuiConfig.getSlot(path), oi); addItem(GuiConfig.getSlot(path), oi);
} }
private int i = 0; private int i = 0;
@Override @Override
public Inventory getInventory(Player p) { public Inventory getInventory(Player p) {
return super.getInventory(p); return super.getInventory(p);
} }
public void addItem(OrcItem item) { public void addItem(OrcItem item) {
if (i > 36) { if (i > 36) {
System.err.println("More items than allowed in page view"); System.err.println("More items than allowed in page view");
return; return;
} }
addItem(i, item); addItem(i, item);
i++; i++;
} }
@EventHandler @EventHandler
public void on(InventoryClickEvent e) { public void on(InventoryClickEvent e) {
if (e.getClickedInventory() != null && e.getClickedInventory().getTitle() != null if (e.getClickedInventory() != null && e.getClickedInventory().getTitle() != null
&& e.getClickedInventory().getTitle().equals(title)) { && e.getClickedInventory().getTitle().equals(title)) {
e.setCancelled(true); e.setCancelled(true);
OrcItem item = items.get(e.getSlot()); OrcItem item = items.get(e.getSlot());
if (item != null) if (item != null)
item.onClick((Player) e.getWhoClicked(), this); item.onClick((Player) e.getWhoClicked(), this);
} }
} }
} }

View File

@ -1,13 +1,13 @@
package de.butzlabben.inventory.pages; package de.butzlabben.inventory.pages;
import de.butzlabben.inventory.OrcItem; import de.butzlabben.inventory.OrcItem;
/** /**
* @author Butzlabben * @author Butzlabben
* @since 21.05.2018 * @since 21.05.2018
*/ */
public interface ItemConverter<T> { public interface ItemConverter<T> {
public OrcItem convert(T element); public OrcItem convert(T element);
} }

View File

@ -1,65 +1,65 @@
package de.butzlabben.inventory.pages; package de.butzlabben.inventory.pages;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import de.butzlabben.inventory.OrcItem; import de.butzlabben.inventory.OrcItem;
/** /**
* @author Butzlabben * @author Butzlabben
* @since 21.05.2018 * @since 21.05.2018
*/ */
public class PageGUICreator<T> { public class PageGUICreator<T> {
private final int elementsPerPage; private final int elementsPerPage;
private List<InventoryPage> invpages; private List<InventoryPage> invpages;
public void create(String title, Collection<T> elements, ItemConverter<T> converter) { public void create(String title, Collection<T> elements, ItemConverter<T> converter) {
List<OrcItem> items = elements.stream().map(r -> converter.convert(r)).collect(Collectors.toList()); List<OrcItem> items = elements.stream().map(r -> converter.convert(r)).collect(Collectors.toList());
if (items == null || items.size() == 0) if (items == null || items.size() == 0)
return; return;
int pages = (int) (Math.ceil((double) (items.size() / (double) elementsPerPage) < 1 ? 1 : Math.ceil((double) items.size() / (double) elementsPerPage))); int pages = (int) (Math.ceil((double) (items.size() / (double) elementsPerPage) < 1 ? 1 : Math.ceil((double) items.size() / (double) elementsPerPage)));
invpages = new ArrayList<>(pages); invpages = new ArrayList<>(pages);
for (int i = 1; i < pages + 1; i++) { for (int i = 1; i < pages + 1; i++) {
int start = i == 1 ? 0 : elementsPerPage * (i - 1); int start = i == 1 ? 0 : elementsPerPage * (i - 1);
int end = items.size() < elementsPerPage * i ? items.size() : elementsPerPage * i; int end = items.size() < elementsPerPage * i ? items.size() : elementsPerPage * i;
List<OrcItem> page = items.subList(start, end); List<OrcItem> page = items.subList(start, end);
InventoryPage invpage = new InventoryPage(title, i, pages); InventoryPage invpage = new InventoryPage(title, i, pages);
page.forEach(invpage::addItem); page.forEach(invpage::addItem);
invpages.add(invpage); invpages.add(invpage);
} }
for (int i = 0; i < invpages.size(); i++) { for (int i = 0; i < invpages.size(); i++) {
int beforeIndex = i == 0 ? invpages.size() - 1 : i - 1; int beforeIndex = i == 0 ? invpages.size() - 1 : i - 1;
int nextIndex = i == invpages.size() - 1 ? 0 : i + 1; int nextIndex = i == invpages.size() - 1 ? 0 : i + 1;
invpages.get(i).before = invpages.get(beforeIndex); invpages.get(i).before = invpages.get(beforeIndex);
invpages.get(i).next = invpages.get(nextIndex); invpages.get(i).next = invpages.get(nextIndex);
} }
} }
public void show(Player p) { public void show(Player p) {
p.openInventory(invpages.get(0).getInventory(p)); p.openInventory(invpages.get(0).getInventory(p));
} }
public PageGUICreator() { public PageGUICreator() {
this(4 * 9); this(4 * 9);
} }
public List<InventoryPage> getInvPages() { public List<InventoryPage> getInvPages() {
return invpages; return invpages;
} }
public PageGUICreator(int elementsPerPage) { public PageGUICreator(int elementsPerPage) {
this.elementsPerPage = elementsPerPage; this.elementsPerPage = elementsPerPage;
} }
} }

View File

@ -1,9 +1,9 @@
package de.butzlabben.world; package de.butzlabben.world;
public class GCRunnable implements Runnable { public class GCRunnable implements Runnable {
@Override @Override
public void run() { public void run() {
new Thread(() -> System.gc()).start(); new Thread(() -> System.gc()).start();
} }
} }

View File

@ -1,146 +1,146 @@
package de.butzlabben.world; package de.butzlabben.world;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder; import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer; import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.google.gson.JsonParseException; import com.google.gson.JsonParseException;
import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer; import com.google.gson.JsonSerializer;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property; import com.mojang.authlib.properties.Property;
import com.mojang.authlib.properties.PropertyMap; import com.mojang.authlib.properties.PropertyMap;
import com.mojang.util.UUIDTypeAdapter; import com.mojang.util.UUIDTypeAdapter;
/** /**
* @author Butzlabben * @author Butzlabben
* @since 26.02.2018 * @since 26.02.2018
*/ */
public class GameProfileBuilder { public class GameProfileBuilder {
private static Gson gson = new GsonBuilder().disableHtmlEscaping() private static Gson gson = new GsonBuilder().disableHtmlEscaping()
.registerTypeAdapter(UUID.class, new UUIDTypeAdapter()) .registerTypeAdapter(UUID.class, new UUIDTypeAdapter())
.registerTypeAdapter(GameProfile.class, new GameProfileSerializer()) .registerTypeAdapter(GameProfile.class, new GameProfileSerializer())
.registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer()).create(); .registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer()).create();
private static HashMap<UUID, CachedProfile> cache = new HashMap<>(); private static HashMap<UUID, CachedProfile> cache = new HashMap<>();
private static long cacheTime = -1L; private static long cacheTime = -1L;
private static Object sync = new Object(); private static Object sync = new Object();
public static GameProfile fetch(UUID uuid) throws IOException { public static GameProfile fetch(UUID uuid) throws IOException {
return fetch(uuid, false); return fetch(uuid, false);
} }
public static GameProfile fetch(UUID uuid, boolean forceNew) throws IOException { public static GameProfile fetch(UUID uuid, boolean forceNew) throws IOException {
if ((!forceNew) && (cache.containsKey(uuid)) && (((CachedProfile) cache.get(uuid)).isValid())) { if ((!forceNew) && (cache.containsKey(uuid)) && (((CachedProfile) cache.get(uuid)).isValid())) {
return ((CachedProfile) cache.get(uuid)).profile; return ((CachedProfile) cache.get(uuid)).profile;
} }
HttpURLConnection connection; HttpURLConnection connection;
synchronized (sync) { synchronized (sync) {
connection = (HttpURLConnection) new URL( connection = (HttpURLConnection) new URL(
String.format("https://sessionserver.mojang.com/session/minecraft/profile/%s?unsigned=false", String.format("https://sessionserver.mojang.com/session/minecraft/profile/%s?unsigned=false",
new Object[] { UUIDTypeAdapter.fromUUID(uuid) })).openConnection(); new Object[] { UUIDTypeAdapter.fromUUID(uuid) })).openConnection();
connection.setReadTimeout(5000); connection.setReadTimeout(5000);
} }
if (connection.getResponseCode() == 200) { if (connection.getResponseCode() == 200) {
String json = new BufferedReader(new InputStreamReader(connection.getInputStream())).readLine(); String json = new BufferedReader(new InputStreamReader(connection.getInputStream())).readLine();
GameProfile result = (GameProfile) gson.fromJson(json, GameProfile.class); GameProfile result = (GameProfile) gson.fromJson(json, GameProfile.class);
cache.put(uuid, new CachedProfile(result)); cache.put(uuid, new CachedProfile(result));
return result; return result;
} }
if ((!forceNew) && (cache.containsKey(uuid))) { if ((!forceNew) && (cache.containsKey(uuid))) {
return ((CachedProfile) cache.get(uuid)).profile; return ((CachedProfile) cache.get(uuid)).profile;
} }
throw new IOException("Could not connect to mojang servers for unknown player: " + uuid.toString()); throw new IOException("Could not connect to mojang servers for unknown player: " + uuid.toString());
} }
public static GameProfile getProfile(UUID uuid, String name, String skin) { public static GameProfile getProfile(UUID uuid, String name, String skin) {
return getProfile(uuid, name, skin, null); return getProfile(uuid, name, skin, null);
} }
public static GameProfile getProfile(UUID uuid, String name, String skinUrl, String capeUrl) { public static GameProfile getProfile(UUID uuid, String name, String skinUrl, String capeUrl) {
GameProfile profile = new GameProfile(uuid, name); GameProfile profile = new GameProfile(uuid, name);
boolean cape = (capeUrl != null) && (!capeUrl.isEmpty()); boolean cape = (capeUrl != null) && (!capeUrl.isEmpty());
List<Object> args = new ArrayList<>(); List<Object> args = new ArrayList<>();
args.add(Long.valueOf(System.currentTimeMillis())); args.add(Long.valueOf(System.currentTimeMillis()));
args.add(UUIDTypeAdapter.fromUUID(uuid)); args.add(UUIDTypeAdapter.fromUUID(uuid));
args.add(name); args.add(name);
args.add(skinUrl); args.add(skinUrl);
if (cape) { if (cape) {
args.add(capeUrl); args.add(capeUrl);
} }
profile.getProperties().put("textures", profile.getProperties().put("textures",
new Property("textures", new Property("textures",
Base64Coder.encodeString(String.format( Base64Coder.encodeString(String.format(
cape ? "{\"timestamp\":%d,\"profileId\":\"%s\",\"profileName\":\"%s\",\"isPublic\":true,\"textures\":{\"SKIN\":{\"url\":\"%s\"},\"CAPE\":{\"url\":\"%s\"}}}" 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\"}}}", : "{\"timestamp\":%d,\"profileId\":\"%s\",\"profileName\":\"%s\",\"isPublic\":true,\"textures\":{\"SKIN\":{\"url\":\"%s\"}}}",
args.toArray(new Object[args.size()]))))); args.toArray(new Object[args.size()])))));
return profile; return profile;
} }
public static void setCacheTime(long time) { public static void setCacheTime(long time) {
cacheTime = time; cacheTime = time;
} }
private static class GameProfileSerializer implements JsonSerializer<GameProfile>, JsonDeserializer<GameProfile> { private static class GameProfileSerializer implements JsonSerializer<GameProfile>, JsonDeserializer<GameProfile> {
public GameProfile deserialize(JsonElement json, Type type, JsonDeserializationContext context) public GameProfile deserialize(JsonElement json, Type type, JsonDeserializationContext context)
throws JsonParseException { throws JsonParseException {
JsonObject object = (JsonObject) json; JsonObject object = (JsonObject) json;
UUID id = object.has("id") ? (UUID) context.deserialize(object.get("id"), UUID.class) : null; UUID id = object.has("id") ? (UUID) context.deserialize(object.get("id"), UUID.class) : null;
String name = object.has("name") ? object.getAsJsonPrimitive("name").getAsString() : null; String name = object.has("name") ? object.getAsJsonPrimitive("name").getAsString() : null;
GameProfile profile = new GameProfile(id, name); GameProfile profile = new GameProfile(id, name);
if (object.has("properties")) { if (object.has("properties")) {
for (Map.Entry<String, Property> prop : ((PropertyMap) context.deserialize(object.get("properties"), for (Map.Entry<String, Property> prop : ((PropertyMap) context.deserialize(object.get("properties"),
PropertyMap.class)).entries()) { PropertyMap.class)).entries()) {
profile.getProperties().put((String) prop.getKey(), (Property) prop.getValue()); profile.getProperties().put((String) prop.getKey(), (Property) prop.getValue());
} }
} }
return profile; return profile;
} }
public JsonElement serialize(GameProfile profile, Type type, JsonSerializationContext context) { public JsonElement serialize(GameProfile profile, Type type, JsonSerializationContext context) {
JsonObject result = new JsonObject(); JsonObject result = new JsonObject();
if (profile.getId() != null) { if (profile.getId() != null) {
result.add("id", context.serialize(profile.getId())); result.add("id", context.serialize(profile.getId()));
} }
if (profile.getName() != null) { if (profile.getName() != null) {
result.addProperty("name", profile.getName()); result.addProperty("name", profile.getName());
} }
if (!profile.getProperties().isEmpty()) { if (!profile.getProperties().isEmpty()) {
result.add("properties", context.serialize(profile.getProperties())); result.add("properties", context.serialize(profile.getProperties()));
} }
return result; return result;
} }
} }
private static class CachedProfile { private static class CachedProfile {
private GameProfile profile; private GameProfile profile;
public CachedProfile(GameProfile profile) { public CachedProfile(GameProfile profile) {
this.profile = profile; this.profile = profile;
} }
public boolean isValid() { public boolean isValid() {
return GameProfileBuilder.cacheTime < 0L; return GameProfileBuilder.cacheTime < 0L;
} }
} }
} }

View File

@ -1,49 +1,49 @@
package de.butzlabben.world; package de.butzlabben.world;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import de.butzlabben.world.config.MessageConfig; import de.butzlabben.world.config.MessageConfig;
import de.butzlabben.world.config.PluginConfig; import de.butzlabben.world.config.PluginConfig;
import de.butzlabben.world.wrapper.SystemWorld; import de.butzlabben.world.wrapper.SystemWorld;
public class WorldCheckerRunnable implements Runnable { public class WorldCheckerRunnable implements Runnable {
@Override @Override
public void run() { public void run() {
for (World world : Bukkit.getWorlds()) { for (World world : Bukkit.getWorlds()) {
if (SystemWorld.getSystemWorld(world.getName()) == null || !SystemWorld.getSystemWorld(world.getName()).isLoaded()) if (SystemWorld.getSystemWorld(world.getName()) == null || !SystemWorld.getSystemWorld(world.getName()).isLoaded())
continue; continue;
int other = world.getEntities().size() - world.getPlayers().size(); int other = world.getEntities().size() - world.getPlayers().size();
if (other > PluginConfig.getEntitysPerWorld()) { if (other > PluginConfig.getEntitysPerWorld()) {
String worldname = world.getName(); String worldname = world.getName();
for (Entity e : world.getEntities()) { for (Entity e : world.getEntities()) {
if (!(e instanceof Player)) { if (!(e instanceof Player)) {
e.remove(); e.remove();
} }
} }
String ownerofWorld = null; String ownerofWorld = null;
for (OfflinePlayer p : Bukkit.getOfflinePlayers()) { for (OfflinePlayer p : Bukkit.getOfflinePlayers()) {
if (p.getUniqueId().toString() if (p.getUniqueId().toString()
.equals(worldname.substring(worldname.length() - 36, worldname.length()))) .equals(worldname.substring(worldname.length() - 36, worldname.length())))
ownerofWorld = p.getName(); ownerofWorld = p.getName();
} }
String members = ""; String members = "";
for (Player p : world.getPlayers()) { for (Player p : world.getPlayers()) {
members += p.getName() + " "; members += p.getName() + " ";
} }
for (Player p : Bukkit.getOnlinePlayers()) { for (Player p : Bukkit.getOnlinePlayers()) {
if (!p.hasPermission("ws.lag")) if (!p.hasPermission("ws.lag"))
continue; continue;
p.sendMessage(MessageConfig.getLagDetection().replaceAll("%world", p.sendMessage(MessageConfig.getLagDetection().replaceAll("%world",
ownerofWorld + " ( ID: " + world.getName().substring(2, worldname.length() - 37) + " )")); ownerofWorld + " ( ID: " + world.getName().substring(2, worldname.length() - 37) + " )"));
p.sendMessage(MessageConfig.getPlayerList().replaceAll("%players", members)); p.sendMessage(MessageConfig.getPlayerList().replaceAll("%players", members));
} }
} }
} }
} }
} }

View File

@ -1,162 +1,162 @@
package de.butzlabben.world.config; package de.butzlabben.world.config;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.UUID; import java.util.UUID;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class DependenceConfig { public class DependenceConfig {
private OfflinePlayer op; private OfflinePlayer op;
public DependenceConfig() { public DependenceConfig() {
setConfig(); setConfig();
} }
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public DependenceConfig(String s) { public DependenceConfig(String s) {
OfflinePlayer op = null; OfflinePlayer op = null;
try { try {
op = Bukkit.getOfflinePlayer(UUID.fromString(s)); op = Bukkit.getOfflinePlayer(UUID.fromString(s));
} catch (Exception e) { } catch (Exception e) {
} }
if (op == null) { if (op == null) {
op = Bukkit.getOfflinePlayer(s); op = Bukkit.getOfflinePlayer(s);
} }
this.op = op; this.op = op;
} }
private void setConfig() { private void setConfig() {
File dconfig = new File("plugins//WorldSystem//dependence.yml"); File dconfig = new File("plugins//WorldSystem//dependence.yml");
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig); YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
cfg.set("HighestID", -1); cfg.set("HighestID", -1);
try { try {
cfg.save(dconfig); cfg.save(dconfig);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
public DependenceConfig(Player p) { public DependenceConfig(Player p) {
this.op = p; this.op = p;
refreshName(); refreshName();
} }
public DependenceConfig(OfflinePlayer p) { public DependenceConfig(OfflinePlayer p) {
this.op = p; this.op = p;
refreshName(); refreshName();
} }
public void refreshName() { public void refreshName() {
if (hasWorld()) { if (hasWorld()) {
File dconfig = new File("plugins//WorldSystem//dependence.yml"); File dconfig = new File("plugins//WorldSystem//dependence.yml");
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig); YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
String uuid = this.op.getUniqueId().toString(); String uuid = this.op.getUniqueId().toString();
cfg.set("Dependences." + uuid + ".ActualName", op.getName()); cfg.set("Dependences." + uuid + ".ActualName", op.getName());
try { try {
cfg.save(dconfig); cfg.save(dconfig);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
} }
public void createNewEntry() { public void createNewEntry() {
File dconfig = new File("plugins//WorldSystem//dependence.yml"); File dconfig = new File("plugins//WorldSystem//dependence.yml");
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig); YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
String uuid = this.op.getUniqueId().toString(); String uuid = this.op.getUniqueId().toString();
int id = cfg.getInt("HighestID"); int id = cfg.getInt("HighestID");
id++; id++;
cfg.set("HighestID", id); cfg.set("HighestID", id);
cfg.set("Dependences." + uuid + ".ID", id); cfg.set("Dependences." + uuid + ".ID", id);
cfg.set("Dependences." + uuid + ".ActualName", op.getName()); cfg.set("Dependences." + uuid + ".ActualName", op.getName());
try { try {
cfg.save(dconfig); cfg.save(dconfig);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
public boolean hasWorld() { public boolean hasWorld() {
File dconfig = new File("plugins//WorldSystem//dependence.yml"); File dconfig = new File("plugins//WorldSystem//dependence.yml");
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig); YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
String uuid = op.getUniqueId().toString(); String uuid = op.getUniqueId().toString();
//Fix for #40 //Fix for #40
if (cfg.isInt("Dependences." + uuid + ".ID")) if (cfg.isInt("Dependences." + uuid + ".ID"))
return true; return true;
return false; return false;
} }
public String getWorldname() { public String getWorldname() {
File dconfig = new File("plugins//WorldSystem//dependence.yml"); File dconfig = new File("plugins//WorldSystem//dependence.yml");
YamlConfiguration dcfg = YamlConfiguration.loadConfiguration(dconfig); YamlConfiguration dcfg = YamlConfiguration.loadConfiguration(dconfig);
String uuid = op.getUniqueId().toString(); String uuid = op.getUniqueId().toString();
int id = dcfg.getInt("Dependences." + uuid + ".ID"); int id = dcfg.getInt("Dependences." + uuid + ".ID");
String worldname = "ID" + id + "-" + uuid; String worldname = "ID" + id + "-" + uuid;
return worldname; return worldname;
} }
public String getWorldNamebyOfflinePlayer() { public String getWorldNamebyOfflinePlayer() {
String name = ""; String name = "";
String uuid = op.getUniqueId().toString(); String uuid = op.getUniqueId().toString();
File dconfig = new File("plugins//WorldSystem//dependence.yml"); File dconfig = new File("plugins//WorldSystem//dependence.yml");
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig); YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
if (cfg.getString("Dependences." + uuid + ".ActualName") == null) { if (cfg.getString("Dependences." + uuid + ".ActualName") == null) {
name = "n"; name = "n";
} else { } else {
name = "ID" + cfg.getInt("Dependences." + uuid + ".ID") + "-" + uuid; name = "ID" + cfg.getInt("Dependences." + uuid + ".ID") + "-" + uuid;
} }
return name; return name;
} }
public void setLastLoaded() { public void setLastLoaded() {
File dconfig = new File("plugins//WorldSystem//dependence.yml"); File dconfig = new File("plugins//WorldSystem//dependence.yml");
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig); YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
String uuid = op.getUniqueId().toString(); String uuid = op.getUniqueId().toString();
cfg.set("Dependences." + uuid + ".last_loaded", System.currentTimeMillis()); cfg.set("Dependences." + uuid + ".last_loaded", System.currentTimeMillis());
try { try {
cfg.save(dconfig); cfg.save(dconfig);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
public static int getHighestID() { public static int getHighestID() {
File dconfig = new File("plugins//WorldSystem//dependence.yml"); File dconfig = new File("plugins//WorldSystem//dependence.yml");
YamlConfiguration dcfg = YamlConfiguration.loadConfiguration(dconfig); YamlConfiguration dcfg = YamlConfiguration.loadConfiguration(dconfig);
return dcfg.getInt("HighestID"); return dcfg.getInt("HighestID");
} }
public int getID() { public int getID() {
File dconfig = new File("plugins//WorldSystem//dependence.yml"); File dconfig = new File("plugins//WorldSystem//dependence.yml");
YamlConfiguration dcfg = YamlConfiguration.loadConfiguration(dconfig); YamlConfiguration dcfg = YamlConfiguration.loadConfiguration(dconfig);
return dcfg.getInt("Dependences." + op.getUniqueId().toString() + ".ID"); return dcfg.getInt("Dependences." + op.getUniqueId().toString() + ".ID");
} }
public OfflinePlayer getOwner() { public OfflinePlayer getOwner() {
return op; return op;
} }
public static void checkWorlds() { public static void checkWorlds() {
File dconfig = new File("plugins//WorldSystem//dependence.yml"); File dconfig = new File("plugins//WorldSystem//dependence.yml");
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig); YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
long deleteTime = 1000 * 60 * 60 * 24 * PluginConfig.deleteAfter(); long deleteTime = 1000 * 60 * 60 * 24 * PluginConfig.deleteAfter();
long now = System.currentTimeMillis(); long now = System.currentTimeMillis();
for (String s : cfg.getConfigurationSection("Dependences").getKeys(false)) { for (String s : cfg.getConfigurationSection("Dependences").getKeys(false)) {
if (!cfg.isLong("Dependences." + s + ".last_loaded") && !cfg.isInt("Dependences." + s + ".last_loaded")) if (!cfg.isLong("Dependences." + s + ".last_loaded") && !cfg.isInt("Dependences." + s + ".last_loaded"))
continue; continue;
long lastLoaded = cfg.getLong("Dependences." + s + ".last_loaded"); long lastLoaded = cfg.getLong("Dependences." + s + ".last_loaded");
long diff = now - lastLoaded; long diff = now - lastLoaded;
if (diff > deleteTime) { if (diff > deleteTime) {
Bukkit.getConsoleSender().sendMessage( Bukkit.getConsoleSender().sendMessage(
PluginConfig.getPrefix() + "World of " + s + " was not loaded for too long. Deleting!"); PluginConfig.getPrefix() + "World of " + s + " was not loaded for too long. Deleting!");
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "ws delete " + s); Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "ws delete " + s);
} }
} }
} }
} }

View File

@ -1,56 +1,56 @@
package de.butzlabben.world.config; package de.butzlabben.world.config;
import java.io.File; import java.io.File;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
public class Entry { public class Entry {
private OfflinePlayer op; private OfflinePlayer op;
private String uuid; private String uuid;
private int id; private int id;
private String worldname; private String worldname;
public static int entrys() { public static int entrys() {
int entrys = 0; int entrys = 0;
for(OfflinePlayer op : Bukkit.getOfflinePlayers()) { for(OfflinePlayer op : Bukkit.getOfflinePlayers()) {
Entry e = new Entry(op); Entry e = new Entry(op);
if(e.hasWorld()) if(e.hasWorld())
++entrys; ++entrys;
} }
return entrys; return entrys;
} }
protected OfflinePlayer getOfflinePlayer() { protected OfflinePlayer getOfflinePlayer() {
return op; return op;
} }
protected int getID() { protected int getID() {
return id; return id;
} }
protected String getWorldname() { protected String getWorldname() {
return worldname; return worldname;
} }
protected boolean hasWorld() { protected boolean hasWorld() {
if(worldname.equals("n")) if(worldname.equals("n"))
return false; return false;
return true; return true;
} }
protected Entry(OfflinePlayer op) { protected Entry(OfflinePlayer op) {
uuid = op.getUniqueId().toString(); uuid = op.getUniqueId().toString();
this.op = op; this.op = op;
File dconfig = new File("plugins//WorldSystem//dependence.yml"); File dconfig = new File("plugins//WorldSystem//dependence.yml");
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig); YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
if (cfg.getString("Dependences." + uuid + ".ActualName") == null) { if (cfg.getString("Dependences." + uuid + ".ActualName") == null) {
worldname = "n"; worldname = "n";
} else { } else {
worldname = "ID" + cfg.getInt("Dependences." + uuid + ".ID") + " " + uuid; worldname = "ID" + cfg.getInt("Dependences." + uuid + ".ID") + " " + uuid;
id = cfg.getInt("Dependences." + uuid + ".ID"); id = cfg.getInt("Dependences." + uuid + ".ID");
} }
} }
} }

View File

@ -1,153 +1,153 @@
package de.butzlabben.world.config; package de.butzlabben.world.config;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.file.Files; import java.nio.file.Files;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import de.butzlabben.inventory.OrcItem; import de.butzlabben.inventory.OrcItem;
import de.butzlabben.world.WorldSystem; import de.butzlabben.world.WorldSystem;
public class GuiConfig { public class GuiConfig {
private GuiConfig() { private GuiConfig() {
} }
private static File file; private static File file;
public static void checkConfig(File f) { public static void checkConfig(File f) {
file = f; file = f;
if (file.exists() == false) { if (file.exists() == false) {
try { try {
String guiFileResource; String guiFileResource;
if (WorldSystem.is1_13()) { if (WorldSystem.is1_13()) {
guiFileResource = "1_13_gui.yml"; guiFileResource = "1_13_gui.yml";
} else { } else {
guiFileResource = "old_gui.yml"; guiFileResource = "old_gui.yml";
} }
InputStream in = JavaPlugin.getPlugin(WorldSystem.class).getResource(guiFileResource); InputStream in = JavaPlugin.getPlugin(WorldSystem.class).getResource(guiFileResource);
Files.copy(in, file.toPath()); Files.copy(in, file.toPath());
} catch (IOException e) { } catch (IOException e) {
System.err.println("Wasn't able to create Config"); System.err.println("Wasn't able to create Config");
e.printStackTrace(); e.printStackTrace();
} }
} }
OrcItem.enabled = getEnabled(); OrcItem.enabled = getEnabled();
OrcItem.disabled = getDisabled(); OrcItem.disabled = getDisabled();
OrcItem.coming_soon = getComingSoon(); OrcItem.coming_soon = getComingSoon();
OrcItem.back = getBack(); OrcItem.back = getBack();
OrcItem.fill = getFill(); OrcItem.fill = getFill();
} }
public static YamlConfiguration getConfig() { public static YamlConfiguration getConfig() {
try { try {
return YamlConfiguration return YamlConfiguration
.loadConfiguration(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8"))); .loadConfiguration(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8")));
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
e.printStackTrace(); e.printStackTrace();
} }
return null; return null;
} }
public static int getSlot(String path) { public static int getSlot(String path) {
YamlConfiguration cfg = getConfig(); YamlConfiguration cfg = getConfig();
return (cfg.getInt(path + ".slot.row") - 1) * 9 + cfg.getInt(path + ".slot.col") - 1; return (cfg.getInt(path + ".slot.row") - 1) * 9 + cfg.getInt(path + ".slot.col") - 1;
} }
public static int getState(String path) { public static int getState(String path) {
YamlConfiguration cfg = getConfig(); YamlConfiguration cfg = getConfig();
return (cfg.getInt(path + ".state.row") - 1) * 9 + cfg.getInt(path + ".state.col") - 1; return (cfg.getInt(path + ".state.row") - 1) * 9 + cfg.getInt(path + ".state.col") - 1;
} }
public static boolean isEnabled(String path) { public static boolean isEnabled(String path) {
return getConfig().getBoolean(path + ".enabled", true); return getConfig().getBoolean(path + ".enabled", true);
} }
public static int getRows(String path) { public static int getRows(String path) {
return getConfig().getInt(path + ".rows", 1); return getConfig().getInt(path + ".rows", 1);
} }
public static String getDisplay(FileConfiguration cfg, String path) { public static String getDisplay(FileConfiguration cfg, String path) {
return ChatColor.translateAlternateColorCodes('&', cfg.getString(path + ".display")); return ChatColor.translateAlternateColorCodes('&', cfg.getString(path + ".display"));
} }
public static ArrayList<String> getLore(FileConfiguration cfg, String path) { public static ArrayList<String> getLore(FileConfiguration cfg, String path) {
List<String> list = cfg.getStringList(path + ".lore"); List<String> list = cfg.getStringList(path + ".lore");
ArrayList<String> colored = new ArrayList<>(list.size()); ArrayList<String> colored = new ArrayList<>(list.size());
for (String s : list) { for (String s : list) {
colored.add(ChatColor.translateAlternateColorCodes('&', s)); colored.add(ChatColor.translateAlternateColorCodes('&', s));
} }
return colored; return colored;
} }
public static byte getData(FileConfiguration cfg, String path) { public static byte getData(FileConfiguration cfg, String path) {
return (byte) cfg.getInt(path + ".data", 0); return (byte) cfg.getInt(path + ".data", 0);
} }
public static String getTitle(FileConfiguration cfg, String path) { public static String getTitle(FileConfiguration cfg, String path) {
return cfg.getString(path + ".title"); return cfg.getString(path + ".title");
} }
public static Material getMaterial(FileConfiguration cfg, String path) { public static Material getMaterial(FileConfiguration cfg, String path) {
try { try {
return Material.valueOf(cfg.getString(path + ".material").toUpperCase()); return Material.valueOf(cfg.getString(path + ".material").toUpperCase());
} catch (IllegalArgumentException ex) { } catch (IllegalArgumentException ex) {
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "§cUnknown material: " + path); Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "§cUnknown material: " + path);
return null; return null;
} }
} }
public static OrcItem getItem(String path) { public static OrcItem getItem(String path) {
YamlConfiguration cfg = getConfig(); YamlConfiguration cfg = getConfig();
try { try {
return new OrcItem(getMaterial(cfg, path), getData(cfg, path), getDisplay(cfg, path), getLore(cfg, path)); return new OrcItem(getMaterial(cfg, path), getData(cfg, path), getDisplay(cfg, path), getLore(cfg, path));
} catch (Exception e) { } catch (Exception e) {
} }
try { try {
return new OrcItem(getMaterial(cfg, path), getDisplay(cfg, path), getLore(cfg, path)); return new OrcItem(getMaterial(cfg, path), getDisplay(cfg, path), getLore(cfg, path));
} catch (Exception e) { } catch (Exception e) {
} }
return OrcItem.error.clone().setDisplay("§c" + path); return OrcItem.error.clone().setDisplay("§c" + path);
} }
public static OrcItem getEnabled() { public static OrcItem getEnabled() {
return getItem("options.enabled"); return getItem("options.enabled");
} }
public static OrcItem getDisabled() { public static OrcItem getDisabled() {
return getItem("options.disabled"); return getItem("options.disabled");
} }
public static OrcItem getComingSoon() { public static OrcItem getComingSoon() {
return getItem("options.coming_soon"); return getItem("options.coming_soon");
} }
private static OrcItem getBack() { private static OrcItem getBack() {
return getItem("options.back"); return getItem("options.back");
} }
private static OrcItem getFill() { private static OrcItem getFill() {
return getItem("options.fill"); return getItem("options.fill");
} }
public static boolean isFill(String path) { public static boolean isFill(String path) {
return getConfig().getBoolean(path + ".fill"); return getConfig().getBoolean(path + ".fill");
} }
public static Material getSkullItem() { public static Material getSkullItem() {
return getMaterial(getConfig(), "options.players.playerhead"); return getMaterial(getConfig(), "options.players.playerhead");
} }
} }

View File

@ -1,245 +1,245 @@
package de.butzlabben.world.config; package de.butzlabben.world.config;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.StandardCopyOption; import java.nio.file.StandardCopyOption;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.WorldCreator; import org.bukkit.WorldCreator;
import org.bukkit.World.Environment; import org.bukkit.World.Environment;
import org.bukkit.WorldType; import org.bukkit.WorldType;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import de.butzlabben.world.WorldSystem; import de.butzlabben.world.WorldSystem;
import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ChatColor;
public class PluginConfig { public class PluginConfig {
private PluginConfig() { private PluginConfig() {
} }
private static File file; private static File file;
public static void checkConfig(File f) { public static void checkConfig(File f) {
file = f; file = f;
if (file.exists()) { if (file.exists()) {
YamlConfiguration cfg = getConfig(); YamlConfiguration cfg = getConfig();
if (false == (cfg.isString("worldfolder") && cfg.isInt("unloadingtime") if (false == (cfg.isString("worldfolder") && cfg.isInt("unloadingtime")
&& cfg.isBoolean("survival") && cfg.isString("language") && cfg.isString("prefix") && cfg.isBoolean("survival") && cfg.isString("language") && cfg.isString("prefix")
&& cfg.isInt("request_expires") && cfg.isBoolean("need_confirm") && cfg.isInt("request_expires") && cfg.isBoolean("need_confirm")
&& cfg.isBoolean("contact_authserver") && cfg.isBoolean("spawn_teleportation") && cfg.isBoolean("contact_authserver") && cfg.isBoolean("spawn_teleportation")
&& cfg.isInt("delete_after") && cfg.isBoolean("worldtemplates.multi_choose") && cfg.isInt("delete_after") && cfg.isBoolean("worldtemplates.multi_choose")
&& cfg.isString("worldtemplates.default") && && cfg.isString("worldtemplates.default") &&
cfg.isInt("lagsystem.period_in_seconds") && cfg.isInt("lagsystem.entities_per_world") cfg.isInt("lagsystem.period_in_seconds") && cfg.isInt("lagsystem.entities_per_world")
&& cfg.isBoolean("lagsystem.garbagecollector.use") && cfg.isBoolean("lagsystem.garbagecollector.use")
&& cfg.isInt("lagsystem.garbagecollector.period_in_minutes") && && cfg.isInt("lagsystem.garbagecollector.period_in_minutes") &&
cfg.isString("worldgeneration.type") && cfg.isString("worldgeneration.environment") cfg.isString("worldgeneration.type") && cfg.isString("worldgeneration.environment")
&& cfg.isString("worldgeneration.generator") && cfg.isString("worldgeneration.generator")
&& (cfg.isLong("worldgeneration.seed") || cfg.isInt("worldgeneration.seed")) && && (cfg.isLong("worldgeneration.seed") || cfg.isInt("worldgeneration.seed")) &&
cfg.isString("spawn.spawnpoint.world") && cfg.isInt("spawn.gamemode") cfg.isString("spawn.spawnpoint.world") && cfg.isInt("spawn.gamemode")
&& (cfg.isDouble("spawn.spawnpoint.x") || cfg.isInt("spawn.spawnpoint.x")) && (cfg.isDouble("spawn.spawnpoint.x") || cfg.isInt("spawn.spawnpoint.x"))
&& (cfg.isDouble("spawn.spawnpoint.y") || cfg.isInt("spawn.spawnpoint.y")) && (cfg.isDouble("spawn.spawnpoint.y") || cfg.isInt("spawn.spawnpoint.y"))
&& (cfg.isDouble("spawn.spawnpoint.z") || cfg.isInt("spawn.spawnpoint.z")) && (cfg.isDouble("spawn.spawnpoint.z") || cfg.isInt("spawn.spawnpoint.z"))
&& (cfg.isDouble("spawn.spawnpoint.yaw") || cfg.isInt("spawn.spawnpoint.yaw")) && (cfg.isDouble("spawn.spawnpoint.yaw") || cfg.isInt("spawn.spawnpoint.yaw"))
&& (cfg.isDouble("spawn.spawnpoint.pitch") || cfg.isInt("spawn.spawnpoint.pitch")) && && (cfg.isDouble("spawn.spawnpoint.pitch") || cfg.isInt("spawn.spawnpoint.pitch")) &&
cfg.isBoolean("worldspawn.use") cfg.isBoolean("worldspawn.use")
&& (cfg.isDouble("worldspawn.spawnpoint.x") || cfg.isInt("worldspawn.spawnpoint.x")) && (cfg.isDouble("worldspawn.spawnpoint.x") || cfg.isInt("worldspawn.spawnpoint.x"))
&& (cfg.isDouble("worldspawn.spawnpoint.y") || cfg.isInt("worldspawn.spawnpoint.y")) && (cfg.isDouble("worldspawn.spawnpoint.y") || cfg.isInt("worldspawn.spawnpoint.y"))
&& (cfg.isDouble("worldspawn.spawnpoint.z") || cfg.isInt("worldspawn.spawnpoint.z")) && (cfg.isDouble("worldspawn.spawnpoint.z") || cfg.isInt("worldspawn.spawnpoint.z"))
&& (cfg.isDouble("worldspawn.spawnpoint.yaw") || cfg.isInt("worldspawn.spawnpoint.yaw")) && (cfg.isDouble("worldspawn.spawnpoint.yaw") || cfg.isInt("worldspawn.spawnpoint.yaw"))
&& (cfg.isDouble("worldspawn.spawnpoint.pitch") || cfg.isInt("worldspawn.spawnpoint.pitch")))) { && (cfg.isDouble("worldspawn.spawnpoint.pitch") || cfg.isInt("worldspawn.spawnpoint.pitch")))) {
try { try {
Files.copy(file.toPath(), Files.copy(file.toPath(),
new File(file.getParentFile(), "config-broken-" new File(file.getParentFile(), "config-broken-"
+ new SimpleDateFormat("dd-MM-yyyy-HH-mm-ss").format(new Date()) + ".yml").toPath(), + new SimpleDateFormat("dd-MM-yyyy-HH-mm-ss").format(new Date()) + ".yml").toPath(),
StandardCopyOption.REPLACE_EXISTING); StandardCopyOption.REPLACE_EXISTING);
Files.delete(file.toPath()); Files.delete(file.toPath());
System.err.println("[WorldSystem] Config is broken, creating a new one!"); System.err.println("[WorldSystem] Config is broken, creating a new one!");
checkConfig(f); checkConfig(f);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
} else { } else {
try { try {
InputStream in = JavaPlugin.getPlugin(WorldSystem.class).getResource("config.yml"); InputStream in = JavaPlugin.getPlugin(WorldSystem.class).getResource("config.yml");
Files.copy(in, file.toPath()); Files.copy(in, file.toPath());
} catch (IOException e) { } catch (IOException e) {
System.err.println("Wasn't able to create Config"); System.err.println("Wasn't able to create Config");
e.printStackTrace(); e.printStackTrace();
} }
} }
// Should fix #2 // Should fix #2
if (getSpawn().getWorld() == null) { if (getSpawn().getWorld() == null) {
Bukkit.getConsoleSender().sendMessage(getPrefix() + "§cWorld is null in spawn.world!"); Bukkit.getConsoleSender().sendMessage(getPrefix() + "§cWorld is null in spawn.world!");
} }
} }
public static YamlConfiguration getConfig() { public static YamlConfiguration getConfig() {
try { try {
return YamlConfiguration return YamlConfiguration
.loadConfiguration(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8"))); .loadConfiguration(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8")));
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
e.printStackTrace(); e.printStackTrace();
} }
return null; return null;
} }
public static int getGCPeriod() { public static int getGCPeriod() {
return getConfig().getInt("lagsystem.garbagecollector.period_in_minutes", 5); return getConfig().getInt("lagsystem.garbagecollector.period_in_minutes", 5);
} }
public static boolean useGC() { public static boolean useGC() {
return getConfig().getBoolean("lagsystem.garbagecollector.use", false); return getConfig().getBoolean("lagsystem.garbagecollector.use", false);
} }
public static int getEntitysPerWorld() { public static int getEntitysPerWorld() {
return getConfig().getInt("lagsystem.entities_per_world", 350); return getConfig().getInt("lagsystem.entities_per_world", 350);
} }
public static int getLagCheckPeriod() { public static int getLagCheckPeriod() {
return getConfig().getInt("lagsystem.period_in_seconds", 10); return getConfig().getInt("lagsystem.period_in_seconds", 10);
} }
public static boolean useWorldSpawn() { public static boolean useWorldSpawn() {
return getConfig().getBoolean("worldspawn.use", true); return getConfig().getBoolean("worldspawn.use", true);
} }
public static boolean isSurvival() { public static boolean isSurvival() {
return getConfig().getBoolean("survival", false); return getConfig().getBoolean("survival", false);
} }
public static int getUnloadingTime() { public static int getUnloadingTime() {
return getConfig().getInt("unloadingtime", 20); return getConfig().getInt("unloadingtime", 20);
} }
private final static GameMode[] gamemodes = new GameMode[] { GameMode.SURVIVAL, GameMode.CREATIVE, private final static GameMode[] gamemodes = new GameMode[] { GameMode.SURVIVAL, GameMode.CREATIVE,
GameMode.ADVENTURE, GameMode.SPECTATOR }; GameMode.ADVENTURE, GameMode.SPECTATOR };
public static GameMode getSpawnGamemode() { public static GameMode getSpawnGamemode() {
return gamemodes[getConfig().getInt("spawn.gamemode", 2)]; return gamemodes[getConfig().getInt("spawn.gamemode", 2)];
} }
public static String getWorlddir() { public static String getWorlddir() {
return getConfig().getString("worldfolder", "plugins/WorldSystem/Worlds") + "/"; return getConfig().getString("worldfolder", "plugins/WorldSystem/Worlds") + "/";
} }
public static boolean isMultiChoose() { public static boolean isMultiChoose() {
return getConfig().getBoolean("worldtemplates.multi_choose", false); return getConfig().getBoolean("worldtemplates.multi_choose", false);
} }
public static String getDefaultWorldTemplate() { public static String getDefaultWorldTemplate() {
return getConfig().getString("worldtemplates.default", ""); return getConfig().getString("worldtemplates.default", "");
} }
public static String getLanguage() { public static String getLanguage() {
return getConfig().getString("language", "en"); return getConfig().getString("language", "en");
} }
public static String getPrefix() { public static String getPrefix() {
return ChatColor.translateAlternateColorCodes('&', getConfig().getString("prefix", "§8[§3WorldSystem§8] §6")); return ChatColor.translateAlternateColorCodes('&', getConfig().getString("prefix", "§8[§3WorldSystem§8] §6"));
} }
public static Location getWorldSpawn(World w) { public static Location getWorldSpawn(World w) {
return getLocation(getConfig(), "worldspawn.spawnpoint", w); return getLocation(getConfig(), "worldspawn.spawnpoint", w);
} }
public static Location getSpawn() { public static Location getSpawn() {
YamlConfiguration cfg = getConfig(); YamlConfiguration cfg = getConfig();
return getLocation(cfg, "spawn.spawnpoint", Bukkit.getWorld(cfg.getString("spawn.spawnpoint.world", "world"))); return getLocation(cfg, "spawn.spawnpoint", Bukkit.getWorld(cfg.getString("spawn.spawnpoint.world", "world")));
} }
public static long getSeed() { public static long getSeed() {
return getConfig().getLong("worldgeneration.seed"); return getConfig().getLong("worldgeneration.seed");
} }
public static Environment getEnvironment() { public static Environment getEnvironment() {
YamlConfiguration cfg = getConfig(); YamlConfiguration cfg = getConfig();
String t = cfg.getString("worldgeneration.environment"); String t = cfg.getString("worldgeneration.environment");
Environment e = Environment.NORMAL; Environment e = Environment.NORMAL;
try { try {
e = Environment.valueOf(t.toUpperCase()); e = Environment.valueOf(t.toUpperCase());
} catch (Exception ex) { } catch (Exception ex) {
System.out.println("'" + t + "' is not a valid environment"); System.out.println("'" + t + "' is not a valid environment");
} }
return e; return e;
} }
public static String getGenerator() { public static String getGenerator() {
return getConfig().getString("worldgeneration.generator"); return getConfig().getString("worldgeneration.generator");
} }
public static WorldType getWorldType() { public static WorldType getWorldType() {
YamlConfiguration cfg = getConfig(); YamlConfiguration cfg = getConfig();
String t = cfg.getString("worldgeneration.type"); String t = cfg.getString("worldgeneration.type");
WorldType wt = WorldType.NORMAL; WorldType wt = WorldType.NORMAL;
try { try {
wt = WorldType.valueOf(t.toUpperCase()); wt = WorldType.valueOf(t.toUpperCase());
} catch (Exception e) { } catch (Exception e) {
System.err.println("'" + t + "' is not a valid worldtype"); System.err.println("'" + t + "' is not a valid worldtype");
} }
return wt; return wt;
} }
public static int getRequestExpire() { public static int getRequestExpire() {
return getConfig().getInt("request_expires", 20); return getConfig().getInt("request_expires", 20);
} }
private static Location getLocation(YamlConfiguration cfg, String path, World world) { private static Location getLocation(YamlConfiguration cfg, String path, World world) {
return new Location(world, cfg.getDouble(path + ".x", 0), cfg.getDouble(path + ".y", 20), 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), cfg.getDouble(path + ".z", 0), (float) cfg.getDouble(path + ".yaw", 0),
(float) cfg.getDouble(path + ".pitch", 0)); (float) cfg.getDouble(path + ".pitch", 0));
} }
public static boolean confirmNeed() { public static boolean confirmNeed() {
return getConfig().getBoolean("need_confirm", true); return getConfig().getBoolean("need_confirm", true);
} }
public static boolean contactAuth() { public static boolean contactAuth() {
return getConfig().getBoolean("contact_authserver", true); return getConfig().getBoolean("contact_authserver", true);
} }
public static boolean spawnTeleportation() { public static boolean spawnTeleportation() {
return getConfig().getBoolean("spawn_teleportation", true); return getConfig().getBoolean("spawn_teleportation", true);
} }
public static boolean shouldDelete() { public static boolean shouldDelete() {
return getConfig().getInt("delete_after") != -1; return getConfig().getInt("delete_after") != -1;
} }
public static long deleteAfter() { public static long deleteAfter() {
return getConfig().getLong("delete_after"); return getConfig().getLong("delete_after");
} }
public static WorldCreator getWorldCreator(String worldname) { public static WorldCreator getWorldCreator(String worldname) {
WorldCreator creator = new WorldCreator(worldname); WorldCreator creator = new WorldCreator(worldname);
long seed = PluginConfig.getSeed(); long seed = PluginConfig.getSeed();
Environment env = PluginConfig.getEnvironment(); Environment env = PluginConfig.getEnvironment();
WorldType type = PluginConfig.getWorldType(); WorldType type = PluginConfig.getWorldType();
if (seed != 0) if (seed != 0)
creator.seed(seed); creator.seed(seed);
creator.type(type); creator.type(type);
creator.environment(env); creator.environment(env);
String generator = PluginConfig.getGenerator(); String generator = PluginConfig.getGenerator();
if (!generator.trim().isEmpty()) if (!generator.trim().isEmpty())
creator.generator(generator); creator.generator(generator);
return creator; return creator;
} }
} }

View File

@ -1,184 +1,184 @@
package de.butzlabben.world.config; package de.butzlabben.world.config;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.file.Files; import java.nio.file.Files;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import de.butzlabben.world.WorldSystem; import de.butzlabben.world.WorldSystem;
import de.butzlabben.world.wrapper.SystemWorld; import de.butzlabben.world.wrapper.SystemWorld;
public class SettingsConfig { public class SettingsConfig {
private static HashMap<String, Long> borderSizes = new HashMap<>(); private static HashMap<String, Long> borderSizes = new HashMap<>();
private static File file; private static File file;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public static void editWorld(World w) { public static void editWorld(World w) {
YamlConfiguration cfg = getConfig(); YamlConfiguration cfg = getConfig();
SystemWorld sw = SystemWorld.getSystemWorld(w.getName()); SystemWorld sw = SystemWorld.getSystemWorld(w.getName());
boolean shouldChange = cfg.getBoolean("worldborder.should_change", false); boolean shouldChange = cfg.getBoolean("worldborder.should_change", false);
if (shouldChange) { if (shouldChange) {
long size = cfg.getLong("worldborder.normal", 1000); long size = cfg.getLong("worldborder.normal", 1000);
if (sw != null && sw.isLoaded()) { if (sw != null && sw.isLoaded()) {
String worldname = w.getName(); String worldname = w.getName();
UUID uuid = UUID.fromString(worldname.substring(worldname.length() - 36)); UUID uuid = UUID.fromString(worldname.substring(worldname.length() - 36));
Player p = Bukkit.getPlayer(uuid); Player p = Bukkit.getPlayer(uuid);
if (p != null && p.isOnline()) { if (p != null && p.isOnline()) {
for (String string : borderSizes.keySet()) { for (String string : borderSizes.keySet()) {
if (p.hasPermission(string) && size < borderSizes.get(string)) { if (p.hasPermission(string) && size < borderSizes.get(string)) {
size = borderSizes.get(string); size = borderSizes.get(string);
} }
} }
} }
} }
w.getWorldBorder().setSize(size); w.getWorldBorder().setSize(size);
if (cfg.getBoolean("worldborder.center.as_spawn", true)) { if (cfg.getBoolean("worldborder.center.as_spawn", true)) {
if (PluginConfig.useWorldSpawn()) { if (PluginConfig.useWorldSpawn()) {
w.getWorldBorder().setCenter(PluginConfig.getWorldSpawn(w)); w.getWorldBorder().setCenter(PluginConfig.getWorldSpawn(w));
} else { } else {
w.getWorldBorder().setCenter(w.getSpawnLocation()); w.getWorldBorder().setCenter(w.getSpawnLocation());
} }
} else { } else {
Location loc = new Location(w, cfg.getDouble("worldborder.center.x", 0), Location loc = new Location(w, cfg.getDouble("worldborder.center.x", 0),
cfg.getDouble("worldborder.center.y", 20), cfg.getDouble("worldborder.center.z", 0)); cfg.getDouble("worldborder.center.y", 20), cfg.getDouble("worldborder.center.z", 0));
w.getWorldBorder().setCenter(loc); w.getWorldBorder().setCenter(loc);
} }
if (cfg.getBoolean("worldborder.center.as_home")) { if (cfg.getBoolean("worldborder.center.as_home")) {
WorldConfig config = WorldConfig.getWorldConfig(w.getName()); WorldConfig config = WorldConfig.getWorldConfig(w.getName());
if (config.getHome() != null) if (config.getHome() != null)
w.getWorldBorder().setCenter(config.getHome()); w.getWorldBorder().setCenter(config.getHome());
} }
} }
if (w.isGameRule("announceAdvancements")) if (w.isGameRule("announceAdvancements"))
w.setGameRuleValue("announceAdvancements", cfg.getString("announceAdvancements")); w.setGameRuleValue("announceAdvancements", cfg.getString("announceAdvancements"));
if (w.isGameRule("commandBlockOutput")) if (w.isGameRule("commandBlockOutput"))
w.setGameRuleValue("commandBlockOutput", cfg.getString("commandBlockOutput")); w.setGameRuleValue("commandBlockOutput", cfg.getString("commandBlockOutput"));
if (w.isGameRule("disableElytraMovementCheck")) if (w.isGameRule("disableElytraMovementCheck"))
w.setGameRuleValue("disableElytraMovementCheck", cfg.getString("disableElytraMovementCheck")); w.setGameRuleValue("disableElytraMovementCheck", cfg.getString("disableElytraMovementCheck"));
if (w.isGameRule("doDaylightCycle")) if (w.isGameRule("doDaylightCycle"))
w.setGameRuleValue("doDaylightCycle", cfg.getString("doDaylightCycle")); w.setGameRuleValue("doDaylightCycle", cfg.getString("doDaylightCycle"));
if (w.isGameRule("doEntityDrops")) if (w.isGameRule("doEntityDrops"))
w.setGameRuleValue("doEntityDrops", cfg.getString("doEntityDrops")); w.setGameRuleValue("doEntityDrops", cfg.getString("doEntityDrops"));
if (w.isGameRule("doFireTick")) if (w.isGameRule("doFireTick"))
w.setGameRuleValue("doFireTick", cfg.getString("doFireTick")); w.setGameRuleValue("doFireTick", cfg.getString("doFireTick"));
if (w.isGameRule("doLimitedCrafting")) if (w.isGameRule("doLimitedCrafting"))
w.setGameRuleValue("doLimitedCrafting", cfg.getString("doLimitedCrafting")); w.setGameRuleValue("doLimitedCrafting", cfg.getString("doLimitedCrafting"));
if (w.isGameRule("doMobLoot")) if (w.isGameRule("doMobLoot"))
w.setGameRuleValue("doMobLoot", cfg.getString("doMobLoot")); w.setGameRuleValue("doMobLoot", cfg.getString("doMobLoot"));
if (w.isGameRule("doMobSpawning")) if (w.isGameRule("doMobSpawning"))
w.setGameRuleValue("doMobSpawning", cfg.getString("doMobSpawning")); w.setGameRuleValue("doMobSpawning", cfg.getString("doMobSpawning"));
if (w.isGameRule("doTileDrops")) if (w.isGameRule("doTileDrops"))
w.setGameRuleValue("doTileDrops", cfg.getString("doTileDrops")); w.setGameRuleValue("doTileDrops", cfg.getString("doTileDrops"));
if (w.isGameRule("doWeatherCycle")) if (w.isGameRule("doWeatherCycle"))
w.setGameRuleValue("doWeatherCycle", cfg.getString("doWeatherCycle")); w.setGameRuleValue("doWeatherCycle", cfg.getString("doWeatherCycle"));
if (w.isGameRule("gameLoopFunction")) if (w.isGameRule("gameLoopFunction"))
w.setGameRuleValue("gameLoopFunction", cfg.getString("gameLoopFunction")); w.setGameRuleValue("gameLoopFunction", cfg.getString("gameLoopFunction"));
if (w.isGameRule("keepInventory")) if (w.isGameRule("keepInventory"))
w.setGameRuleValue("keepInventory", cfg.getString("keepInventory")); w.setGameRuleValue("keepInventory", cfg.getString("keepInventory"));
if (w.isGameRule("logAdminCommands")) if (w.isGameRule("logAdminCommands"))
w.setGameRuleValue("logAdminCommands", cfg.getString("logAdminCommands")); w.setGameRuleValue("logAdminCommands", cfg.getString("logAdminCommands"));
if (w.isGameRule("maxCommandChainLength")) if (w.isGameRule("maxCommandChainLength"))
w.setGameRuleValue("maxCommandChainLength", cfg.getString("maxCommandChainLength")); w.setGameRuleValue("maxCommandChainLength", cfg.getString("maxCommandChainLength"));
if (w.isGameRule("maxEntityCramming")) if (w.isGameRule("maxEntityCramming"))
w.setGameRuleValue("maxEntityCramming", cfg.getString("maxEntityCramming")); w.setGameRuleValue("maxEntityCramming", cfg.getString("maxEntityCramming"));
if (w.isGameRule("mobGriefing")) if (w.isGameRule("mobGriefing"))
w.setGameRuleValue("mobGriefing", cfg.getString("mobGriefing")); w.setGameRuleValue("mobGriefing", cfg.getString("mobGriefing"));
if (w.isGameRule("naturalRegeneration")) if (w.isGameRule("naturalRegeneration"))
w.setGameRuleValue("naturalRegeneration", cfg.getString("naturalRegeneration")); w.setGameRuleValue("naturalRegeneration", cfg.getString("naturalRegeneration"));
if (w.isGameRule("randomTickSpeed")) if (w.isGameRule("randomTickSpeed"))
w.setGameRuleValue("randomTickSpeed", cfg.getString("randomTickSpeed")); w.setGameRuleValue("randomTickSpeed", cfg.getString("randomTickSpeed"));
if (w.isGameRule("reducedDebugInfo")) if (w.isGameRule("reducedDebugInfo"))
w.setGameRuleValue("reducedDebugInfo", cfg.getString("reducedDebugInfo")); w.setGameRuleValue("reducedDebugInfo", cfg.getString("reducedDebugInfo"));
if (w.isGameRule("sendCommandFeedback")) if (w.isGameRule("sendCommandFeedback"))
w.setGameRuleValue("sendCommandFeedback", cfg.getString("sendCommandFeedback")); w.setGameRuleValue("sendCommandFeedback", cfg.getString("sendCommandFeedback"));
if (w.isGameRule("showDeathMessages")) if (w.isGameRule("showDeathMessages"))
w.setGameRuleValue("showDeathMessages", cfg.getString("showDeathMessages")); w.setGameRuleValue("showDeathMessages", cfg.getString("showDeathMessages"));
if (w.isGameRule("spawnRadius")) if (w.isGameRule("spawnRadius"))
w.setGameRuleValue("spawnRadius", cfg.getString("spawnRadius")); w.setGameRuleValue("spawnRadius", cfg.getString("spawnRadius"));
if (w.isGameRule("spectatorsGenerateChunks")) if (w.isGameRule("spectatorsGenerateChunks"))
w.setGameRuleValue("spectatorsGenerateChunks", cfg.getString("spectatorsGenerateChunks")); w.setGameRuleValue("spectatorsGenerateChunks", cfg.getString("spectatorsGenerateChunks"));
} }
private static YamlConfiguration getConfig() { private static YamlConfiguration getConfig() {
try { try {
return YamlConfiguration return YamlConfiguration
.loadConfiguration(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8"))); .loadConfiguration(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8")));
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
e.printStackTrace(); e.printStackTrace();
} }
return null; return null;
} }
public static void checkConfig() { public static void checkConfig() {
File file = new File(WorldSystem.getInstance().getDataFolder(), "settings.yml"); File file = new File(WorldSystem.getInstance().getDataFolder(), "settings.yml");
SettingsConfig.file = file; SettingsConfig.file = file;
if (!file.exists()) { if (!file.exists()) {
try { try {
InputStream in = JavaPlugin.getPlugin(WorldSystem.class).getResource("settings.yml"); InputStream in = JavaPlugin.getPlugin(WorldSystem.class).getResource("settings.yml");
Files.copy(in, file.toPath()); Files.copy(in, file.toPath());
} catch (IOException e) { } catch (IOException e) {
System.err.println("Wasn't able to create Config"); System.err.println("Wasn't able to create Config");
e.printStackTrace(); e.printStackTrace();
} }
} }
YamlConfiguration cfg = getConfig(); YamlConfiguration cfg = getConfig();
for (String s : cfg.getConfigurationSection("worldborder.ranks").getKeys(true)) { for (String s : cfg.getConfigurationSection("worldborder.ranks").getKeys(true)) {
if (cfg.isInt("worldborder.ranks." + s) || cfg.isLong("worldborder.ranks." + s)) if (cfg.isInt("worldborder.ranks." + s) || cfg.isLong("worldborder.ranks." + s))
borderSizes.put(s, cfg.getLong("worldborder.ranks." + s)); borderSizes.put(s, cfg.getLong("worldborder.ranks." + s));
} }
} }
/** /**
* @return the commands specified in settings.yml on /ws get * @return the commands specified in settings.yml on /ws get
*/ */
public static List<String> getCommandsonGet() { public static List<String> getCommandsonGet() {
YamlConfiguration cfg = getConfig(); YamlConfiguration cfg = getConfig();
return cfg.getStringList("commands_on_get"); return cfg.getStringList("commands_on_get");
} }
private SettingsConfig() { private SettingsConfig() {
} }
} }

View File

@ -1,53 +1,53 @@
package de.butzlabben.world.event; package de.butzlabben.world.event;
import java.util.UUID; import java.util.UUID;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
/** /**
* Event for adding somebody to a world * Event for adding somebody to a world
* *
* @author Butzlabben * @author Butzlabben
* @since 09.05.2018 * @since 09.05.2018
*/ */
public class WorldAddmemberEvent extends WorldEvent { public class WorldAddmemberEvent extends WorldEvent {
private final String worldname; private final String worldname;
private final UUID uuid; private final UUID uuid;
private Player adder; private Player adder;
public WorldAddmemberEvent(UUID uuid, String worldname, Player adder) { public WorldAddmemberEvent(UUID uuid, String worldname, Player adder) {
this.uuid = uuid; this.uuid = uuid;
this.worldname = worldname; this.worldname = worldname;
this.adder = adder; this.adder = adder;
} }
/** /**
* @return player who adds somebody * @return player who adds somebody
*/ */
public Player getAdding() { public Player getAdding() {
return adder; return adder;
} }
/** /**
* @return UUID of player who gets added * @return UUID of player who gets added
*/ */
public UUID getUUID() { public UUID getUUID() {
return uuid; return uuid;
} }
/** /**
* @return worldname for which it happens * @return worldname for which it happens
*/ */
public String getWorldname() { public String getWorldname() {
return worldname; return worldname;
} }
@Override @Override
public HandlerList getHandlers() { public HandlerList getHandlers() {
return handlers; return handlers;
} }
public final static HandlerList handlers = new HandlerList(); public final static HandlerList handlers = new HandlerList();
} }

View File

@ -1,53 +1,53 @@
package de.butzlabben.world.event; package de.butzlabben.world.event;
import org.bukkit.WorldCreator; import org.bukkit.WorldCreator;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
/** /**
* Event if a SystemWorld gets created. * Event if a SystemWorld gets created.
* Do mix up with the WorldCreateEvent from Bukkit * Do mix up with the WorldCreateEvent from Bukkit
* *
* @author Butzlabben * @author Butzlabben
* @since 09.05.2018 * @since 09.05.2018
*/ */
public class WorldCreateEvent extends WorldEvent { public class WorldCreateEvent extends WorldEvent {
private final Player owner; private final Player owner;
private WorldCreator worldCreator; private WorldCreator worldCreator;
public WorldCreateEvent(Player owner, WorldCreator creator) { public WorldCreateEvent(Player owner, WorldCreator creator) {
this.owner = owner; this.owner = owner;
this.setWorldCreator(creator); this.setWorldCreator(creator);
} }
/** /**
* @return owner of world that gets created * @return owner of world that gets created
*/ */
public Player getOwner() { public Player getOwner() {
return owner; return owner;
} }
public final static HandlerList handlers = new HandlerList(); public final static HandlerList handlers = new HandlerList();
public final static HandlerList getHandlerList() { public final static HandlerList getHandlerList() {
return handlers; return handlers;
} }
@Override @Override
public final HandlerList getHandlers() { public final HandlerList getHandlers() {
return handlers; return handlers;
} }
/** /**
* @return the worldcreator which will be used * @return the worldcreator which will be used
*/ */
public WorldCreator getWorldCreator() { public WorldCreator getWorldCreator() {
return worldCreator; return worldCreator;
} }
public void setWorldCreator(WorldCreator worldCreator) { public void setWorldCreator(WorldCreator worldCreator) {
this.worldCreator = worldCreator; this.worldCreator = worldCreator;
} }
} }

View File

@ -1,49 +1,49 @@
package de.butzlabben.world.event; package de.butzlabben.world.event;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import de.butzlabben.world.wrapper.SystemWorld; import de.butzlabben.world.wrapper.SystemWorld;
/** /**
* Event if a systemworld gets deleted * Event if a systemworld gets deleted
* *
* @author Butzlabben * @author Butzlabben
* @since 09.05.2018 * @since 09.05.2018
*/ */
public class WorldDeleteEvent extends WorldEvent { public class WorldDeleteEvent extends WorldEvent {
private final SystemWorld world; private final SystemWorld world;
private final CommandSender executor; private final CommandSender executor;
public WorldDeleteEvent(CommandSender executor, SystemWorld world) { public WorldDeleteEvent(CommandSender executor, SystemWorld world) {
this.executor = executor; this.executor = executor;
this.world = world; this.world = world;
} }
/** /**
* @return get the world which will be deleted * @return get the world which will be deleted
*/ */
public SystemWorld getWorld() { public SystemWorld getWorld() {
return world; return world;
} }
/** /**
* @return get the executor of the command * @return get the executor of the command
*/ */
public CommandSender getExecutor() { public CommandSender getExecutor() {
return executor; return executor;
} }
public final static HandlerList handlers = new HandlerList(); public final static HandlerList handlers = new HandlerList();
public final static HandlerList getHandlerList() { public final static HandlerList getHandlerList() {
return handlers; return handlers;
} }
@Override @Override
public final HandlerList getHandlers() { public final HandlerList getHandlers() {
return handlers; return handlers;
} }
} }

View File

@ -1,27 +1,27 @@
package de.butzlabben.world.event; package de.butzlabben.world.event;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.Event; import org.bukkit.event.Event;
public abstract class WorldEvent extends Event implements Cancellable { public abstract class WorldEvent extends Event implements Cancellable {
private boolean cancelled; private boolean cancelled;
public WorldEvent() { public WorldEvent() {
} }
public WorldEvent(boolean cancel) { public WorldEvent(boolean cancel) {
setCancelled(cancel); setCancelled(cancel);
} }
@Override @Override
public boolean isCancelled() { public boolean isCancelled() {
return cancelled; return cancelled;
} }
@Override @Override
public void setCancelled(boolean cancel) { public void setCancelled(boolean cancel) {
cancelled = cancel; cancelled = cancel;
} }
} }

View File

@ -1,49 +1,49 @@
package de.butzlabben.world.event; package de.butzlabben.world.event;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import de.butzlabben.world.wrapper.SystemWorld; import de.butzlabben.world.wrapper.SystemWorld;
/** /**
* Event for loading a world * Event for loading a world
* *
* @author Butzlabben * @author Butzlabben
* @since 09.05.2018 * @since 09.05.2018
*/ */
public class WorldLoadEvent extends WorldEvent { public class WorldLoadEvent extends WorldEvent {
private final Player owner; private final Player owner;
private final SystemWorld world; private final SystemWorld world;
public WorldLoadEvent(Player owner, SystemWorld systemWorld) { public WorldLoadEvent(Player owner, SystemWorld systemWorld) {
this.owner = owner; this.owner = owner;
this.world = systemWorld; this.world = systemWorld;
} }
/** /**
* @return get the world which will be loaded * @return get the world which will be loaded
*/ */
public SystemWorld getWorld() { public SystemWorld getWorld() {
return world; return world;
} }
/** /**
* @return get person which intiziated the loading * @return get person which intiziated the loading
*/ */
public Player getOwner() { public Player getOwner() {
return owner; return owner;
} }
public final static HandlerList handlers = new HandlerList(); public final static HandlerList handlers = new HandlerList();
public final static HandlerList getHandlerList() { public final static HandlerList getHandlerList() {
return handlers; return handlers;
} }
@Override @Override
public final HandlerList getHandlers() { public final HandlerList getHandlers() {
return handlers; return handlers;
} }
} }

View File

@ -1,52 +1,52 @@
package de.butzlabben.world.event; package de.butzlabben.world.event;
import java.util.UUID; import java.util.UUID;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
/** /**
* @author Butzlabben * @author Butzlabben
* @since 09.05.2018 * @since 09.05.2018
*/ */
public class WorldRemovememberEvent extends WorldEvent { public class WorldRemovememberEvent extends WorldEvent {
private final String worldname; private final String worldname;
private final UUID uuid; private final UUID uuid;
private Player remover; private Player remover;
public WorldRemovememberEvent(UUID uuid, String worldname, Player remover) { public WorldRemovememberEvent(UUID uuid, String worldname, Player remover) {
this.uuid = uuid; this.uuid = uuid;
this.worldname = worldname; this.worldname = worldname;
this.remover = remover; this.remover = remover;
} }
/** /**
* @return player who removes somebody * @return player who removes somebody
*/ */
public Player getRemoving() { public Player getRemoving() {
return remover; return remover;
} }
/** /**
* @return uuid of player who gets removed * @return uuid of player who gets removed
*/ */
public UUID getUUID() { public UUID getUUID() {
return uuid; return uuid;
} }
/** /**
* @return worldname for which it happens * @return worldname for which it happens
*/ */
public String getWorldname() { public String getWorldname() {
return worldname; return worldname;
} }
@Override @Override
public HandlerList getHandlers() { public HandlerList getHandlers() {
return handlers; return handlers;
} }
public final static HandlerList handlers = new HandlerList(); public final static HandlerList handlers = new HandlerList();
} }

View File

@ -1,50 +1,50 @@
package de.butzlabben.world.event; package de.butzlabben.world.event;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import de.butzlabben.world.wrapper.SystemWorld; import de.butzlabben.world.wrapper.SystemWorld;
/** /**
* Event when a world gets reset * Event when a world gets reset
* *
* @author Butzlabben * @author Butzlabben
* @since 09.05.2018 * @since 09.05.2018
*/ */
public class WorldResetEvent extends WorldEvent { public class WorldResetEvent extends WorldEvent {
private final SystemWorld world; private final SystemWorld world;
private final CommandSender executor; private final CommandSender executor;
public WorldResetEvent(CommandSender executor, SystemWorld world) { public WorldResetEvent(CommandSender executor, SystemWorld world) {
this.executor = executor; this.executor = executor;
this.world = world; this.world = world;
} }
/** /**
* @return world which gets reset * @return world which gets reset
*/ */
public SystemWorld getWorld() { public SystemWorld getWorld() {
return world; return world;
} }
/** /**
* @return Executor of the command * @return Executor of the command
*/ */
public CommandSender getExecutor() { public CommandSender getExecutor() {
return executor; return executor;
} }
public final static HandlerList handlers = new HandlerList(); public final static HandlerList handlers = new HandlerList();
public final static HandlerList getHandlerList() { public final static HandlerList getHandlerList() {
return handlers; return handlers;
} }
@Override @Override
public final HandlerList getHandlers() { public final HandlerList getHandlers() {
return handlers; return handlers;
} }
} }

View File

@ -1,64 +1,64 @@
package de.butzlabben.world.event; package de.butzlabben.world.event;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import de.butzlabben.world.wrapper.SystemWorld; import de.butzlabben.world.wrapper.SystemWorld;
/** /**
* @author Butzlabben * @author Butzlabben
* @since 09.05.2018 * @since 09.05.2018
*/ */
public class WorldToggleFireEvent extends WorldEvent { public class WorldToggleFireEvent extends WorldEvent {
private final SystemWorld world; private final SystemWorld world;
private final CommandSender executor; private final CommandSender executor;
private boolean value; private boolean value;
public WorldToggleFireEvent(CommandSender executor, SystemWorld world, boolean value) { public WorldToggleFireEvent(CommandSender executor, SystemWorld world, boolean value) {
this.executor = executor; this.executor = executor;
this.world = world; this.world = world;
this.value = value; this.value = value;
} }
/** /**
* @return if fire now gets enabled or disabled * @return if fire now gets enabled or disabled
*/ */
public boolean getValue() { public boolean getValue() {
return value; return value;
} }
/** /**
* @param val if fire should be enabled or disabled * @param val if fire should be enabled or disabled
*/ */
public void setValue(boolean val) { public void setValue(boolean val) {
value = val; value = val;
} }
/** /**
* @return world get world * @return world get world
*/ */
public SystemWorld getWorld() { public SystemWorld getWorld() {
return world; return world;
} }
/** /**
* @return get executor who toggles fire * @return get executor who toggles fire
*/ */
public CommandSender getExecutor() { public CommandSender getExecutor() {
return executor; return executor;
} }
public final static HandlerList handlers = new HandlerList(); public final static HandlerList handlers = new HandlerList();
public final static HandlerList getHandlerList() { public final static HandlerList getHandlerList() {
return handlers; return handlers;
} }
@Override @Override
public final HandlerList getHandlers() { public final HandlerList getHandlers() {
return handlers; return handlers;
} }
} }

View File

@ -1,64 +1,64 @@
package de.butzlabben.world.event; package de.butzlabben.world.event;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import de.butzlabben.world.wrapper.SystemWorld; import de.butzlabben.world.wrapper.SystemWorld;
/** /**
* @author Butzlabben * @author Butzlabben
* @since 09.05.2018 * @since 09.05.2018
*/ */
public class WorldToggleTntEvent extends WorldEvent { public class WorldToggleTntEvent extends WorldEvent {
private final SystemWorld world; private final SystemWorld world;
private final CommandSender executor; private final CommandSender executor;
private boolean value; private boolean value;
public WorldToggleTntEvent(CommandSender executor, SystemWorld world, boolean value) { public WorldToggleTntEvent(CommandSender executor, SystemWorld world, boolean value) {
this.executor = executor; this.executor = executor;
this.world = world; this.world = world;
this.value = value; this.value = value;
} }
/** /**
* @return if tnt now gets enabled or disabled * @return if tnt now gets enabled or disabled
*/ */
public boolean getValue() { public boolean getValue() {
return value; return value;
} }
/** /**
* @param val if tnt should be enabled or disabled * @param val if tnt should be enabled or disabled
*/ */
public void setValue(boolean val) { public void setValue(boolean val) {
value = val; value = val;
} }
/** /**
* @return world get world * @return world get world
*/ */
public SystemWorld getWorld() { public SystemWorld getWorld() {
return world; return world;
} }
/** /**
* @return get executor who toggles tnt * @return get executor who toggles tnt
*/ */
public CommandSender getExecutor() { public CommandSender getExecutor() {
return executor; return executor;
} }
public final static HandlerList handlers = new HandlerList(); public final static HandlerList handlers = new HandlerList();
public final static HandlerList getHandlerList() { public final static HandlerList getHandlerList() {
return handlers; return handlers;
} }
@Override @Override
public final HandlerList getHandlers() { public final HandlerList getHandlers() {
return handlers; return handlers;
} }
} }

View File

@ -1,37 +1,37 @@
package de.butzlabben.world.event; package de.butzlabben.world.event;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import de.butzlabben.world.wrapper.SystemWorld; import de.butzlabben.world.wrapper.SystemWorld;
/** /**
* @author Butzlabben * @author Butzlabben
* @since 09.05.2018 * @since 09.05.2018
*/ */
public class WorldUnloadEvent extends WorldEvent { public class WorldUnloadEvent extends WorldEvent {
private final SystemWorld world; private final SystemWorld world;
public WorldUnloadEvent(SystemWorld world) { public WorldUnloadEvent(SystemWorld world) {
this.world = world; this.world = world;
} }
/** /**
* @return world which gets unloaded * @return world which gets unloaded
*/ */
public SystemWorld getWorld() { public SystemWorld getWorld() {
return world; return world;
} }
public final static HandlerList handlers = new HandlerList(); public final static HandlerList handlers = new HandlerList();
public final static HandlerList getHandlerList() { public final static HandlerList getHandlerList() {
return handlers; return handlers;
} }
@Override @Override
public final HandlerList getHandlers() { public final HandlerList getHandlers() {
return handlers; return handlers;
} }
} }

View File

@ -1,32 +1,32 @@
package de.butzlabben.world.gui; package de.butzlabben.world.gui;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import de.butzlabben.world.config.MessageConfig; import de.butzlabben.world.config.MessageConfig;
import de.butzlabben.world.wrapper.WorldPlayer; import de.butzlabben.world.wrapper.WorldPlayer;
public class GuiCommand implements CommandExecutor { public class GuiCommand implements CommandExecutor {
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player == false) { if (sender instanceof Player == false) {
sender.sendMessage("You are not a player"); sender.sendMessage("You are not a player");
return true; return true;
} }
WorldPlayer wp = new WorldPlayer((Player) sender); WorldPlayer wp = new WorldPlayer((Player) sender);
if (!wp.isOnSystemWorld()) { if (!wp.isOnSystemWorld()) {
sender.sendMessage(MessageConfig.getNotOnWorld()); sender.sendMessage(MessageConfig.getNotOnWorld());
return true; return true;
} }
if (!wp.isOwnerofWorld()) { if (!wp.isOwnerofWorld()) {
sender.sendMessage(MessageConfig.getNoPermission()); sender.sendMessage(MessageConfig.getNoPermission());
return true; return true;
} }
((Player) sender).openInventory(new WorldSystemGUI().getInventory((Player) sender)); ((Player) sender).openInventory(new WorldSystemGUI().getInventory((Player) sender));
return true; return true;
} }
} }

View File

@ -1,91 +1,91 @@
package de.butzlabben.world.gui; package de.butzlabben.world.gui;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.UUID; import java.util.UUID;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta; import org.bukkit.inventory.meta.SkullMeta;
import de.butzlabben.inventory.OrcItem; import de.butzlabben.inventory.OrcItem;
import de.butzlabben.inventory.pages.PageGUICreator; import de.butzlabben.inventory.pages.PageGUICreator;
import de.butzlabben.world.config.GuiConfig; import de.butzlabben.world.config.GuiConfig;
import de.butzlabben.world.config.MessageConfig; import de.butzlabben.world.config.MessageConfig;
import de.butzlabben.world.config.WorldConfig; import de.butzlabben.world.config.WorldConfig;
/** /**
* @author Butzlabben * @author Butzlabben
* @since 20.04.2018 * @since 20.04.2018
*/ */
public class PlayersPageGUI { public class PlayersPageGUI {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public static void openGUI(Player p) { public static void openGUI(Player p) {
WorldConfig config = WorldConfig.getWorldConfig(p.getWorld().getName()); WorldConfig config = WorldConfig.getWorldConfig(p.getWorld().getName());
HashMap<UUID, String> members = config.getMembersWithNames(); HashMap<UUID, String> members = config.getMembersWithNames();
if (members.size() == 0) { if (members.size() == 0) {
p.sendMessage(MessageConfig.getNoMemberAdded()); p.sendMessage(MessageConfig.getNoMemberAdded());
return; return;
} }
PageGUICreator<Entry<UUID, String>> creator = new PageGUICreator<>(GuiConfig.getRows("options.players")); PageGUICreator<Entry<UUID, String>> creator = new PageGUICreator<>(GuiConfig.getRows("options.players"));
creator.create(GuiConfig.getTitle(GuiConfig.getConfig(), "options.players"), members.entrySet(), (entry) -> { creator.create(GuiConfig.getTitle(GuiConfig.getConfig(), "options.players"), members.entrySet(), (entry) -> {
String name = entry.getValue(); String name = entry.getValue();
OrcItem oi = new OrcItem(GuiConfig.getSkullItem(), GuiConfig OrcItem oi = new OrcItem(GuiConfig.getSkullItem(), GuiConfig
.getDisplay(GuiConfig.getConfig(), "options.players.playerhead").replaceAll("%player", name)); .getDisplay(GuiConfig.getConfig(), "options.players.playerhead").replaceAll("%player", name));
SkullMeta sm = (SkullMeta) oi.getItemStack().getItemMeta(); SkullMeta sm = (SkullMeta) oi.getItemStack().getItemMeta();
sm.setOwner(name); sm.setOwner(name);
oi.getItemStack().setItemMeta(sm); oi.getItemStack().setItemMeta(sm);
oi.setOnClick((player, inv, item) -> { oi.setOnClick((player, inv, item) -> {
player.closeInventory(); player.closeInventory();
PlayerOptionsGUI gui = new PlayerOptionsGUI(player, name, entry.getKey()); PlayerOptionsGUI gui = new PlayerOptionsGUI(player, name, entry.getKey());
player.openInventory(gui.getInventory(p)); player.openInventory(gui.getInventory(p));
}); });
return oi; return oi;
}); });
if (GuiConfig.isEnabled("options.players.back")) { if (GuiConfig.isEnabled("options.players.back")) {
OrcItem back = OrcItem.back.clone(); OrcItem back = OrcItem.back.clone();
back.setOnClick((player, inv, i) -> { back.setOnClick((player, inv, i) -> {
player.closeInventory(); player.closeInventory();
player.openInventory(new WorldSystemGUI().getInventory(p)); player.openInventory(new WorldSystemGUI().getInventory(p));
}); });
creator.getInvPages().forEach((oi) -> {oi.addItem(GuiConfig.getSlot("options.players.back"), back);}); creator.getInvPages().forEach((oi) -> {oi.addItem(GuiConfig.getSlot("options.players.back"), back);});
} }
creator.show(p); creator.show(p);
} }
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public static void preloadPlayers(WorldConfig config) { public static void preloadPlayers(WorldConfig config) {
new Thread(() -> { new Thread(() -> {
int headsPerInv = GuiConfig.getRows("options.players") * 9; int headsPerInv = GuiConfig.getRows("options.players") * 9;
HashMap<UUID, String> members = config.getMembersWithNames(); HashMap<UUID, String> members = config.getMembersWithNames();
if (members == null || members.size() == 0) if (members == null || members.size() == 0)
return; return;
int pages = Math.round(members.size() / headsPerInv) < 1 ? 1 : Math.round(members.size() / headsPerInv); int pages = Math.round(members.size() / headsPerInv) < 1 ? 1 : Math.round(members.size() / headsPerInv);
for (int page = 0; page < pages; page++) { for (int page = 0; page < pages; page++) {
int startPos = pages == 1 ? 0 : headsPerInv * (page - 1); int startPos = pages == 1 ? 0 : headsPerInv * (page - 1);
int length = pages == 1 ? members.size() : headsPerInv; int length = pages == 1 ? members.size() : headsPerInv;
ArrayList<UUID> list = new ArrayList<>(members.keySet()); ArrayList<UUID> list = new ArrayList<>(members.keySet());
Inventory inv = Bukkit.createInventory(null, headsPerInv); Inventory inv = Bukkit.createInventory(null, headsPerInv);
for (int i = startPos; i < startPos + length; i++) { for (int i = startPos; i < startPos + length; i++) {
String name = members.get(list.get(i)); String name = members.get(list.get(i));
ItemStack is = new ItemStack(GuiConfig.getSkullItem(), 1, (short) 3); ItemStack is = new ItemStack(GuiConfig.getSkullItem(), 1, (short) 3);
SkullMeta sm = (SkullMeta) is.getItemMeta(); SkullMeta sm = (SkullMeta) is.getItemMeta();
sm.setOwner(name); sm.setOwner(name);
is.setItemMeta(sm); is.setItemMeta(sm);
inv.addItem(is); inv.addItem(is);
} }
} }
}).start(); }).start();
} }
} }

View File

@ -1,70 +1,70 @@
package de.butzlabben.world.gui; package de.butzlabben.world.gui;
import java.util.function.Consumer; import java.util.function.Consumer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import de.butzlabben.inventory.OrcClickListener; import de.butzlabben.inventory.OrcClickListener;
import de.butzlabben.inventory.OrcInventory; import de.butzlabben.inventory.OrcInventory;
import de.butzlabben.inventory.OrcItem; import de.butzlabben.inventory.OrcItem;
import de.butzlabben.world.config.GuiConfig; import de.butzlabben.world.config.GuiConfig;
import de.butzlabben.world.wrapper.WorldTemplate; import de.butzlabben.world.wrapper.WorldTemplate;
import de.butzlabben.world.wrapper.WorldTemplateProvider; import de.butzlabben.world.wrapper.WorldTemplateProvider;
/** /**
* @author Butzlabben * @author Butzlabben
* @since 15.12.2018 * @since 15.12.2018
*/ */
public class WorldChooseGUI extends OrcInventory { public class WorldChooseGUI extends OrcInventory {
private final static String path = "worldchoose."; private final static String path = "worldchoose.";
public WorldChooseGUI() { public WorldChooseGUI() {
this(null); this(null);
} }
public WorldChooseGUI(Consumer<WorldTemplate> onClick) { public WorldChooseGUI(Consumer<WorldTemplate> onClick) {
super(GuiConfig.getTitle(GuiConfig.getConfig(), "worldchoose"), GuiConfig.getRows("worldchoose"), super(GuiConfig.getTitle(GuiConfig.getConfig(), "worldchoose"), GuiConfig.getRows("worldchoose"),
GuiConfig.isFill("worldchoose")); GuiConfig.isFill("worldchoose"));
for (WorldTemplate template : WorldTemplateProvider.getInstace().getTemplates()) { for (WorldTemplate template : WorldTemplateProvider.getInstace().getTemplates()) {
OrcItem icon = template.getIcon(); OrcItem icon = template.getIcon();
if(onClick != null) if(onClick != null)
icon.setOnClick((p, inv, item) -> { icon.setOnClick((p, inv, item) -> {
p.closeInventory(); p.closeInventory();
onClick.accept(template); onClick.accept(template);
}); });
int slot = template.getSlot(); int slot = template.getSlot();
addItem(slot, icon); addItem(slot, icon);
} }
if (GuiConfig.isEnabled(path + "back")) { if (GuiConfig.isEnabled(path + "back")) {
OrcItem back = OrcItem.back.clone(); OrcItem back = OrcItem.back.clone();
back.setOnClick((p, inv, item) -> { back.setOnClick((p, inv, item) -> {
p.closeInventory(); p.closeInventory();
}); });
addItem(GuiConfig.getSlot(path + "back"), back); addItem(GuiConfig.getSlot(path + "back"), back);
} }
} }
public static void letChoose(Player player, Consumer<WorldTemplate> template) { public static void letChoose(Player player, Consumer<WorldTemplate> template) {
player.openInventory(new WorldChooseGUI(template).getInventory(player)); player.openInventory(new WorldChooseGUI(template).getInventory(player));
} }
public void loadItem(String subpath, OrcClickListener listener) { public void loadItem(String subpath, OrcClickListener listener) {
if (GuiConfig.isEnabled(path + subpath) == false) if (GuiConfig.isEnabled(path + subpath) == false)
return; return;
OrcItem item = GuiConfig.getItem(path + subpath); OrcItem item = GuiConfig.getItem(path + subpath);
if (item != null) { if (item != null) {
item.setOnClick(listener); item.setOnClick(listener);
addItem(GuiConfig.getSlot(path + subpath), item); addItem(GuiConfig.getSlot(path + subpath), item);
} }
} }
public void loadItem(String subpath) { public void loadItem(String subpath) {
loadItem(subpath, null); loadItem(subpath, null);
} }
public boolean canOpen(Player p) { public boolean canOpen(Player p) {
return true; return true;
} }
} }

View File

@ -1,100 +1,100 @@
package de.butzlabben.world.gui; package de.butzlabben.world.gui;
import java.util.HashMap; import java.util.HashMap;
import java.util.UUID; import java.util.UUID;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import de.butzlabben.inventory.DependListener; import de.butzlabben.inventory.DependListener;
import de.butzlabben.inventory.OrcInventory; import de.butzlabben.inventory.OrcInventory;
import de.butzlabben.inventory.OrcItem; import de.butzlabben.inventory.OrcItem;
import de.butzlabben.world.config.GuiConfig; import de.butzlabben.world.config.GuiConfig;
import de.butzlabben.world.gui.clicklistener.ComingSoonClickListener; import de.butzlabben.world.gui.clicklistener.ComingSoonClickListener;
import de.butzlabben.world.gui.clicklistener.CommandExecutorClickListener; import de.butzlabben.world.gui.clicklistener.CommandExecutorClickListener;
import de.butzlabben.world.gui.worldoption.FireStatus; import de.butzlabben.world.gui.worldoption.FireStatus;
import de.butzlabben.world.gui.worldoption.TntStatus; import de.butzlabben.world.gui.worldoption.TntStatus;
import de.butzlabben.world.wrapper.WorldPlayer; import de.butzlabben.world.wrapper.WorldPlayer;
public class WorldOptionsGUI extends OrcInventory { public class WorldOptionsGUI extends OrcInventory {
private final static String path = "options.world."; private final static String path = "options.world.";
public final static HashMap<UUID, String> data = new HashMap<>(); public final static HashMap<UUID, String> data = new HashMap<>();
public WorldOptionsGUI() { public WorldOptionsGUI() {
super(GuiConfig.getTitle(GuiConfig.getConfig(), "options.world"), GuiConfig.getRows("options.world"), GuiConfig.isFill("options.world")); super(GuiConfig.getTitle(GuiConfig.getConfig(), "options.world"), GuiConfig.getRows("options.world"), GuiConfig.isFill("options.world"));
loadItem("fire", "/ws fire", true, new FireStatus()); loadItem("fire", "/ws fire", true, new FireStatus());
loadItem("tnt", "/ws tnt", true, new TntStatus()); loadItem("tnt", "/ws tnt", true, new TntStatus());
if (GuiConfig.isEnabled(path + "reset") == false) if (GuiConfig.isEnabled(path + "reset") == false)
return; return;
OrcItem item = GuiConfig.getItem(path + "reset"); OrcItem item = GuiConfig.getItem(path + "reset");
if (item != null) { if (item != null) {
item.setOnClick((p, inv, i) -> { item.setOnClick((p, inv, i) -> {
p.closeInventory(); p.closeInventory();
p.chat("/ws reset"); p.chat("/ws reset");
}); });
addItem(GuiConfig.getSlot(path + "reset"), item); addItem(GuiConfig.getSlot(path + "reset"), item);
} }
if (GuiConfig.isEnabled(path + "back")) { if (GuiConfig.isEnabled(path + "back")) {
OrcItem back = OrcItem.back.clone(); OrcItem back = OrcItem.back.clone();
back.setOnClick((p, inv, i) -> { back.setOnClick((p, inv, i) -> {
p.closeInventory(); p.closeInventory();
p.openInventory(new WorldSystemGUI().getInventory(p)); p.openInventory(new WorldSystemGUI().getInventory(p));
}); });
addItem(GuiConfig.getSlot(path + "back"), back); addItem(GuiConfig.getSlot(path + "back"), back);
} }
} }
public void loadItem(String subpath, String message, boolean state, DependListener depend) { public void loadItem(String subpath, String message, boolean state, DependListener depend) {
if (GuiConfig.isEnabled(path + subpath) == false) if (GuiConfig.isEnabled(path + subpath) == false)
return; return;
OrcItem item = GuiConfig.getItem(path + subpath); OrcItem item = GuiConfig.getItem(path + subpath);
if (item != null) { if (item != null) {
if (message == null) { if (message == null) {
item.setOnClick(new ComingSoonClickListener()); item.setOnClick(new ComingSoonClickListener());
} else { } else {
item.setOnClick(new CommandExecutorClickListener(message)); item.setOnClick(new CommandExecutorClickListener(message));
} }
if (state) { if (state) {
if (depend == null) { if (depend == null) {
addItem(GuiConfig.getState(path + subpath), OrcItem.coming_soon.clone()); addItem(GuiConfig.getState(path + subpath), OrcItem.coming_soon.clone());
} else { } else {
addItem(GuiConfig.getState(path + subpath), OrcItem.disabled.clone().setDepend(depend)); addItem(GuiConfig.getState(path + subpath), OrcItem.disabled.clone().setDepend(depend));
} }
} }
addItem(GuiConfig.getSlot(path + subpath), item); addItem(GuiConfig.getSlot(path + subpath), item);
} }
} }
public void loadItem(String subpath, String message, boolean state) { public void loadItem(String subpath, String message, boolean state) {
loadItem(subpath, message, state, null); loadItem(subpath, message, state, null);
} }
public void loadItem(String subpath, boolean state) { public void loadItem(String subpath, boolean state) {
loadItem(subpath, null, state); loadItem(subpath, null, state);
} }
@Override @Override
public Inventory getInventory(Player p, String title) { public Inventory getInventory(Player p, String title) {
if (data.containsKey(p.getUniqueId())) if (data.containsKey(p.getUniqueId()))
return super.getInventory(p, title.replaceAll("%data", data.get(p.getUniqueId()))); return super.getInventory(p, title.replaceAll("%data", data.get(p.getUniqueId())));
return super.getInventory(p, title); return super.getInventory(p, title);
} }
@Override @Override
public Inventory getInventory(Player p) { public Inventory getInventory(Player p) {
if (data.containsKey(p.getUniqueId())) if (data.containsKey(p.getUniqueId()))
return super.getInventory(p, getTitle().replaceAll("%data", data.get(p.getUniqueId()))); return super.getInventory(p, getTitle().replaceAll("%data", data.get(p.getUniqueId())));
return super.getInventory(p, getTitle()); return super.getInventory(p, getTitle());
} }
public boolean canOpen(Player p) { public boolean canOpen(Player p) {
return new WorldPlayer(p).isOwnerofWorld(); return new WorldPlayer(p).isOwnerofWorld();
} }
} }

View File

@ -1,60 +1,60 @@
package de.butzlabben.world.gui; package de.butzlabben.world.gui;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import de.butzlabben.inventory.OrcClickListener; import de.butzlabben.inventory.OrcClickListener;
import de.butzlabben.inventory.OrcInventory; import de.butzlabben.inventory.OrcInventory;
import de.butzlabben.inventory.OrcItem; import de.butzlabben.inventory.OrcItem;
import de.butzlabben.world.config.GuiConfig; import de.butzlabben.world.config.GuiConfig;
import de.butzlabben.world.config.WorldConfig; import de.butzlabben.world.config.WorldConfig;
import de.butzlabben.world.gui.clicklistener.InventoryOpenClickListener; import de.butzlabben.world.gui.clicklistener.InventoryOpenClickListener;
public class WorldSystemGUI extends OrcInventory { public class WorldSystemGUI extends OrcInventory {
private final static String path = "worldsystem."; private final static String path = "worldsystem.";
public WorldSystemGUI() { public WorldSystemGUI() {
super(GuiConfig.getTitle(GuiConfig.getConfig(), "worldsystem"), GuiConfig.getRows("worldsystem"), GuiConfig.isFill("worldsystem")); super(GuiConfig.getTitle(GuiConfig.getConfig(), "worldsystem"), GuiConfig.getRows("worldsystem"), GuiConfig.isFill("worldsystem"));
loadItem("playeroptions", (p, inv, item) -> { loadItem("playeroptions", (p, inv, item) -> {
p.closeInventory(); p.closeInventory();
PlayersPageGUI.openGUI(p); PlayersPageGUI.openGUI(p);
}); });
loadItem("worldoptions", new InventoryOpenClickListener(new WorldOptionsGUI())); loadItem("worldoptions", new InventoryOpenClickListener(new WorldOptionsGUI()));
if (GuiConfig.isEnabled(path + "back")) { if (GuiConfig.isEnabled(path + "back")) {
OrcItem back = OrcItem.back.clone(); OrcItem back = OrcItem.back.clone();
back.setOnClick((p, inv, item) -> { back.setOnClick((p, inv, item) -> {
p.closeInventory(); p.closeInventory();
}); });
addItem(GuiConfig.getSlot(path + "back"), back); addItem(GuiConfig.getSlot(path + "back"), back);
} }
} }
@Override @Override
public Inventory getInventory(Player player) { public Inventory getInventory(Player player) {
PlayersPageGUI.preloadPlayers(WorldConfig.getWorldConfig(player.getWorld().getName())); PlayersPageGUI.preloadPlayers(WorldConfig.getWorldConfig(player.getWorld().getName()));
return super.getInventory(player); return super.getInventory(player);
} }
public void loadItem(String subpath, OrcClickListener listener) { public void loadItem(String subpath, OrcClickListener listener) {
if (GuiConfig.isEnabled(path + subpath) == false) if (GuiConfig.isEnabled(path + subpath) == false)
return; return;
OrcItem item = GuiConfig.getItem(path + subpath); OrcItem item = GuiConfig.getItem(path + subpath);
if (item != null) { if (item != null) {
item.setOnClick(listener); item.setOnClick(listener);
addItem(GuiConfig.getSlot(path + subpath), item); addItem(GuiConfig.getSlot(path + subpath), item);
} }
} }
public void loadItem(String subpath) { public void loadItem(String subpath) {
loadItem(subpath, null); loadItem(subpath, null);
} }
public boolean canOpen(Player p) { public boolean canOpen(Player p) {
return true; return true;
} }
} }

View File

@ -1,17 +1,17 @@
package de.butzlabben.world.gui.clicklistener; package de.butzlabben.world.gui.clicklistener;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import de.butzlabben.inventory.OrcClickListener; import de.butzlabben.inventory.OrcClickListener;
import de.butzlabben.inventory.OrcInventory; import de.butzlabben.inventory.OrcInventory;
import de.butzlabben.inventory.OrcItem; import de.butzlabben.inventory.OrcItem;
public class ComingSoonClickListener implements OrcClickListener { public class ComingSoonClickListener implements OrcClickListener {
@Override @Override
public void onClick(Player p, OrcInventory inv, OrcItem item) { public void onClick(Player p, OrcInventory inv, OrcItem item) {
p.closeInventory(); p.closeInventory();
p.sendMessage("§cComing soon..."); p.sendMessage("§cComing soon...");
} }
} }

View File

@ -1,25 +1,25 @@
package de.butzlabben.world.gui.clicklistener; package de.butzlabben.world.gui.clicklistener;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import de.butzlabben.inventory.OrcClickListener; import de.butzlabben.inventory.OrcClickListener;
import de.butzlabben.inventory.OrcInventory; import de.butzlabben.inventory.OrcInventory;
import de.butzlabben.inventory.OrcItem; import de.butzlabben.inventory.OrcItem;
public class CommandExecutorClickListener implements OrcClickListener { public class CommandExecutorClickListener implements OrcClickListener {
private final String message; private final String message;
public CommandExecutorClickListener(String message) { public CommandExecutorClickListener(String message) {
this.message = message; this.message = message;
} }
@Override @Override
public void onClick(Player p, OrcInventory inv, OrcItem item) { public void onClick(Player p, OrcInventory inv, OrcItem item) {
p.closeInventory(); p.closeInventory();
String msg = message; String msg = message;
p.chat(msg); p.chat(msg);
// Fix for #9 // Fix for #9
inv.redraw(p); inv.redraw(p);
} }
} }

View File

@ -1,34 +1,34 @@
package de.butzlabben.world.gui.clicklistener; package de.butzlabben.world.gui.clicklistener;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import de.butzlabben.inventory.OrcClickListener; import de.butzlabben.inventory.OrcClickListener;
import de.butzlabben.inventory.OrcInventory; import de.butzlabben.inventory.OrcInventory;
import de.butzlabben.inventory.OrcItem; import de.butzlabben.inventory.OrcItem;
import de.butzlabben.world.config.MessageConfig; import de.butzlabben.world.config.MessageConfig;
public class InventoryOpenClickListener implements OrcClickListener { public class InventoryOpenClickListener implements OrcClickListener {
private final OrcInventory open; private final OrcInventory open;
public InventoryOpenClickListener(OrcInventory inv) { public InventoryOpenClickListener(OrcInventory inv) {
open = inv; open = inv;
} }
@Override @Override
public void onClick(Player p, OrcInventory inv, OrcItem item) { public void onClick(Player p, OrcInventory inv, OrcItem item) {
p.closeInventory(); p.closeInventory();
if (open == null) { if (open == null) {
return; return;
} }
Inventory to = open.getInventory(p); Inventory to = open.getInventory(p);
if (to != null) { if (to != null) {
p.openInventory(to); p.openInventory(to);
} else { } else {
p.closeInventory(); p.closeInventory();
p.sendMessage(MessageConfig.getNoPermission()); p.sendMessage(MessageConfig.getNoPermission());
} }
} }
} }

View File

@ -1,22 +1,22 @@
package de.butzlabben.world.gui.playeroption; package de.butzlabben.world.gui.playeroption;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import de.butzlabben.inventory.DependListener; import de.butzlabben.inventory.DependListener;
import de.butzlabben.inventory.OrcItem; import de.butzlabben.inventory.OrcItem;
import de.butzlabben.world.wrapper.WorldPlayer; import de.butzlabben.world.wrapper.WorldPlayer;
public class BuildStatus implements DependListener { public class BuildStatus implements DependListener {
private final WorldPlayer wp; private final WorldPlayer wp;
public BuildStatus(WorldPlayer wp) { public BuildStatus(WorldPlayer wp) {
this.wp = wp; this.wp = wp;
} }
@Override @Override
public ItemStack getItemStack(Player p, WorldPlayer player) { public ItemStack getItemStack(Player p, WorldPlayer player) {
return wp.canBuild() ? OrcItem.enabled.getItemStack(p, wp) : OrcItem.disabled.getItemStack(p, wp); return wp.canBuild() ? OrcItem.enabled.getItemStack(p, wp) : OrcItem.disabled.getItemStack(p, wp);
} }
} }

View File

@ -1,22 +1,22 @@
package de.butzlabben.world.gui.playeroption; package de.butzlabben.world.gui.playeroption;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import de.butzlabben.inventory.DependListener; import de.butzlabben.inventory.DependListener;
import de.butzlabben.inventory.OrcItem; import de.butzlabben.inventory.OrcItem;
import de.butzlabben.world.wrapper.WorldPlayer; import de.butzlabben.world.wrapper.WorldPlayer;
public class GamemodeStatus implements DependListener { public class GamemodeStatus implements DependListener {
private final WorldPlayer wp; private final WorldPlayer wp;
public GamemodeStatus(WorldPlayer wp) { public GamemodeStatus(WorldPlayer wp) {
this.wp = wp; this.wp = wp;
} }
@Override @Override
public ItemStack getItemStack(Player p, WorldPlayer player) { public ItemStack getItemStack(Player p, WorldPlayer player) {
return wp.canChangeGamemode() ? OrcItem.enabled.getItemStack(p, wp) : OrcItem.disabled.getItemStack(p, wp); return wp.canChangeGamemode() ? OrcItem.enabled.getItemStack(p, wp) : OrcItem.disabled.getItemStack(p, wp);
} }
} }

View File

@ -1,22 +1,22 @@
package de.butzlabben.world.gui.playeroption; package de.butzlabben.world.gui.playeroption;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import de.butzlabben.inventory.DependListener; import de.butzlabben.inventory.DependListener;
import de.butzlabben.inventory.OrcItem; import de.butzlabben.inventory.OrcItem;
import de.butzlabben.world.wrapper.WorldPlayer; import de.butzlabben.world.wrapper.WorldPlayer;
public class TeleportStatus implements DependListener { public class TeleportStatus implements DependListener {
private final WorldPlayer wp; private final WorldPlayer wp;
public TeleportStatus(WorldPlayer wp) { public TeleportStatus(WorldPlayer wp) {
this.wp = wp; this.wp = wp;
} }
@Override @Override
public ItemStack getItemStack(Player p, WorldPlayer player) { public ItemStack getItemStack(Player p, WorldPlayer player) {
return wp.canTeleport() ? OrcItem.enabled.getItemStack(p, wp) : OrcItem.disabled.getItemStack(p, wp); return wp.canTeleport() ? OrcItem.enabled.getItemStack(p, wp) : OrcItem.disabled.getItemStack(p, wp);
} }
} }

View File

@ -1,35 +1,35 @@
package de.butzlabben.world.gui.worldoption; package de.butzlabben.world.gui.worldoption;
import java.io.File; import java.io.File;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import de.butzlabben.inventory.DependListener; import de.butzlabben.inventory.DependListener;
import de.butzlabben.inventory.OrcItem; import de.butzlabben.inventory.OrcItem;
import de.butzlabben.world.config.DependenceConfig; import de.butzlabben.world.config.DependenceConfig;
import de.butzlabben.world.config.PluginConfig; import de.butzlabben.world.config.PluginConfig;
import de.butzlabben.world.wrapper.WorldPlayer; import de.butzlabben.world.wrapper.WorldPlayer;
public class FireStatus implements DependListener { public class FireStatus implements DependListener {
@Override @Override
public ItemStack getItemStack(Player p, WorldPlayer wp) { public ItemStack getItemStack(Player p, WorldPlayer wp) {
String worldname = new DependenceConfig(p).getWorldname(); String worldname = new DependenceConfig(p).getWorldname();
File file = new File(worldname + "/worldconfig.yml"); File file = new File(worldname + "/worldconfig.yml");
if (!file.exists()) if (!file.exists())
file = new File(PluginConfig.getWorlddir() + "/worldconfig.yml"); file = new File(PluginConfig.getWorlddir() + "/worldconfig.yml");
if (!file.exists()) if (!file.exists())
return null; return null;
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file); YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
boolean b = cfg.getBoolean("Settings.Fire"); boolean b = cfg.getBoolean("Settings.Fire");
if (b) if (b)
return OrcItem.enabled.getItemStack(p); return OrcItem.enabled.getItemStack(p);
return null; return null;
// TODO wenn enabled, dann return OrcItem.enabled.getItemStack(p, wp); // TODO wenn enabled, dann return OrcItem.enabled.getItemStack(p, wp);
// sonst return null // sonst return null
} }
} }

View File

@ -1,35 +1,35 @@
package de.butzlabben.world.gui.worldoption; package de.butzlabben.world.gui.worldoption;
import java.io.File; import java.io.File;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import de.butzlabben.inventory.DependListener; import de.butzlabben.inventory.DependListener;
import de.butzlabben.inventory.OrcItem; import de.butzlabben.inventory.OrcItem;
import de.butzlabben.world.config.DependenceConfig; import de.butzlabben.world.config.DependenceConfig;
import de.butzlabben.world.config.PluginConfig; import de.butzlabben.world.config.PluginConfig;
import de.butzlabben.world.wrapper.WorldPlayer; import de.butzlabben.world.wrapper.WorldPlayer;
public class TntStatus implements DependListener { public class TntStatus implements DependListener {
@Override @Override
public ItemStack getItemStack(Player p, WorldPlayer wp) { public ItemStack getItemStack(Player p, WorldPlayer wp) {
String worldname = new DependenceConfig(p).getWorldname(); String worldname = new DependenceConfig(p).getWorldname();
File file = new File(worldname + "/worldconfig.yml"); File file = new File(worldname + "/worldconfig.yml");
if (!file.exists()) if (!file.exists())
file = new File(PluginConfig.getWorlddir() + "/worldconfig.yml"); file = new File(PluginConfig.getWorlddir() + "/worldconfig.yml");
if (!file.exists()) if (!file.exists())
return null; return null;
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file); YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
boolean b = cfg.getBoolean("Settings.TNTDamage"); boolean b = cfg.getBoolean("Settings.TNTDamage");
if (b) if (b)
return OrcItem.enabled.getItemStack(p); return OrcItem.enabled.getItemStack(p);
return null; return null;
// TODO wenn enabled, dann return OrcItem.enabled.getItemStack(p, wp); // TODO wenn enabled, dann return OrcItem.enabled.getItemStack(p, wp);
// sonst return null // sonst return null
} }
} }

View File

@ -1,76 +1,76 @@
package de.butzlabben.world.listener; package de.butzlabben.world.listener;
import java.io.File; import java.io.File;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockBurnEvent; import org.bukkit.event.block.BlockBurnEvent;
import org.bukkit.event.block.BlockIgniteEvent; import org.bukkit.event.block.BlockIgniteEvent;
import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityExplodeEvent;
import de.butzlabben.world.config.WorldConfig; import de.butzlabben.world.config.WorldConfig;
import de.butzlabben.world.wrapper.WorldPlayer; import de.butzlabben.world.wrapper.WorldPlayer;
public class BlockListener implements Listener { public class BlockListener implements Listener {
@EventHandler @EventHandler
public void onExplode(EntityExplodeEvent e) { public void onExplode(EntityExplodeEvent e) {
File file = WorldConfig.getWorldFile(e.getLocation().getWorld().getName()); File file = WorldConfig.getWorldFile(e.getLocation().getWorld().getName());
if(!file.exists()) if(!file.exists())
return; return;
WorldConfig wc = WorldConfig.getWorldConfig(e.getLocation().getWorld().getName()); WorldConfig wc = WorldConfig.getWorldConfig(e.getLocation().getWorld().getName());
e.setCancelled(!wc.isTnt()); e.setCancelled(!wc.isTnt());
} }
@EventHandler @EventHandler
public void onPlace(BlockPlaceEvent e) { public void onPlace(BlockPlaceEvent e) {
Player p = e.getPlayer(); Player p = e.getPlayer();
if (p.hasPermission("ws.build")) if (p.hasPermission("ws.build"))
return; return;
String worldname = p.getWorld().getName(); String worldname = p.getWorld().getName();
WorldPlayer wp = new WorldPlayer(p, worldname); WorldPlayer wp = new WorldPlayer(p, worldname);
if (!wp.isOnSystemWorld()) if (!wp.isOnSystemWorld())
return; return;
if(!wp.isMember()) if(!wp.isMember())
e.setCancelled(true); e.setCancelled(true);
if (!wp.isOwnerofWorld()) { if (!wp.isOwnerofWorld()) {
e.setCancelled(!wp.canBuild()); e.setCancelled(!wp.canBuild());
} }
} }
@EventHandler @EventHandler
public void onBreak(BlockBreakEvent e) { public void onBreak(BlockBreakEvent e) {
Player p = e.getPlayer(); Player p = e.getPlayer();
if (p.hasPermission("ws.build")) if (p.hasPermission("ws.build"))
return; return;
String worldname = p.getWorld().getName(); String worldname = p.getWorld().getName();
WorldPlayer wp = new WorldPlayer(p, worldname); WorldPlayer wp = new WorldPlayer(p, worldname);
if (!wp.isOnSystemWorld()) if (!wp.isOnSystemWorld())
return; return;
if(!wp.isMember()) if(!wp.isMember())
e.setCancelled(true); e.setCancelled(true);
if (!wp.isOwnerofWorld()) { if (!wp.isOwnerofWorld()) {
e.setCancelled(!wp.canBuild()); e.setCancelled(!wp.canBuild());
} }
} }
@EventHandler @EventHandler
public void onFire(BlockIgniteEvent e) { public void onFire(BlockIgniteEvent e) {
File file = WorldConfig.getWorldFile(e.getBlock().getWorld().getName()); File file = WorldConfig.getWorldFile(e.getBlock().getWorld().getName());
if(!file.exists()) if(!file.exists())
return; return;
WorldConfig wc = WorldConfig.getWorldConfig(e.getBlock().getWorld().getName()); WorldConfig wc = WorldConfig.getWorldConfig(e.getBlock().getWorld().getName());
e.setCancelled(!wc.isFire()); e.setCancelled(!wc.isFire());
} }
@EventHandler @EventHandler
public void onFire(BlockBurnEvent e) { public void onFire(BlockBurnEvent e) {
File file = WorldConfig.getWorldFile(e.getBlock().getWorld().getName()); File file = WorldConfig.getWorldFile(e.getBlock().getWorld().getName());
if(!file.exists()) if(!file.exists())
return; return;
WorldConfig wc = WorldConfig.getWorldConfig(e.getBlock().getWorld().getName()); WorldConfig wc = WorldConfig.getWorldConfig(e.getBlock().getWorld().getName());
e.setCancelled(!wc.isFire()); e.setCancelled(!wc.isFire());
} }
} }

View File

@ -1,135 +1,135 @@
package de.butzlabben.world.listener; package de.butzlabben.world.listener;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import de.butzlabben.world.config.MessageConfig; import de.butzlabben.world.config.MessageConfig;
import de.butzlabben.world.config.PluginConfig; import de.butzlabben.world.config.PluginConfig;
import de.butzlabben.world.config.WorldConfig; import de.butzlabben.world.config.WorldConfig;
import de.butzlabben.world.wrapper.SystemWorld; import de.butzlabben.world.wrapper.SystemWorld;
import de.butzlabben.world.wrapper.WorldPlayer; import de.butzlabben.world.wrapper.WorldPlayer;
public class CommandListener implements Listener { public class CommandListener implements Listener {
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
public void onTeleport(PlayerTeleportEvent e) { public void onTeleport(PlayerTeleportEvent e) {
Player p = e.getPlayer(); Player p = e.getPlayer();
World from = e.getFrom().getWorld(); World from = e.getFrom().getWorld();
World to = e.getTo().getWorld(); World to = e.getTo().getWorld();
WorldPlayer wp = new WorldPlayer(p); WorldPlayer wp = new WorldPlayer(p);
if (from != to) if (from != to)
SystemWorld.tryUnloadLater(from); SystemWorld.tryUnloadLater(from);
if (e.getCause() == TeleportCause.SPECTATE) { if (e.getCause() == TeleportCause.SPECTATE) {
if (from != to && WorldConfig.exists(to.getName())) { if (from != to && WorldConfig.exists(to.getName())) {
if (!p.hasPermission("ws.tp.toother")) { if (!p.hasPermission("ws.tp.toother")) {
e.setCancelled(true); e.setCancelled(true);
p.sendMessage(MessageConfig.getNoPermission()); p.sendMessage(MessageConfig.getNoPermission());
return; return;
} }
} }
if (!wp.isOnSystemWorld() || wp.isOwnerofWorld() || wp.canTeleport() || p.hasPermission("ws.tp.toother")) if (!wp.isOnSystemWorld() || wp.isOwnerofWorld() || wp.canTeleport() || p.hasPermission("ws.tp.toother"))
return; return;
e.setCancelled(true); e.setCancelled(true);
p.sendMessage(MessageConfig.getNoPermission()); p.sendMessage(MessageConfig.getNoPermission());
} else if (e.getCause() == TeleportCause.COMMAND) { } else if (e.getCause() == TeleportCause.COMMAND) {
if (from != to && WorldConfig.exists(to.getName())) { if (from != to && WorldConfig.exists(to.getName())) {
if (!p.hasPermission("ws.tp.toother")) { if (!p.hasPermission("ws.tp.toother")) {
e.setCancelled(true); e.setCancelled(true);
p.sendMessage(MessageConfig.getNoPermission()); p.sendMessage(MessageConfig.getNoPermission());
return; return;
} }
} }
if (!wp.isOnSystemWorld() || wp.isOwnerofWorld() || wp.canTeleport() || p.hasPermission("ws.tp.toother")) if (!wp.isOnSystemWorld() || wp.isOwnerofWorld() || wp.canTeleport() || p.hasPermission("ws.tp.toother"))
return; return;
e.setCancelled(true); e.setCancelled(true);
p.sendMessage(MessageConfig.getNoPermission()); p.sendMessage(MessageConfig.getNoPermission());
} }
} }
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
public void onCmd(PlayerCommandPreprocessEvent e) { public void onCmd(PlayerCommandPreprocessEvent e) {
String cmd = e.getMessage().toLowerCase(); String cmd = e.getMessage().toLowerCase();
Player p = e.getPlayer(); Player p = e.getPlayer();
WorldPlayer wp = new WorldPlayer(p); WorldPlayer wp = new WorldPlayer(p);
if (!wp.isOnSystemWorld()) if (!wp.isOnSystemWorld())
return; return;
if (cmd.startsWith("/gamemode") || cmd.startsWith("/gm")) { if (cmd.startsWith("/gamemode") || cmd.startsWith("/gm")) {
if (!wp.isOnSystemWorld()) if (!wp.isOnSystemWorld())
return; return;
if (p.hasPermission("ws.gamemode")) if (p.hasPermission("ws.gamemode"))
return; return;
if (PluginConfig.isSurvival()) { if (PluginConfig.isSurvival()) {
e.setCancelled(true); e.setCancelled(true);
p.sendMessage(MessageConfig.getNoPermission()); p.sendMessage(MessageConfig.getNoPermission());
return; return;
} }
if (!wp.canChangeGamemode() && !wp.isOwnerofWorld()) { if (!wp.canChangeGamemode() && !wp.isOwnerofWorld()) {
p.sendMessage(MessageConfig.getNoPermission()); p.sendMessage(MessageConfig.getNoPermission());
e.setCancelled(true); e.setCancelled(true);
return; return;
} }
} else if (cmd.startsWith("/tp") || cmd.startsWith("/teleport")) { } else if (cmd.startsWith("/tp") || cmd.startsWith("/teleport")) {
String[] args = e.getMessage().split(" "); String[] args = e.getMessage().split(" ");
if (args.length == 2) { if (args.length == 2) {
if (p.hasPermission("ws.tp.toother")) if (p.hasPermission("ws.tp.toother"))
return; return;
if (PluginConfig.isSurvival()) { if (PluginConfig.isSurvival()) {
e.setCancelled(true); e.setCancelled(true);
p.sendMessage(MessageConfig.getNoPermission()); p.sendMessage(MessageConfig.getNoPermission());
return; return;
} }
Player a = Bukkit.getPlayer(args[1]); Player a = Bukkit.getPlayer(args[1]);
if (a == null) if (a == null)
return; return;
if (p.getWorld() != a.getWorld()) { if (p.getWorld() != a.getWorld()) {
e.setCancelled(true); e.setCancelled(true);
p.sendMessage(MessageConfig.getNoPermission()); p.sendMessage(MessageConfig.getNoPermission());
return; return;
} }
if (wp.isOwnerofWorld()) if (wp.isOwnerofWorld())
return; return;
if (!wp.canTeleport()) { if (!wp.canTeleport()) {
p.sendMessage(MessageConfig.getNoPermission()); p.sendMessage(MessageConfig.getNoPermission());
e.setCancelled(true); e.setCancelled(true);
return; return;
} }
} else if (args.length == 3) { } else if (args.length == 3) {
if (!p.hasPermission("ws.tp.other")) { if (!p.hasPermission("ws.tp.other")) {
p.sendMessage(MessageConfig.getNoPermission()); p.sendMessage(MessageConfig.getNoPermission());
e.setCancelled(true); e.setCancelled(true);
} }
} else if (args.length == 4) { } else if (args.length == 4) {
if (p.hasPermission("ws.tp.toother")) if (p.hasPermission("ws.tp.toother"))
return; return;
if (PluginConfig.isSurvival()) { if (PluginConfig.isSurvival()) {
e.setCancelled(true); e.setCancelled(true);
p.sendMessage(MessageConfig.getNoPermission()); p.sendMessage(MessageConfig.getNoPermission());
return; return;
} }
if (wp.isOwnerofWorld()) if (wp.isOwnerofWorld())
return; return;
if (!wp.canTeleport()) { if (!wp.canTeleport()) {
p.sendMessage(MessageConfig.getNoPermission()); p.sendMessage(MessageConfig.getNoPermission());
e.setCancelled(true); e.setCancelled(true);
return; return;
} }
} }
} }
} }
} }

View File

@ -1,51 +1,51 @@
package de.butzlabben.world.listener; package de.butzlabben.world.listener;
import java.util.HashMap; import java.util.HashMap;
import java.util.UUID; import java.util.UUID;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.event.player.PlayerRespawnEvent;
import de.butzlabben.world.config.PluginConfig; import de.butzlabben.world.config.PluginConfig;
import de.butzlabben.world.config.WorldConfig; import de.butzlabben.world.config.WorldConfig;
import de.butzlabben.world.wrapper.WorldPlayer; import de.butzlabben.world.wrapper.WorldPlayer;
public class PlayerDeathListener implements Listener { public class PlayerDeathListener implements Listener {
private HashMap<UUID, World> deathLocations = new HashMap<>(); private HashMap<UUID, World> deathLocations = new HashMap<>();
@EventHandler @EventHandler
public void onDie(PlayerDeathEvent e) { public void onDie(PlayerDeathEvent e) {
Player p = e.getEntity(); Player p = e.getEntity();
WorldPlayer wp = new WorldPlayer(p, p.getWorld().getName()); WorldPlayer wp = new WorldPlayer(p, p.getWorld().getName());
if (wp.isOnSystemWorld()) { if (wp.isOnSystemWorld()) {
deathLocations.put(p.getUniqueId(), p.getLocation().getWorld()); deathLocations.put(p.getUniqueId(), p.getLocation().getWorld());
} else { } else {
p.setGameMode(PluginConfig.getSpawnGamemode()); p.setGameMode(PluginConfig.getSpawnGamemode());
} }
} }
@EventHandler @EventHandler
public void onRespawn(PlayerRespawnEvent e) { public void onRespawn(PlayerRespawnEvent e) {
Player p = e.getPlayer(); Player p = e.getPlayer();
if (deathLocations.containsKey(p.getUniqueId())) { if (deathLocations.containsKey(p.getUniqueId())) {
World world = deathLocations.remove(p.getUniqueId()); World world = deathLocations.remove(p.getUniqueId());
WorldConfig config = WorldConfig.getWorldConfig(world.getName()); WorldConfig config = WorldConfig.getWorldConfig(world.getName());
if (config.getHome() != null) { if (config.getHome() != null) {
e.setRespawnLocation(config.getHome()); e.setRespawnLocation(config.getHome());
} else { } else {
if (PluginConfig.useWorldSpawn()) { if (PluginConfig.useWorldSpawn()) {
e.setRespawnLocation(PluginConfig.getWorldSpawn(world)); e.setRespawnLocation(PluginConfig.getWorldSpawn(world));
} else { } else {
e.setRespawnLocation(world.getSpawnLocation()); e.setRespawnLocation(world.getSpawnLocation());
} }
} }
} }
} }
} }

View File

@ -1,38 +1,38 @@
package de.butzlabben.world.listener; package de.butzlabben.world.listener;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import de.butzlabben.world.config.DependenceConfig; import de.butzlabben.world.config.DependenceConfig;
import de.butzlabben.world.config.PluginConfig; import de.butzlabben.world.config.PluginConfig;
import de.butzlabben.world.wrapper.SystemWorld; import de.butzlabben.world.wrapper.SystemWorld;
public class PlayerListener implements Listener { public class PlayerListener implements Listener {
//#17 //#17
@EventHandler(priority = EventPriority.HIGHEST) @EventHandler(priority = EventPriority.HIGHEST)
public void onJoin(PlayerJoinEvent e) { public void onJoin(PlayerJoinEvent e) {
if (PluginConfig.spawnTeleportation()) { if (PluginConfig.spawnTeleportation()) {
Player p = e.getPlayer(); Player p = e.getPlayer();
DependenceConfig dc = new DependenceConfig(p); DependenceConfig dc = new DependenceConfig(p);
if (dc.hasWorld()) { if (dc.hasWorld()) {
SystemWorld sw = SystemWorld.getSystemWorld(dc.getWorldname()); SystemWorld sw = SystemWorld.getSystemWorld(dc.getWorldname());
if (sw != null && !sw.isLoaded()) { if (sw != null && !sw.isLoaded()) {
e.getPlayer().teleport(PluginConfig.getSpawn()); e.getPlayer().teleport(PluginConfig.getSpawn());
} }
} }
} }
} }
@EventHandler @EventHandler
public void onLeave(PlayerQuitEvent e) { public void onLeave(PlayerQuitEvent e) {
Player p = e.getPlayer(); Player p = e.getPlayer();
World w = p.getWorld(); World w = p.getWorld();
SystemWorld.tryUnloadLater(w); SystemWorld.tryUnloadLater(w);
} }
} }

View File

@ -1,29 +1,29 @@
package de.butzlabben.world.util; package de.butzlabben.world.util;
import java.util.HashMap; import java.util.HashMap;
import java.util.UUID; import java.util.UUID;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
/** /**
* @author Butzlabben * @author Butzlabben
* @since 13.09.2018 * @since 13.09.2018
*/ */
public class TeleportUtil { public class TeleportUtil {
private static HashMap<UUID, Location> oldLocs = new HashMap<>(); private static HashMap<UUID, Location> oldLocs = new HashMap<>();
public static void teleportPlayer(Player p, Location loc) { public static void teleportPlayer(Player p, Location loc) {
// Save old player location. // Save old player location.
// If he does another teleport he will be taken back then to the first location // If he does another teleport he will be taken back then to the first location
if(!oldLocs.containsKey(p.getUniqueId())) { if(!oldLocs.containsKey(p.getUniqueId())) {
Location oldLoc = p.getLocation(); Location oldLoc = p.getLocation();
oldLocs.put(p.getUniqueId(), oldLoc); oldLocs.put(p.getUniqueId(), oldLoc);
} }
} }
private TeleportUtil() { private TeleportUtil() {
} }
} }

View File

@ -1,45 +1,45 @@
package de.butzlabben.world.wrapper; package de.butzlabben.world.wrapper;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.WorldCreator; import org.bukkit.WorldCreator;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import com.boydti.fawe.bukkit.wrapper.AsyncWorld; import com.boydti.fawe.bukkit.wrapper.AsyncWorld;
import com.boydti.fawe.util.TaskManager; import com.boydti.fawe.util.TaskManager;
/** /**
* @author Butzlabben * @author Butzlabben
* @since 08.06.2018 * @since 08.06.2018
*/ */
public class AsyncCreatorAdapter implements CreatorAdapter { public class AsyncCreatorAdapter implements CreatorAdapter {
// Create worlds async to close #16 // Create worlds async to close #16
@Override @Override
public void create(WorldCreator creator, SystemWorld sw, Runnable r) { public void create(WorldCreator creator, SystemWorld sw, Runnable r) {
TaskManager.IMP.async(new Runnable() { TaskManager.IMP.async(new Runnable() {
@Override @Override
public void run() { public void run() {
AsyncWorld world; AsyncWorld world;
if (Bukkit.getWorld(creator.name()) == null) if (Bukkit.getWorld(creator.name()) == null)
world = AsyncWorld.create(creator); world = AsyncWorld.create(creator);
else else
world = AsyncWorld.wrap(Bukkit.getWorld(creator.name())); world = AsyncWorld.wrap(Bukkit.getWorld(creator.name()));
Block block = world.getBlockAt(0, 0, 0); Block block = world.getBlockAt(0, 0, 0);
block.setType(Material.BEDROCK); block.setType(Material.BEDROCK);
// When you are done // When you are done
world.commit(); world.commit();
Bukkit.getWorlds().add(world); Bukkit.getWorlds().add(world);
if (sw != null) if (sw != null)
sw.setCreating(false); sw.setCreating(false);
// Send the message // Send the message
r.run(); r.run();
} }
}); });
return; return;
} }
} }

View File

@ -1,12 +1,12 @@
package de.butzlabben.world.wrapper; package de.butzlabben.world.wrapper;
import org.bukkit.WorldCreator; import org.bukkit.WorldCreator;
/** /**
* @author Butzlabben * @author Butzlabben
* @since 07.06.2018 * @since 07.06.2018
*/ */
public interface CreatorAdapter { public interface CreatorAdapter {
public void create(WorldCreator creator, SystemWorld world, Runnable sendPlayerMessageCallback); public void create(WorldCreator creator, SystemWorld world, Runnable sendPlayerMessageCallback);
} }

View File

@ -1,432 +1,432 @@
package de.butzlabben.world.wrapper; package de.butzlabben.world.wrapper;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.WorldCreator; import org.bukkit.WorldCreator;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import de.butzlabben.world.WorldSystem; import de.butzlabben.world.WorldSystem;
import de.butzlabben.world.config.DependenceConfig; import de.butzlabben.world.config.DependenceConfig;
import de.butzlabben.world.config.MessageConfig; import de.butzlabben.world.config.MessageConfig;
import de.butzlabben.world.config.PluginConfig; import de.butzlabben.world.config.PluginConfig;
import de.butzlabben.world.config.SettingsConfig; import de.butzlabben.world.config.SettingsConfig;
import de.butzlabben.world.config.WorldConfig; import de.butzlabben.world.config.WorldConfig;
import de.butzlabben.world.event.WorldCreateEvent; import de.butzlabben.world.event.WorldCreateEvent;
import de.butzlabben.world.event.WorldLoadEvent; import de.butzlabben.world.event.WorldLoadEvent;
import de.butzlabben.world.event.WorldUnloadEvent; import de.butzlabben.world.event.WorldUnloadEvent;
/** /**
* This class represents a systemworld, loaded or not * This class represents a systemworld, loaded or not
* *
* @author Butzlabben * @author Butzlabben
* @since 14.02.2018 * @since 14.02.2018
*/ */
public class SystemWorld { public class SystemWorld {
private World w; private World w;
private String worldname; private String worldname;
private boolean unloading = false; private boolean unloading = false;
private boolean creating = false; private boolean creating = false;
private static HashMap<String, SystemWorld> cached = new HashMap<>(); private static HashMap<String, SystemWorld> cached = new HashMap<>();
/** /**
* This method is the online way to get a system world instance * This method is the online way to get a system world instance
* *
* @param worldname as in minecraft * @param worldname as in minecraft
* @return a systemworld instance if it is a systemworld or null if is not a * @return a systemworld instance if it is a systemworld or null if is not a
* systemworld * systemworld
* @exception NullPointerException worldname == null * @exception NullPointerException worldname == null
*/ */
public static SystemWorld getSystemWorld(String worldname) { public static SystemWorld getSystemWorld(String worldname) {
Preconditions.checkNotNull(worldname, "worldname must not be null"); Preconditions.checkNotNull(worldname, "worldname must not be null");
if (cached.containsKey(worldname)) if (cached.containsKey(worldname))
return cached.get(worldname); return cached.get(worldname);
SystemWorld sw = new SystemWorld(worldname); SystemWorld sw = new SystemWorld(worldname);
if (sw != null && sw.exists()) { if (sw != null && sw.exists()) {
cached.put(worldname, sw); cached.put(worldname, sw);
return sw; return sw;
} }
return null; return null;
} }
/** /**
* @param w a world in bukkit, no matter if systemworld or not Trys to unload a * @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 * systemworld later, with the given delay in the config
*/ */
public static void tryUnloadLater(World w) { public static void tryUnloadLater(World w) {
if (w != null) if (w != null)
Bukkit.getScheduler().runTaskLater(WorldSystem.getInstance(), () -> { Bukkit.getScheduler().runTaskLater(WorldSystem.getInstance(), () -> {
if (w.getPlayers().size() == 0) { if (w.getPlayers().size() == 0) {
SystemWorld sw = SystemWorld.getSystemWorld(w.getName()); SystemWorld sw = SystemWorld.getSystemWorld(w.getName());
if (sw != null && sw.isLoaded()) if (sw != null && sw.isLoaded())
sw.unloadLater(w); sw.unloadLater(w);
} }
}, 20); }, 20);
} }
private SystemWorld(String worldname) { private SystemWorld(String worldname) {
this.worldname = worldname; this.worldname = worldname;
w = Bukkit.getWorld(worldname); w = Bukkit.getWorld(worldname);
} }
/** /**
* Trys to force-unload this world * Trys to force-unload this world
* *
* @param w associated world * @param w associated world
* @exception NullPointerException w == null * @exception NullPointerException w == null
*/ */
public void directUnload(World w) { public void directUnload(World w) {
if (!Bukkit.isPrimaryThread()) { if (!Bukkit.isPrimaryThread()) {
Bukkit.getScheduler().runTask(WorldSystem.getInstance(), () -> { Bukkit.getScheduler().runTask(WorldSystem.getInstance(), () -> {
directUnload(w); directUnload(w);
}); });
return; return;
} }
Preconditions.checkNotNull(w, "world must not be null"); Preconditions.checkNotNull(w, "world must not be null");
unloading = true; unloading = true;
w.save(); w.save();
Chunk[] arrayOfChunk; Chunk[] arrayOfChunk;
int j = (arrayOfChunk = w.getLoadedChunks()).length; int j = (arrayOfChunk = w.getLoadedChunks()).length;
for (int i = 0; i < j; i++) { for (int i = 0; i < j; i++) {
Chunk c = arrayOfChunk[i]; Chunk c = arrayOfChunk[i];
c.unload(); c.unload();
} }
for (Player a : w.getPlayers()) { for (Player a : w.getPlayers()) {
a.teleport(PluginConfig.getSpawn()); a.teleport(PluginConfig.getSpawn());
a.setGameMode(PluginConfig.getSpawnGamemode()); a.setGameMode(PluginConfig.getSpawnGamemode());
} }
if (unloading) { if (unloading) {
if (Bukkit.unloadWorld(w, true)) { if (Bukkit.unloadWorld(w, true)) {
File worldinserver = new File(Bukkit.getWorldContainer(), worldname); File worldinserver = new File(Bukkit.getWorldContainer(), worldname);
File worlddir = new File(PluginConfig.getWorlddir()); File worlddir = new File(PluginConfig.getWorlddir());
try { try {
FileUtils.moveDirectoryToDirectory(worldinserver, worlddir, false); FileUtils.moveDirectoryToDirectory(worldinserver, worlddir, false);
Bukkit.getWorlds().remove(w); Bukkit.getWorlds().remove(w);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
} }
} }
/** /**
* Trys to unload this world later, with the given delay in the config * Trys to unload this world later, with the given delay in the config
* *
* @param w the associated world * @param w the associated world
* @exception NullPointerException w == null * @exception NullPointerException w == null
*/ */
public void unloadLater(World w) { public void unloadLater(World w) {
if (!Bukkit.isPrimaryThread()) { if (!Bukkit.isPrimaryThread()) {
Bukkit.getScheduler().runTask(WorldSystem.getInstance(), () -> { Bukkit.getScheduler().runTask(WorldSystem.getInstance(), () -> {
unloadLater(w); unloadLater(w);
}); });
return; return;
} }
Preconditions.checkNotNull(w, "world must not be null"); Preconditions.checkNotNull(w, "world must not be null");
WorldUnloadEvent event = new WorldUnloadEvent(this); WorldUnloadEvent event = new WorldUnloadEvent(this);
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) if (event.isCancelled())
return; return;
// Set unloading to true // Set unloading to true
unloading = true; unloading = true;
w.save(); w.save();
Chunk[] arrayOfChunk; Chunk[] arrayOfChunk;
int j = (arrayOfChunk = w.getLoadedChunks()).length; int j = (arrayOfChunk = w.getLoadedChunks()).length;
for (int i = 0; i < j; i++) { for (int i = 0; i < j; i++) {
Chunk c = arrayOfChunk[i]; Chunk c = arrayOfChunk[i];
c.unload(); c.unload();
} }
for (Player a : w.getPlayers()) { for (Player a : w.getPlayers()) {
a.teleport(PluginConfig.getSpawn()); a.teleport(PluginConfig.getSpawn());
a.setGameMode(PluginConfig.getSpawnGamemode()); a.setGameMode(PluginConfig.getSpawnGamemode());
} }
Bukkit.getScheduler().runTaskLater(WorldSystem.getInstance(), new Runnable() { Bukkit.getScheduler().runTaskLater(WorldSystem.getInstance(), new Runnable() {
@Override @Override
public void run() { public void run() {
// Still in world unloading process? // Still in world unloading process?
if (unloading && w.getPlayers().size() == 0) { if (unloading && w.getPlayers().size() == 0) {
if (Bukkit.unloadWorld(w, true)) { if (Bukkit.unloadWorld(w, true)) {
File worldinserver = new File(Bukkit.getWorldContainer(), worldname); File worldinserver = new File(Bukkit.getWorldContainer(), worldname);
File worlddir = new File(PluginConfig.getWorlddir()); File worlddir = new File(PluginConfig.getWorlddir());
try { try {
FileUtils.moveDirectoryToDirectory(worldinserver, worlddir, false); FileUtils.moveDirectoryToDirectory(worldinserver, worlddir, false);
Bukkit.getWorlds().remove(w); Bukkit.getWorlds().remove(w);
unloading = false; unloading = false;
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
} }
} }
}, 20 * PluginConfig.getUnloadingTime()); }, 20 * PluginConfig.getUnloadingTime());
} }
/** /**
* Trys to load this world, and messages the player about the process * Trys to load this world, and messages the player about the process
* *
* @param p the player to teleport on the world * @param p the player to teleport on the world
* @exception NullPointerException if p is null * @exception NullPointerException if p is null
* @exception IllegalArgumentException if player is not online * @exception IllegalArgumentException if player is not online
*/ */
public void load(Player p) { public void load(Player p) {
if (!Bukkit.isPrimaryThread()) { if (!Bukkit.isPrimaryThread()) {
Bukkit.getScheduler().runTask(WorldSystem.getInstance(), () -> { Bukkit.getScheduler().runTask(WorldSystem.getInstance(), () -> {
load(p); load(p);
}); });
return; return;
} }
Preconditions.checkNotNull(p, "player must not be null"); Preconditions.checkNotNull(p, "player must not be null");
Preconditions.checkArgument(p.isOnline(), "player must be online"); Preconditions.checkArgument(p.isOnline(), "player must be online");
if (creating) { if (creating) {
p.sendMessage(MessageConfig.getWorldStillCreating()); p.sendMessage(MessageConfig.getWorldStillCreating());
return; return;
} }
WorldLoadEvent event = new WorldLoadEvent(p, this); WorldLoadEvent event = new WorldLoadEvent(p, this);
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) if (event.isCancelled())
return; return;
unloading = false; unloading = false;
p.sendMessage(MessageConfig.getSettingUpWorld()); p.sendMessage(MessageConfig.getSettingUpWorld());
// Move World into Server dir // Move World into Server dir
String worlddir = PluginConfig.getWorlddir(); String worlddir = PluginConfig.getWorlddir();
File world = new File(worlddir + "/" + worldname); File world = new File(worlddir + "/" + worldname);
if (!world.exists()) { if (!world.exists()) {
world = new File(Bukkit.getWorldContainer(), worldname); world = new File(Bukkit.getWorldContainer(), worldname);
} else { } else {
if (new File(Bukkit.getWorldContainer(), worldname).exists() if (new File(Bukkit.getWorldContainer(), worldname).exists()
&& new File(PluginConfig.getWorlddir() + "/" + worldname).exists()) { && new File(PluginConfig.getWorlddir() + "/" + worldname).exists()) {
System.err.println("World " + worldname + " exists twice!"); System.err.println("World " + worldname + " exists twice!");
// try { // try {
// FileUtils.deleteDirectory(new // FileUtils.deleteDirectory(new
// File(Bukkit.getWorldContainer(), worldname)); // File(Bukkit.getWorldContainer(), worldname));
// } catch (IOException e) { // } catch (IOException e) {
// p.sendMessage(PluginConfig.getPrefix() + "§cError"); // p.sendMessage(PluginConfig.getPrefix() + "§cError");
// e.printStackTrace(); // e.printStackTrace();
// } // }
} }
try { try {
FileUtils.moveDirectoryToDirectory(world, Bukkit.getWorldContainer(), false); FileUtils.moveDirectoryToDirectory(world, Bukkit.getWorldContainer(), false);
} catch (IOException e) { } catch (IOException e) {
System.err.println("Couldn't load world of " + p.getName()); System.err.println("Couldn't load world of " + p.getName());
p.sendMessage(PluginConfig.getPrefix() + "§cError: " + e.getMessage()); p.sendMessage(PluginConfig.getPrefix() + "§cError: " + e.getMessage());
e.printStackTrace(); e.printStackTrace();
} }
} }
if (worldname.charAt(worldname.length() - 37) == ' ') { if (worldname.charAt(worldname.length() - 37) == ' ') {
StringBuilder myName = new StringBuilder(worldname); StringBuilder myName = new StringBuilder(worldname);
myName.setCharAt(worldname.length() - 37, '-'); myName.setCharAt(worldname.length() - 37, '-');
world.renameTo(new File(Bukkit.getWorldContainer(), myName.toString())); world.renameTo(new File(Bukkit.getWorldContainer(), myName.toString()));
worldname = myName.toString(); worldname = myName.toString();
} }
WorldCreator creator = PluginConfig.getWorldCreator(worldname); WorldCreator creator = PluginConfig.getWorldCreator(worldname);
World w = Bukkit.getWorld(worldname); World w = Bukkit.getWorld(worldname);
if (w == null) if (w == null)
w = Bukkit.createWorld(creator); w = Bukkit.createWorld(creator);
this.w = w; this.w = w;
teleportToWorldSpawn(p); teleportToWorldSpawn(p);
OfflinePlayer owner = Bukkit.getOfflinePlayer(WorldConfig.getWorldConfig(worldname).getOwner()); OfflinePlayer owner = Bukkit.getOfflinePlayer(WorldConfig.getWorldConfig(worldname).getOwner());
DependenceConfig dc = new DependenceConfig(owner); DependenceConfig dc = new DependenceConfig(owner);
dc.setLastLoaded(); dc.setLastLoaded();
} }
/** /**
* Trys to create a new systemworld with all entries etc. finally loads the * Trys to create a new systemworld with all entries etc. finally loads the
* world * world
* *
* @param p Player to create the world for * @param p Player to create the world for
* @return whether it succesfull or not * @return whether it succesfull or not
*/ */
public static boolean create(Player p, WorldTemplate template) { public static boolean create(Player p, WorldTemplate template) {
DependenceConfig dc = new DependenceConfig(p); DependenceConfig dc = new DependenceConfig(p);
String uuid = p.getUniqueId().toString(); String uuid = p.getUniqueId().toString();
int id = DependenceConfig.getHighestID() + 1; int id = DependenceConfig.getHighestID() + 1;
String worldname = "ID" + id + "-" + uuid; String worldname = "ID" + id + "-" + uuid;
WorldCreator creator = PluginConfig.getWorldCreator(worldname); WorldCreator creator = PluginConfig.getWorldCreator(worldname);
WorldCreateEvent event = new WorldCreateEvent(p, creator); WorldCreateEvent event = new WorldCreateEvent(p, creator);
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) if (event.isCancelled())
return false; return false;
dc.createNewEntry(); dc.createNewEntry();
String worlddir = PluginConfig.getWorlddir(); String worlddir = PluginConfig.getWorlddir();
File exampleworld = new File(template.getPath()); File exampleworld = new File(template.getPath());
if (new File(template.getPath() + "/uid.dat").exists()) { if (new File(template.getPath() + "/uid.dat").exists()) {
new File(template.getPath() + "/uid.dat").delete(); new File(template.getPath() + "/uid.dat").delete();
} }
File newworld = new File(worlddir + "/" + worldname); File newworld = new File(worlddir + "/" + worldname);
if (exampleworld.isDirectory()) if (exampleworld.isDirectory())
try { try {
FileUtils.copyDirectory(exampleworld, newworld); FileUtils.copyDirectory(exampleworld, newworld);
} catch (IOException e) { } catch (IOException e) {
System.err.println("Couldn't create world for " + p.getName()); System.err.println("Couldn't create world for " + p.getName());
e.printStackTrace(); e.printStackTrace();
} }
else else
newworld.mkdirs(); newworld.mkdirs();
WorldConfig.create(p); WorldConfig.create(p);
// Move World into Server dir // Move World into Server dir
File world = new File(worlddir + "/" + worldname); File world = new File(worlddir + "/" + worldname);
if (!world.exists()) { if (!world.exists()) {
world = new File(Bukkit.getWorldContainer(), worldname); world = new File(Bukkit.getWorldContainer(), worldname);
} else { } else {
if (new File(Bukkit.getWorldContainer(), worldname).exists() if (new File(Bukkit.getWorldContainer(), worldname).exists()
&& new File(PluginConfig.getWorlddir() + "/" + worldname).exists()) { && new File(PluginConfig.getWorlddir() + "/" + worldname).exists()) {
try { try {
FileUtils.deleteDirectory(new File(Bukkit.getWorldContainer(), worldname)); FileUtils.deleteDirectory(new File(Bukkit.getWorldContainer(), worldname));
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
try { try {
FileUtils.moveDirectoryToDirectory(world, Bukkit.getWorldContainer(), false); FileUtils.moveDirectoryToDirectory(world, Bukkit.getWorldContainer(), false);
} catch (IOException e) { } catch (IOException e) {
p.sendMessage(PluginConfig.getPrefix() + "§cError: " + e.getMessage()); p.sendMessage(PluginConfig.getPrefix() + "§cError: " + e.getMessage());
System.err.println("Couldn't load world of " + p.getName()); System.err.println("Couldn't load world of " + p.getName());
e.printStackTrace(); e.printStackTrace();
return false; return false;
} }
} }
SystemWorld sw = SystemWorld.getSystemWorld(worldname); SystemWorld sw = SystemWorld.getSystemWorld(worldname);
sw.setCreating(true); sw.setCreating(true);
// Run in scheduler so method returns without delay // Run in scheduler so method returns without delay
new BukkitRunnable() { new BukkitRunnable() {
@Override @Override
public void run() { public void run() {
// For #16 // For #16
WorldSystem.getInstance().getAdapter().create(event.getWorldCreator(), sw, () -> { WorldSystem.getInstance().getAdapter().create(event.getWorldCreator(), sw, () -> {
if (p != null && p.isOnline()) { if (p != null && p.isOnline()) {
p.sendMessage(MessageConfig.getWorldCreated()); p.sendMessage(MessageConfig.getWorldCreated());
SettingsConfig.getCommandsonGet().stream() SettingsConfig.getCommandsonGet().stream()
.map(s -> s.replace("%player", p.getName()).replace("%world", sw.getName()) .map(s -> s.replace("%player", p.getName()).replace("%world", sw.getName())
.replace("%uuid", p.getUniqueId().toString())) .replace("%uuid", p.getUniqueId().toString()))
.forEach(s -> Bukkit.dispatchCommand(Bukkit.getConsoleSender(), s)); .forEach(s -> Bukkit.dispatchCommand(Bukkit.getConsoleSender(), s));
} }
}); });
} }
}.runTaskLater(WorldSystem.getInstance(), 1); }.runTaskLater(WorldSystem.getInstance(), 1);
return true; return true;
} }
/** /**
* @return if the world is loaded * @return if the world is loaded
*/ */
public boolean isLoaded() { public boolean isLoaded() {
File worldAsDir = new File(Bukkit.getWorldContainer(), worldname + "/worldconfig.yml"); File worldAsDir = new File(Bukkit.getWorldContainer(), worldname + "/worldconfig.yml");
World w = Bukkit.getWorld(worldname); World w = Bukkit.getWorld(worldname);
if (worldAsDir.exists() && w != null) if (worldAsDir.exists() && w != null)
return true; return true;
return false; return false;
} }
private boolean exists() { private boolean exists() {
File worldAsDir = new File(Bukkit.getWorldContainer(), worldname + "/worldconfig.yml"); File worldAsDir = new File(Bukkit.getWorldContainer(), worldname + "/worldconfig.yml");
if (worldAsDir.exists()) { if (worldAsDir.exists()) {
return true; return true;
} }
worldAsDir = new File(PluginConfig.getWorlddir() + "/" + worldname + "/worldconfig.yml"); worldAsDir = new File(PluginConfig.getWorlddir() + "/" + worldname + "/worldconfig.yml");
if (worldAsDir.exists()) { if (worldAsDir.exists()) {
return true; return true;
} }
return false; return false;
} }
/** /**
* Teleports the player to the world with the given settings in the config * Teleports the player to the world with the given settings in the config
* *
* @param p player to teleport * @param p player to teleport
* @exception NullPointerException if player is null * @exception NullPointerException if player is null
* @exception IllegalArgumentException if player is not online * @exception IllegalArgumentException if player is not online
*/ */
public void teleportToWorldSpawn(Player p) { public void teleportToWorldSpawn(Player p) {
Preconditions.checkNotNull(p, "player must not be null"); Preconditions.checkNotNull(p, "player must not be null");
Preconditions.checkArgument(p.isOnline(), "player must be online"); Preconditions.checkArgument(p.isOnline(), "player must be online");
if (creating) { if (creating) {
p.sendMessage(MessageConfig.getWorldStillCreating()); p.sendMessage(MessageConfig.getWorldStillCreating());
return; return;
} }
unloading = false; unloading = false;
w = Bukkit.getWorld(worldname); w = Bukkit.getWorld(worldname);
if (w == null) if (w == null)
return; return;
WorldConfig config = WorldConfig.getWorldConfig(worldname); WorldConfig config = WorldConfig.getWorldConfig(worldname);
if (config.getHome() != null) { if (config.getHome() != null) {
p.teleport(config.getHome()); p.teleport(config.getHome());
} else { } else {
if (PluginConfig.useWorldSpawn()) { if (PluginConfig.useWorldSpawn()) {
p.teleport(PluginConfig.getWorldSpawn(w)); p.teleport(PluginConfig.getWorldSpawn(w));
} else { } else {
p.teleport(w.getSpawnLocation()); p.teleport(w.getSpawnLocation());
} }
} }
if (PluginConfig.isSurvival()) { if (PluginConfig.isSurvival()) {
p.setGameMode(GameMode.SURVIVAL); p.setGameMode(GameMode.SURVIVAL);
} else { } else {
p.setGameMode(GameMode.CREATIVE); p.setGameMode(GameMode.CREATIVE);
} }
OfflinePlayer owner = Bukkit.getOfflinePlayer(WorldConfig.getWorldConfig(worldname).getOwner()); OfflinePlayer owner = Bukkit.getOfflinePlayer(WorldConfig.getWorldConfig(worldname).getOwner());
DependenceConfig dc = new DependenceConfig(owner); DependenceConfig dc = new DependenceConfig(owner);
dc.setLastLoaded(); dc.setLastLoaded();
} }
/** /**
* @return the world * @return the world
*/ */
public World getWorld() { public World getWorld() {
return w; return w;
} }
public void setCreating(boolean creating) { public void setCreating(boolean creating) {
this.creating = creating; this.creating = creating;
} }
public boolean isCreating() { public boolean isCreating() {
return creating; return creating;
} }
/** /**
* @return the worldname * @return the worldname
*/ */
public String getName() { public String getName() {
return worldname; return worldname;
} }
} }

View File

@ -1,42 +1,42 @@
package de.butzlabben.world.wrapper; package de.butzlabben.world.wrapper;
import de.butzlabben.inventory.OrcItem; import de.butzlabben.inventory.OrcItem;
import de.butzlabben.world.config.GuiConfig; import de.butzlabben.world.config.GuiConfig;
/** /**
* @author Butzlabben * @author Butzlabben
* @since 15.12.2018 * @since 15.12.2018
*/ */
public class WorldTemplate { public class WorldTemplate {
private final String name; private final String name;
private final OrcItem icon; private final OrcItem icon;
private final int slot; private final int slot;
public WorldTemplate(String name) { public WorldTemplate(String name) {
this.name = name; this.name = name;
this.icon = GuiConfig.getItem("worldchoose." + name); this.icon = GuiConfig.getItem("worldchoose." + name);
this.slot = GuiConfig.getSlot("worldchoose." + name); this.slot = GuiConfig.getSlot("worldchoose." + name);
icon.setOnClick((p, inv, item) -> { icon.setOnClick((p, inv, item) -> {
p.closeInventory(); p.closeInventory();
p.chat("/ws get " + name); p.chat("/ws get " + name);
}); });
} }
public int getSlot() { public int getSlot() {
return slot; return slot;
} }
public OrcItem getIcon() { public OrcItem getIcon() {
return icon; return icon;
} }
public String getName() { public String getName() {
return name; return name;
} }
public String getPath() { public String getPath() {
return "plugins/WorldSystem/worldsources/" + name; return "plugins/WorldSystem/worldsources/" + name;
} }
} }

View File

@ -1,39 +1,39 @@
package de.butzlabben.world.wrapper; package de.butzlabben.world.wrapper;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import de.butzlabben.world.config.PluginConfig; import de.butzlabben.world.config.PluginConfig;
/** /**
* @author Butzlabben * @author Butzlabben
* @since 16.12.2018 * @since 16.12.2018
*/ */
public class WorldTemplateProvider { public class WorldTemplateProvider {
private static WorldTemplateProvider instance = new WorldTemplateProvider(); private static WorldTemplateProvider instance = new WorldTemplateProvider();
public static WorldTemplateProvider getInstace() { public static WorldTemplateProvider getInstace() {
return instance; return instance;
} }
private HashMap<String, WorldTemplate> templates = new HashMap<>(); private HashMap<String, WorldTemplate> templates = new HashMap<>();
private WorldTemplateProvider() { private WorldTemplateProvider() {
ConfigurationSection section = PluginConfig.getConfig().getConfigurationSection("worldtemplates.templates"); ConfigurationSection section = PluginConfig.getConfig().getConfigurationSection("worldtemplates.templates");
for(String key: section.getKeys(false)) { for(String key: section.getKeys(false)) {
String name = section.getString(key + ".name"); String name = section.getString(key + ".name");
templates.put(name, new WorldTemplate(name)); templates.put(name, new WorldTemplate(name));
} }
} }
public WorldTemplate getTemplate(String key) { public WorldTemplate getTemplate(String key) {
return templates.get(key); return templates.get(key);
} }
public Collection<WorldTemplate> getTemplates() { public Collection<WorldTemplate> getTemplates() {
return templates.values(); return templates.values();
} }
} }

View File

@ -1,105 +1,105 @@
########################################################################## ##########################################################################
### __ __ __ _______ __ ### ### __ __ __ _______ __ ###
### \ \ / / / / / / ___/ / / ### ### \ \ / / / / / / ___/ / / ###
### \ \ __ / /___ ___/ /___/ / /____ ______/ /______________ ### ### \ \ __ / /___ ___/ /___/ / /____ ______/ /______________ ###
### \ \ / \ / / __ \/ _/ / __ /__ / / / / __/ __/ ___/ _ _ / ### ### \ \ / \ / / __ \/ _/ / __ /__ / / / / __/ __/ ___/ _ _ / ###
### \ \/ /\ \/ / /_/ / // / /_/ /__/ / /_/ /_ / /_/ ___/ // // / ### ### \ \/ /\ \/ / /_/ / // / /_/ /__/ / /_/ /_ / /_/ ___/ // // / ###
### \__/ \__/\____/_//_/\__,_/____/\__, /___/\__/\___/_//_//_/ ### ### \__/ \__/\____/_//_/\__,_/____/\__, /___/\__/\___/_//_//_/ ###
### ___/ / ### ### ___/ / ###
### \___/ ### ### \___/ ###
########################################################################## ##########################################################################
# Path where the worlds will be saved # Path where the worlds will be saved
worldfolder: 'plugins/WorldSystem/Worlds' worldfolder: 'plugins/WorldSystem/Worlds'
worldtemplates: worldtemplates:
# Wheter players can decide on different templates # Wheter players can decide on different templates
multi_choose: false multi_choose: false
# If multi_choose is disabled, which template should be choosen # If multi_choose is disabled, which template should be choosen
default: 'template_default' default: 'template_default'
templates: templates:
# The "1" can be any key # The "1" can be any key
1: 1:
# Name of directory in plugins/WorldSystem/worldsources # Name of directory in plugins/WorldSystem/worldsources
# e.g. this would be plugins/WorldSystem/worldsources/template_default # e.g. this would be plugins/WorldSystem/worldsources/template_default
name: 'template_default' name: 'template_default'
2: 2:
name: 'another_template' name: 'another_template'
# If a confirm is needed before auto-update # If a confirm is needed before auto-update
need_confirm: true need_confirm: true
# When nobody is on a world time until it get unloaded # When nobody is on a world time until it get unloaded
unloadingtime: 20 unloadingtime: 20
# If true nobody can teleport or change their gamemode a WorldSystem world # If true nobody can teleport or change their gamemode a WorldSystem world
# Except for players with the permissions: ws.gamemode | ws.tp.* # Except for players with the permissions: ws.gamemode | ws.tp.*
survival: false survival: false
# If true players will teleported to the spawn on join # If true players will teleported to the spawn on join
spawn_teleportation: true spawn_teleportation: true
# Time in seconds until a request expires # Time in seconds until a request expires
request_expires: 20 request_expires: 20
# Name of the languagefile in plugins/WorldSystem/messages/ # Name of the languagefile in plugins/WorldSystem/messages/
language: en language: en
# Prefix which will be shown before each message # Prefix which will be shown before each message
prefix: '&8[&3WorldSystem&8] &6' prefix: '&8[&3WorldSystem&8] &6'
# Time in days after a not used world will be deleted # Time in days after a not used world will be deleted
# Set to -1 to disable # Set to -1 to disable
delete_after: -1 delete_after: -1
# Whether WorldSystem should contact the Mojang authserver # Whether WorldSystem should contact the Mojang authserver
# If not, some unknown playernames will not be displayed # If not, some unknown playernames will not be displayed
# eg. in the gui or in /ws info # eg. in the gui or in /ws info
contact_authserver: true contact_authserver: true
# Options for the LagSystem: # Options for the LagSystem:
# period_in_seconds - how often will be checked for entities in seconds # period_in_seconds - how often will be checked for entities in seconds
# entities_per_world - maximal allowed entities per world # entities_per_world - maximal allowed entities per world
# garbagecollector - how often will be unused ram be cleared # garbagecollector - how often will be unused ram be cleared
lagsystem: lagsystem:
period_in_seconds: 10 period_in_seconds: 10
entities_per_world: 350 entities_per_world: 350
garbagecollector: garbagecollector:
use: false use: false
period_in_minutes: 5 period_in_minutes: 5
# Options for random world generation # Options for random world generation
worldgeneration: worldgeneration:
# A seed for worldgeneration # A seed for worldgeneration
# Set it to 0 for no seed-useage # Set it to 0 for no seed-useage
seed: 0 seed: 0
# Environment for the world # Environment for the world
# Valid inputs are 'NORMAL', 'NETHER' and 'THE_END' # Valid inputs are 'NORMAL', 'NETHER' and 'THE_END'
environment: NORMAL environment: NORMAL
# Type of the world eg. flat, amplified, ... # Type of the world eg. flat, amplified, ...
# Valid types are 'NORMAL', 'VERSION_1_1', 'FLAT', 'AMPLIFIED', 'CUSTOMIZED' or 'LARGE_BIOMES' # Valid types are 'NORMAL', 'VERSION_1_1', 'FLAT', 'AMPLIFIED', 'CUSTOMIZED' or 'LARGE_BIOMES'
type: NORMAL type: NORMAL
# Put in here the name of a generator # Put in here the name of a generator
# If you have one from one plugin # If you have one from one plugin
generator: '' generator: ''
# Location where you will be teleported when you leave you world # Location where you will be teleported when you leave you world
spawn: spawn:
gamemode: 2 gamemode: 2
spawnpoint: spawnpoint:
world: world world: world
x: 0 x: 0
y: 20 y: 20
z: 0 z: 0
yaw: 0 yaw: 0
pitch: 0 pitch: 0
# Location where you spawn when you join a world # Location where you spawn when you join a world
worldspawn: worldspawn:
use: false use: false
spawnpoint: spawnpoint:
x: 0 x: 0
y: 20 y: 20
z: 0 z: 0
yaw: 0 yaw: 0
pitch: 0 pitch: 0

View File

@ -1,82 +1,82 @@
nopermission: "" nopermission: ""
unknown_error: "" unknown_error: ""
lagdetection: "%world" lagdetection: "%world"
wrong_usage: "" wrong_usage: ""
not_registered: "" not_registered: ""
world: world:
reseted: "" reseted: ""
still_loaded: "" still_loaded: ""
not_on: "" not_on: ""
created: "" created: ""
already_exists: "" already_exists: ""
delete: delete:
own: "" own: ""
other: "%player" other: "%player"
does_not_exists: does_not_exists:
own: "" own: ""
other: "" other: ""
setting_up: "" setting_up: ""
playerlist: "%players" playerlist: "%players"
still_creating: "" still_creating: ""
set_home: "" set_home: ""
member: member:
removed: "%player" removed: "%player"
added: "%player" added: "%player"
already_added: " already_added: "
not_added: not_added:
own: "" own: ""
other: "" other: ""
no_one_added no_one_added
request: request:
expired: "" expired: ""
confirm: "%command" confirm: "%command"
until_expire: "%time" until_expire: "%time"
already_sent: "" already_sent: ""
not_sent: "" not_sent: ""
invalid_input: "%input" invalid_input: "%input"
toggle: toggle:
gamemode: gamemode:
enabled: "" enabled: ""
disabled: "" disabled: ""
teleport: teleport:
enabled: "" enabled: ""
disabled: "" disabled: ""
build: build:
enabled: "" enabled: ""
disabled: "" disabled: ""
fire: fire:
enabled: "" enabled: ""
disabled: "" disabled: ""
tnt: tnt:
enabled: "" enabled: ""
disabled: "" disabled: ""
info: info:
owner: "%data" owner: "%data"
id: "%data" id: "%data"
member: "%data" member: "%data"
tnt: "%data" tnt: "%data"
fire: "%data" fire: "%data"
enabled: "" enabled: ""
disabled: "" disabled: ""
command_help: command_help:
list: list:
- "" - ""
- "" - ""
- "" - ""
- "" - ""
- "" - ""
- "" - ""
- "" - ""
- "" - ""
- "" - ""
- "" - ""
- "" - ""
- "" - ""
- "" - ""
delete_command: "" delete_command: ""

View File

@ -1,84 +1,84 @@
nopermission: "&cNo tienes permiso." nopermission: "&cNo tienes permiso."
unknown_error: "&cAlgo salio mal..." unknown_error: "&cAlgo salio mal..."
lagdetection: "Deteccion de lag en el mundo: &c%world" lagdetection: "Deteccion de lag en el mundo: &c%world"
wrong_usage: "&c%usage" wrong_usage: "&c%usage"
not_registered: "&cEse jugador no existe." not_registered: "&cEse jugador no existe."
world: world:
reseted: "Tu mundo ha sido reiniciado." reseted: "Tu mundo ha sido reiniciado."
still_loaded: "&cTu mundo aun esta cargando." still_loaded: "&cTu mundo aun esta cargando."
not_on: "&cNo estas en un mundo." not_on: "&cNo estas en un mundo."
created: "Tu mundo esta listo. Ve a el con &a/ws home&6." created: "Tu mundo esta listo. Ve a el con &a/ws home&6."
already_exists: "&cYa tienes un mundo." already_exists: "&cYa tienes un mundo."
delete: delete:
own: "&cTu mundo ha sido eliminado" own: "&cTu mundo ha sido eliminado"
other: "Has eliminado el mundo de &c%player&6." other: "Has eliminado el mundo de &c%player&6."
does_not_exists: does_not_exists:
own: "&cNo tienes un mundo." own: "&cNo tienes un mundo."
other: "&cEse jugador no tiene un mundo." other: "&cEse jugador no tiene un mundo."
setting_up: "&aConfigurando el mundo..." setting_up: "&aConfigurando el mundo..."
playerlist: "Jugadores en este mundo: %players" playerlist: "Jugadores en este mundo: %players"
still_creating: "&cWorld is still creating" still_creating: "&cWorld is still creating"
set_home: "You set the home" set_home: "You set the home"
member: member:
removed: "Has eliminado a &c%player&6 de tu mundo." removed: "Has eliminado a &c%player&6 de tu mundo."
added: "Has agregado a &c%player&6 a tu mundo." added: "Has agregado a &c%player&6 a tu mundo."
already_added: "&cEse jugador ya es miembro de tu mundo." already_added: "&cEse jugador ya es miembro de tu mundo."
not_added: not_added:
own: "&cEse jugador no es miembro de tu mundo." own: "&cEse jugador no es miembro de tu mundo."
other: "&cNo estas agregado a este mundo." other: "&cNo estas agregado a este mundo."
no_one_added: "&cThere are no members added" no_one_added: "&cThere are no members added"
request: request:
expired: "&cTu solicitud ha expirado." expired: "&cTu solicitud ha expirado."
confirm: "&cPor favor confirma el reinicio de tu mundo con: %command" confirm: "&cPor favor confirma el reinicio de tu mundo con: %command"
until_expire: "&cTu solicitud expira en %time segundos." until_expire: "&cTu solicitud expira en %time segundos."
already_sent: "&cYa has enviado una solicitud." already_sent: "&cYa has enviado una solicitud."
not_sent: "&cNo has enviado una solicitud." not_sent: "&cNo has enviado una solicitud."
invalid_input: "&c%input no es una entrada valida." invalid_input: "&c%input no es una entrada valida."
toggle: toggle:
gamemode: gamemode:
enabled: "&a%player&6 ahora puede cambiar su modo de juego." enabled: "&a%player&6 ahora puede cambiar su modo de juego."
disabled: "&c%player&6 ya no puede cambiar su modo de juego." disabled: "&c%player&6 ya no puede cambiar su modo de juego."
teleport: teleport:
enabled: "&a%player&6 ahora puede teletransportarse." enabled: "&a%player&6 ahora puede teletransportarse."
disabled: "&c%player&6 ya no puede teletransportarse." disabled: "&c%player&6 ya no puede teletransportarse."
build: build:
enabled: "&a%player&6 ahora puede construir." enabled: "&a%player&6 ahora puede construir."
disabled: "&c%player&6 ya no puede construir" disabled: "&c%player&6 ya no puede construir"
fire: fire:
enabled: "&aHas activado el fuego." enabled: "&aHas activado el fuego."
disabled: "&cHas desactivado el fuego." disabled: "&cHas desactivado el fuego."
tnt: tnt:
enabled: "&aHas activado la TNT." enabled: "&aHas activado la TNT."
disabled: "&cHas desactivado la TNT." disabled: "&cHas desactivado la TNT."
info: info:
owner: "Propietario: %data" owner: "Propietario: %data"
id: "ID: %data" id: "ID: %data"
member: "Miembros: %data" member: "Miembros: %data"
tnt: "TNT: %data" tnt: "TNT: %data"
fire: "Fuego: %data" fire: "Fuego: %data"
enabled: "&aSi" enabled: "&aSi"
disabled: "&cNo" disabled: "&cNo"
command_help: command_help:
list: list:
- "/ws get &8- &7Obten tu mundo" - "/ws get &8- &7Obten tu mundo"
- "/ws home &8- &7Ve a tu mundo" - "/ws home &8- &7Ve a tu mundo"
- "/ws sethome &8- &7Sets a specific home" - "/ws sethome &8- &7Sets a specific home"
- "/ws gui &8- &7Abre el menu de tu mundo" - "/ws gui &8- &7Abre el menu de tu mundo"
- "/ws tp &8- &7Ve a un mundo especifico" - "/ws tp &8- &7Ve a un mundo especifico"
- "/ws addmember &8- &7Agrega jugadores a tu mundo" - "/ws addmember &8- &7Agrega jugadores a tu mundo"
- "/ws delmember &8- &7Elimina jugadores de tu mundo" - "/ws delmember &8- &7Elimina jugadores de tu mundo"
- "/ws leave &8- &7Salir de un mundo" - "/ws leave &8- &7Salir de un mundo"
- "/ws tnt &8- &7Activa/Desactiva la TNT en tu mundo" - "/ws tnt &8- &7Activa/Desactiva la TNT en tu mundo"
- "/ws fire &8- &7Activa/Desactiva el FUEGO en tu mundo" - "/ws fire &8- &7Activa/Desactiva el FUEGO en tu mundo"
- "/ws togglegm &8- &7Activa/Desactiva el cambio de modo" - "/ws togglegm &8- &7Activa/Desactiva el cambio de modo"
- "/ws togglebuild &8- &7Activa/Desactiva la construccion" - "/ws togglebuild &8- &7Activa/Desactiva la construccion"
- "/ws toggletp &8- &7Activa/Desactiva la teletransportacion" - "/ws toggletp &8- &7Activa/Desactiva la teletransportacion"
- "/ws info &8- &7Muestra informacion del mundo" - "/ws info &8- &7Muestra informacion del mundo"
- "/ws reset &8- &7Reinicia tu mundo" - "/ws reset &8- &7Reinicia tu mundo"
delete_command: "/ws delete &8- &7Elimina tu mundo" delete_command: "/ws delete &8- &7Elimina tu mundo"

View File

@ -1,84 +1,84 @@
nopermission: "&cSinulla ei ole lupaa tuohon komentoon!" nopermission: "&cSinulla ei ole lupaa tuohon komentoon!"
unknown_error: "&cJotain meni pieleen..." unknown_error: "&cJotain meni pieleen..."
lagdetection: "Lagia havaittu maailmassa: &c%world" lagdetection: "Lagia havaittu maailmassa: &c%world"
wrong_usage: "&c%usage" wrong_usage: "&c%usage"
not_registered: "&cTämä pelaaja ei ole liittynyt vielä!" not_registered: "&cTämä pelaaja ei ole liittynyt vielä!"
world: world:
reseted: "Maailmasi nollautui!" reseted: "Maailmasi nollautui!"
still_loaded: "&cMailmasi on vieläkin ladattu!" still_loaded: "&cMailmasi on vieläkin ladattu!"
not_on: "&cEt ole maailmassa!" not_on: "&cEt ole maailmassa!"
created: "Maailmasi on nyt valmis. Pääset sinne komennolla &a/ws home" created: "Maailmasi on nyt valmis. Pääset sinne komennolla &a/ws home"
already_exists: "&cSinulla on jo maailma!" already_exists: "&cSinulla on jo maailma!"
delete: delete:
own: "&cMaailmasi poistettiin!" own: "&cMaailmasi poistettiin!"
other: "Poistit pelaajan &c%player&6 maailman&6!" other: "Poistit pelaajan &c%player&6 maailman&6!"
does_not_exists: does_not_exists:
own: "&cSinulla ei ole maailmaa!" own: "&cSinulla ei ole maailmaa!"
other: "&cKyseisellä pelaajalla ei ole maailmaa!" other: "&cKyseisellä pelaajalla ei ole maailmaa!"
setting_up: "&aAlustetaan maailmaa..." setting_up: "&aAlustetaan maailmaa..."
playerlist: "Pelaajat tässä maailmassa: %players" playerlist: "Pelaajat tässä maailmassa: %players"
still_creating: "&cWorld is still creating" still_creating: "&cWorld is still creating"
set_home: "You set the home" set_home: "You set the home"
member: member:
removed: "Poistit pelaajan &c%player&6 maailmastasi!" removed: "Poistit pelaajan &c%player&6 maailmastasi!"
added: "Lisäsit pelaajan &c%player&6 maailmaasi!" added: "Lisäsit pelaajan &c%player&6 maailmaasi!"
already_added: "&cKyseinen pelaaja on jo jäsen!" already_added: "&cKyseinen pelaaja on jo jäsen!"
not_added: not_added:
own: "&cKyseinen pelaaja ei ole jäsen!" own: "&cKyseinen pelaaja ei ole jäsen!"
other: "&cSinua ei ole lisätty tähän maailmaan" other: "&cSinua ei ole lisätty tähän maailmaan"
no_one_added: "&cThere are no members added" no_one_added: "&cThere are no members added"
request: request:
expired: "&cPyyntösi on vanhentunut!" expired: "&cPyyntösi on vanhentunut!"
confirm: "&cVahvista maailmasi nollaaminen: %command" confirm: "&cVahvista maailmasi nollaaminen: %command"
until_expire: "&cPyyntösi vanhentuu %time seconds sekunnin kuluttua!" until_expire: "&cPyyntösi vanhentuu %time seconds sekunnin kuluttua!"
already_sent: "&cLähetit jo pyynnön!" already_sent: "&cLähetit jo pyynnön!"
not_sent: "&cEt lähettänyt pyyntöä!" not_sent: "&cEt lähettänyt pyyntöä!"
invalid_input: "&cSyöte ei ole kelvollinen!" invalid_input: "&cSyöte ei ole kelvollinen!"
toggle: toggle:
gamemode: gamemode:
enabled: "&a%player&6 voi nyt vaihtaa pelimuotonsa!" enabled: "&a%player&6 voi nyt vaihtaa pelimuotonsa!"
disabled: "&c%player&6 ei voi enää vaihtaa pelimuotoansa!" disabled: "&c%player&6 ei voi enää vaihtaa pelimuotoansa!"
teleport: teleport:
enabled: "&a%player&6 voi nyt teleportata!" enabled: "&a%player&6 voi nyt teleportata!"
disabled: "&c%player&6 ei voi enään teleportata!" disabled: "&c%player&6 ei voi enään teleportata!"
build: build:
enabled: "&a%player&6 voi nyt rakentaa!" enabled: "&a%player&6 voi nyt rakentaa!"
disabled: "&c%player&6 ei voi enään rakentaa!" disabled: "&c%player&6 ei voi enään rakentaa!"
fire: fire:
enabled: "&aSinä aktivoit tulen!" enabled: "&aSinä aktivoit tulen!"
disabled: "&cSinä deaktivoit tulen!" disabled: "&cSinä deaktivoit tulen!"
tnt: tnt:
enabled: "&aSinä aktivoit TNT-Damagen!" enabled: "&aSinä aktivoit TNT-Damagen!"
disabled: "&cSinä deaktivoit TNT-Damagen!" disabled: "&cSinä deaktivoit TNT-Damagen!"
info: info:
owner: "Omistaja: %data" owner: "Omistaja: %data"
id: "ID: %data" id: "ID: %data"
member: "Jäsen: %data" member: "Jäsen: %data"
tnt: "TNT: %data" tnt: "TNT: %data"
fire: "Tuli: %data" fire: "Tuli: %data"
enabled: "&aOn" enabled: "&aOn"
disabled: "&cOff" disabled: "&cOff"
command_help: command_help:
list: list:
- "/ws get &8- &7Luo sinulle maailman" - "/ws get &8- &7Luo sinulle maailman"
- "/ws home &8- &7Teleporttaa sinut maailmaasi" - "/ws home &8- &7Teleporttaa sinut maailmaasi"
- "/ws sethome &8- &7Sets a specific home" - "/ws sethome &8- &7Sets a specific home"
- "/ws gui &8- &7Avaa sinulle valikon jos omistat tämän maailman" - "/ws gui &8- &7Avaa sinulle valikon jos omistat tämän maailman"
- "/ws tp &8- &7Teleporttaa sinut tiettyyn maailmaan" - "/ws tp &8- &7Teleporttaa sinut tiettyyn maailmaan"
- "/ws addmember &8- &7Lisää pelaajan sinun maailmaasi" - "/ws addmember &8- &7Lisää pelaajan sinun maailmaasi"
- "/ws delmember &8- &7Poistaa pelaajan sinun maailmastasi" - "/ws delmember &8- &7Poistaa pelaajan sinun maailmastasi"
- "/ws leave &8- &7Lähtee maailmasta" - "/ws leave &8- &7Lähtee maailmasta"
- "/ws tnt &8- &7Sallii/Kieltää TNT sinun maailmastasi" - "/ws tnt &8- &7Sallii/Kieltää TNT sinun maailmastasi"
- "/ws fire &8- &7Sallii/Kieltää Tulen sinun maailmastasi" - "/ws fire &8- &7Sallii/Kieltää Tulen sinun maailmastasi"
- "/ws togglegm &8- &7Sallii/Kieltää pelaajan vaihtamasta pelimuotoansa" - "/ws togglegm &8- &7Sallii/Kieltää pelaajan vaihtamasta pelimuotoansa"
- "/ws togglebuild &8- &7Sallii/Kieltää pelaajan rakentamasta" - "/ws togglebuild &8- &7Sallii/Kieltää pelaajan rakentamasta"
- "/ws toggletp &8- &7Sallii/Kieltää pelaajan treleporttaamasta" - "/ws toggletp &8- &7Sallii/Kieltää pelaajan treleporttaamasta"
- "/ws info &8- &7Näyttää tietoa aktiivisesta maailmasta" - "/ws info &8- &7Näyttää tietoa aktiivisesta maailmasta"
- "/ws reset &8- &7Nollaa sinun maailmasi" - "/ws reset &8- &7Nollaa sinun maailmasi"
delete_command: "/ws delete &8- &7Poistaa maailman" delete_command: "/ws delete &8- &7Poistaa maailman"

View File

@ -1,85 +1,85 @@
nopermission: "&cNincs jogod ehhez!" nopermission: "&cNincs jogod ehhez!"
unknown_error: "&cValami elromlott..." unknown_error: "&cValami elromlott..."
lagdetection: "Lagdetection a világban: &c%world" lagdetection: "Lagdetection a világban: &c%world"
wrong_usage: "&c%usage" wrong_usage: "&c%usage"
not_registered: "&cEz a játékos még nem csatlakozott!" not_registered: "&cEz a játékos még nem csatlakozott!"
world: world:
reseted: "A világod vissza lett állítva!" reseted: "A világod vissza lett állítva!"
still_loaded: "&cA világod még mindig be van töltve!" still_loaded: "&cA világod még mindig be van töltve!"
not_on: "&cNem vagy a világon!" not_on: "&cNem vagy a világon!"
created: "A világod készen áll. Szállj fel a &a/ws home" created: "A világod készen áll. Szállj fel a &a/ws home"
already_exists: "&cMár van világod!" already_exists: "&cMár van világod!"
delete: delete:
own: "&cA világot törölve!" own: "&cA világot törölve!"
other: "Törölte a világot &c%player&6 játékostól!" other: "Törölte a világot &c%player&6 játékostól!"
does_not_exists: does_not_exists:
own: "&cNincs világod!" own: "&cNincs világod!"
other: "&cEz a játékos nem rendelkezik világgal!" other: "&cEz a játékos nem rendelkezik világgal!"
setting_up: "&aA világ megteremtése..." setting_up: "&aA világ megteremtése..."
playerlist: "Játékos ebben a világban: %player" playerlist: "Játékos ebben a világban: %player"
still_creating: "&cWorld is still creating" still_creating: "&cWorld is still creating"
set_home: "You set the home" set_home: "You set the home"
member: member:
removed: "Törölted &c%player&6 játékost a világodból!" removed: "Törölted &c%player&6 játékost a világodból!"
added: "Hozzáadtad &c%player&6 játékost a világodhoz!" added: "Hozzáadtad &c%player&6 játékost a világodhoz!"
already_added: "&cEz a játékos már tagja!" already_added: "&cEz a játékos már tagja!"
not_added: not_added:
own: "&cEz a játékos nem tagja!" own: "&cEz a játékos nem tagja!"
other: "&cNem vagy hozzáadva ehhez a világhoz" other: "&cNem vagy hozzáadva ehhez a világhoz"
still_creating: "&cWorld is still creating" still_creating: "&cWorld is still creating"
no_one_added: "&cThere are no members added" no_one_added: "&cThere are no members added"
request: request:
expired: "&cA kérelem lejárt!" expired: "&cA kérelem lejárt!"
confirm: "&cKérjük, erõsítsd meg a világ újraindítását: %command" confirm: "&cKérjük, erõsítsd meg a világ újraindítását: %command"
until_expire: "&cA kérés lejárati ideje %time másodperc!" until_expire: "&cA kérés lejárati ideje %time másodperc!"
already_sent: "&cMár elküldtél egy kérelmet!" already_sent: "&cMár elküldtél egy kérelmet!"
not_sent: "&cNem küldtél kérést!" not_sent: "&cNem küldtél kérést!"
invalid_input: "&c%input nem érvényes bemenet!" invalid_input: "&c%input nem érvényes bemenet!"
toggle: toggle:
gamemode: gamemode:
enabled: "&a%player&6 most megváltoztathatja játékmódját!" enabled: "&a%player&6 most megváltoztathatja játékmódját!"
disabled: "&c%player&6 már nem tudja megváltoztatni játékmódját!" disabled: "&c%player&6 már nem tudja megváltoztatni játékmódját!"
teleport: teleport:
enabled: "&a%player&6 most teleportálhat!" enabled: "&a%player&6 most teleportálhat!"
disabled: "&c%player&6 már nem teleportálhat!" disabled: "&c%player&6 már nem teleportálhat!"
build: build:
enabled: "&a%player&6 most építhet!" enabled: "&a%player&6 most építhet!"
disabled: "&c%player&6 már nem építhet!" disabled: "&c%player&6 már nem építhet!"
fire: fire:
enabled: "&aAktiváltad a tüzet!" enabled: "&aAktiváltad a tüzet!"
disabled: "&cDeaktiváltad a tüzet!" disabled: "&cDeaktiváltad a tüzet!"
tnt: tnt:
enabled: "&aAktiváltad a TNT-sebzést!" enabled: "&aAktiváltad a TNT-sebzést!"
disabled: "&cDeaktiváltad TNT-sebzést!" disabled: "&cDeaktiváltad TNT-sebzést!"
info: info:
owner: "Tulajdonos: %data" owner: "Tulajdonos: %data"
id: "ID: %data" id: "ID: %data"
member: "Tag: %data" member: "Tag: %data"
tnt: "TNT: %data" tnt: "TNT: %data"
fire: "Tûz: %data" fire: "Tûz: %data"
enabled: "&aBe" enabled: "&aBe"
disabled: "&cKi" disabled: "&cKi"
command_help: command_help:
list: list:
- "/ws get &8- &7Will give you a world" - "/ws get &8- &7Will give you a world"
- "/ws home &8- &7Teleports you on your world" - "/ws home &8- &7Teleports you on your world"
- "/ws sethome &8- &7Sets a specific home" - "/ws sethome &8- &7Sets a specific home"
- "/ws gui &8- &7Opens the GUI menu if you are the worldowner" - "/ws gui &8- &7Opens the GUI menu if you are the worldowner"
- "/ws tp &8- &7Teleports you on a specific world" - "/ws tp &8- &7Teleports you on a specific world"
- "/ws addmember &8- &7Adds a player to your world" - "/ws addmember &8- &7Adds a player to your world"
- "/ws delmember &8- &7Removes a player from your world" - "/ws delmember &8- &7Removes a player from your world"
- "/ws leave &8- &7Leave a world" - "/ws leave &8- &7Leave a world"
- "/ws tnt &8- &7Allows/Denys TNT on your world" - "/ws tnt &8- &7Allows/Denys TNT on your world"
- "/ws fire &8- &7Allows/Denys Fire on your world" - "/ws fire &8- &7Allows/Denys Fire on your world"
- "/ws togglegm &8- &7Allows/Denys a player changing gamemode" - "/ws togglegm &8- &7Allows/Denys a player changing gamemode"
- "/ws togglebuild &8- &7Allows/Denys a player building" - "/ws togglebuild &8- &7Allows/Denys a player building"
- "/ws toggletp &8- &7Allows/Denys a player teleporting" - "/ws toggletp &8- &7Allows/Denys a player teleporting"
- "/ws info &8- &7Shows information about the world" - "/ws info &8- &7Shows information about the world"
- "/ws reset &8- &7Will reset your world" - "/ws reset &8- &7Will reset your world"
delete_command: "/ws delete &8- &7Will delete a world" delete_command: "/ws delete &8- &7Will delete a world"

View File

@ -1,84 +1,84 @@
nopermission: "&cJij hebt geen rechten om dit te doen!" nopermission: "&cJij hebt geen rechten om dit te doen!"
unknown_error: "&cEr is iets verkeerd gegaan.." unknown_error: "&cEr is iets verkeerd gegaan.."
lagdetection: "Lag gededecteerd in wereld: &c%world" lagdetection: "Lag gededecteerd in wereld: &c%world"
wrong_usage: "&c%gebruik" wrong_usage: "&c%gebruik"
not_registered: "&cDeze speler heeft nog nooit gejoined!" not_registered: "&cDeze speler heeft nog nooit gejoined!"
world: world:
reseted: "Jouw wereld is gereset!" reseted: "Jouw wereld is gereset!"
still_loaded: "&cJouw wereld is nog steeds geladen!" still_loaded: "&cJouw wereld is nog steeds geladen!"
not_on: "&cJij bent niet in een wereld!" not_on: "&cJij bent niet in een wereld!"
created: "Jouw wereld is gemaakt gebruik: &a/ws home" created: "Jouw wereld is gemaakt gebruik: &a/ws home"
already_exists: "&cJij hebt al een wereld!" already_exists: "&cJij hebt al een wereld!"
delete: delete:
own: "&cJouw wereld is verwijderd!" own: "&cJouw wereld is verwijderd!"
other: "Jij hebt de wereld verwijderd van: &c%player&6!" other: "Jij hebt de wereld verwijderd van: &c%player&6!"
does_not_exists: does_not_exists:
own: "&cJij hebt nog geen wereld!" own: "&cJij hebt nog geen wereld!"
other: "&cDeze speler heeft nog geen wereld!" other: "&cDeze speler heeft nog geen wereld!"
setting_up: "&aWereld word aangemaakt" setting_up: "&aWereld word aangemaakt"
playerlist: "speler is in wereld: %players" playerlist: "speler is in wereld: %players"
still_creating: "&cWorld is still creating" still_creating: "&cWorld is still creating"
set_home: "You set the home" set_home: "You set the home"
member: member:
removed: "Jij hebt &c%player&6 verwijderd van jouw wereld!" removed: "Jij hebt &c%player&6 verwijderd van jouw wereld!"
added: "Jij hebt &c%player&6 toegevoegd aan jouw wereld!" added: "Jij hebt &c%player&6 toegevoegd aan jouw wereld!"
already_added: "&cDeze speler is al toegevoegd!" already_added: "&cDeze speler is al toegevoegd!"
not_added: not_added:
own: "&cDeze speler is nog niet toegevoegd!" own: "&cDeze speler is nog niet toegevoegd!"
other: "&cJij bent niet aan deze wereld toegevoegd" other: "&cJij bent niet aan deze wereld toegevoegd"
no_one_added: "&cThere are no members added" no_one_added: "&cThere are no members added"
request: request:
expired: "&cJouw uitnodiging is verlopen!" expired: "&cJouw uitnodiging is verlopen!"
confirm: "&cBevestig het verwijderen van jouw wereld: %command" confirm: "&cBevestig het verwijderen van jouw wereld: %command"
until_expire: "&cJouw uitnodiging verloopt over %time seconden!" until_expire: "&cJouw uitnodiging verloopt over %time seconden!"
already_sent: "&cJij hebt al een uitnodiging verstuurd!" already_sent: "&cJij hebt al een uitnodiging verstuurd!"
not_sent: "&cJij hebt geen uitnodiging gestuurd!" not_sent: "&cJij hebt geen uitnodiging gestuurd!"
invalid_input: "&c%input is niet een command!" invalid_input: "&c%input is niet een command!"
toggle: toggle:
gamemode: gamemode:
enabled: "&a%player&6 kan nu zijn spelermodus veranderen!" enabled: "&a%player&6 kan nu zijn spelermodus veranderen!"
disabled: "&c%player&6 kan niet meer zijn spelermodus veranderen!" disabled: "&c%player&6 kan niet meer zijn spelermodus veranderen!"
teleport: teleport:
enabled: "&a%player&6 kan nu teleporteren!" enabled: "&a%player&6 kan nu teleporteren!"
disabled: "&c%player&6 kan nu niet meer teleporteren!" disabled: "&c%player&6 kan nu niet meer teleporteren!"
build: build:
enabled: "&a%player&6 kan nu bouwen!" enabled: "&a%player&6 kan nu bouwen!"
disabled: "&c%player&6 kan nu niet meer bouwen!" disabled: "&c%player&6 kan nu niet meer bouwen!"
fire: fire:
enabled: "&aJij hebt vuur geactiveert!" enabled: "&aJij hebt vuur geactiveert!"
disabled: "&cJij hebt vuur gedeactiveerd!" disabled: "&cJij hebt vuur gedeactiveerd!"
tnt: tnt:
enabled: "&aJij hebt TNT-schade geactiveerd!" enabled: "&aJij hebt TNT-schade geactiveerd!"
disabled: "&cJij hebt TNT-schade gedeactiveerd!" disabled: "&cJij hebt TNT-schade gedeactiveerd!"
info: info:
owner: "Owner: %data" owner: "Owner: %data"
id: "ID: %data" id: "ID: %data"
member: "Toegevoegd: %data" member: "Toegevoegd: %data"
tnt: "TNT: %data" tnt: "TNT: %data"
fire: "Vuur: %data" fire: "Vuur: %data"
enabled: "&Aan" enabled: "&Aan"
disabled: "&cUit" disabled: "&cUit"
command_help: command_help:
list: list:
- "/ws get &8- &7Will give you a world" - "/ws get &8- &7Will give you a world"
- "/ws home &8- &7Teleports you on your world" - "/ws home &8- &7Teleports you on your world"
- "/ws sethome &8- &7Sets a specific home" - "/ws sethome &8- &7Sets a specific home"
- "/ws gui &8- &7Opens the GUI menu if you are the worldowner" - "/ws gui &8- &7Opens the GUI menu if you are the worldowner"
- "/ws tp &8- &7Teleports you on a specific world" - "/ws tp &8- &7Teleports you on a specific world"
- "/ws addmember &8- &7Adds a player to your world" - "/ws addmember &8- &7Adds a player to your world"
- "/ws delmember &8- &7Removes a player from your world" - "/ws delmember &8- &7Removes a player from your world"
- "/ws leave &8- &7Leave a world" - "/ws leave &8- &7Leave a world"
- "/ws tnt &8- &7Allows/Denys TNT on your world" - "/ws tnt &8- &7Allows/Denys TNT on your world"
- "/ws fire &8- &7Allows/Denys Fire on your world" - "/ws fire &8- &7Allows/Denys Fire on your world"
- "/ws togglegm &8- &7Allows/Denys a player changing gamemode" - "/ws togglegm &8- &7Allows/Denys a player changing gamemode"
- "/ws togglebuild &8- &7Allows/Denys a player building" - "/ws togglebuild &8- &7Allows/Denys a player building"
- "/ws toggletp &8- &7Allows/Denys a player teleporting" - "/ws toggletp &8- &7Allows/Denys a player teleporting"
- "/ws info &8- &7Shows information about the world" - "/ws info &8- &7Shows information about the world"
- "/ws reset &8- &7Will reset your world" - "/ws reset &8- &7Will reset your world"
delete_command: "/ws delete &8- &7Will delete a world" delete_command: "/ws delete &8- &7Will delete a world"

View File

@ -1,84 +1,84 @@
nopermission: "&cNie posiadasz uprawnień do tego!" nopermission: "&cNie posiadasz uprawnień do tego!"
unknown_error: "&cCoś poszło nie tak..." unknown_error: "&cCoś poszło nie tak..."
lagdetection: "Wykryto laga na świecie: &c%world" lagdetection: "Wykryto laga na świecie: &c%world"
wrong_usage: "&c%usage" wrong_usage: "&c%usage"
not_registered: "&cTen gracz nie dołączył jeszcze na serwer!" not_registered: "&cTen gracz nie dołączył jeszcze na serwer!"
world: world:
reseted: "Twój świat został zresetowany!" reseted: "Twój świat został zresetowany!"
still_loaded: "&cTwój serwer wciąż się ładuje!" still_loaded: "&cTwój serwer wciąż się ładuje!"
not_on: "&cNie jesteś na swoim świecie!" not_on: "&cNie jesteś na swoim świecie!"
created: "Twój świat jest gotowy. Dostań się na niego za pomocą &a/ws home" created: "Twój świat jest gotowy. Dostań się na niego za pomocą &a/ws home"
already_exists: "&cJuż posiadasz swój świat!" already_exists: "&cJuż posiadasz swój świat!"
delete: delete:
own: "&cTwój świat został skasowany!" own: "&cTwój świat został skasowany!"
other: "Usunąłeś świat gracza: &c%player&6!" other: "Usunąłeś świat gracza: &c%player&6!"
does_not_exists: does_not_exists:
own: "&cNie masz swojego świata!" own: "&cNie masz swojego świata!"
other: "&cTen gracz nie ma swojego świata!" other: "&cTen gracz nie ma swojego świata!"
setting_up: "&aUstawianie świata..." setting_up: "&aUstawianie świata..."
playerlist: "Gracze na tym świecie: %players" playerlist: "Gracze na tym świecie: %players"
still_creating: "&cWorld is still creating" still_creating: "&cWorld is still creating"
set_home: "You set the home" set_home: "You set the home"
member: member:
removed: "Usunąłeś &c%player&6 ze swojego świata!" removed: "Usunąłeś &c%player&6 ze swojego świata!"
added: "Dodałeś &c%player&6 na swój świat!" added: "Dodałeś &c%player&6 na swój świat!"
already_added: "&cTen gracz jest już dodany na Twoim świecie!" already_added: "&cTen gracz jest już dodany na Twoim świecie!"
not_added: not_added:
own: "&cTen gracz nie jest dodany do Twojego świata!" own: "&cTen gracz nie jest dodany do Twojego świata!"
other: "&cNie jesteś dodany na ten świat!" other: "&cNie jesteś dodany na ten świat!"
no_one_added: "&cThere are no members added" no_one_added: "&cThere are no members added"
request: request:
expired: "&cTwoja prośba wygasła!" expired: "&cTwoja prośba wygasła!"
confirm: "&cPotwierdź zresetowanie swojego świata komendą: %command" confirm: "&cPotwierdź zresetowanie swojego świata komendą: %command"
until_expire: "&cTwója prośba wygaśnie za %time sek.!" until_expire: "&cTwója prośba wygaśnie za %time sek.!"
already_sent: "&cJuż wysłałeś prośbę!" already_sent: "&cJuż wysłałeś prośbę!"
not_sent: "&cNie wysłałeś prośby!" not_sent: "&cNie wysłałeś prośby!"
invalid_input: "&c%input nie jest poprawnym argumentem komendy!" invalid_input: "&c%input nie jest poprawnym argumentem komendy!"
toggle: toggle:
gamemode: gamemode:
enabled: "&a%player&6 może teraz zmienić swój gamemode!" enabled: "&a%player&6 może teraz zmienić swój gamemode!"
disabled: "&c%player&6 nie może już zmienić swojego gamemode!" disabled: "&c%player&6 nie może już zmienić swojego gamemode!"
teleport: teleport:
enabled: "&a%player&6 może teleportować się!" enabled: "&a%player&6 może teleportować się!"
disabled: "&c%player&6 nie może teleportować się!" disabled: "&c%player&6 nie może teleportować się!"
build: build:
enabled: "&a%player&6 może budować!" enabled: "&a%player&6 może budować!"
disabled: "&c%player&6 nie może już budować!" disabled: "&c%player&6 nie może już budować!"
fire: fire:
enabled: "&aWłączyłeś ogień!" enabled: "&aWłączyłeś ogień!"
disabled: "&cWyłączyłeś ogień!" disabled: "&cWyłączyłeś ogień!"
tnt: tnt:
enabled: "&aWłączyłeś obrażenia od TNT!" enabled: "&aWłączyłeś obrażenia od TNT!"
disabled: "&cWyłączyłeś obrażenia od TNT!" disabled: "&cWyłączyłeś obrażenia od TNT!"
info: info:
owner: "Właściciel: %data" owner: "Właściciel: %data"
id: "ID: %data" id: "ID: %data"
member: "Członek: %data" member: "Członek: %data"
tnt: "TNT: %data" tnt: "TNT: %data"
fire: "Ogień: %data" fire: "Ogień: %data"
enabled: "&aWłączone" enabled: "&aWłączone"
disabled: "&cWyłączone" disabled: "&cWyłączone"
command_help: command_help:
list: list:
- "/ws get &8- &7Tworzy Twój świat" - "/ws get &8- &7Tworzy Twój świat"
- "/ws home &8- &7Teleportuje Cie na Twój świat" - "/ws home &8- &7Teleportuje Cie na Twój świat"
- "/ws sethome &8- &7Sets a specific home" - "/ws sethome &8- &7Sets a specific home"
- "/ws gui &8- &7Otwiera GUI świata jeżeli jesteś jego właścicielem" - "/ws gui &8- &7Otwiera GUI świata jeżeli jesteś jego właścicielem"
- "/ws tp &8- &7Teleportuje Cie na określony świat" - "/ws tp &8- &7Teleportuje Cie na określony świat"
- "/ws addmember &8- &7Dodaj gracza na swój świat" - "/ws addmember &8- &7Dodaj gracza na swój świat"
- "/ws delmember &8- &7Usuń gracza ze swojego świata" - "/ws delmember &8- &7Usuń gracza ze swojego świata"
- "/ws leave &8- &7Opuść świat" - "/ws leave &8- &7Opuść świat"
- "/ws tnt &8- &7Zezwól/Odmów TNT na swoim świecie" - "/ws tnt &8- &7Zezwól/Odmów TNT na swoim świecie"
- "/ws fire &8- &7Zezwól/Odmów Ogień 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 togglegm &8- &7Zezwól/Odmów graczowi zmieniać swój gamemode"
- "/ws togglebuild &8- &7Zezwól/Odmów graczowi budowanie" - "/ws togglebuild &8- &7Zezwól/Odmów graczowi budowanie"
- "/ws toggletp &8- &7Zezwól/Odmów graczowi teleportowanie się" - "/ws toggletp &8- &7Zezwól/Odmów graczowi teleportowanie się"
- "/ws info &8- &7Pokazuje informacje o świecie" - "/ws info &8- &7Pokazuje informacje o świecie"
- "/ws reset &8- &7Zresetuje Twój świat" - "/ws reset &8- &7Zresetuje Twój świat"
delete_command: "/ws delete &8- &7Usunie Twój świat" delete_command: "/ws delete &8- &7Usunie Twój świat"

Some files were not shown because too many files have changed in this diff Show More