diff options
author | KHobbits <rob@khobbits.co.uk> | 2011-12-12 23:06:40 +0000 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2011-12-12 23:06:40 +0000 |
commit | 081491d0a14afc3c9ac7dc9b8acd01ac11fa46e1 (patch) | |
tree | 5ad3124aca6957d99accdcfc80c6c9f1257f4074 | |
parent | 8d0230d6a8f323749dc0a0fadfcbc226dc4c2ab8 (diff) | |
parent | f936cd5f2716ddbfd15054891b4bc335f1ad1347 (diff) | |
download | Essentials-081491d0a14afc3c9ac7dc9b8acd01ac11fa46e1.tar Essentials-081491d0a14afc3c9ac7dc9b8acd01ac11fa46e1.tar.gz Essentials-081491d0a14afc3c9ac7dc9b8acd01ac11fa46e1.tar.lz Essentials-081491d0a14afc3c9ac7dc9b8acd01ac11fa46e1.tar.xz Essentials-081491d0a14afc3c9ac7dc9b8acd01ac11fa46e1.zip |
Merge branch 'master' into release
57 files changed, 562 insertions, 362 deletions
diff --git a/.gitignore b/.gitignore index adc931227..6c25fbdd7 100644 --- a/.gitignore +++ b/.gitignore @@ -35,4 +35,6 @@ /EssentialsUpdate/dist/ /EssentialsUpdate/build/ /WebPush/apikey.php -/WebPush/nbproject/private
\ No newline at end of file +/WebPush/nbproject/private +/.idea +*.iml
\ No newline at end of file diff --git a/Essentials/nbproject/project.properties b/Essentials/nbproject/project.properties index 59540b809..87e522254 100644 --- a/Essentials/nbproject/project.properties +++ b/Essentials/nbproject/project.properties @@ -66,7 +66,8 @@ endorsed.classpath= excludes= file.reference.BOSEconomy7.jar=../lib/BOSEconomy7.jar file.reference.bPermissions.jar=../lib/bPermissions.jar -file.reference.craftbukkit-1.0.0-SNAPSHOT.jar=../lib/craftbukkit-1.0.0-SNAPSHOT.jar +file.reference.bukkit.jar=../lib/bukkit.jar +file.reference.craftbukkit.jar=../lib/craftbukkit.jar file.reference.iCo4.jar=../lib/iCo4.jar file.reference.iCo5.jar=../lib/iCo5.jar file.reference.iCo6.jar=../lib/iCo6.jar @@ -91,7 +92,8 @@ javac.classpath=\ ${file.reference.PermissionsBukkit-1.2.jar}:\ ${file.reference.lombok-0.10.1.jar}:\ ${reference.EssentialsGroupManager.jar}:\ - ${file.reference.craftbukkit-1.0.0-SNAPSHOT.jar} + ${file.reference.bukkit.jar}:\ + ${file.reference.craftbukkit.jar} # Space-separated list of extra javac options javac.compilerargs= javac.deprecation=false diff --git a/Essentials/src/com/earth2me/essentials/ISettings.java b/Essentials/src/com/earth2me/essentials/ISettings.java index 97c5070b5..5c53a6790 100644 --- a/Essentials/src/com/earth2me/essentials/ISettings.java +++ b/Essentials/src/com/earth2me/essentials/ISettings.java @@ -151,4 +151,6 @@ public interface ISettings extends IConf public boolean getDisableItemPickupWhileAfk(); public Priority getRespawnPriority(); + + long getTpaAcceptCancellation(); } diff --git a/Essentials/src/com/earth2me/essentials/Kit.java b/Essentials/src/com/earth2me/essentials/Kit.java new file mode 100644 index 000000000..53d2e8784 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/Kit.java @@ -0,0 +1,113 @@ +package com.earth2me.essentials; + +import static com.earth2me.essentials.I18n._; +import com.earth2me.essentials.commands.NoChargeException; +import com.earth2me.essentials.craftbukkit.InventoryWorkaround; +import java.util.*; +import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; + + +public class Kit +{ + //TODO: Convert this to use one of the new text classes? + public static String listKits(final IEssentials ess, final User user) throws Exception + { + try + { + final Map<String, Object> kits = ess.getSettings().getKits(); + final StringBuilder list = new StringBuilder(); + for (String kiteItem : kits.keySet()) + { + if (user.isAuthorized("essentials.kit." + kiteItem.toLowerCase(Locale.ENGLISH))) + { + list.append(" ").append(kiteItem); + } + } + return list.toString(); + } + catch (Exception ex) + { + throw new Exception(_("kitError")); + } + + } + + public static void checkTime(final User user, final String kitName, final Map<String, Object> els) throws NoChargeException + { + final double delay = els.containsKey("delay") ? ((Number)els.get("delay")).doubleValue() : 0L; + final Calendar c = new GregorianCalendar(); + c.add(Calendar.SECOND, -(int)delay); + c.add(Calendar.MILLISECOND, -(int)((delay * 1000.0) % 1000.0)); + + final long mintime = c.getTimeInMillis(); + + final Long lastTime = user.getKitTimestamp(kitName); + if (lastTime == null || lastTime < mintime) + { + final Calendar now = new GregorianCalendar(); + user.setKitTimestamp(kitName, now.getTimeInMillis()); + } + else + { + final Calendar future = new GregorianCalendar(); + future.setTimeInMillis(lastTime); + future.add(Calendar.SECOND, (int)delay); + future.add(Calendar.MILLISECOND, (int)((delay * 1000.0) % 1000.0)); + user.sendMessage(_("kitTimed", Util.formatDateDiff(future.getTimeInMillis()))); + throw new NoChargeException(); + } + } + + public static List<String> getItems(final User user, final Map<String, Object> els) throws Exception + { + try + { + return (List<String>)els.get("items"); + } + catch (Exception e) + { + user.sendMessage(_("kitError2")); + throw new Exception(_("kitErrorHelp")); + } + } + + public static void expandItems(final IEssentials ess, final User user, final List<String> items) throws Exception + { + try + { + boolean spew = false; + for (String d : items) + { + final String[] parts = d.split("[^0-9]+", 3); + 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 Map<Integer, ItemStack> overfilled; + if (user.isAuthorized("essentials.oversizedstacks")) + { + overfilled = InventoryWorkaround.addItem(user.getInventory(), true, ess.getSettings().getOversizedStackSize(), new ItemStack(id, amount, data)); + } + else + { + overfilled = InventoryWorkaround.addItem(user.getInventory(), true, new ItemStack(id, amount, data)); + } + for (ItemStack itemStack : overfilled.values()) + { + user.getWorld().dropItemNaturally(user.getLocation(), itemStack); + spew = true; + } + } + user.updateInventory(); + if (spew) + { + user.sendMessage(_("kitInvFull")); + } + } + catch (Exception e) + { + user.updateInventory(); + throw new Exception(_("kitError2")); + } + } +} diff --git a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java index 45359a837..e05a07576 100644 --- a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java +++ b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java @@ -816,4 +816,10 @@ public class OfflinePlayer implements Player { throw new UnsupportedOperationException("Not supported yet."); } + + @Override + public Player getKiller() + { + throw new UnsupportedOperationException("Not supported yet."); + } } diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java index d374e5130..682eedaf9 100644 --- a/Essentials/src/com/earth2me/essentials/Settings.java +++ b/Essentials/src/com/earth2me/essentials/Settings.java @@ -606,4 +606,10 @@ public class Settings implements ISettings } return Priority.Normal; } + + @Override + public long getTpaAcceptCancellation() + { + return config.getLong("tpa-accept-cancellation", 0); + } } diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java index 2ef59eb88..8c678d734 100644 --- a/Essentials/src/com/earth2me/essentials/User.java +++ b/Essentials/src/com/earth2me/essentials/User.java @@ -19,6 +19,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser private transient User teleportRequester; private transient boolean teleportRequestHere; private transient final Teleport teleport; + private transient long teleportRequestTime; private transient long lastOnlineActivity; private transient long lastActivity = System.currentTimeMillis(); private boolean hidden = false; @@ -174,7 +175,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser @Override public int compareTo(final User other) { - return ChatColor.stripColor(this.getDisplayName()).compareToIgnoreCase(ChatColor.stripColor(other.getDisplayName())); + return Util.stripColor(this.getDisplayName()).compareToIgnoreCase(Util.stripColor(other.getDisplayName())); } @Override @@ -184,14 +185,14 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser { return false; } - return ChatColor.stripColor(this.getDisplayName()).equalsIgnoreCase(ChatColor.stripColor(((User)object).getDisplayName())); + return this.getName().equalsIgnoreCase(((User)object).getName()); } @Override public int hashCode() { - return ChatColor.stripColor(this.getDisplayName()).hashCode(); + return this.getName().hashCode(); } public Boolean canSpawnItem(final int itemId) @@ -222,6 +223,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser public void requestTeleport(final User player, final boolean here) { + teleportRequestTime = System.currentTimeMillis(); teleportRequester = player; teleportRequestHere = here; } @@ -537,4 +539,9 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser { return ess.getPermissionsHandler().canBuild(base, getGroup()); } + + public long getTeleportRequestTime() + { + return teleportRequestTime; + } } diff --git a/Essentials/src/com/earth2me/essentials/Util.java b/Essentials/src/com/earth2me/essentials/Util.java index fe86fd167..6a1df197f 100644 --- a/Essentials/src/com/earth2me/essentials/Util.java +++ b/Essentials/src/com/earth2me/essentials/Util.java @@ -477,4 +477,15 @@ public class Util } return buf.toString(); } + private static transient final Pattern COLOR_PATTERN = Pattern.compile("(?i)\u00A7[0-9A-F]"); + + public static String stripColor(final String input) + { + if (input == null) + { + return null; + } + + return COLOR_PATTERN.matcher(input).replaceAll(""); + } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbreak.java b/Essentials/src/com/earth2me/essentials/commands/Commandbreak.java index 9c0a34698..a1db8e0b2 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandbreak.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandbreak.java @@ -14,6 +14,7 @@ public class Commandbreak extends EssentialsCommand super("break"); } + //TODO: Switch to use util class @Override public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbutcher.java b/Essentials/src/com/earth2me/essentials/commands/Commandbutcher.java index b5f43e2d9..fa628f8e0 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandbutcher.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandbutcher.java @@ -29,6 +29,7 @@ public class Commandbutcher extends EssentialsCommand super("butcher"); } + //TODO: Tidy - missed this during command cleanup @Override public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkit.java b/Essentials/src/com/earth2me/essentials/commands/Commandkit.java index 8392d4759..c003d28ac 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkit.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkit.java @@ -1,14 +1,9 @@ package com.earth2me.essentials.commands; -import com.earth2me.essentials.craftbukkit.InventoryWorkaround; +import com.earth2me.essentials.*; import static com.earth2me.essentials.I18n._; -import com.earth2me.essentials.Trade; -import com.earth2me.essentials.User; -import com.earth2me.essentials.Util; import java.util.*; -import org.bukkit.Material; import org.bukkit.Server; -import org.bukkit.inventory.ItemStack; public class Commandkit extends EssentialsCommand @@ -23,131 +18,39 @@ public class Commandkit extends EssentialsCommand { if (args.length < 1) { - try + final String kitList = Kit.listKits(ess, user); + if (kitList.length() > 0) { - final Map<String, Object> kits = ess.getSettings().getKits(); - final StringBuilder list = new StringBuilder(); - for (String kiteItem : kits.keySet()) - { - if (user.isAuthorized("essentials.kit." + kiteItem.toLowerCase(Locale.ENGLISH))) - { - list.append(" ").append(kiteItem); - } - } - if (list.length() > 0) - { - user.sendMessage(_("kits", list.toString())); - } - else - { - user.sendMessage(_("noKits")); - } + user.sendMessage(_("kits", kitList)); } - catch (Exception ex) + else { - user.sendMessage(_("kitError")); + user.sendMessage(_("noKits")); } + throw new NoChargeException(); } else { - try - { - final String kitName = args[0].toLowerCase(Locale.ENGLISH); - final Object kit = ess.getSettings().getKit(kitName); - List<String> items; - - if (!user.isAuthorized("essentials.kit." + kitName)) - { - user.sendMessage(_("noKitPermission", "essentials.kit." + kitName)); - return; - } + final String kitName = args[0].toLowerCase(Locale.ENGLISH); + final Object kit = ess.getSettings().getKit(kitName); - try - { - - //System.out.println("Kit is timed"); - final Map<String, Object> els = (Map<String, Object>)kit; - items = (List<String>)els.get("items"); - final double delay = els.containsKey("delay") ? ((Number)els.get("delay")).doubleValue() : 0L; - final Calendar c = new GregorianCalendar(); - c.add(Calendar.SECOND, -(int)delay); - c.add(Calendar.MILLISECOND, -(int)((delay * 1000.0) % 1000.0)); + if (!user.isAuthorized("essentials.kit." + kitName)) + { + throw new Exception(_("noKitPermission", "essentials.kit." + kitName)); + } + final Map<String, Object> els = (Map<String, Object>)kit; + final List<String> items = Kit.getItems(user, els); - final long mintime = c.getTimeInMillis(); + Kit.checkTime(user, kitName, els); - final Long lastTime = user.getKitTimestamp(kitName); - if (lastTime == null || lastTime < mintime) - { - final Calendar now = new GregorianCalendar(); - user.setKitTimestamp(kitName, now.getTimeInMillis()); - } - else - { - final Calendar future = new GregorianCalendar(); - future.setTimeInMillis(lastTime); - future.add(Calendar.SECOND, (int)delay); - future.add(Calendar.MILLISECOND, (int)((delay * 1000.0) % 1000.0)); - user.sendMessage(_("kitTimed", Util.formatDateDiff(future.getTimeInMillis()))); - return; - } - } - catch (Exception ex) - { - items = (List<String>)kit; - } + final Trade charge = new Trade("kit-" + kitName, ess); + charge.isAffordableFor(user); - final Trade charge = new Trade("kit-" + kitName, ess); - try - { - charge.isAffordableFor(user); - } - catch (Exception ex) - { - user.sendMessage(ex.getMessage()); - return; - } + Kit.expandItems(ess, user, items); + + charge.charge(user); + user.sendMessage(_("kitGive", kitName)); - boolean spew = false; - for (String d : items) - { - final String[] parts = d.split("[^0-9]+", 3); - 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 Map<Integer, ItemStack> overfilled; - if (user.isAuthorized("essentials.oversizedstacks")) - { - overfilled = InventoryWorkaround.addItem(user.getInventory(), true, ess.getSettings().getOversizedStackSize(), new ItemStack(id, amount, data)); - } - else - { - overfilled = InventoryWorkaround.addItem(user.getInventory(), true, new ItemStack(id, amount, data)); - } - for (ItemStack itemStack : overfilled.values()) - { - user.getWorld().dropItemNaturally(user.getLocation(), itemStack); - spew = true; - } - } - if (spew) - { - user.sendMessage(_("kitInvFull")); - } - try - { - charge.charge(user); - } - catch (Exception ex) - { - user.sendMessage(ex.getMessage()); - } - user.sendMessage(_("kitGive", kitName)); - } - catch (Exception ex) - { - user.sendMessage(_("kitError2")); - user.sendMessage(_("kitErrorHelp")); - } } } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmail.java b/Essentials/src/com/earth2me/essentials/commands/Commandmail.java index 884238393..6a66186e7 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmail.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmail.java @@ -58,7 +58,7 @@ public class Commandmail extends EssentialsCommand } if (!u.isIgnoredPlayer(user.getName())) { - u.addMail(ChatColor.stripColor(user.getDisplayName()) + ": " + getFinalArg(args, 2)); + u.addMail(user.getName() + ": " + getFinalArg(args, 2)); } user.sendMessage(_("mailSent")); return; @@ -69,7 +69,7 @@ public class Commandmail extends EssentialsCommand { throw new Exception(_("noPerm","essentials.mail.sendall")); } - ess.scheduleAsyncDelayedTask(new SendAll(ChatColor.stripColor(user.getDisplayName()) + ": " + getFinalArg(args, 1))); + ess.scheduleAsyncDelayedTask(new SendAll(user.getName() + ": " + getFinalArg(args, 1))); user.sendMessage(_("mailSent")); return; } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandnear.java b/Essentials/src/com/earth2me/essentials/commands/Commandnear.java index 18fb798af..0afcf1650 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandnear.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandnear.java @@ -19,7 +19,7 @@ public class Commandnear extends EssentialsCommand @Override protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { - long radius = 100; + long radius = 200; User otherUser = null; if (args.length > 0) @@ -72,7 +72,7 @@ public class Commandnear extends EssentialsCommand { throw new NotEnoughArgumentsException(); } - long radius = 100; + long radius = 200; if (args.length > 1) { try @@ -111,7 +111,7 @@ public class Commandnear extends EssentialsCommand { output.append(", "); } - output.append(player.getDisplayName()).append("§f(§4").append(Math.sqrt(delta)).append("m§f)"); + output.append(player.getDisplayName()).append("§f(§4").append((long)Math.sqrt(delta)).append("m§f)"); } } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java b/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java index b442d4db8..ca03364b2 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java @@ -24,7 +24,7 @@ public class Commandpowertool extends EssentialsCommand String command = getFinalArg(args, 0); // check to see if this is a clear all command - if (command != null && command.equalsIgnoreCase("c:")) + if (command != null && command.equalsIgnoreCase("d:")) { user.clearAllPowertools(); user.sendMessage(_("powerToolClearAll")); @@ -76,11 +76,16 @@ public class Commandpowertool extends EssentialsCommand { if (command.startsWith("a:")) { + if (!user.isAuthorized("essentials.powertool.append")) + { + throw new Exception(_("noPerm", "essentials.powertool.append")); + } command = command.substring(2); if (powertools.contains(command)) { throw new Exception(_("powerToolAlreadySet", command, itemName)); } + } else if (powertools != null && !powertools.isEmpty()) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java b/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java index 6266b5178..b48ac5bcb 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java @@ -2,8 +2,8 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; +import com.earth2me.essentials.Util; import java.util.Locale; -import org.bukkit.ChatColor; import org.bukkit.Server; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -31,9 +31,9 @@ public class Commandrealname extends EssentialsCommand { continue; } - final String displayName = ChatColor.stripColor(u.getDisplayName()).toLowerCase(Locale.ENGLISH); + final String displayName = Util.stripColor(u.getDisplayName()).toLowerCase(Locale.ENGLISH); if (!whois.equals(displayName) - && !displayName.equals(ChatColor.stripColor(ess.getSettings().getNicknamePrefix()) + whois) + && !displayName.equals(Util.stripColor(ess.getSettings().getNicknamePrefix()) + whois) && !whois.equalsIgnoreCase(u.getName())) { continue; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java index 5b810e611..34195d51a 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java @@ -31,6 +31,10 @@ public class Commandtpa extends EssentialsCommand player.sendMessage(_("teleportRequest", user.getDisplayName())); player.sendMessage(_("typeTpaccept")); player.sendMessage(_("typeTpdeny")); + if (ess.getSettings().getTpaAcceptCancellation() != 0) + { + player.sendMessage(_("teleportRequestTimeoutInfo", ess.getSettings().getTpaAcceptCancellation())); + } } user.sendMessage(_("requestSent", player.getDisplayName())); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpaall.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpaall.java index 7a5d078f3..c0abdc1ad 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpaall.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpaall.java @@ -50,6 +50,10 @@ public class Commandtpaall extends EssentialsCommand player.requestTeleport(user, true); player.sendMessage(_("teleportHereRequest", user.getDisplayName())); player.sendMessage(_("typeTpaccept")); + if (ess.getSettings().getTpaAcceptCancellation() != 0) + { + player.sendMessage(_("teleportRequestTimeoutInfo", ess.getSettings().getTpaAcceptCancellation())); + } } catch (Exception ex) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java index 954f3f038..0cece3310 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java @@ -27,6 +27,13 @@ public class Commandtpaccept extends EssentialsCommand throw new Exception(_("noPendingRequest")); } + long timeout = ess.getSettings().getTpaAcceptCancellation(); + if (timeout != 0 && (System.currentTimeMillis() - user.getTeleportRequestTime()) / 1000 > timeout) + { + user.requestTeleport(null, false); + throw new Exception(_("requestTimedOut")); + } + final Trade charge = new Trade(this.getName(), ess); if (user.isTeleportRequestHere()) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpahere.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpahere.java index 751fc628c..376c2be44 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpahere.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpahere.java @@ -28,6 +28,10 @@ public class Commandtpahere extends EssentialsCommand player.requestTeleport(user, true); player.sendMessage(_("teleportHereRequest", user.getDisplayName())); player.sendMessage(_("typeTpaccept")); + if (ess.getSettings().getTpaAcceptCancellation() != 0) + { + player.sendMessage(_("teleportRequestTimeoutInfo", ess.getSettings().getTpaAcceptCancellation())); + } user.sendMessage(_("requestSent", player.getDisplayName())); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtree.java b/Essentials/src/com/earth2me/essentials/commands/Commandtree.java index 538611972..20cc9d46f 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtree.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtree.java @@ -35,6 +35,14 @@ public class Commandtree extends EssentialsCommand { tree = TreeType.TREE; } + else if (args[0].equalsIgnoreCase("redmushroom")) + { + tree = TreeType.RED_MUSHROOM; + } + else if (args[0].equalsIgnoreCase("brownmushroom")) + { + tree = TreeType.BROWN_MUSHROOM; + } else { throw new NotEnoughArgumentsException(); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java b/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java index 8fe84ba16..51b64563b 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java @@ -70,6 +70,7 @@ public class Commandwarp extends EssentialsCommand } + //TODO: Use one of the new text classes, like /help ? private void warpList(final CommandSender sender, final String[] args) throws Exception { final Warps warps = ess.getWarps(); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java b/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java index c5d10a2e8..7e211455e 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java @@ -4,7 +4,6 @@ import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import com.earth2me.essentials.Util; import java.util.Locale; -import org.bukkit.ChatColor; import org.bukkit.Server; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -37,7 +36,7 @@ public class Commandwhois extends EssentialsCommand showhidden = true; } final String whois = args[0].toLowerCase(Locale.ENGLISH); - final int prefixLength = ChatColor.stripColor(ess.getSettings().getNicknamePrefix()).length(); + final int prefixLength = Util.stripColor(ess.getSettings().getNicknamePrefix()).length(); for (Player onlinePlayer : server.getOnlinePlayers()) { final User user = ess.getUser(onlinePlayer); @@ -45,7 +44,7 @@ public class Commandwhois extends EssentialsCommand { continue; } - final String nickName = ChatColor.stripColor(user.getNickname()); + final String nickName = Util.stripColor(user.getNickname()); if (!whois.equalsIgnoreCase(nickName) && !whois.substring(prefixLength).equalsIgnoreCase(nickName) && !whois.equalsIgnoreCase(user.getName())) diff --git a/Essentials/src/com/earth2me/essentials/perm/BPermissionsHandler.java b/Essentials/src/com/earth2me/essentials/perm/BPermissionsHandler.java index b0f8e90c6..fea268f90 100644 --- a/Essentials/src/com/earth2me/essentials/perm/BPermissionsHandler.java +++ b/Essentials/src/com/earth2me/essentials/perm/BPermissionsHandler.java @@ -8,7 +8,7 @@ import java.util.List; import org.bukkit.entity.Player; -public class BPermissionsHandler implements IPermissionsHandler +public class BPermissionsHandler extends SuperpermsHandler { private final transient WorldPermissionsManager wpm; private final transient InfoReader info; @@ -71,9 +71,4 @@ public class BPermissionsHandler implements IPermissionsHandler return info.getSuffix(base); } - @Override - public boolean hasPermission(final Player base, final String node) - { - return base.hasPermission(node); - } } diff --git a/Essentials/src/com/earth2me/essentials/signs/SignKit.java b/Essentials/src/com/earth2me/essentials/signs/SignKit.java new file mode 100644 index 000000000..32a169592 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/signs/SignKit.java @@ -0,0 +1,73 @@ +package com.earth2me.essentials.signs; + +import com.earth2me.essentials.*; +import java.util.List; +import java.util.Locale; +import java.util.Map; + + +public class SignKit extends EssentialsSign +{ + public SignKit() + { + super("Kit"); + } + + @Override + protected boolean onSignCreate(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException + { + validateTrade(sign, 3, ess); + + final String kitName = sign.getLine(1).toLowerCase(Locale.ENGLISH); + + if (kitName.isEmpty()) + { + sign.setLine(1, "§dKit name!"); + return false; + } + else + { + try + { + ess.getSettings().getKit(kitName); + } + catch (Exception ex) + { + throw new SignException(ex.getMessage(), ex); + } + final String group = sign.getLine(2); + if ("Everyone".equalsIgnoreCase(group) || "Everybody".equalsIgnoreCase(group)) + { + sign.setLine(2, "§2Everyone"); + } + return true; + } + } + + @Override + protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException, ChargeException + { + final String kitName = sign.getLine(1).toLowerCase(Locale.ENGLISH); + final String group = sign.getLine(2); + if ((!group.isEmpty() && ("§2Everyone".equals(group) || player.inGroup(group))) + || (group.isEmpty() && (player.isAuthorized("essentials.kit." + kitName)))) + { + final Trade charge = getTrade(sign, 3, ess); + charge.isAffordableFor(player); + try + { + final Object kit = ess.getSettings().getKit(kitName); + final Map<String, Object> els = (Map<String, Object>)kit; + final List<String> items = Kit.getItems(player, els); + Kit.expandItems(ess, player, items); + charge.charge(player); + } + catch (Exception ex) + { + throw new SignException(ex.getMessage(), ex); + } + return true; + } + return false; + } +} diff --git a/Essentials/src/com/earth2me/essentials/signs/SignProtection.java b/Essentials/src/com/earth2me/essentials/signs/SignProtection.java index e82759655..f64b6f3f1 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignProtection.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignProtection.java @@ -5,8 +5,8 @@ import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.IEssentials; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; +import com.earth2me.essentials.Util; import java.util.*; -import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; @@ -147,7 +147,7 @@ public class SignProtection extends EssentialsSign { return SignProtectionState.OWNER; } - if (ChatColor.stripColor(sign.getLine(3)).equalsIgnoreCase(username)) + if (Util.stripColor(sign.getLine(3)).equalsIgnoreCase(username)) { return SignProtectionState.OWNER; } diff --git a/Essentials/src/com/earth2me/essentials/signs/Signs.java b/Essentials/src/com/earth2me/essentials/signs/Signs.java index 83a0ee828..e29d45ad4 100644 --- a/Essentials/src/com/earth2me/essentials/signs/Signs.java +++ b/Essentials/src/com/earth2me/essentials/signs/Signs.java @@ -10,6 +10,7 @@ public enum Signs FREE(new SignFree()), GAMEMODE(new SignGameMode()), HEAL(new SignHeal()), + KIT(new SignKit()), MAIL(new SignMail()), PROTECTION(new SignProtection()), SELL(new SignSell()), diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml index 019c0ef7a..2254bdbab 100644 --- a/Essentials/src/config.yml +++ b/Essentials/src/config.yml @@ -273,6 +273,10 @@ sethome-multiple: # essentials.sethome.multiple.staff staff: 10 +#Set timeout in seconds for players to accept tpa before request is cancelled. +#Set to 0 for no timeout +tpa-accept-cancellation: 0 + ############################################################ # +------------------------------------------------------+ # # | EssentialsEco | # @@ -368,24 +372,21 @@ protect: # For which block types would you like to be alerted? # You can find a list of IDs in plugins/Essentials/items.csv after loading Essentials for the first time. + # 10 = lava :: 11 = still lava :: 46 = TNT :: 327 = lava bucket alert: - # 10: lava - # 11: still lava - # 46: TNT - on-placement: 10,11,46 - on-use: - # 46: TNT + on-placement: 10,11,46,327 + on-use: 327 on-break: - # Users cannot PLACE these types of blocks/items. - # < 255 designates a BLOCK - # > 255 designates an ITEM (Some blocks can be placed as blocks OR items; lava blocks can be placed by lava buckets, for example.) blacklist: - placement: 327,326,14,56,46,11,10,9,8 - usage: 327,326,325 + + # Which blocks should people be prevented from placing + placement: 10,11,46,327 + + # Which items should people be prevented from using + usage: 327 - #prevent people from breaking blocks - #break: 20,50 + # Which blocks should people be prevented from breaking break: # Which blocks should not be pushed by pistons diff --git a/Essentials/src/items.csv b/Essentials/src/items.csv index 44a4de473..95a197aec 100644 --- a/Essentials/src/items.csv +++ b/Essentials/src/items.csv @@ -1425,13 +1425,13 @@ btable,116,0 bdesk,116,0 mtable,116,0 mdesk,116,0 -brewingstand,117,0 -brewer,117,0 -potionstand,117,0 -potionbrewer,117,0 -pstand,117,0 -bstand,117,0 -pbrewer,117,0 +brewingstandblock,117,0 +brewerblock,117,0 +potionstandblock,117,0 +potionbrewerblock,117,0 +pstandblock,117,0 +bstandblock,117,0 +pbrewerblock,117,0 cauldron,118,0 steelcauldron,118,0 ironcauldron,118,0 @@ -2405,8 +2405,10 @@ gcream,378,0 bcream,378,0 combinedcream,378,0 ccream,378,0 -brewingstanditem,379,0 -potionstanditem,379,0 +bstand,379,0 +pstand,379,0 +brewingstand,379,0 +potionstand,379,0 cauldronitem,380,0 ironcauldronitem,380,0 steelcauldronitem,380,0 diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index b9e27b959..56da9bbec 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -24,7 +24,7 @@ bannedPlayersFileError=Error reading banned-players.txt bannedPlayersFileNotFound=banned-players.txt not found bigTreeFailure=\u00a7cBig tree generation failure. Try again on grass or dirt. bigTreeSuccess= \u00a77Big tree spawned. -blockList=Essentials blocked the following commands, due to command conflicts: +blockList=Essentials relayed the following commands to another plugin: broadcast=[\u00a7cBroadcast\u00a7f]\u00a7a {0} buildAlert=\u00a7cYou are not permitted to build bukkitFormatChanged=Bukkit version format changed. Version not checked. @@ -233,7 +233,7 @@ notAllowedToQuestion=\u00a7cYou are not authorized to use question. notAllowedToShout=\u00a7cYou are not authorized to shout. notEnoughExperience=You do not have enough experience. notEnoughMoney=You do not have sufficient funds. -notRecommendedBukkit=Bukkit version is not the recommended build for Essentials. +notRecommendedBukkit= * ! * Bukkit version is not the recommended build for Essentials. notSupportedYet=Not supported yet. nothingInHand = \u00a7cYou have nothing in your hand. now=now @@ -291,7 +291,7 @@ requestAcceptedFrom=\u00a77{0} accepted your teleport request. requestDenied=\u00a77Teleport request denied. requestDeniedFrom=\u00a77{0} denied your teleport request. requestSent=\u00a77Request sent to {0}\u00a77. -requiredBukkit=You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org. +requiredBukkit= * ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org. returnPlayerToJailError=Error occurred when trying to return player to jail. second=second seconds=seconds @@ -402,3 +402,5 @@ year=year years=years youAreHealed=\u00a77You have been healed. youHaveNewMail=\u00a7cYou have {0} messages!\u00a7f Type \u00a77/mail read\u00a7f to view your mail. +requestTimedOut=\u00a7cTeleport request has timed out +teleportRequestTimeoutInfo=\u00a77This request will timeout after {0} seconds. diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties index d44f66c72..ea2007b17 100644 --- a/Essentials/src/messages_da.properties +++ b/Essentials/src/messages_da.properties @@ -24,7 +24,7 @@ bannedPlayersFileError=Fejl i afl\u00e6sning af banned-players.txt bannedPlayersFileNotFound=banned-players.txt ikke fundet bigTreeFailure=\u00a7cFejl i generering af stort tr\u00e6. Pr\u00f8v igen p\u00e5 gr\u00e6s eller jord. bigTreeSuccess= \u00a77Stort tr\u00e6 bygget. -blockList=Essentials blokerede f\u00c3\u00b8lgende kommandoer som f\u00c3\u00b8lge af kommando-konflikter: +blockList=Essentials relayed the following commands to another plugin: broadcast=[\u00a7cMeddelelse\u00a7f]\u00a7a {0} buildAlert=\u00a7cDu har ikke tilladelse til at bygge bukkitFormatChanged=Bukkit versionsformat er \u00e6ndret. Versionen er ikke checket. @@ -233,7 +233,7 @@ notAllowedToQuestion=\u00a7cDu har ikke tilladelse til at bruge sp\u00f8rgsm\u00 notAllowedToShout=\u00a7cDu har ikke tilladelse til at r\u00e5be. notEnoughExperience=You do not have enough experience. notEnoughMoney=Du har ikke tilstr\u00e6kkeligt med penge. -notRecommendedBukkit=Bukkit version er ikke den anbefalede build til Essentials. +notRecommendedBukkit=* ! * Bukkit version er ikke den anbefalede build til Essentials. notSupportedYet=Ikke underst\u00f8ttet endnu. nothingInHand = \u00a7cDu har intet i din h\u00c3\u00a5nd. now=nu @@ -291,7 +291,7 @@ requestAcceptedFrom=\u00a77{0} accepterede din anmodning om teleport. requestDenied=\u00a77Anmodning om teleport afvist. requestDeniedFrom=\u00a77{0} afviste din anmodning om teleport. requestSent=\u00a77Anmodning sendt til {0}\u00a77. -requiredBukkit=You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org. +requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org. returnPlayerToJailError=En fejl opstod ved fors\u00f8g p\u00e5 at returnere spilleren til f\u00e6ngsel. second=sekund seconds=sekunder @@ -402,3 +402,5 @@ year=\u00e5r years=\u00e5r youAreHealed=\u00a77Du er blevet healed. Halleluja! youHaveNewMail=\u00a7cDu har {0} flaskeposter!\u00a7f Type \u00a77/mail read for at se din flaskepost. +requestTimedOut=\u00a7cTeleport request has timed out +teleportRequestTimeoutInfo=\u00a77This request will timeout after {0} seconds. diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties index 5de616099..204625fd1 100644 --- a/Essentials/src/messages_de.properties +++ b/Essentials/src/messages_de.properties @@ -24,7 +24,7 @@ bannedPlayersFileError=Fehler beim Lesen von banned-players.txt bannedPlayersFileNotFound=banned-players.txt nicht gefunden bigTreeFailure=\u00a7cFehler beim Pflanzen eines grossen Baums. Versuch es auf Gras oder Dreck. bigTreeSuccess= \u00a77Grosser Baum gepflanzt. -blockList=Essentials blocked the following commands, due to command conflicts: +blockList=Essentials relayed the following commands to another plugin: broadcast=[\u00a7cRundruf\u00a7f]\u00a7a {0} buildAlert=\u00a7cDu hast keine Rechte zum Bauen. bukkitFormatChanged=Bukkit-Versionsformat hat sich ge\u00e4ndert. Version nicht kontrolliert. @@ -233,7 +233,7 @@ notAllowedToQuestion=\u00a7cDu bist nicht berechtigt zu fragen. notAllowedToShout=\u00a7cDu bist nicht berechtigt zu schreien. notEnoughExperience=You do not have enough experience. notEnoughMoney=Du hast nicht genug Geld. -notRecommendedBukkit=Die verwendete Bukkit-Version ist nicht f\u00fcr Essentials empfohlen. +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 @@ -291,7 +291,7 @@ requestAcceptedFrom=\u00a77{0} hat deine Teleportierungsanfrage angenommen. requestDenied=\u00a77Teleportierungsanfrage verweigert. requestDeniedFrom=\u00a77{0} hat deine Teleportierungsanfrage abgelehnt. requestSent=\u00a77Anfrage gesendet an {0}\u00a77. -requiredBukkit=You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org. +requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org. returnPlayerToJailError=Fehler beim Versuch, den Spieler ins Gef\u00e4ngnis zu teleportieren. second=Sekunde seconds=Sekunden @@ -402,3 +402,5 @@ year=Jahr years=Jahre youAreHealed=\u00a77Du wurdest geheilt. youHaveNewMail=\u00a7cDu hast {0} Nachrichten!\u00a7f Schreibe \u00a77/mail read\u00a7f um deine Nachrichten anzuzeigen. +requestTimedOut=\u00a7cTeleport request has timed out +teleportRequestTimeoutInfo=\u00a77This request will timeout after {0} seconds. diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties index 72d095524..9476b8bcf 100644 --- a/Essentials/src/messages_en.properties +++ b/Essentials/src/messages_en.properties @@ -24,7 +24,7 @@ bannedPlayersFileError=Error reading banned-players.txt bannedPlayersFileNotFound=banned-players.txt not found bigTreeFailure=\u00a7cBig tree generation failure. Try again on grass or dirt. bigTreeSuccess= \u00a77Big tree spawned. -blockList=Essentials blocked the following commands, due to command conflicts: +blockList=Essentials relayed the following commands to another plugin: broadcast=[\u00a7cBroadcast\u00a7f]\u00a7a {0} buildAlert=\u00a7cYou are not permitted to build bukkitFormatChanged=Bukkit version format changed. Version not checked. @@ -233,7 +233,7 @@ notAllowedToQuestion=\u00a7cYou are not authorized to use question. notAllowedToShout=\u00a7cYou are not authorized to shout. notEnoughExperience=You do not have enough experience. notEnoughMoney=You do not have sufficient funds. -notRecommendedBukkit=Bukkit version is not the recommended build for Essentials. +notRecommendedBukkit=* ! * Bukkit version is not the recommended build for Essentials. notSupportedYet=Not supported yet. nothingInHand = \u00a7cYou have nothing in your hand. now=now @@ -291,7 +291,7 @@ requestAcceptedFrom=\u00a77{0} accepted your teleport request. requestDenied=\u00a77Teleport request denied. requestDeniedFrom=\u00a77{0} denied your teleport request requestSent=\u00a77Request sent to {0}\u00a77. -requiredBukkit=You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org. +requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org. returnPlayerToJailError=Error occurred when trying to return player to jail. second=second seconds=seconds @@ -402,3 +402,5 @@ year=year years=years youAreHealed=\u00a77You have been healed. youHaveNewMail=\u00a7cYou have {0} messages!\u00a7f Type \u00a77/mail read\u00a7f to view your mail. +requestTimedOut=\u00a7cTeleport request has timed out +teleportRequestTimeoutInfo=\u00a77This request will timeout after {0} seconds. diff --git a/Essentials/src/messages_es.properties b/Essentials/src/messages_es.properties index fc6b13eb1..def9d9fb1 100644 --- a/Essentials/src/messages_es.properties +++ b/Essentials/src/messages_es.properties @@ -24,7 +24,7 @@ bannedPlayersFileError=Error leyendo banned-players.txt bannedPlayersFileNotFound=banned-players.txt no encontrado bigTreeFailure=\u00a7cBig Generacion de arbol fallida. Prueba de nuevo en hierba o arena. bigTreeSuccess= \u00a77Big Arbol generado. -blockList=Essentials blocked the following commands, due to command conflicts: +blockList=Essentials relayed the following commands to another plugin: broadcast=[\u00a7cBroadcast\u00a7f]\u00a7a {0} buildAlert=\u00a7cNo tienes permisos para construir bukkitFormatChanged=Version de formato de Bukkit cambiado. Version no comprobada. @@ -233,7 +233,7 @@ notAllowedToQuestion=\u00a7cYou estas autorizado para usar las preguntas. notAllowedToShout=\u00a7cNo estas autorizado para gritar. notEnoughExperience=You do not have enough experience. notEnoughMoney=No tienes el dinero suficiente. -notRecommendedBukkit=La version de bukkit no es la recomendada para esta version de Essentials. +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 @@ -291,7 +291,7 @@ requestAcceptedFrom=\u00a77{0} acepto tu peticion de teletransporte. requestDenied=\u00a77Peticion de teletransporte denegada. requestDeniedFrom=\u00a77{0} ha denegado tu peticion de teletransporte. requestSent=\u00a77Peticion enviada a {0}\u00a77. -requiredBukkit=You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org. +requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org. returnPlayerToJailError=Error al intentar quitar al jugador de la carcel. second=segundo seconds=segundos @@ -402,3 +402,5 @@ year=año years=años youAreHealed=\u00a77Has sido curado. youHaveNewMail=\u00a7cTienes {0} mensajes!\u00a7f Pon \u00a77/mail read\u00a7f para ver tus emails no leidos!. +requestTimedOut=\u00a7cTeleport request has timed out +teleportRequestTimeoutInfo=\u00a77This request will timeout after {0} seconds. diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties index 97e87b14b..b73603e4f 100644 --- a/Essentials/src/messages_fr.properties +++ b/Essentials/src/messages_fr.properties @@ -24,7 +24,7 @@ bannedPlayersFileError=Erreur lors de la lecture de banned-players.txt bannedPlayersFileNotFound=banned-players.txt introuvable. bigTreeFailure=\u00a7c\u00c9chec de la g\u00e9n\u00e9ration du gros arbre. Essayez de nouveau sur de la terre ou de l''herbe. bigTreeSuccess=\u00a77Gros arbre cr\u00e9e. -blockList=Essentials blocked the following commands, due to command conflicts: +blockList=Essentials relayed the following commands to another plugin: broadcast=[\u00a7cMessage\u00a7f]\u00a7a {0} buildAlert=\u00a7cVous n''avez pas la permission de construire. bukkitFormatChanged=Le format de la version de Bukkit a \u00e9t\u00e9 chang\u00e9. La version n''a pas \u00e9t\u00e9 v\u00e9rifi\u00e9e. @@ -233,7 +233,7 @@ notAllowedToQuestion=\u00a7cVous n''\u00eates pas autoris\u00e9 \u00e0 poser des notAllowedToShout=\u00a7cVous n''\u00eates pas autoris\u00e9 \u00e0 crier. notEnoughExperience=You do not have enough experience. 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. +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 = \u00a7cVous n''avez rien en main. now=maintenant @@ -291,7 +291,7 @@ requestAcceptedFrom=\u00a77{0} a accept\u00e9 votre demande de t\u00e9l\u00e9por requestDenied=\u00a77Demande de t\u00e9l\u00e9portation refus\u00e9e. requestDeniedFrom=\u00a77{0} a refus\u00e9 votre demande de t\u00e9l\u00e9portation. requestSent=\u00a77Requ\u00eate envoy\u00e9e \u00e0 {0}\u00a77. -requiredBukkit=You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org. +requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org. returnPlayerToJailError=Erreur survenue lors de la tentative d''emprisonner de nouveau un joueur. second=seconde seconds=secondes @@ -402,3 +402,5 @@ 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. +requestTimedOut=\u00a7cTeleport request has timed out +teleportRequestTimeoutInfo=\u00a77This request will timeout after {0} seconds. diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties index c92952adb..546169060 100644 --- a/Essentials/src/messages_nl.properties +++ b/Essentials/src/messages_nl.properties @@ -24,7 +24,7 @@ bannedPlayersFileError=Fout bij het lezen van banned-players.txt bannedPlayersFileNotFound=banned-players.txt werd niet gevonden bigTreeFailure=\u00a7cMaken van een grote boom is mislukt. Probeer het opnieuw op gras of dirt. bigTreeSuccess= \u00a77Grote boom gemaakt. -blockList=Essentials blocked the following commands, due to command conflicts: +blockList=Essentials relayed the following commands to another plugin: broadcast=[\u00a7cBroadcast\u00a7f]\u00a7a {0} buildAlert=\u00a7cJe bent niet bevoegd om te bouwen bukkitFormatChanged=Bukkit versie formaat veranderd. Versie niet nagekeken. @@ -233,7 +233,7 @@ notAllowedToQuestion=\u00a7cJe bent niet bevoegd om de vraag functie te gebruike notAllowedToShout=\u00a7cJe bent niet bevoegd om de roep functie te gebruiken. notEnoughExperience=You do not have enough experience. notEnoughMoney=Je hebt niet voldoende middelen. -notRecommendedBukkit=De Bukkit versie is niet de aangeraden build voor Essentials. +notRecommendedBukkit=* ! * De Bukkit versie is niet de aangeraden build voor Essentials. notSupportedYet=Nog niet ondersteund. nothingInHand = \u00a7cYou have nothing in your hand. now=nu @@ -291,7 +291,7 @@ requestAcceptedFrom=\u00a77{0} accepted your teleport request. requestDenied=\u00a77Teleporteer aanvraag geweigerd. requestDeniedFrom=\u00a77{0} denied your teleport request. requestSent=\u00a77Aanvraag verstuurd naar {0}\u00a77. -requiredBukkit=You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org. +requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org. returnPlayerToJailError=Fout opgetreden bij terugzetten van speler in gevangenis. second=seconde seconds=seconde @@ -402,3 +402,5 @@ year=jaar years=jaren youAreHealed=\u00a77Je bent genezen. youHaveNewMail=\u00a7cJe hebt {0} berichten!\u00a7f Type \u00a77/mail read\u00a7f om je berichten te bekijken. +requestTimedOut=\u00a7cTeleport request has timed out +teleportRequestTimeoutInfo=\u00a77This request will timeout after {0} seconds. diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml index 275501ab5..c3ed49ad1 100644 --- a/Essentials/src/plugin.yml +++ b/Essentials/src/plugin.yml @@ -240,7 +240,7 @@ commands: aliases: [pong,eping,epong] powertool: description: Assigns a command to the item in hand, {player} will be replaced by the name of the player that you click. - usage: /<command> [l:|a:|r:|c:][command] [arguments] + usage: /<command> [l:|a:|r:|c:|d:][command] [arguments] aliases: [pt,epowertool,ept] powertooltoggle: description: Enables or disables all current powertools diff --git a/Essentials/test/com/earth2me/essentials/FakeServer.java b/Essentials/test/com/earth2me/essentials/FakeServer.java index d0fe51c9a..306f0d6a1 100644 --- a/Essentials/test/com/earth2me/essentials/FakeServer.java +++ b/Essentials/test/com/earth2me/essentials/FakeServer.java @@ -531,6 +531,24 @@ public class FakeServer implements Server { throw new UnsupportedOperationException("Not supported yet."); } + + @Override + public long getFirstPlayed() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public long getLastPlayed() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean hasPlayedBefore() + { + throw new UnsupportedOperationException("Not supported yet."); + } }; } @@ -599,4 +617,10 @@ public class FakeServer implements Server { throw new UnsupportedOperationException("Not supported yet."); } + + @Override + public boolean getAllowEnd() + { + throw new UnsupportedOperationException("Not supported yet."); + } } diff --git a/EssentialsChat/nbproject/project.properties b/EssentialsChat/nbproject/project.properties index e59815e40..8cf7e9081 100644 --- a/EssentialsChat/nbproject/project.properties +++ b/EssentialsChat/nbproject/project.properties @@ -63,12 +63,12 @@ dist.jar=${dist.dir}/EssentialsChat.jar dist.javadoc.dir=${dist.dir}/javadoc endorsed.classpath= excludes= -file.reference.bukkit-1.0.0-R1-SNAPSHOT.jar=../lib/bukkit-1.0.0-R1-SNAPSHOT.jar +file.reference.bukkit.jar=../lib/bukkit.jar includes=** jar.compress=true javac.classpath=\ ${reference.Essentials.jar}:\ - ${file.reference.bukkit-1.0.0-R1-SNAPSHOT.jar} + ${file.reference.bukkit.jar} # Space-separated list of extra javac options javac.compilerargs= javac.deprecation=false diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java index 6600ff91d..25ce85cc8 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java +++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java @@ -4,10 +4,12 @@ import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.IEssentials; import java.util.HashMap; import java.util.Map; +import java.util.concurrent.ConcurrentSkipListMap; import java.util.logging.Level; import java.util.logging.Logger; import org.bukkit.event.Event.Priority; import org.bukkit.event.Event.Type; +import org.bukkit.event.player.PlayerChatEvent; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; @@ -15,8 +17,10 @@ import org.bukkit.plugin.java.JavaPlugin; public class EssentialsChat extends JavaPlugin { private static final Logger LOGGER = Logger.getLogger("Minecraft"); - private Map<String, IEssentialsChatListener> chatListener; + private transient Map<String, IEssentialsChatListener> chatListener; + + @Override public void onEnable() { final PluginManager pluginManager = getServer().getPluginManager(); @@ -31,11 +35,13 @@ public class EssentialsChat extends JavaPlugin return; } - chatListener = new HashMap<String, IEssentialsChatListener>(); + chatListener = new ConcurrentSkipListMap<String, IEssentialsChatListener>(); + final Map<PlayerChatEvent, String> charges = new HashMap<PlayerChatEvent, String>(); + final EssentialsChatPlayerListenerLowest playerListenerLowest = new EssentialsChatPlayerListenerLowest(getServer(), ess, chatListener); - final EssentialsChatPlayerListenerNormal playerListenerNormal = new EssentialsChatPlayerListenerNormal(getServer(), ess, chatListener); - final EssentialsChatPlayerListenerHighest playerListenerHighest = new EssentialsChatPlayerListenerHighest(getServer(), ess, chatListener); + final EssentialsChatPlayerListenerNormal playerListenerNormal = new EssentialsChatPlayerListenerNormal(getServer(), ess, chatListener, charges); + final EssentialsChatPlayerListenerHighest playerListenerHighest = new EssentialsChatPlayerListenerHighest(getServer(), ess, chatListener, charges); pluginManager.registerEvent(Type.PLAYER_CHAT, playerListenerLowest, Priority.Lowest, this); pluginManager.registerEvent(Type.PLAYER_CHAT, playerListenerNormal, Priority.Normal, this); pluginManager.registerEvent(Type.PLAYER_CHAT, playerListenerHighest, Priority.Highest, this); @@ -43,6 +49,7 @@ public class EssentialsChat extends JavaPlugin LOGGER.info(_("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team")); } + @Override public void onDisable() { if (chatListener != null) diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerHighest.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerHighest.java index 17a219acd..22989d4f9 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerHighest.java +++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerHighest.java @@ -10,14 +10,25 @@ import org.bukkit.event.player.PlayerChatEvent; public class EssentialsChatPlayerListenerHighest extends EssentialsChatPlayer { - public EssentialsChatPlayerListenerHighest(Server server, IEssentials ess, Map<String, IEssentialsChatListener> listeners) + private final transient Map<PlayerChatEvent, String> charges; + + public EssentialsChatPlayerListenerHighest(final Server server, + final IEssentials ess, + final Map<String, IEssentialsChatListener> listeners, + final Map<PlayerChatEvent, String> charges) { super(server, ess, listeners); + this.charges = charges; } @Override public void onPlayerChat(final PlayerChatEvent event) { + String charge = charges.remove(event); + if (charge == null) + { + charge = "chat"; + } if (isAborted(event)) { return; @@ -27,22 +38,14 @@ public class EssentialsChatPlayerListenerHighest extends EssentialsChatPlayer * This file should handle charging the user for the action before returning control back */ final User user = ess.getUser(event.getPlayer()); - final String chatType = getChatType(event.getMessage()); - final StringBuilder command = new StringBuilder(); - command.append("chat"); - - if (chatType.length() > 0) - { - command.append("-").append(chatType); - } try { - charge(user, command.toString()); + charge(user, charge); } catch (ChargeException e) { - ess.showError(user, e, command.toString()); + ess.showError(user, e, charge); event.setCancelled(true); return; } diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java index 0a599e88b..de5757951 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java +++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java @@ -10,7 +10,9 @@ import org.bukkit.event.player.PlayerChatEvent; public class EssentialsChatPlayerListenerLowest extends EssentialsChatPlayer { - public EssentialsChatPlayerListenerLowest(Server server, IEssentials ess, Map<String, IEssentialsChatListener> listeners) + public EssentialsChatPlayerListenerLowest(final Server server, + final IEssentials ess, + final Map<String, IEssentialsChatListener> listeners) { super(server, ess, listeners); } diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerNormal.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerNormal.java index 7789009e1..4e3cbefc0 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerNormal.java +++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerNormal.java @@ -1,6 +1,5 @@ package com.earth2me.essentials.chat; -import com.earth2me.essentials.ChargeException; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.IEssentials; import com.earth2me.essentials.User; @@ -12,9 +11,15 @@ import org.bukkit.event.player.PlayerChatEvent; public class EssentialsChatPlayerListenerNormal extends EssentialsChatPlayer { - public EssentialsChatPlayerListenerNormal(Server server, IEssentials ess, Map<String, IEssentialsChatListener> listeners) + private final transient Map<PlayerChatEvent, String> charges; + + public EssentialsChatPlayerListenerNormal(final Server server, + final IEssentials ess, + final Map<String, IEssentialsChatListener> listeners, + final Map<PlayerChatEvent, String> charges) { super(server, ess, listeners); + this.charges = charges; } @Override @@ -29,49 +34,46 @@ public class EssentialsChatPlayerListenerNormal extends EssentialsChatPlayer * This file should handle detection of the local chat features... if local chat is enabled, we need to handle * it here */ - final User user = ess.getUser(event.getPlayer()); final String chatType = getChatType(event.getMessage()); + final StringBuilder command = new StringBuilder(); + command.append("chat"); + + if (chatType.length() > 0) + { + command.append("-").append(chatType); + } long radius = ess.getSettings().getChatRadius(); if (radius < 1) { return; } radius *= radius; - try - { - if (event.getMessage().length() > 0 && chatType.length() > 0) - { - StringBuilder permission = new StringBuilder(); - permission.append("essentials.chat.").append(chatType); - - StringBuilder command = new StringBuilder(); - command.append("chat-").append(chatType); + final User user = ess.getUser(event.getPlayer()); - StringBuilder format = new StringBuilder(); - format.append(chatType).append("Format"); + if (event.getMessage().length() > 0 && chatType.length() > 0) + { + final StringBuilder permission = new StringBuilder(); + permission.append("essentials.chat.").append(chatType); - StringBuilder errorMsg = new StringBuilder(); - errorMsg.append("notAllowedTo").append(chatType.substring(0, 1).toUpperCase(Locale.ENGLISH)).append(chatType.substring(1)); + final StringBuilder format = new StringBuilder(); + format.append(chatType).append("Format"); - if (user.isAuthorized(permission.toString())) - { - charge(user, command.toString()); - event.setMessage(event.getMessage().substring(1)); - event.setFormat(_(format.toString(), event.getFormat())); - return; - } + final StringBuilder errorMsg = new StringBuilder(); + errorMsg.append("notAllowedTo").append(chatType.substring(0, 1).toUpperCase(Locale.ENGLISH)).append(chatType.substring(1)); - user.sendMessage(_(errorMsg.toString())); - event.setCancelled(true); + if (user.isAuthorized(permission.toString())) + { + event.setMessage(event.getMessage().substring(1)); + event.setFormat(_(format.toString(), event.getFormat())); + charges.put(event, command.toString()); return; } - } - catch (ChargeException ex) - { - ess.showError(user, ex, "Shout"); + + user.sendMessage(_(errorMsg.toString())); event.setCancelled(true); return; } + sendLocalChat(user, radius, event); } } diff --git a/EssentialsChat/src/plugin.yml b/EssentialsChat/src/plugin.yml index d3f5d38df..cc129f825 100644 --- a/EssentialsChat/src/plugin.yml +++ b/EssentialsChat/src/plugin.yml @@ -5,6 +5,6 @@ main: com.earth2me.essentials.chat.EssentialsChat version: TeamCity website: http://www.earth2me.net:8001/ description: Provides chat control features for Essentials. Requires Permissions. -authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology] +authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits, Okamosy] depend: [Essentials] #softdepend: [Factions]
\ No newline at end of file diff --git a/EssentialsGeoIP/nbproject/project.properties b/EssentialsGeoIP/nbproject/project.properties index d20b3418f..cec81b0c2 100644 --- a/EssentialsGeoIP/nbproject/project.properties +++ b/EssentialsGeoIP/nbproject/project.properties @@ -63,12 +63,12 @@ dist.jar=${dist.dir}/EssentialsGeoIP.jar dist.javadoc.dir=${dist.dir}/javadoc endorsed.classpath= excludes= -file.reference.bukkit-1.0.0-R1-SNAPSHOT.jar=../lib/bukkit-1.0.0-R1-SNAPSHOT.jar +file.reference.bukkit.jar=../lib/bukkit.jar includes=** jar.compress=true javac.classpath=\ ${reference.Essentials.jar}:\ - ${file.reference.bukkit-1.0.0-R1-SNAPSHOT.jar} + ${file.reference.bukkit.jar} # Space-separated list of extra javac options javac.compilerargs= javac.deprecation=false diff --git a/EssentialsGroupBridge/nbproject/project.properties b/EssentialsGroupBridge/nbproject/project.properties index d23aed45b..b114e24e3 100644 --- a/EssentialsGroupBridge/nbproject/project.properties +++ b/EssentialsGroupBridge/nbproject/project.properties @@ -39,14 +39,14 @@ dist.jar=${dist.dir}/EssentialsGroupBridge.jar dist.javadoc.dir=${dist.dir}/javadoc endorsed.classpath= excludes= -file.reference.bukkit-1.0.0-R1-SNAPSHOT.jar=../lib/bukkit-1.0.0-R1-SNAPSHOT.jar +file.reference.bukkit.jar=../lib/bukkit.jar includes=** jar.archive.disabled=${jnlp.enabled} jar.compress=true jar.index=${jnlp.enabled} javac.classpath=\ ${reference.EssentialsGroupManager.jar}:\ - ${file.reference.bukkit-1.0.0-R1-SNAPSHOT.jar} + ${file.reference.bukkit.jar} # Space-separated list of extra javac options javac.compilerargs= javac.deprecation=false diff --git a/EssentialsGroupManager/.classpath b/EssentialsGroupManager/.classpath index eafae0c2b..61f808b2d 100644 --- a/EssentialsGroupManager/.classpath +++ b/EssentialsGroupManager/.classpath @@ -2,6 +2,6 @@ <classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="lib" path="../lib/bukkit-0.0.1-SNAPSHOT.jar"/>
- <classpathentry kind="lib" path="../lib/craftbukkit-0.0.1-SNAPSHOT.jar"/>
+ <classpathentry kind="lib" path="../lib/craftbukkit.jar"/>
+ <classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/EssentialsGroupManager/nbproject/project.properties b/EssentialsGroupManager/nbproject/project.properties index 6fe938f17..7a333a590 100644 --- a/EssentialsGroupManager/nbproject/project.properties +++ b/EssentialsGroupManager/nbproject/project.properties @@ -39,11 +39,11 @@ dist.jar=${dist.dir}/EssentialsGroupManager.jar dist.javadoc.dir=${dist.dir}/javadoc endorsed.classpath= excludes= -file.reference.bukkit-1.0.0-R1-SNAPSHOT.jar=../lib/bukkit-1.0.0-R1-SNAPSHOT.jar +file.reference.bukkit.jar=../lib/craftbukkit.jar includes=** jar.compress=true javac.classpath=\ - ${file.reference.bukkit-1.0.0-R1-SNAPSHOT.jar} + ${file.reference.craftbukkit.jar} # Space-separated list of extra javac options javac.compilerargs= javac.deprecation=false diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index 71e9f4225..00df6628d 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -79,4 +79,7 @@ v 1.6: - 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.
- - Added file details in error messages for loading groups/users.
\ No newline at end of file + - Added file details in error messages for loading groups/users.
+v 1.7:
+ - GM now supports offline players without having to mantogglevalidate
+ - Offline player checks now support partial name matches.
\ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java index d8b7a15e1..37131f888 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java @@ -16,6 +16,7 @@ import org.anjocaido.groupmanager.dataholder.WorldDataHolder; import java.io.File; import java.io.InputStream; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -30,6 +31,7 @@ import org.anjocaido.groupmanager.utils.PermissionCheckResult; import org.anjocaido.groupmanager.utils.Tasks; import org.bukkit.Bukkit; import org.bukkit.ChatColor; +import org.bukkit.OfflinePlayer; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.command.ConsoleCommandSender; @@ -325,7 +327,7 @@ public class GroupManager extends JavaPlugin { PermissionCheckResult permissionResult = null; ArrayList<User> removeList = null; String auxString = null; - List<Player> match = null; + List<String> match = null; User auxUser = null; Group auxGroup = null; Group auxGroup2 = null; @@ -373,15 +375,12 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <group>)"); return false; } - if (validateOnlinePlayer) { - match = this.getServer().matchPlayer(args[0]); - if (match.size() != 1) { - sender.sendMessage(ChatColor.RED + "Player not found!"); + if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; - } } + if (match != null) { - auxUser = dataHolder.getUser(match.get(0).getName()); + auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } @@ -427,15 +426,12 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player>)"); return false; } - if (validateOnlinePlayer) { - match = this.getServer().matchPlayer(args[0]); - if (match.size() != 1) { - sender.sendMessage(ChatColor.RED + "Player not found!"); + if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; - } } + if (match != null) { - auxUser = dataHolder.getUser(match.get(0).getName()); + auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } @@ -467,15 +463,12 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <group>)"); return false; } - if (validateOnlinePlayer) { - match = this.getServer().matchPlayer(args[0]); - if (match.size() != 1) { - sender.sendMessage(ChatColor.RED + "Player not found!"); + if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; - } } + if (match != null) { - auxUser = dataHolder.getUser(match.get(0).getName()); + auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } @@ -509,15 +502,12 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manudelsub <user> <group>)"); return false; } - if (validateOnlinePlayer) { - match = this.getServer().matchPlayer(args[0]); - if (match.size() != 1) { - sender.sendMessage(ChatColor.RED + "Player not found!"); + if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; - } } + if (match != null) { - auxUser = dataHolder.getUser(match.get(0).getName()); + auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } @@ -596,15 +586,12 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <permission>)"); return false; } - if (validateOnlinePlayer) { - match = this.getServer().matchPlayer(args[0]); - if (match.size() != 1) { - sender.sendMessage(ChatColor.RED + "Player not found!"); + if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; - } } + if (match != null) { - auxUser = dataHolder.getUser(match.get(0).getName()); + auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } @@ -664,15 +651,12 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <permission>)"); return false; } - if (validateOnlinePlayer) { - match = this.getServer().matchPlayer(args[0]); - if (match.size() != 1) { - sender.sendMessage(ChatColor.RED + "Player not found!"); + if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; - } } + if (match != null) { - auxUser = dataHolder.getUser(match.get(0).getName()); + auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } @@ -718,17 +702,13 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> (+))"); return false; } - - if (validateOnlinePlayer) { - match = this.getServer().matchPlayer(args[0]); - if (match.size() != 1) { - sender.sendMessage(ChatColor.RED + "Player not found!"); + + if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; - } else - targetPlayer = this.getServer().getPlayer(match.get(0).getName()); } + if (match != null) { - auxUser = dataHolder.getUser(match.get(0).getName()); + auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } @@ -765,6 +745,7 @@ public class GroupManager extends JavaPlugin { // bukkit perms if ((args.length == 2) && (args[1].equalsIgnoreCase("+"))) { + targetPlayer = this.getServer().getPlayer(auxUser.getName()); if (targetPlayer != null) { sender.sendMessage(ChatColor.YELLOW + "Superperms reports: "); for (String line : BukkitPermissions.listPerms(targetPlayer)) @@ -786,19 +767,16 @@ public class GroupManager extends JavaPlugin { return false; } - if (validateOnlinePlayer) { - match = this.getServer().matchPlayer(args[0]); - if (match.size() != 1) { - sender.sendMessage(ChatColor.RED + "Player not found!"); + if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; - } else - targetPlayer = this.getServer().getPlayer(match.get(0).getName()); } + if (match != null) { - auxUser = dataHolder.getUser(match.get(0).getName()); + auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } + targetPlayer = this.getServer().getPlayer(auxUser.getName()); // VALIDANDO PERMISSAO permissionResult = permissionHandler.checkFullUserPermission(auxUser, args[1]); if (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND)) { @@ -1089,15 +1067,12 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <user> <variable> <value>)"); return false; } - if (validateOnlinePlayer) { - match = this.getServer().matchPlayer(args[0]); - if (match.size() != 1) { - sender.sendMessage(ChatColor.RED + "Player not found!"); + if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; - } } + if (match != null) { - auxUser = dataHolder.getUser(match.get(0).getName()); + auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } @@ -1124,15 +1099,12 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <user> <variable>)"); return false; } - if (validateOnlinePlayer) { - match = this.getServer().matchPlayer(args[0]); - if (match.size() != 1) { - sender.sendMessage(ChatColor.RED + "Player not found!"); + if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; - } } + if (match != null) { - auxUser = dataHolder.getUser(match.get(0).getName()); + auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } @@ -1155,15 +1127,11 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <user>)"); return false; } - if (validateOnlinePlayer) { - match = this.getServer().matchPlayer(args[0]); - if (match.size() != 1) { - sender.sendMessage(ChatColor.RED + "Player not found!"); + if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; - } } if (match != null) { - auxUser = dataHolder.getUser(match.get(0).getName()); + auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } @@ -1192,15 +1160,11 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <user> <variable>)"); return false; } - if (validateOnlinePlayer) { - match = this.getServer().matchPlayer(args[0]); - if (match.size() != 1) { - sender.sendMessage(ChatColor.RED + "Player not found!"); + if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; - } } if (match != null) { - auxUser = dataHolder.getUser(match.get(0).getName()); + auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } @@ -1359,15 +1323,11 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player>)"); return false; } - if (validateOnlinePlayer) { - match = this.getServer().matchPlayer(args[0]); - if (match.size() != 1) { - sender.sendMessage(ChatColor.RED + "Player not found!"); + if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; - } } if (match != null) { - auxUser = dataHolder.getUser(match.get(0).getName()); + auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } @@ -1393,15 +1353,11 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player>)"); return false; } - if (validateOnlinePlayer) { - match = this.getServer().matchPlayer(args[0]); - if (match.size() != 1) { - sender.sendMessage(ChatColor.RED + "Player not found!"); + if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; - } } if (match != null) { - auxUser = dataHolder.getUser(match.get(0).getName()); + auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } @@ -1431,15 +1387,11 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player>)"); return false; } - if (validateOnlinePlayer) { - match = this.getServer().matchPlayer(args[0]); - if (match.size() != 1) { - sender.sendMessage(ChatColor.RED + "Player not found!"); + if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; - } } if (match != null) { - auxUser = dataHolder.getUser(match.get(0).getName()); + auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } @@ -1613,15 +1565,11 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <group>)"); return false; } - if (validateOnlinePlayer) { - match = this.getServer().matchPlayer(args[0]); - if (match.size() != 1) { - sender.sendMessage(ChatColor.RED + "Player not found!"); + if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; - } } if (match != null) { - auxUser = dataHolder.getUser(match.get(0).getName()); + auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } @@ -1673,15 +1621,11 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <group>)"); return false; } - if (validateOnlinePlayer) { - match = this.getServer().matchPlayer(args[0]); - if (match.size() != 1) { - sender.sendMessage(ChatColor.RED + "Player not found!"); + if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; - } } if (match != null) { - auxUser = dataHolder.getUser(match.get(0).getName()); + auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } @@ -1841,6 +1785,49 @@ public class GroupManager extends JavaPlugin { } } + + /** + * Load a List of players matching the name given. If none online, check + * Offline. + * + * @param playerName, sender + * @return true if a single match is found + */ + private List<String> validatePlayer(String playerName, CommandSender sender) { + + List<Player> players = new ArrayList<Player>(); + List<String> match = new ArrayList<String>(); + + players = this.getServer().matchPlayer(playerName); + if (players.isEmpty()) { + // Check for an offline player (exact match). + if (Arrays.asList(this.getServer().getOfflinePlayers()).contains(Bukkit.getOfflinePlayer(playerName))) { + match.add(playerName); + } else { + //look for partial matches + for (OfflinePlayer offline : this.getServer().getOfflinePlayers()) { + if (offline.getName().toLowerCase().startsWith(playerName.toLowerCase())) + match.add(offline.getName()); + } + } + + } else { + for (Player player : players) { + match.add(player.getName()); + } + } + + if (match.isEmpty() || match == null) { + sender.sendMessage(ChatColor.RED + "Player not found!"); + return null; + } else if (match.size() > 1) { + sender.sendMessage(ChatColor.RED + "Too many matches found! (" + match.toString() + ")"); + return null; + } + + return match; + + } /** * @return the config diff --git a/EssentialsGroupManager/src/plugin.yml b/EssentialsGroupManager/src/plugin.yml index 3c8657c12..115e92ba2 100644 --- a/EssentialsGroupManager/src/plugin.yml +++ b/EssentialsGroupManager/src/plugin.yml @@ -1,5 +1,5 @@ name: GroupManager -version: "1.6 (Phoenix)" +version: "1.7 (Phoenix)" main: org.anjocaido.groupmanager.GroupManager website: http://www.anjocaido.info/ description: Provides on-the-fly system for permissions system created by Nijikokun. But all in memory, and with flat-file saving schedule. diff --git a/EssentialsProtect/nbproject/project.properties b/EssentialsProtect/nbproject/project.properties index 5224b3af6..77c12c248 100644 --- a/EssentialsProtect/nbproject/project.properties +++ b/EssentialsProtect/nbproject/project.properties @@ -63,7 +63,7 @@ dist.jar=${dist.dir}/original-EssentialsProtect.jar dist.javadoc.dir=${dist.dir}/javadoc endorsed.classpath= excludes= -file.reference.bukkit-1.0.0-R1-SNAPSHOT.jar=../lib/bukkit-1.0.0-R1-SNAPSHOT.jar +file.reference.bukkit.jar=../lib/bukkit.jar file.reference.c3p0-0.9.1.2.jar=..\\lib\\c3p0-0.9.1.2.jar includes=** jar.archive.disabled=${jnlp.enabled} @@ -72,7 +72,7 @@ jar.index=${jnlp.enabled} javac.classpath=\ ${reference.Essentials.jar}:\ ${file.reference.c3p0-0.9.1.2.jar}:\ - ${file.reference.bukkit-1.0.0-R1-SNAPSHOT.jar} + ${file.reference.bukkit.jar} # Space-separated list of extra javac options javac.compilerargs= javac.deprecation=false diff --git a/EssentialsProtect/src/plugin.yml b/EssentialsProtect/src/plugin.yml index 770d51e64..6407c45ee 100644 --- a/EssentialsProtect/src/plugin.yml +++ b/EssentialsProtect/src/plugin.yml @@ -5,5 +5,5 @@ main: com.earth2me.essentials.protect.EssentialsProtect version: TeamCity website: http://www.earth2me.net:8001/ description: Provides protection for various parts of the world. -authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology] +authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits] softdepend: [Essentials]
\ No newline at end of file diff --git a/EssentialsSpawn/nbproject/project.properties b/EssentialsSpawn/nbproject/project.properties index 96f4448ec..f78c2be3d 100644 --- a/EssentialsSpawn/nbproject/project.properties +++ b/EssentialsSpawn/nbproject/project.properties @@ -63,12 +63,12 @@ dist.jar=${dist.dir}/EssentialsSpawn.jar dist.javadoc.dir=${dist.dir}/javadoc endorsed.classpath= excludes= -file.reference.bukkit-1.0.0-R1-SNAPSHOT.jar=../lib/bukkit-1.0.0-R1-SNAPSHOT.jar +file.reference.bukkit.jar=../lib/bukkit.jar includes=** jar.compress=true javac.classpath=\ ${reference.Essentials.jar}:\ - ${file.reference.bukkit-1.0.0-R1-SNAPSHOT.jar} + ${file.reference.bukkit.jar} # Space-separated list of extra javac options javac.compilerargs= javac.deprecation=false diff --git a/EssentialsSpawn/src/plugin.yml b/EssentialsSpawn/src/plugin.yml index 9a5261e56..a91031fbe 100644 --- a/EssentialsSpawn/src/plugin.yml +++ b/EssentialsSpawn/src/plugin.yml @@ -5,7 +5,7 @@ main: com.earth2me.essentials.spawn.EssentialsSpawn version: TeamCity website: http://www.earth2me.net:8001/ description: Provides spawn control commands, utilizing Essentials. -authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology] +authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits] depend: [Essentials] commands: setspawn: diff --git a/EssentialsXMPP/nbproject/project.properties b/EssentialsXMPP/nbproject/project.properties index 90aba36fa..66d780451 100644 --- a/EssentialsXMPP/nbproject/project.properties +++ b/EssentialsXMPP/nbproject/project.properties @@ -63,7 +63,7 @@ dist.jar=${dist.dir}/original-EssentialsXMPP.jar dist.javadoc.dir=${dist.dir}/javadoc endorsed.classpath= excludes= -file.reference.bukkit-1.0.0-R1-SNAPSHOT.jar=../lib/bukkit-1.0.0-R1-SNAPSHOT.jar +file.reference.bukkit.jar=../lib/bukkit.jar file.reference.smack-3.2.1.jar=../lib/smack-3.2.1.jar includes=** jar.archive.disabled=${jnlp.enabled} @@ -71,8 +71,8 @@ jar.compress=true jar.index=${jnlp.enabled} javac.classpath=\ ${reference.Essentials.jar}:\ - ${file.reference.bukkit-1.0.0-R1-SNAPSHOT.jar}:\ - ${file.reference.smack-3.2.1.jar} + ${file.reference.smack-3.2.1.jar}:\ + ${file.reference.bukkit.jar} # Space-separated list of extra javac options javac.compilerargs=-Xlint:unchecked javac.deprecation=false diff --git a/lib/bukkit-1.0.0-R1-SNAPSHOT.jar b/lib/bukkit.jar Binary files differindex ddaaa3368..283d2224d 100644 --- a/lib/bukkit-1.0.0-R1-SNAPSHOT.jar +++ b/lib/bukkit.jar diff --git a/lib/craftbukkit-1.0.0-SNAPSHOT.jar b/lib/craftbukkit.jar Binary files differindex ab3f075ac..28b3e3f7e 100644 --- a/lib/craftbukkit-1.0.0-SNAPSHOT.jar +++ b/lib/craftbukkit.jar |