Extract CommandSender to CommandSource, this should prevent Ess user object leaks.

This commit is contained in:
KHobbits 2013-10-16 20:59:39 +01:00
parent cf9d79d24c
commit 6f85761f7f
145 changed files with 1848 additions and 590 deletions

2
.gitignore vendored
View File

@ -36,8 +36,6 @@
/EssentialsUpdate/build/ /EssentialsUpdate/build/
/WebPush/apikey.php /WebPush/apikey.php
/WebPush/nbproject/private /WebPush/nbproject/private
/.idea
*.iml
/EssentialsGroupManager/bin /EssentialsGroupManager/bin
/EssentialsGroupManager/.externalToolBuilders /EssentialsGroupManager/.externalToolBuilders
/EssentialsAntiBuild/nbproject/private/ /EssentialsAntiBuild/nbproject/private/

1
.idea/.name Normal file
View File

@ -0,0 +1 @@
Essentials

7
.idea/ant.xml Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AntConfiguration">
<buildFile url="file://$PROJECT_DIR$/Essentials/build.xml" />
</component>
</project>

28
.idea/compiler.xml Normal file
View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<option name="DEFAULT_COMPILER" value="Javac" />
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="?*.properties" />
<entry name="?*.xml" />
<entry name="?*.gif" />
<entry name="?*.png" />
<entry name="?*.jpeg" />
<entry name="?*.jpg" />
<entry name="?*.html" />
<entry name="?*.dtd" />
<entry name="?*.tld" />
<entry name="?*.ftl" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
</component>
<component name="JavacSettings">
<option name="ADDITIONAL_OPTIONS_STRING" value="-target 1.6" />
</component>
</project>

View File

@ -0,0 +1,5 @@
<component name="CopyrightManager">
<settings default="">
<module2copyright />
</settings>
</component>

13
.idea/encodings.xml Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false">
<file url="file://$PROJECT_DIR$/Essentials" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/EssentialsAntiBuild" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/EssentialsChat" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/EssentialsGeoIP" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/EssentialsGroupManager" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/EssentialsProtect" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/EssentialsXMPP" charset="UTF-8" />
</component>
</project>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.iCo6:iConomy:6.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/iCo6/iConomy/6.0/iConomy-6.0.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/iCo6/iConomy/6.0/iConomy-6.0-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/iCo6/iConomy/6.0/iConomy-6.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.iConomy:iConomy:5.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/iConomy/iConomy/5.0/iConomy-5.0.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/iConomy/iConomy/5.0/iConomy-5.0-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/iConomy/iConomy/5.0/iConomy-5.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: commons-io:commons-io:2.4">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/commons-io/commons-io/2.4/commons-io-2.4.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/commons-io/commons-io/2.4/commons-io-2.4-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/commons-io/commons-io/2.4/commons-io-2.4-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: cosine:BOSEconomy:0.7">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/cosine/BOSEconomy/0.7/BOSEconomy-0.7.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/cosine/BOSEconomy/0.7/BOSEconomy-0.7-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/cosine/BOSEconomy/0.7/BOSEconomy-0.7-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: jivesoftware:smack:3.1.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/jivesoftware/smack/3.1.0/smack-3.1.0.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/jivesoftware/smack/3.1.0/smack-3.1.0-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/jivesoftware/smack/3.1.0/smack-3.1.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: junit:junit:4.10">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.10/junit-4.10.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.10/junit-4.10-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.10/junit-4.10-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: me.ashtheking:MultiCurrency:0.05">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/me/ashtheking/MultiCurrency/0.05/MultiCurrency-0.05.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/me/ashtheking/MultiCurrency/0.05/MultiCurrency-0.05-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/me/ashtheking/MultiCurrency/0.05/MultiCurrency-0.05-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: net.milkbowl:Vault:1.2">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/net/milkbowl/Vault/1.2/Vault-1.2.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/net/milkbowl/Vault/1.2/Vault-1.2-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/net/milkbowl/Vault/1.2/Vault-1.2-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.apache.commons:commons-compress:1.4.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-compress/1.4.1/commons-compress-1.4.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-compress/1.4.1/commons-compress-1.4.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-compress/1.4.1/commons-compress-1.4.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.bukkit:bukkit:1.4.2-R0.3-SNAPSHOT">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/bukkit/bukkit/1.4.2-R0.3-SNAPSHOT/bukkit-1.4.2-R0.3-SNAPSHOT.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/bukkit/bukkit/1.4.2-R0.3-SNAPSHOT/bukkit-1.4.2-R0.3-SNAPSHOT-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/bukkit/bukkit/1.4.2-R0.3-SNAPSHOT/bukkit-1.4.2-R0.3-SNAPSHOT-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.hamcrest:hamcrest-core:1.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.mockito:mockito-core:1.9.5">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/mockito/mockito-core/1.9.5/mockito-core-1.9.5.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/mockito/mockito-core/1.9.5/mockito-core-1.9.5-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/mockito/mockito-core/1.9.5/mockito-core-1.9.5-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.objenesis:objenesis:1.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/objenesis/objenesis/1.0/objenesis-1.0.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/objenesis/objenesis/1.0/objenesis-1.0-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/objenesis/objenesis/1.0/objenesis-1.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.projectlombok:lombok:0.11.6">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/projectlombok/lombok/0.11.6/lombok-0.11.6.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/projectlombok/lombok/0.11.6/lombok-0.11.6-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/projectlombok/lombok/0.11.6/lombok-0.11.6-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.tukaani:xz:1.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/tukaani/xz/1.0/xz-1.0.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/tukaani/xz/1.0/xz-1.0-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/tukaani/xz/1.0/xz-1.0-sources.jar!/" />
</SOURCES>
</library>
</component>

44
.idea/misc.xml Normal file
View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
<component name="IdProvider" IDEtalkID="2C16A12C16D2472A87479355E4A1041E" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/Essentials/pom.xml" />
<option value="$PROJECT_DIR$/EssentialsAntiBuild/pom.xml" />
<option value="$PROJECT_DIR$/EssentialsChat/pom.xml" />
<option value="$PROJECT_DIR$/EssentialsGeoIP/pom.xml" />
<option value="$PROJECT_DIR$/EssentialsGroupBridge/pom.xml" />
<option value="$PROJECT_DIR$/EssentialsGroupManager/pom.xml" />
<option value="$PROJECT_DIR$/EssentialsProtect/pom.xml" />
<option value="$PROJECT_DIR$/EssentialsXMPP/pom.xml" />
</list>
</option>
</component>
<component name="ProjectResources">
<default-html-doctype>http://www.w3.org/1999/xhtml</default-html-doctype>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="1.7" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
<component name="masterDetails">
<states>
<state key="ProjectJDKs.UI">
<settings>
<last-edited>1.7</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project>

12
.idea/modules.xml Normal file
View File

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

View File

@ -0,0 +1,5 @@
<component name="DependencyValidationManager">
<state>
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
</state>
</component>

125
.idea/uiDesigner.xml Normal file
View File

@ -0,0 +1,125 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

8
.idea/vcs.xml Normal file
View File

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

642
.idea/workspace.xml Normal file
View File

