From a1a9b112b4fa6767d1859e63ae59a5a213cea6a6 Mon Sep 17 00:00:00 2001 From: Necrodoom Date: Fri, 28 Sep 2012 17:02:43 +0300 Subject: [PATCH 01/43] update potion aliases- add all unused potions items.csv version 2.1_13 --- Essentials/src/items.csv | 275 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 272 insertions(+), 3 deletions(-) diff --git a/Essentials/src/items.csv b/Essentials/src/items.csv index d8c60cb36..0e66d61e2 100644 --- a/Essentials/src/items.csv +++ b/Essentials/src/items.csv @@ -1329,7 +1329,6 @@ burningfurnace,62,0 bfurnace,62,0 signpost,63,0 spost,63,0 -door,64,0 woodendoorhalf,64,0 wooddoorhalf,64,0 wdoorhalf,64,0 @@ -1589,6 +1588,7 @@ doort,96,0 trapd,96,0 dtrap,96,0 silverfish,97,0 +monsteregg,97,0 monstereggsmoothstone,97,0 monstereggsstone,97,0 meggsmoothstone,97,0 @@ -3397,6 +3397,7 @@ sign,323,0 woodendoor,324,0 wooddoor,324,0 wdoor,324,0 +door,324,0 bucket,325,0 bukkit,325,0 waterbucket,326,0 @@ -3946,14 +3947,98 @@ waterbottle,373,0 fullbottle,373,0 watervase,373,0 fullvase,373,0 +clearpotion,373,6 +clearpot,373,6 +clearextendedpotion,373,7 +clearexpotion,373,7 +clear2potion,373,7 +clearextendedpot,373,7 +clearexpot,373,7 +clear2pot,373,7 +diffusepotion,373,11 +diffusepot,373,11 +artlesspotion,373,13 +artlesspot,373,13 +thinpotion,373,14 +thinpot,373,14 +thinextendedpotion,373,15 +thinexpotion,373,15 +thin2potion,373,15 +thinextendedpot,373,15 +thinexpot,373,15 +thin2pot,373,15 awkwardpotion,373,16 awkwardpot,373,16 +bunglingpotion,373,22 +bunglingpot,373,22 +bunglingextendedpotion,373,23 +bunglingexpotion,373,23 +bungling2potion,373,23 +bunglingextendedpot,373,23 +bunglingexpot,373,23 +bungling2pot,373,23 +smoothpotion,373,27 +smoothpot,373,27 +suavepotion,373,29 +suavepot,373,29 +debonairpotion,373,30 +debonairpot,373,30 +debonairextendedpotion,373,31 +debonairexpotion,373,31 +debonair2potion,373,31 +debonairextendedpot,373,31 +debonairexpot,373,31 +debonair2pot,373,31 thickpotion,373,32 thickpot,373,32 -mundaneexpotion,373,64 +charmingpotion,373,38 +charmingpot,373,38 +charmingextendedpotion,373,39 +charmingexpotion,373,39 +charming2potion,373,39 +charmingextendedpot,373,39 +charmingexpot,373,39 +charming2pot,373,39 +refinedpotion,373,43 +refinedpot,373,43 +cordialpotion,373,45 +cordialpot,373,45 +sparklingpotion,373,46 +sparklingpot,373,46 +sparklingextendedpotion,373,47 +sparklingexpotion,373,47 +sparkling2potion,373,47 +sparklingextendedpot,373,47 +sparklingexpot,373,47 +sparkling2pot,373,47 +potentpotion,373,48 +potentpot,373,48 +rankpotion,373,54 +rankpot,373,54 +rankextendedpotion,373,55 +rankexpotion,373,55 +rank2potion,373,55 +rankextendedpot,373,55 +rankexpot,373,55 +rank2pot,373,55 +acridpotion,373,59 +acridpot,373,59 +grosspotion,373,61 +grosspot,373,61 +stinkypotion,373,62 +stinkypot,373,62 +stinkyextendedpotion,373,63 +stinkyexpotion,373,63 +stinky2potion,373,63 +stinkyextendedpot,373,63 +stinkyexpot,373,63 +stinky2pot,373,63 mundaneextendedpotion,373,64 -mundaneexpot,373,64 +mundaneexpotion,373,64 +mundane2potion,373,64 mundaneextendedpot,373,64 +mundaneexpot,373,64 +mundane2pot,373,64 mundanepotion,373,8192 mundanepot,373,8192 regenerationpotion,373,8193 @@ -4308,6 +4393,22 @@ splhealingpot,373,16389 splhealpot,373,16389 spllifepot,373,16389 sphpot,373,16389 +splashclearpotion,373,16390 +splashclearpot,373,16390 +splclearpotion,373,16390 +splclearpot,373,16390 +splashclearextendedpotion,373,16391 +splashclearexpotion,373,16391 +splashclear2potion,373,16391 +splashclearextendedpot,373,16391 +splashclearexpot,373,16391 +splashclear2pot,373,16391 +splclearextendedpotion,373,16391 +splclearexpotion,373,16391 +splclear2potion,373,16391 +splclearextendedpot,373,16391 +splclearexpot,373,16391 +splclear2pot,373,16391 splashweaknesspotion,373,16392 splashweakpotion,373,16392 splashweaknesspot,373,16392 @@ -4339,6 +4440,10 @@ splslowpotion,373,16394 splslownesspot,373,16394 splslowpot,373,16394 spslpot,373,16394 +splashdiffusepotion,373,16395 +splashdiffusepot,373,16395 +spldiffusepotion,373,16395 +spldiffusepot,373,16395 splashharmingpotion,373,16396 splashdamagepotion,373,16396 splashdmgpotion,373,16396 @@ -4352,6 +4457,74 @@ splharmingpot,373,16396 spldamagepot,373,16396 spldmgpot,373,16396 spdpot,373,16396 +splashartlesspotion,373,16397 +splashartlesspot,373,16397 +splartlesspotion,373,16397 +splartlesspot,373,16397 +splashthinpotion,373,16398 +splashthinpot,373,16398 +splthinpotion,373,16398 +splthinpot,373,16398 +splashthinextendedpotion,373,16399 +splashthinexpotion,373,16399 +splashthin2potion,373,16399 +splashthinextendedpot,373,16399 +splashthinexpot,373,16399 +splashthin2pot,373,16399 +splthinextendedpotion,373,16399 +splthinexpotion,373,16399 +splthin2potion,373,16399 +splthinextendedpot,373,16399 +splthinexpot,373,16399 +splthin2pot,373,16399 +splashawkwardpotion,373,16400 +splashawkwardpot,373,16400 +splawkwardpotion,373,16400 +splawkwardpot,373,16400 +splashbunglingpotion,373,16406 +splashbunglingpot,373,16406 +splbunglingpotion,373,16406 +splbunglingpot,373,16406 +splashbunglingextendedpotion,373,16407 +splashbunglingexpotion,373,16407 +splashbungling2potion,373,16407 +splashbunglingextendedpot,373,16407 +splashbunglingexpot,373,16407 +splashbungling2pot,373,16407 +splbunglingextendedpotion,373,16407 +splbunglingexpotion,373,16407 +splbungling2potion,373,16407 +splbunglingextendedpot,373,16407 +splbunglingexpot,373,16407 +splbungling2pot,373,16407 +splashsmoothpotion,373,16411 +splashsmoothpot,373,16411 +splsmoothpotion,373,16411 +splsmoothpot,373,16411 +splashsuavepotion,373,16413 +splashsuavepot,373,16413 +splsuavepotion,373,16413 +splsuavepot,373,16413 +splashdebonairpotion,373,16414 +splashdebonairpot,373,16414 +spldebonairpotion,373,16414 +spldebonairpot,373,16414 +splashdebonairextendedpotion,373,16415 +splashdebonairexpotion,373,16415 +splashdebonair2potion,373,16415 +splashdebonairextendedpot,373,16415 +splashdebonairexpot,373,16415 +splashdebonair2pot,373,16415 +spldebonairextendedpotion,373,16415 +spldebonairexpotion,373,16415 +spldebonair2potion,373,16415 +spldebonairextendedpot,373,16415 +spldebonairexpot,373,16415 +spldebonair2pot,373,16415 +splashthickpotion,373,16416 +splashthickpot,373,16416 +splthickpotion,373,16416 +splthickpot,373,16416 splashregenerationleveliipotion,373,16417 splashregenerateleveliipotion,373,16417 splashregenleveliipotion,373,16417 @@ -4476,6 +4649,22 @@ splheallevel2pot,373,16421 splhealingiipot,373,16421 splhealiipot,373,16421 sph2pot,373,16421 +splashcharmingpotion,373,16422 +splashcharmingpot,373,16422 +splcharmingpotion,373,16422 +splcharmingpot,373,16422 +splashcharmingextendedpotion,373,16423 +splashcharmingexpotion,373,16423 +splashcharming2potion,373,16423 +splashcharmingextendedpot,373,16423 +splashcharmingexpot,373,16423 +splashcharming2pot,373,16423 +splcharmingextendedpotion,373,16423 +splcharmingexpotion,373,16423 +splcharming2potion,373,16423 +splcharmingextendedpot,373,16423 +splcharmingexpot,373,16423 +splcharming2pot,373,16423 splashstrengthleveliipotion,373,16425 splashstrongleveliipotion,373,16425 splashstrleveliipotion,373,16425 @@ -4513,6 +4702,10 @@ splstrengthiipot,373,16425 splstrongiipot,373,16425 splstriipot,373,16425 spst2pot,373,16425 +splashrefinedpotion,373,16427 +splashrefinedpot,373,16427 +splrefinedpotion,373,16427 +splrefinedpot,373,16427 splashharmingleveliipotion,373,16428 splashdamageleveliipotion,373,16428 splashdmgleveliipotion,373,16428 @@ -4550,6 +4743,82 @@ splharmingiipot,373,16428 spldamageiipot,373,16428 spldmgiipot,373,16428 spd2pot,373,16428 +splashcordialpotion,373,16429 +splashcordialpot,373,16429 +splcordialpotion,373,16429 +splcordialpot,373,16429 +splashsparklingpotion,373,16430 +splashsparklingpot,373,16430 +splsparklingpotion,373,16430 +splsparklingpot,373,16430 +splashsparklingextendedpotion,373,16431 +splashsparklingexpotion,373,16431 +splashsparkling2potion,373,16431 +splashsparklingextendedpot,373,16431 +splashsparklingexpot,373,16431 +splashsparkling2pot,373,16431 +splsparklingextendedpotion,373,16431 +splsparklingexpotion,373,16431 +splsparkling2potion,373,16431 +splsparklingextendedpot,373,16431 +splsparklingexpot,373,16431 +splsparkling2pot,373,16431 +splashpotentpotion,373,16432 +splashpotentpot,373,16432 +splpotentpotion,373,16432 +splpotentpot,373,16432 +splashrankpotion,373,16438 +splashrankpot,373,16438 +splrankpotion,373,16438 +splrankpot,373,16438 +splashrankextendedpotion,373,16439 +splashrankexpotion,373,16439 +splashrank2potion,373,16439 +splashrankextendedpot,373,16439 +splashrankexpot,373,16439 +splashrank2pot,373,16439 +splrankextendedpotion,373,16439 +splrankexpotion,373,16439 +splrank2potion,373,16439 +splrankextendedpot,373,16439 +splrankexpot,373,16439 +splrank2pot,373,16439 +splashacridpotion,373,16443 +splashacridpot,373,16443 +splacridpotion,373,16443 +splacridpot,373,16443 +splashgrosspotion,373,16445 +splashgrosspot,373,16445 +splgrosspotion,373,16445 +splgrosspot,373,16445 +splashstinkypotion,373,16446 +splashstinkypot,373,16446 +splstinkypotion,373,16446 +splstinkypot,373,16446 +splashstinkyextendedpotion,373,16447 +splashstinkyexpotion,373,16447 +splashstinky2potion,373,16447 +splashstinkyextendedpot,373,16447 +splashstinkyexpot,373,16447 +splashstinky2pot,373,16447 +splstinkyextendedpotion,373,16447 +splstinkyexpotion,373,16447 +splstinky2potion,373,16447 +splstinkyextendedpot,373,16447 +splstinkyexpot,373,16447 +splstinky2pot,373,16447 +splashmundaneextendedpotion,373,16448 +splashmundaneexpotion,373,16448 +splashmundane2potion,373,16448 +splashmundaneextendedpot,373,16448 +splashmundaneexpot,373,16448 +splashmundane2pot,373,16448 +splmundaneextendedpotion,373,16448 +splmundaneexpotion,373,16448 +splmundane2potion,373,16448 +splmundaneextendedpot,373,16448 +splmundaneexpot,373,16448 +splmundane2pot,373,16448 splashregenerationextendedpotion,373,16449 splashregenerateextendedpotion,373,16449 splashregenextendepotion,373,16449 From 83a712826c336f9c38ec932fe01aba2f4b06afd6 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Sat, 29 Sep 2012 03:59:31 +0100 Subject: [PATCH 02/43] Should fix tpaccept charge bug - needs testing --- .../src/com/earth2me/essentials/commands/Commandtpaccept.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java index 86f88f884..3f52e8e01 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java @@ -72,5 +72,6 @@ public class Commandtpaccept extends EssentialsCommand target.getTeleport().teleport(user, charge, TeleportCause.COMMAND); } user.requestTeleport(null, false); + throw new NoChargeException(); } } From c92b3b62172d531638a355c9bc4b2410aadb5edc Mon Sep 17 00:00:00 2001 From: Necrodoom Date: Sat, 29 Sep 2012 15:55:47 +0300 Subject: [PATCH 03/43] update warp sign permission check --- Essentials/src/com/earth2me/essentials/signs/SignWarp.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Essentials/src/com/earth2me/essentials/signs/SignWarp.java b/Essentials/src/com/earth2me/essentials/signs/SignWarp.java index 8f470bc6b..eb81ea4e1 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignWarp.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignWarp.java @@ -53,7 +53,7 @@ public class SignWarp extends EssentialsSign if ((!group.isEmpty() && ("§2Everyone".equals(group) || player.inGroup(group))) - || (group.isEmpty() && (!ess.getSettings().getPerWarpPermission() || player.isAuthorized("essentials.warp." + warpName)))) + || (group.isEmpty() && (!ess.getSettings().getPerWarpPermission() || player.isAuthorized("essentials.warps." + warpName)))) { final Trade charge = getTrade(sign, 3, ess); try From bc1c4b2ce5f223611245a72d7be22e128b3b41c8 Mon Sep 17 00:00:00 2001 From: Necrodoom Date: Sat, 29 Sep 2012 15:57:31 +0300 Subject: [PATCH 04/43] update kit sign permission check --- Essentials/src/com/earth2me/essentials/signs/SignKit.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Essentials/src/com/earth2me/essentials/signs/SignKit.java b/Essentials/src/com/earth2me/essentials/signs/SignKit.java index aee1d7dea..1c3528a18 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignKit.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignKit.java @@ -51,7 +51,7 @@ public class SignKit extends EssentialsSign final String kitName = sign.getLine(1).toLowerCase(Locale.ENGLISH).trim(); final String group = sign.getLine(2); if ((!group.isEmpty() && ("§2Everyone".equals(group) || player.inGroup(group))) - || (group.isEmpty() && (player.isAuthorized("essentials.kit." + kitName)))) + || (group.isEmpty() && (player.isAuthorized("essentials.kits." + kitName)))) { final Trade charge = getTrade(sign, 3, ess); charge.isAffordableFor(player); From 4526a4fe52594695cb94aa739a2f434c8a5d0a36 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Sat, 29 Sep 2012 23:33:32 +0100 Subject: [PATCH 05/43] Tidy Teleport file --- .../src/com/earth2me/essentials/Teleport.java | 83 ++++++++++--------- 1 file changed, 42 insertions(+), 41 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/Teleport.java b/Essentials/src/com/earth2me/essentials/Teleport.java index c6106ad24..9ecd2adb9 100644 --- a/Essentials/src/com/earth2me/essentials/Teleport.java +++ b/Essentials/src/com/earth2me/essentials/Teleport.java @@ -44,6 +44,7 @@ public class Teleport implements Runnable, ITeleport } } private IUser user; + private IUser teleportUser; private int teleTimer = -1; private long started; // time this task was initiated private long delay; // how long to delay the teleport @@ -127,22 +128,6 @@ public class Teleport implements Runnable, ITeleport this.ess = ess; } - public void respawn(final Trade chargeFor, TeleportCause cause) throws Exception - { - final Player player = user.getBase(); - final Location bed = player.getBedSpawnLocation(); - final PlayerRespawnEvent pre = new PlayerRespawnEvent(player, bed == null ? player.getWorld().getSpawnLocation() : bed, bed != null); - ess.getServer().getPluginManager().callEvent(pre); - teleport(new Target(pre.getRespawnLocation()), chargeFor, cause); - } - - public void warp(String warp, Trade chargeFor, TeleportCause cause) throws Exception - { - Location loc = ess.getWarps().getWarp(warp); - teleport(new Target(loc), chargeFor, cause); - user.sendMessage(_("warpingTo", warp)); - } - public void cooldown(boolean check) throws Exception { final Calendar time = new GregorianCalendar(); @@ -181,6 +166,7 @@ public class Teleport implements Runnable, ITeleport } } + //If we need to cancel a pending teleport call this method public void cancel(boolean notifyUser) { if (teleTimer == -1) @@ -201,16 +187,7 @@ public class Teleport implements Runnable, ITeleport } } - public void cancel() - { - cancel(false); - } - - public void teleport(Location loc, Trade chargeFor) throws Exception - { - teleport(new Target(loc), chargeFor, TeleportCause.PLUGIN); - } - + //The teleport function is used when you want to normally teleport someone to a location or player. public void teleport(Location loc, Trade chargeFor, TeleportCause cause) throws Exception { teleport(new Target(loc), chargeFor, cause); @@ -241,7 +218,7 @@ public class Teleport implements Runnable, ITeleport return; } - cancel(); + cancel(false); Calendar c = new GregorianCalendar(); c.add(Calendar.SECOND, (int)delay); c.add(Calendar.MILLISECOND, (int)((delay * 1000.0) % 1000.0)); @@ -251,13 +228,7 @@ public class Teleport implements Runnable, ITeleport teleTimer = ess.scheduleSyncRepeatingTask(this, 10, 10); } - private void now(Target target, TeleportCause cause) throws Exception - { - cancel(); - user.setLastLocation(); - user.getBase().teleport(Util.getSafeDestination(target.getLocation()), cause); - } - + //The now function is used when you want to skip tp delay when teleporting someone to a location or player. public void now(Location loc, boolean cooldown, TeleportCause cause) throws Exception { if (cooldown) @@ -267,13 +238,6 @@ public class Teleport implements Runnable, ITeleport now(new Target(loc), cause); } - public void now(Location loc, Trade chargeFor, TeleportCause cause) throws Exception - { - cooldown(false); - chargeFor.charge(user); - now(new Target(loc), cause); - } - public void now(Player entity, boolean cooldown, TeleportCause cause) throws Exception { if (cooldown) @@ -283,16 +247,53 @@ public class Teleport implements Runnable, ITeleport now(new Target(entity), cause); } + private void now(Target target, TeleportCause cause) throws Exception + { + cancel(false); + user.setLastLocation(); + user.getBase().teleport(Util.getSafeDestination(target.getLocation()), cause); + } + + public void now(Player entity, boolean cooldown, TeleportCause cause) throws Exception + { + if (cooldown) + { + cooldown(false); + } + now(new Target(entity), cause); + } + + //The respawn function is a wrapper used to handle tp fallback, on /jail and /home + public void respawn(final Trade chargeFor, TeleportCause cause) throws Exception + { + final Player player = user.getBase(); + final Location bed = player.getBedSpawnLocation(); + final PlayerRespawnEvent pre = new PlayerRespawnEvent(player, bed == null ? player.getWorld().getSpawnLocation() : bed, bed != null); + ess.getServer().getPluginManager().callEvent(pre); + teleport(new Target(pre.getRespawnLocation()), chargeFor, cause); + } + + //The warp function is a wrapper used to teleport a player to a /warp + public void warp(String warp, Trade chargeFor, TeleportCause cause) throws Exception + { + Location loc = ess.getWarps().getWarp(warp); + teleport(new Target(loc), chargeFor, cause); + user.sendMessage(_("warpingTo", warp)); + } + + //The back function is a wrapper used to teleport a player /back to their previous location. public void back(Trade chargeFor) throws Exception { teleport(new Target(user.getLastLocation()), chargeFor, TeleportCause.COMMAND); } + //This function is used to throw a user back after a jail sentence public void back() throws Exception { now(new Target(user.getLastLocation()), TeleportCause.COMMAND); } + //This function handles teleporting to /home public void home(Location loc, Trade chargeFor) throws Exception { teleport(new Target(loc), chargeFor, TeleportCause.COMMAND); From b8b4966e00752133cc32d9eed69cc3f50f33e256 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Sat, 29 Sep 2012 23:34:46 +0100 Subject: [PATCH 06/43] Properly handle tphere requests so the right user is in control/charged. --- .../src/com/earth2me/essentials/Teleport.java | 77 +++++++++++++++---- .../essentials/commands/Commandtpaccept.java | 2 +- .../essentials/commands/Commandtphere.java | 2 +- 3 files changed, 63 insertions(+), 18 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/Teleport.java b/Essentials/src/com/earth2me/essentials/Teleport.java index 9ecd2adb9..2f1028243 100644 --- a/Essentials/src/com/earth2me/essentials/Teleport.java +++ b/Essentials/src/com/earth2me/essentials/Teleport.java @@ -37,7 +37,7 @@ public class Teleport implements Runnable, ITeleport { if (this.name != null) { - + return ess.getServer().getPlayerExact(name).getLocation(); } return location; @@ -62,13 +62,19 @@ public class Teleport implements Runnable, ITeleport private TeleportCause cause; private void initTimer(long delay, Target target, Trade chargeFor, TeleportCause cause) + { + initTimer(delay, user, target, chargeFor, cause); + } + + private void initTimer(long delay, IUser teleportUser, Target target, Trade chargeFor, TeleportCause cause) { this.started = System.currentTimeMillis(); this.delay = delay; - this.health = user.getHealth(); - this.initX = Math.round(user.getLocation().getX() * MOVE_CONSTANT); - this.initY = Math.round(user.getLocation().getY() * MOVE_CONSTANT); - this.initZ = Math.round(user.getLocation().getZ() * MOVE_CONSTANT); + this.health = teleportUser.getHealth(); + this.initX = Math.round(teleportUser.getLocation().getX() * MOVE_CONSTANT); + this.initY = Math.round(teleportUser.getLocation().getY() * MOVE_CONSTANT); + this.initZ = Math.round(teleportUser.getLocation().getZ() * MOVE_CONSTANT); + this.teleportUser = teleportUser; this.teleportTarget = target; this.chargeFor = chargeFor; this.cause = cause; @@ -80,19 +86,25 @@ public class Teleport implements Runnable, ITeleport if (user == null || !user.isOnline() || user.getLocation() == null) { - cancel(); + cancel(false); return; } - if (Math.round(user.getLocation().getX() * MOVE_CONSTANT) != initX - || Math.round(user.getLocation().getY() * MOVE_CONSTANT) != initY - || Math.round(user.getLocation().getZ() * MOVE_CONSTANT) != initZ - || user.getHealth() < health) + if (teleportUser == null || !teleportUser.isOnline() || teleportUser.getLocation() == null) + { + cancel(false); + return; + } + + if (Math.round(teleportUser.getLocation().getX() * MOVE_CONSTANT) != initX + || Math.round(teleportUser.getLocation().getY() * MOVE_CONSTANT) != initY + || Math.round(teleportUser.getLocation().getZ() * MOVE_CONSTANT) != initZ + || teleportUser.getHealth() < health) { // user moved, cancel teleport cancel(true); return; } - health = user.getHealth(); // in case user healed, then later gets injured + health = teleportUser.getHealth(); // in case user healed, then later gets injured long now = System.currentTimeMillis(); if (now > started + delay) @@ -100,11 +112,12 @@ public class Teleport implements Runnable, ITeleport try { cooldown(false); - user.sendMessage(_("teleportationCommencing")); + teleportUser.sendMessage(_("teleportationCommencing")); try { - now(teleportTarget, cause); + teleportUser.getTeleport().now(teleportTarget, cause); + cancel(false); if (chargeFor != null) { chargeFor.charge(user); @@ -118,6 +131,10 @@ public class Teleport implements Runnable, ITeleport catch (Exception ex) { user.sendMessage(_("cooldownWithMessage", ex.getMessage())); + if (user != teleportUser) + { + teleportUser.sendMessage(_("cooldownWithMessage", ex.getMessage())); + } } } } @@ -179,6 +196,10 @@ public class Teleport implements Runnable, ITeleport if (notifyUser) { user.sendMessage(_("pendingTeleportCancelled")); + if (teleportUser != user) + { + teleportUser.sendMessage(_("pendingTeleportCancelled")); + } } } finally @@ -254,13 +275,37 @@ public class Teleport implements Runnable, ITeleport user.getBase().teleport(Util.getSafeDestination(target.getLocation()), cause); } - public void now(Player entity, boolean cooldown, TeleportCause cause) throws Exception + //The teleportToMe function is a wrapper used to handle teleporting players to them, like /tphere + public void teleportToMe(User otherUser, Trade chargeFor, TeleportCause cause) throws Exception { - if (cooldown) + Target target = new Target(user); + + double delay = ess.getSettings().getTeleportDelay(); + + if (chargeFor != null) + { + chargeFor.isAffordableFor(user); + } + cooldown(true); + if (delay <= 0 || user.isAuthorized("essentials.teleport.timer.bypass")) { cooldown(false); + otherUser.getTeleport().now(target, cause); + if (chargeFor != null) + { + chargeFor.charge(user); + } + return; } - now(new Target(entity), cause); + + cancel(false); + Calendar c = new GregorianCalendar(); + c.add(Calendar.SECOND, (int)delay); + c.add(Calendar.MILLISECOND, (int)((delay * 1000.0) % 1000.0)); + otherUser.sendMessage(_("dontMoveMessage", Util.formatDateDiff(c.getTimeInMillis()))); + initTimer((long)(delay * 1000.0), otherUser, target, chargeFor, cause); + + teleTimer = ess.scheduleSyncRepeatingTask(this, 10, 10); } //The respawn function is a wrapper used to handle tp fallback, on /jail and /home diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java index 3f52e8e01..865492921 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java @@ -65,7 +65,7 @@ public class Commandtpaccept extends EssentialsCommand if (user.isTpRequestHere()) { - user.getTeleport().teleport(target, charge, TeleportCause.COMMAND); + target.getTeleport().teleportToMe(user, charge, TeleportCause.COMMAND); } else { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtphere.java b/Essentials/src/com/earth2me/essentials/commands/Commandtphere.java index 641290575..76041ca6c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtphere.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtphere.java @@ -27,7 +27,7 @@ public class Commandtphere extends EssentialsCommand { throw new Exception(_("noPerm", "essentials.worlds." + user.getWorld().getName())); } - player.getTeleport().teleport(user, new Trade(this.getName(), ess), TeleportCause.COMMAND); + user.getTeleport().teleportToMe(player, new Trade(this.getName(), ess), TeleportCause.COMMAND); user.sendMessage(_("teleporting")); player.sendMessage(_("teleporting")); throw new NoChargeException(); From 23d99dd9778c0ba8f228fb37b04693e06aa43403 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Sat, 29 Sep 2012 23:41:12 +0100 Subject: [PATCH 07/43] Little bit DRYer --- .../src/com/earth2me/essentials/Teleport.java | 69 ++++++++++--------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/Teleport.java b/Essentials/src/com/earth2me/essentials/Teleport.java index 2f1028243..17dbca0f2 100644 --- a/Essentials/src/com/earth2me/essentials/Teleport.java +++ b/Essentials/src/com/earth2me/essentials/Teleport.java @@ -207,6 +207,32 @@ public class Teleport implements Runnable, ITeleport teleTimer = -1; } } + + //The now function is used when you want to skip tp delay when teleporting someone to a location or player. + public void now(Location loc, boolean cooldown, TeleportCause cause) throws Exception + { + if (cooldown) + { + cooldown(false); + } + now(new Target(loc), cause); + } + + public void now(Player entity, boolean cooldown, TeleportCause cause) throws Exception + { + if (cooldown) + { + cooldown(false); + } + now(new Target(entity), cause); + } + + private void now(Target target, TeleportCause cause) throws Exception + { + cancel(false); + user.setLastLocation(); + user.getBase().teleport(Util.getSafeDestination(target.getLocation()), cause); + } //The teleport function is used when you want to normally teleport someone to a location or player. public void teleport(Location loc, Trade chargeFor, TeleportCause cause) throws Exception @@ -240,41 +266,12 @@ public class Teleport implements Runnable, ITeleport } cancel(false); - Calendar c = new GregorianCalendar(); - c.add(Calendar.SECOND, (int)delay); - c.add(Calendar.MILLISECOND, (int)((delay * 1000.0) % 1000.0)); - user.sendMessage(_("dontMoveMessage", Util.formatDateDiff(c.getTimeInMillis()))); + warnUser(user); initTimer((long)(delay * 1000.0), target, chargeFor, cause); teleTimer = ess.scheduleSyncRepeatingTask(this, 10, 10); } - //The now function is used when you want to skip tp delay when teleporting someone to a location or player. - public void now(Location loc, boolean cooldown, TeleportCause cause) throws Exception - { - if (cooldown) - { - cooldown(false); - } - now(new Target(loc), cause); - } - - public void now(Player entity, boolean cooldown, TeleportCause cause) throws Exception - { - if (cooldown) - { - cooldown(false); - } - now(new Target(entity), cause); - } - - private void now(Target target, TeleportCause cause) throws Exception - { - cancel(false); - user.setLastLocation(); - user.getBase().teleport(Util.getSafeDestination(target.getLocation()), cause); - } - //The teleportToMe function is a wrapper used to handle teleporting players to them, like /tphere public void teleportToMe(User otherUser, Trade chargeFor, TeleportCause cause) throws Exception { @@ -299,14 +296,18 @@ public class Teleport implements Runnable, ITeleport } cancel(false); - Calendar c = new GregorianCalendar(); - c.add(Calendar.SECOND, (int)delay); - c.add(Calendar.MILLISECOND, (int)((delay * 1000.0) % 1000.0)); - otherUser.sendMessage(_("dontMoveMessage", Util.formatDateDiff(c.getTimeInMillis()))); + warnUser(otherUser); initTimer((long)(delay * 1000.0), otherUser, target, chargeFor, cause); teleTimer = ess.scheduleSyncRepeatingTask(this, 10, 10); } + + private void warnUser(final IUser user) { + Calendar c = new GregorianCalendar(); + c.add(Calendar.SECOND, (int)delay); + c.add(Calendar.MILLISECOND, (int)((delay * 1000.0) % 1000.0)); + user.sendMessage(_("dontMoveMessage", Util.formatDateDiff(c.getTimeInMillis()))); + } //The respawn function is a wrapper used to handle tp fallback, on /jail and /home public void respawn(final Trade chargeFor, TeleportCause cause) throws Exception From eed0eddffc5ec140a7ff487e65f617a2346f7859 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Sat, 29 Sep 2012 23:48:59 +0100 Subject: [PATCH 08/43] New permission: essentials.teleport.timer.move - allow players to move during tp delay --- .../src/com/earth2me/essentials/Teleport.java | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/Teleport.java b/Essentials/src/com/earth2me/essentials/Teleport.java index 17dbca0f2..a03a4b74b 100644 --- a/Essentials/src/com/earth2me/essentials/Teleport.java +++ b/Essentials/src/com/earth2me/essentials/Teleport.java @@ -95,17 +95,17 @@ public class Teleport implements Runnable, ITeleport return; } - if (Math.round(teleportUser.getLocation().getX() * MOVE_CONSTANT) != initX - || Math.round(teleportUser.getLocation().getY() * MOVE_CONSTANT) != initY - || Math.round(teleportUser.getLocation().getZ() * MOVE_CONSTANT) != initZ - || teleportUser.getHealth() < health) - { // user moved, cancel teleport + if (!user.isAuthorized("essentials.teleport.timer.move") + && (Math.round(teleportUser.getLocation().getX() * MOVE_CONSTANT) != initX + || Math.round(teleportUser.getLocation().getY() * MOVE_CONSTANT) != initY + || Math.round(teleportUser.getLocation().getZ() * MOVE_CONSTANT) != initZ + || teleportUser.getHealth() < health)) + { + // user moved, cancel teleport cancel(true); return; } - health = teleportUser.getHealth(); // in case user healed, then later gets injured - long now = System.currentTimeMillis(); if (now > started + delay) { @@ -207,7 +207,7 @@ public class Teleport implements Runnable, ITeleport teleTimer = -1; } } - + //The now function is used when you want to skip tp delay when teleporting someone to a location or player. public void now(Location loc, boolean cooldown, TeleportCause cause) throws Exception { @@ -301,8 +301,9 @@ public class Teleport implements Runnable, ITeleport teleTimer = ess.scheduleSyncRepeatingTask(this, 10, 10); } - - private void warnUser(final IUser user) { + + private void warnUser(final IUser user) + { Calendar c = new GregorianCalendar(); c.add(Calendar.SECOND, (int)delay); c.add(Calendar.MILLISECOND, (int)((delay * 1000.0) % 1000.0)); From 3a95bb27ddf5a2a5460e0498e8bb2ee07114c1bf Mon Sep 17 00:00:00 2001 From: Necrodoom Date: Sun, 30 Sep 2012 19:22:14 +0300 Subject: [PATCH 09/43] small fixes to items.csv --- Essentials/src/items.csv | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Essentials/src/items.csv b/Essentials/src/items.csv index d8c60cb36..b3d6d97a9 100644 --- a/Essentials/src/items.csv +++ b/Essentials/src/items.csv @@ -1329,7 +1329,6 @@ burningfurnace,62,0 bfurnace,62,0 signpost,63,0 spost,63,0 -door,64,0 woodendoorhalf,64,0 wooddoorhalf,64,0 wdoorhalf,64,0 @@ -1588,6 +1587,7 @@ tdoor,96,0 doort,96,0 trapd,96,0 dtrap,96,0 +monsteregg,97,0 silverfish,97,0 monstereggsmoothstone,97,0 monstereggsstone,97,0 @@ -3397,6 +3397,7 @@ sign,323,0 woodendoor,324,0 wooddoor,324,0 wdoor,324,0 +door,324,0 bucket,325,0 bukkit,325,0 waterbucket,326,0 From 128b48adeeb72be476844394c5e238f3946c93ba Mon Sep 17 00:00:00 2001 From: KHobbits Date: Sun, 30 Sep 2012 18:12:36 +0100 Subject: [PATCH 10/43] Restore removed tp method, it is used in other plugins. --- Essentials/src/com/earth2me/essentials/Teleport.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Essentials/src/com/earth2me/essentials/Teleport.java b/Essentials/src/com/earth2me/essentials/Teleport.java index a03a4b74b..6a666a199 100644 --- a/Essentials/src/com/earth2me/essentials/Teleport.java +++ b/Essentials/src/com/earth2me/essentials/Teleport.java @@ -235,6 +235,13 @@ public class Teleport implements Runnable, ITeleport } //The teleport function is used when you want to normally teleport someone to a location or player. + //This method is nolonger used internally and will be removed. + @Deprecated + public void teleport(Location loc, Trade chargeFor) throws Exception + { + teleport(loc, chargeFor, TeleportCause.PLUGIN); + } + public void teleport(Location loc, Trade chargeFor, TeleportCause cause) throws Exception { teleport(new Target(loc), chargeFor, cause); From 8855d2525a61d5ad286cac16fd0b1552f7b96acf Mon Sep 17 00:00:00 2001 From: Chris Ward Date: Mon, 1 Oct 2012 20:12:13 +1000 Subject: [PATCH 11/43] Typo (Ticket 2933) --- Essentials/src/messages_de.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties index 7beb49169..205c6f134 100644 --- a/Essentials/src/messages_de.properties +++ b/Essentials/src/messages_de.properties @@ -230,7 +230,7 @@ nickChanged=Nickname ge\u00e4ndert. nickDisplayName=\u00a77Du musst \u00a7fchange-displayname\u00a7c in der Essentials-Config aktivieren. nickInUse=\u00a7cDieser Name wird bereits verwendet. nickNamesAlpha=\u00a7cNicknamen d\u00fcrfen nur alphanumerische Zeichen enthalten. -nickNoMore=\u00a7Du hast keinen Nicknamen mehr. +nickNoMore=\u00a7cDu hast keinen Nicknamen mehr. nickOthersPermission=\u00a7cDu hast keine Rechte um den Nicknamen von anderen zu \u00e4ndern. nickSet=\u00a77Dein Nickname ist nun \u00a7c{0} noAccessCommand=\u00a7cDu hast keinen Zugriff auf diesen Befehl. From f4b45f5ca06d877ce7a0ae7bc02f28f2da786354 Mon Sep 17 00:00:00 2001 From: Chris Ward Date: Mon, 1 Oct 2012 21:20:17 +1000 Subject: [PATCH 12/43] Fixing bad file names in Windows (Fixes #2924) --- Essentials/src/com/earth2me/essentials/Util.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Essentials/src/com/earth2me/essentials/Util.java b/Essentials/src/com/earth2me/essentials/Util.java index c1f7cd014..72c1accef 100644 --- a/Essentials/src/com/earth2me/essentials/Util.java +++ b/Essentials/src/com/earth2me/essentials/Util.java @@ -26,7 +26,9 @@ public class Util public static String sanitizeFileName(final String name) { - final String newName = INVALIDFILECHARS.matcher(name.toLowerCase(Locale.ENGLISH)).replaceAll("_"); + String newName = INVALIDFILECHARS.matcher(name.toLowerCase(Locale.ENGLISH)).replaceAll("_"); + if(Pattern.compile("^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(\\.(.+))?$", Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE | Pattern.COMMENTS).matcher(newName).matches()) + newName = "_" + newName; return newName; } From a8575bddef2fbcada9303435594b6e510f6cdcd3 Mon Sep 17 00:00:00 2001 From: Chris Ward Date: Tue, 2 Oct 2012 01:57:29 +1000 Subject: [PATCH 13/43] Adding console overrides to exempts --- .../src/com/earth2me/essentials/commands/Commandban.java | 2 +- .../src/com/earth2me/essentials/commands/Commandsudo.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandban.java b/Essentials/src/com/earth2me/essentials/commands/Commandban.java index 5f70df273..cf6ea53df 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandban.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandban.java @@ -44,7 +44,7 @@ public class Commandban extends EssentialsCommand } else { - if (user.isAuthorized("essentials.ban.exempt")) + if (user.isAuthorized("essentials.ban.exempt") && sender instanceof Player) { sender.sendMessage(_("banExempt")); return; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java b/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java index 1d974121b..89cfe2438 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java @@ -7,6 +7,7 @@ import java.util.logging.Logger; import org.bukkit.Server; import org.bukkit.command.CommandSender; import org.bukkit.command.PluginCommand; +import org.bukkit.entity.Player; public class Commandsudo extends EssentialsCommand @@ -33,7 +34,7 @@ public class Commandsudo extends EssentialsCommand System.arraycopy(args, 2, arguments, 0, args.length - 2); } - if (user.isAuthorized("essentials.sudo.exempt")) + if (user.isAuthorized("essentials.sudo.exempt") && sender instanceof Player) { throw new Exception(_("sudoExempt")); } From 6aad42e35eb0a51975fd00d1e9c5f922f06dae20 Mon Sep 17 00:00:00 2001 From: Chris Ward Date: Tue, 2 Oct 2012 02:11:05 +1000 Subject: [PATCH 14/43] Fixing storage of compiled regex --- 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 72c1accef..34e5c6420 100644 --- a/Essentials/src/com/earth2me/essentials/Util.java +++ b/Essentials/src/com/earth2me/essentials/Util.java @@ -23,11 +23,12 @@ public class Util private final static Logger logger = Logger.getLogger("Minecraft"); private final static Pattern INVALIDFILECHARS = Pattern.compile("[^a-z0-9]"); private final static Pattern INVALIDCHARS = Pattern.compile("[^\t\n\r\u0020-\u007E\u0085\u00A0-\uD7FF\uE000-\uFFFC]"); + private final static Pattern BADFILENAMES = Pattern.compile("^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(\\.(.+))?$", Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE | Pattern.COMMENTS); public static String sanitizeFileName(final String name) { String newName = INVALIDFILECHARS.matcher(name.toLowerCase(Locale.ENGLISH)).replaceAll("_"); - if(Pattern.compile("^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(\\.(.+))?$", Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE | Pattern.COMMENTS).matcher(newName).matches()) + if(BADFILENAMES.matcher(newName).matches()) newName = "_" + newName; return newName; } From eaa92b8c8327b1398be9b9b320fc27d755ace57d Mon Sep 17 00:00:00 2001 From: Chris Ward Date: Tue, 2 Oct 2012 02:31:15 +1000 Subject: [PATCH 15/43] Adding -c switch to sudo to fake chat --- .../com/earth2me/essentials/commands/Commandsudo.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java b/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java index 1d974121b..da4981ee0 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java @@ -26,6 +26,15 @@ public class Commandsudo extends EssentialsCommand } final User user = getPlayer(server, args, 0, false); + if(args[1].equalsIgnoreCase("say")) + { + if (user.isAuthorized("essentials.sudo.exempt")) + { + throw new Exception(_("sudoExempt")); + } + user.chat(getFinalArg(args, 2)); + return; + } final String command = args[1]; final String[] arguments = new String[args.length - 2]; if (arguments.length > 0) From 7fcc1da2833206375b7cd9e8975ef44acbf1a35a Mon Sep 17 00:00:00 2001 From: Chris Ward Date: Tue, 2 Oct 2012 02:32:52 +1000 Subject: [PATCH 16/43] Blocking numeric home names, changing invalid home message --- .../com/earth2me/essentials/commands/Commandsethome.java | 7 +++++-- Essentials/src/messages.properties | 1 + Essentials/src/messages_cs.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_fi.properties | 1 + Essentials/src/messages_fr.properties | 1 + Essentials/src/messages_it.properties | 1 + Essentials/src/messages_nl.properties | 1 + Essentials/src/messages_pl.properties | 1 + Essentials/src/messages_pt.properties | 1 + Essentials/src/messages_se.properties | 1 + 14 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java b/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java index 7ec1ba11d..c97761f8d 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java @@ -2,7 +2,9 @@ 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 java.util.regex.Pattern; import org.bukkit.Location; import org.bukkit.Server; @@ -55,9 +57,10 @@ public class Commandsethome extends EssentialsCommand { name = "home"; } - if ("bed".equals(name)) + if ("bed".equals(name) || Util.isInt(name)) { - throw new NotEnoughArgumentsException(); + user.sendMessage(_("invalidHomeName")); + throw new NoChargeException(); } usersHome.setHome(name, location); user.sendMessage(_("homeSet", user.getLocation().getWorld().getName(), user.getLocation().getBlockX(), user.getLocation().getBlockY(), user.getLocation().getBlockZ())); diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index 37b8f0945..4852f2bef 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -457,3 +457,4 @@ uptime=\u00a76Uptime:\u00a7c {0} antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities +invalidHomeName=\u00a74Invalid home name diff --git a/Essentials/src/messages_cs.properties b/Essentials/src/messages_cs.properties index c0bb5a3d0..26e039001 100644 --- a/Essentials/src/messages_cs.properties +++ b/Essentials/src/messages_cs.properties @@ -460,3 +460,4 @@ uptime=\u00a76Uptime:\u00a7c {0} antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities +invalidHomeName=\u00a74Invalid home name diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties index e1245de43..9419ad45e 100644 --- a/Essentials/src/messages_da.properties +++ b/Essentials/src/messages_da.properties @@ -457,3 +457,4 @@ uptime=\u00a76Uptime:\u00a7c {0} antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities +invalidHomeName=\u00a74Invalid home name diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties index 205c6f134..90e373b33 100644 --- a/Essentials/src/messages_de.properties +++ b/Essentials/src/messages_de.properties @@ -457,3 +457,4 @@ uptime=\u00a76Uptime:\u00a7c {0} antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities +invalidHomeName=\u00a74Invalid home name diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties index 37b8f0945..4852f2bef 100644 --- a/Essentials/src/messages_en.properties +++ b/Essentials/src/messages_en.properties @@ -457,3 +457,4 @@ uptime=\u00a76Uptime:\u00a7c {0} antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities +invalidHomeName=\u00a74Invalid home name diff --git a/Essentials/src/messages_es.properties b/Essentials/src/messages_es.properties index 78738532d..b3b098d91 100644 --- a/Essentials/src/messages_es.properties +++ b/Essentials/src/messages_es.properties @@ -457,3 +457,4 @@ uptime=\u00a76Uptime:\u00a7c {0} antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities +invalidHomeName=\u00a74Invalid home name diff --git a/Essentials/src/messages_fi.properties b/Essentials/src/messages_fi.properties index 97bf0ae36..8dd5343ad 100644 --- a/Essentials/src/messages_fi.properties +++ b/Essentials/src/messages_fi.properties @@ -457,3 +457,4 @@ uptime=\u00a76Uptime:\u00a7c {0} antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities +invalidHomeName=\u00a74Invalid home name diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties index 242616fbb..7468952a6 100644 --- a/Essentials/src/messages_fr.properties +++ b/Essentials/src/messages_fr.properties @@ -457,3 +457,4 @@ uptime=\u00a76Uptime:\u00a7c {0} antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities +invalidHomeName=\u00a74Invalid home name diff --git a/Essentials/src/messages_it.properties b/Essentials/src/messages_it.properties index 042ee1412..91e2e8f27 100644 --- a/Essentials/src/messages_it.properties +++ b/Essentials/src/messages_it.properties @@ -457,3 +457,4 @@ uptime=\u00a76Uptime:\u00a7c {0} antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities +invalidHomeName=\u00a74Invalid home name diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties index 0e8849f34..62be530f1 100644 --- a/Essentials/src/messages_nl.properties +++ b/Essentials/src/messages_nl.properties @@ -457,3 +457,4 @@ uptime=\u00a76Uptime:\u00a7c {0} antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities +invalidHomeName=\u00a74Invalid home name diff --git a/Essentials/src/messages_pl.properties b/Essentials/src/messages_pl.properties index d6dccc753..1a1e73d65 100644 --- a/Essentials/src/messages_pl.properties +++ b/Essentials/src/messages_pl.properties @@ -457,3 +457,4 @@ uptime=\u00a76Uptime:\u00a7c {0} antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities +invalidHomeName=\u00a74Invalid home name diff --git a/Essentials/src/messages_pt.properties b/Essentials/src/messages_pt.properties index 9ee14ed91..11a2c1df0 100644 --- a/Essentials/src/messages_pt.properties +++ b/Essentials/src/messages_pt.properties @@ -457,3 +457,4 @@ uptime=\u00a76Uptime:\u00a7c {0} antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities +invalidHomeName=\u00a74Invalid home name diff --git a/Essentials/src/messages_se.properties b/Essentials/src/messages_se.properties index 4701d34c2..c7685d6f4 100644 --- a/Essentials/src/messages_se.properties +++ b/Essentials/src/messages_se.properties @@ -457,3 +457,4 @@ uptime=\u00a76Uptime:\u00a7c {0} antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities +invalidHomeName=\u00a74Invalid home name From 38b2687f547195c4c0bdf98323b9a54ad0f99e36 Mon Sep 17 00:00:00 2001 From: ElgarL Date: Mon, 1 Oct 2012 17:49:42 +0100 Subject: [PATCH 17/43] Move Event to LOW so permissions get updated before this event is triggered. With LOWEST it would only randomly work with most perm systems, depending on the loading order. --- .../src/com/earth2me/essentials/EssentialsPlayerListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java index 8718f84a7..8ef218a67 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java @@ -347,7 +347,7 @@ public class EssentialsPlayerListener implements Listener } } - @EventHandler(priority = EventPriority.LOWEST) + @EventHandler(priority = EventPriority.LOW) public void onPlayerChangedWorldHack(final PlayerChangedWorldEvent event) { final Player user = event.getPlayer(); From ccd226f6857cc83f5202b05a0937124afb754c2f Mon Sep 17 00:00:00 2001 From: Chris Ward Date: Tue, 2 Oct 2012 03:30:13 +1000 Subject: [PATCH 18/43] Adding console override to sudo chat, changing say to c: --- .../src/com/earth2me/essentials/commands/Commandsudo.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java b/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java index d41cf9a51..b2bd5d14b 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java @@ -27,13 +27,13 @@ public class Commandsudo extends EssentialsCommand } final User user = getPlayer(server, args, 0, false); - if(args[1].equalsIgnoreCase("say")) + if(args[1].toLowerCase().startsWith("c:")) { - if (user.isAuthorized("essentials.sudo.exempt")) + if (user.isAuthorized("essentials.sudo.exempt") && sender instanceof Player) { throw new Exception(_("sudoExempt")); } - user.chat(getFinalArg(args, 2)); + user.chat(getFinalArg(args, 1).substring(2)); return; } final String command = args[1]; From 2e115c73a252448804a8037b5c7564d0ef7b0f40 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Mon, 1 Oct 2012 20:28:09 +0100 Subject: [PATCH 19/43] Cleanup sethome --- .../com/earth2me/essentials/commands/Commandsethome.java | 6 ++---- .../com/earth2me/essentials/commands/Commandsetwarp.java | 7 ++++--- Essentials/src/messages.properties | 1 + Essentials/src/messages_cs.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_fi.properties | 1 + Essentials/src/messages_fr.properties | 1 + Essentials/src/messages_it.properties | 1 + Essentials/src/messages_nl.properties | 1 + Essentials/src/messages_pl.properties | 1 + Essentials/src/messages_pt.properties | 1 + Essentials/src/messages_se.properties | 1 + 15 files changed, 19 insertions(+), 7 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java b/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java index c97761f8d..eb151077f 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsethome.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 java.util.regex.Pattern; import org.bukkit.Location; import org.bukkit.Server; @@ -47,7 +46,7 @@ public class Commandsethome extends EssentialsCommand } if (usersHome == null) { - throw new Exception(_("playerNotFound")); + throw new NoSuchFieldException(_("playerNotFound")); } name = args[1].toLowerCase(Locale.ENGLISH); } @@ -59,8 +58,7 @@ public class Commandsethome extends EssentialsCommand } if ("bed".equals(name) || Util.isInt(name)) { - user.sendMessage(_("invalidHomeName")); - throw new NoChargeException(); + throw new NoSuchFieldException(_("invalidHomeName")); } usersHome.setHome(name, location); user.sendMessage(_("homeSet", user.getLocation().getWorld().getName(), user.getLocation().getBlockX(), user.getLocation().getBlockY(), user.getLocation().getBlockZ())); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java b/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java index 42da62b85..ba8c71626 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java @@ -22,9 +22,10 @@ public class Commandsetwarp extends EssentialsCommand { throw new NotEnoughArgumentsException(); } - - if (args[0].matches("[0-9]+")) { - throw new NotEnoughArgumentsException(); + + if (Util.isInt(args[0])) + { + throw new NoSuchFieldException(_("invalidWarpName")); } final Location loc = user.getLocation(); diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index 4852f2bef..e8f36a2bb 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -458,3 +458,4 @@ antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities invalidHomeName=\u00a74Invalid home name +invalidWarpName=\u00a74Invalid warp name diff --git a/Essentials/src/messages_cs.properties b/Essentials/src/messages_cs.properties index 26e039001..e4bd8de7d 100644 --- a/Essentials/src/messages_cs.properties +++ b/Essentials/src/messages_cs.properties @@ -461,3 +461,4 @@ antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities invalidHomeName=\u00a74Invalid home name +invalidWarpName=\u00a74Invalid warp name diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties index 9419ad45e..08ae21450 100644 --- a/Essentials/src/messages_da.properties +++ b/Essentials/src/messages_da.properties @@ -458,3 +458,4 @@ antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities invalidHomeName=\u00a74Invalid home name +invalidWarpName=\u00a74Invalid warp name diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties index 90e373b33..5c00b42d6 100644 --- a/Essentials/src/messages_de.properties +++ b/Essentials/src/messages_de.properties @@ -458,3 +458,4 @@ antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities invalidHomeName=\u00a74Invalid home name +invalidWarpName=\u00a74Invalid warp name diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties index 4852f2bef..e8f36a2bb 100644 --- a/Essentials/src/messages_en.properties +++ b/Essentials/src/messages_en.properties @@ -458,3 +458,4 @@ antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities invalidHomeName=\u00a74Invalid home name +invalidWarpName=\u00a74Invalid warp name diff --git a/Essentials/src/messages_es.properties b/Essentials/src/messages_es.properties index b3b098d91..8f6bc071f 100644 --- a/Essentials/src/messages_es.properties +++ b/Essentials/src/messages_es.properties @@ -458,3 +458,4 @@ antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities invalidHomeName=\u00a74Invalid home name +invalidWarpName=\u00a74Invalid warp name diff --git a/Essentials/src/messages_fi.properties b/Essentials/src/messages_fi.properties index 8dd5343ad..97fcea110 100644 --- a/Essentials/src/messages_fi.properties +++ b/Essentials/src/messages_fi.properties @@ -458,3 +458,4 @@ antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities invalidHomeName=\u00a74Invalid home name +invalidWarpName=\u00a74Invalid warp name diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties index 7468952a6..c6c9662f7 100644 --- a/Essentials/src/messages_fr.properties +++ b/Essentials/src/messages_fr.properties @@ -458,3 +458,4 @@ antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities invalidHomeName=\u00a74Invalid home name +invalidWarpName=\u00a74Invalid warp name diff --git a/Essentials/src/messages_it.properties b/Essentials/src/messages_it.properties index 91e2e8f27..90f3c9fa9 100644 --- a/Essentials/src/messages_it.properties +++ b/Essentials/src/messages_it.properties @@ -458,3 +458,4 @@ antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities invalidHomeName=\u00a74Invalid home name +invalidWarpName=\u00a74Invalid warp name diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties index 62be530f1..94f37f378 100644 --- a/Essentials/src/messages_nl.properties +++ b/Essentials/src/messages_nl.properties @@ -458,3 +458,4 @@ antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities invalidHomeName=\u00a74Invalid home name +invalidWarpName=\u00a74Invalid warp name diff --git a/Essentials/src/messages_pl.properties b/Essentials/src/messages_pl.properties index 1a1e73d65..2c1556d14 100644 --- a/Essentials/src/messages_pl.properties +++ b/Essentials/src/messages_pl.properties @@ -458,3 +458,4 @@ antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities invalidHomeName=\u00a74Invalid home name +invalidWarpName=\u00a74Invalid warp name diff --git a/Essentials/src/messages_pt.properties b/Essentials/src/messages_pt.properties index 11a2c1df0..bcd032383 100644 --- a/Essentials/src/messages_pt.properties +++ b/Essentials/src/messages_pt.properties @@ -458,3 +458,4 @@ antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities invalidHomeName=\u00a74Invalid home name +invalidWarpName=\u00a74Invalid warp name diff --git a/Essentials/src/messages_se.properties b/Essentials/src/messages_se.properties index c7685d6f4..67ee9a25d 100644 --- a/Essentials/src/messages_se.properties +++ b/Essentials/src/messages_se.properties @@ -458,3 +458,4 @@ antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74. antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities invalidHomeName=\u00a74Invalid home name +invalidWarpName=\u00a74Invalid warp name From 9a6616b302eaf37e1adbafa037956f0b9b276576 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Tue, 2 Oct 2012 00:19:42 +0100 Subject: [PATCH 20/43] Better handle invalid warp names --- .../com/earth2me/essentials/EssentialsConf.java | 5 +++++ .../src/com/earth2me/essentials/UserData.java | 4 ++-- Essentials/src/com/earth2me/essentials/Util.java | 14 +++++++++----- Essentials/src/com/earth2me/essentials/Warps.java | 10 +++++++++- .../essentials/commands/Commandsetwarp.java | 2 +- 5 files changed, 26 insertions(+), 9 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/EssentialsConf.java b/Essentials/src/com/earth2me/essentials/EssentialsConf.java index d6414fb05..70e683da4 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsConf.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsConf.java @@ -344,6 +344,11 @@ public class EssentialsConf extends YamlConfiguration } } + public void saveWithError() throws IOException + { + save(configFile); + } + @Override public synchronized void save(final File file) throws IOException { diff --git a/Essentials/src/com/earth2me/essentials/UserData.java b/Essentials/src/com/earth2me/essentials/UserData.java index e9b84e656..76bac71b3 100644 --- a/Essentials/src/com/earth2me/essentials/UserData.java +++ b/Essentials/src/com/earth2me/essentials/UserData.java @@ -161,7 +161,7 @@ public abstract class UserData extends PlayerExtension implements IConf public void setHome(String name, Location loc) { //Invalid names will corrupt the yaml - name = Util.sanitizeFileName(name); + name = Util.safeString(name); homes.put(name, loc); config.setProperty("homes." + name, loc); config.save(); @@ -172,7 +172,7 @@ public abstract class UserData extends PlayerExtension implements IConf String search = getHomeName(name); if (!homes.containsKey(search)) { - search = Util.sanitizeFileName(search); + search = Util.safeString(search); } if (homes.containsKey(search)) { diff --git a/Essentials/src/com/earth2me/essentials/Util.java b/Essentials/src/com/earth2me/essentials/Util.java index 34e5c6420..cdbf3f82c 100644 --- a/Essentials/src/com/earth2me/essentials/Util.java +++ b/Essentials/src/com/earth2me/essentials/Util.java @@ -23,16 +23,20 @@ public class Util private final static Logger logger = Logger.getLogger("Minecraft"); private final static Pattern INVALIDFILECHARS = Pattern.compile("[^a-z0-9]"); private final static Pattern INVALIDCHARS = Pattern.compile("[^\t\n\r\u0020-\u007E\u0085\u00A0-\uD7FF\uE000-\uFFFC]"); - private final static Pattern BADFILENAMES = Pattern.compile("^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(\\.(.+))?$", Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE | Pattern.COMMENTS); + //Used to clean file names before saving to disk public static String sanitizeFileName(final String name) { - String newName = INVALIDFILECHARS.matcher(name.toLowerCase(Locale.ENGLISH)).replaceAll("_"); - if(BADFILENAMES.matcher(newName).matches()) - newName = "_" + newName; - return newName; + return safeString(name); } + //Used to clean strings/names before saving as filenames/permissions + public static String safeString(final String string) + { + return INVALIDFILECHARS.matcher(string.toLowerCase(Locale.ENGLISH)).replaceAll("_"); + } + + //Less restrictive string sanitizing, when not used as perm or filename public static String sanitizeString(final String string) { return INVALIDCHARS.matcher(string).replaceAll(""); diff --git a/Essentials/src/com/earth2me/essentials/Warps.java b/Essentials/src/com/earth2me/essentials/Warps.java index ece987aba..6c3448f4e 100644 --- a/Essentials/src/com/earth2me/essentials/Warps.java +++ b/Essentials/src/com/earth2me/essentials/Warps.java @@ -3,6 +3,7 @@ package com.earth2me.essentials; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.commands.WarpNotFoundException; import java.io.File; +import java.io.IOException; import java.util.*; import java.util.logging.Level; import java.util.logging.Logger; @@ -70,7 +71,14 @@ public class Warps implements IConf } conf.setProperty(null, loc); conf.setProperty("name", name); - conf.save(); + try + { + conf.saveWithError(); + } + catch (IOException ex) + { + throw new IOException(_("invalidWarpName")); + } } public void delWarp(String name) throws Exception diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java b/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java index ba8c71626..2469f6ec1 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java @@ -40,7 +40,7 @@ public class Commandsetwarp extends EssentialsCommand { } - if (warpLoc == null || user.isAuthorized("essentials.warp.overwrite." + Util.sanitizeFileName(args[0]))) + if (warpLoc == null || user.isAuthorized("essentials.warp.overwrite." + Util.safeString(args[0]))) { warps.setWarp(args[0], loc); } From 26bcb84ee328fdf2eb30392451956a802deba229 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Tue, 2 Oct 2012 21:06:28 +0100 Subject: [PATCH 21/43] Fix gamemode other perm check --- .../essentials/commands/Commandgamemode.java | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java b/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java index 85aeaa673..9f38eb5ae 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java @@ -41,18 +41,25 @@ public class Commandgamemode extends EssentialsCommand gamemodeOtherPlayers(server, user, gameMode, args[1]); return; } - else + else { - try { + try + { gameMode = matchGameMode(args[0].toLowerCase(Locale.ENGLISH)); } - catch (NotEnoughArgumentsException e) { - gameMode = matchGameMode(commandLabel); - gamemodeOtherPlayers(server, user, gameMode, args[0]); - return; + catch (NotEnoughArgumentsException e) + { + if (user.isAuthorized("essentials.gamemode.others")) + { + gameMode = matchGameMode(commandLabel); + gamemodeOtherPlayers(server, user, gameMode, args[0]); + return; + } + throw new NotEnoughArgumentsException(); } } - if (gameMode == null) { + if (gameMode == null) + { gameMode = user.getGameMode() == GameMode.SURVIVAL ? GameMode.CREATIVE : user.getGameMode() == GameMode.CREATIVE ? GameMode.ADVENTURE : GameMode.SURVIVAL; } user.setGameMode(gameMode); @@ -104,11 +111,12 @@ public class Commandgamemode extends EssentialsCommand mode = GameMode.ADVENTURE; } else if (modeString.equalsIgnoreCase("gmt") || modeString.equalsIgnoreCase("egmt") - || modeString.contains("toggle") || modeString.contains("cycle") || modeString.equalsIgnoreCase("t")) + || modeString.contains("toggle") || modeString.contains("cycle") || modeString.equalsIgnoreCase("t")) { mode = null; } - else { + else + { throw new NotEnoughArgumentsException(); } return mode; From 97544a755faeb72571e4cbc6edb5937f085c620f Mon Sep 17 00:00:00 2001 From: KHobbits Date: Fri, 5 Oct 2012 02:06:23 +0100 Subject: [PATCH 22/43] Comment for future sanity. --- .../com/earth2me/essentials/signs/SignPlayerListener.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Essentials/src/com/earth2me/essentials/signs/SignPlayerListener.java b/Essentials/src/com/earth2me/essentials/signs/SignPlayerListener.java index 08257c9e4..12296b023 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignPlayerListener.java @@ -21,6 +21,11 @@ public class SignPlayerListener implements Listener this.ess = ess; } + //This following code below listens to cancelled events to fix a bukkit issue + //Right clicking signs with a block in hand, can now fire cancelled events. + //This is because when the block place is cancelled (for example not enough space for the block to be placed), + //the event will be marked as cancelled, thus preventing 30% of sign purchases. + @EventHandler(priority = EventPriority.LOW) public void onPlayerInteract(final PlayerInteractEvent event) { From 914a7b59688bb49eb99f6dc036a3b52278dff209 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Sat, 6 Oct 2012 03:31:34 +0100 Subject: [PATCH 23/43] Code comments --- .../src/com/earth2me/essentials/EssentialsEntityListener.java | 1 + .../src/com/earth2me/essentials/EssentialsPlayerListener.java | 1 + Essentials/src/com/earth2me/essentials/Settings.java | 2 ++ Essentials/src/com/earth2me/essentials/Trade.java | 3 +++ Essentials/src/com/earth2me/essentials/User.java | 1 + .../src/com/earth2me/essentials/commands/Commandantioch.java | 2 +- .../com/earth2me/essentials/commands/Commandessentials.java | 3 ++- .../src/com/earth2me/essentials/commands/Commandjump.java | 2 +- .../com/earth2me/essentials/commands/Commandkittycannon.java | 2 +- .../src/com/earth2me/essentials/commands/Commandping.java | 2 +- .../src/com/earth2me/essentials/signs/SignProtection.java | 2 +- 11 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java index 0077d988c..693bde3ef 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java @@ -27,6 +27,7 @@ public class EssentialsEntityListener implements Listener this.ess = ess; } + // This method does something undocumented reguarding certain bucket types #EasterEgg @EventHandler(priority = EventPriority.LOW) public void onEntityDamage(final EntityDamageByEntityEvent event) { diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java index 8ef218a67..2b5693c8d 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java @@ -414,6 +414,7 @@ public class EssentialsPlayerListener implements Listener } } + // This method allows the /jump lock feature to work, allows teleporting while flying #EasterEgg private void useFlyClickJump(final User user) { try diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java index fff129d52..f05474196 100644 --- a/Essentials/src/com/earth2me/essentials/Settings.java +++ b/Essentials/src/com/earth2me/essentials/Settings.java @@ -928,6 +928,8 @@ public class Settings implements ISettings return maxSpeed > 1.0 ? 1.0 : Math.abs(maxSpeed); } + //This option does not exist in the config.yml because it wasn't yet implemented in bukkit + //The code was commented out in the /speed command @Override public double getMaxWalkSpeed() { diff --git a/Essentials/src/com/earth2me/essentials/Trade.java b/Essentials/src/com/earth2me/essentials/Trade.java index ff37a5d28..420525e63 100644 --- a/Essentials/src/com/earth2me/essentials/Trade.java +++ b/Essentials/src/com/earth2me/essentials/Trade.java @@ -234,6 +234,9 @@ public class Trade public static void log(String type, String subtype, String event, String sender, Trade charge, String receiver, Trade pay, Location loc, IEssentials ess) { + //isEcoLogUpdateEnabled() - This refers to log entries with no location, ie API updates #EasterEgg + //isEcoLogEnabled() - This refers to log entries with with location, ie /pay /sell and eco signs. + if ((loc == null && !ess.getSettings().isEcoLogUpdateEnabled()) || (loc != null && !ess.getSettings().isEcoLogEnabled())) { diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java index 01284d4b8..f74e11f25 100644 --- a/Essentials/src/com/earth2me/essentials/User.java +++ b/Essentials/src/com/earth2me/essentials/User.java @@ -306,6 +306,7 @@ public class User extends UserData implements Comparable, IReplyTo, IUser if (ess.getSettings().addPrefixSuffix()) { + //These two extra toggles are not documented, because they are mostly redundant #EasterEgg if (!ess.getSettings().disablePrefix()) { final String ptext = ess.getPermissionsHandler().getPrefix(base).replace('&', '§'); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandantioch.java b/Essentials/src/com/earth2me/essentials/commands/Commandantioch.java index 968d0012c..79ef1f969 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandantioch.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandantioch.java @@ -6,7 +6,7 @@ import org.bukkit.Location; import org.bukkit.Server; import org.bukkit.entity.TNTPrimed; - +// This command has a in theme message that only shows if you supply a parameter #EasterEgg public class Commandantioch extends EssentialsCommand { public Commandantioch() diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java b/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java index fe33aebd7..8598a31e9 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java @@ -14,7 +14,7 @@ import org.bukkit.command.CommandSender; import org.bukkit.command.ConsoleCommandSender; import org.bukkit.entity.Player; - +// This command has 4 undocumented behaviours #EasterEgg public class Commandessentials extends EssentialsCommand { public Commandessentials() @@ -55,6 +55,7 @@ public class Commandessentials extends EssentialsCommand } } + //If you do not supply an argument this command will list 'overridden' commands. private void run_disabled(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception { sender.sendMessage("Essentials " + ess.getDescription().getVersion()); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandjump.java b/Essentials/src/com/earth2me/essentials/commands/Commandjump.java index ba7182628..073c20dce 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandjump.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandjump.java @@ -8,7 +8,7 @@ import org.bukkit.Location; import org.bukkit.Server; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; - +// This method contains an undocumented sub command #EasterEgg public class Commandjump extends EssentialsCommand { public Commandjump() diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkittycannon.java b/Essentials/src/com/earth2me/essentials/commands/Commandkittycannon.java index 9db608235..a94f09cdb 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkittycannon.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkittycannon.java @@ -7,7 +7,7 @@ import org.bukkit.Location; import org.bukkit.Server; import org.bukkit.entity.Ocelot; - +// This command is not documented on the wiki #EasterEgg public class Commandkittycannon extends EssentialsCommand { private static Random random = new Random(); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandping.java b/Essentials/src/com/earth2me/essentials/commands/Commandping.java index 43aa18d5f..0b1df5bf5 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandping.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandping.java @@ -5,7 +5,7 @@ import com.earth2me.essentials.Util; import org.bukkit.Server; import org.bukkit.command.CommandSender; - +// This command can be used to echo messages to the users screen, mostly useless but also an #EasterEgg public class Commandping extends EssentialsCommand { public Commandping() diff --git a/Essentials/src/com/earth2me/essentials/signs/SignProtection.java b/Essentials/src/com/earth2me/essentials/signs/SignProtection.java index 6fdf056e2..1ea26c859 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignProtection.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignProtection.java @@ -10,7 +10,7 @@ import org.bukkit.block.BlockFace; import org.bukkit.block.Sign; import org.bukkit.inventory.ItemStack; - +@Deprecated // This sign will be removed soon public class SignProtection extends EssentialsSign { private final transient Set protectedBlocks = EnumSet.noneOf(Material.class); From e130bca4c547c6aa7cf8ae36b1cc9c33aa34eed4 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Sat, 6 Oct 2012 22:26:51 +0100 Subject: [PATCH 24/43] Change default action colour to be different to /say --- .gitignore | 4 +++- Essentials/src/messages.properties | 8 ++++---- Essentials/src/messages_en.properties | 8 ++++---- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 524ed1334..9251ca7e6 100644 --- a/.gitignore +++ b/.gitignore @@ -42,4 +42,6 @@ /EssentialsGroupManager/.externalToolBuilders /EssentialsAntiBuild/nbproject/private/ /EssentialsAntiBuild/dist/ -/EssentialsAntiBuild/build/ \ No newline at end of file +/EssentialsAntiBuild/build/ +/jars +/out \ No newline at end of file diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index e8f36a2bb..20c880220 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -2,7 +2,7 @@ # Single quotes have to be doubled: '' # Translations start here # by: -action=\u00a7d* {0} {1} +action=\u00a75* {0} \u00a75{1} addedToAccount=\u00a7a{0} has been added to your account. addedToOthersAccount=\u00a7a{0} added to {1}\u00a7a account. New balance: {2} adventure= adventure @@ -264,7 +264,7 @@ notRecommendedBukkit= \u00a74* ! * Bukkit version is not the recommended build f notSupportedYet=Not supported yet. nothingInHand=\u00a74You have nothing in your hand. now=now -nuke=\u00a7dMay death rain upon them +nuke=\u00a75May death rain upon them numberRequired=A number goes there, silly. onlyDayNight=/time only supports day/night. onlyPlayers=\u00a74Only in-game players can use {0}. @@ -397,8 +397,8 @@ unvanished=\u00a76You are once again visible. unvanishedReload=\u00a74A reload has forced you to become visible. upgradingFilesError=Error while upgrading the files userDoesNotExist=\u00a74The user\u00a7c {0} \u00a74does not exist. -userIsAway=\u00a7d{0} \u00a7dis now AFK -userIsNotAway=\u00a7d{0} \u00a7dis no longer AFK +userIsAway=\u00a75{0} \u00a75is now AFK +userIsNotAway=\u00a75{0} \u00a75is no longer AFK userJailed=\u00a76You have been jailed userUsedPortal={0} used an existing exit portal. userdataMoveBackError=Failed to move userdata/{0}.tmp to userdata/{1} diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties index e8f36a2bb..20c880220 100644 --- a/Essentials/src/messages_en.properties +++ b/Essentials/src/messages_en.properties @@ -2,7 +2,7 @@ # Single quotes have to be doubled: '' # Translations start here # by: -action=\u00a7d* {0} {1} +action=\u00a75* {0} \u00a75{1} addedToAccount=\u00a7a{0} has been added to your account. addedToOthersAccount=\u00a7a{0} added to {1}\u00a7a account. New balance: {2} adventure= adventure @@ -264,7 +264,7 @@ notRecommendedBukkit= \u00a74* ! * Bukkit version is not the recommended build f notSupportedYet=Not supported yet. nothingInHand=\u00a74You have nothing in your hand. now=now -nuke=\u00a7dMay death rain upon them +nuke=\u00a75May death rain upon them numberRequired=A number goes there, silly. onlyDayNight=/time only supports day/night. onlyPlayers=\u00a74Only in-game players can use {0}. @@ -397,8 +397,8 @@ unvanished=\u00a76You are once again visible. unvanishedReload=\u00a74A reload has forced you to become visible. upgradingFilesError=Error while upgrading the files userDoesNotExist=\u00a74The user\u00a7c {0} \u00a74does not exist. -userIsAway=\u00a7d{0} \u00a7dis now AFK -userIsNotAway=\u00a7d{0} \u00a7dis no longer AFK +userIsAway=\u00a75{0} \u00a75is now AFK +userIsNotAway=\u00a75{0} \u00a75is no longer AFK userJailed=\u00a76You have been jailed userUsedPortal={0} used an existing exit portal. userdataMoveBackError=Failed to move userdata/{0}.tmp to userdata/{1} From 532ecab05e96956934cb1477c6d2ce4cfe514390 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Sun, 7 Oct 2012 18:10:50 +0100 Subject: [PATCH 25/43] New permission: essentials.vanish.pvp If you don't have this permission you cannot PVP while vanished. --- .../com/earth2me/essentials/EssentialsEntityListener.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java index 693bde3ef..0c4d7b9e1 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java @@ -54,6 +54,11 @@ public class EssentialsEntityListener implements Listener event.setCancelled(true); } + if (attacker.isHidden() && !attacker.isAuthorized("essentials.vanish.pvp")) + { + event.setCancelled(true); + } + attacker.updateActivity(true); final List commandList = attacker.getPowertool(attacker.getItemInHand()); if (commandList != null && !commandList.isEmpty()) From dc44abbb1d150996d51b5983bdf9e3a6db5f796c Mon Sep 17 00:00:00 2001 From: snowleo Date: Sun, 7 Oct 2012 22:46:15 +0200 Subject: [PATCH 26/43] Prevent massive amount of mails being send. Added new config: mails-per-minute, default 1000 --- .../com/earth2me/essentials/ISettings.java | 2 ++ .../src/com/earth2me/essentials/Settings.java | 12 +++++++++++ .../essentials/commands/Commandmail.java | 21 +++++++++++++++++-- Essentials/src/config.yml | 3 +++ 4 files changed, 36 insertions(+), 2 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/ISettings.java b/Essentials/src/com/earth2me/essentials/ISettings.java index d8c421fde..eac342d9e 100644 --- a/Essentials/src/com/earth2me/essentials/ISettings.java +++ b/Essentials/src/com/earth2me/essentials/ISettings.java @@ -179,4 +179,6 @@ public interface ISettings extends IConf double getMaxFlySpeed(); double getMaxWalkSpeed(); + + public int getMailsPerMinute(); } diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java index f05474196..c0cac8dcf 100644 --- a/Essentials/src/com/earth2me/essentials/Settings.java +++ b/Essentials/src/com/earth2me/essentials/Settings.java @@ -439,6 +439,7 @@ public class Settings implements ISettings chatRadius = _getChatRadius(); commandCosts = _getCommandCosts(); warnOnBuildDisallow = _warnOnBuildDisallow(); + mailsPerMinute = _getMailsPerMinute(); } private List itemSpawnBl = new ArrayList(); @@ -936,4 +937,15 @@ public class Settings implements ISettings double maxSpeed = config.getDouble("max-walk-speed", 0.8); return maxSpeed > 1.0 ? 1.0 : Math.abs(maxSpeed); } + + private int mailsPerMinute; + + private int _getMailsPerMinute() { + return config.getInt("mails-per-minute", 1000); + } + @Override + public int getMailsPerMinute() + { + return mailsPerMinute; + } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmail.java b/Essentials/src/com/earth2me/essentials/commands/Commandmail.java index 60306c272..e2c95afab 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmail.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmail.java @@ -11,6 +11,9 @@ import org.bukkit.entity.Player; public class Commandmail extends EssentialsCommand { + private static int mailsPerMinute = 0; + private static long timestamp = 0; + public Commandmail() { super("mail"); @@ -58,8 +61,22 @@ public class Commandmail extends EssentialsCommand } if (!u.isIgnoredPlayer(user)) { - final String mail = Util.sanitizeString(Util.stripFormat(getFinalArg(args, 2))); - u.addMail(user.getName() + ": " + mail); + final String mail = user.getName() + ": " + Util.sanitizeString(Util.stripFormat(getFinalArg(args, 2))); + if (mail.length() > 1000) + { + throw new Exception("Mail message too long. Try to keep it below 1000"); + } + if (Math.abs(System.currentTimeMillis() - timestamp) > 60000) + { + timestamp = System.currentTimeMillis(); + mailsPerMinute = 0; + } + mailsPerMinute++; + if (mailsPerMinute > ess.getSettings().getMailsPerMinute()) + { + throw new Exception("Too many mails have been send within the last minute. Maximum: " + ess.getSettings().getMailsPerMinute()); + } + u.addMail(mail); } user.sendMessage(_("mailSent")); return; diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml index 9fa0f8c4c..1eedc95dd 100644 --- a/Essentials/src/config.yml +++ b/Essentials/src/config.yml @@ -315,6 +315,9 @@ login-attack-delay: 5 #Set the max fly speed, values range from 0.1 to 1.0 max-fly-speed: 0.8 +#Set the maximum amount of mails that can be send within a minute. +mails-per-minute: 1000 + ############################################################ # +------------------------------------------------------+ # # | EssentialsHome | # From 23b08e223c26021b1aac05e709bd6b61f45252c9 Mon Sep 17 00:00:00 2001 From: snowleo Date: Sun, 7 Oct 2012 23:00:09 +0200 Subject: [PATCH 27/43] Update AntiBuild for NB7.2 --- EssentialsAntiBuild/nbproject/build-impl.xml | 453 ++++++++++++++++-- .../nbproject/genfiles.properties | 4 +- 2 files changed, 402 insertions(+), 55 deletions(-) diff --git a/EssentialsAntiBuild/nbproject/build-impl.xml b/EssentialsAntiBuild/nbproject/build-impl.xml index fd7175255..94e589ef7 100644 --- a/EssentialsAntiBuild/nbproject/build-impl.xml +++ b/EssentialsAntiBuild/nbproject/build-impl.xml @@ -12,9 +12,9 @@ is divided into following sections: - execution - debugging - javadoc - - junit compilation - - junit execution - - junit debugging + - test compilation + - test execution + - test debugging - applet - cleanup @@ -181,6 +181,7 @@ is divided into following sections: + @@ -225,6 +226,27 @@ is divided into following sections: + + + + + + + + + + + + + + + + + + + + + @@ -357,11 +379,52 @@ is divided into following sections: - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -370,32 +433,270 @@ is divided into following sections: - - - - - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + @@ -427,10 +728,13 @@ is divided into following sections: - + Must set JVM to use for profiling in profiler.info.jvm Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + @@ -488,6 +792,7 @@ is divided into following sections: + @@ -504,6 +809,7 @@ is divided into following sections: + @@ -511,6 +817,7 @@ is divided into following sections: + @@ -537,6 +844,9 @@ is divided into following sections: + + + @@ -582,7 +892,7 @@ is divided into following sections: - + - + + + This target only works when run from inside the NetBeans IDE. @@ -813,8 +1127,9 @@ is divided into following sections: - + Must select one file in the IDE or set profile.class + This target only works when run from inside the NetBeans IDE. @@ -822,12 +1137,8 @@ is divided into following sections: - - + + This target only works when run from inside the NetBeans IDE. @@ -839,12 +1150,8 @@ is divided into following sections: - - + + This target only works when run from inside the NetBeans IDE. @@ -866,6 +1173,42 @@ is divided into following sections: + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + Must select some files in the IDE or set test.includes + + + + + Must select one file in the IDE or set run.class + + + + + Must select one file in the IDE or set applet.url + + + @@ -952,14 +1295,14 @@ is divided into following sections: - + Some tests failed; see details above. @@ -972,39 +1315,40 @@ is divided into following sections: Must select some files in the IDE or set test.includes - + Some tests failed; see details above. + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + - + Must select one file in the IDE or set test.class - - - - - - - - - - - - - - - + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + @@ -1076,9 +1420,12 @@ is divided into following sections: - - - + + + + + + diff --git a/EssentialsAntiBuild/nbproject/genfiles.properties b/EssentialsAntiBuild/nbproject/genfiles.properties index 61188645c..ed84f2f67 100644 --- a/EssentialsAntiBuild/nbproject/genfiles.properties +++ b/EssentialsAntiBuild/nbproject/genfiles.properties @@ -4,5 +4,5 @@ build.xml.stylesheet.CRC32=28e38971@1.38.3.45 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. nbproject/build-impl.xml.data.CRC32=ddb4519c -nbproject/build-impl.xml.script.CRC32=cfb9443d -nbproject/build-impl.xml.stylesheet.CRC32=fcddb364@1.50.3.46 +nbproject/build-impl.xml.script.CRC32=00e1454b +nbproject/build-impl.xml.stylesheet.CRC32=6ddba6b6@1.53.1.46 From 110a70ec01bf48d7b4e2167631999e7a98b8da40 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Sun, 7 Oct 2012 22:40:04 +0100 Subject: [PATCH 28/43] Add alt warp perm for others --- .../src/com/earth2me/essentials/commands/Commandbalance.java | 1 + .../src/com/earth2me/essentials/commands/Commandwarp.java | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbalance.java b/Essentials/src/com/earth2me/essentials/commands/Commandbalance.java index 15c3c9088..e4aebd197 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandbalance.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandbalance.java @@ -27,6 +27,7 @@ public class Commandbalance extends EssentialsCommand @Override public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { + //TODO: Remove 'other' perm final double bal = (args.length < 1 || !(user.isAuthorized("essentials.balance.others") || user.isAuthorized("essentials.balance.other")) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java b/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java index 4268ed797..9755d451d 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java @@ -37,8 +37,9 @@ public class Commandwarp extends EssentialsCommand } if (args.length > 0) { + //TODO: Remove 'otherplayers' permission. User otherUser = null; - if (args.length == 2 && user.isAuthorized("essentials.warp.otherplayers")) + if (args.length == 2 && (user.isAuthorized("essentials.warp.otherplayers") || user.isAuthorized("essentials.warp.others"))) { otherUser = ess.getUser(server.getPlayer(args[1])); if (otherUser == null) From b446df78e203d4a305139f21e6df774007049532 Mon Sep 17 00:00:00 2001 From: Iaccidentally Date: Tue, 9 Oct 2012 05:19:27 -0300 Subject: [PATCH 29/43] Update Essentials/src/items.csv quick items.csv fix --- Essentials/src/items.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Essentials/src/items.csv b/Essentials/src/items.csv index a3d6ca91b..86c172111 100644 --- a/Essentials/src/items.csv +++ b/Essentials/src/items.csv @@ -4162,7 +4162,7 @@ healinglevel2pot,373,8229 heallevel2pot,373,8229 healingiipot,373,8229 healiipot,373,8229 -h2potpot,373,8229 +h2pot,373,8229 strengthleveliipotion,373,8233 strongleveliipotion,373,8233 strleveliipotion,373,8233 From 209efb3ac9b9ad9500a469508c16951455536e03 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Sun, 14 Oct 2012 13:01:40 +0100 Subject: [PATCH 30/43] Warn when banning a player who has never connected to the server. --- .../com/earth2me/essentials/commands/Commandban.java | 10 ++++++++-- Essentials/src/messages.properties | 1 + Essentials/src/messages_cs.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_fi.properties | 1 + Essentials/src/messages_fr.properties | 1 + Essentials/src/messages_it.properties | 1 + Essentials/src/messages_nl.properties | 1 + Essentials/src/messages_pl.properties | 1 + Essentials/src/messages_pt.properties | 1 + Essentials/src/messages_se.properties | 1 + 14 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandban.java b/Essentials/src/com/earth2me/essentials/commands/Commandban.java index cf6ea53df..3c31469e3 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandban.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandban.java @@ -20,6 +20,7 @@ public class Commandban extends EssentialsCommand @Override public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception { + boolean nomatch = false; if (args.length < 1) { throw new NotEnoughArgumentsException(); @@ -31,6 +32,7 @@ public class Commandban extends EssentialsCommand } catch (NoSuchFieldException e) { + nomatch = true; user = ess.getUser(new OfflinePlayer(args[0], ess)); } if (!user.isOnline()) @@ -65,13 +67,17 @@ public class Commandban extends EssentialsCommand user.setBanReason(banReason); user.setBanned(true); user.kickPlayer(banReason); - + server.getLogger().log(Level.INFO, _("playerBanned", senderName, user.getName(), banReason)); + + if (nomatch) { + sender.sendMessage(_("userUnknown", user.getName())); + } for (Player onlinePlayer : server.getOnlinePlayers()) { final User player = ess.getUser(onlinePlayer); - if (player.isAuthorized("essentials.ban.notify")) + if (onlinePlayer == sender || player.isAuthorized("essentials.ban.notify")) { onlinePlayer.sendMessage(_("playerBanned", senderName, user.getName(), banReason)); } diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index 20c880220..ea780bb03 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -459,3 +459,4 @@ antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities invalidHomeName=\u00a74Invalid home name invalidWarpName=\u00a74Invalid warp name +userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server. diff --git a/Essentials/src/messages_cs.properties b/Essentials/src/messages_cs.properties index e4bd8de7d..f8eccb7f9 100644 --- a/Essentials/src/messages_cs.properties +++ b/Essentials/src/messages_cs.properties @@ -462,3 +462,4 @@ antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities invalidHomeName=\u00a74Invalid home name invalidWarpName=\u00a74Invalid warp name +userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server. diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties index 08ae21450..06339f3b6 100644 --- a/Essentials/src/messages_da.properties +++ b/Essentials/src/messages_da.properties @@ -459,3 +459,4 @@ antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities invalidHomeName=\u00a74Invalid home name invalidWarpName=\u00a74Invalid warp name +userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server. diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties index 5c00b42d6..487fbf85b 100644 --- a/Essentials/src/messages_de.properties +++ b/Essentials/src/messages_de.properties @@ -459,3 +459,4 @@ antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities invalidHomeName=\u00a74Invalid home name invalidWarpName=\u00a74Invalid warp name +userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server. diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties index 20c880220..ea780bb03 100644 --- a/Essentials/src/messages_en.properties +++ b/Essentials/src/messages_en.properties @@ -459,3 +459,4 @@ antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities invalidHomeName=\u00a74Invalid home name invalidWarpName=\u00a74Invalid warp name +userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server. diff --git a/Essentials/src/messages_es.properties b/Essentials/src/messages_es.properties index 8f6bc071f..60d21d896 100644 --- a/Essentials/src/messages_es.properties +++ b/Essentials/src/messages_es.properties @@ -459,3 +459,4 @@ antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities invalidHomeName=\u00a74Invalid home name invalidWarpName=\u00a74Invalid warp name +userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server. diff --git a/Essentials/src/messages_fi.properties b/Essentials/src/messages_fi.properties index 97fcea110..3ff85ebfb 100644 --- a/Essentials/src/messages_fi.properties +++ b/Essentials/src/messages_fi.properties @@ -459,3 +459,4 @@ antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities invalidHomeName=\u00a74Invalid home name invalidWarpName=\u00a74Invalid warp name +userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server. diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties index c6c9662f7..bf1dfecff 100644 --- a/Essentials/src/messages_fr.properties +++ b/Essentials/src/messages_fr.properties @@ -459,3 +459,4 @@ antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities invalidHomeName=\u00a74Invalid home name invalidWarpName=\u00a74Invalid warp name +userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server. diff --git a/Essentials/src/messages_it.properties b/Essentials/src/messages_it.properties index 90f3c9fa9..5f414f6ee 100644 --- a/Essentials/src/messages_it.properties +++ b/Essentials/src/messages_it.properties @@ -459,3 +459,4 @@ antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities invalidHomeName=\u00a74Invalid home name invalidWarpName=\u00a74Invalid warp name +userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server. diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties index 94f37f378..2b49d17bb 100644 --- a/Essentials/src/messages_nl.properties +++ b/Essentials/src/messages_nl.properties @@ -459,3 +459,4 @@ antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities invalidHomeName=\u00a74Invalid home name invalidWarpName=\u00a74Invalid warp name +userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server. diff --git a/Essentials/src/messages_pl.properties b/Essentials/src/messages_pl.properties index 2c1556d14..24884d9d6 100644 --- a/Essentials/src/messages_pl.properties +++ b/Essentials/src/messages_pl.properties @@ -459,3 +459,4 @@ antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities invalidHomeName=\u00a74Invalid home name invalidWarpName=\u00a74Invalid warp name +userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server. diff --git a/Essentials/src/messages_pt.properties b/Essentials/src/messages_pt.properties index bcd032383..cdb544026 100644 --- a/Essentials/src/messages_pt.properties +++ b/Essentials/src/messages_pt.properties @@ -459,3 +459,4 @@ antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities invalidHomeName=\u00a74Invalid home name invalidWarpName=\u00a74Invalid warp name +userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server. diff --git a/Essentials/src/messages_se.properties b/Essentials/src/messages_se.properties index 67ee9a25d..de1061753 100644 --- a/Essentials/src/messages_se.properties +++ b/Essentials/src/messages_se.properties @@ -459,3 +459,4 @@ antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74. gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities invalidHomeName=\u00a74Invalid home name invalidWarpName=\u00a74Invalid warp name +userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server. From a25be26c12f81ea532de699fe52a760ba94b03c0 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Sun, 14 Oct 2012 13:04:00 +0100 Subject: [PATCH 31/43] Allow kicking of hidden players --- .../essentials/commands/Commandkick.java | 20 ++++++++++++------- .../commands/EssentialsCommand.java | 6 +++--- .../commands/PlayerNotFoundException.java | 11 ++++++++++ 3 files changed, 27 insertions(+), 10 deletions(-) create mode 100644 Essentials/src/com/earth2me/essentials/commands/PlayerNotFoundException.java diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkick.java b/Essentials/src/com/earth2me/essentials/commands/Commandkick.java index 287a3cc62..c05c66ad0 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkick.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkick.java @@ -24,23 +24,29 @@ public class Commandkick extends EssentialsCommand throw new NotEnoughArgumentsException(); } - final User user = getPlayer(server, args, 0); - if (sender instanceof Player && user.isAuthorized("essentials.kick.exempt")) - { - throw new Exception(_("kickExempt")); + final User target = getPlayer(server, args, 0, true); + if (sender instanceof Player) { + User user = ess.getUser(sender); + if (target.isHidden() && !user.isAuthorized("essentials.list.hidden")) { + throw new PlayerNotFoundException(); + } + if (target.isAuthorized("essentials.kick.exempt")) + { + throw new Exception(_("kickExempt")); + } } final String kickReason = args.length > 1 ? getFinalArg(args, 1) : _("kickDefault"); - user.kickPlayer(kickReason); + target.kickPlayer(kickReason); final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME; - server.getLogger().log(Level.INFO, _("playerKicked", senderName, user.getName(), kickReason)); + server.getLogger().log(Level.INFO, _("playerKicked", senderName, target.getName(), kickReason)); for (Player onlinePlayer : server.getOnlinePlayers()) { User player = ess.getUser(onlinePlayer); if (player.isAuthorized("essentials.kick.notify")) { - onlinePlayer.sendMessage(_("playerKicked", senderName, user.getName(), kickReason)); + onlinePlayer.sendMessage(_("playerKicked", senderName, target.getName(), kickReason)); } } } diff --git a/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java b/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java index 6bc0649e9..5287016eb 100644 --- a/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java +++ b/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java @@ -56,14 +56,14 @@ public abstract class EssentialsCommand implements IEssentialsCommand } if (args[pos].isEmpty()) { - throw new NoSuchFieldException(_("playerNotFound")); + throw new PlayerNotFoundException(); } final User user = ess.getUser(args[pos]); if (user != null) { if (!getOffline && (!user.isOnline() || user.isHidden())) { - throw new NoSuchFieldException(_("playerNotFound")); + throw new PlayerNotFoundException(); } return user; } @@ -85,7 +85,7 @@ public abstract class EssentialsCommand implements IEssentialsCommand return userMatch; } } - throw new NoSuchFieldException(_("playerNotFound")); + throw new PlayerNotFoundException(); } @Override diff --git a/Essentials/src/com/earth2me/essentials/commands/PlayerNotFoundException.java b/Essentials/src/com/earth2me/essentials/commands/PlayerNotFoundException.java new file mode 100644 index 000000000..c33e87522 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/commands/PlayerNotFoundException.java @@ -0,0 +1,11 @@ +package com.earth2me.essentials.commands; + +import static com.earth2me.essentials.I18n._; + +public class PlayerNotFoundException extends NoSuchFieldException +{ + public PlayerNotFoundException() + { + super(_("playerNotFound")); + } +} From f237d833604ef7f95cec5ce3d311cbd7f10a2601 Mon Sep 17 00:00:00 2001 From: Necrodoom Date: Sun, 14 Oct 2012 19:40:57 +0300 Subject: [PATCH 32/43] fix sandstone slab aliases --- Essentials/src/items.csv | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Essentials/src/items.csv b/Essentials/src/items.csv index 86c172111..da66c0e5c 100644 --- a/Essentials/src/items.csv +++ b/Essentials/src/items.csv @@ -1163,13 +1163,13 @@ smoothstonehalfblock,44,0 stonehalfblock,44,0 shalfblock,44,0 halfblock,44,0 -sanddstonestep,44,1 +sandstonestep,44,1 sstonestep,44,1 ssstep,44,1 -sanddstoneslab,44,1 +sandstoneslab,44,1 sstoneslab,44,1 ssslab,44,1 -sanddstonehalfblock,44,1 +sandstonehalfblock,44,1 sstonehalfblock,44,1 sshalfblock,44,1 woodenplankstonestep,44,2 @@ -1587,7 +1587,6 @@ tdoor,96,0 doort,96,0 trapd,96,0 dtrap,96,0 -monsteregg,97,0 silverfish,97,0 monsteregg,97,0 monstereggsmoothstone,97,0 From 87edb235b5586eb9719bf4998c0dd367e3228e4c Mon Sep 17 00:00:00 2001 From: snowleo Date: Mon, 15 Oct 2012 20:30:52 +0200 Subject: [PATCH 33/43] Don't call plugin manager in Settings. --- .../earth2me/essentials/EssentialsPluginListener.java | 6 ++++++ Essentials/src/com/earth2me/essentials/ISettings.java | 2 ++ Essentials/src/com/earth2me/essentials/Settings.java | 9 ++++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPluginListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPluginListener.java index 2ec8538ca..56cabf6cb 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPluginListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPluginListener.java @@ -20,6 +20,9 @@ public class EssentialsPluginListener implements Listener, IConf @EventHandler(priority = EventPriority.MONITOR) public void onPluginEnable(final PluginEnableEvent event) { + if (event.getPlugin().getName().equals("EssentialsChat")) { + ess.getSettings().setEssentialsChatActive(true); + } ess.getPermissionsHandler().checkPermissions(); ess.getAlternativeCommandsHandler().addPlugin(event.getPlugin()); if (!ess.getPaymentMethod().hasMethod() && ess.getPaymentMethod().setMethod(ess.getServer().getPluginManager())) @@ -31,6 +34,9 @@ public class EssentialsPluginListener implements Listener, IConf @EventHandler(priority = EventPriority.MONITOR) public void onPluginDisable(final PluginDisableEvent event) { + if (event.getPlugin().getName().equals("EssentialsChat")) { + ess.getSettings().setEssentialsChatActive(false); + } ess.getPermissionsHandler().checkPermissions(); ess.getAlternativeCommandsHandler().removePlugin(event.getPlugin()); // Check to see if the plugin thats being disabled is the one we are using diff --git a/Essentials/src/com/earth2me/essentials/ISettings.java b/Essentials/src/com/earth2me/essentials/ISettings.java index eac342d9e..fb0073c8a 100644 --- a/Essentials/src/com/earth2me/essentials/ISettings.java +++ b/Essentials/src/com/earth2me/essentials/ISettings.java @@ -181,4 +181,6 @@ public interface ISettings extends IConf double getMaxWalkSpeed(); public int getMailsPerMinute(); + + public void setEssentialsChatActive(boolean b); } diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java index c0cac8dcf..ca78aca7b 100644 --- a/Essentials/src/com/earth2me/essentials/Settings.java +++ b/Essentials/src/com/earth2me/essentials/Settings.java @@ -696,6 +696,7 @@ public class Settings implements ISettings } private boolean prefixsuffixconfigured = false; private boolean addprefixsuffix = false; + private boolean essentialsChatActive = false; private boolean _addPrefixSuffix() { @@ -707,10 +708,16 @@ public class Settings implements ISettings return config.hasProperty("add-prefix-suffix"); } + @Override + public void setEssentialsChatActive(boolean essentialsChatActive) + { + this.essentialsChatActive = essentialsChatActive; + } + @Override public boolean addPrefixSuffix() { - return prefixsuffixconfigured ? addprefixsuffix : ess.getServer().getPluginManager().isPluginEnabled("EssentialsChat"); + return prefixsuffixconfigured ? addprefixsuffix : essentialsChatActive; } private boolean disablePrefix = false; From b4e6d550409d8cfe795391dc44738d558c4e3d77 Mon Sep 17 00:00:00 2001 From: ementalo Date: Wed, 17 Oct 2012 13:09:03 +0100 Subject: [PATCH 34/43] CB #2396 B #1566 --- Essentials/src/com/earth2me/essentials/Essentials.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java index e0f5706ca..2419d8209 100644 --- a/Essentials/src/com/earth2me/essentials/Essentials.java +++ b/Essentials/src/com/earth2me/essentials/Essentials.java @@ -65,7 +65,7 @@ import org.yaml.snakeyaml.error.YAMLException; public class Essentials extends JavaPlugin implements IEssentials { - public static final int BUKKIT_VERSION = 2352; + public static final int BUKKIT_VERSION = 2396; private static final Logger LOGGER = Logger.getLogger("Minecraft"); private transient ISettings settings; private final transient TNTExplodeListener tntListener = new TNTExplodeListener(this); From 1269ed4b3596bf565ccee38ec4ebc60cde6c9549 Mon Sep 17 00:00:00 2001 From: ementalo Date: Wed, 17 Oct 2012 13:14:59 +0100 Subject: [PATCH 35/43] Fix test --- .../com/earth2me/essentials/FakeServer.java | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/Essentials/test/com/earth2me/essentials/FakeServer.java b/Essentials/test/com/earth2me/essentials/FakeServer.java index c86068eb8..83301ea28 100644 --- a/Essentials/test/com/earth2me/essentials/FakeServer.java +++ b/Essentials/test/com/earth2me/essentials/FakeServer.java @@ -240,6 +240,42 @@ public class FakeServer implements Server { throw new UnsupportedOperationException("Not supported yet."); } + + @Override + public BukkitTask runTask(Plugin plugin, Runnable r) throws IllegalArgumentException + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public BukkitTask runTaskAsynchronously(Plugin plugin, Runnable r) throws IllegalArgumentException + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public BukkitTask runTaskLater(Plugin plugin, Runnable r, long l) throws IllegalArgumentException + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public BukkitTask runTaskLaterAsynchronously(Plugin plugin, Runnable r, long l) throws IllegalArgumentException + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public BukkitTask runTaskTimer(Plugin plugin, Runnable r, long l, long l1) throws IllegalArgumentException + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public BukkitTask runTaskTimerAsynchronously(Plugin plugin, Runnable r, long l, long l1) throws IllegalArgumentException + { + throw new UnsupportedOperationException("Not supported yet."); + } }; } From eb845cc6dd2e6903e3d8be5bfc14ceccd3cecab8 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Sat, 20 Oct 2012 16:09:54 +0100 Subject: [PATCH 36/43] Remove extra home check. --- Essentials/src/com/earth2me/essentials/commands/Commandhome.java | 1 - 1 file changed, 1 deletion(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java index 546bfc85d..d7046819f 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java @@ -23,7 +23,6 @@ public class Commandhome extends EssentialsCommand public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { final Trade charge = new Trade(this.getName(), ess); - charge.isAffordableFor(user); User player = user; String homeName = ""; String[] nameParts; From 84f8ff055fcbd7eb1040c12f2c747d4e220810ef Mon Sep 17 00:00:00 2001 From: KHobbits Date: Sat, 20 Oct 2012 16:12:28 +0100 Subject: [PATCH 37/43] Block explicit /home bed, unless user has "essentials.home.bed" permission. This does not effect the '/home' command when used with no arguments. In this case, a player will still be sent to the bed home, if they have no Ess home set. --- .../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 d7046819f..8419f05f4 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java @@ -44,7 +44,7 @@ public class Commandhome extends EssentialsCommand } try { - if ("bed".equalsIgnoreCase(homeName)) + if ("bed".equalsIgnoreCase(homeName) && user.isAuthorized("essentials.home.bed")) { final Location bed = player.getBedSpawnLocation(); if (bed != null && bed.getBlock().getType() == Material.BED_BLOCK) From 5d42895173c3985a11c906ca8caa423f652bac4a Mon Sep 17 00:00:00 2001 From: KHobbits Date: Sat, 20 Oct 2012 19:10:51 +0100 Subject: [PATCH 38/43] If the player is still alive, make sure he dies. (/kill) --- .../src/com/earth2me/essentials/commands/Commandkill.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkill.java b/Essentials/src/com/earth2me/essentials/commands/Commandkill.java index a2e58227b..306bfd58e 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkill.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkill.java @@ -21,7 +21,7 @@ public class Commandkill extends EssentialsCommand { throw new NotEnoughArgumentsException(); } - + //TODO: TL this if (args[0].trim().length() < 2) { @@ -38,6 +38,12 @@ public class Commandkill extends EssentialsCommand } matchPlayer.damage(Short.MAX_VALUE); + + if (matchPlayer.getHealth() > 0) + { + matchPlayer.setHealth(0); + } + sender.sendMessage(_("kill", matchPlayer.getDisplayName())); } } From 411a4cc7ee09ae19da93b45cd9cd51c83d98900f Mon Sep 17 00:00:00 2001 From: KHobbits Date: Sat, 20 Oct 2012 19:24:33 +0100 Subject: [PATCH 39/43] Fix perm check in /kill --- .../src/com/earth2me/essentials/commands/Commandkill.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkill.java b/Essentials/src/com/earth2me/essentials/commands/Commandkill.java index 306bfd58e..a83b0d490 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkill.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkill.java @@ -32,7 +32,7 @@ public class Commandkill extends EssentialsCommand { final EntityDamageEvent ede = new EntityDamageEvent(matchPlayer, sender instanceof Player && ((Player)sender).getName().equals(matchPlayer.getName()) ? EntityDamageEvent.DamageCause.SUICIDE : EntityDamageEvent.DamageCause.CUSTOM, Short.MAX_VALUE); server.getPluginManager().callEvent(ede); - if (ede.isCancelled() && !sender.hasPermission("essentials.kill.force")) + if (ede.isCancelled() && sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.kill.force")) { continue; } From 2a227a64001ea6ef56a5a38487a9e5f92de049a0 Mon Sep 17 00:00:00 2001 From: Alexander Schepp Date: Sun, 21 Oct 2012 23:17:08 +0300 Subject: [PATCH 40/43] Fix NPE in UserData on login if no address is available --- Essentials/src/com/earth2me/essentials/UserData.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Essentials/src/com/earth2me/essentials/UserData.java b/Essentials/src/com/earth2me/essentials/UserData.java index 76bac71b3..3de5c1e48 100644 --- a/Essentials/src/com/earth2me/essentials/UserData.java +++ b/Essentials/src/com/earth2me/essentials/UserData.java @@ -635,7 +635,10 @@ public abstract class UserData extends PlayerExtension implements IConf public void setLastLogin(long time) { _setLastLogin(time); - _setLastLoginAddress(base.getAddress().getAddress().getHostAddress()); + if (base.getAddress() != null && base.getAddress().getAddress() != null) + { + _setLastLoginAddress(base.getAddress().getAddress().getHostAddress()); + } config.save(); } private long lastLogout; From 2c52ed361c604a6356f604581bf9864669da39fb Mon Sep 17 00:00:00 2001 From: KHobbits Date: Mon, 22 Oct 2012 12:27:01 +0200 Subject: [PATCH 41/43] Update listener comment --- .../src/com/earth2me/essentials/EssentialsPlayerListener.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java index 2b5693c8d..afbab584a 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java @@ -213,6 +213,7 @@ public class EssentialsPlayerListener implements Listener } } + // Makes the compass item ingame always point to the first essentials home. #EasterEgg private void updateCompass(final User user) { Location loc = user.getHome(user.getLocation()); From c2cfa8a089277897aca37c3114aae6711462cba3 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Mon, 22 Oct 2012 14:55:52 +0200 Subject: [PATCH 42/43] Update EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java --- .../essentials/antibuild/EssentialsAntiBuildListener.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java index d2f46586f..a14036c2e 100644 --- a/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java +++ b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java @@ -36,6 +36,10 @@ public class EssentialsAntiBuildListener implements Listener { if (block == null) { + if (ess.getSettings().isDebug()) + { + ess.getLogger().log(Level.INFO, "AntiBuild permission check failed, invalid block."); + } return false; } return metaPermCheck(user, action, block.getTypeId(), block.getData()); From 2dccfdb53cb6958790dd4c73fab369aa9072d9d1 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Tue, 23 Oct 2012 00:00:55 +0100 Subject: [PATCH 43/43] Fix tp delay message --- .../src/com/earth2me/essentials/Teleport.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/Teleport.java b/Essentials/src/com/earth2me/essentials/Teleport.java index 6a666a199..5eba636d5 100644 --- a/Essentials/src/com/earth2me/essentials/Teleport.java +++ b/Essentials/src/com/earth2me/essentials/Teleport.java @@ -47,7 +47,7 @@ public class Teleport implements Runnable, ITeleport private IUser teleportUser; private int teleTimer = -1; private long started; // time this task was initiated - private long delay; // how long to delay the teleport + private long tpdelay; // how long to delay the teleport private int health; // note that I initially stored a clone of the location for reference, but... // when comparing locations, I got incorrect mismatches (rounding errors, looked like) @@ -69,7 +69,7 @@ public class Teleport implements Runnable, ITeleport private void initTimer(long delay, IUser teleportUser, Target target, Trade chargeFor, TeleportCause cause) { this.started = System.currentTimeMillis(); - this.delay = delay; + this.tpdelay = delay; this.health = teleportUser.getHealth(); this.initX = Math.round(teleportUser.getLocation().getX() * MOVE_CONSTANT); this.initY = Math.round(teleportUser.getLocation().getY() * MOVE_CONSTANT); @@ -107,7 +107,7 @@ public class Teleport implements Runnable, ITeleport } health = teleportUser.getHealth(); // in case user healed, then later gets injured long now = System.currentTimeMillis(); - if (now > started + delay) + if (now > started + tpdelay) { try { @@ -273,7 +273,7 @@ public class Teleport implements Runnable, ITeleport } cancel(false); - warnUser(user); + warnUser(user, delay); initTimer((long)(delay * 1000.0), target, chargeFor, cause); teleTimer = ess.scheduleSyncRepeatingTask(this, 10, 10); @@ -303,13 +303,13 @@ public class Teleport implements Runnable, ITeleport } cancel(false); - warnUser(otherUser); + warnUser(otherUser, delay); initTimer((long)(delay * 1000.0), otherUser, target, chargeFor, cause); teleTimer = ess.scheduleSyncRepeatingTask(this, 10, 10); } - private void warnUser(final IUser user) + private void warnUser(final IUser user, final double delay) { Calendar c = new GregorianCalendar(); c.add(Calendar.SECOND, (int)delay); @@ -331,8 +331,8 @@ public class Teleport implements Runnable, ITeleport public void warp(String warp, Trade chargeFor, TeleportCause cause) throws Exception { Location loc = ess.getWarps().getWarp(warp); - teleport(new Target(loc), chargeFor, cause); user.sendMessage(_("warpingTo", warp)); + teleport(new Target(loc), chargeFor, cause); } //The back function is a wrapper used to teleport a player /back to their previous location.