diff --git a/.gitignore b/.gitignore index eda2b5917..524ed1334 100644 --- a/.gitignore +++ b/.gitignore @@ -1,42 +1,45 @@ -.DS_Store -/BuildAll/nbproject/private/ -/EssentialsProtect/nbproject/private/ -/EssentialsChat/nbproject/private/ -/EssentialsGroupBridge/nbproject/private/ -/EssentialsGeoIP/nbproject/private/ -/EssentialsSpawn/nbproject/private/ -/EssentialsXMPP/nbproject/private/ -/EssentialsGroupManager/nbproject/private/ -/BuildAll/build/ -/EssentialsGroupBridge/dist/ -/EssentialsGroupBridge/build/ -/EssentialsGeoIP/dist/ -/EssentialsGeoIP/build/ -/EssentialsGroupManager/build/ -/EssentialsGroupManager/dist/ -/BuildAll/dist/ -/EssentialsChat/build/ -/EssentialsChat/dist/ -/EssentialsSpawn/build/ -/EssentialsSpawn/dist/ -/EssentialsXMPP/dist/ -/EssentialsXMPP/build/ -/EssentialsProtect/dist/ -/EssentialsProtect/build/ -/EssentialsPermissionsCommands/nbproject/private/ -/EssentialsPermissionsCommands/build/ -/EssentialsPermissionsCommands/dist/ -/Essentials/nbproject/private/ -/Essentials/dist/ -/Essentials/build/ -/YamlAnnotations/ -/EssentialsUpdate/nbproject/private/ -/EssentialsRelease/ -/EssentialsUpdate/dist/ -/EssentialsUpdate/build/ -/WebPush/apikey.php -/WebPush/nbproject/private -/.idea +.DS_Store +/BuildAll/nbproject/private/ +/EssentialsProtect/nbproject/private/ +/EssentialsChat/nbproject/private/ +/EssentialsGroupBridge/nbproject/private/ +/EssentialsGeoIP/nbproject/private/ +/EssentialsSpawn/nbproject/private/ +/EssentialsXMPP/nbproject/private/ +/EssentialsGroupManager/nbproject/private/ +/BuildAll/build/ +/EssentialsGroupBridge/dist/ +/EssentialsGroupBridge/build/ +/EssentialsGeoIP/dist/ +/EssentialsGeoIP/build/ +/EssentialsGroupManager/build/ +/EssentialsGroupManager/dist/ +/BuildAll/dist/ +/EssentialsChat/build/ +/EssentialsChat/dist/ +/EssentialsSpawn/build/ +/EssentialsSpawn/dist/ +/EssentialsXMPP/dist/ +/EssentialsXMPP/build/ +/EssentialsProtect/dist/ +/EssentialsProtect/build/ +/EssentialsPermissionsCommands/nbproject/private/ +/EssentialsPermissionsCommands/build/ +/EssentialsPermissionsCommands/dist/ +/Essentials/nbproject/private/ +/Essentials/dist/ +/Essentials/build/ +/YamlAnnotations/ +/EssentialsUpdate/nbproject/private/ +/EssentialsRelease/ +/EssentialsUpdate/dist/ +/EssentialsUpdate/build/ +/WebPush/apikey.php +/WebPush/nbproject/private +/.idea *.iml /EssentialsGroupManager/bin -/EssentialsGroupManager/.externalToolBuilders \ No newline at end of file +/EssentialsGroupManager/.externalToolBuilders +/EssentialsAntiBuild/nbproject/private/ +/EssentialsAntiBuild/dist/ +/EssentialsAntiBuild/build/ \ No newline at end of file diff --git a/BuildAll/nbproject/build-impl.xml b/BuildAll/nbproject/build-impl.xml index 58eac422c..d52f998c1 100644 --- a/BuildAll/nbproject/build-impl.xml +++ b/BuildAll/nbproject/build-impl.xml @@ -12,9 +12,9 @@ is divided into following sections: - execution - debugging - javadoc - - test compilation - - test execution - - test debugging + - junit compilation + - junit execution + - junit debugging - applet - cleanup @@ -181,7 +181,6 @@ is divided into following sections: - @@ -226,27 +225,6 @@ is divided into following sections: - - - - - - - - - - - - - - - - - - - - - @@ -379,52 +357,11 @@ is divided into following sections: - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - @@ -433,270 +370,32 @@ is divided into following sections: + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - No tests executed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - + @@ -728,13 +427,10 @@ is divided into following sections: - + Must set JVM to use for profiling in profiler.info.jvm Must set profiler agent JVM arguments in profiler.info.jvmargs.agent - @@ -792,7 +488,6 @@ is divided into following sections: - @@ -809,7 +504,6 @@ is divided into following sections: - @@ -817,7 +511,6 @@ is divided into following sections: - @@ -844,9 +537,6 @@ is divided into following sections: - - - @@ -892,7 +582,7 @@ is divided into following sections: - + - - - This target only works when run from inside the NetBeans IDE. + @@ -1176,9 +869,8 @@ is divided into following sections: - + Must select one file in the IDE or set profile.class - This target only works when run from inside the NetBeans IDE. @@ -1186,8 +878,12 @@ is divided into following sections: - - This target only works when run from inside the NetBeans IDE. + + @@ -1199,8 +895,12 @@ is divided into following sections: - - This target only works when run from inside the NetBeans IDE. + + @@ -1222,42 +922,6 @@ is divided into following sections: - - - - - - - - - - - - - - - Must select one file in the IDE or set run.class - - - - - - Must select some files in the IDE or set test.includes - - - - - Must select one file in the IDE or set run.class - - - - - Must select one file in the IDE or set applet.url - - - @@ -1344,14 +1008,14 @@ is divided into following sections: - + Some tests failed; see details above. @@ -1364,40 +1028,39 @@ is divided into following sections: Must select some files in the IDE or set test.includes - + Some tests failed; see details above. - - Must select some files in the IDE or set test.class - Must select some method in the IDE or set test.method - - - - Some tests failed; see details above. - - - + Must select one file in the IDE or set test.class - - - - Must select one file in the IDE or set test.class - Must select some method in the IDE or set test.method - + + + + + + + + + + + + + + + - @@ -1484,6 +1147,13 @@ is divided into following sections: + + + + + + + @@ -1518,12 +1188,9 @@ is divided into following sections: - - - - - - + + + diff --git a/BuildAll/nbproject/genfiles.properties b/BuildAll/nbproject/genfiles.properties index 95b41a19a..de7702440 100644 --- a/BuildAll/nbproject/genfiles.properties +++ b/BuildAll/nbproject/genfiles.properties @@ -1,8 +1,8 @@ -build.xml.data.CRC32=51b33957 +build.xml.data.CRC32=b4df970c build.xml.script.CRC32=7a797370 -build.xml.stylesheet.CRC32=28e38971@1.44.1.45 +build.xml.stylesheet.CRC32=28e38971@1.50.3.46 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=51b33957 -nbproject/build-impl.xml.script.CRC32=2a17f1e9 -nbproject/build-impl.xml.stylesheet.CRC32=6ddba6b6@1.53.1.46 +nbproject/build-impl.xml.data.CRC32=b4df970c +nbproject/build-impl.xml.script.CRC32=1fd6d3cc +nbproject/build-impl.xml.stylesheet.CRC32=fcddb364@1.50.3.46 diff --git a/BuildAll/nbproject/project.properties b/BuildAll/nbproject/project.properties index 246ea1240..2bbfdd15b 100644 --- a/BuildAll/nbproject/project.properties +++ b/BuildAll/nbproject/project.properties @@ -66,6 +66,7 @@ jar.compress=true javac.classpath=\ ${reference.Essentials.jar}:\ ${reference.EssentialsChat.jar}:\ + ${reference.EssentialsAntiBuild.jar}:\ ${reference.EssentialsProtect.jar}:\ ${reference.EssentialsSpawn.jar}:\ ${reference.EssentialsGeoIP.jar}:\ @@ -103,6 +104,7 @@ project.EssentialsChat=../EssentialsChat project.EssentialsGeoIP=../EssentialsGeoIP project.EssentialsGroupBridge=../EssentialsGroupBridge project.EssentialsGroupManager=../EssentialsGroupManager +project.EssentialsAntiBuild=../EssentialsAntiBuild project.EssentialsProtect=../EssentialsProtect project.EssentialsSpawn=../EssentialsSpawn project.EssentialsXMPP=../EssentialsXMPP @@ -111,6 +113,7 @@ reference.EssentialsChat.jar=${project.EssentialsChat}/dist/EssentialsChat.jar reference.EssentialsGeoIP.jar=${project.EssentialsGeoIP}/dist/EssentialsGeoIP.jar reference.EssentialsGroupBridge.jar=${project.EssentialsGroupBridge}/dist/EssentialsGroupBridge.jar reference.EssentialsGroupManager.jar=${project.EssentialsGroupManager}/dist/EssentialsGroupManager.jar +reference.EssentialsAntiBuild.jar=${project.EssentialsAntiBuild}/dist/EssentialsAntiBuild.jar reference.EssentialsProtect.jar=${project.EssentialsProtect}/dist/EssentialsProtect.jar reference.EssentialsSpawn.jar=${project.EssentialsSpawn}/dist/EssentialsSpawn.jar reference.EssentialsXMPP.jar=${project.EssentialsXMPP}/dist/EssentialsXMPP.jar diff --git a/BuildAll/nbproject/project.xml b/BuildAll/nbproject/project.xml index 420233ac9..7a2d6b451 100644 --- a/BuildAll/nbproject/project.xml +++ b/BuildAll/nbproject/project.xml @@ -55,6 +55,14 @@ clean jar + + EssentialsAntiBuild + jar + + jar + clean + jar + EssentialsProtect jar diff --git a/Essentials/src/com/earth2me/essentials/perm/BPermissions2Handler.java b/Essentials/src/com/earth2me/essentials/perm/BPermissions2Handler.java index f4122bf53..d8c5c9c12 100644 --- a/Essentials/src/com/earth2me/essentials/perm/BPermissions2Handler.java +++ b/Essentials/src/com/earth2me/essentials/perm/BPermissions2Handler.java @@ -44,7 +44,7 @@ public class BPermissions2Handler extends SuperpermsHandler @Override public boolean canBuild(final Player base, final String group) { - return hasPermission(base, "essentials.build") || hasPermission(base, "bPermissions.build"); + return hasPermission(base, "bPermissions.build"); } @Override diff --git a/Essentials/src/com/earth2me/essentials/perm/BPermissionsHandler.java b/Essentials/src/com/earth2me/essentials/perm/BPermissionsHandler.java index fea268f90..a542c3d66 100644 --- a/Essentials/src/com/earth2me/essentials/perm/BPermissionsHandler.java +++ b/Essentials/src/com/earth2me/essentials/perm/BPermissionsHandler.java @@ -56,7 +56,7 @@ public class BPermissionsHandler extends SuperpermsHandler @Override public boolean canBuild(final Player base, final String group) { - return hasPermission(base, "essentials.build") || hasPermission(base, "bPermissions.build"); + return hasPermission(base, "bPermissions.build"); } @Override diff --git a/Essentials/src/com/earth2me/essentials/perm/PermissionsBukkitHandler.java b/Essentials/src/com/earth2me/essentials/perm/PermissionsBukkitHandler.java index aef6401d9..315cfa363 100644 --- a/Essentials/src/com/earth2me/essentials/perm/PermissionsBukkitHandler.java +++ b/Essentials/src/com/earth2me/essentials/perm/PermissionsBukkitHandler.java @@ -78,6 +78,6 @@ public class PermissionsBukkitHandler extends SuperpermsHandler @Override public boolean canBuild(Player base, String group) { - return hasPermission(base, "essentials.build") || hasPermission(base, "permissions.build"); + return hasPermission(base, "permissions.build"); } } diff --git a/Essentials/src/com/earth2me/essentials/perm/PrivilegesHandler.java b/Essentials/src/com/earth2me/essentials/perm/PrivilegesHandler.java index 6cc97f30e..03db3502b 100644 --- a/Essentials/src/com/earth2me/essentials/perm/PrivilegesHandler.java +++ b/Essentials/src/com/earth2me/essentials/perm/PrivilegesHandler.java @@ -55,7 +55,7 @@ public class PrivilegesHandler extends SuperpermsHandler @Override public boolean canBuild(Player base, String group) { - return hasPermission(base, "essentials.build") || hasPermission(base, "privileges.build"); + return hasPermission(base, "privileges.build"); } } diff --git a/Essentials/src/com/earth2me/essentials/perm/SuperpermsHandler.java b/Essentials/src/com/earth2me/essentials/perm/SuperpermsHandler.java index 2e767cb72..aedd4c5ae 100644 --- a/Essentials/src/com/earth2me/essentials/perm/SuperpermsHandler.java +++ b/Essentials/src/com/earth2me/essentials/perm/SuperpermsHandler.java @@ -21,7 +21,7 @@ public class SuperpermsHandler implements IPermissionsHandler @Override public boolean canBuild(final Player base, final String group) { - return hasPermission(base, "essentials.build"); + return false; } @Override diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml index 617fb6677..e7813af8b 100644 --- a/Essentials/src/config.yml +++ b/Essentials/src/config.yml @@ -450,28 +450,6 @@ protect: password: 'root' mysqlDb: 'jdbc:mysql://localhost:3306/minecraft' - # For which block types would you like to be alerted? - # You can find a list of IDs in plugins/Essentials/items.csv after loading Essentials for the first time. - # 10 = lava :: 11 = still lava :: 46 = TNT :: 327 = lava bucket - alert: - on-placement: 10,11,46,327 - on-use: 327 - on-break: - - blacklist: - - # Which blocks should people be prevented from placing - placement: 10,11,46,327 - - # Which items should people be prevented from using - usage: 327 - - # Which blocks should people be prevented from breaking - break: - - # Which blocks should not be pushed by pistons - piston: - # General physics/behavior modifications prevent: lava-flow: false @@ -532,10 +510,10 @@ protect: # Protect various blocks. protect: # Protect all signs - signs: true + signs: false # Prevent users from destroying rails - rails: true + rails: false # Blocks below rails/signs are also protected if the respective rail/sign is protected. # This makes it more difficult to circumvent protection, and should be enabled. @@ -577,6 +555,20 @@ protect: # Should the damage after hit by a lightning be disabled? lightning: false + # Disable weather options + weather: + storm: false + thunder: false + lightning: false + +############################################################ +# +------------------------------------------------------+ # +# | EssentialsAntiBuild | # +# +------------------------------------------------------+ # +############################################################ + + # Disable various default physics and behaviors + # Should people with build: false in permissions be allowed to build # Set true to disable building for those people build: true @@ -587,12 +579,28 @@ protect: # Should we tell people they are not allowed to build warn-on-build-disallow: true + + # For which block types would you like to be alerted? + # You can find a list of IDs in plugins/Essentials/items.csv after loading Essentials for the first time. + # 10 = lava :: 11 = still lava :: 46 = TNT :: 327 = lava bucket + alert: + on-placement: 10,11,46,327 + on-use: 327 + on-break: - # Disable weather options - weather: - storm: false - thunder: false - lightning: false + blacklist: + + # Which blocks should people be prevented from placing + placement: 10,11,46,327 + + # Which items should people be prevented from using + usage: 327 + + # Which blocks should people be prevented from breaking + break: + + # Which blocks should not be pushed by pistons + piston: ############################################################ # +------------------------------------------------------+ # diff --git a/EssentialsAntiBuild/build.xml b/EssentialsAntiBuild/build.xml new file mode 100644 index 000000000..8cae8a7c1 --- /dev/null +++ b/EssentialsAntiBuild/build.xml @@ -0,0 +1,83 @@ + + ]> + + + + + + + + + + Builds, tests, and runs the project EssentialsAntiBuild. + + + + + + + + + + + diff --git a/EssentialsAntiBuild/nbproject/build-impl.xml b/EssentialsAntiBuild/nbproject/build-impl.xml new file mode 100644 index 000000000..fd7175255 --- /dev/null +++ b/EssentialsAntiBuild/nbproject/build-impl.xml @@ -0,0 +1,1092 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + + + + + + java -cp "${run.classpath.with.dist.jar}" ${main.class} + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + + + + + + + + Must select one file in the IDE or set profile.class + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/EssentialsAntiBuild/nbproject/genfiles.properties b/EssentialsAntiBuild/nbproject/genfiles.properties new file mode 100644 index 000000000..61188645c --- /dev/null +++ b/EssentialsAntiBuild/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=ff207988 +build.xml.script.CRC32=1ed11cc3 +build.xml.stylesheet.CRC32=28e38971@1.38.3.45 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=ddb4519c +nbproject/build-impl.xml.script.CRC32=cfb9443d +nbproject/build-impl.xml.stylesheet.CRC32=fcddb364@1.50.3.46 diff --git a/EssentialsAntiBuild/nbproject/project.properties b/EssentialsAntiBuild/nbproject/project.properties new file mode 100644 index 000000000..10fe0db04 --- /dev/null +++ b/EssentialsAntiBuild/nbproject/project.properties @@ -0,0 +1,123 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=false +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +application.title=EssentialsAntiBuild +application.vendor= +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs=true +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width=2 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.spaces-per-tab=2 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.tab-size=2 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=120 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-line-wrap=none +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=project +auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineAnnotationArgs=true +auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineArrayInit=true +auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineAssignment=true +auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineBinaryOp=true +auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineCallArgs=true +auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineDisjunctiveCatchTypes=true +auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineFor=true +auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineImplements=true +auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineMethodParams=true +auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineParenthesized=true +auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineTernaryOp=true +auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineThrows=true +auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineTryResources=true +auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.blankLinesAfterClassHeader=0 +auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.blankLinesBeforeClass=2 +auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.classDeclBracePlacement=NEW_LINE +auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.expand-tabs=false +auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.importGroupsOrder=* +auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indent-shift-width=4 +auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indentCasesFromSwitch=false +auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement=NEW_LINE +auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.otherBracePlacement=NEW_LINE +auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeCatchOnNewLine=true +auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeElseOnNewLine=true +auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeFinallyOnNewLine=true +auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeWhileOnNewLine=true +auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.separateImportGroups=false +auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceAfterTypeCast=false +auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaces-per-tab=4 +auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.tab-size=4 +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/original-EssentialsAntiBuild.jar +dist.javadoc.dir=${dist.dir}/javadoc +endorsed.classpath= +excludes= +file.reference.bukkit.jar=../lib/bukkit.jar +includes=** +jar.archive.disabled=${jnlp.enabled} +jar.compress=true +jar.index=${jnlp.enabled} +javac.classpath=\ + ${reference.Essentials.jar}:\ + ${file.reference.bukkit.jar} +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.processorpath=\ + ${javac.classpath} +javac.source=1.6 +javac.target=1.6 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir}:\ + ${libs.junit_4.10.classpath} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +jnlp.codebase.type=no.codebase +jnlp.descriptor=application +jnlp.enabled=false +jnlp.mixed.code=defaut +jnlp.offline-allowed=false +jnlp.signed=false +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +mkdist.disabled=true +platform.active=default_platform +project.Essentials=../Essentials +reference.Essentials.jar=${project.Essentials}/dist/Essentials.jar +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value +# or test-sys-prop.name=value to set system properties for unit tests): +run.jvmargs= +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +source.encoding=UTF-8 +src.dir=src +test.src.dir=test diff --git a/EssentialsAntiBuild/nbproject/project.xml b/EssentialsAntiBuild/nbproject/project.xml new file mode 100644 index 000000000..931bed5ea --- /dev/null +++ b/EssentialsAntiBuild/nbproject/project.xml @@ -0,0 +1,28 @@ + + + org.netbeans.modules.java.j2seproject + + + EssentialsAntiBuild + + + + + + + + + ../lib/nblibraries.properties + + + + Essentials + jar + + jar + clean + jar + + + + diff --git a/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/AntiBuildConfig.java b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/AntiBuildConfig.java new file mode 100644 index 000000000..1aa33d02a --- /dev/null +++ b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/AntiBuildConfig.java @@ -0,0 +1,73 @@ +package com.earth2me.essentials.antibuild; + + +public enum AntiBuildConfig +{ + disable_build("protect.disable.build", true), + disable_use("protect.disable.use", true), + alert_on_placement("protect.alert.on-placement"), + alert_on_use("protect.alert.on-use"), + alert_on_break("protect.alert.on-break"), + blacklist_placement("protect.blacklist.placement"), + blacklist_usage("protect.blacklist.usage"), + blacklist_break("protect.blacklist.break"), + blacklist_piston("protect.blacklist.piston"); + private final String configName; + private final String defValueString; + private final boolean defValueBoolean; + private final boolean isList; + private final boolean isString; + + private AntiBuildConfig(final String configName) + { + this(configName, null, false, true, false); + } + + private AntiBuildConfig(final String configName, final boolean defValueBoolean) + { + this(configName, null, defValueBoolean, false, false); + } + + private AntiBuildConfig(final String configName, final String defValueString, final boolean defValueBoolean, final boolean isList, final boolean isString) + { + this.configName = configName; + this.defValueString = defValueString; + this.defValueBoolean = defValueBoolean; + this.isList = isList; + this.isString = isString; + } + + /** + * @return the configName + */ + public String getConfigName() + { + return configName; + } + + /** + * @return the default value String + */ + public String getDefaultValueString() + { + return defValueString; + } + + /** + * @return the default value boolean + */ + public boolean getDefaultValueBoolean() + { + return defValueBoolean; + } + + public boolean isString() + { + return isString; + } + + public boolean isList() + { + return isList; + } +} diff --git a/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuild.java b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuild.java new file mode 100644 index 000000000..c7b2eb7dd --- /dev/null +++ b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuild.java @@ -0,0 +1,65 @@ +package com.earth2me.essentials.antibuild; + +import java.util.EnumMap; +import java.util.List; +import java.util.Map; +import java.util.logging.Logger; +import org.bukkit.plugin.Plugin; +import org.bukkit.plugin.PluginManager; +import org.bukkit.plugin.java.JavaPlugin; + + +public class EssentialsAntiBuild extends JavaPlugin implements IAntiBuild +{ + private static final Logger LOGGER = Logger.getLogger("Minecraft"); + private final transient Map settingsBoolean = new EnumMap(AntiBuildConfig.class); + private final transient Map> settingsList = new EnumMap>(AntiBuildConfig.class); + private transient EssentialsConnect ess = null; + + @Override + public void onEnable() + { + final PluginManager pm = this.getServer().getPluginManager(); + final Plugin essPlugin = pm.getPlugin("Essentials"); + if (essPlugin == null || !essPlugin.isEnabled()) + { + return; + } + ess = new EssentialsConnect(essPlugin, this); + + final EssentialsAntiBuildListener blockListener = new EssentialsAntiBuildListener(this); + pm.registerEvents(blockListener, this); + } + + @Override + public boolean checkProtectionItems(final AntiBuildConfig list, final int id) + { + final List itemList = settingsList.get(list); + return itemList != null && !itemList.isEmpty() && itemList.contains(id); + } + + @Override + public EssentialsConnect getEssentialsConnect() + { + return ess; + } + + @Override + public Map getSettingsBoolean() + { + return settingsBoolean; + } + + @Override + public Map> getSettingsList() + { + return settingsList; + } + + @Override + public boolean getSettingBool(final AntiBuildConfig protectConfig) + { + final Boolean bool = settingsBoolean.get(protectConfig); + return bool == null ? protectConfig.getDefaultValueBoolean() : bool; + } +} diff --git a/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java new file mode 100644 index 000000000..9ce4f58f6 --- /dev/null +++ b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java @@ -0,0 +1,215 @@ +package com.earth2me.essentials.antibuild; + +import static com.earth2me.essentials.I18n._; +import com.earth2me.essentials.IEssentials; +import com.earth2me.essentials.User; +import java.util.logging.Level; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.event.Event.Result; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.block.*; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; + + +public class EssentialsAntiBuildListener implements Listener +{ + final private transient IAntiBuild prot; + final private transient IEssentials ess; + + public EssentialsAntiBuildListener(final IAntiBuild parent) + { + this.prot = parent; + this.ess = prot.getEssentialsConnect().getEssentials(); + } + + private boolean metaPermCheck(User user, String action, Block block) + { + if (block == null) + { + return false; + } + return metaPermCheck(user, action, block.getTypeId(), block.getData()); + } + + private boolean metaPermCheck(User user, String action, int blockId, byte data) + { + final String blockPerm = "essentials.build." + action + "." + blockId; + final String dataPerm = blockPerm + ":" + data; + + if (user.isPermissionSet(dataPerm)) + { + return user.isAuthorized(dataPerm); + } + else + { + if (ess.getSettings().isDebug()) + { + ess.getLogger().log(Level.INFO, "abort checking if " + user.getName() + " has " + dataPerm + " - not directly set"); + } + } + + return user.isAuthorized(blockPerm); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void onBlockPlace(final BlockPlaceEvent event) + { + if (event.isCancelled()) + { + return; + } + + final User user = ess.getUser(event.getPlayer()); + + if (prot.getSettingBool(AntiBuildConfig.disable_build) && !user.canBuild() && !user.isAuthorized("essentials.build") + && !metaPermCheck(user, "place", event.getBlock())) + { + if (ess.getSettings().warnOnBuildDisallow()) + { + user.sendMessage(_("buildAlert")); + } + event.setCancelled(true); + return; + } + + final Block blockPlaced = event.getBlockPlaced(); + final int id = blockPlaced.getTypeId(); + + if (prot.checkProtectionItems(AntiBuildConfig.blacklist_placement, id) && !user.isAuthorized("essentials.protect.exemptplacement")) + { + event.setCancelled(true); + return; + } + + if (!user.isAuthorized("essentials.protect.alerts.notrigger") + && prot.checkProtectionItems(AntiBuildConfig.alert_on_placement, id)) + { + prot.getEssentialsConnect().alert(user, blockPlaced.getType().toString(), _("alertPlaced")); + } + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void onBlockBreak(final BlockBreakEvent event) + { + if (event.isCancelled()) + { + return; + } + final User user = ess.getUser(event.getPlayer()); + + if (prot.getSettingBool(AntiBuildConfig.disable_build) && !user.canBuild() && !user.isAuthorized("essentials.build") + && !metaPermCheck(user, "break", event.getBlock())) + { + if (ess.getSettings().warnOnBuildDisallow()) + { + user.sendMessage(_("buildAlert")); + } + event.setCancelled(true); + return; + } + final Block block = event.getBlock(); + final int typeId = block.getTypeId(); + + if (prot.checkProtectionItems(AntiBuildConfig.blacklist_break, typeId) + && !user.isAuthorized("essentials.protect.exemptbreak")) + { + event.setCancelled(true); + return; + } + final Material type = block.getType(); + + if (!user.isAuthorized("essentials.protect.alerts.notrigger") + && prot.checkProtectionItems(AntiBuildConfig.alert_on_break, typeId)) + { + prot.getEssentialsConnect().alert(user, type.toString(), _("alertBroke")); + } + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void onBlockPistonExtend(BlockPistonExtendEvent event) + { + if (event.isCancelled()) + { + return; + } + for (Block block : event.getBlocks()) + { + if (prot.checkProtectionItems(AntiBuildConfig.blacklist_piston, block.getTypeId())) + { + event.setCancelled(true); + return; + } + } + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void onBlockPistonRetract(BlockPistonRetractEvent event) + { + if (event.isCancelled() || !event.isSticky()) + { + return; + } + final Block block = event.getRetractLocation().getBlock(); + if (prot.checkProtectionItems(AntiBuildConfig.blacklist_piston, block.getTypeId())) + { + event.setCancelled(true); + return; + } + } + + @EventHandler(priority = EventPriority.LOW) + public void onPlayerInteract(final PlayerInteractEvent event) + { + // Do not return if cancelled, because the interact event has 2 cancelled states. + final User user = ess.getUser(event.getPlayer()); + + if (event.hasItem() + && (event.getItem().getType() == Material.WATER_BUCKET + || event.getItem().getType() == Material.LAVA_BUCKET) + && prot.getSettingBool(AntiBuildConfig.disable_build) && !user.canBuild() && !user.isAuthorized("essentials.build")) + { + if (ess.getSettings().warnOnBuildDisallow()) + { + user.sendMessage(_("buildAlert")); + } + event.setCancelled(true); + return; + } + + final ItemStack item = event.getItem(); + if (item != null + && prot.checkProtectionItems(AntiBuildConfig.blacklist_usage, item.getTypeId()) + && !user.isAuthorized("essentials.protect.exemptusage")) + { + event.setCancelled(true); + return; + } + + if (item != null + && !user.isAuthorized("essentials.protect.alerts.notrigger") + && prot.checkProtectionItems(AntiBuildConfig.alert_on_use, item.getTypeId())) + { + prot.getEssentialsConnect().alert(user, item.getType().toString(), _("alertUsed")); + } + + if (prot.getSettingBool(AntiBuildConfig.disable_use) && !user.canBuild() && !user.isAuthorized("essentials.interact") && !user.isAuthorized("essentials.build")) + { + if (!metaPermCheck(user, "interact", event.getClickedBlock())) + { + event.setUseInteractedBlock(Result.DENY); + if (ess.getSettings().warnOnBuildDisallow()) + { + user.sendMessage(_("buildAlert")); + } + } + if (event.hasItem() && !metaPermCheck(user, "use", event.getItem().getTypeId(), event.getItem().getData().getData())) + { + event.setUseItemInHand(Result.DENY); + } + } + } +} diff --git a/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsConnect.java b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsConnect.java new file mode 100644 index 000000000..c25898f78 --- /dev/null +++ b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsConnect.java @@ -0,0 +1,80 @@ +package com.earth2me.essentials.antibuild; + +import com.earth2me.essentials.IConf; +import com.earth2me.essentials.IEssentials; +import com.earth2me.essentials.User; +import static com.earth2me.essentials.I18n._; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.plugin.Plugin; + + +public class EssentialsConnect +{ + private static final Logger LOGGER = Logger.getLogger("Minecraft"); + private final transient IEssentials ess; + private final transient IAntiBuild protect; + + public EssentialsConnect(Plugin essPlugin, Plugin essProtect) + { + if (!essProtect.getDescription().getVersion().equals(essPlugin.getDescription().getVersion())) + { + LOGGER.log(Level.WARNING, _("versionMismatchAll")); + } + ess = (IEssentials)essPlugin; + protect = (IAntiBuild)essProtect; + AntiBuildReloader pr = new AntiBuildReloader(); + pr.reloadConfig(); + ess.addReloadListener(pr); + } + + public void onDisable() + { + } + + public IEssentials getEssentials() + { + return ess; + } + + public void alert(final User user, final String item, final String type) + { + final Location loc = user.getLocation(); + final String warnMessage = _("alertFormat", user.getName(), type, item, + loc.getWorld().getName() + "," + loc.getBlockX() + "," + + loc.getBlockY() + "," + loc.getBlockZ()); + LOGGER.log(Level.WARNING, warnMessage); + for (Player p : ess.getServer().getOnlinePlayers()) + { + final User alertUser = ess.getUser(p); + if (alertUser.isAuthorized("essentials.protect.alerts")) + { + alertUser.sendMessage(warnMessage); + } + } + } + + + private class AntiBuildReloader implements IConf + { + @Override + public void reloadConfig() + { + for (AntiBuildConfig protectConfig : AntiBuildConfig.values()) + { + if (protectConfig.isList()) + { + protect.getSettingsList().put(protectConfig, ess.getSettings().getProtectList(protectConfig.getConfigName())); + } + else + { + protect.getSettingsBoolean().put(protectConfig, ess.getSettings().getProtectBoolean(protectConfig.getConfigName(), protectConfig.getDefaultValueBoolean())); + } + + } + + } + } +} diff --git a/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/IAntiBuild.java b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/IAntiBuild.java new file mode 100644 index 000000000..c7b370006 --- /dev/null +++ b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/IAntiBuild.java @@ -0,0 +1,19 @@ +package com.earth2me.essentials.antibuild; + +import java.util.List; +import java.util.Map; +import org.bukkit.plugin.Plugin; + + +public interface IAntiBuild extends Plugin +{ + boolean checkProtectionItems(final AntiBuildConfig list, final int id); + + boolean getSettingBool(final AntiBuildConfig protectConfig); + + EssentialsConnect getEssentialsConnect(); + + Map getSettingsBoolean(); + + Map> getSettingsList(); +} diff --git a/EssentialsAntiBuild/src/plugin.yml b/EssentialsAntiBuild/src/plugin.yml new file mode 100644 index 000000000..ea880af14 --- /dev/null +++ b/EssentialsAntiBuild/src/plugin.yml @@ -0,0 +1,9 @@ +# This determines the command prefix when there are conflicts (/name:home, /name:help, etc.) +name: EssentialsAntiBuild +main: com.earth2me.essentials.antibuild.EssentialsAntiBuild +# Note to developers: This next line cannot change, or the automatic versioning system will break. +version: TeamCity +website: http://www.earth2me.net:8001/ +description: Provides build protection. +authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits] +softdepend: [Essentials] \ No newline at end of file diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java index 7503c334c..e17264ca9 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java @@ -2,7 +2,6 @@ package com.earth2me.essentials.protect; import com.earth2me.essentials.IConf; import com.earth2me.essentials.IEssentials; -import com.earth2me.essentials.User; import com.earth2me.essentials.protect.data.ProtectedBlockMemory; import com.earth2me.essentials.protect.data.ProtectedBlockMySQL; import com.earth2me.essentials.protect.data.ProtectedBlockSQLite; @@ -10,8 +9,6 @@ import java.beans.PropertyVetoException; import static com.earth2me.essentials.I18n._; import java.util.logging.Level; import java.util.logging.Logger; -import org.bukkit.Location; -import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; @@ -43,23 +40,6 @@ public class EssentialsConnect return ess; } - public void alert(final User user, final String item, final String type) - { - final Location loc = user.getLocation(); - final String warnMessage = _("alertFormat", user.getName(), type, item, - loc.getWorld().getName() + "," + loc.getBlockX() + "," - + loc.getBlockY() + "," + loc.getBlockZ()); - LOGGER.log(Level.WARNING, warnMessage); - for (Player p : ess.getServer().getOnlinePlayers()) - { - final User alertUser = ess.getUser(p); - if (alertUser.isAuthorized("essentials.protect.alerts")) - { - alertUser.sendMessage(warnMessage); - } - } - } - private class ProtectReloader implements IConf { diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java index 9c257662d..06dc03656 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java @@ -73,13 +73,6 @@ public class EssentialsProtect extends JavaPlugin implements IProtect LOGGER.log(Level.SEVERE, "Essentials not installed or failed to load. Essenials Protect is in emergency mode now."); } - @Override - public boolean checkProtectionItems(final ProtectConfig list, final int id) - { - final List itemList = settingsList.get(list); - return itemList != null && !itemList.isEmpty() && itemList.contains(id); - } - @Override public IProtectedBlock getStorage() { diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java index 8e5e9cca8..bd760b0ec 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java @@ -1,6 +1,5 @@ package com.earth2me.essentials.protect; -import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.IEssentials; import com.earth2me.essentials.User; import com.earth2me.essentials.protect.data.IProtectedBlock; @@ -36,26 +35,9 @@ public class EssentialsProtectBlockListener implements Listener final User user = ess.getUser(event.getPlayer()); - if (prot.getSettingBool(ProtectConfig.disable_build) && !user.canBuild()) - { - event.setCancelled(true); - return; - } - final Block blockPlaced = event.getBlockPlaced(); final int id = blockPlaced.getTypeId(); - if (prot.checkProtectionItems(ProtectConfig.blacklist_placement, id) && !user.isAuthorized("essentials.protect.exemptplacement")) - { - event.setCancelled(true); - return; - } - - if (!user.hasPermission("essentials.protect.alerts.notrigger") - && prot.checkProtectionItems(ProtectConfig.alert_on_placement, id)) - { - prot.getEssentialsConnect().alert(user, blockPlaced.getType().toString(), _("alertPlaced")); - } final Block below = blockPlaced.getRelative(BlockFace.DOWN); if ((below.getType() == Material.RAILS || below.getType() == Material.POWERED_RAIL || below.getType() == Material.DETECTOR_RAIL) @@ -234,27 +216,11 @@ public class EssentialsProtectBlockListener implements Listener } final User user = ess.getUser(event.getPlayer()); - if (prot.getSettingBool(ProtectConfig.disable_build) && !user.canBuild()) - { - event.setCancelled(true); - return; - } final Block block = event.getBlock(); final int typeId = block.getTypeId(); - if (prot.checkProtectionItems(ProtectConfig.blacklist_break, typeId) - && !user.isAuthorized("essentials.protect.exemptbreak")) - { - event.setCancelled(true); - return; - } final Material type = block.getType(); - if (!user.hasPermission("essentials.protect.alerts.notrigger") - && prot.checkProtectionItems(ProtectConfig.alert_on_break, typeId)) - { - prot.getEssentialsConnect().alert(user, type.toString(), _("alertBroke")); - } final IProtectedBlock storage = prot.getStorage(); if (user.isAuthorized("essentials.protect.admin")) @@ -333,11 +299,6 @@ public class EssentialsProtectBlockListener implements Listener } for (Block block : event.getBlocks()) { - if (prot.checkProtectionItems(ProtectConfig.blacklist_piston, block.getTypeId())) - { - event.setCancelled(true); - return; - } if ((block.getRelative(BlockFace.UP).getType() == Material.RAILS || block.getType() == Material.RAILS || block.getRelative(BlockFace.UP).getType() == Material.POWERED_RAIL @@ -385,11 +346,6 @@ public class EssentialsProtectBlockListener implements Listener return; } final Block block = event.getRetractLocation().getBlock(); - if (prot.checkProtectionItems(ProtectConfig.blacklist_piston, block.getTypeId())) - { - event.setCancelled(true); - return; - } if ((block.getRelative(BlockFace.UP).getType() == Material.RAILS || block.getType() == Material.RAILS || block.getRelative(BlockFace.UP).getType() == Material.POWERED_RAIL diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java index 6e515e56d..393376b6f 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java @@ -3,14 +3,12 @@ package com.earth2me.essentials.protect; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.IEssentials; import com.earth2me.essentials.User; -import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.inventory.ItemStack; public class EssentialsProtectPlayerListener implements Listener @@ -30,38 +28,6 @@ public class EssentialsProtectPlayerListener implements Listener // Do not return if cancelled, because the interact event has 2 cancelled states. final User user = ess.getUser(event.getPlayer()); - if (event.hasItem() - && (event.getItem().getType() == Material.WATER_BUCKET - || event.getItem().getType() == Material.LAVA_BUCKET) - && prot.getSettingBool(ProtectConfig.disable_build) && !user.canBuild()) - { - if (ess.getSettings().warnOnBuildDisallow()) - { - user.sendMessage(_("buildAlert")); - } - event.setCancelled(true); - return; - } - - if (prot.getSettingBool(ProtectConfig.disable_use) && !user.canBuild()) - { - if (ess.getSettings().warnOnBuildDisallow()) - { - user.sendMessage(_("buildAlert")); - } - event.setCancelled(true); - return; - } - - final ItemStack item = event.getItem(); - if (item != null - && prot.checkProtectionItems(ProtectConfig.blacklist_usage, item.getTypeId()) - && !user.isAuthorized("essentials.protect.exemptusage")) - { - event.setCancelled(true); - return; - } - if (user.isAuthorized("essentials.protect.ownerinfo") && event.getAction() == Action.RIGHT_CLICK_BLOCK) { final StringBuilder stringBuilder = new StringBuilder(); @@ -82,11 +48,5 @@ public class EssentialsProtectPlayerListener implements Listener user.sendMessage(_("protectionOwner", ownerNames)); } } - if (item != null - && !user.hasPermission("essentials.protect.alerts.notrigger") - && prot.checkProtectionItems(ProtectConfig.alert_on_use, item.getTypeId())) - { - prot.getEssentialsConnect().alert(user, item.getType().toString(), _("alertUsed")); - } } } diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/IProtect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/IProtect.java index afcb6e8ce..b82481267 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/IProtect.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/IProtect.java @@ -8,8 +8,6 @@ import org.bukkit.plugin.Plugin; public interface IProtect extends Plugin { - boolean checkProtectionItems(final ProtectConfig list, final int id); - boolean getSettingBool(final ProtectConfig protectConfig); String getSettingString(final ProtectConfig protectConfig); diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java b/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java index bee8d0f4d..31141d7e7 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java @@ -10,8 +10,6 @@ public enum ProtectConfig memstore("protect.memstore", false), disable_contactdmg("protect.disable.contactdmg", false), disable_lavadmg("protect.disable.lavadmg", false), - disable_build("protect.disable.build", true), - disable_use("protect.disable.use", true), disable_pvp("protect.disable.pvp", false), disable_projectiles("protect.disable.projectiles", false), disable_fall("protect.disable.fall", false), @@ -47,14 +45,7 @@ public enum ProtectConfig protect_below_rails("protect.protect.block-below", true), protect_signs("protect.protect.signs", true), protect_against_signs("protect.protect.block-below", true), - enderdragon_fakeexplosions("protect.enderdragon-fakeexplosions", false), - alert_on_placement("protect.alert.on-placement"), - alert_on_use("protect.alert.on-use"), - alert_on_break("protect.alert.on-break"), - blacklist_placement("protect.blacklist.placement"), - blacklist_usage("protect.blacklist.usage"), - blacklist_break("protect.blacklist.break"), - blacklist_piston("protect.blacklist.piston"); + enderdragon_fakeexplosions("protect.enderdragon-fakeexplosions", false); private final String configName; private final String defValueString; private final boolean defValueBoolean; diff --git a/build.xml b/build.xml index c69c0f075..bda0fe7a3 100644 --- a/build.xml +++ b/build.xml @@ -16,6 +16,7 @@ +