@ -0,0 +1,642 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="BuildServerSettings">
<option name="LOGIN" value="" />
<option name="SERVER_URL" value="http://buildserver" />
<option name="PASSWORD" />
<option name="REMEMBER_ME" value="true" />
<option name="USE_IDEA_PROXY_SETTINGS" value="true" />
<option name="TEST_STATUS_BUILD_TYPE_IDS" />
<option name="INSPECTIONS_BUILD_TYPE_IDS" />
<option name="DUPLICATES_BUILD_TYPE_IDS" />
<option name="COVERAGE_SETTINGS" />
<option name="ARTIFACTS_BUILD_TYPE_IDS" />
<option name="PERFORM_COMMIT_IF_SUCCESSFUL" value="true" />
<option name="PERFORM_COMMIT_IF_NO_NEW_FAILED_TESTS" value="false" />
<option name="REQUEST_CONFIRMATON" value="false" />
<option name="PRE_TESTED_COMMIT" value="true" />
<option name="PROJECT_STATUS_DIALOG_SPLITTER_DIVIDER_LOCATION" value="500" />
<option name="CHANGES_STATUS_DIALOG_SPLITTER_DIVIDER_LOCATION" value="500" />
<option name="FILTER_BY_STATUS" value="false" />
<option name="FILTER_MARKED_AS_FIXED" value="false" />
<option name="SHOW_CLOSE_PROMPT" value="true" />
<option name="TOOL_WINDOW_SELECTED_CONTENT_INDEX" value="0" />
<option name="FILTER_BY_CURRENT_PROJECT" value="true" />
</component>
<component name="ChangeListManager">
<list default="true" id="441bb410-ba68-4128-9cf7-0fdd2f090da0" name="Default" comment="" />
<ignored path="Essentials.iws" />
<ignored path=".idea/workspace.xml" />
<file path="/Dummy.txt" changelist="441bb410-ba68-4128-9cf7-0fdd2f090da0" time="1381106771267" ignored="false" />
<file path="/messages.properties" changelist="441bb410-ba68-4128-9cf7-0fdd2f090da0" time="1376411491573" ignored="false" />
<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="ChangesViewManager" flattened_view="true" show_ignored="false" />
<component name="CreatePatchCommitExecutor">
<option name="PATCH_PATH" value="" />
</component>
<component name="DaemonCodeAnalyzer">
<disable_hints />
</component>
<component name="DebuggerManager">
<ui_properties default_suspend_policy="SuspendAll" default_condition_enabled="true" />
<breakpoint_any default_suspend_policy="SuspendAll" default_condition_enabled="true">
<breakpoint>
<option name="NOTIFY_CAUGHT" value="true" />
<option name="NOTIFY_UNCAUGHT" value="true" />
<option name="ENABLED" value="false" />
<option name="LOG_ENABLED" value="false" />
<option name="LOG_EXPRESSION_ENABLED" value="false" />
<option name="REMOVE_AFTER_HIT" value="false" />
<option name="SUSPEND_POLICY" value="SuspendAll" />
<option name="SUSPEND" value="true" />
<option name="COUNT_FILTER_ENABLED" value="false" />
<option name="COUNT_FILTER" value="0" />
<option name="CONDITION_ENABLED" value="false" />
<option name="CLASS_FILTERS_ENABLED" value="false" />
<option name="INSTANCE_FILTERS_ENABLED" value="false" />
<option name="CONDITION" value="" />
<option name="LOG_MESSAGE" value="" />
</breakpoint>
<breakpoint>
<option name="NOTIFY_CAUGHT" value="true" />
<option name="NOTIFY_UNCAUGHT" value="true" />
<option name="ENABLED" value="false" />
<option name="LOG_ENABLED" value="false" />
<option name="LOG_EXPRESSION_ENABLED" value="false" />
<option name="REMOVE_AFTER_HIT" value="false" />
<option name="SUSPEND_POLICY" value="SuspendAll" />
<option name="SUSPEND" value="true" />
<option name="COUNT_FILTER_ENABLED" value="false" />
<option name="COUNT_FILTER" value="0" />
<option name="CONDITION_ENABLED" value="false" />
<option name="CLASS_FILTERS_ENABLED" value="false" />
<option name="INSTANCE_FILTERS_ENABLED" value="false" />
<option name="CONDITION" value="" />
<option name="LOG_MESSAGE" value="" />
</breakpoint>
</breakpoint_any>
<breakpoint_rules />
<ui_properties />
</component>
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
<component name="FavoritesManager">
<favorites_list name="Essentials" />
</component>
<component name="FileEditorManager">
<leaf>
<file leaf-file-name="AlternativeCommandsHandler.java" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/Essentials/src/com/earth2me/essentials/AlternativeCommandsHandler.java">
<provider selected="true" editor-type-id="text-editor">
<state line="36" column="14" selection-start="1046" selection-end="1046" vertical-scroll-proportion="0.61997706">
<folding />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FindManager">
<FindUsagesManager>
<setting name="OPEN_NEW_TAB" value="false" />
</FindUsagesManager>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="GitLogSettings">
<option name="myDateState">
<MyDateState />
</option>
</component>
<component name="IdeDocumentHistory">
<option name="changedFiles">
<list>
<option value="$PROJECT_DIR$/Essentials/src/messages.properties" />
</list>
</option>
</component>
<component name="MavenImportPreferences">
<option name="importingSettings">
<MavenImportingSettings>
<option name="downloadDocsAutomatically" value="true" />
<option name="downloadSourcesAutomatically" value="true" />
<option name="importAutomatically" value="true" />
<option name="keepSourceFolders" value="false" />
<option name="lookForNested" value="true" />
</MavenImportingSettings>
</option>
</component>
<component name="ProjectFrameBounds">
<option name="x" value="-8" />
<option name="y" value="-8" />
<option name="width" value="1936" />
<option name="height" value="1056" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="true">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectReloadState">
<option name="STATE" value="0" />
</component>
<component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1" splitterProportion="0.5">
<flattenPackages />
<showMembers />
<showModules />
<showLibraryContents />
<hideEmptyPackages />
<abbreviatePackageNames />
<autoscrollToSource />
<autoscrollFromSource />
<sortByType />
</navigator>
<panes>
<pane id="PackagesPane">
<subPane />
</pane>
<pane id="Scope" />
<pane id="ProjectPane">
<subPane>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="Essentials" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="External Libraries" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ExternalLibrariesNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="Essentials" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="Essentials" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="Essentials" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
</subPane>
</pane>
</panes>
</component>
<component name="PropertiesComponent">
<property name="GoToFile.includeJavaFiles" value="false" />
<property name="options.splitter.main.proportions" value="0.3" />
<property name="options.lastSelected" value="project.propVCSSupport.Mappings" />
<property name="MemberChooser.sorted" value="false" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="MemberChooser.copyJavadoc" value="false" />
<property name="GoToClass.toSaveIncludeLibraries" value="false" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="FullScreen" value="false" />
<property name="MemberChooser.showClasses" value="true" />
<property name="GoToClass.includeLibraries" value="false" />
<property name="options.searchVisible" value="true" />
<property name="options.splitter.details.proportions" value="0.2" />
</component>
<component name="RunManager">
<configuration default="true" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" factoryName="Plugin">
<module name="" />
<option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m" />
<option name="PROGRAM_PARAMETERS" />
<method />
</configuration>
<configuration default="true" type="Remote" factoryName="Remote">
<option name="USE_SOCKET_TRANSPORT" value="true" />
<option name="SERVER_MODE" value="false" />
<option name="SHMEM_ADDRESS" value="javadebug" />
<option name="HOST" value="localhost" />
<option name="PORT" value="5005" />
<method />
</configuration>
<configuration default="true" type="Applet" factoryName="Applet">
<module name="" />
<option name="MAIN_CLASS_NAME" />
<option name="HTML_FILE_NAME" />
<option name="HTML_USED" value="false" />
<option name="WIDTH" value="400" />
<option name="HEIGHT" value="300" />
<option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
<option name="VM_PARAMETERS" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<method />
</configuration>
<configuration default="true" type="TestNG" factoryName="TestNG">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<module name="" />
<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="$PROJECT_DIR$" />
<option name="OUTPUT_DIRECTORY" />
<option name="ANNOTATION_TYPE" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="moduleWithDependencies" />
</option>
<option name="USE_DEFAULT_REPORTERS" value="false" />
<option name="PROPERTIES_FILE" />
<envs />
<properties />
<listeners />
<method />
</configuration>
<configuration default="true" type="Application" factoryName="Application">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" />
<option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="" />
<envs />
<method />
</configuration>
<configuration default="true" type="JUnit" factoryName="JUnit">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<module name="" />
<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="$PROJECT_DIR$" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="moduleWithDependencies" />
</option>
<envs />
<patterns />
<method />
</configuration>
<list size="0" />
<configuration name="&lt;template&gt;" type="WebApp" default="true" selected="false">
<Host>localhost</Host>
<Port>5050</Port>
</configuration>
</component>
<component name="ShelveChangesManager" show_recycled="false" />
<component name="SvnConfiguration" maxAnnotateRevisions="500" myUseAcceleration="nothing" myAutoUpdateAfterCommit="false" cleanupOnStartRun="false">
<option name="USER" value="" />
<option name="PASSWORD" value="" />
<option name="mySSHConnectionTimeout" value="30000" />
<option name="mySSHReadTimeout" value="30000" />
<option name="LAST_MERGED_REVISION" />
<option name="MERGE_DRY_RUN" value="false" />
<option name="MERGE_DIFF_USE_ANCESTRY" value="true" />
<option name="UPDATE_LOCK_ON_DEMAND" value="false" />
<option name="IGNORE_SPACES_IN_MERGE" value="false" />
<option name="DETECT_NESTED_COPIES" value="true" />
<option name="CHECK_NESTED_FOR_QUICK_MERGE" value="false" />
<option name="IGNORE_SPACES_IN_ANNOTATE" value="true" />
<option name="SHOW_MERGE_SOURCES_IN_ANNOTATE" value="true" />
<option name="FORCE_UPDATE" value="false" />
<option name="IGNORE_EXTERNALS" value="false" />
<myIsUseDefaultProxy>false</myIsUseDefaultProxy>
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="441bb410-ba68-4128-9cf7-0fdd2f090da0" name="Default" comment="" />
<created>1352756031122</created>
<updated>1352756031122</updated>
</task>
<servers />
</component>
<component name="ToolWindowManager">
<frame x="-8" y="-8" width="1936" height="1056" extended-state="6" />
<editor active="true" />
<layout>
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.20651014" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="IDEtalk Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="IDEtalk" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="true" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.23585913" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Data Sources" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="TeamCity" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
</layout>
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="VcsManagerConfiguration">
<option name="OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT" value="true" />
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="true" />
<option name="CHECK_NEW_TODO" value="true" />
<option name="myTodoPanelSettings">
<value>
<are-packages-shown value="false" />
<are-modules-shown value="false" />
<flatten-packages value="false" />
<is-autoscroll-to-source value="false" />
</value>
</option>
<option name="PERFORM_UPDATE_IN_BACKGROUND" value="true" />
<option name="PERFORM_COMMIT_IN_BACKGROUND" value="true" />
<option name="PERFORM_EDIT_IN_BACKGROUND" value="true" />
<option name="PERFORM_CHECKOUT_IN_BACKGROUND" value="true" />
<option name="PERFORM_ADD_REMOVE_IN_BACKGROUND" value="true" />
<option name="PERFORM_ROLLBACK_IN_BACKGROUND" value="false" />
<option name="CHECK_LOCALLY_CHANGED_CONFLICTS_IN_BACKGROUND" value="false" />
<option name="CHANGED_ON_SERVER_INTERVAL" value="60" />
<option name="SHOW_ONLY_CHANGED_IN_SELECTION_DIFF" value="true" />
<option name="CHECK_COMMIT_MESSAGE_SPELLING" value="true" />
<option name="DEFAULT_PATCH_EXTENSION" value="patch" />
<option name="SHORT_DIFF_HORIZONTALLY" value="true" />
<option name="SHORT_DIFF_EXTRA_LINES" value="2" />
<option name="SOFT_WRAPS_IN_SHORT_DIFF" value="true" />
<option name="INCLUDE_TEXT_INTO_PATCH" value="false" />
<option name="INCLUDE_TEXT_INTO_SHELF" value="false" />
<option name="SHOW_FILE_HISTORY_DETAILS" value="true" />
<option name="SHOW_VCS_ERROR_NOTIFICATIONS" value="true" />
<option name="SHOW_DIRTY_RECURSIVELY" value="false" />
<option name="LIMIT_HISTORY" value="true" />
<option name="MAXIMUM_HISTORY_ROWS" value="1000" />
<option name="UPDATE_FILTER_SCOPE_NAME" />
<option name="USE_COMMIT_MESSAGE_MARGIN" value="false" />
<option name="COMMIT_MESSAGE_MARGIN_SIZE" value="72" />
<option name="WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN" value="false" />
<option name="FORCE_NON_EMPTY_COMMENT" value="false" />
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="false" />
<option name="LAST_COMMIT_MESSAGE" />
<option name="MAKE_NEW_CHANGELIST_ACTIVE" value="false" />
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" />
<option name="CHECK_FILES_UP_TO_DATE_BEFORE_COMMIT" value="false" />
<option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="false" />
<option name="REFORMAT_BEFORE_FILE_COMMIT" value="false" />
<option name="FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION" value="0.8" />
<option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5" />
<option name="ACTIVE_VCS_NAME" />
<option name="UPDATE_GROUP_BY_PACKAGES" value="false" />
<option name="UPDATE_GROUP_BY_CHANGELIST" value="false" />
<option name="UPDATE_FILTER_BY_SCOPE" value="false" />
<option name="SHOW_FILE_HISTORY_AS_TREE" value="false" />
<option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager />
</component>
<component name="antWorkspaceConfiguration">
<option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
<option name="FILTER_TARGETS" value="true" />
<buildFile url="file://$PROJECT_DIR$/Essentials/build.xml">
<targetFilters>
<filter targetName="default" isVisible="true" />
<filter targetName="-pre-init" isVisible="false" />
<filter targetName="-init-private" isVisible="false" />
<filter targetName="-pre-init-libraries" isVisible="false" />
<filter targetName="-init-private-libraries" isVisible="false" />
<filter targetName="-init-libraries" isVisible="false" />
<filter targetName="-init-user" isVisible="false" />
<filter targetName="-init-project" isVisible="false" />
<filter targetName="-do-init" isVisible="false" />
<filter targetName="-post-init" isVisible="false" />
<filter targetName="-init-check" isVisible="false" />
<filter targetName="-init-macrodef-property" isVisible="false" />
<filter targetName="-init-macrodef-javac-with-processors" isVisible="false" />
<filter targetName="-init-macrodef-javac-without-processors" isVisible="false" />
<filter targetName="-init-macrodef-javac" isVisible="false" />
<filter targetName="-init-macrodef-junit-init" isVisible="false" />
<filter targetName="-init-test-properties" isVisible="false" />
<filter targetName="-init-macrodef-junit-single" isVisible="false" />
<filter targetName="-init-macrodef-junit-batch" isVisible="false" />
<filter targetName="-init-macrodef-junit" isVisible="false" />
<filter targetName="-init-macrodef-testng" isVisible="false" />
<filter targetName="-init-macrodef-test-impl" isVisible="false" />
<filter targetName="-init-macrodef-junit-impl" isVisible="false" />
<filter targetName="-init-macrodef-testng-impl" isVisible="false" />
<filter targetName="-init-macrodef-test" isVisible="false" />
<filter targetName="-init-macrodef-junit-debug" isVisible="false" />
<filter targetName="-init-macrodef-junit-debug-batch" isVisible="false" />
<filter targetName="-init-macrodef-junit-debug-impl" isVisible="false" />
<filter targetName="-init-macrodef-testng-debug" isVisible="false" />
<filter targetName="-init-macrodef-testng-debug-impl" isVisible="false" />
<filter targetName="-init-macrodef-test-debug-junit" isVisible="false" />
<filter targetName="-init-macrodef-test-debug-testng" isVisible="false" />
<filter targetName="-init-macrodef-test-debug" isVisible="false" />
<filter targetName="profile-init" isVisible="false" />
<filter targetName="-profile-pre-init" isVisible="false" />
<filter targetName="-profile-post-init" isVisible="false" />
<filter targetName="-profile-init-macrodef-profile" isVisible="false" />
<filter targetName="-profile-init-check" isVisible="false" />
<filter targetName="-init-macrodef-nbjpda" isVisible="false" />
<filter targetName="-init-debug-args" isVisible="false" />
<filter targetName="-init-macrodef-debug" isVisible="false" />
<filter targetName="-init-macrodef-java" isVisible="false" />
<filter targetName="-init-macrodef-copylibs" isVisible="false" />
<filter targetName="-init-presetdef-jar" isVisible="false" />
<filter targetName="-init-ap-cmdline-properties" isVisible="false" />
<filter targetName="-init-ap-cmdline-supported" isVisible="false" />
<filter targetName="-init-ap-cmdline" isVisible="false" />
<filter targetName="init" isVisible="false" />
<filter targetName="-deps-jar-init" isVisible="false" />
<filter targetName="-warn-already-built-jar" isVisible="false" />
<filter targetName="deps-jar" isVisible="false" />
<filter targetName="-verify-automatic-build" isVisible="false" />
<filter targetName="-check-automatic-build" isVisible="false" />
<filter targetName="-clean-after-automatic-build" isVisible="false" />
<filter targetName="-pre-pre-compile" isVisible="false" />
<filter targetName="-pre-compile" isVisible="false" />
<filter targetName="-compile-depend" isVisible="false" />
<filter targetName="-do-compile" isVisible="false" />
<filter targetName="-copy-persistence-xml" isVisible="false" />
<filter targetName="-post-compile" isVisible="false" />
<filter targetName="compile" isVisible="true" />
<filter targetName="-pre-compile-single" isVisible="false" />
<filter targetName="-do-compile-single" isVisible="false" />
<filter targetName="-post-compile-single" isVisible="false" />
<filter targetName="compile-single" isVisible="false" />
<filter targetName="-pre-pre-jar" isVisible="false" />
<filter targetName="-pre-jar" isVisible="false" />
<filter targetName="-do-jar-without-manifest" isVisible="false" />
<filter targetName="-do-jar-with-manifest" isVisible="false" />
<filter targetName="-do-jar-with-mainclass" isVisible="false" />
<filter targetName="-do-jar-with-libraries-create-manifest" isVisible="false" />
<filter targetName="-do-jar-with-libraries-copy-manifest" isVisible="false" />
<filter targetName="-do-jar-with-libraries-set-main" isVisible="false" />
<filter targetName="-do-jar-with-libraries-set-splashscreen" isVisible="false" />
<filter targetName="-do-jar-with-libraries-pack" isVisible="false" />
<filter targetName="-do-jar-with-libraries-delete-manifest" isVisible="false" />
<filter targetName="-do-jar-with-libraries" isVisible="false" />
<filter targetName="-post-jar" isVisible="false" />
<filter targetName="jar" isVisible="true" />
<filter targetName="run" isVisible="true" />
<filter targetName="-do-not-recompile" isVisible="false" />
<filter targetName="run-single" isVisible="false" />
<filter targetName="run-test-with-main" isVisible="false" />
<filter targetName="-debug-start-debugger" isVisible="false" />
<filter targetName="-debug-start-debugger-main-test" isVisible="false" />
<filter targetName="-debug-start-debuggee" isVisible="false" />
<filter targetName="debug" isVisible="true" />
<filter targetName="-debug-start-debugger-stepinto" isVisible="false" />
<filter targetName="debug-stepinto" isVisible="false" />
<filter targetName="-debug-start-debuggee-single" isVisible="false" />
<filter targetName="debug-single" isVisible="false" />
<filter targetName="-debug-start-debuggee-main-test" isVisible="false" />
<filter targetName="debug-test-with-main" isVisible="false" />
<filter targetName="-pre-debug-fix" isVisible="false" />
<filter targetName="-do-debug-fix" isVisible="false" />
<filter targetName="debug-fix" isVisible="false" />
<filter targetName="-profile-pre72" isVisible="true" />
<filter targetName="-profile-single-pre72" isVisible="true" />
<filter targetName="-profile-applet-pre72" isVisible="false" />
<filter targetName="-profile-test-single-pre72" isVisible="false" />
<filter targetName="-profile-check" isVisible="false" />
<filter targetName="profile" isVisible="true" />
<filter targetName="profile-single" isVisible="true" />
<filter targetName="profile-test-single" isVisible="true" />
<filter targetName="profile-test" isVisible="true" />
<filter targetName="profile-test-with-main" isVisible="true" />
<filter targetName="profile-applet" isVisible="false" />
<filter targetName="-javadoc-build" isVisible="false" />
<filter targetName="-javadoc-browse" isVisible="false" />
<filter targetName="javadoc" isVisible="true" />
<filter targetName="-pre-pre-compile-test" isVisible="false" />
<filter targetName="-pre-compile-test" isVisible="false" />
<filter targetName="-compile-test-depend" isVisible="false" />
<filter targetName="-do-compile-test" isVisible="false" />
<filter targetName="-post-compile-test" isVisible="false" />
<filter targetName="compile-test" isVisible="false" />
<filter targetName="-pre-compile-test-single" isVisible="false" />
<filter targetName="-do-compile-test-single" isVisible="false" />
<filter targetName="-post-compile-test-single" isVisible="false" />
<filter targetName="compile-test-single" isVisible="false" />
<filter targetName="-pre-test-run" isVisible="false" />
<filter targetName="-do-test-run" isVisible="false" />
<filter targetName="-post-test-run" isVisible="false" />
<filter targetName="test-report" isVisible="false" />
<filter targetName="-test-browse" isVisible="false" />
<filter targetName="test" isVisible="true" />
<filter targetName="-pre-test-run-single" isVisible="false" />
<filter targetName="-do-test-run-single" isVisible="false" />
<filter targetName="-post-test-run-single" isVisible="false" />
<filter targetName="test-single" isVisible="true" />
<filter targetName="-do-test-run-single-method" isVisible="false" />
<filter targetName="-post-test-run-single-method" isVisible="false" />
<filter targetName="test-single-method" isVisible="true" />
<filter targetName="-debug-start-debuggee-test" isVisible="false" />
<filter targetName="-debug-start-debuggee-test-method" isVisible="false" />
<filter targetName="-debug-start-debugger-test" isVisible="false" />
<filter targetName="debug-test" isVisible="false" />
<filter targetName="debug-test-method" isVisible="false" />
<filter targetName="-do-debug-fix-test" isVisible="false" />
<filter targetName="debug-fix-test" isVisible="false" />
<filter targetName="run-applet" isVisible="false" />
<filter targetName="-debug-start-debuggee-applet" isVisible="false" />
<filter targetName="debug-applet" isVisible="false" />
<filter targetName="-deps-clean-init" isVisible="false" />
<filter targetName="-warn-already-built-clean" isVisible="false" />
<filter targetName="deps-clean" isVisible="false" />
<filter targetName="-do-clean" isVisible="false" />
<filter targetName="-post-clean" isVisible="false" />
<filter targetName="clean" isVisible="true" />
<filter targetName="-check-call-dep" isVisible="false" />
<filter targetName="-maybe-call-dep" isVisible="false" />
</targetFilters>
<expanded value="true" />
</buildFile>
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/Essentials/src/com/earth2me/essentials/AlternativeCommandsHandler.java">
<provider selected="true" editor-type-id="text-editor">
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Essentials/Essentials.iml">
<provider selected="true" editor-type-id="text-editor">
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Essentials/Essentials.iml">
<provider selected="true" editor-type-id="text-editor">
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Essentials/src/messages_cs.properties">
<provider editor-type-id="ResourceBundle">
<state />
</provider>
<provider selected="true" editor-type-id="text-editor">
<state line="10" column="0" selection-start="565" selection-end="565" vertical-scroll-proportion="0.18248175" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Essentials/src/messages.properties">
<provider editor-type-id="ResourceBundle">
<state />
</provider>
<provider selected="true" editor-type-id="text-editor">
<state line="5" column="0" selection-start="116" selection-end="116" vertical-scroll-proportion="-0.6" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Essentials/build.xml">
<provider selected="true" editor-type-id="text-editor">
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Essentials/src/com/earth2me/essentials/AlternativeCommandsHandler.java">
<provider selected="true" editor-type-id="text-editor">
<state line="36" column="14" selection-start="1046" selection-end="1046" vertical-scroll-proportion="0.61997706">
<folding />
</state>
</provider>
</entry>
</component>
</project>

31
Essentials/Essentials.iml Normal file
View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="EssentialsGroupManager" />
<orderEntry type="library" name="Maven: org.bukkit:bukkit:1.4.2-R0.3-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: org.projectlombok:lombok:0.11.6" level="project" />
<orderEntry type="library" name="Maven: commons-io:commons-io:2.4" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-compress:1.4.1" level="project" />
<orderEntry type="library" name="Maven: org.tukaani:xz:1.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.10" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:1.9.5" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:1.0" level="project" />
<orderEntry type="library" name="Maven: cosine:BOSEconomy:0.7" level="project" />
<orderEntry type="library" name="Maven: com.iConomy:iConomy:5.0" level="project" />
<orderEntry type="library" name="Maven: com.iCo6:iConomy:6.0" level="project" />
<orderEntry type="library" name="Maven: me.ashtheking:MultiCurrency:0.05" level="project" />
<orderEntry type="library" name="Maven: net.milkbowl:Vault:1.2" level="project" />
</component>
</module>

View File

@ -0,0 +1,61 @@
package com.earth2me.essentials;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class CommandSource implements IReplyTo
{
private CommandSource replyTo = null;
protected CommandSender sender;
public CommandSource(final CommandSender base)
{
this.sender = base;
}
public final CommandSender getSender()
{
return sender;
}
public final Player getPlayer()
{
if (sender instanceof Player)
{
return (Player)sender;
}
return null;
}
public final boolean isPlayer()
{
return (sender instanceof Player);
}
public final CommandSender setSender(final CommandSender base)
{
return this.sender = base;
}
public void sendMessage(String message)
{
if (!message.isEmpty())
{
sender.sendMessage(message);
}
}
@Override
public void setReplyTo(final CommandSource user)
{
replyTo = user;
}
@Override
public CommandSource getReplyTo()
{
return replyTo;
}
}

View File

@ -7,7 +7,7 @@ import org.bukkit.command.CommandSender;
public final class Console implements IReplyTo public final class Console implements IReplyTo
{ {
private static Console instance = new Console(); private static Console instance = new Console();
private CommandSender replyTo; private CommandSource replyTo;
public final static String NAME = "Console"; public final static String NAME = "Console";
private Console() private Console()
@ -20,13 +20,13 @@ public final class Console implements IReplyTo
} }
@Override @Override
public void setReplyTo(CommandSender user) public void setReplyTo(CommandSource user)
{ {
replyTo = user; replyTo = user;
} }
@Override @Override
public CommandSender getReplyTo() public CommandSource getReplyTo()
{ {
return replyTo; return replyTo;
} }

View File

