mirror of
https://github.com/trainerlord/WorldSystem.git
synced 2024-12-02 13:23:21 +01:00
commit
e08b8eda94
10
WorldSystem/.gitignore → .gitignore
vendored
10
WorldSystem/.gitignore → .gitignore
vendored
@ -1,7 +1,7 @@
|
||||
.idea/
|
||||
.settings/
|
||||
bin/
|
||||
WorldSystem.iml
|
||||
.project
|
||||
.idea/
|
||||
.settings/
|
||||
bin/
|
||||
WorldSystem.iml
|
||||
.project
|
||||
.classpath
|
||||
/target/
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -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>
|
@ -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>
|
@ -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>
|
@ -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	" />
|
||||
<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>
|
@ -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>
|
@ -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
|
@ -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
|
@ -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
|
@ -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"
|
@ -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"
|
@ -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"
|
@ -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"
|
@ -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
|
@ -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
|
@ -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: ""
|
@ -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"
|
@ -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"
|
@ -1,53 +1,53 @@
|
||||
package de.butzlabben.autoupdater;
|
||||
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.nio.channels.Channels;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.nio.channels.ReadableByteChannel;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 02.05.2018
|
||||
*/
|
||||
public class AutoUpdate implements Runnable {
|
||||
|
||||
private UpdateInformations ui;
|
||||
private String jar;
|
||||
|
||||
public AutoUpdate(UpdateInformations ui, String jar) {
|
||||
this.ui = ui;
|
||||
this.jar = jar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
FileChannel out = null;
|
||||
FileOutputStream outStream = null;
|
||||
try {
|
||||
|
||||
ReadableByteChannel in = Channels
|
||||
.newChannel(new URL(ui.getURL()).openStream());
|
||||
outStream = new FileOutputStream(jar);
|
||||
out = outStream.getChannel();
|
||||
out.transferFrom(in, 0, Long.MAX_VALUE);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (out != null)
|
||||
try {
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (outStream != null) {
|
||||
try {
|
||||
outStream.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
package de.butzlabben.autoupdater;
|
||||
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.nio.channels.Channels;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.nio.channels.ReadableByteChannel;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 02.05.2018
|
||||
*/
|
||||
public class AutoUpdate implements Runnable {
|
||||
|
||||
private UpdateInformations ui;
|
||||
private String jar;
|
||||
|
||||
public AutoUpdate(UpdateInformations ui, String jar) {
|
||||
this.ui = ui;
|
||||
this.jar = jar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
FileChannel out = null;
|
||||
FileOutputStream outStream = null;
|
||||
try {
|
||||
|
||||
ReadableByteChannel in = Channels
|
||||
.newChannel(new URL(ui.getURL()).openStream());
|
||||
outStream = new FileOutputStream(jar);
|
||||
out = outStream.getChannel();
|
||||
out.transferFrom(in, 0, Long.MAX_VALUE);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (out != null)
|
||||
try {
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (outStream != null) {
|
||||
try {
|
||||
outStream.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,127 +1,127 @@
|
||||
package de.butzlabben.autoupdater;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import de.butzlabben.world.config.PluginConfig;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 01.05.2018
|
||||
*/
|
||||
public class AutoUpdater implements Listener {
|
||||
|
||||
private boolean confirmed;
|
||||
private boolean confirmNeed;
|
||||
private static AutoUpdater instance;
|
||||
private AutoUpdate au;
|
||||
|
||||
public static void startAsync() {
|
||||
Thread t = new Thread(() -> {
|
||||
getInstance();
|
||||
});
|
||||
t.setName("update-thread-worldsystem");
|
||||
t.start();
|
||||
}
|
||||
|
||||
public static synchronized AutoUpdater getInstance() {
|
||||
if (instance == null)
|
||||
instance = new AutoUpdater();
|
||||
return instance;
|
||||
}
|
||||
|
||||
private AutoUpdater() {
|
||||
confirmNeed = PluginConfig.confirmNeed();
|
||||
UpdateInformations ui = UpdateInformations.getInformations();
|
||||
if (ui == null) {
|
||||
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "§cCouldn't contact autoupdate server");
|
||||
return;
|
||||
}
|
||||
Plugin plugin = Bukkit.getPluginManager().getPlugin(ui.getPlugin());
|
||||
if (plugin == null)
|
||||
return;
|
||||
String v = plugin.getDescription().getVersion();
|
||||
if (!ui.getVersion().equals(plugin.getDescription().getVersion())) {
|
||||
|
||||
if (!ui.isSilent()) {
|
||||
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "Found new version. Current: " + v
|
||||
+ ", Available: " + ui.getVersion());
|
||||
}
|
||||
// Get jar file
|
||||
Method getFileMethod = null;
|
||||
try {
|
||||
getFileMethod = JavaPlugin.class.getDeclaredMethod("getFile");
|
||||
} catch (NoSuchMethodException | SecurityException e1) {
|
||||
e1.printStackTrace();
|
||||
return;
|
||||
}
|
||||
getFileMethod.setAccessible(true);
|
||||
File file = null;
|
||||
|
||||
try {
|
||||
file = (File) getFileMethod.invoke(plugin);
|
||||
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
getFileMethod.setAccessible(false);
|
||||
|
||||
String jar = file.getAbsolutePath();
|
||||
au = new AutoUpdate(ui, jar);
|
||||
if (ui.isSilent() || !confirmNeed) {
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(au));
|
||||
if (!ui.isSilent())
|
||||
Bukkit.getConsoleSender().sendMessage(
|
||||
PluginConfig.getPrefix() + "§aAutoupdate confirmed, §crestart §ato apply changes");
|
||||
confirmed = true;
|
||||
} else {
|
||||
Bukkit.getPluginManager().registerEvents(this, plugin);
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
p.sendMessage(
|
||||
PluginConfig.getPrefix() + "§aFound new update. Confirm autoupdate with §c/ws confirm");
|
||||
p.sendMessage(PluginConfig.getPrefix() + "§aRead changelogs: https://www.spigotmc.org/resources/49756/updates");
|
||||
}
|
||||
Bukkit.getConsoleSender().sendMessage(
|
||||
PluginConfig.getPrefix() + "§aFound new update. Confirm autoupdate with §c/ws confirm");
|
||||
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "§aRead changelogs: https://www.spigotmc.org/resources/49756/updates");
|
||||
}
|
||||
} else {
|
||||
confirmNeed = false;
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void on(PlayerJoinEvent e) {
|
||||
if (e.getPlayer().hasPermission("ws.confirm")) {
|
||||
e.getPlayer().sendMessage(
|
||||
PluginConfig.getPrefix() + "§aFound new update. Confirm autoupdate with §c/ws confirm");
|
||||
e.getPlayer().sendMessage(PluginConfig.getPrefix() + "§aRead changelogs: https://www.spigotmc.org/resources/49756/updates");
|
||||
}
|
||||
}
|
||||
|
||||
public boolean confirm() {
|
||||
if (confirmNeed && !confirmed) {
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(au));
|
||||
confirmed = true;
|
||||
HandlerList.unregisterAll(this);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean confirmed() {
|
||||
return confirmed;
|
||||
}
|
||||
|
||||
}
|
||||
package de.butzlabben.autoupdater;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import de.butzlabben.world.config.PluginConfig;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 01.05.2018
|
||||
*/
|
||||
public class AutoUpdater implements Listener {
|
||||
|
||||
private boolean confirmed;
|
||||
private boolean confirmNeed;
|
||||
private static AutoUpdater instance;
|
||||
private AutoUpdate au;
|
||||
|
||||
public static void startAsync() {
|
||||
Thread t = new Thread(() -> {
|
||||
getInstance();
|
||||
});
|
||||
t.setName("update-thread-worldsystem");
|
||||
t.start();
|
||||
}
|
||||
|
||||
public static synchronized AutoUpdater getInstance() {
|
||||
if (instance == null)
|
||||
instance = new AutoUpdater();
|
||||
return instance;
|
||||
}
|
||||
|
||||
private AutoUpdater() {
|
||||
confirmNeed = PluginConfig.confirmNeed();
|
||||
UpdateInformations ui = UpdateInformations.getInformations();
|
||||
if (ui == null) {
|
||||
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "§cCouldn't contact autoupdate server");
|
||||
return;
|
||||
}
|
||||
Plugin plugin = Bukkit.getPluginManager().getPlugin(ui.getPlugin());
|
||||
if (plugin == null)
|
||||
return;
|
||||
String v = plugin.getDescription().getVersion();
|
||||
if (!ui.getVersion().equals(plugin.getDescription().getVersion())) {
|
||||
|
||||
if (!ui.isSilent()) {
|
||||
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "Found new version. Current: " + v
|
||||
+ ", Available: " + ui.getVersion());
|
||||
}
|
||||
// Get jar file
|
||||
Method getFileMethod = null;
|
||||
try {
|
||||
getFileMethod = JavaPlugin.class.getDeclaredMethod("getFile");
|
||||
} catch (NoSuchMethodException | SecurityException e1) {
|
||||
e1.printStackTrace();
|
||||
return;
|
||||
}
|
||||
getFileMethod.setAccessible(true);
|
||||
File file = null;
|
||||
|
||||
try {
|
||||
file = (File) getFileMethod.invoke(plugin);
|
||||
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
getFileMethod.setAccessible(false);
|
||||
|
||||
String jar = file.getAbsolutePath();
|
||||
au = new AutoUpdate(ui, jar);
|
||||
if (ui.isSilent() || !confirmNeed) {
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(au));
|
||||
if (!ui.isSilent())
|
||||
Bukkit.getConsoleSender().sendMessage(
|
||||
PluginConfig.getPrefix() + "§aAutoupdate confirmed, §crestart §ato apply changes");
|
||||
confirmed = true;
|
||||
} else {
|
||||
Bukkit.getPluginManager().registerEvents(this, plugin);
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
p.sendMessage(
|
||||
PluginConfig.getPrefix() + "§aFound new update. Confirm autoupdate with §c/ws confirm");
|
||||
p.sendMessage(PluginConfig.getPrefix() + "§aRead changelogs: https://www.spigotmc.org/resources/49756/updates");
|
||||
}
|
||||
Bukkit.getConsoleSender().sendMessage(
|
||||
PluginConfig.getPrefix() + "§aFound new update. Confirm autoupdate with §c/ws confirm");
|
||||
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "§aRead changelogs: https://www.spigotmc.org/resources/49756/updates");
|
||||
}
|
||||
} else {
|
||||
confirmNeed = false;
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void on(PlayerJoinEvent e) {
|
||||
if (e.getPlayer().hasPermission("ws.confirm")) {
|
||||
e.getPlayer().sendMessage(
|
||||
PluginConfig.getPrefix() + "§aFound new update. Confirm autoupdate with §c/ws confirm");
|
||||
e.getPlayer().sendMessage(PluginConfig.getPrefix() + "§aRead changelogs: https://www.spigotmc.org/resources/49756/updates");
|
||||
}
|
||||
}
|
||||
|
||||
public boolean confirm() {
|
||||
if (confirmNeed && !confirmed) {
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(au));
|
||||
confirmed = true;
|
||||
HandlerList.unregisterAll(this);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean confirmed() {
|
||||
return confirmed;
|
||||
}
|
||||
|
||||
}
|
@ -1,16 +1,16 @@
|
||||
package de.butzlabben.inventory;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 28.06.2018
|
||||
*/
|
||||
public class CostumInv extends OrcInventory {
|
||||
|
||||
public CostumInv(String title, int rows) {
|
||||
super(title, rows);
|
||||
}
|
||||
|
||||
public CostumInv(String title, int rows, boolean fill) {
|
||||
super(title, rows, fill);
|
||||
}
|
||||
}
|
||||
package de.butzlabben.inventory;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 28.06.2018
|
||||
*/
|
||||
public class CostumInv extends OrcInventory {
|
||||
|
||||
public CostumInv(String title, int rows) {
|
||||
super(title, rows);
|
||||
}
|
||||
|
||||
public CostumInv(String title, int rows, boolean fill) {
|
||||
super(title, rows, fill);
|
||||
}
|
||||
}
|
@ -1,12 +1,12 @@
|
||||
package de.butzlabben.inventory;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import de.butzlabben.world.wrapper.WorldPlayer;
|
||||
|
||||
public interface DependListener {
|
||||
|
||||
public ItemStack getItemStack(Player p, WorldPlayer wp);
|
||||
|
||||
}
|
||||
package de.butzlabben.inventory;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import de.butzlabben.world.wrapper.WorldPlayer;
|
||||
|
||||
public interface DependListener {
|
||||
|
||||
public ItemStack getItemStack(Player p, WorldPlayer wp);
|
||||
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
package de.butzlabben.inventory;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public interface OrcClickListener {
|
||||
|
||||
public void onClick(Player p, OrcInventory inv, OrcItem item);
|
||||
|
||||
}
|
||||
package de.butzlabben.inventory;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public interface OrcClickListener {
|
||||
|
||||
public void onClick(Player p, OrcInventory inv, OrcItem item);
|
||||
|
||||
}
|
@ -1,113 +1,113 @@
|
||||
package de.butzlabben.inventory;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
public abstract class OrcInventory {
|
||||
|
||||
protected String title;
|
||||
private int rows;
|
||||
private InventoryType type;
|
||||
private boolean fill = false;
|
||||
|
||||
protected HashMap<Integer, OrcItem> items = new HashMap<>();
|
||||
|
||||
public OrcInventory(String title) {
|
||||
Objects.requireNonNull(title, "title cannot be null");
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public OrcInventory(String title, int rows) {
|
||||
this(title);
|
||||
if (rows <= 0 || rows > 6)
|
||||
throw new IllegalArgumentException("rows cannot be smaller than 1 or bigger than 6");
|
||||
this.rows = rows;
|
||||
}
|
||||
|
||||
public OrcInventory(String title, int rows, boolean fill) {
|
||||
this(title, rows);
|
||||
this.fill = fill;
|
||||
if(this.fill) {
|
||||
for (int i = 0; i < rows * 9; i++) {
|
||||
items.put(i, OrcItem.fill);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public OrcInventory(String title, InventoryType type) {
|
||||
this(title);
|
||||
if (type == null || type == InventoryType.CHEST) {
|
||||
this.type = null;
|
||||
rows = 3;
|
||||
} else {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
|
||||
public void addItem(int slot, OrcItem item) {
|
||||
if (item == null) {
|
||||
removeItem(slot);
|
||||
} else {
|
||||
items.put(slot, item);
|
||||
}
|
||||
}
|
||||
|
||||
public void addItem(int row, int col, OrcItem item) {
|
||||
addItem(row * 9 + col, item);
|
||||
}
|
||||
|
||||
public void removeItem(int slot) {
|
||||
items.remove(slot);
|
||||
}
|
||||
|
||||
public void removeItem(int row, int col) {
|
||||
removeItem(row * 9 + col);
|
||||
}
|
||||
|
||||
public Inventory getInventory(Player p) {
|
||||
return getInventory(p, title);
|
||||
}
|
||||
|
||||
public void redraw(Player p) {
|
||||
p.closeInventory();
|
||||
p.openInventory(getInventory(p));
|
||||
}
|
||||
|
||||
public Inventory getInventory(Player p, String title) {
|
||||
Inventory inv;
|
||||
int size;
|
||||
if (type == null) {
|
||||
inv = Bukkit.createInventory(null, rows * 9, title);
|
||||
size = rows * 9;
|
||||
} else {
|
||||
inv = Bukkit.createInventory(null, type, title);
|
||||
size = type.getDefaultSize();
|
||||
}
|
||||
|
||||
for (Entry<Integer, OrcItem> entry : items.entrySet()) {
|
||||
if (entry.getKey() >= 0 && entry.getKey() < size) {
|
||||
inv.setItem(entry.getKey(), entry.getValue().getItemStack(p));
|
||||
} else {
|
||||
System.err.println("There is a problem with a configured Item!");
|
||||
}
|
||||
}
|
||||
|
||||
OrcListener.getInstance().register(p.getUniqueId(), this);
|
||||
|
||||
return inv;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
}
|
||||
package de.butzlabben.inventory;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
public abstract class OrcInventory {
|
||||
|
||||
protected String title;
|
||||
private int rows;
|
||||
private InventoryType type;
|
||||
private boolean fill = false;
|
||||
|
||||
protected HashMap<Integer, OrcItem> items = new HashMap<>();
|
||||
|
||||
public OrcInventory(String title) {
|
||||
Objects.requireNonNull(title, "title cannot be null");
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public OrcInventory(String title, int rows) {
|
||||
this(title);
|
||||
if (rows <= 0 || rows > 6)
|
||||
throw new IllegalArgumentException("rows cannot be smaller than 1 or bigger than 6");
|
||||
this.rows = rows;
|
||||
}
|
||||
|
||||
public OrcInventory(String title, int rows, boolean fill) {
|
||||
this(title, rows);
|
||||
this.fill = fill;
|
||||
if(this.fill) {
|
||||
for (int i = 0; i < rows * 9; i++) {
|
||||
items.put(i, OrcItem.fill);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public OrcInventory(String title, InventoryType type) {
|
||||
this(title);
|
||||
if (type == null || type == InventoryType.CHEST) {
|
||||
this.type = null;
|
||||
rows = 3;
|
||||
} else {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
|
||||
public void addItem(int slot, OrcItem item) {
|
||||
if (item == null) {
|
||||
removeItem(slot);
|
||||
} else {
|
||||
items.put(slot, item);
|
||||
}
|
||||
}
|
||||
|
||||
public void addItem(int row, int col, OrcItem item) {
|
||||
addItem(row * 9 + col, item);
|
||||
}
|
||||
|
||||
public void removeItem(int slot) {
|
||||
items.remove(slot);
|
||||
}
|
||||
|
||||
public void removeItem(int row, int col) {
|
||||
removeItem(row * 9 + col);
|
||||
}
|
||||
|
||||
public Inventory getInventory(Player p) {
|
||||
return getInventory(p, title);
|
||||
}
|
||||
|
||||
public void redraw(Player p) {
|
||||
p.closeInventory();
|
||||
p.openInventory(getInventory(p));
|
||||
}
|
||||
|
||||
public Inventory getInventory(Player p, String title) {
|
||||
Inventory inv;
|
||||
int size;
|
||||
if (type == null) {
|
||||
inv = Bukkit.createInventory(null, rows * 9, title);
|
||||
size = rows * 9;
|
||||
} else {
|
||||
inv = Bukkit.createInventory(null, type, title);
|
||||
size = type.getDefaultSize();
|
||||
}
|
||||
|
||||
for (Entry<Integer, OrcItem> entry : items.entrySet()) {
|
||||
if (entry.getKey() >= 0 && entry.getKey() < size) {
|
||||
inv.setItem(entry.getKey(), entry.getValue().getItemStack(p));
|
||||
} else {
|
||||
System.err.println("There is a problem with a configured Item!");
|
||||
}
|
||||
}
|
||||
|
||||
OrcListener.getInstance().register(p.getUniqueId(), this);
|
||||
|
||||
return inv;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
}
|
@ -1,139 +1,139 @@
|
||||
package de.butzlabben.inventory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import de.butzlabben.world.wrapper.WorldPlayer;
|
||||
|
||||
public class OrcItem {
|
||||
|
||||
public static OrcItem enabled, disabled, coming_soon, back, fill, error = new OrcItem(Material.BARRIER, null,
|
||||
"§cERROR: Item is wrong configured!", "§cPath in config: see Displayname");
|
||||
|
||||
private ItemStack is;
|
||||
private OrcClickListener listener;
|
||||
private DependListener depend;
|
||||
private Runnable callback;
|
||||
|
||||
public void setCallback(Runnable r) {
|
||||
callback = r;
|
||||
}
|
||||
|
||||
public OrcItem(Material mat, String display, String... lore) {
|
||||
setItemStack(mat, display, lore);
|
||||
}
|
||||
|
||||
public OrcItem(ItemStack is) {
|
||||
setItemStack(is);
|
||||
}
|
||||
|
||||
public OrcItem(Material mat, String display, List<String> lore) {
|
||||
setItemStack(mat, (byte) 0, display, lore);
|
||||
}
|
||||
|
||||
public OrcItem(Material mat) {
|
||||
this(new ItemStack(mat));
|
||||
}
|
||||
|
||||
public OrcItem(Material material, byte data, String display, ArrayList<String> lore) {
|
||||
setItemStack(material, data, display, lore);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public OrcItem setItemStack(Material mat, byte data, String display, List<String> lore) {
|
||||
is = new ItemStack(mat, 1 , data);
|
||||
ItemMeta meta = is.getItemMeta();
|
||||
meta.setDisplayName(display);
|
||||
meta.setLore(lore);
|
||||
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||
is.setItemMeta(meta);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemStack getItemStack(Player p) {
|
||||
if (p != null && depend != null) {
|
||||
ItemStack is = depend.getItemStack(p, new WorldPlayer(p));
|
||||
if (is != null)
|
||||
return is;
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
public ItemStack getItemStack(Player p, WorldPlayer wp) {
|
||||
if (p != null && depend != null) {
|
||||
ItemStack is = depend.getItemStack(p, wp);
|
||||
if (is != null)
|
||||
return is;
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
public ItemStack getItemStack() {
|
||||
return is;
|
||||
}
|
||||
|
||||
public OrcItem setOnClick(OrcClickListener listener) {
|
||||
this.listener = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OrcItem onClick(Player p, OrcInventory inv) {
|
||||
if (listener != null) {
|
||||
listener.onClick(p, inv, this);
|
||||
}
|
||||
if (callback != null)
|
||||
callback.run();
|
||||
return this;
|
||||
}
|
||||
|
||||
public OrcItem setDisplay(String display) {
|
||||
ItemMeta meta = is.getItemMeta();
|
||||
meta.setDisplayName(display);
|
||||
is.setItemMeta(meta);
|
||||
return this;
|
||||
}
|
||||
|
||||
public OrcItem setLore(String... lore) {
|
||||
ItemMeta meta = is.getItemMeta();
|
||||
meta.setLore(Arrays.asList(lore));
|
||||
is.setItemMeta(meta);
|
||||
return this;
|
||||
}
|
||||
|
||||
public OrcItem removeLore() {
|
||||
ItemMeta meta = is.getItemMeta();
|
||||
meta.setLore(null);
|
||||
is.setItemMeta(meta);
|
||||
return this;
|
||||
}
|
||||
|
||||
public OrcItem setItemStack(ItemStack is) {
|
||||
Objects.requireNonNull(is, "ItemStack cannot be null");
|
||||
this.is = is;
|
||||
ItemMeta meta = is.getItemMeta();
|
||||
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||
is.setItemMeta(meta);
|
||||
return this;
|
||||
}
|
||||
|
||||
public OrcItem setItemStack(Material mat, String display, String... lore) {
|
||||
return setItemStack(mat, (byte) 0, display, Arrays.asList(lore));
|
||||
}
|
||||
|
||||
public OrcItem setDepend(DependListener listener) {
|
||||
depend = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OrcItem clone() {
|
||||
return new OrcItem(is);
|
||||
}
|
||||
}
|
||||
package de.butzlabben.inventory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import de.butzlabben.world.wrapper.WorldPlayer;
|
||||
|
||||
public class OrcItem {
|
||||
|
||||
public static OrcItem enabled, disabled, coming_soon, back, fill, error = new OrcItem(Material.BARRIER, null,
|
||||
"§cERROR: Item is wrong configured!", "§cPath in config: see Displayname");
|
||||
|
||||
private ItemStack is;
|
||||
private OrcClickListener listener;
|
||||
private DependListener depend;
|
||||
private Runnable callback;
|
||||
|
||||
public void setCallback(Runnable r) {
|
||||
callback = r;
|
||||
}
|
||||
|
||||
public OrcItem(Material mat, String display, String... lore) {
|
||||
setItemStack(mat, display, lore);
|
||||
}
|
||||
|
||||
public OrcItem(ItemStack is) {
|
||||
setItemStack(is);
|
||||
}
|
||||
|
||||
public OrcItem(Material mat, String display, List<String> lore) {
|
||||
setItemStack(mat, (byte) 0, display, lore);
|
||||
}
|
||||
|
||||
public OrcItem(Material mat) {
|
||||
this(new ItemStack(mat));
|
||||
}
|
||||
|
||||
public OrcItem(Material material, byte data, String display, ArrayList<String> lore) {
|
||||
setItemStack(material, data, display, lore);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public OrcItem setItemStack(Material mat, byte data, String display, List<String> lore) {
|
||||
is = new ItemStack(mat, 1 , data);
|
||||
ItemMeta meta = is.getItemMeta();
|
||||
meta.setDisplayName(display);
|
||||
meta.setLore(lore);
|
||||
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||
is.setItemMeta(meta);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemStack getItemStack(Player p) {
|
||||
if (p != null && depend != null) {
|
||||
ItemStack is = depend.getItemStack(p, new WorldPlayer(p));
|
||||
if (is != null)
|
||||
return is;
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
public ItemStack getItemStack(Player p, WorldPlayer wp) {
|
||||
if (p != null && depend != null) {
|
||||
ItemStack is = depend.getItemStack(p, wp);
|
||||
if (is != null)
|
||||
return is;
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
public ItemStack getItemStack() {
|
||||
return is;
|
||||
}
|
||||
|
||||
public OrcItem setOnClick(OrcClickListener listener) {
|
||||
this.listener = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OrcItem onClick(Player p, OrcInventory inv) {
|
||||
if (listener != null) {
|
||||
listener.onClick(p, inv, this);
|
||||
}
|
||||
if (callback != null)
|
||||
callback.run();
|
||||
return this;
|
||||
}
|
||||
|
||||
public OrcItem setDisplay(String display) {
|
||||
ItemMeta meta = is.getItemMeta();
|
||||
meta.setDisplayName(display);
|
||||
is.setItemMeta(meta);
|
||||
return this;
|
||||
}
|
||||
|
||||
public OrcItem setLore(String... lore) {
|
||||
ItemMeta meta = is.getItemMeta();
|
||||
meta.setLore(Arrays.asList(lore));
|
||||
is.setItemMeta(meta);
|
||||
return this;
|
||||
}
|
||||
|
||||
public OrcItem removeLore() {
|
||||
ItemMeta meta = is.getItemMeta();
|
||||
meta.setLore(null);
|
||||
is.setItemMeta(meta);
|
||||
return this;
|
||||
}
|
||||
|
||||
public OrcItem setItemStack(ItemStack is) {
|
||||
Objects.requireNonNull(is, "ItemStack cannot be null");
|
||||
this.is = is;
|
||||
ItemMeta meta = is.getItemMeta();
|
||||
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||
is.setItemMeta(meta);
|
||||
return this;
|
||||
}
|
||||
|
||||
public OrcItem setItemStack(Material mat, String display, String... lore) {
|
||||
return setItemStack(mat, (byte) 0, display, Arrays.asList(lore));
|
||||
}
|
||||
|
||||
public OrcItem setDepend(DependListener listener) {
|
||||
depend = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OrcItem clone() {
|
||||
return new OrcItem(is);
|
||||
}
|
||||
}
|
@ -1,55 +1,55 @@
|
||||
package de.butzlabben.inventory;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
|
||||
import de.butzlabben.world.WorldSystem;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 10.06.2018
|
||||
*/
|
||||
public class OrcListener implements Listener {
|
||||
|
||||
private static OrcListener instance;
|
||||
|
||||
private HashMap<UUID, OrcInventory> invs = new HashMap<>();
|
||||
|
||||
public static synchronized OrcListener getInstance() {
|
||||
if (instance == null)
|
||||
instance = new OrcListener();
|
||||
return instance;
|
||||
}
|
||||
|
||||
private OrcListener() {
|
||||
Bukkit.getPluginManager().registerEvents(this, WorldSystem.getInstance());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void on(InventoryClickEvent e) {
|
||||
if (e.getClickedInventory() != null && invs.containsKey(e.getWhoClicked().getUniqueId())) {
|
||||
e.setCancelled(true);
|
||||
OrcItem item = invs.get(e.getWhoClicked().getUniqueId()).items.get(e.getSlot());
|
||||
if (item != null)
|
||||
item.onClick((Player) e.getWhoClicked(), invs.get(e.getWhoClicked().getUniqueId()));
|
||||
}
|
||||
}
|
||||
|
||||
public void register(UUID uuid, OrcInventory inv) {
|
||||
invs.put(uuid, inv);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void on(InventoryCloseEvent e) {
|
||||
if (e.getInventory() != null && invs.containsKey(e.getPlayer().getUniqueId())) {
|
||||
invs.remove(e.getPlayer().getUniqueId());
|
||||
}
|
||||
}
|
||||
}
|
||||
package de.butzlabben.inventory;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
|
||||
import de.butzlabben.world.WorldSystem;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 10.06.2018
|
||||
*/
|
||||
public class OrcListener implements Listener {
|
||||
|
||||
private static OrcListener instance;
|
||||
|
||||
private HashMap<UUID, OrcInventory> invs = new HashMap<>();
|
||||
|
||||
public static synchronized OrcListener getInstance() {
|
||||
if (instance == null)
|
||||
instance = new OrcListener();
|
||||
return instance;
|
||||
}
|
||||
|
||||
private OrcListener() {
|
||||
Bukkit.getPluginManager().registerEvents(this, WorldSystem.getInstance());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void on(InventoryClickEvent e) {
|
||||
if (e.getClickedInventory() != null && invs.containsKey(e.getWhoClicked().getUniqueId())) {
|
||||
e.setCancelled(true);
|
||||
OrcItem item = invs.get(e.getWhoClicked().getUniqueId()).items.get(e.getSlot());
|
||||
if (item != null)
|
||||
item.onClick((Player) e.getWhoClicked(), invs.get(e.getWhoClicked().getUniqueId()));
|
||||
}
|
||||
}
|
||||
|
||||
public void register(UUID uuid, OrcInventory inv) {
|
||||
invs.put(uuid, inv);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void on(InventoryCloseEvent e) {
|
||||
if (e.getInventory() != null && invs.containsKey(e.getPlayer().getUniqueId())) {
|
||||
invs.remove(e.getPlayer().getUniqueId());
|
||||
}
|
||||
}
|
||||
}
|
@ -1,74 +1,74 @@
|
||||
package de.butzlabben.inventory.pages;
|
||||
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
import de.butzlabben.inventory.OrcInventory;
|
||||
import de.butzlabben.inventory.OrcItem;
|
||||
import de.butzlabben.world.config.GuiConfig;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 20.05.2018
|
||||
*/
|
||||
public class InventoryPage extends OrcInventory {
|
||||
|
||||
InventoryPage next, before = null;
|
||||
|
||||
public InventoryPage(String title, int page, int pages) {
|
||||
super(title, 6);
|
||||
|
||||
YamlConfiguration cfg = GuiConfig.getConfig();
|
||||
String path = "options.players.currentpage";
|
||||
|
||||
OrcItem oi = new OrcItem(GuiConfig.getMaterial(cfg, path), GuiConfig.getData(cfg, path),
|
||||
GuiConfig.getDisplay(cfg, path).replaceAll("%page", "" + page), GuiConfig.getLore(cfg, path));
|
||||
addItem(GuiConfig.getSlot(path), oi);
|
||||
|
||||
path = "options.players.pagebefore";
|
||||
oi = GuiConfig.getItem(path);
|
||||
oi.setOnClick((p, inv, item) -> {
|
||||
p.closeInventory();
|
||||
p.openInventory(this.before.getInventory(p));
|
||||
});
|
||||
addItem(GuiConfig.getSlot(path), oi);
|
||||
|
||||
path = "options.players.nextpage";
|
||||
oi = GuiConfig.getItem(path);
|
||||
oi.setOnClick((p, inv, item) -> {
|
||||
p.closeInventory();
|
||||
p.openInventory(this.next.getInventory(p));
|
||||
});
|
||||
addItem(GuiConfig.getSlot(path), oi);
|
||||
}
|
||||
|
||||
private int i = 0;
|
||||
|
||||
@Override
|
||||
public Inventory getInventory(Player p) {
|
||||
return super.getInventory(p);
|
||||
}
|
||||
|
||||
public void addItem(OrcItem item) {
|
||||
if (i > 36) {
|
||||
System.err.println("More items than allowed in page view");
|
||||
return;
|
||||
}
|
||||
addItem(i, item);
|
||||
i++;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void on(InventoryClickEvent e) {
|
||||
if (e.getClickedInventory() != null && e.getClickedInventory().getTitle() != null
|
||||
&& e.getClickedInventory().getTitle().equals(title)) {
|
||||
e.setCancelled(true);
|
||||
OrcItem item = items.get(e.getSlot());
|
||||
if (item != null)
|
||||
item.onClick((Player) e.getWhoClicked(), this);
|
||||
}
|
||||
}
|
||||
}
|
||||
package de.butzlabben.inventory.pages;
|
||||
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
import de.butzlabben.inventory.OrcInventory;
|
||||
import de.butzlabben.inventory.OrcItem;
|
||||
import de.butzlabben.world.config.GuiConfig;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 20.05.2018
|
||||
*/
|
||||
public class InventoryPage extends OrcInventory {
|
||||
|
||||
InventoryPage next, before = null;
|
||||
|
||||
public InventoryPage(String title, int page, int pages) {
|
||||
super(title, 6);
|
||||
|
||||
YamlConfiguration cfg = GuiConfig.getConfig();
|
||||
String path = "options.players.currentpage";
|
||||
|
||||
OrcItem oi = new OrcItem(GuiConfig.getMaterial(cfg, path), GuiConfig.getData(cfg, path),
|
||||
GuiConfig.getDisplay(cfg, path).replaceAll("%page", "" + page), GuiConfig.getLore(cfg, path));
|
||||
addItem(GuiConfig.getSlot(path), oi);
|
||||
|
||||
path = "options.players.pagebefore";
|
||||
oi = GuiConfig.getItem(path);
|
||||
oi.setOnClick((p, inv, item) -> {
|
||||
p.closeInventory();
|
||||
p.openInventory(this.before.getInventory(p));
|
||||
});
|
||||
addItem(GuiConfig.getSlot(path), oi);
|
||||
|
||||
path = "options.players.nextpage";
|
||||
oi = GuiConfig.getItem(path);
|
||||
oi.setOnClick((p, inv, item) -> {
|
||||
p.closeInventory();
|
||||
p.openInventory(this.next.getInventory(p));
|
||||
});
|
||||
addItem(GuiConfig.getSlot(path), oi);
|
||||
}
|
||||
|
||||
private int i = 0;
|
||||
|
||||
@Override
|
||||
public Inventory getInventory(Player p) {
|
||||
return super.getInventory(p);
|
||||
}
|
||||
|
||||
public void addItem(OrcItem item) {
|
||||
if (i > 36) {
|
||||
System.err.println("More items than allowed in page view");
|
||||
return;
|
||||
}
|
||||
addItem(i, item);
|
||||
i++;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void on(InventoryClickEvent e) {
|
||||
if (e.getClickedInventory() != null && e.getClickedInventory().getTitle() != null
|
||||
&& e.getClickedInventory().getTitle().equals(title)) {
|
||||
e.setCancelled(true);
|
||||
OrcItem item = items.get(e.getSlot());
|
||||
if (item != null)
|
||||
item.onClick((Player) e.getWhoClicked(), this);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,13 +1,13 @@
|
||||
package de.butzlabben.inventory.pages;
|
||||
|
||||
import de.butzlabben.inventory.OrcItem;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 21.05.2018
|
||||
*/
|
||||
public interface ItemConverter<T> {
|
||||
|
||||
public OrcItem convert(T element);
|
||||
|
||||
}
|
||||
package de.butzlabben.inventory.pages;
|
||||
|
||||
import de.butzlabben.inventory.OrcItem;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 21.05.2018
|
||||
*/
|
||||
public interface ItemConverter<T> {
|
||||
|
||||
public OrcItem convert(T element);
|
||||
|
||||
}
|
@ -1,65 +1,65 @@
|
||||
package de.butzlabben.inventory.pages;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import de.butzlabben.inventory.OrcItem;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 21.05.2018
|
||||
*/
|
||||
public class PageGUICreator<T> {
|
||||
|
||||
private final int elementsPerPage;
|
||||
private List<InventoryPage> invpages;
|
||||
|
||||
public void create(String title, Collection<T> elements, ItemConverter<T> converter) {
|
||||
List<OrcItem> items = elements.stream().map(r -> converter.convert(r)).collect(Collectors.toList());
|
||||
if (items == null || items.size() == 0)
|
||||
return;
|
||||
|
||||
int pages = (int) (Math.ceil((double) (items.size() / (double) elementsPerPage) < 1 ? 1 : Math.ceil((double) items.size() / (double) elementsPerPage)));
|
||||
|
||||
invpages = new ArrayList<>(pages);
|
||||
|
||||
for (int i = 1; i < pages + 1; i++) {
|
||||
int start = i == 1 ? 0 : elementsPerPage * (i - 1);
|
||||
int end = items.size() < elementsPerPage * i ? items.size() : elementsPerPage * i;
|
||||
List<OrcItem> page = items.subList(start, end);
|
||||
|
||||
InventoryPage invpage = new InventoryPage(title, i, pages);
|
||||
page.forEach(invpage::addItem);
|
||||
invpages.add(invpage);
|
||||
}
|
||||
|
||||
for (int i = 0; i < invpages.size(); i++) {
|
||||
|
||||
int beforeIndex = i == 0 ? invpages.size() - 1 : i - 1;
|
||||
int nextIndex = i == invpages.size() - 1 ? 0 : i + 1;
|
||||
|
||||
invpages.get(i).before = invpages.get(beforeIndex);
|
||||
invpages.get(i).next = invpages.get(nextIndex);
|
||||
}
|
||||
}
|
||||
|
||||
public void show(Player p) {
|
||||
p.openInventory(invpages.get(0).getInventory(p));
|
||||
}
|
||||
|
||||
public PageGUICreator() {
|
||||
this(4 * 9);
|
||||
}
|
||||
|
||||
public List<InventoryPage> getInvPages() {
|
||||
return invpages;
|
||||
}
|
||||
|
||||
public PageGUICreator(int elementsPerPage) {
|
||||
this.elementsPerPage = elementsPerPage;
|
||||
}
|
||||
}
|
||||
package de.butzlabben.inventory.pages;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import de.butzlabben.inventory.OrcItem;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 21.05.2018
|
||||
*/
|
||||
public class PageGUICreator<T> {
|
||||
|
||||
private final int elementsPerPage;
|
||||
private List<InventoryPage> invpages;
|
||||
|
||||
public void create(String title, Collection<T> elements, ItemConverter<T> converter) {
|
||||
List<OrcItem> items = elements.stream().map(r -> converter.convert(r)).collect(Collectors.toList());
|
||||
if (items == null || items.size() == 0)
|
||||
return;
|
||||
|
||||
int pages = (int) (Math.ceil((double) (items.size() / (double) elementsPerPage) < 1 ? 1 : Math.ceil((double) items.size() / (double) elementsPerPage)));
|
||||
|
||||
invpages = new ArrayList<>(pages);
|
||||
|
||||
for (int i = 1; i < pages + 1; i++) {
|
||||
int start = i == 1 ? 0 : elementsPerPage * (i - 1);
|
||||
int end = items.size() < elementsPerPage * i ? items.size() : elementsPerPage * i;
|
||||
List<OrcItem> page = items.subList(start, end);
|
||||
|
||||
InventoryPage invpage = new InventoryPage(title, i, pages);
|
||||
page.forEach(invpage::addItem);
|
||||
invpages.add(invpage);
|
||||
}
|
||||
|
||||
for (int i = 0; i < invpages.size(); i++) {
|
||||
|
||||
int beforeIndex = i == 0 ? invpages.size() - 1 : i - 1;
|
||||
int nextIndex = i == invpages.size() - 1 ? 0 : i + 1;
|
||||
|
||||
invpages.get(i).before = invpages.get(beforeIndex);
|
||||
invpages.get(i).next = invpages.get(nextIndex);
|
||||
}
|
||||
}
|
||||
|
||||
public void show(Player p) {
|
||||
p.openInventory(invpages.get(0).getInventory(p));
|
||||
}
|
||||
|
||||
public PageGUICreator() {
|
||||
this(4 * 9);
|
||||
}
|
||||
|
||||
public List<InventoryPage> getInvPages() {
|
||||
return invpages;
|
||||
}
|
||||
|
||||
public PageGUICreator(int elementsPerPage) {
|
||||
this.elementsPerPage = elementsPerPage;
|
||||
}
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
package de.butzlabben.world;
|
||||
|
||||
public class GCRunnable implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
new Thread(() -> System.gc()).start();
|
||||
}
|
||||
}
|
||||
package de.butzlabben.world;
|
||||
|
||||
public class GCRunnable implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
new Thread(() -> System.gc()).start();
|
||||
}
|
||||
}
|
@ -1,146 +1,146 @@
|
||||
package de.butzlabben.world;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.reflect.Type;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonDeserializationContext;
|
||||
import com.google.gson.JsonDeserializer;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.google.gson.JsonSerializationContext;
|
||||
import com.google.gson.JsonSerializer;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import com.mojang.authlib.properties.PropertyMap;
|
||||
import com.mojang.util.UUIDTypeAdapter;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 26.02.2018
|
||||
*/
|
||||
public class GameProfileBuilder {
|
||||
|
||||
private static Gson gson = new GsonBuilder().disableHtmlEscaping()
|
||||
.registerTypeAdapter(UUID.class, new UUIDTypeAdapter())
|
||||
.registerTypeAdapter(GameProfile.class, new GameProfileSerializer())
|
||||
.registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer()).create();
|
||||
private static HashMap<UUID, CachedProfile> cache = new HashMap<>();
|
||||
private static long cacheTime = -1L;
|
||||
private static Object sync = new Object();
|
||||
|
||||
public static GameProfile fetch(UUID uuid) throws IOException {
|
||||
return fetch(uuid, false);
|
||||
}
|
||||
|
||||
public static GameProfile fetch(UUID uuid, boolean forceNew) throws IOException {
|
||||
if ((!forceNew) && (cache.containsKey(uuid)) && (((CachedProfile) cache.get(uuid)).isValid())) {
|
||||
return ((CachedProfile) cache.get(uuid)).profile;
|
||||
}
|
||||
|
||||
HttpURLConnection connection;
|
||||
synchronized (sync) {
|
||||
connection = (HttpURLConnection) new URL(
|
||||
String.format("https://sessionserver.mojang.com/session/minecraft/profile/%s?unsigned=false",
|
||||
new Object[] { UUIDTypeAdapter.fromUUID(uuid) })).openConnection();
|
||||
connection.setReadTimeout(5000);
|
||||
}
|
||||
if (connection.getResponseCode() == 200) {
|
||||
String json = new BufferedReader(new InputStreamReader(connection.getInputStream())).readLine();
|
||||
|
||||
GameProfile result = (GameProfile) gson.fromJson(json, GameProfile.class);
|
||||
cache.put(uuid, new CachedProfile(result));
|
||||
return result;
|
||||
}
|
||||
if ((!forceNew) && (cache.containsKey(uuid))) {
|
||||
return ((CachedProfile) cache.get(uuid)).profile;
|
||||
}
|
||||
throw new IOException("Could not connect to mojang servers for unknown player: " + uuid.toString());
|
||||
}
|
||||
|
||||
public static GameProfile getProfile(UUID uuid, String name, String skin) {
|
||||
return getProfile(uuid, name, skin, null);
|
||||
}
|
||||
|
||||
public static GameProfile getProfile(UUID uuid, String name, String skinUrl, String capeUrl) {
|
||||
GameProfile profile = new GameProfile(uuid, name);
|
||||
boolean cape = (capeUrl != null) && (!capeUrl.isEmpty());
|
||||
|
||||
List<Object> args = new ArrayList<>();
|
||||
args.add(Long.valueOf(System.currentTimeMillis()));
|
||||
args.add(UUIDTypeAdapter.fromUUID(uuid));
|
||||
args.add(name);
|
||||
args.add(skinUrl);
|
||||
if (cape) {
|
||||
args.add(capeUrl);
|
||||
}
|
||||
profile.getProperties().put("textures",
|
||||
new Property("textures",
|
||||
Base64Coder.encodeString(String.format(
|
||||
cape ? "{\"timestamp\":%d,\"profileId\":\"%s\",\"profileName\":\"%s\",\"isPublic\":true,\"textures\":{\"SKIN\":{\"url\":\"%s\"},\"CAPE\":{\"url\":\"%s\"}}}"
|
||||
: "{\"timestamp\":%d,\"profileId\":\"%s\",\"profileName\":\"%s\",\"isPublic\":true,\"textures\":{\"SKIN\":{\"url\":\"%s\"}}}",
|
||||
args.toArray(new Object[args.size()])))));
|
||||
return profile;
|
||||
}
|
||||
|
||||
public static void setCacheTime(long time) {
|
||||
cacheTime = time;
|
||||
}
|
||||
|
||||
private static class GameProfileSerializer implements JsonSerializer<GameProfile>, JsonDeserializer<GameProfile> {
|
||||
|
||||
public GameProfile deserialize(JsonElement json, Type type, JsonDeserializationContext context)
|
||||
throws JsonParseException {
|
||||
JsonObject object = (JsonObject) json;
|
||||
UUID id = object.has("id") ? (UUID) context.deserialize(object.get("id"), UUID.class) : null;
|
||||
String name = object.has("name") ? object.getAsJsonPrimitive("name").getAsString() : null;
|
||||
GameProfile profile = new GameProfile(id, name);
|
||||
if (object.has("properties")) {
|
||||
for (Map.Entry<String, Property> prop : ((PropertyMap) context.deserialize(object.get("properties"),
|
||||
PropertyMap.class)).entries()) {
|
||||
profile.getProperties().put((String) prop.getKey(), (Property) prop.getValue());
|
||||
}
|
||||
}
|
||||
return profile;
|
||||
}
|
||||
|
||||
public JsonElement serialize(GameProfile profile, Type type, JsonSerializationContext context) {
|
||||
JsonObject result = new JsonObject();
|
||||
if (profile.getId() != null) {
|
||||
result.add("id", context.serialize(profile.getId()));
|
||||
}
|
||||
if (profile.getName() != null) {
|
||||
result.addProperty("name", profile.getName());
|
||||
}
|
||||
if (!profile.getProperties().isEmpty()) {
|
||||
result.add("properties", context.serialize(profile.getProperties()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
private static class CachedProfile {
|
||||
private GameProfile profile;
|
||||
|
||||
public CachedProfile(GameProfile profile) {
|
||||
this.profile = profile;
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return GameProfileBuilder.cacheTime < 0L;
|
||||
}
|
||||
}
|
||||
}
|
||||
package de.butzlabben.world;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.reflect.Type;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonDeserializationContext;
|
||||
import com.google.gson.JsonDeserializer;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.google.gson.JsonSerializationContext;
|
||||
import com.google.gson.JsonSerializer;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import com.mojang.authlib.properties.PropertyMap;
|
||||
import com.mojang.util.UUIDTypeAdapter;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 26.02.2018
|
||||
*/
|
||||
public class GameProfileBuilder {
|
||||
|
||||
private static Gson gson = new GsonBuilder().disableHtmlEscaping()
|
||||
.registerTypeAdapter(UUID.class, new UUIDTypeAdapter())
|
||||
.registerTypeAdapter(GameProfile.class, new GameProfileSerializer())
|
||||
.registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer()).create();
|
||||
private static HashMap<UUID, CachedProfile> cache = new HashMap<>();
|
||||
private static long cacheTime = -1L;
|
||||
private static Object sync = new Object();
|
||||
|
||||
public static GameProfile fetch(UUID uuid) throws IOException {
|
||||
return fetch(uuid, false);
|
||||
}
|
||||
|
||||
public static GameProfile fetch(UUID uuid, boolean forceNew) throws IOException {
|
||||
if ((!forceNew) && (cache.containsKey(uuid)) && (((CachedProfile) cache.get(uuid)).isValid())) {
|
||||
return ((CachedProfile) cache.get(uuid)).profile;
|
||||
}
|
||||
|
||||
HttpURLConnection connection;
|
||||
synchronized (sync) {
|
||||
connection = (HttpURLConnection) new URL(
|
||||
String.format("https://sessionserver.mojang.com/session/minecraft/profile/%s?unsigned=false",
|
||||
new Object[] { UUIDTypeAdapter.fromUUID(uuid) })).openConnection();
|
||||
connection.setReadTimeout(5000);
|
||||
}
|
||||
if (connection.getResponseCode() == 200) {
|
||||
String json = new BufferedReader(new InputStreamReader(connection.getInputStream())).readLine();
|
||||
|
||||
GameProfile result = (GameProfile) gson.fromJson(json, GameProfile.class);
|
||||
cache.put(uuid, new CachedProfile(result));
|
||||
return result;
|
||||
}
|
||||
if ((!forceNew) && (cache.containsKey(uuid))) {
|
||||
return ((CachedProfile) cache.get(uuid)).profile;
|
||||
}
|
||||
throw new IOException("Could not connect to mojang servers for unknown player: " + uuid.toString());
|
||||
}
|
||||
|
||||
public static GameProfile getProfile(UUID uuid, String name, String skin) {
|
||||
return getProfile(uuid, name, skin, null);
|
||||
}
|
||||
|
||||
public static GameProfile getProfile(UUID uuid, String name, String skinUrl, String capeUrl) {
|
||||
GameProfile profile = new GameProfile(uuid, name);
|
||||
boolean cape = (capeUrl != null) && (!capeUrl.isEmpty());
|
||||
|
||||
List<Object> args = new ArrayList<>();
|
||||
args.add(Long.valueOf(System.currentTimeMillis()));
|
||||
args.add(UUIDTypeAdapter.fromUUID(uuid));
|
||||
args.add(name);
|
||||
args.add(skinUrl);
|
||||
if (cape) {
|
||||
args.add(capeUrl);
|
||||
}
|
||||
profile.getProperties().put("textures",
|
||||
new Property("textures",
|
||||
Base64Coder.encodeString(String.format(
|
||||
cape ? "{\"timestamp\":%d,\"profileId\":\"%s\",\"profileName\":\"%s\",\"isPublic\":true,\"textures\":{\"SKIN\":{\"url\":\"%s\"},\"CAPE\":{\"url\":\"%s\"}}}"
|
||||
: "{\"timestamp\":%d,\"profileId\":\"%s\",\"profileName\":\"%s\",\"isPublic\":true,\"textures\":{\"SKIN\":{\"url\":\"%s\"}}}",
|
||||
args.toArray(new Object[args.size()])))));
|
||||
return profile;
|
||||
}
|
||||
|
||||
public static void setCacheTime(long time) {
|
||||
cacheTime = time;
|
||||
}
|
||||
|
||||
private static class GameProfileSerializer implements JsonSerializer<GameProfile>, JsonDeserializer<GameProfile> {
|
||||
|
||||
public GameProfile deserialize(JsonElement json, Type type, JsonDeserializationContext context)
|
||||
throws JsonParseException {
|
||||
JsonObject object = (JsonObject) json;
|
||||
UUID id = object.has("id") ? (UUID) context.deserialize(object.get("id"), UUID.class) : null;
|
||||
String name = object.has("name") ? object.getAsJsonPrimitive("name").getAsString() : null;
|
||||
GameProfile profile = new GameProfile(id, name);
|
||||
if (object.has("properties")) {
|
||||
for (Map.Entry<String, Property> prop : ((PropertyMap) context.deserialize(object.get("properties"),
|
||||
PropertyMap.class)).entries()) {
|
||||
profile.getProperties().put((String) prop.getKey(), (Property) prop.getValue());
|
||||
}
|
||||
}
|
||||
return profile;
|
||||
}
|
||||
|
||||
public JsonElement serialize(GameProfile profile, Type type, JsonSerializationContext context) {
|
||||
JsonObject result = new JsonObject();
|
||||
if (profile.getId() != null) {
|
||||
result.add("id", context.serialize(profile.getId()));
|
||||
}
|
||||
if (profile.getName() != null) {
|
||||
result.addProperty("name", profile.getName());
|
||||
}
|
||||
if (!profile.getProperties().isEmpty()) {
|
||||
result.add("properties", context.serialize(profile.getProperties()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
private static class CachedProfile {
|
||||
private GameProfile profile;
|
||||
|
||||
public CachedProfile(GameProfile profile) {
|
||||
this.profile = profile;
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return GameProfileBuilder.cacheTime < 0L;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,49 +1,49 @@
|
||||
package de.butzlabben.world;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import de.butzlabben.world.config.MessageConfig;
|
||||
import de.butzlabben.world.config.PluginConfig;
|
||||
import de.butzlabben.world.wrapper.SystemWorld;
|
||||
|
||||
public class WorldCheckerRunnable implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
for (World world : Bukkit.getWorlds()) {
|
||||
if (SystemWorld.getSystemWorld(world.getName()) == null || !SystemWorld.getSystemWorld(world.getName()).isLoaded())
|
||||
continue;
|
||||
int other = world.getEntities().size() - world.getPlayers().size();
|
||||
if (other > PluginConfig.getEntitysPerWorld()) {
|
||||
String worldname = world.getName();
|
||||
for (Entity e : world.getEntities()) {
|
||||
if (!(e instanceof Player)) {
|
||||
e.remove();
|
||||
}
|
||||
}
|
||||
String ownerofWorld = null;
|
||||
for (OfflinePlayer p : Bukkit.getOfflinePlayers()) {
|
||||
if (p.getUniqueId().toString()
|
||||
.equals(worldname.substring(worldname.length() - 36, worldname.length())))
|
||||
ownerofWorld = p.getName();
|
||||
}
|
||||
String members = "";
|
||||
for (Player p : world.getPlayers()) {
|
||||
members += p.getName() + " ";
|
||||
}
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
if (!p.hasPermission("ws.lag"))
|
||||
continue;
|
||||
p.sendMessage(MessageConfig.getLagDetection().replaceAll("%world",
|
||||
ownerofWorld + " ( ID: " + world.getName().substring(2, worldname.length() - 37) + " )"));
|
||||
p.sendMessage(MessageConfig.getPlayerList().replaceAll("%players", members));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
package de.butzlabben.world;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import de.butzlabben.world.config.MessageConfig;
|
||||
import de.butzlabben.world.config.PluginConfig;
|
||||
import de.butzlabben.world.wrapper.SystemWorld;
|
||||
|
||||
public class WorldCheckerRunnable implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
for (World world : Bukkit.getWorlds()) {
|
||||
if (SystemWorld.getSystemWorld(world.getName()) == null || !SystemWorld.getSystemWorld(world.getName()).isLoaded())
|
||||
continue;
|
||||
int other = world.getEntities().size() - world.getPlayers().size();
|
||||
if (other > PluginConfig.getEntitysPerWorld()) {
|
||||
String worldname = world.getName();
|
||||
for (Entity e : world.getEntities()) {
|
||||
if (!(e instanceof Player)) {
|
||||
e.remove();
|
||||
}
|
||||
}
|
||||
String ownerofWorld = null;
|
||||
for (OfflinePlayer p : Bukkit.getOfflinePlayers()) {
|
||||
if (p.getUniqueId().toString()
|
||||
.equals(worldname.substring(worldname.length() - 36, worldname.length())))
|
||||
ownerofWorld = p.getName();
|
||||
}
|
||||
String members = "";
|
||||
for (Player p : world.getPlayers()) {
|
||||
members += p.getName() + " ";
|
||||
}
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
if (!p.hasPermission("ws.lag"))
|
||||
continue;
|
||||
p.sendMessage(MessageConfig.getLagDetection().replaceAll("%world",
|
||||
ownerofWorld + " ( ID: " + world.getName().substring(2, worldname.length() - 37) + " )"));
|
||||
p.sendMessage(MessageConfig.getPlayerList().replaceAll("%players", members));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,162 +1,162 @@
|
||||
package de.butzlabben.world.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class DependenceConfig {
|
||||
|
||||
private OfflinePlayer op;
|
||||
|
||||
public DependenceConfig() {
|
||||
setConfig();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public DependenceConfig(String s) {
|
||||
OfflinePlayer op = null;
|
||||
try {
|
||||
op = Bukkit.getOfflinePlayer(UUID.fromString(s));
|
||||
} catch (Exception e) {
|
||||
}
|
||||
if (op == null) {
|
||||
op = Bukkit.getOfflinePlayer(s);
|
||||
}
|
||||
this.op = op;
|
||||
}
|
||||
|
||||
private void setConfig() {
|
||||
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
|
||||
cfg.set("HighestID", -1);
|
||||
try {
|
||||
cfg.save(dconfig);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public DependenceConfig(Player p) {
|
||||
this.op = p;
|
||||
refreshName();
|
||||
}
|
||||
|
||||
public DependenceConfig(OfflinePlayer p) {
|
||||
this.op = p;
|
||||
refreshName();
|
||||
}
|
||||
|
||||
public void refreshName() {
|
||||
if (hasWorld()) {
|
||||
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
|
||||
String uuid = this.op.getUniqueId().toString();
|
||||
cfg.set("Dependences." + uuid + ".ActualName", op.getName());
|
||||
try {
|
||||
cfg.save(dconfig);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void createNewEntry() {
|
||||
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
|
||||
String uuid = this.op.getUniqueId().toString();
|
||||
int id = cfg.getInt("HighestID");
|
||||
id++;
|
||||
cfg.set("HighestID", id);
|
||||
cfg.set("Dependences." + uuid + ".ID", id);
|
||||
cfg.set("Dependences." + uuid + ".ActualName", op.getName());
|
||||
try {
|
||||
cfg.save(dconfig);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasWorld() {
|
||||
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
|
||||
String uuid = op.getUniqueId().toString();
|
||||
//Fix for #40
|
||||
if (cfg.isInt("Dependences." + uuid + ".ID"))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getWorldname() {
|
||||
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
||||
YamlConfiguration dcfg = YamlConfiguration.loadConfiguration(dconfig);
|
||||
String uuid = op.getUniqueId().toString();
|
||||
int id = dcfg.getInt("Dependences." + uuid + ".ID");
|
||||
String worldname = "ID" + id + "-" + uuid;
|
||||
return worldname;
|
||||
}
|
||||
|
||||
public String getWorldNamebyOfflinePlayer() {
|
||||
String name = "";
|
||||
String uuid = op.getUniqueId().toString();
|
||||
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
|
||||
if (cfg.getString("Dependences." + uuid + ".ActualName") == null) {
|
||||
name = "n";
|
||||
} else {
|
||||
name = "ID" + cfg.getInt("Dependences." + uuid + ".ID") + "-" + uuid;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setLastLoaded() {
|
||||
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
|
||||
String uuid = op.getUniqueId().toString();
|
||||
cfg.set("Dependences." + uuid + ".last_loaded", System.currentTimeMillis());
|
||||
try {
|
||||
cfg.save(dconfig);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static int getHighestID() {
|
||||
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
||||
YamlConfiguration dcfg = YamlConfiguration.loadConfiguration(dconfig);
|
||||
return dcfg.getInt("HighestID");
|
||||
}
|
||||
|
||||
public int getID() {
|
||||
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
||||
YamlConfiguration dcfg = YamlConfiguration.loadConfiguration(dconfig);
|
||||
return dcfg.getInt("Dependences." + op.getUniqueId().toString() + ".ID");
|
||||
}
|
||||
|
||||
public OfflinePlayer getOwner() {
|
||||
return op;
|
||||
}
|
||||
|
||||
public static void checkWorlds() {
|
||||
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
|
||||
|
||||
long deleteTime = 1000 * 60 * 60 * 24 * PluginConfig.deleteAfter();
|
||||
long now = System.currentTimeMillis();
|
||||
for (String s : cfg.getConfigurationSection("Dependences").getKeys(false)) {
|
||||
if (!cfg.isLong("Dependences." + s + ".last_loaded") && !cfg.isInt("Dependences." + s + ".last_loaded"))
|
||||
continue;
|
||||
long lastLoaded = cfg.getLong("Dependences." + s + ".last_loaded");
|
||||
long diff = now - lastLoaded;
|
||||
if (diff > deleteTime) {
|
||||
Bukkit.getConsoleSender().sendMessage(
|
||||
PluginConfig.getPrefix() + "World of " + s + " was not loaded for too long. Deleting!");
|
||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "ws delete " + s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
package de.butzlabben.world.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class DependenceConfig {
|
||||
|
||||
private OfflinePlayer op;
|
||||
|
||||
public DependenceConfig() {
|
||||
setConfig();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public DependenceConfig(String s) {
|
||||
OfflinePlayer op = null;
|
||||
try {
|
||||
op = Bukkit.getOfflinePlayer(UUID.fromString(s));
|
||||
} catch (Exception e) {
|
||||
}
|
||||
if (op == null) {
|
||||
op = Bukkit.getOfflinePlayer(s);
|
||||
}
|
||||
this.op = op;
|
||||
}
|
||||
|
||||
private void setConfig() {
|
||||
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
|
||||
cfg.set("HighestID", -1);
|
||||
try {
|
||||
cfg.save(dconfig);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public DependenceConfig(Player p) {
|
||||
this.op = p;
|
||||
refreshName();
|
||||
}
|
||||
|
||||
public DependenceConfig(OfflinePlayer p) {
|
||||
this.op = p;
|
||||
refreshName();
|
||||
}
|
||||
|
||||
public void refreshName() {
|
||||
if (hasWorld()) {
|
||||
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
|
||||
String uuid = this.op.getUniqueId().toString();
|
||||
cfg.set("Dependences." + uuid + ".ActualName", op.getName());
|
||||
try {
|
||||
cfg.save(dconfig);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void createNewEntry() {
|
||||
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
|
||||
String uuid = this.op.getUniqueId().toString();
|
||||
int id = cfg.getInt("HighestID");
|
||||
id++;
|
||||
cfg.set("HighestID", id);
|
||||
cfg.set("Dependences." + uuid + ".ID", id);
|
||||
cfg.set("Dependences." + uuid + ".ActualName", op.getName());
|
||||
try {
|
||||
cfg.save(dconfig);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasWorld() {
|
||||
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
|
||||
String uuid = op.getUniqueId().toString();
|
||||
//Fix for #40
|
||||
if (cfg.isInt("Dependences." + uuid + ".ID"))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getWorldname() {
|
||||
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
||||
YamlConfiguration dcfg = YamlConfiguration.loadConfiguration(dconfig);
|
||||
String uuid = op.getUniqueId().toString();
|
||||
int id = dcfg.getInt("Dependences." + uuid + ".ID");
|
||||
String worldname = "ID" + id + "-" + uuid;
|
||||
return worldname;
|
||||
}
|
||||
|
||||
public String getWorldNamebyOfflinePlayer() {
|
||||
String name = "";
|
||||
String uuid = op.getUniqueId().toString();
|
||||
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
|
||||
if (cfg.getString("Dependences." + uuid + ".ActualName") == null) {
|
||||
name = "n";
|
||||
} else {
|
||||
name = "ID" + cfg.getInt("Dependences." + uuid + ".ID") + "-" + uuid;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setLastLoaded() {
|
||||
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
|
||||
String uuid = op.getUniqueId().toString();
|
||||
cfg.set("Dependences." + uuid + ".last_loaded", System.currentTimeMillis());
|
||||
try {
|
||||
cfg.save(dconfig);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static int getHighestID() {
|
||||
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
||||
YamlConfiguration dcfg = YamlConfiguration.loadConfiguration(dconfig);
|
||||
return dcfg.getInt("HighestID");
|
||||
}
|
||||
|
||||
public int getID() {
|
||||
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
||||
YamlConfiguration dcfg = YamlConfiguration.loadConfiguration(dconfig);
|
||||
return dcfg.getInt("Dependences." + op.getUniqueId().toString() + ".ID");
|
||||
}
|
||||
|
||||
public OfflinePlayer getOwner() {
|
||||
return op;
|
||||
}
|
||||
|
||||
public static void checkWorlds() {
|
||||
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
|
||||
|
||||
long deleteTime = 1000 * 60 * 60 * 24 * PluginConfig.deleteAfter();
|
||||
long now = System.currentTimeMillis();
|
||||
for (String s : cfg.getConfigurationSection("Dependences").getKeys(false)) {
|
||||
if (!cfg.isLong("Dependences." + s + ".last_loaded") && !cfg.isInt("Dependences." + s + ".last_loaded"))
|
||||
continue;
|
||||
long lastLoaded = cfg.getLong("Dependences." + s + ".last_loaded");
|
||||
long diff = now - lastLoaded;
|
||||
if (diff > deleteTime) {
|
||||
Bukkit.getConsoleSender().sendMessage(
|
||||
PluginConfig.getPrefix() + "World of " + s + " was not loaded for too long. Deleting!");
|
||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "ws delete " + s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,56 +1,56 @@
|
||||
package de.butzlabben.world.config;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
public class Entry {
|
||||
|
||||
private OfflinePlayer op;
|
||||
private String uuid;
|
||||
private int id;
|
||||
private String worldname;
|
||||
|
||||
public static int entrys() {
|
||||
int entrys = 0;
|
||||
for(OfflinePlayer op : Bukkit.getOfflinePlayers()) {
|
||||
Entry e = new Entry(op);
|
||||
if(e.hasWorld())
|
||||
++entrys;
|
||||
}
|
||||
return entrys;
|
||||
}
|
||||
|
||||
protected OfflinePlayer getOfflinePlayer() {
|
||||
return op;
|
||||
}
|
||||
|
||||
protected int getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
protected String getWorldname() {
|
||||
return worldname;
|
||||
}
|
||||
|
||||
protected boolean hasWorld() {
|
||||
if(worldname.equals("n"))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
protected Entry(OfflinePlayer op) {
|
||||
uuid = op.getUniqueId().toString();
|
||||
this.op = op;
|
||||
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
|
||||
if (cfg.getString("Dependences." + uuid + ".ActualName") == null) {
|
||||
worldname = "n";
|
||||
} else {
|
||||
worldname = "ID" + cfg.getInt("Dependences." + uuid + ".ID") + " " + uuid;
|
||||
id = cfg.getInt("Dependences." + uuid + ".ID");
|
||||
}
|
||||
}
|
||||
}
|
||||
package de.butzlabben.world.config;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
public class Entry {
|
||||
|
||||
private OfflinePlayer op;
|
||||
private String uuid;
|
||||
private int id;
|
||||
private String worldname;
|
||||
|
||||
public static int entrys() {
|
||||
int entrys = 0;
|
||||
for(OfflinePlayer op : Bukkit.getOfflinePlayers()) {
|
||||
Entry e = new Entry(op);
|
||||
if(e.hasWorld())
|
||||
++entrys;
|
||||
}
|
||||
return entrys;
|
||||
}
|
||||
|
||||
protected OfflinePlayer getOfflinePlayer() {
|
||||
return op;
|
||||
}
|
||||
|
||||
protected int getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
protected String getWorldname() {
|
||||
return worldname;
|
||||
}
|
||||
|
||||
protected boolean hasWorld() {
|
||||
if(worldname.equals("n"))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
protected Entry(OfflinePlayer op) {
|
||||
uuid = op.getUniqueId().toString();
|
||||
this.op = op;
|
||||
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
|
||||
if (cfg.getString("Dependences." + uuid + ".ActualName") == null) {
|
||||
worldname = "n";
|
||||
} else {
|
||||
worldname = "ID" + cfg.getInt("Dependences." + uuid + ".ID") + " " + uuid;
|
||||
id = cfg.getInt("Dependences." + uuid + ".ID");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,153 +1,153 @@
|
||||
package de.butzlabben.world.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.file.Files;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import de.butzlabben.inventory.OrcItem;
|
||||
import de.butzlabben.world.WorldSystem;
|
||||
|
||||
public class GuiConfig {
|
||||
|
||||
private GuiConfig() {
|
||||
}
|
||||
|
||||
private static File file;
|
||||
|
||||
public static void checkConfig(File f) {
|
||||
file = f;
|
||||
if (file.exists() == false) {
|
||||
try {
|
||||
String guiFileResource;
|
||||
if (WorldSystem.is1_13()) {
|
||||
guiFileResource = "1_13_gui.yml";
|
||||
} else {
|
||||
guiFileResource = "old_gui.yml";
|
||||
}
|
||||
InputStream in = JavaPlugin.getPlugin(WorldSystem.class).getResource(guiFileResource);
|
||||
Files.copy(in, file.toPath());
|
||||
} catch (IOException e) {
|
||||
System.err.println("Wasn't able to create Config");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
OrcItem.enabled = getEnabled();
|
||||
OrcItem.disabled = getDisabled();
|
||||
OrcItem.coming_soon = getComingSoon();
|
||||
OrcItem.back = getBack();
|
||||
OrcItem.fill = getFill();
|
||||
}
|
||||
|
||||
public static YamlConfiguration getConfig() {
|
||||
try {
|
||||
return YamlConfiguration
|
||||
.loadConfiguration(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8")));
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int getSlot(String path) {
|
||||
YamlConfiguration cfg = getConfig();
|
||||
return (cfg.getInt(path + ".slot.row") - 1) * 9 + cfg.getInt(path + ".slot.col") - 1;
|
||||
}
|
||||
|
||||
public static int getState(String path) {
|
||||
YamlConfiguration cfg = getConfig();
|
||||
return (cfg.getInt(path + ".state.row") - 1) * 9 + cfg.getInt(path + ".state.col") - 1;
|
||||
}
|
||||
|
||||
public static boolean isEnabled(String path) {
|
||||
return getConfig().getBoolean(path + ".enabled", true);
|
||||
}
|
||||
|
||||
public static int getRows(String path) {
|
||||
return getConfig().getInt(path + ".rows", 1);
|
||||
}
|
||||
|
||||
public static String getDisplay(FileConfiguration cfg, String path) {
|
||||
return ChatColor.translateAlternateColorCodes('&', cfg.getString(path + ".display"));
|
||||
}
|
||||
|
||||
public static ArrayList<String> getLore(FileConfiguration cfg, String path) {
|
||||
List<String> list = cfg.getStringList(path + ".lore");
|
||||
ArrayList<String> colored = new ArrayList<>(list.size());
|
||||
for (String s : list) {
|
||||
colored.add(ChatColor.translateAlternateColorCodes('&', s));
|
||||
}
|
||||
return colored;
|
||||
}
|
||||
|
||||
public static byte getData(FileConfiguration cfg, String path) {
|
||||
return (byte) cfg.getInt(path + ".data", 0);
|
||||
}
|
||||
|
||||
public static String getTitle(FileConfiguration cfg, String path) {
|
||||
return cfg.getString(path + ".title");
|
||||
}
|
||||
|
||||
public static Material getMaterial(FileConfiguration cfg, String path) {
|
||||
try {
|
||||
return Material.valueOf(cfg.getString(path + ".material").toUpperCase());
|
||||
} catch (IllegalArgumentException ex) {
|
||||
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "§cUnknown material: " + path);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static OrcItem getItem(String path) {
|
||||
YamlConfiguration cfg = getConfig();
|
||||
try {
|
||||
return new OrcItem(getMaterial(cfg, path), getData(cfg, path), getDisplay(cfg, path), getLore(cfg, path));
|
||||
} catch (Exception e) {
|
||||
}
|
||||
try {
|
||||
return new OrcItem(getMaterial(cfg, path), getDisplay(cfg, path), getLore(cfg, path));
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return OrcItem.error.clone().setDisplay("§c" + path);
|
||||
}
|
||||
|
||||
public static OrcItem getEnabled() {
|
||||
return getItem("options.enabled");
|
||||
}
|
||||
|
||||
public static OrcItem getDisabled() {
|
||||
return getItem("options.disabled");
|
||||
}
|
||||
|
||||
public static OrcItem getComingSoon() {
|
||||
return getItem("options.coming_soon");
|
||||
}
|
||||
|
||||
private static OrcItem getBack() {
|
||||
return getItem("options.back");
|
||||
}
|
||||
|
||||
private static OrcItem getFill() {
|
||||
return getItem("options.fill");
|
||||
}
|
||||
|
||||
public static boolean isFill(String path) {
|
||||
return getConfig().getBoolean(path + ".fill");
|
||||
}
|
||||
|
||||
public static Material getSkullItem() {
|
||||
return getMaterial(getConfig(), "options.players.playerhead");
|
||||
}
|
||||
}
|
||||
package de.butzlabben.world.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.file.Files;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import de.butzlabben.inventory.OrcItem;
|
||||
import de.butzlabben.world.WorldSystem;
|
||||
|
||||
public class GuiConfig {
|
||||
|
||||
private GuiConfig() {
|
||||
}
|
||||
|
||||
private static File file;
|
||||
|
||||
public static void checkConfig(File f) {
|
||||
file = f;
|
||||
if (file.exists() == false) {
|
||||
try {
|
||||
String guiFileResource;
|
||||
if (WorldSystem.is1_13()) {
|
||||
guiFileResource = "1_13_gui.yml";
|
||||
} else {
|
||||
guiFileResource = "old_gui.yml";
|
||||
}
|
||||
InputStream in = JavaPlugin.getPlugin(WorldSystem.class).getResource(guiFileResource);
|
||||
Files.copy(in, file.toPath());
|
||||
} catch (IOException e) {
|
||||
System.err.println("Wasn't able to create Config");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
OrcItem.enabled = getEnabled();
|
||||
OrcItem.disabled = getDisabled();
|
||||
OrcItem.coming_soon = getComingSoon();
|
||||
OrcItem.back = getBack();
|
||||
OrcItem.fill = getFill();
|
||||
}
|
||||
|
||||
public static YamlConfiguration getConfig() {
|
||||
try {
|
||||
return YamlConfiguration
|
||||
.loadConfiguration(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8")));
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int getSlot(String path) {
|
||||
YamlConfiguration cfg = getConfig();
|
||||
return (cfg.getInt(path + ".slot.row") - 1) * 9 + cfg.getInt(path + ".slot.col") - 1;
|
||||
}
|
||||
|
||||
public static int getState(String path) {
|
||||
YamlConfiguration cfg = getConfig();
|
||||
return (cfg.getInt(path + ".state.row") - 1) * 9 + cfg.getInt(path + ".state.col") - 1;
|
||||
}
|
||||
|
||||
public static boolean isEnabled(String path) {
|
||||
return getConfig().getBoolean(path + ".enabled", true);
|
||||
}
|
||||
|
||||
public static int getRows(String path) {
|
||||
return getConfig().getInt(path + ".rows", 1);
|
||||
}
|
||||
|
||||
public static String getDisplay(FileConfiguration cfg, String path) {
|
||||
return ChatColor.translateAlternateColorCodes('&', cfg.getString(path + ".display"));
|
||||
}
|
||||
|
||||
public static ArrayList<String> getLore(FileConfiguration cfg, String path) {
|
||||
List<String> list = cfg.getStringList(path + ".lore");
|
||||
ArrayList<String> colored = new ArrayList<>(list.size());
|
||||
for (String s : list) {
|
||||
colored.add(ChatColor.translateAlternateColorCodes('&', s));
|
||||
}
|
||||
return colored;
|
||||
}
|
||||
|
||||
public static byte getData(FileConfiguration cfg, String path) {
|
||||
return (byte) cfg.getInt(path + ".data", 0);
|
||||
}
|
||||
|
||||
public static String getTitle(FileConfiguration cfg, String path) {
|
||||
return cfg.getString(path + ".title");
|
||||
}
|
||||
|
||||
public static Material getMaterial(FileConfiguration cfg, String path) {
|
||||
try {
|
||||
return Material.valueOf(cfg.getString(path + ".material").toUpperCase());
|
||||
} catch (IllegalArgumentException ex) {
|
||||
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "§cUnknown material: " + path);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static OrcItem getItem(String path) {
|
||||
YamlConfiguration cfg = getConfig();
|
||||
try {
|
||||
return new OrcItem(getMaterial(cfg, path), getData(cfg, path), getDisplay(cfg, path), getLore(cfg, path));
|
||||
} catch (Exception e) {
|
||||
}
|
||||
try {
|
||||
return new OrcItem(getMaterial(cfg, path), getDisplay(cfg, path), getLore(cfg, path));
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return OrcItem.error.clone().setDisplay("§c" + path);
|
||||
}
|
||||
|
||||
public static OrcItem getEnabled() {
|
||||
return getItem("options.enabled");
|
||||
}
|
||||
|
||||
public static OrcItem getDisabled() {
|
||||
return getItem("options.disabled");
|
||||
}
|
||||
|
||||
public static OrcItem getComingSoon() {
|
||||
return getItem("options.coming_soon");
|
||||
}
|
||||
|
||||
private static OrcItem getBack() {
|
||||
return getItem("options.back");
|
||||
}
|
||||
|
||||
private static OrcItem getFill() {
|
||||
return getItem("options.fill");
|
||||
}
|
||||
|
||||
public static boolean isFill(String path) {
|
||||
return getConfig().getBoolean(path + ".fill");
|
||||
}
|
||||
|
||||
public static Material getSkullItem() {
|
||||
return getMaterial(getConfig(), "options.players.playerhead");
|
||||
}
|
||||
}
|
@ -1,245 +1,245 @@
|
||||
package de.butzlabben.world.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.WorldCreator;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.WorldType;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import de.butzlabben.world.WorldSystem;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
|
||||
public class PluginConfig {
|
||||
|
||||
private PluginConfig() {
|
||||
}
|
||||
|
||||
private static File file;
|
||||
|
||||
public static void checkConfig(File f) {
|
||||
file = f;
|
||||
if (file.exists()) {
|
||||
YamlConfiguration cfg = getConfig();
|
||||
if (false == (cfg.isString("worldfolder") && cfg.isInt("unloadingtime")
|
||||
&& cfg.isBoolean("survival") && cfg.isString("language") && cfg.isString("prefix")
|
||||
&& cfg.isInt("request_expires") && cfg.isBoolean("need_confirm")
|
||||
&& cfg.isBoolean("contact_authserver") && cfg.isBoolean("spawn_teleportation")
|
||||
&& cfg.isInt("delete_after") && cfg.isBoolean("worldtemplates.multi_choose")
|
||||
&& cfg.isString("worldtemplates.default") &&
|
||||
|
||||
cfg.isInt("lagsystem.period_in_seconds") && cfg.isInt("lagsystem.entities_per_world")
|
||||
&& cfg.isBoolean("lagsystem.garbagecollector.use")
|
||||
&& cfg.isInt("lagsystem.garbagecollector.period_in_minutes") &&
|
||||
|
||||
cfg.isString("worldgeneration.type") && cfg.isString("worldgeneration.environment")
|
||||
&& cfg.isString("worldgeneration.generator")
|
||||
&& (cfg.isLong("worldgeneration.seed") || cfg.isInt("worldgeneration.seed")) &&
|
||||
|
||||
cfg.isString("spawn.spawnpoint.world") && cfg.isInt("spawn.gamemode")
|
||||
&& (cfg.isDouble("spawn.spawnpoint.x") || cfg.isInt("spawn.spawnpoint.x"))
|
||||
&& (cfg.isDouble("spawn.spawnpoint.y") || cfg.isInt("spawn.spawnpoint.y"))
|
||||
&& (cfg.isDouble("spawn.spawnpoint.z") || cfg.isInt("spawn.spawnpoint.z"))
|
||||
&& (cfg.isDouble("spawn.spawnpoint.yaw") || cfg.isInt("spawn.spawnpoint.yaw"))
|
||||
&& (cfg.isDouble("spawn.spawnpoint.pitch") || cfg.isInt("spawn.spawnpoint.pitch")) &&
|
||||
|
||||
cfg.isBoolean("worldspawn.use")
|
||||
&& (cfg.isDouble("worldspawn.spawnpoint.x") || cfg.isInt("worldspawn.spawnpoint.x"))
|
||||
&& (cfg.isDouble("worldspawn.spawnpoint.y") || cfg.isInt("worldspawn.spawnpoint.y"))
|
||||
&& (cfg.isDouble("worldspawn.spawnpoint.z") || cfg.isInt("worldspawn.spawnpoint.z"))
|
||||
&& (cfg.isDouble("worldspawn.spawnpoint.yaw") || cfg.isInt("worldspawn.spawnpoint.yaw"))
|
||||
&& (cfg.isDouble("worldspawn.spawnpoint.pitch") || cfg.isInt("worldspawn.spawnpoint.pitch")))) {
|
||||
try {
|
||||
Files.copy(file.toPath(),
|
||||
new File(file.getParentFile(), "config-broken-"
|
||||
+ new SimpleDateFormat("dd-MM-yyyy-HH-mm-ss").format(new Date()) + ".yml").toPath(),
|
||||
StandardCopyOption.REPLACE_EXISTING);
|
||||
Files.delete(file.toPath());
|
||||
System.err.println("[WorldSystem] Config is broken, creating a new one!");
|
||||
checkConfig(f);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
InputStream in = JavaPlugin.getPlugin(WorldSystem.class).getResource("config.yml");
|
||||
Files.copy(in, file.toPath());
|
||||
} catch (IOException e) {
|
||||
System.err.println("Wasn't able to create Config");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
// Should fix #2
|
||||
if (getSpawn().getWorld() == null) {
|
||||
Bukkit.getConsoleSender().sendMessage(getPrefix() + "§cWorld is null in spawn.world!");
|
||||
}
|
||||
}
|
||||
|
||||
public static YamlConfiguration getConfig() {
|
||||
try {
|
||||
return YamlConfiguration
|
||||
.loadConfiguration(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8")));
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int getGCPeriod() {
|
||||
return getConfig().getInt("lagsystem.garbagecollector.period_in_minutes", 5);
|
||||
}
|
||||
|
||||
public static boolean useGC() {
|
||||
return getConfig().getBoolean("lagsystem.garbagecollector.use", false);
|
||||
}
|
||||
|
||||
public static int getEntitysPerWorld() {
|
||||
return getConfig().getInt("lagsystem.entities_per_world", 350);
|
||||
}
|
||||
|
||||
public static int getLagCheckPeriod() {
|
||||
return getConfig().getInt("lagsystem.period_in_seconds", 10);
|
||||
}
|
||||
|
||||
public static boolean useWorldSpawn() {
|
||||
return getConfig().getBoolean("worldspawn.use", true);
|
||||
}
|
||||
|
||||
public static boolean isSurvival() {
|
||||
return getConfig().getBoolean("survival", false);
|
||||
}
|
||||
|
||||
public static int getUnloadingTime() {
|
||||
return getConfig().getInt("unloadingtime", 20);
|
||||
}
|
||||
|
||||
private final static GameMode[] gamemodes = new GameMode[] { GameMode.SURVIVAL, GameMode.CREATIVE,
|
||||
GameMode.ADVENTURE, GameMode.SPECTATOR };
|
||||
|
||||
public static GameMode getSpawnGamemode() {
|
||||
return gamemodes[getConfig().getInt("spawn.gamemode", 2)];
|
||||
}
|
||||
|
||||
public static String getWorlddir() {
|
||||
return getConfig().getString("worldfolder", "plugins/WorldSystem/Worlds") + "/";
|
||||
}
|
||||
|
||||
public static boolean isMultiChoose() {
|
||||
return getConfig().getBoolean("worldtemplates.multi_choose", false);
|
||||
}
|
||||
|
||||
public static String getDefaultWorldTemplate() {
|
||||
return getConfig().getString("worldtemplates.default", "");
|
||||
}
|
||||
|
||||
public static String getLanguage() {
|
||||
return getConfig().getString("language", "en");
|
||||
}
|
||||
|
||||
public static String getPrefix() {
|
||||
return ChatColor.translateAlternateColorCodes('&', getConfig().getString("prefix", "§8[§3WorldSystem§8] §6"));
|
||||
}
|
||||
|
||||
public static Location getWorldSpawn(World w) {
|
||||
return getLocation(getConfig(), "worldspawn.spawnpoint", w);
|
||||
}
|
||||
|
||||
public static Location getSpawn() {
|
||||
YamlConfiguration cfg = getConfig();
|
||||
return getLocation(cfg, "spawn.spawnpoint", Bukkit.getWorld(cfg.getString("spawn.spawnpoint.world", "world")));
|
||||
}
|
||||
|
||||
public static long getSeed() {
|
||||
return getConfig().getLong("worldgeneration.seed");
|
||||
}
|
||||
|
||||
public static Environment getEnvironment() {
|
||||
YamlConfiguration cfg = getConfig();
|
||||
String t = cfg.getString("worldgeneration.environment");
|
||||
Environment e = Environment.NORMAL;
|
||||
try {
|
||||
e = Environment.valueOf(t.toUpperCase());
|
||||
} catch (Exception ex) {
|
||||
System.out.println("'" + t + "' is not a valid environment");
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
public static String getGenerator() {
|
||||
return getConfig().getString("worldgeneration.generator");
|
||||
}
|
||||
|
||||
public static WorldType getWorldType() {
|
||||
YamlConfiguration cfg = getConfig();
|
||||
String t = cfg.getString("worldgeneration.type");
|
||||
WorldType wt = WorldType.NORMAL;
|
||||
try {
|
||||
wt = WorldType.valueOf(t.toUpperCase());
|
||||
} catch (Exception e) {
|
||||
System.err.println("'" + t + "' is not a valid worldtype");
|
||||
}
|
||||
return wt;
|
||||
}
|
||||
|
||||
public static int getRequestExpire() {
|
||||
return getConfig().getInt("request_expires", 20);
|
||||
}
|
||||
|
||||
private static Location getLocation(YamlConfiguration cfg, String path, World world) {
|
||||
return new Location(world, cfg.getDouble(path + ".x", 0), cfg.getDouble(path + ".y", 20),
|
||||
cfg.getDouble(path + ".z", 0), (float) cfg.getDouble(path + ".yaw", 0),
|
||||
(float) cfg.getDouble(path + ".pitch", 0));
|
||||
}
|
||||
|
||||
public static boolean confirmNeed() {
|
||||
return getConfig().getBoolean("need_confirm", true);
|
||||
}
|
||||
|
||||
public static boolean contactAuth() {
|
||||
return getConfig().getBoolean("contact_authserver", true);
|
||||
}
|
||||
|
||||
public static boolean spawnTeleportation() {
|
||||
return getConfig().getBoolean("spawn_teleportation", true);
|
||||
}
|
||||
|
||||
public static boolean shouldDelete() {
|
||||
return getConfig().getInt("delete_after") != -1;
|
||||
}
|
||||
|
||||
public static long deleteAfter() {
|
||||
return getConfig().getLong("delete_after");
|
||||
}
|
||||
|
||||
public static WorldCreator getWorldCreator(String worldname) {
|
||||
WorldCreator creator = new WorldCreator(worldname);
|
||||
long seed = PluginConfig.getSeed();
|
||||
Environment env = PluginConfig.getEnvironment();
|
||||
WorldType type = PluginConfig.getWorldType();
|
||||
if (seed != 0)
|
||||
creator.seed(seed);
|
||||
creator.type(type);
|
||||
creator.environment(env);
|
||||
String generator = PluginConfig.getGenerator();
|
||||
if (!generator.trim().isEmpty())
|
||||
creator.generator(generator);
|
||||
return creator;
|
||||
}
|
||||
}
|
||||
package de.butzlabben.world.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.WorldCreator;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.WorldType;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import de.butzlabben.world.WorldSystem;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
|
||||
public class PluginConfig {
|
||||
|
||||
private PluginConfig() {
|
||||
}
|
||||
|
||||
private static File file;
|
||||
|
||||
public static void checkConfig(File f) {
|
||||
file = f;
|
||||
if (file.exists()) {
|
||||
YamlConfiguration cfg = getConfig();
|
||||
if (false == (cfg.isString("worldfolder") && cfg.isInt("unloadingtime")
|
||||
&& cfg.isBoolean("survival") && cfg.isString("language") && cfg.isString("prefix")
|
||||
&& cfg.isInt("request_expires") && cfg.isBoolean("need_confirm")
|
||||
&& cfg.isBoolean("contact_authserver") && cfg.isBoolean("spawn_teleportation")
|
||||
&& cfg.isInt("delete_after") && cfg.isBoolean("worldtemplates.multi_choose")
|
||||
&& cfg.isString("worldtemplates.default") &&
|
||||
|
||||
cfg.isInt("lagsystem.period_in_seconds") && cfg.isInt("lagsystem.entities_per_world")
|
||||
&& cfg.isBoolean("lagsystem.garbagecollector.use")
|
||||
&& cfg.isInt("lagsystem.garbagecollector.period_in_minutes") &&
|
||||
|
||||
cfg.isString("worldgeneration.type") && cfg.isString("worldgeneration.environment")
|
||||
&& cfg.isString("worldgeneration.generator")
|
||||
&& (cfg.isLong("worldgeneration.seed") || cfg.isInt("worldgeneration.seed")) &&
|
||||
|
||||
cfg.isString("spawn.spawnpoint.world") && cfg.isInt("spawn.gamemode")
|
||||
&& (cfg.isDouble("spawn.spawnpoint.x") || cfg.isInt("spawn.spawnpoint.x"))
|
||||
&& (cfg.isDouble("spawn.spawnpoint.y") || cfg.isInt("spawn.spawnpoint.y"))
|
||||
&& (cfg.isDouble("spawn.spawnpoint.z") || cfg.isInt("spawn.spawnpoint.z"))
|
||||
&& (cfg.isDouble("spawn.spawnpoint.yaw") || cfg.isInt("spawn.spawnpoint.yaw"))
|
||||
&& (cfg.isDouble("spawn.spawnpoint.pitch") || cfg.isInt("spawn.spawnpoint.pitch")) &&
|
||||
|
||||
cfg.isBoolean("worldspawn.use")
|
||||
&& (cfg.isDouble("worldspawn.spawnpoint.x") || cfg.isInt("worldspawn.spawnpoint.x"))
|
||||
&& (cfg.isDouble("worldspawn.spawnpoint.y") || cfg.isInt("worldspawn.spawnpoint.y"))
|
||||
&& (cfg.isDouble("worldspawn.spawnpoint.z") || cfg.isInt("worldspawn.spawnpoint.z"))
|
||||
&& (cfg.isDouble("worldspawn.spawnpoint.yaw") || cfg.isInt("worldspawn.spawnpoint.yaw"))
|
||||
&& (cfg.isDouble("worldspawn.spawnpoint.pitch") || cfg.isInt("worldspawn.spawnpoint.pitch")))) {
|
||||
try {
|
||||
Files.copy(file.toPath(),
|
||||
new File(file.getParentFile(), "config-broken-"
|
||||
+ new SimpleDateFormat("dd-MM-yyyy-HH-mm-ss").format(new Date()) + ".yml").toPath(),
|
||||
StandardCopyOption.REPLACE_EXISTING);
|
||||
Files.delete(file.toPath());
|
||||
System.err.println("[WorldSystem] Config is broken, creating a new one!");
|
||||
checkConfig(f);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
InputStream in = JavaPlugin.getPlugin(WorldSystem.class).getResource("config.yml");
|
||||
Files.copy(in, file.toPath());
|
||||
} catch (IOException e) {
|
||||
System.err.println("Wasn't able to create Config");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
// Should fix #2
|
||||
if (getSpawn().getWorld() == null) {
|
||||
Bukkit.getConsoleSender().sendMessage(getPrefix() + "§cWorld is null in spawn.world!");
|
||||
}
|
||||
}
|
||||
|
||||
public static YamlConfiguration getConfig() {
|
||||
try {
|
||||
return YamlConfiguration
|
||||
.loadConfiguration(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8")));
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int getGCPeriod() {
|
||||
return getConfig().getInt("lagsystem.garbagecollector.period_in_minutes", 5);
|
||||
}
|
||||
|
||||
public static boolean useGC() {
|
||||
return getConfig().getBoolean("lagsystem.garbagecollector.use", false);
|
||||
}
|
||||
|
||||
public static int getEntitysPerWorld() {
|
||||
return getConfig().getInt("lagsystem.entities_per_world", 350);
|
||||
}
|
||||
|
||||
public static int getLagCheckPeriod() {
|
||||
return getConfig().getInt("lagsystem.period_in_seconds", 10);
|
||||
}
|
||||
|
||||
public static boolean useWorldSpawn() {
|
||||
return getConfig().getBoolean("worldspawn.use", true);
|
||||
}
|
||||
|
||||
public static boolean isSurvival() {
|
||||
return getConfig().getBoolean("survival", false);
|
||||
}
|
||||
|
||||
public static int getUnloadingTime() {
|
||||
return getConfig().getInt("unloadingtime", 20);
|
||||
}
|
||||
|
||||
private final static GameMode[] gamemodes = new GameMode[] { GameMode.SURVIVAL, GameMode.CREATIVE,
|
||||
GameMode.ADVENTURE, GameMode.SPECTATOR };
|
||||
|
||||
public static GameMode getSpawnGamemode() {
|
||||
return gamemodes[getConfig().getInt("spawn.gamemode", 2)];
|
||||
}
|
||||
|
||||
public static String getWorlddir() {
|
||||
return getConfig().getString("worldfolder", "plugins/WorldSystem/Worlds") + "/";
|
||||
}
|
||||
|
||||
public static boolean isMultiChoose() {
|
||||
return getConfig().getBoolean("worldtemplates.multi_choose", false);
|
||||
}
|
||||
|
||||
public static String getDefaultWorldTemplate() {
|
||||
return getConfig().getString("worldtemplates.default", "");
|
||||
}
|
||||
|
||||
public static String getLanguage() {
|
||||
return getConfig().getString("language", "en");
|
||||
}
|
||||
|
||||
public static String getPrefix() {
|
||||
return ChatColor.translateAlternateColorCodes('&', getConfig().getString("prefix", "§8[§3WorldSystem§8] §6"));
|
||||
}
|
||||
|
||||
public static Location getWorldSpawn(World w) {
|
||||
return getLocation(getConfig(), "worldspawn.spawnpoint", w);
|
||||
}
|
||||
|
||||
public static Location getSpawn() {
|
||||
YamlConfiguration cfg = getConfig();
|
||||
return getLocation(cfg, "spawn.spawnpoint", Bukkit.getWorld(cfg.getString("spawn.spawnpoint.world", "world")));
|
||||
}
|
||||
|
||||
public static long getSeed() {
|
||||
return getConfig().getLong("worldgeneration.seed");
|
||||
}
|
||||
|
||||
public static Environment getEnvironment() {
|
||||
YamlConfiguration cfg = getConfig();
|
||||
String t = cfg.getString("worldgeneration.environment");
|
||||
Environment e = Environment.NORMAL;
|
||||
try {
|
||||
e = Environment.valueOf(t.toUpperCase());
|
||||
} catch (Exception ex) {
|
||||
System.out.println("'" + t + "' is not a valid environment");
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
public static String getGenerator() {
|
||||
return getConfig().getString("worldgeneration.generator");
|
||||
}
|
||||
|
||||
public static WorldType getWorldType() {
|
||||
YamlConfiguration cfg = getConfig();
|
||||
String t = cfg.getString("worldgeneration.type");
|
||||
WorldType wt = WorldType.NORMAL;
|
||||
try {
|
||||
wt = WorldType.valueOf(t.toUpperCase());
|
||||
} catch (Exception e) {
|
||||
System.err.println("'" + t + "' is not a valid worldtype");
|
||||
}
|
||||
return wt;
|
||||
}
|
||||
|
||||
public static int getRequestExpire() {
|
||||
return getConfig().getInt("request_expires", 20);
|
||||
}
|
||||
|
||||
private static Location getLocation(YamlConfiguration cfg, String path, World world) {
|
||||
return new Location(world, cfg.getDouble(path + ".x", 0), cfg.getDouble(path + ".y", 20),
|
||||
cfg.getDouble(path + ".z", 0), (float) cfg.getDouble(path + ".yaw", 0),
|
||||
(float) cfg.getDouble(path + ".pitch", 0));
|
||||
}
|
||||
|
||||
public static boolean confirmNeed() {
|
||||
return getConfig().getBoolean("need_confirm", true);
|
||||
}
|
||||
|
||||
public static boolean contactAuth() {
|
||||
return getConfig().getBoolean("contact_authserver", true);
|
||||
}
|
||||
|
||||
public static boolean spawnTeleportation() {
|
||||
return getConfig().getBoolean("spawn_teleportation", true);
|
||||
}
|
||||
|
||||
public static boolean shouldDelete() {
|
||||
return getConfig().getInt("delete_after") != -1;
|
||||
}
|
||||
|
||||
public static long deleteAfter() {
|
||||
return getConfig().getLong("delete_after");
|
||||
}
|
||||
|
||||
public static WorldCreator getWorldCreator(String worldname) {
|
||||
WorldCreator creator = new WorldCreator(worldname);
|
||||
long seed = PluginConfig.getSeed();
|
||||
Environment env = PluginConfig.getEnvironment();
|
||||
WorldType type = PluginConfig.getWorldType();
|
||||
if (seed != 0)
|
||||
creator.seed(seed);
|
||||
creator.type(type);
|
||||
creator.environment(env);
|
||||
String generator = PluginConfig.getGenerator();
|
||||
if (!generator.trim().isEmpty())
|
||||
creator.generator(generator);
|
||||
return creator;
|
||||
}
|
||||
}
|
@ -1,184 +1,184 @@
|
||||
package de.butzlabben.world.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.file.Files;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import de.butzlabben.world.WorldSystem;
|
||||
import de.butzlabben.world.wrapper.SystemWorld;
|
||||
|
||||
public class SettingsConfig {
|
||||
|
||||
private static HashMap<String, Long> borderSizes = new HashMap<>();
|
||||
|
||||
private static File file;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void editWorld(World w) {
|
||||
YamlConfiguration cfg = getConfig();
|
||||
|
||||
SystemWorld sw = SystemWorld.getSystemWorld(w.getName());
|
||||
|
||||
boolean shouldChange = cfg.getBoolean("worldborder.should_change", false);
|
||||
if (shouldChange) {
|
||||
long size = cfg.getLong("worldborder.normal", 1000);
|
||||
if (sw != null && sw.isLoaded()) {
|
||||
String worldname = w.getName();
|
||||
UUID uuid = UUID.fromString(worldname.substring(worldname.length() - 36));
|
||||
Player p = Bukkit.getPlayer(uuid);
|
||||
if (p != null && p.isOnline()) {
|
||||
for (String string : borderSizes.keySet()) {
|
||||
if (p.hasPermission(string) && size < borderSizes.get(string)) {
|
||||
size = borderSizes.get(string);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
w.getWorldBorder().setSize(size);
|
||||
|
||||
if (cfg.getBoolean("worldborder.center.as_spawn", true)) {
|
||||
if (PluginConfig.useWorldSpawn()) {
|
||||
w.getWorldBorder().setCenter(PluginConfig.getWorldSpawn(w));
|
||||
} else {
|
||||
w.getWorldBorder().setCenter(w.getSpawnLocation());
|
||||
}
|
||||
} else {
|
||||
Location loc = new Location(w, cfg.getDouble("worldborder.center.x", 0),
|
||||
cfg.getDouble("worldborder.center.y", 20), cfg.getDouble("worldborder.center.z", 0));
|
||||
w.getWorldBorder().setCenter(loc);
|
||||
}
|
||||
if (cfg.getBoolean("worldborder.center.as_home")) {
|
||||
WorldConfig config = WorldConfig.getWorldConfig(w.getName());
|
||||
if (config.getHome() != null)
|
||||
w.getWorldBorder().setCenter(config.getHome());
|
||||
}
|
||||
}
|
||||
|
||||
if (w.isGameRule("announceAdvancements"))
|
||||
w.setGameRuleValue("announceAdvancements", cfg.getString("announceAdvancements"));
|
||||
|
||||
if (w.isGameRule("commandBlockOutput"))
|
||||
w.setGameRuleValue("commandBlockOutput", cfg.getString("commandBlockOutput"));
|
||||
|
||||
if (w.isGameRule("disableElytraMovementCheck"))
|
||||
w.setGameRuleValue("disableElytraMovementCheck", cfg.getString("disableElytraMovementCheck"));
|
||||
|
||||
if (w.isGameRule("doDaylightCycle"))
|
||||
w.setGameRuleValue("doDaylightCycle", cfg.getString("doDaylightCycle"));
|
||||
|
||||
if (w.isGameRule("doEntityDrops"))
|
||||
w.setGameRuleValue("doEntityDrops", cfg.getString("doEntityDrops"));
|
||||
|
||||
if (w.isGameRule("doFireTick"))
|
||||
w.setGameRuleValue("doFireTick", cfg.getString("doFireTick"));
|
||||
|
||||
if (w.isGameRule("doLimitedCrafting"))
|
||||
w.setGameRuleValue("doLimitedCrafting", cfg.getString("doLimitedCrafting"));
|
||||
|
||||
if (w.isGameRule("doMobLoot"))
|
||||
w.setGameRuleValue("doMobLoot", cfg.getString("doMobLoot"));
|
||||
|
||||
if (w.isGameRule("doMobSpawning"))
|
||||
w.setGameRuleValue("doMobSpawning", cfg.getString("doMobSpawning"));
|
||||
|
||||
if (w.isGameRule("doTileDrops"))
|
||||
w.setGameRuleValue("doTileDrops", cfg.getString("doTileDrops"));
|
||||
|
||||
if (w.isGameRule("doWeatherCycle"))
|
||||
w.setGameRuleValue("doWeatherCycle", cfg.getString("doWeatherCycle"));
|
||||
|
||||
if (w.isGameRule("gameLoopFunction"))
|
||||
w.setGameRuleValue("gameLoopFunction", cfg.getString("gameLoopFunction"));
|
||||
|
||||
if (w.isGameRule("keepInventory"))
|
||||
w.setGameRuleValue("keepInventory", cfg.getString("keepInventory"));
|
||||
|
||||
if (w.isGameRule("logAdminCommands"))
|
||||
w.setGameRuleValue("logAdminCommands", cfg.getString("logAdminCommands"));
|
||||
|
||||
if (w.isGameRule("maxCommandChainLength"))
|
||||
w.setGameRuleValue("maxCommandChainLength", cfg.getString("maxCommandChainLength"));
|
||||
|
||||
if (w.isGameRule("maxEntityCramming"))
|
||||
w.setGameRuleValue("maxEntityCramming", cfg.getString("maxEntityCramming"));
|
||||
|
||||
if (w.isGameRule("mobGriefing"))
|
||||
w.setGameRuleValue("mobGriefing", cfg.getString("mobGriefing"));
|
||||
|
||||
if (w.isGameRule("naturalRegeneration"))
|
||||
w.setGameRuleValue("naturalRegeneration", cfg.getString("naturalRegeneration"));
|
||||
|
||||
if (w.isGameRule("randomTickSpeed"))
|
||||
w.setGameRuleValue("randomTickSpeed", cfg.getString("randomTickSpeed"));
|
||||
|
||||
if (w.isGameRule("reducedDebugInfo"))
|
||||
w.setGameRuleValue("reducedDebugInfo", cfg.getString("reducedDebugInfo"));
|
||||
|
||||
if (w.isGameRule("sendCommandFeedback"))
|
||||
w.setGameRuleValue("sendCommandFeedback", cfg.getString("sendCommandFeedback"));
|
||||
|
||||
if (w.isGameRule("showDeathMessages"))
|
||||
w.setGameRuleValue("showDeathMessages", cfg.getString("showDeathMessages"));
|
||||
|
||||
if (w.isGameRule("spawnRadius"))
|
||||
w.setGameRuleValue("spawnRadius", cfg.getString("spawnRadius"));
|
||||
|
||||
if (w.isGameRule("spectatorsGenerateChunks"))
|
||||
w.setGameRuleValue("spectatorsGenerateChunks", cfg.getString("spectatorsGenerateChunks"));
|
||||
}
|
||||
|
||||
private static YamlConfiguration getConfig() {
|
||||
try {
|
||||
return YamlConfiguration
|
||||
.loadConfiguration(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8")));
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void checkConfig() {
|
||||
File file = new File(WorldSystem.getInstance().getDataFolder(), "settings.yml");
|
||||
SettingsConfig.file = file;
|
||||
if (!file.exists()) {
|
||||
try {
|
||||
InputStream in = JavaPlugin.getPlugin(WorldSystem.class).getResource("settings.yml");
|
||||
Files.copy(in, file.toPath());
|
||||
} catch (IOException e) {
|
||||
System.err.println("Wasn't able to create Config");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
YamlConfiguration cfg = getConfig();
|
||||
for (String s : cfg.getConfigurationSection("worldborder.ranks").getKeys(true)) {
|
||||
if (cfg.isInt("worldborder.ranks." + s) || cfg.isLong("worldborder.ranks." + s))
|
||||
borderSizes.put(s, cfg.getLong("worldborder.ranks." + s));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @return the commands specified in settings.yml on /ws get
|
||||
*/
|
||||
public static List<String> getCommandsonGet() {
|
||||
YamlConfiguration cfg = getConfig();
|
||||
return cfg.getStringList("commands_on_get");
|
||||
}
|
||||
|
||||
private SettingsConfig() {
|
||||
}
|
||||
}
|
||||
package de.butzlabben.world.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.file.Files;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import de.butzlabben.world.WorldSystem;
|
||||
import de.butzlabben.world.wrapper.SystemWorld;
|
||||
|
||||
public class SettingsConfig {
|
||||
|
||||
private static HashMap<String, Long> borderSizes = new HashMap<>();
|
||||
|
||||
private static File file;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void editWorld(World w) {
|
||||
YamlConfiguration cfg = getConfig();
|
||||
|
||||
SystemWorld sw = SystemWorld.getSystemWorld(w.getName());
|
||||
|
||||
boolean shouldChange = cfg.getBoolean("worldborder.should_change", false);
|
||||
if (shouldChange) {
|
||||
long size = cfg.getLong("worldborder.normal", 1000);
|
||||
if (sw != null && sw.isLoaded()) {
|
||||
String worldname = w.getName();
|
||||
UUID uuid = UUID.fromString(worldname.substring(worldname.length() - 36));
|
||||
Player p = Bukkit.getPlayer(uuid);
|
||||
if (p != null && p.isOnline()) {
|
||||
for (String string : borderSizes.keySet()) {
|
||||
if (p.hasPermission(string) && size < borderSizes.get(string)) {
|
||||
size = borderSizes.get(string);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
w.getWorldBorder().setSize(size);
|
||||
|
||||
if (cfg.getBoolean("worldborder.center.as_spawn", true)) {
|
||||
if (PluginConfig.useWorldSpawn()) {
|
||||
w.getWorldBorder().setCenter(PluginConfig.getWorldSpawn(w));
|
||||
} else {
|
||||
w.getWorldBorder().setCenter(w.getSpawnLocation());
|
||||
}
|
||||
} else {
|
||||
Location loc = new Location(w, cfg.getDouble("worldborder.center.x", 0),
|
||||
cfg.getDouble("worldborder.center.y", 20), cfg.getDouble("worldborder.center.z", 0));
|
||||
w.getWorldBorder().setCenter(loc);
|
||||
}
|
||||
if (cfg.getBoolean("worldborder.center.as_home")) {
|
||||
WorldConfig config = WorldConfig.getWorldConfig(w.getName());
|
||||
if (config.getHome() != null)
|
||||
w.getWorldBorder().setCenter(config.getHome());
|
||||
}
|
||||
}
|
||||
|
||||
if (w.isGameRule("announceAdvancements"))
|
||||
w.setGameRuleValue("announceAdvancements", cfg.getString("announceAdvancements"));
|
||||
|
||||
if (w.isGameRule("commandBlockOutput"))
|
||||
w.setGameRuleValue("commandBlockOutput", cfg.getString("commandBlockOutput"));
|
||||
|
||||
if (w.isGameRule("disableElytraMovementCheck"))
|
||||
w.setGameRuleValue("disableElytraMovementCheck", cfg.getString("disableElytraMovementCheck"));
|
||||
|
||||
if (w.isGameRule("doDaylightCycle"))
|
||||
w.setGameRuleValue("doDaylightCycle", cfg.getString("doDaylightCycle"));
|
||||
|
||||
if (w.isGameRule("doEntityDrops"))
|
||||
w.setGameRuleValue("doEntityDrops", cfg.getString("doEntityDrops"));
|
||||
|
||||
if (w.isGameRule("doFireTick"))
|
||||
w.setGameRuleValue("doFireTick", cfg.getString("doFireTick"));
|
||||
|
||||
if (w.isGameRule("doLimitedCrafting"))
|
||||
w.setGameRuleValue("doLimitedCrafting", cfg.getString("doLimitedCrafting"));
|
||||
|
||||
if (w.isGameRule("doMobLoot"))
|
||||
w.setGameRuleValue("doMobLoot", cfg.getString("doMobLoot"));
|
||||
|
||||
if (w.isGameRule("doMobSpawning"))
|
||||
w.setGameRuleValue("doMobSpawning", cfg.getString("doMobSpawning"));
|
||||
|
||||
if (w.isGameRule("doTileDrops"))
|
||||
w.setGameRuleValue("doTileDrops", cfg.getString("doTileDrops"));
|
||||
|
||||
if (w.isGameRule("doWeatherCycle"))
|
||||
w.setGameRuleValue("doWeatherCycle", cfg.getString("doWeatherCycle"));
|
||||
|
||||
if (w.isGameRule("gameLoopFunction"))
|
||||
w.setGameRuleValue("gameLoopFunction", cfg.getString("gameLoopFunction"));
|
||||
|
||||
if (w.isGameRule("keepInventory"))
|
||||
w.setGameRuleValue("keepInventory", cfg.getString("keepInventory"));
|
||||
|
||||
if (w.isGameRule("logAdminCommands"))
|
||||
w.setGameRuleValue("logAdminCommands", cfg.getString("logAdminCommands"));
|
||||
|
||||
if (w.isGameRule("maxCommandChainLength"))
|
||||
w.setGameRuleValue("maxCommandChainLength", cfg.getString("maxCommandChainLength"));
|
||||
|
||||
if (w.isGameRule("maxEntityCramming"))
|
||||
w.setGameRuleValue("maxEntityCramming", cfg.getString("maxEntityCramming"));
|
||||
|
||||
if (w.isGameRule("mobGriefing"))
|
||||
w.setGameRuleValue("mobGriefing", cfg.getString("mobGriefing"));
|
||||
|
||||
if (w.isGameRule("naturalRegeneration"))
|
||||
w.setGameRuleValue("naturalRegeneration", cfg.getString("naturalRegeneration"));
|
||||
|
||||
if (w.isGameRule("randomTickSpeed"))
|
||||
w.setGameRuleValue("randomTickSpeed", cfg.getString("randomTickSpeed"));
|
||||
|
||||
if (w.isGameRule("reducedDebugInfo"))
|
||||
w.setGameRuleValue("reducedDebugInfo", cfg.getString("reducedDebugInfo"));
|
||||
|
||||
if (w.isGameRule("sendCommandFeedback"))
|
||||
w.setGameRuleValue("sendCommandFeedback", cfg.getString("sendCommandFeedback"));
|
||||
|
||||
if (w.isGameRule("showDeathMessages"))
|
||||
w.setGameRuleValue("showDeathMessages", cfg.getString("showDeathMessages"));
|
||||
|
||||
if (w.isGameRule("spawnRadius"))
|
||||
w.setGameRuleValue("spawnRadius", cfg.getString("spawnRadius"));
|
||||
|
||||
if (w.isGameRule("spectatorsGenerateChunks"))
|
||||
w.setGameRuleValue("spectatorsGenerateChunks", cfg.getString("spectatorsGenerateChunks"));
|
||||
}
|
||||
|
||||
private static YamlConfiguration getConfig() {
|
||||
try {
|
||||
return YamlConfiguration
|
||||
.loadConfiguration(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8")));
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void checkConfig() {
|
||||
File file = new File(WorldSystem.getInstance().getDataFolder(), "settings.yml");
|
||||
SettingsConfig.file = file;
|
||||
if (!file.exists()) {
|
||||
try {
|
||||
InputStream in = JavaPlugin.getPlugin(WorldSystem.class).getResource("settings.yml");
|
||||
Files.copy(in, file.toPath());
|
||||
} catch (IOException e) {
|
||||
System.err.println("Wasn't able to create Config");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
YamlConfiguration cfg = getConfig();
|
||||
for (String s : cfg.getConfigurationSection("worldborder.ranks").getKeys(true)) {
|
||||
if (cfg.isInt("worldborder.ranks." + s) || cfg.isLong("worldborder.ranks." + s))
|
||||
borderSizes.put(s, cfg.getLong("worldborder.ranks." + s));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @return the commands specified in settings.yml on /ws get
|
||||
*/
|
||||
public static List<String> getCommandsonGet() {
|
||||
YamlConfiguration cfg = getConfig();
|
||||
return cfg.getStringList("commands_on_get");
|
||||
}
|
||||
|
||||
private SettingsConfig() {
|
||||
}
|
||||
}
|
@ -1,53 +1,53 @@
|
||||
package de.butzlabben.world.event;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Event for adding somebody to a world
|
||||
*
|
||||
* @author Butzlabben
|
||||
* @since 09.05.2018
|
||||
*/
|
||||
public class WorldAddmemberEvent extends WorldEvent {
|
||||
|
||||
private final String worldname;
|
||||
private final UUID uuid;
|
||||
private Player adder;
|
||||
|
||||
public WorldAddmemberEvent(UUID uuid, String worldname, Player adder) {
|
||||
this.uuid = uuid;
|
||||
this.worldname = worldname;
|
||||
this.adder = adder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return player who adds somebody
|
||||
*/
|
||||
public Player getAdding() {
|
||||
return adder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return UUID of player who gets added
|
||||
*/
|
||||
public UUID getUUID() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return worldname for which it happens
|
||||
*/
|
||||
public String getWorldname() {
|
||||
return worldname;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public final static HandlerList handlers = new HandlerList();
|
||||
}
|
||||
package de.butzlabben.world.event;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Event for adding somebody to a world
|
||||
*
|
||||
* @author Butzlabben
|
||||
* @since 09.05.2018
|
||||
*/
|
||||
public class WorldAddmemberEvent extends WorldEvent {
|
||||
|
||||
private final String worldname;
|
||||
private final UUID uuid;
|
||||
private Player adder;
|
||||
|
||||
public WorldAddmemberEvent(UUID uuid, String worldname, Player adder) {
|
||||
this.uuid = uuid;
|
||||
this.worldname = worldname;
|
||||
this.adder = adder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return player who adds somebody
|
||||
*/
|
||||
public Player getAdding() {
|
||||
return adder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return UUID of player who gets added
|
||||
*/
|
||||
public UUID getUUID() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return worldname for which it happens
|
||||
*/
|
||||
public String getWorldname() {
|
||||
return worldname;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public final static HandlerList handlers = new HandlerList();
|
||||
}
|
@ -1,53 +1,53 @@
|
||||
package de.butzlabben.world.event;
|
||||
|
||||
import org.bukkit.WorldCreator;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Event if a SystemWorld gets created.
|
||||
* Do mix up with the WorldCreateEvent from Bukkit
|
||||
*
|
||||
* @author Butzlabben
|
||||
* @since 09.05.2018
|
||||
*/
|
||||
public class WorldCreateEvent extends WorldEvent {
|
||||
|
||||
private final Player owner;
|
||||
private WorldCreator worldCreator;
|
||||
|
||||
public WorldCreateEvent(Player owner, WorldCreator creator) {
|
||||
this.owner = owner;
|
||||
this.setWorldCreator(creator);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return owner of world that gets created
|
||||
*/
|
||||
public Player getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
public final static HandlerList handlers = new HandlerList();
|
||||
|
||||
public final static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the worldcreator which will be used
|
||||
*/
|
||||
public WorldCreator getWorldCreator() {
|
||||
return worldCreator;
|
||||
}
|
||||
|
||||
public void setWorldCreator(WorldCreator worldCreator) {
|
||||
this.worldCreator = worldCreator;
|
||||
}
|
||||
|
||||
}
|
||||
package de.butzlabben.world.event;
|
||||
|
||||
import org.bukkit.WorldCreator;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Event if a SystemWorld gets created.
|
||||
* Do mix up with the WorldCreateEvent from Bukkit
|
||||
*
|
||||
* @author Butzlabben
|
||||
* @since 09.05.2018
|
||||
*/
|
||||
public class WorldCreateEvent extends WorldEvent {
|
||||
|
||||
private final Player owner;
|
||||
private WorldCreator worldCreator;
|
||||
|
||||
public WorldCreateEvent(Player owner, WorldCreator creator) {
|
||||
this.owner = owner;
|
||||
this.setWorldCreator(creator);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return owner of world that gets created
|
||||
*/
|
||||
public Player getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
public final static HandlerList handlers = new HandlerList();
|
||||
|
||||
public final static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the worldcreator which will be used
|
||||
*/
|
||||
public WorldCreator getWorldCreator() {
|
||||
return worldCreator;
|
||||
}
|
||||
|
||||
public void setWorldCreator(WorldCreator worldCreator) {
|
||||
this.worldCreator = worldCreator;
|
||||
}
|
||||
|
||||
}
|
@ -1,49 +1,49 @@
|
||||
package de.butzlabben.world.event;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import de.butzlabben.world.wrapper.SystemWorld;
|
||||
|
||||
/**
|
||||
* Event if a systemworld gets deleted
|
||||
*
|
||||
* @author Butzlabben
|
||||
* @since 09.05.2018
|
||||
*/
|
||||
public class WorldDeleteEvent extends WorldEvent {
|
||||
|
||||
private final SystemWorld world;
|
||||
private final CommandSender executor;
|
||||
|
||||
public WorldDeleteEvent(CommandSender executor, SystemWorld world) {
|
||||
this.executor = executor;
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return get the world which will be deleted
|
||||
*/
|
||||
public SystemWorld getWorld() {
|
||||
return world;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return get the executor of the command
|
||||
*/
|
||||
public CommandSender getExecutor() {
|
||||
return executor;
|
||||
}
|
||||
|
||||
public final static HandlerList handlers = new HandlerList();
|
||||
|
||||
public final static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
}
|
||||
package de.butzlabben.world.event;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import de.butzlabben.world.wrapper.SystemWorld;
|
||||
|
||||
/**
|
||||
* Event if a systemworld gets deleted
|
||||
*
|
||||
* @author Butzlabben
|
||||
* @since 09.05.2018
|
||||
*/
|
||||
public class WorldDeleteEvent extends WorldEvent {
|
||||
|
||||
private final SystemWorld world;
|
||||
private final CommandSender executor;
|
||||
|
||||
public WorldDeleteEvent(CommandSender executor, SystemWorld world) {
|
||||
this.executor = executor;
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return get the world which will be deleted
|
||||
*/
|
||||
public SystemWorld getWorld() {
|
||||
return world;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return get the executor of the command
|
||||
*/
|
||||
public CommandSender getExecutor() {
|
||||
return executor;
|
||||
}
|
||||
|
||||
public final static HandlerList handlers = new HandlerList();
|
||||
|
||||
public final static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
}
|
@ -1,27 +1,27 @@
|
||||
package de.butzlabben.world.event;
|
||||
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
|
||||
public abstract class WorldEvent extends Event implements Cancellable {
|
||||
|
||||
private boolean cancelled;
|
||||
|
||||
public WorldEvent() {
|
||||
}
|
||||
|
||||
public WorldEvent(boolean cancel) {
|
||||
setCancelled(cancel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
cancelled = cancel;
|
||||
}
|
||||
|
||||
}
|
||||
package de.butzlabben.world.event;
|
||||
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
|
||||
public abstract class WorldEvent extends Event implements Cancellable {
|
||||
|
||||
private boolean cancelled;
|
||||
|
||||
public WorldEvent() {
|
||||
}
|
||||
|
||||
public WorldEvent(boolean cancel) {
|
||||
setCancelled(cancel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
cancelled = cancel;
|
||||
}
|
||||
|
||||
}
|
@ -1,49 +1,49 @@
|
||||
package de.butzlabben.world.event;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import de.butzlabben.world.wrapper.SystemWorld;
|
||||
|
||||
/**
|
||||
* Event for loading a world
|
||||
*
|
||||
* @author Butzlabben
|
||||
* @since 09.05.2018
|
||||
*/
|
||||
public class WorldLoadEvent extends WorldEvent {
|
||||
|
||||
private final Player owner;
|
||||
private final SystemWorld world;
|
||||
|
||||
public WorldLoadEvent(Player owner, SystemWorld systemWorld) {
|
||||
this.owner = owner;
|
||||
this.world = systemWorld;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return get the world which will be loaded
|
||||
*/
|
||||
public SystemWorld getWorld() {
|
||||
return world;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return get person which intiziated the loading
|
||||
*/
|
||||
public Player getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
public final static HandlerList handlers = new HandlerList();
|
||||
|
||||
public final static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
}
|
||||
package de.butzlabben.world.event;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import de.butzlabben.world.wrapper.SystemWorld;
|
||||
|
||||
/**
|
||||
* Event for loading a world
|
||||
*
|
||||
* @author Butzlabben
|
||||
* @since 09.05.2018
|
||||
*/
|
||||
public class WorldLoadEvent extends WorldEvent {
|
||||
|
||||
private final Player owner;
|
||||
private final SystemWorld world;
|
||||
|
||||
public WorldLoadEvent(Player owner, SystemWorld systemWorld) {
|
||||
this.owner = owner;
|
||||
this.world = systemWorld;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return get the world which will be loaded
|
||||
*/
|
||||
public SystemWorld getWorld() {
|
||||
return world;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return get person which intiziated the loading
|
||||
*/
|
||||
public Player getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
public final static HandlerList handlers = new HandlerList();
|
||||
|
||||
public final static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
}
|
@ -1,52 +1,52 @@
|
||||
package de.butzlabben.world.event;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 09.05.2018
|
||||
*/
|
||||
public class WorldRemovememberEvent extends WorldEvent {
|
||||
|
||||
private final String worldname;
|
||||
private final UUID uuid;
|
||||
private Player remover;
|
||||
|
||||
public WorldRemovememberEvent(UUID uuid, String worldname, Player remover) {
|
||||
this.uuid = uuid;
|
||||
this.worldname = worldname;
|
||||
this.remover = remover;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return player who removes somebody
|
||||
*/
|
||||
public Player getRemoving() {
|
||||
return remover;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return uuid of player who gets removed
|
||||
*/
|
||||
public UUID getUUID() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return worldname for which it happens
|
||||
*/
|
||||
public String getWorldname() {
|
||||
return worldname;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
|
||||
public final static HandlerList handlers = new HandlerList();
|
||||
}
|
||||
package de.butzlabben.world.event;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 09.05.2018
|
||||
*/
|
||||
public class WorldRemovememberEvent extends WorldEvent {
|
||||
|
||||
private final String worldname;
|
||||
private final UUID uuid;
|
||||
private Player remover;
|
||||
|
||||
public WorldRemovememberEvent(UUID uuid, String worldname, Player remover) {
|
||||
this.uuid = uuid;
|
||||
this.worldname = worldname;
|
||||
this.remover = remover;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return player who removes somebody
|
||||
*/
|
||||
public Player getRemoving() {
|
||||
return remover;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return uuid of player who gets removed
|
||||
*/
|
||||
public UUID getUUID() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return worldname for which it happens
|
||||
*/
|
||||
public String getWorldname() {
|
||||
return worldname;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
|
||||
public final static HandlerList handlers = new HandlerList();
|
||||
}
|
@ -1,50 +1,50 @@
|
||||
package de.butzlabben.world.event;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import de.butzlabben.world.wrapper.SystemWorld;
|
||||
|
||||
/**
|
||||
* Event when a world gets reset
|
||||
*
|
||||
* @author Butzlabben
|
||||
* @since 09.05.2018
|
||||
*/
|
||||
public class WorldResetEvent extends WorldEvent {
|
||||
|
||||
private final SystemWorld world;
|
||||
private final CommandSender executor;
|
||||
|
||||
public WorldResetEvent(CommandSender executor, SystemWorld world) {
|
||||
this.executor = executor;
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return world which gets reset
|
||||
*/
|
||||
public SystemWorld getWorld() {
|
||||
return world;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Executor of the command
|
||||
*/
|
||||
public CommandSender getExecutor() {
|
||||
return executor;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public final static HandlerList handlers = new HandlerList();
|
||||
|
||||
public final static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
package de.butzlabben.world.event;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import de.butzlabben.world.wrapper.SystemWorld;
|
||||
|
||||
/**
|
||||
* Event when a world gets reset
|
||||
*
|
||||
* @author Butzlabben
|
||||
* @since 09.05.2018
|
||||
*/
|
||||
public class WorldResetEvent extends WorldEvent {
|
||||
|
||||
private final SystemWorld world;
|
||||
private final CommandSender executor;
|
||||
|
||||
public WorldResetEvent(CommandSender executor, SystemWorld world) {
|
||||
this.executor = executor;
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return world which gets reset
|
||||
*/
|
||||
public SystemWorld getWorld() {
|
||||
return world;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Executor of the command
|
||||
*/
|
||||
public CommandSender getExecutor() {
|
||||
return executor;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public final static HandlerList handlers = new HandlerList();
|
||||
|
||||
public final static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
@ -1,64 +1,64 @@
|
||||
package de.butzlabben.world.event;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import de.butzlabben.world.wrapper.SystemWorld;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 09.05.2018
|
||||
*/
|
||||
public class WorldToggleFireEvent extends WorldEvent {
|
||||
|
||||
private final SystemWorld world;
|
||||
private final CommandSender executor;
|
||||
private boolean value;
|
||||
|
||||
public WorldToggleFireEvent(CommandSender executor, SystemWorld world, boolean value) {
|
||||
this.executor = executor;
|
||||
this.world = world;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return if fire now gets enabled or disabled
|
||||
*/
|
||||
public boolean getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param val if fire should be enabled or disabled
|
||||
*/
|
||||
public void setValue(boolean val) {
|
||||
value = val;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return world get world
|
||||
*/
|
||||
public SystemWorld getWorld() {
|
||||
return world;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return get executor who toggles fire
|
||||
*/
|
||||
public CommandSender getExecutor() {
|
||||
return executor;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public final static HandlerList handlers = new HandlerList();
|
||||
|
||||
public final static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
package de.butzlabben.world.event;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import de.butzlabben.world.wrapper.SystemWorld;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 09.05.2018
|
||||
*/
|
||||
public class WorldToggleFireEvent extends WorldEvent {
|
||||
|
||||
private final SystemWorld world;
|
||||
private final CommandSender executor;
|
||||
private boolean value;
|
||||
|
||||
public WorldToggleFireEvent(CommandSender executor, SystemWorld world, boolean value) {
|
||||
this.executor = executor;
|
||||
this.world = world;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return if fire now gets enabled or disabled
|
||||
*/
|
||||
public boolean getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param val if fire should be enabled or disabled
|
||||
*/
|
||||
public void setValue(boolean val) {
|
||||
value = val;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return world get world
|
||||
*/
|
||||
public SystemWorld getWorld() {
|
||||
return world;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return get executor who toggles fire
|
||||
*/
|
||||
public CommandSender getExecutor() {
|
||||
return executor;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public final static HandlerList handlers = new HandlerList();
|
||||
|
||||
public final static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
@ -1,64 +1,64 @@
|
||||
package de.butzlabben.world.event;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import de.butzlabben.world.wrapper.SystemWorld;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 09.05.2018
|
||||
*/
|
||||
public class WorldToggleTntEvent extends WorldEvent {
|
||||
|
||||
private final SystemWorld world;
|
||||
private final CommandSender executor;
|
||||
private boolean value;
|
||||
|
||||
public WorldToggleTntEvent(CommandSender executor, SystemWorld world, boolean value) {
|
||||
this.executor = executor;
|
||||
this.world = world;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return if tnt now gets enabled or disabled
|
||||
*/
|
||||
public boolean getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param val if tnt should be enabled or disabled
|
||||
*/
|
||||
public void setValue(boolean val) {
|
||||
value = val;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return world get world
|
||||
*/
|
||||
public SystemWorld getWorld() {
|
||||
return world;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return get executor who toggles tnt
|
||||
*/
|
||||
public CommandSender getExecutor() {
|
||||
return executor;
|
||||
}
|
||||
|
||||
|
||||
public final static HandlerList handlers = new HandlerList();
|
||||
|
||||
public final static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
}
|
||||
package de.butzlabben.world.event;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import de.butzlabben.world.wrapper.SystemWorld;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 09.05.2018
|
||||
*/
|
||||
public class WorldToggleTntEvent extends WorldEvent {
|
||||
|
||||
private final SystemWorld world;
|
||||
private final CommandSender executor;
|
||||
private boolean value;
|
||||
|
||||
public WorldToggleTntEvent(CommandSender executor, SystemWorld world, boolean value) {
|
||||
this.executor = executor;
|
||||
this.world = world;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return if tnt now gets enabled or disabled
|
||||
*/
|
||||
public boolean getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param val if tnt should be enabled or disabled
|
||||
*/
|
||||
public void setValue(boolean val) {
|
||||
value = val;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return world get world
|
||||
*/
|
||||
public SystemWorld getWorld() {
|
||||
return world;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return get executor who toggles tnt
|
||||
*/
|
||||
public CommandSender getExecutor() {
|
||||
return executor;
|
||||
}
|
||||
|
||||
|
||||
public final static HandlerList handlers = new HandlerList();
|
||||
|
||||
public final static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
}
|
@ -1,37 +1,37 @@
|
||||
package de.butzlabben.world.event;
|
||||
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import de.butzlabben.world.wrapper.SystemWorld;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 09.05.2018
|
||||
*/
|
||||
public class WorldUnloadEvent extends WorldEvent {
|
||||
|
||||
private final SystemWorld world;
|
||||
|
||||
public WorldUnloadEvent(SystemWorld world) {
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return world which gets unloaded
|
||||
*/
|
||||
public SystemWorld getWorld() {
|
||||
return world;
|
||||
}
|
||||
|
||||
public final static HandlerList handlers = new HandlerList();
|
||||
|
||||
public final static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
}
|
||||
package de.butzlabben.world.event;
|
||||
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import de.butzlabben.world.wrapper.SystemWorld;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 09.05.2018
|
||||
*/
|
||||
public class WorldUnloadEvent extends WorldEvent {
|
||||
|
||||
private final SystemWorld world;
|
||||
|
||||
public WorldUnloadEvent(SystemWorld world) {
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return world which gets unloaded
|
||||
*/
|
||||
public SystemWorld getWorld() {
|
||||
return world;
|
||||
}
|
||||
|
||||
public final static HandlerList handlers = new HandlerList();
|
||||
|
||||
public final static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
}
|
@ -1,32 +1,32 @@
|
||||
package de.butzlabben.world.gui;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import de.butzlabben.world.config.MessageConfig;
|
||||
import de.butzlabben.world.wrapper.WorldPlayer;
|
||||
|
||||
public class GuiCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (sender instanceof Player == false) {
|
||||
sender.sendMessage("You are not a player");
|
||||
return true;
|
||||
}
|
||||
WorldPlayer wp = new WorldPlayer((Player) sender);
|
||||
if (!wp.isOnSystemWorld()) {
|
||||
sender.sendMessage(MessageConfig.getNotOnWorld());
|
||||
return true;
|
||||
}
|
||||
if (!wp.isOwnerofWorld()) {
|
||||
sender.sendMessage(MessageConfig.getNoPermission());
|
||||
return true;
|
||||
}
|
||||
((Player) sender).openInventory(new WorldSystemGUI().getInventory((Player) sender));
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
package de.butzlabben.world.gui;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import de.butzlabben.world.config.MessageConfig;
|
||||
import de.butzlabben.world.wrapper.WorldPlayer;
|
||||
|
||||
public class GuiCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (sender instanceof Player == false) {
|
||||
sender.sendMessage("You are not a player");
|
||||
return true;
|
||||
}
|
||||
WorldPlayer wp = new WorldPlayer((Player) sender);
|
||||
if (!wp.isOnSystemWorld()) {
|
||||
sender.sendMessage(MessageConfig.getNotOnWorld());
|
||||
return true;
|
||||
}
|
||||
if (!wp.isOwnerofWorld()) {
|
||||
sender.sendMessage(MessageConfig.getNoPermission());
|
||||
return true;
|
||||
}
|
||||
((Player) sender).openInventory(new WorldSystemGUI().getInventory((Player) sender));
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -1,91 +1,91 @@
|
||||
package de.butzlabben.world.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
import de.butzlabben.inventory.OrcItem;
|
||||
import de.butzlabben.inventory.pages.PageGUICreator;
|
||||
import de.butzlabben.world.config.GuiConfig;
|
||||
import de.butzlabben.world.config.MessageConfig;
|
||||
import de.butzlabben.world.config.WorldConfig;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 20.04.2018
|
||||
*/
|
||||
public class PlayersPageGUI {
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void openGUI(Player p) {
|
||||
WorldConfig config = WorldConfig.getWorldConfig(p.getWorld().getName());
|
||||
|
||||
HashMap<UUID, String> members = config.getMembersWithNames();
|
||||
|
||||
if (members.size() == 0) {
|
||||
p.sendMessage(MessageConfig.getNoMemberAdded());
|
||||
return;
|
||||
}
|
||||
|
||||
PageGUICreator<Entry<UUID, String>> creator = new PageGUICreator<>(GuiConfig.getRows("options.players"));
|
||||
|
||||
creator.create(GuiConfig.getTitle(GuiConfig.getConfig(), "options.players"), members.entrySet(), (entry) -> {
|
||||
String name = entry.getValue();
|
||||
OrcItem oi = new OrcItem(GuiConfig.getSkullItem(), GuiConfig
|
||||
.getDisplay(GuiConfig.getConfig(), "options.players.playerhead").replaceAll("%player", name));
|
||||
SkullMeta sm = (SkullMeta) oi.getItemStack().getItemMeta();
|
||||
sm.setOwner(name);
|
||||
oi.getItemStack().setItemMeta(sm);
|
||||
oi.setOnClick((player, inv, item) -> {
|
||||
player.closeInventory();
|
||||
PlayerOptionsGUI gui = new PlayerOptionsGUI(player, name, entry.getKey());
|
||||
player.openInventory(gui.getInventory(p));
|
||||
});
|
||||
return oi;
|
||||
});
|
||||
|
||||
if (GuiConfig.isEnabled("options.players.back")) {
|
||||
OrcItem back = OrcItem.back.clone();
|
||||
back.setOnClick((player, inv, i) -> {
|
||||
player.closeInventory();
|
||||
player.openInventory(new WorldSystemGUI().getInventory(p));
|
||||
});
|
||||
creator.getInvPages().forEach((oi) -> {oi.addItem(GuiConfig.getSlot("options.players.back"), back);});
|
||||
}
|
||||
|
||||
creator.show(p);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void preloadPlayers(WorldConfig config) {
|
||||
new Thread(() -> {
|
||||
int headsPerInv = GuiConfig.getRows("options.players") * 9;
|
||||
HashMap<UUID, String> members = config.getMembersWithNames();
|
||||
if (members == null || members.size() == 0)
|
||||
return;
|
||||
int pages = Math.round(members.size() / headsPerInv) < 1 ? 1 : Math.round(members.size() / headsPerInv);
|
||||
for (int page = 0; page < pages; page++) {
|
||||
int startPos = pages == 1 ? 0 : headsPerInv * (page - 1);
|
||||
int length = pages == 1 ? members.size() : headsPerInv;
|
||||
|
||||
ArrayList<UUID> list = new ArrayList<>(members.keySet());
|
||||
|
||||
Inventory inv = Bukkit.createInventory(null, headsPerInv);
|
||||
for (int i = startPos; i < startPos + length; i++) {
|
||||
String name = members.get(list.get(i));
|
||||
ItemStack is = new ItemStack(GuiConfig.getSkullItem(), 1, (short) 3);
|
||||
SkullMeta sm = (SkullMeta) is.getItemMeta();
|
||||
sm.setOwner(name);
|
||||
is.setItemMeta(sm);
|
||||
inv.addItem(is);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
package de.butzlabben.world.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
import de.butzlabben.inventory.OrcItem;
|
||||
import de.butzlabben.inventory.pages.PageGUICreator;
|
||||
import de.butzlabben.world.config.GuiConfig;
|
||||
import de.butzlabben.world.config.MessageConfig;
|
||||
import de.butzlabben.world.config.WorldConfig;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 20.04.2018
|
||||
*/
|
||||
public class PlayersPageGUI {
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void openGUI(Player p) {
|
||||
WorldConfig config = WorldConfig.getWorldConfig(p.getWorld().getName());
|
||||
|
||||
HashMap<UUID, String> members = config.getMembersWithNames();
|
||||
|
||||
if (members.size() == 0) {
|
||||
p.sendMessage(MessageConfig.getNoMemberAdded());
|
||||
return;
|
||||
}
|
||||
|
||||
PageGUICreator<Entry<UUID, String>> creator = new PageGUICreator<>(GuiConfig.getRows("options.players"));
|
||||
|
||||
creator.create(GuiConfig.getTitle(GuiConfig.getConfig(), "options.players"), members.entrySet(), (entry) -> {
|
||||
String name = entry.getValue();
|
||||
OrcItem oi = new OrcItem(GuiConfig.getSkullItem(), GuiConfig
|
||||
.getDisplay(GuiConfig.getConfig(), "options.players.playerhead").replaceAll("%player", name));
|
||||
SkullMeta sm = (SkullMeta) oi.getItemStack().getItemMeta();
|
||||
sm.setOwner(name);
|
||||
oi.getItemStack().setItemMeta(sm);
|
||||
oi.setOnClick((player, inv, item) -> {
|
||||
player.closeInventory();
|
||||
PlayerOptionsGUI gui = new PlayerOptionsGUI(player, name, entry.getKey());
|
||||
player.openInventory(gui.getInventory(p));
|
||||
});
|
||||
return oi;
|
||||
});
|
||||
|
||||
if (GuiConfig.isEnabled("options.players.back")) {
|
||||
OrcItem back = OrcItem.back.clone();
|
||||
back.setOnClick((player, inv, i) -> {
|
||||
player.closeInventory();
|
||||
player.openInventory(new WorldSystemGUI().getInventory(p));
|
||||
});
|
||||
creator.getInvPages().forEach((oi) -> {oi.addItem(GuiConfig.getSlot("options.players.back"), back);});
|
||||
}
|
||||
|
||||
creator.show(p);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void preloadPlayers(WorldConfig config) {
|
||||
new Thread(() -> {
|
||||
int headsPerInv = GuiConfig.getRows("options.players") * 9;
|
||||
HashMap<UUID, String> members = config.getMembersWithNames();
|
||||
if (members == null || members.size() == 0)
|
||||
return;
|
||||
int pages = Math.round(members.size() / headsPerInv) < 1 ? 1 : Math.round(members.size() / headsPerInv);
|
||||
for (int page = 0; page < pages; page++) {
|
||||
int startPos = pages == 1 ? 0 : headsPerInv * (page - 1);
|
||||
int length = pages == 1 ? members.size() : headsPerInv;
|
||||
|
||||
ArrayList<UUID> list = new ArrayList<>(members.keySet());
|
||||
|
||||
Inventory inv = Bukkit.createInventory(null, headsPerInv);
|
||||
for (int i = startPos; i < startPos + length; i++) {
|
||||
String name = members.get(list.get(i));
|
||||
ItemStack is = new ItemStack(GuiConfig.getSkullItem(), 1, (short) 3);
|
||||
SkullMeta sm = (SkullMeta) is.getItemMeta();
|
||||
sm.setOwner(name);
|
||||
is.setItemMeta(sm);
|
||||
inv.addItem(is);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}
|
@ -1,70 +1,70 @@
|
||||
package de.butzlabben.world.gui;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import de.butzlabben.inventory.OrcClickListener;
|
||||
import de.butzlabben.inventory.OrcInventory;
|
||||
import de.butzlabben.inventory.OrcItem;
|
||||
import de.butzlabben.world.config.GuiConfig;
|
||||
import de.butzlabben.world.wrapper.WorldTemplate;
|
||||
import de.butzlabben.world.wrapper.WorldTemplateProvider;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 15.12.2018
|
||||
*/
|
||||
public class WorldChooseGUI extends OrcInventory {
|
||||
|
||||
private final static String path = "worldchoose.";
|
||||
|
||||
public WorldChooseGUI() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public WorldChooseGUI(Consumer<WorldTemplate> onClick) {
|
||||
super(GuiConfig.getTitle(GuiConfig.getConfig(), "worldchoose"), GuiConfig.getRows("worldchoose"),
|
||||
GuiConfig.isFill("worldchoose"));
|
||||
|
||||
for (WorldTemplate template : WorldTemplateProvider.getInstace().getTemplates()) {
|
||||
OrcItem icon = template.getIcon();
|
||||
if(onClick != null)
|
||||
icon.setOnClick((p, inv, item) -> {
|
||||
p.closeInventory();
|
||||
onClick.accept(template);
|
||||
});
|
||||
int slot = template.getSlot();
|
||||
addItem(slot, icon);
|
||||
}
|
||||
|
||||
if (GuiConfig.isEnabled(path + "back")) {
|
||||
OrcItem back = OrcItem.back.clone();
|
||||
back.setOnClick((p, inv, item) -> {
|
||||
p.closeInventory();
|
||||
});
|
||||
addItem(GuiConfig.getSlot(path + "back"), back);
|
||||
}
|
||||
}
|
||||
|
||||
public static void letChoose(Player player, Consumer<WorldTemplate> template) {
|
||||
player.openInventory(new WorldChooseGUI(template).getInventory(player));
|
||||
}
|
||||
|
||||
public void loadItem(String subpath, OrcClickListener listener) {
|
||||
if (GuiConfig.isEnabled(path + subpath) == false)
|
||||
return;
|
||||
OrcItem item = GuiConfig.getItem(path + subpath);
|
||||
if (item != null) {
|
||||
item.setOnClick(listener);
|
||||
addItem(GuiConfig.getSlot(path + subpath), item);
|
||||
}
|
||||
}
|
||||
|
||||
public void loadItem(String subpath) {
|
||||
loadItem(subpath, null);
|
||||
}
|
||||
|
||||
public boolean canOpen(Player p) {
|
||||
return true;
|
||||
}
|
||||
package de.butzlabben.world.gui;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import de.butzlabben.inventory.OrcClickListener;
|
||||
import de.butzlabben.inventory.OrcInventory;
|
||||
import de.butzlabben.inventory.OrcItem;
|
||||
import de.butzlabben.world.config.GuiConfig;
|
||||
import de.butzlabben.world.wrapper.WorldTemplate;
|
||||
import de.butzlabben.world.wrapper.WorldTemplateProvider;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 15.12.2018
|
||||
*/
|
||||
public class WorldChooseGUI extends OrcInventory {
|
||||
|
||||
private final static String path = "worldchoose.";
|
||||
|
||||
public WorldChooseGUI() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public WorldChooseGUI(Consumer<WorldTemplate> onClick) {
|
||||
super(GuiConfig.getTitle(GuiConfig.getConfig(), "worldchoose"), GuiConfig.getRows("worldchoose"),
|
||||
GuiConfig.isFill("worldchoose"));
|
||||
|
||||
for (WorldTemplate template : WorldTemplateProvider.getInstace().getTemplates()) {
|
||||
OrcItem icon = template.getIcon();
|
||||
if(onClick != null)
|
||||
icon.setOnClick((p, inv, item) -> {
|
||||
p.closeInventory();
|
||||
onClick.accept(template);
|
||||
});
|
||||
int slot = template.getSlot();
|
||||
addItem(slot, icon);
|
||||
}
|
||||
|
||||
if (GuiConfig.isEnabled(path + "back")) {
|
||||
OrcItem back = OrcItem.back.clone();
|
||||
back.setOnClick((p, inv, item) -> {
|
||||
p.closeInventory();
|
||||
});
|
||||
addItem(GuiConfig.getSlot(path + "back"), back);
|
||||
}
|
||||
}
|
||||
|
||||
public static void letChoose(Player player, Consumer<WorldTemplate> template) {
|
||||
player.openInventory(new WorldChooseGUI(template).getInventory(player));
|
||||
}
|
||||
|
||||
public void loadItem(String subpath, OrcClickListener listener) {
|
||||
if (GuiConfig.isEnabled(path + subpath) == false)
|
||||
return;
|
||||
OrcItem item = GuiConfig.getItem(path + subpath);
|
||||
if (item != null) {
|
||||
item.setOnClick(listener);
|
||||
addItem(GuiConfig.getSlot(path + subpath), item);
|
||||
}
|
||||
}
|
||||
|
||||
public void loadItem(String subpath) {
|
||||
loadItem(subpath, null);
|
||||
}
|
||||
|
||||
public boolean canOpen(Player p) {
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,100 +1,100 @@
|
||||
package de.butzlabben.world.gui;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
import de.butzlabben.inventory.DependListener;
|
||||
import de.butzlabben.inventory.OrcInventory;
|
||||
import de.butzlabben.inventory.OrcItem;
|
||||
import de.butzlabben.world.config.GuiConfig;
|
||||
import de.butzlabben.world.gui.clicklistener.ComingSoonClickListener;
|
||||
import de.butzlabben.world.gui.clicklistener.CommandExecutorClickListener;
|
||||
import de.butzlabben.world.gui.worldoption.FireStatus;
|
||||
import de.butzlabben.world.gui.worldoption.TntStatus;
|
||||
import de.butzlabben.world.wrapper.WorldPlayer;
|
||||
|
||||
public class WorldOptionsGUI extends OrcInventory {
|
||||
|
||||
private final static String path = "options.world.";
|
||||
|
||||
public final static HashMap<UUID, String> data = new HashMap<>();
|
||||
|
||||
public WorldOptionsGUI() {
|
||||
super(GuiConfig.getTitle(GuiConfig.getConfig(), "options.world"), GuiConfig.getRows("options.world"), GuiConfig.isFill("options.world"));
|
||||
|
||||
loadItem("fire", "/ws fire", true, new FireStatus());
|
||||
loadItem("tnt", "/ws tnt", true, new TntStatus());
|
||||
|
||||
if (GuiConfig.isEnabled(path + "reset") == false)
|
||||
return;
|
||||
|
||||
OrcItem item = GuiConfig.getItem(path + "reset");
|
||||
if (item != null) {
|
||||
item.setOnClick((p, inv, i) -> {
|
||||
p.closeInventory();
|
||||
p.chat("/ws reset");
|
||||
});
|
||||
addItem(GuiConfig.getSlot(path + "reset"), item);
|
||||
}
|
||||
|
||||
if (GuiConfig.isEnabled(path + "back")) {
|
||||
OrcItem back = OrcItem.back.clone();
|
||||
back.setOnClick((p, inv, i) -> {
|
||||
p.closeInventory();
|
||||
p.openInventory(new WorldSystemGUI().getInventory(p));
|
||||
});
|
||||
addItem(GuiConfig.getSlot(path + "back"), back);
|
||||
}
|
||||
}
|
||||
|
||||
public void loadItem(String subpath, String message, boolean state, DependListener depend) {
|
||||
if (GuiConfig.isEnabled(path + subpath) == false)
|
||||
return;
|
||||
OrcItem item = GuiConfig.getItem(path + subpath);
|
||||
if (item != null) {
|
||||
if (message == null) {
|
||||
item.setOnClick(new ComingSoonClickListener());
|
||||
} else {
|
||||
item.setOnClick(new CommandExecutorClickListener(message));
|
||||
}
|
||||
if (state) {
|
||||
if (depend == null) {
|
||||
addItem(GuiConfig.getState(path + subpath), OrcItem.coming_soon.clone());
|
||||
} else {
|
||||
addItem(GuiConfig.getState(path + subpath), OrcItem.disabled.clone().setDepend(depend));
|
||||
}
|
||||
}
|
||||
addItem(GuiConfig.getSlot(path + subpath), item);
|
||||
}
|
||||
}
|
||||
|
||||
public void loadItem(String subpath, String message, boolean state) {
|
||||
loadItem(subpath, message, state, null);
|
||||
}
|
||||
|
||||
public void loadItem(String subpath, boolean state) {
|
||||
loadItem(subpath, null, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Inventory getInventory(Player p, String title) {
|
||||
if (data.containsKey(p.getUniqueId()))
|
||||
return super.getInventory(p, title.replaceAll("%data", data.get(p.getUniqueId())));
|
||||
return super.getInventory(p, title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Inventory getInventory(Player p) {
|
||||
if (data.containsKey(p.getUniqueId()))
|
||||
return super.getInventory(p, getTitle().replaceAll("%data", data.get(p.getUniqueId())));
|
||||
return super.getInventory(p, getTitle());
|
||||
}
|
||||
|
||||
public boolean canOpen(Player p) {
|
||||
return new WorldPlayer(p).isOwnerofWorld();
|
||||
}
|
||||
|
||||
}
|
||||
package de.butzlabben.world.gui;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
import de.butzlabben.inventory.DependListener;
|
||||
import de.butzlabben.inventory.OrcInventory;
|
||||
import de.butzlabben.inventory.OrcItem;
|
||||
import de.butzlabben.world.config.GuiConfig;
|
||||
import de.butzlabben.world.gui.clicklistener.ComingSoonClickListener;
|
||||
import de.butzlabben.world.gui.clicklistener.CommandExecutorClickListener;
|
||||
import de.butzlabben.world.gui.worldoption.FireStatus;
|
||||
import de.butzlabben.world.gui.worldoption.TntStatus;
|
||||
import de.butzlabben.world.wrapper.WorldPlayer;
|
||||
|
||||
public class WorldOptionsGUI extends OrcInventory {
|
||||
|
||||
private final static String path = "options.world.";
|
||||
|
||||
public final static HashMap<UUID, String> data = new HashMap<>();
|
||||
|
||||
public WorldOptionsGUI() {
|
||||
super(GuiConfig.getTitle(GuiConfig.getConfig(), "options.world"), GuiConfig.getRows("options.world"), GuiConfig.isFill("options.world"));
|
||||
|
||||
loadItem("fire", "/ws fire", true, new FireStatus());
|
||||
loadItem("tnt", "/ws tnt", true, new TntStatus());
|
||||
|
||||
if (GuiConfig.isEnabled(path + "reset") == false)
|
||||
return;
|
||||
|
||||
OrcItem item = GuiConfig.getItem(path + "reset");
|
||||
if (item != null) {
|
||||
item.setOnClick((p, inv, i) -> {
|
||||
p.closeInventory();
|
||||
p.chat("/ws reset");
|
||||
});
|
||||
addItem(GuiConfig.getSlot(path + "reset"), item);
|
||||
}
|
||||
|
||||
if (GuiConfig.isEnabled(path + "back")) {
|
||||
OrcItem back = OrcItem.back.clone();
|
||||
back.setOnClick((p, inv, i) -> {
|
||||
p.closeInventory();
|
||||
p.openInventory(new WorldSystemGUI().getInventory(p));
|
||||
});
|
||||
addItem(GuiConfig.getSlot(path + "back"), back);
|
||||
}
|
||||
}
|
||||
|
||||
public void loadItem(String subpath, String message, boolean state, DependListener depend) {
|
||||
if (GuiConfig.isEnabled(path + subpath) == false)
|
||||
return;
|
||||
OrcItem item = GuiConfig.getItem(path + subpath);
|
||||
if (item != null) {
|
||||
if (message == null) {
|
||||
item.setOnClick(new ComingSoonClickListener());
|
||||
} else {
|
||||
item.setOnClick(new CommandExecutorClickListener(message));
|
||||
}
|
||||
if (state) {
|
||||
if (depend == null) {
|
||||
addItem(GuiConfig.getState(path + subpath), OrcItem.coming_soon.clone());
|
||||
} else {
|
||||
addItem(GuiConfig.getState(path + subpath), OrcItem.disabled.clone().setDepend(depend));
|
||||
}
|
||||
}
|
||||
addItem(GuiConfig.getSlot(path + subpath), item);
|
||||
}
|
||||
}
|
||||
|
||||
public void loadItem(String subpath, String message, boolean state) {
|
||||
loadItem(subpath, message, state, null);
|
||||
}
|
||||
|
||||
public void loadItem(String subpath, boolean state) {
|
||||
loadItem(subpath, null, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Inventory getInventory(Player p, String title) {
|
||||
if (data.containsKey(p.getUniqueId()))
|
||||
return super.getInventory(p, title.replaceAll("%data", data.get(p.getUniqueId())));
|
||||
return super.getInventory(p, title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Inventory getInventory(Player p) {
|
||||
if (data.containsKey(p.getUniqueId()))
|
||||
return super.getInventory(p, getTitle().replaceAll("%data", data.get(p.getUniqueId())));
|
||||
return super.getInventory(p, getTitle());
|
||||
}
|
||||
|
||||
public boolean canOpen(Player p) {
|
||||
return new WorldPlayer(p).isOwnerofWorld();
|
||||
}
|
||||
|
||||
}
|
@ -1,60 +1,60 @@
|
||||
package de.butzlabben.world.gui;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
import de.butzlabben.inventory.OrcClickListener;
|
||||
import de.butzlabben.inventory.OrcInventory;
|
||||
import de.butzlabben.inventory.OrcItem;
|
||||
import de.butzlabben.world.config.GuiConfig;
|
||||
import de.butzlabben.world.config.WorldConfig;
|
||||
import de.butzlabben.world.gui.clicklistener.InventoryOpenClickListener;
|
||||
|
||||
public class WorldSystemGUI extends OrcInventory {
|
||||
|
||||
private final static String path = "worldsystem.";
|
||||
|
||||
public WorldSystemGUI() {
|
||||
|
||||
super(GuiConfig.getTitle(GuiConfig.getConfig(), "worldsystem"), GuiConfig.getRows("worldsystem"), GuiConfig.isFill("worldsystem"));
|
||||
|
||||
loadItem("playeroptions", (p, inv, item) -> {
|
||||
p.closeInventory();
|
||||
PlayersPageGUI.openGUI(p);
|
||||
});
|
||||
|
||||
loadItem("worldoptions", new InventoryOpenClickListener(new WorldOptionsGUI()));
|
||||
|
||||
if (GuiConfig.isEnabled(path + "back")) {
|
||||
OrcItem back = OrcItem.back.clone();
|
||||
back.setOnClick((p, inv, item) -> {
|
||||
p.closeInventory();
|
||||
});
|
||||
addItem(GuiConfig.getSlot(path + "back"), back);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Inventory getInventory(Player player) {
|
||||
PlayersPageGUI.preloadPlayers(WorldConfig.getWorldConfig(player.getWorld().getName()));
|
||||
return super.getInventory(player);
|
||||
}
|
||||
|
||||
public void loadItem(String subpath, OrcClickListener listener) {
|
||||
if (GuiConfig.isEnabled(path + subpath) == false)
|
||||
return;
|
||||
OrcItem item = GuiConfig.getItem(path + subpath);
|
||||
if (item != null) {
|
||||
item.setOnClick(listener);
|
||||
addItem(GuiConfig.getSlot(path + subpath), item);
|
||||
}
|
||||
}
|
||||
|
||||
public void loadItem(String subpath) {
|
||||
loadItem(subpath, null);
|
||||
}
|
||||
|
||||
public boolean canOpen(Player p) {
|
||||
return true;
|
||||
}
|
||||
package de.butzlabben.world.gui;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
import de.butzlabben.inventory.OrcClickListener;
|
||||
import de.butzlabben.inventory.OrcInventory;
|
||||
import de.butzlabben.inventory.OrcItem;
|
||||
import de.butzlabben.world.config.GuiConfig;
|
||||
import de.butzlabben.world.config.WorldConfig;
|
||||
import de.butzlabben.world.gui.clicklistener.InventoryOpenClickListener;
|
||||
|
||||
public class WorldSystemGUI extends OrcInventory {
|
||||
|
||||
private final static String path = "worldsystem.";
|
||||
|
||||
public WorldSystemGUI() {
|
||||
|
||||
super(GuiConfig.getTitle(GuiConfig.getConfig(), "worldsystem"), GuiConfig.getRows("worldsystem"), GuiConfig.isFill("worldsystem"));
|
||||
|
||||
loadItem("playeroptions", (p, inv, item) -> {
|
||||
p.closeInventory();
|
||||
PlayersPageGUI.openGUI(p);
|
||||
});
|
||||
|
||||
loadItem("worldoptions", new InventoryOpenClickListener(new WorldOptionsGUI()));
|
||||
|
||||
if (GuiConfig.isEnabled(path + "back")) {
|
||||
OrcItem back = OrcItem.back.clone();
|
||||
back.setOnClick((p, inv, item) -> {
|
||||
p.closeInventory();
|
||||
});
|
||||
addItem(GuiConfig.getSlot(path + "back"), back);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Inventory getInventory(Player player) {
|
||||
PlayersPageGUI.preloadPlayers(WorldConfig.getWorldConfig(player.getWorld().getName()));
|
||||
return super.getInventory(player);
|
||||
}
|
||||
|
||||
public void loadItem(String subpath, OrcClickListener listener) {
|
||||
if (GuiConfig.isEnabled(path + subpath) == false)
|
||||
return;
|
||||
OrcItem item = GuiConfig.getItem(path + subpath);
|
||||
if (item != null) {
|
||||
item.setOnClick(listener);
|
||||
addItem(GuiConfig.getSlot(path + subpath), item);
|
||||
}
|
||||
}
|
||||
|
||||
public void loadItem(String subpath) {
|
||||
loadItem(subpath, null);
|
||||
}
|
||||
|
||||
public boolean canOpen(Player p) {
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,17 +1,17 @@
|
||||
package de.butzlabben.world.gui.clicklistener;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import de.butzlabben.inventory.OrcClickListener;
|
||||
import de.butzlabben.inventory.OrcInventory;
|
||||
import de.butzlabben.inventory.OrcItem;
|
||||
|
||||
public class ComingSoonClickListener implements OrcClickListener {
|
||||
|
||||
@Override
|
||||
public void onClick(Player p, OrcInventory inv, OrcItem item) {
|
||||
p.closeInventory();
|
||||
p.sendMessage("§cComing soon...");
|
||||
}
|
||||
|
||||
}
|
||||
package de.butzlabben.world.gui.clicklistener;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import de.butzlabben.inventory.OrcClickListener;
|
||||
import de.butzlabben.inventory.OrcInventory;
|
||||
import de.butzlabben.inventory.OrcItem;
|
||||
|
||||
public class ComingSoonClickListener implements OrcClickListener {
|
||||
|
||||
@Override
|
||||
public void onClick(Player p, OrcInventory inv, OrcItem item) {
|
||||
p.closeInventory();
|
||||
p.sendMessage("§cComing soon...");
|
||||
}
|
||||
|
||||
}
|
@ -1,25 +1,25 @@
|
||||
package de.butzlabben.world.gui.clicklistener;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import de.butzlabben.inventory.OrcClickListener;
|
||||
import de.butzlabben.inventory.OrcInventory;
|
||||
import de.butzlabben.inventory.OrcItem;
|
||||
|
||||
public class CommandExecutorClickListener implements OrcClickListener {
|
||||
|
||||
private final String message;
|
||||
|
||||
public CommandExecutorClickListener(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(Player p, OrcInventory inv, OrcItem item) {
|
||||
p.closeInventory();
|
||||
String msg = message;
|
||||
p.chat(msg);
|
||||
// Fix for #9
|
||||
inv.redraw(p);
|
||||
}
|
||||
}
|
||||
package de.butzlabben.world.gui.clicklistener;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import de.butzlabben.inventory.OrcClickListener;
|
||||
import de.butzlabben.inventory.OrcInventory;
|
||||
import de.butzlabben.inventory.OrcItem;
|
||||
|
||||
public class CommandExecutorClickListener implements OrcClickListener {
|
||||
|
||||
private final String message;
|
||||
|
||||
public CommandExecutorClickListener(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(Player p, OrcInventory inv, OrcItem item) {
|
||||
p.closeInventory();
|
||||
String msg = message;
|
||||
p.chat(msg);
|
||||
// Fix for #9
|
||||
inv.redraw(p);
|
||||
}
|
||||
}
|
@ -1,34 +1,34 @@
|
||||
package de.butzlabben.world.gui.clicklistener;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
import de.butzlabben.inventory.OrcClickListener;
|
||||
import de.butzlabben.inventory.OrcInventory;
|
||||
import de.butzlabben.inventory.OrcItem;
|
||||
import de.butzlabben.world.config.MessageConfig;
|
||||
|
||||
public class InventoryOpenClickListener implements OrcClickListener {
|
||||
|
||||
private final OrcInventory open;
|
||||
|
||||
public InventoryOpenClickListener(OrcInventory inv) {
|
||||
open = inv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(Player p, OrcInventory inv, OrcItem item) {
|
||||
p.closeInventory();
|
||||
if (open == null) {
|
||||
return;
|
||||
}
|
||||
Inventory to = open.getInventory(p);
|
||||
if (to != null) {
|
||||
p.openInventory(to);
|
||||
} else {
|
||||
p.closeInventory();
|
||||
p.sendMessage(MessageConfig.getNoPermission());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
package de.butzlabben.world.gui.clicklistener;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
import de.butzlabben.inventory.OrcClickListener;
|
||||
import de.butzlabben.inventory.OrcInventory;
|
||||
import de.butzlabben.inventory.OrcItem;
|
||||
import de.butzlabben.world.config.MessageConfig;
|
||||
|
||||
public class InventoryOpenClickListener implements OrcClickListener {
|
||||
|
||||
private final OrcInventory open;
|
||||
|
||||
public InventoryOpenClickListener(OrcInventory inv) {
|
||||
open = inv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(Player p, OrcInventory inv, OrcItem item) {
|
||||
p.closeInventory();
|
||||
if (open == null) {
|
||||
return;
|
||||
}
|
||||
Inventory to = open.getInventory(p);
|
||||
if (to != null) {
|
||||
p.openInventory(to);
|
||||
} else {
|
||||
p.closeInventory();
|
||||
p.sendMessage(MessageConfig.getNoPermission());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,22 +1,22 @@
|
||||
package de.butzlabben.world.gui.playeroption;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import de.butzlabben.inventory.DependListener;
|
||||
import de.butzlabben.inventory.OrcItem;
|
||||
import de.butzlabben.world.wrapper.WorldPlayer;
|
||||
|
||||
public class BuildStatus implements DependListener {
|
||||
|
||||
private final WorldPlayer wp;
|
||||
|
||||
public BuildStatus(WorldPlayer wp) {
|
||||
this.wp = wp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItemStack(Player p, WorldPlayer player) {
|
||||
return wp.canBuild() ? OrcItem.enabled.getItemStack(p, wp) : OrcItem.disabled.getItemStack(p, wp);
|
||||
}
|
||||
}
|
||||
package de.butzlabben.world.gui.playeroption;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import de.butzlabben.inventory.DependListener;
|
||||
import de.butzlabben.inventory.OrcItem;
|
||||
import de.butzlabben.world.wrapper.WorldPlayer;
|
||||
|
||||
public class BuildStatus implements DependListener {
|
||||
|
||||
private final WorldPlayer wp;
|
||||
|
||||
public BuildStatus(WorldPlayer wp) {
|
||||
this.wp = wp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItemStack(Player p, WorldPlayer player) {
|
||||
return wp.canBuild() ? OrcItem.enabled.getItemStack(p, wp) : OrcItem.disabled.getItemStack(p, wp);
|
||||
}
|
||||
}
|
@ -1,22 +1,22 @@
|
||||
package de.butzlabben.world.gui.playeroption;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import de.butzlabben.inventory.DependListener;
|
||||
import de.butzlabben.inventory.OrcItem;
|
||||
import de.butzlabben.world.wrapper.WorldPlayer;
|
||||
|
||||
public class GamemodeStatus implements DependListener {
|
||||
|
||||
private final WorldPlayer wp;
|
||||
|
||||
public GamemodeStatus(WorldPlayer wp) {
|
||||
this.wp = wp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItemStack(Player p, WorldPlayer player) {
|
||||
return wp.canChangeGamemode() ? OrcItem.enabled.getItemStack(p, wp) : OrcItem.disabled.getItemStack(p, wp);
|
||||
}
|
||||
package de.butzlabben.world.gui.playeroption;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import de.butzlabben.inventory.DependListener;
|
||||
import de.butzlabben.inventory.OrcItem;
|
||||
import de.butzlabben.world.wrapper.WorldPlayer;
|
||||
|
||||
public class GamemodeStatus implements DependListener {
|
||||
|
||||
private final WorldPlayer wp;
|
||||
|
||||
public GamemodeStatus(WorldPlayer wp) {
|
||||
this.wp = wp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItemStack(Player p, WorldPlayer player) {
|
||||
return wp.canChangeGamemode() ? OrcItem.enabled.getItemStack(p, wp) : OrcItem.disabled.getItemStack(p, wp);
|
||||
}
|
||||
}
|
@ -1,22 +1,22 @@
|
||||
package de.butzlabben.world.gui.playeroption;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import de.butzlabben.inventory.DependListener;
|
||||
import de.butzlabben.inventory.OrcItem;
|
||||
import de.butzlabben.world.wrapper.WorldPlayer;
|
||||
|
||||
public class TeleportStatus implements DependListener {
|
||||
|
||||
private final WorldPlayer wp;
|
||||
|
||||
public TeleportStatus(WorldPlayer wp) {
|
||||
this.wp = wp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItemStack(Player p, WorldPlayer player) {
|
||||
return wp.canTeleport() ? OrcItem.enabled.getItemStack(p, wp) : OrcItem.disabled.getItemStack(p, wp);
|
||||
}
|
||||
package de.butzlabben.world.gui.playeroption;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import de.butzlabben.inventory.DependListener;
|
||||
import de.butzlabben.inventory.OrcItem;
|
||||
import de.butzlabben.world.wrapper.WorldPlayer;
|
||||
|
||||
public class TeleportStatus implements DependListener {
|
||||
|
||||
private final WorldPlayer wp;
|
||||
|
||||
public TeleportStatus(WorldPlayer wp) {
|
||||
this.wp = wp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItemStack(Player p, WorldPlayer player) {
|
||||
return wp.canTeleport() ? OrcItem.enabled.getItemStack(p, wp) : OrcItem.disabled.getItemStack(p, wp);
|
||||
}
|
||||
}
|
@ -1,35 +1,35 @@
|
||||
package de.butzlabben.world.gui.worldoption;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import de.butzlabben.inventory.DependListener;
|
||||
import de.butzlabben.inventory.OrcItem;
|
||||
import de.butzlabben.world.config.DependenceConfig;
|
||||
import de.butzlabben.world.config.PluginConfig;
|
||||
import de.butzlabben.world.wrapper.WorldPlayer;
|
||||
|
||||
public class FireStatus implements DependListener {
|
||||
|
||||
@Override
|
||||
public ItemStack getItemStack(Player p, WorldPlayer wp) {
|
||||
String worldname = new DependenceConfig(p).getWorldname();
|
||||
File file = new File(worldname + "/worldconfig.yml");
|
||||
if (!file.exists())
|
||||
file = new File(PluginConfig.getWorlddir() + "/worldconfig.yml");
|
||||
if (!file.exists())
|
||||
return null;
|
||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
|
||||
boolean b = cfg.getBoolean("Settings.Fire");
|
||||
if (b)
|
||||
return OrcItem.enabled.getItemStack(p);
|
||||
|
||||
return null;
|
||||
// TODO wenn enabled, dann return OrcItem.enabled.getItemStack(p, wp);
|
||||
// sonst return null
|
||||
}
|
||||
|
||||
}
|
||||
package de.butzlabben.world.gui.worldoption;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import de.butzlabben.inventory.DependListener;
|
||||
import de.butzlabben.inventory.OrcItem;
|
||||
import de.butzlabben.world.config.DependenceConfig;
|
||||
import de.butzlabben.world.config.PluginConfig;
|
||||
import de.butzlabben.world.wrapper.WorldPlayer;
|
||||
|
||||
public class FireStatus implements DependListener {
|
||||
|
||||
@Override
|
||||
public ItemStack getItemStack(Player p, WorldPlayer wp) {
|
||||
String worldname = new DependenceConfig(p).getWorldname();
|
||||
File file = new File(worldname + "/worldconfig.yml");
|
||||
if (!file.exists())
|
||||
file = new File(PluginConfig.getWorlddir() + "/worldconfig.yml");
|
||||
if (!file.exists())
|
||||
return null;
|
||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
|
||||
boolean b = cfg.getBoolean("Settings.Fire");
|
||||
if (b)
|
||||
return OrcItem.enabled.getItemStack(p);
|
||||
|
||||
return null;
|
||||
// TODO wenn enabled, dann return OrcItem.enabled.getItemStack(p, wp);
|
||||
// sonst return null
|
||||
}
|
||||
|
||||
}
|
@ -1,35 +1,35 @@
|
||||
package de.butzlabben.world.gui.worldoption;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import de.butzlabben.inventory.DependListener;
|
||||
import de.butzlabben.inventory.OrcItem;
|
||||
import de.butzlabben.world.config.DependenceConfig;
|
||||
import de.butzlabben.world.config.PluginConfig;
|
||||
import de.butzlabben.world.wrapper.WorldPlayer;
|
||||
|
||||
public class TntStatus implements DependListener {
|
||||
|
||||
@Override
|
||||
public ItemStack getItemStack(Player p, WorldPlayer wp) {
|
||||
String worldname = new DependenceConfig(p).getWorldname();
|
||||
File file = new File(worldname + "/worldconfig.yml");
|
||||
if (!file.exists())
|
||||
file = new File(PluginConfig.getWorlddir() + "/worldconfig.yml");
|
||||
if (!file.exists())
|
||||
return null;
|
||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
|
||||
boolean b = cfg.getBoolean("Settings.TNTDamage");
|
||||
if (b)
|
||||
return OrcItem.enabled.getItemStack(p);
|
||||
|
||||
return null;
|
||||
// TODO wenn enabled, dann return OrcItem.enabled.getItemStack(p, wp);
|
||||
// sonst return null
|
||||
}
|
||||
|
||||
}
|
||||
package de.butzlabben.world.gui.worldoption;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import de.butzlabben.inventory.DependListener;
|
||||
import de.butzlabben.inventory.OrcItem;
|
||||
import de.butzlabben.world.config.DependenceConfig;
|
||||
import de.butzlabben.world.config.PluginConfig;
|
||||
import de.butzlabben.world.wrapper.WorldPlayer;
|
||||
|
||||
public class TntStatus implements DependListener {
|
||||
|
||||
@Override
|
||||
public ItemStack getItemStack(Player p, WorldPlayer wp) {
|
||||
String worldname = new DependenceConfig(p).getWorldname();
|
||||
File file = new File(worldname + "/worldconfig.yml");
|
||||
if (!file.exists())
|
||||
file = new File(PluginConfig.getWorlddir() + "/worldconfig.yml");
|
||||
if (!file.exists())
|
||||
return null;
|
||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
|
||||
boolean b = cfg.getBoolean("Settings.TNTDamage");
|
||||
if (b)
|
||||
return OrcItem.enabled.getItemStack(p);
|
||||
|
||||
return null;
|
||||
// TODO wenn enabled, dann return OrcItem.enabled.getItemStack(p, wp);
|
||||
// sonst return null
|
||||
}
|
||||
|
||||
}
|
@ -1,76 +1,76 @@
|
||||
package de.butzlabben.world.listener;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockBurnEvent;
|
||||
import org.bukkit.event.block.BlockIgniteEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
|
||||
import de.butzlabben.world.config.WorldConfig;
|
||||
import de.butzlabben.world.wrapper.WorldPlayer;
|
||||
|
||||
public class BlockListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onExplode(EntityExplodeEvent e) {
|
||||
File file = WorldConfig.getWorldFile(e.getLocation().getWorld().getName());
|
||||
if(!file.exists())
|
||||
return;
|
||||
WorldConfig wc = WorldConfig.getWorldConfig(e.getLocation().getWorld().getName());
|
||||
e.setCancelled(!wc.isTnt());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlace(BlockPlaceEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
if (p.hasPermission("ws.build"))
|
||||
return;
|
||||
String worldname = p.getWorld().getName();
|
||||
WorldPlayer wp = new WorldPlayer(p, worldname);
|
||||
if (!wp.isOnSystemWorld())
|
||||
return;
|
||||
if(!wp.isMember())
|
||||
e.setCancelled(true);
|
||||
if (!wp.isOwnerofWorld()) {
|
||||
e.setCancelled(!wp.canBuild());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBreak(BlockBreakEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
if (p.hasPermission("ws.build"))
|
||||
return;
|
||||
String worldname = p.getWorld().getName();
|
||||
WorldPlayer wp = new WorldPlayer(p, worldname);
|
||||
if (!wp.isOnSystemWorld())
|
||||
return;
|
||||
if(!wp.isMember())
|
||||
e.setCancelled(true);
|
||||
if (!wp.isOwnerofWorld()) {
|
||||
e.setCancelled(!wp.canBuild());
|
||||
}
|
||||
}
|
||||
@EventHandler
|
||||
public void onFire(BlockIgniteEvent e) {
|
||||
File file = WorldConfig.getWorldFile(e.getBlock().getWorld().getName());
|
||||
if(!file.exists())
|
||||
return;
|
||||
WorldConfig wc = WorldConfig.getWorldConfig(e.getBlock().getWorld().getName());
|
||||
e.setCancelled(!wc.isFire());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onFire(BlockBurnEvent e) {
|
||||
File file = WorldConfig.getWorldFile(e.getBlock().getWorld().getName());
|
||||
if(!file.exists())
|
||||
return;
|
||||
WorldConfig wc = WorldConfig.getWorldConfig(e.getBlock().getWorld().getName());
|
||||
e.setCancelled(!wc.isFire());
|
||||
}
|
||||
}
|
||||
package de.butzlabben.world.listener;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockBurnEvent;
|
||||
import org.bukkit.event.block.BlockIgniteEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
|
||||
import de.butzlabben.world.config.WorldConfig;
|
||||
import de.butzlabben.world.wrapper.WorldPlayer;
|
||||
|
||||
public class BlockListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onExplode(EntityExplodeEvent e) {
|
||||
File file = WorldConfig.getWorldFile(e.getLocation().getWorld().getName());
|
||||
if(!file.exists())
|
||||
return;
|
||||
WorldConfig wc = WorldConfig.getWorldConfig(e.getLocation().getWorld().getName());
|
||||
e.setCancelled(!wc.isTnt());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlace(BlockPlaceEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
if (p.hasPermission("ws.build"))
|
||||
return;
|
||||
String worldname = p.getWorld().getName();
|
||||
WorldPlayer wp = new WorldPlayer(p, worldname);
|
||||
if (!wp.isOnSystemWorld())
|
||||
return;
|
||||
if(!wp.isMember())
|
||||
e.setCancelled(true);
|
||||
if (!wp.isOwnerofWorld()) {
|
||||
e.setCancelled(!wp.canBuild());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBreak(BlockBreakEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
if (p.hasPermission("ws.build"))
|
||||
return;
|
||||
String worldname = p.getWorld().getName();
|
||||
WorldPlayer wp = new WorldPlayer(p, worldname);
|
||||
if (!wp.isOnSystemWorld())
|
||||
return;
|
||||
if(!wp.isMember())
|
||||
e.setCancelled(true);
|
||||
if (!wp.isOwnerofWorld()) {
|
||||
e.setCancelled(!wp.canBuild());
|
||||
}
|
||||
}
|
||||
@EventHandler
|
||||
public void onFire(BlockIgniteEvent e) {
|
||||
File file = WorldConfig.getWorldFile(e.getBlock().getWorld().getName());
|
||||
if(!file.exists())
|
||||
return;
|
||||
WorldConfig wc = WorldConfig.getWorldConfig(e.getBlock().getWorld().getName());
|
||||
e.setCancelled(!wc.isFire());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onFire(BlockBurnEvent e) {
|
||||
File file = WorldConfig.getWorldFile(e.getBlock().getWorld().getName());
|
||||
if(!file.exists())
|
||||
return;
|
||||
WorldConfig wc = WorldConfig.getWorldConfig(e.getBlock().getWorld().getName());
|
||||
e.setCancelled(!wc.isFire());
|
||||
}
|
||||
}
|
@ -1,135 +1,135 @@
|
||||
package de.butzlabben.world.listener;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
|
||||
import de.butzlabben.world.config.MessageConfig;
|
||||
import de.butzlabben.world.config.PluginConfig;
|
||||
import de.butzlabben.world.config.WorldConfig;
|
||||
import de.butzlabben.world.wrapper.SystemWorld;
|
||||
import de.butzlabben.world.wrapper.WorldPlayer;
|
||||
|
||||
public class CommandListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onTeleport(PlayerTeleportEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
World from = e.getFrom().getWorld();
|
||||
World to = e.getTo().getWorld();
|
||||
WorldPlayer wp = new WorldPlayer(p);
|
||||
|
||||
if (from != to)
|
||||
SystemWorld.tryUnloadLater(from);
|
||||
|
||||
if (e.getCause() == TeleportCause.SPECTATE) {
|
||||
if (from != to && WorldConfig.exists(to.getName())) {
|
||||
if (!p.hasPermission("ws.tp.toother")) {
|
||||
e.setCancelled(true);
|
||||
p.sendMessage(MessageConfig.getNoPermission());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!wp.isOnSystemWorld() || wp.isOwnerofWorld() || wp.canTeleport() || p.hasPermission("ws.tp.toother"))
|
||||
return;
|
||||
e.setCancelled(true);
|
||||
p.sendMessage(MessageConfig.getNoPermission());
|
||||
} else if (e.getCause() == TeleportCause.COMMAND) {
|
||||
if (from != to && WorldConfig.exists(to.getName())) {
|
||||
if (!p.hasPermission("ws.tp.toother")) {
|
||||
e.setCancelled(true);
|
||||
p.sendMessage(MessageConfig.getNoPermission());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!wp.isOnSystemWorld() || wp.isOwnerofWorld() || wp.canTeleport() || p.hasPermission("ws.tp.toother"))
|
||||
return;
|
||||
e.setCancelled(true);
|
||||
p.sendMessage(MessageConfig.getNoPermission());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onCmd(PlayerCommandPreprocessEvent e) {
|
||||
String cmd = e.getMessage().toLowerCase();
|
||||
Player p = e.getPlayer();
|
||||
WorldPlayer wp = new WorldPlayer(p);
|
||||
|
||||
if (!wp.isOnSystemWorld())
|
||||
return;
|
||||
|
||||
if (cmd.startsWith("/gamemode") || cmd.startsWith("/gm")) {
|
||||
if (!wp.isOnSystemWorld())
|
||||
return;
|
||||
if (p.hasPermission("ws.gamemode"))
|
||||
return;
|
||||
if (PluginConfig.isSurvival()) {
|
||||
e.setCancelled(true);
|
||||
p.sendMessage(MessageConfig.getNoPermission());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!wp.canChangeGamemode() && !wp.isOwnerofWorld()) {
|
||||
p.sendMessage(MessageConfig.getNoPermission());
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
} else if (cmd.startsWith("/tp") || cmd.startsWith("/teleport")) {
|
||||
String[] args = e.getMessage().split(" ");
|
||||
if (args.length == 2) {
|
||||
if (p.hasPermission("ws.tp.toother"))
|
||||
return;
|
||||
if (PluginConfig.isSurvival()) {
|
||||
e.setCancelled(true);
|
||||
p.sendMessage(MessageConfig.getNoPermission());
|
||||
return;
|
||||
}
|
||||
Player a = Bukkit.getPlayer(args[1]);
|
||||
if (a == null)
|
||||
return;
|
||||
if (p.getWorld() != a.getWorld()) {
|
||||
e.setCancelled(true);
|
||||
p.sendMessage(MessageConfig.getNoPermission());
|
||||
return;
|
||||
}
|
||||
if (wp.isOwnerofWorld())
|
||||
return;
|
||||
if (!wp.canTeleport()) {
|
||||
p.sendMessage(MessageConfig.getNoPermission());
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
} else if (args.length == 3) {
|
||||
if (!p.hasPermission("ws.tp.other")) {
|
||||
p.sendMessage(MessageConfig.getNoPermission());
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
} else if (args.length == 4) {
|
||||
if (p.hasPermission("ws.tp.toother"))
|
||||
return;
|
||||
if (PluginConfig.isSurvival()) {
|
||||
e.setCancelled(true);
|
||||
p.sendMessage(MessageConfig.getNoPermission());
|
||||
return;
|
||||
}
|
||||
if (wp.isOwnerofWorld())
|
||||
return;
|
||||
if (!wp.canTeleport()) {
|
||||
p.sendMessage(MessageConfig.getNoPermission());
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
package de.butzlabben.world.listener;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
|
||||
import de.butzlabben.world.config.MessageConfig;
|
||||
import de.butzlabben.world.config.PluginConfig;
|
||||
import de.butzlabben.world.config.WorldConfig;
|
||||
import de.butzlabben.world.wrapper.SystemWorld;
|
||||
import de.butzlabben.world.wrapper.WorldPlayer;
|
||||
|
||||
public class CommandListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onTeleport(PlayerTeleportEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
World from = e.getFrom().getWorld();
|
||||
World to = e.getTo().getWorld();
|
||||
WorldPlayer wp = new WorldPlayer(p);
|
||||
|
||||
if (from != to)
|
||||
SystemWorld.tryUnloadLater(from);
|
||||
|
||||
if (e.getCause() == TeleportCause.SPECTATE) {
|
||||
if (from != to && WorldConfig.exists(to.getName())) {
|
||||
if (!p.hasPermission("ws.tp.toother")) {
|
||||
e.setCancelled(true);
|
||||
p.sendMessage(MessageConfig.getNoPermission());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!wp.isOnSystemWorld() || wp.isOwnerofWorld() || wp.canTeleport() || p.hasPermission("ws.tp.toother"))
|
||||
return;
|
||||
e.setCancelled(true);
|
||||
p.sendMessage(MessageConfig.getNoPermission());
|
||||
} else if (e.getCause() == TeleportCause.COMMAND) {
|
||||
if (from != to && WorldConfig.exists(to.getName())) {
|
||||
if (!p.hasPermission("ws.tp.toother")) {
|
||||
e.setCancelled(true);
|
||||
p.sendMessage(MessageConfig.getNoPermission());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!wp.isOnSystemWorld() || wp.isOwnerofWorld() || wp.canTeleport() || p.hasPermission("ws.tp.toother"))
|
||||
return;
|
||||
e.setCancelled(true);
|
||||
p.sendMessage(MessageConfig.getNoPermission());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onCmd(PlayerCommandPreprocessEvent e) {
|
||||
String cmd = e.getMessage().toLowerCase();
|
||||
Player p = e.getPlayer();
|
||||
WorldPlayer wp = new WorldPlayer(p);
|
||||
|
||||
if (!wp.isOnSystemWorld())
|
||||
return;
|
||||
|
||||
if (cmd.startsWith("/gamemode") || cmd.startsWith("/gm")) {
|
||||
if (!wp.isOnSystemWorld())
|
||||
return;
|
||||
if (p.hasPermission("ws.gamemode"))
|
||||
return;
|
||||
if (PluginConfig.isSurvival()) {
|
||||
e.setCancelled(true);
|
||||
p.sendMessage(MessageConfig.getNoPermission());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!wp.canChangeGamemode() && !wp.isOwnerofWorld()) {
|
||||
p.sendMessage(MessageConfig.getNoPermission());
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
} else if (cmd.startsWith("/tp") || cmd.startsWith("/teleport")) {
|
||||
String[] args = e.getMessage().split(" ");
|
||||
if (args.length == 2) {
|
||||
if (p.hasPermission("ws.tp.toother"))
|
||||
return;
|
||||
if (PluginConfig.isSurvival()) {
|
||||
e.setCancelled(true);
|
||||
p.sendMessage(MessageConfig.getNoPermission());
|
||||
return;
|
||||
}
|
||||
Player a = Bukkit.getPlayer(args[1]);
|
||||
if (a == null)
|
||||
return;
|
||||
if (p.getWorld() != a.getWorld()) {
|
||||
e.setCancelled(true);
|
||||
p.sendMessage(MessageConfig.getNoPermission());
|
||||
return;
|
||||
}
|
||||
if (wp.isOwnerofWorld())
|
||||
return;
|
||||
if (!wp.canTeleport()) {
|
||||
p.sendMessage(MessageConfig.getNoPermission());
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
} else if (args.length == 3) {
|
||||
if (!p.hasPermission("ws.tp.other")) {
|
||||
p.sendMessage(MessageConfig.getNoPermission());
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
} else if (args.length == 4) {
|
||||
if (p.hasPermission("ws.tp.toother"))
|
||||
return;
|
||||
if (PluginConfig.isSurvival()) {
|
||||
e.setCancelled(true);
|
||||
p.sendMessage(MessageConfig.getNoPermission());
|
||||
return;
|
||||
}
|
||||
if (wp.isOwnerofWorld())
|
||||
return;
|
||||
if (!wp.canTeleport()) {
|
||||
p.sendMessage(MessageConfig.getNoPermission());
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,51 +1,51 @@
|
||||
package de.butzlabben.world.listener;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
|
||||
import de.butzlabben.world.config.PluginConfig;
|
||||
import de.butzlabben.world.config.WorldConfig;
|
||||
import de.butzlabben.world.wrapper.WorldPlayer;
|
||||
|
||||
public class PlayerDeathListener implements Listener {
|
||||
|
||||
private HashMap<UUID, World> deathLocations = new HashMap<>();
|
||||
|
||||
@EventHandler
|
||||
public void onDie(PlayerDeathEvent e) {
|
||||
Player p = e.getEntity();
|
||||
WorldPlayer wp = new WorldPlayer(p, p.getWorld().getName());
|
||||
if (wp.isOnSystemWorld()) {
|
||||
deathLocations.put(p.getUniqueId(), p.getLocation().getWorld());
|
||||
} else {
|
||||
p.setGameMode(PluginConfig.getSpawnGamemode());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onRespawn(PlayerRespawnEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
if (deathLocations.containsKey(p.getUniqueId())) {
|
||||
World world = deathLocations.remove(p.getUniqueId());
|
||||
|
||||
WorldConfig config = WorldConfig.getWorldConfig(world.getName());
|
||||
|
||||
if (config.getHome() != null) {
|
||||
e.setRespawnLocation(config.getHome());
|
||||
} else {
|
||||
if (PluginConfig.useWorldSpawn()) {
|
||||
e.setRespawnLocation(PluginConfig.getWorldSpawn(world));
|
||||
} else {
|
||||
e.setRespawnLocation(world.getSpawnLocation());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
package de.butzlabben.world.listener;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
|
||||
import de.butzlabben.world.config.PluginConfig;
|
||||
import de.butzlabben.world.config.WorldConfig;
|
||||
import de.butzlabben.world.wrapper.WorldPlayer;
|
||||
|
||||
public class PlayerDeathListener implements Listener {
|
||||
|
||||
private HashMap<UUID, World> deathLocations = new HashMap<>();
|
||||
|
||||
@EventHandler
|
||||
public void onDie(PlayerDeathEvent e) {
|
||||
Player p = e.getEntity();
|
||||
WorldPlayer wp = new WorldPlayer(p, p.getWorld().getName());
|
||||
if (wp.isOnSystemWorld()) {
|
||||
deathLocations.put(p.getUniqueId(), p.getLocation().getWorld());
|
||||
} else {
|
||||
p.setGameMode(PluginConfig.getSpawnGamemode());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onRespawn(PlayerRespawnEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
if (deathLocations.containsKey(p.getUniqueId())) {
|
||||
World world = deathLocations.remove(p.getUniqueId());
|
||||
|
||||
WorldConfig config = WorldConfig.getWorldConfig(world.getName());
|
||||
|
||||
if (config.getHome() != null) {
|
||||
e.setRespawnLocation(config.getHome());
|
||||
} else {
|
||||
if (PluginConfig.useWorldSpawn()) {
|
||||
e.setRespawnLocation(PluginConfig.getWorldSpawn(world));
|
||||
} else {
|
||||
e.setRespawnLocation(world.getSpawnLocation());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,38 +1,38 @@
|
||||
package de.butzlabben.world.listener;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import de.butzlabben.world.config.DependenceConfig;
|
||||
import de.butzlabben.world.config.PluginConfig;
|
||||
import de.butzlabben.world.wrapper.SystemWorld;
|
||||
|
||||
public class PlayerListener implements Listener {
|
||||
|
||||
//#17
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onJoin(PlayerJoinEvent e) {
|
||||
if (PluginConfig.spawnTeleportation()) {
|
||||
Player p = e.getPlayer();
|
||||
DependenceConfig dc = new DependenceConfig(p);
|
||||
if (dc.hasWorld()) {
|
||||
SystemWorld sw = SystemWorld.getSystemWorld(dc.getWorldname());
|
||||
if (sw != null && !sw.isLoaded()) {
|
||||
e.getPlayer().teleport(PluginConfig.getSpawn());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onLeave(PlayerQuitEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
World w = p.getWorld();
|
||||
SystemWorld.tryUnloadLater(w);
|
||||
}
|
||||
package de.butzlabben.world.listener;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import de.butzlabben.world.config.DependenceConfig;
|
||||
import de.butzlabben.world.config.PluginConfig;
|
||||
import de.butzlabben.world.wrapper.SystemWorld;
|
||||
|
||||
public class PlayerListener implements Listener {
|
||||
|
||||
//#17
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onJoin(PlayerJoinEvent e) {
|
||||
if (PluginConfig.spawnTeleportation()) {
|
||||
Player p = e.getPlayer();
|
||||
DependenceConfig dc = new DependenceConfig(p);
|
||||
if (dc.hasWorld()) {
|
||||
SystemWorld sw = SystemWorld.getSystemWorld(dc.getWorldname());
|
||||
if (sw != null && !sw.isLoaded()) {
|
||||
e.getPlayer().teleport(PluginConfig.getSpawn());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onLeave(PlayerQuitEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
World w = p.getWorld();
|
||||
SystemWorld.tryUnloadLater(w);
|
||||
}
|
||||
}
|
@ -1,29 +1,29 @@
|
||||
package de.butzlabben.world.util;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 13.09.2018
|
||||
*/
|
||||
public class TeleportUtil {
|
||||
|
||||
private static HashMap<UUID, Location> oldLocs = new HashMap<>();
|
||||
|
||||
public static void teleportPlayer(Player p, Location loc) {
|
||||
// Save old player location.
|
||||
// If he does another teleport he will be taken back then to the first location
|
||||
if(!oldLocs.containsKey(p.getUniqueId())) {
|
||||
Location oldLoc = p.getLocation();
|
||||
oldLocs.put(p.getUniqueId(), oldLoc);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private TeleportUtil() {
|
||||
}
|
||||
}
|
||||
package de.butzlabben.world.util;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 13.09.2018
|
||||
*/
|
||||
public class TeleportUtil {
|
||||
|
||||
private static HashMap<UUID, Location> oldLocs = new HashMap<>();
|
||||
|
||||
public static void teleportPlayer(Player p, Location loc) {
|
||||
// Save old player location.
|
||||
// If he does another teleport he will be taken back then to the first location
|
||||
if(!oldLocs.containsKey(p.getUniqueId())) {
|
||||
Location oldLoc = p.getLocation();
|
||||
oldLocs.put(p.getUniqueId(), oldLoc);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private TeleportUtil() {
|
||||
}
|
||||
}
|
@ -1,45 +1,45 @@
|
||||
package de.butzlabben.world.wrapper;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.WorldCreator;
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
import com.boydti.fawe.bukkit.wrapper.AsyncWorld;
|
||||
import com.boydti.fawe.util.TaskManager;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 08.06.2018
|
||||
*/
|
||||
public class AsyncCreatorAdapter implements CreatorAdapter {
|
||||
|
||||
// Create worlds async to close #16
|
||||
@Override
|
||||
public void create(WorldCreator creator, SystemWorld sw, Runnable r) {
|
||||
TaskManager.IMP.async(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
AsyncWorld world;
|
||||
if (Bukkit.getWorld(creator.name()) == null)
|
||||
world = AsyncWorld.create(creator);
|
||||
else
|
||||
world = AsyncWorld.wrap(Bukkit.getWorld(creator.name()));
|
||||
|
||||
Block block = world.getBlockAt(0, 0, 0);
|
||||
block.setType(Material.BEDROCK);
|
||||
|
||||
// When you are done
|
||||
world.commit();
|
||||
Bukkit.getWorlds().add(world);
|
||||
if (sw != null)
|
||||
sw.setCreating(false);
|
||||
|
||||
// Send the message
|
||||
r.run();
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
package de.butzlabben.world.wrapper;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.WorldCreator;
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
import com.boydti.fawe.bukkit.wrapper.AsyncWorld;
|
||||
import com.boydti.fawe.util.TaskManager;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 08.06.2018
|
||||
*/
|
||||
public class AsyncCreatorAdapter implements CreatorAdapter {
|
||||
|
||||
// Create worlds async to close #16
|
||||
@Override
|
||||
public void create(WorldCreator creator, SystemWorld sw, Runnable r) {
|
||||
TaskManager.IMP.async(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
AsyncWorld world;
|
||||
if (Bukkit.getWorld(creator.name()) == null)
|
||||
world = AsyncWorld.create(creator);
|
||||
else
|
||||
world = AsyncWorld.wrap(Bukkit.getWorld(creator.name()));
|
||||
|
||||
Block block = world.getBlockAt(0, 0, 0);
|
||||
block.setType(Material.BEDROCK);
|
||||
|
||||
// When you are done
|
||||
world.commit();
|
||||
Bukkit.getWorlds().add(world);
|
||||
if (sw != null)
|
||||
sw.setCreating(false);
|
||||
|
||||
// Send the message
|
||||
r.run();
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
@ -1,12 +1,12 @@
|
||||
package de.butzlabben.world.wrapper;
|
||||
|
||||
import org.bukkit.WorldCreator;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 07.06.2018
|
||||
*/
|
||||
public interface CreatorAdapter {
|
||||
|
||||
public void create(WorldCreator creator, SystemWorld world, Runnable sendPlayerMessageCallback);
|
||||
}
|
||||
package de.butzlabben.world.wrapper;
|
||||
|
||||
import org.bukkit.WorldCreator;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 07.06.2018
|
||||
*/
|
||||
public interface CreatorAdapter {
|
||||
|
||||
public void create(WorldCreator creator, SystemWorld world, Runnable sendPlayerMessageCallback);
|
||||
}
|
@ -1,432 +1,432 @@
|
||||
package de.butzlabben.world.wrapper;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.WorldCreator;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import de.butzlabben.world.WorldSystem;
|
||||
import de.butzlabben.world.config.DependenceConfig;
|
||||
import de.butzlabben.world.config.MessageConfig;
|
||||
import de.butzlabben.world.config.PluginConfig;
|
||||
import de.butzlabben.world.config.SettingsConfig;
|
||||
import de.butzlabben.world.config.WorldConfig;
|
||||
import de.butzlabben.world.event.WorldCreateEvent;
|
||||
import de.butzlabben.world.event.WorldLoadEvent;
|
||||
import de.butzlabben.world.event.WorldUnloadEvent;
|
||||
|
||||
/**
|
||||
* This class represents a systemworld, loaded or not
|
||||
*
|
||||
* @author Butzlabben
|
||||
* @since 14.02.2018
|
||||
*/
|
||||
public class SystemWorld {
|
||||
|
||||
private World w;
|
||||
private String worldname;
|
||||
private boolean unloading = false;
|
||||
private boolean creating = false;
|
||||
|
||||
private static HashMap<String, SystemWorld> cached = new HashMap<>();
|
||||
|
||||
/**
|
||||
* This method is the online way to get a system world instance
|
||||
*
|
||||
* @param worldname as in minecraft
|
||||
* @return a systemworld instance if it is a systemworld or null if is not a
|
||||
* systemworld
|
||||
* @exception NullPointerException worldname == null
|
||||
*/
|
||||
public static SystemWorld getSystemWorld(String worldname) {
|
||||
Preconditions.checkNotNull(worldname, "worldname must not be null");
|
||||
if (cached.containsKey(worldname))
|
||||
return cached.get(worldname);
|
||||
SystemWorld sw = new SystemWorld(worldname);
|
||||
if (sw != null && sw.exists()) {
|
||||
cached.put(worldname, sw);
|
||||
return sw;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param w a world in bukkit, no matter if systemworld or not Trys to unload a
|
||||
* systemworld later, with the given delay in the config
|
||||
*/
|
||||
public static void tryUnloadLater(World w) {
|
||||
if (w != null)
|
||||
Bukkit.getScheduler().runTaskLater(WorldSystem.getInstance(), () -> {
|
||||
if (w.getPlayers().size() == 0) {
|
||||
SystemWorld sw = SystemWorld.getSystemWorld(w.getName());
|
||||
if (sw != null && sw.isLoaded())
|
||||
sw.unloadLater(w);
|
||||
}
|
||||
}, 20);
|
||||
}
|
||||
|
||||
private SystemWorld(String worldname) {
|
||||
this.worldname = worldname;
|
||||
w = Bukkit.getWorld(worldname);
|
||||
}
|
||||
|
||||
/**
|
||||
* Trys to force-unload this world
|
||||
*
|
||||
* @param w associated world
|
||||
* @exception NullPointerException w == null
|
||||
*/
|
||||
public void directUnload(World w) {
|
||||
if (!Bukkit.isPrimaryThread()) {
|
||||
Bukkit.getScheduler().runTask(WorldSystem.getInstance(), () -> {
|
||||
directUnload(w);
|
||||
});
|
||||
return;
|
||||
}
|
||||
Preconditions.checkNotNull(w, "world must not be null");
|
||||
unloading = true;
|
||||
w.save();
|
||||
Chunk[] arrayOfChunk;
|
||||
int j = (arrayOfChunk = w.getLoadedChunks()).length;
|
||||
for (int i = 0; i < j; i++) {
|
||||
Chunk c = arrayOfChunk[i];
|
||||
c.unload();
|
||||
}
|
||||
for (Player a : w.getPlayers()) {
|
||||
a.teleport(PluginConfig.getSpawn());
|
||||
a.setGameMode(PluginConfig.getSpawnGamemode());
|
||||
}
|
||||
if (unloading) {
|
||||
if (Bukkit.unloadWorld(w, true)) {
|
||||
File worldinserver = new File(Bukkit.getWorldContainer(), worldname);
|
||||
File worlddir = new File(PluginConfig.getWorlddir());
|
||||
try {
|
||||
FileUtils.moveDirectoryToDirectory(worldinserver, worlddir, false);
|
||||
Bukkit.getWorlds().remove(w);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Trys to unload this world later, with the given delay in the config
|
||||
*
|
||||
* @param w the associated world
|
||||
* @exception NullPointerException w == null
|
||||
*/
|
||||
public void unloadLater(World w) {
|
||||
if (!Bukkit.isPrimaryThread()) {
|
||||
Bukkit.getScheduler().runTask(WorldSystem.getInstance(), () -> {
|
||||
unloadLater(w);
|
||||
});
|
||||
return;
|
||||
}
|
||||
Preconditions.checkNotNull(w, "world must not be null");
|
||||
WorldUnloadEvent event = new WorldUnloadEvent(this);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
// Set unloading to true
|
||||
unloading = true;
|
||||
w.save();
|
||||
Chunk[] arrayOfChunk;
|
||||
int j = (arrayOfChunk = w.getLoadedChunks()).length;
|
||||
for (int i = 0; i < j; i++) {
|
||||
Chunk c = arrayOfChunk[i];
|
||||
c.unload();
|
||||
}
|
||||
for (Player a : w.getPlayers()) {
|
||||
a.teleport(PluginConfig.getSpawn());
|
||||
a.setGameMode(PluginConfig.getSpawnGamemode());
|
||||
}
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(WorldSystem.getInstance(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// Still in world unloading process?
|
||||
if (unloading && w.getPlayers().size() == 0) {
|
||||
if (Bukkit.unloadWorld(w, true)) {
|
||||
File worldinserver = new File(Bukkit.getWorldContainer(), worldname);
|
||||
File worlddir = new File(PluginConfig.getWorlddir());
|
||||
try {
|
||||
FileUtils.moveDirectoryToDirectory(worldinserver, worlddir, false);
|
||||
Bukkit.getWorlds().remove(w);
|
||||
unloading = false;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 20 * PluginConfig.getUnloadingTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* Trys to load this world, and messages the player about the process
|
||||
*
|
||||
* @param p the player to teleport on the world
|
||||
* @exception NullPointerException if p is null
|
||||
* @exception IllegalArgumentException if player is not online
|
||||
*/
|
||||
public void load(Player p) {
|
||||
if (!Bukkit.isPrimaryThread()) {
|
||||
Bukkit.getScheduler().runTask(WorldSystem.getInstance(), () -> {
|
||||
load(p);
|
||||
});
|
||||
return;
|
||||
}
|
||||
Preconditions.checkNotNull(p, "player must not be null");
|
||||
Preconditions.checkArgument(p.isOnline(), "player must be online");
|
||||
|
||||
if (creating) {
|
||||
p.sendMessage(MessageConfig.getWorldStillCreating());
|
||||
return;
|
||||
}
|
||||
|
||||
WorldLoadEvent event = new WorldLoadEvent(p, this);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
unloading = false;
|
||||
|
||||
p.sendMessage(MessageConfig.getSettingUpWorld());
|
||||
|
||||
// Move World into Server dir
|
||||
String worlddir = PluginConfig.getWorlddir();
|
||||
File world = new File(worlddir + "/" + worldname);
|
||||
if (!world.exists()) {
|
||||
world = new File(Bukkit.getWorldContainer(), worldname);
|
||||
} else {
|
||||
if (new File(Bukkit.getWorldContainer(), worldname).exists()
|
||||
&& new File(PluginConfig.getWorlddir() + "/" + worldname).exists()) {
|
||||
System.err.println("World " + worldname + " exists twice!");
|
||||
// try {
|
||||
// FileUtils.deleteDirectory(new
|
||||
// File(Bukkit.getWorldContainer(), worldname));
|
||||
// } catch (IOException e) {
|
||||
// p.sendMessage(PluginConfig.getPrefix() + "§cError");
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
}
|
||||
try {
|
||||
FileUtils.moveDirectoryToDirectory(world, Bukkit.getWorldContainer(), false);
|
||||
} catch (IOException e) {
|
||||
System.err.println("Couldn't load world of " + p.getName());
|
||||
p.sendMessage(PluginConfig.getPrefix() + "§cError: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (worldname.charAt(worldname.length() - 37) == ' ') {
|
||||
StringBuilder myName = new StringBuilder(worldname);
|
||||
myName.setCharAt(worldname.length() - 37, '-');
|
||||
world.renameTo(new File(Bukkit.getWorldContainer(), myName.toString()));
|
||||
worldname = myName.toString();
|
||||
}
|
||||
|
||||
WorldCreator creator = PluginConfig.getWorldCreator(worldname);
|
||||
|
||||
World w = Bukkit.getWorld(worldname);
|
||||
if (w == null)
|
||||
w = Bukkit.createWorld(creator);
|
||||
|
||||
this.w = w;
|
||||
|
||||
teleportToWorldSpawn(p);
|
||||
|
||||
OfflinePlayer owner = Bukkit.getOfflinePlayer(WorldConfig.getWorldConfig(worldname).getOwner());
|
||||
DependenceConfig dc = new DependenceConfig(owner);
|
||||
dc.setLastLoaded();
|
||||
}
|
||||
|
||||
/**
|
||||
* Trys to create a new systemworld with all entries etc. finally loads the
|
||||
* world
|
||||
*
|
||||
* @param p Player to create the world for
|
||||
* @return whether it succesfull or not
|
||||
*/
|
||||
public static boolean create(Player p, WorldTemplate template) {
|
||||
|
||||
DependenceConfig dc = new DependenceConfig(p);
|
||||
|
||||
String uuid = p.getUniqueId().toString();
|
||||
int id = DependenceConfig.getHighestID() + 1;
|
||||
String worldname = "ID" + id + "-" + uuid;
|
||||
|
||||
WorldCreator creator = PluginConfig.getWorldCreator(worldname);
|
||||
|
||||
WorldCreateEvent event = new WorldCreateEvent(p, creator);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if (event.isCancelled())
|
||||
return false;
|
||||
|
||||
dc.createNewEntry();
|
||||
|
||||
String worlddir = PluginConfig.getWorlddir();
|
||||
File exampleworld = new File(template.getPath());
|
||||
if (new File(template.getPath() + "/uid.dat").exists()) {
|
||||
new File(template.getPath() + "/uid.dat").delete();
|
||||
}
|
||||
|
||||
File newworld = new File(worlddir + "/" + worldname);
|
||||
|
||||
if (exampleworld.isDirectory())
|
||||
try {
|
||||
FileUtils.copyDirectory(exampleworld, newworld);
|
||||
} catch (IOException e) {
|
||||
System.err.println("Couldn't create world for " + p.getName());
|
||||
e.printStackTrace();
|
||||
}
|
||||
else
|
||||
newworld.mkdirs();
|
||||
|
||||
WorldConfig.create(p);
|
||||
|
||||
// Move World into Server dir
|
||||
File world = new File(worlddir + "/" + worldname);
|
||||
if (!world.exists()) {
|
||||
world = new File(Bukkit.getWorldContainer(), worldname);
|
||||
} else {
|
||||
if (new File(Bukkit.getWorldContainer(), worldname).exists()
|
||||
&& new File(PluginConfig.getWorlddir() + "/" + worldname).exists()) {
|
||||
try {
|
||||
FileUtils.deleteDirectory(new File(Bukkit.getWorldContainer(), worldname));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
try {
|
||||
FileUtils.moveDirectoryToDirectory(world, Bukkit.getWorldContainer(), false);
|
||||
} catch (IOException e) {
|
||||
p.sendMessage(PluginConfig.getPrefix() + "§cError: " + e.getMessage());
|
||||
System.err.println("Couldn't load world of " + p.getName());
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
SystemWorld sw = SystemWorld.getSystemWorld(worldname);
|
||||
sw.setCreating(true);
|
||||
|
||||
// Run in scheduler so method returns without delay
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// For #16
|
||||
WorldSystem.getInstance().getAdapter().create(event.getWorldCreator(), sw, () -> {
|
||||
if (p != null && p.isOnline()) {
|
||||
p.sendMessage(MessageConfig.getWorldCreated());
|
||||
SettingsConfig.getCommandsonGet().stream()
|
||||
.map(s -> s.replace("%player", p.getName()).replace("%world", sw.getName())
|
||||
.replace("%uuid", p.getUniqueId().toString()))
|
||||
.forEach(s -> Bukkit.dispatchCommand(Bukkit.getConsoleSender(), s));
|
||||
}
|
||||
});
|
||||
}
|
||||
}.runTaskLater(WorldSystem.getInstance(), 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return if the world is loaded
|
||||
*/
|
||||
public boolean isLoaded() {
|
||||
File worldAsDir = new File(Bukkit.getWorldContainer(), worldname + "/worldconfig.yml");
|
||||
World w = Bukkit.getWorld(worldname);
|
||||
if (worldAsDir.exists() && w != null)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean exists() {
|
||||
File worldAsDir = new File(Bukkit.getWorldContainer(), worldname + "/worldconfig.yml");
|
||||
if (worldAsDir.exists()) {
|
||||
return true;
|
||||
}
|
||||
worldAsDir = new File(PluginConfig.getWorlddir() + "/" + worldname + "/worldconfig.yml");
|
||||
if (worldAsDir.exists()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Teleports the player to the world with the given settings in the config
|
||||
*
|
||||
* @param p player to teleport
|
||||
* @exception NullPointerException if player is null
|
||||
* @exception IllegalArgumentException if player is not online
|
||||
*/
|
||||
public void teleportToWorldSpawn(Player p) {
|
||||
Preconditions.checkNotNull(p, "player must not be null");
|
||||
Preconditions.checkArgument(p.isOnline(), "player must be online");
|
||||
|
||||
if (creating) {
|
||||
p.sendMessage(MessageConfig.getWorldStillCreating());
|
||||
return;
|
||||
}
|
||||
|
||||
unloading = false;
|
||||
w = Bukkit.getWorld(worldname);
|
||||
if (w == null)
|
||||
return;
|
||||
|
||||
WorldConfig config = WorldConfig.getWorldConfig(worldname);
|
||||
if (config.getHome() != null) {
|
||||
p.teleport(config.getHome());
|
||||
} else {
|
||||
if (PluginConfig.useWorldSpawn()) {
|
||||
p.teleport(PluginConfig.getWorldSpawn(w));
|
||||
} else {
|
||||
p.teleport(w.getSpawnLocation());
|
||||
}
|
||||
}
|
||||
if (PluginConfig.isSurvival()) {
|
||||
p.setGameMode(GameMode.SURVIVAL);
|
||||
} else {
|
||||
p.setGameMode(GameMode.CREATIVE);
|
||||
}
|
||||
|
||||
OfflinePlayer owner = Bukkit.getOfflinePlayer(WorldConfig.getWorldConfig(worldname).getOwner());
|
||||
DependenceConfig dc = new DependenceConfig(owner);
|
||||
dc.setLastLoaded();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the world
|
||||
*/
|
||||
public World getWorld() {
|
||||
return w;
|
||||
}
|
||||
|
||||
public void setCreating(boolean creating) {
|
||||
this.creating = creating;
|
||||
}
|
||||
|
||||
public boolean isCreating() {
|
||||
return creating;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the worldname
|
||||
*/
|
||||
public String getName() {
|
||||
return worldname;
|
||||
}
|
||||
package de.butzlabben.world.wrapper;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.WorldCreator;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import de.butzlabben.world.WorldSystem;
|
||||
import de.butzlabben.world.config.DependenceConfig;
|
||||
import de.butzlabben.world.config.MessageConfig;
|
||||
import de.butzlabben.world.config.PluginConfig;
|
||||
import de.butzlabben.world.config.SettingsConfig;
|
||||
import de.butzlabben.world.config.WorldConfig;
|
||||
import de.butzlabben.world.event.WorldCreateEvent;
|
||||
import de.butzlabben.world.event.WorldLoadEvent;
|
||||
import de.butzlabben.world.event.WorldUnloadEvent;
|
||||
|
||||
/**
|
||||
* This class represents a systemworld, loaded or not
|
||||
*
|
||||
* @author Butzlabben
|
||||
* @since 14.02.2018
|
||||
*/
|
||||
public class SystemWorld {
|
||||
|
||||
private World w;
|
||||
private String worldname;
|
||||
private boolean unloading = false;
|
||||
private boolean creating = false;
|
||||
|
||||
private static HashMap<String, SystemWorld> cached = new HashMap<>();
|
||||
|
||||
/**
|
||||
* This method is the online way to get a system world instance
|
||||
*
|
||||
* @param worldname as in minecraft
|
||||
* @return a systemworld instance if it is a systemworld or null if is not a
|
||||
* systemworld
|
||||
* @exception NullPointerException worldname == null
|
||||
*/
|
||||
public static SystemWorld getSystemWorld(String worldname) {
|
||||
Preconditions.checkNotNull(worldname, "worldname must not be null");
|
||||
if (cached.containsKey(worldname))
|
||||
return cached.get(worldname);
|
||||
SystemWorld sw = new SystemWorld(worldname);
|
||||
if (sw != null && sw.exists()) {
|
||||
cached.put(worldname, sw);
|
||||
return sw;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param w a world in bukkit, no matter if systemworld or not Trys to unload a
|
||||
* systemworld later, with the given delay in the config
|
||||
*/
|
||||
public static void tryUnloadLater(World w) {
|
||||
if (w != null)
|
||||
Bukkit.getScheduler().runTaskLater(WorldSystem.getInstance(), () -> {
|
||||
if (w.getPlayers().size() == 0) {
|
||||
SystemWorld sw = SystemWorld.getSystemWorld(w.getName());
|
||||
if (sw != null && sw.isLoaded())
|
||||
sw.unloadLater(w);
|
||||
}
|
||||
}, 20);
|
||||
}
|
||||
|
||||
private SystemWorld(String worldname) {
|
||||
this.worldname = worldname;
|
||||
w = Bukkit.getWorld(worldname);
|
||||
}
|
||||
|
||||
/**
|
||||
* Trys to force-unload this world
|
||||
*
|
||||
* @param w associated world
|
||||
* @exception NullPointerException w == null
|
||||
*/
|
||||
public void directUnload(World w) {
|
||||
if (!Bukkit.isPrimaryThread()) {
|
||||
Bukkit.getScheduler().runTask(WorldSystem.getInstance(), () -> {
|
||||
directUnload(w);
|
||||
});
|
||||
return;
|
||||
}
|
||||
Preconditions.checkNotNull(w, "world must not be null");
|
||||
unloading = true;
|
||||
w.save();
|
||||
Chunk[] arrayOfChunk;
|
||||
int j = (arrayOfChunk = w.getLoadedChunks()).length;
|
||||
for (int i = 0; i < j; i++) {
|
||||
Chunk c = arrayOfChunk[i];
|
||||
c.unload();
|
||||
}
|
||||
for (Player a : w.getPlayers()) {
|
||||
a.teleport(PluginConfig.getSpawn());
|
||||
a.setGameMode(PluginConfig.getSpawnGamemode());
|
||||
}
|
||||
if (unloading) {
|
||||
if (Bukkit.unloadWorld(w, true)) {
|
||||
File worldinserver = new File(Bukkit.getWorldContainer(), worldname);
|
||||
File worlddir = new File(PluginConfig.getWorlddir());
|
||||
try {
|
||||
FileUtils.moveDirectoryToDirectory(worldinserver, worlddir, false);
|
||||
Bukkit.getWorlds().remove(w);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Trys to unload this world later, with the given delay in the config
|
||||
*
|
||||
* @param w the associated world
|
||||
* @exception NullPointerException w == null
|
||||
*/
|
||||
public void unloadLater(World w) {
|
||||
if (!Bukkit.isPrimaryThread()) {
|
||||
Bukkit.getScheduler().runTask(WorldSystem.getInstance(), () -> {
|
||||
unloadLater(w);
|
||||
});
|
||||
return;
|
||||
}
|
||||
Preconditions.checkNotNull(w, "world must not be null");
|
||||
WorldUnloadEvent event = new WorldUnloadEvent(this);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
// Set unloading to true
|
||||
unloading = true;
|
||||
w.save();
|
||||
Chunk[] arrayOfChunk;
|
||||
int j = (arrayOfChunk = w.getLoadedChunks()).length;
|
||||
for (int i = 0; i < j; i++) {
|
||||
Chunk c = arrayOfChunk[i];
|
||||
c.unload();
|
||||
}
|
||||
for (Player a : w.getPlayers()) {
|
||||
a.teleport(PluginConfig.getSpawn());
|
||||
a.setGameMode(PluginConfig.getSpawnGamemode());
|
||||
}
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(WorldSystem.getInstance(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// Still in world unloading process?
|
||||
if (unloading && w.getPlayers().size() == 0) {
|
||||
if (Bukkit.unloadWorld(w, true)) {
|
||||
File worldinserver = new File(Bukkit.getWorldContainer(), worldname);
|
||||
File worlddir = new File(PluginConfig.getWorlddir());
|
||||
try {
|
||||
FileUtils.moveDirectoryToDirectory(worldinserver, worlddir, false);
|
||||
Bukkit.getWorlds().remove(w);
|
||||
unloading = false;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 20 * PluginConfig.getUnloadingTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* Trys to load this world, and messages the player about the process
|
||||
*
|
||||
* @param p the player to teleport on the world
|
||||
* @exception NullPointerException if p is null
|
||||
* @exception IllegalArgumentException if player is not online
|
||||
*/
|
||||
public void load(Player p) {
|
||||
if (!Bukkit.isPrimaryThread()) {
|
||||
Bukkit.getScheduler().runTask(WorldSystem.getInstance(), () -> {
|
||||
load(p);
|
||||
});
|
||||
return;
|
||||
}
|
||||
Preconditions.checkNotNull(p, "player must not be null");
|
||||
Preconditions.checkArgument(p.isOnline(), "player must be online");
|
||||
|
||||
if (creating) {
|
||||
p.sendMessage(MessageConfig.getWorldStillCreating());
|
||||
return;
|
||||
}
|
||||
|
||||
WorldLoadEvent event = new WorldLoadEvent(p, this);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
unloading = false;
|
||||
|
||||
p.sendMessage(MessageConfig.getSettingUpWorld());
|
||||
|
||||
// Move World into Server dir
|
||||
String worlddir = PluginConfig.getWorlddir();
|
||||
File world = new File(worlddir + "/" + worldname);
|
||||
if (!world.exists()) {
|
||||
world = new File(Bukkit.getWorldContainer(), worldname);
|
||||
} else {
|
||||
if (new File(Bukkit.getWorldContainer(), worldname).exists()
|
||||
&& new File(PluginConfig.getWorlddir() + "/" + worldname).exists()) {
|
||||
System.err.println("World " + worldname + " exists twice!");
|
||||
// try {
|
||||
// FileUtils.deleteDirectory(new
|
||||
// File(Bukkit.getWorldContainer(), worldname));
|
||||
// } catch (IOException e) {
|
||||
// p.sendMessage(PluginConfig.getPrefix() + "§cError");
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
}
|
||||
try {
|
||||
FileUtils.moveDirectoryToDirectory(world, Bukkit.getWorldContainer(), false);
|
||||
} catch (IOException e) {
|
||||
System.err.println("Couldn't load world of " + p.getName());
|
||||
p.sendMessage(PluginConfig.getPrefix() + "§cError: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (worldname.charAt(worldname.length() - 37) == ' ') {
|
||||
StringBuilder myName = new StringBuilder(worldname);
|
||||
myName.setCharAt(worldname.length() - 37, '-');
|
||||
world.renameTo(new File(Bukkit.getWorldContainer(), myName.toString()));
|
||||
worldname = myName.toString();
|
||||
}
|
||||
|
||||
WorldCreator creator = PluginConfig.getWorldCreator(worldname);
|
||||
|
||||
World w = Bukkit.getWorld(worldname);
|
||||
if (w == null)
|
||||
w = Bukkit.createWorld(creator);
|
||||
|
||||
this.w = w;
|
||||
|
||||
teleportToWorldSpawn(p);
|
||||
|
||||
OfflinePlayer owner = Bukkit.getOfflinePlayer(WorldConfig.getWorldConfig(worldname).getOwner());
|
||||
DependenceConfig dc = new DependenceConfig(owner);
|
||||
dc.setLastLoaded();
|
||||
}
|
||||
|
||||
/**
|
||||
* Trys to create a new systemworld with all entries etc. finally loads the
|
||||
* world
|
||||
*
|
||||
* @param p Player to create the world for
|
||||
* @return whether it succesfull or not
|
||||
*/
|
||||
public static boolean create(Player p, WorldTemplate template) {
|
||||
|
||||
DependenceConfig dc = new DependenceConfig(p);
|
||||
|
||||
String uuid = p.getUniqueId().toString();
|
||||
int id = DependenceConfig.getHighestID() + 1;
|
||||
String worldname = "ID" + id + "-" + uuid;
|
||||
|
||||
WorldCreator creator = PluginConfig.getWorldCreator(worldname);
|
||||
|
||||
WorldCreateEvent event = new WorldCreateEvent(p, creator);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if (event.isCancelled())
|
||||
return false;
|
||||
|
||||
dc.createNewEntry();
|
||||
|
||||
String worlddir = PluginConfig.getWorlddir();
|
||||
File exampleworld = new File(template.getPath());
|
||||
if (new File(template.getPath() + "/uid.dat").exists()) {
|
||||
new File(template.getPath() + "/uid.dat").delete();
|
||||
}
|
||||
|
||||
File newworld = new File(worlddir + "/" + worldname);
|
||||
|
||||
if (exampleworld.isDirectory())
|
||||
try {
|
||||
FileUtils.copyDirectory(exampleworld, newworld);
|
||||
} catch (IOException e) {
|
||||
System.err.println("Couldn't create world for " + p.getName());
|
||||
e.printStackTrace();
|
||||
}
|
||||
else
|
||||
newworld.mkdirs();
|
||||
|
||||
WorldConfig.create(p);
|
||||
|
||||
// Move World into Server dir
|
||||
File world = new File(worlddir + "/" + worldname);
|
||||
if (!world.exists()) {
|
||||
world = new File(Bukkit.getWorldContainer(), worldname);
|
||||
} else {
|
||||
if (new File(Bukkit.getWorldContainer(), worldname).exists()
|
||||
&& new File(PluginConfig.getWorlddir() + "/" + worldname).exists()) {
|
||||
try {
|
||||
FileUtils.deleteDirectory(new File(Bukkit.getWorldContainer(), worldname));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
try {
|
||||
FileUtils.moveDirectoryToDirectory(world, Bukkit.getWorldContainer(), false);
|
||||
} catch (IOException e) {
|
||||
p.sendMessage(PluginConfig.getPrefix() + "§cError: " + e.getMessage());
|
||||
System.err.println("Couldn't load world of " + p.getName());
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
SystemWorld sw = SystemWorld.getSystemWorld(worldname);
|
||||
sw.setCreating(true);
|
||||
|
||||
// Run in scheduler so method returns without delay
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// For #16
|
||||
WorldSystem.getInstance().getAdapter().create(event.getWorldCreator(), sw, () -> {
|
||||
if (p != null && p.isOnline()) {
|
||||
p.sendMessage(MessageConfig.getWorldCreated());
|
||||
SettingsConfig.getCommandsonGet().stream()
|
||||
.map(s -> s.replace("%player", p.getName()).replace("%world", sw.getName())
|
||||
.replace("%uuid", p.getUniqueId().toString()))
|
||||
.forEach(s -> Bukkit.dispatchCommand(Bukkit.getConsoleSender(), s));
|
||||
}
|
||||
});
|
||||
}
|
||||
}.runTaskLater(WorldSystem.getInstance(), 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return if the world is loaded
|
||||
*/
|
||||
public boolean isLoaded() {
|
||||
File worldAsDir = new File(Bukkit.getWorldContainer(), worldname + "/worldconfig.yml");
|
||||
World w = Bukkit.getWorld(worldname);
|
||||
if (worldAsDir.exists() && w != null)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean exists() {
|
||||
File worldAsDir = new File(Bukkit.getWorldContainer(), worldname + "/worldconfig.yml");
|
||||
if (worldAsDir.exists()) {
|
||||
return true;
|
||||
}
|
||||
worldAsDir = new File(PluginConfig.getWorlddir() + "/" + worldname + "/worldconfig.yml");
|
||||
if (worldAsDir.exists()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Teleports the player to the world with the given settings in the config
|
||||
*
|
||||
* @param p player to teleport
|
||||
* @exception NullPointerException if player is null
|
||||
* @exception IllegalArgumentException if player is not online
|
||||
*/
|
||||
public void teleportToWorldSpawn(Player p) {
|
||||
Preconditions.checkNotNull(p, "player must not be null");
|
||||
Preconditions.checkArgument(p.isOnline(), "player must be online");
|
||||
|
||||
if (creating) {
|
||||
p.sendMessage(MessageConfig.getWorldStillCreating());
|
||||
return;
|
||||
}
|
||||
|
||||
unloading = false;
|
||||
w = Bukkit.getWorld(worldname);
|
||||
if (w == null)
|
||||
return;
|
||||
|
||||
WorldConfig config = WorldConfig.getWorldConfig(worldname);
|
||||
if (config.getHome() != null) {
|
||||
p.teleport(config.getHome());
|
||||
} else {
|
||||
if (PluginConfig.useWorldSpawn()) {
|
||||
p.teleport(PluginConfig.getWorldSpawn(w));
|
||||
} else {
|
||||
p.teleport(w.getSpawnLocation());
|
||||
}
|
||||
}
|
||||
if (PluginConfig.isSurvival()) {
|
||||
p.setGameMode(GameMode.SURVIVAL);
|
||||
} else {
|
||||
p.setGameMode(GameMode.CREATIVE);
|
||||
}
|
||||
|
||||
OfflinePlayer owner = Bukkit.getOfflinePlayer(WorldConfig.getWorldConfig(worldname).getOwner());
|
||||
DependenceConfig dc = new DependenceConfig(owner);
|
||||
dc.setLastLoaded();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the world
|
||||
*/
|
||||
public World getWorld() {
|
||||
return w;
|
||||
}
|
||||
|
||||
public void setCreating(boolean creating) {
|
||||
this.creating = creating;
|
||||
}
|
||||
|
||||
public boolean isCreating() {
|
||||
return creating;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the worldname
|
||||
*/
|
||||
public String getName() {
|
||||
return worldname;
|
||||
}
|
||||
}
|
@ -1,42 +1,42 @@
|
||||
package de.butzlabben.world.wrapper;
|
||||
|
||||
import de.butzlabben.inventory.OrcItem;
|
||||
import de.butzlabben.world.config.GuiConfig;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 15.12.2018
|
||||
*/
|
||||
public class WorldTemplate {
|
||||
|
||||
private final String name;
|
||||
private final OrcItem icon;
|
||||
private final int slot;
|
||||
|
||||
public WorldTemplate(String name) {
|
||||
this.name = name;
|
||||
this.icon = GuiConfig.getItem("worldchoose." + name);
|
||||
this.slot = GuiConfig.getSlot("worldchoose." + name);
|
||||
|
||||
icon.setOnClick((p, inv, item) -> {
|
||||
p.closeInventory();
|
||||
p.chat("/ws get " + name);
|
||||
});
|
||||
}
|
||||
|
||||
public int getSlot() {
|
||||
return slot;
|
||||
}
|
||||
|
||||
public OrcItem getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return "plugins/WorldSystem/worldsources/" + name;
|
||||
}
|
||||
}
|
||||
package de.butzlabben.world.wrapper;
|
||||
|
||||
import de.butzlabben.inventory.OrcItem;
|
||||
import de.butzlabben.world.config.GuiConfig;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 15.12.2018
|
||||
*/
|
||||
public class WorldTemplate {
|
||||
|
||||
private final String name;
|
||||
private final OrcItem icon;
|
||||
private final int slot;
|
||||
|
||||
public WorldTemplate(String name) {
|
||||
this.name = name;
|
||||
this.icon = GuiConfig.getItem("worldchoose." + name);
|
||||
this.slot = GuiConfig.getSlot("worldchoose." + name);
|
||||
|
||||
icon.setOnClick((p, inv, item) -> {
|
||||
p.closeInventory();
|
||||
p.chat("/ws get " + name);
|
||||
});
|
||||
}
|
||||
|
||||
public int getSlot() {
|
||||
return slot;
|
||||
}
|
||||
|
||||
public OrcItem getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return "plugins/WorldSystem/worldsources/" + name;
|
||||
}
|
||||
}
|
@ -1,39 +1,39 @@
|
||||
package de.butzlabben.world.wrapper;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import de.butzlabben.world.config.PluginConfig;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 16.12.2018
|
||||
*/
|
||||
public class WorldTemplateProvider {
|
||||
|
||||
private static WorldTemplateProvider instance = new WorldTemplateProvider();
|
||||
|
||||
public static WorldTemplateProvider getInstace() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
private HashMap<String, WorldTemplate> templates = new HashMap<>();
|
||||
|
||||
private WorldTemplateProvider() {
|
||||
ConfigurationSection section = PluginConfig.getConfig().getConfigurationSection("worldtemplates.templates");
|
||||
for(String key: section.getKeys(false)) {
|
||||
String name = section.getString(key + ".name");
|
||||
templates.put(name, new WorldTemplate(name));
|
||||
}
|
||||
}
|
||||
|
||||
public WorldTemplate getTemplate(String key) {
|
||||
return templates.get(key);
|
||||
}
|
||||
|
||||
public Collection<WorldTemplate> getTemplates() {
|
||||
return templates.values();
|
||||
}
|
||||
}
|
||||
package de.butzlabben.world.wrapper;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import de.butzlabben.world.config.PluginConfig;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 16.12.2018
|
||||
*/
|
||||
public class WorldTemplateProvider {
|
||||
|
||||
private static WorldTemplateProvider instance = new WorldTemplateProvider();
|
||||
|
||||
public static WorldTemplateProvider getInstace() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
private HashMap<String, WorldTemplate> templates = new HashMap<>();
|
||||
|
||||
private WorldTemplateProvider() {
|
||||
ConfigurationSection section = PluginConfig.getConfig().getConfigurationSection("worldtemplates.templates");
|
||||
for(String key: section.getKeys(false)) {
|
||||
String name = section.getString(key + ".name");
|
||||
templates.put(name, new WorldTemplate(name));
|
||||
}
|
||||
}
|
||||
|
||||
public WorldTemplate getTemplate(String key) {
|
||||
return templates.get(key);
|
||||
}
|
||||
|
||||
public Collection<WorldTemplate> getTemplates() {
|
||||
return templates.values();
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,105 +1,105 @@
|
||||
##########################################################################
|
||||
### __ __ __ _______ __ ###
|
||||
### \ \ / / / / / / ___/ / / ###
|
||||
### \ \ __ / /___ ___/ /___/ / /____ ______/ /______________ ###
|
||||
### \ \ / \ / / __ \/ _/ / __ /__ / / / / __/ __/ ___/ _ _ / ###
|
||||
### \ \/ /\ \/ / /_/ / // / /_/ /__/ / /_/ /_ / /_/ ___/ // // / ###
|
||||
### \__/ \__/\____/_//_/\__,_/____/\__, /___/\__/\___/_//_//_/ ###
|
||||
### ___/ / ###
|
||||
### \___/ ###
|
||||
##########################################################################
|
||||
|
||||
# Path where the worlds will be saved
|
||||
worldfolder: 'plugins/WorldSystem/Worlds'
|
||||
|
||||
worldtemplates:
|
||||
# Wheter players can decide on different templates
|
||||
multi_choose: false
|
||||
# If multi_choose is disabled, which template should be choosen
|
||||
default: 'template_default'
|
||||
templates:
|
||||
# The "1" can be any key
|
||||
1:
|
||||
# Name of directory in plugins/WorldSystem/worldsources
|
||||
# e.g. this would be plugins/WorldSystem/worldsources/template_default
|
||||
name: 'template_default'
|
||||
2:
|
||||
name: 'another_template'
|
||||
|
||||
# If a confirm is needed before auto-update
|
||||
need_confirm: true
|
||||
|
||||
# When nobody is on a world time until it get unloaded
|
||||
unloadingtime: 20
|
||||
|
||||
# If true nobody can teleport or change their gamemode a WorldSystem world
|
||||
# Except for players with the permissions: ws.gamemode | ws.tp.*
|
||||
survival: false
|
||||
|
||||
# If true players will teleported to the spawn on join
|
||||
spawn_teleportation: true
|
||||
|
||||
# Time in seconds until a request expires
|
||||
request_expires: 20
|
||||
|
||||
# Name of the languagefile in plugins/WorldSystem/messages/
|
||||
language: en
|
||||
|
||||
# Prefix which will be shown before each message
|
||||
prefix: '&8[&3WorldSystem&8] &6'
|
||||
|
||||
# Time in days after a not used world will be deleted
|
||||
# Set to -1 to disable
|
||||
delete_after: -1
|
||||
|
||||
# Whether WorldSystem should contact the Mojang authserver
|
||||
# If not, some unknown playernames will not be displayed
|
||||
# eg. in the gui or in /ws info
|
||||
contact_authserver: true
|
||||
|
||||
# Options for the LagSystem:
|
||||
# period_in_seconds - how often will be checked for entities in seconds
|
||||
# entities_per_world - maximal allowed entities per world
|
||||
# garbagecollector - how often will be unused ram be cleared
|
||||
lagsystem:
|
||||
period_in_seconds: 10
|
||||
entities_per_world: 350
|
||||
garbagecollector:
|
||||
use: false
|
||||
period_in_minutes: 5
|
||||
|
||||
# Options for random world generation
|
||||
worldgeneration:
|
||||
# A seed for worldgeneration
|
||||
# Set it to 0 for no seed-useage
|
||||
seed: 0
|
||||
# Environment for the world
|
||||
# Valid inputs are 'NORMAL', 'NETHER' and 'THE_END'
|
||||
environment: NORMAL
|
||||
# Type of the world eg. flat, amplified, ...
|
||||
# Valid types are 'NORMAL', 'VERSION_1_1', 'FLAT', 'AMPLIFIED', 'CUSTOMIZED' or 'LARGE_BIOMES'
|
||||
type: NORMAL
|
||||
# Put in here the name of a generator
|
||||
# If you have one from one plugin
|
||||
generator: ''
|
||||
|
||||
# Location where you will be teleported when you leave you world
|
||||
spawn:
|
||||
gamemode: 2
|
||||
spawnpoint:
|
||||
world: world
|
||||
x: 0
|
||||
y: 20
|
||||
z: 0
|
||||
yaw: 0
|
||||
pitch: 0
|
||||
|
||||
# Location where you spawn when you join a world
|
||||
worldspawn:
|
||||
use: false
|
||||
spawnpoint:
|
||||
x: 0
|
||||
y: 20
|
||||
z: 0
|
||||
yaw: 0
|
||||
pitch: 0
|
||||
##########################################################################
|
||||
### __ __ __ _______ __ ###
|
||||
### \ \ / / / / / / ___/ / / ###
|
||||
### \ \ __ / /___ ___/ /___/ / /____ ______/ /______________ ###
|
||||
### \ \ / \ / / __ \/ _/ / __ /__ / / / / __/ __/ ___/ _ _ / ###
|
||||
### \ \/ /\ \/ / /_/ / // / /_/ /__/ / /_/ /_ / /_/ ___/ // // / ###
|
||||
### \__/ \__/\____/_//_/\__,_/____/\__, /___/\__/\___/_//_//_/ ###
|
||||
### ___/ / ###
|
||||
### \___/ ###
|
||||
##########################################################################
|
||||
|
||||
# Path where the worlds will be saved
|
||||
worldfolder: 'plugins/WorldSystem/Worlds'
|
||||
|
||||
worldtemplates:
|
||||
# Wheter players can decide on different templates
|
||||
multi_choose: false
|
||||
# If multi_choose is disabled, which template should be choosen
|
||||
default: 'template_default'
|
||||
templates:
|
||||
# The "1" can be any key
|
||||
1:
|
||||
# Name of directory in plugins/WorldSystem/worldsources
|
||||
# e.g. this would be plugins/WorldSystem/worldsources/template_default
|
||||
name: 'template_default'
|
||||
2:
|
||||
name: 'another_template'
|
||||
|
||||
# If a confirm is needed before auto-update
|
||||
need_confirm: true
|
||||
|
||||
# When nobody is on a world time until it get unloaded
|
||||
unloadingtime: 20
|
||||
|
||||
# If true nobody can teleport or change their gamemode a WorldSystem world
|
||||
# Except for players with the permissions: ws.gamemode | ws.tp.*
|
||||
survival: false
|
||||
|
||||
# If true players will teleported to the spawn on join
|
||||
spawn_teleportation: true
|
||||
|
||||
# Time in seconds until a request expires
|
||||
request_expires: 20
|
||||
|
||||
# Name of the languagefile in plugins/WorldSystem/messages/
|
||||
language: en
|
||||
|
||||
# Prefix which will be shown before each message
|
||||
prefix: '&8[&3WorldSystem&8] &6'
|
||||
|
||||
# Time in days after a not used world will be deleted
|
||||
# Set to -1 to disable
|
||||
delete_after: -1
|
||||
|
||||
# Whether WorldSystem should contact the Mojang authserver
|
||||
# If not, some unknown playernames will not be displayed
|
||||
# eg. in the gui or in /ws info
|
||||
contact_authserver: true
|
||||
|
||||
# Options for the LagSystem:
|
||||
# period_in_seconds - how often will be checked for entities in seconds
|
||||
# entities_per_world - maximal allowed entities per world
|
||||
# garbagecollector - how often will be unused ram be cleared
|
||||
lagsystem:
|
||||
period_in_seconds: 10
|
||||
entities_per_world: 350
|
||||
garbagecollector:
|
||||
use: false
|
||||
period_in_minutes: 5
|
||||
|
||||
# Options for random world generation
|
||||
worldgeneration:
|
||||
# A seed for worldgeneration
|
||||
# Set it to 0 for no seed-useage
|
||||
seed: 0
|
||||
# Environment for the world
|
||||
# Valid inputs are 'NORMAL', 'NETHER' and 'THE_END'
|
||||
environment: NORMAL
|
||||
# Type of the world eg. flat, amplified, ...
|
||||
# Valid types are 'NORMAL', 'VERSION_1_1', 'FLAT', 'AMPLIFIED', 'CUSTOMIZED' or 'LARGE_BIOMES'
|
||||
type: NORMAL
|
||||
# Put in here the name of a generator
|
||||
# If you have one from one plugin
|
||||
generator: ''
|
||||
|
||||
# Location where you will be teleported when you leave you world
|
||||
spawn:
|
||||
gamemode: 2
|
||||
spawnpoint:
|
||||
world: world
|
||||
x: 0
|
||||
y: 20
|
||||
z: 0
|
||||
yaw: 0
|
||||
pitch: 0
|
||||
|
||||
# Location where you spawn when you join a world
|
||||
worldspawn:
|
||||
use: false
|
||||
spawnpoint:
|
||||
x: 0
|
||||
y: 20
|
||||
z: 0
|
||||
yaw: 0
|
||||
pitch: 0
|
@ -1,82 +1,82 @@
|
||||
nopermission: ""
|
||||
unknown_error: ""
|
||||
lagdetection: "%world"
|
||||
wrong_usage: ""
|
||||
not_registered: ""
|
||||
|
||||
world:
|
||||
reseted: ""
|
||||
still_loaded: ""
|
||||
not_on: ""
|
||||
created: ""
|
||||
already_exists: ""
|
||||
delete:
|
||||
own: ""
|
||||
other: "%player"
|
||||
does_not_exists:
|
||||
own: ""
|
||||
other: ""
|
||||
setting_up: ""
|
||||
playerlist: "%players"
|
||||
still_creating: ""
|
||||
set_home: ""
|
||||
|
||||
member:
|
||||
removed: "%player"
|
||||
added: "%player"
|
||||
already_added: "
|
||||
not_added:
|
||||
own: ""
|
||||
other: ""
|
||||
no_one_added
|
||||
|
||||
request:
|
||||
expired: ""
|
||||
confirm: "%command"
|
||||
until_expire: "%time"
|
||||
already_sent: ""
|
||||
not_sent: ""
|
||||
invalid_input: "%input"
|
||||
|
||||
toggle:
|
||||
gamemode:
|
||||
enabled: ""
|
||||
disabled: ""
|
||||
teleport:
|
||||
enabled: ""
|
||||
disabled: ""
|
||||
build:
|
||||
enabled: ""
|
||||
disabled: ""
|
||||
fire:
|
||||
enabled: ""
|
||||
disabled: ""
|
||||
tnt:
|
||||
enabled: ""
|
||||
disabled: ""
|
||||
|
||||
info:
|
||||
owner: "%data"
|
||||
id: "%data"
|
||||
member: "%data"
|
||||
tnt: "%data"
|
||||
fire: "%data"
|
||||
enabled: ""
|
||||
disabled: ""
|
||||
|
||||
command_help:
|
||||
list:
|
||||
- ""
|
||||
- ""
|
||||
- ""
|
||||
- ""
|
||||
- ""
|
||||
- ""
|
||||
- ""
|
||||
- ""
|
||||
- ""
|
||||
- ""
|
||||
- ""
|
||||
- ""
|
||||
- ""
|
||||
nopermission: ""
|
||||
unknown_error: ""
|
||||
lagdetection: "%world"
|
||||
wrong_usage: ""
|
||||
not_registered: ""
|
||||
|
||||
world:
|
||||
reseted: ""
|
||||
still_loaded: ""
|
||||
not_on: ""
|
||||
created: ""
|
||||
already_exists: ""
|
||||
delete:
|
||||
own: ""
|
||||
other: "%player"
|
||||
does_not_exists:
|
||||
own: ""
|
||||
other: ""
|
||||
setting_up: ""
|
||||
playerlist: "%players"
|
||||
still_creating: ""
|
||||
set_home: ""
|
||||
|
||||
member:
|
||||
removed: "%player"
|
||||
added: "%player"
|
||||
already_added: "
|
||||
not_added:
|
||||
own: ""
|
||||
other: ""
|
||||
no_one_added
|
||||
|
||||
request:
|
||||
expired: ""
|
||||
confirm: "%command"
|
||||
until_expire: "%time"
|
||||
already_sent: ""
|
||||
not_sent: ""
|
||||
invalid_input: "%input"
|
||||
|
||||
toggle:
|
||||
gamemode:
|
||||
enabled: ""
|
||||
disabled: ""
|
||||
teleport:
|
||||
enabled: ""
|
||||
disabled: ""
|
||||
build:
|
||||
enabled: ""
|
||||
disabled: ""
|
||||
fire:
|
||||
enabled: ""
|
||||
disabled: ""
|
||||
tnt:
|
||||
enabled: ""
|
||||
disabled: ""
|
||||
|
||||
info:
|
||||
owner: "%data"
|
||||
id: "%data"
|
||||
member: "%data"
|
||||
tnt: "%data"
|
||||
fire: "%data"
|
||||
enabled: ""
|
||||
disabled: ""
|
||||
|
||||
command_help:
|
||||
list:
|
||||
- ""
|
||||
- ""
|
||||
- ""
|
||||
- ""
|
||||
- ""
|
||||
- ""
|
||||
- ""
|
||||
- ""
|
||||
- ""
|
||||
- ""
|
||||
- ""
|
||||
- ""
|
||||
- ""
|
||||
delete_command: ""
|
@ -1,84 +1,84 @@
|
||||
nopermission: "&cNo tienes permiso."
|
||||
unknown_error: "&cAlgo salio mal..."
|
||||
lagdetection: "Deteccion de lag en el mundo: &c%world"
|
||||
wrong_usage: "&c%usage"
|
||||
not_registered: "&cEse jugador no existe."
|
||||
|
||||
world:
|
||||
reseted: "Tu mundo ha sido reiniciado."
|
||||
still_loaded: "&cTu mundo aun esta cargando."
|
||||
not_on: "&cNo estas en un mundo."
|
||||
created: "Tu mundo esta listo. Ve a el con &a/ws home&6."
|
||||
already_exists: "&cYa tienes un mundo."
|
||||
delete:
|
||||
own: "&cTu mundo ha sido eliminado"
|
||||
other: "Has eliminado el mundo de &c%player&6."
|
||||
does_not_exists:
|
||||
own: "&cNo tienes un mundo."
|
||||
other: "&cEse jugador no tiene un mundo."
|
||||
setting_up: "&aConfigurando el mundo..."
|
||||
playerlist: "Jugadores en este mundo: %players"
|
||||
still_creating: "&cWorld is still creating"
|
||||
set_home: "You set the home"
|
||||
|
||||
member:
|
||||
removed: "Has eliminado a &c%player&6 de tu mundo."
|
||||
added: "Has agregado a &c%player&6 a tu mundo."
|
||||
already_added: "&cEse jugador ya es miembro de tu mundo."
|
||||
not_added:
|
||||
own: "&cEse jugador no es miembro de tu mundo."
|
||||
other: "&cNo estas agregado a este mundo."
|
||||
no_one_added: "&cThere are no members added"
|
||||
|
||||
request:
|
||||
expired: "&cTu solicitud ha expirado."
|
||||
confirm: "&cPor favor confirma el reinicio de tu mundo con: %command"
|
||||
until_expire: "&cTu solicitud expira en %time segundos."
|
||||
already_sent: "&cYa has enviado una solicitud."
|
||||
not_sent: "&cNo has enviado una solicitud."
|
||||
invalid_input: "&c%input no es una entrada valida."
|
||||
|
||||
toggle:
|
||||
gamemode:
|
||||
enabled: "&a%player&6 ahora puede cambiar su modo de juego."
|
||||
disabled: "&c%player&6 ya no puede cambiar su modo de juego."
|
||||
teleport:
|
||||
enabled: "&a%player&6 ahora puede teletransportarse."
|
||||
disabled: "&c%player&6 ya no puede teletransportarse."
|
||||
build:
|
||||
enabled: "&a%player&6 ahora puede construir."
|
||||
disabled: "&c%player&6 ya no puede construir"
|
||||
fire:
|
||||
enabled: "&aHas activado el fuego."
|
||||
disabled: "&cHas desactivado el fuego."
|
||||
tnt:
|
||||
enabled: "&aHas activado la TNT."
|
||||
disabled: "&cHas desactivado la TNT."
|
||||
|
||||
info:
|
||||
owner: "Propietario: %data"
|
||||
id: "ID: %data"
|
||||
member: "Miembros: %data"
|
||||
tnt: "TNT: %data"
|
||||
fire: "Fuego: %data"
|
||||
enabled: "&aSi"
|
||||
disabled: "&cNo"
|
||||
|
||||
command_help:
|
||||
list:
|
||||
- "/ws get &8- &7Obten tu mundo"
|
||||
- "/ws home &8- &7Ve a tu mundo"
|
||||
- "/ws sethome &8- &7Sets a specific home"
|
||||
- "/ws gui &8- &7Abre el menu de tu mundo"
|
||||
- "/ws tp &8- &7Ve a un mundo especifico"
|
||||
- "/ws addmember &8- &7Agrega jugadores a tu mundo"
|
||||
- "/ws delmember &8- &7Elimina jugadores de tu mundo"
|
||||
- "/ws leave &8- &7Salir de un mundo"
|
||||
- "/ws tnt &8- &7Activa/Desactiva la TNT en tu mundo"
|
||||
- "/ws fire &8- &7Activa/Desactiva el FUEGO en tu mundo"
|
||||
- "/ws togglegm &8- &7Activa/Desactiva el cambio de modo"
|
||||
- "/ws togglebuild &8- &7Activa/Desactiva la construccion"
|
||||
- "/ws toggletp &8- &7Activa/Desactiva la teletransportacion"
|
||||
- "/ws info &8- &7Muestra informacion del mundo"
|
||||
- "/ws reset &8- &7Reinicia tu mundo"
|
||||
nopermission: "&cNo tienes permiso."
|
||||
unknown_error: "&cAlgo salio mal..."
|
||||
lagdetection: "Deteccion de lag en el mundo: &c%world"
|
||||
wrong_usage: "&c%usage"
|
||||
not_registered: "&cEse jugador no existe."
|
||||
|
||||
world:
|
||||
reseted: "Tu mundo ha sido reiniciado."
|
||||
still_loaded: "&cTu mundo aun esta cargando."
|
||||
not_on: "&cNo estas en un mundo."
|
||||
created: "Tu mundo esta listo. Ve a el con &a/ws home&6."
|
||||
already_exists: "&cYa tienes un mundo."
|
||||
delete:
|
||||
own: "&cTu mundo ha sido eliminado"
|
||||
other: "Has eliminado el mundo de &c%player&6."
|
||||
does_not_exists:
|
||||
own: "&cNo tienes un mundo."
|
||||
other: "&cEse jugador no tiene un mundo."
|
||||
setting_up: "&aConfigurando el mundo..."
|
||||
playerlist: "Jugadores en este mundo: %players"
|
||||
still_creating: "&cWorld is still creating"
|
||||
set_home: "You set the home"
|
||||
|
||||
member:
|
||||
removed: "Has eliminado a &c%player&6 de tu mundo."
|
||||
added: "Has agregado a &c%player&6 a tu mundo."
|
||||
already_added: "&cEse jugador ya es miembro de tu mundo."
|
||||
not_added:
|
||||
own: "&cEse jugador no es miembro de tu mundo."
|
||||
other: "&cNo estas agregado a este mundo."
|
||||
no_one_added: "&cThere are no members added"
|
||||
|
||||
request:
|
||||
expired: "&cTu solicitud ha expirado."
|
||||
confirm: "&cPor favor confirma el reinicio de tu mundo con: %command"
|
||||
until_expire: "&cTu solicitud expira en %time segundos."
|
||||
already_sent: "&cYa has enviado una solicitud."
|
||||
not_sent: "&cNo has enviado una solicitud."
|
||||
invalid_input: "&c%input no es una entrada valida."
|
||||
|
||||
toggle:
|
||||
gamemode:
|
||||
enabled: "&a%player&6 ahora puede cambiar su modo de juego."
|
||||
disabled: "&c%player&6 ya no puede cambiar su modo de juego."
|
||||
teleport:
|
||||
enabled: "&a%player&6 ahora puede teletransportarse."
|
||||
disabled: "&c%player&6 ya no puede teletransportarse."
|
||||
build:
|
||||
enabled: "&a%player&6 ahora puede construir."
|
||||
disabled: "&c%player&6 ya no puede construir"
|
||||
fire:
|
||||
enabled: "&aHas activado el fuego."
|
||||
disabled: "&cHas desactivado el fuego."
|
||||
tnt:
|
||||
enabled: "&aHas activado la TNT."
|
||||
disabled: "&cHas desactivado la TNT."
|
||||
|
||||
info:
|
||||
owner: "Propietario: %data"
|
||||
id: "ID: %data"
|
||||
member: "Miembros: %data"
|
||||
tnt: "TNT: %data"
|
||||
fire: "Fuego: %data"
|
||||
enabled: "&aSi"
|
||||
disabled: "&cNo"
|
||||
|
||||
command_help:
|
||||
list:
|
||||
- "/ws get &8- &7Obten tu mundo"
|
||||
- "/ws home &8- &7Ve a tu mundo"
|
||||
- "/ws sethome &8- &7Sets a specific home"
|
||||
- "/ws gui &8- &7Abre el menu de tu mundo"
|
||||
- "/ws tp &8- &7Ve a un mundo especifico"
|
||||
- "/ws addmember &8- &7Agrega jugadores a tu mundo"
|
||||
- "/ws delmember &8- &7Elimina jugadores de tu mundo"
|
||||
- "/ws leave &8- &7Salir de un mundo"
|
||||
- "/ws tnt &8- &7Activa/Desactiva la TNT en tu mundo"
|
||||
- "/ws fire &8- &7Activa/Desactiva el FUEGO en tu mundo"
|
||||
- "/ws togglegm &8- &7Activa/Desactiva el cambio de modo"
|
||||
- "/ws togglebuild &8- &7Activa/Desactiva la construccion"
|
||||
- "/ws toggletp &8- &7Activa/Desactiva la teletransportacion"
|
||||
- "/ws info &8- &7Muestra informacion del mundo"
|
||||
- "/ws reset &8- &7Reinicia tu mundo"
|
||||
delete_command: "/ws delete &8- &7Elimina tu mundo"
|
@ -1,84 +1,84 @@
|
||||
nopermission: "&cSinulla ei ole lupaa tuohon komentoon!"
|
||||
unknown_error: "&cJotain meni pieleen..."
|
||||
lagdetection: "Lagia havaittu maailmassa: &c%world"
|
||||
wrong_usage: "&c%usage"
|
||||
not_registered: "&cTämä pelaaja ei ole liittynyt vielä!"
|
||||
|
||||
world:
|
||||
reseted: "Maailmasi nollautui!"
|
||||
still_loaded: "&cMailmasi on vieläkin ladattu!"
|
||||
not_on: "&cEt ole maailmassa!"
|
||||
created: "Maailmasi on nyt valmis. Pääset sinne komennolla &a/ws home"
|
||||
already_exists: "&cSinulla on jo maailma!"
|
||||
delete:
|
||||
own: "&cMaailmasi poistettiin!"
|
||||
other: "Poistit pelaajan &c%player&6 maailman&6!"
|
||||
does_not_exists:
|
||||
own: "&cSinulla ei ole maailmaa!"
|
||||
other: "&cKyseisellä pelaajalla ei ole maailmaa!"
|
||||
setting_up: "&aAlustetaan maailmaa..."
|
||||
playerlist: "Pelaajat tässä maailmassa: %players"
|
||||
still_creating: "&cWorld is still creating"
|
||||
set_home: "You set the home"
|
||||
|
||||
member:
|
||||
removed: "Poistit pelaajan &c%player&6 maailmastasi!"
|
||||
added: "Lisäsit pelaajan &c%player&6 maailmaasi!"
|
||||
already_added: "&cKyseinen pelaaja on jo jäsen!"
|
||||
not_added:
|
||||
own: "&cKyseinen pelaaja ei ole jäsen!"
|
||||
other: "&cSinua ei ole lisätty tähän maailmaan"
|
||||
no_one_added: "&cThere are no members added"
|
||||
|
||||
request:
|
||||
expired: "&cPyyntösi on vanhentunut!"
|
||||
confirm: "&cVahvista maailmasi nollaaminen: %command"
|
||||
until_expire: "&cPyyntösi vanhentuu %time seconds sekunnin kuluttua!"
|
||||
already_sent: "&cLähetit jo pyynnön!"
|
||||
not_sent: "&cEt lähettänyt pyyntöä!"
|
||||
invalid_input: "&cSyöte ei ole kelvollinen!"
|
||||
|
||||
toggle:
|
||||
gamemode:
|
||||
enabled: "&a%player&6 voi nyt vaihtaa pelimuotonsa!"
|
||||
disabled: "&c%player&6 ei voi enää vaihtaa pelimuotoansa!"
|
||||
teleport:
|
||||
enabled: "&a%player&6 voi nyt teleportata!"
|
||||
disabled: "&c%player&6 ei voi enään teleportata!"
|
||||
build:
|
||||
enabled: "&a%player&6 voi nyt rakentaa!"
|
||||
disabled: "&c%player&6 ei voi enään rakentaa!"
|
||||
fire:
|
||||
enabled: "&aSinä aktivoit tulen!"
|
||||
disabled: "&cSinä deaktivoit tulen!"
|
||||
tnt:
|
||||
enabled: "&aSinä aktivoit TNT-Damagen!"
|
||||
disabled: "&cSinä deaktivoit TNT-Damagen!"
|
||||
|
||||
info:
|
||||
owner: "Omistaja: %data"
|
||||
id: "ID: %data"
|
||||
member: "Jäsen: %data"
|
||||
tnt: "TNT: %data"
|
||||
fire: "Tuli: %data"
|
||||
enabled: "&aOn"
|
||||
disabled: "&cOff"
|
||||
|
||||
command_help:
|
||||
list:
|
||||
- "/ws get &8- &7Luo sinulle maailman"
|
||||
- "/ws home &8- &7Teleporttaa sinut maailmaasi"
|
||||
- "/ws sethome &8- &7Sets a specific home"
|
||||
- "/ws gui &8- &7Avaa sinulle valikon jos omistat tämän maailman"
|
||||
- "/ws tp &8- &7Teleporttaa sinut tiettyyn maailmaan"
|
||||
- "/ws addmember &8- &7Lisää pelaajan sinun maailmaasi"
|
||||
- "/ws delmember &8- &7Poistaa pelaajan sinun maailmastasi"
|
||||
- "/ws leave &8- &7Lähtee maailmasta"
|
||||
- "/ws tnt &8- &7Sallii/Kieltää TNT sinun maailmastasi"
|
||||
- "/ws fire &8- &7Sallii/Kieltää Tulen sinun maailmastasi"
|
||||
- "/ws togglegm &8- &7Sallii/Kieltää pelaajan vaihtamasta pelimuotoansa"
|
||||
- "/ws togglebuild &8- &7Sallii/Kieltää pelaajan rakentamasta"
|
||||
- "/ws toggletp &8- &7Sallii/Kieltää pelaajan treleporttaamasta"
|
||||
- "/ws info &8- &7Näyttää tietoa aktiivisesta maailmasta"
|
||||
- "/ws reset &8- &7Nollaa sinun maailmasi"
|
||||
nopermission: "&cSinulla ei ole lupaa tuohon komentoon!"
|
||||
unknown_error: "&cJotain meni pieleen..."
|
||||
lagdetection: "Lagia havaittu maailmassa: &c%world"
|
||||
wrong_usage: "&c%usage"
|
||||
not_registered: "&cTämä pelaaja ei ole liittynyt vielä!"
|
||||
|
||||
world:
|
||||
reseted: "Maailmasi nollautui!"
|
||||
still_loaded: "&cMailmasi on vieläkin ladattu!"
|
||||
not_on: "&cEt ole maailmassa!"
|
||||
created: "Maailmasi on nyt valmis. Pääset sinne komennolla &a/ws home"
|
||||
already_exists: "&cSinulla on jo maailma!"
|
||||
delete:
|
||||
own: "&cMaailmasi poistettiin!"
|
||||
other: "Poistit pelaajan &c%player&6 maailman&6!"
|
||||
does_not_exists:
|
||||
own: "&cSinulla ei ole maailmaa!"
|
||||
other: "&cKyseisellä pelaajalla ei ole maailmaa!"
|
||||
setting_up: "&aAlustetaan maailmaa..."
|
||||
playerlist: "Pelaajat tässä maailmassa: %players"
|
||||
still_creating: "&cWorld is still creating"
|
||||
set_home: "You set the home"
|
||||
|
||||
member:
|
||||
removed: "Poistit pelaajan &c%player&6 maailmastasi!"
|
||||
added: "Lisäsit pelaajan &c%player&6 maailmaasi!"
|
||||
already_added: "&cKyseinen pelaaja on jo jäsen!"
|
||||
not_added:
|
||||
own: "&cKyseinen pelaaja ei ole jäsen!"
|
||||
other: "&cSinua ei ole lisätty tähän maailmaan"
|
||||
no_one_added: "&cThere are no members added"
|
||||
|
||||
request:
|
||||
expired: "&cPyyntösi on vanhentunut!"
|
||||
confirm: "&cVahvista maailmasi nollaaminen: %command"
|
||||
until_expire: "&cPyyntösi vanhentuu %time seconds sekunnin kuluttua!"
|
||||
already_sent: "&cLähetit jo pyynnön!"
|
||||
not_sent: "&cEt lähettänyt pyyntöä!"
|
||||
invalid_input: "&cSyöte ei ole kelvollinen!"
|
||||
|
||||
toggle:
|
||||
gamemode:
|
||||
enabled: "&a%player&6 voi nyt vaihtaa pelimuotonsa!"
|
||||
disabled: "&c%player&6 ei voi enää vaihtaa pelimuotoansa!"
|
||||
teleport:
|
||||
enabled: "&a%player&6 voi nyt teleportata!"
|
||||
disabled: "&c%player&6 ei voi enään teleportata!"
|
||||
build:
|
||||
enabled: "&a%player&6 voi nyt rakentaa!"
|
||||
disabled: "&c%player&6 ei voi enään rakentaa!"
|
||||
fire:
|
||||
enabled: "&aSinä aktivoit tulen!"
|
||||
disabled: "&cSinä deaktivoit tulen!"
|
||||
tnt:
|
||||
enabled: "&aSinä aktivoit TNT-Damagen!"
|
||||
disabled: "&cSinä deaktivoit TNT-Damagen!"
|
||||
|
||||
info:
|
||||
owner: "Omistaja: %data"
|
||||
id: "ID: %data"
|
||||
member: "Jäsen: %data"
|
||||
tnt: "TNT: %data"
|
||||
fire: "Tuli: %data"
|
||||
enabled: "&aOn"
|
||||
disabled: "&cOff"
|
||||
|
||||
command_help:
|
||||
list:
|
||||
- "/ws get &8- &7Luo sinulle maailman"
|
||||
- "/ws home &8- &7Teleporttaa sinut maailmaasi"
|
||||
- "/ws sethome &8- &7Sets a specific home"
|
||||
- "/ws gui &8- &7Avaa sinulle valikon jos omistat tämän maailman"
|
||||
- "/ws tp &8- &7Teleporttaa sinut tiettyyn maailmaan"
|
||||
- "/ws addmember &8- &7Lisää pelaajan sinun maailmaasi"
|
||||
- "/ws delmember &8- &7Poistaa pelaajan sinun maailmastasi"
|
||||
- "/ws leave &8- &7Lähtee maailmasta"
|
||||
- "/ws tnt &8- &7Sallii/Kieltää TNT sinun maailmastasi"
|
||||
- "/ws fire &8- &7Sallii/Kieltää Tulen sinun maailmastasi"
|
||||
- "/ws togglegm &8- &7Sallii/Kieltää pelaajan vaihtamasta pelimuotoansa"
|
||||
- "/ws togglebuild &8- &7Sallii/Kieltää pelaajan rakentamasta"
|
||||
- "/ws toggletp &8- &7Sallii/Kieltää pelaajan treleporttaamasta"
|
||||
- "/ws info &8- &7Näyttää tietoa aktiivisesta maailmasta"
|
||||
- "/ws reset &8- &7Nollaa sinun maailmasi"
|
||||
delete_command: "/ws delete &8- &7Poistaa maailman"
|
@ -1,85 +1,85 @@
|
||||
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"
|
||||
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"
|
@ -1,84 +1,84 @@
|
||||
nopermission: "&cJij hebt geen rechten om dit te doen!"
|
||||
unknown_error: "&cEr is iets verkeerd gegaan.."
|
||||
lagdetection: "Lag gededecteerd in wereld: &c%world"
|
||||
wrong_usage: "&c%gebruik"
|
||||
not_registered: "&cDeze speler heeft nog nooit gejoined!"
|
||||
|
||||
world:
|
||||
reseted: "Jouw wereld is gereset!"
|
||||
still_loaded: "&cJouw wereld is nog steeds geladen!"
|
||||
not_on: "&cJij bent niet in een wereld!"
|
||||
created: "Jouw wereld is gemaakt gebruik: &a/ws home"
|
||||
already_exists: "&cJij hebt al een wereld!"
|
||||
delete:
|
||||
own: "&cJouw wereld is verwijderd!"
|
||||
other: "Jij hebt de wereld verwijderd van: &c%player&6!"
|
||||
does_not_exists:
|
||||
own: "&cJij hebt nog geen wereld!"
|
||||
other: "&cDeze speler heeft nog geen wereld!"
|
||||
setting_up: "&aWereld word aangemaakt"
|
||||
playerlist: "speler is in wereld: %players"
|
||||
still_creating: "&cWorld is still creating"
|
||||
set_home: "You set the home"
|
||||
|
||||
member:
|
||||
removed: "Jij hebt &c%player&6 verwijderd van jouw wereld!"
|
||||
added: "Jij hebt &c%player&6 toegevoegd aan jouw wereld!"
|
||||
already_added: "&cDeze speler is al toegevoegd!"
|
||||
not_added:
|
||||
own: "&cDeze speler is nog niet toegevoegd!"
|
||||
other: "&cJij bent niet aan deze wereld toegevoegd"
|
||||
no_one_added: "&cThere are no members added"
|
||||
|
||||
request:
|
||||
expired: "&cJouw uitnodiging is verlopen!"
|
||||
confirm: "&cBevestig het verwijderen van jouw wereld: %command"
|
||||
until_expire: "&cJouw uitnodiging verloopt over %time seconden!"
|
||||
already_sent: "&cJij hebt al een uitnodiging verstuurd!"
|
||||
not_sent: "&cJij hebt geen uitnodiging gestuurd!"
|
||||
invalid_input: "&c%input is niet een command!"
|
||||
|
||||
toggle:
|
||||
gamemode:
|
||||
enabled: "&a%player&6 kan nu zijn spelermodus veranderen!"
|
||||
disabled: "&c%player&6 kan niet meer zijn spelermodus veranderen!"
|
||||
teleport:
|
||||
enabled: "&a%player&6 kan nu teleporteren!"
|
||||
disabled: "&c%player&6 kan nu niet meer teleporteren!"
|
||||
build:
|
||||
enabled: "&a%player&6 kan nu bouwen!"
|
||||
disabled: "&c%player&6 kan nu niet meer bouwen!"
|
||||
fire:
|
||||
enabled: "&aJij hebt vuur geactiveert!"
|
||||
disabled: "&cJij hebt vuur gedeactiveerd!"
|
||||
tnt:
|
||||
enabled: "&aJij hebt TNT-schade geactiveerd!"
|
||||
disabled: "&cJij hebt TNT-schade gedeactiveerd!"
|
||||
|
||||
info:
|
||||
owner: "Owner: %data"
|
||||
id: "ID: %data"
|
||||
member: "Toegevoegd: %data"
|
||||
tnt: "TNT: %data"
|
||||
fire: "Vuur: %data"
|
||||
enabled: "&Aan"
|
||||
disabled: "&cUit"
|
||||
|
||||
command_help:
|
||||
list:
|
||||
- "/ws get &8- &7Will give you a world"
|
||||
- "/ws home &8- &7Teleports you on your world"
|
||||
- "/ws sethome &8- &7Sets a specific home"
|
||||
- "/ws gui &8- &7Opens the GUI menu if you are the worldowner"
|
||||
- "/ws tp &8- &7Teleports you on a specific world"
|
||||
- "/ws addmember &8- &7Adds a player to your world"
|
||||
- "/ws delmember &8- &7Removes a player from your world"
|
||||
- "/ws leave &8- &7Leave a world"
|
||||
- "/ws tnt &8- &7Allows/Denys TNT on your world"
|
||||
- "/ws fire &8- &7Allows/Denys Fire on your world"
|
||||
- "/ws togglegm &8- &7Allows/Denys a player changing gamemode"
|
||||
- "/ws togglebuild &8- &7Allows/Denys a player building"
|
||||
- "/ws toggletp &8- &7Allows/Denys a player teleporting"
|
||||
- "/ws info &8- &7Shows information about the world"
|
||||
- "/ws reset &8- &7Will reset your world"
|
||||
nopermission: "&cJij hebt geen rechten om dit te doen!"
|
||||
unknown_error: "&cEr is iets verkeerd gegaan.."
|
||||
lagdetection: "Lag gededecteerd in wereld: &c%world"
|
||||
wrong_usage: "&c%gebruik"
|
||||
not_registered: "&cDeze speler heeft nog nooit gejoined!"
|
||||
|
||||
world:
|
||||
reseted: "Jouw wereld is gereset!"
|
||||
still_loaded: "&cJouw wereld is nog steeds geladen!"
|
||||
not_on: "&cJij bent niet in een wereld!"
|
||||
created: "Jouw wereld is gemaakt gebruik: &a/ws home"
|
||||
already_exists: "&cJij hebt al een wereld!"
|
||||
delete:
|
||||
own: "&cJouw wereld is verwijderd!"
|
||||
other: "Jij hebt de wereld verwijderd van: &c%player&6!"
|
||||
does_not_exists:
|
||||
own: "&cJij hebt nog geen wereld!"
|
||||
other: "&cDeze speler heeft nog geen wereld!"
|
||||
setting_up: "&aWereld word aangemaakt"
|
||||
playerlist: "speler is in wereld: %players"
|
||||
still_creating: "&cWorld is still creating"
|
||||
set_home: "You set the home"
|
||||
|
||||
member:
|
||||
removed: "Jij hebt &c%player&6 verwijderd van jouw wereld!"
|
||||
added: "Jij hebt &c%player&6 toegevoegd aan jouw wereld!"
|
||||
already_added: "&cDeze speler is al toegevoegd!"
|
||||
not_added:
|
||||
own: "&cDeze speler is nog niet toegevoegd!"
|
||||
other: "&cJij bent niet aan deze wereld toegevoegd"
|
||||
no_one_added: "&cThere are no members added"
|
||||
|
||||
request:
|
||||
expired: "&cJouw uitnodiging is verlopen!"
|
||||
confirm: "&cBevestig het verwijderen van jouw wereld: %command"
|
||||
until_expire: "&cJouw uitnodiging verloopt over %time seconden!"
|
||||
already_sent: "&cJij hebt al een uitnodiging verstuurd!"
|
||||
not_sent: "&cJij hebt geen uitnodiging gestuurd!"
|
||||
invalid_input: "&c%input is niet een command!"
|
||||
|
||||
toggle:
|
||||
gamemode:
|
||||
enabled: "&a%player&6 kan nu zijn spelermodus veranderen!"
|
||||
disabled: "&c%player&6 kan niet meer zijn spelermodus veranderen!"
|
||||
teleport:
|
||||
enabled: "&a%player&6 kan nu teleporteren!"
|
||||
disabled: "&c%player&6 kan nu niet meer teleporteren!"
|
||||
build:
|
||||
enabled: "&a%player&6 kan nu bouwen!"
|
||||
disabled: "&c%player&6 kan nu niet meer bouwen!"
|
||||
fire:
|
||||
enabled: "&aJij hebt vuur geactiveert!"
|
||||
disabled: "&cJij hebt vuur gedeactiveerd!"
|
||||
tnt:
|
||||
enabled: "&aJij hebt TNT-schade geactiveerd!"
|
||||
disabled: "&cJij hebt TNT-schade gedeactiveerd!"
|
||||
|
||||
info:
|
||||
owner: "Owner: %data"
|
||||
id: "ID: %data"
|
||||
member: "Toegevoegd: %data"
|
||||
tnt: "TNT: %data"
|
||||
fire: "Vuur: %data"
|
||||
enabled: "&Aan"
|
||||
disabled: "&cUit"
|
||||
|
||||
command_help:
|
||||
list:
|
||||
- "/ws get &8- &7Will give you a world"
|
||||
- "/ws home &8- &7Teleports you on your world"
|
||||
- "/ws sethome &8- &7Sets a specific home"
|
||||
- "/ws gui &8- &7Opens the GUI menu if you are the worldowner"
|
||||
- "/ws tp &8- &7Teleports you on a specific world"
|
||||
- "/ws addmember &8- &7Adds a player to your world"
|
||||
- "/ws delmember &8- &7Removes a player from your world"
|
||||
- "/ws leave &8- &7Leave a world"
|
||||
- "/ws tnt &8- &7Allows/Denys TNT on your world"
|
||||
- "/ws fire &8- &7Allows/Denys Fire on your world"
|
||||
- "/ws togglegm &8- &7Allows/Denys a player changing gamemode"
|
||||
- "/ws togglebuild &8- &7Allows/Denys a player building"
|
||||
- "/ws toggletp &8- &7Allows/Denys a player teleporting"
|
||||
- "/ws info &8- &7Shows information about the world"
|
||||
- "/ws reset &8- &7Will reset your world"
|
||||
delete_command: "/ws delete &8- &7Will delete a world"
|
@ -1,84 +1,84 @@
|
||||
nopermission: "&cNie posiadasz uprawnień do tego!"
|
||||
unknown_error: "&cCoś poszło nie tak..."
|
||||
lagdetection: "Wykryto laga na świecie: &c%world"
|
||||
wrong_usage: "&c%usage"
|
||||
not_registered: "&cTen gracz nie dołączył jeszcze na serwer!"
|
||||
|
||||
world:
|
||||
reseted: "Twój świat został zresetowany!"
|
||||
still_loaded: "&cTwój serwer wciąż się ładuje!"
|
||||
not_on: "&cNie jesteś na swoim świecie!"
|
||||
created: "Twój świat jest gotowy. Dostań się na niego za pomocą &a/ws home"
|
||||
already_exists: "&cJuż posiadasz swój świat!"
|
||||
delete:
|
||||
own: "&cTwój świat został skasowany!"
|
||||
other: "Usunąłeś świat gracza: &c%player&6!"
|
||||
does_not_exists:
|
||||
own: "&cNie masz swojego świata!"
|
||||
other: "&cTen gracz nie ma swojego świata!"
|
||||
setting_up: "&aUstawianie świata..."
|
||||
playerlist: "Gracze na tym świecie: %players"
|
||||
still_creating: "&cWorld is still creating"
|
||||
set_home: "You set the home"
|
||||
|
||||
member:
|
||||
removed: "Usunąłeś &c%player&6 ze swojego świata!"
|
||||
added: "Dodałeś &c%player&6 na swój świat!"
|
||||
already_added: "&cTen gracz jest już dodany na Twoim świecie!"
|
||||
not_added:
|
||||
own: "&cTen gracz nie jest dodany do Twojego świata!"
|
||||
other: "&cNie jesteś dodany na ten świat!"
|
||||
no_one_added: "&cThere are no members added"
|
||||
|
||||
request:
|
||||
expired: "&cTwoja prośba wygasła!"
|
||||
confirm: "&cPotwierdź zresetowanie swojego świata komendą: %command"
|
||||
until_expire: "&cTwója prośba wygaśnie za %time sek.!"
|
||||
already_sent: "&cJuż wysłałeś prośbę!"
|
||||
not_sent: "&cNie wysłałeś prośby!"
|
||||
invalid_input: "&c%input nie jest poprawnym argumentem komendy!"
|
||||
|
||||
toggle:
|
||||
gamemode:
|
||||
enabled: "&a%player&6 może teraz zmienić swój gamemode!"
|
||||
disabled: "&c%player&6 nie może już zmienić swojego gamemode!"
|
||||
teleport:
|
||||
enabled: "&a%player&6 może teleportować się!"
|
||||
disabled: "&c%player&6 nie może teleportować się!"
|
||||
build:
|
||||
enabled: "&a%player&6 może budować!"
|
||||
disabled: "&c%player&6 nie może już budować!"
|
||||
fire:
|
||||
enabled: "&aWłączyłeś ogień!"
|
||||
disabled: "&cWyłączyłeś ogień!"
|
||||
tnt:
|
||||
enabled: "&aWłączyłeś obrażenia od TNT!"
|
||||
disabled: "&cWyłączyłeś obrażenia od TNT!"
|
||||
|
||||
info:
|
||||
owner: "Właściciel: %data"
|
||||
id: "ID: %data"
|
||||
member: "Członek: %data"
|
||||
tnt: "TNT: %data"
|
||||
fire: "Ogień: %data"
|
||||
enabled: "&aWłączone"
|
||||
disabled: "&cWyłączone"
|
||||
|
||||
command_help:
|
||||
list:
|
||||
- "/ws get &8- &7Tworzy Twój świat"
|
||||
- "/ws home &8- &7Teleportuje Cie na Twój świat"
|
||||
- "/ws sethome &8- &7Sets a specific home"
|
||||
- "/ws gui &8- &7Otwiera GUI świata jeżeli jesteś jego właścicielem"
|
||||
- "/ws tp &8- &7Teleportuje Cie na określony świat"
|
||||
- "/ws addmember &8- &7Dodaj gracza na swój świat"
|
||||
- "/ws delmember &8- &7Usuń gracza ze swojego świata"
|
||||
- "/ws leave &8- &7Opuść świat"
|
||||
- "/ws tnt &8- &7Zezwól/Odmów TNT na swoim świecie"
|
||||
- "/ws fire &8- &7Zezwól/Odmów Ogień na swoim świecie"
|
||||
- "/ws togglegm &8- &7Zezwól/Odmów graczowi zmieniać swój gamemode"
|
||||
- "/ws togglebuild &8- &7Zezwól/Odmów graczowi budowanie"
|
||||
- "/ws toggletp &8- &7Zezwól/Odmów graczowi teleportowanie się"
|
||||
- "/ws info &8- &7Pokazuje informacje o świecie"
|
||||
- "/ws reset &8- &7Zresetuje Twój świat"
|
||||
nopermission: "&cNie posiadasz uprawnień do tego!"
|
||||
unknown_error: "&cCoś poszło nie tak..."
|
||||
lagdetection: "Wykryto laga na świecie: &c%world"
|
||||
wrong_usage: "&c%usage"
|
||||
not_registered: "&cTen gracz nie dołączył jeszcze na serwer!"
|
||||
|
||||
world:
|
||||
reseted: "Twój świat został zresetowany!"
|
||||
still_loaded: "&cTwój serwer wciąż się ładuje!"
|
||||
not_on: "&cNie jesteś na swoim świecie!"
|
||||
created: "Twój świat jest gotowy. Dostań się na niego za pomocą &a/ws home"
|
||||
already_exists: "&cJuż posiadasz swój świat!"
|
||||
delete:
|
||||
own: "&cTwój świat został skasowany!"
|
||||
other: "Usunąłeś świat gracza: &c%player&6!"
|
||||
does_not_exists:
|
||||
own: "&cNie masz swojego świata!"
|
||||
other: "&cTen gracz nie ma swojego świata!"
|
||||
setting_up: "&aUstawianie świata..."
|
||||
playerlist: "Gracze na tym świecie: %players"
|
||||
still_creating: "&cWorld is still creating"
|
||||
set_home: "You set the home"
|
||||
|
||||
member:
|
||||
removed: "Usunąłeś &c%player&6 ze swojego świata!"
|
||||
added: "Dodałeś &c%player&6 na swój świat!"
|
||||
already_added: "&cTen gracz jest już dodany na Twoim świecie!"
|
||||
not_added:
|
||||
own: "&cTen gracz nie jest dodany do Twojego świata!"
|
||||
other: "&cNie jesteś dodany na ten świat!"
|
||||
no_one_added: "&cThere are no members added"
|
||||
|
||||
request:
|
||||
expired: "&cTwoja prośba wygasła!"
|
||||
confirm: "&cPotwierdź zresetowanie swojego świata komendą: %command"
|
||||
until_expire: "&cTwója prośba wygaśnie za %time sek.!"
|
||||
already_sent: "&cJuż wysłałeś prośbę!"
|
||||
not_sent: "&cNie wysłałeś prośby!"
|
||||
invalid_input: "&c%input nie jest poprawnym argumentem komendy!"
|
||||
|
||||
toggle:
|
||||
gamemode:
|
||||
enabled: "&a%player&6 może teraz zmienić swój gamemode!"
|
||||
disabled: "&c%player&6 nie może już zmienić swojego gamemode!"
|
||||
teleport:
|
||||
enabled: "&a%player&6 może teleportować się!"
|
||||
disabled: "&c%player&6 nie może teleportować się!"
|
||||
build:
|
||||
enabled: "&a%player&6 może budować!"
|
||||
disabled: "&c%player&6 nie może już budować!"
|
||||
fire:
|
||||
enabled: "&aWłączyłeś ogień!"
|
||||
disabled: "&cWyłączyłeś ogień!"
|
||||
tnt:
|
||||
enabled: "&aWłączyłeś obrażenia od TNT!"
|
||||
disabled: "&cWyłączyłeś obrażenia od TNT!"
|
||||
|
||||
info:
|
||||
owner: "Właściciel: %data"
|
||||
id: "ID: %data"
|
||||
member: "Członek: %data"
|
||||
tnt: "TNT: %data"
|
||||
fire: "Ogień: %data"
|
||||
enabled: "&aWłączone"
|
||||
disabled: "&cWyłączone"
|
||||
|
||||
command_help:
|
||||
list:
|
||||
- "/ws get &8- &7Tworzy Twój świat"
|
||||
- "/ws home &8- &7Teleportuje Cie na Twój świat"
|
||||
- "/ws sethome &8- &7Sets a specific home"
|
||||
- "/ws gui &8- &7Otwiera GUI świata jeżeli jesteś jego właścicielem"
|
||||
- "/ws tp &8- &7Teleportuje Cie na określony świat"
|
||||
- "/ws addmember &8- &7Dodaj gracza na swój świat"
|
||||
- "/ws delmember &8- &7Usuń gracza ze swojego świata"
|
||||
- "/ws leave &8- &7Opuść świat"
|
||||
- "/ws tnt &8- &7Zezwól/Odmów TNT na swoim świecie"
|
||||
- "/ws fire &8- &7Zezwól/Odmów Ogień na swoim świecie"
|
||||
- "/ws togglegm &8- &7Zezwól/Odmów graczowi zmieniać swój gamemode"
|
||||
- "/ws togglebuild &8- &7Zezwól/Odmów graczowi budowanie"
|
||||
- "/ws toggletp &8- &7Zezwól/Odmów graczowi teleportowanie się"
|
||||
- "/ws info &8- &7Pokazuje informacje o świecie"
|
||||
- "/ws reset &8- &7Zresetuje Twój świat"
|
||||
delete_command: "/ws delete &8- &7Usunie Twój świat"
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user