diff options
145 files changed, 1847 insertions, 589 deletions
diff --git a/.gitignore b/.gitignore index 9251ca7e6..199130ecb 100644 --- a/.gitignore +++ b/.gitignore @@ -36,8 +36,6 @@ /EssentialsUpdate/build/
/WebPush/apikey.php
/WebPush/nbproject/private
-/.idea
-*.iml
/EssentialsGroupManager/bin
/EssentialsGroupManager/.externalToolBuilders
/EssentialsAntiBuild/nbproject/private/
diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 000000000..7fd826920 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +Essentials
\ No newline at end of file diff --git a/.idea/ant.xml b/.idea/ant.xml new file mode 100644 index 000000000..23e6fe04c --- /dev/null +++ b/.idea/ant.xml @@ -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> + diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 000000000..074eb5c80 --- /dev/null +++ b/.idea/compiler.xml @@ -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> + diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 000000000..3572571ad --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,5 @@ +<component name="CopyrightManager"> + <settings default=""> + <module2copyright /> + </settings> +</component>
\ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 000000000..77d25dd5b --- /dev/null +++ b/.idea/encodings.xml @@ -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> + diff --git a/.idea/libraries/Maven__com_iCo6_iConomy_6_0.xml b/.idea/libraries/Maven__com_iCo6_iConomy_6_0.xml new file mode 100644 index 000000000..e1c635d69 --- /dev/null +++ b/.idea/libraries/Maven__com_iCo6_iConomy_6_0.xml @@ -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>
\ No newline at end of file diff --git a/.idea/libraries/Maven__com_iConomy_iConomy_5_0.xml b/.idea/libraries/Maven__com_iConomy_iConomy_5_0.xml new file mode 100644 index 000000000..68a212375 --- /dev/null +++ b/.idea/libraries/Maven__com_iConomy_iConomy_5_0.xml @@ -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>
\ No newline at end of file diff --git a/.idea/libraries/Maven__commons_io_commons_io_2_4.xml b/.idea/libraries/Maven__commons_io_commons_io_2_4.xml new file mode 100644 index 000000000..bc2aad0ed --- /dev/null +++ b/.idea/libraries/Maven__commons_io_commons_io_2_4.xml @@ -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>
\ No newline at end of file diff --git a/.idea/libraries/Maven__cosine_BOSEconomy_0_7.xml b/.idea/libraries/Maven__cosine_BOSEconomy_0_7.xml new file mode 100644 index 000000000..8d8f8be1f --- /dev/null +++ b/.idea/libraries/Maven__cosine_BOSEconomy_0_7.xml @@ -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>
\ No newline at end of file diff --git a/.idea/libraries/Maven__jivesoftware_smack_3_1_0.xml b/.idea/libraries/Maven__jivesoftware_smack_3_1_0.xml new file mode 100644 index 000000000..8d0da5dbb --- /dev/null +++ b/.idea/libraries/Maven__jivesoftware_smack_3_1_0.xml @@ -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>
\ No newline at end of file diff --git a/.idea/libraries/Maven__junit_junit_4_10.xml b/.idea/libraries/Maven__junit_junit_4_10.xml new file mode 100644 index 000000000..ed8bf5fe7 --- /dev/null +++ b/.idea/libraries/Maven__junit_junit_4_10.xml @@ -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>
\ No newline at end of file diff --git a/.idea/libraries/Maven__me_ashtheking_MultiCurrency_0_05.xml b/.idea/libraries/Maven__me_ashtheking_MultiCurrency_0_05.xml new file mode 100644 index 000000000..61fbfb70f --- /dev/null +++ b/.idea/libraries/Maven__me_ashtheking_MultiCurrency_0_05.xml @@ -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>
\ No newline at end of file diff --git a/.idea/libraries/Maven__net_milkbowl_Vault_1_2.xml b/.idea/libraries/Maven__net_milkbowl_Vault_1_2.xml new file mode 100644 index 000000000..351770097 --- /dev/null +++ b/.idea/libraries/Maven__net_milkbowl_Vault_1_2.xml @@ -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>
\ No newline at end of file diff --git a/.idea/libraries/Maven__org_apache_commons_commons_compress_1_4_1.xml b/.idea/libraries/Maven__org_apache_commons_commons_compress_1_4_1.xml new file mode 100644 index 000000000..190209ed6 --- /dev/null +++ b/.idea/libraries/Maven__org_apache_commons_commons_compress_1_4_1.xml @@ -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>
\ No newline at end of file diff --git a/.idea/libraries/Maven__org_bukkit_bukkit_1_4_2_R0_3_SNAPSHOT.xml b/.idea/libraries/Maven__org_bukkit_bukkit_1_4_2_R0_3_SNAPSHOT.xml new file mode 100644 index 000000000..8ed2cfef1 --- /dev/null +++ b/.idea/libraries/Maven__org_bukkit_bukkit_1_4_2_R0_3_SNAPSHOT.xml @@ -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>
\ No newline at end of file diff --git a/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_1.xml b/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_1.xml new file mode 100644 index 000000000..acdf44300 --- /dev/null +++ b/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_1.xml @@ -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>
\ No newline at end of file diff --git a/.idea/libraries/Maven__org_mockito_mockito_core_1_9_5.xml b/.idea/libraries/Maven__org_mockito_mockito_core_1_9_5.xml new file mode 100644 index 000000000..5f7f780bf --- /dev/null +++ b/.idea/libraries/Maven__org_mockito_mockito_core_1_9_5.xml @@ -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>
\ No newline at end of file diff --git a/.idea/libraries/Maven__org_objenesis_objenesis_1_0.xml b/.idea/libraries/Maven__org_objenesis_objenesis_1_0.xml new file mode 100644 index 000000000..c79fa27d2 --- /dev/null +++ b/.idea/libraries/Maven__org_objenesis_objenesis_1_0.xml @@ -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>
\ No newline at end of file diff --git a/.idea/libraries/Maven__org_projectlombok_lombok_0_11_6.xml b/.idea/libraries/Maven__org_projectlombok_lombok_0_11_6.xml new file mode 100644 index 000000000..6b05a518b --- /dev/null +++ b/.idea/libraries/Maven__org_projectlombok_lombok_0_11_6.xml @@ -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>
\ No newline at end of file diff --git a/.idea/libraries/Maven__org_tukaani_xz_1_0.xml b/.idea/libraries/Maven__org_tukaani_xz_1_0.xml new file mode 100644 index 000000000..8b8042f39 --- /dev/null +++ b/.idea/libraries/Maven__org_tukaani_xz_1_0.xml @@ -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>
\ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 000000000..2d5ca7c0a --- /dev/null +++ b/.idea/misc.xml @@ -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> + diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 000000000..fc221b0a7 --- /dev/null +++ b/.idea/modules.xml @@ -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> + diff --git a/.idea/scopes/scope_settings.xml b/.idea/scopes/scope_settings.xml new file mode 100644 index 000000000..922003b84 --- /dev/null +++ b/.idea/scopes/scope_settings.xml @@ -0,0 +1,5 @@ +<component name="DependencyValidationManager"> + <state> + <option name="SKIP_IMPORT_STATEMENTS" value="false" /> + </state> +</component>
\ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 000000000..3b0002030 --- /dev/null +++ b/.idea/uiDesigner.xml @@ -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> + diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 000000000..9d32e507a --- /dev/null +++ b/.idea/vcs.xml @@ -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> + diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 000000000..8a2df0463 --- /dev/null +++ b/.idea/workspace.xml @@ -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="<template>" 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> + diff --git a/Essentials/Essentials.iml b/Essentials/Essentials.iml new file mode 100644 index 000000000..198129876 --- /dev/null +++ b/Essentials/Essentials.iml @@ -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> + diff --git a/Essentials/src/com/earth2me/essentials/CommandSource.java b/Essentials/src/com/earth2me/essentials/CommandSource.java new file mode 100644 index 000000000..689431a37 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/CommandSource.java @@ -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; + } +} diff --git a/Essentials/src/com/earth2me/essentials/Console.java b/Essentials/src/com/earth2me/essentials/Console.java index d07171c63..8596a585b 100644 --- a/Essentials/src/com/earth2me/essentials/Console.java +++ b/Essentials/src/com/earth2me/essentials/Console.java @@ -7,7 +7,7 @@ import org.bukkit.command.CommandSender; public final class Console implements IReplyTo { private static Console instance = new Console(); - private CommandSender replyTo; + private CommandSource replyTo; public final static String NAME = "Console"; private Console() @@ -20,13 +20,13 @@ public final class Console implements IReplyTo } @Override - public void setReplyTo(CommandSender user) + public void setReplyTo(CommandSource user) { replyTo = user; } @Override - public CommandSender getReplyTo() + public CommandSource getReplyTo() { return replyTo; } diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java index 665018a3f..373f201c3 100644 --- a/Essentials/src/com/earth2me/essentials/Essentials.java +++ b/Essentials/src/com/earth2me/essentials/Essentials.java @@ -374,7 +374,7 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials } @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 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); try { - return pc.execute(sender, commandLabel, args); + return pc.execute(cSender, commandLabel, args); } catch (final Exception 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; } } @@ -398,15 +398,16 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials try { + User user = 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(); } @@ -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[] { - sender.getName(), commandLabel, EssentialsCommand.getFinalArg(args, 0) + cSender.getName(), commandLabel, EssentialsCommand.getFinalArg(args, 0) }); } + CommandSource sender = new CommandSource(cSender); // New mail notification 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)) { - 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 - 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())); if (getSettings().isDebug()) @@ -608,18 +610,11 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials this.metrics = metrics; } + @Override - public User getUser(final Object base) - { - if (base instanceof Player) - { - return getUser((Player)base); - } - if (base instanceof String) - { - return getOfflineUser((String)base); - } - return null; + public User getUser(final String base) + { + return getOfflineUser((String)base); } @Override @@ -633,18 +628,14 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials return user; } - private <T extends Player> User getUser(final T base) + @Override + public User getUser(final Player base) { if (base == null) { return null; } - if (base instanceof User) - { - return (User)base; - } - if (userMap == null) { LOGGER.log(Level.WARNING, "Essentials userMap not initialized"); @@ -746,7 +737,7 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials { if (keywords) { - broadcast = new KeywordReplacer(broadcast, player, this, false); + broadcast = new KeywordReplacer(broadcast, new CommandSource(player), this, false); } for (String messageText : broadcast.getLines()) { diff --git a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java index a521cd927..883b310a9 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java @@ -35,7 +35,7 @@ public class EssentialsEntityListener implements Listener final Entity eDefend = event.getEntity(); if (eAttack instanceof Player) { - final User attacker = ess.getUser(eAttack); + final User attacker = ess.getUser((Player)eAttack); if (eDefend instanceof Player) { onPlayerVsPlayerDamage(event, (Player)eDefend, attacker); @@ -59,7 +59,7 @@ public class EssentialsEntityListener implements Listener Entity shooter = ((Projectile)event.getDamager()).getShooter(); if (shooter instanceof Player) { - final User attacker = ess.getUser(shooter); + final User attacker = ess.getUser((Player)shooter); onPlayerVsPlayerDamage(event, (Player)eDefend, attacker); attacker.updateActivity(true); } @@ -124,7 +124,7 @@ public class EssentialsEntityListener implements Listener @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) 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(); player.setFireTicks(0); @@ -136,7 +136,7 @@ public class EssentialsEntityListener implements Listener @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) 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); } @@ -173,7 +173,7 @@ public class EssentialsEntityListener implements Listener { 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.isGodModeEnabledRaw()) @@ -190,7 +190,7 @@ public class EssentialsEntityListener implements Listener public void onEntityRegainHealth(final EntityRegainHealthEvent event) { 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); } @@ -201,7 +201,7 @@ public class EssentialsEntityListener implements Listener { 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); } @@ -213,7 +213,7 @@ public class EssentialsEntityListener implements Listener { if (event.getEntity() instanceof Player) { - final User user = ess.getUser(event.getEntity()); + final User user = ess.getUser((Player)event.getEntity()); if (user.isAfk()) { user.updateActivity(true); diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java index 8040d42ae..fcf99355f 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java @@ -235,10 +235,10 @@ public class EssentialsPlayerListener implements Listener { try { - final IText input = new TextInput(user.getBase(), "motd", true, ess); - final IText output = new KeywordReplacer(input, user.getBase(), ess); + final IText input = new TextInput(user.getSource(), "motd", true, ess); + final IText output = new KeywordReplacer(input, user.getSource(), ess); final TextPager pager = new TextPager(output, true); - pager.showPage("1", null, "motd", user.getBase()); + pager.showPage("1", null, "motd", user.getSource()); } catch (IOException ex) { @@ -595,11 +595,11 @@ public class EssentialsPlayerListener implements Listener if (type == InventoryType.PLAYER) { - final User user = ess.getUser(event.getWhoClicked()); + final User user = ess.getUser((Player)event.getWhoClicked()); final InventoryHolder invHolder = top.getHolder(); 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") || invOwner.isAuthorized("essentials.invsee.preventmodify") || !invOwner.isOnline())) @@ -611,7 +611,7 @@ public class EssentialsPlayerListener implements Listener } 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"))) { event.setCancelled(true); @@ -619,7 +619,7 @@ public class EssentialsPlayerListener implements Listener } else if (type == InventoryType.WORKBENCH) { - User user = ess.getUser(event.getWhoClicked()); + User user = ess.getUser((Player)event.getWhoClicked()); if (user.isRecipeSee()) { event.setCancelled(true); @@ -627,7 +627,7 @@ public class EssentialsPlayerListener implements Listener } 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(); if (invHolder != null && invHolder instanceof HumanEntity && user.isInvSee()) { @@ -643,19 +643,19 @@ public class EssentialsPlayerListener implements Listener final InventoryType type = top.getType(); if (type == InventoryType.PLAYER) { - final User user = ess.getUser(event.getPlayer()); + final User user = ess.getUser((Player)event.getPlayer()); user.setInvSee(false); user.updateInventory(); } 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.updateInventory(); } else if (type == InventoryType.WORKBENCH) { - final User user = ess.getUser(event.getPlayer()); + final User user = ess.getUser((Player)event.getPlayer()); if (user.isRecipeSee()) { user.setRecipeSee(false); @@ -668,7 +668,7 @@ public class EssentialsPlayerListener implements Listener final InventoryHolder invHolder = top.getHolder(); 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.updateInventory(); } diff --git a/Essentials/src/com/earth2me/essentials/IEssentials.java b/Essentials/src/com/earth2me/essentials/IEssentials.java index 6c1ba3715..73b462939 100644 --- a/Essentials/src/com/earth2me/essentials/IEssentials.java +++ b/Essentials/src/com/earth2me/essentials/IEssentials.java @@ -10,6 +10,7 @@ import java.util.List; import org.bukkit.World; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; import org.bukkit.scheduler.BukkitScheduler; 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); - User getUser(Object base); + User getUser(String base); + + User getUser(Player base); I18n getI18n(); @@ -67,7 +70,7 @@ public interface IEssentials extends Plugin 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(); diff --git a/Essentials/src/com/earth2me/essentials/IReplyTo.java b/Essentials/src/com/earth2me/essentials/IReplyTo.java index 429fd7584..ee8e80b4c 100644 --- a/Essentials/src/com/earth2me/essentials/IReplyTo.java +++ b/Essentials/src/com/earth2me/essentials/IReplyTo.java @@ -1,18 +1,16 @@ package com.earth2me.essentials; -import org.bukkit.command.CommandSender; - public interface IReplyTo { /** * Sets the user to reply to * @param user */ - public void setReplyTo(CommandSender user); + public void setReplyTo(CommandSource user); /** * Gets the user the sender should reply to * @return */ - public CommandSender getReplyTo(); + public CommandSource getReplyTo(); } diff --git a/Essentials/src/com/earth2me/essentials/IUser.java b/Essentials/src/com/earth2me/essentials/IUser.java index fbd0e355d..cc5806022 100644 --- a/Essentials/src/com/earth2me/essentials/IUser.java +++ b/Essentials/src/com/earth2me/essentials/IUser.java @@ -7,7 +7,6 @@ import java.util.Map; import java.util.Set; import net.ess3.api.ITeleport; import org.bukkit.Location; -import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -23,13 +22,13 @@ public interface IUser 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 takeMoney(BigDecimal value); - void takeMoney(final BigDecimal value, final CommandSender initiator); + void takeMoney(final BigDecimal value, final CommandSource initiator); boolean canAfford(BigDecimal value); @@ -93,9 +92,8 @@ public interface IUser public void sendMessage(String message); /* - * UserData - */ - + * UserData + */ Location getHome(String name) throws Exception; Location getHome(Location loc) throws Exception; @@ -107,25 +105,25 @@ public interface IUser void delHome(String name) throws Exception; boolean hasHome(); - + Location getLastLocation(); - + Location getLogoutLocation(); - + long getLastTeleportTimestamp(); void setLastTeleportTimestamp(long time); - + String getJail(); void setJail(String jail); - + List<String> getMails(); - + void addMail(String mail); - + boolean isAfk(); - + void setConfigProperty(String node, Object object); Set<String> getConfigKeys(); @@ -133,12 +131,13 @@ public interface IUser Map<String, Object> getConfigMap(); Map<String, Object> getConfigMap(String node); - + /* * PlayerExtension */ - Player getBase(); + CommandSource getSource(); + public String getName(); } diff --git a/Essentials/src/com/earth2me/essentials/Jails.java b/Essentials/src/com/earth2me/essentials/Jails.java index 8acf04195..303de169c 100644 --- a/Essentials/src/com/earth2me/essentials/Jails.java +++ b/Essentials/src/com/earth2me/essentials/Jails.java @@ -12,6 +12,7 @@ import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; @@ -236,7 +237,7 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett final Entity damager = event.getDamager(); if (damager.getType() == EntityType.PLAYER) { - final User user = ess.getUser(damager); + final User user = ess.getUser((Player)damager); if (user != null && user.isJailed()) { event.setCancelled(true); diff --git a/Essentials/src/com/earth2me/essentials/Kit.java b/Essentials/src/com/earth2me/essentials/Kit.java index 22af34c85..21a948784 100644 --- a/Essentials/src/com/earth2me/essentials/Kit.java +++ b/Essentials/src/com/earth2me/essentials/Kit.java @@ -171,7 +171,7 @@ public class Kit try { IText input = new SimpleTextInput(items); - IText output = new KeywordReplacer(input, user.getBase(), ess); + IText output = new KeywordReplacer(input, user.getSource(), ess); boolean spew = false; final boolean allowUnsafe = ess.getSettings().allowUnsafeEnchantments(); diff --git a/Essentials/src/com/earth2me/essentials/MetaItemStack.java b/Essentials/src/com/earth2me/essentials/MetaItemStack.java index 49d0f287a..820591f03 100644 --- a/Essentials/src/com/earth2me/essentials/MetaItemStack.java +++ b/Essentials/src/com/earth2me/essentials/MetaItemStack.java @@ -13,7 +13,6 @@ import org.bukkit.Color; import org.bukkit.DyeColor; import org.bukkit.FireworkEffect; import org.bukkit.Material; -import org.bukkit.command.CommandSender; import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.*; @@ -95,7 +94,7 @@ public class MetaItemStack 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++) @@ -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); 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) { @@ -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) { @@ -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]); 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); } - 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) { @@ -496,9 +495,9 @@ public class MetaItemStack 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); } diff --git a/Essentials/src/com/earth2me/essentials/SpawnMob.java b/Essentials/src/com/earth2me/essentials/SpawnMob.java index 53b8703a6..b8447f2c5 100644 --- a/Essentials/src/com/earth2me/essentials/SpawnMob.java +++ b/Essentials/src/com/earth2me/essentials/SpawnMob.java @@ -14,7 +14,6 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Server; import org.bukkit.block.Block; -import org.bukkit.command.CommandSender; import org.bukkit.entity.*; import org.bukkit.inventory.EntityEquipment; import org.bukkit.inventory.ItemStack; @@ -91,17 +90,17 @@ public class SpawnMob { 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 - 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); } // 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); @@ -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; 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) { @@ -203,13 +202,13 @@ public class SpawnMob 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")); } } - 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; @@ -217,14 +216,15 @@ public class SpawnMob { sender.sendMessage(_("mobDataList", StringUtil.joinList(MobData.getValidHelp(spawned)))); } - + MobData newData = MobData.fromData(spawned, data); - while (newData != null) { + while (newData != null) + { newData.setData(spawned, target.getBase(), data); data = data.replace(newData.getMatched(), ""); newData = MobData.fromData(spawned, data); } - + if (spawned instanceof Zombie || type == EntityType.SKELETON) { if (inputData.contains("armor") || inputData.contains("armour")) diff --git a/Essentials/src/com/earth2me/essentials/TimedTeleport.java b/Essentials/src/com/earth2me/essentials/TimedTeleport.java index 15e5642f3..5287feaf1 100644 --- a/Essentials/src/com/earth2me/essentials/TimedTeleport.java +++ b/Essentials/src/com/earth2me/essentials/TimedTeleport.java @@ -114,7 +114,7 @@ public class TimedTeleport implements Runnable } catch (Throwable ex) { - ess.showError(teleportOwner.getBase(), ex, "teleport"); + ess.showError(teleportOwner.getSource(), ex, "teleport"); } } catch (Exception ex) diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java index ddc158c3f..c4e22fe86 100644 --- a/Essentials/src/com/earth2me/essentials/User.java +++ b/Essentials/src/com/earth2me/essentials/User.java @@ -14,7 +14,6 @@ import java.util.logging.Logger; import net.ess3.api.IEssentials; import org.bukkit.ChatColor; import org.bukkit.Location; -import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; 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 { - private CommandSender replyTo = null; + private CommandSource replyTo = null; private transient String teleportRequester; private transient boolean teleportRequestHere; private transient Location teleportLocation; @@ -137,7 +136,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es } @Override - public void giveMoney(final BigDecimal value, final CommandSender initiator) + public void giveMoney(final BigDecimal value, final CommandSource initiator) { if (value.signum() == 0) { @@ -178,7 +177,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es } @Override - public void takeMoney(final BigDecimal value, final CommandSender initiator) + public void takeMoney(final BigDecimal value, final CommandSource initiator) { if (value.signum() == 0) { @@ -799,13 +798,13 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es } @Override - public void setReplyTo(final CommandSender user) + public void setReplyTo(final CommandSource user) { replyTo = user; } @Override - public CommandSender getReplyTo() + public CommandSource getReplyTo() { return replyTo; } @@ -832,4 +831,9 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es { return this.getName().hashCode(); } + + public CommandSource getSource() + { + return new CommandSource(getBase()); + } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandafk.java b/Essentials/src/com/earth2me/essentials/commands/Commandafk.java index 6d9016a31..e14b02a80 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandafk.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandafk.java @@ -1,9 +1,9 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import org.bukkit.Server; -import org.bukkit.command.CommandSender; public class Commandafk extends EssentialsCommand @@ -28,7 +28,7 @@ public class Commandafk extends EssentialsCommand } @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) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbackup.java b/Essentials/src/com/earth2me/essentials/commands/Commandbackup.java index 38644c680..4da00e26e 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandbackup.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandbackup.java @@ -1,9 +1,9 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.Backup; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import org.bukkit.Server; -import org.bukkit.command.CommandSender; public class Commandbackup extends EssentialsCommand @@ -14,7 +14,7 @@ public class Commandbackup extends EssentialsCommand } @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(); if (backup == null) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbalance.java b/Essentials/src/com/earth2me/essentials/commands/Commandbalance.java index ce0d03437..09b661191 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandbalance.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandbalance.java @@ -1,11 +1,11 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import com.earth2me.essentials.utils.NumberUtil; import java.math.BigDecimal; import org.bukkit.Server; -import org.bukkit.command.CommandSender; public class Commandbalance extends EssentialsCommand @@ -16,7 +16,7 @@ public class Commandbalance extends EssentialsCommand } @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) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbalancetop.java b/Essentials/src/com/earth2me/essentials/commands/Commandbalancetop.java index 87063bdd8..64ba74c91 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandbalancetop.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandbalancetop.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import com.earth2me.essentials.textreader.SimpleTextInput; @@ -11,7 +12,6 @@ import java.util.*; import java.util.Map.Entry; import java.util.concurrent.locks.ReentrantReadWriteLock; import org.bukkit.Server; -import org.bukkit.command.CommandSender; //TODO: Remove op and replace with perm public class Commandbalancetop extends EssentialsCommand @@ -27,7 +27,7 @@ public class Commandbalancetop extends EssentialsCommand private static ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); @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; boolean force = false; @@ -39,7 +39,7 @@ public class Commandbalancetop extends EssentialsCommand } catch (NumberFormatException ex) { - if (args[0].equalsIgnoreCase("force") && sender.isOp()) + if (args[0].equalsIgnoreCase("force") && sender.getSender().isOp()) { 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(); cal.setTimeInMillis(cacheage); @@ -163,11 +163,11 @@ public class Commandbalancetop extends EssentialsCommand private class Viewer implements Runnable { - private final transient CommandSender sender; + private final transient CommandSource sender; private final transient int page; 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.page = page; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandban.java b/Essentials/src/com/earth2me/essentials/commands/Commandban.java index 0cf353094..6d0efced5 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandban.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandban.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.Console; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.OfflinePlayer; @@ -7,7 +8,6 @@ import com.earth2me.essentials.User; import com.earth2me.essentials.utils.FormatUtil; import java.util.logging.Level; import org.bukkit.Server; -import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -19,7 +19,7 @@ public class Commandban extends EssentialsCommand } @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; if (args.length < 1) @@ -38,8 +38,7 @@ public class Commandban extends EssentialsCommand } if (!user.isOnline()) { - if (sender instanceof Player - && !ess.getUser(sender).isAuthorized("essentials.ban.offline")) + if (sender.isPlayer() && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.ban.offline")) { 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; if (args.length > 1) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbanip.java b/Essentials/src/com/earth2me/essentials/commands/Commandbanip.java index e8ac16bdb..9246f89ad 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandbanip.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandbanip.java @@ -1,13 +1,12 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.Console; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import com.earth2me.essentials.utils.FormatUtil; import java.util.logging.Level; import org.bukkit.Server; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; public class Commandbanip extends EssentialsCommand @@ -18,14 +17,14 @@ public class Commandbanip extends EssentialsCommand } @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) { 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; if (FormatUtil.validIP(args[0])) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbroadcast.java b/Essentials/src/com/earth2me/essentials/commands/Commandbroadcast.java index c68ed5000..a97ed54c9 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandbroadcast.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandbroadcast.java @@ -1,10 +1,10 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import com.earth2me.essentials.utils.FormatUtil; import org.bukkit.Server; -import org.bukkit.command.CommandSender; public class Commandbroadcast extends EssentialsCommand @@ -21,9 +21,9 @@ public class Commandbroadcast extends EssentialsCommand } @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 diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandburn.java b/Essentials/src/com/earth2me/essentials/commands/Commandburn.java index dad96dee7..019768750 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandburn.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandburn.java @@ -1,9 +1,9 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import org.bukkit.Server; -import org.bukkit.command.CommandSender; public class Commandburn extends EssentialsCommand @@ -14,7 +14,7 @@ public class Commandburn extends EssentialsCommand } @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) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandclearinventory.java b/Essentials/src/com/earth2me/essentials/commands/Commandclearinventory.java index 1d4d82dcf..140831bb4 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandclearinventory.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandclearinventory.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import com.earth2me.essentials.utils.NumberUtil; @@ -8,7 +9,6 @@ import java.util.Arrays; import java.util.List; import java.util.Locale; import org.bukkit.Server; -import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -25,23 +25,23 @@ public class Commandclearinventory extends EssentialsCommand @Override 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 - 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); } - 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>(); 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("*")) @@ -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; int type = -1; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandcustomtext.java b/Essentials/src/com/earth2me/essentials/commands/Commandcustomtext.java index 4d56fa705..6c2601823 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandcustomtext.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandcustomtext.java @@ -1,11 +1,11 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.textreader.IText; import com.earth2me.essentials.textreader.KeywordReplacer; import com.earth2me.essentials.textreader.TextInput; import com.earth2me.essentials.textreader.TextPager; import org.bukkit.Server; -import org.bukkit.command.CommandSender; public class Commandcustomtext extends EssentialsCommand @@ -16,7 +16,7 @@ public class Commandcustomtext extends EssentialsCommand } @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 output = new KeywordReplacer(input, sender, ess); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanddelhome.java b/Essentials/src/com/earth2me/essentials/commands/Commanddelhome.java index 3faf1c80a..555bcd4a2 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commanddelhome.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commanddelhome.java @@ -1,10 +1,10 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import java.util.Locale; import org.bukkit.Server; -import org.bukkit.command.CommandSender; public class Commanddelhome extends EssentialsCommand @@ -15,14 +15,14 @@ public class Commanddelhome extends EssentialsCommand } @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) { throw new NotEnoughArgumentsException(); } - User user = ess.getUser(sender); + User user = ess.getUser(sender.getPlayer()); String name; String[] expandedArg; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanddeljail.java b/Essentials/src/com/earth2me/essentials/commands/Commanddeljail.java index e224cbe7b..17e0411ad 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commanddeljail.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commanddeljail.java @@ -1,8 +1,8 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import org.bukkit.Server; -import org.bukkit.command.CommandSender; public class Commanddeljail extends EssentialsCommand @@ -13,7 +13,7 @@ public class Commanddeljail extends EssentialsCommand } @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) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanddelwarp.java b/Essentials/src/com/earth2me/essentials/commands/Commanddelwarp.java index 7a053b449..754f62118 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commanddelwarp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commanddelwarp.java @@ -1,8 +1,8 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import org.bukkit.Server; -import org.bukkit.command.CommandSender; public class Commanddelwarp extends EssentialsCommand @@ -13,7 +13,7 @@ public class Commanddelwarp extends EssentialsCommand } @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) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandeco.java b/Essentials/src/com/earth2me/essentials/commands/Commandeco.java index f66004d17..37f94e5b6 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandeco.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandeco.java @@ -1,13 +1,13 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.ChargeException; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import com.earth2me.essentials.utils.NumberUtil; import java.math.BigDecimal; import java.util.Locale; import org.bukkit.Server; -import org.bukkit.command.CommandSender; public class Commandeco extends EssentialsLoopCommand @@ -21,7 +21,7 @@ public class Commandeco extends EssentialsLoopCommand } @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) { @@ -56,7 +56,7 @@ public class Commandeco extends EssentialsLoopCommand } @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) { @@ -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 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(); boolean underMinimum = (amount.compareTo(minBalance) < 0); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java b/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java index 88d76e573..d26833041 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java @@ -63,7 +63,7 @@ public class Commandenchant extends EssentialsCommand final MetaItemStack metaStack = new MetaItemStack(stack); 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.updateInventory(); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java b/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java index f4655212f..50dc8ad1e 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import com.earth2me.essentials.UserMap; @@ -13,8 +14,6 @@ import org.bukkit.Material; import org.bukkit.Server; import org.bukkit.Sound; import org.bukkit.block.Block; -import org.bukkit.command.CommandSender; -import org.bukkit.command.ConsoleCommandSender; import org.bukkit.entity.Player; // 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>(); @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) { @@ -65,7 +64,7 @@ public class Commandessentials extends EssentialsCommand } //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>"); @@ -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) { @@ -96,19 +95,19 @@ public class Commandessentials extends EssentialsCommand 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()); 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(); 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>(); noteMap.put("1F#", 0.5f); @@ -174,36 +173,36 @@ public class Commandessentials extends EssentialsCommand } noteBlocks.clear(); } + private final String[] consoleMoo = new String[] + { + " (__)", + " (oo)", + " /------\\/", + " / | ||", + " * /\\---/\\", + " ~~ ~~", + "....\"Have you mooed today?\"..." + }; + private final String[] playerMoo = new String[] + { + " (__)", + " (oo)", + " /------\\/", + " / | | |", + " * /\\---/\\", + " ~~ ~~", + "....\"Have you mooed today?\"..." + }; - - private final String[] consoleMoo = new String[] { - " (__)", - " (oo)", - " /------\\/", - " / | ||", - " * /\\---/\\", - " ~~ ~~", - "....\"Have you mooed today?\"..." - }; - - private final String[] playerMoo = new String[] { - " (__)", - " (oo)", - " /------\\/", - " / | | |", - " * /\\---/\\", - " ~~ ~~", - "....\"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); } - for(Player player : ess.getServer().getOnlinePlayers()) + for (Player player : ess.getServer().getOnlinePlayers()) { player.sendMessage(playerMoo); player.playSound(player.getLocation(), Sound.COW_IDLE, 1, 1.0f); @@ -211,20 +210,21 @@ public class Commandessentials extends EssentialsCommand } 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 { - sender.sendMessage(playerMoo); - final Player player = (Player)sender; - player.playSound(player.getLocation(), Sound.COW_IDLE, 1, 1.0f); + sender.getSender().sendMessage(consoleMoo); } } } - 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(); 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])) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandexp.java b/Essentials/src/com/earth2me/essentials/commands/Commandexp.java index 09c325481..2f301fb34 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandexp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandexp.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.commands;
+import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import com.earth2me.essentials.craftbukkit.SetExpFix;
@@ -7,7 +8,6 @@ import com.earth2me.essentials.utils.NumberUtil; import java.util.List;
import java.util.Locale;
import org.bukkit.Server;
-import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -23,28 +23,28 @@ public class Commandexp extends EssentialsCommand {
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"))
{
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
{
- 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"))
{
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
{
- setExp(user.getBase(), user, args[1], true);
+ setExp(user.getSource(), user, args[1], true);
}
}
else if (args[0].equalsIgnoreCase("show"))
@@ -52,11 +52,11 @@ public class Commandexp extends EssentialsCommand if (args.length >= 2 && user.isAuthorized("essentials.exp.others"))
{
String match = args[1].trim();
- showMatch(server, user.getBase(), match);
+ showMatch(server, user.getSource(), match);
}
else
{
- showExp(user.getBase(), user);
+ showExp(user.getSource(), user);
}
}
else
@@ -65,27 +65,27 @@ public class Commandexp extends EssentialsCommand {
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
{
- setExp(user.getBase(), user, args[0], true);
+ setExp(user.getSource(), user, args[0], true);
}
}
else if (args.length >= 1 && user.isAuthorized("essentials.exp.others"))
{
String match = args[0].trim();
- showMatch(server, user.getBase(), match);
+ showMatch(server, user.getSource(), match);
}
else
{
- showExp(user.getBase(), user);
+ showExp(user.getSource(), user);
}
}
}
@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)
{
@@ -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;
final List<Player> matchedPlayers = server.matchPlayer(match);
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;
final List<Player> matchedPlayers = server.matchPlayer(match);
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())));
}
//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;
strAmount = strAmount.toLowerCase(Locale.ENGLISH);
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandext.java b/Essentials/src/com/earth2me/essentials/commands/Commandext.java index 338a214cf..23ab6ac40 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandext.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandext.java @@ -1,9 +1,9 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import org.bukkit.Server; -import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -15,7 +15,7 @@ public class Commandext extends EssentialsLoopCommand } @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) { @@ -35,11 +35,11 @@ public class Commandext extends EssentialsLoopCommand return; } - loopOnlinePlayers(server, user.getBase(), true, args[0], null); + loopOnlinePlayers(server, user.getSource(), true, args[0], null); } @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()); sender.sendMessage(_("extinguishOthers", player.getDisplayName())); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandfeed.java b/Essentials/src/com/earth2me/essentials/commands/Commandfeed.java index 7460d2238..f2df07f3c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandfeed.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandfeed.java @@ -1,9 +1,9 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import org.bukkit.Server; -import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.event.entity.FoodLevelChangeEvent; @@ -25,7 +25,7 @@ public class Commandfeed extends EssentialsLoopCommand 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; } @@ -34,7 +34,7 @@ public class Commandfeed extends EssentialsLoopCommand } @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) { @@ -45,7 +45,7 @@ public class Commandfeed extends EssentialsLoopCommand } @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 { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandfirework.java b/Essentials/src/com/earth2me/essentials/commands/Commandfirework.java index d01e5bf85..ecf0561e1 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandfirework.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandfirework.java @@ -113,7 +113,7 @@ public class Commandfirework extends EssentialsCommand { try { - mStack.addFireworkMeta(user.getBase(), true, arg, ess); + mStack.addFireworkMeta(user.getSource(), true, arg, ess); } catch (Exception e) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandfly.java b/Essentials/src/com/earth2me/essentials/commands/Commandfly.java index 8036ba57c..8d38f08dd 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandfly.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandfly.java @@ -1,9 +1,9 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import org.bukkit.Server; -import org.bukkit.command.CommandSender; public class Commandfly extends EssentialsToggleCommand @@ -14,7 +14,7 @@ public class Commandfly extends EssentialsToggleCommand } @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); } @@ -27,25 +27,25 @@ public class Commandfly extends EssentialsToggleCommand Boolean toggle = matchToggleArgument(args[0]); if (toggle == null && user.isAuthorized(othersPermission)) { - toggleOtherPlayers(server, user.getBase(), args); + toggleOtherPlayers(server, user.getSource(), args); } else { - togglePlayer(user.getBase(), user, toggle); + togglePlayer(user.getSource(), user, toggle); } } else if (args.length == 2 && user.isAuthorized(othersPermission)) { - toggleOtherPlayers(server, user.getBase(), args); + toggleOtherPlayers(server, user.getSource(), args); } else { - togglePlayer(user.getBase(), user, null); + togglePlayer(user.getSource(), user, null); } } @Override - void togglePlayer(CommandSender sender, User user, Boolean enabled) + void togglePlayer(CommandSource sender, User user, Boolean enabled) { if (enabled == null) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java b/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java index c96a6116f..c24a08a9c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java @@ -1,12 +1,12 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import java.util.List; import java.util.Locale; import org.bukkit.GameMode; import org.bukkit.Server; -import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -18,7 +18,7 @@ public class Commandgamemode extends EssentialsCommand } @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; 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")) { gameMode = matchGameMode(args[0].toLowerCase(Locale.ENGLISH)); - gamemodeOtherPlayers(server, user.getBase(), gameMode, args[1]); + gamemodeOtherPlayers(server, user.getSource(), gameMode, args[1]); return; } else @@ -63,7 +63,7 @@ public class Commandgamemode extends EssentialsCommand if (user.isAuthorized("essentials.gamemode.others")) { gameMode = matchGameMode(commandLabel); - gamemodeOtherPlayers(server, user.getBase(), gameMode, args[0]); + gamemodeOtherPlayers(server, user.getSource(), gameMode, args[0]); return; } throw new NotEnoughArgumentsException(); @@ -77,7 +77,7 @@ public class Commandgamemode extends EssentialsCommand 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 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."); } - 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; final List<Player> matchedPlayers = server.matchPlayer(name); for (Player matchPlayer : matchedPlayers) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgc.java b/Essentials/src/com/earth2me/essentials/commands/Commandgc.java index 9f15c18fd..0faf037e5 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgc.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgc.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.utils.DateUtil; import com.earth2me.essentials.utils.NumberUtil; @@ -9,7 +10,6 @@ import org.bukkit.ChatColor; import org.bukkit.Chunk; import org.bukkit.Server; import org.bukkit.World; -import org.bukkit.command.CommandSender; public class Commandgc extends EssentialsCommand @@ -20,7 +20,7 @@ public class Commandgc extends EssentialsCommand } @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(); ChatColor color; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java b/Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java index 021d711a8..0a9959461 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java @@ -1,10 +1,10 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import org.bukkit.Location; import org.bukkit.Server; -import org.bukkit.command.CommandSender; public class Commandgetpos extends EssentialsCommand @@ -20,14 +20,14 @@ public class Commandgetpos extends EssentialsCommand if (args.length > 0 && user.isAuthorized("essentials.getpos.others")) { final User otherUser = getPlayer(server, user, args, 0); - outputPosition(user.getBase(), otherUser.getLocation(), user.getLocation()); + outputPosition(user.getSource(), otherUser.getLocation(), user.getLocation()); return; } - outputPosition(user.getBase(), user.getLocation(), null); + outputPosition(user.getSource(), user.getLocation(), null); } @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) { @@ -37,7 +37,7 @@ public class Commandgetpos extends EssentialsCommand 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(_("posX", coords.getBlockX())); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgive.java b/Essentials/src/com/earth2me/essentials/commands/Commandgive.java index ce0258108..54c5a0afb 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgive.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgive.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.MetaItemStack; import com.earth2me.essentials.User; @@ -9,8 +10,6 @@ import java.util.Locale; import java.util.Map; import org.bukkit.Material; import org.bukkit.Server; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -22,7 +21,7 @@ public class Commandgive extends EssentialsCommand } @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) { @@ -32,13 +31,13 @@ public class Commandgive extends EssentialsCommand ItemStack stack = ess.getItemDb().get(args[1]); final String itemname = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""); - if (sender instanceof Player + if (sender.isPlayer() && (ess.getSettings().permissionBasedItemSpawn() - ? (!ess.getUser(sender).isAuthorized("essentials.itemspawn.item-all") - && !ess.getUser(sender).isAuthorized("essentials.itemspawn.item-" + itemname) - && !ess.getUser(sender).isAuthorized("essentials.itemspawn.item-" + stack.getTypeId())) - : (!ess.getUser(sender).isAuthorized("essentials.itemspawn.exempt") - && !ess.getUser(sender).canSpawnItem(stack.getTypeId())))) + ? (!ess.getUser(sender.getPlayer()).isAuthorized("essentials.itemspawn.item-all") + && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.itemspawn.item-" + itemname) + && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.itemspawn.item-" + stack.getTypeId())) + : (!ess.getUser(sender.getPlayer()).isAuthorized("essentials.itemspawn.exempt") + && !ess.getUser(sender.getPlayer()).canSpawnItem(stack.getTypeId())))) { throw new Exception(_("cantSpawnItem", itemname)); } @@ -74,7 +73,7 @@ public class Commandgive extends EssentialsCommand { MetaItemStack metaStack = new MetaItemStack(stack); 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; } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgod.java b/Essentials/src/com/earth2me/essentials/commands/Commandgod.java index c1c561d6e..439584667 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgod.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgod.java @@ -1,11 +1,10 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import net.ess3.api.events.GodStatusChangeEvent; import org.bukkit.Server; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; public class Commandgod extends EssentialsToggleCommand @@ -16,7 +15,7 @@ public class Commandgod extends EssentialsToggleCommand } @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); } @@ -29,32 +28,32 @@ public class Commandgod extends EssentialsToggleCommand Boolean toggle = matchToggleArgument(args[0]); if (toggle == null && user.isAuthorized(othersPermission)) { - toggleOtherPlayers(server, user.getBase(), args); + toggleOtherPlayers(server, user.getSource(), args); } else { - togglePlayer(user.getBase(), user, toggle); + togglePlayer(user.getSource(), user, toggle); } } else if (args.length == 2 && user.isAuthorized(othersPermission)) { - toggleOtherPlayers(server, user.getBase(), args); + toggleOtherPlayers(server, user.getSource(), args); } else { - togglePlayer(user.getBase(), user, null); + togglePlayer(user.getSource(), user, null); } } @Override - void togglePlayer(CommandSender sender, User user, Boolean enabled) + void togglePlayer(CommandSource sender, User user, Boolean enabled) { if (enabled == null) { 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); ess.getServer().getPluginManager().callEvent(godEvent); if (!godEvent.isCancelled()) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandheal.java b/Essentials/src/com/earth2me/essentials/commands/Commandheal.java index b579ba16a..fb4477331 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandheal.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandheal.java @@ -1,9 +1,9 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import org.bukkit.Server; -import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.event.entity.EntityRegainHealthEvent; 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")) { - loopOnlinePlayers(server, user.getBase(), true, args[0], null); + loopOnlinePlayers(server, user.getSource(), true, args[0], null); return; } @@ -35,7 +35,7 @@ public class Commandheal extends EssentialsLoopCommand } @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) { @@ -46,7 +46,7 @@ public class Commandheal extends EssentialsLoopCommand } @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 { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java b/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java index 36b93e82b..03cd37374 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java @@ -1,12 +1,12 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import com.earth2me.essentials.textreader.*; import com.earth2me.essentials.utils.NumberUtil; import java.util.Locale; import org.bukkit.Server; -import org.bukkit.command.CommandSender; public class Commandhelp extends EssentialsCommand @@ -23,7 +23,7 @@ public class Commandhelp extends EssentialsCommand String pageStr = args.length > 0 ? args[0] : null; String chapterPageStr = args.length > 1 ? args[1] : null; 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()) { @@ -45,14 +45,14 @@ public class Commandhelp extends EssentialsCommand } else { - output = new KeywordReplacer(input, user.getBase(), ess); + output = new KeywordReplacer(input, user.getSource(), ess); } final TextPager pager = new TextPager(output); - pager.showPage(pageStr, chapterPageStr, command, user.getBase()); + pager.showPage(pageStr, chapterPageStr, command, user.getSource()); } @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")); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java b/Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java index d1dec09a0..7f4647de5 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.Console; import static com.earth2me.essentials.I18n._; 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 { user.setDisplayNick(); - sendMessage(server, user.getBase(), user.getDisplayName(), args); + sendMessage(server, user.getSource(), user.getDisplayName(), args); } @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); } - 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) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandinfo.java b/Essentials/src/com/earth2me/essentials/commands/Commandinfo.java index afe1add72..a8b10cf36 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandinfo.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandinfo.java @@ -1,11 +1,11 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.textreader.IText; import com.earth2me.essentials.textreader.KeywordReplacer; import com.earth2me.essentials.textreader.TextInput; import com.earth2me.essentials.textreader.TextPager; import org.bukkit.Server; -import org.bukkit.command.CommandSender; public class Commandinfo extends EssentialsCommand @@ -16,7 +16,7 @@ public class Commandinfo extends EssentialsCommand } @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 output = new KeywordReplacer(input, sender, ess); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanditem.java b/Essentials/src/com/earth2me/essentials/commands/Commanditem.java index 869028af4..09715dff1 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commanditem.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commanditem.java @@ -60,7 +60,7 @@ public class Commanditem extends EssentialsCommand MetaItemStack metaStack = new MetaItemStack(stack); 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(); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java b/Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java index 11d633286..e0b87dca5 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java @@ -1,9 +1,9 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import org.bukkit.Material; import org.bukkit.Server; -import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -16,13 +16,13 @@ public class Commanditemdb extends EssentialsCommand } @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; boolean itemHeld = false; if (args.length < 1) { - if (sender instanceof Player) + if (sender.isPlayer()) { itemHeld = true; itemStack = ((Player)sender).getItemInHand(); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandjails.java b/Essentials/src/com/earth2me/essentials/commands/Commandjails.java index b7eccdba3..5fe61032d 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandjails.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandjails.java @@ -1,8 +1,8 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.utils.StringUtil; import org.bukkit.Server; -import org.bukkit.command.CommandSender; public class Commandjails extends EssentialsCommand @@ -13,7 +13,7 @@ public class Commandjails extends EssentialsCommand } @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())); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkick.java b/Essentials/src/com/earth2me/essentials/commands/Commandkick.java index 3825d7865..316b50300 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkick.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkick.java @@ -1,13 +1,12 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.Console; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import com.earth2me.essentials.utils.FormatUtil; import java.util.logging.Level; import org.bukkit.Server; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; public class Commandkick extends EssentialsCommand @@ -18,7 +17,7 @@ public class Commandkick extends EssentialsCommand } @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) { @@ -26,9 +25,9 @@ public class Commandkick extends EssentialsCommand } 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")) { throw new PlayerNotFoundException(); @@ -44,7 +43,7 @@ public class Commandkick extends EssentialsCommand kickReason = FormatUtil.replaceFormat(kickReason.replace("\\n", "\n").replace("|", "\n")); 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)); ess.broadcastMessage("essentials.kick.notify", _("playerKicked", senderName, target.getName(), kickReason)); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java b/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java index e8453d90b..f789cfe32 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java @@ -1,9 +1,9 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.utils.FormatUtil; import org.bukkit.Server; -import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -15,14 +15,14 @@ public class Commandkickall extends EssentialsCommand } @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"); kickReason = FormatUtil.replaceFormat(kickReason.replace("\\n", "\n").replace("|", "\n")); 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; } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkill.java b/Essentials/src/com/earth2me/essentials/commands/Commandkill.java index 0bbb3562e..36698f0b2 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkill.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkill.java @@ -1,9 +1,9 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import org.bukkit.Server; -import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.event.entity.EntityDamageEvent; @@ -16,7 +16,7 @@ public class Commandkill extends EssentialsLoopCommand } @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) { @@ -27,16 +27,16 @@ public class Commandkill extends EssentialsLoopCommand } @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(); - 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())); } 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); - 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; } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkillall.java b/Essentials/src/com/earth2me/essentials/commands/Commandkillall.java index 014d4d4e9..1ce8aecc0 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkillall.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkillall.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.Mob; import java.util.ArrayList; @@ -7,7 +8,6 @@ import java.util.Locale; import org.bukkit.Chunk; import org.bukkit.Server; import org.bukkit.World; -import org.bukkit.command.CommandSender; import org.bukkit.entity.*; import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.inventory.ItemStack; @@ -22,12 +22,12 @@ public class Commandkillall extends EssentialsCommand //TODO: Tidy - missed this during command cleanup @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"; int radius = -1; World world; - if (sender instanceof Player) + if (sender.isPlayer()) { world = ((Player)sender).getWorld(); if (args.length == 1) @@ -96,7 +96,7 @@ public class Commandkillall extends EssentialsCommand { for (Entity entity : chunk.getEntities()) { - if (sender instanceof Player) + if (sender.isPlayer()) { if (radius >= 0 && ((Player)sender).getLocation().distanceSquared(entity.getLocation()) > radius) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkit.java b/Essentials/src/com/earth2me/essentials/commands/Commandkit.java index ccc58c224..a7fc4e2e5 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkit.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkit.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.Kit; import com.earth2me.essentials.Trade; @@ -9,7 +10,6 @@ import java.util.List; import java.util.Locale; import java.util.Map; import org.bukkit.Server; -import org.bukkit.command.CommandSender; public class Commandkit extends EssentialsCommand @@ -42,7 +42,7 @@ public class Commandkit extends EssentialsCommand } @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) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandlightning.java b/Essentials/src/com/earth2me/essentials/commands/Commandlightning.java index 12381a330..254058eb2 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandlightning.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandlightning.java @@ -1,9 +1,9 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import org.bukkit.Server; -import org.bukkit.command.CommandSender; import org.bukkit.entity.LightningStrike; import org.bukkit.entity.Player; @@ -18,10 +18,10 @@ public class Commandlightning extends EssentialsLoopCommand } @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; - if (sender instanceof Player) + if (sender.isPlayer()) { user = ess.getUser(((Player)sender)); if ((args.length < 1 || user != null && !user.isAuthorized("essentials.lightning.others"))) @@ -45,7 +45,7 @@ public class Commandlightning extends EssentialsLoopCommand } @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())); final LightningStrike strike = matchUser.getBase().getWorld().strikeLightningEffect(matchUser.getBase().getLocation()); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandlist.java b/Essentials/src/com/earth2me/essentials/commands/Commandlist.java index ef7911d12..c9bc864cf 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandlist.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandlist.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.PlayerList; import com.earth2me.essentials.User; @@ -7,8 +8,6 @@ import com.earth2me.essentials.utils.FormatUtil; import com.earth2me.essentials.utils.NumberUtil; import java.util.*; import org.bukkit.Server; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; public class Commandlist extends EssentialsCommand @@ -19,12 +18,12 @@ public class Commandlist extends EssentialsCommand } @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; - 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)); 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 - 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 List<String> asterisk = new ArrayList<String>(); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmail.java b/Essentials/src/com/earth2me/essentials/commands/Commandmail.java index 70310cf2a..cb7ba174f 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmail.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmail.java @@ -1,12 +1,12 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import com.earth2me.essentials.utils.FormatUtil; import com.earth2me.essentials.utils.StringUtil; import java.util.List; import org.bukkit.Server; -import org.bukkit.command.CommandSender; public class Commandmail extends EssentialsCommand @@ -97,7 +97,7 @@ public class Commandmail extends EssentialsCommand } @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])) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandme.java b/Essentials/src/com/earth2me/essentials/commands/Commandme.java index fe552f598..382bbf06a 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandme.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandme.java @@ -1,10 +1,10 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import com.earth2me.essentials.utils.FormatUtil; import org.bukkit.Server; -import org.bukkit.command.CommandSender; public class Commandme extends EssentialsCommand @@ -35,7 +35,7 @@ public class Commandme extends EssentialsCommand } @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) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmotd.java b/Essentials/src/com/earth2me/essentials/commands/Commandmotd.java index 0031504e8..bbab26ab0 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmotd.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmotd.java @@ -1,11 +1,11 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.textreader.IText; import com.earth2me.essentials.textreader.KeywordReplacer; import com.earth2me.essentials.textreader.TextInput; import com.earth2me.essentials.textreader.TextPager; import org.bukkit.Server; -import org.bukkit.command.CommandSender; public class Commandmotd extends EssentialsCommand @@ -16,7 +16,7 @@ public class Commandmotd extends EssentialsCommand } @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 output = new KeywordReplacer(input, sender, ess); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java b/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java index 5749bb667..31156813b 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.Console; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.IReplyTo; @@ -8,7 +9,6 @@ import static com.earth2me.essentials.commands.EssentialsCommand.getFinalArg; import com.earth2me.essentials.utils.FormatUtil; import org.bukkit.Server; import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; public class Commandmsg extends EssentialsLoopCommand @@ -21,7 +21,7 @@ public class Commandmsg extends EssentialsLoopCommand } @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()) { @@ -29,9 +29,9 @@ public class Commandmsg extends EssentialsLoopCommand } 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()) { throw new Exception(_("voiceSilenced")); @@ -45,13 +45,13 @@ public class Commandmsg extends EssentialsLoopCommand if (args[0].equalsIgnoreCase(Console.NAME)) { - final IReplyTo replyTo = sender instanceof Player ? ess.getUser(sender) : Console.getConsoleReplyTo(); - final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME; + final IReplyTo replyTo = sender.isPlayer() ? ess.getUser(sender.getPlayer()) : Console.getConsoleReplyTo(); + final String senderName = sender.isPlayer() ? sender.getPlayer().getDisplayName() : Console.NAME; sender.sendMessage(_("msgFormat", translatedMe, Console.NAME, message)); CommandSender cs = Console.getCommandSender(server); cs.sendMessage(_("msgFormat", senderName, translatedMe, message)); - replyTo.setReplyTo(cs); + replyTo.setReplyTo(new CommandSource(cs)); Console.getConsoleReplyTo().setReplyTo(sender); return; } @@ -60,10 +60,10 @@ public class Commandmsg extends EssentialsLoopCommand } @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 String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME; + final IReplyTo replyTo = sender.isPlayer() ? ess.getUser(sender.getPlayer()) : Console.getConsoleReplyTo(); + final String senderName = sender.isPlayer() ? sender.getPlayer().getDisplayName() : Console.NAME; if (matchedUser.isAfk()) { @@ -71,13 +71,13 @@ public class Commandmsg extends EssentialsLoopCommand } 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; } matchedUser.sendMessage(_("msgFormat", senderName, translatedMe, args[0])); - replyTo.setReplyTo(matchedUser.getBase()); + replyTo.setReplyTo(matchedUser.getSource()); matchedUser.setReplyTo(sender); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmute.java b/Essentials/src/com/earth2me/essentials/commands/Commandmute.java index 9ef7f5662..201768e8c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmute.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmute.java @@ -1,11 +1,11 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.OfflinePlayer; import com.earth2me.essentials.User; import com.earth2me.essentials.utils.DateUtil; import org.bukkit.Server; -import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -17,7 +17,7 @@ public class Commandmute extends EssentialsCommand } @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; if (args.length < 1) @@ -36,8 +36,7 @@ public class Commandmute extends EssentialsCommand } if (!user.isOnline()) { - if (sender instanceof Player - && !ess.getUser(sender).isAuthorized("essentials.mute.offline")) + if (sender.isPlayer() && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.mute.offline")) { throw new Exception(_("muteExempt")); } @@ -83,7 +82,7 @@ public class Commandmute extends EssentialsCommand sender.sendMessage(_("mutedPlayer", user.getDisplayName())); 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 { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandnear.java b/Essentials/src/com/earth2me/essentials/commands/Commandnear.java index b79ee93f9..71205cdb8 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandnear.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandnear.java @@ -1,11 +1,11 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import org.bukkit.Location; import org.bukkit.Server; import org.bukkit.World; -import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -72,7 +72,7 @@ public class Commandnear extends EssentialsCommand } @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) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandnick.java b/Essentials/src/com/earth2me/essentials/commands/Commandnick.java index d6346e71c..0a5665b33 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandnick.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandnick.java @@ -1,12 +1,12 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import com.earth2me.essentials.utils.FormatUtil; import java.util.Locale; import net.ess3.api.events.NickChangeEvent; import org.bukkit.Server; -import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -32,18 +32,18 @@ public class Commandnick extends EssentialsLoopCommand if (args.length > 1 && user.isAuthorized("essentials.nick.others")) { 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")); } else { final String[] nickname = formatNickname(user, args[0]).split(" "); - updatePlayer(server, user.getBase(), user, nickname); + updatePlayer(server, user.getSource(), user, nickname); } } @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) { @@ -59,7 +59,7 @@ public class Commandnick extends EssentialsLoopCommand } @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]; if (target.getName().equalsIgnoreCase(nick)) @@ -123,9 +123,9 @@ public class Commandnick extends EssentialsLoopCommand 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); server.getPluginManager().callEvent(nickEvent); if (!nickEvent.isCancelled()) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandnuke.java b/Essentials/src/com/earth2me/essentials/commands/Commandnuke.java index de365a89a..173e28b5c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandnuke.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandnuke.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import java.util.ArrayList; import java.util.Arrays; @@ -7,7 +8,6 @@ import java.util.List; import org.bukkit.Location; import org.bukkit.Server; import org.bukkit.World; -import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.entity.TNTPrimed; @@ -20,7 +20,7 @@ public class Commandnuke extends EssentialsCommand } @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; if (args.length > 0) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandpay.java b/Essentials/src/com/earth2me/essentials/commands/Commandpay.java index c229d1a2b..c6826717b 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandpay.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandpay.java @@ -1,11 +1,11 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.ChargeException; +import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; import java.math.BigDecimal; import org.bukkit.Server; -import org.bukkit.command.CommandSender; public class Commandpay extends EssentialsLoopCommand @@ -26,13 +26,13 @@ public class Commandpay extends EssentialsLoopCommand } 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 - 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); Trade.log("Command", "Pay", "Player", user.getName(), new Trade(amount, ess), player.getName(), new Trade(amount, ess), user.getLocation(), ess); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandping.java b/Essentials/src/com/earth2me/essentials/commands/Commandping.java index 72b5beca0..0597ae6e5 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandping.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandping.java @@ -1,9 +1,9 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.utils.FormatUtil; 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 public class Commandping extends EssentialsCommand @@ -14,7 +14,7 @@ public class Commandping extends EssentialsCommand } @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) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandpotion.java b/Essentials/src/com/earth2me/essentials/commands/Commandpotion.java index 52ab627ae..73a6157b9 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandpotion.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandpotion.java @@ -69,7 +69,7 @@ public class Commandpotion extends EssentialsCommand final MetaItemStack mStack = new MetaItemStack(stack); for (String arg : args) { - mStack.addPotionMeta(user.getBase(), true, arg, ess); + mStack.addPotionMeta(user.getSource(), true, arg, ess); } if (mStack.completePotion()) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java b/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java index 33b69565f..582a8fe99 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import com.earth2me.essentials.utils.StringUtil; @@ -8,8 +9,6 @@ import java.util.List; import java.util.Locale; import org.bukkit.Material; import org.bukkit.Server; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -25,11 +24,11 @@ public class Commandpowertool extends EssentialsCommand { final String command = getFinalArg(args, 0); final ItemStack itemStack = user.getItemInHand(); - powertool(server, user.getBase(), user, commandLabel, itemStack, command); + powertool(server, user.getSource(), user, commandLabel, itemStack, command); } @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 { @@ -42,7 +41,7 @@ public class Commandpowertool extends EssentialsCommand 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 if (command != null && command.equalsIgnoreCase("d:")) @@ -88,7 +87,7 @@ public class Commandpowertool extends EssentialsCommand { 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")); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandptime.java b/Essentials/src/com/earth2me/essentials/commands/Commandptime.java index 8c0fd7dfa..050a012ad 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandptime.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandptime.java @@ -1,12 +1,12 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import com.earth2me.essentials.utils.DescParseTickFormat; import java.util.*; import org.bukkit.Server; import org.bukkit.World; -import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -28,7 +28,7 @@ public class Commandptime extends EssentialsCommand } @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? String userSelector = null; @@ -45,11 +45,14 @@ public class Commandptime extends EssentialsCommand return; } - User user = ess.getUser(sender); - if (user != null && (!users.contains(user) || users.size() > 1)&& !user.isAuthorized("essentials.ptime.others")) + if (sender.isPlayer()) { - user.sendMessage(_("pTimeOthersPermission")); - return; + User user = ess.getUser(sender.getPlayer()); + if (user != null && (!users.contains(user) || users.size() > 1) && !user.isAuthorized("essentials.ptime.others")) + { + user.sendMessage(_("pTimeOthersPermission")); + return; + } } Long ticks; @@ -89,7 +92,7 @@ public class Commandptime extends EssentialsCommand /** * 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) { @@ -120,7 +123,7 @@ public class Commandptime extends EssentialsCommand /** * 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 if (ticks == null) @@ -181,24 +184,24 @@ public class Commandptime extends EssentialsCommand /** * 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()); // If there is no selector we want the sender itself. Or all users if sender isn't a user. if (selector == null) { - final User user = ess.getUser(sender); - if (user == null) + if (sender.isPlayer()) + { + final User user = ess.getUser(sender.getPlayer()); + users.add(user); + } + else { for (Player player : server.getOnlinePlayers()) { users.add(ess.getUser(player)); } } - else - { - users.add(user); - } return users; } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandpweather.java b/Essentials/src/com/earth2me/essentials/commands/Commandpweather.java index c410bcdfa..0c067b682 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandpweather.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandpweather.java @@ -1,11 +1,11 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import java.util.*; import org.bukkit.Server; import org.bukkit.WeatherType; -import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -32,7 +32,7 @@ public class Commandpweather extends EssentialsCommand } @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? String userSelector = null; @@ -54,11 +54,14 @@ public class Commandpweather extends EssentialsCommand return; } - User user = ess.getUser(sender); - if (user != null && (!users.contains(user) || users.size() > 1) && !user.isAuthorized("essentials.pweather.others")) + if (sender.isPlayer()) { - user.sendMessage(_("pWeatherOthersPermission")); - return; + User user = ess.getUser(sender.getPlayer()); + if (user != null && (!users.contains(user) || users.size() > 1) && !user.isAuthorized("essentials.pweather.others")) + { + user.sendMessage(_("pWeatherOthersPermission")); + return; + } } setUsersWeather(sender, users, args[0].toLowerCase()); @@ -67,7 +70,7 @@ public class Commandpweather extends EssentialsCommand /** * 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) { @@ -90,7 +93,7 @@ public class Commandpweather extends EssentialsCommand /** * 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(); @@ -131,24 +134,24 @@ public class Commandpweather extends EssentialsCommand /** * 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()); // If there is no selector we want the sender itself. Or all users if sender isn't a user. if (selector == null) { - final User user = ess.getUser(sender); - if (user == null) + if (sender.isPlayer()) + { + final User user = ess.getUser(sender.getPlayer()); + users.add(user); + } + else { for (Player player : server.getOnlinePlayers()) { users.add(ess.getUser(player)); } } - else - { - users.add(user); - } return users; } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandr.java b/Essentials/src/com/earth2me/essentials/commands/Commandr.java index a011540b1..82b74d7bd 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandr.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandr.java @@ -1,12 +1,12 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.Console; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.IReplyTo; import com.earth2me.essentials.User; import com.earth2me.essentials.utils.FormatUtil; import org.bukkit.Server; -import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -18,7 +18,7 @@ public class Commandr extends EssentialsCommand } @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) { @@ -29,9 +29,9 @@ public class Commandr extends EssentialsCommand IReplyTo replyTo; 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); replyTo = user; senderName = user.getDisplayName(); @@ -43,7 +43,7 @@ public class Commandr extends EssentialsCommand senderName = Console.NAME; } - final CommandSender target = replyTo.getReplyTo(); + final CommandSource target = replyTo.getReplyTo(); final String targetName = target instanceof Player ? ((Player)target).getDisplayName() : Console.NAME; if (target == null || ((target instanceof Player) && !((Player)target).isOnline())) @@ -52,10 +52,10 @@ public class Commandr extends EssentialsCommand } sender.sendMessage(_("msgFormat", _("me"), targetName, message)); - if (target instanceof Player) + if (target.isPlayer()) { - User player = ess.getUser(target); - if (sender instanceof Player && player.isIgnoredPlayer(ess.getUser(sender))) + User player = ess.getUser(target.getPlayer()); + if (sender.isPlayer() && player.isIgnoredPlayer(ess.getUser(sender.getPlayer()))) { return; } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java b/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java index cadc0e652..6a4f600cc 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java @@ -1,11 +1,11 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import com.earth2me.essentials.utils.FormatUtil; import java.util.Locale; import org.bukkit.Server; -import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -17,14 +17,14 @@ public class Commandrealname extends EssentialsCommand } @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) { throw new NotEnoughArgumentsException(); } 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; for (Player onlinePlayer : server.getOnlinePlayers()) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java b/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java index 6661233ac..565067a5e 100755 --- a/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.commands;
+import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import com.earth2me.essentials.utils.NumberUtil;
@@ -9,8 +10,6 @@ import java.util.Locale; import java.util.Map;
import org.bukkit.Material;
import org.bukkit.Server;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
import org.bukkit.inventory.*;
@@ -22,7 +21,7 @@ public class Commandrecipe extends EssentialsCommand }
@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)
{
@@ -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())));
}
- 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();
- if (sender instanceof Player)
+ if (sender.isPlayer())
{
- final User user = ess.getUser(sender);
+ final User user = ess.getUser(sender.getPlayer());
user.closeInventory();
user.setRecipeSee(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();
- if (sender instanceof Player)
+ if (sender.isPlayer())
{
- final User user = ess.getUser(sender);
+ final User user = ess.getUser(sender.getPlayer());
user.setRecipeSee(true);
final InventoryView view = user.openWorkbench(null, true);
for (int i = 0; i < ingredients.size(); i++)
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandremove.java b/Essentials/src/com/earth2me/essentials/commands/Commandremove.java index 1f1dfef77..f466f2b66 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandremove.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandremove.java @@ -1,12 +1,12 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import java.util.Locale; import org.bukkit.Chunk; import org.bukkit.Server; import org.bukkit.World; -import org.bukkit.command.CommandSender; import org.bukkit.entity.*; //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 - 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) { @@ -105,7 +105,7 @@ public class Commandremove extends EssentialsCommand 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; if (radius > 0) @@ -173,7 +173,7 @@ public class Commandremove extends EssentialsCommand } else if (toRemove == ToRemove.ITEMFRAMES) { - if (e instanceof ItemFrame)
+ if (e instanceof ItemFrame) { e.remove(); removed++; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrules.java b/Essentials/src/com/earth2me/essentials/commands/Commandrules.java index d87c4f41b..2a3e7a464 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandrules.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandrules.java @@ -1,11 +1,11 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.textreader.IText; import com.earth2me.essentials.textreader.KeywordReplacer; import com.earth2me.essentials.textreader.TextInput; import com.earth2me.essentials.textreader.TextPager; import org.bukkit.Server; -import org.bukkit.command.CommandSender; public class Commandrules extends EssentialsCommand @@ -16,7 +16,7 @@ public class Commandrules extends EssentialsCommand } @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, "rules", true, ess); final IText output = new KeywordReplacer(input, sender, ess); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandseen.java b/Essentials/src/com/earth2me/essentials/commands/Commandseen.java index 6393b2e4e..c63671e1f 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandseen.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandseen.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import com.earth2me.essentials.UserMap; @@ -10,8 +11,6 @@ import java.util.ArrayList; import java.util.List; import org.bukkit.Location; import org.bukkit.Server; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; public class Commandseen extends EssentialsCommand @@ -22,7 +21,7 @@ public class Commandseen extends EssentialsCommand } @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 { seen(server, sender, args, true, true, true); } @@ -30,10 +29,10 @@ public class Commandseen extends EssentialsCommand @Override protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { - seen(server, user.getBase(), args, user.isAuthorized("essentials.seen.banreason"), user.isAuthorized("essentials.seen.extra"), user.isAuthorized("essentials.seen.ipsearch")); + seen(server, user.getSource(), args, user.isAuthorized("essentials.seen.banreason"), user.isAuthorized("essentials.seen.extra"), user.isAuthorized("essentials.seen.ipsearch")); } - protected void seen(final Server server, final CommandSender sender, final String[] args, final boolean showBan, final boolean extra, final boolean ipLookup) throws Exception + protected void seen(final Server server, final CommandSource sender, final String[] args, final boolean showBan, final boolean extra, final boolean ipLookup) throws Exception { if (args.length < 1) { @@ -67,7 +66,7 @@ public class Commandseen extends EssentialsCommand } } - private void seenOnline(final Server server, final CommandSender sender, final User user, final boolean showBan, final boolean extra) throws Exception + private void seenOnline(final Server server, final CommandSource sender, final User user, final boolean showBan, final boolean extra) throws Exception { user.setDisplayNick(); @@ -89,7 +88,7 @@ public class Commandseen extends EssentialsCommand : _("true")))); } final String location = user.getGeoLocation(); - if (location != null && (!(sender instanceof Player) || ess.getUser(sender).isAuthorized("essentials.geoip.show"))) + if (location != null && (!(sender.isPlayer()) || ess.getUser(sender.getPlayer()).isAuthorized("essentials.geoip.show"))) { sender.sendMessage(_("whoisGeoLocation", location)); } @@ -99,7 +98,7 @@ public class Commandseen extends EssentialsCommand } } - private void seenOffline(final Server server, final CommandSender sender, User user, final boolean showBan, final boolean extra) throws Exception + private void seenOffline(final Server server, final CommandSource sender, User user, final boolean showBan, final boolean extra) throws Exception { user.setDisplayNick(); if (user.getLastLogout() > 0) @@ -115,7 +114,7 @@ public class Commandseen extends EssentialsCommand sender.sendMessage(_("whoisBanned", showBan ? user.getBanReason() : _("true"))); } final String location = user.getGeoLocation(); - if (location != null && (!(sender instanceof Player) || ess.getUser(sender).isAuthorized("essentials.geoip.show"))) + if (location != null && (!(sender.isPlayer()) || ess.getUser(sender.getPlayer()).isAuthorized("essentials.geoip.show"))) { sender.sendMessage(_("whoisGeoLocation", location)); } @@ -133,7 +132,7 @@ public class Commandseen extends EssentialsCommand } } - private void seenIP(final Server server, final CommandSender sender, final String ipAddress) throws Exception + private void seenIP(final Server server, final CommandSource sender, final String ipAddress) throws Exception { final UserMap userMap = ess.getUserMap(); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsetworth.java b/Essentials/src/com/earth2me/essentials/commands/Commandsetworth.java index 91a1dd657..ecc11cd52 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsetworth.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsetworth.java @@ -1,9 +1,9 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import org.bukkit.Server; -import org.bukkit.command.CommandSender; import org.bukkit.inventory.ItemStack; @@ -41,7 +41,7 @@ public class Commandsetworth extends EssentialsCommand } @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) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsocialspy.java b/Essentials/src/com/earth2me/essentials/commands/Commandsocialspy.java index 54344124a..e288a5cb0 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsocialspy.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsocialspy.java @@ -1,9 +1,9 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import org.bukkit.Server; -import org.bukkit.command.CommandSender; public class Commandsocialspy extends EssentialsToggleCommand @@ -14,7 +14,7 @@ public class Commandsocialspy extends EssentialsToggleCommand } @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); } @@ -27,25 +27,25 @@ public class Commandsocialspy extends EssentialsToggleCommand Boolean toggle = matchToggleArgument(args[0]); if (toggle == null && user.isAuthorized(othersPermission)) { - toggleOtherPlayers(server, user.getBase(), args); + toggleOtherPlayers(server, user.getSource(), args); } else { - togglePlayer(user.getBase(), user, toggle); + togglePlayer(user.getSource(), user, toggle); } } else if (args.length == 2 && user.isAuthorized(othersPermission)) { - toggleOtherPlayers(server, user.getBase(), args); + toggleOtherPlayers(server, user.getSource(), args); } else { - togglePlayer(user.getBase(), user, null); + togglePlayer(user.getSource(), user, null); } } @Override - void togglePlayer(CommandSender sender, User user, Boolean enabled) throws NotEnoughArgumentsException + void togglePlayer(CommandSource sender, User user, Boolean enabled) throws NotEnoughArgumentsException { if (enabled == null) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java index 3722d6412..4c37e35bb 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.Mob; import com.earth2me.essentials.SpawnMob; @@ -7,7 +8,6 @@ import com.earth2me.essentials.User; import com.earth2me.essentials.utils.StringUtil; import java.util.List; import org.bukkit.Server; -import org.bukkit.command.CommandSender; public class Commandspawnmob extends EssentialsCommand @@ -43,7 +43,7 @@ public class Commandspawnmob extends EssentialsCommand if (args.length >= 3) { final User target = getPlayer(ess.getServer(), user, args, 2); - SpawnMob.spawnmob(ess, server, user.getBase(), target, mobParts, mobData, mobCount); + SpawnMob.spawnmob(ess, server, user.getSource(), target, mobParts, mobData, mobCount); return; } @@ -51,7 +51,7 @@ public class Commandspawnmob extends EssentialsCommand } @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 < 3) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspeed.java b/Essentials/src/com/earth2me/essentials/commands/Commandspeed.java index f4bc6e597..ce361e786 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandspeed.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandspeed.java @@ -1,10 +1,10 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import java.util.List; import org.bukkit.Server; -import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -16,7 +16,7 @@ public class Commandspeed extends EssentialsCommand } @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) { @@ -53,7 +53,7 @@ public class Commandspeed extends EssentialsCommand { throw new PlayerNotFoundException(); } - speedOtherPlayers(server, user.getBase(), isFly, isBypass, speed, args[2]); + speedOtherPlayers(server, user.getSource(), isFly, isBypass, speed, args[2]); return; } } @@ -70,9 +70,9 @@ public class Commandspeed extends EssentialsCommand } } - private void speedOtherPlayers(final Server server, final CommandSender sender, final boolean isFly, final boolean isBypass, final float speed, final String name) throws PlayerNotFoundException + private void speedOtherPlayers(final Server server, final CommandSource sender, final boolean isFly, final boolean isBypass, final float speed, final String name) 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; final List<Player> matchedPlayers = server.matchPlayer(name); for (Player matchPlayer : matchedPlayers) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java b/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java index 7067eef4a..61e31c1a3 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java @@ -1,12 +1,12 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import java.util.Locale; import java.util.logging.Level; import java.util.logging.Logger; import org.bukkit.Server; -import org.bukkit.command.CommandSender; import org.bukkit.command.PluginCommand; import org.bukkit.entity.Player; @@ -20,7 +20,7 @@ public class Commandsudo extends EssentialsCommand private static final Logger LOGGER = Logger.getLogger("Minecraft"); @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) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java b/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java index dc9bc67c0..f2d39929a 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java @@ -1,12 +1,12 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.Console; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import com.earth2me.essentials.utils.DateUtil; import java.util.GregorianCalendar; import org.bukkit.Server; -import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -18,7 +18,7 @@ public class Commandtempban extends EssentialsCommand } @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) { @@ -27,8 +27,8 @@ public class Commandtempban extends EssentialsCommand final User user = getPlayer(server, args, 0, true, true); if (!user.isOnline()) { - if (sender instanceof Player - && !ess.getUser(sender).isAuthorized("essentials.tempban.offline")) + if (sender.isPlayer() + && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.tempban.offline")) { sender.sendMessage(_("tempbanExempt")); return; @@ -47,13 +47,13 @@ public class Commandtempban extends EssentialsCommand final long maxBanLength = ess.getSettings().getMaxTempban() * 1000; if (maxBanLength > 0 && ((banTimestamp - GregorianCalendar.getInstance().getTimeInMillis()) > maxBanLength) - && sender instanceof Player && !(ess.getUser(sender).isAuthorized("essentials.tempban.unlimited"))) + && sender.isPlayer() && !(ess.getUser(sender.getPlayer()).isAuthorized("essentials.tempban.unlimited"))) { sender.sendMessage(_("oversizedTempban")); throw new NoChargeException(); } - final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME; + final String senderName = sender.isPlayer() ? sender.getPlayer().getDisplayName() : Console.NAME; final String banReason = _("tempBanned", DateUtil.formatDateDiff(banTimestamp), senderName); user.setBanReason(banReason); user.setBanTimeout(banTimestamp); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtime.java b/Essentials/src/com/earth2me/essentials/commands/Commandtime.java index b0099ada5..e29be16f5 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtime.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtime.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import com.earth2me.essentials.utils.DescParseTickFormat; @@ -7,7 +8,6 @@ import com.earth2me.essentials.utils.NumberUtil; import java.util.*; import org.bukkit.Server; import org.bukkit.World; -import org.bukkit.command.CommandSender; public class Commandtime extends EssentialsCommand @@ -18,7 +18,7 @@ public class Commandtime extends EssentialsCommand } @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 add = false; final List<String> argList = new ArrayList<String>(Arrays.asList(args)); @@ -59,11 +59,12 @@ public class Commandtime extends EssentialsCommand return; } } - else { + else + { setTime = validArgs[0]; } - final User user = ess.getUser(sender); + final User user = ess.getUser(sender.getPlayer()); if (user != null && !user.isAuthorized("essentials.time.set")) { user.sendMessage(_("timeSetPermission")); @@ -87,7 +88,7 @@ public class Commandtime extends EssentialsCommand /** * Used to get the time and inform */ - private void getWorldsTime(final CommandSender sender, final Collection<World> worlds) + private void getWorldsTime(final CommandSource sender, final Collection<World> worlds) { if (worlds.size() == 1) { @@ -105,7 +106,7 @@ public class Commandtime extends EssentialsCommand /** * Used to set the time and inform of the change */ - private void setWorldsTime(final CommandSender sender, final Collection<World> worlds, final long ticks, final boolean add) + private void setWorldsTime(final CommandSource sender, final Collection<World> worlds, final long ticks, final boolean add) { // Update the time for (World world : worlds) @@ -135,21 +136,22 @@ public class Commandtime extends EssentialsCommand /** * Used to parse an argument of the type "world(s) selector" */ - private Set<World> getWorlds(final Server server, final CommandSender sender, final String selector) throws Exception + private Set<World> getWorlds(final Server server, final CommandSource sender, final String selector) throws Exception { final Set<World> worlds = new TreeSet<World>(new WorldNameComparator()); // If there is no selector we want the world the user is currently in. Or all worlds if it isn't a user. if (selector == null) { - final User user = ess.getUser(sender); - if (user == null) + if (sender.isPlayer()) { - worlds.addAll(server.getWorlds()); + + final User user = ess.getUser(sender.getPlayer()); + worlds.add(user.getWorld()); } else { - worlds.add(user.getWorld()); + worlds.addAll(server.getWorlds()); } return worlds; } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java b/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java index 4aed22fd1..ba1f0f3a2 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java @@ -1,11 +1,10 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import com.earth2me.essentials.utils.DateUtil; import org.bukkit.Server; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; public class Commandtogglejail extends EssentialsCommand @@ -16,7 +15,7 @@ public class Commandtogglejail extends EssentialsCommand } @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) { @@ -29,8 +28,8 @@ public class Commandtogglejail extends EssentialsCommand { if (!player.isOnline()) { - if (sender instanceof Player - && !ess.getUser(sender).isAuthorized("essentials.togglejail.offline")) + if (sender.isPlayer() + && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.togglejail.offline")) { sender.sendMessage(_("mayNotJail")); return; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtp.java b/Essentials/src/com/earth2me/essentials/commands/Commandtp.java index fc2c1302c..119e45f5d 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtp.java @@ -1,12 +1,12 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.Console; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; import org.bukkit.Location; import org.bukkit.Server; -import org.bukkit.command.CommandSender; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; @@ -92,7 +92,7 @@ public class Commandtp extends EssentialsCommand } @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) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpaall.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpaall.java index 03672ddd5..689fdcc57 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpaall.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpaall.java @@ -1,9 +1,9 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import org.bukkit.Server; -import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -15,13 +15,13 @@ public class Commandtpaall extends EssentialsCommand } @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 (sender instanceof Player) + if (sender.isPlayer()) { - teleportAAllPlayers(server, sender, ess.getUser(sender)); + teleportAAllPlayers(server, sender, ess.getUser(sender.getPlayer())); return; } throw new NotEnoughArgumentsException(); @@ -31,7 +31,7 @@ public class Commandtpaall extends EssentialsCommand teleportAAllPlayers(server, sender, target); } - private void teleportAAllPlayers(final Server server, final CommandSender sender, final User target) + private void teleportAAllPlayers(final Server server, final CommandSource sender, final User target) { sender.sendMessage(_("teleportAAll")); for (Player onlinePlayer : server.getOnlinePlayers()) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java index 39fd58550..65930cca2 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java @@ -69,7 +69,7 @@ public class Commandtpaccept extends EssentialsCommand catch (Exception ex) { user.sendMessage(_("pendingTeleportCancelled")); - ess.showError(requester.getBase(), ex, commandLabel); + ess.showError(requester.getSource(), ex, commandLabel); } user.requestTeleport(null, false); throw new NoChargeException(); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java index 1b9ca7553..74a0136e7 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java @@ -1,9 +1,9 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import org.bukkit.Server; -import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; @@ -16,13 +16,13 @@ public class Commandtpall extends EssentialsCommand } @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 (sender instanceof Player) + if (sender.isPlayer()) { - teleportAllPlayers(server, sender, ess.getUser(sender)); + teleportAllPlayers(server, sender, ess.getUser(sender.getPlayer())); return; } throw new NotEnoughArgumentsException(); @@ -32,7 +32,7 @@ public class Commandtpall extends EssentialsCommand teleportAllPlayers(server, sender, target); } - private void teleportAllPlayers(Server server, CommandSender sender, User target) + private void teleportAllPlayers(Server server, CommandSource sender, User target) { sender.sendMessage(_("teleportAll")); for (Player onlinePlayer : server.getOnlinePlayers()) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java b/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java index b1a41fc4c..2b8ce49e3 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java @@ -1,11 +1,11 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; import org.bukkit.Location; import org.bukkit.Server; -import org.bukkit.command.CommandSender; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; @@ -48,7 +48,7 @@ public class Commandtppos extends EssentialsCommand } @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 < 4) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtptoggle.java b/Essentials/src/com/earth2me/essentials/commands/Commandtptoggle.java index 7d8028353..442f53554 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtptoggle.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtptoggle.java @@ -1,9 +1,9 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import org.bukkit.Server; -import org.bukkit.command.CommandSender; public class Commandtptoggle extends EssentialsToggleCommand @@ -14,7 +14,7 @@ public class Commandtptoggle extends EssentialsToggleCommand } @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); } @@ -27,25 +27,25 @@ public class Commandtptoggle extends EssentialsToggleCommand Boolean toggle = matchToggleArgument(args[0]); if (toggle == null && user.isAuthorized(othersPermission)) { - toggleOtherPlayers(server, user.getBase(), args); + toggleOtherPlayers(server, user.getSource(), args); } else { - togglePlayer(user.getBase(), user, toggle); + togglePlayer(user.getSource(), user, toggle); } } else if (args.length == 2 && user.isAuthorized(othersPermission)) { - toggleOtherPlayers(server, user.getBase(), args); + toggleOtherPlayers(server, user.getSource(), args); } else { - togglePlayer(user.getBase(), user, null); + togglePlayer(user.getSource(), user, null); } } @Override - void togglePlayer(CommandSender sender, User user, Boolean enabled) + void togglePlayer(CommandSource sender, User user, Boolean enabled) { if (enabled == null) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandunban.java b/Essentials/src/com/earth2me/essentials/commands/Commandunban.java index 49ddd0b97..eeb60985d 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandunban.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandunban.java @@ -1,13 +1,12 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.Console; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import java.util.logging.Level; import org.bukkit.OfflinePlayer; import org.bukkit.Server; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; public class Commandunban extends EssentialsCommand @@ -18,7 +17,7 @@ public class Commandunban extends EssentialsCommand } @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) { @@ -43,7 +42,7 @@ public class Commandunban extends EssentialsCommand player.setBanned(false); } - 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, _("playerUnbanned", senderName, name)); ess.broadcastMessage("essentials.ban.notify", _("playerUnbanned", senderName, name)); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java b/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java index 8d6c5909d..c3de1b48e 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java @@ -1,13 +1,12 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.Console; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import com.earth2me.essentials.utils.FormatUtil; import java.util.logging.Level; import org.bukkit.Server; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; public class Commandunbanip extends EssentialsCommand @@ -18,7 +17,7 @@ public class Commandunbanip extends EssentialsCommand } @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) { @@ -49,7 +48,7 @@ public class Commandunbanip extends EssentialsCommand } ess.getServer().unbanIP(ipAddress); - 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, _("playerUnbanIpAddress", senderName, ipAddress)); ess.broadcastMessage("essentials.ban.notify", _("playerUnbanIpAddress", senderName, ipAddress)); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandvanish.java b/Essentials/src/com/earth2me/essentials/commands/Commandvanish.java index c44563325..588c17883 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandvanish.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandvanish.java @@ -1,9 +1,9 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import org.bukkit.Server; -import org.bukkit.command.CommandSender; public class Commandvanish extends EssentialsToggleCommand @@ -14,7 +14,7 @@ public class Commandvanish extends EssentialsToggleCommand } @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); } @@ -27,25 +27,25 @@ public class Commandvanish extends EssentialsToggleCommand Boolean toggle = matchToggleArgument(args[0]); if (toggle == null && user.isAuthorized(othersPermission)) { - toggleOtherPlayers(server, user.getBase(), args); + toggleOtherPlayers(server, user.getSource(), args); } else { - togglePlayer(user.getBase(), user, toggle); + togglePlayer(user.getSource(), user, toggle); } } else if (args.length == 2 && user.isAuthorized(othersPermission)) { - toggleOtherPlayers(server, user.getBase(), args); + toggleOtherPlayers(server, user.getSource(), args); } else { - togglePlayer(user.getBase(), user, null); + togglePlayer(user.getSource(), user, null); } } @Override - void togglePlayer(CommandSender sender, User user, Boolean enabled) throws NotEnoughArgumentsException + void togglePlayer(CommandSource sender, User user, Boolean enabled) throws NotEnoughArgumentsException { if (enabled == null) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java b/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java index 430c36220..501aca36c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; @@ -13,7 +14,6 @@ import java.util.List; import java.util.Locale; import net.ess3.api.IUser; import org.bukkit.Server; -import org.bukkit.command.CommandSender; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; @@ -35,7 +35,7 @@ public class Commandwarp extends EssentialsCommand { throw new Exception(_("warpListPermission")); } - warpList(user.getBase(), args, user); + warpList(user.getSource(), args, user); throw new NoChargeException(); } if (args.length > 0) @@ -54,7 +54,7 @@ public class Commandwarp extends EssentialsCommand } @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 || NumberUtil.isInt(args[0])) { @@ -68,7 +68,7 @@ public class Commandwarp extends EssentialsCommand } //TODO: Use one of the new text classes, like /help ? - private void warpList(final CommandSender sender, final String[] args, final IUser user) throws Exception + private void warpList(final CommandSource sender, final String[] args, final IUser user) throws Exception { final IWarps warps = ess.getWarps(); if (warps.isEmpty()) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandweather.java b/Essentials/src/com/earth2me/essentials/commands/Commandweather.java index dc9f767d5..e193a4913 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandweather.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandweather.java @@ -1,10 +1,10 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import org.bukkit.Server; import org.bukkit.World; -import org.bukkit.command.CommandSender; public class Commandweather extends EssentialsCommand @@ -60,7 +60,7 @@ public class Commandweather extends EssentialsCommand //TODO: Translate these @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) //running from console means inserting a world arg before other args { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java b/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java index b89a4d7f7..4d4b5df7a 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import com.earth2me.essentials.craftbukkit.SetExpFix; @@ -7,8 +8,6 @@ import com.earth2me.essentials.utils.DateUtil; import com.earth2me.essentials.utils.NumberUtil; import java.util.Locale; import org.bukkit.Server; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; public class Commandwhois extends EssentialsCommand @@ -19,7 +18,7 @@ public class Commandwhois extends EssentialsCommand } @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) { @@ -42,7 +41,7 @@ public class Commandwhois extends EssentialsCommand sender.sendMessage(_("whoisIPAddress", user.getAddress().getAddress().toString())); final String location = user.getGeoLocation(); if (location != null - && (sender instanceof Player ? ess.getUser(sender).isAuthorized("essentials.geoip.show") : true)) + && (sender.isPlayer() ? ess.getUser(sender.getPlayer()).isAuthorized("essentials.geoip.show") : true)) { sender.sendMessage(_("whoisGeoLocation", location)); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandworth.java b/Essentials/src/com/earth2me/essentials/commands/Commandworth.java index fa2e106f7..eeea2d7e3 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandworth.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandworth.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import com.earth2me.essentials.utils.NumberUtil; @@ -7,7 +8,6 @@ import java.math.BigDecimal; import java.util.List; import java.util.Locale; import org.bukkit.Server; -import org.bukkit.command.CommandSender; import org.bukkit.inventory.ItemStack; @@ -35,7 +35,7 @@ public class Commandworth extends EssentialsCommand { if (stack.getAmount() > 0) { - totalWorth = totalWorth.add(itemWorth(user.getBase(), user, stack, args)); + totalWorth = totalWorth.add(itemWorth(user.getSource(), user, stack, args)); stack = stack.clone(); count++; for (ItemStack zeroStack : is) @@ -70,7 +70,7 @@ public class Commandworth extends EssentialsCommand } @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 type = ""; if (args.length < 1) @@ -83,7 +83,7 @@ public class Commandworth extends EssentialsCommand itemWorth(sender, null, stack, args); } - private BigDecimal itemWorth(CommandSender sender, User user, ItemStack is, String[] args) throws Exception + private BigDecimal itemWorth(CommandSource sender, User user, ItemStack is, String[] args) throws Exception { int amount = 1; if (user == null) diff --git a/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java b/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java index b3005d869..ccb348a57 100644 --- a/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java +++ b/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java @@ -9,7 +9,6 @@ import java.util.logging.Logger; import net.ess3.api.IEssentials; import org.bukkit.Server; import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -44,11 +43,11 @@ public abstract class EssentialsCommand implements IEssentialsCommand } // Get online players - only show vanished if source has permission - protected User getPlayer(final Server server, final CommandSender sender, final String[] args, final int pos) throws PlayerNotFoundException, NotEnoughArgumentsException + protected User getPlayer(final Server server, final CommandSource sender, final String[] args, final int pos) throws PlayerNotFoundException, NotEnoughArgumentsException { - if (sender instanceof Player) + if (sender.isPlayer()) { - User user = ess.getUser(sender); + User user = ess.getUser(sender.getPlayer()); return getPlayer(server, user, args, pos); } return getPlayer(server, args, pos, true, false); @@ -153,16 +152,16 @@ public abstract class EssentialsCommand implements IEssentialsCommand protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { - run(server, (CommandSender)(user.getBase()), commandLabel, args); + run(server, user.getSource(), commandLabel, args); } @Override - public final void run(final Server server, final CommandSender sender, final String commandLabel, final Command cmd, final String[] args) throws Exception + public final void run(final Server server, final CommandSource sender, final String commandLabel, final Command cmd, final String[] args) throws Exception { run(server, sender, commandLabel, args); } - 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 { throw new Exception(_("onlyPlayers", commandLabel)); } diff --git a/Essentials/src/com/earth2me/essentials/commands/EssentialsLoopCommand.java b/Essentials/src/com/earth2me/essentials/commands/EssentialsLoopCommand.java index 854385f04..2a7ebddde 100644 --- a/Essentials/src/com/earth2me/essentials/commands/EssentialsLoopCommand.java +++ b/Essentials/src/com/earth2me/essentials/commands/EssentialsLoopCommand.java @@ -1,10 +1,10 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.ChargeException; +import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.User; import java.util.List; import org.bukkit.Server; -import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -15,7 +15,7 @@ public abstract class EssentialsLoopCommand extends EssentialsCommand super(command); } - protected void loopOfflinePlayers(final Server server, final CommandSender sender, final boolean multipleStringMatches, final String searchTerm, final String[] commandArgs) + protected void loopOfflinePlayers(final Server server, final CommandSource sender, final boolean multipleStringMatches, final String searchTerm, final String[] commandArgs) throws PlayerNotFoundException, NotEnoughArgumentsException, PlayerExemptException, ChargeException { if (searchTerm.isEmpty()) @@ -33,7 +33,7 @@ public abstract class EssentialsLoopCommand extends EssentialsCommand } else if (searchTerm.contentEquals("*")) { - boolean skipHidden = sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.vanish.interact"); + boolean skipHidden = sender.isPlayer() && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.vanish.interact"); for (Player onlinePlayer : server.getOnlinePlayers()) { final User onlineUser = ess.getUser(onlinePlayer); @@ -69,7 +69,7 @@ public abstract class EssentialsLoopCommand extends EssentialsCommand } } - protected void loopOnlinePlayers(final Server server, final CommandSender sender, final boolean multipleStringMatches, final String searchTerm, final String[] commandArgs) + protected void loopOnlinePlayers(final Server server, final CommandSource sender, final boolean multipleStringMatches, final String searchTerm, final String[] commandArgs) throws PlayerNotFoundException, NotEnoughArgumentsException, PlayerExemptException, ChargeException { if (searchTerm.isEmpty()) @@ -77,7 +77,7 @@ public abstract class EssentialsLoopCommand extends EssentialsCommand throw new 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"); if (searchTerm.contentEquals("**") || searchTerm.contentEquals("*")) { @@ -121,6 +121,6 @@ public abstract class EssentialsLoopCommand extends EssentialsCommand } } - protected abstract void updatePlayer(Server server, CommandSender sender, User user, String[] args) + protected abstract void updatePlayer(Server server, CommandSource sender, User user, String[] args) throws NotEnoughArgumentsException, PlayerExemptException, ChargeException; } diff --git a/Essentials/src/com/earth2me/essentials/commands/EssentialsToggleCommand.java b/Essentials/src/com/earth2me/essentials/commands/EssentialsToggleCommand.java index 8bc4cb91e..062441dda 100644 --- a/Essentials/src/com/earth2me/essentials/commands/EssentialsToggleCommand.java +++ b/Essentials/src/com/earth2me/essentials/commands/EssentialsToggleCommand.java @@ -1,9 +1,9 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.User; import java.util.List; import org.bukkit.Server; -import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -30,14 +30,14 @@ public abstract class EssentialsToggleCommand extends EssentialsCommand return null; } - protected void toggleOtherPlayers(final Server server, final CommandSender sender, final String[] args) throws PlayerNotFoundException, NotEnoughArgumentsException + protected void toggleOtherPlayers(final Server server, final CommandSource sender, final String[] args) throws PlayerNotFoundException, NotEnoughArgumentsException { if (args.length < 1 || args[0].trim().length() < 2) { throw new 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; final List<Player> matchedPlayers = server.matchPlayer(args[0]); for (Player matchPlayer : matchedPlayers) @@ -72,5 +72,5 @@ public abstract class EssentialsToggleCommand extends EssentialsCommand } // Make sure when implementing this method that all 3 Boolean states are handled, 'null' should toggle the existing state. - abstract void togglePlayer(CommandSender sender, User user, Boolean enabled) throws NotEnoughArgumentsException; + abstract void togglePlayer(CommandSource sender, User user, Boolean enabled) throws NotEnoughArgumentsException; } diff --git a/Essentials/src/com/earth2me/essentials/commands/IEssentialsCommand.java b/Essentials/src/com/earth2me/essentials/commands/IEssentialsCommand.java index 4a946d814..1eb241888 100644 --- a/Essentials/src/com/earth2me/essentials/commands/IEssentialsCommand.java +++ b/Essentials/src/com/earth2me/essentials/commands/IEssentialsCommand.java @@ -1,11 +1,11 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.IEssentialsModule; import com.earth2me.essentials.User; import net.ess3.api.IEssentials; import org.bukkit.Server; import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; public interface IEssentialsCommand @@ -15,7 +15,7 @@ public interface IEssentialsCommand void run(Server server, User user, String commandLabel, Command cmd, String[] args) throws Exception; - void run(Server server, CommandSender sender, String commandLabel, Command cmd, String[] args) + void run(Server server, CommandSource sender, String commandLabel, Command cmd, String[] args) throws Exception; void setEssentials(IEssentials ess); diff --git a/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java b/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java index a0e862730..482b66fcb 100644 --- a/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java +++ b/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java @@ -51,11 +51,11 @@ public class EssentialsSign } catch (ChargeException ex) { - ess.showError(user.getBase(), ex, signName); + ess.showError(user.getSource(), ex, signName); } catch (SignException ex) { - ess.showError(user.getBase(), ex, signName); + ess.showError(user.getSource(), ex, signName); } // Return true, so the player sees the wrong sign. return true; @@ -97,12 +97,12 @@ public class EssentialsSign } catch (ChargeException ex) { - ess.showError(user.getBase(), ex, signName); + ess.showError(user.getSource(), ex, signName); return false; } catch (SignException ex) { - ess.showError(user.getBase(), ex, signName); + ess.showError(user.getSource(), ex, signName); return false; } } @@ -119,7 +119,7 @@ public class EssentialsSign } catch (SignException ex) { - ess.showError(user.getBase(), ex, signName); + ess.showError(user.getSource(), ex, signName); return false; } } @@ -148,11 +148,11 @@ public class EssentialsSign } catch (ChargeException ex) { - ess.showError(user.getBase(), ex, signName); + ess.showError(user.getSource(), ex, signName); } catch (SignException ex) { - ess.showError(user.getBase(), ex, signName); + ess.showError(user.getSource(), ex, signName); } return false; } @@ -166,11 +166,11 @@ public class EssentialsSign } catch (ChargeException ex) { - ess.showError(user.getBase(), ex, signName); + ess.showError(user.getSource(), ex, signName); } catch (SignException ex) { - ess.showError(user.getBase(), ex, signName); + ess.showError(user.getSource(), ex, signName); } return false; } @@ -184,7 +184,7 @@ public class EssentialsSign } catch (SignException ex) { - ess.showError(user.getBase(), ex, signName); + ess.showError(user.getSource(), ex, signName); } return false; } diff --git a/Essentials/src/com/earth2me/essentials/signs/SignInfo.java b/Essentials/src/com/earth2me/essentials/signs/SignInfo.java index 050cc3d57..9d6ef8da0 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignInfo.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignInfo.java @@ -37,10 +37,10 @@ public class SignInfo extends EssentialsSign final IText input; try { - input = new TextInput(player.getBase(), "info", true, ess); - final IText output = new KeywordReplacer(input, player.getBase(), ess); + input = new TextInput(player.getSource(), "info", true, ess); + final IText output = new KeywordReplacer(input, player.getSource(), ess); final TextPager pager = new TextPager(output); - pager.showPage(chapter, page, null, player.getBase()); + pager.showPage(chapter, page, null, player.getSource()); } catch (IOException ex) diff --git a/Essentials/src/com/earth2me/essentials/signs/SignSpawnmob.java b/Essentials/src/com/earth2me/essentials/signs/SignSpawnmob.java index b271b8951..4916d131b 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignSpawnmob.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignSpawnmob.java @@ -30,7 +30,7 @@ public class SignSpawnmob extends EssentialsSign { List<String> mobParts = SpawnMob.mobParts(sign.getLine(2)); List<String> mobData = SpawnMob.mobData(sign.getLine(2)); - SpawnMob.spawnmob(ess, ess.getServer(), player.getBase(), player, mobParts, mobData, Integer.parseInt(sign.getLine(1))); + SpawnMob.spawnmob(ess, ess.getServer(), player.getSource(), player, mobParts, mobData, Integer.parseInt(sign.getLine(1))); } catch (Exception ex) { diff --git a/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java b/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java index b8c1a13a3..def72e2ae 100644 --- a/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java +++ b/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.textreader; +import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.ExecuteTimer; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.PlayerList; @@ -24,7 +25,6 @@ import java.util.regex.Pattern; import net.ess3.api.IEssentials; import org.bukkit.Location; import org.bukkit.World; -import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; @@ -40,7 +40,7 @@ public class KeywordReplacer implements IText private final static Pattern KEYWORDSPLIT = Pattern.compile("\\:"); private final EnumMap<KeywordType, Object> keywordCache = new EnumMap<KeywordType, Object>(KeywordType.class); - public KeywordReplacer(final IText input, final CommandSender sender, final IEssentials ess) + public KeywordReplacer(final IText input, final CommandSource sender, final IEssentials ess) { this.input = input; this.replaced = new ArrayList<String>(this.input.getLines().size()); @@ -49,7 +49,7 @@ public class KeywordReplacer implements IText replaceKeywords(sender); } - public KeywordReplacer(final IText input, final CommandSender sender, final IEssentials ess, final boolean showPrivate) + public KeywordReplacer(final IText input, final CommandSource sender, final IEssentials ess, final boolean showPrivate) { this.input = input; this.replaced = new ArrayList<String>(this.input.getLines().size()); @@ -58,14 +58,14 @@ public class KeywordReplacer implements IText replaceKeywords(sender); } - private void replaceKeywords(final CommandSender sender) + private void replaceKeywords(final CommandSource sender) { execTimer = new ExecuteTimer(); execTimer.start(); User user = null; - if (sender instanceof Player) + if (sender.isPlayer()) { - user = ess.getUser(sender); + user = ess.getUser(sender.getPlayer()); //This is just so any displayname lookups below show the correct nickname user.setDisplayNick(); } @@ -122,8 +122,9 @@ public class KeywordReplacer implements IText } } } - - if (validKeyword.isPrivate() && !includePrivate) { + + if (validKeyword.isPrivate() && !includePrivate) + { replacer = ""; } @@ -199,10 +200,12 @@ public class KeywordReplacer implements IText else { final boolean showHidden; - if (user == null) { + if (user == null) + { showHidden = true; } - else { + else + { showHidden = user.isAuthorized("essentials.list.hidden") || user.isAuthorized("essentials.vanish.interact"); } @@ -381,10 +384,9 @@ enum KeywordType ADDRESS(KeywordCachable.CACHEABLE, true), PLUGINS(KeywordCachable.CACHEABLE, true), VERSION(KeywordCachable.CACHEABLE, true); - private final KeywordCachable type; private final boolean isPrivate; - + KeywordType(KeywordCachable type) { this.type = type; @@ -401,12 +403,14 @@ enum KeywordType { return type; } - - public boolean isPrivate() { + + public boolean isPrivate() + { return isPrivate; } } + enum KeywordCachable { CACHEABLE, // This keyword can be cached as a string diff --git a/Essentials/src/com/earth2me/essentials/textreader/SimpleTextPager.java b/Essentials/src/com/earth2me/essentials/textreader/SimpleTextPager.java index 5376abbd2..2556201f1 100644 --- a/Essentials/src/com/earth2me/essentials/textreader/SimpleTextPager.java +++ b/Essentials/src/com/earth2me/essentials/textreader/SimpleTextPager.java @@ -1,8 +1,7 @@ package com.earth2me.essentials.textreader; +import com.earth2me.essentials.CommandSource; import java.util.List; -import org.bukkit.command.CommandSender; - public class SimpleTextPager { @@ -13,7 +12,7 @@ public class SimpleTextPager this.text = text; } - public void showPage(final CommandSender sender) + public void showPage(final CommandSource sender) { for (String line : text.getLines()) { diff --git a/Essentials/src/com/earth2me/essentials/textreader/TextInput.java b/Essentials/src/com/earth2me/essentials/textreader/TextInput.java index 7d3bb02cf..f375a3072 100644 --- a/Essentials/src/com/earth2me/essentials/textreader/TextInput.java +++ b/Essentials/src/com/earth2me/essentials/textreader/TextInput.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.textreader; +import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.User; import com.earth2me.essentials.utils.FormatUtil; import com.earth2me.essentials.utils.StringUtil; @@ -7,8 +8,6 @@ import java.io.*; import java.lang.ref.SoftReference; import java.util.*; import net.ess3.api.IEssentials; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; public class TextInput implements IText @@ -19,13 +18,13 @@ public class TextInput implements IText private final transient long lastChange; private final static HashMap<String, SoftReference<TextInput>> cache = new HashMap<String, SoftReference<TextInput>>(); - public TextInput(final CommandSender sender, final String filename, final boolean createFile, final IEssentials ess) throws IOException + public TextInput(final CommandSource sender, final String filename, final boolean createFile, final IEssentials ess) throws IOException { File file = null; - if (sender instanceof Player) + if (sender.isPlayer()) { - final User user = ess.getUser(sender); + final User user = ess.getUser(sender.getPlayer()); file = new File(ess.getDataFolder(), filename + "_" + StringUtil.sanitizeFileName(user.getName()) + ".txt"); if (!file.exists()) { @@ -78,7 +77,8 @@ public class TextInput implements IText { String[] titles = line.substring(1).trim().replace(" ", "_").split(","); chapters.add(FormatUtil.replaceFormat(titles[0])); - for (String title : titles) { + for (String title : titles) + { bookmarks.put(FormatUtil.stripEssentialsFormat(title.toLowerCase(Locale.ENGLISH)), lineNumber); } } diff --git a/Essentials/src/com/earth2me/essentials/textreader/TextPager.java b/Essentials/src/com/earth2me/essentials/textreader/TextPager.java index b07e0b233..d2f18984f 100644 --- a/Essentials/src/com/earth2me/essentials/textreader/TextPager.java +++ b/Essentials/src/com/earth2me/essentials/textreader/TextPager.java @@ -1,11 +1,11 @@ package com.earth2me.essentials.textreader; +import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.I18n; import static com.earth2me.essentials.I18n._; import java.util.List; import java.util.Locale; import java.util.Map; -import org.bukkit.command.CommandSender; public class TextPager @@ -24,7 +24,7 @@ public class TextPager this.onePage = onePage; } - public void showPage(final String pageStr, final String chapterPageStr, final String commandName, final CommandSender sender) + public void showPage(final String pageStr, final String chapterPageStr, final String commandName, final CommandSource sender) { List<String> lines = text.getLines(); List<String> chapters = text.getChapters(); diff --git a/Essentials/test/com/earth2me/essentials/ToggleTest.java b/Essentials/test/com/earth2me/essentials/ToggleTest.java index e5555e9fc..e66d7a9c7 100644 --- a/Essentials/test/com/earth2me/essentials/ToggleTest.java +++ b/Essentials/test/com/earth2me/essentials/ToggleTest.java @@ -64,7 +64,7 @@ public class ToggleTest extends TestCase { cmd = (IEssentialsCommand)Essentials.class.getClassLoader().loadClass("com.earth2me.essentials.commands.Command" + command).newInstance(); cmd.setEssentials(ess); - cmd.run(server, sender, command, null, args); + cmd.run(server, new CommandSource(sender), command, null, args); } catch (NoChargeException ex) { diff --git a/EssentialsAntiBuild/EssentialsAntiBuild.iml b/EssentialsAntiBuild/EssentialsAntiBuild.iml new file mode 100644 index 000000000..df12eff90 --- /dev/null +++ b/EssentialsAntiBuild/EssentialsAntiBuild.iml @@ -0,0 +1,27 @@ +<?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" /> + <excludeFolder url="file://$MODULE_DIR$/target" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + <orderEntry type="module" module-name="Essentials" /> + <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" 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> + diff --git a/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java index 7f5acd56f..c81a38ab2 100644 --- a/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java +++ b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java @@ -151,7 +151,7 @@ public class EssentialsAntiBuildListener implements Listener final Entity entity = event.getRemover(); if (entity instanceof Player) { - final User user = ess.getUser(entity); + final User user = ess.getUser((Player)entity); final EntityType type = event.getEntity().getType(); final boolean warn = ess.getSettings().warnOnBuildDisallow(); if (prot.getSettingBool(AntiBuildConfig.disable_build) && !user.canBuild() && !user.isAuthorized("essentials.build")) @@ -259,7 +259,7 @@ public class EssentialsAntiBuildListener implements Listener if (entity instanceof Player) { - final User user = ess.getUser(entity); + final User user = ess.getUser((Player)entity); final ItemStack item = event.getRecipe().getResult(); if (prot.getSettingBool(AntiBuildConfig.disable_use) && !user.canBuild() && !user.isAuthorized("essentials.build")) diff --git a/EssentialsChat/EssentialsChat.iml b/EssentialsChat/EssentialsChat.iml new file mode 100644 index 000000000..df12eff90 --- /dev/null +++ b/EssentialsChat/EssentialsChat.iml @@ -0,0 +1,27 @@ +<?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" /> + <excludeFolder url="file://$MODULE_DIR$/target" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + <orderEntry type="module" module-name="Essentials" /> + <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" 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> + diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java index 7fff85ff8..78b9d1a7f 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java +++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java @@ -82,7 +82,7 @@ public abstract class EssentialsChatPlayer implements Listener } catch (ChargeException e) { - ess.showError(chatStore.getUser().getBase(), e, chatStore.getLongType()); + ess.showError(chatStore.getUser().getSource(), e, chatStore.getLongType()); event.setCancelled(true); return false; } diff --git a/EssentialsGeoIP/EssentialsGeoIP.iml b/EssentialsGeoIP/EssentialsGeoIP.iml new file mode 100644 index 000000000..df12eff90 --- /dev/null +++ b/EssentialsGeoIP/EssentialsGeoIP.iml @@ -0,0 +1,27 @@ +<?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" /> + <excludeFolder url="file://$MODULE_DIR$/target" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + <orderEntry type="module" module-name="Essentials" /> + <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" 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> + diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java index d8657fef5..1336f3e07 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java @@ -37,7 +37,12 @@ public class EssentialsProtectEntityListener implements Listener return;
}
- final User user = ess.getUser(target);
+ User user = null;
+ if (target instanceof Player)
+ {
+ user = ess.getUser((Player)target);
+ }
+
final DamageCause cause = event.getCause();
if (event instanceof EntityDamageByBlockEvent)
@@ -69,7 +74,12 @@ public class EssentialsProtectEntityListener implements Listener {
final EntityDamageByEntityEvent edEvent = (EntityDamageByEntityEvent)event;
final Entity eAttack = edEvent.getDamager();
- final User attacker = ess.getUser(eAttack);
+
+ User attacker = null;
+ if (eAttack instanceof Player)
+ {
+ attacker = ess.getUser((Player)eAttack);
+ }
//Creeper explode prevention
if (eAttack instanceof Creeper
@@ -126,7 +136,7 @@ public class EssentialsProtectEntityListener implements Listener || (((Projectile)edEvent.getDamager()).getShooter() instanceof Player
&& prot.getSettingBool(ProtectConfig.disable_pvp)
&& (!user.isAuthorized("essentials.protect.pvp")
- || !ess.getUser(((Projectile)edEvent.getDamager()).getShooter()).isAuthorized("essentials.protect.pvp")))))
+ || !ess.getUser((Player)((Projectile)edEvent.getDamager()).getShooter()).isAuthorized("essentials.protect.pvp")))))
{
event.setCancelled(true);
return;
@@ -275,7 +285,7 @@ public class EssentialsProtectEntityListener implements Listener {
return;
}
- final User user = ess.getUser(event.getTarget());
+ final User user = ess.getUser((Player)event.getTarget());
if ((event.getReason() == TargetReason.CLOSEST_PLAYER
|| event.getReason() == TargetReason.TARGET_ATTACKED_ENTITY
|| event.getReason() == TargetReason.PIG_ZOMBIE_TARGET
diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java index 35edd172c..2317e774c 100644 --- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java +++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.spawn; +import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.Console; import com.earth2me.essentials.Trade; @@ -9,7 +10,6 @@ import com.earth2me.essentials.commands.NoChargeException; import com.earth2me.essentials.commands.NotEnoughArgumentsException; import org.bukkit.Location; import org.bukkit.Server; -import org.bukkit.command.CommandSender; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; @@ -43,7 +43,7 @@ public class Commandspawn extends EssentialsCommand } @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) { diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java index 6fcabe6e0..668294970 100644 --- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java +++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java @@ -108,7 +108,7 @@ public class EssentialsSpawnPlayerListener implements Listener //This method allows for multiple line player announce messages using multiline yaml syntax #EasterEgg if (ess.getSettings().getAnnounceNewPlayers()) { - final IText output = new KeywordReplacer(ess.getSettings().getAnnounceNewPlayerFormat(), user.getBase(), ess); + final IText output = new KeywordReplacer(ess.getSettings().getAnnounceNewPlayerFormat(), user.getSource(), ess); final SimpleTextPager pager = new SimpleTextPager(output); for (String line : pager.getLines()) diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmpp.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmpp.java index e7dd01670..529b4a1c2 100644 --- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmpp.java +++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmpp.java @@ -1,10 +1,10 @@ package com.earth2me.essentials.xmpp; +import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.Console; import com.earth2me.essentials.commands.EssentialsCommand; import com.earth2me.essentials.commands.NotEnoughArgumentsException; import org.bukkit.Server; -import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -16,7 +16,7 @@ public class Commandxmpp extends EssentialsCommand } @Override - protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws NotEnoughArgumentsException + protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws NotEnoughArgumentsException { if (args.length < 2) { @@ -31,7 +31,7 @@ public class Commandxmpp extends EssentialsCommand else { final String message = getFinalArg(args, 1); - final String senderName = sender instanceof Player ? ess.getUser(sender).getDisplayName() : Console.NAME; + final String senderName = sender.isPlayer() ? ess.getUser(sender.getPlayer()).getDisplayName() : Console.NAME; sender.sendMessage("[" + senderName + ">" + address + "] " + message); if (!EssentialsXMPP.getInstance().sendMessage(address, "[" + senderName + "] " + message)) { diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmppspy.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmppspy.java index 4f276c3b9..a3f8ee83e 100644 --- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmppspy.java +++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmppspy.java @@ -1,10 +1,10 @@ package com.earth2me.essentials.xmpp; +import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.commands.EssentialsCommand; import com.earth2me.essentials.commands.NotEnoughArgumentsException; import java.util.List; import org.bukkit.Server; -import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -16,7 +16,7 @@ public class Commandxmppspy extends EssentialsCommand } @Override - protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws NotEnoughArgumentsException + protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws NotEnoughArgumentsException { if (args.length < 1) { |