@ -374,7 +374,7 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials
} }
@Override @Override
public boolean onCommandEssentials(final CommandSender sender, final Command command, final String commandLabel, final String[] args, final ClassLoader classLoader, final String commandPath, final String permissionPrefix, final IEssentialsModule module) public boolean onCommandEssentials(final CommandSender cSender, final Command command, final String commandLabel, final String[] args, final ClassLoader classLoader, final String commandPath, final String permissionPrefix, final IEssentialsModule module)
{ {
// Allow plugins to override the command via onCommand // Allow plugins to override the command via onCommand
if (!getSettings().isCommandOverridden(command.getName()) && (!commandLabel.startsWith("e") || commandLabel.equalsIgnoreCase(command.getName()))) if (!getSettings().isCommandOverridden(command.getName()) && (!commandLabel.startsWith("e") || commandLabel.equalsIgnoreCase(command.getName())))
@ -385,12 +385,12 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials
alternativeCommandsHandler.executed(commandLabel, pc); alternativeCommandsHandler.executed(commandLabel, pc);
try try
{ {
return pc.execute(sender, commandLabel, args); return pc.execute(cSender, commandLabel, args);
} }
catch (final Exception ex) catch (final Exception ex)
{ {
Bukkit.getLogger().log(Level.SEVERE, ex.getMessage(), ex); Bukkit.getLogger().log(Level.SEVERE, ex.getMessage(), ex);
sender.sendMessage(ChatColor.RED + "An internal error occurred while attempting to perform this command"); cSender.sendMessage(ChatColor.RED + "An internal error occurred while attempting to perform this command");
return true; return true;
} }
} }
@ -398,15 +398,16 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials
try try
{ {
User user = null; User user = null;
Block bSenderBlock = null; Block bSenderBlock = null;
if (sender instanceof Player) if (cSender instanceof Player)
{ {
user = getUser(sender); user = getUser((Player)cSender);
} }
else if (sender instanceof BlockCommandSender) else if (cSender instanceof BlockCommandSender)
{ {
BlockCommandSender bsender = (BlockCommandSender)sender; BlockCommandSender bsender = (BlockCommandSender)cSender;
bSenderBlock = bsender.getBlock(); bSenderBlock = bsender.getBlock();
} }
@ -421,10 +422,11 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials
{ {
Bukkit.getLogger().log(Level.INFO, "{0} issued server command: /{1} {2}", new Object[] Bukkit.getLogger().log(Level.INFO, "{0} issued server command: /{1} {2}", new Object[]
{ {
sender.getName(), commandLabel, EssentialsCommand.getFinalArg(args, 0) cSender.getName(), commandLabel, EssentialsCommand.getFinalArg(args, 0)
}); });
} }
CommandSource sender = new CommandSource(cSender);
// New mail notification // New mail notification
if (user != null && !getSettings().isCommandDisabled("mail") && !command.getName().equals("mail") && user.isAuthorized("essentials.mail")) if (user != null && !getSettings().isCommandDisabled("mail") && !command.getName().equals("mail") && user.isAuthorized("essentials.mail"))
@ -452,7 +454,7 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials
{ {
if (cmd.matches(commandLabel)) if (cmd.matches(commandLabel))
{ {
cmd.execute(sender, commandLabel, args); cmd.execute(cSender, commandLabel, args);
} }
} }
} }
@ -559,7 +561,7 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials
} }
@Override @Override
public void showError(final CommandSender sender, final Throwable exception, final String commandLabel) public void showError(final CommandSource sender, final Throwable exception, final String commandLabel)
{ {
sender.sendMessage(_("errorWithMessage", exception.getMessage())); sender.sendMessage(_("errorWithMessage", exception.getMessage()));
if (getSettings().isDebug()) if (getSettings().isDebug())
@ -608,19 +610,12 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials
this.metrics = metrics; this.metrics = metrics;
} }
@Override @Override
public User getUser(final Object base) public User getUser(final String base)
{
if (base instanceof Player)
{
return getUser((Player)base);
}
if (base instanceof String)
{ {
return getOfflineUser((String)base); return getOfflineUser((String)base);
} }
return null;
}
@Override @Override
public User getOfflineUser(final String name) public User getOfflineUser(final String name)
@ -633,18 +628,14 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials
return user; return user;
} }
private <T extends Player> User getUser(final T base) @Override
public User getUser(final Player base)
{ {
if (base == null) if (base == null)
{ {
return null; return null;
} }
if (base instanceof User)
{
return (User)base;
}
if (userMap == null) if (userMap == null)
{ {
LOGGER.log(Level.WARNING, "Essentials userMap not initialized"); LOGGER.log(Level.WARNING, "Essentials userMap not initialized");
@ -746,7 +737,7 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials
{ {
if (keywords) if (keywords)
{ {
broadcast = new KeywordReplacer(broadcast, player, this, false); broadcast = new KeywordReplacer(broadcast, new CommandSource(player), this, false);
} }
for (String messageText : broadcast.getLines()) for (String messageText : broadcast.getLines())
{ {

View File

@ -35,7 +35,7 @@ public class EssentialsEntityListener implements Listener
final Entity eDefend = event.getEntity(); final Entity eDefend = event.getEntity();
if (eAttack instanceof Player) if (eAttack instanceof Player)
{ {
final User attacker = ess.getUser(eAttack); final User attacker = ess.getUser((Player)eAttack);
if (eDefend instanceof Player) if (eDefend instanceof Player)
{ {
onPlayerVsPlayerDamage(event, (Player)eDefend, attacker); onPlayerVsPlayerDamage(event, (Player)eDefend, attacker);
@ -59,7 +59,7 @@ public class EssentialsEntityListener implements Listener
Entity shooter = ((Projectile)event.getDamager()).getShooter(); Entity shooter = ((Projectile)event.getDamager()).getShooter();
if (shooter instanceof Player) if (shooter instanceof Player)
{ {
final User attacker = ess.getUser(shooter); final User attacker = ess.getUser((Player)shooter);
onPlayerVsPlayerDamage(event, (Player)eDefend, attacker); onPlayerVsPlayerDamage(event, (Player)eDefend, attacker);
attacker.updateActivity(true); attacker.updateActivity(true);
} }
@ -124,7 +124,7 @@ public class EssentialsEntityListener implements Listener
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onEntityDamage(final EntityDamageEvent event) public void onEntityDamage(final EntityDamageEvent event)
{ {
if (event.getEntity() instanceof Player && ess.getUser(event.getEntity()).isGodModeEnabled()) if (event.getEntity() instanceof Player && ess.getUser((Player)event.getEntity()).isGodModeEnabled())
{ {
final Player player = (Player)event.getEntity(); final Player player = (Player)event.getEntity();
player.setFireTicks(0); player.setFireTicks(0);
@ -136,7 +136,7 @@ public class EssentialsEntityListener implements Listener
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onEntityCombust(final EntityCombustEvent event) public void onEntityCombust(final EntityCombustEvent event)
{ {
if (event.getEntity() instanceof Player && ess.getUser(event.getEntity()).isGodModeEnabled()) if (event.getEntity() instanceof Player && ess.getUser((Player)event.getEntity()).isGodModeEnabled())
{ {
event.setCancelled(true); event.setCancelled(true);
} }
@ -173,7 +173,7 @@ public class EssentialsEntityListener implements Listener
{ {
if (event.getEntity() instanceof Player) if (event.getEntity() instanceof Player)
{ {
final User user = ess.getUser(event.getEntity()); final User user = ess.getUser((Player)event.getEntity());
if (user.isGodModeEnabled()) if (user.isGodModeEnabled())
{ {
if (user.isGodModeEnabledRaw()) if (user.isGodModeEnabledRaw())
@ -190,7 +190,7 @@ public class EssentialsEntityListener implements Listener
public void onEntityRegainHealth(final EntityRegainHealthEvent event) public void onEntityRegainHealth(final EntityRegainHealthEvent event)
{ {
if (event.getRegainReason() == RegainReason.SATIATED && event.getEntity() instanceof Player if (event.getRegainReason() == RegainReason.SATIATED && event.getEntity() instanceof Player
&& ess.getUser(event.getEntity()).isAfk() && ess.getSettings().getFreezeAfkPlayers()) && ess.getUser((Player)event.getEntity()).isAfk() && ess.getSettings().getFreezeAfkPlayers())
{ {
event.setCancelled(true); event.setCancelled(true);
} }
@ -201,7 +201,7 @@ public class EssentialsEntityListener implements Listener
{ {
for (LivingEntity entity : event.getAffectedEntities()) for (LivingEntity entity : event.getAffectedEntities())
{ {
if (entity instanceof Player && ess.getUser(entity).isGodModeEnabled()) if (entity instanceof Player && ess.getUser((Player)entity).isGodModeEnabled())
{ {
event.setIntensity(entity, 0d); event.setIntensity(entity, 0d);
} }
@ -213,7 +213,7 @@ public class EssentialsEntityListener implements Listener
{ {
if (event.getEntity() instanceof Player) if (event.getEntity() instanceof Player)
{ {
final User user = ess.getUser(event.getEntity()); final User user = ess.getUser((Player)event.getEntity());
if (user.isAfk()) if (user.isAfk())
{ {
user.updateActivity(true); user.updateActivity(true);

View File

@ -235,10 +235,10 @@ public class EssentialsPlayerListener implements Listener
{ {
try try
{ {
final IText input = new TextInput(user.getBase(), "motd", true, ess); final IText input = new TextInput(user.getSource(), "motd", true, ess);
final IText output = new KeywordReplacer(input, user.getBase(), ess); final IText output = new KeywordReplacer(input, user.getSource(), ess);
final TextPager pager = new TextPager(output, true); final TextPager pager = new TextPager(output, true);
pager.showPage("1", null, "motd", user.getBase()); pager.showPage("1", null, "motd", user.getSource());
} }
catch (IOException ex) catch (IOException ex)
{ {
@ -595,11 +595,11 @@ public class EssentialsPlayerListener implements Listener
if (type == InventoryType.PLAYER) if (type == InventoryType.PLAYER)
{ {
final User user = ess.getUser(event.getWhoClicked()); final User user = ess.getUser((Player)event.getWhoClicked());
final InventoryHolder invHolder = top.getHolder(); final InventoryHolder invHolder = top.getHolder();
if (invHolder != null && invHolder instanceof HumanEntity) if (invHolder != null && invHolder instanceof HumanEntity)
{ {
final User invOwner = ess.getUser((HumanEntity)invHolder); final User invOwner = ess.getUser((Player)invHolder);
if (user.isInvSee() && (!user.isAuthorized("essentials.invsee.modify") if (user.isInvSee() && (!user.isAuthorized("essentials.invsee.modify")
|| invOwner.isAuthorized("essentials.invsee.preventmodify") || invOwner.isAuthorized("essentials.invsee.preventmodify")
|| !invOwner.isOnline())) || !invOwner.isOnline()))
@ -611,7 +611,7 @@ public class EssentialsPlayerListener implements Listener
} }
else if (type == InventoryType.ENDER_CHEST) else if (type == InventoryType.ENDER_CHEST)
{ {
final User user = ess.getUser(event.getWhoClicked()); final User user = ess.getUser((Player)event.getWhoClicked());
if (user.isEnderSee() && (!user.isAuthorized("essentials.enderchest.modify"))) if (user.isEnderSee() && (!user.isAuthorized("essentials.enderchest.modify")))
{ {
event.setCancelled(true); event.setCancelled(true);
@ -619,7 +619,7 @@ public class EssentialsPlayerListener implements Listener
} }
else if (type == InventoryType.WORKBENCH) else if (type == InventoryType.WORKBENCH)
{ {
User user = ess.getUser(event.getWhoClicked()); User user = ess.getUser((Player)event.getWhoClicked());
if (user.isRecipeSee()) if (user.isRecipeSee())
{ {
event.setCancelled(true); event.setCancelled(true);
@ -627,7 +627,7 @@ public class EssentialsPlayerListener implements Listener
} }
else if (type == InventoryType.CHEST && top.getSize() == 9) else if (type == InventoryType.CHEST && top.getSize() == 9)
{ {
final User user = ess.getUser(event.getWhoClicked()); final User user = ess.getUser((Player)event.getWhoClicked());
final InventoryHolder invHolder = top.getHolder(); final InventoryHolder invHolder = top.getHolder();
if (invHolder != null && invHolder instanceof HumanEntity && user.isInvSee()) if (invHolder != null && invHolder instanceof HumanEntity && user.isInvSee())
{ {
@ -643,19 +643,19 @@ public class EssentialsPlayerListener implements Listener
final InventoryType type = top.getType(); final InventoryType type = top.getType();
if (type == InventoryType.PLAYER) if (type == InventoryType.PLAYER)
{ {
final User user = ess.getUser(event.getPlayer()); final User user = ess.getUser((Player)event.getPlayer());
user.setInvSee(false); user.setInvSee(false);
user.updateInventory(); user.updateInventory();
} }
else if (type == InventoryType.ENDER_CHEST) else if (type == InventoryType.ENDER_CHEST)
{ {
final User user = ess.getUser(event.getPlayer()); final User user = ess.getUser((Player)event.getPlayer());
user.setEnderSee(false); user.setEnderSee(false);
user.updateInventory(); user.updateInventory();
} }
else if (type == InventoryType.WORKBENCH) else if (type == InventoryType.WORKBENCH)
{ {
final User user = ess.getUser(event.getPlayer()); final User user = ess.getUser((Player)event.getPlayer());
if (user.isRecipeSee()) if (user.isRecipeSee())
{ {
user.setRecipeSee(false); user.setRecipeSee(false);
@ -668,7 +668,7 @@ public class EssentialsPlayerListener implements Listener
final InventoryHolder invHolder = top.getHolder(); final InventoryHolder invHolder = top.getHolder();
if (invHolder != null && invHolder instanceof HumanEntity) if (invHolder != null && invHolder instanceof HumanEntity)
{ {
final User user = ess.getUser(event.getPlayer()); final User user = ess.getUser((Player)event.getPlayer());
user.setInvSee(false); user.setInvSee(false);
user.updateInventory(); user.updateInventory();
} }

View File

@ -10,6 +10,7 @@ import java.util.List;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.scheduler.BukkitScheduler;
import org.bukkit.scheduler.BukkitTask; import org.bukkit.scheduler.BukkitTask;
@ -23,7 +24,9 @@ public interface IEssentials extends Plugin
boolean onCommandEssentials(CommandSender sender, Command command, String commandLabel, String[] args, ClassLoader classLoader, String commandPath, String permissionPrefix, IEssentialsModule module); boolean onCommandEssentials(CommandSender sender, Command command, String commandLabel, String[] args, ClassLoader classLoader, String commandPath, String permissionPrefix, IEssentialsModule module);
User getUser(Object base); User getUser(String base);
User getUser(Player base);
I18n getI18n(); I18n getI18n();
@ -67,7 +70,7 @@ public interface IEssentials extends Plugin
AlternativeCommandsHandler getAlternativeCommandsHandler(); AlternativeCommandsHandler getAlternativeCommandsHandler();
void showError(final CommandSender sender, final Throwable exception, final String commandLabel); void showError(final CommandSource sender, final Throwable exception, final String commandLabel);
IItemDb getItemDb(); IItemDb getItemDb();

View File

@ -1,18 +1,16 @@
package com.earth2me.essentials; package com.earth2me.essentials;
import org.bukkit.command.CommandSender;
public interface IReplyTo public interface IReplyTo
{ {
/** /**
* Sets the user to reply to * Sets the user to reply to
* @param user * @param user
*/ */
public void setReplyTo(CommandSender user); public void setReplyTo(CommandSource user);
/** /**
* Gets the user the sender should reply to * Gets the user the sender should reply to
* @return * @return
*/ */
public CommandSender getReplyTo(); public CommandSource getReplyTo();
} }

View File

@ -7,7 +7,6 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import net.ess3.api.ITeleport; import net.ess3.api.ITeleport;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -23,13 +22,13 @@ public interface IUser
void giveMoney(BigDecimal value); void giveMoney(BigDecimal value);
void giveMoney(final BigDecimal value, final CommandSender initiator); void giveMoney(final BigDecimal value, final CommandSource initiator);
void payUser(final User reciever, final BigDecimal value) throws Exception; void payUser(final User reciever, final BigDecimal value) throws Exception;
void takeMoney(BigDecimal value); void takeMoney(BigDecimal value);
void takeMoney(final BigDecimal value, final CommandSender initiator); void takeMoney(final BigDecimal value, final CommandSource initiator);
boolean canAfford(BigDecimal value); boolean canAfford(BigDecimal value);
@ -95,7 +94,6 @@ public interface IUser
/* /*
* UserData * UserData
*/ */
Location getHome(String name) throws Exception; Location getHome(String name) throws Exception;
Location getHome(Location loc) throws Exception; Location getHome(Location loc) throws Exception;
@ -137,8 +135,9 @@ public interface IUser
/* /*
* PlayerExtension * PlayerExtension
*/ */
Player getBase(); Player getBase();
CommandSource getSource();
public String getName(); public String getName();
} }

View File

@ -12,6 +12,7 @@ import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
@ -236,7 +237,7 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
final Entity damager = event.getDamager(); final Entity damager = event.getDamager();
if (damager.getType() == EntityType.PLAYER) if (damager.getType() == EntityType.PLAYER)
{ {
final User user = ess.getUser(damager); final User user = ess.getUser((Player)damager);
if (user != null && user.isJailed()) if (user != null && user.isJailed())
{ {
event.setCancelled(true); event.setCancelled(true);

View File

@ -171,7 +171,7 @@ public class Kit
try try
{ {
IText input = new SimpleTextInput(items); IText input = new SimpleTextInput(items);
IText output = new KeywordReplacer(input, user.getBase(), ess); IText output = new KeywordReplacer(input, user.getSource(), ess);
boolean spew = false; boolean spew = false;
final boolean allowUnsafe = ess.getSettings().allowUnsafeEnchantments(); final boolean allowUnsafe = ess.getSettings().allowUnsafeEnchantments();

View File

@ -13,7 +13,6 @@ import org.bukkit.Color;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
import org.bukkit.FireworkEffect; import org.bukkit.FireworkEffect;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.command.CommandSender;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.*; import org.bukkit.inventory.meta.*;
@ -95,7 +94,7 @@ public class MetaItemStack
completePotion = true; completePotion = true;
} }
public void parseStringMeta(final CommandSender sender, final boolean allowUnsafe, String[] string, int fromArg, final IEssentials ess) throws Exception public void parseStringMeta(final CommandSource sender, final boolean allowUnsafe, String[] string, int fromArg, final IEssentials ess) throws Exception
{ {
for (int i = fromArg; i < string.length; i++) for (int i = fromArg; i < string.length; i++)
@ -119,7 +118,7 @@ public class MetaItemStack
} }
} }
private void addStringMeta(final CommandSender sender, final boolean allowUnsafe, final String string, final IEssentials ess) throws Exception private void addStringMeta(final CommandSource sender, final boolean allowUnsafe, final String string, final IEssentials ess) throws Exception
{ {
final String[] split = splitPattern.split(string, 2); final String[] split = splitPattern.split(string, 2);
if (split.length < 1) if (split.length < 1)
@ -226,7 +225,7 @@ public class MetaItemStack
} }
} }
public void addFireworkMeta(final CommandSender sender, final boolean allowShortName, final String string, final IEssentials ess) throws Exception public void addFireworkMeta(final CommandSource sender, final boolean allowShortName, final String string, final IEssentials ess) throws Exception
{ {
if (stack.getType() == Material.FIREWORK) if (stack.getType() == Material.FIREWORK)
{ {
@ -331,7 +330,7 @@ public class MetaItemStack
} }
} }
public void addPotionMeta(final CommandSender sender, final boolean allowShortName, final String string, final IEssentials ess) throws Exception public void addPotionMeta(final CommandSource sender, final boolean allowShortName, final String string, final IEssentials ess) throws Exception
{ {
if (stack.getType() == Material.POTION) if (stack.getType() == Material.POTION)
{ {
@ -405,7 +404,7 @@ public class MetaItemStack
} }
} }
private void parseEnchantmentStrings(final CommandSender sender, final boolean allowUnsafe, final String[] split, final IEssentials ess) throws Exception private void parseEnchantmentStrings(final CommandSource sender, final boolean allowUnsafe, final String[] split, final IEssentials ess) throws Exception
{ {
final Enchantment enchantment = Enchantments.getByName(split[0]); final Enchantment enchantment = Enchantments.getByName(split[0]);
if (enchantment == null || !hasMetaPermission(sender, "enchantments." + enchantment.getName().toLowerCase(Locale.ENGLISH), false, false, ess)) if (enchantment == null || !hasMetaPermission(sender, "enchantments." + enchantment.getName().toLowerCase(Locale.ENGLISH), false, false, ess))
@ -433,7 +432,7 @@ public class MetaItemStack
addEnchantment(sender, allowUnsafe, enchantment, level); addEnchantment(sender, allowUnsafe, enchantment, level);
} }
public void addEnchantment(final CommandSender sender, final boolean allowUnsafe, final Enchantment enchantment, final int level) throws Exception public void addEnchantment(final CommandSource sender, final boolean allowUnsafe, final Enchantment enchantment, final int level) throws Exception
{ {
if (enchantment == null) if (enchantment == null)
{ {
@ -496,9 +495,9 @@ public class MetaItemStack
return enchantment; return enchantment;
} }
private boolean hasMetaPermission(final CommandSender sender, final String metaPerm, final boolean graceful, final boolean includeBase, final IEssentials ess) throws Exception private boolean hasMetaPermission(final CommandSource sender, final String metaPerm, final boolean graceful, final boolean includeBase, final IEssentials ess) throws Exception
{ {
final User user = ess.getUser(sender); final User user = sender.isPlayer() ? ess.getUser(sender.getPlayer()) : null;
return hasMetaPermission(user, metaPerm, graceful, includeBase); return hasMetaPermission(user, metaPerm, graceful, includeBase);
} }

View File

@ -14,7 +14,6 @@ import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.*; import org.bukkit.entity.*;
import org.bukkit.inventory.EntityEquipment; import org.bukkit.inventory.EntityEquipment;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -91,17 +90,17 @@ public class SpawnMob
{ {
throw new Exception(_("unableToSpawnMob")); throw new Exception(_("unableToSpawnMob"));
} }
spawnmob(ess, server, user.getBase(), user, block.getLocation(), parts, data, mobCount); spawnmob(ess, server, user.getSource(), user, block.getLocation(), parts, data, mobCount);
} }
// This method spawns a mob at target, owned by target // This method spawns a mob at target, owned by target
public static void spawnmob(final IEssentials ess, final Server server, final CommandSender sender, final User target, final List<String> parts, final List<String> data, int mobCount) throws Exception public static void spawnmob(final IEssentials ess, final Server server, final CommandSource sender, final User target, final List<String> parts, final List<String> data, int mobCount) throws Exception
{ {
spawnmob(ess, server, sender, target, target.getLocation(), parts, data, mobCount); spawnmob(ess, server, sender, target, target.getLocation(), parts, data, mobCount);
} }
// This method spawns a mob at loc, owned by target // This method spawns a mob at loc, owned by target
public static void spawnmob(final IEssentials ess, final Server server, final CommandSender sender, final User target, final Location loc, final List<String> parts, final List<String> data, int mobCount) throws Exception public static void spawnmob(final IEssentials ess, final Server server, final CommandSource sender, final User target, final Location loc, final List<String> parts, final List<String> data, int mobCount) throws Exception
{ {
final Location sloc = LocationUtil.getSafeDestination(loc); final Location sloc = LocationUtil.getSafeDestination(loc);
@ -152,7 +151,7 @@ public class SpawnMob
} }
} }
private static void spawnMob(final IEssentials ess, final Server server, final CommandSender sender, final User target, final Location sloc, List<String> parts, List<String> data) throws Exception private static void spawnMob(final IEssentials ess, final Server server, final CommandSource sender, final User target, final Location sloc, List<String> parts, List<String> data) throws Exception
{ {
Mob mob; Mob mob;
Entity spawnedMob = null; Entity spawnedMob = null;
@ -191,7 +190,7 @@ public class SpawnMob
} }
} }
private static void checkSpawnable(IEssentials ess, CommandSender sender, Mob mob) throws Exception private static void checkSpawnable(IEssentials ess, CommandSource sender, Mob mob) throws Exception
{ {
if (mob == null) if (mob == null)
{ {
@ -203,13 +202,13 @@ public class SpawnMob
throw new Exception(_("disabledToSpawnMob")); throw new Exception(_("disabledToSpawnMob"));
} }
if (sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.spawnmob." + mob.name.toLowerCase(Locale.ENGLISH))) if (sender.isPlayer() && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.spawnmob." + mob.name.toLowerCase(Locale.ENGLISH)))
{ {
throw new Exception(_("noPermToSpawnMob")); throw new Exception(_("noPermToSpawnMob"));
} }
} }
private static void changeMobData(final CommandSender sender, final EntityType type, final Entity spawned, final String inputData, final User target) throws Exception private static void changeMobData(final CommandSource sender, final EntityType type, final Entity spawned, final String inputData, final User target) throws Exception
{ {
String data = inputData; String data = inputData;
@ -219,7 +218,8 @@ public class SpawnMob
} }
MobData newData = MobData.fromData(spawned, data); MobData newData = MobData.fromData(spawned, data);
while (newData != null) { while (newData != null)
{
newData.setData(spawned, target.getBase(), data); newData.setData(spawned, target.getBase(), data);
data = data.replace(newData.getMatched(), ""); data = data.replace(newData.getMatched(), "");
newData = MobData.fromData(spawned, data); newData = MobData.fromData(spawned, data);

View File

@ -114,7 +114,7 @@ public class TimedTeleport implements Runnable
} }
catch (Throwable ex) catch (Throwable ex)
{ {
ess.showError(teleportOwner.getBase(), ex, "teleport"); ess.showError(teleportOwner.getSource(), ex, "teleport");
} }
} }
catch (Exception ex) catch (Exception ex)

View File

@ -14,7 +14,6 @@ import java.util.logging.Logger;
import net.ess3.api.IEssentials; import net.ess3.api.IEssentials;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
@ -23,7 +22,7 @@ import org.bukkit.potion.PotionEffectType;
public class User extends UserData implements Comparable<User>, IReplyTo, net.ess3.api.IUser public class User extends UserData implements Comparable<User>, IReplyTo, net.ess3.api.IUser
{ {
private CommandSender replyTo = null; private CommandSource replyTo = null;
private transient String teleportRequester; private transient String teleportRequester;
private transient boolean teleportRequestHere; private transient boolean teleportRequestHere;
private transient Location teleportLocation; private transient Location teleportLocation;
@ -137,7 +136,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
} }
@Override @Override
public void giveMoney(final BigDecimal value, final CommandSender initiator) public void giveMoney(final BigDecimal value, final CommandSource initiator)
{ {
if (value.signum() == 0) if (value.signum() == 0)
{ {
@ -178,7 +177,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
} }
@Override @Override
public void takeMoney(final BigDecimal value, final CommandSender initiator) public void takeMoney(final BigDecimal value, final CommandSource initiator)
{ {
if (value.signum() == 0) if (value.signum() == 0)
{ {
@ -799,13 +798,13 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
} }
@Override @Override
public void setReplyTo(final CommandSender user) public void setReplyTo(final CommandSource user)
{ {
replyTo = user; replyTo = user;
} }
@Override @Override
public CommandSender getReplyTo() public CommandSource getReplyTo()
{ {
return replyTo; return replyTo;
} }
@ -832,4 +831,9 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
{ {
return this.getName().hashCode(); return this.getName().hashCode();
} }
public CommandSource getSource()
{
return new CommandSource(getBase());
}
} }

View File

@ -1,9 +1,9 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandafk extends EssentialsCommand public class Commandafk extends EssentialsCommand
@ -28,7 +28,7 @@ public class Commandafk extends EssentialsCommand
} }
@Override @Override
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception public void run(Server server, CommandSource sender, String commandLabel, String[] args) throws Exception
{ {
if (args.length > 0) if (args.length > 0)
{ {

View File

@ -1,9 +1,9 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.Backup; import com.earth2me.essentials.Backup;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandbackup extends EssentialsCommand public class Commandbackup extends EssentialsCommand
@ -14,7 +14,7 @@ public class Commandbackup extends EssentialsCommand
} }
@Override @Override
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
final Backup backup = ess.getBackup(); final Backup backup = ess.getBackup();
if (backup == null) if (backup == null)

View File

@ -1,11 +1,11 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import com.earth2me.essentials.utils.NumberUtil; import com.earth2me.essentials.utils.NumberUtil;
import java.math.BigDecimal; import java.math.BigDecimal;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandbalance extends EssentialsCommand public class Commandbalance extends EssentialsCommand
@ -16,7 +16,7 @@ public class Commandbalance extends EssentialsCommand
} }
@Override @Override
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
if (args.length < 1) if (args.length < 1)
{ {

View File

@ -1,5 +1,6 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import com.earth2me.essentials.textreader.SimpleTextInput; import com.earth2me.essentials.textreader.SimpleTextInput;
@ -11,7 +12,6 @@ import java.util.*;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
//TODO: Remove op and replace with perm //TODO: Remove op and replace with perm
public class Commandbalancetop extends EssentialsCommand public class Commandbalancetop extends EssentialsCommand
@ -27,7 +27,7 @@ public class Commandbalancetop extends EssentialsCommand
private static ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); private static ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
@Override @Override
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
int page = 0; int page = 0;
boolean force = false; boolean force = false;
@ -39,7 +39,7 @@ public class Commandbalancetop extends EssentialsCommand
} }
catch (NumberFormatException ex) catch (NumberFormatException ex)
{ {
if (args[0].equalsIgnoreCase("force") && sender.isOp()) if (args[0].equalsIgnoreCase("force") && sender.getSender().isOp())
{ {
force = true; force = true;
} }
@ -77,7 +77,7 @@ public class Commandbalancetop extends EssentialsCommand
} }
private static void outputCache(final CommandSender sender, int page) private static void outputCache(final CommandSource sender, int page)
{ {
final Calendar cal = Calendar.getInstance(); final Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(cacheage); cal.setTimeInMillis(cacheage);
@ -163,11 +163,11 @@ public class Commandbalancetop extends EssentialsCommand
private class Viewer implements Runnable private class Viewer implements Runnable
{ {
private final transient CommandSender sender; private final transient CommandSource sender;
private final transient int page; private final transient int page;
private final transient boolean force; private final transient boolean force;
public Viewer(final CommandSender sender, final int page, final boolean force) public Viewer(final CommandSource sender, final int page, final boolean force)
{ {
this.sender = sender; this.sender = sender;
this.page = page; this.page = page;

View File

@ -1,5 +1,6 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import com.earth2me.essentials.Console; import com.earth2me.essentials.Console;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.OfflinePlayer; import com.earth2me.essentials.OfflinePlayer;
@ -7,7 +8,6 @@ import com.earth2me.essentials.User;
import com.earth2me.essentials.utils.FormatUtil; import com.earth2me.essentials.utils.FormatUtil;
import java.util.logging.Level; import java.util.logging.Level;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -19,7 +19,7 @@ public class Commandban extends EssentialsCommand
} }
@Override @Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
boolean nomatch = false; boolean nomatch = false;
if (args.length < 1) if (args.length < 1)
@ -38,8 +38,7 @@ public class Commandban extends EssentialsCommand
} }
if (!user.isOnline()) if (!user.isOnline())
{ {
if (sender instanceof Player if (sender.isPlayer() && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.ban.offline"))
&& !ess.getUser(sender).isAuthorized("essentials.ban.offline"))
{ {
throw new Exception(_("banExempt")); throw new Exception(_("banExempt"));
} }
@ -52,7 +51,7 @@ public class Commandban extends EssentialsCommand
} }
} }
final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME; final String senderName = sender.isPlayer() ? sender.getPlayer().getDisplayName() : Console.NAME;
String banReason; String banReason;
if (args.length > 1) if (args.length > 1)
{ {

View File

@ -1,13 +1,12 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import com.earth2me.essentials.Console; import com.earth2me.essentials.Console;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import com.earth2me.essentials.utils.FormatUtil; import com.earth2me.essentials.utils.FormatUtil;
import java.util.logging.Level; import java.util.logging.Level;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Commandbanip extends EssentialsCommand public class Commandbanip extends EssentialsCommand
@ -18,14 +17,14 @@ public class Commandbanip extends EssentialsCommand
} }
@Override @Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
if (args.length < 1) if (args.length < 1)
{ {
throw new NotEnoughArgumentsException(); throw new NotEnoughArgumentsException();
} }
final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME; final String senderName = sender.isPlayer() ? sender.getPlayer().getDisplayName() : Console.NAME;
String ipAddress; String ipAddress;
if (FormatUtil.validIP(args[0])) if (FormatUtil.validIP(args[0]))

View File

@ -1,10 +1,10 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import com.earth2me.essentials.utils.FormatUtil; import com.earth2me.essentials.utils.FormatUtil;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandbroadcast extends EssentialsCommand public class Commandbroadcast extends EssentialsCommand
@ -21,9 +21,9 @@ public class Commandbroadcast extends EssentialsCommand
} }
@Override @Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
sendBroadcast(sender.getName(), args); sendBroadcast(sender.getSender().getName(), args);
} }
private void sendBroadcast(final String name, final String[] args) throws NotEnoughArgumentsException private void sendBroadcast(final String name, final String[] args) throws NotEnoughArgumentsException

View File

@ -1,9 +1,9 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandburn extends EssentialsCommand public class Commandburn extends EssentialsCommand
@ -14,7 +14,7 @@ public class Commandburn extends EssentialsCommand
} }
@Override @Override
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
if (args.length < 2) if (args.length < 2)
{ {

View File

@ -1,5 +1,6 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import com.earth2me.essentials.utils.NumberUtil; import com.earth2me.essentials.utils.NumberUtil;
@ -8,7 +9,6 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -25,23 +25,23 @@ public class Commandclearinventory extends EssentialsCommand
@Override @Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception public void run(Server server, User user, String commandLabel, String[] args) throws Exception
{ {
parseCommand(server, user.getBase(), args, user.isAuthorized("essentials.clearinventory.others"), user.isAuthorized("essentials.clearinventory.all")); parseCommand(server, user.getSource(), args, user.isAuthorized("essentials.clearinventory.others"), user.isAuthorized("essentials.clearinventory.all"));
} }
@Override @Override
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception protected void run(Server server, CommandSource sender, String commandLabel, String[] args) throws Exception
{ {
parseCommand(server, sender, args, true, true); parseCommand(server, sender, args, true, true);
} }
private void parseCommand(Server server, CommandSender sender, String[] args, boolean allowOthers, boolean allowAll) throws Exception private void parseCommand(Server server, CommandSource sender, String[] args, boolean allowOthers, boolean allowAll) throws Exception
{ {
List<Player> players = new ArrayList<Player>(); List<Player> players = new ArrayList<Player>();
int offset = 0; int offset = 0;
if (sender instanceof Player) if (sender.isPlayer())
{ {
players.add((Player)sender); players.add(sender.getPlayer());
} }
if (allowAll && args.length > 0 && args[0].contentEquals("*")) if (allowAll && args.length > 0 && args[0].contentEquals("*"))
@ -66,7 +66,7 @@ public class Commandclearinventory extends EssentialsCommand
} }
} }
protected void clearHandler(CommandSender sender, Player player, String[] args, int offset, boolean showExtended) throws Exception protected void clearHandler(CommandSource sender, Player player, String[] args, int offset, boolean showExtended) throws Exception
{ {
short data = -1; short data = -1;
int type = -1; int type = -1;

View File

@ -1,11 +1,11 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import com.earth2me.essentials.textreader.IText; import com.earth2me.essentials.textreader.IText;
import com.earth2me.essentials.textreader.KeywordReplacer; import com.earth2me.essentials.textreader.KeywordReplacer;
import com.earth2me.essentials.textreader.TextInput; import com.earth2me.essentials.textreader.TextInput;
import com.earth2me.essentials.textreader.TextPager; import com.earth2me.essentials.textreader.TextPager;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandcustomtext extends EssentialsCommand public class Commandcustomtext extends EssentialsCommand
@ -16,7 +16,7 @@ public class Commandcustomtext extends EssentialsCommand
} }
@Override @Override
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
final IText input = new TextInput(sender, "custom", true, ess); final IText input = new TextInput(sender, "custom", true, ess);
final IText output = new KeywordReplacer(input, sender, ess); final IText output = new KeywordReplacer(input, sender, ess);

View File

@ -1,10 +1,10 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import java.util.Locale; import java.util.Locale;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commanddelhome extends EssentialsCommand public class Commanddelhome extends EssentialsCommand
@ -15,14 +15,14 @@ public class Commanddelhome extends EssentialsCommand
} }
@Override @Override
public void run(final Server server, final CommandSender sender, final String commandLabel, String[] args) throws Exception public void run(final Server server, final CommandSource sender, final String commandLabel, String[] args) throws Exception
{ {
if (args.length < 1) if (args.length < 1)
{ {
throw new NotEnoughArgumentsException(); throw new NotEnoughArgumentsException();
} }
User user = ess.getUser(sender); User user = ess.getUser(sender.getPlayer());
String name; String name;
String[] expandedArg; String[] expandedArg;

View File

@ -1,8 +1,8 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commanddeljail extends EssentialsCommand public class Commanddeljail extends EssentialsCommand
@ -13,7 +13,7 @@ public class Commanddeljail extends EssentialsCommand
} }
@Override @Override
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
if (args.length < 1) if (args.length < 1)
{ {

View File

@ -1,8 +1,8 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commanddelwarp extends EssentialsCommand public class Commanddelwarp extends EssentialsCommand
@ -13,7 +13,7 @@ public class Commanddelwarp extends EssentialsCommand
} }
@Override @Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
if (args.length < 1) if (args.length < 1)
{ {

View File

@ -1,13 +1,13 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.ChargeException; import com.earth2me.essentials.ChargeException;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import com.earth2me.essentials.utils.NumberUtil; import com.earth2me.essentials.utils.NumberUtil;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Locale; import java.util.Locale;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandeco extends EssentialsLoopCommand public class Commandeco extends EssentialsLoopCommand
@ -21,7 +21,7 @@ public class Commandeco extends EssentialsLoopCommand
} }
@Override @Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
if (args.length < 2) if (args.length < 2)
{ {
@ -56,7 +56,7 @@ public class Commandeco extends EssentialsLoopCommand
} }
@Override @Override
protected void updatePlayer(final Server server, final CommandSender sender, final User player, final String[] args) throws NotEnoughArgumentsException, ChargeException protected void updatePlayer(final Server server, final CommandSource sender, final User player, final String[] args) throws NotEnoughArgumentsException, ChargeException
{ {
switch (cmd) switch (cmd)
{ {
@ -75,7 +75,7 @@ public class Commandeco extends EssentialsLoopCommand
} }
} }
private void take(BigDecimal amount, final User player, final CommandSender sender) throws ChargeException private void take(BigDecimal amount, final User player, final CommandSource sender) throws ChargeException
{ {
BigDecimal money = player.getMoney(); BigDecimal money = player.getMoney();
BigDecimal minBalance = ess.getSettings().getMinMoney(); BigDecimal minBalance = ess.getSettings().getMinMoney();
@ -94,7 +94,7 @@ public class Commandeco extends EssentialsLoopCommand
} }
} }
private void set(BigDecimal amount, final User player, final CommandSender sender) private void set(BigDecimal amount, final User player, final CommandSource sender)
{ {
BigDecimal minBalance = ess.getSettings().getMinMoney(); BigDecimal minBalance = ess.getSettings().getMinMoney();
boolean underMinimum = (amount.compareTo(minBalance) < 0); boolean underMinimum = (amount.compareTo(minBalance) < 0);

View File

@ -63,7 +63,7 @@ public class Commandenchant extends EssentialsCommand
final MetaItemStack metaStack = new MetaItemStack(stack); final MetaItemStack metaStack = new MetaItemStack(stack);
final Enchantment enchantment = metaStack.getEnchantment(user, args[0]); final Enchantment enchantment = metaStack.getEnchantment(user, args[0]);
metaStack.addEnchantment(user.getBase(), allowUnsafe, enchantment, level); metaStack.addEnchantment(user.getSource(), allowUnsafe, enchantment, level);
user.getInventory().setItemInHand(metaStack.getItemStack()); user.getInventory().setItemInHand(metaStack.getItemStack());
user.updateInventory(); user.updateInventory();

View File

@ -1,5 +1,6 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import com.earth2me.essentials.UserMap; import com.earth2me.essentials.UserMap;
@ -13,8 +14,6 @@ import org.bukkit.Material;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
// This command has 4 undocumented behaviours #EasterEgg // This command has 4 undocumented behaviours #EasterEgg
@ -28,7 +27,7 @@ public class Commandessentials extends EssentialsCommand
private final transient Map<Player, Block> noteBlocks = new HashMap<Player, Block>(); private final transient Map<Player, Block> noteBlocks = new HashMap<Player, Block>();
@Override @Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
if (args.length == 0) if (args.length == 0)
{ {
@ -65,7 +64,7 @@ public class Commandessentials extends EssentialsCommand
} }
//If you do not supply an argument this command will list 'overridden' commands. //If you do not supply an argument this command will list 'overridden' commands.
private void run_disabled(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception private void run_disabled(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
sender.sendMessage("/<command> <reload/debug>"); sender.sendMessage("/<command> <reload/debug>");
@ -85,7 +84,7 @@ public class Commandessentials extends EssentialsCommand
} }
} }
private void run_reset(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception private void run_reset(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
if (args.length < 2) if (args.length < 2)
{ {
@ -96,19 +95,19 @@ public class Commandessentials extends EssentialsCommand
sender.sendMessage("Reset Essentials userdata for player: " + user.getDisplayName()); sender.sendMessage("Reset Essentials userdata for player: " + user.getDisplayName());
} }
private void run_debug(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception private void run_debug(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
ess.getSettings().setDebug(!ess.getSettings().isDebug()); ess.getSettings().setDebug(!ess.getSettings().isDebug());
sender.sendMessage("Essentials " + ess.getDescription().getVersion() + " debug mode " + (ess.getSettings().isDebug() ? "enabled" : "disabled")); sender.sendMessage("Essentials " + ess.getDescription().getVersion() + " debug mode " + (ess.getSettings().isDebug() ? "enabled" : "disabled"));
} }
private void run_reload(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception private void run_reload(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
ess.reload(); ess.reload();
sender.sendMessage(_("essentialsReload", ess.getDescription().getVersion())); sender.sendMessage(_("essentialsReload", ess.getDescription().getVersion()));
} }
private void run_nya(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception private void run_nya(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
final Map<String, Float> noteMap = new HashMap<String, Float>(); final Map<String, Float> noteMap = new HashMap<String, Float>();
noteMap.put("1F#", 0.5f); noteMap.put("1F#", 0.5f);
@ -174,9 +173,8 @@ public class Commandessentials extends EssentialsCommand
} }
noteBlocks.clear(); noteBlocks.clear();
} }
private final String[] consoleMoo = new String[]
{
private final String[] consoleMoo = new String[] {
" (__)", " (__)",
" (oo)", " (oo)",
" /------\\/", " /------\\/",
@ -185,8 +183,8 @@ public class Commandessentials extends EssentialsCommand
" ~~ ~~", " ~~ ~~",
"....\"Have you mooed today?\"..." "....\"Have you mooed today?\"..."
}; };
private final String[] playerMoo = new String[]
private final String[] playerMoo = new String[] { {
" (__)", " (__)",
" (oo)", " (oo)",
" /------\\/", " /------\\/",
@ -195,15 +193,16 @@ public class Commandessentials extends EssentialsCommand
" ~~ ~~", " ~~ ~~",
"....\"Have you mooed today?\"..." "....\"Have you mooed today?\"..."
}; };
private void run_moo(final Server server, final CommandSender sender, final String command, final String args[])
private void run_moo(final Server server, final CommandSource sender, final String command, final String args[])
{ {
if(args.length == 2 && args[1].equals("moo")) if (args.length == 2 && args[1].equals("moo"))
{ {
for(String s : consoleMoo) for (String s : consoleMoo)
{ {
logger.info(s); logger.info(s);
} }
for(Player player : ess.getServer().getOnlinePlayers()) for (Player player : ess.getServer().getOnlinePlayers())
{ {
player.sendMessage(playerMoo); player.sendMessage(playerMoo);
player.playSound(player.getLocation(), Sound.COW_IDLE, 1, 1.0f); player.playSound(player.getLocation(), Sound.COW_IDLE, 1, 1.0f);
@ -211,20 +210,21 @@ public class Commandessentials extends EssentialsCommand
} }
else else
{ {
if (sender instanceof ConsoleCommandSender) if (sender.isPlayer())
{ {
sender.sendMessage(consoleMoo); sender.getSender().sendMessage(playerMoo);
final Player player = (Player)sender;
player.playSound(player.getLocation(), Sound.COW_IDLE, 1, 1.0f);
} }
else else
{ {
sender.sendMessage(playerMoo); sender.getSender().sendMessage(consoleMoo);
final Player player = (Player)sender;
player.playSound(player.getLocation(), Sound.COW_IDLE, 1, 1.0f);
} }
} }
} }
private void run_optout(final Server server, final CommandSender sender, final String command, final String args[]) private void run_optout(final Server server, final CommandSource sender, final String command, final String args[])
{ {
final Metrics metrics = ess.getMetrics(); final Metrics metrics = ess.getMetrics();
try try
@ -246,7 +246,7 @@ public class Commandessentials extends EssentialsCommand
} }
} }
private void run_cleanup(final Server server, final CommandSender sender, final String command, final String args[]) throws Exception private void run_cleanup(final Server server, final CommandSource sender, final String command, final String args[]) throws Exception
{ {
if (args.length < 2 || !NumberUtil.isInt(args[1])) if (args.length < 2 || !NumberUtil.isInt(args[1]))
{ {

View File

@ -1,5 +1,6 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import com.earth2me.essentials.craftbukkit.SetExpFix; import com.earth2me.essentials.craftbukkit.SetExpFix;
@ -7,7 +8,6 @@ import com.earth2me.essentials.utils.NumberUtil;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -23,28 +23,28 @@ public class Commandexp extends EssentialsCommand
{ {
if (args.length == 0) if (args.length == 0)
{ {
showExp(user.getBase(), user); showExp(user.getSource(), user);
} }
else if (args.length > 1 && args[0].equalsIgnoreCase("set") && user.isAuthorized("essentials.exp.set")) else if (args.length > 1 && args[0].equalsIgnoreCase("set") && user.isAuthorized("essentials.exp.set"))
{ {
if (args.length == 3 && user.isAuthorized("essentials.exp.set.others")) if (args.length == 3 && user.isAuthorized("essentials.exp.set.others"))
{ {
expMatch(server, user.getBase(), args[1], args[2], false); expMatch(server, user.getSource(), args[1], args[2], false);
} }
else else
{ {
setExp(user.getBase(), user, args[1], false); setExp(user.getSource(), user, args[1], false);
} }
} }
else if (args.length > 1 && args[0].equalsIgnoreCase("give") && user.isAuthorized("essentials.exp.give")) else if (args.length > 1 && args[0].equalsIgnoreCase("give") && user.isAuthorized("essentials.exp.give"))
{ {
if (args.length == 3 && user.isAuthorized("essentials.exp.give.others")) if (args.length == 3 && user.isAuthorized("essentials.exp.give.others"))
{ {
expMatch(server, user.getBase(), args[1], args[2], true); expMatch(server, user.getSource(), args[1], args[2], true);
} }
else else
{ {
setExp(user.getBase(), user, args[1], true); setExp(user.getSource(), user, args[1], true);
} }
} }
else if (args[0].equalsIgnoreCase("show")) else if (args[0].equalsIgnoreCase("show"))
@ -52,11 +52,11 @@ public class Commandexp extends EssentialsCommand
if (args.length >= 2 && user.isAuthorized("essentials.exp.others")) if (args.length >= 2 && user.isAuthorized("essentials.exp.others"))
{ {
String match = args[1].trim(); String match = args[1].trim();
showMatch(server, user.getBase(), match); showMatch(server, user.getSource(), match);
} }
else else
{ {
showExp(user.getBase(), user); showExp(user.getSource(), user);
} }
} }
else else
@ -65,27 +65,27 @@ public class Commandexp extends EssentialsCommand
{ {
if (args.length >= 2 && user.isAuthorized("essentials.exp.give.others")) if (args.length >= 2 && user.isAuthorized("essentials.exp.give.others"))
{ {
expMatch(server, user.getBase(), args[1], args[0], true); expMatch(server, user.getSource(), args[1], args[0], true);
} }
else else
{ {
setExp(user.getBase(), user, args[0], true); setExp(user.getSource(), user, args[0], true);
} }
} }
else if (args.length >= 1 && user.isAuthorized("essentials.exp.others")) else if (args.length >= 1 && user.isAuthorized("essentials.exp.others"))
{ {
String match = args[0].trim(); String match = args[0].trim();
showMatch(server, user.getBase(), match); showMatch(server, user.getSource(), match);
} }
else else
{ {
showExp(user.getBase(), user); showExp(user.getSource(), user);
} }
} }
} }
@Override @Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
if (args.length < 1) if (args.length < 1)
{ {
@ -115,9 +115,9 @@ public class Commandexp extends EssentialsCommand
} }
} }
private void showMatch(final Server server, final CommandSender sender, final String match) throws PlayerNotFoundException private void showMatch(final Server server, final CommandSource sender, final String match) throws PlayerNotFoundException
{ {
boolean skipHidden = sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.vanish.interact"); boolean skipHidden = sender.isPlayer() && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.vanish.interact");
boolean foundUser = false; boolean foundUser = false;
final List<Player> matchedPlayers = server.matchPlayer(match); final List<Player> matchedPlayers = server.matchPlayer(match);
for (Player matchPlayer : matchedPlayers) for (Player matchPlayer : matchedPlayers)
@ -136,9 +136,9 @@ public class Commandexp extends EssentialsCommand
} }
} }
private void expMatch(final Server server, final CommandSender sender, final String match, String amount, final boolean give) throws NotEnoughArgumentsException, PlayerNotFoundException private void expMatch(final Server server, final CommandSource sender, final String match, String amount, final boolean give) throws NotEnoughArgumentsException, PlayerNotFoundException
{ {
boolean skipHidden = sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.vanish.interact"); boolean skipHidden = sender.isPlayer() && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.vanish.interact");
boolean foundUser = false; boolean foundUser = false;
final List<Player> matchedPlayers = server.matchPlayer(match); final List<Player> matchedPlayers = server.matchPlayer(match);
for (Player matchPlayer : matchedPlayers) for (Player matchPlayer : matchedPlayers)
@ -157,13 +157,13 @@ public class Commandexp extends EssentialsCommand
} }
} }
private void showExp(final CommandSender sender, final User target) private void showExp(final CommandSource sender, final User target)
{ {
sender.sendMessage(_("exp", target.getDisplayName(), SetExpFix.getTotalExperience(target.getBase()), target.getLevel(), SetExpFix.getExpUntilNextLevel(target.getBase()))); sender.sendMessage(_("exp", target.getDisplayName(), SetExpFix.getTotalExperience(target.getBase()), target.getLevel(), SetExpFix.getExpUntilNextLevel(target.getBase())));
} }
//TODO: Limit who can give negative exp? //TODO: Limit who can give negative exp?
private void setExp(final CommandSender sender, final User target, String strAmount, final boolean give) throws NotEnoughArgumentsException private void setExp(final CommandSource sender, final User target, String strAmount, final boolean give) throws NotEnoughArgumentsException
{ {
long amount; long amount;
strAmount = strAmount.toLowerCase(Locale.ENGLISH); strAmount = strAmount.toLowerCase(Locale.ENGLISH);

View File

@ -1,9 +1,9 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -15,7 +15,7 @@ public class Commandext extends EssentialsLoopCommand
} }
@Override @Override
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
if (args.length < 1) if (args.length < 1)
{ {
@ -35,11 +35,11 @@ public class Commandext extends EssentialsLoopCommand
return; return;
} }
loopOnlinePlayers(server, user.getBase(), true, args[0], null); loopOnlinePlayers(server, user.getSource(), true, args[0], null);
} }
@Override @Override
protected void updatePlayer(final Server server, final CommandSender sender, final User player, final String[] args) protected void updatePlayer(final Server server, final CommandSource sender, final User player, final String[] args)
{ {
extPlayer(player.getBase()); extPlayer(player.getBase());
sender.sendMessage(_("extinguishOthers", player.getDisplayName())); sender.sendMessage(_("extinguishOthers", player.getDisplayName()));

View File

@ -1,9 +1,9 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.entity.FoodLevelChangeEvent; import org.bukkit.event.entity.FoodLevelChangeEvent;
@ -25,7 +25,7 @@ public class Commandfeed extends EssentialsLoopCommand
if (args.length > 0 && user.isAuthorized("essentials.feed.others")) if (args.length > 0 && user.isAuthorized("essentials.feed.others"))
{ {
loopOnlinePlayers(server, user.getBase(), true, args[0], null); loopOnlinePlayers(server, user.getSource(), true, args[0], null);
return; return;
} }
@ -34,7 +34,7 @@ public class Commandfeed extends EssentialsLoopCommand
} }
@Override @Override
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
if (args.length < 1) if (args.length < 1)
{ {
@ -45,7 +45,7 @@ public class Commandfeed extends EssentialsLoopCommand
} }
@Override @Override
protected void updatePlayer(final Server server, final CommandSender sender, final User player, final String[] args) throws PlayerExemptException protected void updatePlayer(final Server server, final CommandSource sender, final User player, final String[] args) throws PlayerExemptException
{ {
try try
{ {

View File

@ -113,7 +113,7 @@ public class Commandfirework extends EssentialsCommand
{ {
try try
{ {
mStack.addFireworkMeta(user.getBase(), true, arg, ess); mStack.addFireworkMeta(user.getSource(), true, arg, ess);
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -1,9 +1,9 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandfly extends EssentialsToggleCommand public class Commandfly extends EssentialsToggleCommand
@ -14,7 +14,7 @@ public class Commandfly extends EssentialsToggleCommand
} }
@Override @Override
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
toggleOtherPlayers(server, sender, args); toggleOtherPlayers(server, sender, args);
} }
@ -27,25 +27,25 @@ public class Commandfly extends EssentialsToggleCommand
Boolean toggle = matchToggleArgument(args[0]); Boolean toggle = matchToggleArgument(args[0]);
if (toggle == null && user.isAuthorized(othersPermission)) if (toggle == null && user.isAuthorized(othersPermission))
{ {
toggleOtherPlayers(server, user.getBase(), args); toggleOtherPlayers(server, user.getSource(), args);
} }
else else
{ {
togglePlayer(user.getBase(), user, toggle); togglePlayer(user.getSource(), user, toggle);
} }
} }
else if (args.length == 2 && user.isAuthorized(othersPermission)) else if (args.length == 2 && user.isAuthorized(othersPermission))
{ {
toggleOtherPlayers(server, user.getBase(), args); toggleOtherPlayers(server, user.getSource(), args);
} }
else else
{ {
togglePlayer(user.getBase(), user, null); togglePlayer(user.getSource(), user, null);
} }
} }
@Override @Override
void togglePlayer(CommandSender sender, User user, Boolean enabled) void togglePlayer(CommandSource sender, User user, Boolean enabled)
{ {
if (enabled == null) if (enabled == null)
{ {

View File

@ -1,12 +1,12 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -18,7 +18,7 @@ public class Commandgamemode extends EssentialsCommand
} }
@Override @Override
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
GameMode gameMode; GameMode gameMode;
if (args.length == 0) if (args.length == 0)
@ -49,7 +49,7 @@ public class Commandgamemode extends EssentialsCommand
else if (args.length > 1 && args[1].trim().length() > 2 && user.isAuthorized("essentials.gamemode.others")) else if (args.length > 1 && args[1].trim().length() > 2 && user.isAuthorized("essentials.gamemode.others"))
{ {
gameMode = matchGameMode(args[0].toLowerCase(Locale.ENGLISH)); gameMode = matchGameMode(args[0].toLowerCase(Locale.ENGLISH));
gamemodeOtherPlayers(server, user.getBase(), gameMode, args[1]); gamemodeOtherPlayers(server, user.getSource(), gameMode, args[1]);
return; return;
} }
else else
@ -63,7 +63,7 @@ public class Commandgamemode extends EssentialsCommand
if (user.isAuthorized("essentials.gamemode.others")) if (user.isAuthorized("essentials.gamemode.others"))
{ {
gameMode = matchGameMode(commandLabel); gameMode = matchGameMode(commandLabel);
gamemodeOtherPlayers(server, user.getBase(), gameMode, args[0]); gamemodeOtherPlayers(server, user.getSource(), gameMode, args[0]);
return; return;
} }
throw new NotEnoughArgumentsException(); throw new NotEnoughArgumentsException();
@ -77,7 +77,7 @@ public class Commandgamemode extends EssentialsCommand
user.sendMessage(_("gameMode", _(user.getGameMode().toString().toLowerCase(Locale.ENGLISH)), user.getDisplayName())); user.sendMessage(_("gameMode", _(user.getGameMode().toString().toLowerCase(Locale.ENGLISH)), user.getDisplayName()));
} }
private void gamemodeOtherPlayers(final Server server, final CommandSender sender, final GameMode gameMode, final String name) throws NotEnoughArgumentsException, PlayerNotFoundException private void gamemodeOtherPlayers(final Server server, final CommandSource sender, final GameMode gameMode, final String name) throws NotEnoughArgumentsException, PlayerNotFoundException
{ {
//TODO: TL this //TODO: TL this
if (name.trim().length() < 2 || gameMode == null) if (name.trim().length() < 2 || gameMode == null)
@ -85,7 +85,7 @@ public class Commandgamemode extends EssentialsCommand
throw new NotEnoughArgumentsException("You need to specify a valid player/mode."); throw new NotEnoughArgumentsException("You need to specify a valid player/mode.");
} }
boolean skipHidden = sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.vanish.interact"); boolean skipHidden = sender.isPlayer() && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.vanish.interact");
boolean foundUser = false; boolean foundUser = false;
final List<Player> matchedPlayers = server.matchPlayer(name); final List<Player> matchedPlayers = server.matchPlayer(name);
for (Player matchPlayer : matchedPlayers) for (Player matchPlayer : matchedPlayers)

View File

@ -1,5 +1,6 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.utils.DateUtil; import com.earth2me.essentials.utils.DateUtil;
import com.earth2me.essentials.utils.NumberUtil; import com.earth2me.essentials.utils.NumberUtil;
@ -9,7 +10,6 @@ import org.bukkit.ChatColor;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.command.CommandSender;
public class Commandgc extends EssentialsCommand public class Commandgc extends EssentialsCommand
@ -20,7 +20,7 @@ public class Commandgc extends EssentialsCommand
} }
@Override @Override
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
double tps = ess.getTimer().getAverageTPS(); double tps = ess.getTimer().getAverageTPS();
ChatColor color; ChatColor color;

View File

@ -1,10 +1,10 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandgetpos extends EssentialsCommand public class Commandgetpos extends EssentialsCommand
@ -20,14 +20,14 @@ public class Commandgetpos extends EssentialsCommand
if (args.length > 0 && user.isAuthorized("essentials.getpos.others")) if (args.length > 0 && user.isAuthorized("essentials.getpos.others"))
{ {
final User otherUser = getPlayer(server, user, args, 0); final User otherUser = getPlayer(server, user, args, 0);
outputPosition(user.getBase(), otherUser.getLocation(), user.getLocation()); outputPosition(user.getSource(), otherUser.getLocation(), user.getLocation());
return; return;
} }
outputPosition(user.getBase(), user.getLocation(), null); outputPosition(user.getSource(), user.getLocation(), null);
} }
@Override @Override
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
if (args.length < 1) if (args.length < 1)
{ {
@ -37,7 +37,7 @@ public class Commandgetpos extends EssentialsCommand
outputPosition(sender, user.getLocation(), null); outputPosition(sender, user.getLocation(), null);
} }
private void outputPosition(final CommandSender sender, final Location coords, final Location distance) private void outputPosition(final CommandSource sender, final Location coords, final Location distance)
{ {
sender.sendMessage(_("currentWorld", coords.getWorld().getName())); sender.sendMessage(_("currentWorld", coords.getWorld().getName()));
sender.sendMessage(_("posX", coords.getBlockX())); sender.sendMessage(_("posX", coords.getBlockX()));

View File

@ -1,5 +1,6 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.MetaItemStack; import com.earth2me.essentials.MetaItemStack;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
@ -9,8 +10,6 @@ import java.util.Locale;
import java.util.Map; import java.util.Map;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -22,7 +21,7 @@ public class Commandgive extends EssentialsCommand
} }
@Override @Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
if (args.length < 2) if (args.length < 2)
{ {
@ -32,13 +31,13 @@ public class Commandgive extends EssentialsCommand
ItemStack stack = ess.getItemDb().get(args[1]); ItemStack stack = ess.getItemDb().get(args[1]);
final String itemname = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""); final String itemname = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", "");
if (sender instanceof Player if (sender.isPlayer()
&& (ess.getSettings().permissionBasedItemSpawn() && (ess.getSettings().permissionBasedItemSpawn()
? (!ess.getUser(sender).isAuthorized("essentials.itemspawn.item-all") ? (!ess.getUser(sender.getPlayer()).isAuthorized("essentials.itemspawn.item-all")
&& !ess.getUser(sender).isAuthorized("essentials.itemspawn.item-" + itemname) && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.itemspawn.item-" + itemname)
&& !ess.getUser(sender).isAuthorized("essentials.itemspawn.item-" + stack.getTypeId())) && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.itemspawn.item-" + stack.getTypeId()))
: (!ess.getUser(sender).isAuthorized("essentials.itemspawn.exempt") : (!ess.getUser(sender.getPlayer()).isAuthorized("essentials.itemspawn.exempt")
&& !ess.getUser(sender).canSpawnItem(stack.getTypeId())))) && !ess.getUser(sender.getPlayer()).canSpawnItem(stack.getTypeId()))))
{ {
throw new Exception(_("cantSpawnItem", itemname)); throw new Exception(_("cantSpawnItem", itemname));
} }
@ -74,7 +73,7 @@ public class Commandgive extends EssentialsCommand
{ {
MetaItemStack metaStack = new MetaItemStack(stack); MetaItemStack metaStack = new MetaItemStack(stack);
boolean allowUnsafe = ess.getSettings().allowUnsafeEnchantments(); boolean allowUnsafe = ess.getSettings().allowUnsafeEnchantments();
if (allowUnsafe && sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.enchantments.allowunsafe")) if (allowUnsafe && sender.isPlayer() && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.enchantments.allowunsafe"))
{ {
allowUnsafe = false; allowUnsafe = false;
} }

View File

@ -1,11 +1,10 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import net.ess3.api.events.GodStatusChangeEvent; import net.ess3.api.events.GodStatusChangeEvent;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Commandgod extends EssentialsToggleCommand public class Commandgod extends EssentialsToggleCommand
@ -16,7 +15,7 @@ public class Commandgod extends EssentialsToggleCommand
} }
@Override @Override
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
toggleOtherPlayers(server, sender, args); toggleOtherPlayers(server, sender, args);
} }
@ -29,32 +28,32 @@ public class Commandgod extends EssentialsToggleCommand
Boolean toggle = matchToggleArgument(args[0]); Boolean toggle = matchToggleArgument(args[0]);
if (toggle == null && user.isAuthorized(othersPermission)) if (toggle == null && user.isAuthorized(othersPermission))
{ {
toggleOtherPlayers(server, user.getBase(), args); toggleOtherPlayers(server, user.getSource(), args);
} }
else else
{ {
togglePlayer(user.getBase(), user, toggle); togglePlayer(user.getSource(), user, toggle);
} }
} }
else if (args.length == 2 && user.isAuthorized(othersPermission)) else if (args.length == 2 && user.isAuthorized(othersPermission))
{ {
toggleOtherPlayers(server, user.getBase(), args); toggleOtherPlayers(server, user.getSource(), args);
} }
else else
{ {
togglePlayer(user.getBase(), user, null); togglePlayer(user.getSource(), user, null);
} }
} }
@Override @Override
void togglePlayer(CommandSender sender, User user, Boolean enabled) void togglePlayer(CommandSource sender, User user, Boolean enabled)
{ {
if (enabled == null) if (enabled == null)
{ {
enabled = !user.isGodModeEnabled(); enabled = !user.isGodModeEnabled();
} }
final User controller = sender instanceof Player ? ess.getUser(sender) : null; final User controller = sender.isPlayer() ? ess.getUser(sender.getPlayer()) : null;
final GodStatusChangeEvent godEvent = new GodStatusChangeEvent(controller, user, enabled); final GodStatusChangeEvent godEvent = new GodStatusChangeEvent(controller, user, enabled);
ess.getServer().getPluginManager().callEvent(godEvent); ess.getServer().getPluginManager().callEvent(godEvent);
if (!godEvent.isCancelled()) if (!godEvent.isCancelled())

View File

@ -1,9 +1,9 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityRegainHealthEvent; import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
@ -27,7 +27,7 @@ public class Commandheal extends EssentialsLoopCommand
if (args.length > 0 && user.isAuthorized("essentials.heal.others")) if (args.length > 0 && user.isAuthorized("essentials.heal.others"))
{ {
loopOnlinePlayers(server, user.getBase(), true, args[0], null); loopOnlinePlayers(server, user.getSource(), true, args[0], null);
return; return;
} }
@ -35,7 +35,7 @@ public class Commandheal extends EssentialsLoopCommand
} }
@Override @Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
if (args.length < 1) if (args.length < 1)
{ {
@ -46,7 +46,7 @@ public class Commandheal extends EssentialsLoopCommand
} }
@Override @Override
protected void updatePlayer(final Server server, final CommandSender sender, final User player, final String[] args) throws PlayerExemptException protected void updatePlayer(final Server server, final CommandSource sender, final User player, final String[] args) throws PlayerExemptException
{ {
try try
{ {

View File

@ -1,12 +1,12 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import com.earth2me.essentials.textreader.*; import com.earth2me.essentials.textreader.*;
import com.earth2me.essentials.utils.NumberUtil; import com.earth2me.essentials.utils.NumberUtil;
import java.util.Locale; import java.util.Locale;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandhelp extends EssentialsCommand public class Commandhelp extends EssentialsCommand
@ -23,7 +23,7 @@ public class Commandhelp extends EssentialsCommand
String pageStr = args.length > 0 ? args[0] : null; String pageStr = args.length > 0 ? args[0] : null;
String chapterPageStr = args.length > 1 ? args[1] : null; String chapterPageStr = args.length > 1 ? args[1] : null;
String command = commandLabel; String command = commandLabel;
final IText input = new TextInput(user.getBase(), "help", false, ess); final IText input = new TextInput(user.getSource(), "help", false, ess);
if (input.getLines().isEmpty()) if (input.getLines().isEmpty())
{ {
@ -45,14 +45,14 @@ public class Commandhelp extends EssentialsCommand
} }
else else
{ {
output = new KeywordReplacer(input, user.getBase(), ess); output = new KeywordReplacer(input, user.getSource(), ess);
} }
final TextPager pager = new TextPager(output); final TextPager pager = new TextPager(output);
pager.showPage(pageStr, chapterPageStr, command, user.getBase()); pager.showPage(pageStr, chapterPageStr, command, user.getSource());
} }
@Override @Override
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
sender.sendMessage(_("helpConsole")); sender.sendMessage(_("helpConsole"));
} }

View File

@ -1,5 +1,6 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import com.earth2me.essentials.Console; import com.earth2me.essentials.Console;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
@ -20,16 +21,16 @@ public class Commandhelpop extends EssentialsCommand
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{ {
user.setDisplayNick(); user.setDisplayNick();
sendMessage(server, user.getBase(), user.getDisplayName(), args); sendMessage(server, user.getSource(), user.getDisplayName(), args);
} }
@Override @Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
sendMessage(server, sender, Console.NAME, args); sendMessage(server, sender, Console.NAME, args);
} }
private void sendMessage(final Server server, final CommandSender sender, final String from, final String[] args) throws Exception private void sendMessage(final Server server, final CommandSource sender, final String from, final String[] args) throws Exception
{ {
if (args.length < 1) if (args.length < 1)
{ {

View File

@ -1,11 +1,11 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import com.earth2me.essentials.textreader.IText; import com.earth2me.essentials.textreader.IText;
import com.earth2me.essentials.textreader.KeywordReplacer; import com.earth2me.essentials.textreader.KeywordReplacer;
import com.earth2me.essentials.textreader.TextInput; import com.earth2me.essentials.textreader.TextInput;
import com.earth2me.essentials.textreader.TextPager; import com.earth2me.essentials.textreader.TextPager;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandinfo extends EssentialsCommand public class Commandinfo extends EssentialsCommand
@ -16,7 +16,7 @@ public class Commandinfo extends EssentialsCommand
} }
@Override @Override
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
final IText input = new TextInput(sender, "info", true, ess); final IText input = new TextInput(sender, "info", true, ess);
final IText output = new KeywordReplacer(input, sender, ess); final IText output = new KeywordReplacer(input, sender, ess);

View File

@ -60,7 +60,7 @@ public class Commanditem extends EssentialsCommand
MetaItemStack metaStack = new MetaItemStack(stack); MetaItemStack metaStack = new MetaItemStack(stack);
final boolean allowUnsafe = ess.getSettings().allowUnsafeEnchantments() && user.isAuthorized("essentials.enchantments.allowunsafe"); final boolean allowUnsafe = ess.getSettings().allowUnsafeEnchantments() && user.isAuthorized("essentials.enchantments.allowunsafe");
metaStack.parseStringMeta(user.getBase(), allowUnsafe, args, 2, ess); metaStack.parseStringMeta(user.getSource(), allowUnsafe, args, 2, ess);
stack = metaStack.getItemStack(); stack = metaStack.getItemStack();
} }

View File

@ -1,9 +1,9 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -16,13 +16,13 @@ public class Commanditemdb extends EssentialsCommand
} }
@Override @Override
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception protected void run(Server server, CommandSource sender, String commandLabel, String[] args) throws Exception
{ {
ItemStack itemStack = null; ItemStack itemStack = null;
boolean itemHeld = false; boolean itemHeld = false;
if (args.length < 1) if (args.length < 1)
{ {
if (sender instanceof Player) if (sender.isPlayer())
{ {
itemHeld = true; itemHeld = true;
itemStack = ((Player)sender).getItemInHand(); itemStack = ((Player)sender).getItemInHand();

View File

@ -1,8 +1,8 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import com.earth2me.essentials.utils.StringUtil; import com.earth2me.essentials.utils.StringUtil;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandjails extends EssentialsCommand public class Commandjails extends EssentialsCommand
@ -13,7 +13,7 @@ public class Commandjails extends EssentialsCommand
} }
@Override @Override
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
sender.sendMessage("§7" + StringUtil.joinList(" ", ess.getJails().getList())); sender.sendMessage("§7" + StringUtil.joinList(" ", ess.getJails().getList()));
} }

View File

@ -1,13 +1,12 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import com.earth2me.essentials.Console; import com.earth2me.essentials.Console;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import com.earth2me.essentials.utils.FormatUtil; import com.earth2me.essentials.utils.FormatUtil;
import java.util.logging.Level; import java.util.logging.Level;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Commandkick extends EssentialsCommand public class Commandkick extends EssentialsCommand
@ -18,7 +17,7 @@ public class Commandkick extends EssentialsCommand
} }
@Override @Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
if (args.length < 1) if (args.length < 1)
{ {
@ -26,9 +25,9 @@ public class Commandkick extends EssentialsCommand
} }
final User target = getPlayer(server, args, 0, true, false); final User target = getPlayer(server, args, 0, true, false);
if (sender instanceof Player) if (sender.isPlayer())
{ {
User user = ess.getUser(sender); User user = ess.getUser(sender.getPlayer());
if (target.isHidden() && !user.isAuthorized("essentials.vanish.interact")) if (target.isHidden() && !user.isAuthorized("essentials.vanish.interact"))
{ {
throw new PlayerNotFoundException(); throw new PlayerNotFoundException();
@ -44,7 +43,7 @@ public class Commandkick extends EssentialsCommand
kickReason = FormatUtil.replaceFormat(kickReason.replace("\\n", "\n").replace("|", "\n")); kickReason = FormatUtil.replaceFormat(kickReason.replace("\\n", "\n").replace("|", "\n"));
target.kickPlayer(kickReason); target.kickPlayer(kickReason);
final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME; final String senderName = sender.isPlayer() ? sender.getPlayer().getDisplayName() : Console.NAME;
server.getLogger().log(Level.INFO, _("playerKicked", senderName, target.getName(), kickReason)); server.getLogger().log(Level.INFO, _("playerKicked", senderName, target.getName(), kickReason));
ess.broadcastMessage("essentials.kick.notify", _("playerKicked", senderName, target.getName(), kickReason)); ess.broadcastMessage("essentials.kick.notify", _("playerKicked", senderName, target.getName(), kickReason));

View File

@ -1,9 +1,9 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.utils.FormatUtil; import com.earth2me.essentials.utils.FormatUtil;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -15,14 +15,14 @@ public class Commandkickall extends EssentialsCommand
} }
@Override @Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
String kickReason = args.length > 0 ? getFinalArg(args, 0) : _("kickDefault"); String kickReason = args.length > 0 ? getFinalArg(args, 0) : _("kickDefault");
kickReason = FormatUtil.replaceFormat(kickReason.replace("\\n", "\n").replace("|", "\n")); kickReason = FormatUtil.replaceFormat(kickReason.replace("\\n", "\n").replace("|", "\n"));
for (Player onlinePlayer : server.getOnlinePlayers()) for (Player onlinePlayer : server.getOnlinePlayers())
{ {
if (sender instanceof Player && onlinePlayer.getName().equalsIgnoreCase(((Player)sender).getName())) if (sender.isPlayer() && onlinePlayer.getName().equalsIgnoreCase(((Player)sender).getName()))
{ {
continue; continue;
} }

View File

@ -1,9 +1,9 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
@ -16,7 +16,7 @@ public class Commandkill extends EssentialsLoopCommand
} }
@Override @Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
if (args.length < 1) if (args.length < 1)
{ {
@ -27,16 +27,16 @@ public class Commandkill extends EssentialsLoopCommand
} }
@Override @Override
protected void updatePlayer(final Server server, final CommandSender sender, final User user, final String[] args) throws PlayerExemptException protected void updatePlayer(final Server server, final CommandSource sender, final User user, final String[] args) throws PlayerExemptException
{ {
final Player matchPlayer = user.getBase(); final Player matchPlayer = user.getBase();
if (sender instanceof Player && user.isAuthorized("essentials.kill.exempt") && !ess.getUser(sender).isAuthorized("essentials.kill.force")) if (sender.isPlayer() && user.isAuthorized("essentials.kill.exempt") && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.kill.force"))
{ {
throw new PlayerExemptException(_("killExempt", matchPlayer.getDisplayName())); throw new PlayerExemptException(_("killExempt", matchPlayer.getDisplayName()));
} }
final EntityDamageEvent ede = new EntityDamageEvent(matchPlayer, sender instanceof Player && ((Player)sender).getName().equals(matchPlayer.getName()) ? EntityDamageEvent.DamageCause.SUICIDE : EntityDamageEvent.DamageCause.CUSTOM, Short.MAX_VALUE); final EntityDamageEvent ede = new EntityDamageEvent(matchPlayer, sender instanceof Player && ((Player)sender).getName().equals(matchPlayer.getName()) ? EntityDamageEvent.DamageCause.SUICIDE : EntityDamageEvent.DamageCause.CUSTOM, Short.MAX_VALUE);
server.getPluginManager().callEvent(ede); server.getPluginManager().callEvent(ede);
if (ede.isCancelled() && sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.kill.force")) if (ede.isCancelled() && sender.isPlayer() && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.kill.force"))
{ {
return; return;
} }

View File

@ -1,5 +1,6 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.Mob; import com.earth2me.essentials.Mob;
import java.util.ArrayList; import java.util.ArrayList;
@ -7,7 +8,6 @@ import java.util.Locale;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.*; import org.bukkit.entity.*;
import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -22,12 +22,12 @@ public class Commandkillall extends EssentialsCommand
//TODO: Tidy - missed this during command cleanup //TODO: Tidy - missed this during command cleanup
@Override @Override
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception public void run(Server server, CommandSource sender, String commandLabel, String[] args) throws Exception
{ {
String type = "all"; String type = "all";
int radius = -1; int radius = -1;
World world; World world;
if (sender instanceof Player) if (sender.isPlayer())
{ {
world = ((Player)sender).getWorld(); world = ((Player)sender).getWorld();
if (args.length == 1) if (args.length == 1)
@ -96,7 +96,7 @@ public class Commandkillall extends EssentialsCommand
{ {
for (Entity entity : chunk.getEntities()) for (Entity entity : chunk.getEntities())
{ {
if (sender instanceof Player) if (sender.isPlayer())
{ {
if (radius >= 0 && ((Player)sender).getLocation().distanceSquared(entity.getLocation()) > radius) if (radius >= 0 && ((Player)sender).getLocation().distanceSquared(entity.getLocation()) > radius)
{ {

View File

@ -1,5 +1,6 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.Kit; import com.earth2me.essentials.Kit;
import com.earth2me.essentials.Trade; import com.earth2me.essentials.Trade;
@ -9,7 +10,6 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandkit extends EssentialsCommand public class Commandkit extends EssentialsCommand
@ -42,7 +42,7 @@ public class Commandkit extends EssentialsCommand
} }
@Override @Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
if (args.length < 2) if (args.length < 2)
{ {

View File

@ -1,9 +1,9 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.LightningStrike; import org.bukkit.entity.LightningStrike;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -18,10 +18,10 @@ public class Commandlightning extends EssentialsLoopCommand
} }
@Override @Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
User user = null; User user = null;
if (sender instanceof Player) if (sender.isPlayer())
{ {
user = ess.getUser(((Player)sender)); user = ess.getUser(((Player)sender));
if ((args.length < 1 || user != null && !user.isAuthorized("essentials.lightning.others"))) if ((args.length < 1 || user != null && !user.isAuthorized("essentials.lightning.others")))
@ -45,7 +45,7 @@ public class Commandlightning extends EssentialsLoopCommand
} }
@Override @Override
protected void updatePlayer(final Server server, final CommandSender sender, final User matchUser, final String[] args) protected void updatePlayer(final Server server, final CommandSource sender, final User matchUser, final String[] args)
{ {
sender.sendMessage(_("lightningUse", matchUser.getDisplayName())); sender.sendMessage(_("lightningUse", matchUser.getDisplayName()));
final LightningStrike strike = matchUser.getBase().getWorld().strikeLightningEffect(matchUser.getBase().getLocation()); final LightningStrike strike = matchUser.getBase().getWorld().strikeLightningEffect(matchUser.getBase().getLocation());

View File

@ -1,5 +1,6 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.PlayerList; import com.earth2me.essentials.PlayerList;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
@ -7,8 +8,6 @@ import com.earth2me.essentials.utils.FormatUtil;
import com.earth2me.essentials.utils.NumberUtil; import com.earth2me.essentials.utils.NumberUtil;
import java.util.*; import java.util.*;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Commandlist extends EssentialsCommand public class Commandlist extends EssentialsCommand
@ -19,12 +18,12 @@ public class Commandlist extends EssentialsCommand
} }
@Override @Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
boolean showHidden = true; boolean showHidden = true;
if (sender instanceof Player) if (sender.isPlayer())
{ {
showHidden = ess.getUser(sender).isAuthorized("essentials.list.hidden") || ess.getUser(sender).isAuthorized("essentials.vanish.interact"); showHidden = ess.getUser(sender.getPlayer()).isAuthorized("essentials.list.hidden") || ess.getUser(sender.getPlayer()).isAuthorized("essentials.vanish.interact");
} }
sender.sendMessage(PlayerList.listSummary(ess, showHidden)); sender.sendMessage(PlayerList.listSummary(ess, showHidden));
final Map<String, List<User>> playerList = PlayerList.getPlayerLists(ess, showHidden); final Map<String, List<User>> playerList = PlayerList.getPlayerLists(ess, showHidden);
@ -40,7 +39,7 @@ public class Commandlist extends EssentialsCommand
} }
// Output the standard /list output, when no group is specified // Output the standard /list output, when no group is specified
private void sendGroupedList(CommandSender sender, String commandLabel, Map<String, List<User>> playerList) private void sendGroupedList(CommandSource sender, String commandLabel, Map<String, List<User>> playerList)
{ {
final Set<String> configGroups = ess.getSettings().getListGroupConfig().keySet(); final Set<String> configGroups = ess.getSettings().getListGroupConfig().keySet();
final List<String> asterisk = new ArrayList<String>(); final List<String> asterisk = new ArrayList<String>();

View File

@ -1,12 +1,12 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import com.earth2me.essentials.utils.FormatUtil; import com.earth2me.essentials.utils.FormatUtil;
import com.earth2me.essentials.utils.StringUtil; import com.earth2me.essentials.utils.StringUtil;
import java.util.List; import java.util.List;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandmail extends EssentialsCommand public class Commandmail extends EssentialsCommand
@ -97,7 +97,7 @@ public class Commandmail extends EssentialsCommand
} }
@Override @Override
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception protected void run(Server server, CommandSource sender, String commandLabel, String[] args) throws Exception
{ {
if (args.length >= 1 && "read".equalsIgnoreCase(args[0])) if (args.length >= 1 && "read".equalsIgnoreCase(args[0]))
{ {

View File

@ -1,10 +1,10 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import com.earth2me.essentials.utils.FormatUtil; import com.earth2me.essentials.utils.FormatUtil;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandme extends EssentialsCommand public class Commandme extends EssentialsCommand
@ -35,7 +35,7 @@ public class Commandme extends EssentialsCommand
} }
@Override @Override
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception public void run(Server server, CommandSource sender, String commandLabel, String[] args) throws Exception
{ {
if (args.length < 1) if (args.length < 1)
{ {

View File

@ -1,11 +1,11 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import com.earth2me.essentials.textreader.IText; import com.earth2me.essentials.textreader.IText;
import com.earth2me.essentials.textreader.KeywordReplacer; import com.earth2me.essentials.textreader.KeywordReplacer;
import com.earth2me.essentials.textreader.TextInput; import com.earth2me.essentials.textreader.TextInput;
import com.earth2me.essentials.textreader.TextPager; import com.earth2me.essentials.textreader.TextPager;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandmotd extends EssentialsCommand public class Commandmotd extends EssentialsCommand
@ -16,7 +16,7 @@ public class Commandmotd extends EssentialsCommand
} }
@Override @Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
final IText input = new TextInput(sender, "motd", true, ess); final IText input = new TextInput(sender, "motd", true, ess);
final IText output = new KeywordReplacer(input, sender, ess); final IText output = new KeywordReplacer(input, sender, ess);

View File

@ -1,5 +1,6 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import com.earth2me.essentials.Console; import com.earth2me.essentials.Console;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IReplyTo; import com.earth2me.essentials.IReplyTo;
@ -8,7 +9,6 @@ import static com.earth2me.essentials.commands.EssentialsCommand.getFinalArg;
import com.earth2me.essentials.utils.FormatUtil; import com.earth2me.essentials.utils.FormatUtil;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Commandmsg extends EssentialsLoopCommand public class Commandmsg extends EssentialsLoopCommand
@ -21,7 +21,7 @@ public class Commandmsg extends EssentialsLoopCommand
} }
@Override @Override
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception public void run(Server server, CommandSource sender, String commandLabel, String[] args) throws Exception
{ {
if (args.length < 2 || args[0].trim().length() < 2 || args[1].trim().isEmpty()) if (args.length < 2 || args[0].trim().length() < 2 || args[1].trim().isEmpty())
{ {
@ -29,9 +29,9 @@ public class Commandmsg extends EssentialsLoopCommand
} }
String message = getFinalArg(args, 1); String message = getFinalArg(args, 1);
if (sender instanceof Player) if (sender.isPlayer())
{ {
User user = ess.getUser(sender); User user = ess.getUser(sender.getPlayer());
if (user.isMuted()) if (user.isMuted())
{ {
throw new Exception(_("voiceSilenced")); throw new Exception(_("voiceSilenced"));
@ -45,13 +45,13 @@ public class Commandmsg extends EssentialsLoopCommand
if (args[0].equalsIgnoreCase(Console.NAME)) if (args[0].equalsIgnoreCase(Console.NAME))
{ {
final IReplyTo replyTo = sender instanceof Player ? ess.getUser(sender) : Console.getConsoleReplyTo(); final IReplyTo replyTo = sender.isPlayer() ? ess.getUser(sender.getPlayer()) : Console.getConsoleReplyTo();
final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME; final String senderName = sender.isPlayer() ? sender.getPlayer().getDisplayName() : Console.NAME;
sender.sendMessage(_("msgFormat", translatedMe, Console.NAME, message)); sender.sendMessage(_("msgFormat", translatedMe, Console.NAME, message));
CommandSender cs = Console.getCommandSender(server); CommandSender cs = Console.getCommandSender(server);
cs.sendMessage(_("msgFormat", senderName, translatedMe, message)); cs.sendMessage(_("msgFormat", senderName, translatedMe, message));
replyTo.setReplyTo(cs); replyTo.setReplyTo(new CommandSource(cs));
Console.getConsoleReplyTo().setReplyTo(sender); Console.getConsoleReplyTo().setReplyTo(sender);
return; return;
} }
@ -60,10 +60,10 @@ public class Commandmsg extends EssentialsLoopCommand
} }
@Override @Override
protected void updatePlayer(final Server server, final CommandSender sender, final User matchedUser, final String[] args) protected void updatePlayer(final Server server, final CommandSource sender, final User matchedUser, final String[] args)
{ {
final IReplyTo replyTo = sender instanceof Player ? ess.getUser(sender) : Console.getConsoleReplyTo(); final IReplyTo replyTo = sender.isPlayer() ? ess.getUser(sender.getPlayer()) : Console.getConsoleReplyTo();
final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME; final String senderName = sender.isPlayer() ? sender.getPlayer().getDisplayName() : Console.NAME;
if (matchedUser.isAfk()) if (matchedUser.isAfk())
{ {
@ -71,13 +71,13 @@ public class Commandmsg extends EssentialsLoopCommand
} }
sender.sendMessage(_("msgFormat", translatedMe, matchedUser.getDisplayName(), args[0])); sender.sendMessage(_("msgFormat", translatedMe, matchedUser.getDisplayName(), args[0]));
if (sender instanceof Player && matchedUser.isIgnoredPlayer(ess.getUser(sender))) if (sender.isPlayer() && matchedUser.isIgnoredPlayer(ess.getUser(sender.getPlayer())))
{ {
return; return;
} }
matchedUser.sendMessage(_("msgFormat", senderName, translatedMe, args[0])); matchedUser.sendMessage(_("msgFormat", senderName, translatedMe, args[0]));
replyTo.setReplyTo(matchedUser.getBase()); replyTo.setReplyTo(matchedUser.getSource());
matchedUser.setReplyTo(sender); matchedUser.setReplyTo(sender);
} }
} }

View File

@ -1,11 +1,11 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.OfflinePlayer; import com.earth2me.essentials.OfflinePlayer;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import com.earth2me.essentials.utils.DateUtil; import com.earth2me.essentials.utils.DateUtil;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -17,7 +17,7 @@ public class Commandmute extends EssentialsCommand
} }
@Override @Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
boolean nomatch = false; boolean nomatch = false;
if (args.length < 1) if (args.length < 1)
@ -36,8 +36,7 @@ public class Commandmute extends EssentialsCommand
} }
if (!user.isOnline()) if (!user.isOnline())
{ {
if (sender instanceof Player if (sender.isPlayer() && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.mute.offline"))
&& !ess.getUser(sender).isAuthorized("essentials.mute.offline"))
{ {
throw new Exception(_("muteExempt")); throw new Exception(_("muteExempt"));
} }
@ -83,7 +82,7 @@ public class Commandmute extends EssentialsCommand
sender.sendMessage(_("mutedPlayer", user.getDisplayName())); sender.sendMessage(_("mutedPlayer", user.getDisplayName()));
user.sendMessage(_("playerMuted")); user.sendMessage(_("playerMuted"));
} }
ess.broadcastMessage("essentials.mute.notify", _("muteNotify", sender.getName(), user.getName(), muteTime)); ess.broadcastMessage("essentials.mute.notify", _("muteNotify", sender.getSender().getName(), user.getName(), muteTime));
} }
else else
{ {

View File

@ -1,11 +1,11 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -72,7 +72,7 @@ public class Commandnear extends EssentialsCommand
} }
@Override @Override
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
if (args.length == 0) if (args.length == 0)
{ {

View File

@ -1,12 +1,12 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import com.earth2me.essentials.utils.FormatUtil; import com.earth2me.essentials.utils.FormatUtil;
import java.util.Locale; import java.util.Locale;
import net.ess3.api.events.NickChangeEvent; import net.ess3.api.events.NickChangeEvent;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -32,18 +32,18 @@ public class Commandnick extends EssentialsLoopCommand
if (args.length > 1 && user.isAuthorized("essentials.nick.others")) if (args.length > 1 && user.isAuthorized("essentials.nick.others"))
{ {
final String[] nickname = formatNickname(user, args[1]).split(" "); final String[] nickname = formatNickname(user, args[1]).split(" ");
loopOfflinePlayers(server, user.getBase(), false, args[0], nickname); loopOfflinePlayers(server, user.getSource(), false, args[0], nickname);
user.sendMessage(_("nickChanged")); user.sendMessage(_("nickChanged"));
} }
else else
{ {
final String[] nickname = formatNickname(user, args[0]).split(" "); final String[] nickname = formatNickname(user, args[0]).split(" ");
updatePlayer(server, user.getBase(), user, nickname); updatePlayer(server, user.getSource(), user, nickname);
} }
} }
@Override @Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
if (args.length < 2) if (args.length < 2)
{ {
@ -59,7 +59,7 @@ public class Commandnick extends EssentialsLoopCommand
} }
@Override @Override
protected void updatePlayer(final Server server, final CommandSender sender, final User target, final String[] args) throws NotEnoughArgumentsException protected void updatePlayer(final Server server, final CommandSource sender, final User target, final String[] args) throws NotEnoughArgumentsException
{ {
final String nick = args[0]; final String nick = args[0];
if (target.getName().equalsIgnoreCase(nick)) if (target.getName().equalsIgnoreCase(nick))
@ -123,9 +123,9 @@ public class Commandnick extends EssentialsLoopCommand
return false; return false;
} }
private void setNickname(final Server server, final CommandSender sender, final User target, final String nickname) private void setNickname(final Server server, final CommandSource sender, final User target, final String nickname)
{ {
final User controller = sender instanceof Player ? ess.getUser(sender) : null; final User controller = sender.isPlayer() ? ess.getUser(sender.getPlayer()) : null;
final NickChangeEvent nickEvent = new NickChangeEvent(controller, target, nickname); final NickChangeEvent nickEvent = new NickChangeEvent(controller, target, nickname);
server.getPluginManager().callEvent(nickEvent); server.getPluginManager().callEvent(nickEvent);
if (!nickEvent.isCancelled()) if (!nickEvent.isCancelled())

View File

@ -1,5 +1,6 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -7,7 +8,6 @@ import java.util.List;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed; import org.bukkit.entity.TNTPrimed;
@ -20,7 +20,7 @@ public class Commandnuke extends EssentialsCommand
} }
@Override @Override
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws NoSuchFieldException, NotEnoughArgumentsException protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws NoSuchFieldException, NotEnoughArgumentsException
{ {
List<Player> targets; List<Player> targets;
if (args.length > 0) if (args.length > 0)

View File

@ -1,11 +1,11 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.ChargeException; import com.earth2me.essentials.ChargeException;
import com.earth2me.essentials.CommandSource;
import com.earth2me.essentials.Trade; import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import java.math.BigDecimal; import java.math.BigDecimal;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandpay extends EssentialsLoopCommand public class Commandpay extends EssentialsLoopCommand
@ -26,13 +26,13 @@ public class Commandpay extends EssentialsLoopCommand
} }
amount = new BigDecimal(args[1].replaceAll("[^0-9\\.]", "")); amount = new BigDecimal(args[1].replaceAll("[^0-9\\.]", ""));
loopOnlinePlayers(server, user.getBase(), false, args[0], args); loopOnlinePlayers(server, user.getSource(), false, args[0], args);
} }
@Override @Override
protected void updatePlayer(final Server server, final CommandSender sender, final User player, final String[] args) throws ChargeException protected void updatePlayer(final Server server, final CommandSource sender, final User player, final String[] args) throws ChargeException
{ {
User user = ess.getUser(sender); User user = ess.getUser(sender.getPlayer());
user.payUser(player, amount); user.payUser(player, amount);
Trade.log("Command", "Pay", "Player", user.getName(), new Trade(amount, ess), player.getName(), new Trade(amount, ess), user.getLocation(), ess); Trade.log("Command", "Pay", "Player", user.getName(), new Trade(amount, ess), player.getName(), new Trade(amount, ess), user.getLocation(), ess);
} }

View File

@ -1,9 +1,9 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.utils.FormatUtil; import com.earth2me.essentials.utils.FormatUtil;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
// This command can be used to echo messages to the users screen, mostly useless but also an #EasterEgg // This command can be used to echo messages to the users screen, mostly useless but also an #EasterEgg
public class Commandping extends EssentialsCommand public class Commandping extends EssentialsCommand
@ -14,7 +14,7 @@ public class Commandping extends EssentialsCommand
} }
@Override @Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
if (args.length < 1) if (args.length < 1)
{ {

View File

@ -69,7 +69,7 @@ public class Commandpotion extends EssentialsCommand
final MetaItemStack mStack = new MetaItemStack(stack); final MetaItemStack mStack = new MetaItemStack(stack);
for (String arg : args) for (String arg : args)
{ {
mStack.addPotionMeta(user.getBase(), true, arg, ess); mStack.addPotionMeta(user.getSource(), true, arg, ess);
} }
if (mStack.completePotion()) if (mStack.completePotion())
{ {

View File

@ -1,5 +1,6 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import com.earth2me.essentials.utils.StringUtil; import com.earth2me.essentials.utils.StringUtil;
@ -8,8 +9,6 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -25,11 +24,11 @@ public class Commandpowertool extends EssentialsCommand
{ {
final String command = getFinalArg(args, 0); final String command = getFinalArg(args, 0);
final ItemStack itemStack = user.getItemInHand(); final ItemStack itemStack = user.getItemInHand();
powertool(server, user.getBase(), user, commandLabel, itemStack, command); powertool(server, user.getSource(), user, commandLabel, itemStack, command);
} }
@Override @Override
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
if (args.length < 3) //running from console means inserting a player and item before the standard syntax if (args.length < 3) //running from console means inserting a player and item before the standard syntax
{ {
@ -42,7 +41,7 @@ public class Commandpowertool extends EssentialsCommand
powertool(server, sender, user, commandLabel, itemStack, command); powertool(server, sender, user, commandLabel, itemStack, command);
} }
protected void powertool(final Server server, final CommandSender sender, final User user, final String commandLabel, final ItemStack itemStack, String command) throws Exception protected void powertool(final Server server, final CommandSource sender, final User user, final String commandLabel, final ItemStack itemStack, String command) throws Exception
{ {
// check to see if this is a clear all command // check to see if this is a clear all command
if (command != null && command.equalsIgnoreCase("d:")) if (command != null && command.equalsIgnoreCase("d:"))
@ -88,7 +87,7 @@ public class Commandpowertool extends EssentialsCommand
{ {
if (command.startsWith("a:")) if (command.startsWith("a:"))
{ {
if (sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.powertool.append")) if (sender.isPlayer() && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.powertool.append"))
{ {
throw new Exception(_("noPerm", "essentials.powertool.append")); throw new Exception(_("noPerm", "essentials.powertool.append"));
} }

View File

@ -1,12 +1,12 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import com.earth2me.essentials.utils.DescParseTickFormat; import com.earth2me.essentials.utils.DescParseTickFormat;
import java.util.*; import java.util.*;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -28,7 +28,7 @@ public class Commandptime extends EssentialsCommand
} }
@Override @Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
// Which Players(s) / Users(s) are we interested in? // Which Players(s) / Users(s) are we interested in?
String userSelector = null; String userSelector = null;
@ -45,12 +45,15 @@ public class Commandptime extends EssentialsCommand
return; return;
} }
User user = ess.getUser(sender); if (sender.isPlayer())
if (user != null && (!users.contains(user) || users.size() > 1)&& !user.isAuthorized("essentials.ptime.others")) {
User user = ess.getUser(sender.getPlayer());
if (user != null && (!users.contains(user) || users.size() > 1) && !user.isAuthorized("essentials.ptime.others"))
{ {
user.sendMessage(_("pTimeOthersPermission")); user.sendMessage(_("pTimeOthersPermission"));
return; return;
} }
}
Long ticks; Long ticks;
// Parse the target time int ticks from args[0] // Parse the target time int ticks from args[0]
@ -89,7 +92,7 @@ public class Commandptime extends EssentialsCommand
/** /**
* Used to get the time and inform * Used to get the time and inform
*/ */
private void getUsersTime(final CommandSender sender, final Collection<User> users) private void getUsersTime(final CommandSource sender, final Collection<User> users)
{ {
if (users.size() > 1) if (users.size() > 1)
{ {
@ -120,7 +123,7 @@ public class Commandptime extends EssentialsCommand
/** /**
* Used to set the time and inform of the change * Used to set the time and inform of the change
*/ */
private void setUsersTime(final CommandSender sender, final Collection<User> users, final Long ticks, Boolean relative) private void setUsersTime(final CommandSource sender, final Collection<User> users, final Long ticks, Boolean relative)
{ {
// Update the time // Update the time
if (ticks == null) if (ticks == null)
@ -181,24 +184,24 @@ public class Commandptime extends EssentialsCommand
/** /**
* Used to parse an argument of the type "users(s) selector" * Used to parse an argument of the type "users(s) selector"
*/ */
private Set<User> getUsers(final Server server, final CommandSender sender, final String selector) throws Exception private Set<User> getUsers(final Server server, final CommandSource sender, final String selector) throws Exception
{ {
final Set<User> users = new TreeSet<User>(new UserNameComparator()); final Set<User> users = new TreeSet<User>(new UserNameComparator());
// If there is no selector we want the sender itself. Or all users if sender isn't a user. // If there is no selector we want the sender itself. Or all users if sender isn't a user.
if (selector == null) if (selector == null)
{ {
final User user = ess.getUser(sender); if (sender.isPlayer())
if (user == null) {
final User user = ess.getUser(sender.getPlayer());
users.add(user);
}
else
{ {
for (Player player : server.getOnlinePlayers()) for (Player player : server.getOnlinePlayers())
{ {
users.add(ess.getUser(player)); users.add(ess.getUser(player));
} }
} }
else
{
users.add(user);
}
return users; return users;
} }

View File

@ -1,11 +1,11 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import java.util.*; import java.util.*;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.WeatherType; import org.bukkit.WeatherType;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -32,7 +32,7 @@ public class Commandpweather extends EssentialsCommand
} }
@Override @Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
// Which Players(s) / Users(s) are we interested in? // Which Players(s) / Users(s) are we interested in?
String userSelector = null; String userSelector = null;
@ -54,12 +54,15 @@ public class Commandpweather extends EssentialsCommand
return; return;
} }
User user = ess.getUser(sender); if (sender.isPlayer())
{
User user = ess.getUser(sender.getPlayer());
if (user != null && (!users.contains(user) || users.size() > 1) && !user.isAuthorized("essentials.pweather.others")) if (user != null && (!users.contains(user) || users.size() > 1) && !user.isAuthorized("essentials.pweather.others"))
{ {
user.sendMessage(_("pWeatherOthersPermission")); user.sendMessage(_("pWeatherOthersPermission"));
return; return;
} }
}
setUsersWeather(sender, users, args[0].toLowerCase()); setUsersWeather(sender, users, args[0].toLowerCase());
} }
@ -67,7 +70,7 @@ public class Commandpweather extends EssentialsCommand
/** /**
* Used to get the time and inform * Used to get the time and inform
*/ */
private void getUsersWeather(final CommandSender sender, final Collection<User> users) private void getUsersWeather(final CommandSource sender, final Collection<User> users)
{ {
if (users.size() > 1) if (users.size() > 1)
{ {
@ -90,7 +93,7 @@ public class Commandpweather extends EssentialsCommand
/** /**
* Used to set the time and inform of the change * Used to set the time and inform of the change
*/ */
private void setUsersWeather(final CommandSender sender, final Collection<User> users, final String weatherType) throws Exception private void setUsersWeather(final CommandSource sender, final Collection<User> users, final String weatherType) throws Exception
{ {
final StringBuilder msg = new StringBuilder(); final StringBuilder msg = new StringBuilder();
@ -131,24 +134,24 @@ public class Commandpweather extends EssentialsCommand
/** /**
* Used to parse an argument of the type "users(s) selector" * Used to parse an argument of the type "users(s) selector"
*/ */
private Set<User> getUsers(final Server server, final CommandSender sender, final String selector) throws Exception private Set<User> getUsers(final Server server, final CommandSource sender, final String selector) throws Exception
{ {
final Set<User> users = new TreeSet<User>(new UserNameComparator()); final Set<User> users = new TreeSet<User>(new UserNameComparator());
// If there is no selector we want the sender itself. Or all users if sender isn't a user. // If there is no selector we want the sender itself. Or all users if sender isn't a user.
if (selector == null) if (selector == null)
{ {
final User user = ess.getUser(sender); if (sender.isPlayer())
if (user == null) {
final User user = ess.getUser(sender.getPlayer());
users.add(user);
}
else
{ {
for (Player player : server.getOnlinePlayers()) for (Player player : server.getOnlinePlayers())
{ {
users.add(ess.getUser(player)); users.add(ess.getUser(player));
} }
} }
else
{
users.add(user);
}
return users; return users;
} }

View File

@ -1,12 +1,12 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import com.earth2me.essentials.Console; import com.earth2me.essentials.Console;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IReplyTo; import com.earth2me.essentials.IReplyTo;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import com.earth2me.essentials.utils.FormatUtil; import com.earth2me.essentials.utils.FormatUtil;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -18,7 +18,7 @@ public class Commandr extends EssentialsCommand
} }
@Override @Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
if (args.length < 1) if (args.length < 1)
{ {
@ -29,9 +29,9 @@ public class Commandr extends EssentialsCommand
IReplyTo replyTo; IReplyTo replyTo;
String senderName; String senderName;
if (sender instanceof Player) if (sender.isPlayer())
{ {
User user = ess.getUser(sender); User user = ess.getUser(sender.getPlayer());
message = FormatUtil.formatMessage(user, "essentials.msg", message); message = FormatUtil.formatMessage(user, "essentials.msg", message);
replyTo = user; replyTo = user;
senderName = user.getDisplayName(); senderName = user.getDisplayName();
@ -43,7 +43,7 @@ public class Commandr extends EssentialsCommand
senderName = Console.NAME; senderName = Console.NAME;
} }
final CommandSender target = replyTo.getReplyTo(); final CommandSource target = replyTo.getReplyTo();
final String targetName = target instanceof Player ? ((Player)target).getDisplayName() : Console.NAME; final String targetName = target instanceof Player ? ((Player)target).getDisplayName() : Console.NAME;
if (target == null || ((target instanceof Player) && !((Player)target).isOnline())) if (target == null || ((target instanceof Player) && !((Player)target).isOnline()))
@ -52,10 +52,10 @@ public class Commandr extends EssentialsCommand
} }
sender.sendMessage(_("msgFormat", _("me"), targetName, message)); sender.sendMessage(_("msgFormat", _("me"), targetName, message));
if (target instanceof Player) if (target.isPlayer())
{ {
User player = ess.getUser(target); User player = ess.getUser(target.getPlayer());
if (sender instanceof Player && player.isIgnoredPlayer(ess.getUser(sender))) if (sender.isPlayer() && player.isIgnoredPlayer(ess.getUser(sender.getPlayer())))
{ {
return; return;
} }

View File

@ -1,11 +1,11 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import com.earth2me.essentials.utils.FormatUtil; import com.earth2me.essentials.utils.FormatUtil;
import java.util.Locale; import java.util.Locale;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -17,14 +17,14 @@ public class Commandrealname extends EssentialsCommand
} }
@Override @Override
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
if (args.length < 1) if (args.length < 1)
{ {
throw new NotEnoughArgumentsException(); throw new NotEnoughArgumentsException();
} }
final String whois = args[0].toLowerCase(Locale.ENGLISH); final String whois = args[0].toLowerCase(Locale.ENGLISH);
boolean skipHidden = sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.vanish.interact"); boolean skipHidden = sender.isPlayer() && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.vanish.interact");
boolean foundUser = false; boolean foundUser = false;
for (Player onlinePlayer : server.getOnlinePlayers()) for (Player onlinePlayer : server.getOnlinePlayers())
{ {

View File

@ -1,5 +1,6 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import com.earth2me.essentials.utils.NumberUtil; import com.earth2me.essentials.utils.NumberUtil;
@ -9,8 +10,6 @@ import java.util.Locale;
import java.util.Map; import java.util.Map;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.*; import org.bukkit.inventory.*;
@ -22,7 +21,7 @@ public class Commandrecipe extends EssentialsCommand
} }
@Override @Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
if (args.length < 1) if (args.length < 1)
{ {
@ -77,18 +76,18 @@ public class Commandrecipe extends EssentialsCommand
} }
} }
public void furnaceRecipe(final CommandSender sender, final FurnaceRecipe recipe) public void furnaceRecipe(final CommandSource sender, final FurnaceRecipe recipe)
{ {
sender.sendMessage(_("recipeFurnace", getMaterialName(recipe.getInput()))); sender.sendMessage(_("recipeFurnace", getMaterialName(recipe.getInput())));
} }
public void shapedRecipe(final CommandSender sender, final ShapedRecipe recipe) public void shapedRecipe(final CommandSource sender, final ShapedRecipe recipe)
{ {
final Map<Character, ItemStack> recipeMap = recipe.getIngredientMap(); final Map<Character, ItemStack> recipeMap = recipe.getIngredientMap();
if (sender instanceof Player) if (sender.isPlayer())
{ {
final User user = ess.getUser(sender); final User user = ess.getUser(sender.getPlayer());
user.closeInventory(); user.closeInventory();
user.setRecipeSee(true); user.setRecipeSee(true);
final InventoryView view = user.openWorkbench(null, true); final InventoryView view = user.openWorkbench(null, true);
@ -142,12 +141,12 @@ public class Commandrecipe extends EssentialsCommand
} }
} }
public void shapelessRecipe(final CommandSender sender, final ShapelessRecipe recipe) public void shapelessRecipe(final CommandSource sender, final ShapelessRecipe recipe)
{ {
final List<ItemStack> ingredients = recipe.getIngredientList(); final List<ItemStack> ingredients = recipe.getIngredientList();
if (sender instanceof Player) if (sender.isPlayer())
{ {
final User user = ess.getUser(sender); final User user = ess.getUser(sender.getPlayer());
user.setRecipeSee(true); user.setRecipeSee(true);
final InventoryView view = user.openWorkbench(null, true); final InventoryView view = user.openWorkbench(null, true);
for (int i = 0; i < ingredients.size(); i++) for (int i = 0; i < ingredients.size(); i++)

View File

@ -1,12 +1,12 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import java.util.Locale; import java.util.Locale;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.*; import org.bukkit.entity.*;
//Todo: Fix this up //Todo: Fix this up
@ -74,11 +74,11 @@ public class Commandremove extends EssentialsCommand
} }
} }
removeEntities(user.getBase(), world, toRemove, radius); removeEntities(user.getSource(), world, toRemove, radius);
} }
@Override @Override
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{ {
if (args.length < 2) if (args.length < 2)
{ {
@ -105,7 +105,7 @@ public class Commandremove extends EssentialsCommand
removeEntities(sender, world, toRemove, 0); removeEntities(sender, world, toRemove, 0);
} }
protected void removeEntities(final CommandSender sender, final World world, final ToRemove toRemove, int radius) throws Exception protected void removeEntities(final CommandSource sender, final World world, final ToRemove toRemove, int radius) throws Exception
{ {
int removed = 0; int removed = 0;
if (radius > 0) if (radius > 0)

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