From 32e43bf1673fa2aa50891aa5b830fdd75cee534b Mon Sep 17 00:00:00 2001 From: snowleo Date: Thu, 24 Nov 2011 05:57:01 +0100 Subject: Show more then 9 lines of motd on login --- .../essentials/EssentialsPlayerListener.java | 2 +- .../earth2me/essentials/textreader/TextPager.java | 39 +++++++++++++--------- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java index a4961ac20..cb3be43c7 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java @@ -172,7 +172,7 @@ public class EssentialsPlayerListener extends PlayerListener { final IText input = new TextInput(user, "motd", true, ess); final IText output = new KeywordReplacer(input, user, ess); - final TextPager pager = new TextPager(output, false); + final TextPager pager = new TextPager(output, true); pager.showPage("1", null, user); } catch (IOException ex) diff --git a/Essentials/src/com/earth2me/essentials/textreader/TextPager.java b/Essentials/src/com/earth2me/essentials/textreader/TextPager.java index 06fd8763f..dd8422580 100644 --- a/Essentials/src/com/earth2me/essentials/textreader/TextPager.java +++ b/Essentials/src/com/earth2me/essentials/textreader/TextPager.java @@ -10,17 +10,17 @@ import org.bukkit.command.CommandSender; public class TextPager { private final transient IText text; - private final transient boolean showHeader; + private final transient boolean onePage; public TextPager(final IText text) { - this(text, true); + this(text, false); } - public TextPager(final IText text, final boolean showHeader) + public TextPager(final IText text, final boolean onePage) { this.text = text; - this.showHeader = showHeader; + this.onePage = onePage; } public void showPage(final String pageStr, final String chapterPageStr, final CommandSender sender) @@ -40,17 +40,18 @@ public class TextPager { page = 1; } - if (page < 1) { + if (page < 1) + { page = 1; } - int start = (page - 1) * 9; - if (showHeader) + int start = onePage ? 0 : (page - 1) * 9; + if (!onePage) { int pages = lines.size() / 9 + (lines.size() % 9 > 0 ? 1 : 0); sender.sendMessage(_("infoPages", page, pages)); } - for (int i = start; i < lines.size() && i < start + 9; i++) + for (int i = start; i < lines.size() && i < start + (onePage ? 20 : 9); i++) { sender.sendMessage(lines.get(i)); } @@ -61,7 +62,7 @@ public class TextPager { if (lines.get(0).startsWith("#")) { - if (!showHeader) + if (onePage) { return; } @@ -91,8 +92,12 @@ public class TextPager { page = 1; } + if (page < 1) + { + page = 1; + } - int start = (page - 1) * 9; + int start = onePage ? 0 : (page - 1) * 9; int end; for (end = 0; end < lines.size(); end++) { @@ -103,12 +108,12 @@ public class TextPager } } - if (showHeader) + if (!onePage) { int pages = end / 9 + (end % 9 > 0 ? 1 : 0); sender.sendMessage(_("infoPages", page, pages)); } - for (int i = start; i < end && i < start + 9; i++) + for (int i = start; i < end && i < start + (onePage ? 20 : 9); i++) { sender.sendMessage(lines.get(i)); } @@ -127,6 +132,10 @@ public class TextPager { chapterpage = 0; } + if (chapterpage < 0) + { + chapterpage = 0; + } } if (!bookmarks.containsKey(pageStr.toLowerCase(Locale.ENGLISH))) @@ -144,15 +153,15 @@ public class TextPager break; } } - final int start = chapterstart + chapterpage * 9; + final int start = chapterstart + (onePage ? 0 : chapterpage * 9); - if (showHeader) + if (!onePage) { final int page = chapterpage + 1; final int pages = (chapterend - chapterstart) / 9 + ((chapterend - chapterstart) % 9 > 0 ? 1 : 0); sender.sendMessage(_("infoChapterPages", pageStr, page, pages)); } - for (int i = start; i < chapterend && i < start + 9; i++) + for (int i = start; i < chapterend && i < start + (onePage ? 20 : 9); i++) { sender.sendMessage(lines.get(i)); } -- cgit v1.2.3 From 94983c3ca75317a2c6c7e0c8ca88b4f2a2ad0f4c Mon Sep 17 00:00:00 2001 From: ElgarL Date: Thu, 24 Nov 2011 13:26:30 +0000 Subject: Optimize sorting to speedup permission tests. --- EssentialsGroupManager/src/Changelog.txt | 3 ++- .../src/org/anjocaido/groupmanager/data/DataUnit.java | 12 ++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index 580d8bc88..d12f96cda 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -75,4 +75,5 @@ v 1.5: - Fixed a crash on reload due to bukkit not unloading plugins before reloading. v 1.6: - Prevent Group.equals tests throwing a NullPointerException for GlobalGroups. - - Stop throwing errors on an empty users file. \ No newline at end of file + - Stop throwing errors on an empty users file. + - Optimize sorting to speedup permission tests. \ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java index 924da3616..25546a0ea 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java @@ -18,7 +18,7 @@ public abstract class DataUnit { private WorldDataHolder dataSource; private String name; - private boolean changed; + private boolean changed, sorted = false; private ArrayList permissions = new ArrayList(); public DataUnit(WorldDataHolder dataSource, String name) { @@ -91,6 +91,7 @@ public abstract class DataUnit { // for(StackTraceElement st: Thread.currentThread().getStackTrace()){ // GroupManager.logger.finest(st.toString()); // } + sorted = false; changed = true; } @@ -135,8 +136,15 @@ public abstract class DataUnit { public ArrayList getPermissionList() { return new ArrayList(permissions); } + + public boolean isSorted() { + return this.sorted; + } public void sortPermissions() { - Collections.sort(permissions, StringPermissionComparator.getInstance()); + if (!isSorted()) { + Collections.sort(permissions, StringPermissionComparator.getInstance()); + sorted = true; + } } } \ No newline at end of file -- cgit v1.2.3 From dec7ea19268d0e4624c3bbb7da0f3a1b52e69c72 Mon Sep 17 00:00:00 2001 From: ElgarL Date: Thu, 24 Nov 2011 14:05:25 +0000 Subject: remove bukkit perms check from checkUserPermission as it's performed in checkFullUserPermission --- .../org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java index b858c2a6c..feec3f17f 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java @@ -657,8 +657,6 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { if (result.resultType.equals(PermissionCheckResult.Type.EXCEPTION) || result.resultType.equals(PermissionCheckResult.Type.FOUND)) { return true; } - if ((Bukkit.getPlayer(user.getName()) != null) && (Bukkit.getPlayer(user.getName()).hasPermission(permission))) - return true; return false; } @@ -699,6 +697,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { } } + // Check Bukkit perms to support plugins which add perms via code (Heroes). if ((Bukkit.getPlayer(user.getName()) != null) && (Bukkit.getPlayer(user.getName()).hasPermission(targetPermission))) { result.resultType = PermissionCheckResult.Type.FOUND; result.owner = user; -- cgit v1.2.3 From 73a7a6a1ddbddb294254b0d271a2928509db574f Mon Sep 17 00:00:00 2001 From: ElgarL Date: Thu, 24 Nov 2011 15:28:32 +0000 Subject: Optimize comparePermissionString --- .../permissions/AnjoPermissionsHandler.java | 28 +++++++++++++++------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java index feec3f17f..94052bb25 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java @@ -9,6 +9,8 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.StringTokenizer; +import java.util.logging.Level; + import org.anjocaido.groupmanager.GroupManager; import org.anjocaido.groupmanager.data.Group; import org.anjocaido.groupmanager.dataholder.WorldDataHolder; @@ -698,7 +700,8 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { } // Check Bukkit perms to support plugins which add perms via code (Heroes). - if ((Bukkit.getPlayer(user.getName()) != null) && (Bukkit.getPlayer(user.getName()).hasPermission(targetPermission))) { + final Player player = Bukkit.getPlayer(user.getName()); + if ((player != null) && (player.hasPermission(targetPermission))) { result.resultType = PermissionCheckResult.Type.FOUND; result.owner = user; return result; @@ -967,7 +970,10 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { if (userAcessLevel == null || fullPermissionName == null) { return false; } - GroupManager.logger.finest("COMPARING " + userAcessLevel + " WITH " + fullPermissionName); + boolean logFinest = (GroupManager.logger.getLevel() == Level.FINEST); + + if (logFinest) + GroupManager.logger.finest("COMPARING " + userAcessLevel + " WITH " + fullPermissionName); if (userAcessLevel.startsWith("+")) { userAcessLevel = userAcessLevel.substring(1); @@ -986,25 +992,31 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { while (levelATokenizer.hasMoreTokens() && levelBTokenizer.hasMoreTokens()) { String levelA = levelATokenizer.nextToken(); String levelB = levelBTokenizer.nextToken(); - GroupManager.logger.finest("ROUND " + levelA + " AGAINST " + levelB); + if (logFinest) + GroupManager.logger.finest("ROUND " + levelA + " AGAINST " + levelB); if (levelA.contains("*")) { - GroupManager.logger.finest("WIN"); + if (logFinest) + GroupManager.logger.finest("WIN"); return true; } if (levelA.equalsIgnoreCase(levelB)) { if (!levelATokenizer.hasMoreTokens() && !levelBTokenizer.hasMoreTokens()) { - GroupManager.logger.finest("WIN"); + if (logFinest) + GroupManager.logger.finest("WIN"); return true; } - GroupManager.logger.finest("NEXT"); + if (logFinest) + GroupManager.logger.finest("NEXT"); continue; } else { - GroupManager.logger.finest("FAIL"); + if (logFinest) + GroupManager.logger.finest("FAIL"); return false; } } - GroupManager.logger.finest("FAIL"); + if (logFinest) + GroupManager.logger.finest("FAIL"); return false; } -- cgit v1.2.3 From 127681736de3e985c85acf4d7e1a61207f629033 Mon Sep 17 00:00:00 2001 From: ElgarL Date: Thu, 24 Nov 2011 15:57:21 +0000 Subject: rewrite of comparePermissionString (snowleo) --- .../permissions/AnjoPermissionsHandler.java | 80 ++++++++-------------- 1 file changed, 28 insertions(+), 52 deletions(-) diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java index 94052bb25..66561a1b8 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java @@ -966,59 +966,35 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { * @param fullPermissionName * @return true if found a matching token. false if not. */ - public boolean comparePermissionString(String userAcessLevel, String fullPermissionName) { - if (userAcessLevel == null || fullPermissionName == null) { - return false; - } - boolean logFinest = (GroupManager.logger.getLevel() == Level.FINEST); - - if (logFinest) - GroupManager.logger.finest("COMPARING " + userAcessLevel + " WITH " + fullPermissionName); - - if (userAcessLevel.startsWith("+")) { - userAcessLevel = userAcessLevel.substring(1); - } else if (userAcessLevel.startsWith("-")) { - userAcessLevel = userAcessLevel.substring(1); - } - - if (fullPermissionName.startsWith("+")) { - fullPermissionName = fullPermissionName.substring(1); - } else if (fullPermissionName.startsWith("-")) { - fullPermissionName = fullPermissionName.substring(1); - } + public boolean comparePermissionString(String userAccessLevel, String fullPermissionName) { + int userAccessLevelLength; + if (userAccessLevel == null || fullPermissionName == null + || (userAccessLevelLength = userAccessLevel.length()) == 0 || fullPermissionName.length() == 0) { + return false; + } + + int userAccessLevelOffset; + if (userAccessLevel.charAt(0) == '+' || userAccessLevel.charAt(0) == '-') { + userAccessLevelOffset = 1; + } else { + userAccessLevelOffset = 0; + } + if ("*".regionMatches(0, userAccessLevel, userAccessLevelOffset, userAccessLevelLength - userAccessLevelOffset)) { + return true; + } + int fullPermissionNameOffset; + if (fullPermissionName.charAt(0) == '+' || fullPermissionName.charAt(0) == '-') { + fullPermissionNameOffset = 1; + } else { + fullPermissionNameOffset = 0; + } + + if (userAccessLevel.charAt(userAccessLevel.length() - 1) == '*') { + userAccessLevelLength--; + } + return userAccessLevel.regionMatches(true, userAccessLevelOffset, fullPermissionName, fullPermissionNameOffset, userAccessLevelLength - userAccessLevelOffset); + } - StringTokenizer levelATokenizer = new StringTokenizer(userAcessLevel, "."); - StringTokenizer levelBTokenizer = new StringTokenizer(fullPermissionName, "."); - while (levelATokenizer.hasMoreTokens() && levelBTokenizer.hasMoreTokens()) { - String levelA = levelATokenizer.nextToken(); - String levelB = levelBTokenizer.nextToken(); - if (logFinest) - GroupManager.logger.finest("ROUND " + levelA + " AGAINST " + levelB); - if (levelA.contains("*")) { - if (logFinest) - GroupManager.logger.finest("WIN"); - return true; - } - if (levelA.equalsIgnoreCase(levelB)) { - if (!levelATokenizer.hasMoreTokens() && !levelBTokenizer.hasMoreTokens()) { - if (logFinest) - GroupManager.logger.finest("WIN"); - return true; - } - if (logFinest) - GroupManager.logger.finest("NEXT"); - continue; - } else { - if (logFinest) - GroupManager.logger.finest("FAIL"); - return false; - } - - } - if (logFinest) - GroupManager.logger.finest("FAIL"); - return false; - } /** * Returns a list of all groups. -- cgit v1.2.3 From 70c235d4f074f24ce83240cd3033aa6ffcbfa61f Mon Sep 17 00:00:00 2001 From: ElgarL Date: Thu, 24 Nov 2011 16:00:46 +0000 Subject: remove unused imports. --- .../org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java index 66561a1b8..2b48eafa0 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java @@ -8,8 +8,6 @@ import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.Map; -import java.util.StringTokenizer; -import java.util.logging.Level; import org.anjocaido.groupmanager.GroupManager; import org.anjocaido.groupmanager.data.Group; -- cgit v1.2.3 From 5a9b573309fc36073660220c48fdfa172734e9c4 Mon Sep 17 00:00:00 2001 From: ElgarL Date: Thu, 24 Nov 2011 16:05:41 +0000 Subject: More optimization (charAt(0)) --- .../groupmanager/permissions/AnjoPermissionsHandler.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java index 2b48eafa0..b20780a54 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java @@ -601,9 +601,9 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { for (String access : user.getPermissionList()) { if (comparePermissionString(access, permission)) { result.accessLevel = access; - if (access.startsWith("-")) { + if (access.charAt(0) == '-') { result.resultType = PermissionCheckResult.Type.NEGATION; - } else if (access.startsWith("+")) { + } else if (access.charAt(0) == '+') { result.resultType = PermissionCheckResult.Type.EXCEPTION; } else { result.resultType = PermissionCheckResult.Type.FOUND; @@ -631,9 +631,9 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { for (String access : group.getPermissionList()) { if (comparePermissionString(access, permission)) { result.accessLevel = access; - if (access.startsWith("-")) { + if (access.charAt(0) == '-') { result.resultType = PermissionCheckResult.Type.NEGATION; - } else if (access.startsWith("+")) { + } else if (access.charAt(0) == '+') { result.resultType = PermissionCheckResult.Type.EXCEPTION; } else { result.resultType = PermissionCheckResult.Type.FOUND; -- cgit v1.2.3 From eea381e7143aac4b2a0dd63878bce769078e3bed Mon Sep 17 00:00:00 2001 From: ElgarL Date: Thu, 24 Nov 2011 16:34:05 +0000 Subject: optimize getPermissionList --- .../src/org/anjocaido/groupmanager/data/DataUnit.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java index 25546a0ea..a35b5aeee 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java @@ -6,6 +6,8 @@ package org.anjocaido.groupmanager.data; import java.util.ArrayList; import java.util.Collections; +import java.util.List; + import org.anjocaido.groupmanager.GroupManager; import org.anjocaido.groupmanager.dataholder.WorldDataHolder; import org.anjocaido.groupmanager.utils.StringPermissionComparator; @@ -133,8 +135,8 @@ public abstract class DataUnit { * You can't edit the permissions using the returned ArrayList instance * @return a copy of the permission list */ - public ArrayList getPermissionList() { - return new ArrayList(permissions); + public List getPermissionList() { + return Collections.unmodifiableList(permissions); } public boolean isSorted() { -- cgit v1.2.3 From cd8ef9361bd103f380ec6d5fa11063a3ba7556e7 Mon Sep 17 00:00:00 2001 From: ElgarL Date: Thu, 24 Nov 2011 16:45:57 +0000 Subject: minimal optimizations --- .../anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java index b20780a54..9387f13ac 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java @@ -967,15 +967,13 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { public boolean comparePermissionString(String userAccessLevel, String fullPermissionName) { int userAccessLevelLength; if (userAccessLevel == null || fullPermissionName == null - || (userAccessLevelLength = userAccessLevel.length()) == 0 || fullPermissionName.length() == 0) { + || fullPermissionName.length() == 0 || (userAccessLevelLength = userAccessLevel.length()) == 0) { return false; } - int userAccessLevelOffset; + int userAccessLevelOffset = 0; if (userAccessLevel.charAt(0) == '+' || userAccessLevel.charAt(0) == '-') { userAccessLevelOffset = 1; - } else { - userAccessLevelOffset = 0; } if ("*".regionMatches(0, userAccessLevel, userAccessLevelOffset, userAccessLevelLength - userAccessLevelOffset)) { return true; -- cgit v1.2.3 From 31b9e792bda348b9eb815ef5237b290ba195fb0b Mon Sep 17 00:00:00 2001 From: snowleo Date: Fri, 25 Nov 2011 00:22:57 +0100 Subject: Fix NPE in AlternativeCommandsHandler on shutdown --- Essentials/src/com/earth2me/essentials/AlternativeCommandsHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Essentials/src/com/earth2me/essentials/AlternativeCommandsHandler.java b/Essentials/src/com/earth2me/essentials/AlternativeCommandsHandler.java index 257d9a165..583401a55 100644 --- a/Essentials/src/com/earth2me/essentials/AlternativeCommandsHandler.java +++ b/Essentials/src/com/earth2me/essentials/AlternativeCommandsHandler.java @@ -78,7 +78,7 @@ public class AlternativeCommandsHandler while (pcIterator.hasNext()) { final PluginCommand pc = pcIterator.next(); - if (pc.getPlugin().equals(plugin)) + if (pc.getPlugin() == null || pc.getPlugin().equals(plugin)) { pcIterator.remove(); } -- cgit v1.2.3 From 613cb57fdb6701c61878796c17f2fe06f38241f4 Mon Sep 17 00:00:00 2001 From: snowleo Date: Fri, 25 Nov 2011 05:49:57 +0100 Subject: CB#1501 B#1037 New spawnmob options: cow:baby sheep:baby chicken:baby pig:baby --- .../src/com/earth2me/essentials/Essentials.java | 2 +- .../essentials/EssentialsEntityListener.java | 13 ++++++++ .../src/com/earth2me/essentials/FakeWorld.java | 9 +++++- .../essentials/commands/Commandspawnmob.java | 33 +++++++++++++-------- .../test/com/earth2me/essentials/FakeServer.java | 6 ++++ lib/bukkit-1.0.0-R1-SNAPSHOT.jar | Bin 4390943 -> 4391224 bytes lib/craftbukkit-1.0.0-SNAPSHOT.jar | Bin 9770067 -> 9770541 bytes 7 files changed, 49 insertions(+), 14 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java index ebdf84af4..c74ce7312 100644 --- a/Essentials/src/com/earth2me/essentials/Essentials.java +++ b/Essentials/src/com/earth2me/essentials/Essentials.java @@ -56,7 +56,7 @@ import org.bukkit.scheduler.BukkitScheduler; public class Essentials extends JavaPlugin implements IEssentials { - public static final int BUKKIT_VERSION = 1467; + public static final int BUKKIT_VERSION = 1501; private static final Logger LOGGER = Logger.getLogger("Minecraft"); private transient ISettings settings; private final transient TNTExplodeListener tntListener = new TNTExplodeListener(this); diff --git a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java index 37c66d2ef..322d94d8f 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java @@ -3,6 +3,8 @@ package com.earth2me.essentials; import static com.earth2me.essentials.I18n._; import java.util.List; import java.util.logging.Logger; +import org.bukkit.Material; +import org.bukkit.entity.Animals; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; @@ -49,6 +51,17 @@ public class EssentialsEntityListener extends EntityListener } } } + if (eDefend instanceof Animals && eAttack instanceof Player) + { + User player = ess.getUser(eAttack); + ItemStack hand = player.getItemInHand(); + if (hand != null && hand.getType() == Material.MILK_BUCKET) { + ((Animals)eDefend).setAge(-24000); + player.setItemInHand(new ItemStack(Material.BUCKET, hand.getAmount())); + player.updateInventory(); + event.setCancelled(true); + } + } } if (event.getEntity() instanceof Player && ess.getUser(event.getEntity()).isGodModeEnabled()) { diff --git a/Essentials/src/com/earth2me/essentials/FakeWorld.java b/Essentials/src/com/earth2me/essentials/FakeWorld.java index c22a04c5a..0032b6845 100644 --- a/Essentials/src/com/earth2me/essentials/FakeWorld.java +++ b/Essentials/src/com/earth2me/essentials/FakeWorld.java @@ -1,5 +1,6 @@ package com.earth2me.essentials; +import java.io.File; import java.util.List; import java.util.UUID; import org.bukkit.*; @@ -514,5 +515,11 @@ public class FakeWorld implements World public int getSeaLevel() { throw new UnsupportedOperationException("Not supported yet."); - } + } + + @Override + public File getWorldFolder() + { + throw new UnsupportedOperationException("Not supported yet."); + } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java index f3f5ce2ef..43b0b8ffa 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java @@ -20,7 +20,7 @@ public class Commandspawnmob extends EssentialsCommand { super("spawnmob"); } - + @Override public void run(Server server, User user, String commandLabel, String[] args) throws Exception { @@ -29,8 +29,8 @@ public class Commandspawnmob extends EssentialsCommand throw new NotEnoughArgumentsException(); //TODO: user.sendMessage("§7Mobs: Zombie PigZombie Skeleton Slime Chicken Pig Monster Spider Creeper Ghast Squid Giant Cow Sheep Wolf"); } - - + + String[] mountparts = args[0].split(","); String[] parts = mountparts[0].split(":"); String mobType = parts[0]; @@ -50,24 +50,24 @@ public class Commandspawnmob extends EssentialsCommand mountData = parts[1]; } } - - + + Entity spawnedMob = null; Mob mob = null; Entity spawnedMount = null; Mob mobMount = null; - + mob = Mob.fromName(mobType); if (mob == null) { throw new Exception(_("invalidMob")); } - + if (ess.getSettings().getProtectPreventSpawn(mob.getType().toString().toLowerCase(Locale.ENGLISH))) { throw new Exception(_("unableToSpawnMob")); } - + final Block block = Util.getTarget(user).getBlock(); if (block == null) { @@ -83,7 +83,7 @@ public class Commandspawnmob extends EssentialsCommand { throw new Exception(_("unableToSpawnMob")); } - + if (mountType != null) { mobMount = Mob.fromName(mountType); @@ -92,7 +92,7 @@ public class Commandspawnmob extends EssentialsCommand user.sendMessage(_("invalidMob")); return; } - + if (ess.getSettings().getProtectPreventSpawn(mobMount.getType().toString().toLowerCase(Locale.ENGLISH))) { throw new Exception(_("unableToSpawnMob")); @@ -124,7 +124,7 @@ public class Commandspawnmob extends EssentialsCommand mobCount = serverLimit; user.sendMessage(_("mobSpawnLimit")); } - + try { for (int i = 1; i < mobCount; i++) @@ -171,7 +171,7 @@ public class Commandspawnmob extends EssentialsCommand user.sendMessage(mob.name + " " + _("spawned")); } } - + private void changeMobData(String type, Entity spawned, String data, User user) throws Exception { if ("Slime".equalsIgnoreCase(type)) @@ -185,6 +185,15 @@ public class Commandspawnmob extends EssentialsCommand throw new Exception(_("slimeMalformedSize"), e); } } + if (("Sheep".equalsIgnoreCase(type) + || "Cow".equalsIgnoreCase(type) + || "Chicken".equalsIgnoreCase(type) + || "Pig".equalsIgnoreCase(type)) + && data.equalsIgnoreCase("baby")) + { + ((Animals)spawned).setAge(-24000); + return; + } if ("Sheep".equalsIgnoreCase(type)) { try diff --git a/Essentials/test/com/earth2me/essentials/FakeServer.java b/Essentials/test/com/earth2me/essentials/FakeServer.java index 78b5380a6..22a8f0224 100644 --- a/Essentials/test/com/earth2me/essentials/FakeServer.java +++ b/Essentials/test/com/earth2me/essentials/FakeServer.java @@ -586,4 +586,10 @@ public class FakeServer implements Server { return "Essentials Fake-Server"; } + + @Override + public File getWorldContainer() + { + throw new UnsupportedOperationException("Not supported yet."); + } } diff --git a/lib/bukkit-1.0.0-R1-SNAPSHOT.jar b/lib/bukkit-1.0.0-R1-SNAPSHOT.jar index 94831e77b..3056d9e59 100644 Binary files a/lib/bukkit-1.0.0-R1-SNAPSHOT.jar and b/lib/bukkit-1.0.0-R1-SNAPSHOT.jar differ diff --git a/lib/craftbukkit-1.0.0-SNAPSHOT.jar b/lib/craftbukkit-1.0.0-SNAPSHOT.jar index 208cc9bb3..5e1e9c101 100644 Binary files a/lib/craftbukkit-1.0.0-SNAPSHOT.jar and b/lib/craftbukkit-1.0.0-SNAPSHOT.jar differ -- cgit v1.2.3 From 03452bda689940f0144f27351099906b9ad7f422 Mon Sep 17 00:00:00 2001 From: snowleo Date: Fri, 25 Nov 2011 05:54:32 +0100 Subject: Baby wolfs, awwwwh --- .../essentials/commands/Commandspawnmob.java | 27 +++++++++++----------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java index 43b0b8ffa..e0e08e6fd 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java @@ -20,7 +20,7 @@ public class Commandspawnmob extends EssentialsCommand { super("spawnmob"); } - + @Override public void run(Server server, User user, String commandLabel, String[] args) throws Exception { @@ -29,8 +29,8 @@ public class Commandspawnmob extends EssentialsCommand throw new NotEnoughArgumentsException(); //TODO: user.sendMessage("§7Mobs: Zombie PigZombie Skeleton Slime Chicken Pig Monster Spider Creeper Ghast Squid Giant Cow Sheep Wolf"); } - - + + String[] mountparts = args[0].split(","); String[] parts = mountparts[0].split(":"); String mobType = parts[0]; @@ -50,24 +50,24 @@ public class Commandspawnmob extends EssentialsCommand mountData = parts[1]; } } - - + + Entity spawnedMob = null; Mob mob = null; Entity spawnedMount = null; Mob mobMount = null; - + mob = Mob.fromName(mobType); if (mob == null) { throw new Exception(_("invalidMob")); } - + if (ess.getSettings().getProtectPreventSpawn(mob.getType().toString().toLowerCase(Locale.ENGLISH))) { throw new Exception(_("unableToSpawnMob")); } - + final Block block = Util.getTarget(user).getBlock(); if (block == null) { @@ -83,7 +83,7 @@ public class Commandspawnmob extends EssentialsCommand { throw new Exception(_("unableToSpawnMob")); } - + if (mountType != null) { mobMount = Mob.fromName(mountType); @@ -92,7 +92,7 @@ public class Commandspawnmob extends EssentialsCommand user.sendMessage(_("invalidMob")); return; } - + if (ess.getSettings().getProtectPreventSpawn(mobMount.getType().toString().toLowerCase(Locale.ENGLISH))) { throw new Exception(_("unableToSpawnMob")); @@ -124,7 +124,7 @@ public class Commandspawnmob extends EssentialsCommand mobCount = serverLimit; user.sendMessage(_("mobSpawnLimit")); } - + try { for (int i = 1; i < mobCount; i++) @@ -171,7 +171,7 @@ public class Commandspawnmob extends EssentialsCommand user.sendMessage(mob.name + " " + _("spawned")); } } - + private void changeMobData(String type, Entity spawned, String data, User user) throws Exception { if ("Slime".equalsIgnoreCase(type)) @@ -188,7 +188,8 @@ public class Commandspawnmob extends EssentialsCommand if (("Sheep".equalsIgnoreCase(type) || "Cow".equalsIgnoreCase(type) || "Chicken".equalsIgnoreCase(type) - || "Pig".equalsIgnoreCase(type)) + || "Pig".equalsIgnoreCase(type) + || "Wolf".equalsIgnoreCase(type)) && data.equalsIgnoreCase("baby")) { ((Animals)spawned).setAge(-24000); -- cgit v1.2.3 From 73d13f574899819ef345e2ae1128bcb8a799c9d1 Mon Sep 17 00:00:00 2001 From: snowleo Date: Fri, 25 Nov 2011 06:04:19 +0100 Subject: Oh no! Angry wolf babies D: --- .../com/earth2me/essentials/commands/Commandspawnmob.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java index e0e08e6fd..eb26d29b1 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java @@ -214,16 +214,26 @@ public class Commandspawnmob extends EssentialsCommand throw new Exception(_("sheepMalformedColor"), e); } } - if ("Wolf".equalsIgnoreCase(type) && data.equalsIgnoreCase("tamed")) + if ("Wolf".equalsIgnoreCase(type) + && data.toLowerCase(Locale.ENGLISH).startsWith("tamed")) { final Wolf wolf = ((Wolf)spawned); wolf.setTamed(true); wolf.setOwner(user); wolf.setSitting(true); + if (data.equalsIgnoreCase("tamedbaby")) + { + ((Animals)spawned).setAge(-24000); + } } - if ("Wolf".equalsIgnoreCase(type) && data.equalsIgnoreCase("angry")) + if ("Wolf".equalsIgnoreCase(type) + && data.toLowerCase(Locale.ENGLISH).startsWith("angry")) { ((Wolf)spawned).setAngry(true); + if (data.equalsIgnoreCase("angrybaby")) + { + ((Animals)spawned).setAge(-24000); + } } if ("Creeper".equalsIgnoreCase(type) && data.equalsIgnoreCase("powered")) { -- cgit v1.2.3 From 871c0e6b6a1cf8998c92171b5ab42ebb8edb011e Mon Sep 17 00:00:00 2001 From: snowleo Date: Fri, 25 Nov 2011 07:12:21 +0100 Subject: Disable god mode automatically in worlds defined by config --- .../src/com/earth2me/essentials/Essentials.java | 1 + .../essentials/EssentialsPlayerListener.java | 11 +++++++++++ .../src/com/earth2me/essentials/ISettings.java | 20 +++++++++++--------- Essentials/src/com/earth2me/essentials/Settings.java | 12 ++++++++++++ Essentials/src/com/earth2me/essentials/User.java | 10 ++++++++-- Essentials/src/config.yml | 4 ++++ Essentials/src/messages.properties | 1 + Essentials/src/messages_da.properties | 1 + Essentials/src/messages_de.properties | 1 + Essentials/src/messages_en.properties | 1 + Essentials/src/messages_es.properties | 1 + Essentials/src/messages_fr.properties | 1 + Essentials/src/messages_nl.properties | 1 + 13 files changed, 54 insertions(+), 11 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java index c74ce7312..9679aa64e 100644 --- a/Essentials/src/com/earth2me/essentials/Essentials.java +++ b/Essentials/src/com/earth2me/essentials/Essentials.java @@ -181,6 +181,7 @@ public class Essentials extends JavaPlugin implements IEssentials pm.registerEvent(Type.PLAYER_EGG_THROW, playerListener, Priority.High, this); pm.registerEvent(Type.PLAYER_BUCKET_EMPTY, playerListener, Priority.High, this); pm.registerEvent(Type.PLAYER_ANIMATION, playerListener, Priority.High, this); + pm.registerEvent(Type.PLAYER_CHANGED_WORLD, playerListener, Priority.Normal, this); final EssentialsBlockListener blockListener = new EssentialsBlockListener(this); pm.registerEvent(Type.BLOCK_PLACE, blockListener, Priority.Lowest, this); diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java index cb3be43c7..c6cbfe232 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java @@ -385,4 +385,15 @@ public class EssentialsPlayerListener extends PlayerListener user.updateActivity(true); } } + + @Override + public void onPlayerChangedWorld(PlayerChangedWorldEvent event) + { + if (ess.getSettings().getNoGodWorlds().contains(event.getPlayer().getLocation().getWorld().getName())) { + User user = ess.getUser(event.getPlayer()); + if (user.isGodModeEnabledRaw()) { + user.sendMessage(_("noGodWorldWarning")); + } + } + } } diff --git a/Essentials/src/com/earth2me/essentials/ISettings.java b/Essentials/src/com/earth2me/essentials/ISettings.java index 49a6ebf23..7891190dc 100644 --- a/Essentials/src/com/earth2me/essentials/ISettings.java +++ b/Essentials/src/com/earth2me/essentials/ISettings.java @@ -3,12 +3,12 @@ package com.earth2me.essentials; import com.earth2me.essentials.commands.IEssentialsCommand; import java.util.List; import java.util.Map; +import java.util.Set; import org.bukkit.ChatColor; public interface ISettings extends IConf { - boolean areSignsDisabled(); String format(String format, IUser user); @@ -64,11 +64,11 @@ public interface ISettings extends IConf boolean getReclaimSetting(); boolean getRespawnAtHome(); - + List getMultipleHomes(); - + int getHomeLimit(String set); - + int getHomeLimit(User user); boolean getSortListByGroups(); @@ -110,11 +110,11 @@ public interface ISettings extends IConf boolean warnOnBuildDisallow(); boolean warnOnSmite(); - + double getMaxMoney(); boolean isEcoLogEnabled(); - + boolean removeGodOnDisconnect(); boolean changeDisplayName(); @@ -124,9 +124,9 @@ public interface ISettings extends IConf boolean useBukkitPermissions(); boolean addPrefixSuffix(); - + boolean disablePrefix(); - + boolean disableSuffix(); long getAutoAfk(); @@ -134,8 +134,10 @@ public interface ISettings extends IConf long getAutoAfkKick(); boolean getFreezeAfkPlayers(); - + boolean areDeathMessagesEnabled(); public void setDebug(boolean debug); + + Set getNoGodWorlds(); } diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java index b004925e6..47a102326 100644 --- a/Essentials/src/com/earth2me/essentials/Settings.java +++ b/Essentials/src/com/earth2me/essentials/Settings.java @@ -4,9 +4,12 @@ import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.commands.IEssentialsCommand; import java.io.File; import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; import org.bukkit.ChatColor; @@ -341,6 +344,7 @@ public class Settings implements ISettings public void reloadConfig() { config.load(); + noGodWorlds = new HashSet(config.getStringList("no-god-in-worlds",Collections.emptyList())); } @Override @@ -543,6 +547,14 @@ public class Settings implements ISettings { return config.getBoolean("death-messages", true); } + + Set noGodWorlds = new HashSet(); + @Override + public Set getNoGodWorlds() + { + return noGodWorlds; + + } @Override public void setDebug(final boolean debug) diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java index e58cbfb50..3c1166240 100644 --- a/Essentials/src/com/earth2me/essentials/User.java +++ b/Essentials/src/com/earth2me/essentials/User.java @@ -513,14 +513,20 @@ public class User extends UserData implements Comparable, IReplyTo, IUser @Override public boolean isGodModeEnabled() { - return super.isGodModeEnabled() || (isAfk() && ess.getSettings().getFreezeAfkPlayers()); + return (super.isGodModeEnabled() && !ess.getSettings().getNoGodWorlds().contains(getLocation().getWorld().getName())) + || (isAfk() && ess.getSettings().getFreezeAfkPlayers()); } + public boolean isGodModeEnabledRaw() + { + return super.isGodModeEnabled(); + } + public String getGroup() { return ess.getPermissionsHandler().getGroup(base); } - + public boolean inGroup(final String group) { return ess.getPermissionsHandler().inGroup(base, group); diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml index b063d1e41..de53ebbcf 100644 --- a/Essentials/src/config.yml +++ b/Essentials/src/config.yml @@ -229,6 +229,10 @@ freeze-afk-players: false # You can disable the death messages of minecraft here death-messages: true +# Add worlds to this list, if you want to automatically disable god mode there +no-god-in-worlds: +# - world_nether + ############################################################ # +------------------------------------------------------+ # # | EssentialsHome | # diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index cfbf33f5b..fdbe917df 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -196,6 +196,7 @@ nickSet=\u00a77Your nickname is now \u00a7c{0} noAccessCommand=\u00a7cYou do not have access to that command. noAccessPermission=\u00a7cYou do not have permission to access that {0}. noDestroyPermission=\u00a7cYou do not have permission to destroy that {0}. +noGodWorldWarning=\u00a7cWarning! God mode in this world disabled. noHelpFound=\u00a7cNo matching commands. noHomeSet=You have not set a home. noHomeSetPlayer=Player has not set a home. diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties index 0650019ce..dd2ee3b97 100644 --- a/Essentials/src/messages_da.properties +++ b/Essentials/src/messages_da.properties @@ -197,6 +197,7 @@ noAccessCommand=\u00a7cDu har ikke adgang til den kommando. noAccessPermission=\u00a7cDu har ikke tilladelse til at f\u00e5 adgang til det {0}. noDestroyPermission=\u00a7cDu har ikke tilladelse til at \u00f8del\u00e6gge det {0}. noHelpFound=\u00a7cNo matching commands. +noGodWorldWarning=\u00a7cWarning! God mode in this world disabled. noHomeSet=Du har sat et nyt hjem. noHomeSetPlayer=Spiller har ikke sat et hjem. noKitPermission=\u00a7cDu har brug for \u00a7c{0}\u00a7c tilladelsen for at bruge den pakke. diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties index 609618a68..d14141507 100644 --- a/Essentials/src/messages_de.properties +++ b/Essentials/src/messages_de.properties @@ -196,6 +196,7 @@ nickSet=\u00a77Dein Nickname ist nun \u00a7c{0} noAccessCommand=\u00a7cDu hast keinen Zugriff auf diesen Befehl. noAccessPermission=\u00a7cDu hast keine Rechte, den Block {0} zu \u00f6ffnen. noDestroyPermission=\u00a7cDu hast keine Rechte, den Block {0} zu zerst\u00f6ren. +noGodWorldWarning=\u00a7cWarning! God mode in this world disabled. noHelpFound=\u00a7cKeine \u00fcbereinstimmenden Kommandos. noHomeSet=Du hast kein Zuhause gesetzt. noHomeSetPlayer=Spieler hat kein Zuhause gesetzt. diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties index a78dfe94f..8843cf194 100644 --- a/Essentials/src/messages_en.properties +++ b/Essentials/src/messages_en.properties @@ -196,6 +196,7 @@ nickSet=\u00a77Your nickname is now \u00a7c{0} noAccessCommand=\u00a7cYou do not have access to that command. noAccessPermission=\u00a7cYou do not have permission to access that {0}. noDestroyPermission=\u00a7cYou do not have permission to destroy that {0}. +noGodWorldWarning=\u00a7cWarning! God mode in this world disabled. noHelpFound=\u00a7cNo matching commands. noHomeSet=You have not set a home. noHomeSetPlayer=Player has not set a home. diff --git a/Essentials/src/messages_es.properties b/Essentials/src/messages_es.properties index ae3156d86..95fda63ac 100644 --- a/Essentials/src/messages_es.properties +++ b/Essentials/src/messages_es.properties @@ -196,6 +196,7 @@ nickSet=\u00a77Tu nombre es ahora \u00a7c{0} noAccessCommand=\u00a7cNo tienes acceso a ese comando. noAccessPermission=\u00a7cNo tienes permisos para hacer eso {0}. noDestroyPermission=\u00a7cNo tienes permisos para destrozar eso {0}. +noGodWorldWarning=\u00a7cWarning! God mode in this world disabled. noHelpFound=\u00a7cNo hay comandos relacionados. noHomeSet=No has establecido un hogar. noHomeSetPlayer=El jugador no ha establecido un hogar. diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties index df51d80d3..f64968250 100644 --- a/Essentials/src/messages_fr.properties +++ b/Essentials/src/messages_fr.properties @@ -196,6 +196,7 @@ nickSet=\u00a77Votre pseudo est maintenant \u00a7c{0} noAccessCommand=\u00a7cVous n''avez pas acc\u00e8s \u00e0 cette commande. noAccessPermission=\u00a7cVous n''avez pas la permissions d''acc\u00e9der \u00e0 cette {0} noDestroyPermission=\u00a7cVous n''avez pas la permission de d\u00e9truire ce {0}. +noGodWorldWarning=\u00a7cWarning! God mode in this world disabled. noHelpFound=\u00a7cNo matching commands. noHomeSet=Vous n''avez pas d\u00e9fini de home. noHomeSetPlayer=Le joueur n''a pas d\u00e9fini son home. diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties index 1fe0ab01f..5907a1047 100644 --- a/Essentials/src/messages_nl.properties +++ b/Essentials/src/messages_nl.properties @@ -196,6 +196,7 @@ nickSet=\u00a77Je nickname is nu \u00a7c{0} noAccessCommand=\u00a7cJe hebt geen toegang tot die opdracht. noAccessPermission=\u00a7cJe hebt hier geen toegang voor {0}. noDestroyPermission=\u00a7cJe hebt geen toegang om dat te vernietigen {0}. +noGodWorldWarning=\u00a7cWarning! God mode in this world disabled. noHelpFound=\u00a7cNo matching commands. noHomeSet=Je hebt geen home gemaakt. noHomeSetPlayer=Speler heeft geen home. -- cgit v1.2.3 From 7afbad3218e99509ca8fec653c4fcef41949ed0e Mon Sep 17 00:00:00 2001 From: snowleo Date: Fri, 25 Nov 2011 13:03:07 +0100 Subject: This config option is never read --- Essentials/src/config.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml index de53ebbcf..cf39007e3 100644 --- a/Essentials/src/config.yml +++ b/Essentials/src/config.yml @@ -76,9 +76,6 @@ permission-based-item-spawn: false # HOWEVER, it is known to cause lag upon users logging OUT, so beware! reclaim-onlogout: false -# Should primitive spawn protection be enabled? For most servers, this should be flase; it is better to use a third-party plugin to protect it. -spawn-protection: false - # Mob limit on spawnmob spawnmob-limit: 10 -- cgit v1.2.3 From 223028f306b0021f83de38d8a0770fdc82579d8c Mon Sep 17 00:00:00 2001 From: snowleo Date: Fri, 25 Nov 2011 13:55:09 +0100 Subject: Fix another NPE in AlternativeCommandsHandler --- .../src/com/earth2me/essentials/AlternativeCommandsHandler.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Essentials/src/com/earth2me/essentials/AlternativeCommandsHandler.java b/Essentials/src/com/earth2me/essentials/AlternativeCommandsHandler.java index 583401a55..5fc2e23de 100644 --- a/Essentials/src/com/earth2me/essentials/AlternativeCommandsHandler.java +++ b/Essentials/src/com/earth2me/essentials/AlternativeCommandsHandler.java @@ -42,7 +42,11 @@ public class AlternativeCommandsHandler PluginCommand reg = ess.getServer().getPluginCommand(pluginName + ":" + pc.getName().toLowerCase(Locale.ENGLISH)); if (reg == null) { - reg = Bukkit.getServer().getPluginCommand(pc.getName().toLowerCase(Locale.ENGLISH)); + reg = ess.getServer().getPluginCommand(pc.getName().toLowerCase(Locale.ENGLISH)); + } + if (reg == null) + { + continue; } for (String label : labels) { -- cgit v1.2.3 From 3daf56c8bea5280c05c7791a700b84bb2abbddaf Mon Sep 17 00:00:00 2001 From: snowleo Date: Fri, 25 Nov 2011 14:02:40 +0100 Subject: Another safety check --- Essentials/src/com/earth2me/essentials/AlternativeCommandsHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Essentials/src/com/earth2me/essentials/AlternativeCommandsHandler.java b/Essentials/src/com/earth2me/essentials/AlternativeCommandsHandler.java index 5fc2e23de..a9291e629 100644 --- a/Essentials/src/com/earth2me/essentials/AlternativeCommandsHandler.java +++ b/Essentials/src/com/earth2me/essentials/AlternativeCommandsHandler.java @@ -44,7 +44,7 @@ public class AlternativeCommandsHandler { reg = ess.getServer().getPluginCommand(pc.getName().toLowerCase(Locale.ENGLISH)); } - if (reg == null) + if (reg == null || !reg.getPlugin().equals(plugin)) { continue; } -- cgit v1.2.3 From 24a60734885deb8128a9640d26e49e173b065a56 Mon Sep 17 00:00:00 2001 From: ElgarL Date: Fri, 25 Nov 2011 15:49:35 +0000 Subject: Fix superperms to pass all tests http://dev.bukkit.org/server-mods/superpermstest/ --- EssentialsGroupManager/src/Changelog.txt | 3 +- .../permissions/AnjoPermissionsHandler.java | 74 ++- .../permissions/BukkitPermissions.java | 522 +++++++++++---------- 3 files changed, 340 insertions(+), 259 deletions(-) diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index d12f96cda..d942a470e 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -76,4 +76,5 @@ v 1.5: v 1.6: - Prevent Group.equals tests throwing a NullPointerException for GlobalGroups. - Stop throwing errors on an empty users file. - - Optimize sorting to speedup permission tests. \ No newline at end of file + - Optimize sorting to speedup permission tests. + - Fix superperms to pass all tests http://dev.bukkit.org/server-mods/superpermstest/ \ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java index 9387f13ac..acfc65232 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java @@ -97,43 +97,59 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { @Override public List getAllPlayersPermissions(String userName) { - List playerPermArray = new ArrayList(ph.getUser(userName).getPermissionList()); - + List playerPermArray = new ArrayList(); + + for (String perm : ph.getUser(userName).getPermissionList()) { + if ((!playerPermArray.contains(perm)) && (!playerPermArray.contains("-" + perm))) { + playerPermArray.add(perm); + + Map children = GroupManager.BukkitPermissions.getAllChildren(perm, playerPermArray); + + if (children != null) { + for (String child : children.keySet()) { + if (children.get(child)) + if ((!playerPermArray.contains(child)) && (!playerPermArray.contains("-" + child))) { + playerPermArray.add(child); + } + } + } + } + } for (String group : getGroups(userName)) { if (group.startsWith("g:") && GroupManager.getGlobalGroups().hasGroup(group)) { for (String perm : GroupManager.getGlobalGroups().getGroupsPermissions(group)) { if ((!playerPermArray.contains(perm)) && (!playerPermArray.contains("-" + perm))) { playerPermArray.add(perm); - Map children = GroupManager.BukkitPermissions.getChildren(perm); + Map children = GroupManager.BukkitPermissions.getAllChildren(perm, playerPermArray); if (children != null) { for (String child : children.keySet()) { if (children.get(child)) - if ((!playerPermArray.contains(perm)) && (!playerPermArray.contains("-" + perm))) + if ((!playerPermArray.contains(child)) && (!playerPermArray.contains("-" + child))) playerPermArray.add(child); } } } } - } else { for (String perm : ph.getGroup(group).getPermissionList()) { if ((!playerPermArray.contains(perm)) && (!playerPermArray.contains("-" + perm))) { playerPermArray.add(perm); - - Map children = GroupManager.BukkitPermissions.getChildren(perm); + + Map children = GroupManager.BukkitPermissions.getAllChildren(perm, playerPermArray); if (children != null) { for (String child : children.keySet()) { if (children.get(child)) - if ((!playerPermArray.contains(perm)) && (!playerPermArray.contains("-" + perm))) + if ((!playerPermArray.contains(child)) && (!playerPermArray.contains("-" + child))) { playerPermArray.add(child); + } } } - } } } } + //Collections.sort(playerPermArray, StringPermissionComparator.getInstance()); return playerPermArray; } @@ -670,8 +686,22 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { * @return PermissionCheckResult */ public PermissionCheckResult checkFullUserPermission(User user, String targetPermission) { + + return checkFullGMPermission(user, targetPermission, true); + } + + /** + * Check user and groups with inheritance and Bukkit if bukkit = true + * return a PermissionCheckResult. + * + * @param user + * @param targetPermission + * @param checkBukkit + * @return PermissionCheckResult + */ + public PermissionCheckResult checkFullGMPermission(User user, String targetPermission, Boolean checkBukkit) { PermissionCheckResult result = new PermissionCheckResult(); - result.askedPermission = targetPermission; + result.accessLevel = targetPermission; result.resultType = PermissionCheckResult.Type.NOTFOUND; if (user == null || targetPermission == null || targetPermission.isEmpty()) { @@ -697,12 +727,14 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { } } - // Check Bukkit perms to support plugins which add perms via code (Heroes). - final Player player = Bukkit.getPlayer(user.getName()); - if ((player != null) && (player.hasPermission(targetPermission))) { - result.resultType = PermissionCheckResult.Type.FOUND; - result.owner = user; - return result; + if (checkBukkit == true) { + // Check Bukkit perms to support plugins which add perms via code (Heroes). + final Player player = Bukkit.getPlayer(user.getName()); + if ((player != null) && (player.hasPermission(targetPermission))) { + result.resultType = PermissionCheckResult.Type.FOUND; + result.owner = user; + return result; + } } // THEN IT RETURNS A NOT FOUND @@ -960,7 +992,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { * Every '-' or '+' in the beginning is ignored. It will match only node * names. * - * @param userAcessLevel + * @param userAccessLevel * @param fullPermissionName * @return true if found a matching token. false if not. */ @@ -986,9 +1018,11 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { } if (userAccessLevel.charAt(userAccessLevel.length() - 1) == '*') { - userAccessLevelLength--; - } - return userAccessLevel.regionMatches(true, userAccessLevelOffset, fullPermissionName, fullPermissionNameOffset, userAccessLevelLength - userAccessLevelOffset); + return userAccessLevel.regionMatches(true, userAccessLevelOffset, fullPermissionName, fullPermissionNameOffset, userAccessLevelLength - userAccessLevelOffset - 1); + } else { + return userAccessLevel.regionMatches(true, userAccessLevelOffset, fullPermissionName, fullPermissionNameOffset, + Math.max(userAccessLevelLength - userAccessLevelOffset, fullPermissionName.length() - fullPermissionNameOffset)); + } } diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java index abfb73bfd..202e27e3a 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java @@ -18,14 +18,14 @@ package org.anjocaido.groupmanager.permissions; import java.util.ArrayList; import java.util.HashMap; -import java.util.HashSet; +import java.util.LinkedList; import java.util.List; import java.util.Map; -import java.util.Set; import org.anjocaido.groupmanager.GroupManager; import org.anjocaido.groupmanager.data.User; import org.anjocaido.groupmanager.dataholder.OverloadedWorldHolder; +import org.anjocaido.groupmanager.utils.PermissionCheckResult; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -49,246 +49,292 @@ import org.bukkit.plugin.PluginManager; /** - * + * * BukkitPermissions overrides to force GM reponses to Superperms - * + * * @author ElgarL, based upon PermissionsEX implementation */ public class BukkitPermissions { - protected Map attachments = new HashMap(); - protected Set registeredPermissions = new HashSet(); - protected GroupManager plugin; - protected boolean dumpAllPermissions = true; - protected boolean dumpMatchedPermissions = true; - public boolean player_join = false; - - public BukkitPermissions(GroupManager plugin) { - this.plugin = plugin; - - this.collectPermissions(); - this.registerEvents(); - - this.updateAllPlayers(); - - GroupManager.logger.info("Superperms support enabled."); - } - - private void registerEvents() { - PluginManager manager = plugin.getServer().getPluginManager(); - - PlayerEvents playerEventListener = new PlayerEvents(); - - manager.registerEvent(Event.Type.PLAYER_JOIN, playerEventListener, Event.Priority.Lowest, plugin); - manager.registerEvent(Event.Type.PLAYER_KICK, playerEventListener, Event.Priority.Lowest, plugin); - manager.registerEvent(Event.Type.PLAYER_QUIT, playerEventListener, Event.Priority.Lowest, plugin); - - manager.registerEvent(Event.Type.PLAYER_RESPAWN, playerEventListener, Event.Priority.Lowest, plugin); - manager.registerEvent(Event.Type.PLAYER_TELEPORT, playerEventListener, Event.Priority.Lowest, plugin); - manager.registerEvent(Event.Type.PLAYER_PORTAL, playerEventListener, Event.Priority.Lowest, plugin); - - ServerListener serverListener = new BukkitEvents(); - - manager.registerEvent(Event.Type.PLUGIN_ENABLE, serverListener, Event.Priority.Normal, plugin); - manager.registerEvent(Event.Type.PLUGIN_DISABLE, serverListener, Event.Priority.Normal, plugin); - } - - public void collectPermissions() { - registeredPermissions.clear(); - for (Plugin bukkitPlugin : Bukkit.getServer().getPluginManager().getPlugins()) { - for(Permission permission : bukkitPlugin.getDescription().getPermissions()) - registeredPermissions.add(permission); - } - } - - public void updatePermissions(Player player){ - this.updatePermissions(player, null); - } - - public void updatePermissions(Player player, String world) { - if (player == null || !GroupManager.isLoaded()) { - return; - } - - if (!this.attachments.containsKey(player)) { - this.attachments.put(player, player.addAttachment(plugin)); - } - - if(world == null){ - world = player.getWorld().getName(); - } - - // All permissions registered with Bukkit for this player - PermissionAttachment attachment = this.attachments.get(player); - - OverloadedWorldHolder worldData = plugin.getWorldsHolder().getWorldData(world); - - User user = worldData.getUser(player.getName()); - - // clear permissions - for (String permission : attachment.getPermissions().keySet()) - attachment.unsetPermission(permission); - - /* - * find matching permissions - * - * and base bukkit perms if we are set to allow bukkit permissions to override. - */ - Boolean value; - for (Permission permission : registeredPermissions) { - - value = worldData.getPermissionsHandler().checkUserPermission(user, permission.getName()); - - // Only check bukkit override IF we don't have the permission directly. - if (value = false) { - PermissionDefault permDefault = permission.getDefault(); - - if ((plugin.getGMConfig().isBukkitPermsOverride()) - && ((permDefault == PermissionDefault.TRUE) - || ((permDefault == PermissionDefault.NOT_OP) && !player.isOp()) - || ((permDefault == PermissionDefault.OP) && player.isOp()))) - value = true; - } - - if (value == true){ - // Set the root permission - attachment.setPermission(permission, value); - // fetch and set all children of this permission node - Map children = permission.getChildren(); - if (children != null) { - for (String child : children.keySet()) { - if (children.get(child)) - attachment.setPermission(child, true); - } - } - - } - } - - // Add any missing permissions for this player (non bukkit plugins) - List playerPermArray = new ArrayList(worldData.getPermissionsHandler().getAllPlayersPermissions(player.getName())); - - for (String permission : playerPermArray) { - value = true; - if (permission.startsWith("-")) { - permission = permission.substring(1); // cut off - - value = false; - } - - if (!attachment.getPermissions().containsKey(permission)) { - attachment.setPermission(permission, value); - } - } - player.recalculatePermissions(); - } - - /** - * Returns a map of the child permissions as defined by the supplying plugin - * null is empty - * - * @param node - * @return Map of child permissions - */ - public Map getChildren(String node) { - for (Permission permission : registeredPermissions) { - if (permission.getName() == node) { - return permission.getChildren(); - } - } - return null; - } - - public List listPerms(Player player) { - List perms = new ArrayList(); - - /* - // All permissions registered with Bukkit for this player - PermissionAttachment attachment = this.attachments.get(player); - - // List perms for this player - perms.add("Attachment Permissions:"); - for(Map.Entry entry : attachment.getPermissions().entrySet()){ - perms.add(" " + entry.getKey() + " = " + entry.getValue()); - } - */ - - perms.add("Effective Permissions:"); - for(PermissionAttachmentInfo info : player.getEffectivePermissions()){ - if (info.getValue() == true) - perms.add(" " + info.getPermission() + " = " + info.getValue()); - } - return perms; - } - - public void updateAllPlayers() { - for (Player player : Bukkit.getServer().getOnlinePlayers()) { - updatePermissions(player); - } - } - - protected class PlayerEvents extends PlayerListener { - - @Override - public void onPlayerJoin(PlayerJoinEvent event) { - player_join = true; - Player player = event.getPlayer(); - //force GM to create the player if they are not already listed. - if (plugin.getWorldsHolder().getWorldData(player.getWorld().getName()).getUser(player.getName()) != null) { - player_join = false; - updatePermissions(event.getPlayer()); - } else - player_join = false; - } - - @Override - 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()); - } - } - - @Override - public void onPlayerRespawn(PlayerRespawnEvent event) { // can be respawned in another world - updatePermissions(event.getPlayer(), event.getRespawnLocation().getWorld().getName()); - } - - @Override - public void onPlayerTeleport(PlayerTeleportEvent event) { // can be teleported 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()); - } - } - - @Override - public void onPlayerQuit(PlayerQuitEvent event) { - if (!GroupManager.isLoaded()) - return; - - attachments.remove(event.getPlayer()); - } - - @Override - public void onPlayerKick(PlayerKickEvent event) { - attachments.remove(event.getPlayer()); - } - } - - protected class BukkitEvents extends ServerListener { - - @Override - public void onPluginEnable(PluginEnableEvent event) { - if (!GroupManager.isLoaded()) - return; - - collectPermissions(); - updateAllPlayers(); - } - - @Override - public void onPluginDisable(PluginDisableEvent event) { - //collectPermissions(); - //updateAllPlayers(); - } - } + protected Map attachments = new HashMap(); + protected LinkedList registeredPermissions = new LinkedList(); + protected GroupManager plugin; + protected boolean dumpAllPermissions = true; + protected boolean dumpMatchedPermissions = true; + public boolean player_join = false; + + public BukkitPermissions(GroupManager plugin) { + this.plugin = plugin; + + this.collectPermissions(); + this.registerEvents(); + + this.updateAllPlayers(); + + GroupManager.logger.info("Superperms support enabled."); + } + + private void registerEvents() { + PluginManager manager = plugin.getServer().getPluginManager(); + + PlayerEvents playerEventListener = new PlayerEvents(); + + manager.registerEvent(Event.Type.PLAYER_JOIN, playerEventListener, Event.Priority.Lowest, plugin); + manager.registerEvent(Event.Type.PLAYER_KICK, playerEventListener, Event.Priority.Lowest, plugin); + manager.registerEvent(Event.Type.PLAYER_QUIT, playerEventListener, Event.Priority.Lowest, plugin); + + manager.registerEvent(Event.Type.PLAYER_RESPAWN, playerEventListener, Event.Priority.Lowest, plugin); + manager.registerEvent(Event.Type.PLAYER_TELEPORT, playerEventListener, Event.Priority.Lowest, plugin); + manager.registerEvent(Event.Type.PLAYER_PORTAL, playerEventListener, Event.Priority.Lowest, plugin); + + ServerListener serverListener = new BukkitEvents(); + + manager.registerEvent(Event.Type.PLUGIN_ENABLE, serverListener, Event.Priority.Normal, plugin); + manager.registerEvent(Event.Type.PLUGIN_DISABLE, serverListener, Event.Priority.Normal, plugin); + } + + public void collectPermissions() { + registeredPermissions.clear(); + for (Plugin bukkitPlugin : Bukkit.getServer().getPluginManager().getPlugins()) { + for (Permission permission : bukkitPlugin.getDescription().getPermissions()) + registeredPermissions.push(permission); + } + } + + public void updatePermissions(Player player) { + this.updatePermissions(player, null); + } + + public void updatePermissions(Player player, String world) { + if (player == null || !GroupManager.isLoaded()) { + return; + } + + if (!this.attachments.containsKey(player)) { + this.attachments.put(player, player.addAttachment(plugin)); + } + + if (world == null) { + world = player.getWorld().getName(); + } + + // All permissions registered with Bukkit for this player + PermissionAttachment attachment = this.attachments.get(player); + + OverloadedWorldHolder worldData = plugin.getWorldsHolder().getWorldData(world); + + User user = worldData.getUser(player.getName()); + + // clear permissions + for (String permission : attachment.getPermissions().keySet()) + attachment.unsetPermission(permission); + + /* + * find matching permissions + * + * and base bukkit perms if we are set to allow bukkit permissions to + * override. + */ + Boolean value = false; + + for (Permission permission : registeredPermissions) { + + PermissionCheckResult result = worldData.getPermissionsHandler().checkFullGMPermission(user, permission.getName(), false); + + // Only check bukkit override IF we don't have the permission + // directly. + if (result.resultType == PermissionCheckResult.Type.NOTFOUND) { + PermissionDefault permDefault = permission.getDefault(); + + if ((plugin.getGMConfig().isBukkitPermsOverride()) && ((permDefault == PermissionDefault.TRUE) + || ((permDefault == PermissionDefault.NOT_OP) && !player.isOp()) + || ((permDefault == PermissionDefault.OP) && player.isOp()))) { + value = true; + } else { + value = false; + } + } else if (result.resultType == PermissionCheckResult.Type.NEGATION) { + value = false; + } else { + value = true; + } + + // Set the root permission + if ((value == true) || (result.resultType == PermissionCheckResult.Type.NEGATION)) { + attachment.setPermission(permission, value); + } + /* + if ((value == true) || (result.resultType == PermissionCheckResult.Type.NOTFOUND)) { + // fetch and set all children of this permission node + Map children = permission.getChildren(); + if (children != null) { + for (String child : children.keySet()) { + if (children.get(child)) + attachment.setPermission(child, value); + } + } + }*/ + + } + + // Add any missing permissions for this player (non bukkit plugins and child nodes) + List playerPermArray = worldData.getPermissionsHandler().getAllPlayersPermissions(player.getName()); + + for (String permission : playerPermArray) { + value = true; + if (permission.startsWith("-")) { + permission = permission.substring(1); // cut off - + value = false; + } + + if (!attachment.getPermissions().containsKey(permission)) { + attachment.setPermission(permission, value); + } + } + player.recalculatePermissions(); + } + + /** + * Returns a map of the ALL child permissions as defined by the supplying plugin + * null is empty + * + * @param node + * @return Map of child permissions + */ + public Map getAllChildren(String node, List playerPermArray) { + + LinkedList stack = new LinkedList(); + Map alreadyVisited = new HashMap(); + stack.push(node); + alreadyVisited.put(node, true); + + while (!stack.isEmpty()) { + String now = stack.pop(); + + Map children = getChildren(now); + + if ((children != null) && (!playerPermArray.contains("-"+now))) { + for (String childName : children.keySet()) { + if (!alreadyVisited.containsKey(childName)) { + stack.push(childName); + alreadyVisited.put(childName, children.get(childName)); + } + } + } + } + alreadyVisited.remove(node); + if (!alreadyVisited.isEmpty()) return alreadyVisited; + + return null; + } + + /** + * Returns a map of the child permissions (1 node deep) as defined by the supplying plugin + * null is empty + * + * @param node + * @return Map of child permissions + */ + public Map getChildren(String node) { + for (Permission permission : registeredPermissions) { + if (permission.getName().equalsIgnoreCase(node)) { + return permission.getChildren(); + } + } + + return null; + } + + public List listPerms(Player player) { + List perms = new ArrayList(); + + /* + * // All permissions registered with Bukkit for this player + * PermissionAttachment attachment = this.attachments.get(player); + * + * // List perms for this player perms.add("Attachment Permissions:"); + * for(Map.Entry entry : + * attachment.getPermissions().entrySet()){ perms.add(" " + + * entry.getKey() + " = " + entry.getValue()); } + */ + + perms.add("Effective Permissions:"); + for (PermissionAttachmentInfo info : player.getEffectivePermissions()) { + if (info.getValue() == true) + perms.add(" " + info.getPermission() + " = " + info.getValue()); + } + return perms; + } + + public void updateAllPlayers() { + for (Player player : Bukkit.getServer().getOnlinePlayers()) { + updatePermissions(player); + } + } + + protected class PlayerEvents extends PlayerListener { + + @Override + public void onPlayerJoin(PlayerJoinEvent event) { + player_join = true; + Player player = event.getPlayer(); + // force GM to create the player if they are not already listed. + if (plugin.getWorldsHolder().getWorldData(player.getWorld().getName()).getUser(player.getName()) != null) { + player_join = false; + updatePermissions(event.getPlayer()); + } else + player_join = false; + } + + @Override + 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()); + } + } + + @Override + public void onPlayerRespawn(PlayerRespawnEvent event) { // can be respawned in another world + updatePermissions(event.getPlayer(), event.getRespawnLocation().getWorld().getName()); + } + + @Override + public void onPlayerTeleport(PlayerTeleportEvent event) { // can be teleported 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()); + } + } + + @Override + public void onPlayerQuit(PlayerQuitEvent event) { + if (!GroupManager.isLoaded()) + return; + + attachments.remove(event.getPlayer()); + } + + @Override + public void onPlayerKick(PlayerKickEvent event) { + attachments.remove(event.getPlayer()); + } + } + + protected class BukkitEvents extends ServerListener { + + @Override + public void onPluginEnable(PluginEnableEvent event) { + if (!GroupManager.isLoaded()) + return; + + collectPermissions(); + updateAllPlayers(); + } + + @Override + public void onPluginDisable(PluginDisableEvent event) { + // collectPermissions(); + // updateAllPlayers(); + } + } } \ No newline at end of file -- cgit v1.2.3 From b41c3709bae6b1ad6f2b6ce9e5494421168c8f5f Mon Sep 17 00:00:00 2001 From: ElgarL Date: Fri, 25 Nov 2011 16:01:46 +0000 Subject: Raised bukkit perms priority --- .../permissions/AnjoPermissionsHandler.java | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java index acfc65232..91c73b5c2 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java @@ -669,7 +669,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { * @return true if permission was found. false if not, or was negated. */ public boolean checkUserPermission(User user, String permission) { - PermissionCheckResult result = checkFullUserPermission(user, permission); + PermissionCheckResult result = checkFullGMPermission(user, permission, true); if (result.resultType.equals(PermissionCheckResult.Type.EXCEPTION) || result.resultType.equals(PermissionCheckResult.Type.FOUND)) { return true; } @@ -708,6 +708,16 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { return result; } + if (checkBukkit == true) { + // Check Bukkit perms to support plugins which add perms via code (Heroes). + final Player player = Bukkit.getPlayer(user.getName()); + if ((player != null) && (player.hasPermission(targetPermission))) { + result.resultType = PermissionCheckResult.Type.FOUND; + result.owner = user; + return result; + } + } + PermissionCheckResult resultUser = checkUserOnlyPermission(user, targetPermission); if (!resultUser.resultType.equals(PermissionCheckResult.Type.NOTFOUND)) { return resultUser; @@ -727,16 +737,6 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { } } - if (checkBukkit == true) { - // Check Bukkit perms to support plugins which add perms via code (Heroes). - final Player player = Bukkit.getPlayer(user.getName()); - if ((player != null) && (player.hasPermission(targetPermission))) { - result.resultType = PermissionCheckResult.Type.FOUND; - result.owner = user; - return result; - } - } - // THEN IT RETURNS A NOT FOUND return result; } -- cgit v1.2.3 From 0cb77d8a03abc0879bec537bd672e09050c16a9e Mon Sep 17 00:00:00 2001 From: ElgarL Date: Fri, 25 Nov 2011 16:34:34 +0000 Subject: Minor optimization for groups --- .../src/org/anjocaido/groupmanager/data/Group.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java index c05065f5e..ba8915a18 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java @@ -7,6 +7,8 @@ package org.anjocaido.groupmanager.data; import org.anjocaido.groupmanager.GroupManager; import org.anjocaido.groupmanager.dataholder.WorldDataHolder; import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import java.util.Map; /** @@ -92,13 +94,13 @@ public class Group extends DataUnit implements Cloneable { } /** - * a COPY of inherits list + * an unmodifiable list of inherits list * You can't manage the list by here * Lol... version 0.6 had a problem because this. * @return the inherits */ - public ArrayList getInherits() { - return new ArrayList(inherits); + public List getInherits() { + return Collections.unmodifiableList(inherits); } /** -- cgit v1.2.3 From b25a8f059b4d383b21d789aefbd3e3273503c0ba Mon Sep 17 00:00:00 2001 From: ElgarL Date: Fri, 25 Nov 2011 19:33:32 +0000 Subject: Optimizations include changing the return of comparePermissionString. --- .../permissions/NijikoPermissionsProxy.java | 4 +- EssentialsGroupManager/src/Changelog.txt | 3 +- .../src/org/anjocaido/groupmanager/data/User.java | 415 +++++++++++---------- .../dataholder/OverloadedWorldHolder.java | 9 +- .../dataholder/worlds/WorldsHolder.java | 7 +- .../permissions/AnjoPermissionsHandler.java | 136 ++++--- 6 files changed, 298 insertions(+), 276 deletions(-) diff --git a/EssentialsGroupBridge/src/org/anjocaido/groupmanager/permissions/NijikoPermissionsProxy.java b/EssentialsGroupBridge/src/org/anjocaido/groupmanager/permissions/NijikoPermissionsProxy.java index e72666cf7..da40fc172 100644 --- a/EssentialsGroupBridge/src/org/anjocaido/groupmanager/permissions/NijikoPermissionsProxy.java +++ b/EssentialsGroupBridge/src/org/anjocaido/groupmanager/permissions/NijikoPermissionsProxy.java @@ -521,10 +521,10 @@ public class NijikoPermissionsProxy extends PermissionHandler { @Override public boolean has(String world, String playerName, String permission) { - if (permission == null || permission.equals("")) { + if (permission == null || permission.isEmpty()) { return false; } - if (playerName == null || playerName == "") { + if (playerName == null || playerName.isEmpty()) { GroupManager.logger.severe("A plugin is asking permission '" + permission + "' for a null player... Which plugin does that? Bastards!"); return false; } diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index d942a470e..7b9a99bb7 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -77,4 +77,5 @@ v 1.6: - Prevent Group.equals tests throwing a NullPointerException for GlobalGroups. - Stop throwing errors on an empty users file. - Optimize sorting to speedup permission tests. - - Fix superperms to pass all tests http://dev.bukkit.org/server-mods/superpermstest/ \ No newline at end of file + - Fix superperms to pass all tests http://dev.bukkit.org/server-mods/superpermstest/ + - Optimizations include changing the return of comparePermissionString. \ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java index 6c4cdbcf2..eea488ab2 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java @@ -10,209 +10,232 @@ import java.util.ArrayList; import org.anjocaido.groupmanager.GroupManager; import org.anjocaido.groupmanager.dataholder.WorldDataHolder; import java.util.Map; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + /** - * + * * @author gabrielcouto */ public class User extends DataUnit implements Cloneable { - /** - * - */ - private String group = null; - private ArrayList subGroups = new ArrayList(); - /** - *This one holds the fields in INFO node. - * like prefix = 'c' - * or build = false - */ - private UserVariables variables = new UserVariables(this); - - /** + /** * - * @param name */ - public User(WorldDataHolder source, String name) { - super(source, name); - this.group = source.getDefaultGroup().getName(); - } + private String group = null; + private ArrayList subGroups = new ArrayList(); + /** + * This one holds the fields in INFO node. like prefix = 'c' or build = + * false + */ + private UserVariables variables = new UserVariables(this); + private transient Player bukkitPlayer = null; + + /** + * + * @param name + */ + public User(WorldDataHolder source, String name) { + super(source, name); + this.group = source.getDefaultGroup().getName(); + } + + /** + * + * @return User clone + */ + @Override + public User clone() { + User clone = new User(getDataSource(), this.getName()); + clone.group = this.group; + for (String perm : this.getPermissionList()) { + clone.addPermission(perm); + } + // clone.variables = this.variables.clone(); + // clone.flagAsChanged(); + return clone; + } + + /** + * Use this to deliver a user from one WorldDataHolder to another + * + * @param dataSource + * @return null if given dataSource already contains the same user + */ + public User clone(WorldDataHolder dataSource) { + if (dataSource.isUserDeclared(this.getName())) { + return null; + } + User clone = dataSource.createUser(this.getName()); + if (dataSource.getGroup(group) == null) { + clone.setGroup(dataSource.getDefaultGroup()); + } else { + clone.setGroup(dataSource.getGroup(this.getGroupName())); + } + for (String perm : this.getPermissionList()) { + clone.addPermission(perm); + } + // clone.variables = this.variables.clone(); + clone.flagAsChanged(); + return clone; + } + + public Group getGroup() { + Group result = getDataSource().getGroup(group); + if (result == null) { + this.setGroup(getDataSource().getDefaultGroup()); + result = getDataSource().getDefaultGroup(); + } + return result; + } + + /** + * @return the group + */ + public String getGroupName() { + Group result = getDataSource().getGroup(group); + if (result == null) { + group = getDataSource().getDefaultGroup().getName(); + } + return group; + } + + /** + * @param group + * the group to set + */ + @Deprecated + public void setGroup(String group) { + this.group = group; + flagAsChanged(); + if (GroupManager.isLoaded()) + if (GroupManager.BukkitPermissions.player_join = false) + GroupManager.BukkitPermissions.updateAllPlayers(); + } + + /** + * @param group + * the group to set + */ + public void setGroup(Group group) { + if (!this.getDataSource().groupExists(group.getName())) { + getDataSource().addGroup(group); + } + group = getDataSource().getGroup(group.getName()); + String oldGroup = this.group; + this.group = group.getName(); + flagAsChanged(); + if (GroupManager.isLoaded()) { + if (GroupManager.BukkitPermissions.player_join = false) + GroupManager.BukkitPermissions.updateAllPlayers(); + + // Do we notify of the group change? + String defaultGroupName = getDataSource().getDefaultGroup().getName(); + // if we were not in the default group + // or we were in the default group and the move is to a different + // group. + boolean notify = (!oldGroup.equalsIgnoreCase(defaultGroupName)) || ((oldGroup.equalsIgnoreCase(defaultGroupName)) && (!this.group.equalsIgnoreCase(defaultGroupName))); + + if (notify) + GroupManager.notify(this.getName(), String.format(" moved to the group %s.", group.getName())); + } + } + + public void addSubGroup(Group subGroup) { + if (this.group.equalsIgnoreCase(subGroup.getName())) { + return; + } + if (!this.getDataSource().groupExists(subGroup.getName())) { + getDataSource().addGroup(subGroup); + } + subGroup = getDataSource().getGroup(subGroup.getName()); + removeSubGroup(subGroup); + subGroups.add(subGroup.getName()); + flagAsChanged(); + if (GroupManager.isLoaded()) + if (GroupManager.BukkitPermissions.player_join = false) + GroupManager.BukkitPermissions.updateAllPlayers(); + } + + public int subGroupsSize() { + return subGroups.size(); + } + + public boolean isSubGroupsEmpty() { + return subGroups.isEmpty(); + } + + public boolean containsSubGroup(Group subGroup) { + return subGroups.contains(subGroup.getName()); + } + + public boolean removeSubGroup(Group subGroup) { + try { + if (subGroups.remove(subGroup.getName())) { + flagAsChanged(); + if (GroupManager.isLoaded()) + if (GroupManager.BukkitPermissions.player_join = false) + GroupManager.BukkitPermissions.updateAllPlayers(); + return true; + } + } catch (Exception e) { + } + return false; + } + + public ArrayList subGroupListCopy() { + ArrayList val = new ArrayList(); + for (String gstr : subGroups) { + Group g = getDataSource().getGroup(gstr); + if (g == null) { + removeSubGroup(g); + continue; + } + val.add(g); + } + return val; + } + + public ArrayList subGroupListStringCopy() { + return new ArrayList(subGroups); + } + + /** + * @return the variables + */ + public UserVariables getVariables() { + return variables; + } + + /** + * + * @param varList + */ + public void setVariables(Map varList) { + UserVariables temp = new UserVariables(this, varList); + variables.clearVars(); + for (String key : temp.getVarKeyList()) { + variables.addVar(key, temp.getVarObject(key)); + } + flagAsChanged(); + if (GroupManager.isLoaded()) + if (GroupManager.BukkitPermissions.player_join = false) + GroupManager.BukkitPermissions.updateAllPlayers(); + } + + public User updatePlayer(Player player) { + if (player != null) { + bukkitPlayer = player; + } + return this; + } + + public Player getBukkitPlayer() { + if (bukkitPlayer == null) { + bukkitPlayer = Bukkit.getPlayer(this.getName()); + } + return bukkitPlayer; + } - /** - * - * @return User clone - */ - @Override - public User clone() { - User clone = new User(getDataSource(), this.getName()); - clone.group = this.group; - for (String perm : this.getPermissionList()) { - clone.addPermission(perm); - } - //clone.variables = this.variables.clone(); - //clone.flagAsChanged(); - return clone; - } - - /** - * Use this to deliver a user from one WorldDataHolder to another - * @param dataSource - * @return null if given dataSource already contains the same user - */ - public User clone(WorldDataHolder dataSource) { - if (dataSource.isUserDeclared(this.getName())) { - return null; - } - User clone = dataSource.createUser(this.getName()); - if (dataSource.getGroup(group) == null) { - clone.setGroup(dataSource.getDefaultGroup()); - } else { - clone.setGroup(dataSource.getGroup(this.getGroupName())); - } - for (String perm : this.getPermissionList()) { - clone.addPermission(perm); - } - //clone.variables = this.variables.clone(); - clone.flagAsChanged(); - return clone; - } - - public Group getGroup() { - Group result = getDataSource().getGroup(group); - if (result == null) { - this.setGroup(getDataSource().getDefaultGroup()); - result = getDataSource().getDefaultGroup(); - } - return result; - } - - /** - * @return the group - */ - public String getGroupName() { - Group result = getDataSource().getGroup(group); - if (result == null) { - group = getDataSource().getDefaultGroup().getName(); - } - return group; - } - - /** - * @param group the group to set - */ - @Deprecated - public void setGroup(String group) { - this.group = group; - flagAsChanged(); - if (GroupManager.isLoaded()) - if(GroupManager.BukkitPermissions.player_join = false) - GroupManager.BukkitPermissions.updateAllPlayers(); - } - - /** - * @param group the group to set - */ - public void setGroup(Group group) { - if (!this.getDataSource().groupExists(group.getName())) { - getDataSource().addGroup(group); - } - group = getDataSource().getGroup(group.getName()); - String oldGroup = this.group; - this.group = group.getName(); - flagAsChanged(); - if (GroupManager.isLoaded()) { - if (GroupManager.BukkitPermissions.player_join = false) - GroupManager.BukkitPermissions.updateAllPlayers(); - - // Do we notify of the group change? - String defaultGroupName = getDataSource().getDefaultGroup().getName(); - // if we were not in the default group - // or we were in the default group and the move is to a different group. - boolean notify = (!oldGroup.equalsIgnoreCase(defaultGroupName)) || ((oldGroup.equalsIgnoreCase(defaultGroupName)) && (!this.group.equalsIgnoreCase(defaultGroupName))) ; - - if (notify) GroupManager.notify(this.getName(), String.format(" moved to the group %s.", group.getName())); - } - } - - public void addSubGroup(Group subGroup) { - if (this.group.equalsIgnoreCase(subGroup.getName())) { - return; - } - if (!this.getDataSource().groupExists(subGroup.getName())) { - getDataSource().addGroup(subGroup); - } - subGroup = getDataSource().getGroup(subGroup.getName()); - removeSubGroup(subGroup); - subGroups.add(subGroup.getName()); - flagAsChanged(); - if (GroupManager.isLoaded()) - if (GroupManager.BukkitPermissions.player_join = false) - GroupManager.BukkitPermissions.updateAllPlayers(); - } - - public int subGroupsSize() { - return subGroups.size(); - } - - public boolean isSubGroupsEmpty() { - return subGroups.isEmpty(); - } - - public boolean containsSubGroup(Group subGroup) { - return subGroups.contains(subGroup.getName()); - } - - public boolean removeSubGroup(Group subGroup) { - try { - if (subGroups.remove(subGroup.getName())) { - flagAsChanged(); - if (GroupManager.isLoaded()) - if (GroupManager.BukkitPermissions.player_join = false) - GroupManager.BukkitPermissions.updateAllPlayers(); - return true; - } - } catch (Exception e) { - } - return false; - } - - public ArrayList subGroupListCopy() { - ArrayList val = new ArrayList(); - for (String gstr : subGroups) { - Group g = getDataSource().getGroup(gstr); - if (g == null) { - removeSubGroup(g); - continue; - } - val.add(g); - } - return val; - } - - public ArrayList subGroupListStringCopy() { - return new ArrayList(subGroups); - } - - /** - * @return the variables - */ - public UserVariables getVariables() { - return variables; - } - - /** - * - * @param varList - */ - public void setVariables(Map varList) { - UserVariables temp = new UserVariables(this, varList); - variables.clearVars(); - for (String key : temp.getVarKeyList()) { - variables.addVar(key, temp.getVarObject(key)); - } - flagAsChanged(); - if (GroupManager.isLoaded()) - if (GroupManager.BukkitPermissions.player_join = false) - GroupManager.BukkitPermissions.updateAllPlayers(); - } } diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/OverloadedWorldHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/OverloadedWorldHolder.java index e7fa81627..8e2df5d10 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/OverloadedWorldHolder.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/OverloadedWorldHolder.java @@ -44,12 +44,13 @@ public class OverloadedWorldHolder extends WorldDataHolder { @Override public User getUser(String userName) { //OVERLOADED CODE - if (overloadedUsers.containsKey(userName.toLowerCase())) { - return overloadedUsers.get(userName.toLowerCase()); + String userNameLowered = userName.toLowerCase(); + if (overloadedUsers.containsKey(userNameLowered)) { + return overloadedUsers.get(userNameLowered); } //END CODE - if (users.containsKey(userName.toLowerCase())) { - return users.get(userName.toLowerCase()); + if (users.containsKey(userNameLowered)) { + return users.get(userNameLowered); } User newUser = createUser(userName); haveUsersChanged = true; diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java index 6544bb1cc..25eaf8526 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java @@ -268,9 +268,10 @@ public class WorldsHolder { * @return OverloadedWorldHolder */ public OverloadedWorldHolder getWorldData(String worldName) { - OverloadedWorldHolder data = worldsData.get(worldName.toLowerCase()); - if (mirrors.containsKey(worldName.toLowerCase())) { - String realOne = mirrors.get(worldName.toLowerCase()); + String worldNameLowered = worldName.toLowerCase(); + OverloadedWorldHolder data = worldsData.get(worldNameLowered); + if (mirrors.containsKey(worldNameLowered)) { + String realOne = mirrors.get(worldNameLowered); data = worldsData.get(realOne.toLowerCase()); } if (data == null) { diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java index 91c73b5c2..6e18bf3f8 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java @@ -17,6 +17,7 @@ import org.anjocaido.groupmanager.utils.PermissionCheckResult; import org.anjocaido.groupmanager.utils.PermissionCheckResult.Type; import org.bukkit.Bukkit; import org.bukkit.entity.Player; +import org.bukkit.permissions.Permission; /** * Everything here maintains the model created by Nijikokun @@ -62,7 +63,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public boolean permission(Player player, String permission) { - return checkUserPermission(ph.getUser(player.getName()), permission); + return checkUserPermission(ph.getUser(player.getName()).updatePlayer(player), permission); } /** @@ -98,13 +99,13 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { public List getAllPlayersPermissions(String userName) { List playerPermArray = new ArrayList(); - + for (String perm : ph.getUser(userName).getPermissionList()) { if ((!playerPermArray.contains(perm)) && (!playerPermArray.contains("-" + perm))) { playerPermArray.add(perm); - + Map children = GroupManager.BukkitPermissions.getAllChildren(perm, playerPermArray); - + if (children != null) { for (String child : children.keySet()) { if (children.get(child)) @@ -135,7 +136,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { for (String perm : ph.getGroup(group).getPermissionList()) { if ((!playerPermArray.contains(perm)) && (!playerPermArray.contains("-" + perm))) { playerPermArray.add(perm); - + Map children = GroupManager.BukkitPermissions.getAllChildren(perm, playerPermArray); if (children != null) { for (String child : children.keySet()) { @@ -149,7 +150,8 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { } } } - //Collections.sort(playerPermArray, StringPermissionComparator.getInstance()); + // Collections.sort(playerPermArray, + // StringPermissionComparator.getInstance()); return playerPermArray; } @@ -243,7 +245,8 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { /** * Check if user can build. Checks inheritance and subgroups. * - * @param userName Player's name + * @param userName + * Player's name * @return true if the user can build */ public boolean canUserBuild(String userName) { @@ -283,8 +286,8 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { } /** - * Checks the specified group for the Info Build node. - * Does NOT check inheritance + * Checks the specified group for the Info Build node. Does NOT check + * inheritance * * @param groupName * @return true if can build @@ -615,15 +618,8 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { result.askedPermission = permission; result.owner = user; for (String access : user.getPermissionList()) { - if (comparePermissionString(access, permission)) { - result.accessLevel = access; - if (access.charAt(0) == '-') { - result.resultType = PermissionCheckResult.Type.NEGATION; - } else if (access.charAt(0) == '+') { - result.resultType = PermissionCheckResult.Type.EXCEPTION; - } else { - result.resultType = PermissionCheckResult.Type.FOUND; - } + result.resultType = comparePermissionString(access, permission); + if (result.resultType != PermissionCheckResult.Type.NOTFOUND) { return result; } } @@ -645,15 +641,8 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { result.owner = group; result.askedPermission = permission; for (String access : group.getPermissionList()) { - if (comparePermissionString(access, permission)) { - result.accessLevel = access; - if (access.charAt(0) == '-') { - result.resultType = PermissionCheckResult.Type.NEGATION; - } else if (access.charAt(0) == '+') { - result.resultType = PermissionCheckResult.Type.EXCEPTION; - } else { - result.resultType = PermissionCheckResult.Type.FOUND; - } + result.resultType = comparePermissionString(access, permission); + if (result.resultType != PermissionCheckResult.Type.NOTFOUND) { return result; } } @@ -670,7 +659,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ public boolean checkUserPermission(User user, String permission) { PermissionCheckResult result = checkFullGMPermission(user, permission, true); - if (result.resultType.equals(PermissionCheckResult.Type.EXCEPTION) || result.resultType.equals(PermissionCheckResult.Type.FOUND)) { + if (result.resultType == PermissionCheckResult.Type.EXCEPTION || result.resultType == PermissionCheckResult.Type.FOUND) { return true; } @@ -686,13 +675,13 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { * @return PermissionCheckResult */ public PermissionCheckResult checkFullUserPermission(User user, String targetPermission) { - + return checkFullGMPermission(user, targetPermission, true); } - + /** - * Check user and groups with inheritance and Bukkit if bukkit = true - * return a PermissionCheckResult. + * Check user and groups with inheritance and Bukkit if bukkit = true return + * a PermissionCheckResult. * * @param user * @param targetPermission @@ -708,31 +697,33 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { return result; } - if (checkBukkit == true) { - // Check Bukkit perms to support plugins which add perms via code (Heroes). - final Player player = Bukkit.getPlayer(user.getName()); - if ((player != null) && (player.hasPermission(targetPermission))) { - result.resultType = PermissionCheckResult.Type.FOUND; + if (checkBukkit) { + // Check Bukkit perms to support plugins which add perms via code + // (Heroes). + final Player player = user.getBukkitPlayer(); + final Permission bukkitPerm = Bukkit.getPluginManager().getPermission(targetPermission); + if (player != null && bukkitPerm != null) { + result.resultType = player.hasPermission(bukkitPerm) ? PermissionCheckResult.Type.FOUND : PermissionCheckResult.Type.NEGATION; result.owner = user; return result; } } - + PermissionCheckResult resultUser = checkUserOnlyPermission(user, targetPermission); - if (!resultUser.resultType.equals(PermissionCheckResult.Type.NOTFOUND)) { + if (resultUser.resultType != PermissionCheckResult.Type.NOTFOUND) { return resultUser; } // IT ONLY CHECKS GROUPS PERMISSIONS IF RESULT FOR USER IS NOT FOUND PermissionCheckResult resultGroup = checkGroupPermissionWithInheritance(user.getGroup(), targetPermission); - if (!resultGroup.resultType.equals(PermissionCheckResult.Type.NOTFOUND)) { + if (resultGroup.resultType != PermissionCheckResult.Type.NOTFOUND) { return resultGroup; } // SUBGROUPS CHECK for (Group subGroup : user.subGroupListCopy()) { PermissionCheckResult resultSubGroup = checkGroupPermissionWithInheritance(subGroup, targetPermission); - if (!resultSubGroup.resultType.equals(PermissionCheckResult.Type.NOTFOUND)) { + if (resultSubGroup.resultType != PermissionCheckResult.Type.NOTFOUND) { return resultSubGroup; } } @@ -994,37 +985,42 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { * * @param userAccessLevel * @param fullPermissionName - * @return true if found a matching token. false if not. + * @return PermissionCheckResult.Type */ - public boolean comparePermissionString(String userAccessLevel, String fullPermissionName) { - int userAccessLevelLength; - if (userAccessLevel == null || fullPermissionName == null - || fullPermissionName.length() == 0 || (userAccessLevelLength = userAccessLevel.length()) == 0) { - return false; - } - - int userAccessLevelOffset = 0; - if (userAccessLevel.charAt(0) == '+' || userAccessLevel.charAt(0) == '-') { - userAccessLevelOffset = 1; - } - if ("*".regionMatches(0, userAccessLevel, userAccessLevelOffset, userAccessLevelLength - userAccessLevelOffset)) { - return true; - } - int fullPermissionNameOffset; - if (fullPermissionName.charAt(0) == '+' || fullPermissionName.charAt(0) == '-') { - fullPermissionNameOffset = 1; - } else { - fullPermissionNameOffset = 0; - } - - if (userAccessLevel.charAt(userAccessLevel.length() - 1) == '*') { - return userAccessLevel.regionMatches(true, userAccessLevelOffset, fullPermissionName, fullPermissionNameOffset, userAccessLevelLength - userAccessLevelOffset - 1); - } else { - return userAccessLevel.regionMatches(true, userAccessLevelOffset, fullPermissionName, fullPermissionNameOffset, - Math.max(userAccessLevelLength - userAccessLevelOffset, fullPermissionName.length() - fullPermissionNameOffset)); - } - } + public PermissionCheckResult.Type comparePermissionString(String userAccessLevel, String fullPermissionName) { + int userAccessLevelLength; + if (userAccessLevel == null || fullPermissionName == null || fullPermissionName.length() == 0 || (userAccessLevelLength = userAccessLevel.length()) == 0) { + return PermissionCheckResult.Type.NOTFOUND; + } + + PermissionCheckResult.Type result = PermissionCheckResult.Type.FOUND; + int userAccessLevelOffset = 0; + if (userAccessLevel.charAt(0) == '+') { + userAccessLevelOffset = 1; + result = PermissionCheckResult.Type.EXCEPTION; + } else if (userAccessLevel.charAt(0) == '-') { + userAccessLevelOffset = 1; + result = PermissionCheckResult.Type.NEGATION; + } + if ("*".regionMatches(0, userAccessLevel, userAccessLevelOffset, userAccessLevelLength - userAccessLevelOffset)) { + return result; + } + int fullPermissionNameOffset; + if (fullPermissionName.charAt(0) == '+' || fullPermissionName.charAt(0) == '-') { + fullPermissionNameOffset = 1; + } else { + fullPermissionNameOffset = 0; + } + if (userAccessLevel.charAt(userAccessLevel.length() - 1) == '*') { + return userAccessLevel.regionMatches(true, userAccessLevelOffset, fullPermissionName, fullPermissionNameOffset, userAccessLevelLength - userAccessLevelOffset - 1) ? + result : PermissionCheckResult.Type.NOTFOUND; + } else { + return userAccessLevel.regionMatches(true, userAccessLevelOffset, fullPermissionName, fullPermissionNameOffset, + Math.max(userAccessLevelLength - userAccessLevelOffset, fullPermissionName.length() - fullPermissionNameOffset)) ? + result : PermissionCheckResult.Type.NOTFOUND; + } + } /** * Returns a list of all groups. -- cgit v1.2.3 From d4685d1d10c077ec6edcd2901276152a403b91c1 Mon Sep 17 00:00:00 2001 From: snowleo Date: Fri, 25 Nov 2011 22:26:06 +0100 Subject: Fix ItemDupe bug in bukkit --- .../src/com/earth2me/essentials/Essentials.java | 2 ++ .../essentials/craftbukkit/ItemDupeFix.java | 25 ++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 Essentials/src/com/earth2me/essentials/craftbukkit/ItemDupeFix.java diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java index 9679aa64e..7c728b0b4 100644 --- a/Essentials/src/com/earth2me/essentials/Essentials.java +++ b/Essentials/src/com/earth2me/essentials/Essentials.java @@ -23,6 +23,7 @@ import com.earth2me.essentials.commands.EssentialsCommand; import com.earth2me.essentials.commands.IEssentialsCommand; import com.earth2me.essentials.commands.NoChargeException; import com.earth2me.essentials.commands.NotEnoughArgumentsException; +import com.earth2me.essentials.craftbukkit.ItemDupeFix; import com.earth2me.essentials.perm.PermissionsHandler; import com.earth2me.essentials.register.payment.Methods; import com.earth2me.essentials.signs.SignBlockListener; @@ -182,6 +183,7 @@ public class Essentials extends JavaPlugin implements IEssentials pm.registerEvent(Type.PLAYER_BUCKET_EMPTY, playerListener, Priority.High, this); pm.registerEvent(Type.PLAYER_ANIMATION, playerListener, Priority.High, this); pm.registerEvent(Type.PLAYER_CHANGED_WORLD, playerListener, Priority.Normal, this); + pm.registerEvent(Type.PLAYER_TELEPORT, new ItemDupeFix(), Priority.Monitor, this); final EssentialsBlockListener blockListener = new EssentialsBlockListener(this); pm.registerEvent(Type.BLOCK_PLACE, blockListener, Priority.Lowest, this); diff --git a/Essentials/src/com/earth2me/essentials/craftbukkit/ItemDupeFix.java b/Essentials/src/com/earth2me/essentials/craftbukkit/ItemDupeFix.java new file mode 100644 index 000000000..243049e0a --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/craftbukkit/ItemDupeFix.java @@ -0,0 +1,25 @@ +package com.earth2me.essentials.craftbukkit; + +import net.minecraft.server.EntityPlayer; +import org.bukkit.craftbukkit.entity.CraftPlayer; +import org.bukkit.event.player.PlayerListener; +import org.bukkit.event.player.PlayerTeleportEvent; + + +public class ItemDupeFix extends PlayerListener +{ + @Override + public void onPlayerTeleport(final PlayerTeleportEvent event) + { + if (event.isCancelled()) + { + return; + } + final CraftPlayer player = (CraftPlayer)event.getPlayer(); + final EntityPlayer entity = player.getHandle(); + if (entity.activeContainer != entity.defaultContainer) + { + entity.closeInventory(); + } + } +} -- cgit v1.2.3 From 4ad19b6fad999b30f5fdbb3712f1203dfaf37ede Mon Sep 17 00:00:00 2001 From: snowleo Date: Sat, 26 Nov 2011 00:34:36 +0100 Subject: Cleanup --- Essentials/src/com/earth2me/essentials/commands/Commandhome.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java index 1c0591bee..5478ab986 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java @@ -33,7 +33,7 @@ public class Commandhome extends EssentialsCommand } else { - player = getPlayer(server, nameParts[0].split(" "), 0, true); + player = getPlayer(server, nameParts, 0, true); if (nameParts.length > 1) { homeName = nameParts[1]; -- cgit v1.2.3 From 8ed4418d5f601e722e1731b6d3e69364f13a5cbd Mon Sep 17 00:00:00 2001 From: snowleo Date: Sat, 26 Nov 2011 15:26:48 +0100 Subject: Translated /list command --- .../earth2me/essentials/commands/Commandlist.java | 22 ++++++++++------------ Essentials/src/messages_da.properties | 4 ++++ Essentials/src/messages_de.properties | 4 ++++ Essentials/src/messages_en.properties | 4 ++++ Essentials/src/messages_es.properties | 4 ++++ Essentials/src/messages_fr.properties | 4 ++++ Essentials/src/messages_nl.properties | 4 ++++ 7 files changed, 34 insertions(+), 12 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandlist.java b/Essentials/src/com/earth2me/essentials/commands/Commandlist.java index 549f6efac..92833a66c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandlist.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandlist.java @@ -3,7 +3,6 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import java.util.*; -import org.bukkit.ChatColor; import org.bukkit.Server; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -39,16 +38,15 @@ public class Commandlist extends EssentialsCommand playerHidden++; } } - //TODO: move these to messages file - final StringBuilder online = new StringBuilder(); - online.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(server.getOnlinePlayers().length - playerHidden); + + String online; if (showhidden && playerHidden > 0) { - online.append(ChatColor.GRAY).append("/").append(playerHidden); + online = _("listAmountHidden", server.getOnlinePlayers().length - playerHidden, playerHidden, server.getMaxPlayers()); + } else { + online = _("listAmount",server.getOnlinePlayers().length - playerHidden, server.getMaxPlayers()); } - online.append(ChatColor.BLUE).append(" out of a maximum ").append(ChatColor.RED).append(server.getMaxPlayers()); - online.append(ChatColor.BLUE).append(" players online."); - sender.sendMessage(online.toString()); + sender.sendMessage(online); if (ess.getSettings().getSortListByGroups()) { @@ -90,11 +88,11 @@ public class Commandlist extends EssentialsCommand } if (user.isAfk()) { - groupString.append("§7[AFK]§f"); + groupString.append(_("listAfkTag")); } if (user.isHidden()) { - groupString.append("§7[HIDDEN]§f"); + groupString.append(_("listHiddenTag")); } groupString.append(user.getDisplayName()); groupString.append("§f"); @@ -131,11 +129,11 @@ public class Commandlist extends EssentialsCommand } if (user.isAfk()) { - onlineUsers.append("§7[AFK]§f"); + onlineUsers.append(_("listAfkTag")); } if (user.isHidden()) { - onlineUsers.append("§7[HIDDEN]§f"); + onlineUsers.append(_("listHiddenTag")); } onlineUsers.append(user.getDisplayName()); onlineUsers.append("§f"); diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties index dd2ee3b97..53bf399f3 100644 --- a/Essentials/src/messages_da.properties +++ b/Essentials/src/messages_da.properties @@ -153,6 +153,10 @@ kitTimed=\u00a7cDu kan ikke den pakke igen f\u00f8r om {0}. kits=\u00a77Pakker: {0} lightningSmited=\u00a77Du er blevet sl\u00e5et lightningUse=\u00a77Sl\u00e5r {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. +listHiddenTag = \u00a77[HIDDEN]\u00a7f loadWarpError=Kunne ikke indl\u00e6se warp {0} loadinfo=Indl\u00e6ste {0} byg {1} af {2} localFormat=Lokal: <{0}> {1} diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties index d14141507..e0bd6dca7 100644 --- a/Essentials/src/messages_de.properties +++ b/Essentials/src/messages_de.properties @@ -153,6 +153,10 @@ kitTimed=\u00a7cDu kannst diese Ausr\u00fcstung nicht innerhalb von {0} anforder kits=\u00a77Ausr\u00fcstungen: {0} lightningSmited=\u00a77Du wurdest gepeinigt. 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. +listHiddenTag = \u00a77[Versteckt]\u00a7f loadWarpError=Fehler beim Laden von Warp-Punkt {0} loadinfo=Plugin {0} Version {1} geladen, erstellt von {2}, \u00fcbersetzt von snowleo localFormat=Lokal: <{0}> {1} diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties index 8843cf194..e89004bf7 100644 --- a/Essentials/src/messages_en.properties +++ b/Essentials/src/messages_en.properties @@ -153,6 +153,10 @@ kitTimed=\u00a7cYou can''t use that kit again for another {0}. kits=\u00a77Kits: {0} lightningSmited=\u00a77You have just been smited 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. +listHiddenTag = \u00a77[HIDDEN]\u00a7f loadWarpError=Failed to load warp {0} loadinfo=Loaded {0} build {1} by: {2} localFormat=Local: <{0}> {1} diff --git a/Essentials/src/messages_es.properties b/Essentials/src/messages_es.properties index 95fda63ac..ffa0af2ce 100644 --- a/Essentials/src/messages_es.properties +++ b/Essentials/src/messages_es.properties @@ -153,6 +153,10 @@ kitTimed=\u00a7c No puedes usar ese kit de nuevo para otro{0}. kits=\u00a77Kits: {0} lightningSmited=\u00a77Acabas de ser golpeado 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. +listHiddenTag = \u00a77[HIDDEN]\u00a7f loadWarpError=Error al cargar el tenetransporte {0} loadinfo=Cargado {0}, construido {1} por: {2} localFormat=Local: <{0}> {1} diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties index f64968250..1d3cddea0 100644 --- a/Essentials/src/messages_fr.properties +++ b/Essentials/src/messages_fr.properties @@ -153,6 +153,10 @@ kitTimed=\u00a7cVous ne pouvez pas utiliser ce kit pendant encore {0}. kits=\u00a77Kits:{0} lightningSmited=\u00a77Vous venez d''\u00eatre foudroy\u00e9 lightningUse=\u00a77{0} a \u00e9t\u00e9 foudroy\u00e9 +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. +listHiddenTag = \u00a77[HIDDEN]\u00a7f loadWarpError=\u00c9chec du chargement du warp {0} loadinfo={0} version {1} par {2} a \u00e9t\u00e9 charg\u00e9 localFormat=Local:<{0}> {1} diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties index 5907a1047..ea0cf99d8 100644 --- a/Essentials/src/messages_nl.properties +++ b/Essentials/src/messages_nl.properties @@ -153,6 +153,10 @@ kitTimed=\u00a7cJe kan die kit pas weer gebruiken over {0}. kits=\u00a77Kits: {0} lightningSmited=\u00a77Je bent zojuist verbrand 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. +listHiddenTag = \u00a77[HIDDEN]\u00a7f loadWarpError=Fout bij het laden van warp {0} loadinfo=Build {1} geladen {0} van {2} localFormat=Local: <{0}> {1} -- cgit v1.2.3 From f9d14697b6aaa62df4ee63fdafa2660e487402eb Mon Sep 17 00:00:00 2001 From: snowleo Date: Sat, 26 Nov 2011 17:37:07 +0100 Subject: Forgot to save this file before commit --- Essentials/src/messages.properties | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index fdbe917df..e0a23002b 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -153,6 +153,10 @@ kitTimed=\u00a7cYou can''t use that kit again for another {0}. kits=\u00a77Kits: {0} lightningSmited=\u00a77You have just been smited 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. +listHiddenTag = \u00a77[HIDDEN]\u00a7f loadWarpError=Failed to load warp {0} loadinfo=Loaded {0} build {1} by: {2} localFormat=Local: <{0}> {1} -- cgit v1.2.3 From b21b7b7e155a45227f9c629d51ee50ecbed1ca73 Mon Sep 17 00:00:00 2001 From: snowleo Date: Sat, 26 Nov 2011 22:30:40 +0100 Subject: New behavior of the /home command and beds - The behavior has been altered to match the vanilla server. - Using a bed will no longer create a home in the users file, if config option bed-sethome is set - The config option bed-sethome has been removed - It's now possible to go to /home bed or /home playername:bed - Bed locations stored before installing Essentials will be used - Players respawn at their bed location (if set) instead of the spawn, if respawn-at-home is set to false - The default value of spawn-if-no-home is set to true - If spawn-if-no-home is set and the player has not set a home, he will be either teleported to his bed location (if set) or the spawn, when he uses the /home command --- .../src/com/earth2me/essentials/Essentials.java | 1 - .../essentials/EssentialsPlayerListener.java | 40 ++++------------------ .../src/com/earth2me/essentials/ISettings.java | 2 -- .../src/com/earth2me/essentials/Settings.java | 6 ---- .../src/com/earth2me/essentials/UserData.java | 29 +++++++++------- .../earth2me/essentials/commands/Commandhome.java | 24 +++++++++++-- Essentials/src/config.yml | 10 ++---- .../test/com/earth2me/essentials/UserTest.java | 22 +++++------- .../spawn/EssentialsSpawnPlayerListener.java | 29 +++++++--------- 9 files changed, 70 insertions(+), 93 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java index 7c728b0b4..5ede55fc5 100644 --- a/Essentials/src/com/earth2me/essentials/Essentials.java +++ b/Essentials/src/com/earth2me/essentials/Essentials.java @@ -178,7 +178,6 @@ public class Essentials extends JavaPlugin implements IEssentials pm.registerEvent(Type.PLAYER_MOVE, playerListener, Priority.High, this); pm.registerEvent(Type.PLAYER_LOGIN, playerListener, Priority.High, this); pm.registerEvent(Type.PLAYER_TELEPORT, playerListener, Priority.High, this); - pm.registerEvent(Type.PLAYER_INTERACT, playerListener, Priority.High, this); pm.registerEvent(Type.PLAYER_EGG_THROW, playerListener, Priority.High, this); pm.registerEvent(Type.PLAYER_BUCKET_EMPTY, playerListener, Priority.High, this); pm.registerEvent(Type.PLAYER_ANIMATION, playerListener, Priority.High, this); diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java index c6cbfe232..f92f9d808 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java @@ -231,12 +231,12 @@ public class EssentialsPlayerListener extends PlayerListener private void updateCompass(final User user) { - try - { - user.setCompassTarget(user.getHome(user.getLocation())); + Location loc = user.getHome(user.getLocation()); + if (loc == null) { + loc = user.getBedSpawnLocation(); } - catch (Exception ex) - { + if (loc != null) { + user.setCompassTarget(loc); } } @@ -255,32 +255,6 @@ public class EssentialsPlayerListener extends PlayerListener updateCompass(user); } - @Override - public void onPlayerInteract(final PlayerInteractEvent event) - { - if (event.isCancelled()) - { - return; - } - if (event.getAction() != Action.RIGHT_CLICK_BLOCK) - { - return; - } - - if (ess.getSettings().getBedSetsHome() && event.getClickedBlock().getType() == Material.BED_BLOCK) - { - try - { - final User user = ess.getUser(event.getPlayer()); - user.setHome(); - user.sendMessage(_("homeSetToBed")); - } - catch (Throwable ex) - { - } - } - } - @Override public void onPlayerEggThrow(final PlayerEggThrowEvent event) { @@ -387,7 +361,7 @@ public class EssentialsPlayerListener extends PlayerListener } @Override - public void onPlayerChangedWorld(PlayerChangedWorldEvent event) + public void onPlayerChangedWorld(final PlayerChangedWorldEvent event) { if (ess.getSettings().getNoGodWorlds().contains(event.getPlayer().getLocation().getWorld().getName())) { User user = ess.getUser(event.getPlayer()); @@ -395,5 +369,5 @@ public class EssentialsPlayerListener extends PlayerListener user.sendMessage(_("noGodWorldWarning")); } } - } + } } diff --git a/Essentials/src/com/earth2me/essentials/ISettings.java b/Essentials/src/com/earth2me/essentials/ISettings.java index 7891190dc..e7ce92a55 100644 --- a/Essentials/src/com/earth2me/essentials/ISettings.java +++ b/Essentials/src/com/earth2me/essentials/ISettings.java @@ -21,8 +21,6 @@ public interface ISettings extends IConf long getBackupInterval(); - boolean getBedSetsHome(); - String getChatFormat(String group); int getChatRadius(); diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java index 47a102326..ab5b0a364 100644 --- a/Essentials/src/com/earth2me/essentials/Settings.java +++ b/Essentials/src/com/earth2me/essentials/Settings.java @@ -36,12 +36,6 @@ public class Settings implements ISettings return config.getBoolean("respawn-at-home", false); } - @Override - public boolean getBedSetsHome() - { - return config.getBoolean("bed-sethome", false); - } - @Override public List getMultipleHomes() { diff --git a/Essentials/src/com/earth2me/essentials/UserData.java b/Essentials/src/com/earth2me/essentials/UserData.java index d9dad769d..9df1b0342 100644 --- a/Essentials/src/com/earth2me/essentials/UserData.java +++ b/Essentials/src/com/earth2me/essentials/UserData.java @@ -130,27 +130,32 @@ public abstract class UserData extends PlayerExtension implements IConf return loc; } - public Location getHome(Location world) throws Exception + public Location getHome(final Location world) { - Location loc; - for (String home : getHomes()) + try { - loc = config.getLocation("homes." + home, getServer()); - if (world.getWorld() == loc.getWorld()) + Location loc; + for (String home : getHomes()) { - return loc; - } + loc = config.getLocation("homes." + home, getServer()); + if (world.getWorld() == loc.getWorld()) + { + return loc; + } + } + loc = config.getLocation("homes." + getHomes().get(0), getServer()); + return loc; + } + catch (Exception ex) + { + return null; } - loc = config.getLocation("homes." + getHomes().get(0), getServer()); - return loc; } public List getHomes() { - List list = new ArrayList(homes.keySet()); - return list; - + return new ArrayList(homes.keySet()); } public void setHome(String name, Location loc) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java index 5478ab986..090cebd4c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java @@ -6,6 +6,7 @@ import com.earth2me.essentials.User; import com.earth2me.essentials.Util; import java.util.List; import java.util.Locale; +import org.bukkit.Location; import org.bukkit.Server; @@ -42,14 +43,32 @@ public class Commandhome extends EssentialsCommand } try { + if ("bed".equalsIgnoreCase(homeName)) { + final Location bed = player.getBedSpawnLocation(); + if (bed != null) + { + user.getTeleport().teleport(bed, charge); + } + } user.getTeleport().home(player, homeName.toLowerCase(Locale.ENGLISH), charge); } catch (NotEnoughArgumentsException e) { final List homes = player.getHomes(); - if (homes.isEmpty() && player.equals(user) && ess.getSettings().spawnIfNoHome()) + if (homes.isEmpty() && player.equals(user)) { - user.getTeleport().respawn(ess.getSpawn(), charge); + final Location loc = player.getBedSpawnLocation(); + if (loc == null) + { + if (ess.getSettings().spawnIfNoHome()) + { + user.getTeleport().respawn(ess.getSpawn(), charge); + } + } + else + { + user.getTeleport().teleport(loc, charge); + } } else if (homes.isEmpty()) { @@ -61,6 +80,7 @@ public class Commandhome extends EssentialsCommand } else { + homes.add("bed"); user.sendMessage(_("homes", Util.joinList(homes))); } } diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml index cf39007e3..a68630f67 100644 --- a/Essentials/src/config.yml +++ b/Essentials/src/config.yml @@ -236,15 +236,11 @@ no-god-in-worlds: # +------------------------------------------------------+ # ############################################################ -# When users die, should they respawn at their homes, instead of the spawnpoint? +# When users die, should they respawn at their first home, instead of the spawnpoint or bed? respawn-at-home: false -# When a user interacts with a bed, should their home be set to that location? -# If you enable this and remove default user access to the /sethome command, you can make beds the only way for players to set their home location. -bed-sethome: false - -# If no home is set send you to spawn when /home is used -spawn-if-no-home: false +# If no home is set send you to bed or spawn when /home is used +spawn-if-no-home: true # Allow players to have multiple homes. # Define different amounts of multiple homes for different permissions, e.g. essentials.sethome.multiple.vip diff --git a/Essentials/test/com/earth2me/essentials/UserTest.java b/Essentials/test/com/earth2me/essentials/UserTest.java index 35244ac90..ef9ab515d 100644 --- a/Essentials/test/com/earth2me/essentials/UserTest.java +++ b/Essentials/test/com/earth2me/essentials/UserTest.java @@ -54,21 +54,15 @@ public class UserTest extends TestCase user.setHome(); OfflinePlayer base2 = server.createPlayer(base1.getName(), ess); User user2 = ess.getUser(base2); - try - { - Location home = user2.getHome(loc); - assertEquals(loc.getWorld().getName(), home.getWorld().getName()); - assertEquals(loc.getX(), home.getX()); - assertEquals(loc.getY(), home.getY()); - assertEquals(loc.getZ(), home.getZ()); - assertEquals(loc.getYaw(), home.getYaw()); - assertEquals(loc.getPitch(), home.getPitch()); - } - catch (Exception ex) - { - fail("Exception"); - } + Location home = user2.getHome(loc); + assertNotNull(home); + assertEquals(loc.getWorld().getName(), home.getWorld().getName()); + assertEquals(loc.getX(), home.getX()); + assertEquals(loc.getY(), home.getY()); + assertEquals(loc.getZ(), home.getZ()); + assertEquals(loc.getYaw(), home.getYaw()); + assertEquals(loc.getPitch(), home.getPitch()); } public void testMoney() diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java index a5d1efba9..57b842c82 100644 --- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java +++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java @@ -15,8 +15,9 @@ public class EssentialsSpawnPlayerListener extends PlayerListener { private final transient IEssentials ess; - public EssentialsSpawnPlayerListener(IEssentials ess) + public EssentialsSpawnPlayerListener(final IEssentials ess) { + super(); this.ess = ess; } @@ -25,28 +26,24 @@ public class EssentialsSpawnPlayerListener extends PlayerListener { final User user = ess.getUser(event.getPlayer()); - try + if (ess.getSettings().getRespawnAtHome()) { - if (ess.getSettings().getRespawnAtHome()) + Location home = user.getHome(user.getLocation()); + if (home == null) + { + home = user.getBedSpawnLocation(); + } + if (home != null) { - Location home = user.getHome(user.getLocation()); - if (home == null) - { - throw new Exception(); - } event.setRespawnLocation(home); return; } } - catch (Throwable ex) + final Location spawn = ess.getSpawn().getSpawn(user.getGroup()); + if (spawn != null) { + event.setRespawnLocation(spawn); } - Location spawn = ess.getSpawn().getSpawn(user.getGroup()); - if (spawn == null) - { - return; - } - event.setRespawnLocation(spawn); } @Override @@ -54,7 +51,7 @@ public class EssentialsSpawnPlayerListener extends PlayerListener { final User user = ess.getUser(event.getPlayer()); - if (!user.isNew()) + if (!user.isNew() || user.getBedSpawnLocation() != null) { return; } -- cgit v1.2.3 From c70700f7b86771ad8d8a5f10c238e002e63db04e Mon Sep 17 00:00:00 2001 From: snowleo Date: Sun, 27 Nov 2011 00:23:40 +0100 Subject: Fix banning random player (and all other commands where a empty player is given) --- .../src/com/earth2me/essentials/commands/EssentialsCommand.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java b/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java index 63717fcae..32d8ef979 100644 --- a/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java +++ b/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java @@ -47,6 +47,10 @@ public abstract class EssentialsCommand implements IEssentialsCommand { throw new NotEnoughArgumentsException(); } + if (args[0].isEmpty()) + { + throw new NoSuchFieldException(_("playerNotFound")); + } final User user = ess.getUser(args[pos]); if (user != null) { -- cgit v1.2.3 From b5e9ad02aefc2304a7fff7280e41471992096961 Mon Sep 17 00:00:00 2001 From: snowleo Date: Sun, 27 Nov 2011 00:31:14 +0100 Subject: arrrgggss --- Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java b/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java index 32d8ef979..6b9d17b26 100644 --- a/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java +++ b/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java @@ -47,7 +47,7 @@ public abstract class EssentialsCommand implements IEssentialsCommand { throw new NotEnoughArgumentsException(); } - if (args[0].isEmpty()) + if (args[pos].isEmpty()) { throw new NoSuchFieldException(_("playerNotFound")); } -- cgit v1.2.3 From ae4c10ced63f3b03639d39a2a9dcf7e3cba3098a Mon Sep 17 00:00:00 2001 From: KHobbits Date: Sun, 27 Nov 2011 01:15:14 +0000 Subject: Fixing optional argument on tppos to use the correct yaw value. --- Essentials/src/com/earth2me/essentials/commands/Commandtppos.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java b/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java index 7aa0e66f8..203628753 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java @@ -28,7 +28,7 @@ public class Commandtppos extends EssentialsCommand final Location location = new Location(user.getWorld(), x, y, z); if (args.length > 3) { - location.setYaw(Float.parseFloat(args[3])); + location.setYaw((Float.parseFloat(args[3]) + 180 + 360) % 360); } if (args.length > 4) { -- cgit v1.2.3 From a714e39bf4733042da4fdc14d43b4cb1f6b40f7c Mon Sep 17 00:00:00 2001 From: snowleo Date: Sun, 27 Nov 2011 03:22:07 +0100 Subject: CB#1512 B#1039 --- lib/bukkit-1.0.0-R1-SNAPSHOT.jar | Bin 4391224 -> 4396182 bytes lib/craftbukkit-1.0.0-SNAPSHOT.jar | Bin 9770541 -> 9780993 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/lib/bukkit-1.0.0-R1-SNAPSHOT.jar b/lib/bukkit-1.0.0-R1-SNAPSHOT.jar index 3056d9e59..dd15e3e2f 100644 Binary files a/lib/bukkit-1.0.0-R1-SNAPSHOT.jar and b/lib/bukkit-1.0.0-R1-SNAPSHOT.jar differ diff --git a/lib/craftbukkit-1.0.0-SNAPSHOT.jar b/lib/craftbukkit-1.0.0-SNAPSHOT.jar index 5e1e9c101..62f18732e 100644 Binary files a/lib/craftbukkit-1.0.0-SNAPSHOT.jar and b/lib/craftbukkit-1.0.0-SNAPSHOT.jar differ -- cgit v1.2.3 From 263a3fc80b31822b2a80a6cef12d77733db3d288 Mon Sep 17 00:00:00 2001 From: ElgarL Date: Sun, 27 Nov 2011 03:12:28 +0000 Subject: Added file details in error messages for loading groups/users. --- EssentialsGroupManager/src/Changelog.txt | 3 ++- .../groupmanager/dataholder/WorldDataHolder.java | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index 7b9a99bb7..71e9f4225 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -78,4 +78,5 @@ v 1.6: - Stop throwing errors on an empty users file. - Optimize sorting to speedup permission tests. - Fix superperms to pass all tests http://dev.bukkit.org/server-mods/superpermstest/ - - Optimizations include changing the return of comparePermissionString. \ No newline at end of file + - Optimizations include changing the return of comparePermissionString. + - Added file details in error messages for loading groups/users. \ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java index 683ba24a9..59c5949f4 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java @@ -595,7 +595,7 @@ public class WorldDataHolder { Map thisGroupNode = (Map) allGroupsNode.get(groupKey); Group thisGrp = ph.createGroup(groupKey); if (thisGrp == null) { - throw new IllegalArgumentException("I think this user was declared more than once: " + groupKey); + throw new IllegalArgumentException("I think this user was declared more than once: " + groupKey + " in file: " + groupsFile.getPath()); } if (thisGroupNode.get("default") == null) { thisGroupNode.put("default", false); @@ -603,7 +603,7 @@ public class WorldDataHolder { if ((Boolean.parseBoolean(thisGroupNode.get("default").toString()))) { if (ph.getDefaultGroup() != null) { GroupManager.logger.warning("The group " + thisGrp.getName() + " is claiming to be default where" + ph.getDefaultGroup().getName() + " already was."); - GroupManager.logger.warning("Overriding first request."); + GroupManager.logger.warning("Overriding first request for file: " + groupsFile.getPath()); } ph.setDefaultGroup(thisGrp); } @@ -619,7 +619,7 @@ public class WorldDataHolder { } 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) for group: " + thisGrp.getName()); + throw new IllegalArgumentException("Unknown type of permissions node(Should be String or List) for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath()); } //INFO NODE @@ -629,7 +629,7 @@ public class WorldDataHolder { thisGrp.setVariables(infoNode); } } else - throw new IllegalArgumentException("Unknown entry found in Info section for group: " + thisGrp.getName()); + throw new IllegalArgumentException("Unknown entry found in Info section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath()); //END INFO NODE @@ -650,14 +650,14 @@ public class WorldDataHolder { } } }else - throw new IllegalArgumentException("Unknown entry found in inheritance section for group: " + thisGrp.getName()); + throw new IllegalArgumentException("Unknown entry 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."); //} if (ph.defaultGroup == null) { - throw new IllegalArgumentException("There was no Default Group declared."); + throw new IllegalArgumentException("There was no Default Group declared in file: " + groupsFile.getPath()); } for (String groupKey : inheritance.keySet()) { List inheritedList = inheritance.get(groupKey); @@ -717,7 +717,7 @@ public class WorldDataHolder { Map thisUserNode = (Map) allUsersNode.get(usersKey); User thisUser = ph.createUser(usersKey); if (thisUser == null) { - throw new IllegalArgumentException("I think this user was declared more than once: " + usersKey); + throw new IllegalArgumentException("I think this user was declared more than once: " + usersKey + " in file: " + usersFile.getPath()); } if (thisUserNode.get("permissions") == null) { thisUserNode.put("permissions", new ArrayList()); @@ -740,7 +740,7 @@ public class WorldDataHolder { if (subGrp != null) { thisUser.addSubGroup(subGrp); } else { - GroupManager.logger.warning("Subgroup " + o.toString() + " not found for user " + thisUser.getName() + ". Ignoring entry."); + GroupManager.logger.warning("Subgroup " + o.toString() + " not found for user " + thisUser.getName() + ". Ignoring entry in file: " + usersFile.getPath()); } } } else if (thisUserNode.get("subgroups") instanceof String) { @@ -748,7 +748,7 @@ public class WorldDataHolder { if (subGrp != null) { thisUser.addSubGroup(subGrp); } else { - GroupManager.logger.warning("Subgroup " + thisUserNode.get("subgroups").toString() + " not found for user " + thisUser.getName() + ". Ignoring entry."); + GroupManager.logger.warning("Subgroup " + thisUserNode.get("subgroups").toString() + " not found for user " + thisUser.getName() + ". Ignoring entry in file: " + usersFile.getPath()); } } @@ -765,7 +765,7 @@ public class WorldDataHolder { if (thisUserNode.get("group") != null) { Group hisGroup = ph.getGroup(thisUserNode.get("group").toString()); if (hisGroup == null) { - GroupManager.logger.warning("There is no group " + thisUserNode.get("group").toString() + ", as stated for player " + thisUser.getName() + ": Set to '" + ph.getDefaultGroup().getName() + "'."); + GroupManager.logger.warning("There is no group " + thisUserNode.get("group").toString() + ", as stated for player " + thisUser.getName() + ": Set to '" + ph.getDefaultGroup().getName() + "' for file: " + usersFile.getPath()); hisGroup = ph.defaultGroup; //throw new IllegalArgumentException("There is no group " + thisUserNode.get("group").toString() + ", as stated for player " + thisUser.getName()); } -- cgit v1.2.3 From 0234c55ce3c9647644ffbebc8b8201c7264e89e8 Mon Sep 17 00:00:00 2001 From: snowleo Date: Sun, 27 Nov 2011 04:36:27 +0100 Subject: New command /enchant Permissions for each enchantment: essentials.enchant.[enchantmentname] For all use * --- .../src/com/earth2me/essentials/Essentials.java | 5 +- Essentials/src/com/earth2me/essentials/Mob.java | 5 + .../essentials/commands/Commandenchant.java | 115 +++++++++++++++++++++ .../essentials/commands/Commandspawnmob.java | 3 +- .../commands/NotEnoughArgumentsException.java | 9 +- Essentials/src/messages.properties | 5 + Essentials/src/messages_da.properties | 5 + Essentials/src/messages_de.properties | 5 + Essentials/src/messages_en.properties | 5 + Essentials/src/messages_es.properties | 5 + Essentials/src/messages_fr.properties | 5 + Essentials/src/messages_nl.properties | 5 + 12 files changed, 167 insertions(+), 5 deletions(-) create mode 100644 Essentials/src/com/earth2me/essentials/commands/Commandenchant.java diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java index 5ede55fc5..6af8e83e6 100644 --- a/Essentials/src/com/earth2me/essentials/Essentials.java +++ b/Essentials/src/com/earth2me/essentials/Essentials.java @@ -57,7 +57,7 @@ import org.bukkit.scheduler.BukkitScheduler; public class Essentials extends JavaPlugin implements IEssentials { - public static final int BUKKIT_VERSION = 1501; + public static final int BUKKIT_VERSION = 1512; private static final Logger LOGGER = Logger.getLogger("Minecraft"); private transient ISettings settings; private final transient TNTExplodeListener tntListener = new TNTExplodeListener(this); @@ -345,6 +345,9 @@ public class Essentials extends JavaPlugin implements IEssentials { sender.sendMessage(command.getDescription()); sender.sendMessage(command.getUsage().replaceAll("", commandLabel)); + if (!ex.getMessage().isEmpty()) { + sender.sendMessage(ex.getMessage()); + } return true; } catch (Throwable ex) diff --git a/Essentials/src/com/earth2me/essentials/Mob.java b/Essentials/src/com/earth2me/essentials/Mob.java index e9b269218..394bbaf23 100644 --- a/Essentials/src/com/earth2me/essentials/Mob.java +++ b/Essentials/src/com/earth2me/essentials/Mob.java @@ -4,6 +4,7 @@ import static com.earth2me.essentials.I18n._; import java.util.HashMap; import java.util.Locale; import java.util.Map; +import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; import org.bukkit.Location; @@ -66,6 +67,10 @@ public enum Mob hashMap.put(mob.name.toLowerCase(Locale.ENGLISH), mob); } } + + public static Set getMobList() { + return hashMap.keySet(); + } public LivingEntity spawn(final Player player, final Server server, final Location loc) throws MobException { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java b/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java new file mode 100644 index 000000000..107727e32 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java @@ -0,0 +1,115 @@ +package com.earth2me.essentials.commands; + +import com.earth2me.essentials.User; +import com.earth2me.essentials.Util; +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; +import org.bukkit.Server; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.inventory.ItemStack; +import static com.earth2me.essentials.I18n._; + + +public class Commandenchant extends EssentialsCommand +{ + private static final Map ENCHANTMENTS = new HashMap(); + + static + { + ENCHANTMENTS.put("alldamage", Enchantment.DAMAGE_ALL); + ENCHANTMENTS.put("alldmg", Enchantment.DAMAGE_ALL); + ENCHANTMENTS.put("arthropodsdamage", Enchantment.DAMAGE_ARTHROPODS); + ENCHANTMENTS.put("ardmg", Enchantment.DAMAGE_ARTHROPODS); + ENCHANTMENTS.put("undeaddamage", Enchantment.DAMAGE_UNDEAD); + ENCHANTMENTS.put("undeaddmg", Enchantment.DAMAGE_UNDEAD); + ENCHANTMENTS.put("digspeed", Enchantment.DIG_SPEED); + ENCHANTMENTS.put("durability", Enchantment.DURABILITY); + ENCHANTMENTS.put("dura", Enchantment.DURABILITY); + ENCHANTMENTS.put("fireaspect", Enchantment.FIRE_ASPECT); + ENCHANTMENTS.put("fire", Enchantment.FIRE_ASPECT); + ENCHANTMENTS.put("knockback", Enchantment.KNOCKBACK); + ENCHANTMENTS.put("blockslootbonus", Enchantment.LOOT_BONUS_BLOCKS); + ENCHANTMENTS.put("blocksbonus", Enchantment.LOOT_BONUS_BLOCKS); + ENCHANTMENTS.put("mobslootbonus", Enchantment.LOOT_BONUS_MOBS); + ENCHANTMENTS.put("mobsbonus", Enchantment.LOOT_BONUS_MOBS); + ENCHANTMENTS.put("oxygen", Enchantment.OXYGEN); + ENCHANTMENTS.put("environmentalprotection", Enchantment.PROTECTION_ENVIRONMENTAL); + ENCHANTMENTS.put("envprot", Enchantment.PROTECTION_ENVIRONMENTAL); + ENCHANTMENTS.put("explosionsprotection", Enchantment.PROTECTION_EXPLOSIONS); + ENCHANTMENTS.put("expprot", Enchantment.PROTECTION_EXPLOSIONS); + ENCHANTMENTS.put("fallprotection", Enchantment.PROTECTION_FALL); + ENCHANTMENTS.put("fallprot", Enchantment.PROTECTION_FALL); + ENCHANTMENTS.put("fireprotection", Enchantment.PROTECTION_FIRE); + ENCHANTMENTS.put("fireprot", Enchantment.PROTECTION_FIRE); + ENCHANTMENTS.put("projectileprotection", Enchantment.PROTECTION_PROJECTILE); + ENCHANTMENTS.put("projprot", Enchantment.PROTECTION_PROJECTILE); + ENCHANTMENTS.put("silktouch", Enchantment.SILK_TOUCH); + ENCHANTMENTS.put("waterworker", Enchantment.WATER_WORKER); + } + + public Commandenchant() + { + super("enchant"); + } + + @Override + protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception + { + final ItemStack stack = user.getItemInHand(); + if (stack == null) + { + throw new Exception(_("nothingInHand")); + } + if (args.length == 0) + { + final Set enchantmentslist = new TreeSet(); + for (Map.Entry entry : ENCHANTMENTS.entrySet()) + { + final String enchantmentName = entry.getValue().getName().toLowerCase(); + if (enchantmentslist.contains(enchantmentName) || user.isAuthorized("essentials.enchant." + enchantmentName)) + { + enchantmentslist.add(entry.getKey()); + enchantmentslist.add(enchantmentName); + } + } + throw new NotEnoughArgumentsException(_("entchantments", Util.joinList(enchantmentslist.toArray()))); + } + int level = -1; + if (args.length > 1) + { + try + { + level = Integer.parseInt(args[1]); + } + catch (NumberFormatException ex) + { + level = -1; + } + } + Enchantment enchantment = Enchantment.getByName(args[0].toUpperCase(Locale.ENGLISH)); + if (enchantment == null) + { + enchantment = ENCHANTMENTS.get(args[0].toLowerCase(Locale.ENGLISH)); + } + if (enchantment == null) + { + throw new Exception(_("enchantmentNotFound")); + } + final String enchantmentName = enchantment.getName().toLowerCase(); + if (!user.isAuthorized("essentials.enchant." + enchantmentName)) + { + throw new Exception(_("enchantmentPerm", enchantmentName)); + } + if (level < enchantment.getStartLevel() || level > enchantment.getMaxLevel()) + { + level = enchantment.getMaxLevel(); + } + stack.addEnchantment(enchantment, level); + user.setItemInHand(stack); + user.updateInventory(); + user.sendMessage(_("enchantmentApplied", enchantmentName.replace('_', ' '))); + } +} diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java index eb26d29b1..14fa3dca3 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java @@ -26,8 +26,7 @@ public class Commandspawnmob extends EssentialsCommand { if (args.length < 1) { - throw new NotEnoughArgumentsException(); - //TODO: user.sendMessage("§7Mobs: Zombie PigZombie Skeleton Slime Chicken Pig Monster Spider Creeper Ghast Squid Giant Cow Sheep Wolf"); + throw new NotEnoughArgumentsException(_("mobsAvailable", Util.joinList(Mob.getMobList()))); } diff --git a/Essentials/src/com/earth2me/essentials/commands/NotEnoughArgumentsException.java b/Essentials/src/com/earth2me/essentials/commands/NotEnoughArgumentsException.java index 9513fc934..0c47b9893 100644 --- a/Essentials/src/com/earth2me/essentials/commands/NotEnoughArgumentsException.java +++ b/Essentials/src/com/earth2me/essentials/commands/NotEnoughArgumentsException.java @@ -5,11 +5,16 @@ public class NotEnoughArgumentsException extends Exception { public NotEnoughArgumentsException() { - super(); + super(""); + } + + public NotEnoughArgumentsException(final String string) + { + super(string); } public NotEnoughArgumentsException(final Throwable ex) { - super(ex); + super("", ex); } } diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index e0a23002b..f162176de 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -68,6 +68,10 @@ downloadingGeoIp=Downloading GeoIP database ... this might take a while (country duplicatedUserdata=Duplicated userdata: {0} and {1} enableUnlimited=\u00a77Giving unlimited amount of {0} to {1}. enabled=enabled +enchantmentApplied = \u00a77The enchantment {0} has been applied to your item in hand. +enchantmentNotFound = \u00a7cEnchantment not found +enchantmentPerm = \u00a7cYou do not have the permission for {0} +enchantments = \u00a77Enchantments: {0} errorCallingCommand=Error calling command /{0} errorWithMessage=\u00a7cError: {0} essentialsReload=\u00a77Essentials Reloaded {0} @@ -221,6 +225,7 @@ notAllowedToShout=\u00a7cYou are not authorized to shout. notEnoughMoney=You do not have sufficient funds. notRecommendedBukkit=Bukkit version is not the recommended build for Essentials. notSupportedYet=Not supported yet. +nothingInHand = \u00a7cYou have nothing in your hand. now=now numberRequired=A number goes there, silly. onlyDayNight=/time only supports day/night. diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties index 53bf399f3..997f48acc 100644 --- a/Essentials/src/messages_da.properties +++ b/Essentials/src/messages_da.properties @@ -68,6 +68,10 @@ downloadingGeoIp=Downloader GeoIP database ... det her kan tage et stykke tid (l duplicatedUserdata=Duplikerede userdata: {0} og {1} enableUnlimited=\u00a77Giver ubegr\u00e6nset m\u00e6ngde af {0} til {1}. enabled=aktiveret +enchantmentApplied = \u00a77The enchantment {0} has been applied to your item in hand. +enchantmentNotFound = \u00a7cEnchantment not found +enchantmentPerm = \u00a7cYou do not have the permission for {0} +enchantments = \u00a77Enchantments: {0} errorCallingCommand=Fejl ved opkald af kommando /{0} errorWithMessage=\u00a7cFejl: {0} essentialsReload=\u00a77Essentials Genindl\u00e6st {0} @@ -221,6 +225,7 @@ notAllowedToShout=\u00a7cDu er ikke autoriseret til at r\u00e5be. notEnoughMoney=Du har ikke tilstr\u00e6kkelig penge. notRecommendedBukkit=Bukkit version er ikke den anbefalede byg for Essentials. notSupportedYet=Ikke underst\u00f8ttet endnu. +nothingInHand = \u00a7cYou have nothing in your hand. now=nu numberRequired=Der skal v\u00e6re et nummer, fjolle. onlyDayNight=/time underst\u00f8tter kun day/night. diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties index e0bd6dca7..f92d6e18e 100644 --- a/Essentials/src/messages_de.properties +++ b/Essentials/src/messages_de.properties @@ -68,6 +68,10 @@ downloadingGeoIp=Lade GeoIP-Datenbank ... dies kann etwas dauern (country: 0.6 M duplicatedUserdata=Doppelte Datei in userdata: {0} und {1} enableUnlimited=\u00a77Gebe {1} unendliche Mengen von {0}. enabled=aktiviert +enchantmentApplied = \u00a77The enchantment {0} has been applied to your item in hand. +enchantmentNotFound = \u00a7cEnchantment not found +enchantmentPerm = \u00a7cYou do not have the permission for {0} +enchantments = \u00a77Enchantments: {0} errorCallingCommand=Fehler beim Aufrufen des Befehls /{0} errorWithMessage=\u00a7cFehler: {0} essentialsReload=\u00a77Essentials neu geladen {0} @@ -221,6 +225,7 @@ notAllowedToShout=\u00a7cDu bist nicht berechtigt zu schreien. notEnoughMoney=Du hast nicht genug Geld. notRecommendedBukkit=Die verwendete Bukkit-Version ist nicht f\u00fcr Essentials empfohlen. notSupportedYet=Noch nicht verf\u00fcgbar. +nothingInHand = \u00a7cYou have nothing in your hand. now=jetzt numberRequired=Ein Zahl wird ben\u00f6tigt. onlyDayNight=/time unterst\u00fctzt nur day und night. diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties index e89004bf7..d8f4b85da 100644 --- a/Essentials/src/messages_en.properties +++ b/Essentials/src/messages_en.properties @@ -68,6 +68,10 @@ downloadingGeoIp=Downloading GeoIP database ... this might take a while (country duplicatedUserdata=Duplicated userdata: {0} and {1} enableUnlimited=\u00a77Giving unlimited amount of {0} to {1}. enabled=enabled +enchantmentApplied = \u00a77The enchantment {0} has been applied to your item in hand. +enchantmentNotFound = \u00a7cEnchantment not found +enchantmentPerm = \u00a7cYou do not have the permission for {0} +enchantments = \u00a77Enchantments: {0} errorCallingCommand=Error calling command /{0} errorWithMessage=\u00a7cError: {0} essentialsReload=\u00a77Essentials Reloaded {0} @@ -221,6 +225,7 @@ notAllowedToShout=\u00a7cYou are not authorized to shout. notEnoughMoney=You do not have sufficient funds. notRecommendedBukkit=Bukkit version is not the recommended build for Essentials. notSupportedYet=Not supported yet. +nothingInHand = \u00a7cYou have nothing in your hand. now=now numberRequired=A number goes there, silly. onlyDayNight=/time only supports day/night. diff --git a/Essentials/src/messages_es.properties b/Essentials/src/messages_es.properties index ffa0af2ce..796515a15 100644 --- a/Essentials/src/messages_es.properties +++ b/Essentials/src/messages_es.properties @@ -68,6 +68,10 @@ downloadingGeoIp=Descargando base de datos de GeoIP ... puede llevar un tiempo ( duplicatedUserdata=Datos de usuario duplicados: {0} y {1} enableUnlimited=\u00a77Dando cantidad ilimitada de {0} a {1}. enabled=activado +enchantmentApplied = \u00a77The enchantment {0} has been applied to your item in hand. +enchantmentNotFound = \u00a7cEnchantment not found +enchantmentPerm = \u00a7cYou do not have the permission for {0} +enchantments = \u00a77Enchantments: {0} errorCallingCommand=Error al ejecutar el comando /{0} errorWithMessage=\u00a7cError: {0} essentialsReload=\u00a77Essentials Recargado {0} @@ -221,6 +225,7 @@ notAllowedToShout=\u00a7cNo estas autorizado para gritar. notEnoughMoney=No tienes el dinero suficiente. notRecommendedBukkit=La version de bukkit no es la recomendada para esta version de Essentials. notSupportedYet=No esta soportado aun. +nothingInHand = \u00a7cYou have nothing in your hand. now=ahora numberRequired=Un numero es necesario, amigo. onlyDayNight=/time solo soporta day/night. (dia/noche) diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties index 1d3cddea0..93b4d6c83 100644 --- a/Essentials/src/messages_fr.properties +++ b/Essentials/src/messages_fr.properties @@ -68,6 +68,10 @@ downloadingGeoIp=T\u00e9l\u00e9chargement de la base de donn\u00e9es GeoIP ... c duplicatedUserdata=Donn\u00e9e utilisateur dupliqu\u00e9e: {0} et {1} enableUnlimited=\u00a77Donner un nombre illimit\u00e9 de {0} \u00e0 {1}. enabled=activ\u00e9 +enchantmentApplied = \u00a77The enchantment {0} has been applied to your item in hand. +enchantmentNotFound = \u00a7cEnchantment not found +enchantmentPerm = \u00a7cYou do not have the permission for {0} +enchantments = \u00a77Enchantments: {0} errorCallingCommand=Erreur en appelant la commande /{0} errorWithMessage=\u00a7cErreur: {0} essentialsReload=\u00a77Essentials Recharg\u00e9 {0} @@ -221,6 +225,7 @@ notAllowedToShout=\u00a7cVous n''\u00eates pas autoris\u00e9 \u00e0 crier. notEnoughMoney=Vous n''avez pas les fonds n\u00e9cessaires. notRecommendedBukkit=La version de Bukkit n''est pas celle qui est recommand\u00e9 pour cette version de Essentials. notSupportedYet=Pas encore pris en charge. +nothingInHand = \u00a7cYou have nothing in your hand. now=maintenant numberRequired=On a besoin d''un nombre ici, idiot. onlyDayNight=/time ne supporte que (jour) day/night (nuit). diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties index ea0cf99d8..a297dc683 100644 --- a/Essentials/src/messages_nl.properties +++ b/Essentials/src/messages_nl.properties @@ -68,6 +68,10 @@ downloadingGeoIp=Bezig met downloaden van GeoIP database ... Dit kan een tijdje duplicatedUserdata=Dubbele userdata: {0} en {1}. enableUnlimited=\u00a77Oneindig aantal {0} aan {1} gegeven. enabled=ingeschakeld +enchantmentApplied = \u00a77The enchantment {0} has been applied to your item in hand. +enchantmentNotFound = \u00a7cEnchantment not found +enchantmentPerm = \u00a7cYou do not have the permission for {0} +enchantments = \u00a77Enchantments: {0} errorCallingCommand=Fout bij het aanroepen van de opdracht /{0} errorWithMessage=\u00a7cFout: {0} essentialsReload=\u00a77Essentials is herladen {0} @@ -221,6 +225,7 @@ notAllowedToShout=\u00a7cJe bent niet bevoegd om de roep functie te gebruiken. notEnoughMoney=Je hebt niet voldoende middelen. notRecommendedBukkit=De Bukkit versie is niet de aangeraden build voor Essentials. notSupportedYet=Nog niet ondersteund. +nothingInHand = \u00a7cYou have nothing in your hand. now=nu numberRequired=Er moet daar een nummer, grapjas. onlyDayNight=/time ondersteund alleen day/night. -- cgit v1.2.3 From 65776d6ed2a4bcdabcdf228da711699530d7dc1f Mon Sep 17 00:00:00 2001 From: snowleo Date: Sun, 27 Nov 2011 04:46:33 +0100 Subject: BedLocationFix for CraftBukkit --- .../essentials/EssentialsPlayerListener.java | 3 ++- .../earth2me/essentials/commands/Commandhome.java | 5 ++-- .../essentials/craftbukkit/BedLocationFix.java | 27 ++++++++++++++++++++++ .../spawn/EssentialsSpawnPlayerListener.java | 5 ++-- 4 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 Essentials/src/com/earth2me/essentials/craftbukkit/BedLocationFix.java diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java index f92f9d808..0ae77fbe5 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java @@ -1,5 +1,6 @@ package com.earth2me.essentials; +import com.earth2me.essentials.craftbukkit.BedLocationFix; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.textreader.IText; import com.earth2me.essentials.textreader.KeywordReplacer; @@ -233,7 +234,7 @@ public class EssentialsPlayerListener extends PlayerListener { Location loc = user.getHome(user.getLocation()); if (loc == null) { - loc = user.getBedSpawnLocation(); + loc = BedLocationFix.getBedSpawnLocation(user); } if (loc != null) { user.setCompassTarget(loc); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java index 090cebd4c..60b1d1147 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java @@ -4,6 +4,7 @@ import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; import com.earth2me.essentials.Util; +import com.earth2me.essentials.craftbukkit.BedLocationFix; import java.util.List; import java.util.Locale; import org.bukkit.Location; @@ -44,7 +45,7 @@ public class Commandhome extends EssentialsCommand try { if ("bed".equalsIgnoreCase(homeName)) { - final Location bed = player.getBedSpawnLocation(); + final Location bed = BedLocationFix.getBedSpawnLocation(player); if (bed != null) { user.getTeleport().teleport(bed, charge); @@ -57,7 +58,7 @@ public class Commandhome extends EssentialsCommand final List homes = player.getHomes(); if (homes.isEmpty() && player.equals(user)) { - final Location loc = player.getBedSpawnLocation(); + final Location loc = BedLocationFix.getBedSpawnLocation(player); if (loc == null) { if (ess.getSettings().spawnIfNoHome()) diff --git a/Essentials/src/com/earth2me/essentials/craftbukkit/BedLocationFix.java b/Essentials/src/com/earth2me/essentials/craftbukkit/BedLocationFix.java new file mode 100644 index 000000000..dc4818284 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/craftbukkit/BedLocationFix.java @@ -0,0 +1,27 @@ +package com.earth2me.essentials.craftbukkit; + +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.craftbukkit.entity.CraftPlayer; +import org.bukkit.entity.Player; + + +public class BedLocationFix +{ + /* + * Adds missing null pointer check to getHandle().getBed() + */ + public static Location getBedSpawnLocation(final Player player) + { + final CraftPlayer cplayer = (CraftPlayer)player; + final World world = player.getServer().getWorld(cplayer.getHandle().spawnWorld); + if (world != null && cplayer.getHandle().getBed() != null) + { + return new Location(world, cplayer.getHandle().getBed().x, cplayer.getHandle().getBed().y, cplayer.getHandle().getBed().z); + } + else + { + return null; + } + } +} diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java index 57b842c82..a14f8bb71 100644 --- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java +++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java @@ -3,6 +3,7 @@ package com.earth2me.essentials.spawn; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.IEssentials; import com.earth2me.essentials.User; +import com.earth2me.essentials.craftbukkit.BedLocationFix; import java.util.logging.Level; import java.util.logging.Logger; import org.bukkit.Location; @@ -31,7 +32,7 @@ public class EssentialsSpawnPlayerListener extends PlayerListener Location home = user.getHome(user.getLocation()); if (home == null) { - home = user.getBedSpawnLocation(); + home = BedLocationFix.getBedSpawnLocation(user); } if (home != null) { @@ -51,7 +52,7 @@ public class EssentialsSpawnPlayerListener extends PlayerListener { final User user = ess.getUser(event.getPlayer()); - if (!user.isNew() || user.getBedSpawnLocation() != null) + if (!user.isNew() || BedLocationFix.getBedSpawnLocation(user) != null) { return; } -- cgit v1.2.3 From d5c852b79dd2aa1aac78bf2d57800456294b0b6c Mon Sep 17 00:00:00 2001 From: KHobbits Date: Sun, 27 Nov 2011 04:54:48 +0000 Subject: URL went nowhere. --- Essentials/src/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml index a68630f67..52c87bb4b 100644 --- a/Essentials/src/config.yml +++ b/Essentials/src/config.yml @@ -333,7 +333,7 @@ chat: protect: # Database settings for sign/rail protection # get mysql.jar and sqlite and place it in your serverroot/lib directory from here: - # http://java.net/projects/essentials/sources/svn/show/lib?rev=435 + # https://github.com/essentials/Essentials/blob/master/lib/mysql.jar # mysql, sqlite or none datatype: 'sqlite' -- cgit v1.2.3 From f250a107e4b9cbfbe6e3cb04ddd89c91f91908d2 Mon Sep 17 00:00:00 2001 From: snowleo Date: Sun, 27 Nov 2011 06:00:58 +0100 Subject: CB#1518 B#1042 Support for Enchantments & Removed broken BedFix (in cb now) --- .../src/com/earth2me/essentials/Essentials.java | 2 +- .../com/earth2me/essentials/EssentialsConf.java | 31 ++++++++++++-- .../essentials/EssentialsEntityListener.java | 3 +- .../essentials/EssentialsPlayerListener.java | 4 +- .../src/com/earth2me/essentials/FakeInventory.java | 1 + .../earth2me/essentials/InventoryWorkaround.java | 24 +++++++---- .../src/com/earth2me/essentials/OfflinePlayer.java | 1 + .../earth2me/essentials/commands/Commandhome.java | 5 +-- .../earth2me/essentials/commands/Commandsell.java | 1 + .../essentials/craftbukkit/BedLocationFix.java | 27 ------------- .../com/earth2me/essentials/signs/SignTrade.java | 4 +- .../essentials/storage/BukkitConstructor.java | 39 ++++++++++++++++-- .../essentials/storage/YamlStorageWriter.java | 45 ++++++++++++++------- .../spawn/EssentialsSpawnPlayerListener.java | 5 +-- lib/bukkit-1.0.0-R1-SNAPSHOT.jar | Bin 4396182 -> 4396376 bytes lib/craftbukkit-1.0.0-SNAPSHOT.jar | Bin 9780993 -> 9781560 bytes 16 files changed, 124 insertions(+), 68 deletions(-) delete mode 100644 Essentials/src/com/earth2me/essentials/craftbukkit/BedLocationFix.java diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java index 6af8e83e6..62f7ad04e 100644 --- a/Essentials/src/com/earth2me/essentials/Essentials.java +++ b/Essentials/src/com/earth2me/essentials/Essentials.java @@ -57,7 +57,7 @@ import org.bukkit.scheduler.BukkitScheduler; public class Essentials extends JavaPlugin implements IEssentials { - public static final int BUKKIT_VERSION = 1512; + public static final int BUKKIT_VERSION = 1518; private static final Logger LOGGER = Logger.getLogger("Minecraft"); private transient ISettings settings; private final transient TNTExplodeListener tntListener = new TNTExplodeListener(this); diff --git a/Essentials/src/com/earth2me/essentials/EssentialsConf.java b/Essentials/src/com/earth2me/essentials/EssentialsConf.java index 512b9c60a..5e6b7ca13 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsConf.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsConf.java @@ -2,7 +2,9 @@ package com.earth2me.essentials; import static com.earth2me.essentials.I18n._; import java.io.*; +import java.util.Collections; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; @@ -10,6 +12,7 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Server; import org.bukkit.World; +import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.ItemStack; import org.bukkit.util.config.Configuration; @@ -224,13 +227,25 @@ public class EssentialsConf extends Configuration public ItemStack getItemStack(final String path) { - return new ItemStack( + final ItemStack stack = new ItemStack( Material.valueOf(getString(path + ".type", "AIR")), getInt(path + ".amount", 1), - (short)getInt(path + ".damage", 0)/* + (short)getInt(path + ".damage", 0)); + List enchants = getKeys(path + ".enchant"); + for (String enchant : enchants) + { + Enchantment enchantment = Enchantment.getByName(enchant); + if (enchantment == null) { + continue; + } + int level = getInt(path+ ".enchant."+enchant, enchantment.getStartLevel()); + stack.addUnsafeEnchantment(enchantment, level); + } + return stack; + /* * , * (byte)getInt(path + ".data", 0) - */); + */ } public void setProperty(final String path, final ItemStack stack) @@ -239,6 +254,16 @@ public class EssentialsConf extends Configuration map.put("type", stack.getType().toString()); map.put("amount", stack.getAmount()); map.put("damage", stack.getDurability()); + Map enchantments = stack.getEnchantments(); + if (!enchantments.isEmpty()) + { + Map enchant = new HashMap(); + for (Map.Entry entry : enchantments.entrySet()) + { + enchant.put(entry.getKey().getName(), entry.getValue()); + } + map.put("enchant", enchant); + } // getData().getData() is broken //map.put("data", stack.getDurability()); setProperty(path, map); diff --git a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java index 322d94d8f..214fc8c01 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java @@ -57,7 +57,8 @@ public class EssentialsEntityListener extends EntityListener ItemStack hand = player.getItemInHand(); if (hand != null && hand.getType() == Material.MILK_BUCKET) { ((Animals)eDefend).setAge(-24000); - player.setItemInHand(new ItemStack(Material.BUCKET, hand.getAmount())); + hand.setType(Material.BUCKET); + player.setItemInHand(hand); player.updateInventory(); event.setCancelled(true); } diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java index 0ae77fbe5..206154e6f 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java @@ -1,6 +1,5 @@ package com.earth2me.essentials; -import com.earth2me.essentials.craftbukkit.BedLocationFix; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.textreader.IText; import com.earth2me.essentials.textreader.KeywordReplacer; @@ -17,7 +16,6 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Server; import org.bukkit.entity.Player; -import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerLoginEvent.Result; import org.bukkit.event.player.*; import org.bukkit.inventory.ItemStack; @@ -234,7 +232,7 @@ public class EssentialsPlayerListener extends PlayerListener { Location loc = user.getHome(user.getLocation()); if (loc == null) { - loc = BedLocationFix.getBedSpawnLocation(user); + loc = user.getBedSpawnLocation(); } if (loc != null) { user.setCompassTarget(loc); diff --git a/Essentials/src/com/earth2me/essentials/FakeInventory.java b/Essentials/src/com/earth2me/essentials/FakeInventory.java index fef6db7d0..32c653d86 100644 --- a/Essentials/src/com/earth2me/essentials/FakeInventory.java +++ b/Essentials/src/com/earth2me/essentials/FakeInventory.java @@ -20,6 +20,7 @@ public class FakeInventory implements Inventory continue; } this.items[i] = new ItemStack(items[i].getTypeId(), items[i].getAmount(), items[i].getDurability()); + this.items[i].addEnchantments(items[i].getEnchantments()); } } diff --git a/Essentials/src/com/earth2me/essentials/InventoryWorkaround.java b/Essentials/src/com/earth2me/essentials/InventoryWorkaround.java index 0470488b8..8b412e72f 100644 --- a/Essentials/src/com/earth2me/essentials/InventoryWorkaround.java +++ b/Essentials/src/com/earth2me/essentials/InventoryWorkaround.java @@ -34,7 +34,7 @@ public final class InventoryWorkaround { continue; } - if (item.getTypeId() == cItem.getTypeId() && (!forceAmount || item.getAmount() == cItem.getAmount()) && (!forceDurability || cItem.getDurability() == item.getDurability())) + if (item.getTypeId() == cItem.getTypeId() && (!forceAmount || item.getAmount() == cItem.getAmount()) && (!forceDurability || cItem.getDurability() == item.getDurability()) && cItem.getEnchantments().equals(item.getEnchantments())) { return i; } @@ -56,7 +56,7 @@ public final class InventoryWorkaround { continue; } - if (item.getTypeId() == cItem.getTypeId() && cItem.getAmount() < cItem.getType().getMaxStackSize() && (!forceDurability || cItem.getDurability() == item.getDurability())) + if (item.getTypeId() == cItem.getTypeId() && cItem.getAmount() < cItem.getType().getMaxStackSize() && (!forceDurability || cItem.getDurability() == item.getDurability()) && cItem.getEnchantments().equals(item.getEnchantments())) { return i; } @@ -102,9 +102,10 @@ public final class InventoryWorkaround if (combined[j] == null) { combined[j] = new ItemStack(items[i].getType(), items[i].getAmount(), items[i].getDurability()); + combined[j].addEnchantments(items[i].getEnchantments()); break; } - if (combined[j].getTypeId() == items[i].getTypeId() && (!forceDurability || combined[j].getDurability() == items[i].getDurability())) + if (combined[j].getTypeId() == items[i].getTypeId() && (!forceDurability || combined[j].getDurability() == items[i].getDurability()) && combined[j].getEnchantments().equals(items[i].getEnchantments())) { combined[j].setAmount(combined[j].getAmount() + items[i].getAmount()); break; @@ -143,7 +144,9 @@ public final class InventoryWorkaround // More than a single stack! if (item.getAmount() > item.getType().getMaxStackSize()) { - cinventory.setItem(firstFree, new ItemStack(item.getTypeId(), item.getType().getMaxStackSize(), item.getDurability())); + ItemStack stack = new ItemStack(item.getTypeId(), item.getType().getMaxStackSize(), item.getDurability()); + stack.addEnchantments(item.getEnchantments()); + cinventory.setItem(firstFree, stack); item.setAmount(item.getAmount() - item.getType().getMaxStackSize()); } else @@ -257,9 +260,10 @@ public final class InventoryWorkaround if (combined[j] == null) { combined[j] = new ItemStack(items[i].getType(), items[i].getAmount(), items[i].getDurability()); + combined[j].addEnchantments(items[i].getEnchantments()); break; } - if (combined[j].getTypeId() == items[i].getTypeId() && (!forceDurability || combined[j].getDurability() == items[i].getDurability())) + if (combined[j].getTypeId() == items[i].getTypeId() && (!forceDurability || combined[j].getDurability() == items[i].getDurability()) && combined[j].getEnchantments().equals(items[i].getEnchantments())) { combined[j].setAmount(combined[j].getAmount() + items[i].getAmount()); break; @@ -318,14 +322,18 @@ public final class InventoryWorkaround final int maxStackSize = itm.getType().getMaxStackSize(); final int stacks = itm.getAmount() / maxStackSize; final int leftover = itm.getAmount() % maxStackSize; - Item[] itemStacks = new Item[stacks + (leftover > 0 ? 1 : 0)]; + final Item[] itemStacks = new Item[stacks + (leftover > 0 ? 1 : 0)]; for (int i = 0; i < stacks; i++) { - itemStacks[i] = loc.getWorld().dropItem(loc, new ItemStack(itm.getType(), maxStackSize, itm.getDurability())); + final ItemStack stack = new ItemStack(itm.getType(), maxStackSize, itm.getDurability()); + stack.addEnchantments(itm.getEnchantments()); + itemStacks[i] = loc.getWorld().dropItem(loc, stack); } if (leftover > 0) { - itemStacks[stacks] = loc.getWorld().dropItem(loc, new ItemStack(itm.getType(), leftover, itm.getDurability())); + final ItemStack stack = new ItemStack(itm.getType(), leftover, itm.getDurability()); + stack.addEnchantments(itm.getEnchantments()); + itemStacks[stacks] = loc.getWorld().dropItem(loc, stack); } return itemStacks; } diff --git a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java index d8c871b5b..deccf6516 100644 --- a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java +++ b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java @@ -4,6 +4,7 @@ import static com.earth2me.essentials.I18n._; import java.net.InetSocketAddress; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; import java.util.UUID; import lombok.Delegate; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java index 60b1d1147..090cebd4c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java @@ -4,7 +4,6 @@ import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; import com.earth2me.essentials.Util; -import com.earth2me.essentials.craftbukkit.BedLocationFix; import java.util.List; import java.util.Locale; import org.bukkit.Location; @@ -45,7 +44,7 @@ public class Commandhome extends EssentialsCommand try { if ("bed".equalsIgnoreCase(homeName)) { - final Location bed = BedLocationFix.getBedSpawnLocation(player); + final Location bed = player.getBedSpawnLocation(); if (bed != null) { user.getTeleport().teleport(bed, charge); @@ -58,7 +57,7 @@ public class Commandhome extends EssentialsCommand final List homes = player.getHomes(); if (homes.isEmpty() && player.equals(user)) { - final Location loc = BedLocationFix.getBedSpawnLocation(player); + final Location loc = player.getBedSpawnLocation(); if (loc == null) { if (ess.getSettings().spawnIfNoHome()) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsell.java b/Essentials/src/com/earth2me/essentials/commands/Commandsell.java index 9ca622aef..1639f5360 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsell.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsell.java @@ -149,6 +149,7 @@ public class Commandsell extends EssentialsCommand } } + //TODO: Prices for Enchantments final ItemStack ris = new ItemStack(is.getType(), amount, is.getDurability()); InventoryWorkaround.removeItem(user.getInventory(), true, ris); user.updateInventory(); diff --git a/Essentials/src/com/earth2me/essentials/craftbukkit/BedLocationFix.java b/Essentials/src/com/earth2me/essentials/craftbukkit/BedLocationFix.java deleted file mode 100644 index dc4818284..000000000 --- a/Essentials/src/com/earth2me/essentials/craftbukkit/BedLocationFix.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.earth2me.essentials.craftbukkit; - -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.craftbukkit.entity.CraftPlayer; -import org.bukkit.entity.Player; - - -public class BedLocationFix -{ - /* - * Adds missing null pointer check to getHandle().getBed() - */ - public static Location getBedSpawnLocation(final Player player) - { - final CraftPlayer cplayer = (CraftPlayer)player; - final World world = player.getServer().getWorld(cplayer.getHandle().spawnWorld); - if (world != null && cplayer.getHandle().getBed() != null) - { - return new Location(world, cplayer.getHandle().getBed().x, cplayer.getHandle().getBed().y, cplayer.getHandle().getBed().z); - } - else - { - return null; - } - } -} diff --git a/Essentials/src/com/earth2me/essentials/signs/SignTrade.java b/Essentials/src/com/earth2me/essentials/signs/SignTrade.java index c2f3eb8e4..28635796a 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignTrade.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignTrade.java @@ -76,7 +76,9 @@ public class SignTrade extends EssentialsSign amount -= amount % trade.getItemStack().getAmount(); if (amount > 0) { - final Trade store = new Trade(new ItemStack(player.getItemInHand().getTypeId(), amount, player.getItemInHand().getDurability()), ess); + final ItemStack stack = new ItemStack(player.getItemInHand().getTypeId(), amount, player.getItemInHand().getDurability()); + stack.addEnchantments(player.getItemInHand().getEnchantments()); + final Trade store = new Trade(stack, ess); addAmount(sign, 2, store, ess); store.charge(player); return store; diff --git a/Essentials/src/com/earth2me/essentials/storage/BukkitConstructor.java b/Essentials/src/com/earth2me/essentials/storage/BukkitConstructor.java index 2656d183d..6d7066c58 100644 --- a/Essentials/src/com/earth2me/essentials/storage/BukkitConstructor.java +++ b/Essentials/src/com/earth2me/essentials/storage/BukkitConstructor.java @@ -1,10 +1,12 @@ package com.earth2me.essentials.storage; +import java.util.Locale; import java.util.regex.Pattern; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; +import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.ItemStack; import org.bukkit.material.MaterialData; import org.yaml.snakeyaml.constructor.Constructor; @@ -83,7 +85,7 @@ public class BukkitConstructor extends Constructor { return null; } - final String[] split1 = val.split("\\W", 2); + final String[] split1 = val.split("\\W"); if (split1.length == 0) { return null; @@ -109,11 +111,42 @@ public class BukkitConstructor extends Constructor data = Short.parseShort(split2[1]); } int size = mat.getMaxStackSize(); - if (split1.length == 2 && NUMPATTERN.matcher(split1[1]).matches()) + if (split1.length > 1 && NUMPATTERN.matcher(split1[1]).matches()) { size = Integer.parseInt(split1[1]); } - return new ItemStack(mat, size, data); + final ItemStack stack = new ItemStack(mat, size, data); + if (split1.length > 2) + { + for (int i = 2; i < split1.length; i++) + { + final String[] split3 = split1[0].split("[:+',;.]", 2); + if (split3.length != 2) + { + continue; + } + Enchantment enchantment; + if (NUMPATTERN.matcher(split3[0]).matches()) + { + final int enchantId = Integer.parseInt(split3[0]); + enchantment = Enchantment.getById(enchantId); + } + else + { + enchantment = Enchantment.getByName(split3[0].toUpperCase(Locale.ENGLISH)); + } + if (enchantment == null) { + continue; + } + int level = enchantment.getStartLevel(); + if (NUMPATTERN.matcher(split3[1]).matches()) + { + level = Integer.parseInt(split3[1]); + } + stack.addUnsafeEnchantment(enchantment, level); + } + } + return stack; } return super.construct(node); } diff --git a/Essentials/src/com/earth2me/essentials/storage/YamlStorageWriter.java b/Essentials/src/com/earth2me/essentials/storage/YamlStorageWriter.java index 048abe737..da636bf71 100644 --- a/Essentials/src/com/earth2me/essentials/storage/YamlStorageWriter.java +++ b/Essentials/src/com/earth2me/essentials/storage/YamlStorageWriter.java @@ -5,6 +5,7 @@ import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.Collection; import java.util.Collections; +import java.util.Locale; import java.util.Map; import java.util.Map.Entry; import java.util.logging.Level; @@ -12,6 +13,7 @@ import java.util.logging.Logger; import java.util.regex.Pattern; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.ItemStack; import org.bukkit.material.MaterialData; import org.yaml.snakeyaml.Yaml; @@ -22,12 +24,12 @@ public class YamlStorageWriter implements IStorageWriter private transient static final Pattern NON_WORD_PATTERN = Pattern.compile("\\W"); private transient final PrintWriter writer; private transient static final Yaml YAML = new Yaml(); - + public YamlStorageWriter(final PrintWriter writer) { this.writer = writer; } - + public void save(final StorageObject object) { try @@ -43,7 +45,7 @@ public class YamlStorageWriter implements IStorageWriter Logger.getLogger(YamlStorageWriter.class.getName()).log(Level.SEVERE, null, ex); } } - + private void writeToFile(final Object object, final int depth, final Class clazz) throws IllegalAccessException { for (Field field : clazz.getDeclaredFields()) @@ -52,7 +54,7 @@ public class YamlStorageWriter implements IStorageWriter if (Modifier.isPrivate(modifier) && !Modifier.isTransient(modifier) && !Modifier.isStatic(modifier)) { field.setAccessible(true); - + final Object data = field.get(object); if (writeKey(field, depth, data)) { @@ -83,7 +85,7 @@ public class YamlStorageWriter implements IStorageWriter } } } - + private boolean writeKey(final Field field, final int depth, final Object data) { final boolean commentPresent = writeComment(field, depth); @@ -107,7 +109,7 @@ public class YamlStorageWriter implements IStorageWriter } return false; } - + private boolean writeComment(final Field field, final int depth) { final boolean commentPresent = field.isAnnotationPresent(Comment.class); @@ -129,7 +131,7 @@ public class YamlStorageWriter implements IStorageWriter } return commentPresent; } - + private void writeCollection(final Collection data, final int depth) throws IllegalAccessException { writer.println(); @@ -160,7 +162,7 @@ public class YamlStorageWriter implements IStorageWriter } writer.println(); } - + private void writeMap(final Map data, final int depth) throws IllegalArgumentException, IllegalAccessException { writer.println(); @@ -197,7 +199,7 @@ public class YamlStorageWriter implements IStorageWriter } } } - + private void writeIndention(final int depth) { for (int i = 0; i < depth; i++) @@ -205,7 +207,7 @@ public class YamlStorageWriter implements IStorageWriter writer.print(" "); } } - + private void writeScalar(final Object data) { if (data instanceof String || data instanceof Boolean || data instanceof Number) @@ -228,16 +230,29 @@ public class YamlStorageWriter implements IStorageWriter else if (data instanceof ItemStack) { final ItemStack itemStack = (ItemStack)data; - writer.println(itemStack.getType().toString().toLowerCase() - + (itemStack.getDurability() > 0 ? ":" + itemStack.getDurability() : "") - + " " + itemStack.getAmount()); + writer.print(itemStack.getType().toString().toLowerCase(Locale.ENGLISH)); + + if (itemStack.getDurability() > 0) + { + writer.print(':'); + writer.print(itemStack.getDurability()); + } + writer.print(' '); + writer.print(itemStack.getAmount()); + for (Entry entry : itemStack.getEnchantments().entrySet()) + { + writer.print(' '); + writer.print(entry.getKey().getName().toLowerCase(Locale.ENGLISH)); + writer.print(':'); + writer.print(entry.getValue()); + } } else { throw new UnsupportedOperationException(); } } - + private void writeKey(final Object data) { if (data instanceof String || data instanceof Boolean || data instanceof Number) @@ -269,7 +284,7 @@ public class YamlStorageWriter implements IStorageWriter throw new UnsupportedOperationException(); } } - + private void writeLocation(final Location entry, final int depth) { writer.println(); diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java index a14f8bb71..57b842c82 100644 --- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java +++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java @@ -3,7 +3,6 @@ package com.earth2me.essentials.spawn; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.IEssentials; import com.earth2me.essentials.User; -import com.earth2me.essentials.craftbukkit.BedLocationFix; import java.util.logging.Level; import java.util.logging.Logger; import org.bukkit.Location; @@ -32,7 +31,7 @@ public class EssentialsSpawnPlayerListener extends PlayerListener Location home = user.getHome(user.getLocation()); if (home == null) { - home = BedLocationFix.getBedSpawnLocation(user); + home = user.getBedSpawnLocation(); } if (home != null) { @@ -52,7 +51,7 @@ public class EssentialsSpawnPlayerListener extends PlayerListener { final User user = ess.getUser(event.getPlayer()); - if (!user.isNew() || BedLocationFix.getBedSpawnLocation(user) != null) + if (!user.isNew() || user.getBedSpawnLocation() != null) { return; } diff --git a/lib/bukkit-1.0.0-R1-SNAPSHOT.jar b/lib/bukkit-1.0.0-R1-SNAPSHOT.jar index dd15e3e2f..60939e166 100644 Binary files a/lib/bukkit-1.0.0-R1-SNAPSHOT.jar and b/lib/bukkit-1.0.0-R1-SNAPSHOT.jar differ diff --git a/lib/craftbukkit-1.0.0-SNAPSHOT.jar b/lib/craftbukkit-1.0.0-SNAPSHOT.jar index 62f18732e..9285ca484 100644 Binary files a/lib/craftbukkit-1.0.0-SNAPSHOT.jar and b/lib/craftbukkit-1.0.0-SNAPSHOT.jar differ -- cgit v1.2.3 From 34edf34ba3710b074a95c8b76434a75ed4b5dd2f Mon Sep 17 00:00:00 2001 From: snowleo Date: Sun, 27 Nov 2011 06:10:11 +0100 Subject: Using the ItemStack.clone() method --- .../src/com/earth2me/essentials/FakeInventory.java | 3 +-- .../com/earth2me/essentials/InventoryWorkaround.java | 18 ++++++++---------- .../src/com/earth2me/essentials/signs/SignTrade.java | 4 ++-- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/FakeInventory.java b/Essentials/src/com/earth2me/essentials/FakeInventory.java index 32c653d86..6496fb75b 100644 --- a/Essentials/src/com/earth2me/essentials/FakeInventory.java +++ b/Essentials/src/com/earth2me/essentials/FakeInventory.java @@ -19,8 +19,7 @@ public class FakeInventory implements Inventory { continue; } - this.items[i] = new ItemStack(items[i].getTypeId(), items[i].getAmount(), items[i].getDurability()); - this.items[i].addEnchantments(items[i].getEnchantments()); + this.items[i] = items[i].clone(); } } diff --git a/Essentials/src/com/earth2me/essentials/InventoryWorkaround.java b/Essentials/src/com/earth2me/essentials/InventoryWorkaround.java index 8b412e72f..bca932ad5 100644 --- a/Essentials/src/com/earth2me/essentials/InventoryWorkaround.java +++ b/Essentials/src/com/earth2me/essentials/InventoryWorkaround.java @@ -101,8 +101,7 @@ public final class InventoryWorkaround { if (combined[j] == null) { - combined[j] = new ItemStack(items[i].getType(), items[i].getAmount(), items[i].getDurability()); - combined[j].addEnchantments(items[i].getEnchantments()); + combined[j] = items[i].clone(); break; } if (combined[j].getTypeId() == items[i].getTypeId() && (!forceDurability || combined[j].getDurability() == items[i].getDurability()) && combined[j].getEnchantments().equals(items[i].getEnchantments())) @@ -144,8 +143,8 @@ public final class InventoryWorkaround // More than a single stack! if (item.getAmount() > item.getType().getMaxStackSize()) { - ItemStack stack = new ItemStack(item.getTypeId(), item.getType().getMaxStackSize(), item.getDurability()); - stack.addEnchantments(item.getEnchantments()); + ItemStack stack = item.clone(); + stack.setAmount(item.getType().getMaxStackSize()); cinventory.setItem(firstFree, stack); item.setAmount(item.getAmount() - item.getType().getMaxStackSize()); } @@ -259,8 +258,7 @@ public final class InventoryWorkaround { if (combined[j] == null) { - combined[j] = new ItemStack(items[i].getType(), items[i].getAmount(), items[i].getDurability()); - combined[j].addEnchantments(items[i].getEnchantments()); + combined[j] = items[i].clone(); break; } if (combined[j].getTypeId() == items[i].getTypeId() && (!forceDurability || combined[j].getDurability() == items[i].getDurability()) && combined[j].getEnchantments().equals(items[i].getEnchantments())) @@ -325,14 +323,14 @@ public final class InventoryWorkaround final Item[] itemStacks = new Item[stacks + (leftover > 0 ? 1 : 0)]; for (int i = 0; i < stacks; i++) { - final ItemStack stack = new ItemStack(itm.getType(), maxStackSize, itm.getDurability()); - stack.addEnchantments(itm.getEnchantments()); + final ItemStack stack = itm.clone(); + stack.setAmount(maxStackSize); itemStacks[i] = loc.getWorld().dropItem(loc, stack); } if (leftover > 0) { - final ItemStack stack = new ItemStack(itm.getType(), leftover, itm.getDurability()); - stack.addEnchantments(itm.getEnchantments()); + final ItemStack stack = itm.clone(); + stack.setAmount(leftover); itemStacks[stacks] = loc.getWorld().dropItem(loc, stack); } return itemStacks; diff --git a/Essentials/src/com/earth2me/essentials/signs/SignTrade.java b/Essentials/src/com/earth2me/essentials/signs/SignTrade.java index 28635796a..7a7031758 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignTrade.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignTrade.java @@ -76,8 +76,8 @@ public class SignTrade extends EssentialsSign amount -= amount % trade.getItemStack().getAmount(); if (amount > 0) { - final ItemStack stack = new ItemStack(player.getItemInHand().getTypeId(), amount, player.getItemInHand().getDurability()); - stack.addEnchantments(player.getItemInHand().getEnchantments()); + final ItemStack stack = player.getItemInHand().clone(); + stack.setAmount(amount); final Trade store = new Trade(stack, ess); addAmount(sign, 2, store, ess); store.charge(player); -- cgit v1.2.3 From 3c71ae4cd96b38f7368c062281b8546a86773949 Mon Sep 17 00:00:00 2001 From: snowleo Date: Sun, 27 Nov 2011 06:23:07 +0100 Subject: Locale.ENGLISH!!1! --- Essentials/src/com/earth2me/essentials/EssentialsConf.java | 5 +++-- Essentials/src/com/earth2me/essentials/Settings.java | 2 +- Essentials/src/com/earth2me/essentials/commands/Commandeco.java | 3 ++- .../src/com/earth2me/essentials/commands/Commandenchant.java | 4 ++-- .../src/com/earth2me/essentials/commands/Commandspawnmob.java | 2 +- .../src/com/earth2me/essentials/storage/YamlStorageWriter.java | 8 ++++---- .../essentials/chat/EssentialsChatPlayerListenerLowest.java | 3 ++- .../essentials/chat/EssentialsChatPlayerListenerNormal.java | 3 ++- EssentialsUpdate/src/org/jibble/pircbot/PircBot.java | 2 +- EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java | 2 +- 10 files changed, 19 insertions(+), 15 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/EssentialsConf.java b/Essentials/src/com/earth2me/essentials/EssentialsConf.java index 5e6b7ca13..b07c9710f 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsConf.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsConf.java @@ -5,6 +5,7 @@ import java.io.*; import java.util.Collections; import java.util.HashMap; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; @@ -234,7 +235,7 @@ public class EssentialsConf extends Configuration List enchants = getKeys(path + ".enchant"); for (String enchant : enchants) { - Enchantment enchantment = Enchantment.getByName(enchant); + Enchantment enchantment = Enchantment.getByName(enchant.toUpperCase(Locale.ENGLISH)); if (enchantment == null) { continue; } @@ -260,7 +261,7 @@ public class EssentialsConf extends Configuration Map enchant = new HashMap(); for (Map.Entry entry : enchantments.entrySet()) { - enchant.put(entry.getKey().getName(), entry.getValue()); + enchant.put(entry.getKey().getName().toLowerCase(Locale.ENGLISH), entry.getValue()); } map.put("enchant", enchant); } diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java index ab5b0a364..4fa67a72a 100644 --- a/Essentials/src/com/earth2me/essentials/Settings.java +++ b/Essentials/src/com/earth2me/essentials/Settings.java @@ -234,7 +234,7 @@ public class Settings implements ISettings try { - return ChatColor.valueOf(colorName.toUpperCase()); + return ChatColor.valueOf(colorName.toUpperCase(Locale.ENGLISH)); } catch (IllegalArgumentException ex) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandeco.java b/Essentials/src/com/earth2me/essentials/commands/Commandeco.java index f4a653ce3..8f432ca6e 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandeco.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandeco.java @@ -1,6 +1,7 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.User; +import java.util.Locale; import org.bukkit.Server; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -24,7 +25,7 @@ public class Commandeco extends EssentialsCommand double amount; try { - cmd = EcoCommands.valueOf(args[0].toUpperCase()); + cmd = EcoCommands.valueOf(args[0].toUpperCase(Locale.ENGLISH)); amount = Double.parseDouble(args[2].replaceAll("[^0-9\\.]", "")); } catch (Exception ex) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java b/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java index 107727e32..ed0a98fd1 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java @@ -68,7 +68,7 @@ public class Commandenchant extends EssentialsCommand final Set enchantmentslist = new TreeSet(); for (Map.Entry entry : ENCHANTMENTS.entrySet()) { - final String enchantmentName = entry.getValue().getName().toLowerCase(); + final String enchantmentName = entry.getValue().getName().toLowerCase(Locale.ENGLISH); if (enchantmentslist.contains(enchantmentName) || user.isAuthorized("essentials.enchant." + enchantmentName)) { enchantmentslist.add(entry.getKey()); @@ -98,7 +98,7 @@ public class Commandenchant extends EssentialsCommand { throw new Exception(_("enchantmentNotFound")); } - final String enchantmentName = enchantment.getName().toLowerCase(); + final String enchantmentName = enchantment.getName().toLowerCase(Locale.ENGLISH); if (!user.isAuthorized("essentials.enchant." + enchantmentName)) { throw new Exception(_("enchantmentPerm", enchantmentName)); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java index 14fa3dca3..66c6b4414 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java @@ -205,7 +205,7 @@ public class Commandspawnmob extends EssentialsCommand } else { - ((Sheep)spawned).setColor(DyeColor.valueOf(data.toUpperCase())); + ((Sheep)spawned).setColor(DyeColor.valueOf(data.toUpperCase(Locale.ENGLISH))); } } catch (Exception e) diff --git a/Essentials/src/com/earth2me/essentials/storage/YamlStorageWriter.java b/Essentials/src/com/earth2me/essentials/storage/YamlStorageWriter.java index da636bf71..c260b3bde 100644 --- a/Essentials/src/com/earth2me/essentials/storage/YamlStorageWriter.java +++ b/Essentials/src/com/earth2me/essentials/storage/YamlStorageWriter.java @@ -219,12 +219,12 @@ public class YamlStorageWriter implements IStorageWriter } else if (data instanceof Material) { - writer.println(data.toString().toLowerCase()); + writer.println(data.toString().toLowerCase(Locale.ENGLISH)); } else if (data instanceof MaterialData) { final MaterialData matData = (MaterialData)data; - writer.println(matData.getItemType().toString().toLowerCase() + writer.println(matData.getItemType().toString().toLowerCase(Locale.ENGLISH) + (matData.getData() > 0 ? ":" + matData.getData() : "")); } else if (data instanceof ItemStack) @@ -271,12 +271,12 @@ public class YamlStorageWriter implements IStorageWriter } else if (data instanceof Material) { - writer.print(data.toString().toLowerCase()); + writer.print(data.toString().toLowerCase(Locale.ENGLISH)); } else if (data instanceof MaterialData) { final MaterialData matData = (MaterialData)data; - writer.print(matData.getItemType().toString().toLowerCase() + writer.print(matData.getItemType().toString().toLowerCase(Locale.ENGLISH) + (matData.getData() > 0 ? ":" + matData.getData() : "")); } else diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java index 0945fcd93..0a599e88b 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java +++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java @@ -2,6 +2,7 @@ package com.earth2me.essentials.chat; import com.earth2me.essentials.IEssentials; import com.earth2me.essentials.User; +import java.util.Locale; import java.util.Map; import org.bukkit.Server; import org.bukkit.event.player.PlayerChatEvent; @@ -30,6 +31,6 @@ public class EssentialsChatPlayerListenerLowest extends EssentialsChatPlayer { event.setMessage(event.getMessage().replaceAll("&([0-9a-f])", "\u00a7$1")); } - event.setFormat(ess.getSettings().getChatFormat(user.getGroup()).replace('&', '\u00a7').replace("\u00a7\u00a7", "&").replace("{DISPLAYNAME}", "%1$s").replace("{GROUP}", user.getGroup()).replace("{MESSAGE}", "%2$s").replace("{WORLDNAME}", user.getWorld().getName()).replace("{SHORTWORLDNAME}", user.getWorld().getName().substring(0, 1).toUpperCase())); + event.setFormat(ess.getSettings().getChatFormat(user.getGroup()).replace('&', '\u00a7').replace("\u00a7\u00a7", "&").replace("{DISPLAYNAME}", "%1$s").replace("{GROUP}", user.getGroup()).replace("{MESSAGE}", "%2$s").replace("{WORLDNAME}", user.getWorld().getName()).replace("{SHORTWORLDNAME}", user.getWorld().getName().substring(0, 1).toUpperCase(Locale.ENGLISH))); } } diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerNormal.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerNormal.java index 363e4ca6e..7789009e1 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerNormal.java +++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerNormal.java @@ -4,6 +4,7 @@ import com.earth2me.essentials.ChargeException; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.IEssentials; import com.earth2me.essentials.User; +import java.util.Locale; import java.util.Map; import org.bukkit.Server; import org.bukkit.event.player.PlayerChatEvent; @@ -50,7 +51,7 @@ public class EssentialsChatPlayerListenerNormal extends EssentialsChatPlayer format.append(chatType).append("Format"); StringBuilder errorMsg = new StringBuilder(); - errorMsg.append("notAllowedTo").append(chatType.substring(0, 1).toUpperCase()).append(chatType.substring(1)); + errorMsg.append("notAllowedTo").append(chatType.substring(0, 1).toUpperCase(Locale.ENGLISH)).append(chatType.substring(1)); if (user.isAuthorized(permission.toString())) { diff --git a/EssentialsUpdate/src/org/jibble/pircbot/PircBot.java b/EssentialsUpdate/src/org/jibble/pircbot/PircBot.java index acdf01b46..28148075f 100755 --- a/EssentialsUpdate/src/org/jibble/pircbot/PircBot.java +++ b/EssentialsUpdate/src/org/jibble/pircbot/PircBot.java @@ -774,7 +774,7 @@ public abstract class PircBot implements ReplyConstants { } } - command = command.toUpperCase(); + command = command.toUpperCase(Locale.ENGLISH); if (sourceNick.startsWith(":")) { sourceNick = sourceNick.substring(1); } diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java index 695969378..72bdb113d 100644 --- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java +++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java @@ -187,7 +187,7 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager final String level = config.getString("log-level", "info"); try { - logLevel = Level.parse(level.toUpperCase()); + logLevel = Level.parse(level.toUpperCase(Locale.ENGLISH)); } catch (IllegalArgumentException e) { -- cgit v1.2.3 From 9b6c01d0716791ef0ca51eb97397c88a8b65891b Mon Sep 17 00:00:00 2001 From: snowleo Date: Sun, 27 Nov 2011 07:32:42 +0100 Subject: /spawner without mobname outputs available mobs --- Essentials/src/com/earth2me/essentials/commands/Commandspawner.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java b/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java index e92b29a93..bdbcc4a8c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java @@ -23,8 +23,7 @@ public class Commandspawner extends EssentialsCommand { if (args.length < 1 || args[0].length() < 2) { - throw new NotEnoughArgumentsException(); - //TODO: user.sendMessage("§7Mobs: Zombie PigZombie Skeleton Slime Chicken Pig Monster Spider Creeper Ghast Squid Giant Cow Sheep Wolf"); + throw new NotEnoughArgumentsException(_("mobsAvailable", Util.joinList(Mob.getMobList()))); } final Location target = Util.getTarget(user); -- cgit v1.2.3 From a8a72da15e71ec62032d6fbfb1f219ea03a00d6a Mon Sep 17 00:00:00 2001 From: snowleo Date: Sun, 27 Nov 2011 07:33:03 +0100 Subject: Added 1.9 material where you can stand --- Essentials/src/com/earth2me/essentials/Util.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Essentials/src/com/earth2me/essentials/Util.java b/Essentials/src/com/earth2me/essentials/Util.java index f73c4daa8..8fc7da3af 100644 --- a/Essentials/src/com/earth2me/essentials/Util.java +++ b/Essentials/src/com/earth2me/essentials/Util.java @@ -240,7 +240,8 @@ public class Util AIR_MATERIALS.add(Material.PUMPKIN_STEM.getId()); AIR_MATERIALS.add(Material.MELON_STEM.getId()); AIR_MATERIALS.add(Material.VINE.getId()); - //TODO: Add 1.9 materials + AIR_MATERIALS.add(Material.NETHER_WARTS.getId()); + AIR_MATERIALS.add(Material.WATER_LILY.getId()); for (Integer integer : AIR_MATERIALS) { -- cgit v1.2.3 From 41e8c4c7b874974088ffe8b33495f2206046c20f Mon Sep 17 00:00:00 2001 From: snowleo Date: Sun, 27 Nov 2011 07:47:16 +0100 Subject: Enchantments on Trade signs? Fixes check, so we won't add items that are enchanted. --- Essentials/src/com/earth2me/essentials/signs/SignTrade.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/signs/SignTrade.java b/Essentials/src/com/earth2me/essentials/signs/SignTrade.java index 7a7031758..4b6e4395c 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignTrade.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignTrade.java @@ -4,7 +4,7 @@ import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.*; import org.bukkit.inventory.ItemStack; - +//TODO: Sell Enchantment on Trade signs? public class SignTrade extends EssentialsSign { public SignTrade() @@ -70,7 +70,8 @@ public class SignTrade extends EssentialsSign final Trade trade = getTrade(sign, 2, false, false, ess); if (trade.getItemStack() != null && player.getItemInHand() != null && trade.getItemStack().getTypeId() == player.getItemInHand().getTypeId() - && trade.getItemStack().getDurability() == player.getItemInHand().getDurability()) + && trade.getItemStack().getDurability() == player.getItemInHand().getDurability() + && trade.getItemStack().getEnchantments().equals(player.getItemInHand().getEnchantments())) { int amount = player.getItemInHand().getAmount(); amount -= amount % trade.getItemStack().getAmount(); -- cgit v1.2.3 From 9c56b147ee830894ded7e3aa86b8ada64cf2943c Mon Sep 17 00:00:00 2001 From: snowleo Date: Sun, 27 Nov 2011 08:18:41 +0100 Subject: Enchantment Multiplier in future Worth config --- .../com/earth2me/essentials/settings/Worth.java | 5 + .../essentials/storage/BukkitConstructor.java | 60 +++++++++++- .../essentials/storage/EnchantmentLevel.java | 57 ++++++++++++ .../essentials/storage/YamlStorageWriter.java | 103 +++++++++++++-------- 4 files changed, 187 insertions(+), 38 deletions(-) create mode 100644 Essentials/src/com/earth2me/essentials/storage/EnchantmentLevel.java diff --git a/Essentials/src/com/earth2me/essentials/settings/Worth.java b/Essentials/src/com/earth2me/essentials/settings/Worth.java index 939cdd883..707f907cf 100644 --- a/Essentials/src/com/earth2me/essentials/settings/Worth.java +++ b/Essentials/src/com/earth2me/essentials/settings/Worth.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.settings; +import com.earth2me.essentials.storage.EnchantmentLevel; import com.earth2me.essentials.storage.MapKeyType; import com.earth2me.essentials.storage.MapValueType; import com.earth2me.essentials.storage.StorageObject; @@ -8,6 +9,7 @@ import java.util.Map; import lombok.Data; import lombok.EqualsAndHashCode; import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; import org.bukkit.material.MaterialData; @@ -21,6 +23,9 @@ public class Worth implements StorageObject @MapKeyType(MaterialData.class) @MapValueType(Double.class) private Map buy = new HashMap(); + @MapKeyType(EnchantmentLevel.class) + @MapValueType(Double.class) + private Map enchantmentMultiplier = new HashMap(); public Worth() { diff --git a/Essentials/src/com/earth2me/essentials/storage/BukkitConstructor.java b/Essentials/src/com/earth2me/essentials/storage/BukkitConstructor.java index 6d7066c58..c48204a06 100644 --- a/Essentials/src/com/earth2me/essentials/storage/BukkitConstructor.java +++ b/Essentials/src/com/earth2me/essentials/storage/BukkitConstructor.java @@ -71,6 +71,10 @@ public class BukkitConstructor extends Constructor { mat = Material.matchMaterial(split[0]); } + if (mat == null) + { + return null; + } byte data = 0; if (split.length == 2 && NUMPATTERN.matcher(split[1]).matches()) { @@ -105,6 +109,10 @@ public class BukkitConstructor extends Constructor { mat = Material.matchMaterial(split2[0]); } + if (mat == null) + { + return null; + } short data = 0; if (split2.length == 2 && NUMPATTERN.matcher(split2[1]).matches()) { @@ -135,7 +143,8 @@ public class BukkitConstructor extends Constructor { enchantment = Enchantment.getByName(split3[0].toUpperCase(Locale.ENGLISH)); } - if (enchantment == null) { + if (enchantment == null) + { continue; } int level = enchantment.getStartLevel(); @@ -143,11 +152,60 @@ public class BukkitConstructor extends Constructor { level = Integer.parseInt(split3[1]); } + if (level < enchantment.getStartLevel()) + { + level = enchantment.getStartLevel(); + } + if (level > enchantment.getMaxLevel()) + { + level = enchantment.getMaxLevel(); + } stack.addUnsafeEnchantment(enchantment, level); } } return stack; } + if (node.getType().equals(EnchantmentLevel.class)) + { + final String val = (String)constructScalar((ScalarNode)node); + if (val.isEmpty()) + { + return null; + } + final String[] split = val.split("[:+',;.]", 2); + if (split.length == 0) + { + return null; + } + Enchantment enchant; + if (NUMPATTERN.matcher(split[0]).matches()) + { + final int typeId = Integer.parseInt(split[0]); + enchant = Enchantment.getById(typeId); + } + else + { + enchant = Enchantment.getByName(split[0].toUpperCase(Locale.ENGLISH)); + } + if (enchant == null) + { + return null; + } + int level = enchant.getStartLevel(); + if (split.length == 2 && NUMPATTERN.matcher(split[1]).matches()) + { + level = Integer.parseInt(split[1]); + } + if (level < enchant.getStartLevel()) + { + level = enchant.getStartLevel(); + } + if (level > enchant.getMaxLevel()) + { + level = enchant.getMaxLevel(); + } + return new EnchantmentLevel(enchant, level); + } return super.construct(node); } } diff --git a/Essentials/src/com/earth2me/essentials/storage/EnchantmentLevel.java b/Essentials/src/com/earth2me/essentials/storage/EnchantmentLevel.java new file mode 100644 index 000000000..0a0299ed3 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/storage/EnchantmentLevel.java @@ -0,0 +1,57 @@ +package com.earth2me.essentials.storage; + +import java.util.Map.Entry; +import org.bukkit.enchantments.Enchantment; + + +public class EnchantmentLevel implements Entry +{ + private Enchantment enchantment; + private int level; + + public EnchantmentLevel(Enchantment enchantment, int level) + { + this.enchantment = enchantment; + this.level = level; + } + + public Enchantment getEnchantment() + { + return enchantment; + } + + public void setEnchantment(Enchantment enchantment) + { + this.enchantment = enchantment; + } + + public int getLevel() + { + return level; + } + + public void setLevel(int level) + { + this.level = level; + } + + @Override + public Enchantment getKey() + { + return enchantment; + } + + @Override + public Integer getValue() + { + return level; + } + + @Override + public Integer setValue(Integer v) + { + int t = level; + level = v; + return t; + } +} diff --git a/Essentials/src/com/earth2me/essentials/storage/YamlStorageWriter.java b/Essentials/src/com/earth2me/essentials/storage/YamlStorageWriter.java index c260b3bde..48540483d 100644 --- a/Essentials/src/com/earth2me/essentials/storage/YamlStorageWriter.java +++ b/Essentials/src/com/earth2me/essentials/storage/YamlStorageWriter.java @@ -24,12 +24,12 @@ public class YamlStorageWriter implements IStorageWriter private transient static final Pattern NON_WORD_PATTERN = Pattern.compile("\\W"); private transient final PrintWriter writer; private transient static final Yaml YAML = new Yaml(); - + public YamlStorageWriter(final PrintWriter writer) { this.writer = writer; } - + public void save(final StorageObject object) { try @@ -45,7 +45,7 @@ public class YamlStorageWriter implements IStorageWriter Logger.getLogger(YamlStorageWriter.class.getName()).log(Level.SEVERE, null, ex); } } - + private void writeToFile(final Object object, final int depth, final Class clazz) throws IllegalAccessException { for (Field field : clazz.getDeclaredFields()) @@ -54,7 +54,7 @@ public class YamlStorageWriter implements IStorageWriter if (Modifier.isPrivate(modifier) && !Modifier.isTransient(modifier) && !Modifier.isStatic(modifier)) { field.setAccessible(true); - + final Object data = field.get(object); if (writeKey(field, depth, data)) { @@ -85,7 +85,7 @@ public class YamlStorageWriter implements IStorageWriter } } } - + private boolean writeKey(final Field field, final int depth, final Object data) { final boolean commentPresent = writeComment(field, depth); @@ -109,7 +109,7 @@ public class YamlStorageWriter implements IStorageWriter } return false; } - + private boolean writeComment(final Field field, final int depth) { final boolean commentPresent = field.isAnnotationPresent(Comment.class); @@ -131,7 +131,7 @@ public class YamlStorageWriter implements IStorageWriter } return commentPresent; } - + private void writeCollection(final Collection data, final int depth) throws IllegalAccessException { writer.println(); @@ -162,7 +162,7 @@ public class YamlStorageWriter implements IStorageWriter } writer.println(); } - + private void writeMap(final Map data, final int depth) throws IllegalArgumentException, IllegalAccessException { writer.println(); @@ -199,7 +199,7 @@ public class YamlStorageWriter implements IStorageWriter } } } - + private void writeIndention(final int depth) { for (int i = 0; i < depth; i++) @@ -207,7 +207,7 @@ public class YamlStorageWriter implements IStorageWriter writer.print(" "); } } - + private void writeScalar(final Object data) { if (data instanceof String || data instanceof Boolean || data instanceof Number) @@ -219,40 +219,30 @@ public class YamlStorageWriter implements IStorageWriter } else if (data instanceof Material) { - writer.println(data.toString().toLowerCase(Locale.ENGLISH)); + writeMaterial(data); + writer.println(); } else if (data instanceof MaterialData) { - final MaterialData matData = (MaterialData)data; - writer.println(matData.getItemType().toString().toLowerCase(Locale.ENGLISH) - + (matData.getData() > 0 ? ":" + matData.getData() : "")); + writeMaterialData(data); + writer.println(); } else if (data instanceof ItemStack) { - final ItemStack itemStack = (ItemStack)data; - writer.print(itemStack.getType().toString().toLowerCase(Locale.ENGLISH)); - - if (itemStack.getDurability() > 0) - { - writer.print(':'); - writer.print(itemStack.getDurability()); - } - writer.print(' '); - writer.print(itemStack.getAmount()); - for (Entry entry : itemStack.getEnchantments().entrySet()) - { - writer.print(' '); - writer.print(entry.getKey().getName().toLowerCase(Locale.ENGLISH)); - writer.print(':'); - writer.print(entry.getValue()); - } + writeItemStack(data); + writer.println(); + } + else if (data instanceof EnchantmentLevel) + { + writeEnchantmentLevel(data); + writer.println(); } else { throw new UnsupportedOperationException(); } } - + private void writeKey(final Object data) { if (data instanceof String || data instanceof Boolean || data instanceof Number) @@ -271,20 +261,59 @@ public class YamlStorageWriter implements IStorageWriter } else if (data instanceof Material) { - writer.print(data.toString().toLowerCase(Locale.ENGLISH)); + writeMaterial(data); } else if (data instanceof MaterialData) { - final MaterialData matData = (MaterialData)data; - writer.print(matData.getItemType().toString().toLowerCase(Locale.ENGLISH) - + (matData.getData() > 0 ? ":" + matData.getData() : "")); + writeMaterialData(data); + } + else if (data instanceof EnchantmentLevel) + { + writeEnchantmentLevel(data); } else { throw new UnsupportedOperationException(); } } - + + private void writeMaterial(final Object data) + { + writer.print(data.toString().toLowerCase(Locale.ENGLISH)); + } + + private void writeMaterialData(final Object data) + { + final MaterialData matData = (MaterialData)data; + writeMaterial(matData.getItemType()); + if (matData.getData() > 0) + { + writer.print(':'); + writer.print(matData.getData()); + } + } + + private void writeItemStack(final Object data) + { + final ItemStack itemStack = (ItemStack)data; + writeMaterialData(itemStack.getData()); + writer.print(' '); + writer.print(itemStack.getAmount()); + for (Entry entry : itemStack.getEnchantments().entrySet()) + { + writer.print(' '); + writeEnchantmentLevel(entry); + } + } + + private void writeEnchantmentLevel(Object data) + { + final Entry enchLevel = (Entry)data; + writer.print(enchLevel.getKey().getName().toLowerCase(Locale.ENGLISH)); + writer.print(':'); + writer.print(enchLevel.getValue()); + } + private void writeLocation(final Location entry, final int depth) { writer.println(); -- cgit v1.2.3 From b8f9a4b96f8ebd6c41f9806e1189edefcbf5c490 Mon Sep 17 00:00:00 2001 From: snowleo Date: Sun, 27 Nov 2011 08:26:52 +0100 Subject: Implement correct hashCode() and equals() in EnchantmentLevel --- .../essentials/storage/EnchantmentLevel.java | 33 ++++++++++++++++++---- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/storage/EnchantmentLevel.java b/Essentials/src/com/earth2me/essentials/storage/EnchantmentLevel.java index 0a0299ed3..a664929f3 100644 --- a/Essentials/src/com/earth2me/essentials/storage/EnchantmentLevel.java +++ b/Essentials/src/com/earth2me/essentials/storage/EnchantmentLevel.java @@ -7,9 +7,9 @@ import org.bukkit.enchantments.Enchantment; public class EnchantmentLevel implements Entry { private Enchantment enchantment; - private int level; + private int level; - public EnchantmentLevel(Enchantment enchantment, int level) + public EnchantmentLevel(final Enchantment enchantment, final int level) { this.enchantment = enchantment; this.level = level; @@ -20,7 +20,7 @@ public class EnchantmentLevel implements Entry return enchantment; } - public void setEnchantment(Enchantment enchantment) + public void setEnchantment(final Enchantment enchantment) { this.enchantment = enchantment; } @@ -30,7 +30,7 @@ public class EnchantmentLevel implements Entry return level; } - public void setLevel(int level) + public void setLevel(final int level) { this.level = level; } @@ -48,10 +48,33 @@ public class EnchantmentLevel implements Entry } @Override - public Integer setValue(Integer v) + public Integer setValue(final Integer v) { int t = level; level = v; return t; } + + @Override + public int hashCode() + { + return enchantment.hashCode() ^ level; + } + + @Override + public boolean equals(final Object obj) + { + if (obj instanceof Entry) + { + final Entry entry = (Entry)obj; + if (entry.getKey() instanceof Enchantment + && entry.getValue() instanceof Integer) + { + final Enchantment enchantment = (Enchantment)entry.getKey(); + final Integer level = (Integer)entry.getValue(); + return this.enchantment.equals(enchantment) && this.level == level.intValue(); + } + } + return false; + } } -- cgit v1.2.3 From 098072517a2bd667e3adc681333192910b442dc5 Mon Sep 17 00:00:00 2001 From: snowleo Date: Sun, 27 Nov 2011 08:57:21 +0100 Subject: Added enchantment to /give and /item Updated plugin.yml --- .../essentials/commands/Commandenchant.java | 37 +++++++++++++++------- .../earth2me/essentials/commands/Commandgive.java | 24 ++++++++++++++ .../earth2me/essentials/commands/Commanditem.java | 24 ++++++++++++++ .../essentials/storage/BukkitConstructor.java | 4 +-- Essentials/src/plugin.yml | 8 +++-- 5 files changed, 82 insertions(+), 15 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java b/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java index ed0a98fd1..42fc250e2 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java @@ -7,6 +7,7 @@ import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.TreeSet; +import java.util.regex.Pattern; import org.bukkit.Server; import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.ItemStack; @@ -16,6 +17,7 @@ import static com.earth2me.essentials.I18n._; public class Commandenchant extends EssentialsCommand { private static final Map ENCHANTMENTS = new HashMap(); + private static final transient Pattern NUMPATTERN = Pattern.compile("\\d+"); static { @@ -89,27 +91,40 @@ public class Commandenchant extends EssentialsCommand level = -1; } } - Enchantment enchantment = Enchantment.getByName(args[0].toUpperCase(Locale.ENGLISH)); + Enchantment enchantment = getEnchantment(args[0], user); + if (level < enchantment.getStartLevel() || level > enchantment.getMaxLevel()) + { + level = enchantment.getMaxLevel(); + } + stack.addEnchantment(enchantment, level); + user.setItemInHand(stack); + user.updateInventory(); + final String enchantmentName = enchantment.getName().toLowerCase(Locale.ENGLISH); + user.sendMessage(_("enchantmentApplied", enchantmentName.replace('_', ' '))); + } + + public static Enchantment getEnchantment(final String name, final User user) throws Exception + { + + Enchantment enchantment; + if (NUMPATTERN.matcher(name).matches()) { + enchantment = Enchantment.getById(Integer.parseInt(name)); + } else { + enchantment = Enchantment.getByName(name.toUpperCase(Locale.ENGLISH)); + } if (enchantment == null) { - enchantment = ENCHANTMENTS.get(args[0].toLowerCase(Locale.ENGLISH)); + enchantment = ENCHANTMENTS.get(name.toLowerCase(Locale.ENGLISH)); } if (enchantment == null) { throw new Exception(_("enchantmentNotFound")); } final String enchantmentName = enchantment.getName().toLowerCase(Locale.ENGLISH); - if (!user.isAuthorized("essentials.enchant." + enchantmentName)) + if (user != null && !user.isAuthorized("essentials.enchant." + enchantmentName)) { throw new Exception(_("enchantmentPerm", enchantmentName)); } - if (level < enchantment.getStartLevel() || level > enchantment.getMaxLevel()) - { - level = enchantment.getMaxLevel(); - } - stack.addEnchantment(enchantment, level); - user.setItemInHand(stack); - user.updateInventory(); - user.sendMessage(_("enchantmentApplied", enchantmentName.replace('_', ' '))); + return enchantment; } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgive.java b/Essentials/src/com/earth2me/essentials/commands/Commandgive.java index ebda30dd5..fb0b78c40 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgive.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgive.java @@ -6,6 +6,7 @@ import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.Server; import org.bukkit.command.CommandSender; +import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -44,6 +45,29 @@ public class Commandgive extends EssentialsCommand stack.setAmount(Integer.parseInt(args[2])); } + if (args.length > 3) + { + for (int i = 3; i < args.length; i++) + { + final String[] split = args[i].split("[:+',;.]", 2); + if (split.length < 1) + { + continue; + } + final Enchantment enchantment = Commandenchant.getEnchantment(split[0], sender instanceof Player ? ess.getUser(sender) : null); + int level; + if (split.length > 1) + { + level = Integer.parseInt(split[1]); + } + else + { + level = enchantment.getMaxLevel(); + } + stack.addEnchantment(enchantment, level); + } + } + if (stack.getType() == Material.AIR) { throw new Exception(ChatColor.RED + "You can't give air."); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanditem.java b/Essentials/src/com/earth2me/essentials/commands/Commanditem.java index 3bd35353a..c17f851e4 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commanditem.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commanditem.java @@ -5,6 +5,7 @@ import com.earth2me.essentials.User; import java.util.Locale; import org.bukkit.Material; import org.bukkit.Server; +import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.ItemStack; @@ -40,6 +41,29 @@ public class Commanditem extends EssentialsCommand stack.setAmount(Integer.parseInt(args[1])); } + if (args.length > 2) + { + for (int i = 2; i < args.length; i++) + { + final String[] split = args[i].split("[:+',;.]", 2); + if (split.length < 1) + { + continue; + } + final Enchantment enchantment = Commandenchant.getEnchantment(split[0], user); + int level; + if (split.length > 1) + { + level = Integer.parseInt(split[1]); + } + else + { + level = enchantment.getMaxLevel(); + } + stack.addEnchantment(enchantment, level); + } + } + if (stack.getType() == Material.AIR) { throw new Exception(_("cantSpawnItem", "Air")); diff --git a/Essentials/src/com/earth2me/essentials/storage/BukkitConstructor.java b/Essentials/src/com/earth2me/essentials/storage/BukkitConstructor.java index c48204a06..7ed12b6d5 100644 --- a/Essentials/src/com/earth2me/essentials/storage/BukkitConstructor.java +++ b/Essentials/src/com/earth2me/essentials/storage/BukkitConstructor.java @@ -129,7 +129,7 @@ public class BukkitConstructor extends Constructor for (int i = 2; i < split1.length; i++) { final String[] split3 = split1[0].split("[:+',;.]", 2); - if (split3.length != 2) + if (split3.length < 1) { continue; } @@ -148,7 +148,7 @@ public class BukkitConstructor extends Constructor continue; } int level = enchantment.getStartLevel(); - if (NUMPATTERN.matcher(split3[1]).matches()) + if (split3.length == 2 && NUMPATTERN.matcher(split3[1]).matches()) { level = Integer.parseInt(split3[1]); } diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml index e3f500b9e..55b7a1c1b 100644 --- a/Essentials/src/plugin.yml +++ b/Essentials/src/plugin.yml @@ -79,6 +79,10 @@ commands: description: Manages the server economy. usage: / aliases: [economy,eeco,eeconomy] + enchant: + description: Enchants the item the user is holding. + usage: / [level] + aliases: [enchantment] essentials: description: Reloads essentials. usage: / @@ -104,7 +108,7 @@ commands: aliases: [mem,memory,egc,emem,ememory] give: description: Give a player an item. - usage: / [amount] + usage: / [amount ...] aliases: [egive] god: description: Enables your godly powers. @@ -140,7 +144,7 @@ commands: aliases: [einvsee] item: description: Spawn an item. - usage: / [amount] + usage: / [amount ...] aliases: [i,eitem] jails: description: List all jails. -- cgit v1.2.3 From 8791a8dbb75ac6ba145f85f5bfb8ecadf146ecc5 Mon Sep 17 00:00:00 2001 From: snowleo Date: Sun, 27 Nov 2011 09:07:15 +0100 Subject: Only print stack trace of motd.txt not found, if debug is on. --- .../essentials/EssentialsPlayerListener.java | 23 ++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java index 206154e6f..2bf989b5c 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java @@ -176,7 +176,14 @@ public class EssentialsPlayerListener extends PlayerListener } catch (IOException ex) { - LOGGER.log(Level.WARNING, ex.getMessage(), ex); + if (ess.getSettings().isDebug()) + { + LOGGER.log(Level.WARNING, ex.getMessage(), ex); + } + else + { + LOGGER.log(Level.WARNING, ex.getMessage()); + } } } @@ -231,10 +238,12 @@ public class EssentialsPlayerListener extends PlayerListener private void updateCompass(final User user) { Location loc = user.getHome(user.getLocation()); - if (loc == null) { + if (loc == null) + { loc = user.getBedSpawnLocation(); } - if (loc != null) { + if (loc != null) + { user.setCompassTarget(loc); } } @@ -362,11 +371,13 @@ public class EssentialsPlayerListener extends PlayerListener @Override public void onPlayerChangedWorld(final PlayerChangedWorldEvent event) { - if (ess.getSettings().getNoGodWorlds().contains(event.getPlayer().getLocation().getWorld().getName())) { + if (ess.getSettings().getNoGodWorlds().contains(event.getPlayer().getLocation().getWorld().getName())) + { User user = ess.getUser(event.getPlayer()); - if (user.isGodModeEnabledRaw()) { + if (user.isGodModeEnabledRaw()) + { user.sendMessage(_("noGodWorldWarning")); } } - } + } } -- cgit v1.2.3 From cbba3639b9a3862c06db263d8a3b054d1b4362ac Mon Sep 17 00:00:00 2001 From: snowleo Date: Sun, 27 Nov 2011 09:09:04 +0100 Subject: Fix Typo --- Essentials/src/com/earth2me/essentials/commands/Commandenchant.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java b/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java index 42fc250e2..ef68b63a9 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java @@ -77,7 +77,7 @@ public class Commandenchant extends EssentialsCommand enchantmentslist.add(enchantmentName); } } - throw new NotEnoughArgumentsException(_("entchantments", Util.joinList(enchantmentslist.toArray()))); + throw new NotEnoughArgumentsException(_("enchantments", Util.joinList(enchantmentslist.toArray()))); } int level = -1; if (args.length > 1) -- cgit v1.2.3 From 76a8f794ef56320adf9559695743e856fd472f15 Mon Sep 17 00:00:00 2001 From: snowleo Date: Sun, 27 Nov 2011 10:02:41 +0100 Subject: Enchantments in CraftBukkit are still broken, but it works with Essentials :) --- .../essentials/EssentialsPlayerListener.java | 3 +- .../earth2me/essentials/InventoryWorkaround.java | 7 ++- .../essentials/commands/Commandenchant.java | 3 +- .../earth2me/essentials/commands/Commandgive.java | 3 +- .../essentials/commands/Commandinvsee.java | 5 +- .../earth2me/essentials/commands/Commanditem.java | 3 +- .../earth2me/essentials/commands/Commandkit.java | 3 +- .../essentials/craftbukkit/EnchantmentFix.java | 66 ++++++++++++++++++++++ 8 files changed, 83 insertions(+), 10 deletions(-) create mode 100644 Essentials/src/com/earth2me/essentials/craftbukkit/EnchantmentFix.java diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java index 2bf989b5c..671f1a479 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java @@ -1,5 +1,6 @@ package com.earth2me.essentials; +import com.earth2me.essentials.craftbukkit.EnchantmentFix; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.textreader.IText; import com.earth2me.essentials.textreader.KeywordReplacer; @@ -114,7 +115,7 @@ public class EssentialsPlayerListener extends PlayerListener } if (user.getSavedInventory() != null) { - user.getInventory().setContents(user.getSavedInventory()); + EnchantmentFix.setContents(user.getInventory(), user.getSavedInventory()); user.setSavedInventory(null); } user.updateActivity(false); diff --git a/Essentials/src/com/earth2me/essentials/InventoryWorkaround.java b/Essentials/src/com/earth2me/essentials/InventoryWorkaround.java index bca932ad5..a5cfdd036 100644 --- a/Essentials/src/com/earth2me/essentials/InventoryWorkaround.java +++ b/Essentials/src/com/earth2me/essentials/InventoryWorkaround.java @@ -1,5 +1,6 @@ package com.earth2me.essentials; +import com.earth2me.essentials.craftbukkit.EnchantmentFix; import java.util.HashMap; import java.util.Map; import org.bukkit.Location; @@ -145,13 +146,13 @@ public final class InventoryWorkaround { ItemStack stack = item.clone(); stack.setAmount(item.getType().getMaxStackSize()); - cinventory.setItem(firstFree, stack); + EnchantmentFix.setItem(cinventory, firstFree, stack); item.setAmount(item.getAmount() - item.getType().getMaxStackSize()); } else { // Just store it - cinventory.setItem(firstFree, item); + EnchantmentFix.setItem(cinventory, firstFree, item); break; } } @@ -230,7 +231,7 @@ public final class InventoryWorkaround { // split the stack and store itemStack.setAmount(amount - toDelete); - cinventory.setItem(first, itemStack); + EnchantmentFix.setItem(cinventory, first, itemStack); toDelete = 0; } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java b/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java index ef68b63a9..962ab54de 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java @@ -2,6 +2,7 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.User; import com.earth2me.essentials.Util; +import com.earth2me.essentials.craftbukkit.EnchantmentFix; import java.util.HashMap; import java.util.Locale; import java.util.Map; @@ -97,7 +98,7 @@ public class Commandenchant extends EssentialsCommand level = enchantment.getMaxLevel(); } stack.addEnchantment(enchantment, level); - user.setItemInHand(stack); + EnchantmentFix.setItemInHand(user.getInventory(), stack); user.updateInventory(); final String enchantmentName = enchantment.getName().toLowerCase(Locale.ENGLISH); user.sendMessage(_("enchantmentApplied", enchantmentName.replace('_', ' '))); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgive.java b/Essentials/src/com/earth2me/essentials/commands/Commandgive.java index fb0b78c40..a9d9bdd6c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgive.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgive.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.InventoryWorkaround; import com.earth2me.essentials.User; import java.util.Locale; import org.bukkit.ChatColor; @@ -76,7 +77,7 @@ public class Commandgive extends EssentialsCommand final User giveTo = getPlayer(server, args, 0); final String itemName = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace('_', ' '); sender.sendMessage(ChatColor.BLUE + "Giving " + stack.getAmount() + " of " + itemName + " to " + giveTo.getDisplayName() + "."); - giveTo.getInventory().addItem(stack); + InventoryWorkaround.addItem(giveTo.getInventory(), true, stack); giveTo.updateInventory(); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java b/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java index 1f5c32faa..d53fe8a77 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java @@ -2,6 +2,7 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; +import com.earth2me.essentials.craftbukkit.EnchantmentFix; import java.util.Arrays; import org.bukkit.Server; import org.bukkit.inventory.ItemStack; @@ -29,7 +30,7 @@ public class Commandinvsee extends EssentialsCommand } if (invUser == user && user.getSavedInventory() != null) { - invUser.getInventory().setContents(user.getSavedInventory()); + EnchantmentFix.setContents(invUser.getInventory(), user.getSavedInventory()); user.setSavedInventory(null); user.sendMessage(_("invRestored")); throw new NoChargeException(); @@ -49,7 +50,7 @@ public class Commandinvsee extends EssentialsCommand { throw new Exception(_("invBigger")); } - user.getInventory().setContents(invUserStack); + EnchantmentFix.setContents(user.getInventory(), invUserStack); user.sendMessage(_("invSee", invUser.getDisplayName())); user.sendMessage(_("invSeeHelp")); throw new NoChargeException(); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanditem.java b/Essentials/src/com/earth2me/essentials/commands/Commanditem.java index c17f851e4..8bdec5e4f 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commanditem.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commanditem.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.InventoryWorkaround; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import java.util.Locale; @@ -71,7 +72,7 @@ public class Commanditem extends EssentialsCommand final String displayName = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace('_', ' '); user.sendMessage(_("itemSpawn", stack.getAmount(), displayName)); - user.getInventory().addItem(stack); + InventoryWorkaround.addItem(user.getInventory(), true, stack); user.updateInventory(); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkit.java b/Essentials/src/com/earth2me/essentials/commands/Commandkit.java index f1aad4394..2e09f28ba 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkit.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkit.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.InventoryWorkaround; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; @@ -113,7 +114,7 @@ public class Commandkit extends EssentialsCommand final int id = Material.getMaterial(Integer.parseInt(parts[0])).getId(); final int amount = parts.length > 1 ? Integer.parseInt(parts[parts.length > 2 ? 2 : 1]) : 1; final short data = parts.length > 2 ? Short.parseShort(parts[1]) : 0; - final HashMap overfilled = user.getInventory().addItem(new ItemStack(id, amount, data)); + final Map overfilled = InventoryWorkaround.addItem(user.getInventory(), true, new ItemStack(id, amount, data)); for (ItemStack itemStack : overfilled.values()) { user.getWorld().dropItemNaturally(user.getLocation(), itemStack); diff --git a/Essentials/src/com/earth2me/essentials/craftbukkit/EnchantmentFix.java b/Essentials/src/com/earth2me/essentials/craftbukkit/EnchantmentFix.java new file mode 100644 index 000000000..b6e18cb3f --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/craftbukkit/EnchantmentFix.java @@ -0,0 +1,66 @@ +package com.earth2me.essentials.craftbukkit; + +import org.bukkit.craftbukkit.inventory.CraftInventory; +import org.bukkit.craftbukkit.inventory.CraftInventoryPlayer; +import org.bukkit.craftbukkit.inventory.CraftItemStack; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + + +public class EnchantmentFix +{ + public static void setContents(Inventory inventory, ItemStack[] items) + { + CraftInventory cInventory = (CraftInventory)inventory; + if (cInventory.getContents().length != items.length) + { + throw new IllegalArgumentException("Invalid inventory size; expected " + cInventory.getContents().length); + } + + net.minecraft.server.ItemStack[] mcItems = cInventory.getInventory().getContents(); + + for (int i = 0; i < items.length; i++) + { + ItemStack item = items[i]; + if (item == null || item.getTypeId() <= 0) + { + mcItems[i] = null; + } + else + { + mcItems[i] = new net.minecraft.server.ItemStack(item.getTypeId(), item.getAmount(), item.getDurability()); + new CraftItemStack(mcItems[i]).addUnsafeEnchantments(item.getEnchantments()); + } + } + } + + public static void setItem(Inventory inventory, int index, ItemStack item) + { + CraftInventory cInventory = (CraftInventory)inventory; + if (item == null) + { + cInventory.getInventory().setItem(index, null); + } + else + { + net.minecraft.server.ItemStack stack = new net.minecraft.server.ItemStack(item.getTypeId(), item.getAmount(), item.getDurability()); + new CraftItemStack(stack).addUnsafeEnchantments(item.getEnchantments()); + cInventory.getInventory().setItem(index, stack); + } + } + + public static void setItemInHand(Inventory inventory, ItemStack item) + { + CraftInventoryPlayer cInventory = (CraftInventoryPlayer)inventory; + if (item == null) + { + cInventory.getInventory().setItem(cInventory.getInventory().itemInHandIndex, null); + } + else + { + net.minecraft.server.ItemStack stack = new net.minecraft.server.ItemStack(item.getTypeId(), item.getAmount(), item.getDurability()); + new CraftItemStack(stack).addUnsafeEnchantments(item.getEnchantments()); + cInventory.getInventory().setItem(cInventory.getInventory().itemInHandIndex, stack); + } + } +} -- cgit v1.2.3 From 0c0c9573be219c15778af830a775b268d1d95c82 Mon Sep 17 00:00:00 2001 From: snowleo Date: Sun, 27 Nov 2011 10:48:10 +0100 Subject: Updated the enchantment names to match those of the game --- .../earth2me/essentials/commands/Commandenchant.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java b/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java index 962ab54de..2e513b29a 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java @@ -24,33 +24,42 @@ public class Commandenchant extends EssentialsCommand { ENCHANTMENTS.put("alldamage", Enchantment.DAMAGE_ALL); ENCHANTMENTS.put("alldmg", Enchantment.DAMAGE_ALL); + ENCHANTMENTS.put("sharpness", Enchantment.DAMAGE_ALL); ENCHANTMENTS.put("arthropodsdamage", Enchantment.DAMAGE_ARTHROPODS); ENCHANTMENTS.put("ardmg", Enchantment.DAMAGE_ARTHROPODS); + ENCHANTMENTS.put("baneofarthropods", Enchantment.DAMAGE_ARTHROPODS); ENCHANTMENTS.put("undeaddamage", Enchantment.DAMAGE_UNDEAD); - ENCHANTMENTS.put("undeaddmg", Enchantment.DAMAGE_UNDEAD); + ENCHANTMENTS.put("smite", Enchantment.DAMAGE_UNDEAD); ENCHANTMENTS.put("digspeed", Enchantment.DIG_SPEED); + ENCHANTMENTS.put("efficiency", Enchantment.DIG_SPEED); ENCHANTMENTS.put("durability", Enchantment.DURABILITY); ENCHANTMENTS.put("dura", Enchantment.DURABILITY); + ENCHANTMENTS.put("unbreaking", Enchantment.DURABILITY); ENCHANTMENTS.put("fireaspect", Enchantment.FIRE_ASPECT); ENCHANTMENTS.put("fire", Enchantment.FIRE_ASPECT); ENCHANTMENTS.put("knockback", Enchantment.KNOCKBACK); ENCHANTMENTS.put("blockslootbonus", Enchantment.LOOT_BONUS_BLOCKS); - ENCHANTMENTS.put("blocksbonus", Enchantment.LOOT_BONUS_BLOCKS); + ENCHANTMENTS.put("fortune", Enchantment.LOOT_BONUS_BLOCKS); ENCHANTMENTS.put("mobslootbonus", Enchantment.LOOT_BONUS_MOBS); - ENCHANTMENTS.put("mobsbonus", Enchantment.LOOT_BONUS_MOBS); + ENCHANTMENTS.put("mobloot", Enchantment.LOOT_BONUS_MOBS); + ENCHANTMENTS.put("looting", Enchantment.LOOT_BONUS_MOBS); ENCHANTMENTS.put("oxygen", Enchantment.OXYGEN); - ENCHANTMENTS.put("environmentalprotection", Enchantment.PROTECTION_ENVIRONMENTAL); - ENCHANTMENTS.put("envprot", Enchantment.PROTECTION_ENVIRONMENTAL); + ENCHANTMENTS.put("respiration", Enchantment.OXYGEN); + ENCHANTMENTS.put("protection", Enchantment.PROTECTION_ENVIRONMENTAL); + ENCHANTMENTS.put("prot", Enchantment.PROTECTION_ENVIRONMENTAL); ENCHANTMENTS.put("explosionsprotection", Enchantment.PROTECTION_EXPLOSIONS); ENCHANTMENTS.put("expprot", Enchantment.PROTECTION_EXPLOSIONS); + ENCHANTMENTS.put("blastprotection", Enchantment.PROTECTION_EXPLOSIONS); ENCHANTMENTS.put("fallprotection", Enchantment.PROTECTION_FALL); ENCHANTMENTS.put("fallprot", Enchantment.PROTECTION_FALL); + ENCHANTMENTS.put("featherfalling", Enchantment.PROTECTION_FALL); ENCHANTMENTS.put("fireprotection", Enchantment.PROTECTION_FIRE); ENCHANTMENTS.put("fireprot", Enchantment.PROTECTION_FIRE); ENCHANTMENTS.put("projectileprotection", Enchantment.PROTECTION_PROJECTILE); ENCHANTMENTS.put("projprot", Enchantment.PROTECTION_PROJECTILE); ENCHANTMENTS.put("silktouch", Enchantment.SILK_TOUCH); ENCHANTMENTS.put("waterworker", Enchantment.WATER_WORKER); + ENCHANTMENTS.put("aquaaffinity", Enchantment.WATER_WORKER); } public Commandenchant() -- cgit v1.2.3 From d5db9d404aefd8ddc96c916119e63caee3f6083d Mon Sep 17 00:00:00 2001 From: snowleo Date: Sun, 27 Nov 2011 10:59:28 +0100 Subject: Revert to the old behavior of oversized stacks. We might remove or change this in the future. --- .../src/com/earth2me/essentials/InventoryWorkaround.java | 11 ++++++++--- .../src/com/earth2me/essentials/commands/Commandgive.java | 2 +- .../src/com/earth2me/essentials/commands/Commanditem.java | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/InventoryWorkaround.java b/Essentials/src/com/earth2me/essentials/InventoryWorkaround.java index a5cfdd036..4ce5cb52e 100644 --- a/Essentials/src/com/earth2me/essentials/InventoryWorkaround.java +++ b/Essentials/src/com/earth2me/essentials/InventoryWorkaround.java @@ -80,6 +80,11 @@ public final class InventoryWorkaround } public static Map addItem(final Inventory cinventory, final boolean forceDurability, final ItemStack... items) + { + return addItem(cinventory, forceDurability, false, null, items); + } + + public static Map addItem(final Inventory cinventory, final boolean forceDurability, final boolean dontBreakStacks, final IEssentials ess, final ItemStack... items) { final Map leftover = new HashMap(); @@ -142,10 +147,10 @@ public final class InventoryWorkaround else { // More than a single stack! - if (item.getAmount() > item.getType().getMaxStackSize()) + if (item.getAmount() > (dontBreakStacks ? ess.getSettings().getDefaultStackSize() : item.getType().getMaxStackSize())) { ItemStack stack = item.clone(); - stack.setAmount(item.getType().getMaxStackSize()); + stack.setAmount(dontBreakStacks ? ess.getSettings().getDefaultStackSize() : item.getType().getMaxStackSize()); EnchantmentFix.setItem(cinventory, firstFree, stack); item.setAmount(item.getAmount() - item.getType().getMaxStackSize()); } @@ -164,7 +169,7 @@ public final class InventoryWorkaround final int amount = item.getAmount(); final int partialAmount = partialItem.getAmount(); - final int maxAmount = partialItem.getType().getMaxStackSize(); + final int maxAmount = dontBreakStacks ? ess.getSettings().getDefaultStackSize() : partialItem.getType().getMaxStackSize(); // Check if it fully fits if (amount + partialAmount <= maxAmount) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgive.java b/Essentials/src/com/earth2me/essentials/commands/Commandgive.java index a9d9bdd6c..32b0564b7 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgive.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgive.java @@ -77,7 +77,7 @@ public class Commandgive extends EssentialsCommand final User giveTo = getPlayer(server, args, 0); final String itemName = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace('_', ' '); sender.sendMessage(ChatColor.BLUE + "Giving " + stack.getAmount() + " of " + itemName + " to " + giveTo.getDisplayName() + "."); - InventoryWorkaround.addItem(giveTo.getInventory(), true, stack); + InventoryWorkaround.addItem(giveTo.getInventory(), true, true, ess, stack); giveTo.updateInventory(); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanditem.java b/Essentials/src/com/earth2me/essentials/commands/Commanditem.java index 8bdec5e4f..0d30b4e77 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commanditem.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commanditem.java @@ -72,7 +72,7 @@ public class Commanditem extends EssentialsCommand final String displayName = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace('_', ' '); user.sendMessage(_("itemSpawn", stack.getAmount(), displayName)); - InventoryWorkaround.addItem(user.getInventory(), true, stack); + InventoryWorkaround.addItem(user.getInventory(), true, true, ess, stack); user.updateInventory(); } } -- cgit v1.2.3 From ccb4d3a7e8fabd4e4e6a607604bef953cb4e9086 Mon Sep 17 00:00:00 2001 From: snowleo Date: Sun, 27 Nov 2011 11:43:42 +0100 Subject: Don't add the internal bukkit names to the enchantment list, to make it shorter. --- Essentials/src/com/earth2me/essentials/commands/Commandenchant.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java b/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java index 2e513b29a..26071d28d 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java @@ -84,7 +84,7 @@ public class Commandenchant extends EssentialsCommand if (enchantmentslist.contains(enchantmentName) || user.isAuthorized("essentials.enchant." + enchantmentName)) { enchantmentslist.add(entry.getKey()); - enchantmentslist.add(enchantmentName); + //enchantmentslist.add(enchantmentName); } } throw new NotEnoughArgumentsException(_("enchantments", Util.joinList(enchantmentslist.toArray()))); -- cgit v1.2.3 From c5251591de0cc085d45a197dbabcb3b9a99ae74d Mon Sep 17 00:00:00 2001 From: snowleo Date: Sun, 27 Nov 2011 16:58:47 +0100 Subject: Allow /unbanip playername, not just ips --- Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java b/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java index 2c1d06f39..2b22ede2c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java @@ -1,6 +1,7 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; +import com.earth2me.essentials.User; import org.bukkit.Server; import org.bukkit.command.CommandSender; @@ -19,7 +20,10 @@ public class Commandunbanip extends EssentialsCommand { throw new NotEnoughArgumentsException(); } - + User user = getPlayer(server, args, 0, true); + if (user != null) { + ess.getServer().unbanIP(user.getLastLoginAddress()); + } ess.getServer().unbanIP(args[0]); sender.sendMessage(_("unbannedIP")); } -- cgit v1.2.3 From 1c6c460a09715d62f6643839742b192dbed104cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Gris?= Date: Sun, 27 Nov 2011 17:52:12 +0100 Subject: Up to date, more accurate french translation. --- Essentials/src/messages_fr.properties | 360 +++++++++++++++++----------------- 1 file changed, 180 insertions(+), 180 deletions(-) diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties index 93b4d6c83..ff7b42240 100644 --- a/Essentials/src/messages_fr.properties +++ b/Essentials/src/messages_fr.properties @@ -1,23 +1,23 @@ -#version: TeamCity +#version: Dev2.7.54 # Single quotes have to be doubled: '' # Translations start here # by: action=* {0} {1} -addedToAccount=\u00a7a{0} a \u00e9t\u00e9 rajout\u00e9 a votre compte. +addedToAccount=\u00a7a{0} a \u00e9t\u00e9 rajout\u00e9 \u00e0 votre compte. addedToOthersAccount=\u00a7a{0} a \u00e9t\u00e9 ajout\u00e9 \u00e0 {1} compte. -alertBroke=a cass\u00e9: +alertBroke=a cass\u00e9 : alertFormat=\u00a73[{0}] \u00a7f {1} \u00a76 {2} \u00e0:{3} -alertPlaced=a plac\u00e9: -alertUsed=a utilis\u00e9: -autoAfkKickReason=You have been kicked for idling more than {0} minutes. +alertPlaced=a plac\u00e9 : +alertUsed=a utilis\u00e9 : +autoAfkKickReason=Vous avez \u00e9t\u00e9 \u00e9ject\u00e9 pour inactivit\u00e9e sup\u00e9rieure \u00e0 {0} minutes. backAfterDeath=\u00a77Utilisez la commande /back pour retourner \u00e0 l''endroit ou vous \u00eates mort. -backUsageMsg=\u00a77Retour a votre emplacement pr\u00e9c\u00e8dent. -backupFinished=Backup termin\u00e9 -backupStarted=D\u00e9but du backup -balance=\u00a77Solde: {0} -balanceTop=\u00a77 Top {0} soldes -banExempt=\u00a77Vous ne pouvez pas interdire ce joueur. -banIpAddress=\u00a77Adresse IP banni +backUsageMsg=\u00a77Retour \u00e0 votre emplacement pr\u00e9cèdent. +backupFinished=Sauvegarde termin\u00e9 +backupStarted=D\u00e9but de la sauvegarde +balance=\u00a77Solde : {0} +balanceTop=\u00a77 Meilleurs {0} soldes +banExempt=\u00a77Vous ne pouvez pas bannir ce joueur. +banIpAddress=\u00a77Adresse IP bannie bannedIpsFileError=Erreur de lecture de banned-ips.txt bannedIpsFileNotFound=Fichier banned-ips.txt introuvable bannedPlayersFileError=Erreur lors de la lecture de banned-players.txt @@ -30,32 +30,32 @@ bukkitFormatChanged=Le format de la version de Bukkit a \u00e9t\u00e9 chang\u00e burnMsg=\u00a77Vous avez enflamm\u00e9 {0} pour {1} seconde(s). canTalkAgain=\u00a77Vous pouvez de nouveau parler. cantFindGeoIpDB=N''arrive pas \u00e0 trouver la base de donn\u00e9es GeoIP! -cantReadGeoIpDB=Echec de la lecture de la base de donn\u00e9s GeoIP! -cantSpawnItem=\u00a7cVous n''avez pas le droit de faire apparaitre {0} -commandFailed=\u00c9chec de la commande {0}: -commandHelpFailedForPlugin=Erreur d'obtention d'aider \u00e0: {0} +cantReadGeoIpDB=Echec de la lecture de la base de donn\u00e9es GeoIP! +cantSpawnItem=\u00a7cVous n''avez pas le droit de faire apparaître {0} +commandFailed=\u00c9chec de la commande {0} : +commandHelpFailedForPlugin=Erreur d''obtention d''aide pour : {0} commandNotLoaded=\u00a7cLa commande {0} a \u00e9t\u00e9 mal charg\u00e9e. -compassBearing=\u00a77Orientation: {0} ({1} degr\u00e9s). -configFileMoveError=\u00c9chec du d\u00e9placement de config.yml vers l''emplacement de backup. -configFileRenameError=\u00c9chec du changement de nom du fichier temp de config.yml -connectedPlayers=Joueurs connect\u00e9s: +compassBearing=\u00a77Orientation : {0} ({1} degr\u00e9s). +configFileMoveError=\u00c9chec du d\u00e9placement de config.yml vers l''emplacement de sauvegarde. +configFileRenameError=\u00c9chec du changement de nom du fichier temporaire de config.yml +connectedPlayers=Joueurs connect\u00e9s : connectionFailed=\u00c9chec de l''ouverture de la connexion. -cooldownWithMessage=\u00a7cRefroidissement: {0} -corruptNodeInConfig=\u00a74Annonce: Votre fichier de configuration a un {0} n\u0153ud corrompu. -couldNotFindTemplate=Le mod\u00e8le {0} est introuvable -creatingConfigFromTemplate=Cr\u00e9ation de la configuration \u00e0 partir du mod\u00e8le : {0} +cooldownWithMessage=\u00a7cR\u00e9utilisation : {0} +corruptNodeInConfig=\u00a74Annonce : Votre fichier de configuration a un {0} n\u0153ud corrompu. +couldNotFindTemplate=Le modèle {0} est introuvable +creatingConfigFromTemplate=Cr\u00e9ation de la configuration \u00e0 partir du modèle : {0} creatingEmptyConfig=Cr\u00e9ation d''une configuration vierge : {0} -creative=creative +creative=cr\u00e9atif day=jour days=jours -defaultBanReason=Le marteau du ban a frapp\u00e9! -deleteFileError=Le fichier n''a pas pu \u00eatre supprim\u00e9: {0} -deleteHome=\u00a77Home {0} has been removed. +defaultBanReason=Le marteau du bannissement a frapp\u00e9 ! +deleteFileError=Le fichier {0} n''a pas pu \u00eatre supprim\u00e9 +deleteHome=\u00a77La r\u00e9sidence {0} a \u00e9t\u00e9 supprim\u00e9e. deleteJail=\u00a77La prison {0} a \u00e9t\u00e9 supprim\u00e9e. deleteWarp=\u00a77Warp {0} supprim\u00e9. -deniedAccessCommand=L''acc\u00e8s \u00e0 la commande a \u00e9t\u00e9 refus\u00e9 pour {0}. +deniedAccessCommand=L''accès \u00e0 la commande a \u00e9t\u00e9 refus\u00e9 pour {0}. dependancyDownloaded=[Essentials] Fichier {0} correctement t\u00e9l\u00e9charg\u00e9. -dependancyException=[Essentials] Une erreur est survenue lors de la tentative de t\u00e9l\u00e9chargement +dependancyException=[Essentials] Une erreur est survenue lors de la tentative de t\u00e9l\u00e9chargement. dependancyNotFound=[Essentials] Une d\u00e9pendance requise n''a pas \u00e9t\u00e9 trouv\u00e9e, t\u00e9l\u00e9chargement en cours. depth=\u00a77Vous \u00eates au niveau de la mer. depthAboveSea=\u00a77Vous \u00eates \u00e0 {0} bloc(s) au-dessus du niveau de la mer. @@ -64,53 +64,53 @@ destinationNotSet=Destination non d\u00e9finie disableUnlimited=\u00a77D\u00e9sactivation du placement illimit\u00e9 de {0} pour {1}. disabled=d\u00e9sactiv\u00e9 dontMoveMessage=\u00a77La t\u00e9l\u00e9portation commence dans {0}. Ne bougez pas. -downloadingGeoIp=T\u00e9l\u00e9chargement de la base de donn\u00e9es GeoIP ... cela peut prendre un moment (campagne : 0.6 Mo, ville : 20Mo) -duplicatedUserdata=Donn\u00e9e utilisateur dupliqu\u00e9e: {0} et {1} -enableUnlimited=\u00a77Donner un nombre illimit\u00e9 de {0} \u00e0 {1}. +downloadingGeoIp=T\u00e9l\u00e9chargement de la base de donn\u00e9es GeoIP ... Cela peut prendre un moment (campagne : 0.6 Mo, ville : 20Mo) +duplicatedUserdata=Donn\u00e9e utilisateur dupliqu\u00e9e : {0} et {1} +enableUnlimited=\u00a77Quantit\u00e9 illimit\u00e9e de {0} \u00e0 {1}. enabled=activ\u00e9 -enchantmentApplied = \u00a77The enchantment {0} has been applied to your item in hand. -enchantmentNotFound = \u00a7cEnchantment not found -enchantmentPerm = \u00a7cYou do not have the permission for {0} -enchantments = \u00a77Enchantments: {0} +enchantmentApplied = \u00a77L''enchantement {0} a \u00e9t\u00e9 appliqu\u00e9 \u00e0 l''objet dans votre main. +enchantmentNotFound = \u00a7cEnchantement non-trouv\u00e9 +enchantmentPerm = \u00a7cVous n''avez pas les droits pour {0}. +enchantments = \u00a77Enchantments : {0} errorCallingCommand=Erreur en appelant la commande /{0} -errorWithMessage=\u00a7cErreur: {0} +errorWithMessage=\u00a7cErreur : {0} essentialsReload=\u00a77Essentials Recharg\u00e9 {0} -extinguish=\u00a77Vous vous \u00eates \u00e9teint. -extinguishOthers=\u00a77Vous avez \u00e9teint {0}. +extinguish=\u00a77Vous cessez de br\u00fbler. +extinguishOthers=\u00a77Vous avez \u00e9teint la combustion de {0}. failedToCloseConfig=Echec de la fermeture de la configuration {0} failedToCreateConfig=Echec de la cr\u00e9ation de la configuration {0} failedToWriteConfig=\u00c9chec de l''\u00e9criture de la configuration {0} -false=false -fileRenameError=Echec du changement de nom de {0}. -foreverAlone=\u00a7cVous n''avez personne \u00e0 qui r\u00e9pondre. +false=faux +fileRenameError=Echec du changement de nom de {0} +foreverAlone=\u00a7cVous n''avez personne \u00e0 qui r\u00e9pondre freedMemory=A lib\u00e9r\u00e9 {0} Mo. -gameMode=\u00a77Set game mode {0} for {1}. -gcchunks=chunks, +gameMode=\u00a77Mode de jeu {0} pour {1}. +gcchunks=portions, gcentities=entit\u00e9s -gcfree=Free memory: {0} Mo -gcmax=M\u00e9moire maximale: {0} Mo -gctotal=Allocated memory: {0} Mo -geoIpUrlEmpty=L''url de t\u00e9l\u00e9chargement de GeoIP est vide. -geoIpUrlInvalid=L''url de t\u00e9l\u00e9chargement de GeoIP est invalide. +gcfree=M\u00e9moire libre : {0} Mo +gcmax=M\u00e9moire maximale : {0} Mo +gctotal=M\u00e9moire utilis\u00e9e : {0} Mo +geoIpUrlEmpty=L''URL de t\u00e9l\u00e9chargement de GeoIP est vide. +geoIpUrlInvalid=L''URL de t\u00e9l\u00e9chargement de GeoIP est invalide. geoipJoinFormat=Joueur {0} vient de {1} -godDisabledFor=d\u00e9sactive pour {0} +godDisabledFor=d\u00e9sactiv\u00e9 pour {0} godEnabledFor=activ\u00e9 pour {0} godMode=\u00a77Mode Dieu {0}. -haveBeenReleased=\u00a77Vous avez \u00e9t\u00e9 lib\u00e9r\u00e9 +haveBeenReleased=\u00a77Vous avez \u00e9t\u00e9 lib\u00e9r\u00e9. heal=\u00a77Vous avez \u00e9t\u00e9 soign\u00e9. healOther=\u00a77{0} a \u00e9t\u00e9 soign\u00e9. helpConsole=Pour voir l''aide tapez ? helpOp=\u00a7c[Aide Admin]\u00a7f \u00a77{0}:\u00a7f {1} helpPages=Page \u00a7c{0}\u00a7f sur \u00a7c{1}\u00a7f. holeInFloor=Trou dans le Sol. -homeSet=\u00a77Home d\u00e9fini. -homeSetToBed=\u00a77Votre home est d\u00e9sormais d\u00e9fini sur ce lit. -homes=Homes: {0} +homeSet=\u00a77R\u00e9sidence d\u00e9finie. +homeSetToBed=\u00a77Votre r\u00e9sidence est d\u00e9sormais li\u00e9e \u00e0 ce lit. +homes=R\u00e9sidences : {0} hour=heure hours=heures ignorePlayer=Vous ignorez d\u00e9sormais {0}. illegalDate=Format de date ill\u00e9gal. -infoChapter=S\u00e9lectionner le chapitre : +infoChapter=S\u00e9lectionnez le chapitre : infoChapterPages=Chapitre {0}, page \u00a7c{1}\u00a7f sur \u00a7c{2}\u00a7f: infoFileDoesNotExist=Le fichier info.txt n''existe pas. Le fichier est en cours de cr\u00e9ation pour vous. infoPages=Page \u00a7c{0}\u00a7f de \u00a7c{1}\u00a7f. @@ -119,7 +119,7 @@ invBigger=Les inventaires des autres joueurs sont plus gros que le v\u00f4tre. invRestored=Votre inventaire vous a \u00e9t\u00e9 rendu. invSee=Vous voyez l''inventaire de {0}. invSeeHelp=Utilisez /invsee pour voir l''inventaire de quelqu''un. -invalidCharge=\u00a7cInvalide charge. +invalidCharge=\u00a7cCharge invalide. invalidMob=Mauvias type de monstre. invalidServer=Serveur non valide. invalidSignLine=La ligne {0} du panneau est invalide. @@ -132,17 +132,17 @@ itemMustBeStacked=Cet objet doit \u00eatre vendu par 64. Une quantit\u00e9 de 2 itemNotEnough1=\u00a7cVous n''avez pas assez de cet objet pour le vendre. itemNotEnough2=\u00a77Si vous voulez vendre l''int\u00e9gralit\u00e9 de vos objets de ce type l\u00e0, utilisez /sell nomObjet itemNotEnough3=\u00a77/sell nomObjet -1 vendra tout sauf un objet, etc. -itemSellAir=Vous vouliez vraiment vendre de l''air? Mettez un objet dans votre main. +itemSellAir=Vouliez-vous vraiment vendre de l''air ? Mettez un objet dans votre main. itemSold=\u00a77Vendu pour \u00a7c{0} \u00a77({1} {2} \u00e0 {3} chacun) itemSoldConsole={0} vendu {1} pour \u00a77{2} \u00a77({3} objet(s) \u00e0 {4} chacun) itemSpawn=\u00a77Donne {0} de {1} itemsCsvNotLoaded=N''a pas pu charger items.csv. -jailAlreadyIncarcerated=\u00a7cPerson is already in jail: {0} +jailAlreadyIncarcerated=\u00a7cJoueur d\u00e9j\u00e0 emprisonn\u00e9 : {0} jailMessage=\u00a7cVous avez commis un crime, vous en payez le prix. jailNotExist=Cette prison n''existe pas. -jailReleased=\u00a77Player \u00a7e{0}\u00a77 unjailed. -jailReleasedPlayerNotify=\u00a77You have been released! -jailSentenceExtended=Jail time extend to: {0) +jailReleased=\u00a77Joueur \u00a7e{0}\u00a77 lib\u00e9r\u00e9. +jailReleasedPlayerNotify=\u00a77Vous avez \u00e9t\u00e9 lib\u00e9r\u00e9 ! +jailSentenceExtended=Dur\u00e9e d''emprisonnement rallong\u00e9e de : {0) jailSet=\u00a77La prison {0} a \u00e9t\u00e9 cr\u00e9\u00e9. jumpError=\u00c7a aurait pu faire mal au cerveau de votre ordinateur. kickDefault=Kick\u00e9 du serveur @@ -150,37 +150,37 @@ kickExempt=\u00a77Vous ne pouvez pas lancer ce joueur. kill=\u00a77Tu\u00e9 {0}. kitError=\u00a7cIl n''y a pas de kits valides. kitError2=\u00a7cCe kit n''existe pas ou a \u00e9t\u00e9 mal d\u00e9fini. -kitErrorHelp=\u00a7cPeut-\u00eatre qu''un objet manque d''une quantit\u00e9 dans la configuration? +kitErrorHelp=\u00a7cPeut-\u00eatre qu''un objet manque d''une quantit\u00e9 dans la configuration ? kitGive=\u00a77Donner le kit {0}. -kitInvFull=\u00a7cVotre inventaire \u00e9tait plein, le kit est Parre-terre. +kitInvFull=\u00a7cVotre inventaire \u00e9tait plein, le kit est parre-terre. kitTimed=\u00a7cVous ne pouvez pas utiliser ce kit pendant encore {0}. -kits=\u00a77Kits:{0} -lightningSmited=\u00a77Vous venez d''\u00eatre foudroy\u00e9 -lightningUse=\u00a77{0} a \u00e9t\u00e9 foudroy\u00e9 +kits=\u00a77Kits :{0} +lightningSmited=\u00a77Vous venez d''\u00eatre foudroy\u00e9. +lightningUse=\u00a77{0} a \u00e9t\u00e9 foudroy\u00e9. 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. -listHiddenTag = \u00a77[HIDDEN]\u00a7f -loadWarpError=\u00c9chec du chargement du warp {0} +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. +listHiddenTag = \u00a77[MASQU\u00c9]\u00a7f +loadWarpError=\u00c9chec du chargement du raccourci {0} loadinfo={0} version {1} par {2} a \u00e9t\u00e9 charg\u00e9 -localFormat=Local:<{0}> {1} +localFormat=Locale :<{0}> {1} mailClear=\u00a7cPour marquer votre courrier en tant que lu, entrez /mail clear -mailCleared=\u00a77Mail supprim\u00e9 ! +mailCleared=\u00a77Courrier supprim\u00e9 ! mailSent=\u00a77Courrier envoy\u00e9 ! markMailAsRead=\u00a7cPour marquer votre courrier en tant que lu, entrez /mail clear markedAsAway=\u00a77Vous \u00eates d\u00e9sormais AFK. markedAsNotAway=\u00a77Vous n''\u00eates d\u00e9sormais plus AFK. -maxHomes=You cannot set more than {0} homes. +maxHomes=Vous ne pouvez pas cr\u00e9er plus de {0} r\u00e9sidences. mayNotJail=\u00a7cVous ne pouvez pas emprisonner cette personne. me=moi minute=minute minutes=minutes missingItems=Vous n''avez pas {0} x {1}. missingPrefixSuffix=Pr\u00e9fixe ou Suffixe manquant pour {0} -mobSpawnError=Erreur lors du changement du spawner de monstres. -mobSpawnLimit=Quantit\u00e9 de monstres limit\u00e9 \u00e0 la limite du serveur. -mobSpawnTarget=Le bloc cible doit \u00eatre un spawner de monstres. -mobsAvailable=\u00a77Mobs: {0} +mobSpawnError=Erreur lors du changement du g\u00e9n\u00e9rateur de monstres. +mobSpawnLimit=Quantit\u00e9 de monstres limit\u00e9 \u00e0 au maximum du serveur. +mobSpawnTarget=Le bloc cible doit \u00eatre un g\u00e9n\u00e9rateur de monstres. +mobsAvailable=\u00a77Monstres : {0} moneyRecievedFrom=\u00a7a{0} a \u00e9t\u00e9 re\u00e7u de {1} moneySentTo=\u00a7a{0} a \u00e9t\u00e9 envoy\u00e9 \u00e0 {1} moneyTaken={0} pr\u00e9lev\u00e9(s) de votre compte bancaire. @@ -188,26 +188,26 @@ month=mois months=mois moreThanZero=Les Quantit\u00e9s doivent \u00eatre sup\u00e9rieures \u00e0 z\u00e9ro. msgFormat=\u00a77[{0}\u00a77 -> {1}\u00a77] \u00a7f{2} -muteExempt=\u00a7cYou may not mute that player. +muteExempt=\u00a7cVous ne pouvez pas r\u00e9duire ce joueur au silence. mutedPlayer=Le joueur {0} est d\u00e9sormais muet. -mutedPlayerFor={0} a \u00e9t\u00e9 mute pour {1}. +mutedPlayerFor={0} a \u00e9t\u00e9 muet pour {1}. mutedUserSpeaks={0} a essay\u00e9 de parler mais est muet. -needTpohere=Vous avez besoin de l''acc\u00e8s \u00e0 /tpohere pour t\u00e9l\u00e9porter d''autres joueurs. +needTpohere=Vous avez besoin de l''accès \u00e0 /tpohere pour t\u00e9l\u00e9porter d''autres joueurs. negativeBalanceError=L''utilisateur n''est pas autoris\u00e9 \u00e0 avoir un solde n\u00e9gatif. -nickChanged=Pseudo modifi\u00e9. -nickDisplayName=\u00a77You have to enable change-displayname in Essentials config. +nickChanged=surnom modifi\u00e9. +nickDisplayName=\u00a77Vous devez activer change-displayname dans la configuration Essentials. nickInUse=\u00a7cCe nom est d\u00e9j\u00e0 utilis\u00e9. -nickNamesAlpha=\u00a7cLes pseudos doivent \u00eatre alphanum\u00e9riques. +nickNamesAlpha=\u00a7cLes surnoms doivent \u00eatre alphanum\u00e9riques. nickNoMore=\u00a7Vous n''avez plus de surnom. -nickOthersPermission=\u00a7cVous n''avez pas la permission de changer le pseudo des autres. -nickSet=\u00a77Votre pseudo est maintenant \u00a7c{0} -noAccessCommand=\u00a7cVous n''avez pas acc\u00e8s \u00e0 cette commande. +nickOthersPermission=\u00a7cVous n''avez pas la permission de changer le surnom des autres. +nickSet=\u00a77Votre surnom est maintenant \u00a7c{0} +noAccessCommand=\u00a7cVous n''avez pas accès \u00e0 cette commande. noAccessPermission=\u00a7cVous n''avez pas la permissions d''acc\u00e9der \u00e0 cette {0} noDestroyPermission=\u00a7cVous n''avez pas la permission de d\u00e9truire ce {0}. -noGodWorldWarning=\u00a7cWarning! God mode in this world disabled. -noHelpFound=\u00a7cNo matching commands. -noHomeSet=Vous n''avez pas d\u00e9fini de home. -noHomeSetPlayer=Le joueur n''a pas d\u00e9fini son home. +noGodWorldWarning=\u00a7cWarning! Le mode Dieu est d\u00e9sactiv\u00e9 dans ce monde. +noHelpFound=\u00a7cAucune commande correspondante. +noHomeSet=Vous n''avez pas d\u00e9fini de r\u00e9sidence. +noHomeSetPlayer=Le joueur n''a pas d\u00e9fini sa r\u00e9sidence. noKitPermission=\u00a7cVous avez besoin de la permission \u00a7c{0}\u00a7c pour utiliser ce kit. noKits=\u00a77Il n''y a pas encore de kits disponibles. noMail=Vous n''avez pas de courrier @@ -215,67 +215,67 @@ noMailSendPerm=\u00a7cVous n''avez pas la permission \u00a7fessentials.mail.send noMotd=\u00a7cIl n''y a pas de message su jour. noNewMail=\u00a77Vous n''avez pas de courrier. noPendingRequest=Vous n''avez pas de requ\u00eate non lue. -noPlacePermission=\u00a7cYou do not have permission to place a block near that sign. -noPowerTools=You have no power tools assigned. -noRules=\u00a7cIl n''y a pas encore de r\u00e8gles d\u00e9finies. -noWarpsDefined=Aucun warps d\u00e9finis. +noPlacePermission=\u00a7cVous n''avez pas la permission de placer un bloc prè de cette pancarte. +noPowerTools=Vous n''avez pas d''outil automatique associ\u00e9. +noRules=\u00a7cIl n''y a pas encore de règles d\u00e9finies. +noWarpsDefined=Aucun raccourci d\u00e9fini. none=aucun notAllowedToQuestion=\u00a7cVous n''\u00eates pas autoris\u00e9 \u00e0 poser des questions. notAllowedToShout=\u00a7cVous n''\u00eates pas autoris\u00e9 \u00e0 crier. notEnoughMoney=Vous n''avez pas les fonds n\u00e9cessaires. notRecommendedBukkit=La version de Bukkit n''est pas celle qui est recommand\u00e9 pour cette version de Essentials. notSupportedYet=Pas encore pris en charge. -nothingInHand = \u00a7cYou have nothing in your hand. +nothingInHand = \u00a7cVous n''avez rien en main. now=maintenant -numberRequired=On a besoin d''un nombre ici, idiot. +numberRequired=Il faut fournir un nombre ici. onlyDayNight=/time ne supporte que (jour) day/night (nuit). onlyPlayers=Seulement les joueurs en jeu peuvent utiliser {0}. -onlySunStorm=/weather only supports sun/storm. -pTimeCurrent=\u00a7e{0}''s\u00a7f time is {1}. -pTimeCurrentFixed=\u00a7e{0}''s\u00a7f time is fixed to {1}. -pTimeNormal=\u00a7e{0}''s\u00a7f time is normal and matches the server. -pTimeOthersPermission=\u00a7cYou are not authorized to set other players'' time. -pTimePlayers=These players have their own time: -pTimeReset=Player time has been reset for: \u00a7e{0} -pTimeSet=Player time is set to \u00a73{0}\u00a7f for: \u00a7e{1} -pTimeSetFixed=Player time is fixed to \u00a73{0}\u00a7f for: \u00a7e{1} +onlySunStorm=/weather ne supporte que (soleil) sun/storm (temp\u00eate). +pTimeCurrent=\u00a7e{0}''s\u00a7f l''heure est {1}. +pTimeCurrentFixed=\u00a7e{0}''s\u00a7f l''heure est fix\u00e9e \u00e0 {1}. +pTimeNormal=\u00a7e{0}''s\u00a7f l''heure est normale et correspond au server. +pTimeOthersPermission=\u00a7cVous n''etes pas autoris\u00e9 \u00e0 changer l''heure des autres joueurs. +pTimePlayers=Ces joueurs ont leur propre horraire : +pTimeReset=l''heure a \u00e9t\u00e9 r\u00e9initialis\u00e9e \u00e0 : \u00a7e{0} +pTimeSet=l''heure du joueur a \u00e9t\u00e9 r\u00e9egl\u00e9ee \u00e0 \u00a73{0}\u00a7f pour : \u00a7e{1} +pTimeSetFixed=l''heure du joueur a \u00e9t\u00e9 fix\u00e9e \u00e0 : \u00a7e{1} parseError=Erreur de conversion {0} \u00e0 la ligne {1} pendingTeleportCancelled=\u00a7cRequete de t\u00e9l\u00e9portation annul\u00e9e. permissionsError=Permissions/GroupManager manquant, les pr\u00e9fixes et suffixes ne seront pas affich\u00e9s. -playerBanned=\u00a7cPlayer {0} banned {1} for {2} +playerBanned=\u00a7cJoueur {0} banni {1} pour {2} playerInJail=\u00a7cLe joueur est d\u00e9j\u00e0 dans la prison {0}. playerJailed=\u00a77Le joueur {0} a \u00e9t\u00e9 emprisonn\u00e9. playerJailedFor=\u00a77{0} a \u00e9t\u00e9 emprisonn\u00e9 pour {1}. playerKicked=\u00a7cPlayer {0} kicked {1} for {2} -playerMuted=\u00a77You have been muted -playerMutedFor=\u00a77You have been muted for {0} +playerMuted=\u00a77Vous avez \u00e9t\u00e9 r\u00e9duis au silence. +playerMutedFor=\u00a77Vous avez \u00e9t\u00e9 r\u00e9duis au silence pour {0} playerNeverOnServer=\u00a7cLe joueur {0} n''a jamais \u00e9t\u00e9 sur le serveur. playerNotFound=\u00a7cLe joueur est introuvable. -playerUnmuted=\u00a77You have been unmuted -pong=Pong! -possibleWorlds=\u00a77Les mondes possibles sont les nombres 0 par {0}. -powerToolAir=La commande ne peut pas \u00eatre attach\u00e9e \u00e0 l''air. -powerToolAlreadySet=Command \u00a7c{0}\u00a7f is already assigned to {1}. -powerToolAttach=\u00a7c{0}\u00a7f command assigned to {1}. -powerToolClearAll=All powertool commands have been cleared. -powerToolList={1} has the following commands: \u00a7c{0}\u00a7f. -powerToolListEmpty={0} has no commands assigned. -powerToolNoSuchCommandAssigned=Command \u00a7c{0}\u00a7f has not been assigned to {1}. -powerToolRemove=Command \u00a7c{0}\u00a7f removed from {1}. -powerToolRemoveAll=All commands removed from {0}. -powerToolsDisabled=All of your power tools have been disabled. -powerToolsEnabled=All of your power tools have been enabled. +playerUnmuted=\u00a77Vous avez de nouveau la parole. +pong=Pong ! +possibleWorlds=\u00a77Les mondes possibles sont les nombres de 0 \u00e0 {0}. +powerToolAir=La commande ne peut pas \u00eatre assign\u00e9e \u00e0 l''air. +powerToolAlreadySet=La commande \u00a7c{0}\u00a7f est d\u00e9j\u00e0 assign\u00e9e \u00e0 {1}. +powerToolAttach=Commande \u00a7c{0}\u00a7f assign\u00e9e \u00e0 {1}. +powerToolClearAll=Toutes les commandes assign\u00e9es ont \u00e9et\u00e9e retir\u00e9ees. +powerToolList={1} assign\u00e9s aux commandes : \u00a7c{0}\u00a7f. +powerToolListEmpty={0} n''a pas de commande assign\u00e9e. +powerToolNoSuchCommandAssigned=La commande \u00a7c{0}\u00a7f n''a pas \u00e9t\u00e9 assign\u00e9e \u00e0 {1}. +powerToolRemove=Command \u00a7c{0}\u00a7f retir\u00e9e de {1}. +powerToolRemoveAll=Toutes les commandes retir\u00e9es de {0}. +powerToolsDisabled=Toutes vos commandes assign\u00e9es ont \u00e9t\u00e9 retir\u00e9es. +powerToolsEnabled=Toutes vos commandes assign\u00e9es ont \u00e9t\u00e9 activ\u00e9es. protectionOwner=\u00a76[EssentialsProtect] Propri\u00e9taire de la protection : {0} questionFormat=\u00a77[Question]\u00a7f {0} -reloadAllPlugins=\u00a77Tous les plugins ont \u00e9t\u00e9 recharg\u00e9s. -repair=You have successfully repaired your: \u00a7e{0}. -repairAlreadyFixed=\u00a77This item does not need repairing. -repairInvalidType=\u00a7cThis item cannot be repaired. -repairNone=There were no items that needing repairing. +reloadAllPlugins=\u00a77Toutes les extensions ont \u00e9t\u00e9 recharg\u00e9es. +repair=Vous avez r\u00e9par\u00e9 votre : \u00a7e{0}. +repairAlreadyFixed=\u00a77Cet objet n''a pas besoin de r\u00e9paration. +repairInvalidType=\u00a7cCet objet ne peut \u00eatre r\u00e9par\u00e9. +repairNone=Aucun objet n''a besoin d''\u00eatre r\u00e9par\u00e9. requestAccepted=\u00a77Demande de t\u00e9l\u00e9portation accept\u00e9e. -requestAcceptedFrom=\u00a77{0} accepted your teleport request. +requestAcceptedFrom=\u00a77{0} a accept\u00e9 votre demande de t\u00e9l\u00e9portation. requestDenied=\u00a77Demande de t\u00e9l\u00e9portation refus\u00e9e. -requestDeniedFrom=\u00a77{0} denied your teleport request. +requestDeniedFrom=\u00a77{0} a refus\u00e9 votre demande de t\u00e9l\u00e9portation. requestSent=\u00a77Requ\u00eate envoy\u00e9e \u00e0 {0}\u00a77. returnPlayerToJailError=Erreur survenue lors de la tentative d''emprisonner de nouveau un joueur. second=seconde @@ -283,59 +283,59 @@ 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. -setSpawner=Changed spawner type to {0} +setSpawner=Type de g\u00e9n\u00e9rateur chang\u00e9 en {0} sheepMalformedColor=Couleur mal form\u00e9e. shoutFormat=\u00a77[Crie]\u00a7f {0} signFormatFail=\u00a74[{0}] signFormatSuccess=\u00a71[{0}] signFormatTemplate=[{0}] -signProtectInvalidLocation=\u00a74You are not allowed to create sign here. -similarWarpExist=Un warp avec un nom similaire existe d\u00e9j\u00e0. +signProtectInvalidLocation=\u00a74Vous n''avez pas l''autorisation de cr\u00e9er une pancarte ici. +similarWarpExist=Un raccourci avec un nom similaire existe d\u00e9j\u00e0. slimeMalformedSize=Taille mal form\u00e9e. soloMob=Ce monstre aime \u00eatre seul. spawnSet=\u00a77Le point de spawn a \u00e9t\u00e9 d\u00e9fini pour le groupe {0}. -spawned=spawn\u00e9 +spawned=invoqu\u00e9(s) suicideMessage=\u00a77Au revoir monde cruel... -suicideSuccess=\u00a77{0} a pris sa propre vie. -survival=survival -takenFromAccount=\u00a7c{0} ont \u00e9t\u00e9 pris de votre compte. -takenFromOthersAccount=\u00a7c{0} a \u00e9t\u00e9 prise de {1} compte. -teleportAAll=\u00a77Teleporting request sent to all players... +suicideSuccess=\u00a77{0} s''est suiscid\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}. +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. teleportDisabled={0} a la t\u00e9l\u00e9portation d\u00e9sactiv\u00e9. teleportHereRequest=\u00a7c{0}\u00a7c Vous a demand\u00e9 de vous t\u00e9l\u00e9porter \u00e0 lui/elle. teleportNewPlayerError=\u00c9chec de la t\u00e9l\u00e9portation du nouveau joueur. -teleportRequest=\u00a7c{0}\u00a7c vous demande s''il peut se t\u00e9l\u00e9porter sur vous. +teleportRequest=\u00a7c{0}\u00a7c vous demande s''il peut se t\u00e9l\u00e9porter vers vous. teleportTop=\u00a77T\u00e9l\u00e9portation vers le haut. -teleportationCommencing=\u00a77D\u00e9but de la t\u00e9l\u00e9portation.... +teleportationCommencing=\u00a77D\u00e9but de la t\u00e9l\u00e9portation... teleportationDisabled=\u00a77T\u00e9l\u00e9poration d\u00e9sactiv\u00e9. teleportationEnabled=\u00a77T\u00e9l\u00e9portation activ\u00e9e. teleporting=\u00a77T\u00e9l\u00e9poration en cours... teleportingPortal=\u00a77T\u00e9l\u00e9portation via portail. tempBanned=Banni temporairement du serveur pour {0} -tempbanExempt=\u00a77You may not tempban that player +tempbanExempt=\u00a77Vous ne pouvez pas bannir temporairement ce joueur. thunder=Vous avez {0} la foudre dans votre monde. -thunderDuration=Vous avez {0} la foudre dans le serveur {1} secondes. +thunderDuration=Vous avez {0} la foudre dans le serveur pendant {1} secondes. timeBeforeHeal=Temps avant le prochain soin : {0} timeBeforeTeleport=Temps avant prochaine t\u00e9l\u00e9portation {0} -timeFormat=\u00a73{0}\u00a7f or \u00a73{1}\u00a7f or \u00a73{2}\u00a7f +timeFormat=\u00a73{0}\u00a7f ou \u00a73{1}\u00a7f ou \u00a73{2}\u00a7f timePattern=(?:([0-9]+)\\\\s*[ya][a-z]*[,\\\\s]*)?(?:([0-9]+)\\\\s*mo[a-z]*[,\\\\s]*)?(?:([0-9]+)\\\\s*(?:sem|w)[a-z]*[,\\\\s]*)?(?:([0-9]+)\\\\s*[dj][a-z]*[,\\\\s]*)?(?:([0-9]+)\\\\s*h[a-z]*[,\\\\s]*)?(?:([0-9]+)\\\\s*m[a-z]*[,\\\\s]*)?(?:([0-9]+)\\\\s*(?:s[a-z]*)?)? -timeSet=Heure modifi\u00e9e dans tous les mondes. -timeSetPermission=\u00a7cYou are not authorized to set the time. -timeWorldCurrent=The current time in {0} is \u00a73{1} -timeWorldSet=The time was set to {0} in: \u00a7c{1} +timeSet=Heure r\u00e9gl\u00e9e dans tous les mondes. +timeSetPermission=\u00a7cVous n''\u00eates pas autoris\u00e9 \u00e0 r\u00e9gler l''heure. +timeWorldCurrent=Il est \u00a73{1}\u00a77 dans \u00a7c{0}. +timeWorldSet=L''heure a \u00e9t\u00e9 r\u00e9gl\u00e9e \u00e0 {0} dans : \u00a7c{1} tradeCompleted=\u00a77\u00c9change termin\u00e9. tradeSignEmpty=Le panneau de vente n''as pas encore assez de stock. -tradeSignEmptyOwner=There is nothing to collect from this trade sign. +tradeSignEmptyOwner=Il n''y a rien \u00e0 collecter de cette pancarte d''\u00e9change commercial. treeFailure=\u00a7cEchec de la g\u00e9n\u00e9ration de l''arbre. Essayez de nouveau sur de l''herbe ou de la terre. treeSpawned=\u00a77Arbre cr\u00e9\u00e9. -true=true +true=vrai typeTpaccept=\u00a77Pour le t\u00e9l\u00e9porter, tapez \u00a7c/tpaccept\u00a77. typeTpdeny=\u00a77Pour d\u00e9cliner cette demande, entrez \u00a7c/tpdeny\u00a77. typeWorldName=\u00a77Vous pouvez aussi taper le nom d''un monde sp\u00e9cifique. -unableToSpawnMob=Incapable de spawner un monstre. -unbannedIP=Adresse IP d\u00e9banni. +unableToSpawnMob=Incapable d''invoquer un monstre. +unbannedIP=Adresse IP d\u00e9bannie. unbannedPlayer=Joueur d\u00e9banni. unignorePlayer=Vous n''ignorez plus {0}. unknownItemId=Num\u00e9ro d''objet inconnu : {0} @@ -350,39 +350,39 @@ userIsAway={0} s''est mis en AFK userIsNotAway={0} n''est plus inactif userJailed=\u00a77Vous avez \u00e9t\u00e9 emprisonn\u00e9 userUsedPortal={0} a utilis\u00e9 un portail existant. -userdataMoveBackError=Echec du d\u00e9placement de userdata/{0}.tmp \u00e0 userdata/{1} -userdataMoveError=Echec du d\u00e9placement de userdata/{0} \u00e0 userdata/{1}.tmp +userdataMoveBackError=Echec du d\u00e9placement de userdata/{0}.tmp vers userdata/{1} +userdataMoveError=Echec du d\u00e9placement de userdata/{0} vers userdata/{1}.tmp usingTempFolderForTesting=Utilise un fichier temporaire pour un test. -versionMismatch=Versions diff\u00e9rentes! Mettez s''il vous pla\u00eet {0} \u00e0 la m\u00eame version. -versionMismatchAll=Mauvaise version! S''il vous plait mettez des jars Essentiels de version identique. -voiceSilenced=\u00a77Votre voix a \u00e9t\u00e9 r\u00e9duite au silence -warpDeleteError=Probl\u00e8me concernant la suppression du fichier warp. +versionMismatch=Versions diff\u00e9rentes ! Mettez s''il vous plait {0} \u00e0 la m\u00eame version. +versionMismatchAll=Mauvaise version ! S''il vous plait mettez des jars Essentials de version identique. +voiceSilenced=\u00a77Vous avez \u00e9t\u00e9 r\u00e9duit au silence. +warpDeleteError=Problème concernant la suppression du fichier warp. warpListPermission=\u00a7cVous n''avez pas la permission d''afficher la liste des warps. -warpNotExist=Ce warp n''existe pas. -warpSet=\u00a77Le warp {0} a \u00e9t\u00e9 cr\u00e9\u00e9. +warpNotExist=Ce raccourci n''existe pas. +warpSet=\u00a77Le raccourci {0} a \u00e9t\u00e9 cr\u00e9\u00e9. warpUsePermission=\u00a7cVous n''avez pas la permission d''utiliser ce warp. warpingTo=\u00a77T\u00e9l\u00e9portation au warp {0}. -warps=Warps: {0} -warpsCount=\u00a77There are {0} warps. Showing page {1} of {2}. -weatherStorm=\u00a77Vous avez d\u00e9fini l''orage dans {0} -weatherStormFor=\u00a77Vous avez d\u00e9fini l''orage dans {0} pour {1} secondes. -weatherSun=\u00a77Vous avez mis le beau temps dans {0} -weatherSunFor=\u00a77Vous avez mis le beau temps dans {0} pour {1} secondes. -whoisGamemode=\u00a79 - Gamemode: {0} -whoisGeoLocation=\u00a79 - Emplacement: {0} -whoisGod=\u00a79 - God mode: {0} -whoisHealth=\u00a79 - Vie: {0} / 20 -whoisIPAddress=\u00a79 - Adresse IP: {0} +warps=Raccourcis : {0} +warpsCount=\u00a77Il y a {0} raccourcis. Page {1} sur {2}. +weatherStorm=\u00a77Vous avez programm\u00e9 l''orage dans {0} +weatherStormFor=\u00a77Vous avez programm\u00e9 l''orage dans {0} pour {1} secondes. +weatherSun=\u00a77Vous avez programm\u00e9 le beau temps dans {0} +weatherSunFor=\u00a77Vous avez programm\u00e9 le beau temps dans {0} pour {1} secondes. +whoisGamemode=\u00a79 - Mode de jeu : {0} +whoisGeoLocation=\u00a79 - Emplacement : {0} +whoisGod=\u00a79 - Mode Dieu : {0} +whoisHealth=\u00a79 - Vie : {0} / 20 +whoisIPAddress=\u00a79 - Adresse IP : {0} whoisIs={0} est {1} -whoisLocation=\u00a79 - Emplacement: ({0}, {1}, {2}, {3}) -whoisMoney=\u00a79 - Argent: {0} -whoisOP=\u00a79 - OP: {0} -whoisStatusAvailable=\u00a79 - Statut: Disponible -whoisStatusAway=\u00a79 - Statut: \u00a7cAilleurs\u00a7f -worth=\u00a77Un stack de {0} vaut \u00a7c{1}\u00a77 ({2} objet(s) \u00e0 {3} chacun) -worthMeta=\u00a77Un stack de {0} avec la m\u00e9tadonn\u00e9e de {1} vaut \u00a7c{2}\u00a77 ({3} objet(s) \u00e0 {4} chacun) +whoisLocation=\u00a79 - Emplacement : ({0}, {1}, {2}, {3}) +whoisMoney=\u00a79 - Argent : {0} +whoisOP=\u00a79 - OP : {0} +whoisStatusAvailable=\u00a79 - Statut : Disponible +whoisStatusAway=\u00a79 - Statut : \u00a7cAilleurs\u00a7f +worth=\u00a77Une pile de {0} vaut \u00a7c{1}\u00a77 ({2} objet(s) \u00e0 {3} chacun) +worthMeta=\u00a77Une pile de {0} avec la m\u00e9tadonn\u00e9e de {1} vaut \u00a7c{2}\u00a77 ({3} objet(s) \u00e0 {4} chacun) worthSet=Valeur cr\u00e9e year=ann\u00e9e years=ann\u00e9es youAreHealed=\u00a77Vous avez \u00e9t\u00e9 soign\u00e9. -youHaveNewMail=\u00a7cVous avez {0} messages! \u00a7fEntrez \u00a77/mail read\u00a7f pour voir votre courrier. +youHaveNewMail=\u00a7cVous avez {0} messages ! \u00a7fEntrez \u00a77/mail read\u00a7f pour voir votre courrier. \ No newline at end of file -- cgit v1.2.3 From 82f864a7f922e3a1bd83873e063cc591bfeb8f86 Mon Sep 17 00:00:00 2001 From: snowleo Date: Sun, 27 Nov 2011 18:56:04 +0100 Subject: Update Essentials/src/messages_fr.properties --- Essentials/src/messages_fr.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties index ff7b42240..6b0d7ec91 100644 --- a/Essentials/src/messages_fr.properties +++ b/Essentials/src/messages_fr.properties @@ -1,4 +1,4 @@ -#version: Dev2.7.54 +#version: TeamCity # Single quotes have to be doubled: '' # Translations start here # by: -- cgit v1.2.3 From ec6baa3621bb9d0a40f032f6669c11fa731be2c5 Mon Sep 17 00:00:00 2001 From: snowleo Date: Sun, 27 Nov 2011 19:13:39 +0100 Subject: Catch exception instead of checking for null --- .../src/com/earth2me/essentials/commands/Commandunbanip.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java b/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java index 2b22ede2c..c539a596c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java @@ -20,10 +20,14 @@ public class Commandunbanip extends EssentialsCommand { throw new NotEnoughArgumentsException(); } - User user = getPlayer(server, args, 0, true); - if (user != null) { + try + { + final User user = getPlayer(server, args, 0, true); ess.getServer().unbanIP(user.getLastLoginAddress()); } + catch (Exception ex) + { + } ess.getServer().unbanIP(args[0]); sender.sendMessage(_("unbannedIP")); } -- cgit v1.2.3 From 67be976d908e5d6dc1337f053b3421bd19668600 Mon Sep 17 00:00:00 2001 From: snowleo Date: Sun, 27 Nov 2011 19:59:06 +0100 Subject: New permissions: essentials.spawnmob.[mobname] and essentials.spawner.[mobname] --- .../src/com/earth2me/essentials/commands/Commandspawner.java | 9 +++++++++ .../src/com/earth2me/essentials/commands/Commandspawnmob.java | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java b/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java index bdbcc4a8c..e3b1ef366 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java @@ -4,6 +4,7 @@ import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.Mob; import com.earth2me.essentials.User; import com.earth2me.essentials.Util; +import java.util.Locale; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Server; @@ -43,6 +44,14 @@ public class Commandspawner extends EssentialsCommand user.sendMessage(_("invalidMob")); return; } + if (ess.getSettings().getProtectPreventSpawn(mob.getType().toString().toLowerCase(Locale.ENGLISH))) + { + throw new Exception(_("unableToSpawnMob")); + } + if (!user.isAuthorized("essentials.spawner." + mob.name.toLowerCase())) + { + throw new Exception(_("unableToSpawnMob")); + } ((CreatureSpawner)target.getBlock().getState()).setCreatureType(mob.getType()); user.sendMessage(_("setSpawner", mob.name)); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java index 66c6b4414..863821973 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java @@ -66,6 +66,10 @@ public class Commandspawnmob extends EssentialsCommand { throw new Exception(_("unableToSpawnMob")); } + if (!user.isAuthorized("essentials.spawnmob." + mob.name.toLowerCase())) + { + throw new Exception(_("unableToSpawnMob")); + } final Block block = Util.getTarget(user).getBlock(); if (block == null) @@ -96,6 +100,10 @@ public class Commandspawnmob extends EssentialsCommand { throw new Exception(_("unableToSpawnMob")); } + if (!user.isAuthorized("essentials.spawnmob." + mobMount.name.toLowerCase())) + { + throw new Exception(_("unableToSpawnMob")); + } try { spawnedMount = mobMount.spawn(user, server, loc); -- cgit v1.2.3 From aceda4c680d11f456204cb42e72a4ef1940768e5 Mon Sep 17 00:00:00 2001 From: snowleo Date: Sun, 27 Nov 2011 20:40:39 +0100 Subject: Allow enchantments to be removed using /enchant enchantmentname 0 --- .../essentials/commands/Commandenchant.java | 14 +++++++++++--- Essentials/src/messages.properties | 1 + Essentials/src/messages_da.properties | 1 + Essentials/src/messages_de.properties | 1 + Essentials/src/messages_en.properties | 1 + Essentials/src/messages_es.properties | 1 + Essentials/src/messages_fr.properties | 21 +++++++++++---------- Essentials/src/messages_nl.properties | 1 + 8 files changed, 28 insertions(+), 13 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java b/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java index 26071d28d..6b028a634 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java @@ -102,15 +102,23 @@ public class Commandenchant extends EssentialsCommand } } Enchantment enchantment = getEnchantment(args[0], user); - if (level < enchantment.getStartLevel() || level > enchantment.getMaxLevel()) + if (level < 0 || level > enchantment.getMaxLevel()) { level = enchantment.getMaxLevel(); } - stack.addEnchantment(enchantment, level); + if (level == 0) { + stack.removeEnchantment(enchantment); + } else { + stack.addEnchantment(enchantment, level); + } EnchantmentFix.setItemInHand(user.getInventory(), stack); user.updateInventory(); final String enchantmentName = enchantment.getName().toLowerCase(Locale.ENGLISH); - user.sendMessage(_("enchantmentApplied", enchantmentName.replace('_', ' '))); + if (level == 0) { + user.sendMessage(_("enchantmentRemoved", enchantmentName.replace('_', ' '))); + } else { + user.sendMessage(_("enchantmentApplied", enchantmentName.replace('_', ' '))); + } } public static Enchantment getEnchantment(final String name, final User user) throws Exception diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index f162176de..6df02c655 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -71,6 +71,7 @@ enabled=enabled enchantmentApplied = \u00a77The enchantment {0} has been applied to your item in hand. enchantmentNotFound = \u00a7cEnchantment not found enchantmentPerm = \u00a7cYou do not have the permission for {0} +enchantmentRemoved = \u00a77The enchantment {0} has been removed from your item in hand. enchantments = \u00a77Enchantments: {0} errorCallingCommand=Error calling command /{0} errorWithMessage=\u00a7cError: {0} diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties index 997f48acc..b3730d1d6 100644 --- a/Essentials/src/messages_da.properties +++ b/Essentials/src/messages_da.properties @@ -71,6 +71,7 @@ enabled=aktiveret enchantmentApplied = \u00a77The enchantment {0} has been applied to your item in hand. enchantmentNotFound = \u00a7cEnchantment not found enchantmentPerm = \u00a7cYou do not have the permission for {0} +enchantmentRemoved = \u00a77The enchantment {0} has been removed from your item in hand. enchantments = \u00a77Enchantments: {0} errorCallingCommand=Fejl ved opkald af kommando /{0} errorWithMessage=\u00a7cFejl: {0} diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties index f92d6e18e..bc3123d6c 100644 --- a/Essentials/src/messages_de.properties +++ b/Essentials/src/messages_de.properties @@ -71,6 +71,7 @@ enabled=aktiviert enchantmentApplied = \u00a77The enchantment {0} has been applied to your item in hand. enchantmentNotFound = \u00a7cEnchantment not found enchantmentPerm = \u00a7cYou do not have the permission for {0} +enchantmentRemoved = \u00a77The enchantment {0} has been removed from your item in hand. enchantments = \u00a77Enchantments: {0} errorCallingCommand=Fehler beim Aufrufen des Befehls /{0} errorWithMessage=\u00a7cFehler: {0} diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties index d8f4b85da..41c32506c 100644 --- a/Essentials/src/messages_en.properties +++ b/Essentials/src/messages_en.properties @@ -71,6 +71,7 @@ enabled=enabled enchantmentApplied = \u00a77The enchantment {0} has been applied to your item in hand. enchantmentNotFound = \u00a7cEnchantment not found enchantmentPerm = \u00a7cYou do not have the permission for {0} +enchantmentRemoved = \u00a77The enchantment {0} has been removed from your item in hand. enchantments = \u00a77Enchantments: {0} errorCallingCommand=Error calling command /{0} errorWithMessage=\u00a7cError: {0} diff --git a/Essentials/src/messages_es.properties b/Essentials/src/messages_es.properties index 796515a15..eae6cf89b 100644 --- a/Essentials/src/messages_es.properties +++ b/Essentials/src/messages_es.properties @@ -71,6 +71,7 @@ enabled=activado enchantmentApplied = \u00a77The enchantment {0} has been applied to your item in hand. enchantmentNotFound = \u00a7cEnchantment not found enchantmentPerm = \u00a7cYou do not have the permission for {0} +enchantmentRemoved = \u00a77The enchantment {0} has been removed from your item in hand. enchantments = \u00a77Enchantments: {0} errorCallingCommand=Error al ejecutar el comando /{0} errorWithMessage=\u00a7cError: {0} diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties index 6b0d7ec91..207b84541 100644 --- a/Essentials/src/messages_fr.properties +++ b/Essentials/src/messages_fr.properties @@ -11,7 +11,7 @@ alertPlaced=a plac\u00e9 : alertUsed=a utilis\u00e9 : autoAfkKickReason=Vous avez \u00e9t\u00e9 \u00e9ject\u00e9 pour inactivit\u00e9e sup\u00e9rieure \u00e0 {0} minutes. backAfterDeath=\u00a77Utilisez la commande /back pour retourner \u00e0 l''endroit ou vous \u00eates mort. -backUsageMsg=\u00a77Retour \u00e0 votre emplacement pr\u00e9cèdent. +backUsageMsg=\u00a77Retour \u00e0 votre emplacement pr\u00e9c\u00c3\u00a8dent. backupFinished=Sauvegarde termin\u00e9 backupStarted=D\u00e9but de la sauvegarde balance=\u00a77Solde : {0} @@ -31,7 +31,7 @@ burnMsg=\u00a77Vous avez enflamm\u00e9 {0} pour {1} seconde(s). canTalkAgain=\u00a77Vous pouvez de nouveau parler. cantFindGeoIpDB=N''arrive pas \u00e0 trouver la base de donn\u00e9es GeoIP! cantReadGeoIpDB=Echec de la lecture de la base de donn\u00e9es GeoIP! -cantSpawnItem=\u00a7cVous n''avez pas le droit de faire apparaître {0} +cantSpawnItem=\u00a7cVous n''avez pas le droit de faire appara\u00c3\u00aetre {0} commandFailed=\u00c9chec de la commande {0} : commandHelpFailedForPlugin=Erreur d''obtention d''aide pour : {0} commandNotLoaded=\u00a7cLa commande {0} a \u00e9t\u00e9 mal charg\u00e9e. @@ -42,8 +42,8 @@ connectedPlayers=Joueurs connect\u00e9s : connectionFailed=\u00c9chec de l''ouverture de la connexion. cooldownWithMessage=\u00a7cR\u00e9utilisation : {0} corruptNodeInConfig=\u00a74Annonce : Votre fichier de configuration a un {0} n\u0153ud corrompu. -couldNotFindTemplate=Le modèle {0} est introuvable -creatingConfigFromTemplate=Cr\u00e9ation de la configuration \u00e0 partir du modèle : {0} +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 day=jour @@ -53,7 +53,7 @@ deleteFileError=Le fichier {0} n''a pas pu \u00eatre supprim\u00e9 deleteHome=\u00a77La r\u00e9sidence {0} a \u00e9t\u00e9 supprim\u00e9e. deleteJail=\u00a77La prison {0} a \u00e9t\u00e9 supprim\u00e9e. deleteWarp=\u00a77Warp {0} supprim\u00e9. -deniedAccessCommand=L''accès \u00e0 la commande a \u00e9t\u00e9 refus\u00e9 pour {0}. +deniedAccessCommand=L''acc\u00c3\u00a8s \u00e0 la commande a \u00e9t\u00e9 refus\u00e9 pour {0}. dependancyDownloaded=[Essentials] Fichier {0} correctement t\u00e9l\u00e9charg\u00e9. dependancyException=[Essentials] Une erreur est survenue lors de la tentative de t\u00e9l\u00e9chargement. dependancyNotFound=[Essentials] Une d\u00e9pendance requise n''a pas \u00e9t\u00e9 trouv\u00e9e, t\u00e9l\u00e9chargement en cours. @@ -71,6 +71,7 @@ enabled=activ\u00e9 enchantmentApplied = \u00a77L''enchantement {0} a \u00e9t\u00e9 appliqu\u00e9 \u00e0 l''objet dans votre main. enchantmentNotFound = \u00a7cEnchantement non-trouv\u00e9 enchantmentPerm = \u00a7cVous n''avez pas les droits pour {0}. +enchantmentRemoved = \u00a77The enchantment {0} has been removed from your item in hand. enchantments = \u00a77Enchantments : {0} errorCallingCommand=Erreur en appelant la commande /{0} errorWithMessage=\u00a7cErreur : {0} @@ -192,7 +193,7 @@ muteExempt=\u00a7cVous ne pouvez pas r\u00e9duire ce joueur au silence. mutedPlayer=Le joueur {0} est d\u00e9sormais muet. mutedPlayerFor={0} a \u00e9t\u00e9 muet pour {1}. mutedUserSpeaks={0} a essay\u00e9 de parler mais est muet. -needTpohere=Vous avez besoin de l''accès \u00e0 /tpohere pour t\u00e9l\u00e9porter d''autres joueurs. +needTpohere=Vous avez besoin de l''acc\u00c3\u00a8s \u00e0 /tpohere pour t\u00e9l\u00e9porter d''autres joueurs. negativeBalanceError=L''utilisateur n''est pas autoris\u00e9 \u00e0 avoir un solde n\u00e9gatif. nickChanged=surnom modifi\u00e9. nickDisplayName=\u00a77Vous devez activer change-displayname dans la configuration Essentials. @@ -201,7 +202,7 @@ nickNamesAlpha=\u00a7cLes surnoms doivent \u00eatre alphanum\u00e9riques. nickNoMore=\u00a7Vous n''avez plus de surnom. nickOthersPermission=\u00a7cVous n''avez pas la permission de changer le surnom des autres. nickSet=\u00a77Votre surnom est maintenant \u00a7c{0} -noAccessCommand=\u00a7cVous n''avez pas accès \u00e0 cette commande. +noAccessCommand=\u00a7cVous n''avez pas acc\u00c3\u00a8s \u00e0 cette commande. noAccessPermission=\u00a7cVous n''avez pas la permissions d''acc\u00e9der \u00e0 cette {0} noDestroyPermission=\u00a7cVous n''avez pas la permission de d\u00e9truire ce {0}. noGodWorldWarning=\u00a7cWarning! Le mode Dieu est d\u00e9sactiv\u00e9 dans ce monde. @@ -215,9 +216,9 @@ noMailSendPerm=\u00a7cVous n''avez pas la permission \u00a7fessentials.mail.send noMotd=\u00a7cIl n''y a pas de message su jour. noNewMail=\u00a77Vous n''avez pas de courrier. noPendingRequest=Vous n''avez pas de requ\u00eate non lue. -noPlacePermission=\u00a7cVous n''avez pas la permission de placer un bloc prè de cette pancarte. +noPlacePermission=\u00a7cVous n''avez pas la permission de placer un bloc pr\u00c3\u00a8 de cette pancarte. noPowerTools=Vous n''avez pas d''outil automatique associ\u00e9. -noRules=\u00a7cIl n''y a pas encore de règles d\u00e9finies. +noRules=\u00a7cIl n''y a pas encore de r\u00c3\u00a8gles d\u00e9finies. noWarpsDefined=Aucun raccourci d\u00e9fini. none=aucun notAllowedToQuestion=\u00a7cVous n''\u00eates pas autoris\u00e9 \u00e0 poser des questions. @@ -356,7 +357,7 @@ usingTempFolderForTesting=Utilise un fichier temporaire pour un test. versionMismatch=Versions diff\u00e9rentes ! Mettez s''il vous plait {0} \u00e0 la m\u00eame version. versionMismatchAll=Mauvaise version ! S''il vous plait mettez des jars Essentials de version identique. voiceSilenced=\u00a77Vous avez \u00e9t\u00e9 r\u00e9duit au silence. -warpDeleteError=Problème concernant la suppression du fichier warp. +warpDeleteError=Probl\u00c3\u00a8me concernant la suppression du fichier warp. warpListPermission=\u00a7cVous n''avez pas la permission d''afficher la liste des warps. warpNotExist=Ce raccourci n''existe pas. warpSet=\u00a77Le raccourci {0} a \u00e9t\u00e9 cr\u00e9\u00e9. diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties index a297dc683..caac0b039 100644 --- a/Essentials/src/messages_nl.properties +++ b/Essentials/src/messages_nl.properties @@ -71,6 +71,7 @@ enabled=ingeschakeld enchantmentApplied = \u00a77The enchantment {0} has been applied to your item in hand. enchantmentNotFound = \u00a7cEnchantment not found enchantmentPerm = \u00a7cYou do not have the permission for {0} +enchantmentRemoved = \u00a77The enchantment {0} has been removed from your item in hand. enchantments = \u00a77Enchantments: {0} errorCallingCommand=Fout bij het aanroepen van de opdracht /{0} errorWithMessage=\u00a7cFout: {0} -- cgit v1.2.3