1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-09-17 01:42:07 +02:00

Compare commits

..

157 Commits

Author SHA1 Message Date
KHobbits
1e34a396cd Change starter kit to default to stone tools 2012-03-05 15:51:15 +00:00
KHobbits
ba96117f55 Temp fix to disable version check on R7 2012-03-05 14:17:09 +00:00
KHobbits
96b217cbe8 Craftbukkit/Bukkit R7 2012-03-05 08:41:19 +00:00
md_5
0dd5c0370e I dont think free noteblocks are a good idea 2012-03-05 08:37:16 +00:00
KHobbits
bdf32cde9e Missed one. 2012-03-05 08:37:15 +00:00
KHobbits
e91ed60441 Fixing spawnmob count. 2012-03-05 08:37:15 +00:00
KHobbits
8577202f48 Add listgroups as TL key 2012-03-05 08:37:15 +00:00
KHobbits
7819b9d2f0 Apply colors to group tags. 2012-03-05 08:37:15 +00:00
KHobbits
15c0565923 Build custom mob list /spawnmob 2012-03-05 08:37:14 +00:00
KHobbits
2b25ca2932 CME 2012-03-05 08:37:14 +00:00
KHobbits
c7a6677d52 Adding starter/newbie kit to EssentialsSpawn
Optimization to EssentialsSpawn join event.
2012-03-05 08:37:14 +00:00
KHobbits
c3d5b32986 Extra command alias. 2012-03-05 08:37:14 +00:00
KHobbits
cbfb524195 Allow more currency customization.
Added currency key to messages.
2012-03-05 08:37:14 +00:00
KHobbits
b16a1f7237 Adding option to modify all users balances (including offline) /eco reset ** <amount> 2012-03-05 08:37:14 +00:00
KHobbits
e28f1b1be3 Half-revert double backflip. 10 points.
(op prefix changes that md-5 broke, thinking I broke op prefixes)
2012-03-05 08:37:14 +00:00
md_5
b512a243e7 Fix op colours, which KHobbits broke! 2012-03-05 08:37:13 +00:00
Chris Ward
873c9880dd Cleanup
Signed-off-by: Chris Ward <chris@chrisgward.com>
2012-03-05 08:35:48 +00:00
Chris Ward
e6736e48a5 Cleanup
Signed-off-by: Chris Ward <chris@chrisgward.com>
2012-03-05 08:35:48 +00:00
KHobbits
caf598f55b Capital case for formatting. 2012-03-05 08:35:48 +00:00
KHobbits
619e099a04 Force all kits to lowercase. 2012-03-05 08:35:48 +00:00
KHobbits
faba1e3604 *make it look like i'm doing something* 2012-03-05 08:35:48 +00:00
KHobbits
7cb728b15f I think switches are better. 2012-03-05 08:35:48 +00:00
KHobbits
3e3c7f0d54 Only update displayname on world change, not every teleport. 2012-03-05 08:35:48 +00:00
KHobbits
a45c19a08b Extra command aliases 2012-03-05 08:35:47 +00:00
KHobbits
eb74a1de9c Make the antioch message optional. 2012-03-05 08:35:47 +00:00
KHobbits
8450734cf1 Entity event cleanup 2012-03-05 08:35:47 +00:00
KHobbits
016299a1dd Shouldn't really be canceling events at priority monitor, oops. 2012-03-05 08:35:47 +00:00
KHobbits
d27ff9abb6 Don't think we need animation event anymore. 2012-03-05 08:35:47 +00:00
Iaccidentally
cdf5d45483 update messages.properties for the new bukkit download link (ci.bukkit,org no longer works) 2012-03-05 08:35:46 +00:00
KHobbits
5622882602 Merge branch 'master' of github.com:essentials/Essentials 2012-03-01 22:37:15 +00:00
KHobbits
b3d3928db8 Kit sign cleanup 2012-03-01 22:36:51 +00:00
snowleo
6df3b9008a update inventory 2012-03-01 23:23:23 +01:00
snowleo
c36ca65e09 Bukkit broke this sign :( 2012-03-01 23:10:12 +01:00
KHobbits
2e788802fe Fix kit timers resetting on server restart. 2012-03-01 22:04:50 +00:00
KHobbits
b0552019f5 Fix version matching. 2012-03-01 21:47:01 +00:00
snowleo
dae69622a5 Merge branch 'refs/heads/master' into release 2012-03-01 19:08:52 +01:00
snowleo
696b930fb2 EntityType instead of CreatureType 2012-03-01 19:05:50 +01:00
snowleo
e43a62f992 Requires #1988 because of the new Inventory stuff 2012-03-01 19:05:50 +01:00
snowleo
02c1cb05c7 Updated to R6 2012-03-01 19:05:50 +01:00
snowleo
b44d738867 CB# 1988 B# 1360 2012-03-01 19:05:49 +01:00
md_5
e1818f7e62 Separate config sections evenly 2012-03-01 19:05:47 +01:00
md_5
e5081db7e4 Remove old, unwanted manifest.mf files 2012-03-01 19:05:47 +01:00
ElgarL
ba346bd797 Make 'manload' reload the config correctly. 2012-03-01 19:05:47 +01:00
KHobbits
0670ece7f3 Updating Bukkit: CB #1858, B #1334 2012-03-01 19:05:47 +01:00
snowleo
a8da3eebd7 Merge remote-tracking branch 'origin/groupmanager' 2012-03-01 17:33:25 +01:00
snowleo
056303b53c EntityType instead of CreatureType 2012-03-01 17:33:09 +01:00
snowleo
454f7d30de Requires #1988 because of the new Inventory stuff 2012-03-01 16:17:40 +01:00
snowleo
6d1c270976 Updated to R6 2012-03-01 16:16:05 +01:00
snowleo
d1001274bb CB# 1988 B# 1360 2012-03-01 16:16:05 +01:00
md_5
3099855562 Merge remote-tracking branch 'origin/master' 2012-03-01 16:23:21 +11:00
md_5
3f26d4ad98 Separate config sections evenly 2012-03-01 14:40:57 +11:00
md_5
bae337cc49 Remove old, unwanted manifest.mf files 2012-03-01 12:27:59 +11:00
ElgarL
3823e7a108 Make 'manload' reload the config correctly. 2012-02-28 10:46:10 +00:00
KHobbits
1c2221f52f Adding option to log all eco api transactions. 2012-02-28 02:45:03 +00:00
KHobbits
1b780a4364 Prevent EssSpawn trying to handle spawning of jailed players. 2012-02-28 02:45:03 +00:00
KHobbits
ac3e65a829 Change jail listener to catch respawn at Highest 2012-02-28 02:45:03 +00:00
KHobbits
332f19177e Allow people to hit exactly 'min money'. 2012-02-28 02:45:03 +00:00
KHobbits
6ab57b9abe Cleanup. 2012-02-28 02:45:03 +00:00
KHobbits
862f3aad59 Adjustments to negative eco give/take. 2012-02-28 02:45:03 +00:00
KHobbits
e277acf80e Display users new balance on /eco give/take. 2012-02-28 02:45:02 +00:00
KHobbits
9f893e68e9 Add Minimum Balance, to allow people to manage overdrafts. 2012-02-28 02:45:02 +00:00
KHobbits
833a5b2b55 Adding option to log all eco api transactions. 2012-02-27 15:31:43 +00:00
KHobbits
340f0c68eb Prevent EssSpawn trying to handle spawning of jailed players. 2012-02-27 03:40:18 +00:00
KHobbits
a5e3182dad Change jail listener to catch respawn at Highest 2012-02-27 03:24:58 +00:00
KHobbits
10ae9c3aa2 Allow people to hit exactly 'min money'. 2012-02-26 05:10:04 +00:00
KHobbits
bcf903de92 Cleanup. 2012-02-26 05:06:03 +00:00
KHobbits
ad08d27504 Adjustments to negative eco give/take. 2012-02-26 05:01:40 +00:00
KHobbits
d24f77dbd5 Display users new balance on /eco give/take. 2012-02-26 04:27:29 +00:00
KHobbits
a5b38ce1a4 Add Minimum Balance, to allow people to manage overdrafts. 2012-02-26 04:15:14 +00:00
KHobbits
5d048d2c1d Updating Bukkit: CB #1858, B #1334 2012-02-25 17:57:26 +00:00
KHobbits
13d3cc3306 Lowering min bukkit to r4 - 1838, this build should still be compatible. 2012-02-25 17:40:00 +00:00
KHobbits
9f02fb4dd4 Merge branch 'master' into release 2012-02-25 17:22:39 +00:00
KHobbits
07baa6e611 Merge remote branch 'remotes/origin/groupmanager' 2012-02-25 17:22:01 +00:00
ElgarL
50bd5869bf Prevent promoting players to, and demoting to GlobalGroups. 2012-02-25 09:29:54 +00:00
ElgarL
fa49fc91d2 Prevent adding inheritances to globalgroups. These are permissions
collections, not player groups.
2012-02-25 09:22:54 +00:00
KHobbits
28f478dd04 Write to user files less, on money update. 2012-02-23 17:25:00 +00:00
KHobbits
6fb8dad0ec Balance top now has server total on first line.
Balance top will update ess balance backup if using register/vault eco.
2012-02-23 15:17:23 +00:00
KHobbits
9f605e9a88 Fixing upgrade script to allow powertool upgrade. 2012-02-23 14:49:23 +00:00
KHobbits
e5b91dae73 Fixing kits for new config classes. 2012-02-22 12:32:51 +00:00
KHobbits
e1749fecd1 Extra command aliases. 2012-02-22 01:29:37 +00:00
KHobbits
358edff798 Powertools dispatch commands as delayed tasks (should reduce any conflict issues). 2012-02-22 00:23:04 +00:00
KHobbits
34f13ba89c Switch powertools to use different event.
Reduce multiple triggering of powertool events.
Abort event when used with powertool.
2012-02-22 00:11:21 +00:00
KHobbits
945ba6f8ab Fix powertools with new config format. 2012-02-22 00:10:13 +00:00
KHobbits
46f05ee92f Check to see if home section exists. 2012-02-21 22:19:56 +00:00
KHobbits
6d46fc66ce Fixing home list. 2012-02-21 22:12:37 +00:00
KHobbits
ed7fe9213f Fix /sudo message display. 2012-02-21 21:39:25 +00:00
ElgarL
9c68cbae72 Removed BukkitPermsOverride as this is now the default with bukkit
handling child nodes.
2012-02-21 18:40:54 +00:00
ElgarL
c0df771539 Update for Bukkit R5 compatability.
Removed some unused variables.
2012-02-21 18:38:08 +00:00
snowleo
9bd0c33fef Never give our user object to other plugins! 2012-02-21 18:41:27 +01:00
snowleo
cf7da7a83f Merge branch 'refs/heads/groupmanager' 2012-02-21 17:34:45 +01:00
snowleo
f46948249e Updated Essentials to work with R5 2012-02-21 17:33:46 +01:00
snowleo
3b81593ebb CB#1952
B#1330
2012-02-21 16:47:25 +01:00
KHobbits
8042cefd3d Merge branch 'master' into release 2012-02-19 01:20:50 +00:00
KHobbits
514f07ce57 Add bPerm2 support for chat prefixes. 2012-02-18 22:47:38 +00:00
KHobbits
4f4d9f6209 Little bit of extra info in the default /einfo file 2012-02-18 22:08:18 +00:00
KHobbits
3077ea4ef1 Re-allow colours in newb welcome messages. 2012-02-18 21:34:05 +00:00
KHobbits
945ae71480 Adding full keyword support for newb join message.
Also adding {ADDRESS} and {USERNAME} as new keywords.
2012-02-18 21:09:18 +00:00
ElgarL
3d1c0fd157 A command of '/manload' with no world arguments now performs a full
reload of GM.
2012-02-18 09:05:28 +00:00
KHobbits
fab9688abb Don't try to use old bPerms API if it is not available. 2012-02-16 23:44:13 +00:00
KHobbits
b2dbb3f9e3 Fixing being charged twice for /back. 2012-02-16 16:57:50 +00:00
KHobbits
16a0f44b4d Merge remote branch 'remotes/origin/master' into release 2012-02-15 19:09:02 +00:00
md_5
7633b136e3 Its a good idea to actually register the listeners 2012-02-15 19:55:41 +11:00
md_5
0252d756f6 Make Essentials Update use new Listener system, and fix a few general mistakes, including that of the config 2012-02-15 19:34:46 +11:00
md_5
ad05516fd5 Fix formatting in the config.yml and plugin.yml files. Add a new author. 2012-02-15 17:57:53 +11:00
md_5
6d127012d8 Add all the new R4 methods 2012-02-15 17:53:47 +11:00
md_5
c064da9af8 Update to 1.1-R4 2012-02-15 17:44:35 +11:00
md_5
d05f2d7a32 Remove dropItems from the inventory work around 2012-02-15 17:21:28 +11:00
ElgarL
3fc6bb4e4f comment name change 2012-02-15 06:16:33 +00:00
ElgarL
59679e0423 Depreciate PlayerTeleportEvent, PlayerRespawnEvent and PlayerPortalEvent
as it's all handled in PlayerChangedWorldEvent.
This also means we no longer update permissions before we change
worlds.
2012-02-15 06:15:31 +00:00
KHobbits
1a2acb43ae Merge branch 'master' into release 2012-02-14 23:56:02 +00:00
KHobbits
f0c0ee1a8d /spawnmob - Only list mobs you have permission to spawn. 2012-02-14 23:55:29 +00:00
snowleo
3c98718387 Don't return null, throw an exception 2012-02-14 20:30:06 +01:00
snowleo
cfdb2a36c1 Merge pull request #49 from Iaccidentally/patch-2
fix typo in config.yml (another one)
2012-02-14 11:21:52 -08:00
Iaccidentally
3b7d194902 fix typo in config.yml (another one) 2012-02-14 14:21:07 -05:00
snowleo
72d514d52f Merge pull request #48 from Iaccidentally/patch-1
fix typo in config.yml
2012-02-14 11:18:03 -08:00
Iaccidentally
9fe119e720 fix typo in config.yml 2012-02-14 14:16:34 -05:00
ElgarL
4a5c431163 Depreciate PlayerTeleportEvent as it's all handled in
PlayerChangedWorldEvent.
2012-02-14 13:01:39 +00:00
snowleo
a6ac333a74 Less sanitizing for more performance 2012-02-13 21:32:05 +01:00
KHobbits
bc2578b788 Caching regex return in user cleanup.
(Pushing this for testing purposes).
2012-02-13 19:40:33 +00:00
KHobbits
36d07cb539 Merge branch 'master' into release 2012-02-13 17:35:05 +00:00
KHobbits
effe0d5ec5 Merge remote branch 'remotes/origin/groupmanager' 2012-02-13 17:24:32 +00:00
KHobbits
0ab2e745cf Merge branch 'master' of github.com:essentials/Essentials 2012-02-13 17:17:14 +00:00
KHobbits
57a2ef08d4 Allow charges for different mob types in /spawner 2012-02-13 17:16:27 +00:00
KHobbits
2699e02f96 Add per warp command costs
Make warp other commands charge the commander, not the warped.
2012-02-13 17:09:07 +00:00
md_5
62cd219b4e Clean up the CommandException stack traces so they appear as if Essentials was never there. 2012-02-12 08:19:24 +11:00
KHobbits
2d56de1483 Update trade signs properly, and visibly handle full signs. 2012-02-11 21:15:26 +00:00
KHobbits
bbc6da5106 Merge pull request #46 from krinsdeath/master
Added Privileges to known Permissions plugins
2012-02-11 12:12:59 -08:00
KHobbits
b0d06ce6ed Refactoring tpaccept perm check to include tpaall. 2012-02-11 20:10:19 +00:00
KHobbits
de1554cb68 Merge pull request #45 from Wolvereness/master
Fix /tpaccept permission check
Refactoring to follow.
2012-02-11 12:06:42 -08:00
Jeff Wardian
c890ea8f87 Added PrivilegesHandler.java;
Implemented privileges in PermissionsHandler.java;

Fixed PrivilegesHandler.canBuild();
2012-02-11 10:06:18 -08:00
ElgarL
c0517c1203 Change Service registration to register WorldsHolder instead of
AnjoPermissionsHandler. This is the correct entry point for all data.
2012-02-11 10:36:55 +00:00
Wolvereness
9efd0eb6f9 Fix exploit with /tpaccept if sender no longer has permission 2012-02-09 23:14:57 -06:00
KHobbits
f0ee026fb9 Allow colour codes in /ping 2012-02-09 22:13:00 +00:00
KHobbits
b3fc790000 New Permission: essentials.sudo.exempt
If a user has this perm, they cannot be controlled.
2012-02-09 22:11:46 +00:00
KHobbits
83f9209bcc Optional argument to /ping [message]- Message to be echo'd.
Possible use in scripts, checking for lag, /sudo, etc.
2012-02-09 22:02:24 +00:00
KHobbits
691a0ef4ce Fixing silly typo - Fixes shout costs. 2012-02-09 02:11:36 +00:00
ElgarL
97bd49e598 Add some commenting 2012-02-05 16:41:34 +00:00
ElgarL
e93e50f6d2 Fix world mirroring so it correctly creates data files and data sources
for partially mirrored worlds.
Fixed world mirroring so it returns the correct data for the
requested world
2012-02-05 16:30:58 +00:00
ElgarL
76ba5caeec Prevent getAllPlayersPermissions() processing a group more than once.
Improves performance when using complex inheritance structures.
2012-02-02 18:10:35 +00:00
KHobbits
6ca1cdec4f Merge branch 'master' into release 2012-02-02 11:41:18 +00:00
KHobbits
86a1dda46c Make it so ops can build, even if they don't have the matching permission. 2012-02-02 10:43:17 +00:00
KHobbits
4326ce0d4a Force minimum CB version to 1846, don't want people on #1840 due to big bugs. 2012-02-02 10:32:18 +00:00
KHobbits
3ff1f4adbb Fixing repair to not repair items with datavalues, unless they actually have a durability. 2012-02-02 10:27:35 +00:00
KHobbits
492c4e8521 Craftbukkit #1846 Bukkit #1211 2012-02-02 10:27:09 +00:00
KHobbits
e3f3fe84ea Recover from broken config files, but keep a backup of the old one for purpose of data recovery. 2012-02-02 09:48:56 +00:00
KHobbits
6e2ac3b56e Extend valid characters to be a little less strict. 2012-02-02 09:37:30 +00:00
KHobbits
5c19e71858 Sanitize mail for untoward characters.
Prevent a user error from terminating essentials timer task.
2012-02-02 09:26:36 +00:00
ElgarL
a0103afde3 fix setGroup to only block superperms update if update is false. 2012-02-02 02:41:10 +00:00
ElgarL
dbf30740fb Fix a bug with getWorldData return the main world data for all mirrors,
instead of the worlds parent data.
2012-02-02 02:01:04 +00:00
KHobbits
92fa415848 More info, and less severe warning on jail error. 2012-01-31 08:33:14 +00:00
KHobbits
2942ef40f3 Update jails to new event system. 2012-01-31 08:06:50 +00:00
ElgarL
3f02bcd702 Catch all errors in badly formatted groups. 2012-01-31 03:16:34 +00:00
ElgarL
fe050dd725 Track the 'onPlayerChangeWorld' event as some teleports seem to not be
triggering a world move.
2012-01-30 17:08:55 +00:00
ElgarL
5b4966c888 Auto sort permissions on load to speed up population of superperms.
Negating a parent node after adding all nodes with * will now
correctly remove all child nodes of that parent before populating
superperms.
	  eg.
	      - '*'
	      - -vanish.*
	      - vanish.standard
2012-01-30 14:41:19 +00:00
KHobbits
e2abf05a27 Merge branch 'master' into release 2012-01-30 05:36:03 +00:00
KHobbits
8500542e93 Remove invalid item spawn blacklist warning during startup. 2012-01-29 23:36:27 +00:00
ElgarL
2c8aa20542 .project change for Eclipse Build tool 2012-01-29 21:37:50 +00:00
113 changed files with 2015 additions and 1043 deletions

View File

@@ -66,6 +66,7 @@ endorsed.classpath=
excludes=
file.reference.BOSEconomy7.jar=../lib/BOSEconomy7.jar
file.reference.bPermissions.jar=../lib/bPermissions.jar
file.reference.bpermissions2.jar=../lib/bpermissions2.jar
file.reference.bukkit.jar=../lib/bukkit.jar
file.reference.craftbukkit.jar=../lib/craftbukkit.jar
file.reference.iCo4.jar=../lib/iCo4.jar
@@ -76,6 +77,7 @@ file.reference.MultiCurrency.jar=../lib/MultiCurrency.jar
file.reference.Permissions3.jar=../lib/Permissions3.jar
file.reference.PermissionsBukkit-1.2.jar=../lib/PermissionsBukkit-1.2.jar
file.reference.PermissionsEx.jar=../lib/PermissionsEx.jar
file.reference.Privileges.jar=..\\lib\\Privileges.jar
file.reference.Vault.jar=../lib/Vault.jar
includes=**
jar.archive.disabled=${jnlp.enabled}
@@ -95,7 +97,9 @@ javac.classpath=\
${reference.EssentialsGroupManager.jar}:\
${file.reference.bukkit.jar}:\
${file.reference.craftbukkit.jar}:\
${file.reference.Vault.jar}
${file.reference.Vault.jar}:\
${file.reference.Privileges.jar}:\
${file.reference.bpermissions2.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false

View File

@@ -32,15 +32,20 @@ import com.earth2me.essentials.signs.SignPlayerListener;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.bukkit.ChatColor;
import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandException;
import org.bukkit.command.CommandSender;
import org.bukkit.command.PluginCommand;
import org.bukkit.entity.Player;
@@ -61,7 +66,7 @@ import org.yaml.snakeyaml.error.YAMLException;
public class Essentials extends JavaPlugin implements IEssentials
{
public static final int BUKKIT_VERSION = 1818;
public static final int BUKKIT_VERSION = 1988;
private static final Logger LOGGER = Logger.getLogger("Minecraft");
private transient ISettings settings;
private final transient TNTExplodeListener tntListener = new TNTExplodeListener(this);
@@ -124,11 +129,11 @@ public class Essentials extends JavaPlugin implements IEssentials
LOGGER.log(Level.WARNING, _("versionMismatch", plugin.getDescription().getName()));
}
}
final Matcher versionMatch = Pattern.compile("git-Bukkit-([0-9]+).([0-9]+).([0-9]+)-R[0-9]+-(?:[0-9]+-g[0-9a-f]+-)?b([0-9]+)jnks.*").matcher(getServer().getVersion());
final Matcher versionMatch = Pattern.compile("git-Bukkit-(?:(?:[0-9]+)\\.)+[0-9]+-R[0-9]+-(?:[0-9]+-g[0-9a-f]+-)?b([0-9]+)jnks.*").matcher(getServer().getVersion());
if (versionMatch.matches())
{
final int versionNumber = Integer.parseInt(versionMatch.group(4));
if (versionNumber < BUKKIT_VERSION)
final int versionNumber = Integer.parseInt(versionMatch.group(1));
if (versionNumber < BUKKIT_VERSION && versionNumber > 100)
{
LOGGER.log(Level.SEVERE, _("notRecommendedBukkit"));
LOGGER.log(Level.SEVERE, _("requiredBukkit", Integer.toString(BUKKIT_VERSION)));
@@ -277,7 +282,29 @@ public class Essentials extends JavaPlugin implements IEssentials
if (pc != null)
{
alternativeCommandsHandler.executed(commandLabel, pc.getLabel());
return pc.execute(sender, commandLabel, args);
try
{
return pc.execute(sender, commandLabel, args);
}
catch (final Exception ex)
{
final ArrayList<StackTraceElement> elements = new ArrayList<StackTraceElement>(Arrays.asList(ex.getStackTrace()));
elements.remove(0);
final ArrayList<StackTraceElement> toRemove = new ArrayList<StackTraceElement>();
for (final StackTraceElement e : elements)
{
if (e.getClassName().equals("com.earth2me.essentials.Essentials"))
{
toRemove.add(e);
}
}
elements.removeAll(toRemove);
final StackTraceElement[] trace = elements.toArray(new StackTraceElement[elements.size()]);
ex.setStackTrace(trace);
ex.printStackTrace();
sender.sendMessage(ChatColor.RED + "An internal error occurred while attempting to perform this command");
return true;
}
}
}

View File

@@ -32,7 +32,7 @@ public class EssentialsBlockListener implements Listener
{
return;
}
boolean unlimitedForUser = user.hasUnlimited(is);
final boolean unlimitedForUser = user.hasUnlimited(is);
if (unlimitedForUser && user.getGameMode() == GameMode.SURVIVAL)
{
ess.scheduleSyncDelayedTask(

View File

@@ -3,7 +3,6 @@ package com.earth2me.essentials;
import static com.earth2me.essentials.I18n._;
import java.io.*;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.logging.Level;
@@ -12,12 +11,14 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.config.Configuration;
public class EssentialsConf extends Configuration
public class EssentialsConf extends YamlConfiguration
{
private static final Logger LOGGER = Logger.getLogger("Minecraft");
private transient File configFile;
@@ -26,15 +27,10 @@ public class EssentialsConf extends Configuration
public EssentialsConf(final File configFile)
{
super(configFile);
super();
this.configFile = configFile;
if (this.root == null)
{
this.root = new HashMap<String, Object>();
}
}
@Override
public void load()
{
configFile = configFile.getAbsoluteFile();
@@ -105,19 +101,24 @@ public class EssentialsConf extends Configuration
}
}
try
{
super.load();
super.load(configFile);
}
catch (RuntimeException e)
catch (FileNotFoundException ex)
{
LOGGER.log(Level.SEVERE, "File broken: " + configFile.toString());
throw e;
LOGGER.log(Level.SEVERE, null, ex);
}
if (this.root == null)
catch (IOException ex)
{
this.root = new HashMap<String, Object>();
LOGGER.log(Level.SEVERE, null, ex);
}
catch (InvalidConfigurationException ex)
{
File broken = new File(configFile.getAbsolutePath() + ".broken." + System.currentTimeMillis());
configFile.renameTo(broken);
LOGGER.log(Level.SEVERE, "The file " + configFile.toString() + " is broken, it has been renamed to " + broken.toString(), ex.getCause());
}
}
@@ -192,7 +193,7 @@ public class EssentialsConf extends Configuration
public boolean hasProperty(final String path)
{
return getProperty(path) != null;
return isSet(path);
}
public Location getLocation(final String path, final Server server) throws Exception
@@ -217,24 +218,25 @@ public class EssentialsConf extends Configuration
public void setProperty(final String path, final Location loc)
{
setProperty((path == null ? "" : path + ".") + "world", loc.getWorld().getName());
setProperty((path == null ? "" : path + ".") + "x", loc.getX());
setProperty((path == null ? "" : path + ".") + "y", loc.getY());
setProperty((path == null ? "" : path + ".") + "z", loc.getZ());
setProperty((path == null ? "" : path + ".") + "yaw", loc.getYaw());
setProperty((path == null ? "" : path + ".") + "pitch", loc.getPitch());
set((path == null ? "" : path + ".") + "world", loc.getWorld().getName());
set((path == null ? "" : path + ".") + "x", loc.getX());
set((path == null ? "" : path + ".") + "y", loc.getY());
set((path == null ? "" : path + ".") + "z", loc.getZ());
set((path == null ? "" : path + ".") + "yaw", loc.getYaw());
set((path == null ? "" : path + ".") + "pitch", loc.getPitch());
}
@Override
public ItemStack getItemStack(final String path)
{
final ItemStack stack = new ItemStack(
Material.valueOf(getString(path + ".type", "AIR")),
getInt(path + ".amount", 1),
(short)getInt(path + ".damage", 0));
final List<String> enchants = getKeys(path + ".enchant");
final ConfigurationSection enchants = getConfigurationSection(path + ".enchant");
if (enchants != null)
{
for (String enchant : enchants)
for (String enchant : enchants.getKeys(false))
{
final Enchantment enchantment = Enchantment.getByName(enchant.toUpperCase(Locale.ENGLISH));
if (enchantment == null)
@@ -270,14 +272,14 @@ public class EssentialsConf extends Configuration
}
// getData().getData() is broken
//map.put("data", stack.getDurability());
setProperty(path, map);
set(path, map);
}
public long getLong(final String path, final long def)
{
try
{
final Number num = (Number)getProperty(path);
final Number num = (Number)get(path);
return num == null ? def : num.longValue();
}
catch (ClassCastException ex)
@@ -291,7 +293,7 @@ public class EssentialsConf extends Configuration
{
try
{
Number num = (Number)getProperty(path);
Number num = (Number)get(path);
return num == null ? def : num.doubleValue();
}
catch (ClassCastException ex)
@@ -299,4 +301,27 @@ public class EssentialsConf extends Configuration
return def;
}
}
public void save() {
try
{
save(configFile);
}
catch (IOException ex)
{
LOGGER.log(Level.SEVERE, null, ex);
}
}
public Object getProperty(String path) {
return get(path);
}
public void setProperty(String path, Object object) {
set(path, object);
}
public void removeProperty(String path) {
set(path, null);
}
}

View File

@@ -24,48 +24,47 @@ public class EssentialsEntityListener implements Listener
}
@EventHandler(priority = EventPriority.LOWEST)
public void onEntityDamage(EntityDamageEvent event)
public void onEntityDamage(final EntityDamageByEntityEvent event)
{
if (event instanceof EntityDamageByEntityEvent)
final Entity eAttack = event.getDamager();
final Entity eDefend = event.getEntity();
if (eDefend instanceof Player && eAttack instanceof Player)
{
EntityDamageByEntityEvent edEvent = (EntityDamageByEntityEvent)event;
Entity eAttack = edEvent.getDamager();
Entity eDefend = edEvent.getEntity();
if (eDefend instanceof Player && eAttack instanceof Player)
final User defender = ess.getUser(eDefend);
final User attacker = ess.getUser(eAttack);
attacker.updateActivity(true);
final List<String> commandList = attacker.getPowertool(attacker.getItemInHand());
if (commandList != null && !commandList.isEmpty())
{
User defender = ess.getUser(eDefend);
User attacker = ess.getUser(eAttack);
attacker.updateActivity(true);
ItemStack is = attacker.getItemInHand();
List<String> commandList = attacker.getPowertool(is);
if (commandList != null && !commandList.isEmpty())
for (String command : commandList)
{
for (String command : commandList)
if (command != null && !command.isEmpty())
{
if (command != null && !command.isEmpty())
{
attacker.getServer().dispatchCommand(attacker, command.replaceAll("\\{player\\}", defender.getName()));
event.setCancelled(true);
return;
}
attacker.getServer().dispatchCommand(attacker, command.replaceAll("\\{player\\}", defender.getName()));
event.setCancelled(true);
return;
}
}
}
if (eDefend instanceof Animals && eAttack instanceof Player)
}
else if (eDefend instanceof Animals && eAttack instanceof Player)
{
final User player = ess.getUser(eAttack);
final ItemStack hand = player.getItemInHand();
if (hand != null && hand.getType() == Material.MILK_BUCKET)
{
User player = ess.getUser(eAttack);
ItemStack hand = player.getItemInHand();
if (hand != null && hand.getType() == Material.MILK_BUCKET)
{
((Animals)eDefend).setAge(-24000);
hand.setType(Material.BUCKET);
player.setItemInHand(hand);
player.updateInventory();
event.setCancelled(true);
}
((Animals)eDefend).setAge(-24000);
hand.setType(Material.BUCKET);
player.setItemInHand(hand);
player.updateInventory();
event.setCancelled(true);
}
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void onEntityDamage(final EntityDamageEvent event)
{
if (event.getEntity() instanceof Player && ess.getUser(event.getEntity()).isGodModeEnabled())
{
final Player player = (Player)event.getEntity();
@@ -76,7 +75,7 @@ public class EssentialsEntityListener implements Listener
}
@EventHandler(priority = EventPriority.LOWEST)
public void onEntityCombust(EntityCombustEvent event)
public void onEntityCombust(final EntityCombustEvent event)
{
if (event.getEntity() instanceof Player && ess.getUser(event.getEntity()).isGodModeEnabled())
{
@@ -85,26 +84,22 @@ public class EssentialsEntityListener implements Listener
}
@EventHandler(priority = EventPriority.LOWEST)
public void onEntityDeath(final EntityDeathEvent event)
public void onPlayerDeathEvent(final PlayerDeathEvent event)
{
if (event instanceof PlayerDeathEvent)
final User user = ess.getUser(event.getEntity());
if (user.isAuthorized("essentials.back.ondeath") && !ess.getSettings().isCommandDisabled("back"))
{
final PlayerDeathEvent pdevent = (PlayerDeathEvent)event;
final User user = ess.getUser(pdevent.getEntity());
if (user.isAuthorized("essentials.back.ondeath") && !ess.getSettings().isCommandDisabled("back"))
{
user.setLastLocation();
user.sendMessage(_("backAfterDeath"));
}
if (!ess.getSettings().areDeathMessagesEnabled())
{
pdevent.setDeathMessage("");
}
user.setLastLocation();
user.sendMessage(_("backAfterDeath"));
}
if (!ess.getSettings().areDeathMessagesEnabled())
{
event.setDeathMessage("");
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void onFoodLevelChange(FoodLevelChangeEvent event)
public void onFoodLevelChange(final FoodLevelChangeEvent event)
{
if (event.getEntity() instanceof Player && ess.getUser(event.getEntity()).isGodModeEnabled())
{
@@ -113,7 +108,7 @@ public class EssentialsEntityListener implements Listener
}
@EventHandler(priority = EventPriority.LOWEST)
public void onEntityRegainHealth(EntityRegainHealthEvent event)
public void onEntityRegainHealth(final EntityRegainHealthEvent event)
{
if (event.getRegainReason() == RegainReason.SATIATED && event.getEntity() instanceof Player
&& ess.getUser(event.getEntity()).isAfk() && ess.getSettings().getFreezeAfkPlayers())

View File

@@ -182,10 +182,16 @@ public class EssentialsPlayerListener implements Listener
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerLogin(final PlayerLoginEvent event)
{
if (event.getResult() != Result.ALLOWED && event.getResult() != Result.KICK_FULL && event.getResult() != Result.KICK_BANNED)
switch (event.getResult())
{
case ALLOWED:
case KICK_FULL:
case KICK_BANNED:
break;
default:
return;
}
User user = ess.getUser(event.getPlayer());
user.setNPC(false);
@@ -194,7 +200,7 @@ public class EssentialsPlayerListener implements Listener
user.checkMuteTimeout(currentTime);
user.checkJailTimeout(currentTime);
if (banExpired == false && (user.isBanned() || event.getResult() == Result.KICK_BANNED))
if (!banExpired && (user.isBanned() || event.getResult() == Result.KICK_BANNED))
{
final String banReason = user.getBanReason();
event.disallow(Result.KICK_BANNED, banReason != null && !banReason.isEmpty() && !banReason.equalsIgnoreCase("ban") ? banReason : _("defaultBanReason"));
@@ -233,18 +239,13 @@ public class EssentialsPlayerListener implements Listener
return;
}
final User user = ess.getUser(event.getPlayer());
//There is TeleportCause.COMMMAND but plugins have to actively pass the cause in on their teleports.
if ((event.getCause() == TeleportCause.PLUGIN || event.getCause() == TeleportCause.COMMAND) && ess.getSettings().registerBackInListener())
{
final User user = ess.getUser(event.getPlayer());
user.setLastLocation();
}
if (ess.getSettings().changeDisplayName())
{
user.setDisplayNick();
}
updateCompass(user);
}
@EventHandler(priority = EventPriority.HIGH)
@@ -277,51 +278,6 @@ public class EssentialsPlayerListener implements Listener
}
}
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerAnimation(final PlayerAnimationEvent event)
{
final User user = ess.getUser(event.getPlayer());
user.updateActivity(true);
if (event.getAnimationType() == PlayerAnimationType.ARM_SWING
&& user.hasPowerTools() && user.arePowerToolsEnabled())
{
usePowertools(user);
}
}
private void usePowertools(final User user)
{
final ItemStack is = user.getItemInHand();
int id;
if (is == null || (id = is.getTypeId()) == 0)
{
return;
}
final List<String> commandList = user.getPowertool(id);
if (commandList == null || commandList.isEmpty())
{
return;
}
// We need to loop through each command and execute
for (String command : commandList)
{
if (command.matches(".*\\{player\\}.*"))
{
//user.sendMessage("Click a player to use this command");
continue;
}
else if (command.startsWith("c:"))
{
user.chat(command.substring(2));
}
else
{
user.getServer().dispatchCommand(user.getBase(), command);
}
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerCommandPreprocess(final PlayerCommandPreprocessEvent event)
{
@@ -336,7 +292,7 @@ public class EssentialsPlayerListener implements Listener
{
for (Player player : ess.getServer().getOnlinePlayers())
{
User spyer = ess.getUser(player);
final User spyer = ess.getUser(player);
if (spyer.isSocialSpyEnabled() && !user.equals(spyer))
{
player.sendMessage(user.getDisplayName() + " : " + event.getMessage());
@@ -352,9 +308,15 @@ public class EssentialsPlayerListener implements Listener
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerChangedWorld(final PlayerChangedWorldEvent event)
{
final User user = ess.getUser(event.getPlayer());
if (ess.getSettings().changeDisplayName())
{
user.setDisplayNick();
}
updateCompass(user);
if (ess.getSettings().getNoGodWorlds().contains(event.getPlayer().getLocation().getWorld().getName()))
{
User user = ess.getUser(event.getPlayer());
if (user.isGodModeEnabledRaw())
{
user.sendMessage(_("noGodWorldWarning"));
@@ -362,26 +324,84 @@ public class EssentialsPlayerListener implements Listener
}
}
@EventHandler(priority = EventPriority.MONITOR)
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerInteract(final PlayerInteractEvent event)
{
if (event.isCancelled())
final User user = ess.getUser(event.getPlayer());
user.updateActivity(true);
switch (event.getAction())
{
return;
}
if (event.getAction() != Action.RIGHT_CLICK_BLOCK)
{
return;
}
if (ess.getSettings().getUpdateBedAtDaytime() && event.getClickedBlock().getType() == Material.BED_BLOCK)
{
event.getPlayer().setBedSpawnLocation(event.getClickedBlock().getLocation());
case RIGHT_CLICK_BLOCK:
if (event.isCancelled())
{
return;
}
if (ess.getSettings().getUpdateBedAtDaytime() && event.getClickedBlock().getType() == Material.BED_BLOCK)
{
event.getPlayer().setBedSpawnLocation(event.getClickedBlock().getLocation());
}
break;
case LEFT_CLICK_AIR:
case LEFT_CLICK_BLOCK:
if (user.hasPowerTools() && user.arePowerToolsEnabled())
{
if (usePowertools(user))
{
event.setCancelled(true);
}
}
break;
default:
break;
}
}
private boolean usePowertools(final User user)
{
final ItemStack is = user.getItemInHand();
int id;
if (is == null || (id = is.getTypeId()) == 0)
{
return false;
}
final List<String> commandList = user.getPowertool(id);
if (commandList == null || commandList.isEmpty())
{
return false;
}
boolean used = false;
// We need to loop through each command and execute
for (final String command : commandList)
{
if (command.matches(".*\\{player\\}.*"))
{
//user.sendMessage("Click a player to use this command");
continue;
}
else if (command.startsWith("c:"))
{
used = true;
user.chat(command.substring(2));
}
else
{
used = true;
ess.scheduleSyncDelayedTask(
new Runnable()
{
@Override
public void run()
{
user.getServer().dispatchCommand(user.getBase(), command);
}
});
}
}
return used;
}
@EventHandler(priority = EventPriority.LOW)
public void onPlayerPickupItem(PlayerPickupItemEvent event)
public void onPlayerPickupItem(final PlayerPickupItemEvent event)
{
if (event.isCancelled() || !ess.getSettings().getDisableItemPickupWhileAfk())
{

View File

@@ -3,6 +3,7 @@ package com.earth2me.essentials;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.logging.Level;
import org.bukkit.entity.Player;
@@ -22,10 +23,17 @@ public class EssentialsTimer implements Runnable
final long currentTime = System.currentTimeMillis();
for (Player player : ess.getServer().getOnlinePlayers())
{
final User user = ess.getUser(player);
onlineUsers.add(user);
user.setLastOnlineActivity(currentTime);
user.checkActivity();
try
{
final User user = ess.getUser(player);
onlineUsers.add(user);
user.setLastOnlineActivity(currentTime);
user.checkActivity();
}
catch (Exception e)
{
ess.getLogger().log(Level.WARNING, "EssentialsTimer Error:", e);
}
}
final Iterator<User> iterator = onlineUsers.iterator();

View File

@@ -95,7 +95,7 @@ public class EssentialsUpgrade
}
final EssentialsConf conf = new EssentialsConf(configFile);
conf.load();
List<String> lines = conf.getStringList(name, null);
List<String> lines = conf.getStringList(name);
if (lines != null && !lines.isEmpty())
{
if (!file.createNewFile())
@@ -271,18 +271,18 @@ public class EssentialsUpgrade
if (config.hasProperty("powertools"))
{
@SuppressWarnings("unchecked")
final Map<Integer, Object> powertools = (Map<Integer, Object>)config.getProperty("powertools");
final Map<String, Object> powertools = config.getConfigurationSection("powertools").getValues(false);
if (powertools == null)
{
continue;
}
for (Map.Entry<Integer, Object> entry : powertools.entrySet())
for (Map.Entry<String, Object> entry : powertools.entrySet())
{
if (entry.getValue() instanceof String)
{
List<String> temp = new ArrayList<String>();
temp.add((String)entry.getValue());
((Map<Integer, Object>)powertools).put(entry.getKey(), temp);
((Map<String, Object>)powertools).put(entry.getKey(), temp);
}
}
config.save();
@@ -332,7 +332,7 @@ public class EssentialsUpgrade
config.setProperty("homes.home", defloc);
}
List<String> worlds = config.getKeys("home.worlds");
Set<String> worlds = config.getConfigurationSection("home.worlds").getKeys(false);
Location loc;
String worldName;
@@ -381,7 +381,7 @@ public class EssentialsUpgrade
}
final EssentialsConf usersConfig = new EssentialsConf(usersFile);
usersConfig.load();
for (String username : usersConfig.getKeys(null))
for (String username : usersConfig.getKeys(false))
{
final User user = new User(new OfflinePlayer(username, ess), ess);
final String nickname = usersConfig.getString(username + ".nickname");
@@ -389,7 +389,7 @@ public class EssentialsUpgrade
{
user.setNickname(nickname);
}
final List<String> mails = usersConfig.getStringList(username + ".mail", null);
final List<String> mails = usersConfig.getStringList(username + ".mail");
if (mails != null && !mails.isEmpty())
{
user.setMails(mails);
@@ -701,7 +701,7 @@ public class EssentialsUpgrade
if (!config.hasProperty("spawns"))
{
final Spawns spawns = new Spawns();
List<String> keys = config.getKeys();
Set<String> keys = config.getKeys(false);
for (String group : keys)
{
Location loc = getFakeLocation(config, group);
@@ -748,7 +748,7 @@ public class EssentialsUpgrade
if (!config.hasProperty("jails"))
{
final com.earth2me.essentials.settings.Jails jails = new com.earth2me.essentials.settings.Jails();
List<String> keys = config.getKeys();
Set<String> keys = config.getKeys(false);
for (String jailName : keys)
{
Location loc = getFakeLocation(config, jailName);

View File

@@ -9,6 +9,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.plugin.Plugin;
import org.bukkit.scheduler.BukkitScheduler;
/**
* @deprecated This will be moved to the api package soon
*/

View File

@@ -2,11 +2,13 @@ package com.earth2me.essentials;
import com.earth2me.essentials.commands.IEssentialsCommand;
import com.earth2me.essentials.signs.EssentialsSign;
import com.earth2me.essentials.textreader.IText;
import java.text.MessageFormat;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.bukkit.ChatColor;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.event.EventPriority;
@@ -14,12 +16,12 @@ public interface ISettings extends IConf
{
boolean areSignsDisabled();
String format(String format, IUser user);
String getAnnounceNewPlayerFormat(IUser user);
IText getAnnounceNewPlayerFormat();
boolean getAnnounceNewPlayers();
String getNewPlayerKit();
String getBackupCommand();
long getBackupInterval();
@@ -35,14 +37,14 @@ public interface ISettings extends IConf
String getCurrencySymbol();
int getOversizedStackSize();
int getDefaultStackSize();
double getHealCooldown();
Object getKit(String name);
Map<String, Object> getKit(String name);
Map<String, Object> getKits();
ConfigurationSection getKits();
String getLocale();
@@ -66,7 +68,7 @@ public interface ISettings extends IConf
boolean getRespawnAtHome();
List getMultipleHomes();
Set getMultipleHomes();
int getHomeLimit(String set);
@@ -101,7 +103,7 @@ public interface ISettings extends IConf
boolean isTradeInStacks(int id);
List<Integer> itemSpawnBlacklist();
List<EssentialsSign> enabledSigns();
boolean permissionBasedItemSpawn();
@@ -116,8 +118,12 @@ public interface ISettings extends IConf
double getMaxMoney();
double getMinMoney();
boolean isEcoLogEnabled();
boolean isEcoLogUpdateEnabled();
boolean removeGodOnDisconnect();
boolean changeDisplayName();
@@ -143,18 +149,18 @@ public interface ISettings extends IConf
public void setDebug(boolean debug);
Set<String> getNoGodWorlds();
boolean getUpdateBedAtDaytime();
boolean getRepairEnchanted();
boolean getIsWorldTeleportPermissions();
boolean registerBackInListener();
boolean getDisableItemPickupWhileAfk();
EventPriority getRespawnPriority();
long getTpaAcceptCancellation();
}

View File

@@ -32,6 +32,8 @@ public interface IUser extends Player
void takeMoney(double value);
void giveMoney(double value);
boolean canAfford(double value);
String getGroup();

View File

@@ -1,18 +1,24 @@
package com.earth2me.essentials;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.api.IJails;
import com.earth2me.essentials.storage.AsyncStorageObjectHolder;
import static com.earth2me.essentials.I18n._;
import java.io.File;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.event.block.*;
import org.bukkit.event.player.*;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.plugin.PluginManager;
@@ -33,13 +39,8 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
final PluginManager pluginManager = ess.getServer().getPluginManager();
final JailBlockListener blockListener = new JailBlockListener();
final JailPlayerListener playerListener = new JailPlayerListener();
pluginManager.registerEvent(Type.BLOCK_BREAK, blockListener, Priority.Low, ess);
pluginManager.registerEvent(Type.BLOCK_DAMAGE, blockListener, Priority.Low, ess);
pluginManager.registerEvent(Type.BLOCK_PLACE, blockListener, Priority.Low, ess);
pluginManager.registerEvent(Type.PLAYER_INTERACT, playerListener, Priority.Low, ess);
pluginManager.registerEvent(Type.PLAYER_RESPAWN, playerListener, Priority.High, ess);
pluginManager.registerEvent(Type.PLAYER_TELEPORT, playerListener, Priority.High, ess);
pluginManager.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.High, ess);
pluginManager.registerEvents(blockListener, ess);
pluginManager.registerEvents(playerListener, ess);
}
@Override
@@ -146,9 +147,9 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
}
private class JailBlockListener extends BlockListener
private class JailBlockListener implements Listener
{
@Override
@EventHandler(priority = EventPriority.LOW)
public void onBlockBreak(final BlockBreakEvent event)
{
final User user = ess.getUser(event.getPlayer());
@@ -158,7 +159,7 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
}
}
@Override
@EventHandler(priority = EventPriority.LOW)
public void onBlockPlace(final BlockPlaceEvent event)
{
final User user = ess.getUser(event.getPlayer());
@@ -168,7 +169,7 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
}
}
@Override
@EventHandler(priority = EventPriority.LOW)
public void onBlockDamage(final BlockDamageEvent event)
{
final User user = ess.getUser(event.getPlayer());
@@ -180,9 +181,9 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
}
private class JailPlayerListener extends PlayerListener
private class JailPlayerListener implements Listener
{
@Override
@EventHandler(priority = EventPriority.LOW)
public void onPlayerInteract(final PlayerInteractEvent event)
{
final User user = ess.getUser(event.getPlayer());
@@ -192,7 +193,7 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
}
}
@Override
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerRespawn(final PlayerRespawnEvent event)
{
final User user = ess.getUser(event.getPlayer());
@@ -207,11 +208,18 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
}
catch (Exception ex)
{
LOGGER.log(Level.WARNING, _("returnPlayerToJailError"), ex);
if (ess.getSettings().isDebug())
{
LOGGER.log(Level.INFO, _("returnPlayerToJailError", user.getName(), ex.getLocalizedMessage()), ex);
}
else
{
LOGGER.log(Level.INFO, _("returnPlayerToJailError", user.getName(), ex.getLocalizedMessage()));
}
}
}
@Override
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerTeleport(final PlayerTeleportEvent event)
{
final User user = ess.getUser(event.getPlayer());
@@ -226,12 +234,19 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
}
catch (Exception ex)
{
LOGGER.log(Level.WARNING, _("returnPlayerToJailError"), ex);
if (ess.getSettings().isDebug())
{
LOGGER.log(Level.INFO, _("returnPlayerToJailError", user.getName(), ex.getLocalizedMessage()), ex);
}
else
{
LOGGER.log(Level.INFO, _("returnPlayerToJailError", user.getName(), ex.getLocalizedMessage()));
}
}
user.sendMessage(_("jailMessage"));
}
@Override
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerJoin(final PlayerJoinEvent event)
{
final User user = ess.getUser(event.getPlayer());
@@ -246,7 +261,14 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
}
catch (Exception ex)
{
LOGGER.log(Level.WARNING, _("returnPlayerToJailError"), ex);
if (ess.getSettings().isDebug())
{
LOGGER.log(Level.INFO, _("returnPlayerToJailError", user.getName(), ex.getLocalizedMessage()), ex);
}
else
{
LOGGER.log(Level.INFO, _("returnPlayerToJailError", user.getName(), ex.getLocalizedMessage()));
}
}
user.sendMessage(_("jailMessage"));
}

View File

@@ -1,10 +1,12 @@
package com.earth2me.essentials;
import static com.earth2me.essentials.I18n._;
import static com.earth2me.essentials.I18n.capitalCase;
import com.earth2me.essentials.commands.NoChargeException;
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
import java.util.*;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.inventory.ItemStack;
@@ -15,16 +17,16 @@ public class Kit
{
try
{
final Map<String, Object> kits = ess.getSettings().getKits();
final ConfigurationSection kits = ess.getSettings().getKits();
final StringBuilder list = new StringBuilder();
for (String kiteItem : kits.keySet())
for (String kiteItem : kits.getKeys(false))
{
if (user.isAuthorized("essentials.kit." + kiteItem.toLowerCase(Locale.ENGLISH)))
{
list.append(" ").append(kiteItem);
list.append(" ").append(capitalCase(kiteItem));
}
}
return list.toString();
return list.toString().trim();
}
catch (Exception ex)
{
@@ -59,11 +61,16 @@ public class Kit
}
}
public static List<String> getItems(final User user, final Map<String, Object> els) throws Exception
public static List<String> getItems(final User user, final Map<String, Object> kit) throws Exception
{
if (kit == null)
{
throw new Exception(_("kitError2"));
}
try
{
return (List<String>)els.get("items");
return (List<String>)kit.get("items");
}
catch (Exception e)
{

View File

@@ -1,6 +1,7 @@
package com.earth2me.essentials;
import static com.earth2me.essentials.I18n._;
import java.util.Collections;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
@@ -9,40 +10,40 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.entity.CreatureType;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
public enum Mob
{
CHICKEN("Chicken", Enemies.FRIENDLY, CreatureType.CHICKEN),
COW("Cow", Enemies.FRIENDLY, CreatureType.COW),
CREEPER("Creeper", Enemies.ENEMY, CreatureType.CREEPER),
GHAST("Ghast", Enemies.ENEMY, CreatureType.GHAST),
GIANT("Giant", Enemies.ENEMY, CreatureType.GIANT),
PIG("Pig", Enemies.FRIENDLY, CreatureType.PIG),
PIGZOMB("PigZombie", Enemies.NEUTRAL, CreatureType.PIG_ZOMBIE),
SHEEP("Sheep", Enemies.FRIENDLY, "", CreatureType.SHEEP),
SKELETON("Skeleton", Enemies.ENEMY, CreatureType.SKELETON),
SLIME("Slime", Enemies.ENEMY, CreatureType.SLIME),
SPIDER("Spider", Enemies.ENEMY, CreatureType.SPIDER),
SQUID("Squid", Enemies.FRIENDLY, CreatureType.SQUID),
ZOMBIE("Zombie", Enemies.ENEMY, CreatureType.ZOMBIE),
WOLF("Wolf", Enemies.NEUTRAL, CreatureType.WOLF),
CAVESPIDER("CaveSpider", Enemies.ENEMY, CreatureType.CAVE_SPIDER),
ENDERMAN("Enderman", Enemies.ENEMY, "", CreatureType.ENDERMAN),
SILVERFISH("Silverfish", Enemies.ENEMY, "", CreatureType.SILVERFISH),
ENDERDRAGON("EnderDragon", Enemies.ENEMY, CreatureType.ENDER_DRAGON),
VILLAGER("Villager", Enemies.FRIENDLY, CreatureType.VILLAGER),
BLAZE("Blaze", Enemies.ENEMY, CreatureType.BLAZE),
MUSHROOMCOW("MushroomCow", Enemies.FRIENDLY, CreatureType.MUSHROOM_COW),
MAGMACUBE("MagmaCube", Enemies.ENEMY, CreatureType.MAGMA_CUBE),
SNOWMAN("Snowman", Enemies.FRIENDLY, "", CreatureType.SNOWMAN);
CHICKEN("Chicken", Enemies.FRIENDLY, EntityType.CHICKEN),
COW("Cow", Enemies.FRIENDLY, EntityType.COW),
CREEPER("Creeper", Enemies.ENEMY, EntityType.CREEPER),
GHAST("Ghast", Enemies.ENEMY, EntityType.GHAST),
GIANT("Giant", Enemies.ENEMY, EntityType.GIANT),
PIG("Pig", Enemies.FRIENDLY, EntityType.PIG),
PIGZOMB("PigZombie", Enemies.NEUTRAL, EntityType.PIG_ZOMBIE),
SHEEP("Sheep", Enemies.FRIENDLY, "", EntityType.SHEEP),
SKELETON("Skeleton", Enemies.ENEMY, EntityType.SKELETON),
SLIME("Slime", Enemies.ENEMY, EntityType.SLIME),
SPIDER("Spider", Enemies.ENEMY, EntityType.SPIDER),
SQUID("Squid", Enemies.FRIENDLY, EntityType.SQUID),
ZOMBIE("Zombie", Enemies.ENEMY, EntityType.ZOMBIE),
WOLF("Wolf", Enemies.NEUTRAL, EntityType.WOLF),
CAVESPIDER("CaveSpider", Enemies.ENEMY, EntityType.CAVE_SPIDER),
ENDERMAN("Enderman", Enemies.ENEMY, "", EntityType.ENDERMAN),
SILVERFISH("Silverfish", Enemies.ENEMY, "", EntityType.SILVERFISH),
ENDERDRAGON("EnderDragon", Enemies.ENEMY, EntityType.ENDER_DRAGON),
VILLAGER("Villager", Enemies.FRIENDLY, EntityType.VILLAGER),
BLAZE("Blaze", Enemies.ENEMY, EntityType.BLAZE),
MUSHROOMCOW("MushroomCow", Enemies.FRIENDLY, EntityType.MUSHROOM_COW),
MAGMACUBE("MagmaCube", Enemies.ENEMY, EntityType.MAGMA_CUBE),
SNOWMAN("Snowman", Enemies.FRIENDLY, "", EntityType.SNOWMAN);
public static final Logger logger = Logger.getLogger("Minecraft");
private Mob(String n, Enemies en, String s, CreatureType type)
private Mob(String n, Enemies en, String s, EntityType type)
{
this.suffix = s;
this.name = n;
@@ -50,7 +51,7 @@ public enum Mob
this.bukkitType = type;
}
private Mob(String n, Enemies en, CreatureType type)
private Mob(String n, Enemies en, EntityType type)
{
this.name = n;
this.type = en;
@@ -59,7 +60,7 @@ public enum Mob
public String suffix = "s";
final public String name;
final public Enemies type;
final private CreatureType bukkitType;
final private EntityType bukkitType;
private static final Map<String, Mob> hashMap = new HashMap<String, Mob>();
static
@@ -71,7 +72,7 @@ public enum Mob
}
public static Set<String> getMobList() {
return hashMap.keySet();
return Collections.unmodifiableSet(hashMap.keySet());
}
public LivingEntity spawn(final Player player, final Server server, final Location loc) throws MobException
@@ -99,7 +100,7 @@ public enum Mob
final protected String type;
}
public CreatureType getType()
public EntityType getType()
{
return bukkitType;
}

View File

@@ -1,22 +1,28 @@
package com.earth2me.essentials;
import com.earth2me.essentials.craftbukkit.OfflineBedLocation;
import static com.earth2me.essentials.I18n._;
import java.net.InetSocketAddress;
import java.util.*;
import lombok.Delegate;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.conversations.Conversation;
import org.bukkit.entity.*;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryView;
import org.bukkit.inventory.InventoryView.Property;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.map.MapView;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionAttachment;
import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.Plugin;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
@@ -170,11 +176,6 @@ public class OfflinePlayer implements Player
return false;
}
public boolean isPlayer()
{
return false;
}
@Override
public int getRemainingAir()
{
@@ -664,18 +665,6 @@ public class OfflinePlayer implements Player
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public int getExperience()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setExperience(int i)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public int getLevel()
{
@@ -857,4 +846,185 @@ public class OfflinePlayer implements Player
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void hidePlayer(Player player)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void showPlayer(Player player)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean canSee(Player player)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean addPotionEffect(PotionEffect pe)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean addPotionEffect(PotionEffect pe, boolean bln)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean addPotionEffects(Collection<PotionEffect> clctn)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean hasPotionEffect(PotionEffectType pet)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void removePotionEffect(PotionEffectType pet)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Collection<PotionEffect> getActivePotionEffects()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public <T extends Projectile> T launchProjectile(Class<? extends T> arg0)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public EntityType getType()
{
return EntityType.PLAYER;
}
@Override
public <T> void playEffect(Location lctn, Effect effect, T t)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean setWindowProperty(Property prprt, int i)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public InventoryView getOpenInventory()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public InventoryView openInventory(Inventory invntr)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public InventoryView openWorkbench(Location lctn, boolean bln)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public InventoryView openEnchanting(Location lctn, boolean bln)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void openInventory(InventoryView iv)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void closeInventory()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public ItemStack getItemOnCursor()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setItemOnCursor(ItemStack is)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setMetadata(String string, MetadataValue mv)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public List<MetadataValue> getMetadata(String string)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean hasMetadata(String string)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void removeMetadata(String string, Plugin plugin)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean isConversing()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void acceptConversationInput(String string)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean beginConversation(Conversation c)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void abandonConversation(Conversation c)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void sendMessage(String[] strings)
{
throw new UnsupportedOperationException("Not supported yet.");
}
}

View File

@@ -4,12 +4,16 @@ import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.commands.IEssentialsCommand;
import com.earth2me.essentials.signs.EssentialsSign;
import com.earth2me.essentials.signs.Signs;
import com.earth2me.essentials.textreader.IText;
import com.earth2me.essentials.textreader.SimpleTextInput;
import java.io.File;
import java.text.MessageFormat;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.ChatColor;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.MemoryConfiguration;
import org.bukkit.event.EventPriority;
import org.bukkit.inventory.ItemStack;
@@ -41,15 +45,15 @@ public class Settings implements ISettings
}
@Override
public List<String> getMultipleHomes()
public Set<String> getMultipleHomes()
{
return config.getKeys("sethome-multiple");
return config.getConfigurationSection("sethome-multiple").getKeys(false);
}
@Override
public int getHomeLimit(final User user)
{
final List<String> homeList = getMultipleHomes();
final Set<String> homeList = getMultipleHomes();
if (homeList == null)
{
//TODO: Replace this code to remove backwards compat, after settings are automatically updated
@@ -112,7 +116,7 @@ public class Settings implements ISettings
@Override
public boolean isCommandDisabled(String label)
{
for (String c : config.getStringList("disabled-commands", new ArrayList<String>(0)))
for (String c : config.getStringList("disabled-commands"))
{
if (!c.equalsIgnoreCase(label))
{
@@ -132,7 +136,7 @@ public class Settings implements ISettings
@Override
public boolean isCommandRestricted(String label)
{
for (String c : config.getStringList("restricted-commands", new ArrayList<String>(0)))
for (String c : config.getStringList("restricted-commands"))
{
if (!c.equalsIgnoreCase(label))
{
@@ -146,7 +150,7 @@ public class Settings implements ISettings
@Override
public boolean isPlayerCommand(String label)
{
for (String c : config.getStringList("player-commands", new ArrayList<String>(0)))
for (String c : config.getStringList("player-commands"))
{
if (!c.equalsIgnoreCase(label))
{
@@ -160,9 +164,7 @@ public class Settings implements ISettings
@Override
public boolean isCommandOverridden(String name)
{
List<String> defaultList = new ArrayList<String>(1);
defaultList.add("god");
for (String c : config.getStringList("overridden-commands", defaultList))
for (String c : config.getStringList("overridden-commands"))
{
if (!c.equalsIgnoreCase(name))
{
@@ -207,25 +209,45 @@ public class Settings implements ISettings
{
return config.getDouble("heal-cooldown", 0);
}
private ConfigurationSection kits;
@Override
public Object getKit(String name)
public ConfigurationSection _getKits()
{
Map<String, Object> kits = (Map<String, Object>)config.getProperty("kits");
for (Map.Entry<String, Object> entry : kits.entrySet())
if (config.isConfigurationSection("kits"))
{
if (entry.getKey().equalsIgnoreCase(name.replace('.', '_').replace('/', '_')))
final ConfigurationSection section = config.getConfigurationSection("kits");
final ConfigurationSection newSection = new MemoryConfiguration();
for (String kitItem : section.getKeys(false))
{
return entry.getValue();
if (section.isConfigurationSection(kitItem))
{
newSection.set(kitItem.toLowerCase(Locale.ENGLISH), section.getConfigurationSection(kitItem));
}
}
return newSection;
}
return null;
}
@Override
public Map<String, Object> getKits()
public ConfigurationSection getKits()
{
return (Map<String, Object>)config.getProperty("kits");
return kits;
}
@Override
public Map<String, Object> getKit(String name)
{
name = name.replace('.', '_').replace('/', '_');
if (config.isConfigurationSection("kits"))
{
final ConfigurationSection kits = getKits();
if (kits.isConfigurationSection(name))
{
return kits.getConfigurationSection(name).getValues(true);
}
}
return null;
}
@Override
@@ -250,7 +272,7 @@ public class Settings implements ISettings
{
}
return ChatColor.getByCode(Integer.parseInt(colorName, 16));
return ChatColor.getByChar(colorName);
}
@Override
@@ -324,15 +346,15 @@ public class Settings implements ISettings
}
@Override
public String getAnnounceNewPlayerFormat(IUser user)
public IText getAnnounceNewPlayerFormat()
{
return format(config.getString("newbies.announce-format", "&dWelcome {DISPLAYNAME} to the server!"), user);
return new SimpleTextInput(Util.replaceColor(config.getString("newbies.announce-format", "&dWelcome {DISPLAYNAME} to the server!")));
}
@Override
public String format(String format, IUser user)
public String getNewPlayerKit()
{
return format.replace('&', '§').replace("§§", "&").replace("{PLAYER}", user.getDisplayName()).replace("{DISPLAYNAME}", user.getDisplayName()).replace("{GROUP}", user.getGroup()).replace("{USERNAME}", user.getName()).replace("{ADDRESS}", user.getAddress().toString());
return config.getString("newbies.kit", "");
}
@Override
@@ -357,30 +379,35 @@ public class Settings implements ISettings
public void reloadConfig()
{
config.load();
noGodWorlds = new HashSet<String>(config.getStringList("no-god-in-worlds", Collections.<String>emptyList()));
enabledSigns = getEnabledSigns();
itemSpawnBl = getItemSpawnBlacklist();
noGodWorlds = new HashSet<String>(config.getStringList("no-god-in-worlds"));
enabledSigns = _getEnabledSigns();
itemSpawnBl = _getItemSpawnBlacklist();
kits = _getKits();
chatFormats.clear();
}
private List<Integer> itemSpawnBl = new ArrayList<Integer>();
@Override
public List<Integer> itemSpawnBlacklist()
{
return itemSpawnBl;
}
private List<Integer> getItemSpawnBlacklist()
private List<Integer> _getItemSpawnBlacklist()
{
final List<Integer> epItemSpwn = new ArrayList<Integer>();
if (ess.getItemDb() == null)
{
logger.log(Level.FINE, "Aborting ItemSpawnBL read, itemDB not yet loaded.");
return epItemSpwn;
}
for (String itemName : config.getString("item-spawn-blacklist", "").split(","))
{
itemName = itemName.trim();
if (itemName.isEmpty())
{
continue;
}
}
try
{
final ItemStack iStack = ess.getItemDb().get(itemName);
@@ -393,20 +420,19 @@ public class Settings implements ISettings
}
return epItemSpwn;
}
private List<EssentialsSign> enabledSigns = new ArrayList<EssentialsSign>();
@Override
public List<EssentialsSign> enabledSigns()
{
return enabledSigns;
}
private List<EssentialsSign> getEnabledSigns()
private List<EssentialsSign> _getEnabledSigns()
{
List<EssentialsSign> newSigns = new ArrayList<EssentialsSign>();
for (String signName : config.getStringList("enabledSigns", null))
for (String signName : config.getStringList("enabledSigns"))
{
signName = signName.trim().toUpperCase(Locale.ENGLISH);
if (signName.isEmpty())
@@ -534,6 +560,22 @@ public class Settings implements ISettings
}
return max;
}
private final static double MINMONEY = -10000000000000.0;
@Override
public double getMinMoney()
{
double min = config.getDouble("min-money", MINMONEY);
if (min > 0)
{
min = -min;
}
if (min < MINMONEY)
{
min = MINMONEY;
}
return min;
}
@Override
public boolean isEcoLogEnabled()
@@ -541,6 +583,12 @@ public class Settings implements ISettings
return config.getBoolean("economy-log-enabled", false);
}
@Override
public boolean isEcoLogUpdateEnabled()
{
return config.getBoolean("economy-log-update-enabled", false);
}
@Override
public boolean removeGodOnDisconnect()
{
@@ -600,7 +648,6 @@ public class Settings implements ISettings
{
return config.getBoolean("death-messages", true);
}
private Set<String> noGodWorlds = new HashSet<String>();
@Override

View File

@@ -13,6 +13,7 @@ import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Location;
import org.bukkit.entity.Item;
import org.bukkit.inventory.ItemStack;
@@ -38,7 +39,7 @@ public class Trade
{
this(null, null, items, null, ess);
}
public Trade(final int exp, final IEssentials ess)
{
this(null, null, null, exp, ess);
@@ -79,9 +80,10 @@ public class Trade
{
throw new ChargeException(_("notEnoughMoney"));
}
if (exp != null && exp > 0
&& SetExpFix.getTotalExperience(user) < exp) {
if (exp != null && exp > 0
&& SetExpFix.getTotalExperience(user) < exp)
{
throw new ChargeException(_("notEnoughExperience"));
}
}
@@ -103,9 +105,25 @@ public class Trade
if (dropItems)
{
final Map<Integer, ItemStack> leftOver = InventoryWorkaround.addItem(user.getInventory(), true, getItemStack());
final Location loc = user.getLocation();
for (ItemStack itemStack : leftOver.values())
{
InventoryWorkaround.dropItem(user.getLocation(), itemStack);
final int maxStackSize = itemStack.getType().getMaxStackSize();
final int stacks = itemStack.getAmount() / maxStackSize;
final int leftover = itemStack.getAmount() % maxStackSize;
final Item[] itemStacks = new Item[stacks + (leftover > 0 ? 1 : 0)];
for (int i = 0; i < stacks; i++)
{
final ItemStack stack = itemStack.clone();
stack.setAmount(maxStackSize);
itemStacks[i] = loc.getWorld().dropItem(loc, stack);
}
if (leftover > 0)
{
final ItemStack stack = itemStack.clone();
stack.setAmount(leftover);
itemStacks[stacks] = loc.getWorld().dropItem(loc, stack);
}
}
}
else
@@ -125,8 +143,7 @@ public class Trade
{
if (getMoney() != null)
{
final double mon = user.getMoney();
if (mon < getMoney() && getMoney() > 0 && !user.isAuthorized("essentials.eco.loan"))
if (!user.canAfford(getMoney()) && getMoney() > 0)
{
throw new ChargeException(_("notEnoughMoney"));
}
@@ -145,9 +162,8 @@ public class Trade
&& !user.isAuthorized("essentials.nocommandcost.all")
&& !user.isAuthorized("essentials.nocommandcost." + command))
{
final double mon = user.getMoney();
final double cost = ess.getSettings().getCommandCost(command.charAt(0) == '/' ? command.substring(1) : command);
if (mon < cost && cost > 0 && !user.isAuthorized("essentials.eco.loan"))
if (!user.canAfford(cost) && cost > 0)
{
throw new ChargeException(_("notEnoughMoney"));
}
@@ -173,7 +189,7 @@ public class Trade
{
return itemStack;
}
public Integer getExperience()
{
return exp;
@@ -182,7 +198,8 @@ public class Trade
public static void log(String type, String subtype, String event, String sender, Trade charge, String receiver, Trade pay, Location loc, IEssentials ess)
{
if (!ess.getSettings().isEcoLogEnabled())
if ((loc == null && !ess.getSettings().isEcoLogUpdateEnabled())
|| (loc != null && !ess.getSettings().isEcoLogEnabled()))
{
return;
}

View File

@@ -7,7 +7,6 @@ import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -106,10 +105,10 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
return;
}
setMoney(getMoney() + value);
sendMessage(_("addedToAccount", Util.formatCurrency(value, ess)));
sendMessage(_("addedToAccount", Util.displayCurrency(value, ess)));
if (initiator != null)
{
initiator.sendMessage(_("addedToOthersAccount", Util.formatCurrency(value, ess), this.getDisplayName()));
initiator.sendMessage(_("addedToOthersAccount", Util.displayCurrency(value, ess), this.getDisplayName(), Util.displayCurrency(getMoney(), ess)));
}
}
@@ -123,8 +122,8 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
{
setMoney(getMoney() - value);
reciever.setMoney(reciever.getMoney() + value);
sendMessage(_("moneySentTo", Util.formatCurrency(value, ess), reciever.getDisplayName()));
reciever.sendMessage(_("moneyRecievedFrom", Util.formatCurrency(value, ess), getDisplayName()));
sendMessage(_("moneySentTo", Util.displayCurrency(value, ess), reciever.getDisplayName()));
reciever.sendMessage(_("moneyRecievedFrom", Util.displayCurrency(value, ess), getDisplayName()));
}
else
{
@@ -145,17 +144,26 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
return;
}
setMoney(getMoney() - value);
sendMessage(_("takenFromAccount", Util.formatCurrency(value, ess)));
sendMessage(_("takenFromAccount", Util.displayCurrency(value, ess)));
if (initiator != null)
{
initiator.sendMessage(_("takenFromOthersAccount", Util.formatCurrency(value, ess), this.getDisplayName()));
initiator.sendMessage(_("takenFromOthersAccount", Util.displayCurrency(value, ess), this.getDisplayName(), Util.displayCurrency(getMoney(), ess)));
}
}
public boolean canAfford(final double cost)
{
return canAfford(cost, true);
}
public boolean canAfford(final double cost, final boolean permcheck)
{
final double mon = getMoney();
return mon >= cost || isAuthorized("essentials.eco.loan");
if (!permcheck || isAuthorized("essentials.eco.loan"))
{
return (mon - cost) >= ess.getSettings().getMinMoney();
}
return cost <= mon;
}
public void dispose()
@@ -241,7 +249,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
return teleportRequestHere;
}
public String getNick(boolean addprefixsuffix)
public String getNick(final boolean addprefixsuffix)
{
final StringBuilder nickname = new StringBuilder();
final String nick = getNickname();
@@ -253,28 +261,31 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
{
nickname.append(ess.getSettings().getNicknamePrefix()).append(nick);
}
if (isOp())
if (addprefixsuffix && isOp())
{
try
{
nickname.insert(0, ess.getSettings().getOperatorColor().toString());
nickname.append("§f");
final String opPrefix = ess.getSettings().getOperatorColor().toString();
if (opPrefix.length() > 0) {
nickname.insert(0, opPrefix);
nickname.append("§f");
}
}
catch (Exception e)
{
}
}
if (addprefixsuffix && ess.getSettings().addPrefixSuffix())
{
if (!ess.getSettings().disablePrefix())
{
final String prefix = ess.getPermissionsHandler().getPrefix(base).replace('&', '§').replace("{WORLDNAME}", this.getWorld().getName());
final String prefix = ess.getPermissionsHandler().getPrefix(base).replace('&', '§');
nickname.insert(0, prefix);
}
if (!ess.getSettings().disableSuffix())
{
final String suffix = ess.getPermissionsHandler().getSuffix(base).replace('&', '§').replace("{WORLDNAME}", this.getWorld().getName());
final String suffix = ess.getPermissionsHandler().getSuffix(base).replace('&', '§');
nickname.append(suffix);
if (suffix.length() < 2 || !suffix.substring(suffix.length() - 2, suffix.length() - 1).equals("§"))
{
@@ -322,6 +333,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
return super.getDisplayName() == null ? super.getName() : super.getDisplayName();
}
@Override
public Teleport getTeleport()
{
return teleport;
@@ -379,6 +391,15 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
}
}
super.setMoney(value);
Trade.log("Update", "Set", "API", getName(), new Trade(value, ess), null, null, null, ess);
}
public void updateMoneyCache(final double value)
{
if (ess.getPaymentMethod().hasMethod() && super.getMoney() != value)
{
super.setMoney(value);
}
}
@Override
@@ -544,6 +565,10 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
public boolean canBuild()
{
if (isOp())
{
return true;
}
return ess.getPermissionsHandler().canBuild(base, getGroup());
}

View File

@@ -44,7 +44,7 @@ public abstract class UserData extends PlayerExtension implements IConf
savedInventory = _getSavedInventory();
teleportEnabled = getTeleportEnabled();
ignoredPlayers = getIgnoredPlayers();
godmode = getGodModeEnabled();
godmode = _getGodModeEnabled();
muted = getMuted();
muteTimeout = _getMuteTimeout();
jailed = getJailed();
@@ -58,6 +58,7 @@ public abstract class UserData extends PlayerExtension implements IConf
isNPC = _isNPC();
arePowerToolsEnabled = _arePowerToolsEnabled();
kitTimestamps = _getKitTimestamps();
nickname = _getNickname();
}
private double money;
@@ -94,17 +95,11 @@ public abstract class UserData extends PlayerExtension implements IConf
private Map<String, Object> _getHomes()
{
Object o = config.getProperty("homes");
if (o instanceof Map)
if (config.isConfigurationSection("homes"))
{
return (Map<String, Object>)o;
return config.getConfigurationSection("homes").getValues(false);
}
else
{
return new HashMap<String, Object>();
}
return new HashMap<String, Object>();
}
public Location getHome(String name) throws Exception
@@ -195,13 +190,21 @@ public abstract class UserData extends PlayerExtension implements IConf
return false;
}
public String getNickname()
private String nickname;
public String _getNickname()
{
return config.getString("nickname");
}
public String getNickname()
{
return nickname;
}
public void setNickname(String nick)
{
nickname = nick;
config.setProperty("nickname", nick);
config.save();
}
@@ -209,7 +212,7 @@ public abstract class UserData extends PlayerExtension implements IConf
private List<Integer> _getUnlimited()
{
return config.getIntList("unlimited", new ArrayList<Integer>());
return config.getIntegerList("unlimited");
}
public List<Integer> getUnlimited()
@@ -235,22 +238,15 @@ public abstract class UserData extends PlayerExtension implements IConf
config.setProperty("unlimited", unlimited);
config.save();
}
private Map<Integer, Object> powertools;
private Map<String, Object> powertools;
@SuppressWarnings("unchecked")
private Map<Integer, Object> _getPowertools()
private Map<String, Object> _getPowertools()
{
Object o = config.getProperty("powertools");
if (o instanceof Map)
if (config.isConfigurationSection("powertools"))
{
return (Map<Integer, Object>)o;
return config.getConfigurationSection("powertools").getValues(false);
}
else
{
return new HashMap<Integer, Object>();
}
return new HashMap<String, Object>();
}
public void clearAllPowertools()
@@ -262,23 +258,23 @@ public abstract class UserData extends PlayerExtension implements IConf
public List<String> getPowertool(ItemStack stack)
{
return (List<String>)powertools.get(stack.getTypeId());
return (List<String>)powertools.get("" + stack.getTypeId());
}
public List<String> getPowertool(int id)
{
return (List<String>)powertools.get(id);
return (List<String>)powertools.get("" + id);
}
public void setPowertool(ItemStack stack, List<String> commandList)
{
if (commandList == null || commandList.isEmpty())
{
powertools.remove(stack.getTypeId());
powertools.remove("" + stack.getTypeId());
}
else
{
powertools.put(stack.getTypeId(), commandList);
powertools.put("" + stack.getTypeId(), commandList);
}
config.setProperty("powertools", powertools);
config.save();
@@ -383,7 +379,7 @@ public abstract class UserData extends PlayerExtension implements IConf
private List<String> _getMails()
{
return config.getStringList("mail", new ArrayList<String>());
return config.getStringList("mail");
}
public List<String> getMails()
@@ -491,7 +487,7 @@ public abstract class UserData extends PlayerExtension implements IConf
public List<String> getIgnoredPlayers()
{
return config.getStringList("ignore", new ArrayList<String>());
return config.getStringList("ignore");
}
public void setIgnoredPlayers(List<String> players)
@@ -528,7 +524,7 @@ public abstract class UserData extends PlayerExtension implements IConf
}
private boolean godmode;
private boolean getGodModeEnabled()
private boolean _getGodModeEnabled()
{
return config.getBoolean("godmode", false);
}
@@ -739,7 +735,6 @@ public abstract class UserData extends PlayerExtension implements IConf
return ret;
}
private boolean newplayer;
private String geolocation;
private String _getGeoLocation()
@@ -831,16 +826,12 @@ public abstract class UserData extends PlayerExtension implements IConf
private Map<String, Object> _getKitTimestamps()
{
final Object map = config.getProperty("timestamps.kits");
if (map instanceof Map)
if (config.isConfigurationSection("timestamps.kits"))
{
return (Map<String, Object>)map;
}
else
{
return new HashMap<String, Object>();
return config.getConfigurationSection("timestamps.kits").getValues(false);
}
return new HashMap<String, Object>();
}
public Long getKitTimestamp(final String name)

View File

@@ -61,7 +61,7 @@ public class UserMap extends CacheLoader<String, User> implements IConf
{
try
{
return users.get(Util.sanitizeFileName(name));
return users.get(name);
}
catch (ExecutionException ex)
{
@@ -76,18 +76,31 @@ public class UserMap extends CacheLoader<String, User> implements IConf
@Override
public User load(final String name) throws Exception
{
String sanitizedName = Util.sanitizeFileName(name);
if (!sanitizedName.equals(name))
{
User user = getUser(sanitizedName);
if (user == null)
{
throw new Exception("User not found!");
}
else
{
return user;
}
}
for (Player player : ess.getServer().getOnlinePlayers())
{
if (player.getName().equalsIgnoreCase(name))
{
keys.add(Util.sanitizeFileName(name));
keys.add(sanitizedName);
return new User(player, ess);
}
}
final File userFile = getUserFile(name);
final File userFile = getUserFile2(sanitizedName);
if (userFile.exists())
{
keys.add(Util.sanitizeFileName(name));
keys.add(sanitizedName);
return new User(new OfflinePlayer(name, ess), ess);
}
throw new Exception("User not found!");
@@ -103,6 +116,7 @@ public class UserMap extends CacheLoader<String, User> implements IConf
{
keys.remove(Util.sanitizeFileName(name));
users.invalidate(Util.sanitizeFileName(name));
users.invalidate(name);
}
public Set<String> getAllUniqueUsers()
@@ -114,10 +128,15 @@ public class UserMap extends CacheLoader<String, User> implements IConf
{
return keys.size();
}
public File getUserFile(final String name)
{
return getUserFile2(Util.sanitizeFileName(name));
}
private File getUserFile2(final String name)
{
final File userFolder = new File(ess.getDataFolder(), "userdata");
return new File(userFolder, Util.sanitizeFileName(name) + ".yml");
return new File(userFolder, name + ".yml");
}
}

View File

@@ -21,11 +21,18 @@ public class Util
{
}
private final static Logger logger = Logger.getLogger("Minecraft");
private final static Pattern INVALIDCHARS = Pattern.compile("[^a-z0-9]");
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]");
public static String sanitizeFileName(final String name)
{
return INVALIDCHARS.matcher(name.toLowerCase(Locale.ENGLISH)).replaceAll("_");
final String newName = INVALIDFILECHARS.matcher(name.toLowerCase(Locale.ENGLISH)).replaceAll("_");
return newName;
}
public static String sanitizeString(final String string)
{
return INVALIDCHARS.matcher(string).replaceAll("");
}
public static String formatDateDiff(long date)
@@ -415,11 +422,11 @@ public class Util
}
return is;
}
private static DecimalFormat df = new DecimalFormat("#0.00", DecimalFormatSymbols.getInstance(Locale.US));
private static DecimalFormat dFormat = new DecimalFormat("#0.00", DecimalFormatSymbols.getInstance(Locale.US));
public static String formatCurrency(final double value, final IEssentials ess)
public static String formatAsCurrency(final double value)
{
String str = ess.getSettings().getCurrencySymbol() + df.format(value);
String str = dFormat.format(value);
if (str.endsWith(".00"))
{
str = str.substring(0, str.length() - 3);
@@ -427,6 +434,16 @@ public class Util
return str;
}
public static String displayCurrency(final double value, final IEssentials ess)
{
return _("currency", ess.getSettings().getCurrencySymbol(), formatAsCurrency(value));
}
public static String shortCurrency(final double value, final IEssentials ess)
{
return ess.getSettings().getCurrencySymbol() + formatAsCurrency(value);
}
public static double roundDouble(final double d)
{
return Math.round(d * 100.0) / 100.0;

View File

@@ -115,6 +115,10 @@ public final class Economy
{
throw new UserDoesNotExistException(name);
}
if (balance < ess.getSettings().getMinMoney())
{
throw new NoLoanPermittedException();
}
if (balance < 0.0 && !user.isAuthorized("essentials.eco.loan"))
{
throw new NoLoanPermittedException();
@@ -245,7 +249,7 @@ public final class Economy
{
throw new RuntimeException(noCallBeforeLoad);
}
return Util.formatCurrency(amount, ess);
return Util.displayCurrency(amount, ess);
}
/**

View File

@@ -17,8 +17,11 @@ public class Commandantioch extends EssentialsCommand
@Override
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
ess.broadcastMessage(user, "...lobbest thou thy Holy Hand Grenade of Antioch towards thy foe,");
ess.broadcastMessage(user, "who being naughty in My sight, shall snuff it.");
if (args.length > 0)
{
ess.broadcastMessage(user, "...lobbest thou thy Holy Hand Grenade of Antioch towards thy foe,");
ess.broadcastMessage(user, "who being naughty in My sight, shall snuff it.");
}
final Location loc = Util.getTarget(user);
loc.getWorld().spawn(loc, TNTPrimed.class);

View File

@@ -20,5 +20,6 @@ public class Commandback extends EssentialsCommand
charge.isAffordableFor(user);
user.sendMessage(_("backUsageMsg"));
user.getTeleport().back(charge);
throw new NoChargeException();
}
}

View File

@@ -21,7 +21,7 @@ public class Commandbalance extends EssentialsCommand
{
throw new NotEnoughArgumentsException();
}
sender.sendMessage(_("balance", Util.formatCurrency(getPlayer(server, args, 0, true).getMoney(), ess)));
sender.sendMessage(_("balance", Util.displayCurrency(getPlayer(server, args, 0, true).getMoney(), ess)));
}
@Override
@@ -32,6 +32,6 @@ public class Commandbalance extends EssentialsCommand
|| user.isAuthorized("essentials.balance.other"))
? user
: getPlayer(server, args, 0, true)).getMoney();
user.sendMessage(_("balance", Util.formatCurrency(bal, ess)));
user.sendMessage(_("balance", Util.displayCurrency(bal, ess)));
}
}

View File

@@ -105,14 +105,18 @@ public class Commandbalancetop extends EssentialsCommand
{
if (force || cacheage <= System.currentTimeMillis() - CACHETIME)
{
cache.getLines().clear();
cache.getLines().clear();
final Map<String, Double> balances = new HashMap<String, Double>();
double totalMoney = 0d;
for (String u : ess.getUserMap().getAllUniqueUsers())
{
final User user = ess.getUserMap().getUser(u);
if (user != null)
{
balances.put(user.getDisplayName(), user.getMoney());
final double userMoney = user.getMoney();
user.updateMoneyCache(userMoney);
totalMoney += userMoney;
balances.put(user.getDisplayName(), userMoney);
}
}
@@ -125,10 +129,12 @@ public class Commandbalancetop extends EssentialsCommand
return -entry1.getValue().compareTo(entry2.getValue());
}
});
cache.getLines().add(_("serverTotal", Util.displayCurrency(totalMoney, ess)));
int pos = 1;
for (Map.Entry<String, Double> entry : sortedEntries)
{
cache.getLines().add(pos + ". " + entry.getKey() + ", " + Util.formatCurrency(entry.getValue(), ess));
cache.getLines().add(pos + ". " + entry.getKey() + ", " + Util.displayCurrency(entry.getValue(), ess));
pos++;
}
cacheage = System.currentTimeMillis();

View File

@@ -1,5 +1,6 @@
package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import java.util.Locale;
import org.bukkit.Server;
@@ -33,7 +34,31 @@ public class Commandeco extends EssentialsCommand
throw new NotEnoughArgumentsException(ex);
}
if (args[1].contentEquals("*"))
if (args[1].contentEquals("**"))
{
for (String sUser : ess.getUserMap().getAllUniqueUsers())
{
final User player = ess.getUser(sUser);
switch (cmd)
{
case GIVE:
player.giveMoney(amount);
break;
case TAKE:
if (player.canAfford(amount, false))
{
player.takeMoney(amount);
}
break;
case RESET:
player.setMoney(amount == 0 ? ess.getSettings().getStartingBalance() : amount);
break;
}
}
}
else if (args[1].contentEquals("*"))
{
for (Player onlinePlayer : server.getOnlinePlayers())
{
@@ -45,6 +70,10 @@ public class Commandeco extends EssentialsCommand
break;
case TAKE:
if (!player.canAfford(amount, false))
{
throw new Exception(_("notEnoughMoney"));
}
player.takeMoney(amount);
break;
@@ -64,6 +93,10 @@ public class Commandeco extends EssentialsCommand
break;
case TAKE:
if (!player.canAfford(amount, false))
{
throw new Exception(_("notEnoughMoney"));
}
player.takeMoney(amount, sender);
break;

View File

@@ -9,6 +9,7 @@ import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.block.Block;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;
@@ -35,6 +36,10 @@ public class Commandessentials extends EssentialsCommand
{
run_nya(server, sender, commandLabel, args);
}
else if (args[0].equalsIgnoreCase("moo"))
{
run_moo(server, sender, commandLabel, args);
}
else {
run_reload(server, sender, commandLabel, args);
}
@@ -112,7 +117,7 @@ public class Commandessentials extends EssentialsCommand
if (loc.getBlock().getTypeId() == 0)
{
noteBlocks.put(player, loc.getBlock());
loc.getBlock().setType(Material.NOTE_BLOCK);
player.sendBlockChange(loc, Material.NOTE_BLOCK, (byte)0);
}
}
taskid = ess.scheduleSyncRepeatingTask(new Runnable()
@@ -144,7 +149,6 @@ public class Commandessentials extends EssentialsCommand
}
}
}, 20, 2);
return;
}
private void stopTune()
@@ -159,4 +163,12 @@ public class Commandessentials extends EssentialsCommand
}
noteBlocks.clear();
}
private void run_moo(final Server server, final CommandSender sender, final String command, final String args[])
{
if(sender instanceof ConsoleCommandSender)
sender.sendMessage(new String[]{" (__)", " (oo)", " /------\\/", " / | ||", " * /\\---/\\", " ~~ ~~", "....\"Have you mooed today?\"..." } );
else
sender.sendMessage(new String[]{" (__)", " (oo)", " /------\\/", " / | | |", " * /\\---/\\", " ~~ ~~", "....\"Have you mooed today?\"..." } );
}
}

View File

@@ -125,7 +125,7 @@ public class Commandkillall extends EssentialsCommand
{
if (entity instanceof Animals || entity instanceof NPC || entity instanceof Snowman || entity instanceof WaterMob)
{
EntityDeathEvent event = new EntityDeathEvent(entity, Collections.EMPTY_LIST);
EntityDeathEvent event = new EntityDeathEvent((LivingEntity)entity, Collections.EMPTY_LIST);
ess.getServer().getPluginManager().callEvent(event);
entity.remove();
numKills++;
@@ -135,7 +135,7 @@ public class Commandkillall extends EssentialsCommand
{
if (entity instanceof Monster || entity instanceof ComplexLivingEntity || entity instanceof Flying || entity instanceof Slime)
{
EntityDeathEvent event = new EntityDeathEvent(entity, Collections.EMPTY_LIST);
EntityDeathEvent event = new EntityDeathEvent((LivingEntity)entity, Collections.EMPTY_LIST);
ess.getServer().getPluginManager().callEvent(event);
entity.remove();
numKills++;
@@ -143,14 +143,14 @@ public class Commandkillall extends EssentialsCommand
}
else if (all)
{
EntityDeathEvent event = new EntityDeathEvent(entity, Collections.EMPTY_LIST);
EntityDeathEvent event = new EntityDeathEvent((LivingEntity)entity, Collections.EMPTY_LIST);
ess.getServer().getPluginManager().callEvent(event);
entity.remove();
numKills++;
}
else if (entityClass != null && entityClass.isAssignableFrom(entity.getClass()))
{
EntityDeathEvent event = new EntityDeathEvent(entity, Collections.EMPTY_LIST);
EntityDeathEvent event = new EntityDeathEvent((LivingEntity)entity, Collections.EMPTY_LIST);
ess.getServer().getPluginManager().callEvent(event);
entity.remove();
numKills++;

View File

@@ -32,22 +32,22 @@ public class Commandkit extends EssentialsCommand
else
{
final String kitName = args[0].toLowerCase(Locale.ENGLISH);
final Object kit = ess.getSettings().getKit(kitName);
final Map<String, Object> kit = ess.getSettings().getKit(kitName);
if (!user.isAuthorized("essentials.kit." + kitName))
{
throw new Exception(_("noKitPermission", "essentials.kit." + kitName));
}
final Map<String, Object> els = (Map<String, Object>)kit;
final List<String> items = Kit.getItems(user, els);
Kit.checkTime(user, kitName, els);
final List<String> items = Kit.getItems(user, kit);
Kit.checkTime(user, kitName, kit);
final Trade charge = new Trade("kit-" + kitName, ess);
charge.isAffordableFor(user);
Kit.expandItems(ess, user, items);
charge.charge(user);
user.sendMessage(_("kitGive", kitName));

View File

@@ -2,6 +2,7 @@ package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.util.*;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
@@ -72,7 +73,7 @@ public class Commandlist extends EssentialsCommand
for (String group : groups)
{
final StringBuilder groupString = new StringBuilder();
groupString.append(group).append(": ");
groupString.append(_("listGroupTag",Util.replaceColor(group)));
final List<User> users = sort.get(group);
Collections.sort(users);
boolean first = true;

View File

@@ -40,7 +40,7 @@ public class Commandmail extends EssentialsCommand
{
if (!user.isAuthorized("essentials.mail.send"))
{
throw new Exception(_("noPerm","essentials.mail.send"));
throw new Exception(_("noPerm", "essentials.mail.send"));
}
Player player = server.getPlayer(args[1]);
@@ -59,7 +59,8 @@ public class Commandmail extends EssentialsCommand
}
if (!u.isIgnoredPlayer(user.getName()))
{
u.addMail(user.getName() + ": " + Util.stripColor(getFinalArg(args, 2)));
final String mail = Util.sanitizeString(Util.stripColor(getFinalArg(args, 2)));
u.addMail(user.getName() + ": " + mail);
}
user.sendMessage(_("mailSent"));
return;
@@ -68,7 +69,7 @@ public class Commandmail extends EssentialsCommand
{
if (!user.isAuthorized("essentials.mail.sendall"))
{
throw new Exception(_("noPerm","essentials.mail.sendall"));
throw new Exception(_("noPerm", "essentials.mail.sendall"));
}
ess.scheduleAsyncDelayedTask(new SendAll(user.getName() + ": " + Util.stripColor(getFinalArg(args, 1))));
user.sendMessage(_("mailSent"));

View File

@@ -1,8 +1,9 @@
package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandping extends EssentialsCommand
@@ -13,8 +14,16 @@ public class Commandping extends EssentialsCommand
}
@Override
public void run(Server server, User player, String commandLabel, String[] args) throws Exception
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
{
player.sendMessage(_("pong"));
if (args.length < 1)
{
sender.sendMessage(_("pong"));
}
else
{
sender.sendMessage(Util.replaceColor(getFinalArg(args, 0)));
}
}
}

View File

@@ -80,7 +80,7 @@ public class Commandrepair extends EssentialsCommand
private void repairItem(final ItemStack item) throws Exception
{
final Material material = Material.getMaterial(item.getTypeId());
if (material.isBlock() || material.getMaxDurability() < 0)
if (material.isBlock() || material.getMaxDurability() < 1)
{
throw new Exception(_("repairInvalidType"));
}

View File

@@ -160,8 +160,8 @@ public class Commandsell extends EssentialsCommand
user.updateInventory();
Trade.log("Command", "Sell", "Item", user.getName(), new Trade(ris, ess), user.getName(), new Trade(worth * amount, ess), user.getLocation(), ess);
user.giveMoney(worth * amount);
user.sendMessage(_("itemSold", Util.formatCurrency(worth * amount, ess), amount, is.getType().toString().toLowerCase(Locale.ENGLISH), Util.formatCurrency(worth, ess)));
logger.log(Level.INFO, _("itemSoldConsole", user.getDisplayName(), is.getType().toString().toLowerCase(Locale.ENGLISH), Util.formatCurrency(worth * amount, ess), amount, Util.formatCurrency(worth, ess)));
user.sendMessage(_("itemSold", Util.displayCurrency(worth * amount, ess), amount, is.getType().toString().toLowerCase(Locale.ENGLISH), Util.displayCurrency(worth, ess)));
logger.log(Level.INFO, _("itemSoldConsole", user.getDisplayName(), is.getType().toString().toLowerCase(Locale.ENGLISH), Util.displayCurrency(worth * amount, ess), amount, Util.displayCurrency(worth, ess)));
}
}

View File

@@ -2,6 +2,7 @@ package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.Mob;
import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.util.Locale;
@@ -9,6 +10,7 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.entity.EntityType;
public class Commandspawner extends EssentialsCommand
@@ -47,11 +49,14 @@ public class Commandspawner extends EssentialsCommand
{
throw new Exception(_("unableToSpawnMob"));
}
if (!user.isAuthorized("essentials.spawner." + mob.name.toLowerCase()))
if (!user.isAuthorized("essentials.spawner." + mob.name.toLowerCase(Locale.ENGLISH)))
{
throw new Exception(_("unableToSpawnMob"));
}
((CreatureSpawner)target.getBlock().getState()).setCreatureType(mob.getType());
final Trade charge = new Trade("spawner-" + mob.name.toLowerCase(Locale.ENGLISH), ess);
charge.isAffordableFor(user);
((CreatureSpawner)target.getBlock().getState()).setSpawnedType(mob.getType());
charge.charge(user);
user.sendMessage(_("setSpawner", mob.name));
}
catch (Throwable ex)

View File

@@ -5,8 +5,7 @@ import com.earth2me.essentials.Mob;
import com.earth2me.essentials.Mob.MobException;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.util.Locale;
import java.util.Random;
import java.util.*;
import org.bukkit.DyeColor;
import org.bukkit.Location;
import org.bukkit.Server;
@@ -26,7 +25,20 @@ public class Commandspawnmob extends EssentialsCommand
{
if (args.length < 1)
{
throw new NotEnoughArgumentsException(_("mobsAvailable", Util.joinList(Mob.getMobList())));
final Set<String> mobList = Mob.getMobList();
final Set<String> availableList = new HashSet<String>();
for (String mob : mobList)
{
if (user.isAuthorized("essentials.spawnmob." + mob.toLowerCase()))
{
availableList.add(mob);
}
}
if (availableList.isEmpty())
{
availableList.add(_("none"));
}
throw new NotEnoughArgumentsException(_("mobsAvailable", Util.joinList(availableList)));
}
@@ -79,7 +91,7 @@ public class Commandspawnmob extends EssentialsCommand
User otherUser = null;
if (args.length >= 3)
{
otherUser = getPlayer(ess.getServer(), args, 2);
otherUser = getPlayer(ess.getServer(), args, 2);
}
final Location loc = (otherUser == null) ? block.getLocation() : otherUser.getLocation();
final Location sloc = Util.getSafeDestination(loc);
@@ -163,7 +175,7 @@ public class Commandspawnmob extends EssentialsCommand
changeMobData(mobMount.getType(), spawnedMount, mountData, user);
}
}
user.sendMessage(args[1] + " " + mob.name.toLowerCase(Locale.ENGLISH) + mob.suffix + " " + _("spawned"));
user.sendMessage(mobCount + " " + mob.name.toLowerCase(Locale.ENGLISH) + mob.suffix + " " + _("spawned"));
}
catch (MobException e1)
{
@@ -184,9 +196,9 @@ public class Commandspawnmob extends EssentialsCommand
}
}
private void changeMobData(final CreatureType type, final Entity spawned, final String data, final User user) throws Exception
private void changeMobData(final EntityType type, final Entity spawned, final String data, final User user) throws Exception
{
if (type == CreatureType.SLIME || type == CreatureType.MAGMA_CUBE)
if (type == EntityType.SLIME || type == EntityType.MAGMA_CUBE)
{
try
{
@@ -197,18 +209,18 @@ public class Commandspawnmob extends EssentialsCommand
throw new Exception(_("slimeMalformedSize"), e);
}
}
if ((type == CreatureType.SHEEP
|| type == CreatureType.COW
|| type == CreatureType.MUSHROOM_COW
|| type == CreatureType.CHICKEN
|| type == CreatureType.PIG
|| type == CreatureType.WOLF)
if ((type == EntityType.SHEEP
|| type == EntityType.COW
|| type == EntityType.MUSHROOM_COW
|| type == EntityType.CHICKEN
|| type == EntityType.PIG
|| type == EntityType.WOLF)
&& data.equalsIgnoreCase("baby"))
{
((Animals)spawned).setAge(-24000);
return;
}
if (type == CreatureType.SHEEP)
if (type == EntityType.SHEEP)
{
if (data.toLowerCase(Locale.ENGLISH).contains("baby"))
{
@@ -233,7 +245,7 @@ public class Commandspawnmob extends EssentialsCommand
throw new Exception(_("sheepMalformedColor"), e);
}
}
if (type == CreatureType.WOLF
if (type == EntityType.WOLF
&& data.toLowerCase(Locale.ENGLISH).startsWith("tamed"))
{
final Wolf wolf = ((Wolf)spawned);
@@ -245,7 +257,7 @@ public class Commandspawnmob extends EssentialsCommand
((Animals)spawned).setAge(-24000);
}
}
if (type == CreatureType.WOLF
if (type == EntityType.WOLF
&& data.toLowerCase(Locale.ENGLISH).startsWith("angry"))
{
((Wolf)spawned).setAngry(true);
@@ -254,7 +266,7 @@ public class Commandspawnmob extends EssentialsCommand
((Animals)spawned).setAge(-24000);
}
}
if (type == CreatureType.CREEPER && data.equalsIgnoreCase("powered"))
if (type == EntityType.CREEPER && data.equalsIgnoreCase("powered"))
{
((Creeper)spawned).setPowered(true);
}

View File

@@ -1,6 +1,7 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.command.PluginCommand;
@@ -30,7 +31,13 @@ public class Commandsudo extends EssentialsCommand
}
//TODO: Translate this.
sender.sendMessage("Running the command as " + user.getDisplayName());
if (user.isAuthorized("essentials.sudo.exempt"))
{
throw new Exception("You cannot sudo this user");
}
//TODO: Translate this.
sender.sendMessage("Forcing " + user.getDisplayName() + " to run: /" + command + " " + getFinalArg(arguments, 0));
final PluginCommand execCommand = ess.getServer().getPluginCommand(command);
if (execCommand != null)

View File

@@ -16,7 +16,7 @@ public class Commandsuicide extends EssentialsCommand
@Override
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
EntityDamageEvent ede = new EntityDamageEvent(user, EntityDamageEvent.DamageCause.SUICIDE, 1000);
EntityDamageEvent ede = new EntityDamageEvent(user.getBase(), EntityDamageEvent.DamageCause.SUICIDE, 1000);
server.getPluginManager().callEvent(ede);
user.damage(1000);
user.setHealth(0);

View File

@@ -22,7 +22,9 @@ public class Commandtpaccept extends EssentialsCommand
final User target = user.getTeleportRequest();
if (target == null
|| target.getBase() instanceof OfflinePlayer
|| (user.isTeleportRequestHere() && !target.isAuthorized("essentials.tpahere")))
|| (user.isTeleportRequestHere() && !target.isAuthorized("essentials.tpahere"))
|| (!user.isTeleportRequestHere() && !target.isAuthorized("essentials.tpa") && !target.isAuthorized("essentials.tpaall"))
)
{
throw new Exception(_("noPendingRequest"));
}

View File

@@ -8,6 +8,7 @@ import com.earth2me.essentials.Warps;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
@@ -44,10 +45,10 @@ public class Commandwarp extends EssentialsCommand
{
throw new Exception(_("playerNotFound"));
}
warpUser(otherUser, args[0]);
warpUser(user, otherUser, args[0]);
throw new NoChargeException();
}
warpUser(user, args[0]);
warpUser(user, user, args[0]);
throw new NoChargeException();
}
}
@@ -65,7 +66,7 @@ public class Commandwarp extends EssentialsCommand
{
throw new Exception(_("playerNotFound"));
}
warpUser(otherUser, args[0]);
otherUser.getTeleport().warp(args[0], null, TeleportCause.COMMAND);
throw new NoChargeException();
}
@@ -112,17 +113,12 @@ public class Commandwarp extends EssentialsCommand
}
}
private void warpUser(final User user, final String name) throws Exception
private void warpUser(final User owner, final User user, final String name) throws Exception
{
final Trade charge = new Trade(this.getName(), ess);
charge.isAffordableFor(user);
if (ess.getSettings().getPerWarpPermission())
final Trade charge = new Trade("warp-" + name.toLowerCase(Locale.ENGLISH).replace('_', '-'), ess);
charge.isAffordableFor(owner);
if (ess.getSettings().getPerWarpPermission() && !owner.isAuthorized("essentials.warp." + name))
{
if (user.isAuthorized("essentials.warp." + name))
{
user.getTeleport().warp(name, charge, TeleportCause.COMMAND);
return;
}
throw new Exception(_("warpUsePermission"));
}
user.getTeleport().warp(name, charge, TeleportCause.COMMAND);

View File

@@ -60,7 +60,7 @@ public class Commandwhois extends EssentialsCommand
sender.sendMessage(_("whoisLocation", user.getLocation().getWorld().getName(), user.getLocation().getBlockX(), user.getLocation().getBlockY(), user.getLocation().getBlockZ()));
if (!ess.getSettings().isEcoDisabled())
{
sender.sendMessage(_("whoisMoney", Util.formatCurrency(user.getMoney(), ess)));
sender.sendMessage(_("whoisMoney", Util.displayCurrency(user.getMoney(), ess)));
}
sender.sendMessage(user.isAfk()
? _("whoisStatusAway")

View File

@@ -51,14 +51,14 @@ public class Commandworth extends EssentialsCommand
? _("worthMeta",
iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""),
iStack.getDurability(),
Util.formatCurrency(worth * amount, ess),
Util.displayCurrency(worth * amount, ess),
amount,
Util.formatCurrency(worth, ess))
Util.displayCurrency(worth, ess))
: _("worth",
iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""),
Util.formatCurrency(worth * amount, ess),
Util.displayCurrency(worth * amount, ess),
amount,
Util.formatCurrency(worth, ess)));
Util.displayCurrency(worth, ess)));
}
@Override
@@ -95,14 +95,14 @@ public class Commandworth extends EssentialsCommand
? _("worthMeta",
iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""),
iStack.getDurability(),
Util.formatCurrency(worth * amount, ess),
Util.displayCurrency(worth * amount, ess),
amount,
Util.formatCurrency(worth, ess))
Util.displayCurrency(worth, ess))
: _("worth",
iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""),
Util.formatCurrency(worth * amount, ess),
Util.displayCurrency(worth * amount, ess),
amount,
Util.formatCurrency(worth, ess)));
Util.displayCurrency(worth, ess)));
}
}

View File

@@ -1,8 +1,13 @@
package com.earth2me.essentials.craftbukkit;
import java.util.HashMap;
import java.util.List;
import java.util.ListIterator;
import org.bukkit.Material;
import org.bukkit.entity.HumanEntity;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
@@ -187,4 +192,34 @@ public class FakeInventory implements Inventory
items[i] = null;
}
}
@Override
public List<HumanEntity> getViewers()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String getTitle()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public InventoryType getType()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public InventoryHolder getHolder()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public ListIterator<ItemStack> iterator()
{
throw new UnsupportedOperationException("Not supported yet.");
}
}

View File

@@ -12,6 +12,7 @@ import org.bukkit.entity.*;
import org.bukkit.generator.BlockPopulator;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.Plugin;
import org.bukkit.util.Vector;
@@ -231,12 +232,6 @@ public class FakeWorld implements World
return name;
}
@Override
public long getId()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Location getSpawnLocation()
{
@@ -554,4 +549,82 @@ public class FakeWorld implements World
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public long getTicksPerAnimalSpawns()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setTicksPerAnimalSpawns(int i)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public long getTicksPerMonsterSpawns()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setTicksPerMonsterSpawns(int i)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public <T extends Entity> Collection<T> getEntitiesByClass(Class<T> type)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Collection<Entity> getEntitiesByClasses(Class<?>... types)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public LivingEntity spawnCreature(Location arg0, EntityType arg1)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public <T> void playEffect(Location lctn, Effect effect, T t)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public <T> void playEffect(Location lctn, Effect effect, T t, int i)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setMetadata(String string, MetadataValue mv)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public List<MetadataValue> getMetadata(String string)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean hasMetadata(String string)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void removeMetadata(String string, Plugin plugin)
{
throw new UnsupportedOperationException("Not supported yet.");
}
}

View File

@@ -1,17 +1,12 @@
package com.earth2me.essentials.craftbukkit;
import com.earth2me.essentials.craftbukkit.FakeInventory;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.Location;
import org.bukkit.entity.Item;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
/*
* This class can be removed when
* https://github.com/Bukkit/CraftBukkit/pull/193
* is accepted to CraftBukkit
* This class can be removed when https://github.com/Bukkit/CraftBukkit/pull/193 is accepted to CraftBukkit
*/
public final class InventoryWorkaround
@@ -47,7 +42,7 @@ public final class InventoryWorkaround
{
return firstPartial(cinventory, item, forceDurability, item.getType().getMaxStackSize());
}
public static int firstPartial(final Inventory cinventory, final ItemStack item, final boolean forceDurability, final int maxAmount)
{
if (item == null)
@@ -93,10 +88,9 @@ public final class InventoryWorkaround
{
final Map<Integer, ItemStack> leftover = new HashMap<Integer, ItemStack>();
/* TODO: some optimization
* - Create a 'firstPartial' with a 'fromIndex'
* - Record the lastPartial per Material
* - Cache firstEmpty result
/*
* TODO: some optimization - Create a 'firstPartial' with a 'fromIndex' - Record the lastPartial per Material -
* Cache firstEmpty result
*/
// combine items
@@ -175,7 +169,7 @@ public final class InventoryWorkaround
final int amount = item.getAmount();
final int partialAmount = partialItem.getAmount();
// Check if it fully fits
if (amount + partialAmount <= maxAmount)
{
@@ -325,25 +319,4 @@ public final class InventoryWorkaround
}
return leftover.isEmpty();
}
public static Item[] dropItem(final Location loc, final ItemStack itm)
{
final int maxStackSize = itm.getType().getMaxStackSize();
final int stacks = itm.getAmount() / maxStackSize;
final int leftover = itm.getAmount() % maxStackSize;
final Item[] itemStacks = new Item[stacks + (leftover > 0 ? 1 : 0)];
for (int i = 0; i < stacks; i++)
{
final ItemStack stack = itm.clone();
stack.setAmount(maxStackSize);
itemStacks[i] = loc.getWorld().dropItem(loc, stack);
}
if (leftover > 0)
{
final ItemStack stack = itm.clone();
stack.setAmount(leftover);
itemStacks[stacks] = loc.getWorld().dropItem(loc, stack);
}
return itemStacks;
}
}

View File

@@ -1,46 +0,0 @@
package com.earth2me.essentials.craftbukkit;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.minecraft.server.EntityPlayer;
import net.minecraft.server.IInventory;
import net.minecraft.server.PlayerInventory;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.craftbukkit.inventory.CraftInventoryPlayer;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class ShowInventory
{
public static void showEmptyInventory(final Player player)
{
try
{
final EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle();
final CraftInventoryPlayer inv = new CraftInventoryPlayer(new PlayerInventory(((CraftPlayer)player).getHandle()));
inv.clear();
entityPlayer.a((IInventory)inv.getInventory());
}
catch (Throwable ex)
{
Logger.getLogger("Minecraft").log(Level.SEVERE, null, ex);
}
}
public static void showFilledInventory(final Player player, final ItemStack stack)
{
try
{
final EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle();
final CraftInventoryPlayer inv = new CraftInventoryPlayer(new PlayerInventory(((CraftPlayer)player).getHandle()));
inv.clear();
InventoryWorkaround.addItem(inv, true, stack);
entityPlayer.a((IInventory)inv.getInventory());
}
catch (Throwable ex)
{
Logger.getLogger("Minecraft").log(Level.SEVERE, null, ex);
}
}
}

View File

@@ -0,0 +1,62 @@
package com.earth2me.essentials.perm;
import de.bananaco.bpermissions.api.ApiLayer;
import de.bananaco.bpermissions.api.World;
import de.bananaco.bpermissions.api.WorldManager;
import de.bananaco.bpermissions.api.util.Calculable;
import de.bananaco.bpermissions.api.util.CalculableType;
import java.util.Arrays;
import java.util.List;
import org.bukkit.entity.Player;
public class BPermissions2Handler extends SuperpermsHandler
{
public BPermissions2Handler()
{
}
@Override
public String getGroup(final Player base)
{
final List<String> groups = getGroups(base);
if (groups == null || groups.isEmpty())
{
return null;
}
return groups.get(0);
}
@Override
public List<String> getGroups(final Player base)
{
final String[] groups = ApiLayer.getGroups(base.getWorld().getName(), CalculableType.USER, base.getName());
return Arrays.asList(groups);
}
@Override
public boolean inGroup(final Player base, final String group)
{
return ApiLayer.hasGroup(base.getWorld().getName(), CalculableType.USER, base.getName(), group);
}
@Override
public boolean canBuild(final Player base, final String group)
{
return hasPermission(base, "essentials.build") || hasPermission(base, "bPermissions.build");
}
@Override
public String getPrefix(final Player base)
{
return ApiLayer.getValue(base.getWorld().getName(), CalculableType.USER, base.getName(), "prefix");
}
@Override
public String getSuffix(final Player base)
{
return ApiLayer.getValue(base.getWorld().getName(), CalculableType.USER, base.getName(), "suffix");
}
}

View File

@@ -1,5 +1,6 @@
package com.earth2me.essentials.perm;
import com.earth2me.essentials.Util;
import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
@@ -111,17 +112,6 @@ public class PermissionsHandler implements IPermissionsHandler
return;
}
final Plugin bPermPlugin = pluginManager.getPlugin("bPermissions");
if (bPermPlugin != null && bPermPlugin.isEnabled())
{
if (!(handler instanceof BPermissionsHandler))
{
LOGGER.log(Level.INFO, "Essentials: Using bPermissions based permissions.");
handler = new BPermissionsHandler();
}
return;
}
final Plugin GMplugin = pluginManager.getPlugin("GroupManager");
if (GMplugin != null && GMplugin.isEnabled())
{
@@ -144,6 +134,38 @@ public class PermissionsHandler implements IPermissionsHandler
return;
}
final Plugin privPlugin = pluginManager.getPlugin("Privileges");
if (privPlugin != null && privPlugin.isEnabled())
{
if (!(handler instanceof PrivilegesHandler))
{
LOGGER.log(Level.INFO, "Essentials: Using Privileges based permissions.");
handler = new PrivilegesHandler(privPlugin);
}
return;
}
final Plugin bPermPlugin = pluginManager.getPlugin("bPermissions");
if (bPermPlugin != null && bPermPlugin.isEnabled())
{
final String bVer = bPermPlugin.getDescription().getVersion().replace(".", "");
if (Util.isInt(bVer) && Integer.parseInt(bVer) < 284)
{
if (!(handler instanceof BPermissionsHandler))
{
LOGGER.log(Level.INFO, "Essentials: Using bPermissions based permissions.");
handler = new BPermissionsHandler();
}
return;
}
if (!(handler instanceof BPermissions2Handler))
{
LOGGER.log(Level.INFO, "Essentials: Using bPermissions2 based permissions.");
handler = new BPermissions2Handler();
}
return;
}
final Plugin permPlugin = pluginManager.getPlugin("Permissions");
if (permPlugin != null && permPlugin.isEnabled())
{

View File

@@ -0,0 +1,61 @@
package com.earth2me.essentials.perm;
import java.util.ArrayList;
import java.util.List;
import net.krinsoft.privileges.Privileges;
import net.krinsoft.privileges.groups.Group;
import net.krinsoft.privileges.groups.GroupManager;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
public class PrivilegesHandler extends SuperpermsHandler
{
private final transient Privileges plugin;
private final GroupManager manager;
public PrivilegesHandler(final Plugin plugin)
{
this.plugin = (Privileges) plugin;
this.manager = this.plugin.getGroupManager();
}
@Override
public String getGroup(final Player base)
{
Group group = manager.getGroup(base);
if (group == null)
{
return null;
}
return group.getName();
}
@Override
public List<String> getGroups(final Player base)
{
Group group = manager.getGroup(base);
if (group == null)
{
return new ArrayList<String>();
}
return group.getGroupTree();
}
@Override
public boolean inGroup(final Player base, final String group)
{
Group pGroup = manager.getGroup(base);
if (pGroup == null)
{
return false;
}
return pGroup.isMemberOf(group);
}
@Override
public boolean canBuild(Player base, String group)
{
return base.hasPermission("essentials.build") || base.hasPermission("privileges.build");
}
}

View File

@@ -27,7 +27,7 @@ public class SuperpermsHandler implements IPermissionsHandler
@Override
public boolean inGroup(final Player base, final String group)
{
return false;
return hasPermission(base, "group." + group);
}
@Override

View File

@@ -266,7 +266,7 @@ public class EssentialsSign
final Double money = trade.getMoney();
if (money != null)
{
sign.setLine(index, Util.formatCurrency(money, ess));
sign.setLine(index, Util.shortCurrency(money, ess));
}
}

View File

@@ -2,7 +2,6 @@ package com.earth2me.essentials.signs;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
import com.earth2me.essentials.craftbukkit.ShowInventory;
public class SignDisposal extends EssentialsSign
@@ -15,7 +14,10 @@ public class SignDisposal extends EssentialsSign
@Override
protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess)
{
ShowInventory.showEmptyInventory(player.getBase());
player.sendMessage("Bukkit broke this sign :(");
//TODO: wait for a fix in bukkit
//Problem: Items can be duplicated
//player.getBase().openInventory(ess.getServer().createInventory(player, 36));
return true;
}
}

View File

@@ -6,7 +6,7 @@ import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EndermanPickupEvent;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
@@ -44,7 +44,7 @@ public class SignEntityListener implements Listener
}
@EventHandler(priority = EventPriority.LOW)
public void onEndermanPickup(final EndermanPickupEvent event)
public void onEntityChangeBlock(final EntityChangeBlockEvent event)
{
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
{

View File

@@ -4,8 +4,10 @@ import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
import com.earth2me.essentials.craftbukkit.ShowInventory;
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
import org.bukkit.Material;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
@@ -32,8 +34,15 @@ public class SignFree extends EssentialsSign
throw new SignException(_("cantSpawnItem", "Air"));
}
item.setAmount(item.getType().getMaxStackSize() * 9 * 4);
ShowInventory.showFilledInventory(player.getBase(), item);
item.setAmount(item.getType().getMaxStackSize());
InventoryWorkaround.addItem(player.getInventory(), true, item);
player.sendMessage("Item added to your inventory.");
player.updateInventory();
//TODO: wait for a fix in bukkit
//Problem: Items can be duplicated
//Inventory i = ess.getServer().createInventory(player, InventoryType.CHEST);
//i.addItem(item);
//player.openInventory(i);
Trade.log("Sign", "Free", "Interact", username, null, username, new Trade(item, ess), sign.getBlock().getLocation(), ess);
return true;
}

View File

@@ -17,7 +17,7 @@ public class SignKit extends EssentialsSign
protected boolean onSignCreate(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException
{
validateTrade(sign, 3, ess);
final String kitName = sign.getLine(1).toLowerCase(Locale.ENGLISH);
if (kitName.isEmpty())
@@ -56,10 +56,9 @@ public class SignKit extends EssentialsSign
charge.isAffordableFor(player);
try
{
final Object kit = ess.getSettings().getKit(kitName);
final Map<String, Object> els = (Map<String, Object>)kit;
final List<String> items = Kit.getItems(player, els);
Kit.expandItems(ess, player, items);
final Map<String, Object> kit = ess.getSettings().getKit(kitName);
final List<String> items = Kit.getItems(player, kit);
Kit.expandItems(ess, player, items);
charge.charge(player);
}
catch (Exception ex)

View File

@@ -129,7 +129,7 @@ public class SignProtection extends EssentialsSign
if (block.getType() == Material.SIGN_POST || block.getType() == Material.WALL_SIGN)
{
final BlockSign sign = new BlockSign(block);
if (sign.getLine(0).equalsIgnoreCase(this.getSuccessName()))
if (sign.getLine(0).equals(this.getSuccessName()))
{
return checkProtectionSign(sign, user, username);
}

View File

@@ -36,7 +36,7 @@ public class SignTrade extends EssentialsSign
try
{
stored = getTrade(sign, 1, true, true, ess);
substractAmount(sign, 1, stored, ess);
subtractAmount(sign, 1, stored, ess);
stored.pay(player);
}
catch (SignException e)
@@ -53,12 +53,14 @@ public class SignTrade extends EssentialsSign
final Trade charge = getTrade(sign, 1, false, false, ess);
final Trade trade = getTrade(sign, 2, false, true, ess);
charge.isAffordableFor(player);
addAmount(sign, 1, charge, ess);
subtractAmount(sign, 2, trade, ess);
if (!trade.pay(player, false))
{
subtractAmount(sign, 1, charge, ess);
addAmount(sign, 2, trade, ess);
throw new ChargeException("Full inventory");
}
substractAmount(sign, 2, trade, ess);
addAmount(sign, 1, charge, ess);
charge.charge(player);
Trade.log("Sign", "Trade", "Interact", sign.getLine(3), charge, username, trade, sign.getBlock().getLocation(), ess);
}
@@ -133,11 +135,11 @@ public class SignTrade extends EssentialsSign
final Double money = getMoney(split[0]);
if (money != null)
{
if (Util.formatCurrency(money, ess).length() * 2 > 15)
if (Util.shortCurrency(money, ess).length() * 2 > 15)
{
throw new SignException("Line can be too long!");
}
sign.setLine(index, Util.formatCurrency(money, ess) + ":0");
sign.setLine(index, Util.shortCurrency(money, ess) + ":0");
return;
}
}
@@ -153,7 +155,7 @@ public class SignTrade extends EssentialsSign
{
throw new SignException(_("moreThanZero"));
}
sign.setLine(index, Util.formatCurrency(money, ess) + ":" + Util.formatCurrency(amount, ess).substring(1));
sign.setLine(index, Util.shortCurrency(money, ess) + ":" + Util.shortCurrency(amount, ess).substring(1));
return;
}
}
@@ -256,7 +258,7 @@ public class SignTrade extends EssentialsSign
throw new SignException(_("invalidSignLine", index + 1));
}
protected final void substractAmount(final ISign sign, final int index, final Trade trade, final IEssentials ess) throws SignException
protected final void subtractAmount(final ISign sign, final int index, final Trade trade, final IEssentials ess) throws SignException
{
final Double money = trade.getMoney();
if (money != null)
@@ -294,6 +296,7 @@ public class SignTrade extends EssentialsSign
}
}
//TODO: Translate these exceptions.
private void changeAmount(final ISign sign, final int index, final double value, final IEssentials ess) throws SignException
{
@@ -310,10 +313,10 @@ public class SignTrade extends EssentialsSign
final Double amount = getDouble(split[1]);
if (money != null && amount != null)
{
final String newline = Util.formatCurrency(money, ess) + ":" + Util.formatCurrency(amount + value, ess).substring(1);
final String newline = Util.shortCurrency(money, ess) + ":" + Util.shortCurrency(amount + value, ess).substring(1);
if (newline.length() > 15)
{
throw new SignException("Line too long!");
throw new SignException("This sign is full: Line too long!");
}
sign.setLine(index, newline);
return;
@@ -329,7 +332,7 @@ public class SignTrade extends EssentialsSign
final String newline = stackamount + " " + split[1] + ":" + (amount + Math.round(value));
if (newline.length() > 15)
{
throw new SignException("Line too long!");
throw new SignException("This sign is full: Line too long!");
}
sign.setLine(index, newline);
return;
@@ -343,7 +346,7 @@ public class SignTrade extends EssentialsSign
final String newline = stackamount + " " + split[1] + ":" + (amount + Math.round(value));
if (newline.length() > 15)
{
throw new SignException("Line too long!");
throw new SignException("This sign is full: Line too long!");
}
sign.setLine(index, newline);
return;

View File

@@ -30,9 +30,9 @@ public class HelpInput implements IText
try
{
final PluginDescriptionFile desc = p.getDescription();
final HashMap<String, HashMap<String, Object>> cmds = (HashMap<String, HashMap<String, Object>>)desc.getCommands();
final Map<String, Map<String, Object>> cmds = desc.getCommands();
pluginName = p.getDescription().getName().toLowerCase(Locale.ENGLISH);
for (Map.Entry<String, HashMap<String, Object>> k : cmds.entrySet())
for (Map.Entry<String, Map<String, Object>> k : cmds.entrySet())
{
try
{
@@ -57,7 +57,7 @@ public class HelpInput implements IText
{
if (ess.getSettings().showNonEssCommandsInHelp())
{
final HashMap<String, Object> value = k.getValue();
final Map<String, Object> value = k.getValue();
Object permissions = null;
if (value.containsKey(PERMISSION))
{

View File

@@ -33,12 +33,14 @@ public class KeywordReplacer implements IText
String displayName, ipAddress, balance, mails, world;
String worlds, online, unique, playerlist, date, time;
String worldTime12, worldTime24, worldDate, plugins;
String version;
String userName, address, version;
if (sender instanceof Player)
{
final User user = ess.getUser(sender);
displayName = user.getDisplayName();
userName = user.getName();
ipAddress = user.getAddress().getAddress().toString();
address = user.getAddress().toString();
balance = Double.toString(user.getMoney());
mails = Integer.toString(user.getMails().size());
world = user.getLocation().getWorld().getName();
@@ -107,8 +109,12 @@ public class KeywordReplacer implements IText
for (int i = 0; i < input.getLines().size(); i++)
{
String line = input.getLines().get(i);
line = line.replace("{PLAYER}", displayName);
line = line.replace("{DISPLAYNAME}", displayName);
line = line.replace("{USERNAME}", displayName);
line = line.replace("{IP}", ipAddress);
line = line.replace("{ADDRESS}", ipAddress);
line = line.replace("{BALANCE}", balance);
line = line.replace("{MAILS}", mails);
line = line.replace("{WORLD}", world);

View File

@@ -0,0 +1,35 @@
package com.earth2me.essentials.textreader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
public class SimpleTextInput implements IText
{
private final transient List<String> lines = new ArrayList<String>();
public SimpleTextInput (final String input) {
lines.add(input);
}
@Override
public List<String> getLines()
{
return lines;
}
@Override
public List<String> getChapters()
{
return Collections.emptyList();
}
@Override
public Map<String, Integer> getBookmarks()
{
return Collections.emptyMap();
}
}

View File

@@ -0,0 +1,31 @@
package com.earth2me.essentials.textreader;
import org.bukkit.command.CommandSender;
public class SimpleTextPager
{
private final transient IText text;
public SimpleTextPager(final IText text)
{
this.text = text;
}
public void showPage(final CommandSender sender)
{
for (String line : text.getLines())
{
sender.sendMessage(line);
}
}
public String getString(int line)
{
if (text.getLines().size() < line)
{
return null;
}
return text.getLines().get(line);
}
}

View File

@@ -196,4 +196,15 @@ public class User extends UserBase implements IUser
unlock();
}
}
@Override
public boolean canAfford(final double cost)
{
final double mon = getMoney();
if (isAuthorized("essentials.eco.loan"))
{
return (mon - cost) >= ess.getSettings().getMinMoney();
}
return cost <= mon;
}
}

View File

@@ -18,8 +18,6 @@
# - CraftBukkit and Permissions have been updated: CraftBukkit and Essentials almost always line up, but sometimes other plugins fall behind CraftBukkit's multiple daily updates
# - You have saved the document as UTF-8, NOT the default, ANSI
############################################################
# +------------------------------------------------------+ #
# | Essentials (Global) | #
@@ -160,12 +158,19 @@ player-commands:
# All kit names should be lower case, and will be treated as lower in permissions/costs.
# Times are measured in seconds.
kits:
tools:
dtools:
delay: 10
items:
- 277 1
- 278 1
- 279 1
tools:
delay: 10
items:
- 272 1
- 273 1
- 274 1
- 275 1
# Essentials Sign Control
# See http://ess.khhq.net/wiki/Sign_Tutorial for instructions on how to use these.
@@ -281,18 +286,18 @@ spawn-if-no-home: true
update-bed-at-daytime: true
# Allow players to have multiple homes.
# Players need essentials.sethome.multiple before they can have more than 1 home, default to 'default' below.
# Define different amounts of multiple homes for different permissions, e.g. essentials.sethome.multiple.vip
# People with essentials.sethome.multiple.unlimited are not limited by these numbers.
sethome-multiple:
# essentials.sethome.multiple
default: 3
# essentials.sethome.multiple.vip
vip: 5
# essentials.sethome.multiple.staff
staff: 10
#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
tpa-accept-cancellation: 0
############################################################
@@ -313,7 +318,7 @@ command-costs:
#example: 1000
# /kit tools costs $1500 PER USE
#kit-tools: 1500
# Set this to a currency symbol you want to use.
currency-symbol: '$'
@@ -321,6 +326,10 @@ currency-symbol: '$'
# The amount is always limited to 10 trillions because of the limitations of a java double
max-money: 10000000000000
# Set the minimum amount of money a player can have
# Setting this to 0, will disable overdrafts/loans compeltely. Users need 'essentials.eco.loan' perm to go below 0.
min-money: -10000000000000
# Enable this to log all interactions with trade/buy/sell signs and sell command
economy-log-enabled: false
@@ -335,7 +344,7 @@ non-ess-in-help: true
# Hide plugins which dont give a permission
# You can override a true value here for a single plugin by adding a permission to a user/group.
# The indervidual permission is: essentials.help.<plugin>, anyone with essentials.* or '*' will see all help this setting reguardless.
# The individual permission is: essentials.help.<plugin>, anyone with essentials.* or '*' will see all help this setting reguardless.
# You can use negitive permissions to remove access to just a single plugins help if the following is enabled.
hide-permissionless-help: true
@@ -346,30 +355,28 @@ hide-permissionless-help: true
############################################################
chat:
# 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."
radius: 0
# Chat formatting can be done in two ways, you can either define a standard format for all chat
# Or you can give a group specific chat format, to give some extra variation.
# If set to the default chat format which "should" be compatible with ichat.
# For more information of chat formatting, check out the wiki: http://ess.khhq.net/wiki/Chat_Formatting
format: '<{DISPLAYNAME}> {MESSAGE}'
#format: '&7[{GROUP}]&f {DISPLAYNAME}&7:&f {MESSAGE}'
group-formats:
# Default: '{WORLDNAME} {DISPLAYNAME}&7:&f {MESSAGE}'
# Admins: '{WORLDNAME} &c[{GROUP}]&f {DISPLAYNAME}&7:&c {MESSAGE}'
# If your using group formats make sure to remove the '#' to allow the setting to be read.
############################################################
# +------------------------------------------------------+ #
# | EssentialsProtect | #
@@ -400,13 +407,13 @@ protect:
# Which blocks should people be prevented from placing
placement: 10,11,46,327
# Which items should people be prevented from using
usage: 327
# Which blocks should people be prevented from breaking
break:
# Which blocks should not be pushed by pistons
piston:
@@ -460,12 +467,12 @@ protect:
mushroom_cow: false
magma_cube: false
snowman: false
# 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.
creeper:
max-height: -1
# Protect various blocks.
protect:
# Protect all signs
@@ -481,7 +488,7 @@ protect:
# Prevent placing blocks above protected rails, this is to stop a potential griefing
prevent-block-on-rails: false
# Store blocks / signs in memory before writing
memstore: false
@@ -510,22 +517,21 @@ protect:
# Burn, baby, burn! Should fire damage be disabled?
firedmg: false
# Should the damage after hit by a lightning be disabled?
lightning: false
# Should people with build: false in permissions be allowed to build
# Set true to disable building for those people
build: true
# Should people with build: false in permissions be allowed to use items
# Set true to disable useing for those people
# Set true to disable using for those people
use: true
# Should we tell people they are not allowed to build
warn-on-build-disallow: true
# Disable weather options
weather:
storm: false
@@ -544,10 +550,15 @@ newbies:
# If not, set to ''
#announce-format: ''
announce-format: '&dWelcome {DISPLAYNAME}&d to the server!'
# 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.
spawnpoint: newbies
# Do we want to give users anything on first join? Set to '' to disable
# This kit will be given reguardless of cost, and permissions.
#kit: ''
kit: tools
# Set this to lowest, if you want Multiverse to handle the respawning
# Set this to high, if you want EssentialsSpawn to handle the respawning

View File

@@ -7,6 +7,10 @@ Name it info_username.txt or info_groupname.txt
This also works with motd and rules.
Extra pages:
Type /info Colours
Type /info Tags
It can contain chapters like the Chapter1 below:
#Chapter1
@@ -25,7 +29,9 @@ Minecraft colors:
#Tags
PLAYER: {PLAYER}
USERNAME: {PLAYER}
IP: {IP}
ADDRESS: {ADDRESS}
BALANCE: {BALANCE}
MAILS: {MAILS}
WORLD: {WORLD}
@@ -39,3 +45,4 @@ WORLDTIME12: {WORLDTIME12}
WORLDTIME24: {WORLDTIME24}
WORLDDATE: {WORLDDATE}
PLUGINS: {PLUGINS}
VERSION: {VERSION}

View File

@@ -4,7 +4,7 @@
# by:
action=* {0} {1}
addedToAccount=\u00a7a{0} has been added to your account.
addedToOthersAccount=\u00a7a{0} has been added to {1} account.
addedToOthersAccount=\u00a7a{0} added to {1}\u00a7a account. New balance: {2}
alertBroke=broke:
alertFormat=\u00a73[{0}] \u00a7f {1} \u00a76 {2} at: {3}
alertPlaced=placed:
@@ -49,6 +49,7 @@ couldNotFindTemplate=Could not find template {0}
creatingConfigFromTemplate=Creating config from template: {0}
creatingEmptyConfig=Creating empty config: {0}
creative=creative
currency={0}{1}
day=day
days=days
defaultBanReason=The Ban Hammer has spoken!
@@ -169,6 +170,7 @@ lightningUse=\u00a77Smiting {0}
listAfkTag = \u00a77[AFK]\u00a7f
listAmount = \u00a79There are \u00a7c{0}\u00a79 out of maximum \u00a7c{1}\u00a79 players online.
listAmountHidden = \u00a79There are \u00a7c{0}\u00a77/{1}\u00a79 out of maximum \u00a7c{2}\u00a79 players online.
listGroupTag={0}\u00a7f:
listHiddenTag = \u00a77[HIDDEN]\u00a7f
loadWarpError=Failed to load warp {0}
localFormat=Local: <{0}> {1}
@@ -294,13 +296,14 @@ requestDenied=\u00a77Teleport request denied.
requestDeniedFrom=\u00a77{0} denied your teleport request.
requestSent=\u00a77Request sent to {0}\u00a77.
requestTimedOut=\u00a7cTeleport request has timed out
requiredBukkit= * ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org.
returnPlayerToJailError=Error occurred when trying to return player to jail.
requiredBukkit= * ! * You need atleast build {0} of CraftBukkit, download it from http://dl.bukkit.org/downloads/craftbukkit/
returnPlayerToJailError=Error occurred when trying to return player {0} to jail: {1}
second=second
seconds=seconds
seenOffline=Player {0} is offline since {1}
seenOnline=Player {0} is online since {1}
serverFull=Server is full
serverTotal=Server Total: {0}
setSpawner=Changed spawner type to {0}
sheepMalformedColor=Malformed color.
shoutFormat=\u00a77[Shout]\u00a7f {0}
@@ -317,7 +320,7 @@ suicideMessage=\u00a77Goodbye Cruel World...
suicideSuccess= \u00a77{0} took their own life
survival=survival
takenFromAccount=\u00a7c{0} has been taken from your account.
takenFromOthersAccount=\u00a7c{0} has been taken from {1} account.
takenFromOthersAccount=\u00a7c{0} taken from {1}\u00a7c account. New balance: {2}
teleportAAll=\u00a77Teleporting request sent to all players...
teleportAll=\u00a77Teleporting all players...
teleportAtoB=\u00a77{0}\u00a77 teleported you to {1}\u00a77.

View File

@@ -4,7 +4,7 @@
# by: Dysp, dysperen@gmail.com
action=* {0} {1}
addedToAccount=\u00a7a{0} er blevet tilf\u00f8jet til din konto.
addedToOthersAccount=\u00a7a{0} er blevet tilf\u00f8jet til {1} konto.
addedToOthersAccount=\u00a7a{0} added to {1}\u00a7a account. New balance: {2}
alertBroke=\u00f8delagde:
alertFormat=\u00a73[{0}] \u00a7f {1} \u00a76 {2} ved: {3}
alertPlaced=placerede:
@@ -15,7 +15,7 @@ backUsageMsg=\u00a77Teleporterer til tidligere placering.
backupFinished=Backup sluttet
backupStarted=Backup startet
balance=\u00a77Saldo: {0}
balanceTop=\u00a77 Top saldoer ({0})
balanceTop=\u00a77Top saldoer ({0})
banExempt=\u00a7cDu kan ikke banne den p\u00e5g\u00e6ldende spiller.
banIpAddress=\u00a77Bannede IP addresse
bannedIpsFileError=Fejl i afl\u00e6sning af banned-ips.txt
@@ -49,6 +49,7 @@ couldNotFindTemplate=Kunne ikke finde skabelon {0}
creatingConfigFromTemplate=Opretter config fra skabelon: {0}
creatingEmptyConfig=Opretter tom config: {0}
creative=creative
currency={0}{1}
day=dag
days=dage
defaultBanReason=Banhammeren har talt!
@@ -169,6 +170,7 @@ lightningUse=\u00a77Kaster lyn efter {0}
listAfkTag = \u00a77[AFK]\u00a7f
listAmount = \u00a79Der er \u00a7c{0}\u00a79 ud af maksimum\u00a7c{1}\u00a79 spillere online.
listAmountHidden = \u00a79Der er \u00a7c{0}\u00a77/{1}\u00a79 ud af maksimum \u00a7c{2}\u00a79 spillere online.
listGroupTag={0}\u00a7f:
listHiddenTag = \u00a77[HIDDEN]\u00a7f
loadWarpError=Kunne ikke l\u00c3\u00a6se warp {0}
localFormat=Local: <{0}> {1}
@@ -295,12 +297,13 @@ requestDeniedFrom=\u00a77{0} afviste din anmodning om teleport.
requestSent=\u00a77Anmodning sendt til {0}\u00a77.
requestTimedOut=\u00a7cTeleport request has timed out
requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org.
returnPlayerToJailError=En fejl opstod ved fors\u00f8g p\u00e5 at returnere spilleren til f\u00e6ngsel.
returnPlayerToJailError=Error occurred when trying to return player {0} to jail: {1}
second=sekund
seconds=sekunder
seenOffline=Spilleren {0} har v\u00c3\u00a6ret offline i {1}
seenOnline=Spilleren {0} har v\u00c3\u00a6ret online i {1}
serverFull=Serveren er sgu fuld. Den b\u00c3\u00b8r melde sig til AA.
serverTotal=Server Total: {0}
setSpawner=\u00c3\u0086ndrede spawner type til {0}
sheepMalformedColor=Forkert farve. (Korrekt oversat?)
shoutFormat=\u00a77[Shout]\u00a7f {0}
@@ -317,7 +320,7 @@ suicideMessage=\u00a77Farvel grusomme verden...
suicideSuccess= \u00a77{0} tog sit eget liv
survival=survival
takenFromAccount=\u00a7c{0} er blevet taget fra din konto.
takenFromOthersAccount=\u00a7c{0} er blevet taget fra {1}''s konto.
takenFromOthersAccount=\u00a7c{0} taken from {1}\u00a7c account. New balance: {2}
teleportAAll=\u00a77Anmodning om teleport er sendt til alle spillere.
teleportAll=\u00a77Teleporterer alle spillere...
teleportAtoB=\u00a77{0}\u00a77 teleporterede dig til {1}\u00a77.

View File

@@ -4,7 +4,7 @@
# by:
action=* {0} {1}
addedToAccount=\u00a7a{0} wurden zu deiner Geldb\u00f6rse hinzugef\u00fcgt.
addedToOthersAccount=\u00a7a{0} wurden zu {1}s Konto hinzugef\u00fcgt.
addedToOthersAccount=\u00a7a{0} added to {1}\u00a7a account. New balance: {2}
alertBroke=zerst\u00f6rt:
alertFormat=\u00a73[{0}] \u00a7f {1} \u00a76 {2} bei: {3}
alertPlaced=platziert:
@@ -15,7 +15,7 @@ backUsageMsg=\u00a77Kehre zur letzten Position zur\u00fcck.
backupFinished=Backup beendet
backupStarted=Backup gestartet
balance=\u00a77Geldb\u00f6rse: {0}
balanceTop=\u00a77 Top Guthaben ({0})
balanceTop=\u00a77Top Guthaben ({0})
banExempt=\u00a7cDu kannst diesen Spieler nicht sperren.
banIpAddress=\u00a77IP-Adresse gesperrt.
bannedIpsFileError=Fehler beim Lesen von banned-ips.txt
@@ -49,6 +49,7 @@ couldNotFindTemplate=Vorlage {0} konnte nicht gefunden werden.
creatingConfigFromTemplate=Erstelle Konfiguration aus Vorlage: {0}
creatingEmptyConfig=Erstelle leere Konfiguration: {0}
creative=creative
currency={0}{1}
day=Tag
days=Tage
defaultBanReason=Der Bann-Hammer hat gesprochen!
@@ -169,6 +170,7 @@ lightningUse=\u00a77Peinige {0}
listAfkTag = \u00a77[Inaktiv]\u00a7f
listAmount = \u00a79Es sind \u00a7c{0}\u00a79 von maximal \u00a7c{1}\u00a79 Spielern online.
listAmountHidden = \u00a79Es sind \u00a7c{0}\u00a77/{1}\u00a79 von maximal \u00a7c{2}\u00a79 Spielern online.
listGroupTag={0}\u00a7f:
listHiddenTag = \u00a77[Versteckt]\u00a7f
loadWarpError=Fehler beim Laden von Warp-Punkt {0}
localFormat=Lokal: <{0}> {1}
@@ -295,12 +297,13 @@ requestDeniedFrom=\u00a77{0} hat deine Teleportierungsanfrage abgelehnt.
requestSent=\u00a77Anfrage gesendet an {0}\u00a77.
requestTimedOut=\u00a7cTeleport request has timed out
requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org.
returnPlayerToJailError=Fehler beim Versuch, den Spieler ins Gef\u00e4ngnis zu teleportieren.
returnPlayerToJailError=Error occurred when trying to return player {0} to jail: {1}
second=Sekunde
seconds=Sekunden
seenOffline=Spieler {0} ist offline seit {1}
seenOnline=Spieler {0} ist online seit {1}
serverFull=Server ist voll
serverTotal=Server Total: {0}
setSpawner=\u00c4ndere Mob-Spawner zu {0}
sheepMalformedColor=Ung\u00fcltige Farbe.
shoutFormat=\u00a77[Schrei]\u00a7f {0}
@@ -317,7 +320,7 @@ suicideMessage=\u00a77Lebewohl grausame Welt...
suicideSuccess= \u00a77{0} hat sich das Leben genommen.
survival=survival
takenFromAccount=\u00a7c{0} wurden aus deiner Geldb\u00f6rse genommen.
takenFromOthersAccount=\u00a7c{0} wurde von {1} wurde Rechnung getragen.
takenFromOthersAccount=\u00a7c{0} taken from {1}\u00a7c account. New balance: {2}
teleportAAll=\u00a77Teleportierungsanfrage zu allen Spielern gesendet...
teleportAll=\u00a77Teleportiere alle Spieler...
teleportAtoB=\u00a77{0}\u00a77 teleportiert dich zu {1}\u00a77.

View File

@@ -4,7 +4,7 @@
# by:
action=* {0} {1}
addedToAccount=\u00a7a{0} has been added to your account.
addedToOthersAccount=\u00a7a{0} has been added to {1} account.
addedToOthersAccount=\u00a7a{0} added to {1}\u00a7a account. New balance: {2}
alertBroke=broke:
alertFormat=\u00a73[{0}] \u00a7f {1} \u00a76 {2} at: {3}
alertPlaced=placed:
@@ -15,7 +15,7 @@ backUsageMsg=\u00a77Returning to previous location.
backupFinished=Backup finished
backupStarted=Backup started
balance=\u00a77Balance: {0}
balanceTop=\u00a77 Top balances ({0})
balanceTop=\u00a77Top balances ({0})
banExempt=\u00a7cYou can not ban that player.
banIpAddress=\u00a77Banned IP address
bannedIpsFileError=Error reading banned-ips.txt
@@ -49,6 +49,7 @@ couldNotFindTemplate=Could not find template {0}
creatingConfigFromTemplate=Creating config from template: {0}
creatingEmptyConfig=Creating empty config: {0}
creative=creative
currency={0}{1}
day=day
days=days
defaultBanReason=The Ban Hammer has spoken!
@@ -169,6 +170,7 @@ lightningUse=\u00a77Smiting {0}
listAfkTag = \u00a77[AFK]\u00a7f
listAmount = \u00a79There are \u00a7c{0}\u00a79 out of maximum \u00a7c{1}\u00a79 players online.
listAmountHidden = \u00a79There are \u00a7c{0}\u00a77/{1}\u00a79 out of maximum \u00a7c{2}\u00a79 players online.
listGroupTag={0}\u00a7f:
listHiddenTag = \u00a77[HIDDEN]\u00a7f
loadWarpError=Failed to load warp {0}
localFormat=Local: <{0}> {1}
@@ -295,12 +297,13 @@ requestDeniedFrom=\u00a77{0} denied your teleport request
requestSent=\u00a77Request sent to {0}\u00a77.
requestTimedOut=\u00a7cTeleport request has timed out
requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org.
returnPlayerToJailError=Error occurred when trying to return player to jail.
returnPlayerToJailError=Error occurred when trying to return player {0} to jail: {1}
second=second
seconds=seconds
seenOffline=Player {0} is offline since {1}
seenOnline=Player {0} is online since {1}
serverFull=Server is full
serverTotal=Server Total: {0}
setSpawner=Changed spawner type to {0}
sheepMalformedColor=Malformed color.
shoutFormat=\u00a77[Shout]\u00a7f {0}
@@ -317,7 +320,7 @@ suicideMessage=\u00a77Goodbye Cruel World...
suicideSuccess= \u00a77{0} took their own life
survival=survival
takenFromAccount=\u00a7c{0} has been taken from your account.
takenFromOthersAccount=\u00a7c{0} has been taken from {1} account.
takenFromOthersAccount=\u00a7c{0} taken from {1}\u00a7c account. New balance: {2}
teleportAAll=\u00a77Teleporting request sent to all players...
teleportAll=\u00a77Teleporting all players...
teleportAtoB=\u00a77{0}\u00a77 teleported you to {1}\u00a77.

View File

@@ -4,7 +4,7 @@
# by:
action=* {0} {1}
addedToAccount=\u00a7a{0} ha sido agregado a tu cuenta.
addedToOthersAccount=\u00a7a{0} ha sido agregado a la cuenta de {1}.
addedToOthersAccount=\u00a7a{0} added to {1}\u00a7a account. New balance: {2}
alertBroke=roto:
alertFormat=\u00a73[{0}] \u00a7f {1} \u00a76 {2} en: {3}
alertPlaced=situado:
@@ -49,6 +49,7 @@ couldNotFindTemplate=No se puede encontrar el template {0}
creatingConfigFromTemplate=Creando configuracion desde el template: {0}
creatingEmptyConfig=Creando configuracion vacia: {0}
creative=creative
currency={0}{1}
day=dia
days=dias
defaultBanReason=Baneado por incumplir las normas!
@@ -169,6 +170,7 @@ lightningUse=\u00a77Golpeando a {0}
listAfkTag = \u00a77[AFK]\u00a7f
listAmount = \u00a79There are \u00a7c{0}\u00a79 out of maximum \u00a7c{1}\u00a79 players online.
listAmountHidden = \u00a79There are \u00a7c{0}\u00a77/{1}\u00a79 out of maximum \u00a7c{2}\u00a79 players online.
listGroupTag={0}\u00a7f:
listHiddenTag = \u00a77[HIDDEN]\u00a7f
loadWarpError=Error al cargar el tenetransporte {0}
localFormat=Local: <{0}> {1}
@@ -295,12 +297,13 @@ requestDeniedFrom=\u00a77{0} ha denegado tu peticion de teletransporte.
requestSent=\u00a77Peticion enviada a {0}\u00a77.
requestTimedOut=\u00a7cTeleport request has timed out
requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org.
returnPlayerToJailError=Error al intentar quitar al jugador de la carcel.
returnPlayerToJailError=Error occurred when trying to return player {0} to jail: {1}
second=segundo
seconds=segundos
seenOffline=El jugador {0} esta desconectado desde {1}
seenOnline=El jugador {0} lleva conectado desde {1}
serverFull=Servidor lleno
serverTotal=Server Total: {0}
setSpawner=Cambiado tipo de lugar de nacimiento a {0}
sheepMalformedColor=Color malformado.
shoutFormat=\u00a77[Shout]\u00a7f {0}
@@ -317,7 +320,7 @@ suicideMessage=\u00a77Adios mundo cruel...
suicideSuccess= \u00a77{0} se quito su propia vida
survival=survival
takenFromAccount=\u00a7c{0} ha sido sacado de tu cuenta.
takenFromOthersAccount=\u00a7c{0} ha sido sacado de la cuenta de {1}.
takenFromOthersAccount=\u00a7c{0} taken from {1}\u00a7c account. New balance: {2}
teleportAAll=\u00a77Peticion de teletransporte enviada a todos los jugadores...
teleportAll=\u00a77Teletransportando a todos los jugadores...
teleportAtoB=\u00a77{0}\u00a77 te teletransporto a {1}\u00a77.

View File

@@ -4,7 +4,7 @@
# by: L\u00e9a Gris
action=* {0} {1}
addedToAccount=\u00a7a{0} a \u00e9t\u00e9 rajout\u00e9 \u00e0 votre compte.
addedToOthersAccount=\u00a7a{0} a \u00e9t\u00e9 ajout\u00e9 \u00e0 {1} compte.
addedToOthersAccount=\u00a7a{0} added to {1}\u00a7a account. New balance: {2}
alertBroke=a cass\u00e9 :
alertFormat=\u00a73[{0}] \u00a7f {1} \u00a76 {2} \u00e0:{3}
alertPlaced=a plac\u00e9 :
@@ -15,7 +15,7 @@ backUsageMsg=\u00a77Retour \u00e0 votre emplacement pr\u00e9c\u00c3\u00a8dent.
backupFinished=Sauvegarde termin\u00e9
backupStarted=D\u00e9but de la sauvegarde...
balance=\u00a77Solde : {0}
balanceTop=\u00a77 Meilleurs soldes au ({0})
balanceTop=\u00a77Meilleurs soldes au ({0})
banExempt=\u00a77Vous ne pouvez pas bannir ce joueur.
banIpAddress=\u00a77Adresse IP bannie.
bannedIpsFileError=Erreur de lecture de banned-ips.txt
@@ -49,6 +49,7 @@ couldNotFindTemplate=Le mod\u00c3\u00a8le {0} est introuvable
creatingConfigFromTemplate=Cr\u00e9ation de la configuration \u00e0 partir du mod\u00c3\u00a8le : {0}
creatingEmptyConfig=Cr\u00e9ation d''une configuration vierge : {0}
creative=cr\u00e9atif
currency={0}{1}
day=jour
days=jours
defaultBanReason=Le marteau du bannissement a frapp\u00e9 !
@@ -169,6 +170,7 @@ lightningUse=\u00a77{0} a \u00e9t\u00e9 foudroy\u00e9.
listAfkTag = \u00a77[AFK]\u00a7f
listAmount = \u00a79Il y a \u00a7c{0}\u00a79 joueurs en ligne sur \u00a7c{1}\u00a79 au total.
listAmountHidden = \u00a79Il y a \u00a7c{0}\u00a77/{1}\u00a79 sur un maximum de \u00a7c{2}\u00a79 joueurs en ligne.
listGroupTag={0}\u00a7f:
listHiddenTag = \u00a77[MASQU\u00c9]\u00a7f
loadWarpError=\u00c9chec du chargement du point de t\u00e9l\u00e9portation {0}.
localFormat=Locale : <{0}> {1}
@@ -295,12 +297,13 @@ requestDeniedFrom=\u00a77{0} a refus\u00e9 votre demande de t\u00e9l\u00e9portat
requestSent=\u00a77Requ\u00eate envoy\u00e9e \u00e0 {0}\u00a77.
requestTimedOut=\u00a7cLa de mande de t\u00e9l\u00e9portation a expir\u00e9.
requiredBukkit=* ! * Vous avez besoin au moins de la version {0} de CraftBukkit. T\u00e9l\u00e9chargez-la ici http://ci.bukkit.org.
returnPlayerToJailError=Erreur survenue lors de la tentative d'emprisonner de nouveau un joueur.
returnPlayerToJailError=Error occurred when trying to return player {0} to jail: {1}
second=seconde
seconds=secondes
seenOffline=Le joueur {0} est hors ligne depuis {1}
seenOnline=Le joueur {0} est en ligne depuis {1}
serverFull=Le serveur est plein.
serverTotal=Server Total: {0}
setSpawner=Type de g\u00e9n\u00e9rateur chang\u00e9 en {0}
sheepMalformedColor=Couleur mal form\u00e9e.
shoutFormat=\u00a77[Crie]\u00a7f {0}
@@ -317,7 +320,7 @@ suicideMessage=\u00a77Au revoir monde cruel...
suicideSuccess=\u00a77{0} s''est suicid\u00e9.
survival=survie
takenFromAccount=\u00a7c{0} ont \u00e9t\u00e9 retir\u00e9 de votre compte.
takenFromOthersAccount=\u00a7c{0} a \u00e9t\u00e9 r\u00e9tir\u00e9 du compte de {1}.
takenFromOthersAccount=\u00a7c{0} taken from {1}\u00a7c account. New balance: {2}
teleportAAll=\u00a77Demande de t\u00e9l\u00e9portation envoy\u00e9e \u00e0 tous les joueurs...
teleportAll=\u00a77T\u00e9l\u00e9poration de tous les joueurs.
teleportAtoB=\u00a77{0}\u00a77 vous a t\u00e9l\u00e9port\u00e9 \u00e0 {1}\u00a77.

View File

@@ -4,7 +4,7 @@
# by: Geertje123
action=* {0} {1}
addedToAccount=\u00a7a{0} is gestort op je account.
addedToOthersAccount=\u00a7a{0} is overgemaakt naar {1}''s rekening
addedToOthersAccount=\u00a7a{0} added to {1}\u00a7a account. New balance: {2}
alertBroke=gebroken:
alertFormat=\u00a73[{0}] \u00a7f {1} \u00a76 {2} bij: {3}
alertPlaced=geplaatst:
@@ -49,6 +49,7 @@ couldNotFindTemplate=Het sjabloon kon niet worden gevonden {0}
creatingConfigFromTemplate=Bezig met aanmaken van een config vanaf sjabloon: {0}
creatingEmptyConfig=Bezig met een lege config aanmaken: {0}
creative=creative
currency={0}{1}
day=dag
days=dagen
defaultBanReason=De Ban Hamer heeft gesproken!
@@ -169,6 +170,7 @@ lightningUse=\u00a77Brand {0}
listAfkTag = \u00a77[AFK]\u00a7f
listAmount = \u00a79There are \u00a7c{0}\u00a79 out of maximum \u00a7c{1}\u00a79 players online.
listAmountHidden = \u00a79There are \u00a7c{0}\u00a77/{1}\u00a79 out of maximum \u00a7c{2}\u00a79 players online.
listGroupTag={0}\u00a7f:
listHiddenTag = \u00a77[HIDDEN]\u00a7f
loadWarpError=Fout bij het laden van warp {0}
localFormat=Local: <{0}> {1}
@@ -295,12 +297,13 @@ requestDeniedFrom=\u00a77{0} denied your teleport request.
requestSent=\u00a77Aanvraag verstuurd naar {0}\u00a77.
requestTimedOut=\u00a7cTeleport request has timed out
requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org.
returnPlayerToJailError=Fout opgetreden bij terugzetten van speler in gevangenis.
returnPlayerToJailError=Error occurred when trying to return player {0} to jail: {1}
second=seconde
seconds=seconde
seenOffline=Speler {0} is offline vanaf {1}
seenOnline=Speler {0} is online vanaf {1}
serverFull=Server is vol
serverTotal=Server Total: {0}
setSpawner=Changed spawner type to {0}
sheepMalformedColor=Misvoormde kleur.
shoutFormat=\u00a77[Shout]\u00a7f {0}
@@ -317,7 +320,7 @@ suicideMessage=\u00a77Vaarwel vreedzame wereld...
suicideSuccess= \u00a77{0} pleegde zelfmoord
survival=survival
takenFromAccount=\u00a7c{0} is van je bank rekening afgehaald.
takenFromOthersAccount=\u00a7c{0} is overgenomen uit {1} account.
takenFromOthersAccount=\u00a7c{0} taken from {1}\u00a7c account. New balance: {2}
teleportAAll=\u00a77Teleporting request sent to all players...
teleportAll=\u00a77Bezig met teleporteren van alle spelers...
teleportAtoB=\u00a77{0}\u00a77 is naar {1}\u00a77 geteleporteerd.

View File

@@ -5,7 +5,7 @@ main: com.earth2me.essentials.Essentials
version: TeamCity
website: http://tiny.cc/EssentialsCommands
description: Provides an essential, core set of commands for Bukkit.
authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits]
authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits, md_5]
commands:
afk:
description: Marks you as away-from-keyboard.
@@ -13,8 +13,8 @@ commands:
aliases: [eafk]
antioch:
description: 'A little surprise for operators.'
usage: /<command>
aliases: [eantioch]
usage: /<command> [message]
aliases: [eantioch,grenade,tnt,egrenade,etnt]
back:
description: Teleports you to your location prior to tp/spawn/warp.
usage: /<command>
@@ -26,7 +26,7 @@ commands:
balance:
description: States the current balance of a player.
usage: /<command> [player]
aliases: [bal,emoney,ebalance,ebal]
aliases: [bal,money,emoney,ebalance,ebal]
balancetop:
description: Gets the top balance values.
usage: /<command> <page>
@@ -58,11 +58,11 @@ commands:
clearinventory:
description: Clear all items in your inventory.
usage: /<command>
aliases: [ci,eci,eclearinventory]
aliases: [ci,eci,clearinvent,clean,eclean,eclearinvent,eclearinventory]
compass:
description: Describes your current bearing.
usage: /<command>
aliases: [ecompass]
aliases: [ecompass,direction,edirection]
delhome:
description: Removes a home
usage: /<command> [player:]<name>
@@ -97,7 +97,7 @@ commands:
feed:
description: Satisfy the hunger.
usage: /<command> [player]
aliases: [efeed]
aliases: [efeed,eat,eeat]
itemdb:
description: Searches for an item.
usage: /<command> <item>
@@ -113,14 +113,14 @@ commands:
getpos:
description: Get your current coordinates or those of a player.
usage: /<command> [player]
aliases: [coords,egetpos,whereami,ewhereami]
aliases: [coords,egetpos,position,eposition,whereami,ewhereami]
gc:
description: Reports garbage collection info; useful to developers.
usage: /<command>
aliases: [mem,memory,egc,emem,ememory]
give:
description: Give a player an item.
usage: /<command> <player> <item|numeric> [amount <enchantmentname[:level]> ...]
usage: /<command> <player> <item|numeric> [amount <enchantmentname[:level]> ...]
aliases: [egive]
god:
description: Enables your godly powers.
@@ -141,7 +141,7 @@ commands:
home:
description: Teleport to your home.
usage: /<command> [player:][name]
aliases: [ehome]
aliases: [ehome,homes,ehomes]
ignore:
description: Ignore other players.
usage: /<command> <player>
@@ -165,7 +165,7 @@ commands:
jump:
description: Jumps to the nearest block in the line of sight.
usage: /<command>
aliases: [j,ejump]
aliases: [j,ej,jumpto,ejumpto,ejump]
kick:
description: Kicks a specified player with a reason.
usage: /<command> <player> [reason]
@@ -177,7 +177,7 @@ commands:
kit:
description: Obtains the specified kit or views all available kits.
usage: /<command> [kit]
aliases: [ekit,kits]
aliases: [ekit,kits,ekits]
kill:
description: Kills specified player.
usage: /<command> <player>
@@ -189,7 +189,7 @@ commands:
list:
description: List all online players.
usage: /<command>
aliases: [playerlist,who,online,elist,ewho,eplayerlist,eonline]
aliases: [playerlist,who,online,plist,eplist,elist,ewho,eplayerlist,eonline]
lightning:
description: The power of Thor. Strike at cursor or player.
usage: /<command> [player] [power]
@@ -220,7 +220,7 @@ commands:
aliases: [emute]
near:
description: Lists the players near by or around a player
usage: /<command> [playername] [radius]
usage: /<command> [playername] [radius]
aliases: [nearby,enear,enearby]
nick:
description: Change your nickname or that of another player.
@@ -237,7 +237,7 @@ commands:
ping:
description: Pong!
usage: /<command>
aliases: [pong,eping,epong]
aliases: [pong,echo,echo,eping,epong]
powertool:
description: Assigns a command to the item in hand, {player} will be replaced by the name of the player that you click.
usage: /<command> [l:|a:|r:|c:|d:][command] [arguments]
@@ -245,7 +245,7 @@ commands:
powertooltoggle:
description: Enables or disables all current powertools
usage: /<command>
aliases: [ptt,epowertooltoggle,eptt]
aliases: [ptt,epowertooltoggle,pttoggle,epttoggle,eptt]
ptime:
description: Adjust player's client time. Add @ prefix to fix.
usage: /<command> [list|reset|day|night|dawn|17:30|4pm|4000ticks] [player|*]
@@ -337,11 +337,11 @@ commands:
tp:
description: Teleport to a player.
usage: /<command> <player> [otherplayer]
aliases: [tele,etele,etp,tp2p,etp2p]
aliases: [tele,teleport,eteleport,etele,etp,tp2p,etp2p]
tpa:
description: Request to teleport to the specified player.
usage: /<command> <player>
aliases: [call,etpa,ecall]
aliases: [call,tpask,etpask,etpa,ecall]
tpaall:
description: Requests all players online to teleport to you.
usage: /<command> <player>
@@ -389,11 +389,11 @@ commands:
unban:
description: Unbans the specified player.
usage: /<command> <player>
aliases: [pardon,eunban]
aliases: [pardon,eunban,epardon]
unbanip:
description: Unbans the specified IP address.
usage: /<command> <address>
aliases: [eunbanip,pardonip]
aliases: [eunbanip,pardonip,epardonip]
unlimited:
description: Allows the unlimited placing of items.
usage: /<command> <list|item|clear> [player]
@@ -401,7 +401,7 @@ commands:
warp:
description: List all warps or warp to the specified location.
usage: /<command> <pagenumber|warp> [player]
aliases: [ewarp,warps]
aliases: [ewarp,warps,ewarps]
weather:
description: Setting the weather.
usage: /<command> <storm/sun> [duration]
@@ -417,4 +417,4 @@ commands:
worth:
description: Calculates the worth of items in hand or as specified.
usage: /<command> [item] [amount]
aliases: [eworth]
aliases: [eworth,price,eprice]

View File

@@ -13,7 +13,12 @@ import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.command.PluginCommand;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.help.HelpMap;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.Recipe;
import org.bukkit.map.MapView;
import org.bukkit.plugin.Plugin;
@@ -250,7 +255,6 @@ public class FakeServer implements Server
return worlds;
}
@Override
public World createWorld(String string, Environment e)
{
World w = new FakeWorld(string, e);
@@ -258,7 +262,6 @@ public class FakeServer implements Server
return w;
}
@Override
public World createWorld(String string, Environment e, long l)
{
World w = new FakeWorld(string, e);
@@ -331,18 +334,6 @@ public class FakeServer implements Server
return player;
}
@Override
public World createWorld(String string, Environment e, ChunkGenerator cg)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public World createWorld(String string, Environment e, long l, ChunkGenerator cg)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public World createWorld(WorldCreator creator)
{
@@ -654,4 +645,64 @@ public class FakeServer implements Server
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public int getTicksPerAnimalSpawns()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public int getTicksPerMonsterSpawns()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public List<Recipe> getRecipesFor(ItemStack is)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Iterator<Recipe> recipeIterator()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void clearRecipes()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void resetRecipes()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public HelpMap getHelpMap()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Inventory createInventory(InventoryHolder ih, InventoryType it)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Inventory createInventory(InventoryHolder ih, int i)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Inventory createInventory(InventoryHolder ih, int i, String string)
{
throw new UnsupportedOperationException("Not supported yet.");
}
}

View File

@@ -36,7 +36,7 @@ public class ChatStore
public String getLongType()
{
return type.length() > 0 ? "chat" : "chat-" + type;
return type.length() == 0 ? "chat" : "chat-" + type;
}
public long getRadius()

View File

@@ -7,8 +7,6 @@ import java.util.Map;
import java.util.concurrent.ConcurrentSkipListMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;

View File

@@ -5,6 +5,6 @@ main: com.earth2me.essentials.chat.EssentialsChat
version: TeamCity
website: http://tiny.cc/EssentialsCommands
description: Provides chat control features for Essentials. Requires Permissions.
authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits, Okamosy]
authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits, md_5, Okamosy]
depend: [Essentials]
#softdepend: [Factions]

View File

@@ -1,3 +0,0 @@
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build

View File

@@ -125,4 +125,25 @@ v 1.9:
- Fixed an infinite loop error when using '/manudel' on a logged in player. It caused setDefaultGroup to trigger a bukkit update when no GM User existed yet.
- do not allow inherited permissions to negate higher perms.
- Fixed a bug when pushing superperms in the wrong order.
- Fix players retaining permissions when demoted.
- Fix players retaining permissions when demoted.
- Auto sort permissions on load to speed up population of superperms.
- Negating a parent node after adding all nodes with * will now correctly remove all child nodes of that parent before populating superperms.
eg.
- '*'
- -vanish.*
- vanish.standard
- Track the 'onPlayerChangeWorld' event as some teleports seem to not be triggering a world move.
- Catch all errors in badly formatted groups.
- Fix a bug with getWorldData return the main world data for all mirrors, instead of the worlds parent data.
- Prevent getAllPlayersPermissions() processing a group more than once. Improves performance when using complex inheritance structures.
- Fix world mirroring so it correctly creates data files and data sources for partially mirrored worlds.
- Fixed world mirroring so it returns the correct data for the requested world.
- Change Service registration to register WorldsHolder instead of AnjoPermissionsHandler. This is the correct entry point for all data.
- Depreciate PlayerTeleportEvent, PlayerRespawnEvent and PlayerPortalEvent as it's all handled in PlayerChangedWorldEvent.
This also means we no longer update permissions before we change worlds.
- A command of '/manload' with no world arguments now performs a full reload of GM.
- Update for Bukkit R5 compatability.
- Removed BukkitPermsOverride as this is now the default with bukkit handling child nodes.
- Prevent adding inheritances and info nodes to globalgroups. These are permissions collections, not player groups.
- Prevent promoting players to, and demoting to GlobalGroups.
- Make 'manload' reload the config correctly.

View File

@@ -4,10 +4,6 @@ settings:
# The user will be able to promote players to the same group or even above.
opOverrides: true
# If enabled any bukkit permissiosn which default to true will be left enabled.
# If the player is op any permissions set to Op will follow suit.
bukkit_perms_override: true
# Default setting for 'mantoglevalidate'
# true will cause GroupManager to attempt name matching by default.
validate_toggle: true

View File

@@ -57,9 +57,6 @@ public class GMConfiguration {
public boolean isOpOverride() {
return GMconfig.getBoolean("settings.config.opOverrides", true);
}
public boolean isBukkitPermsOverride() {
return GMconfig.getBoolean("settings.config.bukkit_perms_override", false);
}
public boolean isToggleValidate() {
return GMconfig.getBoolean("settings.config.validate_toggle", true);
}

View File

@@ -25,7 +25,10 @@ import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.anjocaido.groupmanager.dataholder.worlds.WorldsHolder;
import org.anjocaido.groupmanager.events.GMSystemEvent;
import org.anjocaido.groupmanager.events.GMWorldListener;
import org.anjocaido.groupmanager.events.GroupManagerEventHandler;
import org.anjocaido.groupmanager.events.GMGroupEvent.Action;
import org.anjocaido.groupmanager.utils.GMLoggerHandler;
import org.anjocaido.groupmanager.utils.PermissionCheckResult;
import org.anjocaido.groupmanager.utils.Tasks;
@@ -118,15 +121,15 @@ public class GroupManager extends JavaPlugin {
ch = new GMLoggerHandler();
GroupManager.logger.addHandler(ch);
logger.setLevel(Level.ALL);
if (worldsHolder == null) {
// Create the backup folder, if it doesn't exist.
prepareFileFields();
// Load the config.yml
prepareConfig();
// Load the global groups
globalGroups = new GlobalGroups(this);
worldsHolder = new WorldsHolder(this);
}
// Create the backup folder, if it doesn't exist.
prepareFileFields();
// Load the config.yml
prepareConfig();
// Load the global groups
globalGroups = new GlobalGroups(this);
worldsHolder = new WorldsHolder(this);
PluginDescriptionFile pdfFile = this.getDescription();
if (worldsHolder == null) {
@@ -158,7 +161,7 @@ public class GroupManager extends JavaPlugin {
System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!");
// Register as a service
this.getServer().getServicesManager().register(AnjoPermissionsHandler.class, this.permissionHandler, this, ServicePriority.Lowest);
this.getServer().getServicesManager().register(WorldsHolder.class, this.worldsHolder, this, ServicePriority.Lowest);
}
public static boolean isLoaded() {
@@ -395,6 +398,10 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.RED + "Group not found!");
return false;
}
if (auxGroup.isGlobal()) {
sender.sendMessage(ChatColor.RED + "Players may not be members of GlobalGroups directly.");
return false;
}
// VALIDANDO PERMISSAO
if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
@@ -1016,6 +1023,11 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.RED + "Group 2 does not exists!");
return false;
}
if (auxGroup.isGlobal()) {
sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support inheritance.");
return false;
}
// VALIDANDO PERMISSAO
if (permissionHandler.searchGroupInInheritance(auxGroup, auxGroup2.getName(), null)) {
sender.sendMessage(ChatColor.RED + "Group " + auxGroup.getName() + " already inherits " + auxGroup2.getName() + " (might not be directly)");
@@ -1049,6 +1061,11 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.RED + "Group 2 does not exists!");
return false;
}
if (auxGroup.isGlobal()) {
sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support inheritance.");
return false;
}
// VALIDANDO PERMISSAO
if (!permissionHandler.searchGroupInInheritance(auxGroup, auxGroup2.getName(), null)) {
sender.sendMessage(ChatColor.RED + "Group " + auxGroup.getName() + " does not inherits " + auxGroup2.getName() + ".");
@@ -1219,6 +1236,10 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.RED + "Group does not exists!");
return false;
}
if (auxGroup.isGlobal()) {
sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support Info Nodes.");
return false;
}
// VALIDANDO PERMISSAO
// PARECE OK
auxString = "";
@@ -1248,6 +1269,10 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.RED + "Group does not exists!");
return false;
}
if (auxGroup.isGlobal()) {
sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support Info Nodes.");
return false;
}
// VALIDANDO PERMISSAO
if (!auxGroup.getVariables().hasVar(args[1])) {
sender.sendMessage(ChatColor.RED + "The group doesn't have directly that variable!");
@@ -1273,6 +1298,10 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.RED + "Group does not exists!");
return false;
}
if (auxGroup.isGlobal()) {
sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support Info Nodes.");
return false;
}
// VALIDANDO PERMISSAO
// PARECE OK
auxString = "";
@@ -1310,6 +1339,10 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.RED + "Group does not exists!");
return false;
}
if (auxGroup.isGlobal()) {
sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support Info Nodes.");
return false;
}
// VALIDANDO PERMISSAO
auxGroup2 = permissionHandler.nextGroupWithVariable(auxGroup, args[1], null);
if (auxGroup2 == null) {
@@ -1485,14 +1518,16 @@ public class GroupManager extends JavaPlugin {
try {
worldsHolder.saveChanges(forced);
sender.sendMessage(ChatColor.YELLOW + " The changes were saved.");
sender.sendMessage(ChatColor.YELLOW + " All changes were saved.");
} catch (IllegalStateException ex) {
sender.sendMessage(ChatColor.RED + ex.getMessage());
}
return true;
case manload:
// THIS CASE DONT NEED SENDER
/**
* Attempt to reload a specific world
*/
if (args.length > 0) {
auxString = "";
for (int i = 0; i < args.length; i++) {
@@ -1502,50 +1537,34 @@ public class GroupManager extends JavaPlugin {
}
}
isLoaded = false; // Disable Bukkit Perms update
isLoaded = false; // Disable Bukkit Perms update and event triggers
globalGroups.load();
worldsHolder.loadWorld(auxString);
sender.sendMessage("The request to world '" + auxString + "' was sent.");
sender.sendMessage("The request to reload world '" + auxString + "' was attempted.");
isLoaded = true;
BukkitPermissions.updateAllPlayers();
return true;
}
// VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
if (!setDefaultWorldHandler(sender))
return true;
}
// WORKING
config.load();
worldsHolder.mirrorSetUp();
isLoaded = false;
if (args.length > 0) {
auxString = "";
for (int i = 0; i < args.length; i++) {
auxString += args[i];
if ((i + 1) < args.length) {
auxString += " ";
}
}
worldsHolder.loadWorld(auxString);
sender.sendMessage("The request to world '" + auxString + "' was sent.");
} else {
worldsHolder.reloadAll();
sender.sendMessage(ChatColor.YELLOW + " The current world was reloaded.");
/**
* Reload all settings and data as no world was specified.
*/
onDisable();
onEnable();
}
isLoaded = true;
BukkitPermissions.updateAllPlayers();
/**
* Fire an event as none will have been triggered in the reload.
*/
if (GroupManager.isLoaded())
GroupManagerEventHandler.callEvent(GMSystemEvent.Action.RELOADED);
return true;
case listgroups:
// VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
@@ -1589,6 +1608,10 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.RED + "Group not found!");
return false;
}
if (auxGroup.isGlobal()) {
sender.sendMessage(ChatColor.RED + "Players may not be members of GlobalGroups directly.");
return false;
}
// VALIDANDO PERMISSAO
if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
sender.sendMessage(ChatColor.RED + "Can't modify player with same permissions than you, or higher.");
@@ -1645,6 +1668,10 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.RED + "Group not found!");
return false;
}
if (auxGroup.isGlobal()) {
sender.sendMessage(ChatColor.RED + "Players may not be members of GlobalGroups directly.");
return false;
}
// VALIDANDO PERMISSAO
if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
sender.sendMessage(ChatColor.RED + "Can't modify player with same permissions than you, or higher.");
@@ -1762,9 +1789,9 @@ public class GroupManager extends JavaPlugin {
dataHolder = worldsHolder.getWorldData(worldsHolder.getDefaultWorld().getName());
permissionHandler = dataHolder.getPermissionsHandler();
selectedWorlds.put(sender, dataHolder.getName());
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;
}

View File

@@ -65,8 +65,19 @@ public abstract class DataUnit {
hash = 71 * hash + (this.name != null ? this.name.toLowerCase().hashCode() : 0);
return hash;
}
/**
* Set the data source to point to a different worldDataHolder
*
* @param source
*/
public void setDataSource(WorldDataHolder source) {
this.dataSource = source;
}
/**
* Get the current worldDataHolder this object is pointing to
*
* @return the dataSource
*/
public WorldDataHolder getDataSource() {

View File

@@ -48,6 +48,15 @@ public class Group extends DataUnit implements Cloneable {
public Group(String name) {
super(name);
}
/**
* Is this a GlobalGroup
*
* @return
*/
public boolean isGlobal() {
return (getDataSource() == null);
}
/**
* Clone this group
@@ -57,7 +66,7 @@ public class Group extends DataUnit implements Cloneable {
public Group clone() {
Group clone;
if (getDataSource() == null) {
if (isGlobal()) {
clone = new Group(this.getName());
} else {
clone = new Group(getDataSource(), this.getName());
@@ -85,7 +94,7 @@ public class Group extends DataUnit implements Cloneable {
Group clone = dataSource.createGroup(this.getName());
// Don't add inheritance for GlobalGroups
if (getDataSource() != null) {
if (!isGlobal()) {
clone.inherits = new ArrayList<String>(this.getInherits());
}
for (String perm : this.getPermissionList()) {
@@ -110,26 +119,30 @@ public class Group extends DataUnit implements Cloneable {
* @param inherit the inherits to set
*/
public void addInherits(Group inherit) {
if (!this.getDataSource().groupExists(inherit.getName())) {
getDataSource().addGroup(inherit);
}
if (!inherits.contains(inherit.getName().toLowerCase())) {
inherits.add(inherit.getName().toLowerCase());
}
flagAsChanged();
if (GroupManager.isLoaded()) {
GroupManager.BukkitPermissions.updateAllPlayers();
GroupManagerEventHandler.callEvent(this, Action.GROUP_INHERITANCE_CHANGED);
}
if (!isGlobal()) {
if (!this.getDataSource().groupExists(inherit.getName())) {
getDataSource().addGroup(inherit);
}
if (!inherits.contains(inherit.getName().toLowerCase())) {
inherits.add(inherit.getName().toLowerCase());
}
flagAsChanged();
if (GroupManager.isLoaded()) {
GroupManager.BukkitPermissions.updateAllPlayers();
GroupManagerEventHandler.callEvent(this, Action.GROUP_INHERITANCE_CHANGED);
}
}
}
public boolean removeInherits(String inherit) {
if (this.inherits.contains(inherit.toLowerCase())) {
this.inherits.remove(inherit.toLowerCase());
flagAsChanged();
GroupManagerEventHandler.callEvent(this, Action.GROUP_INHERITANCE_CHANGED);
return true;
}
if (!isGlobal()) {
if (this.inherits.contains(inherit.toLowerCase())) {
this.inherits.remove(inherit.toLowerCase());
flagAsChanged();
GroupManagerEventHandler.callEvent(this, Action.GROUP_INHERITANCE_CHANGED);
return true;
}
}
return false;
}
@@ -145,15 +158,17 @@ public class Group extends DataUnit implements Cloneable {
* @param varList
*/
public void setVariables(Map<String, Object> varList) {
GroupVariables temp = new GroupVariables(this, varList);
variables.clearVars();
for (String key : temp.getVarKeyList()) {
variables.addVar(key, temp.getVarObject(key));
}
flagAsChanged();
if (GroupManager.isLoaded()) {
GroupManager.BukkitPermissions.updateAllPlayers();
GroupManagerEventHandler.callEvent(this, Action.GROUP_INFO_CHANGED);
}
if (!isGlobal()) {
GroupVariables temp = new GroupVariables(this, varList);
variables.clearVars();
for (String key : temp.getVarKeyList()) {
variables.addVar(key, temp.getVarObject(key));
}
flagAsChanged();
if (GroupManager.isLoaded()) {
GroupManager.BukkitPermissions.updateAllPlayers();
GroupManagerEventHandler.callEvent(this, Action.GROUP_INFO_CHANGED);
}
}
}
}

View File

@@ -138,8 +138,8 @@ public class User extends DataUnit implements Cloneable {
String oldGroup = this.group;
this.group = group.getName();
flagAsChanged();
if (GroupManager.isLoaded() && (updatePerms)) {
if (!GroupManager.BukkitPermissions.isPlayer_join())
if (GroupManager.isLoaded()) {
if (!GroupManager.BukkitPermissions.isPlayer_join() && (updatePerms))
GroupManager.BukkitPermissions.updatePlayer(getBukkitPlayer());
// Do we notify of the group change?

View File

@@ -9,15 +9,14 @@ import org.anjocaido.groupmanager.data.Group;
/**
* This container holds all Groups loaded from the relevant groupsFile.
*
* @author ElgarL
*
*/
public class GroupsDataHolder {
/**
* Root World name this set of groups is associated with.
*/
private String name;
private WorldDataHolder dataSource;
private Group defaultGroup = null;
private File groupsFile;
private boolean haveGroupsChanged = false;
@@ -33,16 +32,12 @@ public class GroupsDataHolder {
*/
protected GroupsDataHolder() {
}
protected void setWorldName(String worldName) {
name = worldName;
}
/**
* @return the name
*/
public String getWorldName() {
return name;
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);
}
/**

View File

@@ -9,15 +9,14 @@ import org.anjocaido.groupmanager.data.User;
/**
* This container holds all Users loaded from the relevant usersFile.
*
* @author ElgarL
*
*/
public class UsersDataHolder {
/**
* Root World name this set of groups is associated with.
*/
private String name;
private WorldDataHolder dataSource;
private File usersFile;
private boolean haveUsersChanged = false;
private long timeStampUsers = 0;
@@ -32,19 +31,13 @@ public class UsersDataHolder {
*/
protected UsersDataHolder() {
}
/**
* @param worldName
*/
public void setWorldName(String worldName) {
this.name = worldName;
}
/**
* @return the name
*/
public String getWorldName() {
return this.name;
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);
}
/**

View File

@@ -36,8 +36,11 @@ import org.yaml.snakeyaml.constructor.SafeConstructor;
import org.yaml.snakeyaml.reader.UnicodeReader;
/**
*
* @author gabrielcouto
* 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 {
@@ -80,6 +83,16 @@ public class WorldDataHolder {
//this.defaultGroup = defaultGroup;
}
/**
* update the dataSource to point to this object.
*
* This should be called whenever a set of world data is fetched.
*/
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
@@ -445,13 +458,13 @@ public class WorldDataHolder {
//PROCESS GROUPS FILE
Map<String, List<String>> inheritance = new HashMap<String, List<String>>();
//try {
try {
Map<String, Object> allGroupsNode = (Map<String, Object>) groupsRootDataNode.get("groups");
for (String groupKey : allGroupsNode.keySet()) {
Map<String, Object> thisGroupNode = (Map<String, Object>) allGroupsNode.get(groupKey);
Group thisGrp = ph.createGroup(groupKey);
if (thisGrp == null) {
throw new IllegalArgumentException("I think this user was declared more than once: " + groupKey + " in file: " + groupsFile.getPath());
throw new IllegalArgumentException("I think this Group was declared more than once: " + groupKey + " in file: " + groupsFile.getPath());
}
if (thisGroupNode.get("default") == null) {
thisGroupNode.put("default", false);
@@ -465,57 +478,72 @@ public class WorldDataHolder {
}
//PERMISSIONS NODE
if (thisGroupNode.get("permissions") == null) {
thisGroupNode.put("permissions", new ArrayList<String>());
}
if (thisGroupNode.get("permissions") instanceof List) {
for (Object o : ((List) thisGroupNode.get("permissions"))) {
try {
thisGrp.addPermission(o.toString());
} catch (NullPointerException e) {
// Ignore this entry as it's null.
//throw new IllegalArgumentException("Invalid permission node in group: " + thisGrp.getName() + " in file: " + groupsFile.getPath());
}
}
} else if (thisGroupNode.get("permissions") instanceof String) {
thisGrp.addPermission((String) thisGroupNode.get("permissions"));
} else {
throw new IllegalArgumentException("Unknown type of permissions node(Should be String or List<String>) for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath());
try {
if (thisGroupNode.get("permissions") == null) {
thisGroupNode.put("permissions", new ArrayList<String>());
} else {
if (thisGroupNode.get("permissions") instanceof List) {
for (Object o : ((List) thisGroupNode.get("permissions"))) {
try {
thisGrp.addPermission(o.toString());
} catch (NullPointerException e) {
// Ignore this entry as it's null.
//throw new IllegalArgumentException("Invalid permission node in group: " + thisGrp.getName() + " in file: " + groupsFile.getPath());
}
}
} else if (thisGroupNode.get("permissions") instanceof String) {
thisGrp.addPermission((String) thisGroupNode.get("permissions"));
} else {
throw new IllegalArgumentException("Unknown type of permissions node(Should be String or List<String>) for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath());
}
thisGrp.sortPermissions();
}
} catch (Exception e) {
throw new IllegalArgumentException("Invalid formatting found in permissions section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath());
}
//INFO NODE
if (thisGroupNode.get("info") instanceof Map) {
Map<String, Object> infoNode = (Map<String, Object>) thisGroupNode.get("info");
if (infoNode != null) {
thisGrp.setVariables(infoNode);
}
} else
throw new IllegalArgumentException("Unknown entry found in Info section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath());
try {
if (thisGroupNode.get("info") instanceof Map) {
Map<String, Object> infoNode = (Map<String, Object>) thisGroupNode.get("info");
if (infoNode != null) {
thisGrp.setVariables(infoNode);
}
} else
throw new IllegalArgumentException("Unknown entry found in Info section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath());
} catch (Exception e1) {
throw new IllegalArgumentException("Invalid formatting found in info section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath());
}
//END INFO NODE
if (thisGroupNode.get("inheritance") == null || thisGroupNode.get("inheritance") instanceof List) {
Object inheritNode = thisGroupNode.get("inheritance");
if (inheritNode == null) {
thisGroupNode.put("inheritance", new ArrayList<String>());
} else if (inheritNode instanceof List) {
List<String> groupsInh = (List<String>) inheritNode;
for (String grp : groupsInh) {
if (inheritance.get(groupKey) == null) {
List<String> thisInherits = new ArrayList<String>();
inheritance.put(groupKey, thisInherits);
}
inheritance.get(groupKey).add(grp);
}
}
}else
throw new IllegalArgumentException("Unknown entry found in inheritance section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath());
try {
if (thisGroupNode.get("inheritance") == null || thisGroupNode.get("inheritance") instanceof List) {
Object inheritNode = thisGroupNode.get("inheritance");
if (inheritNode == null) {
thisGroupNode.put("inheritance", new ArrayList<String>());
} else if (inheritNode instanceof List) {
List<String> groupsInh = (List<String>) inheritNode;
for (String grp : groupsInh) {
if (inheritance.get(groupKey) == null) {
List<String> thisInherits = new ArrayList<String>();
inheritance.put(groupKey, thisInherits);
}
inheritance.get(groupKey).add(grp);
}
}
}else
throw new IllegalArgumentException("Unknown entry found in inheritance section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath());
} catch (Exception e2) {
throw new IllegalArgumentException("Invalid formatting found in inheritance section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath());
}
}
//} catch (Exception ex) {
// ex.printStackTrace();
// throw new IllegalArgumentException("Your Permissions config file is invalid. See console for details.");
//}
} catch (Exception ex) {
ex.printStackTrace();
throw new IllegalArgumentException("Your " + groupsFile.getPath() + " file is invalid. See console for details.");
}
if (ph.getDefaultGroup() == null) {
throw new IllegalArgumentException("There was no Default Group declared in file: " + groupsFile.getPath());
}
@@ -581,18 +609,20 @@ public class WorldDataHolder {
}
if (thisUserNode.get("permissions") == null) {
thisUserNode.put("permissions", new ArrayList<String>());
}
if (thisUserNode.get("permissions") instanceof List) {
for (Object o : ((List) thisUserNode.get("permissions"))) {
thisUser.addPermission(o.toString());
}
} else if (thisUserNode.get("permissions") instanceof String) {
try {
thisUser.addPermission(thisUserNode.get("permissions").toString());
} catch (NullPointerException e) {
// Ignore this entry as it's null.
//throw new IllegalArgumentException("Invalid permission node for user: " + thisUser.getName() + " in file: " + UserFile.getPath());
}
} else {
if (thisUserNode.get("permissions") instanceof List) {
for (Object o : ((List) thisUserNode.get("permissions"))) {
thisUser.addPermission(o.toString());
}
} else if (thisUserNode.get("permissions") instanceof String) {
try {
thisUser.addPermission(thisUserNode.get("permissions").toString());
} catch (NullPointerException e) {
// Ignore this entry as it's null.
//throw new IllegalArgumentException("Invalid permission node for user: " + thisUser.getName() + " in file: " + UserFile.getPath());
}
}
thisUser.sortPermissions();
}
//SUBGROUPS LOADING
@@ -826,7 +856,7 @@ public class WorldDataHolder {
PluginManager pm = server.getPluginManager();
Plugin[] plugins = pm.getPlugins();
for (int i = 0; i < plugins.length; i++) {
plugins[i].getConfiguration().load();
//plugins[i].getConfiguration().load();
try {
plugins[i].getClass().getMethod("setupPermissions").invoke(plugins[i]);
} catch (Exception ex) {

View File

@@ -10,6 +10,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -45,7 +46,7 @@ public class WorldsHolder {
private Map<String, String> mirrorsGroup = new HashMap<String, String>();
private Map<String, String> mirrorsUser = new HashMap<String, String>();
private OverloadedWorldHolder defaultWorld;
//private OverloadedWorldHolder defaultWorld;
private String serverDefaultWorldName;
private GroupManager plugin;
private File worldsFolder;
@@ -59,7 +60,7 @@ public class WorldsHolder {
// Setup folders and check files exist for the primary world
verifyFirstRun();
initialLoad();
if (defaultWorld == null) {
if (serverDefaultWorldName == null) {
throw new IllegalStateException("There is no default group! OMG!");
}
}
@@ -76,7 +77,7 @@ public class WorldsHolder {
private void initialWorldLoading() {
//Load the default world
loadWorld(serverDefaultWorldName);
defaultWorld = worldsData.get(serverDefaultWorldName);
//defaultWorld = getUpdatedWorldData(serverDefaultWorldName);
}
private void loadAllSearchedWorlds() {
@@ -117,6 +118,8 @@ public class WorldsHolder {
mirrorsGroup.clear();
mirrorsUser.clear();
Map<String, Object> mirrorsMap = plugin.getGMConfig().getMirrorsMap();
HashSet<String> mirroredWorlds = new HashSet<String>();
if (mirrorsMap != null) {
for (String source : mirrorsMap.keySet()) {
@@ -140,6 +143,10 @@ public class WorldsHolder {
}
mirrorsGroup.put(world, getWorldData(source).getName());
mirrorsUser.put(world, getWorldData(source).getName());
// Track this world so we can create a datasource for it later
mirroredWorlds.add(o.toString());
} else
GroupManager.logger.log(Level.WARNING, "Mirroring error with " + o.toString() + ". Recursive loop detected!");
}
@@ -171,11 +178,13 @@ public class WorldsHolder {
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
GroupManager.logger.log(Level.WARNING, "Mirroring error with " + key + ". Recursive loop detected!");
} else {
throw new IllegalStateException("Unknown mirroring format for " + key);
}
@@ -183,6 +192,14 @@ public class WorldsHolder {
}
}
}
// Create a datasource for any worlds not already loaded
for (String world : mirroredWorlds){
if (!worldsData.containsKey(world.toLowerCase())) {
setupWorldFolder(world);
loadWorld(world, true);
}
}
}
}
@@ -320,7 +337,8 @@ public class WorldsHolder {
* If the world is not on the worlds list, returns the default world
* holder.
*
* Mirrors return original world data.
* Mirrors return their parent world data.
* If no mirroring data it returns the default world.
*
* @param worldName
* @return OverloadedWorldHolder
@@ -328,12 +346,55 @@ public class WorldsHolder {
public OverloadedWorldHolder getWorldData(String worldName) {
String worldNameLowered = worldName.toLowerCase();
if (worldsData.containsKey(worldNameLowered))
return worldsData.get(worldNameLowered);
// Find this worlds data
if (worldsData.containsKey(worldNameLowered)) {
String usersMirror = mirrorsUser.get(worldNameLowered);
String groupsMirror = mirrorsGroup.get(worldNameLowered);
if (usersMirror != null) {
// If both are mirrored
if (groupsMirror != null) {
// if the data sources are the same, return the parent
if (usersMirror == groupsMirror)
return getUpdatedWorldData(usersMirror.toLowerCase());
// Both data sources are mirrors, but they are from different parents
// so we return the actual data object.
return getUpdatedWorldData(worldNameLowered);
}
// Groups isn't a mirror so return this this worlds data source
return getUpdatedWorldData(worldNameLowered);
}
// users isn't mirrored so we need to return this worlds data source
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...");
return getDefaultWorld();
}
/**
* 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) {
if (worldsData.containsKey(worldName.toLowerCase())) {
OverloadedWorldHolder data = worldsData.get(worldName.toLowerCase());
data.updateDataSource();
return data;
}
return null;
}
/**
* Do a matching of playerName, if its found only one player, do
@@ -353,6 +414,7 @@ public class WorldsHolder {
/**
* Retrieves the field player.getWorld().getName() and do
* getWorld(worldName)
*
* @param player
* @return OverloadedWorldHolder
*/
@@ -476,18 +538,29 @@ 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.
* @param worldName
*/
public void loadWorld(String worldName) {
loadWorld(worldName, false);
}
/**
* Load a world from file.
* If it already been loaded, summon reload method from dataHolder.
* @param worldName
*/
public void loadWorld(String worldName, Boolean isMirror) {
if (worldsData.containsKey(worldName.toLowerCase())) {
worldsData.get(worldName.toLowerCase()).reload();
return;
}
GroupManager.logger.finest("Trying to load world " + worldName + "...");
File thisWorldFolder = new File(worldsFolder, worldName);
if (thisWorldFolder.exists() && thisWorldFolder.isDirectory()) {
if ((isMirror) || (thisWorldFolder.exists() && thisWorldFolder.isDirectory())) {
// Setup file handles, if not mirrored
File groupsFile = (mirrorsGroup.containsKey(worldName.toLowerCase()))? null : new File(thisWorldFolder, "groups.yml");
@@ -564,17 +637,43 @@ public class WorldsHolder {
* @return the defaultWorld
*/
public OverloadedWorldHolder getDefaultWorld() {
return defaultWorld;
return getUpdatedWorldData(serverDefaultWorldName);
}
/**
* Returns all physically loaded worlds.
* 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() {
ArrayList<OverloadedWorldHolder> list = new ArrayList<OverloadedWorldHolder>();
for (OverloadedWorldHolder data : worldsData.values()) {
if (!list.contains(data)) {
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 both are mirrored
if (groupsMirror != null) {
// if the data sources are the same, return the parent
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
// so fall through to add the actual data object.
}
// Groups isn't a mirror so fall through to add this this worlds data source
}
// users isn't mirrored so we need to add this worlds data source
list.add(data);
}
}

View File

@@ -16,7 +16,6 @@ public class GMGroupEvent extends Event {
/**
*
*/
private static final long serialVersionUID = -5294917600434510451L;
private static final HandlerList handlers = new HandlerList();
@Override
@@ -37,7 +36,7 @@ public class GMGroupEvent extends Event {
protected Action action;
public GMGroupEvent(Group group, Action action) {
super(action.toString());
super();
this.group = group;
this.action = action;
@@ -45,7 +44,7 @@ public class GMGroupEvent extends Event {
}
public GMGroupEvent(String groupName, Action action) {
super(action.toString());
super();
this.groupName = groupName;
this.action = action;

View File

@@ -15,7 +15,6 @@ public class GMSystemEvent extends Event {
/**
*
*/
private static final long serialVersionUID = -8786811924448821548L;
private static final HandlerList handlers = new HandlerList();
@Override
@@ -32,7 +31,7 @@ public class GMSystemEvent extends Event {
protected Action action;
public GMSystemEvent(Action action) {
super(action.toString());
super();
this.action = action;
}

View File

@@ -16,7 +16,6 @@ public class GMUserEvent extends Event {
/**
*
*/
private static final long serialVersionUID = -5294917600434510451L;
private static final HandlerList handlers = new HandlerList();
@Override
@@ -37,7 +36,7 @@ public class GMUserEvent extends Event {
protected Action action;
public GMUserEvent(User user, Action action) {
super(action.toString());
super();
this.user = user;
this.action = action;
@@ -45,7 +44,7 @@ public class GMUserEvent extends Event {
}
public GMUserEvent(String userName, Action action) {
super(action.toString());
super();
this.userName = userName;
this.action = action;

View File

@@ -121,27 +121,34 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
// Add the players own permissions.
playerPermArray.addAll(populatePerms(ph.getUser(userName).getPermissionList(), includeChildren));
ArrayList<String> alreadyProcessed = new ArrayList<String>();
// fetch all group permissions
for (String group : getGroups(userName)) {
Set<String> groupPermArray = new HashSet<String>();
if (group.startsWith("g:") && GroupManager.getGlobalGroups().hasGroup(group)) {
// GlobalGroups
groupPermArray = populatePerms(GroupManager.getGlobalGroups().getGroupsPermissions(group), includeChildren);
// Don't process a group more than once.
if (!alreadyProcessed.contains(group)) {
alreadyProcessed.add(group);
} else {
// World Groups
groupPermArray = populatePerms(ph.getGroup(group).getPermissionList(), includeChildren);
}
// Add all group permissions, unless negated by earlier permissions.
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.add(perm);
Set<String> groupPermArray = new HashSet<String>();
if (group.startsWith("g:") && GroupManager.getGlobalGroups().hasGroup(group)) {
// GlobalGroups
groupPermArray = populatePerms(GroupManager.getGlobalGroups().getGroupsPermissions(group), includeChildren);
} else {
// World Groups
groupPermArray = populatePerms(ph.getGroup(group).getPermissionList(), includeChildren);
}
// Add all group permissions, unless negated by earlier permissions.
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.add(perm);
}
}
}
@@ -153,15 +160,23 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
private Set<String> populatePerms (List<String> perms, boolean includeChildren) {
Set<String> permArray = new HashSet<String>();
Boolean allPerms = false;
// Allow * node to populate ALL perms in Bukkit.
// Allow * node to populate ALL permissions to Bukkit.
if (perms.contains("*")) {
permArray.addAll(GroupManager.BukkitPermissions.getAllRegisteredPermissions(includeChildren));
allPerms = true;
}
for (String perm : perms) {
if (!perm.equalsIgnoreCase("*")) {
/**
* all permission sets are passed here pre-sorted, alphabetically.
* This means negated nodes will be processed before all permissions
* other than *.
*/
boolean negated = false;
if (perm.startsWith("-"))
negated = true;
@@ -172,12 +187,17 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
if ((negated) && (permArray.contains(perm.substring(1))))
permArray.remove(perm.substring(1));
if (includeChildren) {
/**
* 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)) {
Map<String, Boolean> children = GroupManager.BukkitPermissions.getAllChildren((negated ? perm.substring(1) : perm), new HashSet<String>());
if (children != null) {
if (negated) {
if (negated || (negated && allPerms)) {
// Remove children of negated nodes
for (String child : children.keySet())
@@ -185,7 +205,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
if (permArray.contains(child))
permArray.remove(child);
} else {
} else if (!negated){
// Add child nodes
for (String child : children.keySet())

View File

@@ -34,12 +34,10 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerChangedWorldEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerKickEvent;
import org.bukkit.event.player.PlayerPortalEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.permissions.Permission;
@@ -345,6 +343,12 @@ public class BukkitPermissions {
this.updatePermissions(player, null);
}
/**
* Player events tracked to cause Superperms updates
*
* @author ElgarL
*
*/
protected class PlayerEvents implements Listener {
@EventHandler(priority = EventPriority.LOWEST)
@@ -358,24 +362,10 @@ public class BukkitPermissions {
}
setPlayer_join(false);
}
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerPortal(PlayerPortalEvent event) { // will portal into another world
if ((event.getTo() != null) && (!event.getFrom().getWorld().equals(event.getTo().getWorld()))) { // only if world actually changed
updatePermissions(event.getPlayer(), event.getTo().getWorld().getName());
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerRespawn(PlayerRespawnEvent event) { // can be respawned in another world
updatePermissions(event.getPlayer(), event.getRespawnLocation().getWorld().getName());
}
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerTeleport(PlayerTeleportEvent event) { // can be teleported into another world
if ((event.getTo() != null) && (event.getPlayer() != null) && (!event.getFrom().getWorld().equals(event.getTo().getWorld()))) { // only if world actually changed
updatePermissions(event.getPlayer(), event.getTo().getWorld().getName());
}
public void onPlayerChangeWorld(PlayerChangedWorldEvent event) { // has changed worlds
updatePermissions(event.getPlayer(), event.getPlayer().getWorld().getName());
}
@EventHandler(priority = EventPriority.LOWEST)

View File

@@ -1 +0,0 @@
Manifest-Version: 1.0

View File

@@ -1,36 +0,0 @@
package com.earth2me.essentials.protect;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockBurnEvent;
import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.block.BlockIgniteEvent;
import org.bukkit.event.block.BlockListener;
@Deprecated
public class EmergencyBlockListener extends BlockListener
{
@Override
public void onBlockBurn(final BlockBurnEvent event)
{
event.setCancelled(true);
}
@Override
public void onBlockIgnite(final BlockIgniteEvent event)
{
event.setCancelled(true);
}
@Override
public void onBlockFromTo(final BlockFromToEvent event)
{
event.setCancelled(true);
}
@Override
public void onBlockBreak(final BlockBreakEvent event)
{
event.setCancelled(true);
}
}

View File

@@ -1,22 +0,0 @@
package com.earth2me.essentials.protect;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntityListener;
@Deprecated
public class EmergencyEntityListener extends EntityListener
{
@Override
public void onEntityExplode(final EntityExplodeEvent event)
{
event.setCancelled(true);
}
@Override
public void onEntityDamage(final EntityDamageEvent event)
{
event.setCancelled(true);
}
}

View File

@@ -1,16 +0,0 @@
package com.earth2me.essentials.protect;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerListener;
@Deprecated
public class EmergencyPlayerListener extends PlayerListener
{
@Override
public void onPlayerJoin(PlayerJoinEvent event)
{
event.getPlayer().sendMessage("Essentials Protect is in emergency mode. Check your log for errors.");
}
}

View File

@@ -9,8 +9,6 @@ import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
import org.bukkit.entity.Player;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
@@ -65,21 +63,8 @@ public class EssentialsProtect extends JavaPlugin implements IProtect
private void enableEmergencyMode(final PluginManager pm)
{
//final EmergencyListener emListener = new EmergencyListener();
//pm.registerEvents(emListener, this);
//TODO: Remove deprecated listners in a few weeks.
final EmergencyBlockListener emBlockListener = new EmergencyBlockListener();
final EmergencyEntityListener emEntityListener = new EmergencyEntityListener();
final EmergencyPlayerListener emPlayerListener = new EmergencyPlayerListener();
pm.registerEvent(Type.PLAYER_JOIN, emPlayerListener, Priority.Low, this);
pm.registerEvent(Type.BLOCK_BURN, emBlockListener, Priority.Low, this);
pm.registerEvent(Type.BLOCK_IGNITE, emBlockListener, Priority.Low, this);
pm.registerEvent(Type.BLOCK_FROMTO, emBlockListener, Priority.Low, this);
pm.registerEvent(Type.BLOCK_BREAK, emBlockListener, Priority.Low, this);
pm.registerEvent(Type.ENTITY_DAMAGE, emEntityListener, Priority.Low, this);
pm.registerEvent(Type.ENTITY_EXPLODE, emEntityListener, Priority.Low, this);
final EmergencyListener emListener = new EmergencyListener();
pm.registerEvents(emListener, this);
for (Player player : getServer().getOnlinePlayers())
{

View File

@@ -328,7 +328,7 @@ public class EssentialsProtectEntityListener implements Listener
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onEndermanPickup(EndermanPickupEvent event)
public void onEntityChangeBlock(EntityChangeBlockEvent event)
{
if (event.isCancelled())
{

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