summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Essentials/nb-configuration.xml28
-rw-r--r--Essentials/pom.xml204
-rw-r--r--Essentials/src/net/ess3/Essentials.java38
-rw-r--r--Essentials/src/net/ess3/EssentialsTimer.java8
-rw-r--r--Essentials/src/net/ess3/I18n.java17
-rw-r--r--Essentials/src/net/ess3/ItemDb.java8
-rw-r--r--Essentials/src/net/ess3/Jails.java4
-rw-r--r--Essentials/src/net/ess3/SpawnMob.java4
-rw-r--r--Essentials/src/net/ess3/Teleport.java9
-rw-r--r--Essentials/src/net/ess3/api/Economy.java35
-rw-r--r--Essentials/src/net/ess3/api/IComponent.java1
-rw-r--r--Essentials/src/net/ess3/api/IEssentials.java1
-rw-r--r--Essentials/src/net/ess3/api/IPlugin.java18
-rw-r--r--Essentials/src/net/ess3/api/ITeleport.java4
-rw-r--r--Essentials/src/net/ess3/api/IWarps.java2
-rw-r--r--Essentials/src/net/ess3/api/IWorth.java2
-rw-r--r--Essentials/src/net/ess3/backup/Backup.java18
-rw-r--r--Essentials/src/net/ess3/bukkit/Enchantments.java2
-rw-r--r--Essentials/src/net/ess3/bukkit/LivingEntities.java3
-rw-r--r--Essentials/src/net/ess3/commands/Commandbalancetop.java8
-rw-r--r--Essentials/src/net/ess3/commands/Commandbigtree.java9
-rw-r--r--Essentials/src/net/ess3/commands/Commanddelhome.java2
-rw-r--r--Essentials/src/net/ess3/commands/Commandenderchest.java1
-rw-r--r--Essentials/src/net/ess3/commands/Commandessentials.java2
-rw-r--r--Essentials/src/net/ess3/commands/Commandfireball.java14
-rw-r--r--Essentials/src/net/ess3/commands/Commandgamemode.java2
-rw-r--r--Essentials/src/net/ess3/commands/Commandgive.java2
-rw-r--r--Essentials/src/net/ess3/commands/Commandhome.java2
-rw-r--r--Essentials/src/net/ess3/commands/Commanditem.java2
-rw-r--r--Essentials/src/net/ess3/commands/Commandmore.java5
-rw-r--r--Essentials/src/net/ess3/commands/Commandmute.java4
-rw-r--r--Essentials/src/net/ess3/commands/Commandrecipe.java3
-rw-r--r--Essentials/src/net/ess3/commands/Commandseen.java14
-rw-r--r--Essentials/src/net/ess3/commands/Commandsell.java4
-rw-r--r--Essentials/src/net/ess3/commands/Commandsethome.java6
-rw-r--r--Essentials/src/net/ess3/commands/Commandsetwarp.java1
-rw-r--r--Essentials/src/net/ess3/commands/Commandsocialspy.java1
-rw-r--r--Essentials/src/net/ess3/commands/Commandspawner.java2
-rw-r--r--Essentials/src/net/ess3/commands/Commandspawnmob.java1
-rw-r--r--Essentials/src/net/ess3/commands/Commandspeed.java1
-rw-r--r--Essentials/src/net/ess3/commands/Commandtpaccept.java2
-rw-r--r--Essentials/src/net/ess3/commands/Commandtptoggle.java1
-rw-r--r--Essentials/src/net/ess3/commands/Commandwhois.java12
-rw-r--r--Essentials/src/net/ess3/commands/Commandworth.java16
-rw-r--r--Essentials/src/net/ess3/commands/EssentialsCommand.java12
-rw-r--r--Essentials/src/net/ess3/commands/EssentialsCommandHandler.java18
-rw-r--r--Essentials/src/net/ess3/commands/EssentialsSettingsCommand.java2
-rw-r--r--Essentials/src/net/ess3/commands/EssentialsToggleCommand.java1
-rw-r--r--Essentials/src/net/ess3/commands/WarpNotFoundException.java2
-rw-r--r--Essentials/src/net/ess3/converter/EnumConverter.java12
-rw-r--r--Essentials/src/net/ess3/craftbukkit/InventoryWorkaround.java3
-rw-r--r--Essentials/src/net/ess3/economy/Money.java2
-rw-r--r--Essentials/src/net/ess3/economy/Trade.java13
-rw-r--r--Essentials/src/net/ess3/economy/Worth.java2
-rw-r--r--Essentials/src/net/ess3/economy/register/Method.java26
-rw-r--r--Essentials/src/net/ess3/economy/register/Methods.java9
-rw-r--r--Essentials/src/net/ess3/economy/register/methods/BOSE7.java6
-rw-r--r--Essentials/src/net/ess3/economy/register/methods/iCo5.java6
-rw-r--r--Essentials/src/net/ess3/economy/register/methods/iCo6.java6
-rw-r--r--Essentials/src/net/ess3/listener/EssentialsBlockListener.java2
-rw-r--r--Essentials/src/net/ess3/listener/EssentialsEntityListener.java4
-rw-r--r--Essentials/src/net/ess3/listener/EssentialsPlayerListener.java175
-rw-r--r--Essentials/src/net/ess3/listener/EssentialsPluginListener.java9
-rw-r--r--Essentials/src/net/ess3/metrics/MetricsListener.java6
-rw-r--r--Essentials/src/net/ess3/metrics/MetricsStarter.java7
-rw-r--r--Essentials/src/net/ess3/permissions/BasePermission.java1
-rw-r--r--Essentials/src/net/ess3/permissions/Permissions.java3
-rw-r--r--Essentials/src/net/ess3/ranks/GMGroups.java4
-rw-r--r--Essentials/src/net/ess3/ranks/Ranks.java9
-rw-r--r--Essentials/src/net/ess3/settings/Backup.java18
-rw-r--r--Essentials/src/net/ess3/settings/Chat.java22
-rw-r--r--Essentials/src/net/ess3/settings/Commands.java20
-rw-r--r--Essentials/src/net/ess3/settings/Economy.java21
-rw-r--r--Essentials/src/net/ess3/settings/General.java51
-rw-r--r--Essentials/src/net/ess3/settings/Kits.java3
-rw-r--r--Essentials/src/net/ess3/settings/Settings.java50
-rw-r--r--Essentials/src/net/ess3/settings/SettingsHolder.java2
-rw-r--r--Essentials/src/net/ess3/settings/Spawns.java24
-rw-r--r--Essentials/src/net/ess3/settings/SpawnsHolder.java10
-rw-r--r--Essentials/src/net/ess3/settings/WorldOptions.java1
-rw-r--r--Essentials/src/net/ess3/settings/Worlds.java1
-rw-r--r--Essentials/src/net/ess3/settings/antibuild/Alert.java5
-rw-r--r--Essentials/src/net/ess3/settings/antibuild/AntiBuild.java24
-rw-r--r--Essentials/src/net/ess3/settings/antibuild/BlackList.java29
-rw-r--r--Essentials/src/net/ess3/settings/commands/Afk.java23
-rw-r--r--Essentials/src/net/ess3/settings/commands/Back.java8
-rw-r--r--Essentials/src/net/ess3/settings/commands/Help.java12
-rw-r--r--Essentials/src/net/ess3/settings/commands/Home.java10
-rw-r--r--Essentials/src/net/ess3/settings/commands/List.java1
-rw-r--r--Essentials/src/net/ess3/settings/commands/SocialSpy.java1
-rw-r--r--Essentials/src/net/ess3/settings/commands/Speed.java11
-rw-r--r--Essentials/src/net/ess3/settings/commands/Teleport.java19
-rw-r--r--Essentials/src/net/ess3/settings/protect/Prevent.java7
-rw-r--r--Essentials/src/net/ess3/settings/protect/Protect.java10
-rw-r--r--Essentials/src/net/ess3/storage/AbstractDelayedYamlFileReader.java4
-rw-r--r--Essentials/src/net/ess3/storage/AbstractDelayedYamlFileWriter.java4
-rw-r--r--Essentials/src/net/ess3/storage/AsyncStorageObjectHolder.java14
-rw-r--r--Essentials/src/net/ess3/storage/BukkitConstructor.java6
-rw-r--r--Essentials/src/net/ess3/storage/ManagedFile.java2
-rw-r--r--Essentials/src/net/ess3/storage/StorageObjectMap.java10
-rw-r--r--Essentials/src/net/ess3/storage/StorageQueue.java2
-rw-r--r--Essentials/src/net/ess3/storage/YamlStorageReader.java8
-rw-r--r--Essentials/src/net/ess3/storage/YamlStorageWriter.java8
-rw-r--r--Essentials/src/net/ess3/user/CooldownException.java2
-rw-r--r--Essentials/src/net/ess3/user/IOfflinePlayer.java1
-rw-r--r--Essentials/src/net/ess3/user/IOfflineUser.java1
-rw-r--r--Essentials/src/net/ess3/user/PlayerNotFoundException.java1
-rw-r--r--Essentials/src/net/ess3/user/User.java23
-rw-r--r--Essentials/src/net/ess3/user/UserData.java9
-rw-r--r--Essentials/src/net/ess3/user/UserMap.java1
-rw-r--r--Essentials/src/net/ess3/utils/DateUtil.java10
-rw-r--r--Essentials/src/net/ess3/utils/ExecuteTimer.java5
-rw-r--r--Essentials/src/net/ess3/utils/FormatUtil.java18
-rw-r--r--Essentials/src/net/ess3/utils/LocationUtil.java5
-rw-r--r--Essentials/src/net/ess3/utils/Target.java1
-rw-r--r--Essentials/src/net/ess3/utils/Util.java4
-rw-r--r--Essentials/src/net/ess3/utils/gnu/inet/encoding/Punycode.java38
-rw-r--r--Essentials/src/net/ess3/utils/gnu/inet/encoding/PunycodeException.java25
-rw-r--r--Essentials/src/net/ess3/utils/textreader/ArrayListInput.java3
-rw-r--r--Essentials/src/net/ess3/utils/textreader/HelpInput.java10
-rw-r--r--Essentials/src/net/ess3/utils/textreader/KeywordReplacer.java12
-rw-r--r--Essentials/src/net/ess3/utils/textreader/SimpleTextInput.java3
-rw-r--r--Essentials/src/net/ess3/utils/textreader/SimpleTextPager.java2
-rw-r--r--Essentials/src/net/ess3/utils/textreader/TextInput.java8
-rw-r--r--Essentials/src/net/ess3/utils/textreader/TextPager.java4
-rw-r--r--Essentials/test/net/ess3/EssentialsTest.java12
-rw-r--r--Essentials/test/net/ess3/StorageTest.java48
-rw-r--r--Essentials/test/net/ess3/UserTest.java73
-rw-r--r--Essentials/test/net/ess3/UtilTest.java1
-rw-r--r--Essentials2Compat/pom.xml30
-rw-r--r--Essentials2Compat/src/com/earth2me/essentials/Economy.java30
-rw-r--r--Essentials2Compat/src/com/earth2me/essentials/EssentialsConf.java6
-rw-r--r--Essentials2Compat/src/com/earth2me/essentials/ISettings.java2
-rw-r--r--Essentials2Compat/src/com/earth2me/essentials/Settings.java74
-rw-r--r--Essentials2Compat/src/com/earth2me/essentials/UpdateUserFiles.java1
-rw-r--r--Essentials2Compat/src/com/earth2me/essentials/UserData.java33
-rw-r--r--Essentials2Compat/src/com/earth2me/essentials/Util.java3
-rw-r--r--EssentialsAntiBuild/pom.xml30
-rw-r--r--EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsAntiBuild.java4
-rw-r--r--EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsAntiBuildListener.java4
-rw-r--r--EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsConnect.java4
-rw-r--r--EssentialsAntiBuild/src/net/ess3/antibuild/IAntiBuild.java1
-rw-r--r--EssentialsAntiBuild/src/net/ess3/antibuild/Permissions.java4
-rw-r--r--EssentialsChat/pom.xml30
-rw-r--r--EssentialsChat/src/net/ess3/chat/ChatStore.java6
-rw-r--r--EssentialsChat/src/net/ess3/chat/EssentialsChatPlayer.java13
-rw-r--r--EssentialsChat/src/net/ess3/chat/EssentialsLocalChatEventListener.java4
-rw-r--r--EssentialsExtra/pom.xml30
-rw-r--r--EssentialsExtra/src/net/ess3/extra/AnnotatedCommand.java3
-rw-r--r--EssentialsExtra/src/net/ess3/extra/EssentialsExtra.java5
-rw-r--r--EssentialsExtra/src/net/ess3/extra/commands/Commandkittycannon.java1
-rw-r--r--EssentialsGeoIP/src/net/ess3/geoip/ConfigHolder.java4
-rw-r--r--EssentialsGeoIP/src/net/ess3/geoip/EssentialsGeoIPPlayerListener.java10
-rw-r--r--EssentialsGroupBridge/pom.xml30
-rw-r--r--EssentialsGroupBridge/src/com/nijiko/permissions/Entry.java5
-rw-r--r--EssentialsGroupBridge/src/com/nijiko/permissions/Group.java4
-rw-r--r--EssentialsGroupBridge/src/com/nijiko/permissions/PermissionHandler.java915
-rw-r--r--EssentialsGroupBridge/src/com/nijiko/permissions/User.java5
-rw-r--r--EssentialsGroupBridge/src/com/nijikokun/bukkit/Permissions/OverrideListener.java25
-rw-r--r--EssentialsGroupBridge/src/com/nijikokun/bukkit/Permissions/Permissions.java122
-rw-r--r--EssentialsGroupBridge/src/org/anjocaido/groupmanager/permissions/NijikoPermissionsProxy.java1230
-rw-r--r--EssentialsGroupManager/pom.xml16
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java69
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/GlobalGroups.java278
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java1257
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/Tasks/BukkitPermsUpdateTask.java11
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java98
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java108
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/data/GroupVariables.java56
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java159
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/data/UserVariables.java24
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Variables.java145
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/GroupsDataHolder.java50
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/OverloadedWorldHolder.java131
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/UsersDataHolder.java44
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java874
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java473
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java51
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java40
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java51
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMWorldListener.java31
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEventHandler.java35
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java785
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java269
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/PermissionsReaderInterface.java88
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GMLoggerHandler.java17
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GroupManagerPermissions.java7
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/PermissionCheckResult.java37
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/StringPermissionComparator.java35
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/Tasks.java106
-rw-r--r--EssentialsProtect/src/net/ess3/protect/EssentialsConnect.java4
-rw-r--r--EssentialsProtect/src/net/ess3/protect/EssentialsProtect.java4
-rw-r--r--EssentialsProtect/src/net/ess3/protect/EssentialsProtectBlockListener.java2
-rw-r--r--EssentialsProtect/src/net/ess3/protect/EssentialsProtectEntityListener.java25
-rw-r--r--EssentialsProtect/src/net/ess3/protect/EssentialsProtectWeatherListener.java2
-rw-r--r--EssentialsProtect/src/net/ess3/protect/Permissions.java3
-rw-r--r--EssentialsSigns/pom.xml30
-rw-r--r--EssentialsSigns/src/net/ess3/signs/EssentialsSign.java17
-rw-r--r--EssentialsSigns/src/net/ess3/signs/EssentialsSignsPlugin.java4
-rw-r--r--EssentialsSigns/src/net/ess3/signs/SignConfig.java11
-rw-r--r--EssentialsSigns/src/net/ess3/signs/SignsConfigHolder.java2
-rw-r--r--EssentialsSigns/src/net/ess3/signs/listeners/SignBlockListener.java12
-rw-r--r--EssentialsSigns/src/net/ess3/signs/listeners/SignEntityListener.java8
-rw-r--r--EssentialsSigns/src/net/ess3/signs/listeners/SignPlayerListener.java4
-rw-r--r--EssentialsSigns/src/net/ess3/signs/signs/SignEnchant.java2
-rw-r--r--EssentialsSigns/src/net/ess3/signs/signs/SignKit.java2
-rw-r--r--EssentialsSigns/src/net/ess3/signs/signs/SignRepair.java5
-rw-r--r--EssentialsSigns/src/net/ess3/signs/signs/SignWarp.java2
-rw-r--r--EssentialsUpdate/src/net/ess3/update/AbstractWorkListener.java5
-rw-r--r--EssentialsUpdate/src/net/ess3/update/EssentialsHelp.java10
-rw-r--r--EssentialsUpdate/src/net/ess3/update/EssentialsUpdate.java4
-rw-r--r--EssentialsUpdate/src/net/ess3/update/GetFile.java4
-rw-r--r--EssentialsUpdate/src/net/ess3/update/ModuleInfo.java6
-rw-r--r--EssentialsUpdate/src/net/ess3/update/PastieUpload.java2
-rw-r--r--EssentialsUpdate/src/net/ess3/update/PostToUrl.java6
-rw-r--r--EssentialsUpdate/src/net/ess3/update/UpdateCheck.java14
-rw-r--r--EssentialsUpdate/src/net/ess3/update/UpdateFile.java6
-rw-r--r--EssentialsUpdate/src/net/ess3/update/UpdateProcess.java11
-rw-r--r--EssentialsUpdate/src/net/ess3/update/Version.java9
-rw-r--r--EssentialsUpdate/src/net/ess3/update/VersionInfo.java8
-rw-r--r--EssentialsUpdate/src/net/ess3/update/chat/AbstractFileCommand.java2
-rw-r--r--EssentialsUpdate/src/net/ess3/update/chat/ErrorsCommand.java2
-rw-r--r--EssentialsUpdate/src/net/ess3/update/chat/IrcBot.java6
-rw-r--r--EssentialsUpdate/src/net/ess3/update/chat/StartupCommand.java4
-rw-r--r--EssentialsUpdate/src/net/ess3/update/states/AbstractState.java4
-rw-r--r--EssentialsUpdate/src/net/ess3/update/states/AbstractYesNoState.java4
-rw-r--r--EssentialsUpdate/src/net/ess3/update/states/Changelog.java8
-rw-r--r--EssentialsUpdate/src/net/ess3/update/states/StateMachine.java13
-rw-r--r--EssentialsUpdate/src/net/ess3/update/states/UpdateOrInstallation.java4
-rw-r--r--EssentialsUpdate/src/net/ess3/update/tasks/InstallModule.java6
-rw-r--r--EssentialsUpdate/src/net/ess3/update/tasks/SelfUpdate.java2
-rw-r--r--EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPP.java8
-rw-r--r--EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPPPlayerListener.java2
-rw-r--r--EssentialsXMPP/src/net/ess3/xmpp/UserManager.java6
-rw-r--r--EssentialsXMPP/src/net/ess3/xmpp/XMPPManager.java22
235 files changed, 5818 insertions, 4136 deletions
diff --git a/Essentials/nb-configuration.xml b/Essentials/nb-configuration.xml
index 3486bc9d7..ee640467a 100644
--- a/Essentials/nb-configuration.xml
+++ b/Essentials/nb-configuration.xml
@@ -1,18 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-shared-configuration>
+ <!--
+ This file contains additional configuration written by modules in the NetBeans IDE.
+ The configuration is intended to be shared among all the users of project and
+ therefore it is assumed to be part of version control checkout.
+ Without this configuration present, some functionality in the IDE may be limited or fail altogether.
+ -->
+ <properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
<!--
-This file contains additional configuration written by modules in the NetBeans IDE.
-The configuration is intended to be shared among all the users of project and
-therefore it is assumed to be part of version control checkout.
-Without this configuration present, some functionality in the IDE may be limited or fail altogether.
--->
- <properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
- <!--
-Properties that influence various parts of the IDE, especially code formatting and the like.
-You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
-That way multiple projects can share the same settings (useful for formatting rules for example).
-Any value defined here will override the pom.xml file value but is only applicable to the current project.
--->
- <netbeans.compile.on.save>all</netbeans.compile.on.save>
- </properties>
+ Properties that influence various parts of the IDE, especially code formatting and the like.
+ You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
+ That way multiple projects can share the same settings (useful for formatting rules for example).
+ Any value defined here will override the pom.xml file value but is only applicable to the current project.
+ -->
+ <netbeans.compile.on.save>all</netbeans.compile.on.save>
+ </properties>
</project-shared-configuration>
diff --git a/Essentials/pom.xml b/Essentials/pom.xml
index e98a39882..50dd95bc0 100644
--- a/Essentials/pom.xml
+++ b/Essentials/pom.xml
@@ -1,108 +1,108 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>net.essentials3</groupId>
- <artifactId>BuildAll</artifactId>
- <version>3.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
+ <parent>
+ <groupId>net.essentials3</groupId>
+ <artifactId>BuildAll</artifactId>
+ <version>3.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
- <artifactId>Essentials</artifactId>
- <dependencies>
- <!-- Internal Depends -->
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>EssentialsGroupManager</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.projectlombok</groupId>
- <artifactId>lombok</artifactId>
- <version>0.11.6</version>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>2.4</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-compress</artifactId>
- <version>1.4.1</version>
- </dependency>
- <!-- Test Depends -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.10</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <version>1.9.5</version>
- <scope>test</scope>
- </dependency>
- <!-- External Plugin Depends -->
- <dependency>
- <groupId>cosine</groupId>
- <artifactId>BOSEconomy</artifactId>
- <version>0.7</version>
- </dependency>
- <dependency>
- <groupId>com.iConomy</groupId>
- <artifactId>iConomy</artifactId>
- <version>5.0</version>
- </dependency>
- <dependency>
- <groupId>com.iCo6</groupId>
- <artifactId>iConomy</artifactId>
- <version>6.0</version>
- </dependency>
- <dependency>
- <groupId>me.ashtheking</groupId>
- <artifactId>MultiCurrency</artifactId>
- <version>0.05</version>
- </dependency>
- <dependency>
- <groupId>net.milkbowl</groupId>
- <artifactId>Vault</artifactId>
- <version>1.2</version>
- </dependency>
- </dependencies>
+ <artifactId>Essentials</artifactId>
+ <dependencies>
+ <!-- Internal Depends -->
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>EssentialsGroupManager</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <version>0.11.6</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-compress</artifactId>
+ <version>1.4.1</version>
+ </dependency>
+ <!-- Test Depends -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.10</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <version>1.9.5</version>
+ <scope>test</scope>
+ </dependency>
+ <!-- External Plugin Depends -->
+ <dependency>
+ <groupId>cosine</groupId>
+ <artifactId>BOSEconomy</artifactId>
+ <version>0.7</version>
+ </dependency>
+ <dependency>
+ <groupId>com.iConomy</groupId>
+ <artifactId>iConomy</artifactId>
+ <version>5.0</version>
+ </dependency>
+ <dependency>
+ <groupId>com.iCo6</groupId>
+ <artifactId>iConomy</artifactId>
+ <version>6.0</version>
+ </dependency>
+ <dependency>
+ <groupId>me.ashtheking</groupId>
+ <artifactId>MultiCurrency</artifactId>
+ <version>0.05</version>
+ </dependency>
+ <dependency>
+ <groupId>net.milkbowl</groupId>
+ <artifactId>Vault</artifactId>
+ <version>1.2</version>
+ </dependency>
+ </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-shade-plugin</artifactId>
- <version>2.0</version>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>shade</goal>
- </goals>
- <configuration>
- <artifactSet>
- <includes>
- <include>commons-io:*</include>
- <include>org.apache.commons:*</include>
- </includes>
- </artifactSet>
- <minimizeJar>true</minimizeJar>
- <relocations>
- <relocation>
- <pattern>org.apache.commons</pattern>
- <shadedPattern>net.ess3.commons</shadedPattern>
- </relocation>
- </relocations>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <version>2.0</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ <configuration>
+ <artifactSet>
+ <includes>
+ <include>commons-io:*</include>
+ <include>org.apache.commons:*</include>
+ </includes>
+ </artifactSet>
+ <minimizeJar>true</minimizeJar>
+ <relocations>
+ <relocation>
+ <pattern>org.apache.commons</pattern>
+ <shadedPattern>net.ess3.commons</shadedPattern>
+ </relocation>
+ </relocations>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
</project>
diff --git a/Essentials/src/net/ess3/Essentials.java b/Essentials/src/net/ess3/Essentials.java
index 3bbe79411..c1c506a9b 100644
--- a/Essentials/src/net/ess3/Essentials.java
+++ b/Essentials/src/net/ess3/Essentials.java
@@ -49,34 +49,34 @@ import org.bukkit.plugin.InvalidDescriptionException;
public class Essentials implements IEssentials
{
@Getter
- private transient ISettings settings;
+ private ISettings settings;
@Getter
- private transient IJails jails;
+ private IJails jails;
@Getter
- private transient IKits kits;
+ private IKits kits;
@Getter
- private transient IWarps warps;
+ private IWarps warps;
@Getter
- private transient IWorth worth;
+ private IWorth worth;
@Getter
- private transient IBackup backup;
+ private IBackup backup;
@Getter
- private transient IItemDb itemDb;
+ private IItemDb itemDb;
@Getter
@Setter
- private transient IRanks ranks;
+ private IRanks ranks;
@Getter
- private transient SpawnsHolder spawns;
+ private SpawnsHolder spawns;
@Getter
- private transient final Methods paymentMethod = new Methods();
+ private final Methods paymentMethod = new Methods();
@Getter
- private transient IUserMap userMap;
+ private IUserMap userMap;
@Getter
private final I18n i18n;
@Getter
- private transient ICommandHandler commandHandler;
+ private ICommandHandler commandHandler;
@Getter
- private transient Economy economy;
+ private Economy economy;
@Getter
private final Server server;
@Getter
@@ -85,16 +85,16 @@ public class Essentials implements IEssentials
private final IPlugin plugin;
@Getter
@Setter
- private transient Metrics metrics;
+ private Metrics metrics;
@Getter
- private transient EssentialsTimer timer;
+ private EssentialsTimer timer;
@Getter
- private transient List<String> vanishedPlayers = new ArrayList<String>();
+ private List<String> vanishedPlayers = new ArrayList<String>();
@Getter
- private final transient StorageQueue storageQueue;
- private transient ExecuteTimer execTimer;
+ private final StorageQueue storageQueue;
+ private ExecuteTimer execTimer;
public static boolean testing;
- private transient List<IReload> reloadList;
+ private List<IReload> reloadList;
public Essentials(final Server server, final Logger logger, final IPlugin plugin)
{
diff --git a/Essentials/src/net/ess3/EssentialsTimer.java b/Essentials/src/net/ess3/EssentialsTimer.java
index 0bd902b17..58599f840 100644
--- a/Essentials/src/net/ess3/EssentialsTimer.java
+++ b/Essentials/src/net/ess3/EssentialsTimer.java
@@ -12,10 +12,10 @@ import org.bukkit.entity.Player;
public class EssentialsTimer implements Runnable
{
- private final transient IEssentials ess;
- private final transient Set<IUser> onlineUsers = new HashSet<IUser>();
- private transient long lastPoll = System.currentTimeMillis();
- private final transient LinkedList<Float> history = new LinkedList<Float>();
+ private final IEssentials ess;
+ private final Set<IUser> onlineUsers = new HashSet<IUser>();
+ private long lastPoll = System.currentTimeMillis();
+ private final LinkedList<Float> history = new LinkedList<Float>();
EssentialsTimer(final IEssentials ess)
{
diff --git a/Essentials/src/net/ess3/I18n.java b/Essentials/src/net/ess3/I18n.java
index 8f31963eb..5f1c522cd 100644
--- a/Essentials/src/net/ess3/I18n.java
+++ b/Essentials/src/net/ess3/I18n.java
@@ -19,13 +19,13 @@ public class I18n implements II18n
{
private static I18n instance;
private static final String MESSAGES = "messages";
- private final transient Locale defaultLocale = Locale.getDefault();
- private transient Locale currentLocale = defaultLocale;
- private transient ResourceBundle customBundle;
- private transient ResourceBundle localeBundle;
- private final transient ResourceBundle defaultBundle;
- private final transient Map<String, MessageFormat> messageFormatCache = new HashMap<String, MessageFormat>();
- private final transient IEssentials ess;
+ private final Locale defaultLocale = Locale.getDefault();
+ private Locale currentLocale = defaultLocale;
+ private ResourceBundle customBundle;
+ private ResourceBundle localeBundle;
+ private final ResourceBundle defaultBundle;
+ private final Map<String, MessageFormat> messageFormatCache = new HashMap<String, MessageFormat>();
+ private final IEssentials ess;
public I18n(final IEssentials ess)
{
@@ -100,7 +100,6 @@ public class I18n implements II18n
}
return messageFormat.format(objects);
}
-
private final Pattern partSplit = Pattern.compile("[_\\.]");
public void updateLocale(final String loc)
@@ -136,7 +135,7 @@ public class I18n implements II18n
private static class FileResClassLoader extends ClassLoader
{
- private final transient File dataFolder;
+ private final File dataFolder;
public FileResClassLoader(final ClassLoader classLoader, final IEssentials ess)
{
diff --git a/Essentials/src/net/ess3/ItemDb.java b/Essentials/src/net/ess3/ItemDb.java
index 7e7ca0ede..15d32a6e6 100644
--- a/Essentials/src/net/ess3/ItemDb.java
+++ b/Essentials/src/net/ess3/ItemDb.java
@@ -19,16 +19,15 @@ import org.bukkit.inventory.ItemStack;
public class ItemDb implements IItemDb
{
- private final transient IEssentials ess;
+ private final IEssentials ess;
public ItemDb(final IEssentials ess)
{
this.ess = ess;
file = new ManagedFile("items.csv", ess);
}
-
- private final transient Map<String, Long> items = new HashMap<String, Long>();
- private final transient ManagedFile file;
+ private final Map<String, Long> items = new HashMap<String, Long>();
+ private final ManagedFile file;
private static final Pattern SPLIT = Pattern.compile("[^a-zA-Z0-9]");
@Override
@@ -95,7 +94,6 @@ public class ItemDb implements IItemDb
retval.setAmount(quantity);
return retval;
}
-
private final Pattern idMatch = Pattern.compile("^\\d+[:+',;.]\\d+$");
private final Pattern metaSplit = Pattern.compile("[:+',;.]");
private final Pattern conjoined = Pattern.compile("^[^:+',;.]+[:+',;.]\\d+$");
diff --git a/Essentials/src/net/ess3/Jails.java b/Essentials/src/net/ess3/Jails.java
index 0affe3fca..f191edd81 100644
--- a/Essentials/src/net/ess3/Jails.java
+++ b/Essentials/src/net/ess3/Jails.java
@@ -30,7 +30,7 @@ import org.bukkit.plugin.PluginManager;
public class Jails extends AsyncStorageObjectHolder<net.ess3.settings.Jails> implements IJails
{
- private static final transient Logger LOGGER = Bukkit.getLogger();
+ private static final Logger LOGGER = Bukkit.getLogger();
public Jails(final IEssentials ess)
{
@@ -110,9 +110,9 @@ public class Jails extends AsyncStorageObjectHolder<net.ess3.settings.Jails> imp
throw new UnsupportedOperationException("Not supported yet.");
}
+
private class JailBlockListener implements Listener
{
-
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onBlockBreak(final BlockBreakEvent event)
{
diff --git a/Essentials/src/net/ess3/SpawnMob.java b/Essentials/src/net/ess3/SpawnMob.java
index 47cd07049..0b22569ca 100644
--- a/Essentials/src/net/ess3/SpawnMob.java
+++ b/Essentials/src/net/ess3/SpawnMob.java
@@ -25,8 +25,8 @@ import org.bukkit.material.Colorable;
public class SpawnMob
{
- private static transient Pattern colon = Pattern.compile(":");
- private static transient Pattern comma = Pattern.compile(",");
+ private static Pattern colon = Pattern.compile(":");
+ private static Pattern comma = Pattern.compile(",");
public static String mobList(final IUser user) throws NotEnoughArgumentsException
{
diff --git a/Essentials/src/net/ess3/Teleport.java b/Essentials/src/net/ess3/Teleport.java
index b97b1f58d..81afaf97f 100644
--- a/Essentials/src/net/ess3/Teleport.java
+++ b/Essentials/src/net/ess3/Teleport.java
@@ -21,7 +21,6 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
public class Teleport implements Runnable, ITeleport
{
private static final double MOVE_CONSTANT = 0.3;
-
private IUser user;
private IUser teleportUser;
private int teleTimer = -1;
@@ -75,9 +74,9 @@ public class Teleport implements Runnable, ITeleport
}
if (!Permissions.TELEPORT_TIMER_MOVE.isAuthorized(user) && (Math.round(
- teleportUser.getPlayer().getLocation().getX() * MOVE_CONSTANT) != initX || Math.round(
- teleportUser.getPlayer().getLocation().getY() * MOVE_CONSTANT) != initY || Math.round(
- teleportUser.getPlayer().getLocation().getZ() * MOVE_CONSTANT) != initZ || teleportUser.getPlayer().getHealth() < health))
+ teleportUser.getPlayer().getLocation().getX() * MOVE_CONSTANT) != initX || Math.round(
+ teleportUser.getPlayer().getLocation().getY() * MOVE_CONSTANT) != initY || Math.round(
+ teleportUser.getPlayer().getLocation().getZ() * MOVE_CONSTANT) != initZ || teleportUser.getPlayer().getHealth() < health))
{ // user moved, cancel teleport
cancel(true);
return;
@@ -123,7 +122,6 @@ public class Teleport implements Runnable, ITeleport
this.ess = ess;
}
-
public void cooldown(boolean check) throws Exception
{
try
@@ -233,7 +231,6 @@ public class Teleport implements Runnable, ITeleport
now(new Target(loc), cause);
}
-
@Override
//The now function is used when you want to skip tp delay when teleporting someone to a location or player.
public void now(Entity entity, boolean cooldown, TeleportCause cause) throws Exception
diff --git a/Essentials/src/net/ess3/api/Economy.java b/Essentials/src/net/ess3/api/Economy.java
index 046c6e1f6..19c2d8451 100644
--- a/Essentials/src/net/ess3/api/Economy.java
+++ b/Essentials/src/net/ess3/api/Economy.java
@@ -4,15 +4,13 @@ import net.ess3.utils.FormatUtil;
/**
- * Instead of using this api directly, we recommend to use the register plugin:
- * http://bit.ly/RegisterMethod
+ * Instead of using this api directly, we recommend to use the register plugin: http://bit.ly/RegisterMethod
*/
public final class Economy
{
private Economy()
{
}
-
private static IEssentials ess;
private static final String noCallBeforeLoad = "Essentials API is called before Essentials is loaded.";
@@ -35,10 +33,10 @@ public final class Economy
/**
* Sets the balance of a user
*
- * @param name Name of the user
+ * @param name Name of the user
* @param balance The balance you want to set
* @throws UserDoesNotExistException If a user by that name does not exists
- * @throws NoLoanPermittedException If the user is not allowed to have a negative balance
+ * @throws NoLoanPermittedException If the user is not allowed to have a negative balance
*/
public static void setMoney(String name, double balance) throws UserDoesNotExistException, NoLoanPermittedException
{
@@ -52,10 +50,10 @@ public final class Economy
/**
* Adds money to the balance of a user
*
- * @param name Name of the user
+ * @param name Name of the user
* @param amount The money you want to add
* @throws UserDoesNotExistException If a user by that name does not exists
- * @throws NoLoanPermittedException If the user is not allowed to have a negative balance
+ * @throws NoLoanPermittedException If the user is not allowed to have a negative balance
*/
public static void add(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException
{
@@ -66,10 +64,10 @@ public final class Economy
/**
* Substracts money from the balance of a user
*
- * @param name Name of the user
+ * @param name Name of the user
* @param amount The money you want to substract
* @throws UserDoesNotExistException If a user by that name does not exists
- * @throws NoLoanPermittedException If the user is not allowed to have a negative balance
+ * @throws NoLoanPermittedException If the user is not allowed to have a negative balance
*/
public static void subtract(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException
{
@@ -80,10 +78,10 @@ public final class Economy
/**
* Divides the balance of a user by a value
*
- * @param name Name of the user
+ * @param name Name of the user
* @param value The balance is divided by this value
* @throws UserDoesNotExistException If a user by that name does not exists
- * @throws NoLoanPermittedException If the user is not allowed to have a negative balance
+ * @throws NoLoanPermittedException If the user is not allowed to have a negative balance
*/
public static void divide(String name, double value) throws UserDoesNotExistException, NoLoanPermittedException
{
@@ -94,10 +92,10 @@ public final class Economy
/**
* Multiplies the balance of a user by a value
*
- * @param name Name of the user
+ * @param name Name of the user
* @param value The balance is multiplied by this value
* @throws UserDoesNotExistException If a user by that name does not exists
- * @throws NoLoanPermittedException If the user is not allowed to have a negative balance
+ * @throws NoLoanPermittedException If the user is not allowed to have a negative balance
*/
public static void multiply(String name, double value) throws UserDoesNotExistException, NoLoanPermittedException
{
@@ -110,7 +108,7 @@ public final class Economy
*
* @param name Name of the user
* @throws UserDoesNotExistException If a user by that name does not exists
- * @throws NoLoanPermittedException If the user is not allowed to have a negative balance
+ * @throws NoLoanPermittedException If the user is not allowed to have a negative balance
*/
public static void resetBalance(String name) throws UserDoesNotExistException, NoLoanPermittedException
{
@@ -122,7 +120,7 @@ public final class Economy
}
/**
- * @param name Name of the user
+ * @param name Name of the user
* @param amount The amount of money the user should have
* @return true, if the user has more or an equal amount of money
* @throws UserDoesNotExistException If a user by that name does not exists
@@ -133,7 +131,7 @@ public final class Economy
}
/**
- * @param name Name of the user
+ * @param name Name of the user
* @param amount The amount of money the user should have
* @return true, if the user has more money
* @throws UserDoesNotExistException If a user by that name does not exists
@@ -144,7 +142,7 @@ public final class Economy
}
/**
- * @param name Name of the user
+ * @param name Name of the user
* @param amount The amount of money the user should not have
* @return true, if the user has less money
* @throws UserDoesNotExistException If a user by that name does not exists
@@ -167,8 +165,7 @@ public final class Economy
}
/**
- * Formats the amount of money like all other Essentials functions.
- * Example: $100000 or $12345.67
+ * Formats the amount of money like all other Essentials functions. Example: $100000 or $12345.67
*
* @param amount The amount of money
* @return Formatted money
diff --git a/Essentials/src/net/ess3/api/IComponent.java b/Essentials/src/net/ess3/api/IComponent.java
index 5cdee2b16..bc30f8c37 100644
--- a/Essentials/src/net/ess3/api/IComponent.java
+++ b/Essentials/src/net/ess3/api/IComponent.java
@@ -1,5 +1,6 @@
package net.ess3.api;
+
public interface IComponent extends IReload
{
/**
diff --git a/Essentials/src/net/ess3/api/IEssentials.java b/Essentials/src/net/ess3/api/IEssentials.java
index 68d975b57..226448f24 100644
--- a/Essentials/src/net/ess3/api/IEssentials.java
+++ b/Essentials/src/net/ess3/api/IEssentials.java
@@ -66,5 +66,4 @@ public interface IEssentials extends IComponent
SpawnsHolder getSpawns();
StorageQueue getStorageQueue();
-
}
diff --git a/Essentials/src/net/ess3/api/IPlugin.java b/Essentials/src/net/ess3/api/IPlugin.java
index 8348c9490..18da574b4 100644
--- a/Essentials/src/net/ess3/api/IPlugin.java
+++ b/Essentials/src/net/ess3/api/IPlugin.java
@@ -9,7 +9,6 @@ import org.bukkit.scheduler.BukkitTask;
public interface IPlugin extends Plugin
{
-
/**
* Get an instance of essentials
*
@@ -36,7 +35,7 @@ public interface IPlugin extends Plugin
/**
* Call an a-sync task to be run with a given delay
*
- * @param run - Code to be run
+ * @param run - Code to be run
* @param delay - Long that represents how long to wait
* @return - BukkitTask for the task created
*/
@@ -45,7 +44,7 @@ public interface IPlugin extends Plugin
/**
* Schedule a sync (ran in main thread) delayed task
*
- * @param run - Code to run
+ * @param run - Code to run
* @param delay - Long that represents how long to wait
* @return - Integer of the task ID
*/
@@ -54,8 +53,8 @@ public interface IPlugin extends Plugin
/**
* Schedule a sync (in the main thread) repeating task
*
- * @param run - Code to run
- * @param delay - Delay for the first run
+ * @param run - Code to run
+ * @param delay - Delay for the first run
* @param period - Time to wait between every run after the first
* @return - int of the task ID
*/
@@ -64,8 +63,8 @@ public interface IPlugin extends Plugin
/**
* Schedule an a-sync repeating task
*
- * @param run - Code to run
- * @param delay - Delay for the first run
+ * @param run - Code to run
+ * @param delay - Delay for the first run
* @param period - Time to wait between every run after the first
* @return - int of the task ID
*/
@@ -105,8 +104,8 @@ public interface IPlugin extends Plugin
/**
* Call a re-spawn event on a player
*
- * @param player - Player to re-spawn
- * @param loc - Location to send
+ * @param player - Player to re-spawn
+ * @param loc - Location to send
* @param bedSpawn - do you use bed?
* @return - Location after event called
*/
@@ -137,5 +136,4 @@ public interface IPlugin extends Plugin
* @param module - Your plugin instance
*/
void registerModule(Plugin module);
-
}
diff --git a/Essentials/src/net/ess3/api/ITeleport.java b/Essentials/src/net/ess3/api/ITeleport.java
index a88b72071..3971cb1d7 100644
--- a/Essentials/src/net/ess3/api/ITeleport.java
+++ b/Essentials/src/net/ess3/api/ITeleport.java
@@ -12,9 +12,9 @@ public interface ITeleport
/**
* Teleport to a location now
*
- * @param loc - location to send to
+ * @param loc - location to send to
* @param cooldown - To check cooldown
- * @param cause - Why was the send caused? Use a {@link TeleportCause}
+ * @param cause - Why was the send caused? Use a {@link TeleportCause}
* @throws Exception
*/
void now(Location loc, boolean cooldown, TeleportCause cause) throws Exception;
diff --git a/Essentials/src/net/ess3/api/IWarps.java b/Essentials/src/net/ess3/api/IWarps.java
index 48bc6cd61..fa5d64ece 100644
--- a/Essentials/src/net/ess3/api/IWarps.java
+++ b/Essentials/src/net/ess3/api/IWarps.java
@@ -35,7 +35,7 @@ public interface IWarps extends IReload
* Set a warp
*
* @param name - Name of warp
- * @param loc - Location of warp
+ * @param loc - Location of warp
* @throws Exception
*/
void setWarp(String name, Location loc) throws Exception;
diff --git a/Essentials/src/net/ess3/api/IWorth.java b/Essentials/src/net/ess3/api/IWorth.java
index 1cec6b6f1..23065ab60 100644
--- a/Essentials/src/net/ess3/api/IWorth.java
+++ b/Essentials/src/net/ess3/api/IWorth.java
@@ -17,7 +17,7 @@ public interface IWorth extends IReload
* Set the price of an ItemStack
*
* @param itemStack - ItemStack to set price for
- * @param price - Price to set on item
+ * @param price - Price to set on item
*/
void setPrice(ItemStack itemStack, double price);
}
diff --git a/Essentials/src/net/ess3/backup/Backup.java b/Essentials/src/net/ess3/backup/Backup.java
index bbff922cc..8575525f4 100644
--- a/Essentials/src/net/ess3/backup/Backup.java
+++ b/Essentials/src/net/ess3/backup/Backup.java
@@ -15,11 +15,11 @@ import org.bukkit.command.CommandSender;
public class Backup implements Runnable, IBackup
{
- private transient final Server server;
- private transient final IEssentials ess;
- private transient final AtomicBoolean running = new AtomicBoolean(false);
- private transient int taskId = -1;
- private transient final AtomicBoolean active = new AtomicBoolean(false);
+ private final Server server;
+ private final IEssentials ess;
+ private final AtomicBoolean running = new AtomicBoolean(false);
+ private int taskId = -1;
+ private final AtomicBoolean active = new AtomicBoolean(false);
public Backup(final IEssentials ess)
{
@@ -60,10 +60,10 @@ public class Backup implements Runnable, IBackup
final net.ess3.settings.Backup backupSettings = settings.getData().getGeneral().getBackup();
String backupCommand = backupSettings.getCommand() == null || backupSettings.getCommand().isEmpty() ? ("NORUN") : backupSettings.getCommand();
-
+
/*if (backupCommand.equals("NORUN")) { TODO: Un-comment if you do not want commands to be run if there is no backup command
- return;
- }*/
+ return;
+ }*/
ess.getLogger().log(Level.INFO, _("backupStarted"));
@@ -82,7 +82,7 @@ public class Backup implements Runnable, IBackup
private class BackupRunner implements Runnable
{
- private final transient String command;
+ private final String command;
public BackupRunner(final String command)
{
diff --git a/Essentials/src/net/ess3/bukkit/Enchantments.java b/Essentials/src/net/ess3/bukkit/Enchantments.java
index e76adc8b5..2e54e7caf 100644
--- a/Essentials/src/net/ess3/bukkit/Enchantments.java
+++ b/Essentials/src/net/ess3/bukkit/Enchantments.java
@@ -11,11 +11,9 @@ import org.bukkit.enchantments.Enchantment;
public final class Enchantments
{
-
private Enchantments()
{
}
-
private static final Map<String, Enchantment> ENCHANTMENTS = new HashMap<String, Enchantment>();
static
diff --git a/Essentials/src/net/ess3/bukkit/LivingEntities.java b/Essentials/src/net/ess3/bukkit/LivingEntities.java
index c51285973..7057eb399 100644
--- a/Essentials/src/net/ess3/bukkit/LivingEntities.java
+++ b/Essentials/src/net/ess3/bukkit/LivingEntities.java
@@ -8,7 +8,6 @@ import org.bukkit.entity.EntityType;
public class LivingEntities
{
final private static Map<String, EntityType> entities = new HashMap<String, EntityType>();
-
final private static EnumMap<EntityType, String> entityI18n = new EnumMap<EntityType, String>(EntityType.class);
final private static EnumMap<EntityType, String> entityI18nPlural = new EnumMap<EntityType, String>(EntityType.class);
@@ -41,9 +40,9 @@ public class LivingEntities
return count == 1 ? _(entityI18n.get(type)) : _(entityI18nPlural.get(type));
}
+
public static class MobException extends Exception
{
private static final long serialVersionUID = 1L;
}
-
}
diff --git a/Essentials/src/net/ess3/commands/Commandbalancetop.java b/Essentials/src/net/ess3/commands/Commandbalancetop.java
index 1d4201224..874945cfb 100644
--- a/Essentials/src/net/ess3/commands/Commandbalancetop.java
+++ b/Essentials/src/net/ess3/commands/Commandbalancetop.java
@@ -109,7 +109,7 @@ public class Commandbalancetop extends EssentialsCommand
private class Calculator implements Runnable
{
- private final transient Viewer viewer;
+ private final Viewer viewer;
private final boolean force;
public Calculator(final Viewer viewer, final boolean force)
@@ -176,9 +176,9 @@ public class Commandbalancetop extends EssentialsCommand
private class Viewer implements Runnable
{
- private final transient CommandSender sender;
- private final transient int page;
- private final transient boolean force;
+ private final CommandSender sender;
+ private final int page;
+ private final boolean force;
public Viewer(final CommandSender sender, final int page, final boolean force)
{
diff --git a/Essentials/src/net/ess3/commands/Commandbigtree.java b/Essentials/src/net/ess3/commands/Commandbigtree.java
index 7d2b4e069..edf6eebff 100644
--- a/Essentials/src/net/ess3/commands/Commandbigtree.java
+++ b/Essentials/src/net/ess3/commands/Commandbigtree.java
@@ -10,13 +10,13 @@ import org.bukkit.TreeType;
public class Commandbigtree extends EssentialsCommand
{
- private static enum BigTree {
+ private static enum BigTree
+ {
REDWOOD(TreeType.TALL_REDWOOD),
TREE(TreeType.BIG_TREE),
JUNGLE(TreeType.JUNGLE);
-
private final TreeType bukkitType;
-
+
private BigTree(final TreeType bukkitType)
{
this.bukkitType = bukkitType;
@@ -27,9 +27,8 @@ public class Commandbigtree extends EssentialsCommand
return bukkitType;
}
}
-
private final static EnumConverter<BigTree> BIGTREE_PARSER = EnumConverter.getInstance(BigTree.class);
-
+
@Override
public void run(final IUser user, final String commandLabel, final String[] args) throws Exception
{
diff --git a/Essentials/src/net/ess3/commands/Commanddelhome.java b/Essentials/src/net/ess3/commands/Commanddelhome.java
index 133db6769..c32c390d4 100644
--- a/Essentials/src/net/ess3/commands/Commanddelhome.java
+++ b/Essentials/src/net/ess3/commands/Commanddelhome.java
@@ -10,7 +10,7 @@ import org.bukkit.command.CommandSender;
public class Commanddelhome extends EssentialsCommand
{
- private final transient Pattern colon = Pattern.compile(":");
+ private final Pattern colon = Pattern.compile(":");
@Override
protected void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception
diff --git a/Essentials/src/net/ess3/commands/Commandenderchest.java b/Essentials/src/net/ess3/commands/Commandenderchest.java
index 31d011597..85efb75f2 100644
--- a/Essentials/src/net/ess3/commands/Commandenderchest.java
+++ b/Essentials/src/net/ess3/commands/Commandenderchest.java
@@ -7,7 +7,6 @@ import org.bukkit.entity.Player;
public class Commandenderchest extends EssentialsCommand
{
-
@Override
protected void run(final IUser user, final String commandLabel, final String[] args) throws Exception
{
diff --git a/Essentials/src/net/ess3/commands/Commandessentials.java b/Essentials/src/net/ess3/commands/Commandessentials.java
index 405a3c3d1..0ed491850 100644
--- a/Essentials/src/net/ess3/commands/Commandessentials.java
+++ b/Essentials/src/net/ess3/commands/Commandessentials.java
@@ -7,7 +7,7 @@ import org.bukkit.command.CommandSender;
public class Commandessentials extends EssentialsCommand
{
- private transient int taskid; // TODO: Needed?
+ private int taskid; // TODO: Needed?
@Override
protected void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception
diff --git a/Essentials/src/net/ess3/commands/Commandfireball.java b/Essentials/src/net/ess3/commands/Commandfireball.java
index e82379086..2cc263c0f 100644
--- a/Essentials/src/net/ess3/commands/Commandfireball.java
+++ b/Essentials/src/net/ess3/commands/Commandfireball.java
@@ -13,31 +13,31 @@ public class Commandfireball extends EssentialsCommand
Class<? extends Entity> clazz = Fireball.class;
if (args.length > 0)
{
- if(args[0].equalsIgnoreCase("small"))
+ if (args[0].equalsIgnoreCase("small"))
{
clazz = SmallFireball.class;
}
- else if(args[0].equalsIgnoreCase("arrow"))
+ else if (args[0].equalsIgnoreCase("arrow"))
{
clazz = Arrow.class;
}
- else if(args[0].equalsIgnoreCase("skull"))
+ else if (args[0].equalsIgnoreCase("skull"))
{
clazz = WitherSkull.class;
}
- else if(args[0].equalsIgnoreCase("egg"))
+ else if (args[0].equalsIgnoreCase("egg"))
{
clazz = Egg.class;
}
- else if(args[0].equalsIgnoreCase("snowball"))
+ else if (args[0].equalsIgnoreCase("snowball"))
{
clazz = Snowball.class;
}
- else if(args[0].equalsIgnoreCase("expbottle"))
+ else if (args[0].equalsIgnoreCase("expbottle"))
{
clazz = ThrownExpBottle.class;
}
- else if(args[0].equalsIgnoreCase("large"))
+ else if (args[0].equalsIgnoreCase("large"))
{
clazz = LargeFireball.class;
}
diff --git a/Essentials/src/net/ess3/commands/Commandgamemode.java b/Essentials/src/net/ess3/commands/Commandgamemode.java
index 96eb7ae1f..e5fed21c0 100644
--- a/Essentials/src/net/ess3/commands/Commandgamemode.java
+++ b/Essentials/src/net/ess3/commands/Commandgamemode.java
@@ -10,7 +10,6 @@ import org.bukkit.command.CommandSender;
public class Commandgamemode extends EssentialsSettingsCommand
{
-
protected void setValue(final IUser player, GameMode value)
{
if (value == null)
@@ -124,5 +123,4 @@ public class Commandgamemode extends EssentialsSettingsCommand
}
return mode;
}
-
}
diff --git a/Essentials/src/net/ess3/commands/Commandgive.java b/Essentials/src/net/ess3/commands/Commandgive.java
index d102becfa..ce03e0930 100644
--- a/Essentials/src/net/ess3/commands/Commandgive.java
+++ b/Essentials/src/net/ess3/commands/Commandgive.java
@@ -13,7 +13,7 @@ import org.bukkit.inventory.ItemStack;
public class Commandgive extends EssentialsCommand
{
- private final transient Pattern data = Pattern.compile("[:+',;.]");
+ private final Pattern data = Pattern.compile("[:+',;.]");
@Override
protected void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception
diff --git a/Essentials/src/net/ess3/commands/Commandhome.java b/Essentials/src/net/ess3/commands/Commandhome.java
index 5781b5124..7f74e1287 100644
--- a/Essentials/src/net/ess3/commands/Commandhome.java
+++ b/Essentials/src/net/ess3/commands/Commandhome.java
@@ -15,7 +15,7 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
public class Commandhome extends EssentialsCommand
{
- private final transient Pattern colon = Pattern.compile(":");
+ private final Pattern colon = Pattern.compile(":");
@Override
public void run(final IUser user, final String commandLabel, final String[] args) throws Exception
diff --git a/Essentials/src/net/ess3/commands/Commanditem.java b/Essentials/src/net/ess3/commands/Commanditem.java
index 416bed766..df34d7eca 100644
--- a/Essentials/src/net/ess3/commands/Commanditem.java
+++ b/Essentials/src/net/ess3/commands/Commanditem.java
@@ -11,7 +11,7 @@ import org.bukkit.inventory.ItemStack;
public class Commanditem extends EssentialsCommand
{
- private final transient Pattern data = Pattern.compile("[:+',;.]");
+ private final Pattern data = Pattern.compile("[:+',;.]");
@Override
public void run(final IUser user, final String commandLabel, final String[] args) throws Exception
diff --git a/Essentials/src/net/ess3/commands/Commandmore.java b/Essentials/src/net/ess3/commands/Commandmore.java
index 3c4edf7ea..971b48dc8 100644
--- a/Essentials/src/net/ess3/commands/Commandmore.java
+++ b/Essentials/src/net/ess3/commands/Commandmore.java
@@ -24,8 +24,9 @@ public class Commandmore extends EssentialsCommand
}
else
{
- stacks = new ItemStack[]{
- player.getItemInHand()
+ stacks = new ItemStack[]
+ {
+ player.getItemInHand()
};
}
for (ItemStack stack : stacks)
diff --git a/Essentials/src/net/ess3/commands/Commandmute.java b/Essentials/src/net/ess3/commands/Commandmute.java
index 7b7d232ed..6c46d98c7 100644
--- a/Essentials/src/net/ess3/commands/Commandmute.java
+++ b/Essentials/src/net/ess3/commands/Commandmute.java
@@ -39,8 +39,8 @@ public class Commandmute extends EssentialsCommand
final boolean muted = player.getData().isMuted();
sender.sendMessage(
muted ? (muteTimestamp > 0 ? _("mutedPlayerFor", player.getPlayer().getDisplayName(), DateUtil.formatDateDiff(muteTimestamp)) : _(
- "mutedPlayer", player.getPlayer().getDisplayName())) : _(
- "unmutedPlayer", player.getPlayer().getDisplayName()));
+ "mutedPlayer", player.getPlayer().getDisplayName())) : _(
+ "unmutedPlayer", player.getPlayer().getDisplayName()));
player.sendMessage(
muted ? (muteTimestamp > 0 ? _("playerMutedFor", DateUtil.formatDateDiff(muteTimestamp)) : _("playerMuted")) : _("playerUnmuted"));
}
diff --git a/Essentials/src/net/ess3/commands/Commandrecipe.java b/Essentials/src/net/ess3/commands/Commandrecipe.java
index 69f586114..836680707 100644
--- a/Essentials/src/net/ess3/commands/Commandrecipe.java
+++ b/Essentials/src/net/ess3/commands/Commandrecipe.java
@@ -14,7 +14,6 @@ import org.bukkit.inventory.*;
public class Commandrecipe extends EssentialsCommand
{
-
@Override
public void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception
{
@@ -89,7 +88,7 @@ public class Commandrecipe extends EssentialsCommand
for (int k = 0; k < recipe.getShape()[j].length(); k++)
{
final ItemStack item = recipe.getIngredientMap().get(recipe.getShape()[j].toCharArray()[k]);
- if(item == null)
+ if (item == null)
{
continue;
}
diff --git a/Essentials/src/net/ess3/commands/Commandseen.java b/Essentials/src/net/ess3/commands/Commandseen.java
index 2851b42be..464c323ec 100644
--- a/Essentials/src/net/ess3/commands/Commandseen.java
+++ b/Essentials/src/net/ess3/commands/Commandseen.java
@@ -34,21 +34,21 @@ public class Commandseen extends EssentialsCommand
final IUser u = ess.getUserMap().matchUserExcludingHidden(args[0], getPlayerOrNull(sender));
u.setDisplayNick();
sender.sendMessage(_("seenOnline", u.getPlayer().getDisplayName(), DateUtil.formatDateDiff(u.getTimestamp(TimestampType.LOGIN))));
- if(u.getData().isAfk())
+ if (u.getData().isAfk())
{
sender.sendMessage(_("whoisAFK", _("true")));
}
- if(u.getData().isJailed())
+ if (u.getData().isJailed())
{
sender.sendMessage(_("whoisJail", u.getTimestamp(TimestampType.JAIL) > 0
- ? DateUtil.formatDateDiff(u.getTimestamp(TimestampType.JAIL))
- : _("true")));
+ ? DateUtil.formatDateDiff(u.getTimestamp(TimestampType.JAIL))
+ : _("true")));
}
- if(u.getData().isMuted())
+ if (u.getData().isMuted())
{
sender.sendMessage(_("whoisMuted", u.getTimestamp(TimestampType.MUTE) > 0
- ? DateUtil.formatDateDiff(u.getTimestamp(TimestampType.MUTE))
- : _("true")));
+ ? DateUtil.formatDateDiff(u.getTimestamp(TimestampType.MUTE))
+ : _("true")));
}
}
catch (PlayerNotFoundException e)
diff --git a/Essentials/src/net/ess3/commands/Commandsell.java b/Essentials/src/net/ess3/commands/Commandsell.java
index dde03f8d7..1a239ed0c 100644
--- a/Essentials/src/net/ess3/commands/Commandsell.java
+++ b/Essentials/src/net/ess3/commands/Commandsell.java
@@ -148,8 +148,8 @@ public class Commandsell extends EssentialsCommand
user.giveMoney(worth * amount);
user.sendMessage(
_(
- "itemSold", FormatUtil.displayCurrency(worth * amount, ess), amount, is.getType().toString().toLowerCase(Locale.ENGLISH),
- FormatUtil.displayCurrency(worth, ess)));
+ "itemSold", FormatUtil.displayCurrency(worth * amount, ess), amount, is.getType().toString().toLowerCase(Locale.ENGLISH),
+ FormatUtil.displayCurrency(worth, ess)));
logger.log(
Level.INFO, _(
"itemSoldConsole", player.getDisplayName(), is.getType().toString().toLowerCase(Locale.ENGLISH),
diff --git a/Essentials/src/net/ess3/commands/Commandsethome.java b/Essentials/src/net/ess3/commands/Commandsethome.java
index d4eb74df3..700d84dc9 100644
--- a/Essentials/src/net/ess3/commands/Commandsethome.java
+++ b/Essentials/src/net/ess3/commands/Commandsethome.java
@@ -9,7 +9,7 @@ import net.ess3.permissions.Permissions;
public class Commandsethome extends EssentialsCommand
{
- private final transient Pattern colon = Pattern.compile(":");
+ private final Pattern colon = Pattern.compile(":");
@Override
public void run(final IUser user, final String commandLabel, String[] args) throws Exception
@@ -78,8 +78,8 @@ public class Commandsethome extends EssentialsCommand
}
user.sendMessage(
_(
- "homeSet", user.getPlayer().getLocation().getWorld().getName(), user.getPlayer().getLocation().getBlockX(),
- user.getPlayer().getLocation().getBlockY(), user.getPlayer().getLocation().getBlockZ()));
+ "homeSet", user.getPlayer().getLocation().getWorld().getName(), user.getPlayer().getLocation().getBlockX(),
+ user.getPlayer().getLocation().getBlockY(), user.getPlayer().getLocation().getBlockZ()));
}
}
diff --git a/Essentials/src/net/ess3/commands/Commandsetwarp.java b/Essentials/src/net/ess3/commands/Commandsetwarp.java
index 401aa8ca9..0c890aeb6 100644
--- a/Essentials/src/net/ess3/commands/Commandsetwarp.java
+++ b/Essentials/src/net/ess3/commands/Commandsetwarp.java
@@ -36,7 +36,6 @@ public class Commandsetwarp extends EssentialsCommand
}
if (warpLoc == null || Permissions.WARP_OVERWRITE.isAuthorized(user, args[0]))
-
{
warps.setWarp(args[0], loc);
}
diff --git a/Essentials/src/net/ess3/commands/Commandsocialspy.java b/Essentials/src/net/ess3/commands/Commandsocialspy.java
index 765d7668f..9dbe96f8a 100644
--- a/Essentials/src/net/ess3/commands/Commandsocialspy.java
+++ b/Essentials/src/net/ess3/commands/Commandsocialspy.java
@@ -8,7 +8,6 @@ import org.bukkit.command.CommandSender;
public class Commandsocialspy extends EssentialsToggleCommand
{
-
@Override
protected void setValue(final IUser player, final boolean value)
{
diff --git a/Essentials/src/net/ess3/commands/Commandspawner.java b/Essentials/src/net/ess3/commands/Commandspawner.java
index 74be65774..f4f1d7181 100644
--- a/Essentials/src/net/ess3/commands/Commandspawner.java
+++ b/Essentials/src/net/ess3/commands/Commandspawner.java
@@ -46,7 +46,7 @@ public class Commandspawner extends EssentialsCommand
throw new Exception(_("unableToSpawnMob"));
}
int delay = 0;
- if(args.length > 1 && Util.isInt(args[1]))
+ if (args.length > 1 && Util.isInt(args[1]))
{
delay = Integer.parseInt(args[1]);
}
diff --git a/Essentials/src/net/ess3/commands/Commandspawnmob.java b/Essentials/src/net/ess3/commands/Commandspawnmob.java
index a9a410d62..6e1ae9cd2 100644
--- a/Essentials/src/net/ess3/commands/Commandspawnmob.java
+++ b/Essentials/src/net/ess3/commands/Commandspawnmob.java
@@ -7,7 +7,6 @@ import net.ess3.api.IUser;
public class Commandspawnmob extends EssentialsCommand
{
-
@Override
public void run(final IUser user, final String commandLabel, final String[] args) throws Exception
{
diff --git a/Essentials/src/net/ess3/commands/Commandspeed.java b/Essentials/src/net/ess3/commands/Commandspeed.java
index c5f3b01fa..7437710bc 100644
--- a/Essentials/src/net/ess3/commands/Commandspeed.java
+++ b/Essentials/src/net/ess3/commands/Commandspeed.java
@@ -10,7 +10,6 @@ import org.bukkit.entity.Player;
public class Commandspeed extends EssentialsCommand
{
-
@Override
protected void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception
{
diff --git a/Essentials/src/net/ess3/commands/Commandtpaccept.java b/Essentials/src/net/ess3/commands/Commandtpaccept.java
index 2acc1b221..0fff1b983 100644
--- a/Essentials/src/net/ess3/commands/Commandtpaccept.java
+++ b/Essentials/src/net/ess3/commands/Commandtpaccept.java
@@ -21,7 +21,7 @@ public class Commandtpaccept extends EssentialsCommand
final IUser target = user.getTeleportRequester();
if (target == null || !target.isOnline() || (user.isTpRequestHere() && !Permissions.TPAHERE.isAuthorized(
- target)) || (!user.isTpRequestHere() && !Permissions.TPA.isAuthorized(target) && !Permissions.TPAALL.isAuthorized(target)))
+ target)) || (!user.isTpRequestHere() && !Permissions.TPA.isAuthorized(target) && !Permissions.TPAALL.isAuthorized(target)))
{
throw new Exception(_("noPendingRequest"));
}
diff --git a/Essentials/src/net/ess3/commands/Commandtptoggle.java b/Essentials/src/net/ess3/commands/Commandtptoggle.java
index 7be6506f8..194a40285 100644
--- a/Essentials/src/net/ess3/commands/Commandtptoggle.java
+++ b/Essentials/src/net/ess3/commands/Commandtptoggle.java
@@ -8,7 +8,6 @@ import org.bukkit.command.CommandSender;
public class Commandtptoggle extends EssentialsToggleCommand
{
-
@Override
protected void setValue(final IUser player, final boolean value)
{
diff --git a/Essentials/src/net/ess3/commands/Commandwhois.java b/Essentials/src/net/ess3/commands/Commandwhois.java
index cb6fa55c4..2fdcfd40f 100644
--- a/Essentials/src/net/ess3/commands/Commandwhois.java
+++ b/Essentials/src/net/ess3/commands/Commandwhois.java
@@ -61,8 +61,8 @@ public class Commandwhois extends EssentialsCommand
sender.sendMessage(_("whoisExp", SetExpFix.getTotalExperience(player), player.getLevel()));
sender.sendMessage(
_(
- "whoisLocation", player.getLocation().getWorld().getName(), player.getLocation().getBlockX(), player.getLocation().getBlockY(),
- player.getLocation().getBlockZ()));
+ "whoisLocation", player.getLocation().getWorld().getName(), player.getLocation().getBlockX(), player.getLocation().getBlockY(),
+ player.getLocation().getBlockZ()));
sender.sendMessage(_("whoisMoney", FormatUtil.displayCurrency(user.getMoney(), ess)));
sender.sendMessage(_("whoisIPAddress", player.getAddress().getAddress().toString()));
final String location = userData.getGeolocation();
@@ -77,12 +77,12 @@ public class Commandwhois extends EssentialsCommand
sender.sendMessage(_("whoisAFK", (userData.isAfk() ? _("true") : _("false"))));
sender.sendMessage(
_(
- "whoisJail", (userData.isJailed() ? user.getTimestamp(UserData.TimestampType.JAIL) > 0 ? DateUtil.formatDateDiff(
- user.getTimestamp(UserData.TimestampType.JAIL)) : _("true") : _("false"))));
+ "whoisJail", (userData.isJailed() ? user.getTimestamp(UserData.TimestampType.JAIL) > 0 ? DateUtil.formatDateDiff(
+ user.getTimestamp(UserData.TimestampType.JAIL)) : _("true") : _("false"))));
sender.sendMessage(
_(
- "whoisMute", (userData.isMuted() ? user.getTimestamp(UserData.TimestampType.MUTE) > 0 ? DateUtil.formatDateDiff(
- user.getTimestamp(UserData.TimestampType.MUTE)) : _("true") : _("false"))));
+ "whoisMute", (userData.isMuted() ? user.getTimestamp(UserData.TimestampType.MUTE) > 0 ? DateUtil.formatDateDiff(
+ user.getTimestamp(UserData.TimestampType.MUTE)) : _("true") : _("false"))));
if (!foundPlayer)
{
diff --git a/Essentials/src/net/ess3/commands/Commandworth.java b/Essentials/src/net/ess3/commands/Commandworth.java
index dad600602..c79d757a1 100644
--- a/Essentials/src/net/ess3/commands/Commandworth.java
+++ b/Essentials/src/net/ess3/commands/Commandworth.java
@@ -43,10 +43,10 @@ public class Commandworth extends EssentialsCommand
user.sendMessage(
iStack.getDurability() != 0 ? _(
- "worthMeta", iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""), iStack.getDurability(),
- FormatUtil.displayCurrency(worth * amount, ess), amount, FormatUtil.displayCurrency(worth, ess)) : _(
- "worth", iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""), FormatUtil.displayCurrency(worth * amount, ess),
- amount, FormatUtil.displayCurrency(worth, ess)));
+ "worthMeta", iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""), iStack.getDurability(),
+ FormatUtil.displayCurrency(worth * amount, ess), amount, FormatUtil.displayCurrency(worth, ess)) : _(
+ "worth", iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""), FormatUtil.displayCurrency(worth * amount, ess),
+ amount, FormatUtil.displayCurrency(worth, ess)));
}
@Override
@@ -81,10 +81,10 @@ public class Commandworth extends EssentialsCommand
sender.sendMessage(
iStack.getDurability() != 0 ? _(
- "worthMeta", iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""), iStack.getDurability(),
- FormatUtil.displayCurrency(worth * amount, ess), amount, FormatUtil.displayCurrency(worth, ess)) : _(
- "worth", iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""), FormatUtil.displayCurrency(worth * amount, ess),
- amount, FormatUtil.displayCurrency(worth, ess)));
+ "worthMeta", iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""), iStack.getDurability(),
+ FormatUtil.displayCurrency(worth * amount, ess), amount, FormatUtil.displayCurrency(worth, ess)) : _(
+ "worth", iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""), FormatUtil.displayCurrency(worth * amount, ess),
+ amount, FormatUtil.displayCurrency(worth, ess)));
}
}
diff --git a/Essentials/src/net/ess3/commands/EssentialsCommand.java b/Essentials/src/net/ess3/commands/EssentialsCommand.java
index 42fbd0f3d..02e6aff41 100644
--- a/Essentials/src/net/ess3/commands/EssentialsCommand.java
+++ b/Essentials/src/net/ess3/commands/EssentialsCommand.java
@@ -16,12 +16,12 @@ import org.bukkit.entity.Player;
public abstract class EssentialsCommand extends AbstractSuperpermsPermission implements IEssentialsCommand
{
- protected transient String commandName;
- protected transient IEssentials ess;
- protected transient IEssentialsModule module;
- protected transient Server server;
- protected transient Logger logger;
- private transient String permission;
+ protected String commandName;
+ protected IEssentials ess;
+ protected IEssentialsModule module;
+ protected Server server;
+ protected Logger logger;
+ private String permission;
@Override
public void init(final IEssentials ess, final String commandName)
diff --git a/Essentials/src/net/ess3/commands/EssentialsCommandHandler.java b/Essentials/src/net/ess3/commands/EssentialsCommandHandler.java
index aa9327fda..1a6cc705f 100644
--- a/Essentials/src/net/ess3/commands/EssentialsCommandHandler.java
+++ b/Essentials/src/net/ess3/commands/EssentialsCommandHandler.java
@@ -14,15 +14,15 @@ import org.bukkit.plugin.Plugin;
public class EssentialsCommandHandler implements ICommandHandler, TabExecutor
{
- private final transient ClassLoader classLoader;
- private final transient String commandPath;
- private final transient String permissionPrefix;// TODO: Needed?
- private final transient IEssentialsModule module;
- private static final transient Logger LOGGER = Bukkit.getLogger();
- private final transient Map<String, List<PluginCommand>> altcommands = new HashMap<String, List<PluginCommand>>();
- private final transient Map<String, String> disabledList = new HashMap<String, String>();
- private final transient Map<String, IEssentialsCommand> commands = new HashMap<String, IEssentialsCommand>();
- private final transient IEssentials ess;
+ private final ClassLoader classLoader;
+ private final String commandPath;
+ private final String permissionPrefix; // TODO: Needed?
+ private final IEssentialsModule module;
+ private static final Logger LOGGER = Bukkit.getLogger();
+ private final Map<String, List<PluginCommand>> altcommands = new HashMap<String, List<PluginCommand>>();
+ private final Map<String, String> disabledList = new HashMap<String, String>();
+ private final Map<String, IEssentialsCommand> commands = new HashMap<String, IEssentialsCommand>();
+ private final IEssentials ess;
public EssentialsCommandHandler(ClassLoader classLoader, String commandPath, String permissionPrefix, IEssentials ess)
{
diff --git a/Essentials/src/net/ess3/commands/EssentialsSettingsCommand.java b/Essentials/src/net/ess3/commands/EssentialsSettingsCommand.java
index 1ab327667..440bda706 100644
--- a/Essentials/src/net/ess3/commands/EssentialsSettingsCommand.java
+++ b/Essentials/src/net/ess3/commands/EssentialsSettingsCommand.java
@@ -8,7 +8,6 @@ import org.bukkit.command.CommandSender;
public abstract class EssentialsSettingsCommand extends EssentialsCommand
{
-
abstract protected void informSender(final CommandSender sender, final boolean value, final IUser player);
abstract protected void informPlayer(final IUser player);
@@ -82,5 +81,4 @@ public abstract class EssentialsSettingsCommand extends EssentialsCommand
informSender(sender, true, matchPlayer);
}
}
-
}
diff --git a/Essentials/src/net/ess3/commands/EssentialsToggleCommand.java b/Essentials/src/net/ess3/commands/EssentialsToggleCommand.java
index c62fda512..2d5b723cb 100644
--- a/Essentials/src/net/ess3/commands/EssentialsToggleCommand.java
+++ b/Essentials/src/net/ess3/commands/EssentialsToggleCommand.java
@@ -5,7 +5,6 @@ import net.ess3.api.IUser;
public abstract class EssentialsToggleCommand extends EssentialsSettingsCommand
{
-
abstract protected void setValue(final IUser player, final boolean value);
abstract protected boolean getValue(final IUser player);
diff --git a/Essentials/src/net/ess3/commands/WarpNotFoundException.java b/Essentials/src/net/ess3/commands/WarpNotFoundException.java
index 73e9504c9..3d725072a 100644
--- a/Essentials/src/net/ess3/commands/WarpNotFoundException.java
+++ b/Essentials/src/net/ess3/commands/WarpNotFoundException.java
@@ -17,5 +17,3 @@ public class WarpNotFoundException extends Exception
super(message);
}
}
-
-
diff --git a/Essentials/src/net/ess3/converter/EnumConverter.java b/Essentials/src/net/ess3/converter/EnumConverter.java
index ab45bdfb6..a31b08124 100644
--- a/Essentials/src/net/ess3/converter/EnumConverter.java
+++ b/Essentials/src/net/ess3/converter/EnumConverter.java
@@ -14,7 +14,7 @@ public class EnumConverter<E extends Enum<E>> implements ArgumentsParser<E>, Ser
private static final Pattern REPLACE = Pattern.compile("[_-]");
private final Map<String, E> enumMap = new HashMap<String, E>();
private final Map<E, String> serializedMap;
-
+
private EnumConverter(final Class<E> enumClass)
{
serializedMap = new EnumMap<E, String>(enumClass);
@@ -24,7 +24,7 @@ public class EnumConverter<E extends Enum<E>> implements ArgumentsParser<E>, Ser
serializedMap.put(t, prettifyString(t.name()));
}
}
-
+
public static <T extends Enum<T>> EnumConverter<T> getInstance(final Class<T> enumClass)
{
synchronized (converterMap)
@@ -38,7 +38,7 @@ public class EnumConverter<E extends Enum<E>> implements ArgumentsParser<E>, Ser
return converter;
}
}
-
+
@Override
public ParserResult<E> parse(final String... args)
{
@@ -51,18 +51,18 @@ public class EnumConverter<E extends Enum<E>> implements ArgumentsParser<E>, Ser
}
return new FirstEntryParserResult<E>(e, args);
}
-
+
@Override
public String serialize(final E input)
{
return serializedMap.get(input);
}
-
+
private String cleanString(final String input)
{
return REPLACE.matcher(input).replaceAll("").toLowerCase(Locale.ENGLISH);
}
-
+
private String prettifyString(final String input)
{
return input.replace('_', '-').toLowerCase(Locale.ENGLISH);
diff --git a/Essentials/src/net/ess3/craftbukkit/InventoryWorkaround.java b/Essentials/src/net/ess3/craftbukkit/InventoryWorkaround.java
index d7230fcde..e8397c47b 100644
--- a/Essentials/src/net/ess3/craftbukkit/InventoryWorkaround.java
+++ b/Essentials/src/net/ess3/craftbukkit/InventoryWorkaround.java
@@ -11,7 +11,6 @@ import org.bukkit.inventory.ItemStack;
* TODO: make sure this is up-to date
*/
-
public final class InventoryWorkaround
{
private InventoryWorkaround()
@@ -28,7 +27,7 @@ public final class InventoryWorkaround
for (int i = 0; i < stacks.length; i++)
{
final ItemStack cItem = stacks[i];
- if(cItem != null && cItem.getAmount() < maxAmount && cItem.isSimilar(item))
+ if (cItem != null && cItem.getAmount() < maxAmount && cItem.isSimilar(item))
{
return i;
}
diff --git a/Essentials/src/net/ess3/economy/Money.java b/Essentials/src/net/ess3/economy/Money.java
index 2373cc7f7..180ec305a 100644
--- a/Essentials/src/net/ess3/economy/Money.java
+++ b/Essentials/src/net/ess3/economy/Money.java
@@ -35,6 +35,4 @@ public class Money implements StorageObject
balanceMap.remove(name);
balances = balanceMap;
}
-
-
}
diff --git a/Essentials/src/net/ess3/economy/Trade.java b/Essentials/src/net/ess3/economy/Trade.java
index 15c2a2adc..c15145baf 100644
--- a/Essentials/src/net/ess3/economy/Trade.java
+++ b/Essentials/src/net/ess3/economy/Trade.java
@@ -22,12 +22,12 @@ import org.bukkit.inventory.ItemStack;
public class Trade
{
- private final transient String command;
- private final transient String fallbackCommand;
- private final transient Double money;
- private final transient ItemStack itemStack;
- private final transient Integer exp;
- private final transient IEssentials ess;
+ private final String command;
+ private final String fallbackCommand;
+ private final Double money;
+ private final ItemStack itemStack;
+ private final Integer exp;
+ private final IEssentials ess;
public Trade(final String command, final IEssentials ess)
{
@@ -211,7 +211,6 @@ public class Trade
}
return cost;
}
-
private static FileWriter fw = null;
public static void log(String type, String subtype, String event, String sender, Trade charge, String receiver, Trade pay, Location loc, IEssentials ess)
diff --git a/Essentials/src/net/ess3/economy/Worth.java b/Essentials/src/net/ess3/economy/Worth.java
index f2f3d2d64..6f94204a9 100644
--- a/Essentials/src/net/ess3/economy/Worth.java
+++ b/Essentials/src/net/ess3/economy/Worth.java
@@ -26,7 +26,6 @@ public class Worth implements StorageObject
{
return sell == null ? Collections.<MaterialData, Double>emptyMap() : Collections.unmodifiableMap(sell);
}
-
@MapKeyType(MaterialData.class)
@MapValueType(Double.class)
@Getter(AccessLevel.NONE)
@@ -37,7 +36,6 @@ public class Worth implements StorageObject
{
return buy == null ? Collections.<MaterialData, Double>emptyMap() : Collections.unmodifiableMap(buy);
}
-
@MapKeyType(EnchantmentLevel.class)
@MapValueType(Double.class)
@Getter(AccessLevel.NONE)
diff --git a/Essentials/src/net/ess3/economy/register/Method.java b/Essentials/src/net/ess3/economy/register/Method.java
index 2ded29805..f3f7fab4c 100644
--- a/Essentials/src/net/ess3/economy/register/Method.java
+++ b/Essentials/src/net/ess3/economy/register/Method.java
@@ -6,7 +6,8 @@ import org.bukkit.plugin.Plugin;
/**
* Interface to be implemented by a payment method.
*
- * @author Nijikokun <nijikokun@shortmail.com> (@nijikokun)
+ * @author Nijikokun <nijikokun@shortmail.com> (
+ * @nijikokun)
* @copyright Copyright (C) 2011
* @license AOL license <http://aol.nexua.org>
*/
@@ -16,7 +17,8 @@ public interface Method
* Encodes the Plugin into an Object disguised as the Plugin. If you want the original Plugin Class you must cast it
* to the correct Plugin, to do so you have to verify the name and or version then cast.
* <p/>
- * <pre>
+ * <
+ * pre>
* if(method.getName().equalsIgnoreCase("iConomy"))
* iConomy plugin = ((iConomy)method.getPlugin());</pre>
*
@@ -48,8 +50,7 @@ public interface Method
public String getVersion();
/**
- * Returns the amount of decimal places that get stored
- * NOTE: it will return -1 if there is no rounding
+ * Returns the amount of decimal places that get stored NOTE: it will return -1 if there is no rounding
*
* @return <code>int</code> for each decimal place
*/
@@ -88,7 +89,9 @@ public interface Method
public boolean hasAccount(String name);
/**
- * Check to see if an account <code>name</code> is tied to a <code>bank</code>.
+ * Check to see if an account
+ * <code>name</code> is tied to a
+ * <code>bank</code>.
*
* @param bank Bank name
* @param name Account name
@@ -107,14 +110,16 @@ public interface Method
/**
* Forces an account creation
*
- * @param name Account name
+ * @param name Account name
* @param balance Initial account balance
* @return <code>boolean</code>
*/
public boolean createAccount(String name, Double balance);
/**
- * Returns a <code>MethodAccount</code> class for an account <code>name</code>.
+ * Returns a
+ * <code>MethodAccount</code> class for an account
+ * <code>name</code>.
*
* @param name Account name
* @return <code>MethodAccount</code> <em>or</em> <code>Null</code>
@@ -122,7 +127,9 @@ public interface Method
public MethodAccount getAccount(String name);
/**
- * Returns a <code>MethodBankAccount</code> class for an account <code>name</code>.
+ * Returns a
+ * <code>MethodBankAccount</code> class for an account
+ * <code>name</code>.
*
* @param bank Bank name
* @param name Account name
@@ -131,8 +138,7 @@ public interface Method
public MethodBankAccount getBankAccount(String bank, String name);
/**
- * Checks to verify the compatibility between this Method and a plugin.
- * Internal usage only, for the most part.
+ * Checks to verify the compatibility between this Method and a plugin. Internal usage only, for the most part.
*
* @param plugin Plugin
* @return <code>boolean</code>
diff --git a/Essentials/src/net/ess3/economy/register/Methods.java b/Essentials/src/net/ess3/economy/register/Methods.java
index 3c0772129..1ac716aa7 100644
--- a/Essentials/src/net/ess3/economy/register/Methods.java
+++ b/Essentials/src/net/ess3/economy/register/Methods.java
@@ -22,8 +22,10 @@ import org.bukkit.plugin.PluginManager;
* preferred: "iConomy"
* </pre></blockquote>
*
- * @author: Nijikokun <nijikokun@shortmail.com> (@nijikokun) @copyright: Copyright (C) 2011 @license: AOL license
- * <http://aol.nexua.org>
+ * @author: Nijikokun <nijikokun@shortmail.com> (
+ * @nijikokun)
+ * @copyright: Copyright (C) 2011
+ * @license: AOL license <http://aol.nexua.org>
*/
public class Methods
{
@@ -255,8 +257,7 @@ public class Methods
/**
* Grab the existing and initialized (hopefully) Method Class.
*
- * @return <code>Method</code> <em>or</em>
- * <code>Null</code>
+ * @return <code>Method</code> <em>or</em> <code>Null</code>
*/
public static Method getMethod()
{
diff --git a/Essentials/src/net/ess3/economy/register/methods/BOSE7.java b/Essentials/src/net/ess3/economy/register/methods/BOSE7.java
index cbb9b9314..f186dfadd 100644
--- a/Essentials/src/net/ess3/economy/register/methods/BOSE7.java
+++ b/Essentials/src/net/ess3/economy/register/methods/BOSE7.java
@@ -9,8 +9,10 @@ import org.bukkit.plugin.Plugin;
* BOSEconomy 7 Implementation of Method
*
* @author Acrobot
- * @author Nijikokun <nijikokun@shortmail.com> (@nijikokun) @copyright (c) 2011 @license AOL license
- * <http://aol.nexua.org>
+ * @author Nijikokun <nijikokun@shortmail.com> (
+ * @nijikokun)
+ * @copyright (c) 2011
+ * @license AOL license <http://aol.nexua.org>
*/
public class BOSE7 implements Method
{
diff --git a/Essentials/src/net/ess3/economy/register/methods/iCo5.java b/Essentials/src/net/ess3/economy/register/methods/iCo5.java
index a615ada5d..9e4dab821 100644
--- a/Essentials/src/net/ess3/economy/register/methods/iCo5.java
+++ b/Essentials/src/net/ess3/economy/register/methods/iCo5.java
@@ -12,8 +12,10 @@ import org.bukkit.plugin.Plugin;
/**
* iConomy 5 Implementation of Method
*
- * @author Nijikokun <nijikokun@shortmail.com> (@nijikokun) @copyright (c) 2011 @license AOL license
- * <http://aol.nexua.org>
+ * @author Nijikokun <nijikokun@shortmail.com> (
+ * @nijikokun)
+ * @copyright (c) 2011
+ * @license AOL license <http://aol.nexua.org>
*/
public class iCo5 implements Method
{
diff --git a/Essentials/src/net/ess3/economy/register/methods/iCo6.java b/Essentials/src/net/ess3/economy/register/methods/iCo6.java
index 9dfdabe2e..d98819828 100644
--- a/Essentials/src/net/ess3/economy/register/methods/iCo6.java
+++ b/Essentials/src/net/ess3/economy/register/methods/iCo6.java
@@ -11,8 +11,10 @@ import org.bukkit.plugin.Plugin;
/**
* iConomy 6 Implementation of Method
*
- * @author Nijikokun <nijikokun@shortmail.com> (@nijikokun) @copyright (c) 2011 @license AOL license
- * <http://aol.nexua.org>
+ * @author Nijikokun <nijikokun@shortmail.com> (
+ * @nijikokun)
+ * @copyright (c) 2011
+ * @license AOL license <http://aol.nexua.org>
*/
public class iCo6 implements Method
{
diff --git a/Essentials/src/net/ess3/listener/EssentialsBlockListener.java b/Essentials/src/net/ess3/listener/EssentialsBlockListener.java
index 8d3f380a7..f72b95e64 100644
--- a/Essentials/src/net/ess3/listener/EssentialsBlockListener.java
+++ b/Essentials/src/net/ess3/listener/EssentialsBlockListener.java
@@ -15,7 +15,7 @@ import org.bukkit.inventory.ItemStack;
public class EssentialsBlockListener implements Listener
{
- private final transient IEssentials ess;
+ private final IEssentials ess;
public EssentialsBlockListener(final IEssentials ess)
{
diff --git a/Essentials/src/net/ess3/listener/EssentialsEntityListener.java b/Essentials/src/net/ess3/listener/EssentialsEntityListener.java
index 41ed4503a..c0b5a54d0 100644
--- a/Essentials/src/net/ess3/listener/EssentialsEntityListener.java
+++ b/Essentials/src/net/ess3/listener/EssentialsEntityListener.java
@@ -19,7 +19,7 @@ import org.bukkit.inventory.ItemStack;
public class EssentialsEntityListener implements Listener
{
- private final transient IEssentials ess;
+ private final IEssentials ess;
public EssentialsEntityListener(final IEssentials ess)
{
@@ -41,7 +41,7 @@ public class EssentialsEntityListener implements Listener
attacker.updateActivity(true);
if (settings.getData().getGeneral().getLoginAttackDelay() > 0 && !Permissions.PVPDELAY_EXEMPT.isAuthorized(
attacker) && (System.currentTimeMillis() < (attacker.getTimestamp(
- TimestampType.LOGIN) + settings.getData().getGeneral().getLoginAttackDelay())))
+ TimestampType.LOGIN) + settings.getData().getGeneral().getLoginAttackDelay())))
{
event.setCancelled(true);
}
diff --git a/Essentials/src/net/ess3/listener/EssentialsPlayerListener.java b/Essentials/src/net/ess3/listener/EssentialsPlayerListener.java
index 81ec8a397..b5de18fd1 100644
--- a/Essentials/src/net/ess3/listener/EssentialsPlayerListener.java
+++ b/Essentials/src/net/ess3/listener/EssentialsPlayerListener.java
@@ -40,9 +40,9 @@ import org.bukkit.inventory.ItemStack;
public class EssentialsPlayerListener implements Listener
{
private static final Logger LOGGER = Logger.getLogger("Minecraft");
- private final transient Server server;
- private final transient IEssentials ess;
- private final transient IUserMap userMap;
+ private final Server server;
+ private final IEssentials ess;
+ private final IUserMap userMap;
public EssentialsPlayerListener(final IEssentials parent)
{
@@ -56,7 +56,8 @@ public class EssentialsPlayerListener implements Listener
public void onPlayerRespawn(final PlayerRespawnEvent event)
{
final Player player = event.getPlayer();
- if (!player.isOnline()) {
+ if (!player.isOnline())
+ {
return;
}
final IUser user = userMap.getUser(player);
@@ -173,83 +174,83 @@ public class EssentialsPlayerListener implements Listener
delayedJoin(event.getPlayer());
}
});
-/* TODO: Make sure my update is good
- if (!event.getPlayer().isOnline())
- {
- return;
- }
-
- ess.getBackup().startTask();
-
- final String joinMessage = ess.getSettings().getData().getGeneral().getJoinMessage();
- if (joinMessage != null)
- {
- final IText itOutput = new KeywordReplacer(new SimpleTextInput(joinMessage), ess.getUserMap().getUser(event.getPlayer()), ess);
- final SimpleTextPager stPager = new SimpleTextPager(itOutput);
- event.setJoinMessage(FormatUtil.replaceFormat(stPager.getString(0)));
- }
- else
- {
- event.setJoinMessage(joinMessage);
- }
-
- final IUser user = ess.getUserMap().getUser(event.getPlayer());
-
- user.updateDisplayName();
- user.getData().setIpAddress(user.getPlayer().getAddress().getAddress().getHostAddress());
- user.updateActivity(false);
-
- for (String p : ess.getVanishedPlayers())
- {
- if (!Permissions.VANISH_SEE_OTHERS.isAuthorized(user))
- {
- user.getPlayer().hidePlayer(ess.getUserMap().getUser(p).getPlayer());
- }
- }
-
- if (Permissions.SLEEPINGIGNORED.isAuthorized(user))
- {
- user.getPlayer().setSleepingIgnored(true);
- }
- user.queueSave();
-
-
- final ISettings settings = ess.getSettings();
-
- if (!settings.getData().getCommands().isDisabled("motd") && Permissions.MOTD.isAuthorized(user))
- {
- try
- {
- final IText input = new TextInput(user, "motd", true, ess);
- final IText output = new KeywordReplacer(input, user, ess);
- final TextPager pager = new TextPager(output, true);
- pager.showPage("1", null, "motd", user);
- }
- catch (IOException ex)
- {
- if (settings.getData().getGeneral().isDebug())
- {
- LOGGER.log(Level.WARNING, ex.getMessage(), ex);
- }
- else
- {
- LOGGER.log(Level.WARNING, ex.getMessage());
- }
- }
- }
-
- if (!settings.getData().getCommands().isDisabled("mail") && Permissions.MAIL.isAuthorized(user))
- {
- final List<String> mail = user.getData().getMails();
- if (mail == null || mail.isEmpty())
- {
- user.sendMessage(_("noNewMail"));
- }
- else
- {
- user.sendMessage(_("youHaveNewMail", mail.size()));
- }
- }*/
+ /* TODO: Make sure my update is good
+ if (!event.getPlayer().isOnline())
+ {
+ return;
+ }
+
+ ess.getBackup().startTask();
+
+ final String joinMessage = ess.getSettings().getData().getGeneral().getJoinMessage();
+ if (joinMessage != null)
+ {
+ final IText itOutput = new KeywordReplacer(new SimpleTextInput(joinMessage), ess.getUserMap().getUser(event.getPlayer()), ess);
+ final SimpleTextPager stPager = new SimpleTextPager(itOutput);
+ event.setJoinMessage(FormatUtil.replaceFormat(stPager.getString(0)));
+ }
+ else
+ {
+ event.setJoinMessage(joinMessage);
+ }
+
+ final IUser user = ess.getUserMap().getUser(event.getPlayer());
+
+ user.updateDisplayName();
+ user.getData().setIpAddress(user.getPlayer().getAddress().getAddress().getHostAddress());
+ user.updateActivity(false);
+
+ for (String p : ess.getVanishedPlayers())
+ {
+ if (!Permissions.VANISH_SEE_OTHERS.isAuthorized(user))
+ {
+ user.getPlayer().hidePlayer(ess.getUserMap().getUser(p).getPlayer());
+ }
+ }
+
+ if (Permissions.SLEEPINGIGNORED.isAuthorized(user))
+ {
+ user.getPlayer().setSleepingIgnored(true);
+ }
+ user.queueSave();
+
+
+ final ISettings settings = ess.getSettings();
+
+ if (!settings.getData().getCommands().isDisabled("motd") && Permissions.MOTD.isAuthorized(user))
+ {
+ try
+ {
+ final IText input = new TextInput(user, "motd", true, ess);
+ final IText output = new KeywordReplacer(input, user, ess);
+ final TextPager pager = new TextPager(output, true);
+ pager.showPage("1", null, "motd", user);
+ }
+ catch (IOException ex)
+ {
+ if (settings.getData().getGeneral().isDebug())
+ {
+ LOGGER.log(Level.WARNING, ex.getMessage(), ex);
+ }
+ else
+ {
+ LOGGER.log(Level.WARNING, ex.getMessage());
+ }
+ }
+ }
+
+ if (!settings.getData().getCommands().isDisabled("mail") && Permissions.MAIL.isAuthorized(user))
+ {
+ final List<String> mail = user.getData().getMails();
+ if (mail == null || mail.isEmpty())
+ {
+ user.sendMessage(_("noNewMail"));
+ }
+ else
+ {
+ user.sendMessage(_("youHaveNewMail", mail.size()));
+ }
+ }*/
}
public void delayedJoin(final Player player)
@@ -330,19 +331,19 @@ public class EssentialsPlayerListener implements Listener
user.sendMessage(_("youHaveNewMail", mail.size()));
}
}
- if(Permissions.FLY_SAFELOGIN.isAuthorized(user))
+ if (Permissions.FLY_SAFELOGIN.isAuthorized(user))
{
final Location loc = user.getPlayer().getLocation();
final World world = loc.getWorld();
final int x = loc.getBlockX();
int y = loc.getBlockY();
final int z = loc.getBlockZ();
- while(LocationUtil.isBlockUnsafe(world, x, y, z) && y > -1)
+ while (LocationUtil.isBlockUnsafe(world, x, y, z) && y > -1)
{
y--;
}
- if(loc.getBlockY() - y > 1 || y < 0)
+ if (loc.getBlockY() - y > 1 || y < 0)
{
user.getPlayer().setAllowFlight(true);
user.getPlayer().setFlying(true);
@@ -351,7 +352,6 @@ public class EssentialsPlayerListener implements Listener
}
}
-
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerLogin(final PlayerLoginEvent event)
{
@@ -449,7 +449,6 @@ public class EssentialsPlayerListener implements Listener
});
}
}
-
private final Pattern spaceSplit = Pattern.compile(" ");
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@@ -613,7 +612,7 @@ public class EssentialsPlayerListener implements Listener
{
final IUser invOwner = userMap.getUser((Player)invHolder);
if (user.isInvSee() && (!Permissions.INVSEE_MODIFY.isAuthorized(user) || Permissions.INVSEE_PREVENT_MODIFY.isAuthorized(
- invOwner) || !invOwner.isOnline()))
+ invOwner) || !invOwner.isOnline()))
{
event.setCancelled(true);
}
@@ -621,7 +620,7 @@ public class EssentialsPlayerListener implements Listener
}
if (event.getView().getTopInventory().getType() == InventoryType.WORKBENCH)
{
- final IUser user = userMap.getUser((Player) event.getWhoClicked());
+ final IUser user = userMap.getUser((Player)event.getWhoClicked());
if (user.isRecipeSee())
{
event.setCancelled(true);
diff --git a/Essentials/src/net/ess3/listener/EssentialsPluginListener.java b/Essentials/src/net/ess3/listener/EssentialsPluginListener.java
index 56e3add3d..8f5de1ec2 100644
--- a/Essentials/src/net/ess3/listener/EssentialsPluginListener.java
+++ b/Essentials/src/net/ess3/listener/EssentialsPluginListener.java
@@ -19,7 +19,7 @@ import org.bukkit.plugin.Plugin;
public class EssentialsPluginListener implements Listener, IReload
{
- private final transient IEssentials ess;
+ private final IEssentials ess;
public EssentialsPluginListener(final IEssentials ess)
{
@@ -36,9 +36,10 @@ public class EssentialsPluginListener implements Listener, IReload
if (!Methods.hasMethod() && Methods.setMethod(ess.getServer().getPluginManager()))
{
ess.getLogger().log(
- Level.INFO, "Payment method found ({0} version: {1})", new Object[]{
- Methods.getMethod().getName(), Methods.getMethod().getVersion()
- });
+ Level.INFO, "Payment method found ({0} version: {1})", new Object[]
+ {
+ Methods.getMethod().getName(), Methods.getMethod().getVersion()
+ });
}
}
diff --git a/Essentials/src/net/ess3/metrics/MetricsListener.java b/Essentials/src/net/ess3/metrics/MetricsListener.java
index 17664ab61..b83406e35 100644
--- a/Essentials/src/net/ess3/metrics/MetricsListener.java
+++ b/Essentials/src/net/ess3/metrics/MetricsListener.java
@@ -14,8 +14,8 @@ import org.bukkit.event.player.PlayerJoinEvent;
public class MetricsListener implements Listener
{
- private final transient IEssentials ess;
- private final transient MetricsStarter starter;
+ private final IEssentials ess;
+ private final MetricsStarter starter;
public MetricsListener(final IEssentials parent, final MetricsStarter starter)
{
@@ -30,7 +30,7 @@ public class MetricsListener implements Listener
ISettings settings = ess.getSettings();
if (settings.getData().getGeneral().getMetricsEnabled() == null && (Permissions.ESSENTIALS.isAuthorized(
- event.getPlayer()) || event.getPlayer().hasPermission("bukkit.broadcast.admin")))
+ event.getPlayer()) || event.getPlayer().hasPermission("bukkit.broadcast.admin")))
{
player.sendMessage(_("metrics1"));
player.sendMessage(_("metrics2"));
diff --git a/Essentials/src/net/ess3/metrics/MetricsStarter.java b/Essentials/src/net/ess3/metrics/MetricsStarter.java
index 2c5314142..0c1ac9df9 100644
--- a/Essentials/src/net/ess3/metrics/MetricsStarter.java
+++ b/Essentials/src/net/ess3/metrics/MetricsStarter.java
@@ -14,7 +14,7 @@ import net.ess3.metrics.Metrics.Plotter;
public class MetricsStarter implements Runnable
{
private final IEssentials ess;
- private transient Boolean start;
+ private Boolean start;
private enum Modules
@@ -30,10 +30,7 @@ public class MetricsStarter implements Runnable
EssentialsProtect,
EssentialsGeoIP,
EssentialsXMPP
- }
-
-
- ;
+ };
public MetricsStarter(final IEssentials plugin)
{
diff --git a/Essentials/src/net/ess3/permissions/BasePermission.java b/Essentials/src/net/ess3/permissions/BasePermission.java
index b1cb0be68..5312ebb93 100644
--- a/Essentials/src/net/ess3/permissions/BasePermission.java
+++ b/Essentials/src/net/ess3/permissions/BasePermission.java
@@ -1,5 +1,6 @@
package net.ess3.permissions;
+
public class BasePermission extends AbstractSuperpermsPermission
{
protected String permission;
diff --git a/Essentials/src/net/ess3/permissions/Permissions.java b/Essentials/src/net/ess3/permissions/Permissions.java
index c4c1e19c7..4655ca309 100644
--- a/Essentials/src/net/ess3/permissions/Permissions.java
+++ b/Essentials/src/net/ess3/permissions/Permissions.java
@@ -121,7 +121,7 @@ public enum Permissions implements IPermission
private static final String base = "essentials.";
private final String permission;
private final PermissionDefault defaultPerm;
- private transient String parent = null;
+ private String parent = null;
private Permissions()
{
@@ -164,7 +164,6 @@ public enum Permissions implements IPermission
{
return PermissionFactory.checkPermission(sender, this);
}
-
public static DotStarPermission ENCHANT = new DotStarPermission("essentials.enchant");
public static MaterialDotStarPermission GIVE = new MaterialDotStarPermission("essentials.give", PermissionDefault.TRUE);
public static DotStarPermission RANKS = new DotStarPermission("essentials.ranks");
diff --git a/Essentials/src/net/ess3/ranks/GMGroups.java b/Essentials/src/net/ess3/ranks/GMGroups.java
index 55a6295d3..9e2bd745f 100644
--- a/Essentials/src/net/ess3/ranks/GMGroups.java
+++ b/Essentials/src/net/ess3/ranks/GMGroups.java
@@ -12,8 +12,8 @@ import org.bukkit.plugin.Plugin;
public class GMGroups extends AbstractRanks implements IRanks
{
- private final transient IEssentials ess;
- private final transient GroupManager groupManager;
+ private final IEssentials ess;
+ private final GroupManager groupManager;
public GMGroups(final IEssentials ess, final Plugin groupManager)
{
diff --git a/Essentials/src/net/ess3/ranks/Ranks.java b/Essentials/src/net/ess3/ranks/Ranks.java
index 4e876b128..31a9bc34b 100644
--- a/Essentials/src/net/ess3/ranks/Ranks.java
+++ b/Essentials/src/net/ess3/ranks/Ranks.java
@@ -17,12 +17,11 @@ public class Ranks implements StorageObject
final RankOptions defaultOptions = new RankOptions();
ranks.put("default", defaultOptions);
}
-
@Comment(
- {
- "The order of the ranks matters, the ranks are checked from top to bottom.", "All rank names have to be lower case.",
- "The ranks can be connected to users using the permission essentials.ranks.rankname"
- })
+ {
+ "The order of the ranks matters, the ranks are checked from top to bottom.", "All rank names have to be lower case.",
+ "The ranks can be connected to users using the permission essentials.ranks.rankname"
+ })
@MapValueType(RankOptions.class)
private LinkedHashMap<String, RankOptions> ranks = new LinkedHashMap<String, RankOptions>();
}
diff --git a/Essentials/src/net/ess3/settings/Backup.java b/Essentials/src/net/ess3/settings/Backup.java
index bbdef7bdf..01ba37322 100644
--- a/Essentials/src/net/ess3/settings/Backup.java
+++ b/Essentials/src/net/ess3/settings/Backup.java
@@ -18,17 +18,16 @@ public class Backup implements StorageObject
@Comment("Add a command that backups your data, e.g. 'rdiff-backup World1 backups/World1'")
private String command;
@Comment(
- {
- "Runs these commands before a backup.", "This will run every time time (in minutes) you specify in the interval setting.",
- "ex: say \"Hello World\" will make the server say Hello World"
- })
+ {
+ "Runs these commands before a backup.", "This will run every time time (in minutes) you specify in the interval setting.",
+ "ex: say \"Hello World\" will make the server say Hello World"
+ })
private List<String> commandsBeforeBackup;
-
@Comment(
- {
- "Runs these commands after a backup.", "This will run every time time (in minutes) you specify in the interval setting.",
- "ex: say \"Hello World\" will make the server say Hello World"
- })
+ {
+ "Runs these commands after a backup.", "This will run every time time (in minutes) you specify in the interval setting.",
+ "ex: say \"Hello World\" will make the server say Hello World"
+ })
private List<String> commandsAfterBackup;
public Backup()
@@ -49,5 +48,4 @@ public class Backup implements StorageObject
{
return commandsAfterBackup == null ? Collections.<String>emptyList() : Collections.unmodifiableList(commandsAfterBackup);
}
-
}
diff --git a/Essentials/src/net/ess3/settings/Chat.java b/Essentials/src/net/ess3/settings/Chat.java
index 14c7cc702..a7a99fe6e 100644
--- a/Essentials/src/net/ess3/settings/Chat.java
+++ b/Essentials/src/net/ess3/settings/Chat.java
@@ -13,20 +13,20 @@ public class Chat implements StorageObject
@Comment("The character(s) to prefix all nicknames, so that you know they are not true usernames.")
private String nicknamePrefix = "~";
@Comment(
- {
- "Disable this if you have any other plugin, that modifies the displayname of a user.",
- "If it is not set, it will be enabled if EssentialsChat is installed, otherwise not."
- })
+ {
+ "Disable this if you have any other plugin, that modifies the displayname of a user.",
+ "If it is not set, it will be enabled if EssentialsChat is installed, otherwise not."
+ })
private Boolean changeDisplayname;
private String displaynameFormat = "{PREFIX}{NICKNAMEPREFIX}{NAME}{SUFFIX}";
@Comment(
- {
- "If EssentialsChat is installed, this will define how far a player's voice travels, in blocks. Set to 0 to make all chat global.",
- "Note that users with the \"essentials.chat.spy\" permission will hear everything, regardless of this setting.",
- "Users with essentials.chat.shout can override this by prefixing text with an exclamation mark (!)",
- "Or with essentials.chat.question can override this by prefixing text with a question mark (?)",
- "You can add command costs for shout/question by adding chat-shout and chat-question to the command costs section."
- })
+ {
+ "If EssentialsChat is installed, this will define how far a player's voice travels, in blocks. Set to 0 to make all chat global.",
+ "Note that users with the \"essentials.chat.spy\" permission will hear everything, regardless of this setting.",
+ "Users with essentials.chat.shout can override this by prefixing text with an exclamation mark (!)",
+ "Or with essentials.chat.question can override this by prefixing text with a question mark (?)",
+ "You can add command costs for shout/question by adding chat-shout and chat-question to the command costs section."
+ })
private int localRadius = 0;
@Comment("Set the default chat format here, it will be overwritten by group specific chat formats.")
private String defaultFormat = "&7[{GROUP}]&f {DISPLAYNAME}&7:&f {MESSAGE}";
diff --git a/Essentials/src/net/ess3/settings/Commands.java b/Essentials/src/net/ess3/settings/Commands.java
index e78e09f34..6bd29b4c7 100644
--- a/Essentials/src/net/ess3/settings/Commands.java
+++ b/Essentials/src/net/ess3/settings/Commands.java
@@ -26,16 +26,16 @@ public class Commands implements StorageObject
private Speed speed = new Speed();
@ListType
@Comment(
- {
- "When a command conflicts with another plugin, by default, Essentials will try to force the OTHER plugin to take",
- "priority. If a command is in this list, Essentials will try to give ITSELF priority. This does not always work:",
- "usually whichever plugin was updated most recently wins out. However, the full name of the command will always work.",
- "For example, if WorldGuard and Essentials are both enabled, and WorldGuard takes control over /god, /essentials:god",
- "will still map to Essentials, whereas it might normally get forced upon WorldGuard. Commands prefixed with an \"e\",",
- "such as /egod, will always grant Essentials priority.",
- "We should try to take priority over /god. If this doesn't work, use /essentials:god or /egod.",
- "If god is set using WorldGuard, use /ungod to remove then use whichever you see fit."
- })
+ {
+ "When a command conflicts with another plugin, by default, Essentials will try to force the OTHER plugin to take",
+ "priority. If a command is in this list, Essentials will try to give ITSELF priority. This does not always work:",
+ "usually whichever plugin was updated most recently wins out. However, the full name of the command will always work.",
+ "For example, if WorldGuard and Essentials are both enabled, and WorldGuard takes control over /god, /essentials:god",
+ "will still map to Essentials, whereas it might normally get forced upon WorldGuard. Commands prefixed with an \"e\",",
+ "such as /egod, will always grant Essentials priority.",
+ "We should try to take priority over /god. If this doesn't work, use /essentials:god or /egod.",
+ "If god is set using WorldGuard, use /ungod to remove then use whichever you see fit."
+ })
@Getter(AccessLevel.NONE)
@Setter(AccessLevel.NONE)
private List<String> overridden = null;
diff --git a/Essentials/src/net/ess3/settings/Economy.java b/Essentials/src/net/ess3/settings/Economy.java
index bd37372bd..e43992b61 100644
--- a/Essentials/src/net/ess3/settings/Economy.java
+++ b/Essentials/src/net/ess3/settings/Economy.java
@@ -26,32 +26,29 @@ public class Economy implements StorageObject
{
return currencySymbol == null || currencySymbol.isEmpty() ? "$" : currencySymbol.substring(0, 1);
}
-
- private final transient static double MAXMONEY = 10000000000000.0;
+ private final static double MAXMONEY = 10000000000000.0;
@Comment(
- {
- "Set the maximum amount of money a player can have",
- "The amount is always limited to 10 trillions because of the limitations of a java double"
- })
+ {
+ "Set the maximum amount of money a player can have",
+ "The amount is always limited to 10 trillions because of the limitations of a java double"
+ })
private double maxMoney = MAXMONEY;
public double getMaxMoney()
{
return Math.abs(maxMoney) > MAXMONEY ? MAXMONEY : Math.abs(maxMoney);
}
-
@Comment(
- {
- "Set the minimum amount of money a player can have (must be above the negative of max-money).",
- "Setting this to 0, will disable overdrafts/loans completely. Users need 'essentials.eco.loan' perm to go below 0."
- })
+ {
+ "Set the minimum amount of money a player can have (must be above the negative of max-money).",
+ "Setting this to 0, will disable overdrafts/loans completely. Users need 'essentials.eco.loan' perm to go below 0."
+ })
private double minMoney = -MAXMONEY;
public double getMinMoney()
{
return Math.abs(minMoney) > MAXMONEY ? -MAXMONEY : minMoney;
}
-
@Comment("Enable this to log all interactions with trade/buy/sell signs and sell command")
private boolean logEnabled = false;
private Worth worth = new Worth();
diff --git a/Essentials/src/net/ess3/settings/General.java b/Essentials/src/net/ess3/settings/General.java
index 6fbdb5b8c..01ee58704 100644
--- a/Essentials/src/net/ess3/settings/General.java
+++ b/Essentials/src/net/ess3/settings/General.java
@@ -17,24 +17,24 @@ public class General implements StorageObject
@Comment("Turn this on, if you want to see more error messages, if something goes wrong.")
private boolean debug = false;
@Comment(
- {
- "Set the locale here, if you want to change the language of Essentials.",
- "If this is not set, Essentials will use the language of your computer.", "Available locales: da, de, en, fr, nl"
- })
+ {
+ "Set the locale here, if you want to change the language of Essentials.",
+ "If this is not set, Essentials will use the language of your computer.", "Available locales: da, de, en, fr, nl"
+ })
private String locale;
@Comment(
- {
- "The number of items given, if the quantity parameter is left out in /item or /give.",
- "If this number is below 1, the maximum stack size size is given. If oversized stacks",
- "is not enabled, any number higher then the maximum stack size results in more than one stack."
- })
+ {
+ "The number of items given, if the quantity parameter is left out in /item or /give.",
+ "If this number is below 1, the maximum stack size size is given. If oversized stacks",
+ "is not enabled, any number higher then the maximum stack size results in more than one stack."
+ })
private int defaultStacksize = -1;
@Comment(
- {
- "Oversized stacks are stacks that ignore the normal max stacksize.",
- "They can be obtained using /give and /item, if the player has essentials.oversizedstacks permission.",
- "How many items should be in a oversized stack?"
- })
+ {
+ "Oversized stacks are stacks that ignore the normal max stacksize.",
+ "They can be obtained using /give and /item, if the player has essentials.oversizedstacks permission.",
+ "How many items should be in a oversized stack?"
+ })
private int oversizedStacksize = 64;
@@ -42,21 +42,19 @@ public class General implements StorageObject
{
FILE, GROUPMANAGER, VAULT
}
-
-
@Comment(
- {
- "Sets the place where group options should be stored:", " FILE: Options are stored inside groups.yml in the Essentials folder",
- " GROUPMANAGER: Options are stored using the GroupManager groups",
- " VAULT: Options are stored using a permissions plugin supported by Vault"
- })
+ {
+ "Sets the place where group options should be stored:", " FILE: Options are stored inside groups.yml in the Essentials folder",
+ " GROUPMANAGER: Options are stored using the GroupManager groups",
+ " VAULT: Options are stored using a permissions plugin supported by Vault"
+ })
private GroupStorage groupStorage = GroupStorage.FILE;
@Comment(
- {
- "Set to true to enable per-world permissions for teleporting between worlds with essentials commands",
- "This applies to /world, /back, /tp[a|o][here|all], but not warps.",
- "Give someone permission to teleport to a world with essentials.world.<worldname>"
- })
+ {
+ "Set to true to enable per-world permissions for teleporting between worlds with essentials commands",
+ "This applies to /world, /back, /tp[a|o][here|all], but not warps.",
+ "Give someone permission to teleport to a world with essentials.world.<worldname>"
+ })
private boolean worldTeleportPermissions = false;
private boolean worldHomePermissions = false;
@Comment("Delay to wait before people can cause attack damage after logging in ")
@@ -71,7 +69,6 @@ public class General implements StorageObject
{
this.loginAttackDelay = loginAttackDelay / 1000;
}
-
private Boolean metricsEnabled = null;
@Comment("The join message when players join the server")
private String joinMessage = "&e{PLAYER} has joined the game";
diff --git a/Essentials/src/net/ess3/settings/Kits.java b/Essentials/src/net/ess3/settings/Kits.java
index f68ac5d83..2892729c4 100644
--- a/Essentials/src/net/ess3/settings/Kits.java
+++ b/Essentials/src/net/ess3/settings/Kits.java
@@ -21,11 +21,10 @@ public class Kits implements StorageObject
kit.setDelay(10.0);
kit.setItems(
Arrays.<ItemStack>asList(
- new ItemStack(Material.DIAMOND_SPADE, 1), new ItemStack(Material.DIAMOND_PICKAXE, 1), new ItemStack(Material.DIAMOND_AXE, 1)));
+ new ItemStack(Material.DIAMOND_SPADE, 1), new ItemStack(Material.DIAMOND_PICKAXE, 1), new ItemStack(Material.DIAMOND_AXE, 1)));
kits = new HashMap<String, Kit>();
kits.put("tools", kit);
}
-
@MapValueType(Kit.class)
@Getter(AccessLevel.NONE)
@Setter(AccessLevel.NONE)
diff --git a/Essentials/src/net/ess3/settings/Settings.java b/Essentials/src/net/ess3/settings/Settings.java
index a73e5f42d..9552c4cc7 100644
--- a/Essentials/src/net/ess3/settings/Settings.java
+++ b/Essentials/src/net/ess3/settings/Settings.java
@@ -12,39 +12,39 @@ import net.ess3.storage.StorageObject;
public class Settings implements StorageObject
{
@Comment(
- {
- "##########################################################", "+------------------------------------------------------+ #",
- "| General Settings | #", "+------------------------------------------------------+ #",
- "##########################################################"
- })
+ {
+ "##########################################################", "+------------------------------------------------------+ #",
+ "| General Settings | #", "+------------------------------------------------------+ #",
+ "##########################################################"
+ })
private General general = new General();
@Comment(
- {
- "##########################################################", "+------------------------------------------------------+ #",
- "| Chat Settings | #", "+------------------------------------------------------+ #",
- "##########################################################"
- })
+ {
+ "##########################################################", "+------------------------------------------------------+ #",
+ "| Chat Settings | #", "+------------------------------------------------------+ #",
+ "##########################################################"
+ })
private Chat chat = new Chat();
@Comment(
- {
- "##########################################################", "+------------------------------------------------------+ #",
- "| Economy Settings | #", "+------------------------------------------------------+ #",
- "##########################################################"
- })
+ {
+ "##########################################################", "+------------------------------------------------------+ #",
+ "| Economy Settings | #", "+------------------------------------------------------+ #",
+ "##########################################################"
+ })
private Economy economy = new Economy();
@Comment(
- {
- "##########################################################", "+------------------------------------------------------+ #",
- "| Commands Settings | #", "+------------------------------------------------------+ #",
- "##########################################################"
- })
+ {
+ "##########################################################", "+------------------------------------------------------+ #",
+ "| Commands Settings | #", "+------------------------------------------------------+ #",
+ "##########################################################"
+ })
private Commands commands = new Commands();
@Comment(
- {
- "##########################################################", "+------------------------------------------------------+ #",
- "| Worlds Settings | #", "+------------------------------------------------------+ #",
- "##########################################################"
- })
+ {
+ "##########################################################", "+------------------------------------------------------+ #",
+ "| Worlds Settings | #", "+------------------------------------------------------+ #",
+ "##########################################################"
+ })
@MapValueType(WorldOptions.class)
@Getter(AccessLevel.NONE)
@Setter(AccessLevel.NONE)
diff --git a/Essentials/src/net/ess3/settings/SettingsHolder.java b/Essentials/src/net/ess3/settings/SettingsHolder.java
index e9b7f8af3..5d5ab3934 100644
--- a/Essentials/src/net/ess3/settings/SettingsHolder.java
+++ b/Essentials/src/net/ess3/settings/SettingsHolder.java
@@ -8,7 +8,7 @@ import net.ess3.storage.AsyncStorageObjectHolder;
public class SettingsHolder extends AsyncStorageObjectHolder<Settings> implements ISettings
{
- private transient volatile boolean debug = false;
+ private volatile boolean debug = false;
public SettingsHolder(final IEssentials ess)
{
diff --git a/Essentials/src/net/ess3/settings/Spawns.java b/Essentials/src/net/ess3/settings/Spawns.java
index 7d05d55d2..57a63409c 100644
--- a/Essentials/src/net/ess3/settings/Spawns.java
+++ b/Essentials/src/net/ess3/settings/Spawns.java
@@ -16,22 +16,22 @@ import org.bukkit.Location;
public class Spawns implements StorageObject
{
@Comment(
- {
- "Should we announce to the server when someone logs in for the first time?",
- "If so, use this format, replacing {DISPLAYNAME} with the player name.", "If not, set to ''"
- })
+ {
+ "Should we announce to the server when someone logs in for the first time?",
+ "If so, use this format, replacing {DISPLAYNAME} with the player name.", "If not, set to ''"
+ })
private String newPlayerAnnouncement = "&dWelcome {DISPLAYNAME} to the server!";
@Comment(
- {
- "Priority of the respawn event listener", "Set this to lowest, if you want e.g. Multiverse to handle the respawning",
- "Set this to normal, if you want EssentialsSpawn to handle the respawning",
- "Set this to highest, if you want to force EssentialsSpawn to handle the respawning"
- })
+ {
+ "Priority of the respawn event listener", "Set this to lowest, if you want e.g. Multiverse to handle the respawning",
+ "Set this to normal, if you want EssentialsSpawn to handle the respawning",
+ "Set this to highest, if you want to force EssentialsSpawn to handle the respawning"
+ })
private String respawnPriority = "normal";
@Comment(
- {
- "When we spawn for the first time, which spawnpoint do we use?", "Set to none if you want to use the spawn point of the world."
- })
+ {
+ "When we spawn for the first time, which spawnpoint do we use?", "Set to none if you want to use the spawn point of the world."
+ })
private String newbieSpawn = "none";
@Comment("List of all spawnpoints")
@MapValueType(StoredLocation.class)
diff --git a/Essentials/src/net/ess3/settings/SpawnsHolder.java b/Essentials/src/net/ess3/settings/SpawnsHolder.java
index 1c310c7c3..9aaaaa350 100644
--- a/Essentials/src/net/ess3/settings/SpawnsHolder.java
+++ b/Essentials/src/net/ess3/settings/SpawnsHolder.java
@@ -38,7 +38,7 @@ public class SpawnsHolder extends AsyncStorageObjectHolder<Spawns> implements IE
/**
* Sets a spawn location
*
- * @param loc - Location you want to set as spawn
+ * @param loc - Location you want to set as spawn
* @param group - Group to save it undr in the config
*/
public void setSpawn(final Location loc, final String group)
@@ -174,8 +174,8 @@ public class SpawnsHolder extends AsyncStorageObjectHolder<Spawns> implements IE
private class SpawnPlayerListener implements Listener // TODO: What is this for?
{
- private final transient IEssentials ess;
- private final transient SpawnsHolder spawns;
+ private final IEssentials ess;
+ private final SpawnsHolder spawns;
public SpawnPlayerListener(final IEssentials ess, final SpawnsHolder spawns)
{
@@ -187,8 +187,6 @@ public class SpawnsHolder extends AsyncStorageObjectHolder<Spawns> implements IE
public void onPlayerRespawn(final PlayerRespawnEvent event)
{
final IUser user = ess.getUserMap().getUser(event.getPlayer());
-
- final ISettings settings = ess.getSettings();
boolean respawnAtHome = ess.getSettings().getData().getCommands().getHome().isRespawnAtHome();
if (respawnAtHome)
{
@@ -240,7 +238,7 @@ public class SpawnsHolder extends AsyncStorageObjectHolder<Spawns> implements IE
private class NewPlayerTeleport implements Runnable
{
- private final transient IUser user;
+ private final IUser user;
public NewPlayerTeleport(final IUser user)
{
diff --git a/Essentials/src/net/ess3/settings/WorldOptions.java b/Essentials/src/net/ess3/settings/WorldOptions.java
index e49ebb181..40e57dee7 100644
--- a/Essentials/src/net/ess3/settings/WorldOptions.java
+++ b/Essentials/src/net/ess3/settings/WorldOptions.java
@@ -26,7 +26,6 @@ public class WorldOptions implements StorageObject
}
}
}
-
@Comment("Disables godmode for all players if they teleport to this world.")
private boolean godmode = true;
@Comment("Prevent creatures spawning")
diff --git a/Essentials/src/net/ess3/settings/Worlds.java b/Essentials/src/net/ess3/settings/Worlds.java
index c3f1f09d0..10dc63823 100644
--- a/Essentials/src/net/ess3/settings/Worlds.java
+++ b/Essentials/src/net/ess3/settings/Worlds.java
@@ -9,5 +9,4 @@ import net.ess3.storage.StorageObject;
@EqualsAndHashCode(callSuper = false)
public class Worlds implements StorageObject
{
-
} \ No newline at end of file
diff --git a/Essentials/src/net/ess3/settings/antibuild/Alert.java b/Essentials/src/net/ess3/settings/antibuild/Alert.java
index 481cc39ec..dc11841b1 100644
--- a/Essentials/src/net/ess3/settings/antibuild/Alert.java
+++ b/Essentials/src/net/ess3/settings/antibuild/Alert.java
@@ -32,8 +32,9 @@ public class Alert implements StorageObject
public void setupDefaults()
{
- Material[] mat = {
- Material.LAVA, Material.STATIONARY_LAVA, Material.TNT, Material.LAVA_BUCKET
+ Material[] mat =
+ {
+ Material.LAVA, Material.STATIONARY_LAVA, Material.TNT, Material.LAVA_BUCKET
};
alertOnPlacement.addAll(Arrays.asList(mat));
alertOnUse.add(Material.LAVA_BUCKET);
diff --git a/Essentials/src/net/ess3/settings/antibuild/AntiBuild.java b/Essentials/src/net/ess3/settings/antibuild/AntiBuild.java
index 3bbf32f42..b45c65e3e 100644
--- a/Essentials/src/net/ess3/settings/antibuild/AntiBuild.java
+++ b/Essentials/src/net/ess3/settings/antibuild/AntiBuild.java
@@ -11,24 +11,22 @@ import net.ess3.storage.StorageObject;
public class AntiBuild implements StorageObject
{
@Comment(
- {
- "Should people with build: false in permissions be allowed to build", "Set true to disable building for those people",
- "Setting to false means EssentialsAntiBuild will never prevent you from building"
- })
+ {
+ "Should people with build: false in permissions be allowed to build", "Set true to disable building for those people",
+ "Setting to false means EssentialsAntiBuild will never prevent you from building"
+ })
private boolean disableBuild = true;
@Comment(
- {
- "Should people with build: false in permissions be allowed to use items", "Set true to disable using for those people",
- "Setting to false means EssentialsAntiBuild will never prevent you from using"
- })
+ {
+ "Should people with build: false in permissions be allowed to use items", "Set true to disable using for those people",
+ "Setting to false means EssentialsAntiBuild will never prevent you from using"
+ })
private boolean disableUse = true;
@Comment(
- {
- "Should we tell people they are not allowed to build"
- })
+ {
+ "Should we tell people they are not allowed to build"
+ })
private boolean warnOnBuildDisallow = true;
-
private Alert alert = new Alert();
private BlackList blacklist = new BlackList();
-
}
diff --git a/Essentials/src/net/ess3/settings/antibuild/BlackList.java b/Essentials/src/net/ess3/settings/antibuild/BlackList.java
index af9205f7e..ca67ab479 100644
--- a/Essentials/src/net/ess3/settings/antibuild/BlackList.java
+++ b/Essentials/src/net/ess3/settings/antibuild/BlackList.java
@@ -15,33 +15,33 @@ import org.bukkit.Material;
public class BlackList implements StorageObject
{
@Comment(
- {
- "Which blocks should people be prevented from placing"
- })
+ {
+ "Which blocks should people be prevented from placing"
+ })
@ListType(Material.class)
@Getter(AccessLevel.NONE)
@Setter(AccessLevel.NONE)
private Set<Material> placement = new HashSet<Material>();
@Comment(
- {
- "Which items should people be prevented from using"
- })
+ {
+ "Which items should people be prevented from using"
+ })
@ListType(Material.class)
@Getter(AccessLevel.NONE)
@Setter(AccessLevel.NONE)
private Set<Material> usage = new HashSet<Material>();
@Comment(
- {
- "Which blocks should people be prevented from breaking"
- })
+ {
+ "Which blocks should people be prevented from breaking"
+ })
@ListType(Material.class)
@Getter(AccessLevel.NONE)
@Setter(AccessLevel.NONE)
private Set<Material> breaking = new HashSet<Material>();
@Comment(
- {
- "Which blocks should not be pushed by pistons"
- })
+ {
+ "Which blocks should not be pushed by pistons"
+ })
@ListType(Material.class)
@Getter(AccessLevel.NONE)
@Setter(AccessLevel.NONE)
@@ -49,8 +49,9 @@ public class BlackList implements StorageObject
public void setupDefaults()
{
- Material[] mat = {
- Material.LAVA, Material.STATIONARY_LAVA, Material.TNT, Material.LAVA_BUCKET
+ Material[] mat =
+ {
+ Material.LAVA, Material.STATIONARY_LAVA, Material.TNT, Material.LAVA_BUCKET
};
placement.addAll(Arrays.asList(mat));
}
diff --git a/Essentials/src/net/ess3/settings/commands/Afk.java b/Essentials/src/net/ess3/settings/commands/Afk.java
index 5136dd8d0..2f3ab65dd 100644
--- a/Essentials/src/net/ess3/settings/commands/Afk.java
+++ b/Essentials/src/net/ess3/settings/commands/Afk.java
@@ -11,22 +11,21 @@ import net.ess3.storage.StorageObject;
public class Afk implements StorageObject
{
@Comment(
- {
- "After this timeout in seconds, the user will be set as afk.", "Set to -1 for no timeout."
- })
+ {
+ "After this timeout in seconds, the user will be set as afk.", "Set to -1 for no timeout."
+ })
private long autoAFK = 300;
@Comment(
- {
- "Auto-AFK Kick", "After this timeout in seconds, the user will be kicked from the server.", "Set to -1 for no timeout."
- })
+ {
+ "Auto-AFK Kick", "After this timeout in seconds, the user will be kicked from the server.", "Set to -1 for no timeout."
+ })
private long autoAFKKick = -1;
@Comment(
- {
- "Set this to true, if you want to freeze the player, if he is afk.", "Other players or monsters can't push him out of afk mode then.",
- "This will also enable temporary god mode for the afk player.", "The player has to use the command /afk to leave the afk mode.",
- "You have to add a message to your welcome message or help page,", "since the player will not get a message, if he tries to move."
- })
+ {
+ "Set this to true, if you want to freeze the player, if he is afk.", "Other players or monsters can't push him out of afk mode then.",
+ "This will also enable temporary god mode for the afk player.", "The player has to use the command /afk to leave the afk mode.",
+ "You have to add a message to your welcome message or help page,", "since the player will not get a message, if he tries to move."
+ })
private boolean freezeAFKPlayers = false;
-
private boolean disableItemPickupWhileAfk = true;
}
diff --git a/Essentials/src/net/ess3/settings/commands/Back.java b/Essentials/src/net/ess3/settings/commands/Back.java
index c0e7ed7b6..e83c53860 100644
--- a/Essentials/src/net/ess3/settings/commands/Back.java
+++ b/Essentials/src/net/ess3/settings/commands/Back.java
@@ -11,9 +11,9 @@ import net.ess3.storage.StorageObject;
public class Back implements StorageObject
{
@Comment(
- {
- "Do you want essentials to keep track of previous location for /back in the teleport listener?",
- "If you set this to true any plugin that uses teleport will have the previous location registered."
- })
+ {
+ "Do you want essentials to keep track of previous location for /back in the teleport listener?",
+ "If you set this to true any plugin that uses teleport will have the previous location registered."
+ })
private boolean registerBackInListener = false;
}
diff --git a/Essentials/src/net/ess3/settings/commands/Help.java b/Essentials/src/net/ess3/settings/commands/Help.java
index 77eeacb55..585426dce 100644
--- a/Essentials/src/net/ess3/settings/commands/Help.java
+++ b/Essentials/src/net/ess3/settings/commands/Help.java
@@ -13,11 +13,11 @@ public class Help implements StorageObject
@Comment("Show other plugins commands in help")
private boolean showNonEssCommandsInHelp = true;
@Comment(
- {
- "Hide plugins which don't give a permission in their plugin.yml for each command.",
- "You can override a true value here for a single plugin by adding a permission to a user/group.",
- "The individual permission is: essentials.help.<plugin>, anyone with essentials.* or '*' will see all help this setting reguardless.",
- "You can use negative permissions to remove access to just a single plugins help if the following is enabled."
- })
+ {
+ "Hide plugins which don't give a permission in their plugin.yml for each command.",
+ "You can override a true value here for a single plugin by adding a permission to a user/group.",
+ "The individual permission is: essentials.help.<plugin>, anyone with essentials.* or '*' will see all help this setting reguardless.",
+ "You can use negative permissions to remove access to just a single plugins help if the following is enabled."
+ })
private boolean hidePermissionlessCommands = true;
}
diff --git a/Essentials/src/net/ess3/settings/commands/Home.java b/Essentials/src/net/ess3/settings/commands/Home.java
index 2ef08fe1f..8b4c7356b 100644
--- a/Essentials/src/net/ess3/settings/commands/Home.java
+++ b/Essentials/src/net/ess3/settings/commands/Home.java
@@ -13,11 +13,11 @@ public class Home implements StorageObject
@Comment("When players die, should they respawn at their homes, instead of the spawnpoint?")
private boolean respawnAtHome = false;
@Comment(
- {
- "When a player interacts with a bed, should their home be set to that location?",
- "If you enable this and remove default player access to the /sethome command, ",
- "you can make beds the only way for players to set their home location."
- })
+ {
+ "When a player interacts with a bed, should their home be set to that location?",
+ "If you enable this and remove default player access to the /sethome command, ",
+ "you can make beds the only way for players to set their home location."
+ })
private boolean bedSetsHome = false;
@Comment("If no home is set, should the player be send to spawn, when /home is used.")
private boolean spawnIfNoHome = false;
diff --git a/Essentials/src/net/ess3/settings/commands/List.java b/Essentials/src/net/ess3/settings/commands/List.java
index e2b869aaf..ea47d9115 100644
--- a/Essentials/src/net/ess3/settings/commands/List.java
+++ b/Essentials/src/net/ess3/settings/commands/List.java
@@ -1,6 +1,5 @@
package net.ess3.settings.commands;
-
import lombok.Data;
import lombok.EqualsAndHashCode;
import net.ess3.storage.Comment;
diff --git a/Essentials/src/net/ess3/settings/commands/SocialSpy.java b/Essentials/src/net/ess3/settings/commands/SocialSpy.java
index 4460c0cfd..9cb572689 100644
--- a/Essentials/src/net/ess3/settings/commands/SocialSpy.java
+++ b/Essentials/src/net/ess3/settings/commands/SocialSpy.java
@@ -21,7 +21,6 @@ public class SocialSpy implements StorageObject
socialspyCommands.addAll(Arrays.asList("msg", "r", "mail", "m", "t", "emsg", "tell", "er", "reply", "ereply", "email"));
}
}
-
@ListType
@Comment("Commands to listen for in socialspy")
private List<String> socialspyCommands = new ArrayList<String>();
diff --git a/Essentials/src/net/ess3/settings/commands/Speed.java b/Essentials/src/net/ess3/settings/commands/Speed.java
index 295a6a1b3..b9e7a8988 100644
--- a/Essentials/src/net/ess3/settings/commands/Speed.java
+++ b/Essentials/src/net/ess3/settings/commands/Speed.java
@@ -10,9 +10,14 @@ import net.ess3.storage.StorageObject;
@EqualsAndHashCode(callSuper = false)
public class Speed implements StorageObject
{
- @Comment({"Set the max fly speed, values range from 0.2 to 1.0"})
+ @Comment(
+ {
+ "Set the max fly speed, values range from 0.2 to 1.0"
+ })
private double maxFlySpeed = 1.0f;
-
- @Comment({"Set the max walk speed, values range from 0.1 to 1.0"})
+ @Comment(
+ {
+ "Set the max walk speed, values range from 0.1 to 1.0"
+ })
private double maxWalkSpeed = 0.8f;
}
diff --git a/Essentials/src/net/ess3/settings/commands/Teleport.java b/Essentials/src/net/ess3/settings/commands/Teleport.java
index ffa576410..71b41028d 100644
--- a/Essentials/src/net/ess3/settings/commands/Teleport.java
+++ b/Essentials/src/net/ess3/settings/commands/Teleport.java
@@ -11,17 +11,20 @@ import net.ess3.storage.StorageObject;
public class Teleport implements StorageObject
{
@Comment(
- {
- "Set timeout in seconds for players to accept tpa before request is cancelled.", "Set to 0 for no timeout."
- })
+ {
+ "Set timeout in seconds for players to accept tpa before request is cancelled.", "Set to 0 for no timeout."
+ })
private int requestTimeout = 120;
- @Comment({"Cancels a request made by tpa / tphere on world change to prevent cross world tp"})
+ @Comment(
+ {
+ "Cancels a request made by tpa / tphere on world change to prevent cross world tp"
+ })
private boolean cancelRequestsOnWorldChange = false;
@Comment(
- {
- "The delay, in seconds, a player can't be attacked by other players after he has been teleported by a command",
- "This will also prevent that the player can attack other players"
- })
+ {
+ "The delay, in seconds, a player can't be attacked by other players after he has been teleported by a command",
+ "This will also prevent that the player can attack other players"
+ })
private long invulnerability = 0;
public long getInvulnerability()
diff --git a/Essentials/src/net/ess3/settings/protect/Prevent.java b/Essentials/src/net/ess3/settings/protect/Prevent.java
index 553776c9d..524afe6f2 100644
--- a/Essentials/src/net/ess3/settings/protect/Prevent.java
+++ b/Essentials/src/net/ess3/settings/protect/Prevent.java
@@ -10,7 +10,6 @@ import net.ess3.storage.StorageObject;
@EqualsAndHashCode(callSuper = false)
public class Prevent implements StorageObject
{
-
private boolean lavaFlow = false;
private boolean waterFlow = false;
// private boolean waterbucketFlow = false; TODO: Test if this still works
@@ -30,8 +29,8 @@ public class Prevent implements StorageObject
private boolean endermanPickup = false;
private boolean villagerDeath = false;
@Comment(
- {
- "Monsters won't follow players", "permission essentials.protect.entitytarget.bypass disables this"
- })
+ {
+ "Monsters won't follow players", "permission essentials.protect.entitytarget.bypass disables this"
+ })
private boolean entitytarget = false;
} \ No newline at end of file
diff --git a/Essentials/src/net/ess3/settings/protect/Protect.java b/Essentials/src/net/ess3/settings/protect/Protect.java
index ff4af10ff..420c5028e 100644
--- a/Essentials/src/net/ess3/settings/protect/Protect.java
+++ b/Essentials/src/net/ess3/settings/protect/Protect.java
@@ -13,15 +13,13 @@ public class Protect implements StorageObject
@Comment("General physics/behavior modifications")
private Prevent prevent = new Prevent();
@Comment(
- {
- "Maximum height the creeper should explode. -1 allows them to explode everywhere.",
- "Set prevent.creeper-explosion to true, if you want to disable creeper explosions."
- })
+ {
+ "Maximum height the creeper should explode. -1 allows them to explode everywhere.",
+ "Set prevent.creeper-explosion to true, if you want to disable creeper explosions."
+ })
private int creeperMaxHeight = -1;
-
@Comment("Disable weather options")
private boolean disableStorm = false;
private boolean disableThunder = false;
private boolean disableLighting = false;
-
}
diff --git a/Essentials/src/net/ess3/storage/AbstractDelayedYamlFileReader.java b/Essentials/src/net/ess3/storage/AbstractDelayedYamlFileReader.java
index b38f5750b..714138349 100644
--- a/Essentials/src/net/ess3/storage/AbstractDelayedYamlFileReader.java
+++ b/Essentials/src/net/ess3/storage/AbstractDelayedYamlFileReader.java
@@ -11,8 +11,8 @@ import org.bukkit.Bukkit;
public abstract class AbstractDelayedYamlFileReader<T extends StorageObject> implements Runnable
{
- private final transient Class<T> clazz;
- private final transient IEssentials ess;
+ private final Class<T> clazz;
+ private final IEssentials ess;
public AbstractDelayedYamlFileReader(final IEssentials ess, final Class<T> clazz)
{
diff --git a/Essentials/src/net/ess3/storage/AbstractDelayedYamlFileWriter.java b/Essentials/src/net/ess3/storage/AbstractDelayedYamlFileWriter.java
index 2a74c4cd5..ade8eeb93 100644
--- a/Essentials/src/net/ess3/storage/AbstractDelayedYamlFileWriter.java
+++ b/Essentials/src/net/ess3/storage/AbstractDelayedYamlFileWriter.java
@@ -11,8 +11,8 @@ import org.bukkit.Bukkit;
public abstract class AbstractDelayedYamlFileWriter implements Runnable
{
- private final transient IEssentials ess;
- private final transient ReentrantLock lock = new ReentrantLock(); // TODO: Needed?
+ private final IEssentials ess;
+ private final ReentrantLock lock = new ReentrantLock(); // TODO: Needed?
public AbstractDelayedYamlFileWriter(final IEssentials ess)
{
diff --git a/Essentials/src/net/ess3/storage/AsyncStorageObjectHolder.java b/Essentials/src/net/ess3/storage/AsyncStorageObjectHolder.java
index d4239db8e..b4a82b2bc 100644
--- a/Essentials/src/net/ess3/storage/AsyncStorageObjectHolder.java
+++ b/Essentials/src/net/ess3/storage/AsyncStorageObjectHolder.java
@@ -10,14 +10,14 @@ import org.bukkit.Bukkit;
public abstract class AsyncStorageObjectHolder<T extends StorageObject> implements IStorageObjectHolder<T>
{
- private transient T data;
- private final transient Class<T> clazz;
- protected final transient IEssentials ess;
- private final transient StorageObjectDataWriter writer;
- private final transient StorageObjectDataReader reader;
- private final transient AtomicBoolean loaded = new AtomicBoolean(false);
+ private T data;
+ private final Class<T> clazz;
+ protected final IEssentials ess;
+ private final StorageObjectDataWriter writer;
+ private final StorageObjectDataReader reader;
+ private final AtomicBoolean loaded = new AtomicBoolean(false);
private volatile long savetime = 0;
- private final transient File file;
+ private final File file;
public AsyncStorageObjectHolder(final IEssentials ess, final Class<T> clazz, final File file)
{
diff --git a/Essentials/src/net/ess3/storage/BukkitConstructor.java b/Essentials/src/net/ess3/storage/BukkitConstructor.java
index 89f20cdf8..666c07931 100644
--- a/Essentials/src/net/ess3/storage/BukkitConstructor.java
+++ b/Essentials/src/net/ess3/storage/BukkitConstructor.java
@@ -21,9 +21,9 @@ import org.yaml.snakeyaml.nodes.*;
public class BukkitConstructor extends Constructor
{
- private final transient Pattern DATAPATTERN = Pattern.compile("[:+',;.]");
- private final transient Pattern WORD = Pattern.compile("\\W");
- private final transient IPlugin plugin;
+ private final Pattern DATAPATTERN = Pattern.compile("[:+',;.]");
+ private final Pattern WORD = Pattern.compile("\\W");
+ private final IPlugin plugin;
public BukkitConstructor(final Class<?> clazz, final IPlugin plugin)
{
diff --git a/Essentials/src/net/ess3/storage/ManagedFile.java b/Essentials/src/net/ess3/storage/ManagedFile.java
index 0c3def687..90429968a 100644
--- a/Essentials/src/net/ess3/storage/ManagedFile.java
+++ b/Essentials/src/net/ess3/storage/ManagedFile.java
@@ -18,7 +18,7 @@ import org.bukkit.Bukkit;
public class ManagedFile
{
private final static int BUFFERSIZE = 1024 * 8;
- private final transient File file;
+ private final File file;
public ManagedFile(final String filename, final IEssentials ess)
{
diff --git a/Essentials/src/net/ess3/storage/StorageObjectMap.java b/Essentials/src/net/ess3/storage/StorageObjectMap.java
index bb7894b51..aeaf14892 100644
--- a/Essentials/src/net/ess3/storage/StorageObjectMap.java
+++ b/Essentials/src/net/ess3/storage/StorageObjectMap.java
@@ -26,11 +26,11 @@ import org.apache.commons.io.IOUtils;
public abstract class StorageObjectMap<I> extends CacheLoader<String, I> implements IStorageObjectMap<I>
{
- protected final transient IEssentials ess;
- private final transient File folder;
- protected final transient Cache<String, I> cache = CacheBuilder.newBuilder().softValues().build(this);
- protected final transient ConcurrentSkipListSet<String> keys = new ConcurrentSkipListSet<String>();
- protected final transient ConcurrentSkipListMap<String, File> zippedfiles = new ConcurrentSkipListMap<String, File>();
+ protected final IEssentials ess;
+ private final File folder;
+ protected final Cache<String, I> cache = CacheBuilder.newBuilder().softValues().build(this);
+ protected final ConcurrentSkipListSet<String> keys = new ConcurrentSkipListSet<String>();
+ protected final ConcurrentSkipListMap<String, File> zippedfiles = new ConcurrentSkipListMap<String, File>();
private final Pattern zipCheck = Pattern.compile("^[a-zA-Z0-9]*-?[a-zA-Z0-9]+\\.yml$");
public StorageObjectMap(final IEssentials ess, final String folderName)
diff --git a/Essentials/src/net/ess3/storage/StorageQueue.java b/Essentials/src/net/ess3/storage/StorageQueue.java
index 5084ba82f..d602ad84e 100644
--- a/Essentials/src/net/ess3/storage/StorageQueue.java
+++ b/Essentials/src/net/ess3/storage/StorageQueue.java
@@ -15,7 +15,7 @@ public class StorageQueue implements Runnable
private DelayQueue<WriteRequest> queue = new DelayQueue<WriteRequest>();
public final static long DELAY = TimeUnit.NANOSECONDS.convert(1, TimeUnit.SECONDS);
private final AtomicBoolean enabled = new AtomicBoolean(false);
- private final transient Object lock = new Object();
+ private final Object lock = new Object();
private final IPlugin plugin;
public StorageQueue(IPlugin plugin)
diff --git a/Essentials/src/net/ess3/storage/YamlStorageReader.java b/Essentials/src/net/ess3/storage/YamlStorageReader.java
index f49a0b5a2..0cb0197b0 100644
--- a/Essentials/src/net/ess3/storage/YamlStorageReader.java
+++ b/Essentials/src/net/ess3/storage/YamlStorageReader.java
@@ -13,10 +13,10 @@ import org.yaml.snakeyaml.introspector.BeanAccess;
public class YamlStorageReader implements IStorageReader
{
- private transient static final Map<Class<?>, Yaml> PREPARED_YAMLS = Collections.synchronizedMap(new HashMap<Class<?>, Yaml>());
- private transient static final Map<Class<?>, ReentrantLock> LOCKS = new HashMap<Class<?>, ReentrantLock>();
- private transient final Reader reader;
- private transient final IPlugin plugin;
+ private static final Map<Class<?>, Yaml> PREPARED_YAMLS = Collections.synchronizedMap(new HashMap<Class<?>, Yaml>());
+ private static final Map<Class<?>, ReentrantLock> LOCKS = new HashMap<Class<?>, ReentrantLock>();
+ private final Reader reader;
+ private final IPlugin plugin;
public YamlStorageReader(final Reader reader, final IPlugin plugin)
{
diff --git a/Essentials/src/net/ess3/storage/YamlStorageWriter.java b/Essentials/src/net/ess3/storage/YamlStorageWriter.java
index e5de1460b..2591af79c 100644
--- a/Essentials/src/net/ess3/storage/YamlStorageWriter.java
+++ b/Essentials/src/net/ess3/storage/YamlStorageWriter.java
@@ -20,9 +20,9 @@ import org.yaml.snakeyaml.Yaml;
public class YamlStorageWriter implements IStorageWriter
{
- private transient static final Pattern NON_WORD_PATTERN = Pattern.compile("\\W");
- private transient final PrintWriter writer;
- private transient static final Yaml YAML = new Yaml();
+ private static final Pattern NON_WORD_PATTERN = Pattern.compile("\\W");
+ private final PrintWriter writer;
+ private static final Yaml YAML = new Yaml();
public YamlStorageWriter(final PrintWriter writer)
{
@@ -51,7 +51,7 @@ public class YamlStorageWriter implements IStorageWriter
for (Field field : clazz.getDeclaredFields())
{
final int modifier = field.getModifiers();
- if (Modifier.isPrivate(modifier) && !Modifier.isTransient(modifier) && !Modifier.isStatic(modifier))
+ if (Modifier.isPrivate(modifier) && !Modifier.isStatic(modifier))
{
field.setAccessible(true);
diff --git a/Essentials/src/net/ess3/user/CooldownException.java b/Essentials/src/net/ess3/user/CooldownException.java
index 08e163522..2cd9ac543 100644
--- a/Essentials/src/net/ess3/user/CooldownException.java
+++ b/Essentials/src/net/ess3/user/CooldownException.java
@@ -3,12 +3,10 @@ package net.ess3.user;
public class CooldownException extends Exception
{
-
private static final long serialVersionUID = 913632836257457319L;
public CooldownException(String timeLeft)
{
super(timeLeft);
}
-
}
diff --git a/Essentials/src/net/ess3/user/IOfflinePlayer.java b/Essentials/src/net/ess3/user/IOfflinePlayer.java
index d520ce833..97a9ade5a 100644
--- a/Essentials/src/net/ess3/user/IOfflinePlayer.java
+++ b/Essentials/src/net/ess3/user/IOfflinePlayer.java
@@ -10,7 +10,6 @@ public interface IOfflinePlayer
String getDisplayName();
//Location getBedSpawnLocation();
-
void setBanned(boolean bln);
boolean hasPermission(Permission perm);
diff --git a/Essentials/src/net/ess3/user/IOfflineUser.java b/Essentials/src/net/ess3/user/IOfflineUser.java
index b5361da4f..237569825 100644
--- a/Essentials/src/net/ess3/user/IOfflineUser.java
+++ b/Essentials/src/net/ess3/user/IOfflineUser.java
@@ -5,5 +5,4 @@ import net.ess3.storage.IStorageObjectHolder;
public interface IOfflineUser extends IStorageObjectHolder<UserData>//, IOfflinePlayer
{
-
}
diff --git a/Essentials/src/net/ess3/user/PlayerNotFoundException.java b/Essentials/src/net/ess3/user/PlayerNotFoundException.java
index 2c3c741c1..6817a7847 100644
--- a/Essentials/src/net/ess3/user/PlayerNotFoundException.java
+++ b/Essentials/src/net/ess3/user/PlayerNotFoundException.java
@@ -5,7 +5,6 @@ import static net.ess3.I18n._;
public class PlayerNotFoundException extends Exception
{
-
private static final long serialVersionUID = -510752839980332640L;
public PlayerNotFoundException()
diff --git a/Essentials/src/net/ess3/user/User.java b/Essentials/src/net/ess3/user/User.java
index 4fce959bf..7a3aba0af 100644
--- a/Essentials/src/net/ess3/user/User.java
+++ b/Essentials/src/net/ess3/user/User.java
@@ -31,22 +31,22 @@ public class User extends UserBase implements IUser
{
private CommandSender replyTo = null;
@Getter
- private transient IUser teleportRequester;
+ private IUser teleportRequester;
@Getter
- private transient boolean tpRequestHere;
+ private boolean tpRequestHere;
@Getter
- private transient final ITeleport teleport;
+ private final ITeleport teleport;
@Getter
- private transient long teleportRequestTime;
+ private long teleportRequestTime;
@Getter
@Setter
- private transient long lastOnlineActivity;
- private transient long lastActivity = System.currentTimeMillis();
+ private long lastOnlineActivity;
+ private long lastActivity = System.currentTimeMillis();
/*@Getter
@Setter
private boolean hidden = false;*/
@Getter
- private transient boolean vanished;
+ private boolean vanished;
@Getter
@Setter
private boolean invSee = false;
@@ -54,7 +54,7 @@ public class User extends UserBase implements IUser
@Setter
private boolean enderSee = false;
private long lastThrottledAction;
- private transient Location afkPosition;
+ private Location afkPosition;
private AtomicBoolean gotMailInfo = new AtomicBoolean(false);
private WeakReference<Player> playerCache;
@Getter
@@ -592,8 +592,7 @@ public class User extends UserBase implements IUser
{
return true;
}
-
- private transient long teleportInvulnerabilityTimestamp = 0;
+ private long teleportInvulnerabilityTimestamp = 0;
public void enableInvulnerabilityAfterTeleport()
{
@@ -635,7 +634,7 @@ public class User extends UserBase implements IUser
}
}
ess.getVanishedPlayers().add(getName());
- if(Permissions.VANISH_EFFECT.isAuthorized(this))
+ if (Permissions.VANISH_EFFECT.isAuthorized(this))
{
getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, false));
}
@@ -647,7 +646,7 @@ public class User extends UserBase implements IUser
p.showPlayer(getPlayer());
}
ess.getVanishedPlayers().remove(getName());
- if(Permissions.VANISH_EFFECT.isAuthorized(this))
+ if (Permissions.VANISH_EFFECT.isAuthorized(this))
{
getPlayer().removePotionEffect(PotionEffectType.INVISIBILITY);
}
diff --git a/Essentials/src/net/ess3/user/UserData.java b/Essentials/src/net/ess3/user/UserData.java
index b9d684930..9b63fab2f 100644
--- a/Essentials/src/net/ess3/user/UserData.java
+++ b/Essentials/src/net/ess3/user/UserData.java
@@ -6,6 +6,7 @@ import net.ess3.storage.*;
import org.bukkit.Location;
import org.bukkit.Material;
+
@Data
@EqualsAndHashCode(callSuper = false)
public class UserData implements StorageObject
@@ -14,8 +15,6 @@ public class UserData implements StorageObject
{
JAIL, MUTE, LASTHEAL, LASTTELEPORT, LOGIN, LOGOUT, KIT, COMMAND
}
-
-
private String nickname;
private Double money;
@MapValueType(StoredLocation.class)
@@ -27,7 +26,6 @@ public class UserData implements StorageObject
{
return homes == null ? Collections.<String, StoredLocation>emptyMap() : Collections.unmodifiableMap(homes);
}
-
@ListType(Material.class)
@Getter(AccessLevel.NONE)
@Setter(AccessLevel.NONE)
@@ -37,7 +35,6 @@ public class UserData implements StorageObject
{
return unlimited == null ? Collections.<Material>emptySet() : Collections.unmodifiableSet(unlimited);
}
-
@MapValueType(List.class)
@MapKeyType(Material.class)
@Getter(AccessLevel.NONE)
@@ -48,7 +45,6 @@ public class UserData implements StorageObject
{
return powerTools == null ? Collections.<Material, List<String>>emptyMap() : Collections.unmodifiableMap(powerTools);
}
-
private StoredLocation lastLocation;
@MapKeyType(String.class)
@MapValueType(Long.class)
@@ -60,7 +56,6 @@ public class UserData implements StorageObject
{
return timestamps == null ? Collections.<String, Long>emptyMap() : Collections.unmodifiableMap(timestamps);
}
-
private String jail;
@ListType
@Getter(AccessLevel.NONE)
@@ -71,7 +66,6 @@ public class UserData implements StorageObject
{
return mails == null ? Collections.<String>emptyList() : Collections.unmodifiableList(mails);
}
-
private Inventory inventory;
private boolean teleportEnabled;
@ListType
@@ -83,7 +77,6 @@ public class UserData implements StorageObject
{
return ignore == null ? Collections.<String>emptySet() : Collections.unmodifiableSet(ignore);
}
-
private boolean godmode;
private boolean muted;
private boolean jailed;
diff --git a/Essentials/src/net/ess3/user/UserMap.java b/Essentials/src/net/ess3/user/UserMap.java
index c83047f0c..9df31e543 100644
--- a/Essentials/src/net/ess3/user/UserMap.java
+++ b/Essentials/src/net/ess3/user/UserMap.java
@@ -141,7 +141,6 @@ public class UserMap extends StorageObjectMap<IUser> implements IUserMap
{
return matchUsers(name, false, false, requester);
}
-
private final Pattern comma = Pattern.compile(",");
public Set<IUser> matchUsers(final String name, final boolean includeHidden, final boolean includeOffline, final Player requester)
diff --git a/Essentials/src/net/ess3/utils/DateUtil.java b/Essentials/src/net/ess3/utils/DateUtil.java
index 2a38fd7a4..baf850034 100644
--- a/Essentials/src/net/ess3/utils/DateUtil.java
+++ b/Essentials/src/net/ess3/utils/DateUtil.java
@@ -30,11 +30,13 @@ public class DateUtil
}
StringBuilder sb = new StringBuilder();
- int[] types = new int[]{
- Calendar.YEAR, Calendar.MONTH, Calendar.DAY_OF_MONTH, Calendar.HOUR_OF_DAY, Calendar.MINUTE, Calendar.SECOND
+ int[] types = new int[]
+ {
+ Calendar.YEAR, Calendar.MONTH, Calendar.DAY_OF_MONTH, Calendar.HOUR_OF_DAY, Calendar.MINUTE, Calendar.SECOND
};
- String[] names = new String[]{
- _("year"), _("years"), _("month"), _("months"), _("day"), _("days"), _("hour"), _("hours"), _("minute"), _("minutes"), _("second"), _("seconds")
+ String[] names = new String[]
+ {
+ _("year"), _("years"), _("month"), _("months"), _("day"), _("days"), _("hour"), _("hours"), _("minute"), _("minutes"), _("second"), _("seconds")
};
for (int i = 0; i < types.length; i++)
{
diff --git a/Essentials/src/net/ess3/utils/ExecuteTimer.java b/Essentials/src/net/ess3/utils/ExecuteTimer.java
index 012ab9296..97b4174d9 100644
--- a/Essentials/src/net/ess3/utils/ExecuteTimer.java
+++ b/Essentials/src/net/ess3/utils/ExecuteTimer.java
@@ -9,9 +9,8 @@ import java.util.Locale;
public class ExecuteTimer
{
- private final transient List<ExecuteRecord> times;
- private final transient DecimalFormat decimalFormat = new DecimalFormat("#0.000", DecimalFormatSymbols.getInstance(Locale.US));
-
+ private final List<ExecuteRecord> times;
+ private final DecimalFormat decimalFormat = new DecimalFormat("#0.000", DecimalFormatSymbols.getInstance(Locale.US));
public ExecuteTimer()
{
diff --git a/Essentials/src/net/ess3/utils/FormatUtil.java b/Essentials/src/net/ess3/utils/FormatUtil.java
index 4cba2a71b..bbc690e79 100644
--- a/Essentials/src/net/ess3/utils/FormatUtil.java
+++ b/Essentials/src/net/ess3/utils/FormatUtil.java
@@ -13,15 +13,15 @@ import net.ess3.permissions.DotStarPermission;
public class FormatUtil
{
- static final transient Pattern REPLACE_COLOR_PATTERN = Pattern.compile("&([0-9a-f])");
- static final transient Pattern REPLACE_MAGIC_PATTERN = Pattern.compile("&(k)");
- static final transient Pattern REPLACE_PATTERN = Pattern.compile("&([0-9a-fk-or])");
- static final transient Pattern VANILLA_PATTERN = Pattern.compile("\u00a7+[0-9A-FK-ORa-fk-or]");
- static final transient Pattern VANILLA_COLOR_PATTERN = Pattern.compile("\u00a7+[0-9A-Fa-f]");
- static final transient Pattern REPLACE_FORMAT_PATTERN = Pattern.compile("&([l-or])");
- static final transient Pattern VANILLA_FORMAT_PATTERN = Pattern.compile("\u00a7+[L-ORl-or]");
- static final transient Pattern VANILLA_MAGIC_PATTERN = Pattern.compile("\u00a7+[Kk]");
- static final transient Pattern URL_PATTERN = Pattern.compile("((?:(?:https?)://)?[\\w-_\\.]{2,})\\.([a-z]{2,3}(?:/\\S+)?)");
+ static final Pattern REPLACE_COLOR_PATTERN = Pattern.compile("&([0-9a-f])");
+ static final Pattern REPLACE_MAGIC_PATTERN = Pattern.compile("&(k)");
+ static final Pattern REPLACE_PATTERN = Pattern.compile("&([0-9a-fk-or])");
+ static final Pattern VANILLA_PATTERN = Pattern.compile("\u00a7+[0-9A-FK-ORa-fk-or]");
+ static final Pattern VANILLA_COLOR_PATTERN = Pattern.compile("\u00a7+[0-9A-Fa-f]");
+ static final Pattern REPLACE_FORMAT_PATTERN = Pattern.compile("&([l-or])");
+ static final Pattern VANILLA_FORMAT_PATTERN = Pattern.compile("\u00a7+[L-ORl-or]");
+ static final Pattern VANILLA_MAGIC_PATTERN = Pattern.compile("\u00a7+[Kk]");
+ static final Pattern URL_PATTERN = Pattern.compile("((?:(?:https?)://)?[\\w-_\\.]{2,})\\.([a-z]{2,3}(?:/\\S+)?)");
static DecimalFormat dFormat = new DecimalFormat("#0.00", DecimalFormatSymbols.getInstance(Locale.US));
static String stripColor(final String input, final Pattern pattern)
diff --git a/Essentials/src/net/ess3/utils/LocationUtil.java b/Essentials/src/net/ess3/utils/LocationUtil.java
index 5d2af4000..64fa71f78 100644
--- a/Essentials/src/net/ess3/utils/LocationUtil.java
+++ b/Essentials/src/net/ess3/utils/LocationUtil.java
@@ -69,7 +69,6 @@ public class LocationUtil
}
return block.getLocation();
}
-
public final static int RADIUS = 3;
public final static Vector3D[] VOLUME;
@@ -82,13 +81,11 @@ public class LocationUtil
this.y = y;
this.z = z;
}
-
public int x;
public int y;
public int z;
}
-
static
{
List<Vector3D> pos = new ArrayList<Vector3D>();
@@ -213,7 +210,7 @@ public class LocationUtil
}
if ((!AIR_MATERIALS.contains(world.getBlockAt(x, y, z).getType().getId())) || (!AIR_MATERIALS.contains(
- world.getBlockAt(x, y + 1, z).getType().getId())))
+ world.getBlockAt(x, y + 1, z).getType().getId())))
{
return true;
}
diff --git a/Essentials/src/net/ess3/utils/Target.java b/Essentials/src/net/ess3/utils/Target.java
index 6e871a051..04fa17e1f 100644
--- a/Essentials/src/net/ess3/utils/Target.java
+++ b/Essentials/src/net/ess3/utils/Target.java
@@ -30,4 +30,3 @@ public class Target
return location;
}
}
-
diff --git a/Essentials/src/net/ess3/utils/Util.java b/Essentials/src/net/ess3/utils/Util.java
index 0817448bd..6f93b0909 100644
--- a/Essentials/src/net/ess3/utils/Util.java
+++ b/Essentials/src/net/ess3/utils/Util.java
@@ -16,7 +16,6 @@ public final class Util
private Util()
{
}
-
private final static Pattern INVALIDFILECHARS = Pattern.compile("[^\u0020-\u007E\u0085\u00A0-\uD7FF\uE000-\uFFFC]");
private final static Pattern INVALIDCHARS = Pattern.compile("[^\t\n\r\u0020-\u007E\u0085\u00A0-\uD7FF\uE000-\uFFFC]");
@@ -82,7 +81,7 @@ public final class Util
public static ItemStack convertBlockToItem(final Block block)
{
final ItemStack is = new ItemStack(block.getType(), 1, block.getData());
-
+
final short durability = 0;
switch (is.getType())
@@ -215,5 +214,4 @@ public final class Util
}
return buf.toString();
}
-
}
diff --git a/Essentials/src/net/ess3/utils/gnu/inet/encoding/Punycode.java b/Essentials/src/net/ess3/utils/gnu/inet/encoding/Punycode.java
index ee72d36df..c1946c84f 100644
--- a/Essentials/src/net/ess3/utils/gnu/inet/encoding/Punycode.java
+++ b/Essentials/src/net/ess3/utils/gnu/inet/encoding/Punycode.java
@@ -2,38 +2,26 @@ package net.ess3.utils.gnu.inet.encoding;
/**
- * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
- * Foundation, Inc.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
*
* Author: Oliver Hitz
*
* This file is part of GNU Libidn.
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
+ * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General
+ * Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
*
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA
+ * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-
/**
- * This class offers static methods for encoding/decoding strings
- * using the Punycode algorithm.
- * <ul>
- * <li>RFC3492 Punycode
- * </ul>
- * Note that this implementation only supports 16-bit Unicode code
- * points.
+ * This class offers static methods for encoding/decoding strings using the Punycode algorithm. <ul> <li>RFC3492
+ * Punycode </ul> Note that this implementation only supports 16-bit Unicode code points.
*/
/*
* Changes by snowleo:
@@ -124,7 +112,7 @@ public class Punycode
{
int q = delta;
- for (int k = BASE; ; k += BASE)
+ for (int k = BASE;; k += BASE)
{
int t;
if (k <= bias)
@@ -203,7 +191,7 @@ public class Punycode
int oldi = i;
int w = 1;
- for (int k = BASE; ; k += BASE)
+ for (int k = BASE;; k += BASE)
{
if (d == input.length())
{
diff --git a/Essentials/src/net/ess3/utils/gnu/inet/encoding/PunycodeException.java b/Essentials/src/net/ess3/utils/gnu/inet/encoding/PunycodeException.java
index 7e4da7d79..fb1f3d0ce 100644
--- a/Essentials/src/net/ess3/utils/gnu/inet/encoding/PunycodeException.java
+++ b/Essentials/src/net/ess3/utils/gnu/inet/encoding/PunycodeException.java
@@ -2,30 +2,23 @@ package net.ess3.utils.gnu.inet.encoding;
/**
- * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
- * Foundation, Inc.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
*
* Author: Oliver Hitz
*
* This file is part of GNU Libidn.
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
+ * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General
+ * Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
*
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA
+ * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-
/**
* Exception handling for Punycode class.
*/
diff --git a/Essentials/src/net/ess3/utils/textreader/ArrayListInput.java b/Essentials/src/net/ess3/utils/textreader/ArrayListInput.java
index 9fdc87c9b..31b1ac991 100644
--- a/Essentials/src/net/ess3/utils/textreader/ArrayListInput.java
+++ b/Essentials/src/net/ess3/utils/textreader/ArrayListInput.java
@@ -8,7 +8,7 @@ import java.util.Map;
public class ArrayListInput implements IText
{
- private final transient List<String> lines = new ArrayList<String>();
+ private final List<String> lines = new ArrayList<String>();
@Override
public List<String> getLines()
@@ -27,5 +27,4 @@ public class ArrayListInput implements IText
{
return Collections.emptyMap();
}
-
}
diff --git a/Essentials/src/net/ess3/utils/textreader/HelpInput.java b/Essentials/src/net/ess3/utils/textreader/HelpInput.java
index e6510a2e3..44215c17f 100644
--- a/Essentials/src/net/ess3/utils/textreader/HelpInput.java
+++ b/Essentials/src/net/ess3/utils/textreader/HelpInput.java
@@ -18,9 +18,9 @@ public class HelpInput implements IText
private static final String DESCRIPTION = "description";
private static final String PERMISSION = "permission";
private static final String PERMISSIONS = "permissions";
- private final transient List<String> lines = new ArrayList<String>();
- private final transient List<String> chapters = new ArrayList<String>();
- private final transient Map<String, Integer> bookmarks = new HashMap<String, Integer>();
+ private final List<String> lines = new ArrayList<String>();
+ private final List<String> chapters = new ArrayList<String>();
+ private final Map<String, Integer> bookmarks = new HashMap<String, Integer>();
private final static Logger logger = Logger.getLogger("Minecraft");
public HelpInput(final IUser user, final String match, final IEssentials ess) throws IOException
@@ -56,8 +56,8 @@ public class HelpInput implements IText
try
{
if (!match.equalsIgnoreCase("") && (!pluginNameLow.contains(match)) && (!k.getKey().toLowerCase(Locale.ENGLISH).contains(
- match)) && (!(k.getValue().get(DESCRIPTION) instanceof String && ((String)k.getValue().get(DESCRIPTION)).toLowerCase(
- Locale.ENGLISH).contains(match))))
+ match)) && (!(k.getValue().get(DESCRIPTION) instanceof String && ((String)k.getValue().get(DESCRIPTION)).toLowerCase(
+ Locale.ENGLISH).contains(match))))
{
continue;
}
diff --git a/Essentials/src/net/ess3/utils/textreader/KeywordReplacer.java b/Essentials/src/net/ess3/utils/textreader/KeywordReplacer.java
index 22466e0ac..1194aa266 100644
--- a/Essentials/src/net/ess3/utils/textreader/KeywordReplacer.java
+++ b/Essentials/src/net/ess3/utils/textreader/KeywordReplacer.java
@@ -17,9 +17,9 @@ import org.bukkit.plugin.Plugin;
public class KeywordReplacer implements IText
{
- private final transient IText input;
- private final transient List<String> replaced;
- private final transient IEssentials ess;
+ private final IText input;
+ private final List<String> replaced;
+ private final IEssentials ess;
public KeywordReplacer(final IText input, final CommandSender sender, final IEssentials ess)
{
@@ -34,15 +34,15 @@ public class KeywordReplacer implements IText
String displayName, ipAddress, balance, mails, world;
String worlds, online, unique, playerlist, date, time;
String worldTime12, worldTime24, worldDate, plugins;
- String userName, address, version; //TODO: unused?
+ String version;
if (sender instanceof IUser)
{
final IUser user = (IUser)sender;
final Player player = user.getPlayer();
displayName = player.getDisplayName();
- userName = player.getName();
+ String userName = player.getName(); //TODO: unused
ipAddress = player.getAddress() == null || player.getAddress().getAddress() == null ? "" : player.getAddress().getAddress().toString();
- address = player.getAddress() == null ? "" : player.getAddress().toString();
+ String address = player.getAddress() == null ? "" : player.getAddress().toString(); // TODO: unused
balance = FormatUtil.displayCurrency(user.getMoney(), ess);
mails = Integer.toString(user.getData().getMails() == null ? 0 : user.getData().getMails().size());
world = player.getLocation() == null || player.getLocation().getWorld() == null ? "" : player.getLocation().getWorld().getName();
diff --git a/Essentials/src/net/ess3/utils/textreader/SimpleTextInput.java b/Essentials/src/net/ess3/utils/textreader/SimpleTextInput.java
index 03405df29..6ef3731c1 100644
--- a/Essentials/src/net/ess3/utils/textreader/SimpleTextInput.java
+++ b/Essentials/src/net/ess3/utils/textreader/SimpleTextInput.java
@@ -8,7 +8,7 @@ import java.util.Map;
public class SimpleTextInput implements IText
{
- private final transient List<String> lines = new ArrayList<String>();
+ private final List<String> lines = new ArrayList<String>();
public SimpleTextInput(final String input)
{
@@ -32,5 +32,4 @@ public class SimpleTextInput implements IText
{
return Collections.emptyMap();
}
-
}
diff --git a/Essentials/src/net/ess3/utils/textreader/SimpleTextPager.java b/Essentials/src/net/ess3/utils/textreader/SimpleTextPager.java
index ea70010b6..0b850b509 100644
--- a/Essentials/src/net/ess3/utils/textreader/SimpleTextPager.java
+++ b/Essentials/src/net/ess3/utils/textreader/SimpleTextPager.java
@@ -5,7 +5,7 @@ import org.bukkit.command.CommandSender;
public class SimpleTextPager
{
- private final transient IText text;
+ private final IText text;
public SimpleTextPager(final IText text)
{
diff --git a/Essentials/src/net/ess3/utils/textreader/TextInput.java b/Essentials/src/net/ess3/utils/textreader/TextInput.java
index ca38cd528..090afd948 100644
--- a/Essentials/src/net/ess3/utils/textreader/TextInput.java
+++ b/Essentials/src/net/ess3/utils/textreader/TextInput.java
@@ -13,10 +13,10 @@ import org.bukkit.command.CommandSender;
public class TextInput implements IText
{
- private final transient List<String> lines;
- private final transient List<String> chapters;
- private final transient Map<String, Integer> bookmarks;
- private final transient long lastChange;
+ private final List<String> lines;
+ private final List<String> chapters;
+ private final Map<String, Integer> bookmarks;
+ private final 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
diff --git a/Essentials/src/net/ess3/utils/textreader/TextPager.java b/Essentials/src/net/ess3/utils/textreader/TextPager.java
index 88f00125c..965bb0d2f 100644
--- a/Essentials/src/net/ess3/utils/textreader/TextPager.java
+++ b/Essentials/src/net/ess3/utils/textreader/TextPager.java
@@ -10,8 +10,8 @@ import org.bukkit.command.CommandSender;
public class TextPager
{
- private final transient IText text;
- private final transient boolean onePage;
+ private final IText text;
+ private final boolean onePage;
public TextPager(final IText text)
{
diff --git a/Essentials/test/net/ess3/EssentialsTest.java b/Essentials/test/net/ess3/EssentialsTest.java
index 0daa06abf..cedfa3cb6 100644
--- a/Essentials/test/net/ess3/EssentialsTest.java
+++ b/Essentials/test/net/ess3/EssentialsTest.java
@@ -23,12 +23,12 @@ import org.mockito.stubbing.Answer;
public abstract class EssentialsTest extends TestCase
{
- protected final transient Server server;
- protected final transient IPlugin plugin;
- protected final transient World world;
- protected final transient Logger logger;
- protected final transient Essentials ess;
- protected final transient List<Player> playerList;
+ protected final Server server;
+ protected final IPlugin plugin;
+ protected final World world;
+ protected final Logger logger;
+ protected final Essentials ess;
+ protected final List<Player> playerList;
public EssentialsTest(final String testName)
{
diff --git a/Essentials/test/net/ess3/StorageTest.java b/Essentials/test/net/ess3/StorageTest.java
index 4ca05d9a8..4c96a165b 100644
--- a/Essentials/test/net/ess3/StorageTest.java
+++ b/Essentials/test/net/ess3/StorageTest.java
@@ -155,28 +155,28 @@ public class StorageTest extends EssentialsTest
}
/*@Test
- public void testOldUserdata()
- {
- ExecuteTimer ext = new ExecuteTimer();
- ext.start();
- OfflinePlayer base1 = server.createPlayer("testPlayer1", ess);
- server.addPlayer(base1);
- ext.mark("fake user created");
- UserData user = (UserData)ess.getUserMap().getUser(base1);
- ext.mark("load empty user");
- for (int j = 0; j < 1; j++)
- {
- user.setHome("home", new Location(world, j, j, j));
- }
- ext.mark("change home 1 times");
- user.save();
- ext.mark("write user");
- user.save();
- ext.mark("write user (cached)");
- user.reloadConfig();
- ext.mark("reloaded file");
- user.reloadConfig();
- ext.mark("reloaded file (cached)");
- System.out.println(ext.end());
- }*/
+ public void testOldUserdata()
+ {
+ ExecuteTimer ext = new ExecuteTimer();
+ ext.start();
+ OfflinePlayer base1 = server.createPlayer("testPlayer1", ess);
+ server.addPlayer(base1);
+ ext.mark("fake user created");
+ UserData user = (UserData)ess.getUserMap().getUser(base1);
+ ext.mark("load empty user");
+ for (int j = 0; j < 1; j++)
+ {
+ user.setHome("home", new Location(world, j, j, j));
+ }
+ ext.mark("change home 1 times");
+ user.save();
+ ext.mark("write user");
+ user.save();
+ ext.mark("write user (cached)");
+ user.reloadConfig();
+ ext.mark("reloaded file");
+ user.reloadConfig();
+ ext.mark("reloaded file (cached)");
+ System.out.println(ext.end());
+ }*/
}
diff --git a/Essentials/test/net/ess3/UserTest.java b/Essentials/test/net/ess3/UserTest.java
index ba26e1c6e..f4c58ad44 100644
--- a/Essentials/test/net/ess3/UserTest.java
+++ b/Essentials/test/net/ess3/UserTest.java
@@ -21,49 +21,48 @@ public class UserTest extends EssentialsTest
}
/*public void testUpdate()
- {
- OfflinePlayer base1alt = server.createPlayer(base1.getName(), ess);
- assertEquals(base1alt, ess.getUserMap().getUser(base1alt).getBase());
- }
+ {
+ OfflinePlayer base1alt = server.createPlayer(base1.getName(), ess);
+ assertEquals(base1alt, ess.getUserMap().getUser(base1alt).getBase());
+ }
- public void testHome()
- {
- IUser user = ess.getUserMap().getUser(base1);
- Location loc = base1.getLocation();
- user.setHome();
- OfflinePlayer base2 = server.createPlayer(base1.getName(), ess);
- IUser user2 = ess.getUserMap().getUser(base2);
+ public void testHome()
+ {
+ IUser user = ess.getUserMap().getUser(base1);
+ Location loc = base1.getLocation();
+ user.setHome();
+ OfflinePlayer base2 = server.createPlayer(base1.getName(), ess);
+ IUser user2 = ess.getUserMap().getUser(base2);
- Location home = user2.getHome(loc);
- assertNotNull(home);
- assertEquals(loc.getWorld().getName(), home.getWorld().getName());
- assertEquals(loc.getX(), home.getX());
- assertEquals(loc.getY(), home.getY());
- assertEquals(loc.getZ(), home.getZ());
- assertEquals(loc.getYaw(), home.getYaw());
- assertEquals(loc.getPitch(), home.getPitch());
- }*/
+ Location home = user2.getHome(loc);
+ assertNotNull(home);
+ assertEquals(loc.getWorld().getName(), home.getWorld().getName());
+ assertEquals(loc.getX(), home.getX());
+ assertEquals(loc.getY(), home.getY());
+ assertEquals(loc.getZ(), home.getZ());
+ assertEquals(loc.getYaw(), home.getYaw());
+ assertEquals(loc.getPitch(), home.getPitch());
+ }*/
/*public void testMoney()
- {
- should("properly set, take, give, and get money");
- IUser user = ess.getUserMap().getUser(base1);
- double i;
- user.setMoney(i = 100.5);
- user.takeMoney(50);
- i -= 50;
- user.giveMoney(25);
- i += 25;
- assertEquals(user.getMoney(), i);
- }*/
+ {
+ should("properly set, take, give, and get money");
+ IUser user = ess.getUserMap().getUser(base1);
+ double i;
+ user.setMoney(i = 100.5);
+ user.takeMoney(50);
+ i -= 50;
+ user.giveMoney(25);
+ i += 25;
+ assertEquals(user.getMoney(), i);
+ }*/
/*public void testGetGroup()
- {
- should("return the default group");
- IUser user = ess.getUserMap().getUser(base1);
- //assertEquals(user.getGroup(), "default");
- }*/
-
+ {
+ should("return the default group");
+ IUser user = ess.getUserMap().getUser(base1);
+ //assertEquals(user.getGroup(), "default");
+ }*/
public void testNoop()
{
assertTrue(true);
diff --git a/Essentials/test/net/ess3/UtilTest.java b/Essentials/test/net/ess3/UtilTest.java
index 0364b68aa..bfa3f1e51 100644
--- a/Essentials/test/net/ess3/UtilTest.java
+++ b/Essentials/test/net/ess3/UtilTest.java
@@ -11,7 +11,6 @@ import net.ess3.utils.Util;
public class UtilTest extends EssentialsTest
{
-
public UtilTest(String name)
{
super(name);
diff --git a/Essentials2Compat/pom.xml b/Essentials2Compat/pom.xml
index 81dc96ac8..74222b99e 100644
--- a/Essentials2Compat/pom.xml
+++ b/Essentials2Compat/pom.xml
@@ -1,20 +1,20 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>net.essentials3</groupId>
- <artifactId>BuildAll</artifactId>
- <version>3.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
+ <parent>
+ <groupId>net.essentials3</groupId>
+ <artifactId>BuildAll</artifactId>
+ <version>3.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
- <artifactId>Essentials2Compat</artifactId>
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>Essentials</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
+ <artifactId>Essentials2Compat</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>Essentials</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
</project>
diff --git a/Essentials2Compat/src/com/earth2me/essentials/Economy.java b/Essentials2Compat/src/com/earth2me/essentials/Economy.java
index 15f0045ac..2943fcf67 100644
--- a/Essentials2Compat/src/com/earth2me/essentials/Economy.java
+++ b/Essentials2Compat/src/com/earth2me/essentials/Economy.java
@@ -14,7 +14,6 @@ public final class Economy
private Economy()
{
}
-
private static IEssentials ess;
private static final String noCallBeforeLoad = "Essentials API is called before Essentials is loaded.";
@@ -38,11 +37,10 @@ public final class Economy
/**
* Sets the balance of a user
*
- * @param name Name of the user
+ * @param name Name of the user
* @param balance The balance you want to set
* @throws UserDoesNotExistException If a user by that name does not exists
- * @throws net.ess3.api.NoLoanPermittedException
- * If the user is not allowed to have a negative balance
+ * @throws net.ess3.api.NoLoanPermittedException If the user is not allowed to have a negative balance
*/
public static void setMoney(String name, double balance) throws UserDoesNotExistException, NoLoanPermittedException
{
@@ -56,10 +54,10 @@ public final class Economy
/**
* Adds money to the balance of a user
*
- * @param name Name of the user
+ * @param name Name of the user
* @param amount The money you want to add
* @throws UserDoesNotExistException If a user by that name does not exists
- * @throws NoLoanPermittedException If the user is not allowed to have a negative balance
+ * @throws NoLoanPermittedException If the user is not allowed to have a negative balance
*/
public static void add(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException
{
@@ -70,10 +68,10 @@ public final class Economy
/**
* Substracts money from the balance of a user
*
- * @param name Name of the user
+ * @param name Name of the user
* @param amount The money you want to substract
* @throws UserDoesNotExistException If a user by that name does not exists
- * @throws NoLoanPermittedException If the user is not allowed to have a negative balance
+ * @throws NoLoanPermittedException If the user is not allowed to have a negative balance
*/
public static void subtract(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException
{
@@ -84,10 +82,10 @@ public final class Economy
/**
* Divides the balance of a user by a value
*
- * @param name Name of the user
+ * @param name Name of the user
* @param value The balance is divided by this value
* @throws UserDoesNotExistException If a user by that name does not exists
- * @throws NoLoanPermittedException If the user is not allowed to have a negative balance
+ * @throws NoLoanPermittedException If the user is not allowed to have a negative balance
*/
public static void divide(String name, double value) throws UserDoesNotExistException, NoLoanPermittedException
{
@@ -98,10 +96,10 @@ public final class Economy
/**
* Multiplies the balance of a user by a value
*
- * @param name Name of the user
+ * @param name Name of the user
* @param value The balance is multiplied by this value
* @throws UserDoesNotExistException If a user by that name does not exists
- * @throws NoLoanPermittedException If the user is not allowed to have a negative balance
+ * @throws NoLoanPermittedException If the user is not allowed to have a negative balance
*/
public static void multiply(String name, double value) throws UserDoesNotExistException, NoLoanPermittedException
{
@@ -114,7 +112,7 @@ public final class Economy
*
* @param name Name of the user
* @throws UserDoesNotExistException If a user by that name does not exists
- * @throws NoLoanPermittedException If the user is not allowed to have a negative balance
+ * @throws NoLoanPermittedException If the user is not allowed to have a negative balance
*/
public static void resetBalance(String name) throws UserDoesNotExistException, NoLoanPermittedException
{
@@ -126,7 +124,7 @@ public final class Economy
}
/**
- * @param name Name of the user
+ * @param name Name of the user
* @param amount The amount of money the user should have
* @return true, if the user has more or an equal amount of money
* @throws UserDoesNotExistException If a user by that name does not exists
@@ -137,7 +135,7 @@ public final class Economy
}
/**
- * @param name Name of the user
+ * @param name Name of the user
* @param amount The amount of money the user should have
* @return true, if the user has more money
* @throws UserDoesNotExistException If a user by that name does not exists
@@ -148,7 +146,7 @@ public final class Economy
}
/**
- * @param name Name of the user
+ * @param name Name of the user
* @param amount The amount of money the user should not have
* @return true, if the user has less money
* @throws UserDoesNotExistException If a user by that name does not exists
diff --git a/Essentials2Compat/src/com/earth2me/essentials/EssentialsConf.java b/Essentials2Compat/src/com/earth2me/essentials/EssentialsConf.java
index 073f45bf5..a76ebbe6c 100644
--- a/Essentials2Compat/src/com/earth2me/essentials/EssentialsConf.java
+++ b/Essentials2Compat/src/com/earth2me/essentials/EssentialsConf.java
@@ -29,9 +29,9 @@ import net.ess3.storage.StoredLocation;
public class EssentialsConf extends YamlConfiguration
{
private static final Logger LOGGER = Logger.getLogger("Minecraft");
- private transient File configFile;
- private transient String templateName = null;
- private transient Class<?> resourceClass = EssentialsConf.class;
+ private File configFile;
+ private String templateName = null;
+ private Class<?> resourceClass = EssentialsConf.class;
private static final Charset UTF8 = Charset.forName("UTF-8");
public EssentialsConf(final File configFile)
diff --git a/Essentials2Compat/src/com/earth2me/essentials/ISettings.java b/Essentials2Compat/src/com/earth2me/essentials/ISettings.java
index 93fbd20b3..dfd68f467 100644
--- a/Essentials2Compat/src/com/earth2me/essentials/ISettings.java
+++ b/Essentials2Compat/src/com/earth2me/essentials/ISettings.java
@@ -1,6 +1,5 @@
package com.earth2me.essentials;
-
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -24,7 +23,6 @@ public interface ISettings
long getBackupInterval();
//MessageFormat getChatFormat(String group);
-
int getChatRadius();
double getCommandCost(String label);
diff --git a/Essentials2Compat/src/com/earth2me/essentials/Settings.java b/Essentials2Compat/src/com/earth2me/essentials/Settings.java
index a5f454916..bd8671c7b 100644
--- a/Essentials2Compat/src/com/earth2me/essentials/Settings.java
+++ b/Essentials2Compat/src/com/earth2me/essentials/Settings.java
@@ -16,9 +16,9 @@ import org.bukkit.inventory.ItemStack;
public final class Settings implements ISettings
{
- private final transient EssentialsConf config;
+ private final EssentialsConf config;
private final static Logger logger = Logger.getLogger("Minecraft");
- private final transient IEssentials ess;
+ private final IEssentials ess;
private boolean metricsEnabled = true;
public Settings(IEssentials ess, File file)
@@ -52,7 +52,6 @@ public final class Settings implements ISettings
{
return config.getInt("sethome-multiple." + set, config.getInt("sethome-multiple.default", 3));
}
-
private int chatRadius = 0;
private int _getChatRadius()
@@ -89,7 +88,6 @@ public final class Settings implements ISettings
{
return config.getInt("starting-balance", 0);
}
-
private Set<String> disabledCommands = new HashSet<String>();
@Override
@@ -142,10 +140,8 @@ public final class Settings implements ISettings
}
return config.getBoolean("override-" + name.toLowerCase(Locale.ENGLISH), false);
}
-
private ConfigurationSection commandCosts;
-
public ConfigurationSection _getCommandCosts()
{
if (config.isConfigurationSection("command-costs"))
@@ -178,7 +174,6 @@ public final class Settings implements ISettings
}
return 0.0;
}
-
private String nicknamePrefix = "~";
private String _getNicknamePrefix()
@@ -203,7 +198,6 @@ public final class Settings implements ISettings
{
return config.getDouble("heal-cooldown", 0);
}
-
private ConfigurationSection kits;
public ConfigurationSection _getKits()
@@ -244,7 +238,6 @@ public final class Settings implements ISettings
}
return null;
}
-
private ChatColor operatorColor = null;
@Override
@@ -318,31 +311,29 @@ public final class Settings implements ISettings
{
return config.getString("backup.command", null);
}
-
private Map<String, MessageFormat> chatFormats = Collections.synchronizedMap(new HashMap<String, MessageFormat>());
/*@Override //TODO: implement this
- public MessageFormat getChatFormat(String group)
- {
- MessageFormat mFormat = chatFormats.get(group);
- if (mFormat == null)
- {
- String format = config.getString("chat.group-formats." + (group == null ? "Default" : group),
- config.getString("chat.format", "&7[{GROUP}]&f {DISPLAYNAME}&7:&f {MESSAGE}"));
- format = Util.replaceFormat(format);
- format = format.replace("{DISPLAYNAME}", "%1$s");
- format = format.replace("{GROUP}", "{0}");
- format = format.replace("{MESSAGE}", "%2$s");
- format = format.replace("{WORLDNAME}", "{1}");
- format = format.replace("{SHORTWORLDNAME}", "{2}");
- format = format.replaceAll("\\{(\\D*?)\\}", "\\[$1\\]");
- format = "§r".concat(format);
- mFormat = new MessageFormat(format);
- chatFormats.put(group, mFormat);
- }
- return mFormat;
- }*/
-
+ public MessageFormat getChatFormat(String group)
+ {
+ MessageFormat mFormat = chatFormats.get(group);
+ if (mFormat == null)
+ {
+ String format = config.getString("chat.group-formats." + (group == null ? "Default" : group),
+ config.getString("chat.format", "&7[{GROUP}]&f {DISPLAYNAME}&7:&f {MESSAGE}"));
+ format = Util.replaceFormat(format);
+ format = format.replace("{DISPLAYNAME}", "%1$s");
+ format = format.replace("{GROUP}", "{0}");
+ format = format.replace("{MESSAGE}", "%2$s");
+ format = format.replace("{WORLDNAME}", "{1}");
+ format = format.replace("{SHORTWORLDNAME}", "{2}");
+ format = format.replaceAll("\\{(\\D*?)\\}", "\\[$1\\]");
+ format = "§r".concat(format);
+ mFormat = new MessageFormat(format);
+ chatFormats.put(group, mFormat);
+ }
+ return mFormat;
+ }*/
public String getDefaultChatformat()
{
return config.getString("chat.format", "&7[{GROUP}]&f {DISPLAYNAME}&7:&f {MESSAGE}");
@@ -384,7 +375,6 @@ public final class Settings implements ISettings
return config.getBoolean("sort-list-by-groups", true);
}
-
public void reloadConfig()
{
config.load();
@@ -415,7 +405,6 @@ public final class Settings implements ISettings
warnOnBuildDisallow = _warnOnBuildDisallow();
mailsPerMinute = _getMailsPerMinute();
}
-
private List<Integer> itemSpawnBl = new ArrayList<Integer>();
@Override
@@ -451,7 +440,6 @@ public final class Settings implements ISettings
}
return epItemSpwn;
}
-
private List<String> enabledSigns = new ArrayList<String>();
private boolean signsEnabled = false;
@@ -490,7 +478,6 @@ public final class Settings implements ISettings
}
return newSigns;
}
-
private boolean warnOnBuildDisallow;
private boolean _warnOnBuildDisallow()
@@ -503,7 +490,6 @@ public final class Settings implements ISettings
{
return warnOnBuildDisallow;
}
-
private boolean debug = false;
private boolean configDebug = false;
@@ -596,7 +582,6 @@ public final class Settings implements ISettings
{
return config.getBoolean(configName, def);
}
-
private final static double MAXMONEY = 10000000000000.0;
@Override
@@ -609,7 +594,6 @@ public final class Settings implements ISettings
}
return max;
}
-
private final static double MINMONEY = -10000000000000.0;
@Override
@@ -644,7 +628,6 @@ public final class Settings implements ISettings
{
return config.getBoolean("remove-god-on-disconnect", false);
}
-
private boolean changeDisplayName = true;
private boolean _changeDisplayName()
@@ -657,7 +640,6 @@ public final class Settings implements ISettings
{
return changeDisplayName;
}
-
private boolean changePlayerListName = false;
private boolean _changePlayerListName()
@@ -676,7 +658,6 @@ public final class Settings implements ISettings
{
return config.getBoolean("use-bukkit-permissions", false);
}
-
private boolean prefixsuffixconfigured = false;
private boolean addprefixsuffix = false;
private boolean essentialsChatActive = false;
@@ -702,7 +683,6 @@ public final class Settings implements ISettings
{
return prefixsuffixconfigured ? addprefixsuffix : essentialsChatActive;
}
-
private boolean disablePrefix = false;
private boolean _disablePrefix()
@@ -715,7 +695,6 @@ public final class Settings implements ISettings
{
return disablePrefix;
}
-
private boolean disableSuffix = false;
private boolean _disableSuffix()
@@ -740,7 +719,6 @@ public final class Settings implements ISettings
{
return config.getLong("auto-afk-kick", -1);
}
-
private boolean getFreezeAfkPlayers;
@Override
@@ -753,7 +731,6 @@ public final class Settings implements ISettings
{
return config.getBoolean("freeze-afk-players", false);
}
-
private boolean cancelAfkOnMove;
@Override
@@ -772,7 +749,6 @@ public final class Settings implements ISettings
{
return config.getBoolean("death-messages", true);
}
-
private Set<String> noGodWorlds = new HashSet<String>();
@Override
@@ -804,7 +780,6 @@ public final class Settings implements ISettings
{
return config.getBoolean("world-home-permissions", false);
}
-
private boolean registerBackInListener;
@Override
@@ -817,7 +792,6 @@ public final class Settings implements ISettings
{
return config.getBoolean("register-back-in-listener", false);
}
-
private boolean disableItemPickupWhileAfk;
@Override
@@ -875,7 +849,6 @@ public final class Settings implements ISettings
{
this.metricsEnabled = metricsEnabled;
}
-
private boolean teleportInvulnerability;
@Override
@@ -894,7 +867,6 @@ public final class Settings implements ISettings
{
return teleportInvulnerability;
}
-
private long loginAttackDelay;
private long _getLoginAttackDelay()
@@ -907,7 +879,6 @@ public final class Settings implements ISettings
{
return loginAttackDelay;
}
-
private int signUsePerSecond;
private int _getSignUsePerSecond()
@@ -937,7 +908,6 @@ public final class Settings implements ISettings
double maxSpeed = config.getDouble("max-walk-speed", 0.8);
return maxSpeed > 1.0 ? 1.0 : Math.abs(maxSpeed);
}
-
private int mailsPerMinute;
private int _getMailsPerMinute()
diff --git a/Essentials2Compat/src/com/earth2me/essentials/UpdateUserFiles.java b/Essentials2Compat/src/com/earth2me/essentials/UpdateUserFiles.java
index 040fdd875..a34734cf9 100644
--- a/Essentials2Compat/src/com/earth2me/essentials/UpdateUserFiles.java
+++ b/Essentials2Compat/src/com/earth2me/essentials/UpdateUserFiles.java
@@ -134,7 +134,6 @@ class UpdateUserFiles
String realname = getPlayer(name);
return realname == null ? BROKENNAME : realname;
}
-
private final Map<String, String> players = new HashMap<String, String>();
private String getPlayer(String check)
diff --git a/Essentials2Compat/src/com/earth2me/essentials/UserData.java b/Essentials2Compat/src/com/earth2me/essentials/UserData.java
index fdd16c495..2dc8d2cec 100644
--- a/Essentials2Compat/src/com/earth2me/essentials/UserData.java
+++ b/Essentials2Compat/src/com/earth2me/essentials/UserData.java
@@ -12,11 +12,10 @@ import org.bukkit.inventory.ItemStack;
public class UserData
{
- protected final transient IEssentials ess;
+ protected final IEssentials ess;
private EssentialsConf config;
private final File folder;
-
protected UserData(IEssentials ess, File file)
{
this.ess = ess;
@@ -59,7 +58,6 @@ public class UserData
kitTimestamps = _getKitTimestamps();
nickname = _getNickname();
}
-
private double money;
private double _getMoney()
@@ -91,7 +89,6 @@ public class UserData
config.setProperty("money", value);
config.save();
}
-
private Map<String, Object> homes;
private Map<String, Object> _getHomes()
@@ -124,7 +121,6 @@ public class UserData
return config.getLocation("homes." + search, ess.getServer());
}
-
public List<String> getHomes()
{
return new ArrayList<String>(homes.keySet());
@@ -166,7 +162,6 @@ public class UserData
}
return false;
}
-
private String nickname;
public String _getNickname()
@@ -185,7 +180,6 @@ public class UserData
config.setProperty("nickname", nick);
config.save();
}
-
private List<Integer> unlimited;
private List<Integer> _getUnlimited()
@@ -216,7 +210,6 @@ public class UserData
config.setProperty("unlimited", unlimited);
config.save();
}
-
private Map<String, Object> powertools;
private Map<String, Object> _getPowertools()
@@ -270,7 +263,6 @@ public class UserData
{
return !powertools.isEmpty();
}
-
private StoredLocation lastLocation;
private StoredLocation _getLastLocation()
@@ -289,8 +281,6 @@ public class UserData
{
return lastLocation;
}
-
-
private long lastTeleportTimestamp;
private long _getLastTeleportTimestamp()
@@ -309,7 +299,6 @@ public class UserData
config.setProperty("timestamps.lastteleport", time);
config.save();
}
-
private long lastHealTimestamp;
private long _getLastHealTimestamp()
@@ -328,7 +317,6 @@ public class UserData
config.setProperty("timestamps.lastheal", time);
config.save();
}
-
private String jail;
private String _getJail()
@@ -355,7 +343,6 @@ public class UserData
}
config.save();
}
-
private List<String> mails;
private List<String> _getMails()
@@ -388,7 +375,6 @@ public class UserData
mails.add(mail);
setMails(mails);
}
-
private boolean teleportEnabled;
private boolean getTeleportEnabled()
@@ -421,7 +407,6 @@ public class UserData
setSocialSpyEnabled(ret);
return ret;
}
-
private List<String> ignoredPlayers;
public List<String> getIgnoredPlayers()
@@ -443,8 +428,6 @@ public class UserData
}
config.save();
}
-
-
private boolean godmode;
private boolean _getGodModeEnabled()
@@ -463,7 +446,6 @@ public class UserData
config.setProperty("godmode", set);
config.save();
}
-
private boolean muted;
public boolean getMuted()
@@ -482,7 +464,6 @@ public class UserData
config.setProperty("muted", set);
config.save();
}
-
private long muteTimeout;
private long _getMuteTimeout()
@@ -501,7 +482,6 @@ public class UserData
config.setProperty("timestamps.mute", time);
config.save();
}
-
private boolean jailed;
private boolean getJailed()
@@ -527,7 +507,6 @@ public class UserData
setJailed(ret);
return ret;
}
-
private long jailTimeout;
private long _getJailTimeout()
@@ -568,7 +547,6 @@ public class UserData
config.setProperty("ban.timeout", time);
config.save();
}
-
private long lastLogin;
private long _getLastLogin()
@@ -586,8 +564,6 @@ public class UserData
lastLogin = time;
config.setProperty("timestamps.login", time);
}
-
-
private long lastLogout;
private long _getLastLogout()
@@ -606,7 +582,6 @@ public class UserData
config.setProperty("timestamps.logout", time);
config.save();
}
-
private String lastLoginAddress;
private String _getLastLoginAddress()
@@ -624,7 +599,6 @@ public class UserData
lastLoginAddress = address;
config.setProperty("ipAddress", address);
}
-
private boolean afk;
private boolean getAfk()
@@ -650,7 +624,6 @@ public class UserData
setAfk(ret);
return ret;
}
-
private boolean newplayer; //TODO: unused variable?
private String geolocation;
@@ -678,7 +651,6 @@ public class UserData
}
config.save();
}
-
private boolean isSocialSpyEnabled;
private boolean _isSocialSpyEnabled()
@@ -697,7 +669,6 @@ public class UserData
config.setProperty("socialspy", status);
config.save();
}
-
private boolean isNPC;
private boolean _isNPC()
@@ -716,7 +687,6 @@ public class UserData
config.setProperty("npc", set);
config.save();
}
-
private boolean arePowerToolsEnabled;
public boolean arePowerToolsEnabled()
@@ -742,7 +712,6 @@ public class UserData
{
return config.getBoolean("powertoolsenabled", true);
}
-
private ConfigurationSection kitTimestamps;
private ConfigurationSection _getKitTimestamps()
diff --git a/Essentials2Compat/src/com/earth2me/essentials/Util.java b/Essentials2Compat/src/com/earth2me/essentials/Util.java
index 0500df536..b6f051328 100644
--- a/Essentials2Compat/src/com/earth2me/essentials/Util.java
+++ b/Essentials2Compat/src/com/earth2me/essentials/Util.java
@@ -12,7 +12,6 @@ public class Util
private Util()
{
}
-
private final static Pattern INVALIDFILECHARS = Pattern.compile("[^a-z0-9]");
private final static Pattern INVALIDCHARS = Pattern.compile("[^\t\n\r\u0020-\u007E\u0085\u00A0-\uD7FF\uE000-\uFFFC]");
@@ -33,8 +32,6 @@ public class Util
{
return INVALIDCHARS.matcher(string).replaceAll("");
}
-
-
private static DecimalFormat dFormat = new DecimalFormat("#0.00", DecimalFormatSymbols.getInstance(Locale.US));
public static String formatAsCurrency(final double value)
diff --git a/EssentialsAntiBuild/pom.xml b/EssentialsAntiBuild/pom.xml
index 0db30ef3b..b99f53c5d 100644
--- a/EssentialsAntiBuild/pom.xml
+++ b/EssentialsAntiBuild/pom.xml
@@ -1,20 +1,20 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>net.essentials3</groupId>
- <artifactId>BuildAll</artifactId>
- <version>3.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
+ <parent>
+ <groupId>net.essentials3</groupId>
+ <artifactId>BuildAll</artifactId>
+ <version>3.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
- <artifactId>EssentialsAntiBuild</artifactId>
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>Essentials</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
+ <artifactId>EssentialsAntiBuild</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>Essentials</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
</project>
diff --git a/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsAntiBuild.java b/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsAntiBuild.java
index 2edb98da0..1e54f114a 100644
--- a/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsAntiBuild.java
+++ b/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsAntiBuild.java
@@ -7,8 +7,8 @@ import org.bukkit.plugin.java.JavaPlugin;
public class EssentialsAntiBuild extends JavaPlugin implements IAntiBuild
{
- private transient EssentialsConnect ess = null;
- private transient AntiBuildHolder settings = null;
+ private EssentialsConnect ess = null;
+ private AntiBuildHolder settings = null;
@Override
public void onEnable()
diff --git a/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsAntiBuildListener.java b/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsAntiBuildListener.java
index 52d34c47a..6c5c30b81 100644
--- a/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsAntiBuildListener.java
+++ b/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsAntiBuildListener.java
@@ -26,8 +26,8 @@ import org.bukkit.inventory.ItemStack;
public class EssentialsAntiBuildListener implements Listener
{
- final private transient IAntiBuild antib;
- final private transient IEssentials ess;
+ final private IAntiBuild antib;
+ final private IEssentials ess;
public EssentialsAntiBuildListener(final IAntiBuild parent)
{
diff --git a/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsConnect.java b/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsConnect.java
index 40d760b66..a58f18dcc 100644
--- a/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsConnect.java
+++ b/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsConnect.java
@@ -13,8 +13,8 @@ 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 antib;
+ private final IEssentials ess;
+ private final IAntiBuild antib;
public EssentialsConnect(Plugin essPlugin, Plugin essProtect)
{
diff --git a/EssentialsAntiBuild/src/net/ess3/antibuild/IAntiBuild.java b/EssentialsAntiBuild/src/net/ess3/antibuild/IAntiBuild.java
index 51e49c463..1cbd4df6e 100644
--- a/EssentialsAntiBuild/src/net/ess3/antibuild/IAntiBuild.java
+++ b/EssentialsAntiBuild/src/net/ess3/antibuild/IAntiBuild.java
@@ -1,6 +1,5 @@
package net.ess3.antibuild;
-
import org.bukkit.plugin.Plugin;
diff --git a/EssentialsAntiBuild/src/net/ess3/antibuild/Permissions.java b/EssentialsAntiBuild/src/net/ess3/antibuild/Permissions.java
index 96cdf63ac..eb980a2b2 100644
--- a/EssentialsAntiBuild/src/net/ess3/antibuild/Permissions.java
+++ b/EssentialsAntiBuild/src/net/ess3/antibuild/Permissions.java
@@ -19,7 +19,7 @@ public enum Permissions implements IPermission
private static final String defaultBase = "essentials.build.";
private final String permission;
private final PermissionDefault defaultPerm;
- private transient String parent = null;
+ private String parent = null;
private Permissions()
{
@@ -67,12 +67,10 @@ public enum Permissions implements IPermission
{
return PermissionFactory.checkPermission(sender, this);
}
-
public static MaterialDotStarPermission PLACEMENT = new MaterialDotStarPermission("essentials.build.place");
public static MaterialDotStarPermission BREAK = new MaterialDotStarPermission("essentials.build.break");
public static MaterialDotStarPermission INTERACT = new MaterialDotStarPermission("essentials.build.interact");
public static MaterialDotStarPermission CRAFT = new MaterialDotStarPermission("essentials.build.craft");
public static MaterialDotStarPermission PICKUP = new MaterialDotStarPermission("essentials.build.pickup");
public static MaterialDotStarPermission DROP = new MaterialDotStarPermission("essentials.build.drop");
-
}
diff --git a/EssentialsChat/pom.xml b/EssentialsChat/pom.xml
index e59886710..6be18a14c 100644
--- a/EssentialsChat/pom.xml
+++ b/EssentialsChat/pom.xml
@@ -1,20 +1,20 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>net.essentials3</groupId>
- <artifactId>BuildAll</artifactId>
- <version>3.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
+ <parent>
+ <groupId>net.essentials3</groupId>
+ <artifactId>BuildAll</artifactId>
+ <version>3.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
- <artifactId>EssentialsChat</artifactId>
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>Essentials</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
+ <artifactId>EssentialsChat</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>Essentials</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
</project>
diff --git a/EssentialsChat/src/net/ess3/chat/ChatStore.java b/EssentialsChat/src/net/ess3/chat/ChatStore.java
index 4d696fb36..d099a3e04 100644
--- a/EssentialsChat/src/net/ess3/chat/ChatStore.java
+++ b/EssentialsChat/src/net/ess3/chat/ChatStore.java
@@ -7,9 +7,9 @@ import net.ess3.economy.Trade;
public class ChatStore
{
- private final transient IUser user;
- private final transient String type;
- private final transient Trade charge;
+ private final IUser user;
+ private final String type;
+ private final Trade charge;
public ChatStore(final IEssentials ess, final IUser user, final String type)
{
diff --git a/EssentialsChat/src/net/ess3/chat/EssentialsChatPlayer.java b/EssentialsChat/src/net/ess3/chat/EssentialsChatPlayer.java
index e358cf9e1..15e2d3b8b 100644
--- a/EssentialsChat/src/net/ess3/chat/EssentialsChatPlayer.java
+++ b/EssentialsChat/src/net/ess3/chat/EssentialsChatPlayer.java
@@ -17,10 +17,10 @@ import org.bukkit.event.player.AsyncPlayerChatEvent;
public abstract class EssentialsChatPlayer implements Listener
{
- protected transient IEssentials ess;
+ protected IEssentials ess;
protected final static Logger LOGGER = Logger.getLogger("Minecraft");
- protected final transient Server server;
- protected final transient Map<AsyncPlayerChatEvent, ChatStore> chatStorage;
+ protected final Server server;
+ protected final Map<AsyncPlayerChatEvent, ChatStore> chatStorage;
public EssentialsChatPlayer(
final Server server, final IEssentials ess, final Map<AsyncPlayerChatEvent, ChatStore> chatStorage)
@@ -83,9 +83,10 @@ public abstract class EssentialsChatPlayer implements Listener
{
event.setFormat(
format.format(
- new Object[]{
- group, world, world.substring(0, 1).toUpperCase(Locale.ENGLISH)
- }));
+ new Object[]
+ {
+ group, world, world.substring(0, 1).toUpperCase(Locale.ENGLISH)
+ }));
}
}
diff --git a/EssentialsChat/src/net/ess3/chat/EssentialsLocalChatEventListener.java b/EssentialsChat/src/net/ess3/chat/EssentialsLocalChatEventListener.java
index b6b93c0bf..568657907 100644
--- a/EssentialsChat/src/net/ess3/chat/EssentialsLocalChatEventListener.java
+++ b/EssentialsChat/src/net/ess3/chat/EssentialsLocalChatEventListener.java
@@ -14,8 +14,8 @@ import org.bukkit.event.Listener;
public class EssentialsLocalChatEventListener implements Listener
{
- protected transient IEssentials ess;
- protected final transient Server server;
+ protected IEssentials ess;
+ protected final Server server;
public EssentialsLocalChatEventListener(final Server server, final IEssentials ess)
{
diff --git a/EssentialsExtra/pom.xml b/EssentialsExtra/pom.xml
index fc2f8e23f..0caa52250 100644
--- a/EssentialsExtra/pom.xml
+++ b/EssentialsExtra/pom.xml
@@ -1,20 +1,20 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>net.essentials3</groupId>
- <artifactId>BuildAll</artifactId>
- <version>3.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
+ <parent>
+ <groupId>net.essentials3</groupId>
+ <artifactId>BuildAll</artifactId>
+ <version>3.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
- <artifactId>EssentialsExtra</artifactId>
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>Essentials</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
+ <artifactId>EssentialsExtra</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>Essentials</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
</project>
diff --git a/EssentialsExtra/src/net/ess3/extra/AnnotatedCommand.java b/EssentialsExtra/src/net/ess3/extra/AnnotatedCommand.java
index 05418e9d8..258b53bb5 100644
--- a/EssentialsExtra/src/net/ess3/extra/AnnotatedCommand.java
+++ b/EssentialsExtra/src/net/ess3/extra/AnnotatedCommand.java
@@ -14,6 +14,7 @@ public @interface AnnotatedCommand
String usage() default "";
- String[] aliases() default {
+ String[] aliases() default
+ {
};
}
diff --git a/EssentialsExtra/src/net/ess3/extra/EssentialsExtra.java b/EssentialsExtra/src/net/ess3/extra/EssentialsExtra.java
index 4445dbd11..90cfb85aa 100644
--- a/EssentialsExtra/src/net/ess3/extra/EssentialsExtra.java
+++ b/EssentialsExtra/src/net/ess3/extra/EssentialsExtra.java
@@ -68,8 +68,9 @@ public class EssentialsExtra extends JavaPlugin
}
}
}
- urls = new URL[]{
- commandDir.toURI().toURL()
+ urls = new URL[]
+ {
+ commandDir.toURI().toURL()
};
}
catch (Exception ex)
diff --git a/EssentialsExtra/src/net/ess3/extra/commands/Commandkittycannon.java b/EssentialsExtra/src/net/ess3/extra/commands/Commandkittycannon.java
index a6173a243..36ee400e0 100644
--- a/EssentialsExtra/src/net/ess3/extra/commands/Commandkittycannon.java
+++ b/EssentialsExtra/src/net/ess3/extra/commands/Commandkittycannon.java
@@ -1,6 +1,5 @@
package net.ess3.extra.commands;
-
import java.util.Random;
import net.ess3.api.IUser;
import net.ess3.commands.EssentialsCommand;
diff --git a/EssentialsGeoIP/src/net/ess3/geoip/ConfigHolder.java b/EssentialsGeoIP/src/net/ess3/geoip/ConfigHolder.java
index c535ed4a0..07e68c3ee 100644
--- a/EssentialsGeoIP/src/net/ess3/geoip/ConfigHolder.java
+++ b/EssentialsGeoIP/src/net/ess3/geoip/ConfigHolder.java
@@ -9,8 +9,8 @@ import org.bukkit.plugin.Plugin;
public class ConfigHolder extends AsyncStorageObjectHolder<GeoIP>
{
- private final transient Plugin geoip;
-
+ private final Plugin geoip;
+
public ConfigHolder(final IEssentials ess, final Plugin geoip)
{
super(ess, GeoIP.class, new File(geoip.getDataFolder(), "config.yml"));
diff --git a/EssentialsGeoIP/src/net/ess3/geoip/EssentialsGeoIPPlayerListener.java b/EssentialsGeoIP/src/net/ess3/geoip/EssentialsGeoIPPlayerListener.java
index d899ed972..c305c024f 100644
--- a/EssentialsGeoIP/src/net/ess3/geoip/EssentialsGeoIPPlayerListener.java
+++ b/EssentialsGeoIP/src/net/ess3/geoip/EssentialsGeoIPPlayerListener.java
@@ -26,12 +26,12 @@ import org.bukkit.plugin.Plugin;
public class EssentialsGeoIPPlayerListener implements Listener, IReload
{
- private transient LookupService ls = null;
+ private LookupService ls = null;
private static final Logger LOGGER = Logger.getLogger("Minecraft");
- private transient File databaseFile;
- private final transient ConfigHolder config;
- private final transient IEssentials ess;
- private final transient Plugin geoip;
+ private File databaseFile;
+ private final ConfigHolder config;
+ private final IEssentials ess;
+ private final Plugin geoip;
public EssentialsGeoIPPlayerListener(final Plugin geoip, final IEssentials ess)
{
diff --git a/EssentialsGroupBridge/pom.xml b/EssentialsGroupBridge/pom.xml
index ef9144d1b..9be873ec1 100644
--- a/EssentialsGroupBridge/pom.xml
+++ b/EssentialsGroupBridge/pom.xml
@@ -1,20 +1,20 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>net.essentials3</groupId>
- <artifactId>BuildAll</artifactId>
- <version>3.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
+ <parent>
+ <groupId>net.essentials3</groupId>
+ <artifactId>BuildAll</artifactId>
+ <version>3.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
- <artifactId>EssentialsGroupBridge</artifactId>
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>EssentialsGroupManager</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
+ <artifactId>EssentialsGroupBridge</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>EssentialsGroupManager</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
</project>
diff --git a/EssentialsGroupBridge/src/com/nijiko/permissions/Entry.java b/EssentialsGroupBridge/src/com/nijiko/permissions/Entry.java
index 913c7f51e..a0c369aca 100644
--- a/EssentialsGroupBridge/src/com/nijiko/permissions/Entry.java
+++ b/EssentialsGroupBridge/src/com/nijiko/permissions/Entry.java
@@ -1,5 +1,6 @@
package com.nijiko.permissions;
-public class Entry {
-
+
+public class Entry
+{
}
diff --git a/EssentialsGroupBridge/src/com/nijiko/permissions/Group.java b/EssentialsGroupBridge/src/com/nijiko/permissions/Group.java
index 0d070c207..aa5a39d3c 100644
--- a/EssentialsGroupBridge/src/com/nijiko/permissions/Group.java
+++ b/EssentialsGroupBridge/src/com/nijiko/permissions/Group.java
@@ -1,6 +1,6 @@
package com.nijiko.permissions;
-public class Group extends Entry {
-
+public class Group extends Entry
+{
} \ No newline at end of file
diff --git a/EssentialsGroupBridge/src/com/nijiko/permissions/PermissionHandler.java b/EssentialsGroupBridge/src/com/nijiko/permissions/PermissionHandler.java
index 3b7181d03..f09da5d65 100644
--- a/EssentialsGroupBridge/src/com/nijiko/permissions/PermissionHandler.java
+++ b/EssentialsGroupBridge/src/com/nijiko/permissions/PermissionHandler.java
@@ -7,430 +7,508 @@ import java.util.Set;
import org.bukkit.entity.Player;
+
/**
- * Permissions 3.0
- * Copyright (C) 2011 Matt 'The Yeti' Burnett <admin@theyeticave.net>
- * Original Credit & Copyright (C) 2010 Nijikokun <nijikokun@gmail.com>
+ * Permissions 3.0 Copyright (C) 2011 Matt 'The Yeti' Burnett <admin@theyeticave.net> Original Credit & Copyright (C)
+ * 2010 Nijikokun <nijikokun@gmail.com>
*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Permissions Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
+ * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Permissions Public
+ * License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later
+ * version.
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Permissions Public License for more details.
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Permissions Public License for more
+ * details.
*
- * You should have received a copy of the GNU Permissions Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Permissions Public License along with this program. If not, see
+ * <http://www.gnu.org/licenses/>.
*/
+public abstract class PermissionHandler
+{
+ //World config manipulation methods
+ /**
+ * Sets the default world that is loaded on startup.
+ *
+ * @param world World to load on startup
+ */
+ public abstract void setDefaultWorld(String world);
+
+ /**
+ * Check if world is loaded. A world is considered as loaded if there exists a user/group storage for it or it
+ * mirrors another world.
+ *
+ * @param world Target world
+ * @return Whether the world is loaded.
+ */
+ public abstract boolean checkWorld(String world);
+
+ /**
+ * Attempts to load a world. If the world is already loaded, nothing happens.
+ *
+ * @param world World to load
+ * @return Whether world isn't already loaded
+ * @throws Exception Any exception that may occur when loading the world.
+ */
+ public abstract boolean loadWorld(String world) throws Exception;
+
+ /**
+ * Forces a load of the world.
+ *
+ * @param world World to load
+ * @throws Exception Any exception that may occur when loading the world.
+ */
+ public abstract void forceLoadWorld(String world) throws Exception;
+
+ /**
+ * Returns a set of the names all loaded worlds. A world is considered as loaded if there exists a user/group
+ * storage for it or it mirrors another world.
+ *
+ * @return Set of the names all loaded worlds.
+ */
+ public abstract Set<String> getWorlds();
+
+ /**
+ * Loads the default world and global permissions.
+ *
+ * @throws Exception Any exception that may occur when loading the worlds.
+ */
+ public abstract void load() throws Exception;
+
+ /**
+ * Reloads all worlds
+ */
+ public abstract void reload();
+
+ /**
+ * Reloads the specified world
+ *
+ * @param world Name of target world
+ * @return False if world is not loaded, true otherwise
+ */
+ public abstract boolean reload(String world);
+
+ /**
+ * Forces all storages to save,
+ */
+ public abstract void saveAll();
+
+ /**
+ * This method forces a save of the specified world
+ *
+ * @param world Name of target world
+ */
+ public abstract void save(String world);
+
+ /**
+ * Forces all storages to close.
+ */
+ public abstract void closeAll();
+
+ //Permission-checking methods
+ /**
+ * This is an alias for permission(Player, String).
+ *
+ * @param player Target player
+ * @param node Permission node
+ * @return True if the player has the specified node, false otherwise
+ */
+ public abstract boolean has(Player player, String node);
+
+ /**
+ * This is an alias for permission(String, String, String).
+ *
+ * @param worldName Target world (may be different from player's current world)
+ * @param playerName Player's name
+ * @param node Permission node
+ * @return True if the player has the specified node, false otherwise
+ */
+ public abstract boolean has(String worldName, String playerName, String node);
+
+ /**
+ * This method checks if the player has the given permissions in his/her current world. In other words, this calls
+ * permissions(player.getWorld().getName(), player.getName(), node).
+ *
+ * @param player Target player
+ * @param node Permission node
+ * @return True if the player has the specified node, false otherwise
+ */
+ public abstract boolean permission(Player player, String node);
+
+ /**
+ * This method checks if the player has the given permissions in the given world.
+ *
+ * @param worldName Target world (may be different from player's current world)
+ * @param playerName Player's name
+ * @param node Permission node
+ * @return True if the player has the specified node, false otherwise
+ */
+ public abstract boolean permission(String worldName, String playerName, String node);
+
+ //Permission-manipulation methods
+ /**
+ * Adds the given permission to the targeted player.
+ *
+ * @param world Target world (may be different from player's current world)
+ * @param user Player's name
+ * @param node Permission node
+ */
+ public abstract void addUserPermission(String world, String user, String node);
+
+ /**
+ * Removes the given permission from the targeted player.
+ *
+ * @param world Target world (may be different from player's current world)
+ * @param user Player's name
+ * @param node Permission node
+ */
+ public abstract void removeUserPermission(String world, String user, String node);
+
+ /**
+ * Adds the given permission to the targeted group.
+ *
+ * @param world Target world
+ * @param user Group's name
+ * @param node Permission node
+ */
+ public abstract void addGroupPermission(String world, String user, String node);
+
+ /**
+ * Removes the given permission from the targeted group.
+ *
+ * @param world Target world
+ * @param user Group's name
+ * @param node Permission node
+ */
+ public abstract void removeGroupPermission(String world, String user, String node);
+
+ //Chat, prefix, suffix, build methods
+ /**
+ * Retrieves the properly-capitalised version of the given group's name. Returns an empty string if group does not
+ * exist.
+ *
+ * @param world Group's world
+ * @param group Group's name (any capitalisation)
+ * @return Group's properly-capitalised name.
+ */
+ public abstract String getGroupProperName(String world, String group);
+
+ /**
+ * Gets the appropriate prefix for the user. This method is a utility method for chat plugins to get the user's
+ * prefix without having to look at every one of the user's ancestors. Returns an empty string if user has no parent
+ * groups.
+ *
+ * @param world Player's world
+ * @param user Player's name
+ * @return Player's prefix
+ */
+ public abstract String getUserPrefix(String world, String user);
+
+ /**
+ * Gets the appropriate suffix for the user. This method is a utility method for chat plugins to get the user's
+ * suffix without having to look at every one of the user's ancestors. Returns an empty string if user has no parent
+ * groups.
+ *
+ * @param world Player's world
+ * @param user Player's name
+ * @return Player's suffix
+ */
+ public abstract String getUserSuffix(String world, String user);
+
+ /**
+ * Gets the primary group of the user. Returns the default group if user has no parent groups, or null if there is
+ * no default group for that world.
+ *
+ * @param world Player's world
+ * @param user Player's name
+ * @return Player's primary group
+ */
+ public abstract Group getPrimaryGroupObject(String world, String user);
+
+ /**
+ * Gets name of the primary group of the user. Returns the name of the default group if user has no parent groups,
+ * or "Default" if there is no default group for that world.
+ *
+ * @param world Player's world
+ * @param user Player's name
+ * @return Name of player's primary group
+ */
+ public abstract String getPrimaryGroup(String world, String user);
+
+ /**
+ * Check if user can build.
+ *
+ * @param world Player's world
+ * @param user Player's name
+ * @return Whether the user can build
+ */
+ public abstract boolean canUserBuild(String world, String user);
+
+ /**
+ * Retrieves group's raw prefix, inheritance not included. Will return an empty string if no prefix is defined for
+ * the group.
+ *
+ * @param world Group's world
+ * @param group Group's name
+ * @return The prefix defined for the group, empty string if prefix is not defined.
+ */
+ public abstract String getGroupRawPrefix(String world, String group);
+
+ /**
+ * Retrieves group's raw suffix, inheritance not included. Will return an empty string if no suffix is defined for
+ * the group.
+ *
+ * @param world Group's world
+ * @param group Group's name
+ * @return The suffix defined for the group, empty string if suffix is not defined.
+ */
+ public abstract String getGroupRawSuffix(String world, String group);
+
+ /**
+ * Retrieves group's build setting, inheritance not included.
+ *
+ * @param world Group's world
+ * @param group Group's name
+ * @return Returns group's build setting.
+ */
+ public abstract boolean canGroupRawBuild(String world, String group);
+
+ //Entry methods
+ /**
+ * Returns the user object defined by the given world and name. This method attempts to create the object if it does
+ * not exist.
+ *
+ * @param world User's world
+ * @param name User's name
+ * @return User object
+ * @throws Exception An exception when creating the user object
+ */
+ public abstract User safeGetUser(String world, String name) throws Exception;
+
+ /**
+ * Returns the group object defined by the given world and name. This method attempts to create the object if it
+ * does not exist.
+ *
+ * @param world Group's world
+ * @param name Group's name
+ * @return Group object
+ * @throws Exception An exception when creating the group object
+ */
+ public abstract Group safeGetGroup(String world, String name) throws Exception;
+
+ /**
+ * Returns the user object defined by the given world and name. This method will return null if the object does not
+ * exist.
+ *
+ * @param world User's world
+ * @param name User's name
+ * @return User object, or null if it doesn't exist
+ */
+ public abstract User getUserObject(String world, String name);
+
+ /**
+ * Returns the group object defined by the given world and name. This method will return null if the object does not
+ * exist.
+ *
+ * @param world Group's world
+ * @param name Group's name
+ * @return Group object, or null if it doesn't exist
+ */
+ public abstract Group getGroupObject(String world, String name);
+
+ /**
+ * Returns the group object representing the default group of the given world. This method will return null if the
+ * object does not exist or the world has no default group.
+ *
+ * @param world Target world
+ * @return Group object representing default world, or null if it doesn't exist or is not defined.
+ */
+ public abstract Group getDefaultGroup(String world);
+
+ /**
+ * Returns all the user objects in the world. Will return null if world does not exist.
+ *
+ * @param world Target world
+ * @return Collection of all user objects belonging to the world.
+ */
+ public abstract Collection<User> getUsers(String world);
+
+ /**
+ * Returns all the group objects in the world. Will return null if world does not exist.
+ *
+ * @param world Target world
+ * @return Collection of all group objects belonging to the world.
+ */
+ public abstract Collection<Group> getGroups(String world);
+
+ //Parent-related methods
+ public abstract Set<String> getTracks(String world);
+
+ /**
+ * Checks if user is in specified group. Includes inherited groups.
+ *
+ * @param world World of both the user and the group
+ * @param user User's name
+ * @param group Parent group's name
+ * @return Whether user is a child of the specified group
+ */
+ public abstract boolean inGroup(String world, String user, String group);
+
+ /**
+ * Checks if user is in specified group. Includes inherited groups.
+ *
+ * @param world User's world
+ * @param user User's name
+ * @param groupWorld Parent group's world
+ * @param group Parent group's name
+ * @return Whether user is a child of the specified group
+ */
+ public abstract boolean inGroup(String world, String user, String groupWorld, String group);
-public abstract class PermissionHandler {
- //World config manipulation methods
-
- /**
- * Sets the default world that is loaded on startup.
- * @param world World to load on startup
- */
- public abstract void setDefaultWorld(String world);
- /**
- * Check if world is loaded.
- * A world is considered as loaded if there exists a user/group storage for it or it mirrors another world.
- * @param world Target world
- * @return Whether the world is loaded.
- */
- public abstract boolean checkWorld(String world);
-
- /**
- * Attempts to load a world. If the world is already loaded, nothing happens.
- * @param world World to load
- * @return Whether world isn't already loaded
- * @throws Exception Any exception that may occur when loading the world.
- */
- public abstract boolean loadWorld(String world) throws Exception;
- /**
- * Forces a load of the world.
- * @param world World to load
- * @throws Exception Any exception that may occur when loading the world.
- */
- public abstract void forceLoadWorld(String world) throws Exception;
- /**
- * Returns a set of the names all loaded worlds.
- * A world is considered as loaded if there exists a user/group storage for it or it mirrors another world.
- * @return Set of the names all loaded worlds.
- */
- public abstract Set<String> getWorlds();
- /**
- * Loads the default world and global permissions.
- * @throws Exception Any exception that may occur when loading the worlds.
- */
- public abstract void load() throws Exception;
- /**
- * Reloads all worlds
- */
- public abstract void reload();
- /**
- * Reloads the specified world
- * @param world Name of target world
- * @return False if world is not loaded, true otherwise
- */
- public abstract boolean reload(String world);
- /**
- * Forces all storages to save,
- */
- public abstract void saveAll();
- /**
- * This method forces a save of the specified world
- * @param world Name of target world
- */
- public abstract void save(String world);
- /**
- * Forces all storages to close.
- */
- public abstract void closeAll();
-
- //Permission-checking methods
- /**
- * This is an alias for permission(Player, String).
- * @param player Target player
- * @param node Permission node
- * @return True if the player has the specified node, false otherwise
- */
- public abstract boolean has(Player player, String node);
- /**
- * This is an alias for permission(String, String, String).
- * @param worldName Target world (may be different from player's current world)
- * @param playerName Player's name
- * @param node Permission node
- * @return True if the player has the specified node, false otherwise
- */
- public abstract boolean has(String worldName, String playerName, String node);
- /**
- * This method checks if the player has the given permissions in his/her current world.
- * In other words, this calls permissions(player.getWorld().getName(), player.getName(), node).
- * @param player Target player
- * @param node Permission node
- * @return True if the player has the specified node, false otherwise
- */
- public abstract boolean permission(Player player, String node);
- /**
- * This method checks if the player has the given permissions in the given world.
- * @param worldName Target world (may be different from player's current world)
- * @param playerName Player's name
- * @param node Permission node
- * @return True if the player has the specified node, false otherwise
- */
- public abstract boolean permission(String worldName, String playerName, String node);
-
- //Permission-manipulation methods
- /**
- * Adds the given permission to the targeted player.
- * @param world Target world (may be different from player's current world)
- * @param user Player's name
- * @param node Permission node
- */
- public abstract void addUserPermission(String world, String user, String node);
- /**
- * Removes the given permission from the targeted player.
- * @param world Target world (may be different from player's current world)
- * @param user Player's name
- * @param node Permission node
- */
- public abstract void removeUserPermission(String world, String user, String node);
- /**
- * Adds the given permission to the targeted group.
- * @param world Target world
- * @param user Group's name
- * @param node Permission node
- */
- public abstract void addGroupPermission(String world, String user, String node);
- /**
- * Removes the given permission from the targeted group.
- * @param world Target world
- * @param user Group's name
- * @param node Permission node
- */
- public abstract void removeGroupPermission(String world, String user, String node);
-
- //Chat, prefix, suffix, build methods
- /**
- * Retrieves the properly-capitalised version of the given group's name.
- * Returns an empty string if group does not exist.
- * @param world Group's world
- * @param group Group's name (any capitalisation)
- * @return Group's properly-capitalised name.
- */
- public abstract String getGroupProperName(String world, String group);
- /**
- * Gets the appropriate prefix for the user.
- * This method is a utility method for chat plugins to get the user's prefix
- * without having to look at every one of the user's ancestors.
- * Returns an empty string if user has no parent groups.
- * @param world Player's world
- * @param user Player's name
- * @return Player's prefix
- */
- public abstract String getUserPrefix(String world, String user);
- /**
- * Gets the appropriate suffix for the user.
- * This method is a utility method for chat plugins to get the user's suffix
- * without having to look at every one of the user's ancestors.
- * Returns an empty string if user has no parent groups.
- * @param world Player's world
- * @param user Player's name
- * @return Player's suffix
- */
- public abstract String getUserSuffix(String world, String user);
- /**
- * Gets the primary group of the user.
- * Returns the default group if user has no parent groups,
- * or null if there is no default group for that world.
- * @param world Player's world
- * @param user Player's name
- * @return Player's primary group
- */
- public abstract Group getPrimaryGroupObject(String world, String user);
- /**
- * Gets name of the primary group of the user.
- * Returns the name of the default group if user has no parent groups,
- * or "Default" if there is no default group for that world.
- * @param world Player's world
- * @param user Player's name
- * @return Name of player's primary group
- */
- public abstract String getPrimaryGroup(String world, String user);
- /**
- * Check if user can build.
- * @param world Player's world
- * @param user Player's name
- * @return Whether the user can build
- */
- public abstract boolean canUserBuild(String world, String user);
-
- /**
- * Retrieves group's raw prefix, inheritance not included.
- * Will return an empty string if no prefix is defined for the group.
- * @param world Group's world
- * @param group Group's name
- * @return The prefix defined for the group, empty string if prefix is not defined.
- */
- public abstract String getGroupRawPrefix(String world, String group);
- /**
- * Retrieves group's raw suffix, inheritance not included.
- * Will return an empty string if no suffix is defined for the group.
- * @param world Group's world
- * @param group Group's name
- * @return The suffix defined for the group, empty string if suffix is not defined.
- */
- public abstract String getGroupRawSuffix(String world, String group);
- /**
- * Retrieves group's build setting, inheritance not included.
- * @param world Group's world
- * @param group Group's name
- * @return Returns group's build setting.
- */
- public abstract boolean canGroupRawBuild(String world, String group);
-
- //Entry methods
- /**
- * Returns the user object defined by the given world and name.
- * This method attempts to create the object if it does not exist.
- * @param world User's world
- * @param name User's name
- * @return User object
- * @throws Exception An exception when creating the user object
- */
- public abstract User safeGetUser(String world, String name) throws Exception;
- /**
- * Returns the group object defined by the given world and name.
- * This method attempts to create the object if it does not exist.
- * @param world Group's world
- * @param name Group's name
- * @return Group object
- * @throws Exception An exception when creating the group object
- */
- public abstract Group safeGetGroup(String world, String name) throws Exception;
- /**
- * Returns the user object defined by the given world and name.
- * This method will return null if the object does not exist.
- * @param world User's world
- * @param name User's name
- * @return User object, or null if it doesn't exist
- */
- public abstract User getUserObject(String world, String name);
- /**
- * Returns the group object defined by the given world and name.
- * This method will return null if the object does not exist.
- * @param world Group's world
- * @param name Group's name
- * @return Group object, or null if it doesn't exist
- */
- public abstract Group getGroupObject(String world, String name);
-
- /**
- * Returns the group object representing the default group of the given world.
- * This method will return null if the object does not exist or the world has no default group.
- * @param world Target world
- * @return Group object representing default world, or null if it doesn't exist or is not defined.
- */
- public abstract Group getDefaultGroup(String world);
- /**
- * Returns all the user objects in the world.
- * Will return null if world does not exist.
- * @param world Target world
- * @return Collection of all user objects belonging to the world.
- */
- public abstract Collection<User> getUsers(String world);
- /**
- * Returns all the group objects in the world.
- * Will return null if world does not exist.
- * @param world Target world
- * @return Collection of all group objects belonging to the world.
- */
- public abstract Collection<Group> getGroups(String world);
-
- //Parent-related methods
- public abstract Set<String> getTracks(String world);
- /**
- * Checks if user is in specified group. Includes inherited groups.
- * @param world World of both the user and the group
- * @param user User's name
- * @param group Parent group's name
- * @return Whether user is a child of the specified group
- */
- public abstract boolean inGroup(String world, String user, String group);
- /**
- * Checks if user is in specified group. Includes inherited groups.
- * @param world User's world
- * @param user User's name
- * @param groupWorld Parent group's world
- * @param group Parent group's name
- * @return Whether user is a child of the specified group
- */
- public abstract boolean inGroup(String world, String user, String groupWorld, String group);
- /**
- * Checks if user is in specified group, not counting inherited parents.
- * @param world World of both the user and the group
- * @param user User's name
- * @param group Parent group's name
- * @return Whether user is a child of the specified group
- */
- public abstract boolean inSingleGroup(String world, String user, String group);
- /**
- * Checks if user is in specified group, not counting inherited parents.
- * @param world User's world
- * @param user User's name
- * @param groupWorld Parent group's world
- * @param group Parent group's name
- * @return Whether user is a child of the specified group
- */
- public abstract boolean inSingleGroup(String world, String user, String groupWorld, String group);
- /**
- * Gets a array of the names of all parent groups in the same world.
- * @param world Target user's world
- * @param name Target user's name
- * @return An array containing the names of all parent groups (including ancestors) that are in the same world
- */
- public abstract String[] getGroups(String world, String name);
- /**
- * Gets a map of world name to all parent groups of the target user in that world.
- * @param world Target user's world
- * @param name Target user's name
- * @return Map of world name to set of groups that the user inherits from in the world.
- */
- public abstract Map<String, Set<String>> getAllGroups(String world, String name);
-
- //Weight-related methods
- /**
- * Compare the weights of two users.
- * This method is for plugin devs to compare whether a user can do an action to another user.
- * For example, SlapPlugin can compare the weights of two users when one of them wants to /slap the other.
- * It can decide whether to allow the slap using the result of this function.
- * @param firstWorld First user's world
- * @param first First user's name
- * @param secondWorld Second user's world
- * @param second Second user's name
- * @return -1 if firstWeight < secondWeight, 0 if firstWeight == secondWeight, 1 if firstWeight > secondWeight
- */
- public abstract int compareWeights(String firstWorld, String first, String secondWorld, String second);
- /**
- * Alias for compareWeights(world, first, world, second).
- * @param world World
- * @param first First user's name
- * @param second Second user's name
- * @return -1 if firstWeight < secondWeight, 0 if firstWeight == secondWeight, 1 if firstWeight > secondWeight
- */
- public abstract int compareWeights(String world, String first, String second);
-
- //Data-related methods
- public abstract String getRawInfoString(String world, String entryName, String path,boolean isGroup);
-
- public abstract Integer getRawInfoInteger(String world, String entryName, String path, boolean isGroup);
-
- public abstract Double getRawInfoDouble(String world, String entryName, String path, boolean isGroup);
-
- public abstract Boolean getRawInfoBoolean(String world, String entryName, String path, boolean isGroup);
-
-
- public abstract String getInfoString(String world, String entryName, String path,boolean isGroup);
- public abstract String getInfoString(String world, String entryName, String path, boolean isGroup, Comparator<String> comparator);
-
- public abstract Integer getInfoInteger(String world, String entryName, String path, boolean isGroup);
- public abstract Integer getInfoInteger(String world, String entryName, String path, boolean isGroup, Comparator<Integer> comparator);
-
- public abstract Double getInfoDouble(String world, String entryName, String path, boolean isGroup);
- public abstract Double getInfoDouble(String world, String entryName, String path, boolean isGroup, Comparator<Double> comparator);
-
- public abstract Boolean getInfoBoolean(String world, String entryName, String path, boolean isGroup);
- public abstract Boolean getInfoBoolean(String world, String entryName, String path, boolean isGroup, Comparator<Boolean> comparator);
-
-
- public abstract void addUserInfo(String world, String name, String path, Object data);
- public abstract void removeUserInfo(String world, String name, String path);
- public abstract void addGroupInfo(String world, String name, String path, Object data);
- public abstract void removeGroupInfo(String world, String name, String path);
-
- //Legacy methods
- @Deprecated
- public abstract String getGroupPermissionString(String world, String group, String path);
- @Deprecated
- public abstract int getGroupPermissionInteger(String world, String group, String path);
- @Deprecated
- public abstract boolean getGroupPermissionBoolean(String world, String group, String path);
- @Deprecated
- public abstract double getGroupPermissionDouble(String world, String group, String path);
-
- @Deprecated
- public abstract String getUserPermissionString(String world, String group, String path);
- @Deprecated
- public abstract int getUserPermissionInteger(String world, String group, String path);
- @Deprecated
- public abstract boolean getUserPermissionBoolean(String world, String group, String path);
- @Deprecated
- public abstract double getUserPermissionDouble(String world, String group, String path);
-
- @Deprecated
- public abstract String getPermissionString(String world, String group, String path);
- @Deprecated
- public abstract int getPermissionInteger(String world, String group, String path);
- @Deprecated
- public abstract boolean getPermissionBoolean(String world, String group, String path);
- @Deprecated
- public abstract double getPermissionDouble(String world, String group, String path);
-
-
- @Deprecated
- public abstract String getGroup(String world, String group);
-
- @Deprecated
- public abstract String getGroupPrefix(String world, String group);
- @Deprecated
- public abstract String getGroupSuffix(String world, String group);
- @Deprecated
- public abstract boolean canGroupBuild(String world, String group);
-
- //Cache methods are no longer available
+ /**
+ * Checks if user is in specified group, not counting inherited parents.
+ *
+ * @param world World of both the user and the group
+ * @param user User's name
+ * @param group Parent group's name
+ * @return Whether user is a child of the specified group
+ */
+ public abstract boolean inSingleGroup(String world, String user, String group);
+
+ /**
+ * Checks if user is in specified group, not counting inherited parents.
+ *
+ * @param world User's world
+ * @param user User's name
+ * @param groupWorld Parent group's world
+ * @param group Parent group's name
+ * @return Whether user is a child of the specified group
+ */
+ public abstract boolean inSingleGroup(String world, String user, String groupWorld, String group);
+
+ /**
+ * Gets a array of the names of all parent groups in the same world.
+ *
+ * @param world Target user's world
+ * @param name Target user's name
+ * @return An array containing the names of all parent groups (including ancestors) that are in the same world
+ */
+ public abstract String[] getGroups(String world, String name);
+
+ /**
+ * Gets a map of world name to all parent groups of the target user in that world.
+ *
+ * @param world Target user's world
+ * @param name Target user's name
+ * @return Map of world name to set of groups that the user inherits from in the world.
+ */
+ public abstract Map<String, Set<String>> getAllGroups(String world, String name);
+
+ //Weight-related methods
+ /**
+ * Compare the weights of two users. This method is for plugin devs to compare whether a user can do an action to
+ * another user. For example, SlapPlugin can compare the weights of two users when one of them wants to /slap the
+ * other. It can decide whether to allow the slap using the result of this function.
+ *
+ * @param firstWorld First user's world
+ * @param first First user's name
+ * @param secondWorld Second user's world
+ * @param second Second user's name
+ * @return -1 if firstWeight < secondWeight, 0 if firstWeight == secondWeight, 1 if firstWeight > secondWeight
+ */
+ public abstract int compareWeights(String firstWorld, String first, String secondWorld, String second);
+
+ /**
+ * Alias for compareWeights(world, first, world, second).
+ *
+ * @param world World
+ * @param first First user's name
+ * @param second Second user's name
+ * @return -1 if firstWeight < secondWeight, 0 if firstWeight == secondWeight, 1 if firstWeight > secondWeight
+ */
+ public abstract int compareWeights(String world, String first, String second);
+
+ //Data-related methods
+ public abstract String getRawInfoString(String world, String entryName, String path, boolean isGroup);
+
+ public abstract Integer getRawInfoInteger(String world, String entryName, String path, boolean isGroup);
+
+ public abstract Double getRawInfoDouble(String world, String entryName, String path, boolean isGroup);
+
+ public abstract Boolean getRawInfoBoolean(String world, String entryName, String path, boolean isGroup);
+
+ public abstract String getInfoString(String world, String entryName, String path, boolean isGroup);
+
+ public abstract String getInfoString(String world, String entryName, String path, boolean isGroup, Comparator<String> comparator);
+
+ public abstract Integer getInfoInteger(String world, String entryName, String path, boolean isGroup);
+
+ public abstract Integer getInfoInteger(String world, String entryName, String path, boolean isGroup, Comparator<Integer> comparator);
+
+ public abstract Double getInfoDouble(String world, String entryName, String path, boolean isGroup);
+
+ public abstract Double getInfoDouble(String world, String entryName, String path, boolean isGroup, Comparator<Double> comparator);
+
+ public abstract Boolean getInfoBoolean(String world, String entryName, String path, boolean isGroup);
+
+ public abstract Boolean getInfoBoolean(String world, String entryName, String path, boolean isGroup, Comparator<Boolean> comparator);
+
+ public abstract void addUserInfo(String world, String name, String path, Object data);
+
+ public abstract void removeUserInfo(String world, String name, String path);
+
+ public abstract void addGroupInfo(String world, String name, String path, Object data);
+
+ public abstract void removeGroupInfo(String world, String name, String path);
+
+ //Legacy methods
+ @Deprecated
+ public abstract String getGroupPermissionString(String world, String group, String path);
+
+ @Deprecated
+ public abstract int getGroupPermissionInteger(String world, String group, String path);
+
+ @Deprecated
+ public abstract boolean getGroupPermissionBoolean(String world, String group, String path);
+
+ @Deprecated
+ public abstract double getGroupPermissionDouble(String world, String group, String path);
+
+ @Deprecated
+ public abstract String getUserPermissionString(String world, String group, String path);
+
+ @Deprecated
+ public abstract int getUserPermissionInteger(String world, String group, String path);
+
+ @Deprecated
+ public abstract boolean getUserPermissionBoolean(String world, String group, String path);
+
+ @Deprecated
+ public abstract double getUserPermissionDouble(String world, String group, String path);
+
+ @Deprecated
+ public abstract String getPermissionString(String world, String group, String path);
+
+ @Deprecated
+ public abstract int getPermissionInteger(String world, String group, String path);
+
+ @Deprecated
+ public abstract boolean getPermissionBoolean(String world, String group, String path);
+
+ @Deprecated
+ public abstract double getPermissionDouble(String world, String group, String path);
+
+ @Deprecated
+ public abstract String getGroup(String world, String group);
+
+ @Deprecated
+ public abstract String getGroupPrefix(String world, String group);
+
+ @Deprecated
+ public abstract String getGroupSuffix(String world, String group);
+
+ @Deprecated
+ public abstract boolean canGroupBuild(String world, String group);
+ //Cache methods are no longer available
// @Deprecated
// public void setCache(String world, Map<String, Boolean> Cache) {
// }
@@ -454,5 +532,4 @@ public abstract class PermissionHandler {
// @Deprecated
// public void clearAllCache(){
// }
-
} \ No newline at end of file
diff --git a/EssentialsGroupBridge/src/com/nijiko/permissions/User.java b/EssentialsGroupBridge/src/com/nijiko/permissions/User.java
index 9e93d850a..3bdea431f 100644
--- a/EssentialsGroupBridge/src/com/nijiko/permissions/User.java
+++ b/EssentialsGroupBridge/src/com/nijiko/permissions/User.java
@@ -1,5 +1,6 @@
package com.nijiko.permissions;
-public class User extends Entry {
-
+
+public class User extends Entry
+{
}
diff --git a/EssentialsGroupBridge/src/com/nijikokun/bukkit/Permissions/OverrideListener.java b/EssentialsGroupBridge/src/com/nijikokun/bukkit/Permissions/OverrideListener.java
index 762e42b49..9260c9859 100644
--- a/EssentialsGroupBridge/src/com/nijikokun/bukkit/Permissions/OverrideListener.java
+++ b/EssentialsGroupBridge/src/com/nijikokun/bukkit/Permissions/OverrideListener.java
@@ -6,20 +6,21 @@ import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.event.Listener;
-
-public class OverrideListener implements Listener {
-
+public class OverrideListener implements Listener
+{
Permissions permClass;
-
- OverrideListener(Permissions instance) {
+
+ OverrideListener(Permissions instance)
+ {
this.permClass = instance;
}
-
+
@EventHandler(priority = EventPriority.NORMAL)
- public void onPluginEnable(PluginEnableEvent event) {
- if (event.getPlugin().getDescription().getName().equals("GroupManager")) {
- permClass.setGM(event.getPlugin());
- }
- }
-
+ public void onPluginEnable(PluginEnableEvent event)
+ {
+ if (event.getPlugin().getDescription().getName().equals("GroupManager"))
+ {
+ permClass.setGM(event.getPlugin());
+ }
+ }
} \ No newline at end of file
diff --git a/EssentialsGroupBridge/src/com/nijikokun/bukkit/Permissions/Permissions.java b/EssentialsGroupBridge/src/com/nijikokun/bukkit/Permissions/Permissions.java
index 99fd18ce8..7115bb04c 100644
--- a/EssentialsGroupBridge/src/com/nijikokun/bukkit/Permissions/Permissions.java
+++ b/EssentialsGroupBridge/src/com/nijikokun/bukkit/Permissions/Permissions.java
@@ -8,68 +8,80 @@ import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin;
-public class Permissions extends JavaPlugin {
- public static final Logger log = Logger.getLogger("Fake Permissions");
- public static String name = "Permissions";
- public static String codename = "Hacked Permissions by AnjoCaido";
- public static String version = "2.0";
- public static PermissionHandler Security = null;
+public class Permissions extends JavaPlugin
+{
+ public static final Logger log = Logger.getLogger("Fake Permissions");
+ public static String name = "Permissions";
+ public static String codename = "Hacked Permissions by AnjoCaido";
+ public static String version = "2.0";
+ public static PermissionHandler Security = null;
- @Override
- public void onDisable() {
- PluginDescriptionFile pdfFile = this.getDescription();
- System.out.println("Fake " + pdfFile.getName() + " version " + pdfFile.getVersion() + " is disabled!");
- }
+ @Override
+ public void onDisable()
+ {
+ PluginDescriptionFile pdfFile = this.getDescription();
+ System.out.println("Fake " + pdfFile.getName() + " version " + pdfFile.getVersion() + " is disabled!");
+ }
- @Override
- public void onEnable() {
- PluginDescriptionFile pdfFile = this.getDescription();
+ @Override
+ public void onEnable()
+ {
+ PluginDescriptionFile pdfFile = this.getDescription();
- if (Security == null) {
- //make sure we have only one instance
- Security = new NijikoPermissionsProxy(null);
- }
+ if (Security == null)
+ {
+ //make sure we have only one instance
+ Security = new NijikoPermissionsProxy(null);
+ }
- Plugin p = (this.getServer() == null) ? null : this.getServer().getPluginManager().getPlugin("GroupManager");
- if (p != null) {
- if (p.isEnabled()) {
- setGM(p);
- } else {
- if (this.getServer() != null) {
- this.getServer().getPluginManager().registerEvents(new OverrideListener(this), this);
- }
- }
- } else {
- System.err.println("OOOPS! Fake " + pdfFile.getName() + " version " + pdfFile.getVersion() + " couldn't find GroupManager!");
- this.getPluginLoader().disablePlugin(this);
- }
+ Plugin p = (this.getServer() == null) ? null : this.getServer().getPluginManager().getPlugin("GroupManager");
+ if (p != null)
+ {
+ if (p.isEnabled())
+ {
+ setGM(p);
+ }
+ else
+ {
+ if (this.getServer() != null)
+ {
+ this.getServer().getPluginManager().registerEvents(new OverrideListener(this), this);
+ }
+ }
+ }
+ else
+ {
+ System.err.println("OOOPS! Fake " + pdfFile.getName() + " version " + pdfFile.getVersion() + " couldn't find GroupManager!");
+ this.getPluginLoader().disablePlugin(this);
+ }
- if (pdfFile != null) {
- System.out.println("Fake " + pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!");
- }
- }
+ if (pdfFile != null)
+ {
+ System.out.println("Fake " + pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!");
+ }
+ }
- public void setGM(final Plugin p) {
- //GroupManager groupManager = (GroupManager) p;
- ((NijikoPermissionsProxy) Security).setGM(p);
- }
+ public void setGM(final Plugin p)
+ {
+ //GroupManager groupManager = (GroupManager) p;
+ ((NijikoPermissionsProxy)Security).setGM(p);
+ }
- public PermissionHandler getHandler() {
- if (Security == null) {
- Security = new NijikoPermissionsProxy(null);
- }
- return Security;
- }
+ public PermissionHandler getHandler()
+ {
+ if (Security == null)
+ {
+ Security = new NijikoPermissionsProxy(null);
+ }
+ return Security;
+ }
- public void setupPermissions() {
- if (Security == null) {
- Security = new NijikoPermissionsProxy(null);
- }
- }
-
-
-
+ public void setupPermissions()
+ {
+ if (Security == null)
+ {
+ Security = new NijikoPermissionsProxy(null);
+ }
+ }
}
-
-
diff --git a/EssentialsGroupBridge/src/org/anjocaido/groupmanager/permissions/NijikoPermissionsProxy.java b/EssentialsGroupBridge/src/org/anjocaido/groupmanager/permissions/NijikoPermissionsProxy.java
index cac98e554..3b5b564fb 100644
--- a/EssentialsGroupBridge/src/org/anjocaido/groupmanager/permissions/NijikoPermissionsProxy.java
+++ b/EssentialsGroupBridge/src/org/anjocaido/groupmanager/permissions/NijikoPermissionsProxy.java
@@ -18,570 +18,680 @@ import org.anjocaido.groupmanager.GroupManager;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
+
/**
* Everything here maintains the model created by Nijikokun
*
- * But implemented to use GroupManager system. Which provides instant changes,
- * without file access.
+ * But implemented to use GroupManager system. Which provides instant changes, without file access.
*
* @author gabrielcouto
*/
-public class NijikoPermissionsProxy extends PermissionHandler {
-
- GroupManager plugin;
-
- public NijikoPermissionsProxy(GroupManager plugin) {
- super();
- this.plugin = plugin;
- }
-
- @Override
- public void addGroupPermission(String world, String group, String node) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public void removeGroupPermission(String world, String group, String node) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public void addGroupInfo(String world, String group, String node, Object data) {
- plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().addGroupInfo(group, node, data);
- }
-
- @Override
- public void removeGroupInfo(String world, String group, String node) {
- plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().removeGroupInfo(group, node);
- }
-
- @Override
- public void addUserPermission(String world, String user, String node) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public void removeUserPermission(String world, String user, String node) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public void addUserInfo(String world, String user, String node, Object data) {
- plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().addUserInfo(user, node, data);
- }
-
- @Override
- public void removeUserInfo(String world, String user, String node) {
- plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().removeUserInfo(user, node);
- }
-
- @Deprecated
- public void removeUserInfo(String user, String node) {
- plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().removeUserInfo(user, node);
- }
-
- @Deprecated
- public void addGroupPermission(String group, String node) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Deprecated
- public void removeGroupPermission(String group, String node) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Deprecated
- public void addGroupInfo(String group, String node, Object data) {
- plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().addGroupInfo(group, node, data);
- }
-
- @Deprecated
- public void removeGroupInfo(String group, String node) {
- plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().removeGroupInfo(group, node);
- }
-
- @Deprecated
- public void addUserPermission(String user, String node) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Deprecated
- public void removeUserPermission(String user, String node) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Deprecated
- public void addUserInfo(String user, String node, Object data) {
- plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().addUserInfo(user, node, data);
- }
-
- @Override
- public void setDefaultWorld(String world) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Deprecated
- public void setDirectory(File directory) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public boolean loadWorld(String world) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public void forceLoadWorld(String world) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public boolean checkWorld(String world) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public void load() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public void reload() {
- plugin.getWorldsHolder().reloadAll();
- //throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public boolean reload(String world) {
- plugin.getWorldsHolder().reloadWorld(world);
- return true;
- }
-
- @Override
- public boolean has(Player player, String permission) {
- //throw new UnsupportedOperationException("Not supported yet.");
- return permission(player, permission);
- }
-
- @Override
- public boolean permission(Player player, String permission) {
- //throw new UnsupportedOperationException("Not supported yet.");
- if (permission == null || permission.equals("")) {
- return false;
- }
- if (player == null) {
- GroupManager.logger.severe("A plugin is asking permission '" + permission + "' for a null player... Which plugin does that? Bastards!");
- return false;
- }
- if (player.getWorld() == null) {
- GroupManager.logger.warning("The player " + player.getName() + " has a null world? Treating as default world!");
- return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().has(player, permission);
- }
- return plugin.getWorldsHolder().getWorldData(player.getWorld().getName()).getPermissionsHandler().has(player, permission);
- }
-
- @Override
- public String getGroupRawPrefix(String world, String group) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupPrefix(group);
- }
-
- @Override
- public String getGroupRawSuffix(String world, String group) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupSuffix(group);
- }
-
- @Override
- public String getUserPrefix(String world, String user) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getUserPrefix(user);
- }
-
- @Override
- public String getUserSuffix(String world, String user) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getUserSuffix(user);
- }
-
- @Override
- public String getGroup(String world, String user) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroup(user);
- }
-
- @Override
- public String getPrimaryGroup(String world, String user) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroup(user);
- }
-
- @Override
- public boolean canUserBuild(String world, String user) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().canUserBuild(user);
- }
-
- @Deprecated
- public String getGroup(String name) {
- return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroup(name);
- }
-
- @Override
- public String[] getGroups(String world, String name) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroups(name);
- }
-
- @Override
- public boolean inGroup(String world, String name, String group) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().inGroup(name, group);
- }
-
- @Deprecated
- public boolean inGroup(String name, String group) {
- return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().inGroup(name, group);
- }
-
- @Override
- public String getGroupPrefix(String world, String group) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupPrefix(group);
- }
-
- @Deprecated
- public String getGroupPrefix(String group) {
- return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroupPrefix(group);
- }
-
- @Override
- public String getGroupSuffix(String world, String group) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupSuffix(group);
- }
-
- @Deprecated
- public String getGroupSuffix(String group) {
- return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroupSuffix(group);
- }
-
- @Override
- public boolean canGroupBuild(String world, String group) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().canGroupBuild(group);
- }
-
- @Deprecated
- public boolean canGroupBuild(String group) {
- return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().canGroupBuild(group);
- }
-
- @Override
- public String getGroupPermissionString(String world, String group, String permission) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupPermissionString(group, permission);
- }
-
- @Deprecated
- public String getGroupPermissionString(String group, String permission) {
- return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroupPermissionString(group, permission);
- }
-
- @Override
- public int getGroupPermissionInteger(String world, String group, String permission) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupPermissionInteger(group, permission);
- }
-
- @Deprecated
- public int getGroupPermissionInteger(String group, String permission) {
- return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroupPermissionInteger(group, permission);
- }
-
- @Override
- public boolean getGroupPermissionBoolean(String world, String group, String permission) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupPermissionBoolean(group, permission);
- }
-
- @Deprecated
- public boolean getGroupPermissionBoolean(String group, String permission) {
- return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroupPermissionBoolean(group, permission);
- }
-
- @Override
- public double getGroupPermissionDouble(String world, String group, String permission) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupPermissionDouble(group, permission);
- }
-
- @Deprecated
- public double getGroupPermissionDouble(String group, String permission) {
- return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroupPermissionDouble(group, permission);
- }
-
- @Override
- public String getUserPermissionString(String world, String name, String permission) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getUserPermissionString(name, permission);
- }
-
- @Deprecated
- public String getUserPermissionString(String name, String permission) {
- return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getUserPermissionString(name, permission);
- }
-
- @Override
- public int getUserPermissionInteger(String world, String name, String permission) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getUserPermissionInteger(name, permission);
- }
-
- @Deprecated
- public int getUserPermissionInteger(String name, String permission) {
- return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getUserPermissionInteger(name, permission);
- }
-
- @Override
- public boolean getUserPermissionBoolean(String world, String name, String permission) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getUserPermissionBoolean(name, permission);
- }
-
- @Deprecated
- public boolean getUserPermissionBoolean(String name, String permission) {
- return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getUserPermissionBoolean(name, permission);
- }
-
- @Override
- public double getUserPermissionDouble(String world, String name, String permission) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getUserPermissionDouble(name, permission);
- }
-
- @Deprecated
- public double getUserPermissionDouble(String name, String permission) {
- return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getUserPermissionDouble(name, permission);
- }
-
- @Override
- public String getPermissionString(String world, String name, String permission) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getPermissionString(name, permission);
- }
-
- @Deprecated
- public String getPermissionString(String name, String permission) {
- return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getPermissionString(name, permission);
- }
-
- @Override
- public int getPermissionInteger(String world, String name, String permission) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getPermissionInteger(name, permission);
- }
-
- @Deprecated
- public int getPermissionInteger(String name, String permission) {
- return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getPermissionInteger(name, permission);
- }
-
- @Override
- public boolean getPermissionBoolean(String world, String name, String permission) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getPermissionBoolean(name, permission);
- }
-
- @Deprecated
- public boolean getPermissionBoolean(String name, String permission) {
- return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getPermissionBoolean(name, permission);
- }
-
- @Override
- public double getPermissionDouble(String world, String name, String permission) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getPermissionDouble(name, permission);
- }
-
- @Deprecated
- public double getPermissionDouble(String name, String permission) {
- return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getPermissionDouble(name, permission);
- }
-
- public void setGM(Plugin p) {
- this.plugin = (GroupManager) p;
- }
-
- @Override
- public boolean canGroupRawBuild(String world, String group) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().canGroupBuild(group);
- }
-
- @Override
- public void closeAll() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public int compareWeights(String firstWorld, String first, String secondWorld, String second) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public int compareWeights(String world, String first, String second) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public Map<String, Set<String>> getAllGroups(String world, String name) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public Group getDefaultGroup(String world) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public Group getGroupObject(String world, String group) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public String getGroupProperName(String world, String group) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public Boolean getInfoBoolean(String world, String entryName, String path,
- boolean isGroup) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getInfoBoolean(entryName, path, isGroup);
- }
-
- @Override
- public Boolean getInfoBoolean(String world, String entryName, String path,
- boolean isGroup, Comparator<Boolean> comparator) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public Double getInfoDouble(String world, String entryName, String path, boolean isGroup) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getInfoDouble(entryName, path, isGroup);
- }
-
- @Override
- public Double getInfoDouble(String world, String entryName, String path,
- boolean isGroup, Comparator<Double> comparator) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public Integer getInfoInteger(String world, String entryName, String path,
- boolean isGroup) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getInfoInteger(entryName, path, isGroup);
- }
-
- @Override
- public Integer getInfoInteger(String world, String entryName, String path,
- boolean isGroup, Comparator<Integer> comparator) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public String getInfoString(String world, String entryName, String path, boolean isGroup) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getInfoString(entryName, path, isGroup);
- }
-
- @Override
- public String getInfoString(String world, String entryName, String path,
- boolean isGroup, Comparator<String> comparator) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public Boolean getRawInfoBoolean(String world, String entryName, String path,
- boolean isGroup) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public Double getRawInfoDouble(String world, String entryName, String path,
- boolean isGroup) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public Integer getRawInfoInteger(String world, String entryName, String path,
- boolean isGroup) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public String getRawInfoString(String world, String entryName, String path,
- boolean isGroup) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public Set<String> getTracks(String world) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public User getUserObject(String world, String name) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public Collection<User> getUsers(String world) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public Set<String> getWorlds() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public boolean has(String world, String playerName, String permission) {
- if (permission == null || permission.isEmpty()) {
- return false;
- }
- if (playerName == null || playerName.isEmpty()) {
- GroupManager.logger.severe("A plugin is asking permission '" + permission + "' for a null player... Which plugin does that? Bastards!");
- return false;
- }
- if (world == null) {
- GroupManager.logger.warning("The player " + playerName + " has a null world? Treating as default world!");
- return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().permission(playerName, permission);
- }
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().permission(playerName, permission);
- }
-
- @Override
- public boolean inGroup(String world, String user, String groupWorld, String group) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().inGroup(user, group);
- }
-
- @Override
- public boolean inSingleGroup(String world, String user, String group) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public boolean inSingleGroup(String world, String user, String groupWorld, String group) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public boolean permission(String world, String name, String node) {
- return has(world, name, node);
- }
-
- @Override
- public Group safeGetGroup(String world, String name) throws Exception {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public User safeGetUser(String world, String name) throws Exception {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public void save(String world) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public void saveAll() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public Collection<Group> getGroups(String world) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- //@Override
- public Group getPrimaryGroupObject(String arg0, String arg1) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
+public class NijikoPermissionsProxy extends PermissionHandler
+{
+ GroupManager plugin;
+
+ public NijikoPermissionsProxy(GroupManager plugin)
+ {
+ super();
+ this.plugin = plugin;
+ }
+
+ @Override
+ public void addGroupPermission(String world, String group, String node)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void removeGroupPermission(String world, String group, String node)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void addGroupInfo(String world, String group, String node, Object data)
+ {
+ plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().addGroupInfo(group, node, data);
+ }
+
+ @Override
+ public void removeGroupInfo(String world, String group, String node)
+ {
+ plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().removeGroupInfo(group, node);
+ }
+
+ @Override
+ public void addUserPermission(String world, String user, String node)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void removeUserPermission(String world, String user, String node)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void addUserInfo(String world, String user, String node, Object data)
+ {
+ plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().addUserInfo(user, node, data);
+ }
+
+ @Override
+ public void removeUserInfo(String world, String user, String node)
+ {
+ plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().removeUserInfo(user, node);
+ }
+
+ @Deprecated
+ public void removeUserInfo(String user, String node)
+ {
+ plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().removeUserInfo(user, node);
+ }
+
+ @Deprecated
+ public void addGroupPermission(String group, String node)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Deprecated
+ public void removeGroupPermission(String group, String node)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Deprecated
+ public void addGroupInfo(String group, String node, Object data)
+ {
+ plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().addGroupInfo(group, node, data);
+ }
+
+ @Deprecated
+ public void removeGroupInfo(String group, String node)
+ {
+ plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().removeGroupInfo(group, node);
+ }
+
+ @Deprecated
+ public void addUserPermission(String user, String node)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Deprecated
+ public void removeUserPermission(String user, String node)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Deprecated
+ public void addUserInfo(String user, String node, Object data)
+ {
+ plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().addUserInfo(user, node, data);
+ }
+
+ @Override
+ public void setDefaultWorld(String world)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Deprecated
+ public void setDirectory(File directory)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean loadWorld(String world)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void forceLoadWorld(String world)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean checkWorld(String world)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void load()
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void reload()
+ {
+ plugin.getWorldsHolder().reloadAll();
+ //throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean reload(String world)
+ {
+ plugin.getWorldsHolder().reloadWorld(world);
+ return true;
+ }
+
+ @Override
+ public boolean has(Player player, String permission)
+ {
+ //throw new UnsupportedOperationException("Not supported yet.");
+ return permission(player, permission);
+ }
+
+ @Override
+ public boolean permission(Player player, String permission)
+ {
+ //throw new UnsupportedOperationException("Not supported yet.");
+ if (permission == null || permission.equals(""))
+ {
+ return false;
+ }
+ if (player == null)
+ {
+ GroupManager.logger.severe("A plugin is asking permission '" + permission + "' for a null player... Which plugin does that? Bastards!");
+ return false;
+ }
+ if (player.getWorld() == null)
+ {
+ GroupManager.logger.warning("The player " + player.getName() + " has a null world? Treating as default world!");
+ return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().has(player, permission);
+ }
+ return plugin.getWorldsHolder().getWorldData(player.getWorld().getName()).getPermissionsHandler().has(player, permission);
+ }
+
+ @Override
+ public String getGroupRawPrefix(String world, String group)
+ {
+ return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupPrefix(group);
+ }
+
+ @Override
+ public String getGroupRawSuffix(String world, String group)
+ {
+ return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupSuffix(group);
+ }
+
+ @Override
+ public String getUserPrefix(String world, String user)
+ {
+ return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getUserPrefix(user);
+ }
+
+ @Override
+ public String getUserSuffix(String world, String user)
+ {
+ return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getUserSuffix(user);
+ }
+
+ @Override
+ public String getGroup(String world, String user)
+ {
+ return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroup(user);
+ }
+
+ @Override
+ public String getPrimaryGroup(String world, String user)
+ {
+ return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroup(user);
+ }
+
+ @Override
+ public boolean canUserBuild(String world, String user)
+ {
+ return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().canUserBuild(user);
+ }
+
+ @Deprecated
+ public String getGroup(String name)
+ {
+ return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroup(name);
+ }
+
+ @Override
+ public String[] getGroups(String world, String name)
+ {
+ return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroups(name);
+ }
+
+ @Override
+ public boolean inGroup(String world, String name, String group)
+ {
+ return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().inGroup(name, group);
+ }
+
+ @Deprecated
+ public boolean inGroup(String name, String group)
+ {
+ return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().inGroup(name, group);
+ }
+
+ @Override
+ public String getGroupPrefix(String world, String group)
+ {
+ return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupPrefix(group);
+ }
+
+ @Deprecated
+ public String getGroupPrefix(String group)
+ {
+ return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroupPrefix(group);
+ }
+
+ @Override
+ public String getGroupSuffix(String world, String group)
+ {
+ return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupSuffix(group);
+ }
+
+ @Deprecated
+ public String getGroupSuffix(String group)
+ {
+ return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroupSuffix(group);
+ }
+
+ @Override
+ public boolean canGroupBuild(String world, String group)
+ {
+ return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().canGroupBuild(group);
+ }
+
+ @Deprecated
+ public boolean canGroupBuild(String group)
+ {
+ return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().canGroupBuild(group);
+ }
+
+ @Override
+ public String getGroupPermissionString(String world, String group, String permission)
+ {
+ return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupPermissionString(group, permission);
+ }
+
+ @Deprecated
+ public String getGroupPermissionString(String group, String permission)
+ {
+ return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroupPermissionString(group, permission);
+ }
+
+ @Override
+ public int getGroupPermissionInteger(String world, String group, String permission)
+ {
+ return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupPermissionInteger(group, permission);
+ }
+
+ @Deprecated
+ public int getGroupPermissionInteger(String group, String permission)
+ {
+ return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroupPermissionInteger(group, permission);
+ }
+
+ @Override
+ public boolean getGroupPermissionBoolean(String world, String group, String permission)
+ {
+ return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupPermissionBoolean(group, permission);
+ }
+
+ @Deprecated
+ public boolean getGroupPermissionBoolean(String group, String permission)
+ {
+ return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroupPermissionBoolean(group, permission);
+ }
+
+ @Override
+ public double getGroupPermissionDouble(String world, String group, String permission)
+ {
+ return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupPermissionDouble(group, permission);
+ }
+
+ @Deprecated
+ public double getGroupPermissionDouble(String group, String permission)
+ {
+ return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroupPermissionDouble(group, permission);
+ }
+
+ @Override
+ public String getUserPermissionString(String world, String name, String permission)
+ {
+ return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getUserPermissionString(name, permission);
+ }
+
+ @Deprecated
+ public String getUserPermissionString(String name, String permission)
+ {
+ return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getUserPermissionString(name, permission);
+ }
+
+ @Override
+ public int getUserPermissionInteger(String world, String name, String permission)
+ {
+ return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getUserPermissionInteger(name, permission);
+ }
+
+ @Deprecated
+ public int getUserPermissionInteger(String name, String permission)
+ {
+ return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getUserPermissionInteger(name, permission);
+ }
+
+ @Override
+ public boolean getUserPermissionBoolean(String world, String name, String permission)
+ {
+ return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getUserPermissionBoolean(name, permission);
+ }
+
+ @Deprecated
+ public boolean getUserPermissionBoolean(String name, String permission)
+ {
+ return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getUserPermissionBoolean(name, permission);
+ }
+
+ @Override
+ public double getUserPermissionDouble(String world, String name, String permission)
+ {
+ return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getUserPermissionDouble(name, permission);
+ }
+
+ @Deprecated
+ public double getUserPermissionDouble(String name, String permission)
+ {
+ return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getUserPermissionDouble(name, permission);
+ }
+
+ @Override
+ public String getPermissionString(String world, String name, String permission)
+ {
+ return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getPermissionString(name, permission);
+ }
+
+ @Deprecated
+ public String getPermissionString(String name, String permission)
+ {
+ return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getPermissionString(name, permission);
+ }
+
+ @Override
+ public int getPermissionInteger(String world, String name, String permission)
+ {
+ return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getPermissionInteger(name, permission);
+ }
+
+ @Deprecated
+ public int getPermissionInteger(String name, String permission)
+ {
+ return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getPermissionInteger(name, permission);
+ }
+
+ @Override
+ public boolean getPermissionBoolean(String world, String name, String permission)
+ {
+ return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getPermissionBoolean(name, permission);
+ }
+
+ @Deprecated
+ public boolean getPermissionBoolean(String name, String permission)
+ {
+ return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getPermissionBoolean(name, permission);
+ }
+
+ @Override
+ public double getPermissionDouble(String world, String name, String permission)
+ {
+ return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getPermissionDouble(name, permission);
+ }
+
+ @Deprecated
+ public double getPermissionDouble(String name, String permission)
+ {
+ return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getPermissionDouble(name, permission);
+ }
+
+ public void setGM(Plugin p)
+ {
+ this.plugin = (GroupManager)p;
+ }
+
+ @Override
+ public boolean canGroupRawBuild(String world, String group)
+ {
+ return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().canGroupBuild(group);
+ }
+
+ @Override
+ public void closeAll()
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public int compareWeights(String firstWorld, String first, String secondWorld, String second)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public int compareWeights(String world, String first, String second)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public Map<String, Set<String>> getAllGroups(String world, String name)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public Group getDefaultGroup(String world)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public Group getGroupObject(String world, String group)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public String getGroupProperName(String world, String group)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public Boolean getInfoBoolean(String world, String entryName, String path,
+ boolean isGroup)
+ {
+ return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getInfoBoolean(entryName, path, isGroup);
+ }
+
+ @Override
+ public Boolean getInfoBoolean(String world, String entryName, String path,
+ boolean isGroup, Comparator<Boolean> comparator)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public Double getInfoDouble(String world, String entryName, String path, boolean isGroup)
+ {
+ return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getInfoDouble(entryName, path, isGroup);
+ }
+
+ @Override
+ public Double getInfoDouble(String world, String entryName, String path,
+ boolean isGroup, Comparator<Double> comparator)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public Integer getInfoInteger(String world, String entryName, String path,
+ boolean isGroup)
+ {
+ return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getInfoInteger(entryName, path, isGroup);
+ }
+
+ @Override
+ public Integer getInfoInteger(String world, String entryName, String path,
+ boolean isGroup, Comparator<Integer> comparator)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public String getInfoString(String world, String entryName, String path, boolean isGroup)
+ {
+ return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getInfoString(entryName, path, isGroup);
+ }
+
+ @Override
+ public String getInfoString(String world, String entryName, String path,
+ boolean isGroup, Comparator<String> comparator)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public Boolean getRawInfoBoolean(String world, String entryName, String path,
+ boolean isGroup)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public Double getRawInfoDouble(String world, String entryName, String path,
+ boolean isGroup)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public Integer getRawInfoInteger(String world, String entryName, String path,
+ boolean isGroup)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public String getRawInfoString(String world, String entryName, String path,
+ boolean isGroup)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public Set<String> getTracks(String world)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public User getUserObject(String world, String name)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public Collection<User> getUsers(String world)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public Set<String> getWorlds()
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean has(String world, String playerName, String permission)
+ {
+ if (permission == null || permission.isEmpty())
+ {
+ return false;
+ }
+ if (playerName == null || playerName.isEmpty())
+ {
+ GroupManager.logger.severe("A plugin is asking permission '" + permission + "' for a null player... Which plugin does that? Bastards!");
+ return false;
+ }
+ if (world == null)
+ {
+ GroupManager.logger.warning("The player " + playerName + " has a null world? Treating as default world!");
+ return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().permission(playerName, permission);
+ }
+ return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().permission(playerName, permission);
+ }
+
+ @Override
+ public boolean inGroup(String world, String user, String groupWorld, String group)
+ {
+ return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().inGroup(user, group);
+ }
+
+ @Override
+ public boolean inSingleGroup(String world, String user, String group)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean inSingleGroup(String world, String user, String groupWorld, String group)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean permission(String world, String name, String node)
+ {
+ return has(world, name, node);
+ }
+
+ @Override
+ public Group safeGetGroup(String world, String name) throws Exception
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public User safeGetUser(String world, String name) throws Exception
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void save(String world)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void saveAll()
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public Collection<Group> getGroups(String world)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ //@Override
+ public Group getPrimaryGroupObject(String arg0, String arg1)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
}
diff --git a/EssentialsGroupManager/pom.xml b/EssentialsGroupManager/pom.xml
index f0ec22557..1658a7e3e 100644
--- a/EssentialsGroupManager/pom.xml
+++ b/EssentialsGroupManager/pom.xml
@@ -1,13 +1,13 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>net.essentials3</groupId>
- <artifactId>BuildAll</artifactId>
- <version>3.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
+ <parent>
+ <groupId>net.essentials3</groupId>
+ <artifactId>BuildAll</artifactId>
+ <version>3.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
- <artifactId>EssentialsGroupManager</artifactId>
+ <artifactId>EssentialsGroupManager</artifactId>
</project>
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java
index 0832000f2..0b5437c11 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java
@@ -12,42 +12,53 @@ import java.util.logging.Level;
import org.anjocaido.groupmanager.utils.Tasks;
import org.bukkit.configuration.file.YamlConfiguration;
+
/**
- *
+ *
* @author gabrielcouto
*/
-public class GMConfiguration {
-
+public class GMConfiguration
+{
private GroupManager plugin;
private File configFile;
private YamlConfiguration GMconfig;
- public GMConfiguration(GroupManager plugin) {
+ public GMConfiguration(GroupManager plugin)
+ {
this.plugin = plugin;
load();
}
- public void load() {
+ public void load()
+ {
- if (!plugin.getDataFolder().exists()) {
+ if (!plugin.getDataFolder().exists())
+ {
plugin.getDataFolder().mkdirs();
}
configFile = new File(plugin.getDataFolder(), "config.yml");
- if (!configFile.exists()) {
- try {
+ if (!configFile.exists())
+ {
+ try
+ {
Tasks.copy(plugin.getResourceAsStream("config.yml"), configFile);
- } catch (IOException ex) {
+ }
+ catch (IOException ex)
+ {
GroupManager.logger.log(Level.SEVERE, null, ex);
}
}
GMconfig = new YamlConfiguration();
- try {
+ try
+ {
GMconfig.load(configFile);
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
throw new IllegalArgumentException("The following file couldn't pass on Parser.\n" + configFile.getPath(), ex);
}
@@ -56,44 +67,56 @@ public class GMConfiguration {
plugin.setValidateOnlinePlayer(isToggleValidate());
}
- public boolean isOpOverride() {
+ public boolean isOpOverride()
+ {
return GMconfig.getBoolean("settings.config.opOverrides", true);
}
- public boolean isToggleValidate() {
+ public boolean isToggleValidate()
+ {
return GMconfig.getBoolean("settings.config.validate_toggle", true);
}
- public Map<String, Object> getMirrorsMap() {
+ public Map<String, Object> getMirrorsMap()
+ {
// Try to fetch the old mirror path first
- if (GMconfig.isConfigurationSection("settings.permission.world.mirror")) {
- return (Map<String, Object>) GMconfig.getConfigurationSection("settings.permission.world.mirror").getValues(false);
- } else if (GMconfig.isConfigurationSection("settings.mirrors")) {
- return (Map<String, Object>) GMconfig.getConfigurationSection("settings.mirrors").getValues(false);
+ if (GMconfig.isConfigurationSection("settings.permission.world.mirror"))
+ {
+ return (Map<String, Object>)GMconfig.getConfigurationSection("settings.permission.world.mirror").getValues(false);
+ }
+ else if (GMconfig.isConfigurationSection("settings.mirrors"))
+ {
+ return (Map<String, Object>)GMconfig.getConfigurationSection("settings.mirrors").getValues(false);
}
return null;
}
- public Integer getSaveInterval() {
+ public Integer getSaveInterval()
+ {
return GMconfig.getInt("settings.data.save.minutes", 10);
}
- public Integer getBackupDuration() {
+ public Integer getBackupDuration()
+ {
return GMconfig.getInt("settings.data.save.hours", 24);
}
- public void adjustLoggerLevel() {
+ public void adjustLoggerLevel()
+ {
- try {
+ try
+ {
GroupManager.logger.setLevel(Level.parse(GMconfig.getString("settings.logging.level", "INFO")));
return;
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
}
GroupManager.logger.setLevel(Level.INFO);
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GlobalGroups.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GlobalGroups.java
index 04d9e86be..1335ecbe3 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GlobalGroups.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GlobalGroups.java
@@ -24,22 +24,22 @@ import org.bukkit.configuration.file.YamlConfiguration;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;
+
/**
* @author ElgarL
- *
+ *
*/
-public class GlobalGroups {
-
+public class GlobalGroups
+{
private GroupManager plugin;
private YamlConfiguration GGroups;
-
private Map<String, Group> groups;
-
protected long timeStampGroups = 0;
protected boolean haveGroupsChanged = false;
protected File GlobalGroupsFile = null;
- public GlobalGroups(GroupManager plugin) {
+ public GlobalGroups(GroupManager plugin)
+ {
this.plugin = plugin;
load();
@@ -48,13 +48,17 @@ public class GlobalGroups {
/**
* @return the haveGroupsChanged
*/
- public boolean haveGroupsChanged() {
+ public boolean haveGroupsChanged()
+ {
- if (this.haveGroupsChanged) {
+ if (this.haveGroupsChanged)
+ {
return true;
}
- for (Group g : groups.values()) {
- if (g.isChanged()) {
+ for (Group g : groups.values())
+ {
+ if (g.isChanged())
+ {
return true;
}
}
@@ -64,7 +68,8 @@ public class GlobalGroups {
/**
* @return the timeStampGroups
*/
- public long getTimeStampGroups() {
+ public long getTimeStampGroups()
+ {
return timeStampGroups;
}
@@ -72,22 +77,24 @@ public class GlobalGroups {
/**
* @param timeStampGroups the timeStampGroups to set
*/
- protected void setTimeStampGroups(long timeStampGroups) {
+ protected void setTimeStampGroups(long timeStampGroups)
+ {
this.timeStampGroups = timeStampGroups;
}
/**
- * @param haveGroupsChanged
- * the haveGroupsChanged to set
+ * @param haveGroupsChanged the haveGroupsChanged to set
*/
- public void setGroupsChanged(boolean haveGroupsChanged) {
+ public void setGroupsChanged(boolean haveGroupsChanged)
+ {
this.haveGroupsChanged = haveGroupsChanged;
}
@SuppressWarnings("unchecked")
- public void load() {
+ public void load()
+ {
GGroups = new YamlConfiguration();
@@ -95,39 +102,53 @@ public class GlobalGroups {
// READ globalGroups FILE
if (GlobalGroupsFile == null)
+ {
GlobalGroupsFile = new File(plugin.getDataFolder(), "globalgroups.yml");
+ }
- if (!GlobalGroupsFile.exists()) {
- try {
+ if (!GlobalGroupsFile.exists())
+ {
+ try
+ {
// Create a new file if it doesn't exist.
Tasks.copy(plugin.getResourceAsStream("globalgroups.yml"), GlobalGroupsFile);
- } catch (IOException ex) {
+ }
+ catch (IOException ex)
+ {
GroupManager.logger.log(Level.SEVERE, null, ex);
}
}
- try {
+ try
+ {
GGroups.load(GlobalGroupsFile);
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
throw new IllegalArgumentException("The following file couldn't pass on Parser.\n" + GlobalGroupsFile.getPath(), ex);
}
// Clear out old groups
resetGlobalGroups();
- if (!GGroups.getKeys(false).isEmpty()) {
+ if (!GGroups.getKeys(false).isEmpty())
+ {
// Read all global groups
Map<String, Object> allGroups = new HashMap<String, Object>();
- try {
- allGroups = (Map<String, Object>) GGroups.getConfigurationSection("groups").getValues(false);
- } catch (Exception ex) {
+ try
+ {
+ allGroups = (Map<String, Object>)GGroups.getConfigurationSection("groups").getValues(false);
+ }
+ catch (Exception ex)
+ {
// ex.printStackTrace();
throw new IllegalArgumentException("Your " + GlobalGroupsFile.getPath() + " file is invalid. See console for details.", ex);
}
// Load each groups permissions list.
- if (allGroups != null) {
+ if (allGroups != null)
+ {
Iterator<String> groupItr = allGroups.keySet().iterator();
String groupName;
@@ -137,12 +158,16 @@ public class GlobalGroups {
* loop each group entry
* and read it's data.
*/
- while (groupItr.hasNext()) {
- try {
+ while (groupItr.hasNext())
+ {
+ try
+ {
groupCount++;
// Attempt to fetch the next group name.
groupName = groupItr.next();
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
throw new IllegalArgumentException("Invalid group name for GlobalGroup entry (" + groupCount + ") in file: " + GlobalGroupsFile.getPath(), ex);
}
@@ -156,33 +181,56 @@ public class GlobalGroups {
element = GGroups.get("groups." + groupName + ".permissions");
if (element != null)
- if (element instanceof List) {
- try {
- for (String node : (List<String>) element) {
+ {
+ if (element instanceof List)
+ {
+ try
+ {
+ for (String node : (List<String>)element)
+ {
if ((node != null) && !node.isEmpty())
+ {
newGroup.addPermission(node);
+ }
}
- } catch (ClassCastException ex) {
+ }
+ catch (ClassCastException ex)
+ {
throw new IllegalArgumentException("Invalid permission node for global group: " + groupName, ex);
}
- } else if (element instanceof String) {
+ }
+ else if (element instanceof String)
+ {
if ((element != null) && !((String)element).isEmpty())
- newGroup.addPermission((String) element);
- } else
+ {
+ newGroup.addPermission((String)element);
+ }
+ }
+ else
+ {
throw new IllegalArgumentException("Unknown type of permission node for global group: " + groupName);
+ }
+ }
// Info nodes
element = GGroups.get("groups." + groupName + ".info");
if (element != null)
- if (element instanceof MemorySection) {
+ {
+ if (element instanceof MemorySection)
+ {
Map<String, Object> vars = new HashMap<String, Object>();
- for (String key : ((MemorySection) element).getKeys(false)) {
- vars.put(key, ((MemorySection) element).get(key));
+ for (String key : ((MemorySection)element).getKeys(false))
+ {
+ vars.put(key, ((MemorySection)element).get(key));
}
newGroup.setVariables(vars);
- } else
+ }
+ else
+ {
throw new IllegalArgumentException("Unknown type of info node for global group: " + groupName);
+ }
+ }
// Push a new group
addGroup(newGroup);
@@ -200,18 +248,21 @@ public class GlobalGroups {
/**
* Write the globalgroups.yml file
*/
-
- public void writeGroups(boolean overwrite) {
+ public void writeGroups(boolean overwrite)
+ {
// File GlobalGroupsFile = new File(plugin.getDataFolder(), "globalgroups.yml");
- if (haveGroupsChanged()) {
- if (overwrite || (!overwrite && (getTimeStampGroups() >= GlobalGroupsFile.lastModified()))) {
+ if (haveGroupsChanged())
+ {
+ if (overwrite || (!overwrite && (getTimeStampGroups() >= GlobalGroupsFile.lastModified())))
+ {
Map<String, Object> root = new HashMap<String, Object>();
Map<String, Object> groupsMap = new HashMap<String, Object>();
root.put("groups", groupsMap);
- for (String groupKey : groups.keySet()) {
+ for (String groupKey : groups.keySet())
+ {
Group group = groups.get(groupKey);
// Group header
@@ -222,7 +273,8 @@ public class GlobalGroups {
Map<String, Object> infoMap = new HashMap<String, Object>();
aGroupMap.put("info", infoMap);
- for (String infoKey : group.getVariables().getVarKeyList()) {
+ for (String infoKey : group.getVariables().getVarKeyList())
+ {
infoMap.put(infoKey, group.getVariables().getVarObject(infoKey));
}
@@ -230,26 +282,37 @@ public class GlobalGroups {
aGroupMap.put("permissions", group.getPermissionList());
}
- if (!root.isEmpty()) {
+ if (!root.isEmpty())
+ {
DumperOptions opt = new DumperOptions();
opt.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
final Yaml yaml = new Yaml(opt);
- try {
+ try
+ {
yaml.dump(root, new OutputStreamWriter(new FileOutputStream(GlobalGroupsFile), "UTF-8"));
- } catch (UnsupportedEncodingException ex) {
- } catch (FileNotFoundException ex) {
+ }
+ catch (UnsupportedEncodingException ex)
+ {
+ }
+ catch (FileNotFoundException ex)
+ {
}
}
setTimeStampGroups(GlobalGroupsFile.lastModified());
- } else {
+ }
+ else
+ {
// Newer file found.
GroupManager.logger.log(Level.WARNING, "Newer GlobalGroups file found, but we have local changes!");
throw new IllegalStateException("Unable to save unless you issue a '/mansave force'");
}
removeGroupsChangedFlag();
- } else {
+ }
+ else
+ {
// Check for newer file as no local changes.
- if (getTimeStampGroups() < GlobalGroupsFile.lastModified()) {
+ if (getTimeStampGroups() < GlobalGroupsFile.lastModified())
+ {
System.out.print("Newer GlobalGroups file found (Loading changes)!");
// Backup GlobalGroups file
backupFile();
@@ -261,28 +324,34 @@ public class GlobalGroups {
/**
* Backup the BlobalGroups file
- *
+ *
* @param w
*/
- private void backupFile() {
+ private void backupFile()
+ {
File backupFile = new File(plugin.getBackupFolder(), "bkp_ggroups_" + Tasks.getDateString() + ".yml");
- try {
+ try
+ {
Tasks.copy(GlobalGroupsFile, backupFile);
- } catch (IOException ex) {
+ }
+ catch (IOException ex)
+ {
GroupManager.logger.log(Level.SEVERE, null, ex);
}
}
/**
* Adds a group, or replaces an existing one.
- *
+ *
* @param groupToAdd
*/
- public void addGroup(Group groupToAdd) {
+ public void addGroup(Group groupToAdd)
+ {
// Create a new group if it already exists
- if (hasGroup(groupToAdd.getName())) {
+ if (hasGroup(groupToAdd.getName()))
+ {
groupToAdd = groupToAdd.clone();
removeGroup(groupToAdd.getName());
}
@@ -290,18 +359,22 @@ public class GlobalGroups {
newGroup(groupToAdd);
haveGroupsChanged = true;
if (GroupManager.isLoaded())
+ {
GroupManagerEventHandler.callEvent(groupToAdd, GMGroupEvent.Action.GROUP_ADDED);
+ }
}
/**
* Creates a new group if it doesn't already exist.
- *
+ *
* @param newGroup
*/
- public Group newGroup(Group newGroup) {
+ public Group newGroup(Group newGroup)
+ {
// Push a new group
- if (!groups.containsKey(newGroup.getName().toLowerCase())) {
+ if (!groups.containsKey(newGroup.getName().toLowerCase()))
+ {
groups.put(newGroup.getName().toLowerCase(), newGroup);
this.setGroupsChanged(true);
return newGroup;
@@ -311,17 +384,21 @@ public class GlobalGroups {
/**
* Delete a group if it exist.
- *
+ *
* @param groupName
*/
- public boolean removeGroup(String groupName) {
+ public boolean removeGroup(String groupName)
+ {
// Push a new group
- if (groups.containsKey(groupName.toLowerCase())) {
+ if (groups.containsKey(groupName.toLowerCase()))
+ {
groups.remove(groupName.toLowerCase());
this.setGroupsChanged(true);
if (GroupManager.isLoaded())
+ {
GroupManagerEventHandler.callEvent(groupName.toLowerCase(), GMGroupEvent.Action.GROUP_REMOVED);
+ }
return true;
}
return false;
@@ -329,80 +406,96 @@ public class GlobalGroups {
/**
* Returns true if the Global Group exists in the globalgroups.yml
- *
+ *
* @param groupName
* @return true if the group exists
*/
- public boolean hasGroup(String groupName) {
+ public boolean hasGroup(String groupName)
+ {
return groups.containsKey(groupName.toLowerCase());
}
/**
* Returns true if the group has the correct permission node.
- *
+ *
* @param groupName
* @param permissionNode
* @return true if node exists
*/
- public boolean hasPermission(String groupName, String permissionNode) {
+ public boolean hasPermission(String groupName, String permissionNode)
+ {
if (!hasGroup(groupName))
+ {
return false;
+ }
return groups.get(groupName.toLowerCase()).hasSamePermissionNode(permissionNode);
}
/**
- * Returns a PermissionCheckResult of the permission node for the group to
- * be tested against.
- *
+ * Returns a PermissionCheckResult of the permission node for the group to be tested against.
+ *
* @param groupName
* @param permissionNode
* @return PermissionCheckResult object
*/
- public PermissionCheckResult checkPermission(String groupName, String permissionNode) {
+ public PermissionCheckResult checkPermission(String groupName, String permissionNode)
+ {
PermissionCheckResult result = new PermissionCheckResult();
result.askedPermission = permissionNode;
result.resultType = PermissionCheckResult.Type.NOTFOUND;
if (!hasGroup(groupName))
+ {
return result;
+ }
Group tempGroup = groups.get(groupName.toLowerCase());
if (tempGroup.hasSamePermissionNode(permissionNode))
+ {
result.resultType = PermissionCheckResult.Type.FOUND;
+ }
if (tempGroup.hasSamePermissionNode("-" + permissionNode))
+ {
result.resultType = PermissionCheckResult.Type.NEGATION;
+ }
if (tempGroup.hasSamePermissionNode("+" + permissionNode))
+ {
result.resultType = PermissionCheckResult.Type.EXCEPTION;
+ }
return result;
}
/**
* Returns a List of all permission nodes for this group null if none
- *
+ *
* @param groupName
* @return List of all group names
*/
- public List<String> getGroupsPermissions(String groupName) {
+ public List<String> getGroupsPermissions(String groupName)
+ {
if (!hasGroup(groupName))
+ {
return null;
+ }
return groups.get(groupName.toLowerCase()).getPermissionList();
}
/**
* Returns a Set of all global group names.
- *
+ *
* @return Set containing all group names.
*/
- public Set<String> getGlobalGroups() {
+ public Set<String> getGlobalGroups()
+ {
return groups.keySet();
}
@@ -410,30 +503,35 @@ public class GlobalGroups {
/**
* Resets GlobalGroups.
*/
- public void resetGlobalGroups() {
+ public void resetGlobalGroups()
+ {
this.groups = new HashMap<String, Group>();
}
/**
- *
+ *
* @return a collection of the groups
*/
- public Collection<Group> getGroupList() {
+ public Collection<Group> getGroupList()
+ {
return groups.values();
}
/**
* Returns the Global Group or null if it doesn't exist.
- *
+ *
* @param groupName
* @return Group object
*/
- public Group getGroup(String groupName) {
+ public Group getGroup(String groupName)
+ {
if (!hasGroup(groupName))
+ {
return null;
+ }
return groups.get(groupName.toLowerCase());
@@ -442,20 +540,22 @@ public class GlobalGroups {
/**
* @return the globalGroupsFile
*/
- public File getGlobalGroupsFile() {
+ public File getGlobalGroupsFile()
+ {
return GlobalGroupsFile;
}
/**
- *
- */
- public void removeGroupsChangedFlag() {
+ *
+ */
+ public void removeGroupsChangedFlag()
+ {
setGroupsChanged(false);
- for (Group g : groups.values()) {
+ for (Group g : groups.values())
+ {
g.flagAsSaved();
}
}
-
} \ No newline at end of file
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
index 5f357641a..2a41f33f0 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
@@ -47,8 +47,8 @@ import org.bukkit.plugin.java.JavaPlugin;
*
* @author gabrielcouto, ElgarL
*/
-public class GroupManager extends JavaPlugin {
-
+public class GroupManager extends JavaPlugin
+{
private File backupFolder;
private Runnable commiter;
private ScheduledThreadPoolExecutor scheduler;
@@ -56,91 +56,103 @@ public class GroupManager extends JavaPlugin {
private Map<CommandSender, String> selectedWorlds = new HashMap<CommandSender, String>();
private WorldsHolder worldsHolder;
private boolean validateOnlinePlayer = true;
-
private static boolean isLoaded = false;
protected GMConfiguration config;
-
protected static GlobalGroups globalGroups;
-
private GMLoggerHandler ch;
public static BukkitPermissions BukkitPermissions;
private static GMWorldListener WorldEvents;
public static final Logger logger = Logger.getLogger(GroupManager.class.getName());
-
// PERMISSIONS FOR COMMAND BEING LOADED
private OverloadedWorldHolder dataHolder = null;
private AnjoPermissionsHandler permissionHandler = null;
-
private String lastError = "";
@Override
- public void onDisable() {
-
+ public void onDisable()
+ {
+
onDisable(false);
}
-
+
@Override
- public void onEnable() {
-
+ public void onEnable()
+ {
+
onEnable(false);
}
-
- public void onDisable(boolean restarting) {
+
+ public void onDisable(boolean restarting)
+ {
setLoaded(false);
- if (!restarting) {
+ if (!restarting)
+ {
// Unregister this service if we are shutting down.
this.getServer().getServicesManager().unregister(this.worldsHolder);
}
disableScheduler(); // Shutdown before we save, so it doesn't interfere.
- if (worldsHolder != null) {
- try {
+ if (worldsHolder != null)
+ {
+ try
+ {
worldsHolder.saveChanges(false);
- } catch (IllegalStateException ex) {
+ }
+ catch (IllegalStateException ex)
+ {
GroupManager.logger.log(Level.WARNING, ex.getMessage());
}
}
-
+
// Remove all attachments before clearing
- if (BukkitPermissions != null) {
+ if (BukkitPermissions != null)
+ {
BukkitPermissions.removeAllAttachments();
}
-
- if (!restarting) {
-
+
+ if (!restarting)
+ {
+
if (WorldEvents != null)
+ {
WorldEvents = null;
+ }
BukkitPermissions = null;
-
+
}
// EXAMPLE: Custom code, here we just output some info so we can check that all is well
PluginDescriptionFile pdfFile = this.getDescription();
System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " is disabled!");
-
+
if (!restarting)
+ {
GroupManager.logger.removeHandler(ch);
+ }
}
-
- public void onEnable(boolean restarting) {
- try {
+ public void onEnable(boolean restarting)
+ {
+
+ try
+ {
/*
* reset local variables.
*/
overloadedUsers = new HashMap<String, ArrayList<User>>();
selectedWorlds = new HashMap<CommandSender, String>();
lastError = "";
-
+
/*
* Setup our logger if we are not restarting.
*/
- if (!restarting) {
+ if (!restarting)
+ {
GroupManager.logger.setUseParentHandlers(false);
ch = new GMLoggerHandler();
GroupManager.logger.addHandler(ch);
@@ -153,20 +165,25 @@ public class GroupManager extends JavaPlugin {
prepareConfig();
// Load the global groups
globalGroups = new GlobalGroups(this);
-
+
/*
* Configure the worlds holder.
*/
if (!restarting)
+ {
worldsHolder = new WorldsHolder(this);
+ }
else
+ {
worldsHolder.resetWorldsHolder();
+ }
/*
* This should NEVER happen. No idea why it's still here.
*/
PluginDescriptionFile pdfFile = this.getDescription();
- if (worldsHolder == null) {
+ if (worldsHolder == null)
+ {
GroupManager.logger.severe("Can't enable " + pdfFile.getName() + " version " + pdfFile.getVersion() + ", bad loading!");
this.getServer().getPluginManager().disablePlugin(this);
throw new IllegalStateException("An error ocurred while loading GroupManager");
@@ -186,10 +203,13 @@ public class GroupManager extends JavaPlugin {
*
* Reset bukkit perms.
*/
- if (!restarting) {
+ if (!restarting)
+ {
WorldEvents = new GMWorldListener(this);
BukkitPermissions = new BukkitPermissions(this);
- } else {
+ }
+ else
+ {
BukkitPermissions.reset();
}
@@ -203,7 +223,8 @@ public class GroupManager extends JavaPlugin {
* All plugins will be loaded by then
*/
- if (getServer().getScheduler().scheduleSyncDelayedTask(this, new BukkitPermsUpdateTask(), 1) == -1) {
+ if (getServer().getScheduler().scheduleSyncDelayedTask(this, new BukkitPermsUpdateTask(), 1) == -1)
+ {
GroupManager.logger.severe("Could not schedule superperms Update.");
/*
* Flag that we are now loaded and should start processing events.
@@ -215,9 +236,13 @@ public class GroupManager extends JavaPlugin {
// Register as a service
if (!restarting)
+ {
this.getServer().getServicesManager().register(WorldsHolder.class, this.worldsHolder, this, ServicePriority.Lowest);
-
- } catch (Exception ex) {
+ }
+
+ }
+ catch (Exception ex)
+ {
/*
* Store the error and write to the log.
@@ -234,12 +259,14 @@ public class GroupManager extends JavaPlugin {
/**
* Write an error.log
- *
+ *
* @param ex
*/
- private void saveErrorLog(Exception ex) {
+ private void saveErrorLog(Exception ex)
+ {
- if (!getDataFolder().exists()) {
+ if (!getDataFolder().exists())
+ {
getDataFolder().mkdirs();
}
@@ -257,23 +284,27 @@ public class GroupManager extends JavaPlugin {
GroupManager.logger.severe("===================================================");
// Append this error to the error log.
- try {
+ try
+ {
String error = "=============================== GM ERROR LOG ===============================\n\n";
error += Tasks.getStackTraceAsString(ex);
error += "\n============================================================================\n";
Tasks.appendStringToFile(error, (getDataFolder() + System.getProperty("file.separator") + "ERROR.LOG"));
- } catch (IOException e) {
+ }
+ catch (IOException e)
+ {
// Failed to write file.
e.printStackTrace();
}
}
-
+
/**
* @return the validateOnlinePlayer
*/
- public boolean isValidateOnlinePlayer() {
+ public boolean isValidateOnlinePlayer()
+ {
return validateOnlinePlayer;
}
@@ -281,96 +312,120 @@ public class GroupManager extends JavaPlugin {
/**
* @param validateOnlinePlayer the validateOnlinePlayer to set
*/
- public void setValidateOnlinePlayer(boolean validateOnlinePlayer) {
+ public void setValidateOnlinePlayer(boolean validateOnlinePlayer)
+ {
this.validateOnlinePlayer = validateOnlinePlayer;
}
- public static boolean isLoaded() {
+ public static boolean isLoaded()
+ {
return isLoaded;
}
- public static void setLoaded(boolean isLoaded) {
+ public static void setLoaded(boolean isLoaded)
+ {
GroupManager.isLoaded = isLoaded;
}
- public InputStream getResourceAsStream(String fileName) {
+ public InputStream getResourceAsStream(String fileName)
+ {
return this.getClassLoader().getResourceAsStream(fileName);
}
- private void prepareFileFields() {
+ private void prepareFileFields()
+ {
backupFolder = new File(this.getDataFolder(), "backup");
- if (!backupFolder.exists()) {
+ if (!backupFolder.exists())
+ {
getBackupFolder().mkdirs();
}
}
- private void prepareConfig() {
+ private void prepareConfig()
+ {
config = new GMConfiguration(this);
}
- public void enableScheduler() {
+ public void enableScheduler()
+ {
- if (worldsHolder != null) {
+ if (worldsHolder != null)
+ {
disableScheduler();
- commiter = new Runnable() {
-
+ commiter = new Runnable()
+ {
@Override
- public void run() {
+ public void run()
+ {
- try {
+ try
+ {
worldsHolder.saveChanges(false);
GroupManager.logger.log(Level.INFO, " Data files refreshed.");
- } catch (IllegalStateException ex) {
+ }
+ catch (IllegalStateException ex)
+ {
GroupManager.logger.log(Level.WARNING, ex.getMessage());
}
}
};
scheduler = new ScheduledThreadPoolExecutor(1);
- long minutes = (long) getGMConfig().getSaveInterval();
- if (minutes > 0) {
+ long minutes = (long)getGMConfig().getSaveInterval();
+ if (minutes > 0)
+ {
scheduler.scheduleAtFixedRate(commiter, minutes, minutes, TimeUnit.MINUTES);
GroupManager.logger.info("Scheduled Data Saving is set for every " + minutes + " minutes!");
- } else
+ }
+ else
+ {
GroupManager.logger.info("Scheduled Data Saving is Disabled!");
+ }
GroupManager.logger.info("Backups will be retained for " + getGMConfig().getBackupDuration() + " hours!");
}
}
- public void disableScheduler() {
+ public void disableScheduler()
+ {
- if (scheduler != null) {
- try {
+ if (scheduler != null)
+ {
+ try
+ {
scheduler.setContinueExistingPeriodicTasksAfterShutdownPolicy(false);
scheduler.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
scheduler.shutdown();
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
}
scheduler = null;
GroupManager.logger.info("Scheduled Data Saving is disabled!");
}
}
- public WorldsHolder getWorldsHolder() {
+ public WorldsHolder getWorldsHolder()
+ {
return worldsHolder;
}
/**
* Called when a command registered by this plugin is received.
- *
+ *
* @param sender
* @param cmd
* @param args
*/
@Override
- public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
+ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args)
+ {
boolean playerCanDo = false;
boolean isConsole = false;
@@ -380,10 +435,12 @@ public class GroupManager extends JavaPlugin {
boolean isOpOverride = config.isOpOverride();
// DETERMINING PLAYER INFORMATION
- if (sender instanceof Player) {
- senderPlayer = (Player) sender;
+ if (sender instanceof Player)
+ {
+ senderPlayer = (Player)sender;
- if (!lastError.isEmpty() && !commandLabel.equalsIgnoreCase("manload")) {
+ if (!lastError.isEmpty() && !commandLabel.equalsIgnoreCase("manload"))
+ {
sender.sendMessage(ChatColor.RED + "All commands are locked due to an error. Check the log and then try a '/manload'.)");
return true;
}
@@ -393,12 +450,16 @@ public class GroupManager extends JavaPlugin {
isOpOverride = (isOpOverride && (senderPlayer.isOp() || worldsHolder.getWorldPermissions(senderPlayer).has(senderPlayer, "groupmanager.op")));
System.out.println("[PLAYER_COMMAND] " + senderPlayer.getName() + ": /" + commandLabel + " " + Tasks.join(args, " "));
- if (isOpOverride || worldsHolder.getWorldPermissions(senderPlayer).has(senderPlayer, "groupmanager." + cmd.getName())) {
+ if (isOpOverride || worldsHolder.getWorldPermissions(senderPlayer).has(senderPlayer, "groupmanager." + cmd.getName()))
+ {
playerCanDo = true;
}
- } else if (sender instanceof ConsoleCommandSender) {
+ }
+ else if (sender instanceof ConsoleCommandSender)
+ {
- if (!lastError.isEmpty() && !commandLabel.equalsIgnoreCase("manload")) {
+ if (!lastError.isEmpty() && !commandLabel.equalsIgnoreCase("manload"))
+ {
sender.sendMessage(ChatColor.RED + "All commands are locked due to an error. Check the log and then try a '/manload'.)");
return true;
}
@@ -410,16 +471,19 @@ public class GroupManager extends JavaPlugin {
dataHolder = null;
permissionHandler = null;
- if (senderPlayer != null) {
+ if (senderPlayer != null)
+ {
dataHolder = worldsHolder.getWorldData(senderPlayer);
}
String selectedWorld = selectedWorlds.get(sender);
- if (selectedWorld != null) {
+ if (selectedWorld != null)
+ {
dataHolder = worldsHolder.getWorldData(selectedWorld);
}
- if (dataHolder != null) {
+ if (dataHolder != null)
+ {
permissionHandler = dataHolder.getPermissionsHandler();
}
@@ -435,9 +499,12 @@ public class GroupManager extends JavaPlugin {
Group auxGroup2 = null;
GroupManagerPermissions execCmd = null;
- try {
+ try
+ {
execCmd = GroupManagerPermissions.valueOf(cmd.getName());
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
// this error happened once with someone. now im prepared... i think
GroupManager.logger.severe("===================================================");
GroupManager.logger.severe("= ERROR REPORT START =");
@@ -449,13 +516,15 @@ public class GroupManager extends JavaPlugin {
GroupManager.logger.severe("An error occured while trying to execute command:");
GroupManager.logger.severe(cmd.getName());
GroupManager.logger.severe("With " + args.length + " arguments:");
- for (String ar : args) {
+ for (String ar : args)
+ {
GroupManager.logger.severe(ar);
}
GroupManager.logger.severe("The field '" + cmd.getName() + "' was not found in enum.");
GroupManager.logger.severe("And could not be parsed.");
GroupManager.logger.severe("FIELDS FOUND IN ENUM:");
- for (GroupManagerPermissions val : GroupManagerPermissions.values()) {
+ for (GroupManagerPermissions val : GroupManagerPermissions.values())
+ {
GroupManager.logger.severe(val.name());
}
GroupManager.logger.severe("===================================================");
@@ -464,57 +533,73 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage("An error occurred. Ask the admin to take a look at the console.");
}
- if (isConsole || playerCanDo) {
- switch (execCmd) {
+ if (isConsole || playerCanDo)
+ {
+ switch (execCmd)
+ {
case manuadd:
// Validating arguments
- if ((args.length != 2) && (args.length != 3)) {
+ if ((args.length != 2) && (args.length != 3))
+ {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <group> | optional [world])");
return false;
}
// Select the relevant world (if specified)
- if (args.length == 3) {
+ if (args.length == 3)
+ {
dataHolder = worldsHolder.getWorldData(args[2]);
permissionHandler = dataHolder.getPermissionsHandler();
}
// Validating state of sender
- if (dataHolder == null || permissionHandler == null) {
+ if (dataHolder == null || permissionHandler == null)
+ {
if (!setDefaultWorldHandler(sender))
+ {
return true;
+ }
}
- if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {
+ if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null))
+ {
return false;
}
- if (match != null) {
+ if (match != null)
+ {
auxUser = dataHolder.getUser(match.get(0));
- } else {
+ }
+ else
+ {
auxUser = dataHolder.getUser(args[0]);
}
auxGroup = dataHolder.getGroup(args[1]);
- if (auxGroup == null) {
+ if (auxGroup == null)
+ {
sender.sendMessage(ChatColor.RED + "Group not found!");
return false;
}
- if (auxGroup.isGlobal()) {
+ if (auxGroup.isGlobal())
+ {
sender.sendMessage(ChatColor.RED + "Players may not be members of GlobalGroups directly.");
return false;
}
// Validating permissions
- if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
+ if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false))
+ {
sender.sendMessage(ChatColor.RED + "Can't modify a player with the same permissions as you, or higher.");
return false;
}
- if (!isConsole && !isOpOverride && (permissionHandler.hasGroupInInheritance(auxGroup, senderGroup.getName()))) {
+ if (!isConsole && !isOpOverride && (permissionHandler.hasGroupInInheritance(auxGroup, senderGroup.getName())))
+ {
sender.sendMessage(ChatColor.RED + "The destination group can't be the same as yours, or higher.");
return false;
}
- if (!isConsole && !isOpOverride && (!permissionHandler.inGroup(senderUser.getName(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getName(), auxGroup.getName()))) {
+ if (!isConsole && !isOpOverride && (!permissionHandler.inGroup(senderUser.getName(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getName(), auxGroup.getName())))
+ {
sender.sendMessage(ChatColor.RED + "You can't modify a player involving a group that you don't inherit.");
return false;
}
@@ -522,32 +607,43 @@ public class GroupManager extends JavaPlugin {
// Seems OK
auxUser.setGroup(auxGroup);
if (!sender.hasPermission("groupmanager.notify.other") || (isConsole))
+ {
sender.sendMessage(ChatColor.YELLOW + "You changed player '" + auxUser.getName() + "' group to '" + auxGroup.getName() + "' in world '" + dataHolder.getName() + "'.");
+ }
return true;
case manudel:
// Validating state of sender
- if (dataHolder == null || permissionHandler == null) {
+ if (dataHolder == null || permissionHandler == null)
+ {
if (!setDefaultWorldHandler(sender))
+ {
return true;
+ }
}
// Validating arguments
- if (args.length != 1) {
+ if (args.length != 1)
+ {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player>)");
return false;
}
- if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {
+ if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null))
+ {
return false;
}
- if (match != null) {
+ if (match != null)
+ {
auxUser = dataHolder.getUser(match.get(0));
- } else {
+ }
+ else
+ {
auxUser = dataHolder.getUser(args[0]);
}
// Validating permission
- if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
+ if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false))
+ {
sender.sendMessage(ChatColor.RED + "You can't modify a player with same permissions as you, or higher.");
return false;
}
@@ -558,79 +654,104 @@ public class GroupManager extends JavaPlugin {
// If the player is online, this will create new data for the user.
targetPlayer = this.getServer().getPlayer(auxUser.getName());
if (targetPlayer != null)
+ {
BukkitPermissions.updatePermissions(targetPlayer);
+ }
return true;
case manuaddsub:
// Validating state of sender
- if (dataHolder == null || permissionHandler == null) {
- if (!setDefaultWorldHandler(sender)) {
+ if (dataHolder == null || permissionHandler == null)
+ {
+ if (!setDefaultWorldHandler(sender))
+ {
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed.");
sender.sendMessage(ChatColor.RED + "Use /manselect <world>");
return true;
}
}
// Validating arguments
- if (args.length != 2) {
+ if (args.length != 2)
+ {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <group>)");
return false;
}
- if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {
+ if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null))
+ {
return false;
}
- if (match != null) {
+ if (match != null)
+ {
auxUser = dataHolder.getUser(match.get(0));
- } else {
+ }
+ else
+ {
auxUser = dataHolder.getUser(args[0]);
}
auxGroup = dataHolder.getGroup(args[1]);
- if (auxGroup == null) {
+ if (auxGroup == null)
+ {
sender.sendMessage(ChatColor.RED + "Group not found!");
return false;
}
// Validating permission
- if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
+ if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false))
+ {
sender.sendMessage(ChatColor.RED + "You can't modify a player with same permissions as you, or higher.");
return false;
}
// Seems OK
if (auxUser.addSubGroup(auxGroup))
+ {
sender.sendMessage(ChatColor.YELLOW + "You added subgroup '" + auxGroup.getName() + "' to player '" + auxUser.getName() + "'.");
+ }
else
+ {
sender.sendMessage(ChatColor.RED + "The subgroup '" + auxGroup.getName() + "' is already available to '" + auxUser.getName() + "'.");
+ }
return true;
case manudelsub:
// Validating state of sender
- if (dataHolder == null || permissionHandler == null) {
+ if (dataHolder == null || permissionHandler == null)
+ {
if (!setDefaultWorldHandler(sender))
+ {
return true;
+ }
}
// Validating arguments
- if (args.length != 2) {
+ if (args.length != 2)
+ {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manudelsub <user> <group>)");
return false;
}
- if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {
+ if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null))
+ {
return false;
}
- if (match != null) {
+ if (match != null)
+ {
auxUser = dataHolder.getUser(match.get(0));
- } else {
+ }
+ else
+ {
auxUser = dataHolder.getUser(args[0]);
}
auxGroup = dataHolder.getGroup(args[1]);
- if (auxGroup == null) {
+ if (auxGroup == null)
+ {
sender.sendMessage(ChatColor.RED + "Group not found!");
return false;
}
// Validating permission
- if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
+ if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false))
+ {
sender.sendMessage(ChatColor.RED + "You can't modify a player with same permissions as you, or higher.");
return false;
}
@@ -646,17 +767,22 @@ public class GroupManager extends JavaPlugin {
case mangadd:
// Validating state of sender
- if (dataHolder == null || permissionHandler == null) {
+ if (dataHolder == null || permissionHandler == null)
+ {
if (!setDefaultWorldHandler(sender))
+ {
return true;
+ }
}
// Validating arguments
- if (args.length != 1) {
+ if (args.length != 1)
+ {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group>)");
return false;
}
auxGroup = dataHolder.getGroup(args[0]);
- if (auxGroup != null) {
+ if (auxGroup != null)
+ {
sender.sendMessage(ChatColor.RED + "Group already exists!");
return false;
}
@@ -668,17 +794,22 @@ public class GroupManager extends JavaPlugin {
case mangdel:
// Validating state of sender
- if (dataHolder == null || permissionHandler == null) {
+ if (dataHolder == null || permissionHandler == null)
+ {
if (!setDefaultWorldHandler(sender))
+ {
return true;
+ }
}
// Validating arguments
- if (args.length != 1) {
+ if (args.length != 1)
+ {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group>)");
return false;
}
auxGroup = dataHolder.getGroup(args[0]);
- if (auxGroup == null) {
+ if (auxGroup == null)
+ {
sender.sendMessage(ChatColor.RED + "Group not exists!");
return false;
}
@@ -692,54 +823,74 @@ public class GroupManager extends JavaPlugin {
case manuaddp:
// Validating state of sender
- if (dataHolder == null || permissionHandler == null) {
+ if (dataHolder == null || permissionHandler == null)
+ {
if (!setDefaultWorldHandler(sender))
+ {
return true;
+ }
}
// Validating arguments
- if (args.length != 2) {
+ if (args.length != 2)
+ {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <permission>)");
return false;
}
- if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {
+ if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null))
+ {
return false;
}
- if (match != null) {
+ if (match != null)
+ {
auxUser = dataHolder.getUser(match.get(0));
- } else {
+ }
+ else
+ {
auxUser = dataHolder.getUser(args[0]);
}
// Validating your permissions
- if (!isConsole && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
+ if (!isConsole && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false))
+ {
sender.sendMessage(ChatColor.RED + "Can't modify player with same group than you, or higher.");
return false;
}
permissionResult = permissionHandler.checkFullUserPermission(senderUser, args[1]);
- if (!isConsole && !isOpOverride && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND) || permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))) {
+ if (!isConsole && !isOpOverride && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND) || permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION)))
+ {
sender.sendMessage(ChatColor.RED + "You can't add a permission you don't have.");
return false;
}
// Validating permissions of user
permissionResult = permissionHandler.checkUserOnlyPermission(auxUser, args[1]);
- if (args[1].startsWith("+")) {
- if (permissionResult.resultType.equals(PermissionCheckResult.Type.EXCEPTION)) {
+ if (args[1].startsWith("+"))
+ {
+ if (permissionResult.resultType.equals(PermissionCheckResult.Type.EXCEPTION))
+ {
sender.sendMessage(ChatColor.RED + "The user already has direct access to that permission.");
sender.sendMessage(ChatColor.RED + "Node: " + permissionResult.accessLevel);
return false;
}
- } else if (args[1].startsWith("-")) {
- if (permissionResult.resultType.equals(PermissionCheckResult.Type.EXCEPTION)) {
+ }
+ else if (args[1].startsWith("-"))
+ {
+ if (permissionResult.resultType.equals(PermissionCheckResult.Type.EXCEPTION))
+ {
sender.sendMessage(ChatColor.RED + "The user already has an exception for this node.");
sender.sendMessage(ChatColor.RED + "Node: " + permissionResult.accessLevel);
return false;
- } else if (permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION)) {
+ }
+ else if (permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))
+ {
sender.sendMessage(ChatColor.RED + "The user already has a matching node ");
sender.sendMessage(ChatColor.RED + "Node: " + permissionResult.accessLevel);
return false;
}
- } else {
- if (permissionResult.resultType.equals(PermissionCheckResult.Type.FOUND)) {
+ }
+ else
+ {
+ if (permissionResult.resultType.equals(PermissionCheckResult.Type.FOUND))
+ {
sender.sendMessage(ChatColor.RED + "The user already has direct access to that permission.");
sender.sendMessage(ChatColor.RED + "Node: " + permissionResult.accessLevel);
return false;
@@ -751,47 +902,61 @@ public class GroupManager extends JavaPlugin {
targetPlayer = this.getServer().getPlayer(auxUser.getName());
if (targetPlayer != null)
+ {
BukkitPermissions.updatePermissions(targetPlayer);
+ }
return true;
case manudelp:
// Validating state of sender
- if (dataHolder == null || permissionHandler == null) {
+ if (dataHolder == null || permissionHandler == null)
+ {
if (!setDefaultWorldHandler(sender))
+ {
return true;
+ }
}
// Validating arguments
- if (args.length != 2) {
+ if (args.length != 2)
+ {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <permission>)");
return false;
}
- if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {
+ if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null))
+ {
return false;
}
- if (match != null) {
+ if (match != null)
+ {
auxUser = dataHolder.getUser(match.get(0));
- } else {
+ }
+ else
+ {
auxUser = dataHolder.getUser(args[0]);
}
// Validating your permissions
- if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
+ if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false))
+ {
sender.sendMessage(ChatColor.RED + "You can't modify a player with same group as you, or higher.");
return false;
}
permissionResult = permissionHandler.checkFullUserPermission(senderUser, args[1]);
- if (!isConsole && !isOpOverride && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND) || permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))) {
+ if (!isConsole && !isOpOverride && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND) || permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION)))
+ {
sender.sendMessage(ChatColor.RED + "You can't remove a permission you don't have.");
return false;
}
// Validating permissions of user
permissionResult = permissionHandler.checkUserOnlyPermission(auxUser, args[1]);
- if (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND)) {
+ if (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND))
+ {
sender.sendMessage(ChatColor.RED + "The user doesn't have direct access to that permission.");
return false;
}
- if (!auxUser.hasSamePermissionNode(args[1])) {
+ if (!auxUser.hasSamePermissionNode(args[1]))
+ {
sender.sendMessage(ChatColor.RED + "This permission node doesn't match any node.");
sender.sendMessage(ChatColor.RED + "But might match node: " + permissionResult.accessLevel);
return false;
@@ -802,69 +967,91 @@ public class GroupManager extends JavaPlugin {
targetPlayer = this.getServer().getPlayer(auxUser.getName());
if (targetPlayer != null)
+ {
BukkitPermissions.updatePermissions(targetPlayer);
+ }
return true;
case manulistp:
// Validating state of sender
- if (dataHolder == null || permissionHandler == null) {
+ if (dataHolder == null || permissionHandler == null)
+ {
if (!setDefaultWorldHandler(sender))
+ {
return true;
+ }
}
// Validating arguments
- if ((args.length == 0) || (args.length > 2)) {
+ if ((args.length == 0) || (args.length > 2))
+ {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> (+))");
return false;
}
- if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {
+ if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null))
+ {
return false;
}
- if (match != null) {
+ if (match != null)
+ {
auxUser = dataHolder.getUser(match.get(0));
- } else {
+ }
+ else
+ {
auxUser = dataHolder.getUser(args[0]);
}
// Validating permission
// Seems OK
auxString = "";
- for (String perm : auxUser.getPermissionList()) {
+ for (String perm : auxUser.getPermissionList())
+ {
auxString += perm + ", ";
}
- if (auxString.lastIndexOf(",") > 0) {
+ if (auxString.lastIndexOf(",") > 0)
+ {
auxString = auxString.substring(0, auxString.lastIndexOf(","));
sender.sendMessage(ChatColor.YELLOW + "The player '" + auxUser.getName() + "' has following permissions: " + ChatColor.WHITE + auxString);
sender.sendMessage(ChatColor.YELLOW + "And all permissions from group: " + auxUser.getGroupName());
auxString = "";
- for (String subGroup : auxUser.subGroupListStringCopy()) {
+ for (String subGroup : auxUser.subGroupListStringCopy())
+ {
auxString += subGroup + ", ";
}
- if (auxString.lastIndexOf(",") > 0) {
+ if (auxString.lastIndexOf(",") > 0)
+ {
auxString = auxString.substring(0, auxString.lastIndexOf(","));
sender.sendMessage(ChatColor.YELLOW + "And all permissions from subgroups: " + auxString);
}
- } else {
+ }
+ else
+ {
sender.sendMessage(ChatColor.YELLOW + "The player '" + auxUser.getName() + "' has no specific permissions.");
sender.sendMessage(ChatColor.YELLOW + "Only all permissions from group: " + auxUser.getGroupName());
auxString = "";
- for (String subGroup : auxUser.subGroupListStringCopy()) {
+ for (String subGroup : auxUser.subGroupListStringCopy())
+ {
auxString += subGroup + ", ";
}
- if (auxString.lastIndexOf(",") > 0) {
+ if (auxString.lastIndexOf(",") > 0)
+ {
auxString = auxString.substring(0, auxString.lastIndexOf(","));
sender.sendMessage(ChatColor.YELLOW + "And all permissions from subgroups: " + auxString);
}
}
// bukkit perms
- if ((args.length == 2) && (args[1].equalsIgnoreCase("+"))) {
+ if ((args.length == 2) && (args[1].equalsIgnoreCase("+")))
+ {
targetPlayer = this.getServer().getPlayer(auxUser.getName());
- if (targetPlayer != null) {
+ if (targetPlayer != null)
+ {
sender.sendMessage(ChatColor.YELLOW + "Superperms reports: ");
for (String line : BukkitPermissions.listPerms(targetPlayer))
+ {
sender.sendMessage(ChatColor.YELLOW + line);
+ }
}
}
@@ -873,46 +1060,66 @@ public class GroupManager extends JavaPlugin {
case manucheckp:
// Validating state of sender
- if (dataHolder == null || permissionHandler == null) {
+ if (dataHolder == null || permissionHandler == null)
+ {
if (!setDefaultWorldHandler(sender))
+ {
return true;
+ }
}
// Validating arguments
- if (args.length != 2) {
+ if (args.length != 2)
+ {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <permission>)");
return false;
}
- if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {
+ if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null))
+ {
return false;
}
- if (match != null) {
+ if (match != null)
+ {
auxUser = dataHolder.getUser(match.get(0));
- } else {
+ }
+ else
+ {
auxUser = dataHolder.getUser(args[0]);
}
targetPlayer = this.getServer().getPlayer(auxUser.getName());
// Validating permission
permissionResult = permissionHandler.checkFullGMPermission(auxUser, args[1], false);
- if (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND)) {
+ if (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND))
+ {
// No permissions found in GM so fall through and check Bukkit.
sender.sendMessage(ChatColor.RED + "The player doesn't have access to that permission");
- } else {
+ }
+ else
+ {
// This permission was found in groupmanager.
- if (permissionResult.owner instanceof User) {
- if (permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION)) {
+ if (permissionResult.owner instanceof User)
+ {
+ if (permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))
+ {
sender.sendMessage(ChatColor.RED + "The user has directly a negation node for that permission.");
- } else {
+ }
+ else
+ {
sender.sendMessage(ChatColor.YELLOW + "The user has directly this permission.");
}
sender.sendMessage(ChatColor.YELLOW + "Permission Node: " + permissionResult.accessLevel);
- } else if (permissionResult.owner instanceof Group) {
- if (permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION)) {
+ }
+ else if (permissionResult.owner instanceof Group)
+ {
+ if (permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))
+ {
sender.sendMessage(ChatColor.RED + "The user inherits a negation permission from group: " + permissionResult.owner.getName());
- } else {
+ }
+ else
+ {
sender.sendMessage(ChatColor.YELLOW + "The user inherits the permission from group: " + permissionResult.owner.getName());
}
sender.sendMessage(ChatColor.YELLOW + "Permission Node: " + permissionResult.accessLevel);
@@ -920,54 +1127,71 @@ public class GroupManager extends JavaPlugin {
}
// superperms
- if (targetPlayer != null) {
- sender.sendMessage(ChatColor.YELLOW + "SuperPerms reports Node: " + targetPlayer.hasPermission(args[1]) + ((!targetPlayer.hasPermission(args[1]) && targetPlayer.isPermissionSet(args[1])) ? " (Negated)": ""));
+ if (targetPlayer != null)
+ {
+ sender.sendMessage(ChatColor.YELLOW + "SuperPerms reports Node: " + targetPlayer.hasPermission(args[1]) + ((!targetPlayer.hasPermission(args[1]) && targetPlayer.isPermissionSet(args[1])) ? " (Negated)" : ""));
}
return true;
case mangaddp:
// Validating state of sender
- if (dataHolder == null || permissionHandler == null) {
+ if (dataHolder == null || permissionHandler == null)
+ {
if (!setDefaultWorldHandler(sender))
+ {
return true;
+ }
}
// Validating arguments
- if (args.length != 2) {
+ if (args.length != 2)
+ {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group> <permission>)");
return false;
}
auxGroup = dataHolder.getGroup(args[0]);
- if (auxGroup == null) {
+ if (auxGroup == null)
+ {
sender.sendMessage(ChatColor.RED + "The specified group does not exist!");
return false;
}
// Validating your permissions
permissionResult = permissionHandler.checkFullUserPermission(senderUser, args[1]);
- if (!isConsole && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND) || permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))) {
+ if (!isConsole && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND) || permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION)))
+ {
sender.sendMessage(ChatColor.RED + "You can't add a permission you don't have.");
return false;
}
// Validating permissions of user
permissionResult = permissionHandler.checkGroupOnlyPermission(auxGroup, args[1]);
- if (args[1].startsWith("+")) {
- if (permissionResult.resultType.equals(PermissionCheckResult.Type.EXCEPTION)) {
+ if (args[1].startsWith("+"))
+ {
+ if (permissionResult.resultType.equals(PermissionCheckResult.Type.EXCEPTION))
+ {
sender.sendMessage(ChatColor.RED + "The group already has direct access to that permission.");
sender.sendMessage(ChatColor.RED + "Node: " + permissionResult.accessLevel);
return false;
}
- } else if (args[1].startsWith("-")) {
- if (permissionResult.resultType.equals(PermissionCheckResult.Type.EXCEPTION)) {
+ }
+ else if (args[1].startsWith("-"))
+ {
+ if (permissionResult.resultType.equals(PermissionCheckResult.Type.EXCEPTION))
+ {
sender.sendMessage(ChatColor.RED + "The group already has an exception for this node.");
sender.sendMessage(ChatColor.RED + "Node: " + permissionResult.accessLevel);
return false;
- } else if (permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION)) {
+ }
+ else if (permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))
+ {
sender.sendMessage(ChatColor.RED + "The group already has a matching node.");
sender.sendMessage(ChatColor.RED + "Node: " + permissionResult.accessLevel);
return false;
}
- } else {
- if (permissionResult.resultType.equals(PermissionCheckResult.Type.FOUND)) {
+ }
+ else
+ {
+ if (permissionResult.resultType.equals(PermissionCheckResult.Type.FOUND))
+ {
sender.sendMessage(ChatColor.RED + "The group already has direct access to that permission.");
sender.sendMessage(ChatColor.RED + "Node: " + permissionResult.accessLevel);
return false;
@@ -983,33 +1207,41 @@ public class GroupManager extends JavaPlugin {
case mangdelp:
// Validating state of sender
- if (dataHolder == null || permissionHandler == null) {
+ if (dataHolder == null || permissionHandler == null)
+ {
if (!setDefaultWorldHandler(sender))
+ {
return true;
+ }
}
// Validating arguments
- if (args.length != 2) {
+ if (args.length != 2)
+ {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group> <permission>)");
return false;
}
auxGroup = dataHolder.getGroup(args[0]);
- if (auxGroup == null) {
+ if (auxGroup == null)
+ {
sender.sendMessage(ChatColor.RED + "The specified group does not exist!");
return false;
}
// Validating your permissions
permissionResult = permissionHandler.checkFullUserPermission(senderUser, args[1]);
- if (!isConsole && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND) || permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))) {
+ if (!isConsole && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND) || permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION)))
+ {
sender.sendMessage(ChatColor.RED + "Can't remove a permission you don't have.");
return false;
}
// Validating permissions of user
permissionResult = permissionHandler.checkGroupOnlyPermission(auxGroup, args[1]);
- if (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND)) {
+ if (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND))
+ {
sender.sendMessage(ChatColor.RED + "The group doesn't have direct access to that permission.");
return false;
}
- if (!auxGroup.hasSamePermissionNode(args[1])) {
+ if (!auxGroup.hasSamePermissionNode(args[1]))
+ {
sender.sendMessage(ChatColor.RED + "This permission node doesn't match any node.");
sender.sendMessage(ChatColor.RED + "But might match node: " + permissionResult.accessLevel);
return false;
@@ -1024,17 +1256,22 @@ public class GroupManager extends JavaPlugin {
case manglistp:
// Validating state of sender
- if (dataHolder == null || permissionHandler == null) {
+ if (dataHolder == null || permissionHandler == null)
+ {
if (!setDefaultWorldHandler(sender))
+ {
return true;
+ }
}
// Validating arguments
- if (args.length != 1) {
+ if (args.length != 1)
+ {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group>)");
return false;
}
auxGroup = dataHolder.getGroup(args[0]);
- if (auxGroup == null) {
+ if (auxGroup == null)
+ {
sender.sendMessage(ChatColor.RED + "The specified group does not exist!");
return false;
}
@@ -1042,28 +1279,36 @@ public class GroupManager extends JavaPlugin {
// Seems OK
auxString = "";
- for (String perm : auxGroup.getPermissionList()) {
+ for (String perm : auxGroup.getPermissionList())
+ {
auxString += perm + ", ";
}
- if (auxString.lastIndexOf(",") > 0) {
+ if (auxString.lastIndexOf(",") > 0)
+ {
auxString = auxString.substring(0, auxString.lastIndexOf(","));
sender.sendMessage(ChatColor.YELLOW + "The group '" + auxGroup.getName() + "' has following permissions: " + ChatColor.WHITE + auxString);
auxString = "";
- for (String grp : auxGroup.getInherits()) {
+ for (String grp : auxGroup.getInherits())
+ {
auxString += grp + ", ";
}
- if (auxString.lastIndexOf(",") > 0) {
+ if (auxString.lastIndexOf(",") > 0)
+ {
auxString = auxString.substring(0, auxString.lastIndexOf(","));
sender.sendMessage(ChatColor.YELLOW + "And all permissions from groups: " + auxString);
}
- } else {
+ }
+ else
+ {
sender.sendMessage(ChatColor.YELLOW + "The group '" + auxGroup.getName() + "' has no specific permissions.");
auxString = "";
- for (String grp : auxGroup.getInherits()) {
+ for (String grp : auxGroup.getInherits())
+ {
auxString += grp + ", ";
}
- if (auxString.lastIndexOf(",") > 0) {
+ if (auxString.lastIndexOf(",") > 0)
+ {
auxString = auxString.substring(0, auxString.lastIndexOf(","));
sender.sendMessage(ChatColor.YELLOW + "Only all permissions from groups: " + auxString);
}
@@ -1073,32 +1318,42 @@ public class GroupManager extends JavaPlugin {
case mangcheckp:
// Validating state of sender
- if (dataHolder == null || permissionHandler == null) {
+ if (dataHolder == null || permissionHandler == null)
+ {
if (!setDefaultWorldHandler(sender))
+ {
return true;
+ }
}
// Validating arguments
- if (args.length != 2) {
+ if (args.length != 2)
+ {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group> <permission>)");
return false;
}
auxGroup = dataHolder.getGroup(args[0]);
- if (auxGroup == null) {
+ if (auxGroup == null)
+ {
sender.sendMessage(ChatColor.RED + "The specified group does not exist!");
return false;
}
// Validating permission
permissionResult = permissionHandler.checkGroupPermissionWithInheritance(auxGroup, args[1]);
- if (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND)) {
+ if (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND))
+ {
sender.sendMessage(ChatColor.RED + "The group doesn't have access to that permission");
return false;
}
// Seems OK
// auxString = permissionHandler.checkUserOnlyPermission(auxUser, args[1]);
- if (permissionResult.owner instanceof Group) {
- if (permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION)) {
+ if (permissionResult.owner instanceof Group)
+ {
+ if (permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))
+ {
sender.sendMessage(ChatColor.RED + "The group inherits the a negation permission from group: " + permissionResult.owner.getName());
- } else {
+ }
+ else
+ {
sender.sendMessage(ChatColor.YELLOW + "The user inherits the permission from group: " + permissionResult.owner.getName());
}
sender.sendMessage(ChatColor.YELLOW + "Permission Node: " + permissionResult.accessLevel);
@@ -1108,32 +1363,40 @@ public class GroupManager extends JavaPlugin {
case mangaddi:
// Validating state of sender
- if (dataHolder == null || permissionHandler == null) {
+ if (dataHolder == null || permissionHandler == null)
+ {
if (!setDefaultWorldHandler(sender))
+ {
return true;
+ }
}
// Validating arguments
- if (args.length != 2) {
+ if (args.length != 2)
+ {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group1> <group2>)");
return false;
}
auxGroup = dataHolder.getGroup(args[0]);
- if (auxGroup == null) {
+ if (auxGroup == null)
+ {
sender.sendMessage(ChatColor.RED + "Group 1 does not exist!");
return false;
}
auxGroup2 = dataHolder.getGroup(args[1]);
- if (auxGroup2 == null) {
+ if (auxGroup2 == null)
+ {
sender.sendMessage(ChatColor.RED + "Group 2 does not exist!");
return false;
}
- if (auxGroup.isGlobal()) {
+ if (auxGroup.isGlobal())
+ {
sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support inheritance.");
return false;
}
// Validating permission
- if (permissionHandler.hasGroupInInheritance(auxGroup, auxGroup2.getName())) {
+ if (permissionHandler.hasGroupInInheritance(auxGroup, auxGroup2.getName()))
+ {
sender.sendMessage(ChatColor.RED + "Group " + auxGroup.getName() + " already inherits " + auxGroup2.getName() + " (might not be directly)");
return false;
}
@@ -1147,36 +1410,45 @@ public class GroupManager extends JavaPlugin {
case mangdeli:
// Validating state of sender
- if (dataHolder == null || permissionHandler == null) {
+ if (dataHolder == null || permissionHandler == null)
+ {
if (!setDefaultWorldHandler(sender))
+ {
return true;
+ }
}
// Validating arguments
- if (args.length != 2) {
+ if (args.length != 2)
+ {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group1> <group2>)");
return false;
}
auxGroup = dataHolder.getGroup(args[0]);
- if (auxGroup == null) {
+ if (auxGroup == null)
+ {
sender.sendMessage(ChatColor.RED + "Group 1 does not exist!");
return false;
}
auxGroup2 = dataHolder.getGroup(args[1]);
- if (auxGroup2 == null) {
+ if (auxGroup2 == null)
+ {
sender.sendMessage(ChatColor.RED + "Group 2 does not exist!");
return false;
}
- if (auxGroup.isGlobal()) {
+ if (auxGroup.isGlobal())
+ {
sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support inheritance.");
return false;
}
// Validating permission
- if (!permissionHandler.hasGroupInInheritance(auxGroup, auxGroup2.getName())) {
+ if (!permissionHandler.hasGroupInInheritance(auxGroup, auxGroup2.getName()))
+ {
sender.sendMessage(ChatColor.RED + "Group " + auxGroup.getName() + " does not inherits " + auxGroup2.getName() + ".");
return false;
}
- if (!auxGroup.getInherits().contains(auxGroup2.getName())) {
+ if (!auxGroup.getInherits().contains(auxGroup2.getName()))
+ {
sender.sendMessage(ChatColor.RED + "Group " + auxGroup.getName() + " does not inherits " + auxGroup2.getName() + " directly.");
return false;
}
@@ -1190,30 +1462,40 @@ public class GroupManager extends JavaPlugin {
case manuaddv:
// Validating state of sender
- if (dataHolder == null || permissionHandler == null) {
+ if (dataHolder == null || permissionHandler == null)
+ {
if (!setDefaultWorldHandler(sender))
+ {
return true;
+ }
}
// Validating arguments
- if (args.length < 3) {
+ if (args.length < 3)
+ {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <user> <variable> <value>)");
return false;
}
- if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {
+ if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null))
+ {
return false;
}
- if (match != null) {
+ if (match != null)
+ {
auxUser = dataHolder.getUser(match.get(0));
- } else {
+ }
+ else
+ {
auxUser = dataHolder.getUser(args[0]);
}
// Validating permission
// Seems OK
auxString = "";
- for (int i = 2; i < args.length; i++) {
+ for (int i = 2; i < args.length; i++)
+ {
auxString += args[i];
- if ((i + 1) < args.length) {
+ if ((i + 1) < args.length)
+ {
auxString += " ";
}
}
@@ -1224,26 +1506,35 @@ public class GroupManager extends JavaPlugin {
case manudelv:
// Validating state of sender
- if (dataHolder == null || permissionHandler == null) {
+ if (dataHolder == null || permissionHandler == null)
+ {
if (!setDefaultWorldHandler(sender))
+ {
return true;
+ }
}
// Validating arguments
- if (args.length != 2) {
+ if (args.length != 2)
+ {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <user> <variable>)");
return false;
}
- if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {
+ if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null))
+ {
return false;
}
- if (match != null) {
+ if (match != null)
+ {
auxUser = dataHolder.getUser(match.get(0));
- } else {
+ }
+ else
+ {
auxUser = dataHolder.getUser(args[0]);
}
// Validating permission
- if (!auxUser.getVariables().hasVar(args[1])) {
+ if (!auxUser.getVariables().hasVar(args[1]))
+ {
sender.sendMessage(ChatColor.RED + "The user doesn't have directly that variable!");
}
// Seems OK
@@ -1254,31 +1545,41 @@ public class GroupManager extends JavaPlugin {
case manulistv:
// Validating state of sender
- if (dataHolder == null || permissionHandler == null) {
+ if (dataHolder == null || permissionHandler == null)
+ {
if (!setDefaultWorldHandler(sender))
+ {
return true;
+ }
}
// Validating arguments
- if (args.length != 1) {
+ if (args.length != 1)
+ {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <user>)");
return false;
}
- if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {
+ if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null))
+ {
return false;
}
- if (match != null) {
+ if (match != null)
+ {
auxUser = dataHolder.getUser(match.get(0));
- } else {
+ }
+ else
+ {
auxUser = dataHolder.getUser(args[0]);
}
// Validating permission
// Seems OK
auxString = "";
- for (String varKey : auxUser.getVariables().getVarKeyList()) {
+ for (String varKey : auxUser.getVariables().getVarKeyList())
+ {
Object o = auxUser.getVariables().getVarObject(varKey);
auxString += ChatColor.GOLD + varKey + ChatColor.WHITE + ":'" + ChatColor.GREEN + o.toString() + ChatColor.WHITE + "', ";
}
- if (auxString.lastIndexOf(",") > 0) {
+ if (auxString.lastIndexOf(",") > 0)
+ {
auxString = auxString.substring(0, auxString.lastIndexOf(","));
}
sender.sendMessage(ChatColor.YELLOW + "Variables of user " + auxUser.getName() + ": ");
@@ -1289,47 +1590,64 @@ public class GroupManager extends JavaPlugin {
case manucheckv:
// Validating state of sender
- if (dataHolder == null || permissionHandler == null) {
+ if (dataHolder == null || permissionHandler == null)
+ {
if (!setDefaultWorldHandler(sender))
+ {
return true;
+ }
}
// Validating arguments
- if (args.length != 2) {
+ if (args.length != 2)
+ {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <user> <variable>)");
return false;
}
- if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {
+ if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null))
+ {
return false;
}
- if (match != null) {
+ if (match != null)
+ {
auxUser = dataHolder.getUser(match.get(0));
- } else {
+ }
+ else
+ {
auxUser = dataHolder.getUser(args[0]);
}
// Validating permission
auxGroup = auxUser.getGroup();
auxGroup2 = permissionHandler.nextGroupWithVariable(auxGroup, args[1]);
- if (!auxUser.getVariables().hasVar(args[1])) {
+ if (!auxUser.getVariables().hasVar(args[1]))
+ {
// Check sub groups
if (!auxUser.isSubGroupsEmpty() && auxGroup2 == null)
- for (Group subGroup : auxUser.subGroupListCopy()) {
+ {
+ for (Group subGroup : auxUser.subGroupListCopy())
+ {
auxGroup2 = permissionHandler.nextGroupWithVariable(subGroup, args[1]);
if (auxGroup2 != null)
+ {
continue;
+ }
}
- if (auxGroup2 == null) {
+ }
+ if (auxGroup2 == null)
+ {
sender.sendMessage(ChatColor.RED + "The user doesn't have access to that variable!");
return false;
}
}
// Seems OK
- if (auxUser.getVariables().hasVar(auxString)) {
+ if (auxUser.getVariables().hasVar(auxString))
+ {
sender.sendMessage(ChatColor.YELLOW + "The value of variable '" + ChatColor.GOLD + args[1] + ChatColor.YELLOW + "' is: '" + ChatColor.GREEN + auxUser.getVariables().getVarObject(args[1]).toString() + ChatColor.WHITE + "'");
sender.sendMessage(ChatColor.YELLOW + "This user own directly the variable");
}
sender.sendMessage(ChatColor.YELLOW + "The value of variable '" + ChatColor.GOLD + args[1] + ChatColor.YELLOW + "' is: '" + ChatColor.GREEN + auxGroup2.getVariables().getVarObject(args[1]).toString() + ChatColor.WHITE + "'");
- if (!auxGroup.equals(auxGroup2)) {
+ if (!auxGroup.equals(auxGroup2))
+ {
sender.sendMessage(ChatColor.YELLOW + "And the value was inherited from group: " + ChatColor.GREEN + auxGroup2.getName());
}
@@ -1337,30 +1655,38 @@ public class GroupManager extends JavaPlugin {
case mangaddv:
// Validating state of sender
- if (dataHolder == null || permissionHandler == null) {
+ if (dataHolder == null || permissionHandler == null)
+ {
if (!setDefaultWorldHandler(sender))
+ {
return true;
+ }
}
// Validating arguments
- if (args.length < 3) {
+ if (args.length < 3)
+ {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group> <variable> <value>)");
return false;
}
auxGroup = dataHolder.getGroup(args[0]);
- if (auxGroup == null) {
+ if (auxGroup == null)
+ {
sender.sendMessage(ChatColor.RED + "The specified group does not exist!");
return false;
}
- if (auxGroup.isGlobal()) {
+ if (auxGroup.isGlobal())
+ {
sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support Info Nodes.");
return false;
}
// Validating permission
// Seems OK
auxString = "";
- for (int i = 2; i < args.length; i++) {
+ for (int i = 2; i < args.length; i++)
+ {
auxString += args[i];
- if ((i + 1) < args.length) {
+ if ((i + 1) < args.length)
+ {
auxString += " ";
}
}
@@ -1371,26 +1697,33 @@ public class GroupManager extends JavaPlugin {
case mangdelv:
// Validating state of sender
- if (dataHolder == null || permissionHandler == null) {
+ if (dataHolder == null || permissionHandler == null)
+ {
if (!setDefaultWorldHandler(sender))
+ {
return true;
+ }
}
// Validating arguments
- if (args.length != 2) {
+ if (args.length != 2)
+ {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group> <variable>)");
return false;
}
auxGroup = dataHolder.getGroup(args[0]);
- if (auxGroup == null) {
+ if (auxGroup == null)
+ {
sender.sendMessage(ChatColor.RED + "The specified group does not exist!");
return false;
}
- if (auxGroup.isGlobal()) {
+ if (auxGroup.isGlobal())
+ {
sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support Info Nodes.");
return false;
}
// Validating permission
- if (!auxGroup.getVariables().hasVar(args[1])) {
+ if (!auxGroup.getVariables().hasVar(args[1]))
+ {
sender.sendMessage(ChatColor.RED + "The group doesn't have directly that variable!");
}
// Seems OK
@@ -1401,41 +1734,51 @@ public class GroupManager extends JavaPlugin {
case manglistv:
// Validating state of sender
- if (dataHolder == null || permissionHandler == null) {
+ if (dataHolder == null || permissionHandler == null)
+ {
if (!setDefaultWorldHandler(sender))
+ {
return true;
+ }
}
// Validating arguments
- if (args.length != 1) {
+ if (args.length != 1)
+ {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group>)");
return false;
}
auxGroup = dataHolder.getGroup(args[0]);
- if (auxGroup == null) {
+ if (auxGroup == null)
+ {
sender.sendMessage(ChatColor.RED + "The specified group does not exist!");
return false;
}
- if (auxGroup.isGlobal()) {
+ if (auxGroup.isGlobal())
+ {
sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support Info Nodes.");
return false;
}
// Validating permission
// Seems OK
auxString = "";
- for (String varKey : auxGroup.getVariables().getVarKeyList()) {
+ for (String varKey : auxGroup.getVariables().getVarKeyList())
+ {
Object o = auxGroup.getVariables().getVarObject(varKey);
auxString += ChatColor.GOLD + varKey + ChatColor.WHITE + ":'" + ChatColor.GREEN + o.toString() + ChatColor.WHITE + "', ";
}
- if (auxString.lastIndexOf(",") > 0) {
+ if (auxString.lastIndexOf(",") > 0)
+ {
auxString = auxString.substring(0, auxString.lastIndexOf(","));
}
sender.sendMessage(ChatColor.YELLOW + "Variables of group " + auxGroup.getName() + ": ");
sender.sendMessage(auxString + ".");
auxString = "";
- for (String grp : auxGroup.getInherits()) {
+ for (String grp : auxGroup.getInherits())
+ {
auxString += grp + ", ";
}
- if (auxString.lastIndexOf(",") > 0) {
+ if (auxString.lastIndexOf(",") > 0)
+ {
auxString = auxString.substring(0, auxString.lastIndexOf(","));
sender.sendMessage(ChatColor.YELLOW + "Plus all variables from groups: " + auxString);
}
@@ -1444,32 +1787,40 @@ public class GroupManager extends JavaPlugin {
case mangcheckv:
// Validating state of sender
- if (dataHolder == null || permissionHandler == null) {
+ if (dataHolder == null || permissionHandler == null)
+ {
if (!setDefaultWorldHandler(sender))
+ {
return true;
+ }
}
// Validating arguments
- if (args.length != 2) {
+ if (args.length != 2)
+ {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group> <variable>)");
return false;
}
auxGroup = dataHolder.getGroup(args[0]);
- if (auxGroup == null) {
+ if (auxGroup == null)
+ {
sender.sendMessage(ChatColor.RED + "The specified group does not exist!");
return false;
}
- if (auxGroup.isGlobal()) {
+ if (auxGroup.isGlobal())
+ {
sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support Info Nodes.");
return false;
}
// Validating permission
auxGroup2 = permissionHandler.nextGroupWithVariable(auxGroup, args[1]);
- if (auxGroup2 == null) {
+ if (auxGroup2 == null)
+ {
sender.sendMessage(ChatColor.RED + "The group doesn't have access to that variable!");
}
// Seems OK
sender.sendMessage(ChatColor.YELLOW + "The value of variable '" + ChatColor.GOLD + args[1] + ChatColor.YELLOW + "' is: '" + ChatColor.GREEN + auxGroup2.getVariables().getVarObject(args[1]).toString() + ChatColor.WHITE + "'");
- if (!auxGroup.equals(auxGroup2)) {
+ if (!auxGroup.equals(auxGroup2))
+ {
sender.sendMessage(ChatColor.YELLOW + "And the value was inherited from group: " + ChatColor.GREEN + auxGroup2.getName());
}
@@ -1477,21 +1828,29 @@ public class GroupManager extends JavaPlugin {
case manwhois:
// Validating state of sender
- if (dataHolder == null || permissionHandler == null) {
+ if (dataHolder == null || permissionHandler == null)
+ {
if (!setDefaultWorldHandler(sender))
+ {
return true;
+ }
}
// Validating arguments
- if (args.length != 1) {
+ if (args.length != 1)
+ {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player>)");
return false;
}
- if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {
+ if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null))
+ {
return false;
}
- if (match != null) {
+ if (match != null)
+ {
auxUser = dataHolder.getUser(match.get(0));
- } else {
+ }
+ else
+ {
auxUser = dataHolder.getUser(args[0]);
}
// Seems OK
@@ -1499,17 +1858,20 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.YELLOW + "Group: " + ChatColor.GREEN + auxUser.getGroup().getName());
// Compile a list of subgroups
auxString = "";
- for (String subGroup : auxUser.subGroupListStringCopy()) {
+ for (String subGroup : auxUser.subGroupListStringCopy())
+ {
auxString += subGroup + ", ";
}
- if (auxString.lastIndexOf(",") > 0) {
+ if (auxString.lastIndexOf(",") > 0)
+ {
auxString = auxString.substring(0, auxString.lastIndexOf(","));
sender.sendMessage(ChatColor.YELLOW + "subgroups: " + auxString);
}
sender.sendMessage(ChatColor.YELLOW + "Overloaded: " + ChatColor.GREEN + dataHolder.isOverloaded(auxUser.getName()));
auxGroup = dataHolder.surpassOverload(auxUser.getName()).getGroup();
- if (!auxGroup.equals(auxUser.getGroup())) {
+ if (!auxGroup.equals(auxUser.getGroup()))
+ {
sender.sendMessage(ChatColor.YELLOW + "Original Group: " + ChatColor.GREEN + auxGroup.getName());
}
// victim.permissions.add(args[1]);
@@ -1517,30 +1879,40 @@ public class GroupManager extends JavaPlugin {
case tempadd:
// Validating state of sender
- if (dataHolder == null || permissionHandler == null) {
+ if (dataHolder == null || permissionHandler == null)
+ {
if (!setDefaultWorldHandler(sender))
+ {
return true;
+ }
}
// Validating arguments
- if (args.length != 1) {
+ if (args.length != 1)
+ {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player>)");
return false;
}
- if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {
+ if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null))
+ {
return false;
}
- if (match != null) {
+ if (match != null)
+ {
auxUser = dataHolder.getUser(match.get(0));
- } else {
+ }
+ else
+ {
auxUser = dataHolder.getUser(args[0]);
}
// Validating permission
- if (!isConsole && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
+ if (!isConsole && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false))
+ {
sender.sendMessage(ChatColor.RED + "Can't modify player with same permissions than you, or higher.");
return false;
}
// Seems OK
- if (overloadedUsers.get(dataHolder.getName().toLowerCase()) == null) {
+ if (overloadedUsers.get(dataHolder.getName().toLowerCase()) == null)
+ {
overloadedUsers.put(dataHolder.getName().toLowerCase(), new ArrayList<User>());
}
dataHolder.overloadUser(auxUser.getName());
@@ -1551,34 +1923,45 @@ public class GroupManager extends JavaPlugin {
case tempdel:
// Validating state of sender
- if (dataHolder == null || permissionHandler == null) {
+ if (dataHolder == null || permissionHandler == null)
+ {
if (!setDefaultWorldHandler(sender))
+ {
return true;
+ }
}
// Validating arguments
- if (args.length != 1) {
+ if (args.length != 1)
+ {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player>)");
return false;
}
- if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {
+ if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null))
+ {
return false;
}
- if (match != null) {
+ if (match != null)
+ {
auxUser = dataHolder.getUser(match.get(0));
- } else {
+ }
+ else
+ {
auxUser = dataHolder.getUser(args[0]);
}
// Validating permission
- if (!isConsole && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
+ if (!isConsole && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false))
+ {
sender.sendMessage(ChatColor.RED + "You can't modify a player with same permissions as you, or higher.");
return false;
}
// Seems OK
- if (overloadedUsers.get(dataHolder.getName().toLowerCase()) == null) {
+ if (overloadedUsers.get(dataHolder.getName().toLowerCase()) == null)
+ {
overloadedUsers.put(dataHolder.getName().toLowerCase(), new ArrayList<User>());
}
dataHolder.removeOverload(auxUser.getName());
- if (overloadedUsers.get(dataHolder.getName().toLowerCase()).contains(auxUser)) {
+ if (overloadedUsers.get(dataHolder.getName().toLowerCase()).contains(auxUser))
+ {
overloadedUsers.get(dataHolder.getName().toLowerCase()).remove(auxUser);
}
sender.sendMessage(ChatColor.YELLOW + "You removed that player's overload. He's back to normal!");
@@ -1587,28 +1970,37 @@ public class GroupManager extends JavaPlugin {
case templist:
// Validating state of sender
- if (dataHolder == null || permissionHandler == null) {
+ if (dataHolder == null || permissionHandler == null)
+ {
if (!setDefaultWorldHandler(sender))
+ {
return true;
+ }
}
// WORKING
auxString = "";
removeList = new ArrayList<User>();
count = 0;
- for (User u : overloadedUsers.get(dataHolder.getName().toLowerCase())) {
- if (!dataHolder.isOverloaded(u.getName())) {
+ for (User u : overloadedUsers.get(dataHolder.getName().toLowerCase()))
+ {
+ if (!dataHolder.isOverloaded(u.getName()))
+ {
removeList.add(u);
- } else {
+ }
+ else
+ {
auxString += u.getName() + ", ";
count++;
}
}
- if (count == 0) {
+ if (count == 0)
+ {
sender.sendMessage(ChatColor.YELLOW + "There are no users in overload mode.");
return true;
}
auxString = auxString.substring(0, auxString.lastIndexOf(","));
- if (overloadedUsers.get(dataHolder.getName().toLowerCase()) == null) {
+ if (overloadedUsers.get(dataHolder.getName().toLowerCase()) == null)
+ {
overloadedUsers.put(dataHolder.getName().toLowerCase(), new ArrayList<User>());
}
overloadedUsers.get(dataHolder.getName().toLowerCase()).removeAll(removeList);
@@ -1618,24 +2010,31 @@ public class GroupManager extends JavaPlugin {
case tempdelall:
// Validating state of sender
- if (dataHolder == null || permissionHandler == null) {
+ if (dataHolder == null || permissionHandler == null)
+ {
if (!setDefaultWorldHandler(sender))
+ {
return true;
+ }
}
// WORKING
removeList = new ArrayList<User>();
count = 0;
- for (User u : overloadedUsers.get(dataHolder.getName().toLowerCase())) {
- if (dataHolder.isOverloaded(u.getName())) {
+ for (User u : overloadedUsers.get(dataHolder.getName().toLowerCase()))
+ {
+ if (dataHolder.isOverloaded(u.getName()))
+ {
dataHolder.removeOverload(u.getName());
count++;
}
}
- if (count == 0) {
+ if (count == 0)
+ {
sender.sendMessage(ChatColor.YELLOW + "There are no users in overload mode.");
return true;
}
- if (overloadedUsers.get(dataHolder.getName().toLowerCase()) == null) {
+ if (overloadedUsers.get(dataHolder.getName().toLowerCase()) == null)
+ {
overloadedUsers.put(dataHolder.getName().toLowerCase(), new ArrayList<User>());
}
overloadedUsers.get(dataHolder.getName().toLowerCase()).clear();
@@ -1648,12 +2047,17 @@ public class GroupManager extends JavaPlugin {
boolean forced = false;
if ((args.length == 1) && (args[0].equalsIgnoreCase("force")))
+ {
forced = true;
+ }
- try {
+ try
+ {
worldsHolder.saveChanges(forced);
sender.sendMessage(ChatColor.YELLOW + " All changes were saved.");
- } catch (IllegalStateException ex) {
+ }
+ catch (IllegalStateException ex)
+ {
sender.sendMessage(ChatColor.RED + ex.getMessage());
}
return true;
@@ -1663,17 +2067,21 @@ public class GroupManager extends JavaPlugin {
/**
* Attempt to reload a specific world
*/
- if (args.length > 0) {
+ if (args.length > 0)
+ {
- if (!lastError.isEmpty()) {
+ if (!lastError.isEmpty())
+ {
sender.sendMessage(ChatColor.RED + "All commands are locked due to an error. Check the log and then try a '/manload'.)");
return true;
}
auxString = "";
- for (int i = 0; i < args.length; i++) {
+ for (int i = 0; i < args.length; i++)
+ {
auxString += args[i];
- if ((i + 1) < args.length) {
+ if ((i + 1) < args.length)
+ {
auxString += " ";
}
}
@@ -1689,7 +2097,9 @@ public class GroupManager extends JavaPlugin {
BukkitPermissions.updateAllPlayers();
- } else {
+ }
+ else
+ {
/**
* Reload all settings and data as no world was specified.
@@ -1708,25 +2118,33 @@ public class GroupManager extends JavaPlugin {
* Fire an event as none will have been triggered in the reload.
*/
if (GroupManager.isLoaded())
+ {
GroupManagerEventHandler.callEvent(GMSystemEvent.Action.RELOADED);
+ }
return true;
case listgroups:
// Validating state of sender
- if (dataHolder == null || permissionHandler == null) {
+ if (dataHolder == null || permissionHandler == null)
+ {
if (!setDefaultWorldHandler(sender))
+ {
return true;
+ }
}
// WORKING
auxString = "";
- for (Group g : dataHolder.getGroupList()) {
+ for (Group g : dataHolder.getGroupList())
+ {
auxString += g.getName() + ", ";
}
- for (Group g : getGlobalGroups().getGroupList()) {
+ for (Group g : getGlobalGroups().getGroupList())
+ {
auxString += g.getName() + ", ";
}
- if (auxString.lastIndexOf(",") > 0) {
+ if (auxString.lastIndexOf(",") > 0)
+ {
auxString = auxString.substring(0, auxString.lastIndexOf(","));
}
sender.sendMessage(ChatColor.YELLOW + " Groups Available: " + ChatColor.WHITE + auxString);
@@ -1735,141 +2153,185 @@ public class GroupManager extends JavaPlugin {
case manpromote:
// Validating state of sender
- if (dataHolder == null || permissionHandler == null) {
+ if (dataHolder == null || permissionHandler == null)
+ {
if (!setDefaultWorldHandler(sender))
+ {
return true;
+ }
}
// Validating arguments
- if (args.length != 2) {
+ if (args.length != 2)
+ {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <group>)");
return false;
}
- if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {
+ if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null))
+ {
return false;
}
- if (match != null) {
+ if (match != null)
+ {
auxUser = dataHolder.getUser(match.get(0));
- } else {
+ }
+ else
+ {
auxUser = dataHolder.getUser(args[0]);
}
auxGroup = dataHolder.getGroup(args[1]);
- if (auxGroup == null) {
+ if (auxGroup == null)
+ {
sender.sendMessage(ChatColor.RED + "Group not found!");
return false;
}
- if (auxGroup.isGlobal()) {
+ if (auxGroup.isGlobal())
+ {
sender.sendMessage(ChatColor.RED + "Players may not be members of GlobalGroups directly.");
return false;
}
// Validating permission
- if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
+ if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false))
+ {
sender.sendMessage(ChatColor.RED + "You can't modify a player with same permissions as you, or higher.");
return false;
}
- if (!isConsole && !isOpOverride && (permissionHandler.hasGroupInInheritance(auxGroup, senderGroup.getName()))) {
+ if (!isConsole && !isOpOverride && (permissionHandler.hasGroupInInheritance(auxGroup, senderGroup.getName())))
+ {
sender.sendMessage(ChatColor.RED + "The destination group can't be the same as yours, or higher.");
return false;
}
- if (!isConsole && !isOpOverride && (!permissionHandler.inGroup(senderUser.getName(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getName(), auxGroup.getName()))) {
+ if (!isConsole && !isOpOverride && (!permissionHandler.inGroup(senderUser.getName(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getName(), auxGroup.getName())))
+ {
sender.sendMessage(ChatColor.RED + "You can't modify a player involving a group that you don't inherit.");
return false;
}
- if (!isConsole && !isOpOverride && (!permissionHandler.hasGroupInInheritance(auxUser.getGroup(), auxGroup.getName()) && !permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName()))) {
+ if (!isConsole && !isOpOverride && (!permissionHandler.hasGroupInInheritance(auxUser.getGroup(), auxGroup.getName()) && !permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName())))
+ {
sender.sendMessage(ChatColor.RED + "You can't modify a player using groups with different heritage line.");
return false;
}
- if (!isConsole && !isOpOverride && (!permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName()))) {
+ if (!isConsole && !isOpOverride && (!permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName())))
+ {
sender.sendMessage(ChatColor.RED + "The new group must be a higher rank.");
return false;
}
// Seems OK
auxUser.setGroup(auxGroup);
if (!sender.hasPermission("groupmanager.notify.other") || (isConsole))
+ {
sender.sendMessage(ChatColor.YELLOW + "You changed " + auxUser.getName() + " group to " + auxGroup.getName() + ".");
+ }
return true;
case mandemote:
// Validating state of sender
- if (dataHolder == null || permissionHandler == null) {
+ if (dataHolder == null || permissionHandler == null)
+ {
if (!setDefaultWorldHandler(sender))
+ {
return true;
+ }
}
// Validating arguments
- if (args.length != 2) {
+ if (args.length != 2)
+ {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <group>)");
return false;
}
- if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {
+ if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null))
+ {
return false;
}
- if (match != null) {
+ if (match != null)
+ {
auxUser = dataHolder.getUser(match.get(0));
- } else {
+ }
+ else
+ {
auxUser = dataHolder.getUser(args[0]);
}
auxGroup = dataHolder.getGroup(args[1]);
- if (auxGroup == null) {
+ if (auxGroup == null)
+ {
sender.sendMessage(ChatColor.RED + "Group not found!");
return false;
}
- if (auxGroup.isGlobal()) {
+ if (auxGroup.isGlobal())
+ {
sender.sendMessage(ChatColor.RED + "Players may not be members of GlobalGroups directly.");
return false;
}
// Validating permission
- if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
+ if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false))
+ {
sender.sendMessage(ChatColor.RED + "You can't modify a player with same permissions as you, or higher.");
return false;
}
- if (!isConsole && !isOpOverride && (permissionHandler.hasGroupInInheritance(auxGroup, senderGroup.getName()))) {
+ if (!isConsole && !isOpOverride && (permissionHandler.hasGroupInInheritance(auxGroup, senderGroup.getName())))
+ {
sender.sendMessage(ChatColor.RED + "The destination group can't be the same as yours, or higher.");
return false;
}
- if (!isConsole && !isOpOverride && (!permissionHandler.inGroup(senderUser.getName(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getName(), auxGroup.getName()))) {
+ if (!isConsole && !isOpOverride && (!permissionHandler.inGroup(senderUser.getName(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getName(), auxGroup.getName())))
+ {
sender.sendMessage(ChatColor.RED + "You can't modify a player involving a group that you don't inherit.");
return false;
}
- if (!isConsole && !isOpOverride && (!permissionHandler.hasGroupInInheritance(auxUser.getGroup(), auxGroup.getName()) && !permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName()))) {
+ if (!isConsole && !isOpOverride && (!permissionHandler.hasGroupInInheritance(auxUser.getGroup(), auxGroup.getName()) && !permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName())))
+ {
sender.sendMessage(ChatColor.RED + "You can't modify a player using groups with different heritage line.");
return false;
}
- if (!isConsole && !isOpOverride && (permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName()))) {
+ if (!isConsole && !isOpOverride && (permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName())))
+ {
sender.sendMessage(ChatColor.RED + "The new group must be a lower rank.");
return false;
}
// Seems OK
auxUser.setGroup(auxGroup);
if (!sender.hasPermission("groupmanager.notify.other") || (isConsole))
+ {
sender.sendMessage(ChatColor.YELLOW + "You changed " + auxUser.getName() + " group to " + auxGroup.getName() + ".");
+ }
return true;
case mantogglevalidate:
validateOnlinePlayer = !validateOnlinePlayer;
sender.sendMessage(ChatColor.YELLOW + "Validade if player is online, now set to: " + Boolean.toString(validateOnlinePlayer));
- if (!validateOnlinePlayer) {
+ if (!validateOnlinePlayer)
+ {
sender.sendMessage(ChatColor.GOLD + "From now on you can edit players not connected... BUT:");
sender.sendMessage(ChatColor.LIGHT_PURPLE + "From now on you should type the whole name of the player, correctly.");
}
return true;
case mantogglesave:
- if (scheduler == null) {
+ if (scheduler == null)
+ {
enableScheduler();
sender.sendMessage(ChatColor.YELLOW + "The auto-saving is enabled!");
- } else {
+ }
+ else
+ {
disableScheduler();
sender.sendMessage(ChatColor.YELLOW + "The auto-saving is disabled!");
}
return true;
case manworld:
auxString = selectedWorlds.get(sender);
- if (auxString != null) {
+ if (auxString != null)
+ {
sender.sendMessage(ChatColor.YELLOW + "You have the world '" + dataHolder.getName() + "' in your selection.");
- } else {
- if (dataHolder == null) {
+ }
+ else
+ {
+ if (dataHolder == null)
+ {
sender.sendMessage(ChatColor.YELLOW + "There is no world selected. And no world is available now.");
- } else {
+ }
+ else
+ {
sender.sendMessage(ChatColor.YELLOW + "You don't have a world in your selection..");
sender.sendMessage(ChatColor.YELLOW + "Working with the direct world where your player is.");
sender.sendMessage(ChatColor.YELLOW + "Your world now uses permissions of world name: '" + dataHolder.getName() + "' ");
@@ -1879,14 +2341,17 @@ public class GroupManager extends JavaPlugin {
return true;
case manselect:
- if (args.length < 1) {
+ if (args.length < 1)
+ {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <world>)");
sender.sendMessage(ChatColor.YELLOW + "Worlds available: ");
ArrayList<OverloadedWorldHolder> worlds = worldsHolder.allWorldsDataList();
auxString = "";
- for (int i = 0; i < worlds.size(); i++) {
+ for (int i = 0; i < worlds.size(); i++)
+ {
auxString += worlds.get(i).getName();
- if ((i + 1) < worlds.size()) {
+ if ((i + 1) < worlds.size())
+ {
auxString += ", ";
}
}
@@ -1894,13 +2359,16 @@ public class GroupManager extends JavaPlugin {
return false;
}
auxString = "";
- for (int i = 0; i < args.length; i++) {
- if (args[i] == null) {
+ for (int i = 0; i < args.length; i++)
+ {
+ if (args[i] == null)
+ {
logger.warning("Bukkit gave invalid arguments array! Cmd: " + cmd.getName() + " args.length: " + args.length);
return false;
}
auxString += args[i];
- if (i < (args.length - 1)) {
+ if (i < (args.length - 1))
+ {
auxString += " ";
}
}
@@ -1912,7 +2380,8 @@ public class GroupManager extends JavaPlugin {
return true;
case manclear:
- if (args.length != 0) {
+ if (args.length != 0)
+ {
sender.sendMessage(ChatColor.RED + "Review your arguments count!");
return false;
}
@@ -1932,12 +2401,14 @@ public class GroupManager extends JavaPlugin {
/**
* Sets up the default world for use.
*/
- private boolean setDefaultWorldHandler(CommandSender sender) {
+ private boolean setDefaultWorldHandler(CommandSender sender)
+ {
dataHolder = worldsHolder.getWorldData(worldsHolder.getDefaultWorld().getName());
permissionHandler = dataHolder.getPermissionsHandler();
- if ((dataHolder != null) && (permissionHandler != null)) {
+ if ((dataHolder != null) && (permissionHandler != null))
+ {
selectedWorlds.put(sender, dataHolder.getName());
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. Default world '" + worldsHolder.getDefaultWorld().getName() + "' selected.");
return true;
@@ -1951,61 +2422,82 @@ public class GroupManager extends JavaPlugin {
/**
* Send confirmation of a group change. using permission nodes...
- *
+ *
* groupmanager.notify.self groupmanager.notify.other
- *
+ *
* @param name
* @param msg
*/
- public static void notify(String name, String msg) {
+ public static void notify(String name, String msg)
+ {
Player player = Bukkit.getServer().getPlayerExact(name);
- for (Player test : Bukkit.getServer().getOnlinePlayers()) {
- if (!test.equals(player)) {
+ for (Player test : Bukkit.getServer().getOnlinePlayers())
+ {
+ if (!test.equals(player))
+ {
if (test.hasPermission("groupmanager.notify.other"))
+ {
test.sendMessage(ChatColor.YELLOW + name + " was" + msg);
- } else if ((player != null) && ((player.hasPermission("groupmanager.notify.self")) || (player.hasPermission("groupmanager.notify.other"))))
+ }
+ }
+ else if ((player != null) && ((player.hasPermission("groupmanager.notify.self")) || (player.hasPermission("groupmanager.notify.other"))))
+ {
player.sendMessage(ChatColor.YELLOW + "You were" + msg);
+ }
}
}
/**
- * Load a List of players matching the name given. If none online, check
- * Offline.
- *
+ * Load a List of players matching the name given. If none online, check Offline.
+ *
* @param playerName, sender
* @return true if a single match is found
*/
- private List<String> validatePlayer(String playerName, CommandSender sender) {
+ private List<String> validatePlayer(String playerName, CommandSender sender)
+ {
List<Player> players = new ArrayList<Player>();
List<String> match = new ArrayList<String>();
players = this.getServer().matchPlayer(playerName);
- if (players.isEmpty()) {
+ if (players.isEmpty())
+ {
// Check for an offline player (exact match).
- if (Arrays.asList(this.getServer().getOfflinePlayers()).contains(Bukkit.getOfflinePlayer(playerName))) {
+ if (Arrays.asList(this.getServer().getOfflinePlayers()).contains(Bukkit.getOfflinePlayer(playerName)))
+ {
match.add(playerName);
- } else {
+ }
+ else
+ {
// look for partial matches
- for (OfflinePlayer offline : this.getServer().getOfflinePlayers()) {
+ for (OfflinePlayer offline : this.getServer().getOfflinePlayers())
+ {
if (offline.getName().toLowerCase().startsWith(playerName.toLowerCase()))
+ {
match.add(offline.getName());
+ }
}
}
- } else {
- for (Player player : players) {
+ }
+ else
+ {
+ for (Player player : players)
+ {
match.add(player.getName());
}
}
- if (match.isEmpty() || match == null) {
+ if (match.isEmpty() || match == null)
+ {
sender.sendMessage(ChatColor.RED + "Player not found!");
return null;
- } else if (match.size() > 1) {
+ }
+ else if (match.size() > 1)
+ {
sender.sendMessage(ChatColor.RED + "Too many matches found! (" + match.toString() + ")");
return null;
}
@@ -2017,7 +2509,8 @@ public class GroupManager extends JavaPlugin {
/**
* @return the config
*/
- public GMConfiguration getGMConfig() {
+ public GMConfiguration getGMConfig()
+ {
return config;
}
@@ -2025,12 +2518,14 @@ public class GroupManager extends JavaPlugin {
/**
* @return the backupFolder
*/
- public File getBackupFolder() {
+ public File getBackupFolder()
+ {
return backupFolder;
}
- public static GlobalGroups getGlobalGroups() {
+ public static GlobalGroups getGlobalGroups()
+ {
return globalGroups;
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/Tasks/BukkitPermsUpdateTask.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/Tasks/BukkitPermsUpdateTask.java
index 1a0fc2369..4b51403ae 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/Tasks/BukkitPermsUpdateTask.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/Tasks/BukkitPermsUpdateTask.java
@@ -7,15 +7,17 @@ import org.anjocaido.groupmanager.GroupManager;
* Created by ElgarL
*/
-public class BukkitPermsUpdateTask implements Runnable {
-
- public BukkitPermsUpdateTask() {
+public class BukkitPermsUpdateTask implements Runnable
+{
+ public BukkitPermsUpdateTask()
+ {
super();
}
@Override
- public void run() {
+ public void run()
+ {
// Signal loaded and update BukkitPermissions.
GroupManager.setLoaded(true);
@@ -25,5 +27,4 @@ public class BukkitPermsUpdateTask implements Runnable {
GroupManager.logger.info("Bukkit Permissions Updated!");
}
-
} \ No newline at end of file
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java
index bb04fa3d7..280a882c4 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java
@@ -12,59 +12,74 @@ import org.anjocaido.groupmanager.GroupManager;
import org.anjocaido.groupmanager.dataholder.WorldDataHolder;
import org.anjocaido.groupmanager.utils.StringPermissionComparator;
+
/**
- *
+ *
* @author gabrielcouto
*/
-public abstract class DataUnit {
-
+public abstract class DataUnit
+{
private WorldDataHolder dataSource;
private String name;
private boolean changed, sorted = false;
private ArrayList<String> permissions = new ArrayList<String>();
- public DataUnit(WorldDataHolder dataSource, String name) {
+ public DataUnit(WorldDataHolder dataSource, String name)
+ {
this.dataSource = dataSource;
this.name = name;
}
- public DataUnit(String name) {
+ public DataUnit(String name)
+ {
this.name = name;
}
/**
* Every group is matched only by their names and DataSources names.
- *
+ *
* @param o
* @return true if they are equal. false if not.
*/
@Override
- public boolean equals(Object o) {
-
- if (o instanceof DataUnit) {
- DataUnit go = (DataUnit) o;
- if (this.getName().equalsIgnoreCase(go.getName())) {
+ public boolean equals(Object o)
+ {
+
+ if (o instanceof DataUnit)
+ {
+ DataUnit go = (DataUnit)o;
+ if (this.getName().equalsIgnoreCase(go.getName()))
+ {
// Global Group match.
if (this.dataSource == null && go.getDataSource() == null)
+ {
return true;
+ }
// This is a global group, the object to test isn't.
if (this.dataSource == null && go.getDataSource() != null)
+ {
return false;
+ }
// This is not a global group, but the object to test is.
if (this.dataSource != null && go.getDataSource() == null)
+ {
return false;
+ }
// Match on group name and world name.
if (this.dataSource.getName().equalsIgnoreCase(go.getDataSource().getName()))
+ {
return true;
+ }
}
}
return false;
}
@Override
- public int hashCode() {
+ public int hashCode()
+ {
int hash = 5;
hash = 71 * hash + (this.name != null ? this.name.toLowerCase().hashCode() : 0);
@@ -73,20 +88,22 @@ public abstract class DataUnit {
/**
* Set the data source to point to a different worldDataHolder
- *
+ *
* @param source
*/
- public void setDataSource(WorldDataHolder source) {
+ public void setDataSource(WorldDataHolder source)
+ {
this.dataSource = source;
}
/**
* Get the current worldDataHolder this object is pointing to
- *
+ *
* @return the dataSource
*/
- public WorldDataHolder getDataSource() {
+ public WorldDataHolder getDataSource()
+ {
return dataSource;
}
@@ -94,20 +111,26 @@ public abstract class DataUnit {
/**
* @return the name
*/
- public String getName() {
+ public String getName()
+ {
return name;
}
- public void flagAsChanged() {
+ public void flagAsChanged()
+ {
WorldDataHolder testSource = getDataSource();
String source = "";
if (testSource == null)
+ {
source = "GlobalGroups";
+ }
else
+ {
source = testSource.getName();
+ }
GroupManager.logger.finest("DataSource: " + source + " - DataUnit: " + getName() + " flagged as changed!");
// for(StackTraceElement st: Thread.currentThread().getStackTrace()){
@@ -117,63 +140,76 @@ public abstract class DataUnit {
changed = true;
}
- public boolean isChanged() {
+ public boolean isChanged()
+ {
return changed;
}
- public void flagAsSaved() {
+ public void flagAsSaved()
+ {
WorldDataHolder testSource = getDataSource();
String source = "";
if (testSource == null)
+ {
source = "GlobalGroups";
+ }
else
+ {
source = testSource.getName();
+ }
GroupManager.logger.finest("DataSource: " + source + " - DataUnit: " + getName() + " flagged as saved!");
changed = false;
}
- public boolean hasSamePermissionNode(String permission) {
+ public boolean hasSamePermissionNode(String permission)
+ {
return permissions.contains(permission);
}
- public void addPermission(String permission) {
+ public void addPermission(String permission)
+ {
- if (!hasSamePermissionNode(permission)) {
+ if (!hasSamePermissionNode(permission))
+ {
permissions.add(permission);
}
flagAsChanged();
}
- public boolean removePermission(String permission) {
+ public boolean removePermission(String permission)
+ {
flagAsChanged();
return permissions.remove(permission);
}
/**
- * Use this only to list permissions.
- * You can't edit the permissions using the returned ArrayList instance
- *
+ * Use this only to list permissions. You can't edit the permissions using the returned ArrayList instance
+ *
* @return a copy of the permission list
*/
- public List<String> getPermissionList() {
+ public List<String> getPermissionList()
+ {
return Collections.unmodifiableList(permissions);
}
- public boolean isSorted() {
+ public boolean isSorted()
+ {
return this.sorted;
}
- public void sortPermissions() {
+ public void sortPermissions()
+ {
- if (!isSorted()) {
+ if (!isSorted())
+ {
Collections.sort(permissions, StringPermissionComparator.getInstance());
sorted = true;
}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java
index 751dc8fd6..5fe7365ce 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java
@@ -14,97 +14,108 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
+
/**
- *
+ *
* @author gabrielcouto/ElgarL
*/
-public class Group extends DataUnit implements Cloneable {
-
+public class Group extends DataUnit implements Cloneable
+{
/**
* The group it inherits DIRECTLY!
*/
private ArrayList<String> inherits = new ArrayList<String>();
/**
- * This one holds the fields in INFO node.
- * like prefix = 'c'
- * or build = false
+ * This one holds the fields in INFO node. like prefix = 'c' or build = false
*/
private GroupVariables variables = new GroupVariables(this);
/**
* Constructor for individual World Groups.
- *
+ *
* @param name
*/
- public Group(WorldDataHolder source, String name) {
+ public Group(WorldDataHolder source, String name)
+ {
super(source, name);
}
/**
* Constructor for Global Groups.
- *
+ *
* @param name
*/
- public Group(String name) {
+ public Group(String name)
+ {
super(name);
}
/**
* Is this a GlobalGroup
- *
+ *
* @return true if this is a global group
*/
- public boolean isGlobal() {
+ public boolean isGlobal()
+ {
return (getDataSource() == null);
}
/**
* Clone this group
- *
+ *
* @return a clone of this group
*/
@Override
- public Group clone() {
+ public Group clone()
+ {
Group clone;
- if (isGlobal()) {
+ if (isGlobal())
+ {
clone = new Group(this.getName());
- } else {
+ }
+ else
+ {
clone = new Group(getDataSource(), this.getName());
clone.inherits = new ArrayList<String>(this.getInherits());
}
- for (String perm : this.getPermissionList()) {
+ for (String perm : this.getPermissionList())
+ {
clone.addPermission(perm);
}
- clone.variables = ((GroupVariables) variables).clone(clone);
+ clone.variables = ((GroupVariables)variables).clone(clone);
//clone.flagAsChanged();
return clone;
}
/**
* Use this to deliver a group from a different dataSource to another
- *
+ *
* @param dataSource
* @return Null or Clone
*/
- public Group clone(WorldDataHolder dataSource) {
+ public Group clone(WorldDataHolder dataSource)
+ {
- if (dataSource.groupExists(this.getName())) {
+ if (dataSource.groupExists(this.getName()))
+ {
return null;
}
Group clone = dataSource.createGroup(this.getName());
// Don't add inheritance for GlobalGroups
- if (!isGlobal()) {
+ if (!isGlobal())
+ {
clone.inherits = new ArrayList<String>(this.getInherits());
}
- for (String perm : this.getPermissionList()) {
+ for (String perm : this.getPermissionList())
+ {
clone.addPermission(perm);
}
clone.variables = variables.clone(clone);
@@ -113,13 +124,13 @@ public class Group extends DataUnit implements Cloneable {
}
/**
- * an unmodifiable list of inherits list
- * You can't manage the list by here
- * Lol... version 0.6 had a problem because this.
- *
+ * an unmodifiable list of inherits list You can't manage the list by here Lol... version 0.6 had a problem because
+ * this.
+ *
* @return the inherits
*/
- public List<String> getInherits() {
+ public List<String> getInherits()
+ {
return Collections.unmodifiableList(inherits);
}
@@ -127,27 +138,35 @@ public class Group extends DataUnit implements Cloneable {
/**
* @param inherit the inherits to set
*/
- public void addInherits(Group inherit) {
+ public void addInherits(Group inherit)
+ {
- if (!isGlobal()) {
- if (!this.getDataSource().groupExists(inherit.getName())) {
+ if (!isGlobal())
+ {
+ if (!this.getDataSource().groupExists(inherit.getName()))
+ {
getDataSource().addGroup(inherit);
}
- if (!inherits.contains(inherit.getName().toLowerCase())) {
+ if (!inherits.contains(inherit.getName().toLowerCase()))
+ {
inherits.add(inherit.getName().toLowerCase());
}
flagAsChanged();
- if (GroupManager.isLoaded()) {
+ if (GroupManager.isLoaded())
+ {
GroupManager.BukkitPermissions.updateAllPlayers();
GroupManagerEventHandler.callEvent(this, Action.GROUP_INHERITANCE_CHANGED);
}
}
}
- public boolean removeInherits(String inherit) {
+ public boolean removeInherits(String inherit)
+ {
- if (!isGlobal()) {
- if (this.inherits.contains(inherit.toLowerCase())) {
+ if (!isGlobal())
+ {
+ if (this.inherits.contains(inherit.toLowerCase()))
+ {
this.inherits.remove(inherit.toLowerCase());
flagAsChanged();
GroupManagerEventHandler.callEvent(this, Action.GROUP_INHERITANCE_CHANGED);
@@ -160,25 +179,30 @@ public class Group extends DataUnit implements Cloneable {
/**
* @return the variables
*/
- public GroupVariables getVariables() {
+ public GroupVariables getVariables()
+ {
return variables;
}
/**
- *
+ *
* @param varList
*/
- public void setVariables(Map<String, Object> varList) {
+ public void setVariables(Map<String, Object> varList)
+ {
- if (!isGlobal()) {
+ if (!isGlobal())
+ {
GroupVariables temp = new GroupVariables(this, varList);
variables.clearVars();
- for (String key : temp.getVarKeyList()) {
+ for (String key : temp.getVarKeyList())
+ {
variables.addVar(key, temp.getVarObject(key));
}
flagAsChanged();
- if (GroupManager.isLoaded()) {
+ if (GroupManager.isLoaded())
+ {
GroupManager.BukkitPermissions.updateAllPlayers();
GroupManagerEventHandler.callEvent(this, Action.GROUP_INFO_CHANGED);
}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/GroupVariables.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/GroupVariables.java
index e08d1db7d..e77b3af2c 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/GroupVariables.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/GroupVariables.java
@@ -6,15 +6,17 @@ package org.anjocaido.groupmanager.data;
import java.util.Map;
+
/**
- *
+ *
* @author gabrielcouto
*/
-public class GroupVariables extends Variables implements Cloneable {
-
+public class GroupVariables extends Variables implements Cloneable
+{
private Group owner;
- public GroupVariables(Group owner) {
+ public GroupVariables(Group owner)
+ {
super(owner);
this.owner = owner;
@@ -23,23 +25,27 @@ public class GroupVariables extends Variables implements Cloneable {
addVar("build", false);
}
- public GroupVariables(Group owner, Map<String, Object> varList) {
+ public GroupVariables(Group owner, Map<String, Object> varList)
+ {
super(owner);
variables = varList;
- if (variables.get("prefix") == null) {
+ if (variables.get("prefix") == null)
+ {
variables.put("prefix", "");
owner.flagAsChanged();
}
//thisGrp.prefix = infoNode.get("prefix").toString();
- if (variables.get("suffix") == null) {
+ if (variables.get("suffix") == null)
+ {
variables.put("suffix", "");
owner.flagAsChanged();
}
//thisGrp.suffix = infoNode.get("suffix").toString();
- if (variables.get("build") == null) {
+ if (variables.get("build") == null)
+ {
variables.put("build", false);
owner.flagAsChanged();
}
@@ -48,13 +54,15 @@ public class GroupVariables extends Variables implements Cloneable {
/**
* A clone of all vars here.
- *
+ *
* @return GroupVariables clone
*/
- protected GroupVariables clone(Group newOwner) {
+ protected GroupVariables clone(Group newOwner)
+ {
GroupVariables clone = new GroupVariables(newOwner);
- for (String key : variables.keySet()) {
+ for (String key : variables.keySet())
+ {
clone.variables.put(key, variables.get(key));
}
newOwner.flagAsChanged();
@@ -63,21 +71,30 @@ public class GroupVariables extends Variables implements Cloneable {
/**
* Remove a var from the list
- *
+ *
* @param name
*/
@Override
- public void removeVar(String name) {
+ public void removeVar(String name)
+ {
- try {
+ try
+ {
this.variables.remove(name);
- } catch (Exception e) {
}
- if (name.equals("prefix")) {
+ catch (Exception e)
+ {
+ }
+ if (name.equals("prefix"))
+ {
addVar("prefix", "");
- } else if (name.equals("suffix")) {
+ }
+ else if (name.equals("suffix"))
+ {
addVar("suffix", "");
- } else if (name.equals("build")) {
+ }
+ else if (name.equals("build"))
+ {
addVar("build", false);
}
owner.flagAsChanged();
@@ -87,7 +104,8 @@ public class GroupVariables extends Variables implements Cloneable {
* @return the owner
*/
@Override
- public Group getOwner() {
+ public Group getOwner()
+ {
return owner;
}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java
index 6c74c2e50..128e5a7b1 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java
@@ -16,44 +16,47 @@ import java.util.Map;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
+
/**
- *
+ *
* @author gabrielcouto/ElgarL
*/
-public class User extends DataUnit implements Cloneable {
-
+public class User extends DataUnit implements Cloneable
+{
/**
- *
- */
+ *
+ */
private String group = null;
private ArrayList<String> subGroups = new ArrayList<String>();
/**
- * This one holds the fields in INFO node. like prefix = 'c' or build =
- * false
+ * This one holds the fields in INFO node. like prefix = 'c' or build = false
*/
private UserVariables variables = new UserVariables(this);
- private transient Player bukkitPlayer = null;
+ private Player bukkitPlayer = null;
/**
- *
+ *
* @param name
*/
- public User(WorldDataHolder source, String name) {
+ public User(WorldDataHolder source, String name)
+ {
super(source, name);
this.group = source.getDefaultGroup().getName();
}
/**
- *
+ *
* @return User clone
*/
@Override
- public User clone() {
+ public User clone()
+ {
User clone = new User(getDataSource(), this.getName());
clone.group = this.group;
- for (String perm : this.getPermissionList()) {
+ for (String perm : this.getPermissionList())
+ {
clone.addPermission(perm);
}
// clone.variables = this.variables.clone();
@@ -63,22 +66,28 @@ public class User extends DataUnit implements Cloneable {
/**
* Use this to deliver a user from one WorldDataHolder to another
- *
+ *
* @param dataSource
* @return null if given dataSource already contains the same user
*/
- public User clone(WorldDataHolder dataSource) {
+ public User clone(WorldDataHolder dataSource)
+ {
- if (dataSource.isUserDeclared(this.getName())) {
+ if (dataSource.isUserDeclared(this.getName()))
+ {
return null;
}
User clone = dataSource.createUser(this.getName());
- if (dataSource.getGroup(group) == null) {
+ if (dataSource.getGroup(group) == null)
+ {
clone.setGroup(dataSource.getDefaultGroup());
- } else {
+ }
+ else
+ {
clone.setGroup(dataSource.getGroup(this.getGroupName()));
}
- for (String perm : this.getPermissionList()) {
+ for (String perm : this.getPermissionList())
+ {
clone.addPermission(perm);
}
clone.variables = this.variables.clone(this);
@@ -86,10 +95,12 @@ public class User extends DataUnit implements Cloneable {
return clone;
}
- public Group getGroup() {
+ public Group getGroup()
+ {
Group result = getDataSource().getGroup(group);
- if (result == null) {
+ if (result == null)
+ {
this.setGroup(getDataSource().getDefaultGroup());
result = getDataSource().getDefaultGroup();
}
@@ -99,21 +110,22 @@ public class User extends DataUnit implements Cloneable {
/**
* @return the group
*/
- public String getGroupName() {
+ public String getGroupName()
+ {
Group result = getDataSource().getGroup(group);
- if (result == null) {
+ if (result == null)
+ {
group = getDataSource().getDefaultGroup().getName();
}
return group;
}
-
/**
- * @param group
- * the group to set
+ * @param group the group to set
*/
- public void setGroup(Group group) {
+ public void setGroup(Group group)
+ {
setGroup(group, true);
}
@@ -121,20 +133,25 @@ public class User extends DataUnit implements Cloneable {
/**
* @param group the group to set
* @param updatePerms if we are to trigger a superperms update.
- *
+ *
*/
- public void setGroup(Group group, Boolean updatePerms) {
+ public void setGroup(Group group, Boolean updatePerms)
+ {
- if (!this.getDataSource().groupExists(group.getName())) {
+ if (!this.getDataSource().groupExists(group.getName()))
+ {
getDataSource().addGroup(group);
}
group = getDataSource().getGroup(group.getName());
String oldGroup = this.group;
this.group = group.getName();
flagAsChanged();
- if (GroupManager.isLoaded()) {
+ if (GroupManager.isLoaded())
+ {
if (!GroupManager.BukkitPermissions.isPlayer_join() && (updatePerms))
+ {
GroupManager.BukkitPermissions.updatePlayer(getBukkitPlayer());
+ }
// Do we notify of the group change?
String defaultGroupName = getDataSource().getDefaultGroup().getName();
@@ -144,32 +161,42 @@ public class User extends DataUnit implements Cloneable {
boolean notify = (!oldGroup.equalsIgnoreCase(defaultGroupName)) || ((oldGroup.equalsIgnoreCase(defaultGroupName)) && (!this.group.equalsIgnoreCase(defaultGroupName)));
if (notify)
+ {
GroupManager.notify(this.getName(), String.format(" moved to the group %s.", group.getName()));
+ }
GroupManagerEventHandler.callEvent(this, Action.USER_GROUP_CHANGED);
}
}
- public boolean addSubGroup(Group subGroup) {
+ public boolean addSubGroup(Group subGroup)
+ {
// Don't allow adding a subgroup if it's already set as the primary.
- if (this.group.equalsIgnoreCase(subGroup.getName())) {
+ if (this.group.equalsIgnoreCase(subGroup.getName()))
+ {
return false;
}
// User already has this subgroup
if (containsSubGroup(subGroup))
+ {
return false;
+ }
// If the group doesn't exists add it
- if (!this.getDataSource().groupExists(subGroup.getName())) {
+ if (!this.getDataSource().groupExists(subGroup.getName()))
+ {
getDataSource().addGroup(subGroup);
}
subGroups.add(subGroup.getName());
flagAsChanged();
- if (GroupManager.isLoaded()) {
+ if (GroupManager.isLoaded())
+ {
if (!GroupManager.BukkitPermissions.isPlayer_join())
+ {
GroupManager.BukkitPermissions.updatePlayer(getBukkitPlayer());
+ }
GroupManagerEventHandler.callEvent(this, Action.USER_SUBGROUP_CHANGED);
}
return true;
@@ -179,43 +206,58 @@ public class User extends DataUnit implements Cloneable {
//subGroups.add(subGroup.getName());
}
- public int subGroupsSize() {
+ public int subGroupsSize()
+ {
return subGroups.size();
}
- public boolean isSubGroupsEmpty() {
+ public boolean isSubGroupsEmpty()
+ {
return subGroups.isEmpty();
}
- public boolean containsSubGroup(Group subGroup) {
+ public boolean containsSubGroup(Group subGroup)
+ {
return subGroups.contains(subGroup.getName());
}
- public boolean removeSubGroup(Group subGroup) {
+ public boolean removeSubGroup(Group subGroup)
+ {
- try {
- if (subGroups.remove(subGroup.getName())) {
+ try
+ {
+ if (subGroups.remove(subGroup.getName()))
+ {
flagAsChanged();
if (GroupManager.isLoaded())
+ {
if (!GroupManager.BukkitPermissions.isPlayer_join())
+ {
GroupManager.BukkitPermissions.updatePlayer(getBukkitPlayer());
+ }
+ }
GroupManagerEventHandler.callEvent(this, Action.USER_SUBGROUP_CHANGED);
return true;
}
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
}
return false;
}
- public ArrayList<Group> subGroupListCopy() {
+ public ArrayList<Group> subGroupListCopy()
+ {
ArrayList<Group> val = new ArrayList<Group>();
- for (String gstr : subGroups) {
+ for (String gstr : subGroups)
+ {
Group g = getDataSource().getGroup(gstr);
- if (g == null) {
+ if (g == null)
+ {
removeSubGroup(g);
continue;
}
@@ -224,7 +266,8 @@ public class User extends DataUnit implements Cloneable {
return val;
}
- public ArrayList<String> subGroupListStringCopy() {
+ public ArrayList<String> subGroupListStringCopy()
+ {
return new ArrayList<String>(subGroups);
}
@@ -232,40 +275,46 @@ public class User extends DataUnit implements Cloneable {
/**
* @return the variables
*/
- public UserVariables getVariables() {
+ public UserVariables getVariables()
+ {
return variables;
}
/**
- *
+ *
* @param varList
*/
- public void setVariables(Map<String, Object> varList) {
+ public void setVariables(Map<String, Object> varList)
+ {
//UserVariables temp = new UserVariables(this, varList);
variables.clearVars();
- for (String key : varList.keySet()) {
+ for (String key : varList.keySet())
+ {
variables.addVar(key, varList.get(key));
}
flagAsChanged();
- if (GroupManager.isLoaded()) {
+ if (GroupManager.isLoaded())
+ {
//if (!GroupManager.BukkitPermissions.isPlayer_join())
// GroupManager.BukkitPermissions.updatePlayer(this.getName());
GroupManagerEventHandler.callEvent(this, Action.USER_INFO_CHANGED);
}
}
-
- public User updatePlayer(Player player) {
+ public User updatePlayer(Player player)
+ {
bukkitPlayer = player;
return this;
}
- public Player getBukkitPlayer() {
+ public Player getBukkitPlayer()
+ {
- if (bukkitPlayer == null) {
+ if (bukkitPlayer == null)
+ {
bukkitPlayer = Bukkit.getPlayer(this.getName());
}
return bukkitPlayer;
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/UserVariables.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/UserVariables.java
index f994595c1..36c7e7e1a 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/UserVariables.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/UserVariables.java
@@ -6,21 +6,24 @@ package org.anjocaido.groupmanager.data;
import java.util.Map;
+
/**
- *
+ *
* @author gabrielcouto
*/
-public class UserVariables extends Variables {
-
+public class UserVariables extends Variables
+{
private User owner;
- public UserVariables(User owner) {
+ public UserVariables(User owner)
+ {
super(owner);
this.owner = owner;
}
- public UserVariables(User owner, Map<String, Object> varList) {
+ public UserVariables(User owner, Map<String, Object> varList)
+ {
super(owner);
this.variables = varList;
@@ -29,13 +32,15 @@ public class UserVariables extends Variables {
/**
* A clone of all vars here.
- *
+ *
* @return UserVariables clone
*/
- protected UserVariables clone(User newOwner) {
+ protected UserVariables clone(User newOwner)
+ {
UserVariables clone = new UserVariables(newOwner);
- for (String key : variables.keySet()) {
+ for (String key : variables.keySet())
+ {
clone.variables.put(key, variables.get(key));
}
newOwner.flagAsChanged();
@@ -46,7 +51,8 @@ public class UserVariables extends Variables {
* @return the owner
*/
@Override
- public User getOwner() {
+ public User getOwner()
+ {
return owner;
}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Variables.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Variables.java
index 42ceba7e4..06e309008 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Variables.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Variables.java
@@ -8,41 +8,39 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Set;
+
/**
- * A class that holds variables of a user/group.
- * In groups, it holds the contents of INFO node.
- * Like:
- * prefix
- * suffix
+ * A class that holds variables of a user/group. In groups, it holds the contents of INFO node. Like: prefix suffix
* build
- *
+ *
* @author gabrielcouto
*/
-public abstract class Variables implements Cloneable {
-
+public abstract class Variables implements Cloneable
+{
private DataUnit owner;
protected Map<String, Object> variables = new HashMap<String, Object>();
- public Variables(DataUnit owner) {
+ public Variables(DataUnit owner)
+ {
this.owner = owner;
}
/**
- * Add var to the the INFO node.
- * examples:
- * addVar("build",true);
- * addVar("prefix","c");
- *
+ * Add var to the the INFO node. examples: addVar("build",true); addVar("prefix","c");
+ *
* @param name key name of the var
* @param o the object value of the var
*/
- public void addVar(String name, Object o) {
+ public void addVar(String name, Object o)
+ {
- if (o == null) {
+ if (o == null)
+ {
return;
}
- if (variables.containsKey(name)) {
+ if (variables.containsKey(name))
+ {
variables.remove(name);
}
variables.put(name, o);
@@ -51,143 +49,178 @@ public abstract class Variables implements Cloneable {
/**
* Returns the object inside the var
- *
+ *
* @param name
* @return a Object if exists. null if doesn't exists
*/
- public Object getVarObject(String name) {
+ public Object getVarObject(String name)
+ {
return variables.get(name);
}
/**
* Get the String value for the given var name
- *
+ *
* @param name the var key name
* @return "" if null. or the toString() value of object
*/
- public String getVarString(String name) {
+ public String getVarString(String name)
+ {
Object o = variables.get(name);
- try {
+ try
+ {
return o == null ? "" : o.toString();
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
return "";
}
}
/**
- *
+ *
* @param name
* @return false if null. or a Boolean.parseBoolean of the string
*/
- public Boolean getVarBoolean(String name) {
+ public Boolean getVarBoolean(String name)
+ {
Object o = variables.get(name);
- try {
+ try
+ {
return o == null ? false : Boolean.parseBoolean(o.toString());
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
return false;
}
}
/**
- *
+ *
* @param name
* @return -1 if null. or a parseInt of the string
*/
- public Integer getVarInteger(String name) {
+ public Integer getVarInteger(String name)
+ {
Object o = variables.get(name);
- try {
+ try
+ {
return o == null ? -1 : Integer.parseInt(o.toString());
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
return -1;
}
}
/**
- *
+ *
* @param name
* @return -1 if null. or a parseDouble of the string
*/
- public Double getVarDouble(String name) {
+ public Double getVarDouble(String name)
+ {
Object o = variables.get(name);
- try {
+ try
+ {
return o == null ? -1.0D : Double.parseDouble(o.toString());
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
return -1.0D;
}
}
/**
* All variable keys this is holding
- *
+ *
* @return Set of all variable names.
*/
- public Set<String> getVarKeyList() {
+ public Set<String> getVarKeyList()
+ {
return variables.keySet();
}
/**
* verify is a var exists
- *
+ *
* @param name the key name of the var
* @return true if that var exists
*/
- public boolean hasVar(String name) {
+ public boolean hasVar(String name)
+ {
return variables.containsKey(name);
}
/**
* Returns the quantity of vars this is holding
- *
+ *
* @return the number of vars
*/
- public int getSize() {
+ public int getSize()
+ {
return variables.size();
}
/**
* Remove a var from the list
- *
+ *
* @param name
*/
- public void removeVar(String name) {
+ public void removeVar(String name)
+ {
- try {
+ try
+ {
variables.remove(name);
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
}
owner.flagAsChanged();
}
- public static Object parseVariableValue(String value) {
+ public static Object parseVariableValue(String value)
+ {
- try {
+ try
+ {
Integer i = Integer.parseInt(value);
return i;
- } catch (NumberFormatException e) {
}
- try {
+ catch (NumberFormatException e)
+ {
+ }
+ try
+ {
Double d = Double.parseDouble(value);
return d;
- } catch (NumberFormatException e) {
}
- if (value.equalsIgnoreCase("true") || value.equalsIgnoreCase("yes") || value.equalsIgnoreCase("on")) {
+ catch (NumberFormatException e)
+ {
+ }
+ if (value.equalsIgnoreCase("true") || value.equalsIgnoreCase("yes") || value.equalsIgnoreCase("on"))
+ {
return true;
- } else if (value.equalsIgnoreCase("false") || value.equalsIgnoreCase("no") || value.equalsIgnoreCase("off")) {
+ }
+ else if (value.equalsIgnoreCase("false") || value.equalsIgnoreCase("no") || value.equalsIgnoreCase("off"))
+ {
return false;
}
return value;
}
- public void clearVars() {
+ public void clearVars()
+ {
variables.clear();
owner.flagAsChanged();
@@ -196,12 +229,14 @@ public abstract class Variables implements Cloneable {
/**
* @return the owner
*/
- public DataUnit getOwner() {
+ public DataUnit getOwner()
+ {
return owner;
}
- public boolean isEmpty() {
+ public boolean isEmpty()
+ {
return variables.isEmpty();
}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/GroupsDataHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/GroupsDataHolder.java
index eaaaace74..8169df321 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/GroupsDataHolder.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/GroupsDataHolder.java
@@ -6,20 +6,20 @@ import java.util.Map;
import org.anjocaido.groupmanager.data.Group;
+
/**
* This container holds all Groups loaded from the relevant groupsFile.
- *
+ *
* @author ElgarL
- *
+ *
*/
-public class GroupsDataHolder {
-
+public class GroupsDataHolder
+{
private WorldDataHolder dataSource;
private Group defaultGroup = null;
private File groupsFile;
private boolean haveGroupsChanged = false;
private long timeStampGroups = 0;
-
/**
* The actual groups holder
*/
@@ -28,22 +28,26 @@ public class GroupsDataHolder {
/**
* Constructor
*/
- protected GroupsDataHolder() {
-
+ protected GroupsDataHolder()
+ {
}
- public void setDataSource(WorldDataHolder dataSource) {
+ public void setDataSource(WorldDataHolder dataSource)
+ {
this.dataSource = dataSource;
//push this data source to the users, so they pull the correct groups data.
for (Group group : groups.values())
+ {
group.setDataSource(this.dataSource);
+ }
}
/**
* @return the defaultGroup
*/
- public Group getDefaultGroup() {
+ public Group getDefaultGroup()
+ {
return defaultGroup;
}
@@ -51,7 +55,8 @@ public class GroupsDataHolder {
/**
* @param defaultGroup the defaultGroup to set
*/
- public void setDefaultGroup(Group defaultGroup) {
+ public void setDefaultGroup(Group defaultGroup)
+ {
this.defaultGroup = defaultGroup;
}
@@ -59,7 +64,8 @@ public class GroupsDataHolder {
/**
* @return the groups
*/
- public Map<String, Group> getGroups() {
+ public Map<String, Group> getGroups()
+ {
return groups;
}
@@ -67,7 +73,8 @@ public class GroupsDataHolder {
/**
* @param groups the groups to set
*/
- public void setGroups(Map<String, Group> groups) {
+ public void setGroups(Map<String, Group> groups)
+ {
this.groups = groups;
}
@@ -75,7 +82,8 @@ public class GroupsDataHolder {
/**
* @return the groupsFile
*/
- public File getGroupsFile() {
+ public File getGroupsFile()
+ {
return groupsFile;
}
@@ -83,7 +91,8 @@ public class GroupsDataHolder {
/**
* @param groupsFile the groupsFile to set
*/
- public void setGroupsFile(File groupsFile) {
+ public void setGroupsFile(File groupsFile)
+ {
this.groupsFile = groupsFile;
}
@@ -91,7 +100,8 @@ public class GroupsDataHolder {
/**
* @return the haveGroupsChanged
*/
- public boolean HaveGroupsChanged() {
+ public boolean HaveGroupsChanged()
+ {
return haveGroupsChanged;
}
@@ -99,7 +109,8 @@ public class GroupsDataHolder {
/**
* @param haveGroupsChanged the haveGroupsChanged to set
*/
- public void setGroupsChanged(boolean haveGroupsChanged) {
+ public void setGroupsChanged(boolean haveGroupsChanged)
+ {
this.haveGroupsChanged = haveGroupsChanged;
}
@@ -107,7 +118,8 @@ public class GroupsDataHolder {
/**
* @return the timeStampGroups
*/
- public long getTimeStampGroups() {
+ public long getTimeStampGroups()
+ {
return timeStampGroups;
}
@@ -115,9 +127,9 @@ public class GroupsDataHolder {
/**
* @param timeStampGroups the timeStampGroups to set
*/
- public void setTimeStampGroups(long timeStampGroups) {
+ public void setTimeStampGroups(long timeStampGroups)
+ {
this.timeStampGroups = timeStampGroups;
}
-
} \ No newline at end of file
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/OverloadedWorldHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/OverloadedWorldHolder.java
index 84561b6e5..4bc32cb4e 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/OverloadedWorldHolder.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/OverloadedWorldHolder.java
@@ -10,22 +10,24 @@ import java.util.HashMap;
import java.util.Map;
import org.anjocaido.groupmanager.data.User;
+
/**
- *
+ *
* @author gabrielcouto
*/
-public class OverloadedWorldHolder extends WorldDataHolder {
-
+public class OverloadedWorldHolder extends WorldDataHolder
+{
/**
- *
- */
+ *
+ */
protected Map<String, User> overloadedUsers = new HashMap<String, User>();
/**
- *
+ *
* @param ph
*/
- public OverloadedWorldHolder(WorldDataHolder ph) {
+ public OverloadedWorldHolder(WorldDataHolder ph)
+ {
super(ph.getName());
this.setGroupsFile(ph.getGroupsFile());
@@ -35,20 +37,23 @@ public class OverloadedWorldHolder extends WorldDataHolder {
}
/**
- *
+ *
* @param userName
* @return user object or a new user if none exists.
*/
@Override
- public User getUser(String userName) {
+ public User getUser(String userName)
+ {
//OVERLOADED CODE
String userNameLowered = userName.toLowerCase();
- if (overloadedUsers.containsKey(userNameLowered)) {
+ if (overloadedUsers.containsKey(userNameLowered))
+ {
return overloadedUsers.get(userNameLowered);
}
//END CODE
- if (getUsers().containsKey(userNameLowered)) {
+ if (getUsers().containsKey(userNameLowered))
+ {
return getUsers().get(userNameLowered);
}
User newUser = createUser(userName);
@@ -57,23 +62,28 @@ public class OverloadedWorldHolder extends WorldDataHolder {
}
/**
- *
+ *
* @param theUser
*/
@Override
- public void addUser(User theUser) {
+ public void addUser(User theUser)
+ {
- if (theUser.getDataSource() != this) {
+ if (theUser.getDataSource() != this)
+ {
theUser = theUser.clone(this);
}
- if (theUser == null) {
+ if (theUser == null)
+ {
return;
}
- if ((theUser.getGroup() == null) || (!getGroups().containsKey(theUser.getGroupName().toLowerCase()))) {
+ if ((theUser.getGroup() == null) || (!getGroups().containsKey(theUser.getGroupName().toLowerCase())))
+ {
theUser.setGroup(getDefaultGroup());
}
//OVERLOADED CODE
- if (overloadedUsers.containsKey(theUser.getName().toLowerCase())) {
+ if (overloadedUsers.containsKey(theUser.getName().toLowerCase()))
+ {
overloadedUsers.remove(theUser.getName().toLowerCase());
overloadedUsers.put(theUser.getName().toLowerCase(), theUser);
return;
@@ -85,20 +95,23 @@ public class OverloadedWorldHolder extends WorldDataHolder {
}
/**
- *
+ *
* @param userName
* @return true if removed/false if not found.
*/
@Override
- public boolean removeUser(String userName) {
+ public boolean removeUser(String userName)
+ {
//OVERLOADED CODE
- if (overloadedUsers.containsKey(userName.toLowerCase())) {
+ if (overloadedUsers.containsKey(userName.toLowerCase()))
+ {
overloadedUsers.remove(userName.toLowerCase());
return true;
}
//END CODE
- if (getUsers().containsKey(userName.toLowerCase())) {
+ if (getUsers().containsKey(userName.toLowerCase()))
+ {
getUsers().remove(userName.toLowerCase());
setUsersChanged(true);
return true;
@@ -107,25 +120,33 @@ public class OverloadedWorldHolder extends WorldDataHolder {
}
@Override
- public boolean removeGroup(String groupName) {
+ public boolean removeGroup(String groupName)
+ {
- if (groupName.equals(getDefaultGroup())) {
+ if (groupName.equals(getDefaultGroup()))
+ {
return false;
}
- for (String key : getGroups().keySet()) {
- if (groupName.equalsIgnoreCase(key)) {
+ for (String key : getGroups().keySet())
+ {
+ if (groupName.equalsIgnoreCase(key))
+ {
getGroups().remove(key);
- for (String userKey : getUsers().keySet()) {
+ for (String userKey : getUsers().keySet())
+ {
User user = getUsers().get(userKey);
- if (user.getGroupName().equalsIgnoreCase(key)) {
+ if (user.getGroupName().equalsIgnoreCase(key))
+ {
user.setGroup(getDefaultGroup());
}
}
//OVERLOADED CODE
- for (String userKey : overloadedUsers.keySet()) {
+ for (String userKey : overloadedUsers.keySet())
+ {
User user = overloadedUsers.get(userKey);
- if (user.getGroupName().equalsIgnoreCase(key)) {
+ if (user.getGroupName().equalsIgnoreCase(key))
+ {
user.setGroup(getDefaultGroup());
}
@@ -139,18 +160,23 @@ public class OverloadedWorldHolder extends WorldDataHolder {
}
/**
- *
+ *
* @return Collection of all users
*/
@Override
- public Collection<User> getUserList() {
+ public Collection<User> getUserList()
+ {
Collection<User> overloadedList = new ArrayList<User>();
Collection<User> normalList = getUsers().values();
- for (User u : normalList) {
- if (overloadedUsers.containsKey(u.getName().toLowerCase())) {
+ for (User u : normalList)
+ {
+ if (overloadedUsers.containsKey(u.getName().toLowerCase()))
+ {
overloadedList.add(overloadedUsers.get(u.getName().toLowerCase()));
- } else {
+ }
+ else
+ {
overloadedList.add(u);
}
}
@@ -158,25 +184,29 @@ public class OverloadedWorldHolder extends WorldDataHolder {
}
/**
- *
+ *
* @param userName
* @return true if user is overloaded.
*/
- public boolean isOverloaded(String userName) {
+ public boolean isOverloaded(String userName)
+ {
return overloadedUsers.containsKey(userName.toLowerCase());
}
/**
- *
+ *
* @param userName
*/
- public void overloadUser(String userName) {
+ public void overloadUser(String userName)
+ {
- if (!isOverloaded(userName)) {
+ if (!isOverloaded(userName))
+ {
User theUser = getUser(userName);
theUser = theUser.clone();
- if (overloadedUsers.containsKey(theUser.getName().toLowerCase())) {
+ if (overloadedUsers.containsKey(theUser.getName().toLowerCase()))
+ {
overloadedUsers.remove(theUser.getName().toLowerCase());
}
overloadedUsers.put(theUser.getName().toLowerCase(), theUser);
@@ -184,28 +214,31 @@ public class OverloadedWorldHolder extends WorldDataHolder {
}
/**
- *
+ *
* @param userName
*/
- public void removeOverload(String userName) {
+ public void removeOverload(String userName)
+ {
overloadedUsers.remove(userName.toLowerCase());
}
/**
- * Gets the user in normal state. Surpassing the overload state.
- * It doesn't affect permissions. But it enables plugins change the
- * actual user permissions even in overload mode.
- *
+ * Gets the user in normal state. Surpassing the overload state. It doesn't affect permissions. But it enables
+ * plugins change the actual user permissions even in overload mode.
+ *
* @param userName
* @return user object
*/
- public User surpassOverload(String userName) {
+ public User surpassOverload(String userName)
+ {
- if (!isOverloaded(userName)) {
+ if (!isOverloaded(userName))
+ {
return getUser(userName);
}
- if (getUsers().containsKey(userName.toLowerCase())) {
+ if (getUsers().containsKey(userName.toLowerCase()))
+ {
return getUsers().get(userName.toLowerCase());
}
User newUser = createUser(userName);
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/UsersDataHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/UsersDataHolder.java
index 665fe227d..6d8701fd4 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/UsersDataHolder.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/UsersDataHolder.java
@@ -6,19 +6,19 @@ import java.util.Map;
import org.anjocaido.groupmanager.data.User;
+
/**
* This container holds all Users loaded from the relevant usersFile.
- *
+ *
* @author ElgarL
- *
+ *
*/
-public class UsersDataHolder {
-
+public class UsersDataHolder
+{
private WorldDataHolder dataSource;
private File usersFile;
private boolean haveUsersChanged = false;
private long timeStampUsers = 0;
-
/**
* The actual groups holder
*/
@@ -27,23 +27,27 @@ public class UsersDataHolder {
/**
* Constructor
*/
- protected UsersDataHolder() {
-
+ protected UsersDataHolder()
+ {
}
- public void setDataSource(WorldDataHolder dataSource) {
+ public void setDataSource(WorldDataHolder dataSource)
+ {
this.dataSource = dataSource;
//push this data source to the users, so they pull the correct groups data.
for (User user : users.values())
+ {
user.setDataSource(this.dataSource);
+ }
}
/**
* @return the users
*/
- public Map<String, User> getUsers() {
+ public Map<String, User> getUsers()
+ {
return users;
}
@@ -51,7 +55,8 @@ public class UsersDataHolder {
/**
* @param users the users to set
*/
- public void setUsers(Map<String, User> users) {
+ public void setUsers(Map<String, User> users)
+ {
this.users = users;
}
@@ -59,7 +64,8 @@ public class UsersDataHolder {
/**
* @return the usersFile
*/
- public File getUsersFile() {
+ public File getUsersFile()
+ {
return usersFile;
}
@@ -67,7 +73,8 @@ public class UsersDataHolder {
/**
* @param usersFile the usersFile to set
*/
- public void setUsersFile(File usersFile) {
+ public void setUsersFile(File usersFile)
+ {
this.usersFile = usersFile;
}
@@ -75,7 +82,8 @@ public class UsersDataHolder {
/**
* @return the haveUsersChanged
*/
- public boolean HaveUsersChanged() {
+ public boolean HaveUsersChanged()
+ {
return haveUsersChanged;
}
@@ -83,7 +91,8 @@ public class UsersDataHolder {
/**
* @param haveUsersChanged the haveUsersChanged to set
*/
- public void setUsersChanged(boolean haveUsersChanged) {
+ public void setUsersChanged(boolean haveUsersChanged)
+ {
this.haveUsersChanged = haveUsersChanged;
}
@@ -91,7 +100,8 @@ public class UsersDataHolder {
/**
* @return the timeStampUsers
*/
- public long getTimeStampUsers() {
+ public long getTimeStampUsers()
+ {
return timeStampUsers;
}
@@ -99,9 +109,9 @@ public class UsersDataHolder {
/**
* @param timeStampUsers the timeStampUsers to set
*/
- public void setTimeStampUsers(long timeStampUsers) {
+ public void setTimeStampUsers(long timeStampUsers)
+ {
this.timeStampUsers = timeStampUsers;
}
-
} \ No newline at end of file
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java
index fefc698f9..df1c3c078 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java
@@ -36,15 +36,15 @@ import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.SafeConstructor;
import org.yaml.snakeyaml.reader.UnicodeReader;
+
/**
- * One instance of this should exist per world/mirror
- * it contains all functions to manage these data sets
- * and points to the relevant users and groups objects.
- *
+ * One instance of this should exist per world/mirror it contains all functions to manage these data sets and points to
+ * the relevant users and groups objects.
+ *
* @author gabrielcouto, ElgarL
*/
-public class WorldDataHolder {
-
+public class WorldDataHolder
+{
/**
* World name
*/
@@ -58,28 +58,30 @@ public class WorldDataHolder {
*/
protected UsersDataHolder users = new UsersDataHolder();
/**
- *
- */
+ *
+ */
protected AnjoPermissionsHandler permissionsHandler;
/**
* Prevent direct instantiation
- *
+ *
* @param worldName
*/
- public WorldDataHolder(String worldName) {
+ public WorldDataHolder(String worldName)
+ {
name = worldName;
}
/**
* The main constructor for a new WorldDataHolder
- *
+ *
* @param worldName
* @param groups
* @param users
*/
- public WorldDataHolder(String worldName, GroupsDataHolder groups, UsersDataHolder users) {
+ public WorldDataHolder(String worldName, GroupsDataHolder groups, UsersDataHolder users)
+ {
this.name = worldName;
this.groups = groups;
@@ -90,25 +92,27 @@ public class WorldDataHolder {
/**
* update the dataSource to point to this object.
- *
+ *
* This should be called whenever a set of world data is fetched.
*/
- public void updateDataSource() {
+ public void updateDataSource()
+ {
this.groups.setDataSource(this);
this.users.setDataSource(this);
}
/**
- * Search for a user. If it doesn't exist, create a new one with
- * default group.
- *
+ * Search for a user. If it doesn't exist, create a new one with default group.
+ *
* @param userName the name of the user
* @return class that manage that user permission
*/
- public User getUser(String userName) {
+ public User getUser(String userName)
+ {
- if (getUsers().containsKey(userName.toLowerCase())) {
+ if (getUsers().containsKey(userName.toLowerCase()))
+ {
return getUsers().get(userName.toLowerCase());
}
User newUser = createUser(userName);
@@ -117,154 +121,189 @@ public class WorldDataHolder {
/**
* Add a user to the list. If it already exists, overwrite the old.
- *
+ *
* @param theUser the user you want to add to the permission list
*/
- public void addUser(User theUser) {
+ public void addUser(User theUser)
+ {
- if (theUser.getDataSource() != this) {
+ if (theUser.getDataSource() != this)
+ {
theUser = theUser.clone(this);
}
- if (theUser == null) {
+ if (theUser == null)
+ {
return;
}
- if ((theUser.getGroup() == null)) {
+ if ((theUser.getGroup() == null))
+ {
theUser.setGroup(groups.getDefaultGroup());
}
removeUser(theUser.getName());
getUsers().put(theUser.getName().toLowerCase(), theUser);
setUsersChanged(true);
if (GroupManager.isLoaded())
+ {
GroupManagerEventHandler.callEvent(theUser, Action.USER_ADDED);
+ }
}
/**
* Removes the user from the list. (he might become a default user)
- *
+ *
* @param userName the username from the user to remove
* @return true if it had something to remove
*/
- public boolean removeUser(String userName) {
+ public boolean removeUser(String userName)
+ {
- if (getUsers().containsKey(userName.toLowerCase())) {
+ if (getUsers().containsKey(userName.toLowerCase()))
+ {
getUsers().remove(userName.toLowerCase());
setUsersChanged(true);
if (GroupManager.isLoaded())
+ {
GroupManagerEventHandler.callEvent(userName, GMUserEvent.Action.USER_REMOVED);
+ }
return true;
}
return false;
}
/**
- *
+ *
* @param userName
* @return true if we have data for this player.
*/
- public boolean isUserDeclared(String userName) {
+ public boolean isUserDeclared(String userName)
+ {
return getUsers().containsKey(userName.toLowerCase());
}
/**
* Change the default group of the file.
- *
+ *
* @param group the group you want make default.
*/
- public void setDefaultGroup(Group group) {
+ public void setDefaultGroup(Group group)
+ {
- if (!getGroups().containsKey(group.getName().toLowerCase()) || (group.getDataSource() != this)) {
+ if (!getGroups().containsKey(group.getName().toLowerCase()) || (group.getDataSource() != this))
+ {
addGroup(group);
}
groups.setDefaultGroup(getGroup(group.getName()));
setGroupsChanged(true);
if (GroupManager.isLoaded())
+ {
GroupManagerEventHandler.callEvent(GMSystemEvent.Action.DEFAULT_GROUP_CHANGED);
+ }
}
/**
* Returns the default group of the file
- *
+ *
* @return the default group
*/
- public Group getDefaultGroup() {
+ public Group getDefaultGroup()
+ {
return groups.getDefaultGroup();
}
/**
* Returns a group of the given name
- *
+ *
* @param groupName the name of the group
* @return a group if it is found. null if not found.
*/
- public Group getGroup(String groupName) {
+ public Group getGroup(String groupName)
+ {
if (groupName.toLowerCase().startsWith("g:"))
+ {
return GroupManager.getGlobalGroups().getGroup(groupName);
+ }
else
+ {
return getGroups().get(groupName.toLowerCase());
+ }
}
/**
- * Check if a group exists.
- * Its the same of getGroup, but check if it is null.
- *
+ * Check if a group exists. Its the same of getGroup, but check if it is null.
+ *
* @param groupName the name of the group
* @return true if exists. false if not.
*/
- public boolean groupExists(String groupName) {
+ public boolean groupExists(String groupName)
+ {
if (groupName.toLowerCase().startsWith("g:"))
+ {
return GroupManager.getGlobalGroups().hasGroup(groupName);
+ }
else
+ {
return getGroups().containsKey(groupName.toLowerCase());
+ }
}
/**
* Add a group to the list
- *
+ *
* @param groupToAdd
*/
- public void addGroup(Group groupToAdd) {
+ public void addGroup(Group groupToAdd)
+ {
- if (groupToAdd.getName().toLowerCase().startsWith("g:")) {
+ if (groupToAdd.getName().toLowerCase().startsWith("g:"))
+ {
GroupManager.getGlobalGroups().addGroup(groupToAdd);
GroupManagerEventHandler.callEvent(groupToAdd, GMGroupEvent.Action.GROUP_ADDED);
return;
}
- if (groupToAdd.getDataSource() != this) {
+ if (groupToAdd.getDataSource() != this)
+ {
groupToAdd = groupToAdd.clone(this);
}
removeGroup(groupToAdd.getName());
getGroups().put(groupToAdd.getName().toLowerCase(), groupToAdd);
setGroupsChanged(true);
if (GroupManager.isLoaded())
+ {
GroupManagerEventHandler.callEvent(groupToAdd, GMGroupEvent.Action.GROUP_ADDED);
+ }
}
/**
* Remove the group from the list
- *
+ *
* @param groupName
- * @return true if had something to remove. false the group was default or
- * non-existant
+ * @return true if had something to remove. false the group was default or non-existant
*/
- public boolean removeGroup(String groupName) {
+ public boolean removeGroup(String groupName)
+ {
- if (groupName.toLowerCase().startsWith("g:")) {
+ if (groupName.toLowerCase().startsWith("g:"))
+ {
return GroupManager.getGlobalGroups().removeGroup(groupName);
}
- if (getDefaultGroup() != null && groupName.equalsIgnoreCase(getDefaultGroup().getName())) {
+ if (getDefaultGroup() != null && groupName.equalsIgnoreCase(getDefaultGroup().getName()))
+ {
return false;
}
- if (getGroups().containsKey(groupName.toLowerCase())) {
+ if (getGroups().containsKey(groupName.toLowerCase()))
+ {
getGroups().remove(groupName.toLowerCase());
setGroupsChanged(true);
if (GroupManager.isLoaded())
+ {
GroupManagerEventHandler.callEvent(groupName.toLowerCase(), GMGroupEvent.Action.GROUP_REMOVED);
+ }
return true;
}
return false;
@@ -272,15 +311,16 @@ public class WorldDataHolder {
}
/**
- * Creates a new User with the given name
- * and adds it to this holder.
- *
+ * Creates a new User with the given name and adds it to this holder.
+ *
* @param userName the username you want
* @return null if user already exists. or new User
*/
- public User createUser(String userName) {
+ public User createUser(String userName)
+ {
- if (getUsers().containsKey(userName.toLowerCase())) {
+ if (getUsers().containsKey(userName.toLowerCase()))
+ {
return null;
}
User newUser = new User(this, userName);
@@ -291,20 +331,22 @@ public class WorldDataHolder {
}
/**
- * Creates a new Group with the given name
- * and adds it to this holder
- *
+ * Creates a new Group with the given name and adds it to this holder
+ *
* @param groupName the groupname you want
* @return null if group already exists. or new Group
*/
- public Group createGroup(String groupName) {
+ public Group createGroup(String groupName)
+ {
- if (groupName.toLowerCase().startsWith("g:")) {
+ if (groupName.toLowerCase().startsWith("g:"))
+ {
Group newGroup = new Group(groupName);
return GroupManager.getGlobalGroups().newGroup(newGroup);
}
- if (getGroups().containsKey(groupName.toLowerCase())) {
+ if (getGroups().containsKey(groupName.toLowerCase()))
+ {
return null;
}
@@ -315,19 +357,21 @@ public class WorldDataHolder {
}
/**
- *
+ *
* @return a collection of the groups
*/
- public Collection<Group> getGroupList() {
+ public Collection<Group> getGroupList()
+ {
return getGroups().values();
}
/**
- *
+ *
* @return a collection of the users
*/
- public Collection<User> getUserList() {
+ public Collection<User> getUserList()
+ {
return getUsers().values();
}
@@ -335,12 +379,16 @@ public class WorldDataHolder {
/**
* reads the file again
*/
- public void reload() {
+ public void reload()
+ {
- try {
+ try
+ {
reloadGroups();
reloadUsers();
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
Logger.getLogger(WorldDataHolder.class.getName()).log(Level.SEVERE, null, ex);
}
}
@@ -348,17 +396,20 @@ public class WorldDataHolder {
/**
* Refresh Group data from file
*/
- public void reloadGroups() {
+ public void reloadGroups()
+ {
GroupManager.setLoaded(false);
- try {
+ try
+ {
// temporary holder in case the load fails.
WorldDataHolder ph = new WorldDataHolder(this.getName());
loadGroups(ph, getGroupsFile());
// transfer new data
resetGroups();
- for (Group tempGroup : ph.getGroupList()) {
+ for (Group tempGroup : ph.getGroupList())
+ {
tempGroup.clone(this);
}
this.setDefaultGroup(getGroup(ph.getDefaultGroup().getName()));
@@ -366,7 +417,9 @@ public class WorldDataHolder {
this.setTimeStampGroups(getGroupsFile().lastModified());
ph = null;
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
Logger.getLogger(WorldDataHolder.class.getName()).log(Level.WARNING, null, ex);
}
GroupManager.setLoaded(true);
@@ -376,14 +429,17 @@ public class WorldDataHolder {
/**
* Refresh Users data from file
*/
- public void reloadUsers() {
+ public void reloadUsers()
+ {
GroupManager.setLoaded(false);
- try {
+ try
+ {
// temporary holder in case the load fails.
WorldDataHolder ph = new WorldDataHolder(this.getName());
// copy groups for reference
- for (Group tempGroup : this.getGroupList()) {
+ for (Group tempGroup : this.getGroupList())
+ {
tempGroup.clone(ph);
}
// setup the default group before loading user data.
@@ -391,30 +447,39 @@ public class WorldDataHolder {
loadUsers(ph, getUsersFile());
// transfer new data
resetUsers();
- for (User tempUser : ph.getUserList()) {
+ for (User tempUser : ph.getUserList())
+ {
tempUser.clone(this);
}
this.removeUsersChangedFlag();
this.setTimeStampUsers(getUsersFile().lastModified());
ph = null;
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
Logger.getLogger(WorldDataHolder.class.getName()).log(Level.WARNING, null, ex);
}
GroupManager.setLoaded(true);
GroupManagerEventHandler.callEvent(GMSystemEvent.Action.RELOADED);
}
- public void loadGroups(File groupsFile) {
+ public void loadGroups(File groupsFile)
+ {
GroupManager.setLoaded(false);
- try {
+ try
+ {
setGroupsFile(groupsFile);
loadGroups(this, groupsFile);
- } catch (FileNotFoundException e) {
+ }
+ catch (FileNotFoundException e)
+ {
e.printStackTrace();
throw new IllegalArgumentException("The file which should contain groups does not exist!\n" + groupsFile.getPath());
- } catch (IOException e) {
+ }
+ catch (IOException e)
+ {
e.printStackTrace();
throw new IllegalArgumentException("Error access the groups file!\n" + groupsFile.getPath());
}
@@ -422,16 +487,22 @@ public class WorldDataHolder {
GroupManager.setLoaded(true);
}
- public void loadUsers(File usersFile) {
+ public void loadUsers(File usersFile)
+ {
GroupManager.setLoaded(false);
- try {
+ try
+ {
setUsersFile(usersFile);
loadUsers(this, usersFile);
- } catch (FileNotFoundException e) {
+ }
+ catch (FileNotFoundException e)
+ {
e.printStackTrace();
throw new IllegalArgumentException("The file which should contain users does not exist!\n" + usersFile.getPath());
- } catch (IOException e) {
+ }
+ catch (IOException e)
+ {
e.printStackTrace();
throw new IllegalArgumentException("Error access the users file!\n" + usersFile.getPath());
}
@@ -441,23 +512,28 @@ public class WorldDataHolder {
/**
* Returns a NEW data holder containing data read from the files
- *
+ *
* @param worldName
* @param groupsFile
* @param usersFile
- *
+ *
* @throws FileNotFoundException
* @throws IOException
*/
- public static WorldDataHolder load(String worldName, File groupsFile, File usersFile) throws FileNotFoundException, IOException {
+ public static WorldDataHolder load(String worldName, File groupsFile, File usersFile) throws FileNotFoundException, IOException
+ {
WorldDataHolder ph = new WorldDataHolder(worldName);
GroupManager.setLoaded(false);
if (groupsFile != null)
+ {
loadGroups(ph, groupsFile);
+ }
if (usersFile != null)
+ {
loadUsers(ph, usersFile);
+ }
GroupManager.setLoaded(true);
return ph;
@@ -465,33 +541,44 @@ public class WorldDataHolder {
/**
* Updates the WorldDataHolder from the Groups file
- *
+ *
* @param ph
* @param groupsFile
- *
+ *
* @throws FileNotFoundException
* @throws IOException
*/
- @SuppressWarnings({ "rawtypes", "unchecked" })
- protected static void loadGroups(WorldDataHolder ph, File groupsFile) throws FileNotFoundException, IOException {
+ @SuppressWarnings(
+ {
+ "rawtypes", "unchecked"
+ })
+ protected static void loadGroups(WorldDataHolder ph, File groupsFile) throws FileNotFoundException, IOException
+ {
// READ GROUPS FILE
Yaml yamlGroups = new Yaml(new SafeConstructor());
Map<String, Object> groupsRootDataNode;
- if (!groupsFile.exists()) {
+ if (!groupsFile.exists())
+ {
throw new IllegalArgumentException("The file which should contain groups does not exist!\n" + groupsFile.getPath());
}
FileInputStream groupsInputStream = new FileInputStream(groupsFile);
- try {
- groupsRootDataNode = (Map<String, Object>) yamlGroups.load(new UnicodeReader(groupsInputStream));
- if (groupsRootDataNode == null) {
+ try
+ {
+ groupsRootDataNode = (Map<String, Object>)yamlGroups.load(new UnicodeReader(groupsInputStream));
+ if (groupsRootDataNode == null)
+ {
throw new NullPointerException();
}
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
throw new IllegalArgumentException("The following file couldn't pass on Parser.\n" + groupsFile.getPath(), ex);
- } finally {
+ }
+ finally
+ {
groupsInputStream.close();
}
@@ -503,9 +590,12 @@ public class WorldDataHolder {
/*
* Fetch all groups under the 'groups' entry.
*/
- try {
- allGroupsNode = (Map<String, Object>) groupsRootDataNode.get("groups");
- } catch (Exception ex) {
+ try
+ {
+ allGroupsNode = (Map<String, Object>)groupsRootDataNode.get("groups");
+ }
+ catch (Exception ex)
+ {
throw new IllegalArgumentException("Your " + groupsFile.getPath() + " file is invalid. See console for details.", ex);
}
@@ -517,13 +607,17 @@ public class WorldDataHolder {
* loop each group entry
* and process it's data.
*/
- while (groupItr.hasNext()) {
+ while (groupItr.hasNext())
+ {
- try {
+ try
+ {
groupCount++;
// Attempt to fetch the next group name.
groupKey = groupItr.next();
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
throw new IllegalArgumentException("Invalid group name for group entry (" + groupCount + ") in file: " + groupsFile.getPath(), ex);
}
@@ -532,9 +626,12 @@ public class WorldDataHolder {
*/
Map<String, Object> thisGroupNode = null;
- try {
- thisGroupNode = (Map<String, Object>) allGroupsNode.get(groupKey);
- } catch (Exception ex) {
+ try
+ {
+ thisGroupNode = (Map<String, Object>)allGroupsNode.get(groupKey);
+ }
+ catch (Exception ex)
+ {
throw new IllegalArgumentException("Invalid child nodes for group '" + groupKey + "' in file: " + groupsFile.getPath(), ex);
}
@@ -544,29 +641,37 @@ public class WorldDataHolder {
*/
Group thisGrp = ph.createGroup(groupKey);
- if (thisGrp == null) {
+ if (thisGrp == null)
+ {
throw new IllegalArgumentException("I think this Group was declared more than once: " + groupKey + " in file: " + groupsFile.getPath());
}
// DEFAULT NODE
Object nodeData = null;
- try {
+ try
+ {
nodeData = thisGroupNode.get("default");
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
throw new IllegalArgumentException("Bad format found in 'permissions' for group: " + groupKey + " in file: " + groupsFile.getPath());
}
- if (nodeData == null) {
+ if (nodeData == null)
+ {
/*
* If no 'default' node is found do nothing.
*/
- } else if ((Boolean.parseBoolean(nodeData.toString()))) {
+ }
+ else if ((Boolean.parseBoolean(nodeData.toString())))
+ {
/*
* Set this as the default group.
* Warn if some other group has already claimed that position.
*/
- if (ph.getDefaultGroup() != null) {
+ if (ph.getDefaultGroup() != null)
+ {
GroupManager.logger.warning("The group '" + thisGrp.getName() + "' is claiming to be default where '" + ph.getDefaultGroup().getName() + "' already was.");
GroupManager.logger.warning("Overriding first default request in file: " + groupsFile.getPath());
}
@@ -576,51 +681,73 @@ public class WorldDataHolder {
// PERMISSIONS NODE
nodeData = null;
- try {
+ try
+ {
nodeData = thisGroupNode.get("permissions");
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
throw new IllegalArgumentException("Bad format found in 'permissions' for '" + groupKey + "' in file: " + groupsFile.getPath());
}
- if (nodeData == null) {
+ if (nodeData == null)
+ {
/*
* If no permissions node is found, or it's empty
* do nothing.
*/
- } else {
+ }
+ else
+ {
/*
* There is a permission list Which seems to hold some data
*/
- if (nodeData instanceof List) {
+ if (nodeData instanceof List)
+ {
/*
* Check each entry and add it as a new permission.
*/
- try {
- for (Object o : ((List) nodeData)) {
- try {
+ try
+ {
+ for (Object o : ((List)nodeData))
+ {
+ try
+ {
/*
* Only add this permission if it's not empty.
*/
if (!o.toString().isEmpty())
+ {
thisGrp.addPermission(o.toString());
+ }
- } catch (NullPointerException ex) {
+ }
+ catch (NullPointerException ex)
+ {
// Ignore this entry as it's null. It can be
// safely dropped
}
}
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
throw new IllegalArgumentException("Invalid formatting found in 'permissions' section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath(), ex);
}
- } else if (nodeData instanceof String) {
+ }
+ else if (nodeData instanceof String)
+ {
/*
* Only add this permission if it's not empty.
*/
if (!nodeData.toString().isEmpty())
- thisGrp.addPermission((String) nodeData);
+ {
+ thisGrp.addPermission((String)nodeData);
+ }
- } else {
+ }
+ else
+ {
throw new IllegalArgumentException("Unknown type of 'permissions' node(Should be String or List<String>) for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath());
}
/*
@@ -633,13 +760,17 @@ public class WorldDataHolder {
// INFO NODE
nodeData = null;
- try {
+ try
+ {
nodeData = thisGroupNode.get("info");
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
throw new IllegalArgumentException("Bad format found in 'info' section for group: " + groupKey + " in file: " + groupsFile.getPath());
}
- if (nodeData == null) {
+ if (nodeData == null)
+ {
/*
* No info section was found, so leave all variables as
* defaults.
@@ -647,75 +778,109 @@ public class WorldDataHolder {
GroupManager.logger.warning("The group '" + thisGrp.getName() + "' has no 'info' section!");
GroupManager.logger.warning("Using default values: " + groupsFile.getPath());
- } else if (nodeData instanceof Map) {
- try {
- if (nodeData != null) {
- thisGrp.setVariables((Map<String, Object>) nodeData);
+ }
+ else if (nodeData instanceof Map)
+ {
+ try
+ {
+ if (nodeData != null)
+ {
+ thisGrp.setVariables((Map<String, Object>)nodeData);
}
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
throw new IllegalArgumentException("Invalid formatting found in 'info' section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath(), ex);
}
- } else
+ }
+ else
+ {
throw new IllegalArgumentException("Unknown entry found in 'info' section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath());
+ }
// INHERITANCE NODE
nodeData = null;
- try {
+ try
+ {
nodeData = thisGroupNode.get("inheritance");
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
throw new IllegalArgumentException("Bad format found in 'inheritance' section for group: " + groupKey + " in file: " + groupsFile.getPath());
}
- if (nodeData == null || nodeData instanceof List) {
- if (nodeData == null) {
+ if (nodeData == null || nodeData instanceof List)
+ {
+ if (nodeData == null)
+ {
/*
* If no inheritance node is found, or it's empty
* do nothing.
*/
- } else if (nodeData instanceof List) {
-
- try {
- for (String grp : (List<String>) nodeData) {
- if (inheritance.get(groupKey) == null) {
+ }
+ else if (nodeData instanceof List)
+ {
+
+ try
+ {
+ for (String grp : (List<String>)nodeData)
+ {
+ if (inheritance.get(groupKey) == null)
+ {
inheritance.put(groupKey, new ArrayList<String>());
}
inheritance.get(groupKey).add(grp);
}
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
throw new IllegalArgumentException("Invalid formatting found in 'inheritance' section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath(), ex);
}
}
- } else
+ }
+ else
+ {
throw new IllegalArgumentException("Unknown entry found in 'inheritance' section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath());
+ }
// END GROUP
}
- if (ph.getDefaultGroup() == null) {
+ if (ph.getDefaultGroup() == null)
+ {
throw new IllegalArgumentException("There was no Default Group declared in file: " + groupsFile.getPath());
}
/*
* Build the inheritance map and recored any errors
*/
- for (String group : inheritance.keySet()) {
+ for (String group : inheritance.keySet())
+ {
List<String> inheritedList = inheritance.get(group);
Group thisGroup = ph.getGroup(group);
if (thisGroup != null)
- for (String inheritedKey : inheritedList) {
- if (inheritedKey != null) {
+ {
+ for (String inheritedKey : inheritedList)
+ {
+ if (inheritedKey != null)
+ {
Group inheritedGroup = ph.getGroup(inheritedKey);
- if (inheritedGroup != null) {
+ if (inheritedGroup != null)
+ {
thisGroup.addInherits(inheritedGroup);
- } else
+ }
+ else
+ {
GroupManager.logger.warning("Inherited group '" + inheritedKey + "' not found for group " + thisGroup.getName() + ". Ignoring entry in file: " + groupsFile.getPath());
+ }
}
}
+ }
}
ph.removeGroupsChangedFlag();
@@ -728,31 +893,42 @@ public class WorldDataHolder {
/**
* Updates the WorldDataHolder from the Users file
- *
+ *
* @param ph
* @param usersFile
- *
+ *
* @throws FileNotFoundException
* @throws IOException
*/
- @SuppressWarnings({ "rawtypes", "unchecked" })
- protected static void loadUsers(WorldDataHolder ph, File usersFile) throws FileNotFoundException, IOException {
+ @SuppressWarnings(
+ {
+ "rawtypes", "unchecked"
+ })
+ protected static void loadUsers(WorldDataHolder ph, File usersFile) throws FileNotFoundException, IOException
+ {
// READ USERS FILE
Yaml yamlUsers = new Yaml(new SafeConstructor());
Map<String, Object> usersRootDataNode;
- if (!usersFile.exists()) {
+ if (!usersFile.exists())
+ {
throw new IllegalArgumentException("The file which should contain users does not exist!\n" + usersFile.getPath());
}
FileInputStream usersInputStream = new FileInputStream(usersFile);
- try {
- usersRootDataNode = (Map<String, Object>) yamlUsers.load(new UnicodeReader(usersInputStream));
- if (usersRootDataNode == null) {
+ try
+ {
+ usersRootDataNode = (Map<String, Object>)yamlUsers.load(new UnicodeReader(usersInputStream));
+ if (usersRootDataNode == null)
+ {
throw new NullPointerException();
}
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
throw new IllegalArgumentException("The following file couldn't pass on Parser.\n" + usersFile.getPath(), ex);
- } finally {
+ }
+ finally
+ {
usersInputStream.close();
}
@@ -763,72 +939,101 @@ public class WorldDataHolder {
/*
* Fetch all child nodes under the 'users' entry.
*/
- try {
- allUsersNode = (Map<String, Object>) usersRootDataNode.get("users");
- } catch (Exception ex) {
+ try
+ {
+ allUsersNode = (Map<String, Object>)usersRootDataNode.get("users");
+ }
+ catch (Exception ex)
+ {
throw new IllegalArgumentException("Your " + usersFile.getPath() + " file is invalid. See console for details.", ex);
}
// Load users if the file is NOT empty
- if (allUsersNode != null) {
+ if (allUsersNode != null)
+ {
Iterator<String> usersItr = allUsersNode.keySet().iterator();
String usersKey;
Integer userCount = 0;
- while (usersItr.hasNext()) {
- try {
+ while (usersItr.hasNext())
+ {
+ try
+ {
userCount++;
// Attempt to fetch the next user name.
usersKey = usersItr.next();
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
throw new IllegalArgumentException("Invalid node type for user entry (" + userCount + ") in file: " + usersFile.getPath(), ex);
}
Map<String, Object> thisUserNode = null;
- try {
- thisUserNode = (Map<String, Object>) allUsersNode.get(usersKey);
- } catch (Exception ex) {
+ try
+ {
+ thisUserNode = (Map<String, Object>)allUsersNode.get(usersKey);
+ }
+ catch (Exception ex)
+ {
throw new IllegalArgumentException("Bad format found for user: " + usersKey + " in file: " + usersFile.getPath());
}
User thisUser = ph.createUser(usersKey);
- if (thisUser == null) {
+ if (thisUser == null)
+ {
throw new IllegalArgumentException("I think this user was declared more than once: " + usersKey + " in file: " + usersFile.getPath());
}
// USER PERMISSIONS NODES
Object nodeData = null;
- try {
+ try
+ {
nodeData = thisUserNode.get("permissions");
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
throw new IllegalArgumentException("Bad format found in 'permissions' for user: " + usersKey + " in file: " + usersFile.getPath());
}
- if (nodeData == null) {
+ if (nodeData == null)
+ {
/*
* If no permissions node is found, or it's empty
* do nothing.
*/
- } else {
- if (nodeData instanceof List) {
- for (Object o : ((List) nodeData)) {
+ }
+ else
+ {
+ if (nodeData instanceof List)
+ {
+ for (Object o : ((List)nodeData))
+ {
/*
* Only add this permission if it's not empty
*/
if (!o.toString().isEmpty())
+ {
thisUser.addPermission(o.toString());
+ }
}
- } else if (nodeData instanceof String) {
- try {
+ }
+ else if (nodeData instanceof String)
+ {
+ try
+ {
/*
* Only add this permission if it's not empty
*/
if (!nodeData.toString().isEmpty())
+ {
thisUser.addPermission(nodeData.toString());
- } catch (NullPointerException e) {
+ }
+ }
+ catch (NullPointerException e)
+ {
// Ignore this entry as it's null.
}
}
@@ -838,31 +1043,46 @@ public class WorldDataHolder {
// SUBGROUPS NODES
nodeData = null;
- try {
+ try
+ {
nodeData = thisUserNode.get("subgroups");
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
throw new IllegalArgumentException("Bad format found in 'subgroups' for user: " + usersKey + " in file: " + usersFile.getPath());
}
- if (nodeData == null) {
+ if (nodeData == null)
+ {
/*
* If no subgroups node is found, or it's empty
* do nothing.
*/
- } else if (nodeData instanceof List) {
- for (Object o : ((List) nodeData)) {
+ }
+ else if (nodeData instanceof List)
+ {
+ for (Object o : ((List)nodeData))
+ {
Group subGrp = ph.getGroup(o.toString());
- if (subGrp != null) {
+ if (subGrp != null)
+ {
thisUser.addSubGroup(subGrp);
- } else {
+ }
+ else
+ {
GroupManager.logger.warning("Subgroup '" + o.toString() + "' not found for user: " + thisUser.getName() + ". Ignoring entry in file: " + usersFile.getPath());
}
}
- } else if (nodeData instanceof String) {
+ }
+ else if (nodeData instanceof String)
+ {
Group subGrp = ph.getGroup(nodeData.toString());
- if (subGrp != null) {
+ if (subGrp != null)
+ {
thisUser.addSubGroup(subGrp);
- } else {
+ }
+ else
+ {
GroupManager.logger.warning("Subgroup '" + nodeData.toString() + "' not found for user: " + thisUser.getName() + ". Ignoring entry in file: " + usersFile.getPath());
}
}
@@ -870,42 +1090,58 @@ public class WorldDataHolder {
// USER INFO NODE
nodeData = null;
- try {
+ try
+ {
nodeData = thisUserNode.get("info");
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
throw new IllegalArgumentException("Bad format found in 'info' section for user: " + usersKey + " in file: " + usersFile.getPath());
}
- if (nodeData == null) {
+ if (nodeData == null)
+ {
/*
* If no info node is found, or it's empty
* do nothing.
*/
- } else if (nodeData instanceof Map) {
- thisUser.setVariables((Map<String, Object>) nodeData);
+ }
+ else if (nodeData instanceof Map)
+ {
+ thisUser.setVariables((Map<String, Object>)nodeData);
- } else
+ }
+ else
+ {
throw new IllegalArgumentException("Unknown entry found in 'info' section for user: " + thisUser.getName() + " in file: " + usersFile.getPath());
+ }
// END INFO NODE
// PRIMARY GROUP
nodeData = null;
- try {
+ try
+ {
nodeData = thisUserNode.get("group");
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
throw new IllegalArgumentException("Bad format found in 'group' section for user: " + usersKey + " in file: " + usersFile.getPath());
}
- if (nodeData != null) {
+ if (nodeData != null)
+ {
Group hisGroup = ph.getGroup(nodeData.toString());
- if (hisGroup == null) {
+ if (hisGroup == null)
+ {
GroupManager.logger.warning("There is no group " + thisUserNode.get("group").toString() + ", as stated for player " + thisUser.getName() + ": Set to '" + ph.getDefaultGroup().getName() + "' for file: " + usersFile.getPath());
hisGroup = ph.getDefaultGroup();
}
thisUser.setGroup(hisGroup);
- } else {
+ }
+ else
+ {
thisUser.setGroup(ph.getDefaultGroup());
}
}
@@ -919,24 +1155,27 @@ public class WorldDataHolder {
/**
* Write a dataHolder in a specified file
- *
+ *
* @param ph
* @param groupsFile
*/
- public static void writeGroups(WorldDataHolder ph, File groupsFile) {
+ public static void writeGroups(WorldDataHolder ph, File groupsFile)
+ {
Map<String, Object> root = new HashMap<String, Object>();
Map<String, Object> groupsMap = new HashMap<String, Object>();
root.put("groups", groupsMap);
- for (String groupKey : ph.getGroups().keySet()) {
+ for (String groupKey : ph.getGroups().keySet())
+ {
Group group = ph.getGroups().get(groupKey);
Map<String, Object> aGroupMap = new HashMap<String, Object>();
groupsMap.put(group.getName(), aGroupMap);
- if (ph.getDefaultGroup() == null) {
+ if (ph.getDefaultGroup() == null)
+ {
GroupManager.logger.severe("There is no default group for world: " + ph.getName());
}
aGroupMap.put("default", group.equals(ph.getDefaultGroup()));
@@ -944,7 +1183,8 @@ public class WorldDataHolder {
Map<String, Object> infoMap = new HashMap<String, Object>();
aGroupMap.put("info", infoMap);
- for (String infoKey : group.getVariables().getVarKeyList()) {
+ for (String infoKey : group.getVariables().getVarKeyList())
+ {
infoMap.put(infoKey, group.getVariables().getVarObject(infoKey));
}
@@ -953,11 +1193,13 @@ public class WorldDataHolder {
aGroupMap.put("permissions", group.getPermissionList());
}
- if (!root.isEmpty()) {
+ if (!root.isEmpty())
+ {
DumperOptions opt = new DumperOptions();
opt.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
final Yaml yaml = new Yaml(opt);
- try {
+ try
+ {
OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(groupsFile), "UTF-8");
String newLine = System.getProperty("line.separator");
@@ -975,9 +1217,15 @@ public class WorldDataHolder {
yaml.dump(root, out);
out.close();
- } catch (UnsupportedEncodingException ex) {
- } catch (FileNotFoundException ex) {
- } catch (IOException e) {
+ }
+ catch (UnsupportedEncodingException ex)
+ {
+ }
+ catch (FileNotFoundException ex)
+ {
+ }
+ catch (IOException e)
+ {
}
}
@@ -987,7 +1235,9 @@ public class WorldDataHolder {
ph.removeGroupsChangedFlag();
if (GroupManager.isLoaded())
+ {
GroupManagerEventHandler.callEvent(GMSystemEvent.Action.SAVED);
+ }
/*
* FileWriter tx = null;
@@ -1007,35 +1257,43 @@ public class WorldDataHolder {
/**
* Write a dataHolder in a specified file
- *
+ *
* @param ph
* @param usersFile
*/
- public static void writeUsers(WorldDataHolder ph, File usersFile) {
+ public static void writeUsers(WorldDataHolder ph, File usersFile)
+ {
Map<String, Object> root = new HashMap<String, Object>();
Map<String, Object> usersMap = new HashMap<String, Object>();
root.put("users", usersMap);
- for (String userKey : ph.getUsers().keySet()) {
+ for (String userKey : ph.getUsers().keySet())
+ {
User user = ph.getUsers().get(userKey);
- if ((user.getGroup() == null || user.getGroup().equals(ph.getDefaultGroup())) && user.getPermissionList().isEmpty() && user.getVariables().isEmpty() && user.isSubGroupsEmpty()) {
+ if ((user.getGroup() == null || user.getGroup().equals(ph.getDefaultGroup())) && user.getPermissionList().isEmpty() && user.getVariables().isEmpty() && user.isSubGroupsEmpty())
+ {
continue;
}
Map<String, Object> aUserMap = new HashMap<String, Object>();
usersMap.put(user.getName(), aUserMap);
- if (user.getGroup() == null) {
+ if (user.getGroup() == null)
+ {
aUserMap.put("group", ph.getDefaultGroup().getName());
- } else {
+ }
+ else
+ {
aUserMap.put("group", user.getGroup().getName());
}
// USER INFO NODE - BETA
- if (user.getVariables().getSize() > 0) {
+ if (user.getVariables().getSize() > 0)
+ {
Map<String, Object> infoMap = new HashMap<String, Object>();
aUserMap.put("info", infoMap);
- for (String infoKey : user.getVariables().getVarKeyList()) {
+ for (String infoKey : user.getVariables().getVarKeyList())
+ {
infoMap.put(infoKey, user.getVariables().getVarObject(infoKey));
}
}
@@ -1047,17 +1305,25 @@ public class WorldDataHolder {
// END SUBGROUPS NODE - BETA
}
- if (!root.isEmpty()) {
+ if (!root.isEmpty())
+ {
DumperOptions opt = new DumperOptions();
opt.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
final Yaml yaml = new Yaml(opt);
- try {
+ try
+ {
OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(usersFile), "UTF-8");
yaml.dump(root, out);
out.close();
- } catch (UnsupportedEncodingException ex) {
- } catch (FileNotFoundException ex) {
- } catch (IOException e) {
+ }
+ catch (UnsupportedEncodingException ex)
+ {
+ }
+ catch (FileNotFoundException ex)
+ {
+ }
+ catch (IOException e)
+ {
}
}
@@ -1067,7 +1333,9 @@ public class WorldDataHolder {
ph.removeUsersChangedFlag();
if (GroupManager.isLoaded())
+ {
GroupManagerEventHandler.callEvent(GMSystemEvent.Action.SAVED);
+ }
/*
* FileWriter tx = null;
@@ -1086,32 +1354,31 @@ public class WorldDataHolder {
}
/**
- * Don't use this. Unless you want to make this plugin to interact with
- * original Nijikokun Permissions
- * This method is supposed to make the original one reload the file, and
- * propagate the changes made here.
- *
- * Prefer to use the AnjoCaido's fake version of Nijikokun's Permission
- * plugin.
- * The AnjoCaido's Permission can propagate the changes made on this plugin
- * instantly,
- * without need to save the file.
- *
+ * Don't use this. Unless you want to make this plugin to interact with original Nijikokun Permissions This method
+ * is supposed to make the original one reload the file, and propagate the changes made here.
+ *
+ * Prefer to use the AnjoCaido's fake version of Nijikokun's Permission plugin. The AnjoCaido's Permission can
+ * propagate the changes made on this plugin instantly, without need to save the file.
+ *
* @param server the server that holds the plugin
- * @deprecated it is not used anymore... unless if you use original
- * Permissions
+ * @deprecated it is not used anymore... unless if you use original Permissions
*/
@Deprecated
- public static void reloadOldPlugins(Server server) {
+ public static void reloadOldPlugins(Server server)
+ {
// Only reload permissions
PluginManager pm = server.getPluginManager();
Plugin[] plugins = pm.getPlugins();
- for (int i = 0; i < plugins.length; i++) {
+ for (int i = 0; i < plugins.length; i++)
+ {
// plugins[i].getConfiguration().load();
- try {
+ try
+ {
plugins[i].getClass().getMethod("setupPermissions").invoke(plugins[i]);
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
continue;
}
}
@@ -1120,9 +1387,11 @@ public class WorldDataHolder {
/**
* @return the permissionsHandler
*/
- public AnjoPermissionsHandler getPermissionsHandler() {
+ public AnjoPermissionsHandler getPermissionsHandler()
+ {
- if (permissionsHandler == null) {
+ if (permissionsHandler == null)
+ {
permissionsHandler = new AnjoPermissionsHandler(this);
}
return permissionsHandler;
@@ -1131,22 +1400,27 @@ public class WorldDataHolder {
/**
* @param haveUsersChanged the haveUsersChanged to set
*/
- public void setUsersChanged(boolean haveUsersChanged) {
+ public void setUsersChanged(boolean haveUsersChanged)
+ {
users.setUsersChanged(haveUsersChanged);
}
/**
- *
+ *
* @return true if any user data has changed
*/
- public boolean haveUsersChanged() {
+ public boolean haveUsersChanged()
+ {
- if (users.HaveUsersChanged()) {
+ if (users.HaveUsersChanged())
+ {
return true;
}
- for (User u : users.getUsers().values()) {
- if (u.isChanged()) {
+ for (User u : users.getUsers().values())
+ {
+ if (u.isChanged())
+ {
return true;
}
}
@@ -1156,22 +1430,27 @@ public class WorldDataHolder {
/**
* @param setGroupsChanged the haveGroupsChanged to set
*/
- public void setGroupsChanged(boolean setGroupsChanged) {
+ public void setGroupsChanged(boolean setGroupsChanged)
+ {
groups.setGroupsChanged(setGroupsChanged);
}
/**
- *
+ *
* @return true if any group data has changed.
*/
- public boolean haveGroupsChanged() {
+ public boolean haveGroupsChanged()
+ {
- if (groups.HaveGroupsChanged()) {
+ if (groups.HaveGroupsChanged())
+ {
return true;
}
- for (Group g : groups.getGroups().values()) {
- if (g.isChanged()) {
+ for (Group g : groups.getGroups().values())
+ {
+ if (g.isChanged())
+ {
return true;
}
}
@@ -1179,23 +1458,27 @@ public class WorldDataHolder {
}
/**
- *
- */
- public void removeUsersChangedFlag() {
+ *
+ */
+ public void removeUsersChangedFlag()
+ {
setUsersChanged(false);
- for (User u : getUsers().values()) {
+ for (User u : getUsers().values())
+ {
u.flagAsSaved();
}
}
/**
- *
- */
- public void removeGroupsChangedFlag() {
+ *
+ */
+ public void removeGroupsChangedFlag()
+ {
setGroupsChanged(false);
- for (Group g : getGroups().values()) {
+ for (Group g : getGroups().values())
+ {
g.flagAsSaved();
}
}
@@ -1203,7 +1486,8 @@ public class WorldDataHolder {
/**
* @return the usersFile
*/
- public File getUsersFile() {
+ public File getUsersFile()
+ {
return users.getUsersFile();
}
@@ -1211,7 +1495,8 @@ public class WorldDataHolder {
/**
* @param file the usersFile to set
*/
- public void setUsersFile(File file) {
+ public void setUsersFile(File file)
+ {
users.setUsersFile(file);
}
@@ -1219,7 +1504,8 @@ public class WorldDataHolder {
/**
* @return the groupsFile
*/
- public File getGroupsFile() {
+ public File getGroupsFile()
+ {
return groups.getGroupsFile();
}
@@ -1227,7 +1513,8 @@ public class WorldDataHolder {
/**
* @param file the groupsFile to set
*/
- public void setGroupsFile(File file) {
+ public void setGroupsFile(File file)
+ {
groups.setGroupsFile(file);
}
@@ -1235,7 +1522,8 @@ public class WorldDataHolder {
/**
* @return the name
*/
- public String getName() {
+ public String getName()
+ {
return name;
}
@@ -1243,7 +1531,8 @@ public class WorldDataHolder {
/**
* Resets Groups.
*/
- public void resetGroups() {
+ public void resetGroups()
+ {
// setDefaultGroup(null);
groups.setGroups(new HashMap<String, Group>());
@@ -1252,7 +1541,8 @@ public class WorldDataHolder {
/**
* Resets Users
*/
- public void resetUsers() {
+ public void resetUsers()
+ {
users.setUsers(new HashMap<String, User>());
}
@@ -1260,7 +1550,8 @@ public class WorldDataHolder {
/**
* @return the groups
*/
- public Map<String, Group> getGroups() {
+ public Map<String, Group> getGroups()
+ {
return groups.getGroups();
}
@@ -1268,7 +1559,8 @@ public class WorldDataHolder {
/**
* @return the users
*/
- public Map<String, User> getUsers() {
+ public Map<String, User> getUsers()
+ {
return users.getUsers();
}
@@ -1276,7 +1568,8 @@ public class WorldDataHolder {
/**
* @return the groups
*/
- public GroupsDataHolder getGroupsObject() {
+ public GroupsDataHolder getGroupsObject()
+ {
return groups;
}
@@ -1284,7 +1577,8 @@ public class WorldDataHolder {
/**
* @param groupsDataHolder the GroupsDataHolder to set
*/
- public void setGroupsObject(GroupsDataHolder groupsDataHolder) {
+ public void setGroupsObject(GroupsDataHolder groupsDataHolder)
+ {
groups = groupsDataHolder;
}
@@ -1292,7 +1586,8 @@ public class WorldDataHolder {
/**
* @return the users
*/
- public UsersDataHolder getUsersObject() {
+ public UsersDataHolder getUsersObject()
+ {
return users;
}
@@ -1300,7 +1595,8 @@ public class WorldDataHolder {
/**
* @param usersDataHolder the UsersDataHolder to set
*/
- public void setUsersObject(UsersDataHolder usersDataHolder) {
+ public void setUsersObject(UsersDataHolder usersDataHolder)
+ {
users = usersDataHolder;
}
@@ -1308,7 +1604,8 @@ public class WorldDataHolder {
/**
* @return the timeStampGroups
*/
- public long getTimeStampGroups() {
+ public long getTimeStampGroups()
+ {
return groups.getTimeStampGroups();
}
@@ -1316,7 +1613,8 @@ public class WorldDataHolder {
/**
* @return the timeStampUsers
*/
- public long getTimeStampUsers() {
+ public long getTimeStampUsers()
+ {
return users.getTimeStampUsers();
}
@@ -1324,7 +1622,8 @@ public class WorldDataHolder {
/**
* @param timeStampGroups the timeStampGroups to set
*/
- protected void setTimeStampGroups(long timeStampGroups) {
+ protected void setTimeStampGroups(long timeStampGroups)
+ {
groups.setTimeStampGroups(timeStampGroups);
}
@@ -1332,17 +1631,22 @@ public class WorldDataHolder {
/**
* @param timeStampUsers the timeStampUsers to set
*/
- protected void setTimeStampUsers(long timeStampUsers) {
+ protected void setTimeStampUsers(long timeStampUsers)
+ {
users.setTimeStampUsers(timeStampUsers);
}
- public void setTimeStamps() {
+ public void setTimeStamps()
+ {
if (getGroupsFile() != null)
+ {
setTimeStampGroups(getGroupsFile().lastModified());
+ }
if (getUsersFile() != null)
+ {
setTimeStampUsers(getUsersFile().lastModified());
+ }
}
-
}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java
index 27a7d9a59..b5238c058 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java
@@ -25,55 +25,58 @@ import org.bukkit.World;
import org.bukkit.configuration.MemorySection;
import org.bukkit.entity.Player;
+
/**
- *
+ *
* @author gabrielcouto
*/
-public class WorldsHolder {
-
+public class WorldsHolder
+{
/**
* Map with instances of loaded worlds.
*/
private Map<String, OverloadedWorldHolder> worldsData = new HashMap<String, OverloadedWorldHolder>();
-
/**
- * Map of mirrors: <nonExistingWorldName, existingAndLoadedWorldName>
- * The key is the mirror.
- * The object is the mirrored.
- *
+ * Map of mirrors: <nonExistingWorldName, existingAndLoadedWorldName> The key is the mirror. The object is the
+ * mirrored.
+ *
* Mirror shows the same data of mirrored.
*/
private Map<String, String> mirrorsGroup = new HashMap<String, String>();
private Map<String, String> mirrorsUser = new HashMap<String, String>();
-
private String serverDefaultWorldName;
private GroupManager plugin;
private File worldsFolder;
/**
- *
+ *
* @param plugin
*/
- public WorldsHolder(GroupManager plugin) {
+ public WorldsHolder(GroupManager plugin)
+ {
this.plugin = plugin;
resetWorldsHolder();
}
-
- public void resetWorldsHolder() {
-
+
+ public void resetWorldsHolder()
+ {
+
worldsData = new HashMap<String, OverloadedWorldHolder>();
mirrorsGroup = new HashMap<String, String>();
mirrorsUser = new HashMap<String, String>();
-
+
// Setup folders and check files exist for the primary world
verifyFirstRun();
initialLoad();
if (serverDefaultWorldName == null)
+ {
throw new IllegalStateException("There is no default group! OMG!");
+ }
}
- private void initialLoad() {
+ private void initialLoad()
+ {
// load the initial world
initialWorldLoading();
@@ -83,14 +86,16 @@ public class WorldsHolder {
loadAllSearchedWorlds();
}
- private void initialWorldLoading() {
+ private void initialWorldLoading()
+ {
//Load the default world
loadWorld(serverDefaultWorldName);
//defaultWorld = getUpdatedWorldData(serverDefaultWorldName);
}
- private void loadAllSearchedWorlds() {
+ private void loadAllSearchedWorlds()
+ {
/*
* Read all known worlds from Bukkit
@@ -98,21 +103,28 @@ public class WorldsHolder {
* and they are not mirrored.
*/
for (World world : plugin.getServer().getWorlds())
+ {
if ((!worldsData.containsKey(world.getName().toLowerCase())) && ((!mirrorsGroup.containsKey(world.getName().toLowerCase())) || (!mirrorsUser.containsKey(world.getName().toLowerCase()))))
+ {
setupWorldFolder(world.getName());
+ }
+ }
/*
* Loop over all folders within the worlds folder
* and attempt to load the world data
*/
- for (File folder : worldsFolder.listFiles()) {
- if (folder.isDirectory()) {
+ for (File folder : worldsFolder.listFiles())
+ {
+ if (folder.isDirectory())
+ {
GroupManager.logger.info("World Found: " + folder.getName());
/*
* don't load any worlds which are already loaded
* or fully mirrored worlds that don't need data.
*/
- if (!worldsData.containsKey(folder.getName().toLowerCase()) && ((!mirrorsGroup.containsKey(folder.getName().toLowerCase())) || (!mirrorsUser.containsKey(folder.getName().toLowerCase())))) {
+ if (!worldsData.containsKey(folder.getName().toLowerCase()) && ((!mirrorsGroup.containsKey(folder.getName().toLowerCase())) || (!mirrorsUser.containsKey(folder.getName().toLowerCase()))))
+ {
/*
* Call setupWorldFolder to check case sensitivity
* and convert to lower case, before we attempt to load this
@@ -127,7 +139,8 @@ public class WorldsHolder {
}
@SuppressWarnings("rawtypes")
- public void mirrorSetUp() {
+ public void mirrorSetUp()
+ {
mirrorsGroup.clear();
mirrorsUser.clear();
@@ -135,25 +148,35 @@ public class WorldsHolder {
HashSet<String> mirroredWorlds = new HashSet<String>();
- if (mirrorsMap != null) {
- for (String source : mirrorsMap.keySet()) {
+ if (mirrorsMap != null)
+ {
+ for (String source : mirrorsMap.keySet())
+ {
// Make sure all non mirrored worlds have a set of data files.
setupWorldFolder(source);
// Load the world data
if (!worldsData.containsKey(source.toLowerCase()))
+ {
loadWorld(source);
+ }
- if (mirrorsMap.get(source) instanceof ArrayList) {
- ArrayList mirrorList = (ArrayList) mirrorsMap.get(source);
+ if (mirrorsMap.get(source) instanceof ArrayList)
+ {
+ ArrayList mirrorList = (ArrayList)mirrorsMap.get(source);
// These worlds fully mirror their parent
- for (Object o : mirrorList) {
+ for (Object o : mirrorList)
+ {
String world = o.toString().toLowerCase();
- if (world != serverDefaultWorldName) {
- try {
+ if (world != serverDefaultWorldName)
+ {
+ try
+ {
mirrorsGroup.remove(world);
mirrorsUser.remove(world);
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
}
mirrorsGroup.put(world, getWorldData(source).getName());
mirrorsUser.put(world, getWorldData(source).getName());
@@ -161,45 +184,70 @@ public class WorldsHolder {
// Track this world so we can create a datasource for it later
mirroredWorlds.add(o.toString());
- } else
+ }
+ else
+ {
GroupManager.logger.log(Level.WARNING, "Mirroring error with " + o.toString() + ". Recursive loop detected!");
+ }
}
- } else if (mirrorsMap.get(source) instanceof MemorySection) {
- MemorySection subSection = (MemorySection) mirrorsMap.get(source);
+ }
+ else if (mirrorsMap.get(source) instanceof MemorySection)
+ {
+ MemorySection subSection = (MemorySection)mirrorsMap.get(source);
- for (String key : subSection.getKeys(true)) {
+ for (String key : subSection.getKeys(true))
+ {
- if (key.toLowerCase() != serverDefaultWorldName) {
+ if (key.toLowerCase() != serverDefaultWorldName)
+ {
- if (subSection.get(key) instanceof ArrayList) {
- ArrayList mirrorList = (ArrayList) subSection.get(key);
+ if (subSection.get(key) instanceof ArrayList)
+ {
+ ArrayList mirrorList = (ArrayList)subSection.get(key);
// These worlds have defined mirroring
- for (Object o : mirrorList) {
+ for (Object o : mirrorList)
+ {
String type = o.toString().toLowerCase();
- try {
+ try
+ {
if (type.equals("groups"))
+ {
mirrorsGroup.remove(key.toLowerCase());
+ }
if (type.equals("users"))
+ {
mirrorsUser.remove(key.toLowerCase());
+ }
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
}
if (type.equals("groups"))
+ {
mirrorsGroup.put(key.toLowerCase(), getWorldData(source).getName());
+ }
if (type.equals("users"))
+ {
mirrorsUser.put(key.toLowerCase(), getWorldData(source).getName());
+ }
}
// Track this world so we can create a datasource for it later
mirroredWorlds.add(key);
- } else
+ }
+ else
+ {
GroupManager.logger.log(Level.WARNING, "Mirroring error with " + key + ". Recursive loop detected!");
+ }
- } else {
+ }
+ else
+ {
throw new IllegalStateException("Unknown mirroring format for " + key);
}
@@ -208,8 +256,10 @@ public class WorldsHolder {
}
// Create a datasource for any worlds not already loaded
- for (String world : mirroredWorlds) {
- if (!worldsData.containsKey(world.toLowerCase())) {
+ for (String world : mirroredWorlds)
+ {
+ if (!worldsData.containsKey(world.toLowerCase()))
+ {
setupWorldFolder(world);
loadWorld(world, true);
}
@@ -218,22 +268,29 @@ public class WorldsHolder {
}
/**
- *
- */
- public void reloadAll() {
+ *
+ */
+ public void reloadAll()
+ {
// Load global groups
GroupManager.getGlobalGroups().load();
ArrayList<WorldDataHolder> alreadyDone = new ArrayList<WorldDataHolder>();
- for (WorldDataHolder w : worldsData.values()) {
- if (alreadyDone.contains(w)) {
+ for (WorldDataHolder w : worldsData.values())
+ {
+ if (alreadyDone.contains(w))
+ {
continue;
}
if (!mirrorsGroup.containsKey(w.getName().toLowerCase()))
+ {
w.reloadGroups();
+ }
if (!mirrorsUser.containsKey(w.getName().toLowerCase()))
+ {
w.reloadUsers();
+ }
alreadyDone.add(w);
}
@@ -241,134 +298,170 @@ public class WorldsHolder {
}
/**
- *
+ *
* @param worldName
*/
- public void reloadWorld(String worldName) {
+ public void reloadWorld(String worldName)
+ {
if (!mirrorsGroup.containsKey(worldName.toLowerCase()))
+ {
getWorldData(worldName).reloadGroups();
+ }
if (!mirrorsUser.containsKey(worldName.toLowerCase()))
+ {
getWorldData(worldName).reloadUsers();
+ }
}
/**
- * Wrapper to retain backwards compatibility
- * (call this function to auto overwrite files)
+ * Wrapper to retain backwards compatibility (call this function to auto overwrite files)
*/
- public void saveChanges() {
+ public void saveChanges()
+ {
saveChanges(true);
}
/**
- *
- */
- public void saveChanges(boolean overwrite) {
+ *
+ */
+ public void saveChanges(boolean overwrite)
+ {
ArrayList<WorldDataHolder> alreadyDone = new ArrayList<WorldDataHolder>();
Tasks.removeOldFiles(plugin, plugin.getBackupFolder());
// Write Global Groups
- if (GroupManager.getGlobalGroups().haveGroupsChanged()) {
+ if (GroupManager.getGlobalGroups().haveGroupsChanged())
+ {
GroupManager.getGlobalGroups().writeGroups(overwrite);
- } else {
- if (GroupManager.getGlobalGroups().getTimeStampGroups() < GroupManager.getGlobalGroups().getGlobalGroupsFile().lastModified()) {
+ }
+ else
+ {
+ if (GroupManager.getGlobalGroups().getTimeStampGroups() < GroupManager.getGlobalGroups().getGlobalGroupsFile().lastModified())
+ {
System.out.print("Newer GlobalGroups file found (Loading changes)!");
GroupManager.getGlobalGroups().load();
}
}
- for (OverloadedWorldHolder w : worldsData.values()) {
- if (alreadyDone.contains(w)) {
+ for (OverloadedWorldHolder w : worldsData.values())
+ {
+ if (alreadyDone.contains(w))
+ {
continue;
}
- if (w == null) {
+ if (w == null)
+ {
GroupManager.logger.severe("WHAT HAPPENED?");
continue;
}
if (!mirrorsGroup.containsKey(w.getName().toLowerCase()))
- if (w.haveGroupsChanged()) {
- if (overwrite || (!overwrite && (w.getTimeStampGroups() >= w.getGroupsFile().lastModified()))) {
+ {
+ if (w.haveGroupsChanged())
+ {
+ if (overwrite || (!overwrite && (w.getTimeStampGroups() >= w.getGroupsFile().lastModified())))
+ {
// Backup Groups file
backupFile(w, true);
WorldDataHolder.writeGroups(w, w.getGroupsFile());
//w.removeGroupsChangedFlag();
- } else {
+ }
+ else
+ {
// Newer file found.
GroupManager.logger.log(Level.WARNING, "Newer Groups file found for " + w.getName() + ", but we have local changes!");
throw new IllegalStateException("Unable to save unless you issue a '/mansave force'");
}
- } else {
+ }
+ else
+ {
//Check for newer file as no local changes.
- if (w.getTimeStampGroups() < w.getGroupsFile().lastModified()) {
+ if (w.getTimeStampGroups() < w.getGroupsFile().lastModified())
+ {
System.out.print("Newer Groups file found (Loading changes)!");
// Backup Groups file
backupFile(w, true);
w.reloadGroups();
}
}
+ }
if (!mirrorsUser.containsKey(w.getName().toLowerCase()))
- if (w.haveUsersChanged()) {
- if (overwrite || (!overwrite && (w.getTimeStampUsers() >= w.getUsersFile().lastModified()))) {
+ {
+ if (w.haveUsersChanged())
+ {
+ if (overwrite || (!overwrite && (w.getTimeStampUsers() >= w.getUsersFile().lastModified())))
+ {
// Backup Users file
backupFile(w, false);
WorldDataHolder.writeUsers(w, w.getUsersFile());
//w.removeUsersChangedFlag();
- } else {
+ }
+ else
+ {
// Newer file found.
GroupManager.logger.log(Level.WARNING, "Newer Users file found for " + w.getName() + ", but we have local changes!");
throw new IllegalStateException("Unable to save unless you issue a '/mansave force'");
}
- } else {
+ }
+ else
+ {
//Check for newer file as no local changes.
- if (w.getTimeStampUsers() < w.getUsersFile().lastModified()) {
+ if (w.getTimeStampUsers() < w.getUsersFile().lastModified())
+ {
System.out.print("Newer Users file found (Loading changes)!");
// Backup Users file
backupFile(w, false);
w.reloadUsers();
}
}
+ }
alreadyDone.add(w);
}
}
/**
* Backup the Groups/Users file
- *
+ *
* @param w
* @param groups
*/
- private void backupFile(OverloadedWorldHolder w, Boolean groups) {
+ private void backupFile(OverloadedWorldHolder w, Boolean groups)
+ {
File backupFile = new File(plugin.getBackupFolder(), "bkp_" + w.getName() + (groups ? "_g_" : "_u_") + Tasks.getDateString() + ".yml");
- try {
+ try
+ {
Tasks.copy((groups ? w.getGroupsFile() : w.getUsersFile()), backupFile);
- } catch (IOException ex) {
+ }
+ catch (IOException ex)
+ {
GroupManager.logger.log(Level.SEVERE, null, ex);
}
}
/**
- * Returns the dataHolder for the given world.
- * If the world is not on the worlds list, returns the default world
+ * Returns the dataHolder for the given world. If the world is not on the worlds list, returns the default world
* holder.
- *
- * Mirrors return their parent world data.
- * If no mirroring data it returns the default world.
- *
+ *
+ * Mirrors return their parent world data. If no mirroring data it returns the default world.
+ *
* @param worldName
* @return OverloadedWorldHolder
*/
- public OverloadedWorldHolder getWorldData(String worldName) {
+ public OverloadedWorldHolder getWorldData(String worldName)
+ {
String worldNameLowered = worldName.toLowerCase();
// Find this worlds data
if (worldsData.containsKey(worldNameLowered))
+ {
return getUpdatedWorldData(worldNameLowered);
+ }
// Oddly no data source was found for this world so return the default.
GroupManager.logger.finest("Requested world " + worldName + " not found or badly mirrored. Returning default world...");
@@ -376,17 +469,18 @@ public class WorldsHolder {
}
/**
- * Get the requested world data and update it's dataSource to be relevant
- * for this world
- *
+ * Get the requested world data and update it's dataSource to be relevant for this world
+ *
* @param worldName
* @return updated world holder
*/
- private OverloadedWorldHolder getUpdatedWorldData(String worldName) {
+ private OverloadedWorldHolder getUpdatedWorldData(String worldName)
+ {
String worldNameLowered = worldName.toLowerCase();
- if (worldsData.containsKey(worldNameLowered)) {
+ if (worldsData.containsKey(worldNameLowered))
+ {
OverloadedWorldHolder data = worldsData.get(worldNameLowered);
data.updateDataSource();
return data;
@@ -396,134 +490,160 @@ public class WorldsHolder {
}
/**
- * Do a matching of playerName, if its found only one player, do
- * getWorldData(player)
- *
+ * Do a matching of playerName, if its found only one player, do getWorldData(player)
+ *
* @param playerName
* @return null if matching returned no player, or more than one.
*/
- public OverloadedWorldHolder getWorldDataByPlayerName(String playerName) {
+ public OverloadedWorldHolder getWorldDataByPlayerName(String playerName)
+ {
List<Player> matchPlayer = plugin.getServer().matchPlayer(playerName);
- if (matchPlayer.size() == 1) {
+ if (matchPlayer.size() == 1)
+ {
return getWorldData(matchPlayer.get(0));
}
return null;
}
/**
- * Retrieves the field player.getWorld().getName() and do
- * getWorld(worldName)
- *
+ * Retrieves the field player.getWorld().getName() and do getWorld(worldName)
+ *
* @param player
* @return OverloadedWorldHolder
*/
- public OverloadedWorldHolder getWorldData(Player player) {
+ public OverloadedWorldHolder getWorldData(Player player)
+ {
return getWorldData(player.getWorld().getName());
}
/**
* It does getWorld(worldName).getPermissionsHandler()
- *
+ *
* @param worldName
* @return AnjoPermissionsHandler
*/
- public AnjoPermissionsHandler getWorldPermissions(String worldName) {
+ public AnjoPermissionsHandler getWorldPermissions(String worldName)
+ {
return getWorldData(worldName).getPermissionsHandler();
}
/**
* Returns the PermissionsHandler for this player data
- *
+ *
* @param player
* @return AnjoPermissionsHandler
*/
- public AnjoPermissionsHandler getWorldPermissions(Player player) {
+ public AnjoPermissionsHandler getWorldPermissions(Player player)
+ {
return getWorldData(player).getPermissionsHandler();
}
/**
- * Id does getWorldDataByPlayerName(playerName).
- * If it doesnt return null, it will return result.getPermissionsHandler()
- *
+ * Id does getWorldDataByPlayerName(playerName). If it doesnt return null, it will return
+ * result.getPermissionsHandler()
+ *
* @param playerName
* @return null if the player matching gone wrong.
*/
- public AnjoPermissionsHandler getWorldPermissionsByPlayerName(String playerName) {
+ public AnjoPermissionsHandler getWorldPermissionsByPlayerName(String playerName)
+ {
WorldDataHolder dh = getWorldDataByPlayerName(playerName);
- if (dh != null) {
+ if (dh != null)
+ {
return dh.getPermissionsHandler();
}
return null;
}
- private void verifyFirstRun() {
+ private void verifyFirstRun()
+ {
Properties server = new Properties();
- try {
+ try
+ {
server.load(new FileInputStream(new File("server.properties")));
serverDefaultWorldName = server.getProperty("level-name").toLowerCase();
setupWorldFolder(serverDefaultWorldName);
- } catch (IOException ex) {
+ }
+ catch (IOException ex)
+ {
GroupManager.logger.log(Level.SEVERE, null, ex);
}
}
- public void setupWorldFolder(String worldName) {
+ public void setupWorldFolder(String worldName)
+ {
String worldNameLowered = worldName.toLowerCase();
worldsFolder = new File(plugin.getDataFolder(), "worlds");
- if (!worldsFolder.exists()) {
+ if (!worldsFolder.exists())
+ {
worldsFolder.mkdirs();
}
File defaultWorldFolder = new File(worldsFolder, worldNameLowered);
- if ((!defaultWorldFolder.exists()) && ((!mirrorsGroup.containsKey(worldNameLowered))) || (!mirrorsUser.containsKey(worldNameLowered))) {
+ if ((!defaultWorldFolder.exists()) && ((!mirrorsGroup.containsKey(worldNameLowered))) || (!mirrorsUser.containsKey(worldNameLowered)))
+ {
/*
* check and convert all old case sensitive folders to lower case
*/
File casedWorldFolder = new File(worldsFolder, worldName);
- if ((casedWorldFolder.exists()) && (casedWorldFolder.getName().toLowerCase().equals(worldNameLowered))) {
+ if ((casedWorldFolder.exists()) && (casedWorldFolder.getName().toLowerCase().equals(worldNameLowered)))
+ {
/*
* Rename the old folder to the new lower cased format
*/
casedWorldFolder.renameTo(new File(worldsFolder, worldNameLowered));
- } else {
+ }
+ else
+ {
/*
* Else we just create the folder
*/
defaultWorldFolder.mkdirs();
}
}
- if (defaultWorldFolder.exists()) {
- if (!mirrorsGroup.containsKey(worldNameLowered)) {
+ if (defaultWorldFolder.exists())
+ {
+ if (!mirrorsGroup.containsKey(worldNameLowered))
+ {
File groupsFile = new File(defaultWorldFolder, "groups.yml");
- if (!groupsFile.exists() || groupsFile.length() == 0) {
+ if (!groupsFile.exists() || groupsFile.length() == 0)
+ {
InputStream template = plugin.getResourceAsStream("groups.yml");
- try {
+ try
+ {
Tasks.copy(template, groupsFile);
- } catch (IOException ex) {
+ }
+ catch (IOException ex)
+ {
GroupManager.logger.log(Level.SEVERE, null, ex);
}
}
}
- if (!mirrorsUser.containsKey(worldNameLowered)) {
+ if (!mirrorsUser.containsKey(worldNameLowered))
+ {
File usersFile = new File(defaultWorldFolder, "users.yml");
- if (!usersFile.exists() || usersFile.length() == 0) {
+ if (!usersFile.exists() || usersFile.length() == 0)
+ {
InputStream template = plugin.getResourceAsStream("users.yml");
- try {
+ try
+ {
Tasks.copy(template, usersFile);
- } catch (IOException ex) {
+ }
+ catch (IOException ex)
+ {
GroupManager.logger.log(Level.SEVERE, null, ex);
}
@@ -534,30 +654,36 @@ public class WorldsHolder {
/**
* Copies the specified world data to another world
- *
+ *
* @param fromWorld
* @param toWorld
* @return true if successfully copied.
*/
- public boolean cloneWorld(String fromWorld, String toWorld) {
+ public boolean cloneWorld(String fromWorld, String toWorld)
+ {
File fromWorldFolder = new File(worldsFolder, fromWorld.toLowerCase());
File toWorldFolder = new File(worldsFolder, toWorld.toLowerCase());
- if (toWorldFolder.exists() || !fromWorldFolder.exists()) {
+ if (toWorldFolder.exists() || !fromWorldFolder.exists())
+ {
return false;
}
File fromWorldGroups = new File(fromWorldFolder, "groups.yml");
File fromWorldUsers = new File(fromWorldFolder, "users.yml");
- if (!fromWorldGroups.exists() || !fromWorldUsers.exists()) {
+ if (!fromWorldGroups.exists() || !fromWorldUsers.exists())
+ {
return false;
}
File toWorldGroups = new File(toWorldFolder, "groups.yml");
File toWorldUsers = new File(toWorldFolder, "users.yml");
toWorldFolder.mkdirs();
- try {
+ try
+ {
Tasks.copy(fromWorldGroups, toWorldGroups);
Tasks.copy(fromWorldUsers, toWorldUsers);
- } catch (IOException ex) {
+ }
+ catch (IOException ex)
+ {
Logger.getLogger(WorldsHolder.class.getName()).log(Level.SEVERE, null, ex);
return false;
}
@@ -566,43 +692,47 @@ public class WorldsHolder {
/**
* Wrapper for LoadWorld(String,Boolean) for backwards compatibility
- *
- * Load a world from file.
- * If it already been loaded, summon reload method from dataHolder.
- *
+ *
+ * Load a world from file. If it already been loaded, summon reload method from dataHolder.
+ *
* @param worldName
*/
- public void loadWorld(String worldName) {
+ public void loadWorld(String worldName)
+ {
loadWorld(worldName, false);
}
/**
- * Load a world from file.
- * If it already been loaded, summon reload method from dataHolder.
- *
+ * Load a world from file. If it already been loaded, summon reload method from dataHolder.
+ *
* @param worldName
*/
- public void loadWorld(String worldName, Boolean isMirror) {
+ public void loadWorld(String worldName, Boolean isMirror)
+ {
String worldNameLowered = worldName.toLowerCase();
- if (worldsData.containsKey(worldNameLowered)) {
+ if (worldsData.containsKey(worldNameLowered))
+ {
worldsData.get(worldNameLowered).reload();
return;
}
GroupManager.logger.finest("Trying to load world " + worldName + "...");
File thisWorldFolder = new File(worldsFolder, worldNameLowered);
- if ((isMirror) || (thisWorldFolder.exists() && thisWorldFolder.isDirectory())) {
+ if ((isMirror) || (thisWorldFolder.exists() && thisWorldFolder.isDirectory()))
+ {
// Setup file handles, if not mirrored
File groupsFile = (mirrorsGroup.containsKey(worldNameLowered)) ? null : new File(thisWorldFolder, "groups.yml");
File usersFile = (mirrorsUser.containsKey(worldNameLowered)) ? null : new File(thisWorldFolder, "users.yml");
- if ((groupsFile != null) && (!groupsFile.exists())) {
+ if ((groupsFile != null) && (!groupsFile.exists()))
+ {
throw new IllegalArgumentException("Groups file for world '" + worldName + "' doesnt exist: " + groupsFile.getPath());
}
- if ((usersFile != null) && (!usersFile.exists())) {
+ if ((usersFile != null) && (!usersFile.exists()))
+ {
throw new IllegalArgumentException("Users file for world '" + worldName + "' doesnt exist: " + usersFile.getPath());
}
@@ -610,15 +740,23 @@ public class WorldsHolder {
// Map the group object for any mirror
if (mirrorsGroup.containsKey(worldNameLowered))
+ {
tempHolder.setGroupsObject(this.getWorldData(mirrorsGroup.get(worldNameLowered)).getGroupsObject());
+ }
else
+ {
tempHolder.loadGroups(groupsFile);
+ }
// Map the user object for any mirror
if (mirrorsUser.containsKey(worldNameLowered))
+ {
tempHolder.setUsersObject(this.getWorldData(mirrorsUser.get(worldNameLowered)).getUsersObject());
+ }
else
+ {
tempHolder.loadUsers(usersFile);
+ }
OverloadedWorldHolder thisWorldData = new OverloadedWorldHolder(tempHolder);
@@ -628,7 +766,8 @@ public class WorldsHolder {
// Set the file TimeStamps as it will be default from the initial load.
thisWorldData.setTimeStamps();
- if (thisWorldData != null) {
+ if (thisWorldData != null)
+ {
GroupManager.logger.finest("Successful load of world " + worldName + "...");
worldsData.put(worldNameLowered, thisWorldData);
return;
@@ -640,15 +779,17 @@ public class WorldsHolder {
/**
* Tells if the such world has been mapped.
- *
+ *
* It will return true if world is a mirror.
- *
+ *
* @param worldName
* @return true if world is loaded or mirrored. false if not listed
*/
- public boolean isInList(String worldName) {
+ public boolean isInList(String worldName)
+ {
- if (worldsData.containsKey(worldName.toLowerCase()) || mirrorsGroup.containsKey(worldName.toLowerCase()) || mirrorsUser.containsKey(worldName.toLowerCase())) {
+ if (worldsData.containsKey(worldName.toLowerCase()) || mirrorsGroup.containsKey(worldName.toLowerCase()) || mirrorsUser.containsKey(worldName.toLowerCase()))
+ {
return true;
}
return false;
@@ -656,13 +797,15 @@ public class WorldsHolder {
/**
* Verify if world has it's own file permissions.
- *
+ *
* @param worldName
* @return true if it has its own holder. false if not.
*/
- public boolean hasOwnData(String worldName) {
+ public boolean hasOwnData(String worldName)
+ {
- if (worldsData.containsKey(worldName.toLowerCase()) && (!mirrorsGroup.containsKey(worldName.toLowerCase()) || !mirrorsUser.containsKey(worldName.toLowerCase()))) {
+ if (worldsData.containsKey(worldName.toLowerCase()) && (!mirrorsGroup.containsKey(worldName.toLowerCase()) || !mirrorsUser.containsKey(worldName.toLowerCase())))
+ {
return true;
}
return false;
@@ -671,37 +814,45 @@ public class WorldsHolder {
/**
* @return the defaultWorld
*/
- public OverloadedWorldHolder getDefaultWorld() {
+ public OverloadedWorldHolder getDefaultWorld()
+ {
return getUpdatedWorldData(serverDefaultWorldName);
}
/**
- * Returns all physically loaded worlds which have at least
- * one of their own data sets for users or groups.
- *
+ * Returns all physically loaded worlds which have at least one of their own data sets for users or groups.
+ *
* @return ArrayList<OverloadedWorldHolder> of all loaded worlds
*/
- public ArrayList<OverloadedWorldHolder> allWorldsDataList() {
+ public ArrayList<OverloadedWorldHolder> allWorldsDataList()
+ {
ArrayList<OverloadedWorldHolder> list = new ArrayList<OverloadedWorldHolder>();
- for (OverloadedWorldHolder data : worldsData.values()) {
- if ((!list.contains(data)) && (!mirrorsGroup.containsKey(data.getName().toLowerCase()) || !mirrorsUser.containsKey(data.getName().toLowerCase()))) {
+ for (OverloadedWorldHolder data : worldsData.values())
+ {
+ if ((!list.contains(data)) && (!mirrorsGroup.containsKey(data.getName().toLowerCase()) || !mirrorsUser.containsKey(data.getName().toLowerCase())))
+ {
String worldNameLowered = data.getName().toLowerCase();
String usersMirror = mirrorsUser.get(worldNameLowered);
String groupsMirror = mirrorsGroup.get(worldNameLowered);
// is users mirrored?
- if (usersMirror != null) {
+ if (usersMirror != null)
+ {
// If both are mirrored
- if (groupsMirror != null) {
+ if (groupsMirror != null)
+ {
// if the data sources are the same, return the parent
- if (usersMirror == groupsMirror) {
+ if (usersMirror == groupsMirror)
+ {
if (!list.contains(usersMirror.toLowerCase()))
+ {
list.add(worldsData.get(usersMirror.toLowerCase()));
+ }
continue;
}
// Both data sources are mirrors, but they are from different parents
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java
index af3fb6135..cb438335b 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java
@@ -6,37 +6,37 @@ import org.bukkit.Bukkit;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
+
/**
* @author ElgarL
- *
+ *
*/
-public class GMGroupEvent extends Event {
-
+public class GMGroupEvent extends Event
+{
/**
- *
+ *
*/
private static final HandlerList handlers = new HandlerList();
@Override
- public HandlerList getHandlers() {
+ public HandlerList getHandlers()
+ {
return handlers;
}
- public static HandlerList getHandlerList() {
+ public static HandlerList getHandlerList()
+ {
return handlers;
}
-
//////////////////////////////
-
protected Group group;
-
protected String groupName;
-
protected Action action;
- public GMGroupEvent(Group group, Action action) {
+ public GMGroupEvent(Group group, Action action)
+ {
super();
@@ -45,7 +45,8 @@ public class GMGroupEvent extends Event {
this.groupName = group.getName();
}
- public GMGroupEvent(String groupName, Action action) {
+ public GMGroupEvent(String groupName, Action action)
+ {
super();
@@ -53,35 +54,43 @@ public class GMGroupEvent extends Event {
this.action = action;
}
- public Action getAction() {
+ public Action getAction()
+ {
return this.action;
}
- public Group getGroup() {
+ public Group getGroup()
+ {
return group;
}
- public String getGroupName() {
+ public String getGroupName()
+ {
return groupName;
}
- public enum Action {
- GROUP_PERMISSIONS_CHANGED, GROUP_INHERITANCE_CHANGED, GROUP_INFO_CHANGED, GROUP_ADDED, GROUP_REMOVED,
- }
- public void schedule(final GMGroupEvent event) {
+ public enum Action
+ {
+ GROUP_PERMISSIONS_CHANGED, GROUP_INHERITANCE_CHANGED, GROUP_INFO_CHANGED, GROUP_ADDED, GROUP_REMOVED,}
- if (Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("GroupManager"), new Runnable() {
+ public void schedule(final GMGroupEvent event)
+ {
+ if (Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("GroupManager"), new Runnable()
+ {
@Override
- public void run() {
+ public void run()
+ {
Bukkit.getServer().getPluginManager().callEvent(event);
}
}, 1) == -1)
+ {
GroupManager.logger.warning("Could not schedule GM Event.");
+ }
}
} \ No newline at end of file
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java
index d11581356..d7f2e276e 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java
@@ -5,58 +5,66 @@ import org.bukkit.Bukkit;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
+
/**
* @author ElgarL
- *
+ *
*/
-public class GMSystemEvent extends Event {
-
+public class GMSystemEvent extends Event
+{
/**
- *
+ *
*/
private static final HandlerList handlers = new HandlerList();
@Override
- public HandlerList getHandlers() {
+ public HandlerList getHandlers()
+ {
return handlers;
}
- public static HandlerList getHandlerList() {
+ public static HandlerList getHandlerList()
+ {
return handlers;
}
-
//////////////////////////////
-
protected Action action;
- public GMSystemEvent(Action action) {
+ public GMSystemEvent(Action action)
+ {
super();
this.action = action;
}
- public Action getAction() {
+ public Action getAction()
+ {
return this.action;
}
- public enum Action {
- RELOADED, SAVED, DEFAULT_GROUP_CHANGED, VALIDATE_TOGGLE,
- }
- public void schedule(final GMSystemEvent event) {
+ public enum Action
+ {
+ RELOADED, SAVED, DEFAULT_GROUP_CHANGED, VALIDATE_TOGGLE,}
- if (Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("GroupManager"), new Runnable() {
+ public void schedule(final GMSystemEvent event)
+ {
+ if (Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("GroupManager"), new Runnable()
+ {
@Override
- public void run() {
+ public void run()
+ {
Bukkit.getServer().getPluginManager().callEvent(event);
}
}, 1) == -1)
+ {
GroupManager.logger.warning("Could not schedule GM Event.");
+ }
}
} \ No newline at end of file
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java
index 0a503cd9c..ed3f71c53 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java
@@ -6,37 +6,37 @@ import org.bukkit.Bukkit;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
+
/**
* @author ElgarL
- *
+ *
*/
-public class GMUserEvent extends Event {
-
+public class GMUserEvent extends Event
+{
/**
- *
+ *
*/
private static final HandlerList handlers = new HandlerList();
@Override
- public HandlerList getHandlers() {
+ public HandlerList getHandlers()
+ {
return handlers;
}
- public static HandlerList getHandlerList() {
+ public static HandlerList getHandlerList()
+ {
return handlers;
}
-
//////////////////////////////
-
protected User user;
-
protected String userName;
-
protected Action action;
- public GMUserEvent(User user, Action action) {
+ public GMUserEvent(User user, Action action)
+ {
super();
@@ -45,7 +45,8 @@ public class GMUserEvent extends Event {
this.userName = user.getName();
}
- public GMUserEvent(String userName, Action action) {
+ public GMUserEvent(String userName, Action action)
+ {
super();
@@ -53,35 +54,43 @@ public class GMUserEvent extends Event {
this.action = action;
}
- public Action getAction() {
+ public Action getAction()
+ {
return this.action;
}
- public User getUser() {
+ public User getUser()
+ {
return user;
}
- public String getUserName() {
+ public String getUserName()
+ {
return userName;
}
- public enum Action {
- USER_PERMISSIONS_CHANGED, USER_INHERITANCE_CHANGED, USER_INFO_CHANGED, USER_GROUP_CHANGED, USER_SUBGROUP_CHANGED, USER_ADDED, USER_REMOVED,
- }
- public void schedule(final GMUserEvent event) {
+ public enum Action
+ {
+ USER_PERMISSIONS_CHANGED, USER_INHERITANCE_CHANGED, USER_INFO_CHANGED, USER_GROUP_CHANGED, USER_SUBGROUP_CHANGED, USER_ADDED, USER_REMOVED,}
- if (Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("GroupManager"), new Runnable() {
+ public void schedule(final GMUserEvent event)
+ {
+ if (Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("GroupManager"), new Runnable()
+ {
@Override
- public void run() {
+ public void run()
+ {
Bukkit.getServer().getPluginManager().callEvent(event);
}
}, 1) == -1)
+ {
GroupManager.logger.warning("Could not schedule GM Event.");
+ }
}
} \ No newline at end of file
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMWorldListener.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMWorldListener.java
index accb65acb..14e6dc43c 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMWorldListener.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMWorldListener.java
@@ -6,41 +6,50 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.world.WorldInitEvent;
+
/**
* @author ElgarL
- *
- * Handle new world creation from other plugins
- *
+ *
+ * Handle new world creation from other plugins
+ *
*/
-public class GMWorldListener implements Listener {
-
+public class GMWorldListener implements Listener
+{
private final GroupManager plugin;
- public GMWorldListener(GroupManager instance) {
+ public GMWorldListener(GroupManager instance)
+ {
plugin = instance;
registerEvents();
}
- private void registerEvents() {
+ private void registerEvents()
+ {
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
@EventHandler(priority = EventPriority.LOWEST)
- public void onWorldInit(WorldInitEvent event) {
+ public void onWorldInit(WorldInitEvent event)
+ {
String worldName = event.getWorld().getName();
- if (GroupManager.isLoaded() && !plugin.getWorldsHolder().isInList(worldName)) {
+ if (GroupManager.isLoaded() && !plugin.getWorldsHolder().isInList(worldName))
+ {
GroupManager.logger.info("New world detected...");
GroupManager.logger.info("Creating data for: " + worldName);
plugin.getWorldsHolder().setupWorldFolder(worldName);
plugin.getWorldsHolder().loadWorld(worldName);
- if (plugin.getWorldsHolder().isInList(worldName)) {
+ if (plugin.getWorldsHolder().isInList(worldName))
+ {
GroupManager.logger.info("Don't forget to configure/mirror this world in config.yml.");
- } else
+ }
+ else
+ {
GroupManager.logger.severe("Failed to configure this world.");
+ }
}
}
} \ No newline at end of file
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEventHandler.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEventHandler.java
index 43d42da53..ee09cbda7 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEventHandler.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEventHandler.java
@@ -3,50 +3,59 @@ package org.anjocaido.groupmanager.events;
import org.anjocaido.groupmanager.data.Group;
import org.anjocaido.groupmanager.data.User;
+
/**
* @author ElgarL
- *
- * Handles all Event generation.
- *
+ *
+ * Handles all Event generation.
+ *
*/
-public class GroupManagerEventHandler {
-
- protected static void callEvent(GMGroupEvent event) {
+public class GroupManagerEventHandler
+{
+ protected static void callEvent(GMGroupEvent event)
+ {
event.schedule(event);
}
- protected static void callEvent(GMUserEvent event) {
+ protected static void callEvent(GMUserEvent event)
+ {
event.schedule(event);
}
- protected static void callEvent(GMSystemEvent event) {
+ protected static void callEvent(GMSystemEvent event)
+ {
event.schedule(event);
}
- public static void callEvent(Group group, GMGroupEvent.Action action) {
+ public static void callEvent(Group group, GMGroupEvent.Action action)
+ {
callEvent(new GMGroupEvent(group, action));
}
- public static void callEvent(String groupName, GMGroupEvent.Action action) {
+ public static void callEvent(String groupName, GMGroupEvent.Action action)
+ {
callEvent(new GMGroupEvent(groupName, action));
}
- public static void callEvent(User user, GMUserEvent.Action action) {
+ public static void callEvent(User user, GMUserEvent.Action action)
+ {
callEvent(new GMUserEvent(user, action));
}
- public static void callEvent(String userName, GMUserEvent.Action action) {
+ public static void callEvent(String userName, GMUserEvent.Action action)
+ {
callEvent(new GMUserEvent(userName, action));
}
- public static void callEvent(GMSystemEvent.Action action) {
+ public static void callEvent(GMSystemEvent.Action action)
+ {
callEvent(new GMSystemEvent(action));
}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java
index efad11df4..01f646f00 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java
@@ -18,89 +18,94 @@ import org.anjocaido.groupmanager.data.User;
import org.anjocaido.groupmanager.utils.PermissionCheckResult;
import org.bukkit.entity.Player;
+
/**
* Everything here maintains the model created by Nijikokun
- *
- * But implemented to use GroupManager system. Which provides instant changes,
- * without file access.
- *
+ *
+ * But implemented to use GroupManager system. Which provides instant changes, without file access.
+ *
* It holds permissions only for one single world.
- *
+ *
* @author gabrielcouto, ElgarL
*/
-public class AnjoPermissionsHandler extends PermissionsReaderInterface {
-
+public class AnjoPermissionsHandler extends PermissionsReaderInterface
+{
WorldDataHolder ph = null;
/**
* It needs a WorldDataHolder to work with.
- *
+ *
* @param holder
*/
- public AnjoPermissionsHandler(WorldDataHolder holder) {
+ public AnjoPermissionsHandler(WorldDataHolder holder)
+ {
ph = holder;
}
/**
* A short name method, for permission method.
- *
+ *
* @param player
* @param permission
* @return true if the player has the permission
*/
@Override
- public boolean has(Player player, String permission) {
+ public boolean has(Player player, String permission)
+ {
return permission(player, permission);
}
/**
* Checks if a player can use that permission node.
- *
+ *
* @param player
* @param permission
* @return true if the player has the permission
*/
@Override
- public boolean permission(Player player, String permission) {
+ public boolean permission(Player player, String permission)
+ {
return checkUserPermission(ph.getUser(player.getName()).updatePlayer(player), permission);
}
/**
* Checks if a player can use that permission node.
- *
+ *
* @param playerName
* @param permission
* @return true if the player has the permission
*/
- public boolean permission(String playerName, String permission) {
+ public boolean permission(String playerName, String permission)
+ {
return checkUserPermission(ph.getUser(playerName), permission);
}
/**
* Returns the name of the group of that player name.
- *
+ *
* @param userName
* @return String of players group name.
*/
@Override
- public String getGroup(String userName) {
+ public String getGroup(String userName)
+ {
return ph.getUser(userName).getGroup().getName();
}
/**
- * Returns All permissions (including inheritance and sub groups) for the
- * player, including child nodes from Bukkit.
- *
+ * Returns All permissions (including inheritance and sub groups) for the player, including child nodes from Bukkit.
+ *
* @param userName
* @return List<String> of all players permissions.
*/
@Override
- public List<String> getAllPlayersPermissions(String userName) {
+ public List<String> getAllPlayersPermissions(String userName)
+ {
List<String> perms = new ArrayList<String>();
@@ -110,14 +115,15 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
}
/**
- * Returns All permissions (including inheritance and sub groups) for the
- * player. With or without Bukkit child nodes.
- *
+ * Returns All permissions (including inheritance and sub groups) for the player. With or without Bukkit child
+ * nodes.
+ *
* @param userName
* @return Set<String> of all players permissions.
*/
@Override
- public Set<String> getAllPlayersPermissions(String userName, Boolean includeChildren) {
+ public Set<String> getAllPlayersPermissions(String userName, Boolean includeChildren)
+ {
Set<String> playerPermArray = new HashSet<String>();
@@ -127,29 +133,37 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
ArrayList<String> alreadyProcessed = new ArrayList<String>();
// fetch all group permissions
- for (String group : getGroups(userName)) {
+ for (String group : getGroups(userName))
+ {
// Don't process a group more than once.
- if (!alreadyProcessed.contains(group)) {
+ if (!alreadyProcessed.contains(group))
+ {
alreadyProcessed.add(group);
Set<String> groupPermArray = new HashSet<String>();
- if (group.startsWith("g:") && GroupManager.getGlobalGroups().hasGroup(group)) {
+ if (group.startsWith("g:") && GroupManager.getGlobalGroups().hasGroup(group))
+ {
// GlobalGroups
groupPermArray = populatePerms(GroupManager.getGlobalGroups().getGroupsPermissions(group), includeChildren);
- } else {
+ }
+ else
+ {
// World Groups
groupPermArray = populatePerms(ph.getGroup(group).getPermissionList(), includeChildren);
}
// Add all group permissions, unless negated by earlier permissions.
- for (String perm : groupPermArray) {
+ for (String perm : groupPermArray)
+ {
boolean negated = (perm.startsWith("-"));
// Perm doesn't already exists and there is no negation for it
// or It's a negated perm where a normal perm doesn't exists (don't allow inheritance to negate higher perms)
if ((!negated && !playerPermArray.contains(perm) && !playerPermArray.contains("-" + perm)) || (negated && !playerPermArray.contains(perm.substring(1)) && !playerPermArray.contains("-" + perm)))
+ {
playerPermArray.add(perm);
+ }
}
}
@@ -159,7 +173,8 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
return playerPermArray;
}
- private Set<String> populatePerms(List<String> permsList, boolean includeChildren) {
+ private Set<String> populatePerms(List<String> permsList, boolean includeChildren)
+ {
// Create a new array so it's modifiable.
List<String> perms = new ArrayList<String>(permsList);
@@ -167,55 +182,76 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
Boolean allPerms = false;
// Allow * node to populate ALL permissions to Bukkit.
- if (perms.contains("*")) {
+ if (perms.contains("*"))
+ {
permArray.addAll(GroupManager.BukkitPermissions.getAllRegisteredPermissions(includeChildren));
allPerms = true;
perms.remove("*");
}
- for (String perm : perms) {
+ for (String perm : perms)
+ {
/**
- * all permission sets are passed here pre-sorted, alphabetically.
- * This means negated nodes will be processed before all permissions
- * other than *.
+ * all permission sets are passed here pre-sorted, alphabetically. This means negated nodes will be
+ * processed before all permissions other than *.
*/
boolean negated = perm.startsWith("-");
- if (!permArray.contains(perm)) {
+ if (!permArray.contains(perm))
+ {
permArray.add(perm);
if ((negated) && (permArray.contains(perm.substring(1))))
+ {
permArray.remove(perm.substring(1));
+ }
/**
- * Process child nodes if required,
- * or this is a negated node AND we used * to include all
- * permissions,
+ * Process child nodes if required, or this is a negated node AND we used * to include all permissions,
* in which case we need to remove all children of that node.
*/
- if ((includeChildren) || (negated && allPerms)) {
+ if ((includeChildren) || (negated && allPerms))
+ {
Map<String, Boolean> children = GroupManager.BukkitPermissions.getAllChildren((negated ? perm.substring(1) : perm), new HashSet<String>());
- if (children != null) {
+ if (children != null)
+ {
if (negated)
- if (allPerms) {
+ {
+ if (allPerms)
+ {
// Remove children of negated nodes
for (String child : children.keySet())
+ {
if (children.get(child))
+ {
if (permArray.contains(child))
+ {
permArray.remove(child);
+ }
+ }
+ }
- } else {
+ }
+ else
+ {
// Add child nodes
for (String child : children.keySet())
+ {
if (children.get(child))
+ {
if ((!permArray.contains(child)) && (!permArray.contains("-" + child)))
+ {
permArray.add(child);
+ }
+ }
+ }
}
+ }
}
}
}
@@ -226,27 +262,29 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
/**
* Verify if player is in such group. It will check it's groups inheritance.
- *
+ *
* So if you have a group Admin > Moderator
- *
- * And verify the player 'MyAdmin', which is Admin, it will return true for
- * both Admin or Moderator groups.
- *
- * If you have a player 'MyModerator', which is Moderator, it will give
- * false if you pass Admin in group parameter.
- *
+ *
+ * And verify the player 'MyAdmin', which is Admin, it will return true for both Admin or Moderator groups.
+ *
+ * If you have a player 'MyModerator', which is Moderator, it will give false if you pass Admin in group parameter.
+ *
* @param name
* @param group
* @return true if in group (with inheritance)
*/
@Override
- public boolean inGroup(String name, String group) {
+ public boolean inGroup(String name, String group)
+ {
- if (hasGroupInInheritance(ph.getUser(name).getGroup(), group)) {
+ if (hasGroupInInheritance(ph.getUser(name).getGroup(), group))
+ {
return true;
}
- for (Group subGroup : ph.getUser(name).subGroupListCopy()) {
- if (hasGroupInInheritance(subGroup, group)) {
+ for (Group subGroup : ph.getUser(name).subGroupListCopy())
+ {
+ if (hasGroupInInheritance(subGroup, group))
+ {
return true;
}
}
@@ -254,20 +292,20 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
}
/**
- * Gets the appropriate prefix for the user. This method is a utility method
- * for chat plugins to get the user's prefix without having to look at every
- * one of the user's ancestors. Returns an empty string if user has no
- * parent groups.
- *
- * @param user
- * Player's name
+ * Gets the appropriate prefix for the user. This method is a utility method for chat plugins to get the user's
+ * prefix without having to look at every one of the user's ancestors. Returns an empty string if user has no parent
+ * groups.
+ *
+ * @param user Player's name
* @return Player's prefix
*/
@Override
- public String getUserPrefix(String user) {
+ public String getUserPrefix(String user)
+ {
String prefix = ph.getUser(user).getVariables().getVarString("prefix");
- if (prefix.length() != 0) {
+ if (prefix.length() != 0)
+ {
return prefix;
}
@@ -275,20 +313,20 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
}
/**
- * Gets the appropriate prefix for the user. This method is a utility method
- * for chat plugins to get the user's prefix without having to look at every
- * one of the user's ancestors. Returns an empty string if user has no
- * parent groups.
- *
- * @param user
- * Player's name
+ * Gets the appropriate prefix for the user. This method is a utility method for chat plugins to get the user's
+ * prefix without having to look at every one of the user's ancestors. Returns an empty string if user has no parent
+ * groups.
+ *
+ * @param user Player's name
* @return Player's prefix
*/
@Override
- public String getUserSuffix(String user) {
+ public String getUserSuffix(String user)
+ {
String suffix = ph.getUser(user).getVariables().getVarString("suffix");
- if (suffix.length() != 0) {
+ if (suffix.length() != 0)
+ {
return suffix;
}
@@ -297,15 +335,14 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
}
/**
- * Gets name of the primary group of the user. Returns the name of the
- * default group if user has no parent groups, or "Default" if there is no
- * default group for that world.
- *
- * @param user
- * Player's name
+ * Gets name of the primary group of the user. Returns the name of the default group if user has no parent groups,
+ * or "Default" if there is no default group for that world.
+ *
+ * @param user Player's name
* @return Name of player's primary group
*/
- public String getPrimaryGroup(String user) {
+ public String getPrimaryGroup(String user)
+ {
return getGroup(user);
@@ -313,12 +350,12 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
/**
* Check if user can build. Checks inheritance and subgroups.
- *
- * @param userName
- * Player's name
+ *
+ * @param userName Player's name
* @return true if the user can build
*/
- public boolean canUserBuild(String userName) {
+ public boolean canUserBuild(String userName)
+ {
return getPermissionBoolean(userName, "build");
@@ -326,15 +363,17 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
/**
* Returns the String prefix for the given group
- *
+ *
* @param groupName
* @return empty string if found none.
*/
@Override
- public String getGroupPrefix(String groupName) {
+ public String getGroupPrefix(String groupName)
+ {
Group g = ph.getGroup(groupName);
- if (g == null) {
+ if (g == null)
+ {
return "";
}
return g.getVariables().getVarString("prefix");
@@ -342,120 +381,131 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
/**
* Return the suffix for the given group name
- *
+ *
* @param groupName
* @return empty string if not found.
*/
@Override
- public String getGroupSuffix(String groupName) {
+ public String getGroupSuffix(String groupName)
+ {
Group g = ph.getGroup(groupName);
- if (g == null) {
+ if (g == null)
+ {
return "";
}
return g.getVariables().getVarString("suffix");
}
/**
- * Checks the specified group for the Info Build node. Does NOT check
- * inheritance
- *
+ * Checks the specified group for the Info Build node. Does NOT check inheritance
+ *
* @param groupName
* @return true if can build
*/
@Override
- public boolean canGroupBuild(String groupName) {
+ public boolean canGroupBuild(String groupName)
+ {
Group g = ph.getGroup(groupName);
- if (g == null) {
+ if (g == null)
+ {
return false;
}
return g.getVariables().getVarBoolean("build");
}
/**
- * It returns a string variable value, set in the INFO node of the group. It
- * will harvest inheritance for value.
- *
+ * It returns a string variable value, set in the INFO node of the group. It will harvest inheritance for value.
+ *
* @param groupName
* @param variable
* @return null if no group with that variable is found.
*/
@Override
- public String getGroupPermissionString(String groupName, String variable) {
+ public String getGroupPermissionString(String groupName, String variable)
+ {
Group start = ph.getGroup(groupName);
- if (start == null) {
+ if (start == null)
+ {
return null;
}
Group result = nextGroupWithVariable(start, variable);
- if (result == null) {
+ if (result == null)
+ {
return null;
}
return result.getVariables().getVarString(variable);
}
/**
- * It returns a Integer variable value It will harvest inheritance for
- * value.
- *
+ * It returns a Integer variable value It will harvest inheritance for value.
+ *
* @param groupName
* @param variable
* @return -1 if none found or not parseable.
*/
@Override
- public int getGroupPermissionInteger(String groupName, String variable) {
+ public int getGroupPermissionInteger(String groupName, String variable)
+ {
Group start = ph.getGroup(groupName);
- if (start == null) {
+ if (start == null)
+ {
return -1;
}
Group result = nextGroupWithVariable(start, variable);
- if (result == null) {
+ if (result == null)
+ {
return -1;
}
return result.getVariables().getVarInteger(variable);
}
/**
- * Returns a boolean for given variable in INFO node. It will harvest
- * inheritance for value.
- *
+ * Returns a boolean for given variable in INFO node. It will harvest inheritance for value.
+ *
* @param group
* @param variable
* @return false if not found/not parseable.
*/
@Override
- public boolean getGroupPermissionBoolean(String group, String variable) {
+ public boolean getGroupPermissionBoolean(String group, String variable)
+ {
Group start = ph.getGroup(group);
- if (start == null) {
+ if (start == null)
+ {
return false;
}
Group result = nextGroupWithVariable(start, variable);
- if (result == null) {
+ if (result == null)
+ {
return false;
}
return result.getVariables().getVarBoolean(variable);
}
/**
- * Returns a double value for the given variable name in INFO node. It will
- * harvest inheritance for value.
- *
+ * Returns a double value for the given variable name in INFO node. It will harvest inheritance for value.
+ *
* @param group
* @param variable
* @return -1 if not found / not parseable.
*/
@Override
- public double getGroupPermissionDouble(String group, String variable) {
+ public double getGroupPermissionDouble(String group, String variable)
+ {
Group start = ph.getGroup(group);
- if (start == null) {
+ if (start == null)
+ {
return -1;
}
Group result = nextGroupWithVariable(start, variable);
- if (result == null) {
+ if (result == null)
+ {
return -1;
}
return result.getVariables().getVarDouble(variable);
@@ -463,16 +513,18 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
/**
* Returns the variable value of the user, in INFO node.
- *
+ *
* @param user
* @param variable
* @return empty string if not found
*/
@Override
- public String getUserPermissionString(String user, String variable) {
+ public String getUserPermissionString(String user, String variable)
+ {
User auser = ph.getUser(user);
- if (auser == null) {
+ if (auser == null)
+ {
return "";
}
return auser.getVariables().getVarString(variable);
@@ -480,16 +532,18 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
/**
* Returns the variable value of the user, in INFO node.
- *
+ *
* @param user
* @param variable
* @return -1 if not found
*/
@Override
- public int getUserPermissionInteger(String user, String variable) {
+ public int getUserPermissionInteger(String user, String variable)
+ {
User auser = ph.getUser(user);
- if (auser == null) {
+ if (auser == null)
+ {
return -1;
}
return auser.getVariables().getVarInteger(variable);
@@ -497,16 +551,18 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
/**
* Returns the variable value of the user, in INFO node.
- *
+ *
* @param user
* @param variable
* @return boolean value
*/
@Override
- public boolean getUserPermissionBoolean(String user, String variable) {
+ public boolean getUserPermissionBoolean(String user, String variable)
+ {
User auser = ph.getUser(user);
- if (auser == null) {
+ if (auser == null)
+ {
return false;
}
return auser.getVariables().getVarBoolean(variable);
@@ -514,176 +570,222 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
/**
* Returns the variable value of the user, in INFO node.
- *
+ *
* @param user
* @param variable
* @return -1 if not found
*/
@Override
- public double getUserPermissionDouble(String user, String variable) {
+ public double getUserPermissionDouble(String user, String variable)
+ {
User auser = ph.getUser(user);
- if (auser == null) {
+ if (auser == null)
+ {
return -1;
}
return auser.getVariables().getVarDouble(variable);
}
/**
- * Returns the variable value of the user, in INFO node. If not found, it
- * will search for his Group variables. It will harvest the inheritance and
- * subgroups.
- *
+ * Returns the variable value of the user, in INFO node. If not found, it will search for his Group variables. It
+ * will harvest the inheritance and subgroups.
+ *
* @param user
* @param variable
* @return empty string if not found
*/
@Override
- public String getPermissionString(String user, String variable) {
+ public String getPermissionString(String user, String variable)
+ {
User auser = ph.getUser(user);
- if (auser == null) {
+ if (auser == null)
+ {
return "";
}
- if (auser.getVariables().hasVar(variable)) {
+ if (auser.getVariables().hasVar(variable))
+ {
return auser.getVariables().getVarString(variable);
}
Group start = auser.getGroup();
- if (start == null) {
+ if (start == null)
+ {
return "";
}
Group result = nextGroupWithVariable(start, variable);
- if (result == null) {
+ if (result == null)
+ {
// Check sub groups
if (!auser.isSubGroupsEmpty())
- for (Group subGroup : auser.subGroupListCopy()) {
+ {
+ for (Group subGroup : auser.subGroupListCopy())
+ {
result = nextGroupWithVariable(subGroup, variable);
// Found value?
if (result != null)
+ {
continue;
+ }
}
+ }
if (result == null)
+ {
return "";
+ }
}
return result.getVariables().getVarString(variable);
// return getUserPermissionString(user, variable);
}
/**
- * Returns the variable value of the user, in INFO node. If not found, it
- * will search for his Group variables. It will harvest the inheritance and
- * subgroups.
- *
+ * Returns the variable value of the user, in INFO node. If not found, it will search for his Group variables. It
+ * will harvest the inheritance and subgroups.
+ *
* @param user
* @param variable
* @return -1 if not found
*/
@Override
- public int getPermissionInteger(String user, String variable) {
+ public int getPermissionInteger(String user, String variable)
+ {
User auser = ph.getUser(user);
- if (auser == null) {
+ if (auser == null)
+ {
return -1;
}
- if (auser.getVariables().hasVar(variable)) {
+ if (auser.getVariables().hasVar(variable))
+ {
return auser.getVariables().getVarInteger(variable);
}
Group start = auser.getGroup();
- if (start == null) {
+ if (start == null)
+ {
return -1;
}
Group result = nextGroupWithVariable(start, variable);
- if (result == null) {
+ if (result == null)
+ {
// Check sub groups
if (!auser.isSubGroupsEmpty())
- for (Group subGroup : auser.subGroupListCopy()) {
+ {
+ for (Group subGroup : auser.subGroupListCopy())
+ {
result = nextGroupWithVariable(subGroup, variable);
// Found value?
if (result != null)
+ {
continue;
+ }
}
+ }
if (result == null)
+ {
return -1;
+ }
}
return result.getVariables().getVarInteger(variable);
// return getUserPermissionInteger(string, string1);
}
/**
- * Returns the variable value of the user, in INFO node. If not found, it
- * will search for his Group variables. It will harvest the inheritance and
- * subgroups.
- *
+ * Returns the variable value of the user, in INFO node. If not found, it will search for his Group variables. It
+ * will harvest the inheritance and subgroups.
+ *
* @param user
* @param variable
* @return false if not found or not parseable to true.
*/
@Override
- public boolean getPermissionBoolean(String user, String variable) {
+ public boolean getPermissionBoolean(String user, String variable)
+ {
User auser = ph.getUser(user);
- if (auser == null) {
+ if (auser == null)
+ {
return false;
}
- if (auser.getVariables().hasVar(variable)) {
+ if (auser.getVariables().hasVar(variable))
+ {
return auser.getVariables().getVarBoolean(variable);
}
Group start = auser.getGroup();
- if (start == null) {
+ if (start == null)
+ {
return false;
}
Group result = nextGroupWithVariable(start, variable);
- if (result == null) {
+ if (result == null)
+ {
// Check sub groups
if (!auser.isSubGroupsEmpty())
- for (Group subGroup : auser.subGroupListCopy()) {
+ {
+ for (Group subGroup : auser.subGroupListCopy())
+ {
result = nextGroupWithVariable(subGroup, variable);
// Found value?
if (result != null)
+ {
continue;
+ }
}
+ }
if (result == null)
+ {
return false;
+ }
}
return result.getVariables().getVarBoolean(variable);
// return getUserPermissionBoolean(user, string1);
}
/**
- * Returns the variable value of the user, in INFO node. If not found, it
- * will search for his Group variables. It will harvest the inheritance and
- * subgroups.
- *
+ * Returns the variable value of the user, in INFO node. If not found, it will search for his Group variables. It
+ * will harvest the inheritance and subgroups.
+ *
* @param user
* @param variable
* @return -1 if not found.
*/
@Override
- public double getPermissionDouble(String user, String variable) {
+ public double getPermissionDouble(String user, String variable)
+ {
User auser = ph.getUser(user);
- if (auser == null) {
+ if (auser == null)
+ {
return -1.0D;
}
- if (auser.getVariables().hasVar(variable)) {
+ if (auser.getVariables().hasVar(variable))
+ {
return auser.getVariables().getVarDouble(variable);
}
Group start = auser.getGroup();
- if (start == null) {
+ if (start == null)
+ {
return -1.0D;
}
Group result = nextGroupWithVariable(start, variable);
- if (result == null) {
+ if (result == null)
+ {
// Check sub groups
if (!auser.isSubGroupsEmpty())
- for (Group subGroup : auser.subGroupListCopy()) {
+ {
+ for (Group subGroup : auser.subGroupListCopy())
+ {
result = nextGroupWithVariable(subGroup, variable);
// Found value?
if (result != null)
+ {
continue;
+ }
}
+ }
if (result == null)
+ {
return -1.0D;
+ }
}
return result.getVariables().getVarDouble(variable);
// return getUserPermissionDouble(string, string1);
@@ -691,20 +793,23 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
/**
* Does not include User's group permission
- *
+ *
* @param user
* @param permission
* @return PermissionCheckResult
*/
- public PermissionCheckResult checkUserOnlyPermission(User user, String permission) {
+ public PermissionCheckResult checkUserOnlyPermission(User user, String permission)
+ {
user.sortPermissions();
PermissionCheckResult result = new PermissionCheckResult();
result.askedPermission = permission;
result.owner = user;
- for (String access : user.getPermissionList()) {
+ for (String access : user.getPermissionList())
+ {
result.resultType = comparePermissionString(access, permission);
- if (result.resultType != PermissionCheckResult.Type.NOTFOUND) {
+ if (result.resultType != PermissionCheckResult.Type.NOTFOUND)
+ {
return result;
}
}
@@ -713,22 +818,24 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
}
/**
- * Returns the node responsible for that permission. Does not include User's
- * group permission.
- *
+ * Returns the node responsible for that permission. Does not include User's group permission.
+ *
* @param group
* @param permission
* @return the node if permission is found. if not found, return null
*/
- public PermissionCheckResult checkGroupOnlyPermission(Group group, String permission) {
+ public PermissionCheckResult checkGroupOnlyPermission(Group group, String permission)
+ {
group.sortPermissions();
PermissionCheckResult result = new PermissionCheckResult();
result.owner = group;
result.askedPermission = permission;
- for (String access : group.getPermissionList()) {
+ for (String access : group.getPermissionList())
+ {
result.resultType = comparePermissionString(access, permission);
- if (result.resultType != PermissionCheckResult.Type.NOTFOUND) {
+ if (result.resultType != PermissionCheckResult.Type.NOTFOUND)
+ {
return result;
}
}
@@ -738,15 +845,17 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
/**
* Check permissions, including it's group and inheritance.
- *
+ *
* @param user
* @param permission
* @return true if permission was found. false if not, or was negated.
*/
- public boolean checkUserPermission(User user, String permission) {
+ public boolean checkUserPermission(User user, String permission)
+ {
PermissionCheckResult result = checkFullGMPermission(user, permission, true);
- if (result.resultType == PermissionCheckResult.Type.EXCEPTION || result.resultType == PermissionCheckResult.Type.FOUND) {
+ if (result.resultType == PermissionCheckResult.Type.EXCEPTION || result.resultType == PermissionCheckResult.Type.FOUND)
+ {
return true;
}
@@ -754,43 +863,46 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
}
/**
- * Do what checkUserPermission did before. But now returning a
- * PermissionCheckResult.
- *
+ * Do what checkUserPermission did before. But now returning a PermissionCheckResult.
+ *
* @param user
* @param targetPermission
* @return PermissionCheckResult
*/
- public PermissionCheckResult checkFullUserPermission(User user, String targetPermission) {
+ public PermissionCheckResult checkFullUserPermission(User user, String targetPermission)
+ {
return checkFullGMPermission(user, targetPermission, true);
}
/**
- * Check user and groups with inheritance and Bukkit if bukkit = true return
- * a PermissionCheckResult.
- *
+ * Check user and groups with inheritance and Bukkit if bukkit = true return a PermissionCheckResult.
+ *
* @param user
* @param targetPermission
* @param checkBukkit
* @return PermissionCheckResult
*/
- public PermissionCheckResult checkFullGMPermission(User user, String targetPermission, Boolean checkBukkit) {
+ public PermissionCheckResult checkFullGMPermission(User user, String targetPermission, Boolean checkBukkit)
+ {
PermissionCheckResult result = new PermissionCheckResult();
result.accessLevel = targetPermission;
result.resultType = PermissionCheckResult.Type.NOTFOUND;
- if (user == null || targetPermission == null || targetPermission.isEmpty()) {
+ if (user == null || targetPermission == null || targetPermission.isEmpty())
+ {
return result;
}
- if (checkBukkit) {
+ if (checkBukkit)
+ {
// Check Bukkit perms to support plugins which add perms via code
// (Heroes).
final Player player = user.getBukkitPlayer();
//final Permission bukkitPerm = Bukkit.getPluginManager().getPermission(targetPermission);
- if ((player != null) && player.hasPermission(targetPermission)) {
+ if ((player != null) && player.hasPermission(targetPermission))
+ {
result.resultType = PermissionCheckResult.Type.FOUND;
result.owner = user;
return result;
@@ -798,22 +910,26 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
}
PermissionCheckResult resultUser = checkUserOnlyPermission(user, targetPermission);
- if (resultUser.resultType != PermissionCheckResult.Type.NOTFOUND) {
+ if (resultUser.resultType != PermissionCheckResult.Type.NOTFOUND)
+ {
resultUser.accessLevel = targetPermission;
return resultUser;
}
// IT ONLY CHECKS GROUPS PERMISSIONS IF RESULT FOR USER IS NOT FOUND
PermissionCheckResult resultGroup = checkGroupPermissionWithInheritance(user.getGroup(), targetPermission);
- if (resultGroup.resultType != PermissionCheckResult.Type.NOTFOUND) {
+ if (resultGroup.resultType != PermissionCheckResult.Type.NOTFOUND)
+ {
resultGroup.accessLevel = targetPermission;
return resultGroup;
}
// SUBGROUPS CHECK
- for (Group subGroup : user.subGroupListCopy()) {
+ for (Group subGroup : user.subGroupListCopy())
+ {
PermissionCheckResult resultSubGroup = checkGroupPermissionWithInheritance(subGroup, targetPermission);
- if (resultSubGroup.resultType != PermissionCheckResult.Type.NOTFOUND) {
+ if (resultSubGroup.resultType != PermissionCheckResult.Type.NOTFOUND)
+ {
resultSubGroup.accessLevel = targetPermission;
return resultSubGroup;
}
@@ -824,32 +940,37 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
}
/**
- * Returns the next group, including inheritance, which contains that
- * variable name.
- *
+ * Returns the next group, including inheritance, which contains that variable name.
+ *
* It does Breadth-first search
- *
+ *
* @param start the starting group to look for
* @param targetVariable the variable name
* @return The group if found. Null if not.
*/
- public Group nextGroupWithVariable(Group start, String targetVariable) {
+ public Group nextGroupWithVariable(Group start, String targetVariable)
+ {
- if (start == null || targetVariable == null) {
+ if (start == null || targetVariable == null)
+ {
return null;
}
LinkedList<Group> stack = new LinkedList<Group>();
ArrayList<Group> alreadyVisited = new ArrayList<Group>();
stack.push(start);
alreadyVisited.add(start);
- while (!stack.isEmpty()) {
+ while (!stack.isEmpty())
+ {
Group now = stack.pop();
- if (now.getVariables().hasVar(targetVariable)) {
+ if (now.getVariables().hasVar(targetVariable))
+ {
return now;
}
- for (String sonName : now.getInherits()) {
+ for (String sonName : now.getInherits())
+ {
Group son = ph.getGroup(sonName);
- if (son != null && !alreadyVisited.contains(son)) {
+ if (son != null && !alreadyVisited.contains(son))
+ {
stack.push(son);
alreadyVisited.add(son);
}
@@ -858,33 +979,38 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
return null;
}
-
/**
* Check if given group inherits another group.
- *
+ *
* It does Breadth-first search
- *
+ *
* @param start The group to start the search.
* @param askedGroup Name of the group you're looking for
* @return true if it inherits the group.
*/
- public boolean hasGroupInInheritance(Group start, String askedGroup) {
+ public boolean hasGroupInInheritance(Group start, String askedGroup)
+ {
- if (start == null || askedGroup == null) {
+ if (start == null || askedGroup == null)
+ {
return false;
}
LinkedList<Group> stack = new LinkedList<Group>();
ArrayList<Group> alreadyVisited = new ArrayList<Group>();
stack.push(start);
alreadyVisited.add(start);
- while (!stack.isEmpty()) {
+ while (!stack.isEmpty())
+ {
Group now = stack.pop();
- if (now.getName().equalsIgnoreCase(askedGroup)) {
+ if (now.getName().equalsIgnoreCase(askedGroup))
+ {
return true;
}
- for (String sonName : now.getInherits()) {
+ for (String sonName : now.getInherits())
+ {
Group son = ph.getGroup(sonName);
- if (son != null && !alreadyVisited.contains(son)) {
+ if (son != null && !alreadyVisited.contains(son))
+ {
stack.push(son);
alreadyVisited.add(son);
}
@@ -894,37 +1020,41 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
}
/**
- * Returns the result of permission check. Including inheritance. If found
- * anything, the PermissionCheckResult that retuns will include the Group
- * name, and the result type. Result types will be EXCEPTION, NEGATION,
- * FOUND.
- *
+ * Returns the result of permission check. Including inheritance. If found anything, the PermissionCheckResult that
+ * retuns will include the Group name, and the result type. Result types will be EXCEPTION, NEGATION, FOUND.
+ *
* If returned type NOTFOUND, the owner will be null, and ownerType too.
- *
+ *
* It does Breadth-first search
- *
+ *
* @param start
* @param targetPermission
* @return PermissionCheckResult
*/
- public PermissionCheckResult checkGroupPermissionWithInheritance(Group start, String targetPermission) {
+ public PermissionCheckResult checkGroupPermissionWithInheritance(Group start, String targetPermission)
+ {
- if (start == null || targetPermission == null) {
+ if (start == null || targetPermission == null)
+ {
return null;
}
LinkedList<Group> stack = new LinkedList<Group>();
List<Group> alreadyVisited = new ArrayList<Group>();
stack.push(start);
alreadyVisited.add(start);
- while (!stack.isEmpty()) {
+ while (!stack.isEmpty())
+ {
Group now = stack.pop();
PermissionCheckResult resultNow = checkGroupOnlyPermission(now, targetPermission);
- if (!resultNow.resultType.equals(PermissionCheckResult.Type.NOTFOUND)) {
+ if (!resultNow.resultType.equals(PermissionCheckResult.Type.NOTFOUND))
+ {
return resultNow;
}
- for (String sonName : now.getInherits()) {
+ for (String sonName : now.getInherits())
+ {
Group son = ph.getGroup(sonName);
- if (son != null && !alreadyVisited.contains(son)) {
+ if (son != null && !alreadyVisited.contains(son))
+ {
// Add rather than push to retain inheritance order.
stack.add(son);
alreadyVisited.add(son);
@@ -938,28 +1068,32 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
}
/**
- * Return whole list of names of groups in a inheritance chain. Including a
- * starting group.
- *
+ * Return whole list of names of groups in a inheritance chain. Including a starting group.
+ *
* It does Breadth-first search. So closer groups will appear first in list.
- *
+ *
* @param start
* @return the group that passed on test. null if no group passed.
*/
- public ArrayList<String> listAllGroupsInherited(Group start) {
+ public ArrayList<String> listAllGroupsInherited(Group start)
+ {
- if (start == null) {
+ if (start == null)
+ {
return null;
}
LinkedList<Group> stack = new LinkedList<Group>();
ArrayList<String> alreadyVisited = new ArrayList<String>();
stack.push(start);
alreadyVisited.add(start.getName());
- while (!stack.isEmpty()) {
+ while (!stack.isEmpty())
+ {
Group now = stack.pop();
- for (String sonName : now.getInherits()) {
+ for (String sonName : now.getInherits())
+ {
Group son = ph.getGroup(sonName);
- if (son != null && !alreadyVisited.contains(son.getName())) {
+ if (son != null && !alreadyVisited.contains(son.getName()))
+ {
stack.push(son);
alreadyVisited.add(son.getName());
}
@@ -969,69 +1103,79 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
}
/**
- * Compare a user permission like 'myplugin.*' against a full plugin
- * permission name, like 'myplugin.dosomething'. As the example above, will
- * return true.
- *
- * Please sort permissions before sending them here. So negative tokens get
- * priority.
- *
- * You must test if it start with negative outside this method. It will only
- * tell if the nodes are matching or not.
- *
- * Every '-' or '+' in the beginning is ignored. It will match only node
- * names.
- *
+ * Compare a user permission like 'myplugin.*' against a full plugin permission name, like 'myplugin.dosomething'.
+ * As the example above, will return true.
+ *
+ * Please sort permissions before sending them here. So negative tokens get priority.
+ *
+ * You must test if it start with negative outside this method. It will only tell if the nodes are matching or not.
+ *
+ * Every '-' or '+' in the beginning is ignored. It will match only node names.
+ *
* @param userAccessLevel
* @param fullPermissionName
* @return PermissionCheckResult.Type
*/
- public PermissionCheckResult.Type comparePermissionString(String userAccessLevel, String fullPermissionName) {
+ public PermissionCheckResult.Type comparePermissionString(String userAccessLevel, String fullPermissionName)
+ {
int userAccessLevelLength;
- if (userAccessLevel == null || fullPermissionName == null || fullPermissionName.length() == 0 || (userAccessLevelLength = userAccessLevel.length()) == 0) {
+ if (userAccessLevel == null || fullPermissionName == null || fullPermissionName.length() == 0 || (userAccessLevelLength = userAccessLevel.length()) == 0)
+ {
return PermissionCheckResult.Type.NOTFOUND;
}
PermissionCheckResult.Type result = PermissionCheckResult.Type.FOUND;
int userAccessLevelOffset = 0;
- if (userAccessLevel.charAt(0) == '+') {
+ if (userAccessLevel.charAt(0) == '+')
+ {
userAccessLevelOffset = 1;
result = PermissionCheckResult.Type.EXCEPTION;
- } else if (userAccessLevel.charAt(0) == '-') {
+ }
+ else if (userAccessLevel.charAt(0) == '-')
+ {
userAccessLevelOffset = 1;
result = PermissionCheckResult.Type.NEGATION;
}
- if ("*".regionMatches(0, userAccessLevel, userAccessLevelOffset, userAccessLevelLength - userAccessLevelOffset)) {
+ if ("*".regionMatches(0, userAccessLevel, userAccessLevelOffset, userAccessLevelLength - userAccessLevelOffset))
+ {
return result;
}
int fullPermissionNameOffset;
- if (fullPermissionName.charAt(0) == '+' || fullPermissionName.charAt(0) == '-') {
+ if (fullPermissionName.charAt(0) == '+' || fullPermissionName.charAt(0) == '-')
+ {
fullPermissionNameOffset = 1;
- } else {
+ }
+ else
+ {
fullPermissionNameOffset = 0;
}
- if (userAccessLevel.charAt(userAccessLevel.length() - 1) == '*') {
+ if (userAccessLevel.charAt(userAccessLevel.length() - 1) == '*')
+ {
return userAccessLevel.regionMatches(true, userAccessLevelOffset, fullPermissionName, fullPermissionNameOffset, userAccessLevelLength - userAccessLevelOffset - 1) ? result : PermissionCheckResult.Type.NOTFOUND;
- } else {
+ }
+ else
+ {
return userAccessLevel.regionMatches(true, userAccessLevelOffset, fullPermissionName, fullPermissionNameOffset, Math.max(userAccessLevelLength - userAccessLevelOffset, fullPermissionName.length() - fullPermissionNameOffset)) ? result : PermissionCheckResult.Type.NOTFOUND;
}
}
/**
* Returns a list of all groups.
- *
+ *
* Including subgroups.
- *
+ *
* @param userName
* @return String[] of all group names.
*/
@Override
- public String[] getGroups(String userName) {
+ public String[] getGroups(String userName)
+ {
ArrayList<String> allGroups = listAllGroupsInherited(ph.getUser(userName).getGroup());
- for (Group subg : ph.getUser(userName).subGroupListCopy()) {
+ for (Group subg : ph.getUser(userName).subGroupListCopy())
+ {
allGroups.addAll(listAllGroupsInherited(subg));
}
@@ -1041,36 +1185,42 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
/**
* A Breadth-first search thru inheritance model.
- *
- * Just a model to copy and paste. This will guarantee the closer groups
- * will be checked first.
- *
+ *
+ * Just a model to copy and paste. This will guarantee the closer groups will be checked first.
+ *
* @param start
* @param targerPermission
* @return
*/
@SuppressWarnings("unused")
- private Group breadthFirstSearch(Group start, String targerPermission) {
+ private Group breadthFirstSearch(Group start, String targerPermission)
+ {
- if (start == null || targerPermission == null) {
+ if (start == null || targerPermission == null)
+ {
return null;
}
LinkedList<Group> stack = new LinkedList<Group>();
ArrayList<Group> alreadyVisited = new ArrayList<Group>();
stack.push(start);
alreadyVisited.add(start);
- while (!stack.isEmpty()) {
+ while (!stack.isEmpty())
+ {
Group now = stack.pop();
PermissionCheckResult resultNow = checkGroupOnlyPermission(now, targerPermission);
- if (resultNow.resultType.equals(PermissionCheckResult.Type.EXCEPTION) || resultNow.resultType.equals(PermissionCheckResult.Type.FOUND)) {
+ if (resultNow.resultType.equals(PermissionCheckResult.Type.EXCEPTION) || resultNow.resultType.equals(PermissionCheckResult.Type.FOUND))
+ {
return now;
}
- if (resultNow.resultType.equals(PermissionCheckResult.Type.NEGATION)) {
+ if (resultNow.resultType.equals(PermissionCheckResult.Type.NEGATION))
+ {
return null;
}
- for (String sonName : now.getInherits()) {
+ for (String sonName : now.getInherits())
+ {
Group son = ph.getGroup(sonName);
- if (son != null && !alreadyVisited.contains(son)) {
+ if (son != null && !alreadyVisited.contains(son))
+ {
stack.push(son);
alreadyVisited.add(son);
}
@@ -1080,23 +1230,30 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
}
@Override
- public Group getDefaultGroup() {
+ public Group getDefaultGroup()
+ {
return ph.getDefaultGroup();
}
@Override
- public String getInfoString(String entryName, String path, boolean isGroup) {
+ public String getInfoString(String entryName, String path, boolean isGroup)
+ {
- if (isGroup) {
+ if (isGroup)
+ {
Group data = ph.getGroup(entryName);
- if (data == null) {
+ if (data == null)
+ {
return null;
}
return data.getVariables().getVarString(path);
- } else {
+ }
+ else
+ {
User data = ph.getUser(entryName);
- if (data == null) {
+ if (data == null)
+ {
return null;
}
return data.getVariables().getVarString(path);
@@ -1104,17 +1261,23 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
}
@Override
- public int getInfoInteger(String entryName, String path, boolean isGroup) {
+ public int getInfoInteger(String entryName, String path, boolean isGroup)
+ {
- if (isGroup) {
+ if (isGroup)
+ {
Group data = ph.getGroup(entryName);
- if (data == null) {
+ if (data == null)
+ {
return -1;
}
return data.getVariables().getVarInteger(path);
- } else {
+ }
+ else
+ {
User data = ph.getUser(entryName);
- if (data == null) {
+ if (data == null)
+ {
return -1;
}
return data.getVariables().getVarInteger(path);
@@ -1122,17 +1285,23 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
}
@Override
- public double getInfoDouble(String entryName, String path, boolean isGroup) {
+ public double getInfoDouble(String entryName, String path, boolean isGroup)
+ {
- if (isGroup) {
+ if (isGroup)
+ {
Group data = ph.getGroup(entryName);
- if (data == null) {
+ if (data == null)
+ {
return -1;
}
return data.getVariables().getVarDouble(path);
- } else {
+ }
+ else
+ {
User data = ph.getUser(entryName);
- if (data == null) {
+ if (data == null)
+ {
return -1;
}
return data.getVariables().getVarDouble(path);
@@ -1141,17 +1310,23 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
}
@Override
- public boolean getInfoBoolean(String entryName, String path, boolean isGroup) {
+ public boolean getInfoBoolean(String entryName, String path, boolean isGroup)
+ {
- if (isGroup) {
+ if (isGroup)
+ {
Group data = ph.getGroup(entryName);
- if (data == null) {
+ if (data == null)
+ {
return false;
}
return data.getVariables().getVarBoolean(path);
- } else {
+ }
+ else
+ {
User data = ph.getUser(entryName);
- if (data == null) {
+ if (data == null)
+ {
return false;
}
return data.getVariables().getVarBoolean(path);
@@ -1159,25 +1334,29 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
}
@Override
- public void addUserInfo(String name, String path, Object data) {
+ public void addUserInfo(String name, String path, Object data)
+ {
ph.getUser(name).getVariables().addVar(path, data);
}
@Override
- public void removeUserInfo(String name, String path) {
+ public void removeUserInfo(String name, String path)
+ {
ph.getUser(name).getVariables().removeVar(path);
}
@Override
- public void addGroupInfo(String name, String path, Object data) {
+ public void addGroupInfo(String name, String path, Object data)
+ {
ph.getGroup(name).getVariables().addVar(path, data);
}
@Override
- public void removeGroupInfo(String name, String path) {
+ public void removeGroupInfo(String name, String path)
+ {
ph.getGroup(name).getVariables().removeVar(path);
}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java
index fb14c39f6..74fbd4541 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java
@@ -14,7 +14,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*/
-
package org.anjocaido.groupmanager.permissions;
import java.lang.reflect.Field;
@@ -49,14 +48,15 @@ import org.bukkit.permissions.PermissionAttachment;
import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.PluginManager;
+
/**
- *
+ *
* BukkitPermissions overrides to force GM reponses to Superperms
- *
+ *
* @author ElgarL
*/
-public class BukkitPermissions {
-
+public class BukkitPermissions
+{
protected WeakHashMap<Player, PermissionAttachment> attachments = new WeakHashMap<Player, PermissionAttachment>();
protected LinkedHashMap<String, Permission> registeredPermissions = new LinkedHashMap<String, Permission>();
protected GroupManager plugin;
@@ -67,7 +67,8 @@ public class BukkitPermissions {
/**
* @return the player_join
*/
- public boolean isPlayer_join() {
+ public boolean isPlayer_join()
+ {
return player_join;
}
@@ -75,41 +76,50 @@ public class BukkitPermissions {
/**
* @param player_join the player_join to set
*/
- public void setPlayer_join(boolean player_join) {
+ public void setPlayer_join(boolean player_join)
+ {
this.player_join = player_join;
}
-
private static Field permissions;
// Setup reflection (Thanks to Codename_B for the reflection source)
- static {
- try {
+ static
+ {
+ try
+ {
permissions = PermissionAttachment.class.getDeclaredField("permissions");
permissions.setAccessible(true);
- } catch (SecurityException e) {
+ }
+ catch (SecurityException e)
+ {
e.printStackTrace();
- } catch (NoSuchFieldException e) {
+ }
+ catch (NoSuchFieldException e)
+ {
e.printStackTrace();
}
}
- public BukkitPermissions(GroupManager plugin) {
+ public BukkitPermissions(GroupManager plugin)
+ {
this.plugin = plugin;
this.reset();
this.registerEvents();
-
+
GroupManager.logger.info("Superperms support enabled.");
}
-
- public void reset() {
+
+ public void reset()
+ {
this.collectPermissions();
this.updateAllPlayers();
}
- private void registerEvents() {
+ private void registerEvents()
+ {
PluginManager manager = plugin.getServer().getPluginManager();
@@ -117,51 +127,61 @@ public class BukkitPermissions {
manager.registerEvents(new BukkitEvents(), plugin);
}
- public void collectPermissions() {
+ public void collectPermissions()
+ {
registeredPermissions.clear();
- for (Permission perm : Bukkit.getPluginManager().getPermissions()) {
+ for (Permission perm : Bukkit.getPluginManager().getPermissions())
+ {
registeredPermissions.put(perm.getName().toLowerCase(), perm);
}
}
- public void updatePermissions(Player player) {
+ public void updatePermissions(Player player)
+ {
this.updatePermissions(player, null);
}
/**
- * Push all permissions which are registered with GM for this player, on
- * this world to Bukkit
- * and make it update for the child nodes.
- *
+ * Push all permissions which are registered with GM for this player, on this world to Bukkit and make it update for
+ * the child nodes.
+ *
* @param player
* @param world
*/
- public void updatePermissions(Player player, String world) {
+ public void updatePermissions(Player player, String world)
+ {
- if (player == null || !GroupManager.isLoaded()) {
+ if (player == null || !GroupManager.isLoaded())
+ {
return;
}
-
+
// Reset the User objects player reference.
User user = plugin.getWorldsHolder().getWorldData(player.getWorld().getName()).getUser(player.getName());
if (user != null)
+ {
user.updatePlayer(player);
+ }
PermissionAttachment attachment;
// Find the players current attachment, or add a new one.
- if (this.attachments.containsKey(player)) {
+ if (this.attachments.containsKey(player))
+ {
attachment = this.attachments.get(player);
- } else {
+ }
+ else
+ {
attachment = player.addAttachment(plugin);
this.attachments.put(player, attachment);
}
- if (world == null) {
+ if (world == null)
+ {
world = player.getWorld().getName();
}
@@ -174,19 +194,20 @@ public class BukkitPermissions {
playerPermArray = sort(playerPermArray);
Boolean value = false;
- for (String permission : playerPermArray) {
+ for (String permission : playerPermArray)
+ {
value = (!permission.startsWith("-"));
newPerms.put((value ? permission : permission.substring(1)), value);
}
/**
- * This is put in place until such a time as Bukkit pull 466 is
- * implemented
+ * This is put in place until such a time as Bukkit pull 466 is implemented
* https://github.com/Bukkit/Bukkit/pull/466
*/
- try { // Codename_B source
+ try
+ { // Codename_B source
@SuppressWarnings("unchecked")
- Map<String, Boolean> orig = (Map<String, Boolean>) permissions.get(attachment);
+ Map<String, Boolean> orig = (Map<String, Boolean>)permissions.get(attachment);
// Clear the map (faster than removing the attachment and recalculating)
orig.clear();
// Then whack our map into there
@@ -194,36 +215,45 @@ public class BukkitPermissions {
// That's all folks!
//attachment.getPermissible().recalculatePermissions();
player.recalculatePermissions();
- } catch (IllegalArgumentException e) {
+ }
+ catch (IllegalArgumentException e)
+ {
e.printStackTrace();
- } catch (IllegalAccessException e) {
+ }
+ catch (IllegalAccessException e)
+ {
e.printStackTrace();
}
}
/**
* Sort a permission node list by parent/child
- *
+ *
* @param permList
* @return List sorted for priority
*/
- private List<String> sort(List<String> permList) {
+ private List<String> sort(List<String> permList)
+ {
List<String> result = new ArrayList<String>();
- for (String key : permList) {
+ for (String key : permList)
+ {
String a = key.charAt(0) == '-' ? key.substring(1) : key;
Map<String, Boolean> allchildren = GroupManager.BukkitPermissions.getAllChildren(a, new HashSet<String>());
- if (allchildren != null) {
+ if (allchildren != null)
+ {
ListIterator<String> itr = result.listIterator();
- while (itr.hasNext()) {
- String node = (String) itr.next();
+ while (itr.hasNext())
+ {
+ String node = (String)itr.next();
String b = node.charAt(0) == '-' ? node.substring(1) : node;
// Insert the parent node before the child
- if (allchildren.containsKey(b)) {
+ if (allchildren.containsKey(b))
+ {
itr.set(key);
itr.add(node);
break;
@@ -231,33 +261,43 @@ public class BukkitPermissions {
}
}
if (!result.contains(key))
+ {
result.add(key);
+ }
}
return result;
}
/**
- * Fetch all permissions which are registered with superperms.
- * {can include child nodes)
- *
+ * Fetch all permissions which are registered with superperms. {can include child nodes)
+ *
* @param includeChildren
* @return List of all permission nodes
*/
- public List<String> getAllRegisteredPermissions(boolean includeChildren) {
+ public List<String> getAllRegisteredPermissions(boolean includeChildren)
+ {
List<String> perms = new ArrayList<String>();
- for (String key : registeredPermissions.keySet()) {
- if (!perms.contains(key)) {
+ for (String key : registeredPermissions.keySet())
+ {
+ if (!perms.contains(key))
+ {
perms.add(key);
- if (includeChildren) {
+ if (includeChildren)
+ {
Map<String, Boolean> children = getAllChildren(key, new HashSet<String>());
- if (children != null) {
+ if (children != null)
+ {
for (String node : children.keySet())
+ {
if (!perms.contains(node))
+ {
perms.add(node);
+ }
+ }
}
}
}
@@ -267,29 +307,32 @@ public class BukkitPermissions {
}
/**
- * Returns a map of ALL child permissions registered with bukkit
- * null is empty
- *
+ * Returns a map of ALL child permissions registered with bukkit null is empty
+ *
* @param node
- * @param playerPermArray current list of perms to check against for
- * negations
+ * @param playerPermArray current list of perms to check against for negations
* @return Map of child permissions
*/
- public Map<String, Boolean> getAllChildren(String node, Set<String> playerPermArray) {
+ public Map<String, Boolean> getAllChildren(String node, Set<String> playerPermArray)
+ {
LinkedList<String> stack = new LinkedList<String>();
Map<String, Boolean> alreadyVisited = new HashMap<String, Boolean>();
stack.push(node);
alreadyVisited.put(node, true);
- while (!stack.isEmpty()) {
+ while (!stack.isEmpty())
+ {
String now = stack.pop();
Map<String, Boolean> children = getChildren(now);
- if ((children != null) && (!playerPermArray.contains("-" + now))) {
- for (String childName : children.keySet()) {
- if (!alreadyVisited.containsKey(childName)) {
+ if ((children != null) && (!playerPermArray.contains("-" + now)))
+ {
+ for (String childName : children.keySet())
+ {
+ if (!alreadyVisited.containsKey(childName))
+ {
stack.push(childName);
alreadyVisited.put(childName, children.get(childName));
}
@@ -298,24 +341,27 @@ public class BukkitPermissions {
}
alreadyVisited.remove(node);
if (!alreadyVisited.isEmpty())
+ {
return alreadyVisited;
+ }
return null;
}
/**
- * Returns a map of the child permissions (1 node deep) as registered with
- * Bukkit.
- * null is empty
- *
+ * Returns a map of the child permissions (1 node deep) as registered with Bukkit. null is empty
+ *
* @param node
* @return Map of child permissions
*/
- public Map<String, Boolean> getChildren(String node) {
+ public Map<String, Boolean> getChildren(String node)
+ {
Permission perm = registeredPermissions.get(node.toLowerCase());
if (perm == null)
+ {
return null;
+ }
return perm.getChildren();
@@ -323,11 +369,12 @@ public class BukkitPermissions {
/**
* List all effective permissions for this player.
- *
+ *
* @param player
* @return List<String> of permissions
*/
- public List<String> listPerms(Player player) {
+ public List<String> listPerms(Player player)
+ {
List<String> perms = new ArrayList<String>();
@@ -342,9 +389,12 @@ public class BukkitPermissions {
*/
perms.add("Effective Permissions:");
- for (PermissionAttachmentInfo info : player.getEffectivePermissions()) {
+ for (PermissionAttachmentInfo info : player.getEffectivePermissions())
+ {
if (info.getValue() == true)
+ {
perms.add(" " + info.getPermission() + " = " + info.getValue());
+ }
}
return perms;
}
@@ -352,9 +402,11 @@ public class BukkitPermissions {
/**
* force Bukkit to update every OnlinePlayers permissions.
*/
- public void updateAllPlayers() {
+ public void updateAllPlayers()
+ {
- for (Player player : Bukkit.getServer().getOnlinePlayers()) {
+ for (Player player : Bukkit.getServer().getOnlinePlayers())
+ {
updatePermissions(player);
}
}
@@ -362,23 +414,31 @@ public class BukkitPermissions {
/**
* force Bukkit to update this Players permissions.
*/
- public void updatePlayer(Player player) {
+ public void updatePlayer(Player player)
+ {
if (player != null)
+ {
this.updatePermissions(player, null);
+ }
}
/**
* Force remove any attachments
- *
+ *
* @param player
*/
- private void removeAttachment(Player player) {
+ private void removeAttachment(Player player)
+ {
- if (attachments.containsKey(player)) {
- try {
+ if (attachments.containsKey(player))
+ {
+ try
+ {
player.removeAttachment(attachments.get(player));
- } catch (IllegalArgumentException e) {
+ }
+ catch (IllegalArgumentException e)
+ {
/*
* Failed to remove attachment
* This usually means Bukkit no longer knows of it.
@@ -391,15 +451,20 @@ public class BukkitPermissions {
/**
* Remove all attachments in case of a restart or reload.
*/
- public void removeAllAttachments() {
+ public void removeAllAttachments()
+ {
Iterator<Player> itr = attachments.keySet().iterator();
- while (itr.hasNext()) {
+ while (itr.hasNext())
+ {
Player player = itr.next();
- try {
+ try
+ {
player.removeAttachment(attachments.get(player));
- } catch (IllegalArgumentException e) {
+ }
+ catch (IllegalArgumentException e)
+ {
/*
* Failed to remove attachment
* This usually means Bukkit no longer knows of it.
@@ -409,16 +474,18 @@ public class BukkitPermissions {
attachments.clear();
}
+
/**
* Player events tracked to cause Superperms updates
- *
+ *
* @author ElgarL
- *
+ *
*/
- protected class PlayerEvents implements Listener {
-
+ protected class PlayerEvents implements Listener
+ {
@EventHandler(priority = EventPriority.LOWEST)
- public void onPlayerJoin(PlayerJoinEvent event) {
+ public void onPlayerJoin(PlayerJoinEvent event)
+ {
setPlayer_join(true);
Player player = event.getPlayer();
@@ -429,7 +496,8 @@ public class BukkitPermissions {
removeAttachment(player);
// force GM to create the player if they are not already listed.
- if (plugin.getWorldsHolder().getWorldData(player.getWorld().getName()).getUser(player.getName()) != null) {
+ if (plugin.getWorldsHolder().getWorldData(player.getWorld().getName()).getUser(player.getName()) != null)
+ {
setPlayer_join(false);
updatePermissions(event.getPlayer());
}
@@ -437,16 +505,18 @@ public class BukkitPermissions {
}
@EventHandler(priority = EventPriority.LOWEST)
- public void onPlayerChangeWorld(PlayerChangedWorldEvent event) { // has changed worlds
+ public void onPlayerChangeWorld(PlayerChangedWorldEvent event)
+ { // has changed worlds
updatePermissions(event.getPlayer(), event.getPlayer().getWorld().getName());
}
@EventHandler(priority = EventPriority.LOWEST)
- public void onPlayerKick(PlayerKickEvent event) {
+ public void onPlayerKick(PlayerKickEvent event)
+ {
Player player = event.getPlayer();
-
+
/*
* force remove any attachments as bukkit may not
*/
@@ -454,10 +524,13 @@ public class BukkitPermissions {
}
@EventHandler(priority = EventPriority.LOWEST)
- public void onPlayerQuit(PlayerQuitEvent event) {
+ public void onPlayerQuit(PlayerQuitEvent event)
+ {
if (!GroupManager.isLoaded())
+ {
return;
+ }
Player player = event.getPlayer();
@@ -468,24 +541,28 @@ public class BukkitPermissions {
}
}
- protected class BukkitEvents implements Listener {
+ protected class BukkitEvents implements Listener
+ {
@EventHandler(priority = EventPriority.NORMAL)
- public void onPluginEnable(PluginEnableEvent event) {
+ public void onPluginEnable(PluginEnableEvent event)
+ {
if (!GroupManager.isLoaded())
+ {
return;
+ }
collectPermissions();
updateAllPlayers();
}
@EventHandler(priority = EventPriority.NORMAL)
- public void onPluginDisable(PluginDisableEvent event) {
+ public void onPluginDisable(PluginDisableEvent event)
+ {
collectPermissions();
// updateAllPlayers();
}
}
-
} \ No newline at end of file
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/PermissionsReaderInterface.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/PermissionsReaderInterface.java
index 69f098949..7c6e51367 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/PermissionsReaderInterface.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/PermissionsReaderInterface.java
@@ -10,19 +10,20 @@ import org.anjocaido.groupmanager.data.Group;
//import org.anjocaido.groupmanager.data.User;
import org.bukkit.entity.Player;
+
/**
* Made by Nijikokun. Changed by Gabriel Couto
- *
+ *
* This class is intended to *read* permissions from a single world.
- *
+ *
* @author Nijikokun
* @author Gabriel Couto
* @author ElgarL
*/
-public abstract class PermissionsReaderInterface {
-
+public abstract class PermissionsReaderInterface
+{
/**
- *
+ *
* @param player
* @param string
* @return true if has permission
@@ -30,7 +31,7 @@ public abstract class PermissionsReaderInterface {
public abstract boolean has(Player player, String string);
/**
- *
+ *
* @param player
* @param string
* @return true if has permission
@@ -38,14 +39,14 @@ public abstract class PermissionsReaderInterface {
public abstract boolean permission(Player player, String string);
/**
- *
+ *
* @param userName
* @return group name for this player.
*/
public abstract String getGroup(String userName);
/**
- *
+ *
* @param userName
* @param groupName
* @return true if in group
@@ -53,28 +54,28 @@ public abstract class PermissionsReaderInterface {
public abstract boolean inGroup(String userName, String groupName);
/**
- *
+ *
* @param groupName
* @return String of prefix
*/
public abstract String getGroupPrefix(String groupName);
/**
- *
+ *
* @param groupName
* @return String of suffix
*/
public abstract String getGroupSuffix(String groupName);
/**
- *
+ *
* @param groupName
* @return true if can build
*/
public abstract boolean canGroupBuild(String groupName);
/**
- *
+ *
* @param groupName
* @param node
* @return String value
@@ -82,7 +83,7 @@ public abstract class PermissionsReaderInterface {
public abstract String getGroupPermissionString(String groupName, String node);
/**
- *
+ *
* @param groupName
* @param node
* @return integer value
@@ -90,7 +91,7 @@ public abstract class PermissionsReaderInterface {
public abstract int getGroupPermissionInteger(String groupName, String node);
/**
- *
+ *
* @param groupName
* @param node
* @return boolean value
@@ -98,7 +99,7 @@ public abstract class PermissionsReaderInterface {
public abstract boolean getGroupPermissionBoolean(String groupName, String node);
/**
- *
+ *
* @param groupName
* @param node
* @return double value
@@ -106,7 +107,7 @@ public abstract class PermissionsReaderInterface {
public abstract double getGroupPermissionDouble(String groupName, String node);
/**
- *
+ *
* @param userName
* @param node
* @return String value
@@ -114,7 +115,7 @@ public abstract class PermissionsReaderInterface {
public abstract String getUserPermissionString(String userName, String node);
/**
- *
+ *
* @param userName
* @param node
* @return integer value
@@ -122,7 +123,7 @@ public abstract class PermissionsReaderInterface {
public abstract int getUserPermissionInteger(String userName, String node);
/**
- *
+ *
* @param userName
* @param node
* @return boolean value
@@ -130,7 +131,7 @@ public abstract class PermissionsReaderInterface {
public abstract boolean getUserPermissionBoolean(String userName, String node);
/**
- *
+ *
* @param userName
* @param node
* @return double value
@@ -138,7 +139,7 @@ public abstract class PermissionsReaderInterface {
public abstract double getUserPermissionDouble(String userName, String node);
/**
- *
+ *
* @param userName
* @param node
* @return String value
@@ -146,7 +147,7 @@ public abstract class PermissionsReaderInterface {
public abstract String getPermissionString(String userName, String node);
/**
- *
+ *
* @param userName
* @param node
* @return integer value
@@ -154,7 +155,7 @@ public abstract class PermissionsReaderInterface {
public abstract int getPermissionInteger(String userName, String node);
/**
- *
+ *
* @param userName
* @param node
* @return boolean value
@@ -162,7 +163,7 @@ public abstract class PermissionsReaderInterface {
public abstract boolean getPermissionBoolean(String userName, String node);
/**
- *
+ *
* @param userName
* @param node
* @return double value
@@ -171,58 +172,50 @@ public abstract class PermissionsReaderInterface {
/////////////////////////////
/**
- * Gets the appropriate prefix for the user.
- * This method is a utility method for chat plugins to get the user's prefix
- * without having to look at every one of the user's ancestors.
- * Returns an empty string if user has no parent groups.
- *
+ * Gets the appropriate prefix for the user. This method is a utility method for chat plugins to get the user's
+ * prefix without having to look at every one of the user's ancestors. Returns an empty string if user has no parent
+ * groups.
+ *
* @param user Player's name
* @return Player's prefix
*/
public abstract String getUserPrefix(String user);
/**
- * Gets the appropriate suffix for the user.
- * This method is a utility method for chat plugins to get the user's suffix
- * without having to look at every one of the user's ancestors.
- * Returns an empty string if user has no parent groups.
- *
+ * Gets the appropriate suffix for the user. This method is a utility method for chat plugins to get the user's
+ * suffix without having to look at every one of the user's ancestors. Returns an empty string if user has no parent
+ * groups.
+ *
* @param user Player's name
* @return Player's suffix
*/
public abstract String getUserSuffix(String user);
/**
- * Returns the group object representing the default group of the given
- * world.
- * This method will return null if the object does not exist or the world
- * has no default group.
- *
- * @return Group object representing default world, or null if it doesn't
- * exist or is not defined.
+ * Returns the group object representing the default group of the given world. This method will return null if the
+ * object does not exist or the world has no default group.
+ *
+ * @return Group object representing default world, or null if it doesn't exist or is not defined.
*/
public abstract Group getDefaultGroup();
/**
* Gets a array of the names of all parent groups in the same world.
- *
+ *
* @param name Target user's name
- * @return An array containing the names of all parent groups (including
- * ancestors) that are in the same world
+ * @return An array containing the names of all parent groups (including ancestors) that are in the same world
*/
public abstract String[] getGroups(String name);
public abstract String getInfoString(String entryName, String path, boolean isGroup);
//public abstract String getInfoString(String entryName, String path, boolean isGroup, Comparator<String> comparator);
-
public abstract int getInfoInteger(String entryName, String path, boolean isGroup);
//public abstract int getInfoInteger(String entryName, String path, boolean isGroup, Comparator<Integer> comparator);
-
/**
* Gets a double from the Info node without inheritance.
- *
+ *
* @param entryName
* @param path
* @param isGroup
@@ -231,11 +224,9 @@ public abstract class PermissionsReaderInterface {
public abstract double getInfoDouble(String entryName, String path, boolean isGroup);
//public abstract double getInfoDouble(String entryName, String path, boolean isGroup, Comparator<Double> comparator);
-
public abstract boolean getInfoBoolean(String entryName, String path, boolean isGroup);
//public abstract boolean getInfoBoolean(String entryName, String path, boolean isGroup, Comparator<Boolean> comparator);
-
public abstract void addUserInfo(String name, String path, Object data);
public abstract void removeUserInfo(String name, String path);
@@ -245,7 +236,6 @@ public abstract class PermissionsReaderInterface {
public abstract void removeGroupInfo(String name, String path);
//////////////////////////////
-
public abstract List<String> getAllPlayersPermissions(String userName);
public abstract Set<String> getAllPlayersPermissions(String userName, Boolean includeChildren);
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GMLoggerHandler.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GMLoggerHandler.java
index de5348b17..df305aa38 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GMLoggerHandler.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GMLoggerHandler.java
@@ -8,19 +8,24 @@ import java.util.logging.ConsoleHandler;
import java.util.logging.Level;
import java.util.logging.LogRecord;
+
/**
- *
+ *
* @author gabrielcouto
*/
-public class GMLoggerHandler extends ConsoleHandler {
-
+public class GMLoggerHandler extends ConsoleHandler
+{
@Override
- public void publish(LogRecord record) {
+ public void publish(LogRecord record)
+ {
String message = "GroupManager - " + record.getLevel() + " - " + record.getMessage();
- if (record.getLevel().equals(Level.SEVERE) || record.getLevel().equals(Level.WARNING)) {
+ if (record.getLevel().equals(Level.SEVERE) || record.getLevel().equals(Level.WARNING))
+ {
System.err.println(message);
- } else {
+ }
+ else
+ {
System.out.println(message);
}
}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GroupManagerPermissions.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GroupManagerPermissions.java
index 4a7298b9c..624c6769a 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GroupManagerPermissions.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GroupManagerPermissions.java
@@ -4,13 +4,14 @@
*/
package org.anjocaido.groupmanager.utils;
+
/**
* Just a list of commands for this plugin
- *
+ *
* @author gabrielcouto
*/
-public enum GroupManagerPermissions {
-
+public enum GroupManagerPermissions
+{
manuadd,
manudel,
manuaddsub,
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/PermissionCheckResult.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/PermissionCheckResult.java
index eb6633863..df6e4b1cc 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/PermissionCheckResult.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/PermissionCheckResult.java
@@ -6,15 +6,16 @@ package org.anjocaido.groupmanager.utils;
import org.anjocaido.groupmanager.data.DataUnit;
+
/**
- *
+ *
* @author gabrielcouto
*/
-public class PermissionCheckResult {
-
+public class PermissionCheckResult
+{
/**
* It should be the owner of the access level found.
- *
+ *
* Use instanceof to find the owner type
*/
public DataUnit owner;
@@ -27,40 +28,34 @@ public class PermissionCheckResult {
*/
public String askedPermission;
/**
- * The result conclusion of the search.
- * It determines if the owner can do, or not.
- *
+ * The result conclusion of the search. It determines if the owner can do, or not.
+ *
* It even determines if it has an owner.
*/
public Type resultType = Type.NOTFOUND;
+
/**
* The type of result the search can give.
*/
- public enum Type {
-
+ public enum Type
+ {
/**
- * If found a matching node starting with '+'.
- * It means the user CAN do the permission.
+ * If found a matching node starting with '+'. It means the user CAN do the permission.
*/
EXCEPTION,
/**
- * If found a matching node starting with '-'.
- * It means the user CANNOT do the permission.
+ * If found a matching node starting with '-'. It means the user CANNOT do the permission.
*/
NEGATION,
/**
- * If just found a common matching node.
- * IT means the user CAN do the permission.
+ * If just found a common matching node. IT means the user CAN do the permission.
*/
FOUND,
/**
- * If no matchin node was found.
- * It means the user CANNOT do the permission.
- *
- * owner field and accessLevel field should not be considered,
- * when type is
- * NOTFOUND
+ * If no matchin node was found. It means the user CANNOT do the permission.
+ *
+ * owner field and accessLevel field should not be considered, when type is NOTFOUND
*/
NOTFOUND
}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/StringPermissionComparator.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/StringPermissionComparator.java
index 5a56cd9fc..38cb15349 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/StringPermissionComparator.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/StringPermissionComparator.java
@@ -6,45 +6,54 @@ package org.anjocaido.groupmanager.utils;
import java.util.Comparator;
+
/**
- *
+ *
* @author gabrielcouto
*/
-public class StringPermissionComparator implements Comparator<String> {
-
+public class StringPermissionComparator implements Comparator<String>
+{
@Override
- public int compare(String permA, String permB) {
+ public int compare(String permA, String permB)
+ {
boolean ap = permA.startsWith("+");
boolean bp = permB.startsWith("+");
boolean am = permA.startsWith("-");
boolean bm = permB.startsWith("-");
- if (ap && bp) {
+ if (ap && bp)
+ {
return 0;
}
- if (ap && !bp) {
+ if (ap && !bp)
+ {
return -1;
}
- if (!ap && bp) {
+ if (!ap && bp)
+ {
return 1;
}
- if (am && bm) {
+ if (am && bm)
+ {
return 0;
}
- if (am && !bm) {
+ if (am && !bm)
+ {
return -1;
}
- if (!am && bm) {
+ if (!am && bm)
+ {
return 1;
}
return permA.compareToIgnoreCase(permB);
}
-
private static StringPermissionComparator instance;
- public static StringPermissionComparator getInstance() {
+ public static StringPermissionComparator getInstance()
+ {
- if (instance == null) {
+ if (instance == null)
+ {
instance = new StringPermissionComparator();
}
return instance;
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/Tasks.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/Tasks.java
index d75737c66..da345338d 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/Tasks.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/Tasks.java
@@ -22,19 +22,21 @@ import java.util.List;
import org.anjocaido.groupmanager.GroupManager;
import org.anjocaido.groupmanager.data.Group;
+
/**
- *
+ *
* @author gabrielcouto
*/
-public abstract class Tasks {
-
+public abstract class Tasks
+{
/**
* Gets the exception stack trace as a string.
- *
+ *
* @param exception
* @return stack trace as a string
*/
- public static String getStackTraceAsString(Exception exception) {
+ public static String getStackTraceAsString(Exception exception)
+ {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
@@ -42,7 +44,8 @@ public abstract class Tasks {
return sw.toString();
}
- public static void copy(InputStream src, File dst) throws IOException {
+ public static void copy(InputStream src, File dst) throws IOException
+ {
InputStream in = src;
OutputStream out = new FileOutputStream(dst);
@@ -50,17 +53,22 @@ public abstract class Tasks {
// Transfer bytes from in to out
byte[] buf = new byte[1024];
int len;
- while ((len = in.read(buf)) > 0) {
+ while ((len = in.read(buf)) > 0)
+ {
out.write(buf, 0, len);
}
out.close();
- try {
+ try
+ {
in.close();
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
}
}
- public static void copy(File src, File dst) throws IOException {
+ public static void copy(File src, File dst) throws IOException
+ {
InputStream in = new FileInputStream(src);
copy(in, dst);
@@ -68,11 +76,12 @@ public abstract class Tasks {
/**
* Appends a string to a file
- *
+ *
* @param data
* @param file
*/
- public static void appendStringToFile(String data, String file) throws IOException {
+ public static void appendStringToFile(String data, String file) throws IOException
+ {
FileWriter outStream = new FileWriter("." + System.getProperty("file.separator") + file, true);
@@ -88,16 +97,24 @@ public abstract class Tasks {
out.close();
}
- public static void removeOldFiles(GroupManager gm, File folder) {
-
- if (folder.isDirectory()) {
- long oldTime = System.currentTimeMillis() - (((long) gm.getGMConfig().getBackupDuration() * 60 * 60) * 1000);
- for (File olds : folder.listFiles()) {
- if (olds.isFile()) {
- if (olds.lastModified() < oldTime) {
- try {
+ public static void removeOldFiles(GroupManager gm, File folder)
+ {
+
+ if (folder.isDirectory())
+ {
+ long oldTime = System.currentTimeMillis() - (((long)gm.getGMConfig().getBackupDuration() * 60 * 60) * 1000);
+ for (File olds : folder.listFiles())
+ {
+ if (olds.isFile())
+ {
+ if (olds.lastModified() < oldTime)
+ {
+ try
+ {
olds.delete();
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
}
}
}
@@ -105,7 +122,8 @@ public abstract class Tasks {
}
}
- public static String getDateString() {
+ public static String getDateString()
+ {
GregorianCalendar now = new GregorianCalendar();
String date = "";
@@ -117,59 +135,75 @@ public abstract class Tasks {
return date;
}
- public static String getStringListInString(List<String> list) {
+ public static String getStringListInString(List<String> list)
+ {
- if (list == null) {
+ if (list == null)
+ {
return "";
}
String result = "";
- for (int i = 0; i < list.size(); i++) {
+ for (int i = 0; i < list.size(); i++)
+ {
result += list.get(i);
- if (i < list.size() - 1) {
+ if (i < list.size() - 1)
+ {
result += ", ";
}
}
return result;
}
- public static String getStringArrayInString(String[] list) {
+ public static String getStringArrayInString(String[] list)
+ {
- if (list == null) {
+ if (list == null)
+ {
return "";
}
String result = "";
- for (int i = 0; i < list.length; i++) {
+ for (int i = 0; i < list.length; i++)
+ {
result += list[i];
- if (i < ((list.length) - 1)) {
+ if (i < ((list.length) - 1))
+ {
result += ", ";
}
}
return result;
}
- public static String getGroupListInString(List<Group> list) {
+ public static String getGroupListInString(List<Group> list)
+ {
- if (list == null) {
+ if (list == null)
+ {
return "";
}
String result = "";
- for (int i = 0; i < list.size(); i++) {
+ for (int i = 0; i < list.size(); i++)
+ {
result += list.get(i).getName();
- if (i < list.size() - 1) {
+ if (i < list.size() - 1)
+ {
result += ", ";
}
}
return result;
}
- public static String join(String[] arr, String separator) {
+ public static String join(String[] arr, String separator)
+ {
if (arr.length == 0)
+ {
return "";
+ }
String out = arr[0].toString();
for (int i = 1; i < arr.length; i++)
+ {
out += separator + arr[i];
+ }
return out;
}
-
}
diff --git a/EssentialsProtect/src/net/ess3/protect/EssentialsConnect.java b/EssentialsProtect/src/net/ess3/protect/EssentialsConnect.java
index b91f6740e..7ccbd1f92 100644
--- a/EssentialsProtect/src/net/ess3/protect/EssentialsConnect.java
+++ b/EssentialsProtect/src/net/ess3/protect/EssentialsConnect.java
@@ -11,8 +11,8 @@ import org.bukkit.plugin.Plugin;
public class EssentialsConnect
{
private static final Logger LOGGER = Logger.getLogger("Minecraft");
- private final transient IEssentials ess;
- private final transient IProtect protect;
+ private final IEssentials ess;
+ private final IProtect protect;
public EssentialsConnect(final Plugin essPlugin, final Plugin essProtect)
{
diff --git a/EssentialsProtect/src/net/ess3/protect/EssentialsProtect.java b/EssentialsProtect/src/net/ess3/protect/EssentialsProtect.java
index 98e0596f2..dec2ecd8f 100644
--- a/EssentialsProtect/src/net/ess3/protect/EssentialsProtect.java
+++ b/EssentialsProtect/src/net/ess3/protect/EssentialsProtect.java
@@ -11,8 +11,8 @@ import org.bukkit.plugin.java.JavaPlugin;
public class EssentialsProtect extends JavaPlugin implements IProtect
{
private static final Logger LOGGER = Logger.getLogger("Minecraft");
- private transient EssentialsConnect ess = null;
- private transient ProtectHolder settings = null;
+ private EssentialsConnect ess = null;
+ private ProtectHolder settings = null;
@Override
public void onEnable()
diff --git a/EssentialsProtect/src/net/ess3/protect/EssentialsProtectBlockListener.java b/EssentialsProtect/src/net/ess3/protect/EssentialsProtectBlockListener.java
index 6446adc44..01fc2651b 100644
--- a/EssentialsProtect/src/net/ess3/protect/EssentialsProtectBlockListener.java
+++ b/EssentialsProtect/src/net/ess3/protect/EssentialsProtectBlockListener.java
@@ -13,7 +13,7 @@ import org.bukkit.event.block.BlockIgniteEvent;
public class EssentialsProtectBlockListener implements Listener
{
- final private transient IProtect prot;
+ final private IProtect prot;
public EssentialsProtectBlockListener(final IProtect parent)
{
diff --git a/EssentialsProtect/src/net/ess3/protect/EssentialsProtectEntityListener.java b/EssentialsProtect/src/net/ess3/protect/EssentialsProtectEntityListener.java
index 4fa71139b..f111c7b78 100644
--- a/EssentialsProtect/src/net/ess3/protect/EssentialsProtectEntityListener.java
+++ b/EssentialsProtect/src/net/ess3/protect/EssentialsProtectEntityListener.java
@@ -11,7 +11,7 @@ import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
//TODO: remove unnecessary return statements
public class EssentialsProtectEntityListener implements Listener
{
- private final transient IProtect prot;
+ private final IProtect prot;
public EssentialsProtectEntityListener(final IProtect prot)
{
@@ -47,7 +47,7 @@ public class EssentialsProtectEntityListener implements Listener
return;
}
if (cause == DamageCause.BLOCK_EXPLOSION && (Permissions.PREVENTDAMAGE_TNT.isAuthorized(user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(
- user)))
+ user)))
{
event.setCancelled(true);
return;
@@ -69,21 +69,21 @@ public class EssentialsProtectEntityListener implements Listener
//Creeper explode prevention
if (eAttack instanceof Creeper && settings.getData().getPrevent().isCreeperExplosion() || (Permissions.PREVENTDAMAGE_CREEPER.isAuthorized(
- user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user)))
+ user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user)))
{
event.setCancelled(true);
return;
}
if ((event.getEntity() instanceof Fireball || event.getEntity() instanceof SmallFireball) && (Permissions.PREVENTDAMAGE_FIREBALL.isAuthorized(
- user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user)))
+ user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user)))
{
event.setCancelled(true);
return;
}
if ((event.getEntity() instanceof WitherSkull && Permissions.PREVENTDAMAGE_WITHERSKULL.isAuthorized(
- user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user)))
+ user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user)))
{
event.setCancelled(true);
return;
@@ -96,9 +96,9 @@ public class EssentialsProtectEntityListener implements Listener
}
if (edEvent.getDamager() instanceof Projectile && ((Permissions.PREVENTDAMAGE_PROJECTILES.isAuthorized(
- user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(
- user)) || (((Projectile)edEvent.getDamager()).getShooter() instanceof Player && (!Permissions.PVP.isAuthorized(
- user) || !Permissions.PVP.isAuthorized((Player)((Projectile)edEvent.getDamager()).getShooter())))))
+ user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(
+ user)) || (((Projectile)edEvent.getDamager()).getShooter() instanceof Player && (!Permissions.PVP.isAuthorized(
+ user) || !Permissions.PVP.isAuthorized((Player)((Projectile)edEvent.getDamager()).getShooter())))))
{
event.setCancelled(true);
return;
@@ -115,13 +115,13 @@ public class EssentialsProtectEntityListener implements Listener
}
if (cause == DamageCause.SUFFOCATION && (Permissions.PREVENTDAMAGE_SUFFOCATION.isAuthorized(user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(
- user)))
+ user)))
{
event.setCancelled(true);
return;
}
if ((cause == DamageCause.FIRE || cause == DamageCause.FIRE_TICK) && (Permissions.PREVENTDAMAGE_FIRE.isAuthorized(
- user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user)))
+ user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user)))
{
event.setCancelled(true);
return;
@@ -132,7 +132,7 @@ public class EssentialsProtectEntityListener implements Listener
return;
}
if (cause == DamageCause.LIGHTNING && (Permissions.PREVENTDAMAGE_LIGHTNING.isAuthorized(user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(
- user)))
+ user)))
{
event.setCancelled(true);
}
@@ -143,7 +143,8 @@ public class EssentialsProtectEntityListener implements Listener
}
}
}
- // return statements are probably not needed here
+ // return statements are probably not needed here
+
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onEntityExplode(final EntityExplodeEvent event)
{
diff --git a/EssentialsProtect/src/net/ess3/protect/EssentialsProtectWeatherListener.java b/EssentialsProtect/src/net/ess3/protect/EssentialsProtectWeatherListener.java
index c12dc4a52..b20f7b17d 100644
--- a/EssentialsProtect/src/net/ess3/protect/EssentialsProtectWeatherListener.java
+++ b/EssentialsProtect/src/net/ess3/protect/EssentialsProtectWeatherListener.java
@@ -10,7 +10,7 @@ import org.bukkit.event.weather.WeatherChangeEvent;
public class EssentialsProtectWeatherListener implements Listener
{
- private final transient IProtect prot;
+ private final IProtect prot;
public EssentialsProtectWeatherListener(final IProtect prot)
{
diff --git a/EssentialsProtect/src/net/ess3/protect/Permissions.java b/EssentialsProtect/src/net/ess3/protect/Permissions.java
index 7cacd741f..3655924cd 100644
--- a/EssentialsProtect/src/net/ess3/protect/Permissions.java
+++ b/EssentialsProtect/src/net/ess3/protect/Permissions.java
@@ -29,7 +29,7 @@ public enum Permissions implements IPermission
private static final String base = "essentials.protect.";
private final String permission;
private final PermissionDefault defaultPerm;
- private transient String parent = null;
+ private String parent = null;
private Permissions()
{
@@ -72,6 +72,5 @@ public enum Permissions implements IPermission
{
return PermissionFactory.checkPermission(sender, this);
}
-
public static DotStarPermission ENTITY_TARGET_BYPASS = new DotStarPermission("essentials.protect.entitytarget.bypass");
}
diff --git a/EssentialsSigns/pom.xml b/EssentialsSigns/pom.xml
index 85a47c60b..781bd4512 100644
--- a/EssentialsSigns/pom.xml
+++ b/EssentialsSigns/pom.xml
@@ -1,20 +1,20 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>net.essentials3</groupId>
- <artifactId>BuildAll</artifactId>
- <version>3.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
+ <parent>
+ <groupId>net.essentials3</groupId>
+ <artifactId>BuildAll</artifactId>
+ <version>3.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
- <artifactId>EssentialsSigns</artifactId>
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>Essentials</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
+ <artifactId>EssentialsSigns</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>Essentials</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
</project>
diff --git a/EssentialsSigns/src/net/ess3/signs/EssentialsSign.java b/EssentialsSigns/src/net/ess3/signs/EssentialsSign.java
index 10ed1989d..cf1b44ef8 100644
--- a/EssentialsSigns/src/net/ess3/signs/EssentialsSign.java
+++ b/EssentialsSigns/src/net/ess3/signs/EssentialsSign.java
@@ -22,7 +22,7 @@ import org.bukkit.inventory.ItemStack;
public class EssentialsSign
{
private static final Set<Material> EMPTY_SET = new HashSet<Material>();
- protected transient final String signName;
+ protected final String signName;
public EssentialsSign(final String signName)
{
@@ -212,8 +212,9 @@ public class EssentialsSign
{
return true;
}
- final BlockFace[] directions = new BlockFace[]{
- BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST
+ final BlockFace[] directions = new BlockFace[]
+ {
+ BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST
};
for (BlockFace blockFace : directions)
{
@@ -254,7 +255,7 @@ public class EssentialsSign
{
return EMPTY_SET;
}
-
+
protected final void validateTrade(final ISign sign, final int index, final IEssentials ess) throws SignException
{
final String line = sign.getLine(index).trim();
@@ -430,8 +431,8 @@ public class EssentialsSign
static class EventSign implements ISign
{
- private final transient SignChangeEvent event;
- private final transient Block block;
+ private final SignChangeEvent event;
+ private final Block block;
public EventSign(final SignChangeEvent event)
{
@@ -466,8 +467,8 @@ public class EssentialsSign
public static class BlockSign implements ISign
{
- private final transient Sign sign;
- private final transient Block block;
+ private final Sign sign;
+ private final Block block;
public BlockSign(final Block block)
{
diff --git a/EssentialsSigns/src/net/ess3/signs/EssentialsSignsPlugin.java b/EssentialsSigns/src/net/ess3/signs/EssentialsSignsPlugin.java
index cdd4494ea..29e2edd59 100644
--- a/EssentialsSigns/src/net/ess3/signs/EssentialsSignsPlugin.java
+++ b/EssentialsSigns/src/net/ess3/signs/EssentialsSignsPlugin.java
@@ -15,8 +15,8 @@ import org.bukkit.plugin.java.JavaPlugin;
public class EssentialsSignsPlugin extends JavaPlugin implements ISignsPlugin
{
- private static final transient Logger LOGGER = Bukkit.getLogger();
- private transient SignsConfigHolder config;
+ private static final Logger LOGGER = Bukkit.getLogger();
+ private SignsConfigHolder config;
@Override
public void onEnable()
diff --git a/EssentialsSigns/src/net/ess3/signs/SignConfig.java b/EssentialsSigns/src/net/ess3/signs/SignConfig.java
index 1b8bfddc3..34516dbc4 100644
--- a/EssentialsSigns/src/net/ess3/signs/SignConfig.java
+++ b/EssentialsSigns/src/net/ess3/signs/SignConfig.java
@@ -23,13 +23,12 @@ public class SignConfig implements StorageObject
{
this.signs = signs;
}
-
@Comment(
- {
- "How many times per second can Essentials signs be interacted with.",
- "Values should be between 1-20, 20 being virtually no lag protection.",
- "Lower numbers will reduce the possiblity of lag, but may annoy players."
- })
+ {
+ "How many times per second can Essentials signs be interacted with.",
+ "Values should be between 1-20, 20 being virtually no lag protection.",
+ "Lower numbers will reduce the possiblity of lag, but may annoy players."
+ })
private int signUsesPerSecond = 4;
public int getSignUsePerSecond()
diff --git a/EssentialsSigns/src/net/ess3/signs/SignsConfigHolder.java b/EssentialsSigns/src/net/ess3/signs/SignsConfigHolder.java
index 9c62337c4..613c2edee 100644
--- a/EssentialsSigns/src/net/ess3/signs/SignsConfigHolder.java
+++ b/EssentialsSigns/src/net/ess3/signs/SignsConfigHolder.java
@@ -9,7 +9,7 @@ import org.bukkit.plugin.Plugin;
public class SignsConfigHolder extends AsyncStorageObjectHolder<SignConfig>
{
- private final transient Plugin plugin;
+ private final Plugin plugin;
private Set<EssentialsSign> enabledSigns = new HashSet<EssentialsSign>();
private boolean signsEnabled = false;
diff --git a/EssentialsSigns/src/net/ess3/signs/listeners/SignBlockListener.java b/EssentialsSigns/src/net/ess3/signs/listeners/SignBlockListener.java
index 4aa8182b5..69ca1b4c2 100644
--- a/EssentialsSigns/src/net/ess3/signs/listeners/SignBlockListener.java
+++ b/EssentialsSigns/src/net/ess3/signs/listeners/SignBlockListener.java
@@ -21,8 +21,8 @@ import org.bukkit.event.block.*;
public class SignBlockListener implements Listener
{
- private final transient IEssentials ess;
- private final transient ISignsPlugin plugin;
+ private final IEssentials ess;
+ private final ISignsPlugin plugin;
private final static Logger LOGGER = Logger.getLogger("Minecraft");
private final static int WALL_SIGN = Material.WALL_SIGN.getId();
private final static int SIGN_POST = Material.SIGN_POST.getId();
@@ -150,7 +150,7 @@ public class SignBlockListener implements Listener
final Block block = event.getBlock();
if (((block.getTypeId() == WALL_SIGN || block.getTypeId() == SIGN_POST) && EssentialsSign.isValidSign(
- new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block))
+ new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block))
{
event.setCancelled(true);
return;
@@ -175,7 +175,7 @@ public class SignBlockListener implements Listener
final Block block = event.getBlock();
if (((block.getTypeId() == WALL_SIGN || block.getTypeId() == SIGN_POST) && EssentialsSign.isValidSign(
- new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block))
+ new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block))
{
event.setCancelled(true);
return;
@@ -201,7 +201,7 @@ public class SignBlockListener implements Listener
for (Block block : event.getBlocks())
{
if (((block.getTypeId() == WALL_SIGN || block.getTypeId() == SIGN_POST) && EssentialsSign.isValidSign(
- new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block))
+ new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block))
{
event.setCancelled(true);
return;
@@ -229,7 +229,7 @@ public class SignBlockListener implements Listener
{
final Block block = event.getBlock();
if (((block.getTypeId() == WALL_SIGN || block.getTypeId() == SIGN_POST) && EssentialsSign.isValidSign(
- new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block))
+ new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block))
{
event.setCancelled(true);
return;
diff --git a/EssentialsSigns/src/net/ess3/signs/listeners/SignEntityListener.java b/EssentialsSigns/src/net/ess3/signs/listeners/SignEntityListener.java
index 3c9d63977..be1e5398e 100644
--- a/EssentialsSigns/src/net/ess3/signs/listeners/SignEntityListener.java
+++ b/EssentialsSigns/src/net/ess3/signs/listeners/SignEntityListener.java
@@ -14,8 +14,8 @@ import org.bukkit.event.entity.EntityExplodeEvent;
public class SignEntityListener implements Listener
{
- private final transient IEssentials ess;
- private final transient ISignsPlugin plugin;
+ private final IEssentials ess;
+ private final ISignsPlugin plugin;
public SignEntityListener(final IEssentials ess, final ISignsPlugin plugin)
{
@@ -34,7 +34,7 @@ public class SignEntityListener implements Listener
for (Block block : event.blockList())
{
if (((block.getTypeId() == Material.WALL_SIGN.getId() || block.getTypeId() == Material.SIGN_POST.getId()) && EssentialsSign.isValidSign(
- new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block))
+ new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block))
{
event.setCancelled(true);
return;
@@ -60,7 +60,7 @@ public class SignEntityListener implements Listener
final Block block = event.getBlock();
if (((block.getTypeId() == Material.WALL_SIGN.getId() || block.getTypeId() == Material.SIGN_POST.getId()) && EssentialsSign.isValidSign(
- new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block))
+ new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block))
{
event.setCancelled(true);
return;
diff --git a/EssentialsSigns/src/net/ess3/signs/listeners/SignPlayerListener.java b/EssentialsSigns/src/net/ess3/signs/listeners/SignPlayerListener.java
index 6d6f14b93..d6c6e3ece 100644
--- a/EssentialsSigns/src/net/ess3/signs/listeners/SignPlayerListener.java
+++ b/EssentialsSigns/src/net/ess3/signs/listeners/SignPlayerListener.java
@@ -15,8 +15,8 @@ import org.bukkit.event.player.PlayerInteractEvent;
public class SignPlayerListener implements Listener
{
- private final transient IEssentials ess;
- private final transient ISignsPlugin plugin;
+ private final IEssentials ess;
+ private final ISignsPlugin plugin;
public SignPlayerListener(final IEssentials ess, final ISignsPlugin plugin)
{
diff --git a/EssentialsSigns/src/net/ess3/signs/signs/SignEnchant.java b/EssentialsSigns/src/net/ess3/signs/signs/SignEnchant.java
index 50e99a8d7..b05bc10f2 100644
--- a/EssentialsSigns/src/net/ess3/signs/signs/SignEnchant.java
+++ b/EssentialsSigns/src/net/ess3/signs/signs/SignEnchant.java
@@ -90,7 +90,7 @@ public class SignEnchant extends EssentialsSign
final ItemStack playerHand = player.getPlayer().getItemInHand();
if (playerHand == null || playerHand.getAmount() != 1 || (playerHand.containsEnchantment(enchantment) && playerHand.getEnchantmentLevel(
- enchantment) == level))
+ enchantment) == level))
{
throw new SignException(_("missingItems", 1, sign.getLine(1)));
}
diff --git a/EssentialsSigns/src/net/ess3/signs/signs/SignKit.java b/EssentialsSigns/src/net/ess3/signs/signs/SignKit.java
index fc95f09d6..c962eae85 100644
--- a/EssentialsSigns/src/net/ess3/signs/signs/SignKit.java
+++ b/EssentialsSigns/src/net/ess3/signs/signs/SignKit.java
@@ -55,7 +55,7 @@ public class SignKit extends EssentialsSign
final String kitName = sign.getLine(1).toLowerCase(Locale.ENGLISH);
final String group = sign.getLine(2);
if ((!group.isEmpty() && ("§2Everyone".equals(group) || ess.getRanks().inGroup(player, group))) || (group.isEmpty() && Permissions.KITS.isAuthorized(
- player, kitName)))
+ player, kitName)))
{
final Trade charge = getTrade(sign, 3, ess);
charge.isAffordableFor(player);
diff --git a/EssentialsSigns/src/net/ess3/signs/signs/SignRepair.java b/EssentialsSigns/src/net/ess3/signs/signs/SignRepair.java
index cd3d9dc93..5b60c348c 100644
--- a/EssentialsSigns/src/net/ess3/signs/signs/SignRepair.java
+++ b/EssentialsSigns/src/net/ess3/signs/signs/SignRepair.java
@@ -40,8 +40,9 @@ public class SignRepair extends EssentialsSign
Commandrepair command = new Commandrepair();
command.init(ess, "repair");
- String[] args = new String[]{
- sign.getLine(1)
+ String[] args = new String[]
+ {
+ sign.getLine(1)
};
try
{
diff --git a/EssentialsSigns/src/net/ess3/signs/signs/SignWarp.java b/EssentialsSigns/src/net/ess3/signs/signs/SignWarp.java
index 43e4792aa..750e71ee7 100644
--- a/EssentialsSigns/src/net/ess3/signs/signs/SignWarp.java
+++ b/EssentialsSigns/src/net/ess3/signs/signs/SignWarp.java
@@ -53,7 +53,7 @@ public class SignWarp extends EssentialsSign
final String group = sign.getLine(2);
if ((!group.isEmpty() && ("§2Everyone".equals(group) || ess.getRanks().inGroup(player, group))) || (group.isEmpty() && Permissions.WARPS.isAuthorized(
- player, warpName)))
+ player, warpName)))
{
final Trade charge = getTrade(sign, 3, ess);
try
diff --git a/EssentialsUpdate/src/net/ess3/update/AbstractWorkListener.java b/EssentialsUpdate/src/net/ess3/update/AbstractWorkListener.java
index e63508464..6b39beb1a 100644
--- a/EssentialsUpdate/src/net/ess3/update/AbstractWorkListener.java
+++ b/EssentialsUpdate/src/net/ess3/update/AbstractWorkListener.java
@@ -10,9 +10,8 @@ public abstract class AbstractWorkListener
this.plugin = plugin;
this.newVersionInfo = newVersionInfo;
}
-
- private final transient Plugin plugin;
- private final transient VersionInfo newVersionInfo;
+ private final Plugin plugin;
+ private final VersionInfo newVersionInfo;
public final void onWorkAbort()
{
diff --git a/EssentialsUpdate/src/net/ess3/update/EssentialsHelp.java b/EssentialsUpdate/src/net/ess3/update/EssentialsHelp.java
index a4629ce14..03d9bb937 100644
--- a/EssentialsUpdate/src/net/ess3/update/EssentialsHelp.java
+++ b/EssentialsUpdate/src/net/ess3/update/EssentialsHelp.java
@@ -17,11 +17,11 @@ import org.bukkit.plugin.PluginManager;
public class EssentialsHelp implements Listener
{
- private transient Player chatUser;
- private final transient Server server;
- private final transient Plugin plugin;
- private transient IrcBot ircBot;
- private final transient Map<String, Command> commands = new HashMap<String, Command>();
+ private Player chatUser;
+ private final Server server;
+ private final Plugin plugin;
+ private IrcBot ircBot;
+ private final Map<String, Command> commands = new HashMap<String, Command>();
public EssentialsHelp(final Plugin plugin)
{
diff --git a/EssentialsUpdate/src/net/ess3/update/EssentialsUpdate.java b/EssentialsUpdate/src/net/ess3/update/EssentialsUpdate.java
index 33875423a..13aec2c00 100644
--- a/EssentialsUpdate/src/net/ess3/update/EssentialsUpdate.java
+++ b/EssentialsUpdate/src/net/ess3/update/EssentialsUpdate.java
@@ -9,8 +9,8 @@ import org.bukkit.plugin.java.JavaPlugin;
public class EssentialsUpdate extends JavaPlugin
{
- private transient EssentialsHelp essentialsHelp;
- private transient UpdateProcess updateProcess;
+ private EssentialsHelp essentialsHelp;
+ private UpdateProcess updateProcess;
@Override
public void onEnable()
diff --git a/EssentialsUpdate/src/net/ess3/update/GetFile.java b/EssentialsUpdate/src/net/ess3/update/GetFile.java
index 9636e3bd1..4b8d67562 100644
--- a/EssentialsUpdate/src/net/ess3/update/GetFile.java
+++ b/EssentialsUpdate/src/net/ess3/update/GetFile.java
@@ -14,8 +14,8 @@ import org.bukkit.Bukkit;
public class GetFile
{
- private transient URLConnection connection;
- private transient MessageDigest digest;
+ private URLConnection connection;
+ private MessageDigest digest;
public GetFile(final String urlString) throws MalformedURLException, IOException
{
diff --git a/EssentialsUpdate/src/net/ess3/update/ModuleInfo.java b/EssentialsUpdate/src/net/ess3/update/ModuleInfo.java
index 993575cbf..e0380cf14 100644
--- a/EssentialsUpdate/src/net/ess3/update/ModuleInfo.java
+++ b/EssentialsUpdate/src/net/ess3/update/ModuleInfo.java
@@ -7,9 +7,9 @@ import org.bukkit.configuration.Configuration;
public class ModuleInfo
{
- private final transient String url;
- private final transient String version;
- private final transient String hash;
+ private final String url;
+ private final String version;
+ private final String hash;
public ModuleInfo(final Configuration updateConfig, final String path)
{
diff --git a/EssentialsUpdate/src/net/ess3/update/PastieUpload.java b/EssentialsUpdate/src/net/ess3/update/PastieUpload.java
index fba475b70..0880960ea 100644
--- a/EssentialsUpdate/src/net/ess3/update/PastieUpload.java
+++ b/EssentialsUpdate/src/net/ess3/update/PastieUpload.java
@@ -11,7 +11,7 @@ import java.util.regex.Pattern;
public class PastieUpload
{
- private final transient PostToUrl connection;
+ private final PostToUrl connection;
private final Pattern pattern = Pattern.compile("(?s).*\\?key=([a-z0-9]+).*");
public PastieUpload() throws MalformedURLException
diff --git a/EssentialsUpdate/src/net/ess3/update/PostToUrl.java b/EssentialsUpdate/src/net/ess3/update/PostToUrl.java
index 28fc13c55..5a1bddff9 100644
--- a/EssentialsUpdate/src/net/ess3/update/PostToUrl.java
+++ b/EssentialsUpdate/src/net/ess3/update/PostToUrl.java
@@ -14,9 +14,9 @@ import java.util.Random;
public class PostToUrl
{
- private final transient URL url;
- private final transient String boundary;
- private final transient Random random = new Random();
+ private final URL url;
+ private final String boundary;
+ private final Random random = new Random();
private final static String CRLF = "\r\n";
private final static Charset UTF8 = Charset.forName("utf-8");
diff --git a/EssentialsUpdate/src/net/ess3/update/UpdateCheck.java b/EssentialsUpdate/src/net/ess3/update/UpdateCheck.java
index 8e8b3e7ed..bd3e6300e 100644
--- a/EssentialsUpdate/src/net/ess3/update/UpdateCheck.java
+++ b/EssentialsUpdate/src/net/ess3/update/UpdateCheck.java
@@ -12,14 +12,14 @@ import org.bukkit.plugin.PluginManager;
public class UpdateCheck
{
- private transient CheckResult result = CheckResult.UNKNOWN;
- private transient Version currentVersion;
- private transient Version newVersion = null;
- private transient int bukkitResult = 0;
- private transient UpdateFile updateFile;
+ private CheckResult result = CheckResult.UNKNOWN;
+ private Version currentVersion;
+ private Version newVersion = null;
+ private int bukkitResult = 0;
+ private UpdateFile updateFile;
private final static int CHECK_INTERVAL = 20 * 60 * 60 * 6;
- private final transient Plugin plugin;
- private transient boolean essentialsInstalled;
+ private final Plugin plugin;
+ private boolean essentialsInstalled;
private final Pattern bukkitVersionPattern = Pattern.compile("git-Bukkit-(?:(?:[0-9]+)\\.)+[0-9]+-R[\\.0-9]+-(?:[0-9]+-g[0-9a-f]+-)?b([0-9]+)jnks.*");
public UpdateCheck(final Plugin plugin)
diff --git a/EssentialsUpdate/src/net/ess3/update/UpdateFile.java b/EssentialsUpdate/src/net/ess3/update/UpdateFile.java
index a369ad44e..117daab8c 100644
--- a/EssentialsUpdate/src/net/ess3/update/UpdateFile.java
+++ b/EssentialsUpdate/src/net/ess3/update/UpdateFile.java
@@ -24,9 +24,9 @@ public class UpdateFile
private final static BigInteger PUBLIC_KEY = new BigInteger(
"5ha6a2d4qdy17ttkg8evh74sl5a87djojwenu12k1lvy8ui6003e6l06rntczpoh99mhc3txj8mqlxw111oyy9yl7s7qpyluyzix3j1odxrxx4u52gxvyu6qiteapczkzvi7rxgeqsozz7b19rdx73a7quo9ybwpz1cr82r7x5k0pg2a73pjjsv2j1awr13azo7klrcxp9y5xxwf5qv1s3tw4zqftli18u0ek5qkbzfbgk1v5n2f11pkwwk6p0mibrn26wnjbv11vyiqgu95o7busmt6vf5q7grpcenl637w83mbin56s3asj1131b2mscj9xep3cbj7la9tgsxl5bj87vzy8sk2d34kzwqdqgh9nry43nqqus12l1stmiv184r8r3jcy8w43e8h1u1mzklldb5eytkuhayqik8l3ns04hwt8sgacvw534be8sx26qrn5s1",
36);
- private final transient File file;
- private final transient Plugin plugin;
- private final transient TreeMap<Version, VersionInfo> versions = new TreeMap<Version, VersionInfo>();
+ private final File file;
+ private final Plugin plugin;
+ private final TreeMap<Version, VersionInfo> versions = new TreeMap<Version, VersionInfo>();
public UpdateFile(final Plugin plugin)
{
diff --git a/EssentialsUpdate/src/net/ess3/update/UpdateProcess.java b/EssentialsUpdate/src/net/ess3/update/UpdateProcess.java
index 0e9f59283..9d09264e3 100644
--- a/EssentialsUpdate/src/net/ess3/update/UpdateProcess.java
+++ b/EssentialsUpdate/src/net/ess3/update/UpdateProcess.java
@@ -18,10 +18,10 @@ import org.bukkit.plugin.Plugin;
// TODO: This whole thing should make use of the conversations api
public class UpdateProcess implements Listener
{
- private transient Player currentPlayer;
- private final transient Plugin plugin;
- private final transient UpdateCheck updateCheck;
- private transient StateMachine stateMachine;
+ private Player currentPlayer;
+ private final Plugin plugin;
+ private final UpdateCheck updateCheck;
+ private StateMachine stateMachine;
public UpdateProcess(final Plugin plugin, final UpdateCheck updateCheck)
{
@@ -96,7 +96,8 @@ public class UpdateProcess implements Listener
{
UpdateProcess.this.currentPlayer = null;
}
- //TODO: make sure this is threadsafe
+ //TODO: make sure this is threadsafe
+
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerChat(final AsyncPlayerChatEvent event)
{
diff --git a/EssentialsUpdate/src/net/ess3/update/Version.java b/EssentialsUpdate/src/net/ess3/update/Version.java
index ee449186f..9910882c8 100644
--- a/EssentialsUpdate/src/net/ess3/update/Version.java
+++ b/EssentialsUpdate/src/net/ess3/update/Version.java
@@ -30,11 +30,10 @@ public class Version implements Comparable<Version>
{
return type;
}
-
- private final transient int major;
- private final transient int minor;
- private final transient int build;
- private final transient Type type;
+ private final int major;
+ private final int minor;
+ private final int build;
+ private final Type type;
public Version(final String versionString)
{
diff --git a/EssentialsUpdate/src/net/ess3/update/VersionInfo.java b/EssentialsUpdate/src/net/ess3/update/VersionInfo.java
index afbe87de8..c9e0eb7ec 100644
--- a/EssentialsUpdate/src/net/ess3/update/VersionInfo.java
+++ b/EssentialsUpdate/src/net/ess3/update/VersionInfo.java
@@ -9,10 +9,10 @@ import org.bukkit.configuration.Configuration;
public class VersionInfo
{
- private final transient List<String> changelog;
- private final transient int minBukkit;
- private final transient int maxBukkit;
- private final transient Map<String, ModuleInfo> modules;
+ private final List<String> changelog;
+ private final int minBukkit;
+ private final int maxBukkit;
+ private final Map<String, ModuleInfo> modules;
public VersionInfo(final Configuration updateConfig, final String path)
{
diff --git a/EssentialsUpdate/src/net/ess3/update/chat/AbstractFileCommand.java b/EssentialsUpdate/src/net/ess3/update/chat/AbstractFileCommand.java
index fff363835..b6b83b0bb 100644
--- a/EssentialsUpdate/src/net/ess3/update/chat/AbstractFileCommand.java
+++ b/EssentialsUpdate/src/net/ess3/update/chat/AbstractFileCommand.java
@@ -8,7 +8,7 @@ import org.bukkit.plugin.Plugin;
public abstract class AbstractFileCommand implements Command
{
- private final transient Plugin plugin;
+ private final Plugin plugin;
private final static Charset UTF8 = Charset.forName("utf-8");
public AbstractFileCommand(final Plugin plugin)
diff --git a/EssentialsUpdate/src/net/ess3/update/chat/ErrorsCommand.java b/EssentialsUpdate/src/net/ess3/update/chat/ErrorsCommand.java
index 6e3c29924..04832dbc0 100644
--- a/EssentialsUpdate/src/net/ess3/update/chat/ErrorsCommand.java
+++ b/EssentialsUpdate/src/net/ess3/update/chat/ErrorsCommand.java
@@ -11,7 +11,7 @@ import org.bukkit.plugin.Plugin;
public class ErrorsCommand extends AbstractFileCommand implements Command
{
- private final transient Pattern pattern = Pattern.compile("^[0-9 :-]+\\[INFO\\].*");
+ private final Pattern pattern = Pattern.compile("^[0-9 :-]+\\[INFO\\].*");
public ErrorsCommand(final Plugin plugin)
{
diff --git a/EssentialsUpdate/src/net/ess3/update/chat/IrcBot.java b/EssentialsUpdate/src/net/ess3/update/chat/IrcBot.java
index 348a9ae44..b33ff9dd7 100644
--- a/EssentialsUpdate/src/net/ess3/update/chat/IrcBot.java
+++ b/EssentialsUpdate/src/net/ess3/update/chat/IrcBot.java
@@ -15,9 +15,9 @@ public class IrcBot extends PircBot
private static final String CHANNEL = "#essentials";
private static final int PORT = 6667;
private static final String SERVER = "irc.esper.net";
- private transient boolean reconnect = true;
- private final transient Player player;
- private transient boolean kicked = false;
+ private boolean reconnect = true;
+ private final Player player;
+ private boolean kicked = false;
public IrcBot(final Player player, final String nickName, final String versionString)
{
diff --git a/EssentialsUpdate/src/net/ess3/update/chat/StartupCommand.java b/EssentialsUpdate/src/net/ess3/update/chat/StartupCommand.java
index 978da60c2..1ac171e42 100644
--- a/EssentialsUpdate/src/net/ess3/update/chat/StartupCommand.java
+++ b/EssentialsUpdate/src/net/ess3/update/chat/StartupCommand.java
@@ -11,8 +11,8 @@ import org.bukkit.plugin.Plugin;
public class StartupCommand extends AbstractFileCommand implements Command
{
- private final transient Pattern patternStart = Pattern.compile("^[0-9 :-]+\\[INFO\\] Starting minecraft server version.*");
- private final transient Pattern patternEnd = Pattern.compile("^[0-9 :-]+\\[INFO\\] Done \\([0-9.,]+s\\)! For help, type \"help\".*");
+ private final Pattern patternStart = Pattern.compile("^[0-9 :-]+\\[INFO\\] Starting minecraft server version.*");
+ private final Pattern patternEnd = Pattern.compile("^[0-9 :-]+\\[INFO\\] Done \\([0-9.,]+s\\)! For help, type \"help\".*");
public StartupCommand(final Plugin plugin)
{
diff --git a/EssentialsUpdate/src/net/ess3/update/states/AbstractState.java b/EssentialsUpdate/src/net/ess3/update/states/AbstractState.java
index 783ba19a1..ddcba9250 100644
--- a/EssentialsUpdate/src/net/ess3/update/states/AbstractState.java
+++ b/EssentialsUpdate/src/net/ess3/update/states/AbstractState.java
@@ -6,8 +6,8 @@ import org.bukkit.entity.Player;
public abstract class AbstractState
{
- private transient boolean abortion = false;
- private final transient StateMap stateMap;
+ private boolean abortion = false;
+ private final StateMap stateMap;
public AbstractState(final StateMap stateMap)
{
diff --git a/EssentialsUpdate/src/net/ess3/update/states/AbstractYesNoState.java b/EssentialsUpdate/src/net/ess3/update/states/AbstractYesNoState.java
index e84046224..0747c188b 100644
--- a/EssentialsUpdate/src/net/ess3/update/states/AbstractYesNoState.java
+++ b/EssentialsUpdate/src/net/ess3/update/states/AbstractYesNoState.java
@@ -4,8 +4,8 @@ package net.ess3.update.states;
public abstract class AbstractYesNoState extends AbstractState
{
private boolean answer = false;
- private final transient Class<? extends AbstractState> yesState;
- private final transient Class<? extends AbstractState> noState;
+ private final Class<? extends AbstractState> yesState;
+ private final Class<? extends AbstractState> noState;
public AbstractYesNoState(final StateMap states, final Class<? extends AbstractState> nextState)
{
diff --git a/EssentialsUpdate/src/net/ess3/update/states/Changelog.java b/EssentialsUpdate/src/net/ess3/update/states/Changelog.java
index eccc4548a..9f6fc1a46 100644
--- a/EssentialsUpdate/src/net/ess3/update/states/Changelog.java
+++ b/EssentialsUpdate/src/net/ess3/update/states/Changelog.java
@@ -9,10 +9,10 @@ import org.bukkit.entity.Player;
public class Changelog extends AbstractState
{
private static final int CHANGES_PER_PAGE = 5;
- private transient int page = 0;
- private transient boolean confirmed = false;
- private transient final List<String> changes;
- private transient final int pages;
+ private int page = 0;
+ private boolean confirmed = false;
+ private final List<String> changes;
+ private final int pages;
public Changelog(final StateMap stateMap)
{
diff --git a/EssentialsUpdate/src/net/ess3/update/states/StateMachine.java b/EssentialsUpdate/src/net/ess3/update/states/StateMachine.java
index c9dbb1f6a..ae947e687 100644
--- a/EssentialsUpdate/src/net/ess3/update/states/StateMachine.java
+++ b/EssentialsUpdate/src/net/ess3/update/states/StateMachine.java
@@ -14,12 +14,10 @@ public class StateMachine extends AbstractWorkListener implements Runnable
{
ABORT, WAIT, DONE, NONE
}
-
-
- private final transient StateMap states = new StateMap();
- private transient AbstractState current;
- private transient Player player;
- private transient MachineResult result = MachineResult.NONE;
+ private final StateMap states = new StateMap();
+ private AbstractState current;
+ private Player player;
+ private MachineResult result = MachineResult.NONE;
public StateMachine(final Plugin plugin, final Player player, final UpdateCheck updateCheck)
{
@@ -84,8 +82,7 @@ public class StateMachine extends AbstractWorkListener implements Runnable
}
return result;
}
-
- private transient Iterator<AbstractState> iterator;
+ private Iterator<AbstractState> iterator;
public void startWork()
{
diff --git a/EssentialsUpdate/src/net/ess3/update/states/UpdateOrInstallation.java b/EssentialsUpdate/src/net/ess3/update/states/UpdateOrInstallation.java
index bc043c6de..e8495fe2c 100644
--- a/EssentialsUpdate/src/net/ess3/update/states/UpdateOrInstallation.java
+++ b/EssentialsUpdate/src/net/ess3/update/states/UpdateOrInstallation.java
@@ -6,8 +6,8 @@ import org.bukkit.entity.Player;
public class UpdateOrInstallation extends AbstractState
{
- private final transient UpdateCheck updateCheck;
- private transient boolean update = false;
+ private final UpdateCheck updateCheck;
+ private boolean update = false;
public UpdateOrInstallation(final StateMap stateMap, final UpdateCheck updateCheck)
{
diff --git a/EssentialsUpdate/src/net/ess3/update/tasks/InstallModule.java b/EssentialsUpdate/src/net/ess3/update/tasks/InstallModule.java
index 82e906d90..e24a69f2a 100644
--- a/EssentialsUpdate/src/net/ess3/update/tasks/InstallModule.java
+++ b/EssentialsUpdate/src/net/ess3/update/tasks/InstallModule.java
@@ -12,9 +12,9 @@ import org.bukkit.Bukkit;
public class InstallModule implements Runnable, Task
{
- protected final transient AbstractWorkListener listener;
- private final transient String moduleName;
- private final transient String fileName;
+ protected final AbstractWorkListener listener;
+ private final String moduleName;
+ private final String fileName;
public InstallModule(final AbstractWorkListener listener, final String moduleName)
{
diff --git a/EssentialsUpdate/src/net/ess3/update/tasks/SelfUpdate.java b/EssentialsUpdate/src/net/ess3/update/tasks/SelfUpdate.java
index 31d45e741..d4bc7b066 100644
--- a/EssentialsUpdate/src/net/ess3/update/tasks/SelfUpdate.java
+++ b/EssentialsUpdate/src/net/ess3/update/tasks/SelfUpdate.java
@@ -6,7 +6,7 @@ import org.bukkit.Bukkit;
public class SelfUpdate extends AbstractWorkListener implements Task, Runnable
{
- private final transient AbstractWorkListener listener;
+ private final AbstractWorkListener listener;
public SelfUpdate(final AbstractWorkListener listener)
{
diff --git a/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPP.java b/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPP.java
index fbfbbf56a..baafb27f0 100644
--- a/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPP.java
+++ b/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPP.java
@@ -20,10 +20,10 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP
{
private static final Logger LOGGER = Logger.getLogger("Minecraft");
private static EssentialsXMPP instance = null;
- private transient UserManager users;
- private transient XMPPManager xmpp;
- private transient IEssentials ess;
- private transient TabExecutor commandHandler;
+ private UserManager users;
+ private XMPPManager xmpp;
+ private IEssentials ess;
+ private TabExecutor commandHandler;
public static IEssentialsXMPP getInstance()
{
diff --git a/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPPPlayerListener.java b/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPPPlayerListener.java
index 85676198c..0f27c05c9 100644
--- a/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPPPlayerListener.java
+++ b/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPPPlayerListener.java
@@ -11,7 +11,7 @@ import org.bukkit.event.player.PlayerQuitEvent;
//TODO: port 2.9 changes and verify thread safety.
class EssentialsXMPPPlayerListener implements Listener
{
- private final transient IEssentials ess;
+ private final IEssentials ess;
EssentialsXMPPPlayerListener(final IEssentials ess)
{
diff --git a/EssentialsXMPP/src/net/ess3/xmpp/UserManager.java b/EssentialsXMPP/src/net/ess3/xmpp/UserManager.java
index c80680445..0e0c48b4e 100644
--- a/EssentialsXMPP/src/net/ess3/xmpp/UserManager.java
+++ b/EssentialsXMPP/src/net/ess3/xmpp/UserManager.java
@@ -11,9 +11,9 @@ import org.bukkit.configuration.file.YamlConfiguration;
public class UserManager implements IReload
{
- private transient YamlConfiguration users;
- private final transient File folder;
- private final transient List<String> spyusers = new ArrayList<String>();
+ private YamlConfiguration users;
+ private final File folder;
+ private final List<String> spyusers = new ArrayList<String>();
private final static String ADDRESS = "address";
private final static String SPY = "spy";
diff --git a/EssentialsXMPP/src/net/ess3/xmpp/XMPPManager.java b/EssentialsXMPP/src/net/ess3/xmpp/XMPPManager.java
index a04ab25d9..34d98cb11 100644
--- a/EssentialsXMPP/src/net/ess3/xmpp/XMPPManager.java
+++ b/EssentialsXMPP/src/net/ess3/xmpp/XMPPManager.java
@@ -19,17 +19,17 @@ public final class XMPPManager extends Handler implements MessageListener, ChatM
{
private static final Logger LOGGER = Logger.getLogger("Minecraft");
private static final SimpleFormatter formatter = new SimpleFormatter();
- private transient YamlConfiguration config = null;
- private transient XMPPConnection connection;
- private transient ChatManager chatManager;
- private final transient Map<String, Chat> chats = Collections.synchronizedMap(new HashMap<String, Chat>());
- private final transient Set<LogRecord> logrecords = Collections.synchronizedSet(new HashSet<LogRecord>());
- private final transient IEssentialsXMPP parent;
- private transient List<String> logUsers;
- private transient Level logLevel;
- private transient boolean ignoreLagMessages = true;
- private transient Thread loggerThread;
- private transient boolean threadrunning = true;
+ private YamlConfiguration config = null;
+ private XMPPConnection connection;
+ private ChatManager chatManager;
+ private final Map<String, Chat> chats = Collections.synchronizedMap(new HashMap<String, Chat>());
+ private final Set<LogRecord> logrecords = Collections.synchronizedSet(new HashSet<LogRecord>());
+ private final IEssentialsXMPP parent;
+ private List<String> logUsers;
+ private Level logLevel;
+ private boolean ignoreLagMessages = true;
+ private Thread loggerThread;
+ private boolean threadrunning = true;
public XMPPManager(final IEssentialsXMPP parent)
{