From e815b280cab28f1bcf7b18a3a6e3552696ca0b18 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Tue, 4 Oct 2011 15:56:43 +0100 Subject: [PATCH 1/9] Updating Readme --- README.markdown | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index cfd6629d6..616a76185 100644 --- a/README.markdown +++ b/README.markdown @@ -18,4 +18,6 @@ The default line ending is LF. To build all jars, select the BuildAll project and build that. You'll find all jars inside the dist/lib folder of the BuildAll project. -If you create pull requests, always make them for the master branch. \ No newline at end of file +If you create pull requests, always make them for the master branch. + +The essentials bug tracker can be found at http://www.assembla.com/spaces/essentials/tickets \ No newline at end of file From 5cdce48906a3fbb7dabcd794b31c3b472a0d55b6 Mon Sep 17 00:00:00 2001 From: ElgarL Date: Tue, 4 Oct 2011 15:59:26 +0100 Subject: [PATCH 2/9] Comment config.yml to prevent creation of world4 data files --- EssentialsGroupManager/src/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/EssentialsGroupManager/src/config.yml b/EssentialsGroupManager/src/config.yml index a5bca810e..1c5e3e32d 100644 --- a/EssentialsGroupManager/src/config.yml +++ b/EssentialsGroupManager/src/config.yml @@ -18,5 +18,5 @@ settings: - world_nether - world2 - world3 - world4: - - world5 \ No newline at end of file + # world4: + # - world5 \ No newline at end of file From 0410e8f851ddbad5469ccd248b2946bc542af243 Mon Sep 17 00:00:00 2001 From: ElgarL Date: Tue, 11 Oct 2011 00:34:17 +0100 Subject: [PATCH 3/9] Fixed manudelsub not correctly selecting the group to remove. --- EssentialsGroupManager/src/Changelog.txt | 3 ++- .../src/org/anjocaido/groupmanager/GroupManager.java | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index b8034e19c..37f1e5213 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -35,4 +35,5 @@ v 1.2: - Added event handling to manage new world creation at runtime. - Added the ability to handle unknown worlds at server start. (GM will create the data files for any worlds it finds which are not in the config.yml) - - Fix for Bukkit passing a null To location on a player Portaling \ No newline at end of file + - Fix for Bukkit passing a null To location on a player Portaling + - Fixed manudelsub not correctly selecting the group to remove. \ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java index 0fe8a15d4..34534aa5f 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java @@ -478,6 +478,12 @@ public class GroupManager extends JavaPlugin { } else { auxUser = dataHolder.getUser(args[0]); } + auxGroup = dataHolder.getGroup(args[1]); + if (auxGroup == null) { + sender.sendMessage(ChatColor.RED + "Group not found!"); + return false; + } + //VALIDANDO PERMISSAO if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) { sender.sendMessage(ChatColor.RED + "Can't modify player with same permissions than you, or higher."); From 8d861792294cd8733ce72033901d1fa18a14f748 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Tue, 11 Oct 2011 00:37:03 +0100 Subject: [PATCH 4/9] Changing essentials URL, we should at least give one that works, although bukkitdev would probably be better. --- Essentials/src/plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml index 61a054c45..1240910ce 100644 --- a/Essentials/src/plugin.yml +++ b/Essentials/src/plugin.yml @@ -3,7 +3,7 @@ name: Essentials main: com.earth2me.essentials.Essentials # Note to developers: This next line cannot change, or the automatic versioning system will break. version: TeamCity -website: http://www.earth2me.net:8001/ +website: http://ci.earth2me.net/ description: Provides an essential, core set of commands for Bukkit. authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits] commands: From 8aba67f610a16374d197f5f9212f5f6b152d809e Mon Sep 17 00:00:00 2001 From: ElgarL Date: Tue, 11 Oct 2011 01:03:38 +0100 Subject: [PATCH 5/9] Fixed manudelsub not correctly selecting the group to remove. --- .../com/earth2me/essentials/Essentials.java | 5 - .../essentials/EssentialsPlayerListener.java | 105 +---------- .../com/earth2me/essentials/ISettings.java | 12 -- .../com/earth2me/essentials/NetherPortal.java | 167 ------------------ .../src/com/earth2me/essentials/Settings.java | 40 ----- .../src/com/earth2me/essentials/Teleport.java | 2 +- .../src/com/earth2me/essentials/User.java | 5 +- .../essentials/commands/Commandworld.java | 43 ++--- .../essentials/signs/EssentialsSign.java | 2 +- Essentials/src/config.yml | 6 - .../earth2me/essentials/EssentialsTest.java | 45 ----- EssentialsGroupManager/src/Changelog.txt | 6 +- EssentialsGroupManager/src/plugin.yml | 2 +- 13 files changed, 34 insertions(+), 406 deletions(-) delete mode 100644 Essentials/src/com/earth2me/essentials/NetherPortal.java delete mode 100644 Essentials/test/com/earth2me/essentials/EssentialsTest.java diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java index c98671d94..fe0c3560c 100644 --- a/Essentials/src/com/earth2me/essentials/Essentials.java +++ b/Essentials/src/com/earth2me/essentials/Essentials.java @@ -201,11 +201,6 @@ public class Essentials extends JavaPlugin implements IEssentials pm.registerEvent(Type.PLAYER_TELEPORT, jailPlayerListener, Priority.High, this); pm.registerEvent(Type.PLAYER_JOIN, jailPlayerListener, Priority.High, this); - if (settings.isNetherEnabled() && getServer().getWorlds().size() < 2) - { - getServer().createWorld(settings.getNetherName(), World.Environment.NETHER); - } - pm.registerEvent(Type.ENTITY_EXPLODE, tntListener, Priority.High, this); final EssentialsTimer timer = new EssentialsTimer(this); diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java index ddf0a6806..026e4632b 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java @@ -100,114 +100,11 @@ public class EssentialsPlayerListener extends PlayerListener return; } - Location afk = user.getAfkPosition(); + final Location afk = user.getAfkPosition(); if (afk == null || !event.getTo().getWorld().equals(afk.getWorld()) || afk.distanceSquared(event.getTo()) > 9) { user.updateActivity(true); } - - if (!ess.getSettings().getNetherPortalsEnabled()) - { - return; - } - - final Block block = event.getPlayer().getWorld().getBlockAt(event.getTo().getBlockX(), event.getTo().getBlockY(), event.getTo().getBlockZ()); - final List worlds = server.getWorlds(); - - if (block.getType() == Material.PORTAL && worlds.size() > 1 && user.isAuthorized("essentials.portal")) - { - if (user.getJustPortaled()) - { - return; - } - - World nether = server.getWorld(ess.getSettings().getNetherName()); - if (nether == null) - { - for (World world : worlds) - { - if (world.getEnvironment() == World.Environment.NETHER) - { - nether = world; - break; - } - } - if (nether == null) - { - return; - } - } - final World world = user.getWorld() == nether ? worlds.get(0) : nether; - - double factor; - if (user.getWorld().getEnvironment() == World.Environment.NETHER && world.getEnvironment() == World.Environment.NORMAL) - { - factor = ess.getSettings().getNetherRatio(); - } - else if (user.getWorld().getEnvironment() == World.Environment.NORMAL && world.getEnvironment() == World.Environment.NETHER) - { - factor = 1.0 / ess.getSettings().getNetherRatio(); - } - else - { - factor = 1.0; - } - - Location loc = event.getTo(); - int x = loc.getBlockX(); - int y = loc.getBlockY(); - int z = loc.getBlockZ(); - - if (user.getWorld().getBlockAt(x, y, z - 1).getType() == Material.PORTAL) - { - z--; - } - if (user.getWorld().getBlockAt(x - 1, y, z).getType() == Material.PORTAL) - { - x--; - } - - x = (int)(x * factor); - z = (int)(z * factor); - loc = new Location(world, x + .5, y, z + .5); - - Block dest = world.getBlockAt(x, y, z); - NetherPortal portal = NetherPortal.findPortal(dest); - if (portal == null) - { - if (world.getEnvironment() == World.Environment.NETHER || ess.getSettings().getGenerateExitPortals()) - { - portal = NetherPortal.createPortal(dest); - LOGGER.info(Util.format("userCreatedPortal", event.getPlayer().getName())); - user.sendMessage(Util.i18n("generatingPortal")); - loc = portal.getSpawn(); - } - } - else - { - LOGGER.info(Util.format("userUsedPortal", event.getPlayer().getName())); - user.sendMessage(Util.i18n("usingPortal")); - loc = portal.getSpawn(); - } - - event.setFrom(loc); - event.setTo(loc); - try - { - user.getTeleport().now(loc, new Trade("portal", ess)); - } - catch (Exception ex) - { - user.sendMessage(ex.getMessage()); - } - user.setJustPortaled(true); - user.sendMessage(Util.i18n("teleportingPortal")); - - event.setCancelled(true); - return; - } - - user.setJustPortaled(false); } @Override diff --git a/Essentials/src/com/earth2me/essentials/ISettings.java b/Essentials/src/com/earth2me/essentials/ISettings.java index af95e2cbc..54d1b1495 100644 --- a/Essentials/src/com/earth2me/essentials/ISettings.java +++ b/Essentials/src/com/earth2me/essentials/ISettings.java @@ -35,8 +35,6 @@ public interface ISettings extends IConf int getDefaultStackSize(); - boolean getGenerateExitPortals(); - double getHealCooldown(); Object getKit(String name); @@ -45,12 +43,6 @@ public interface ISettings extends IConf String getLocale(); - String getNetherName(); - - boolean getNetherPortalsEnabled(); - - double getNetherRatio(); - String getNewbieSpawn(); String getNicknamePrefix(); @@ -105,8 +97,6 @@ public interface ISettings extends IConf boolean isEcoDisabled(); - boolean isNetherEnabled(); - boolean isTradeInStacks(int id); List itemSpawnBlacklist(); @@ -117,8 +107,6 @@ public interface ISettings extends IConf boolean spawnIfNoHome(); - boolean use1to1RatioInNether(); - boolean warnOnBuildDisallow(); boolean warnOnSmite(); diff --git a/Essentials/src/com/earth2me/essentials/NetherPortal.java b/Essentials/src/com/earth2me/essentials/NetherPortal.java deleted file mode 100644 index 8c8c9e52f..000000000 --- a/Essentials/src/com/earth2me/essentials/NetherPortal.java +++ /dev/null @@ -1,167 +0,0 @@ -/** - * @author SpaceManiac - * @licent MIT - * @origin https://github.com/SpaceManiac/Nether/blob/master/org/innectis/Nether/NetherPortal.java - */ -package com.earth2me.essentials; - -import org.bukkit.World; -import org.bukkit.block.Block; -import org.bukkit.Location; -import org.bukkit.Material; -import java.util.ArrayList; -import java.util.logging.Level; -import java.util.logging.Logger; - - -public class NetherPortal -{ - private Block block; - - public NetherPortal(Block b) - { - block = b; - } - - public Block getBlock() - { - return block; - } - - public void setBlock(Block b) - { - block = b; - } - - // Return a random spawnable location - public Location getSpawn() - { - if (block.getWorld().getBlockAt(block.getX() + 1, block.getY(), block.getZ()).getType().equals(Material.PORTAL) - || block.getWorld().getBlockAt(block.getX() - 1, block.getY(), block.getZ()).getType().equals(Material.PORTAL)) - { - // portal is in X direction - return new Location(block.getWorld(), block.getX() + 1, - block.getY(), block.getZ() + 1 - 2 * Math.round(Math.random())); - } - else - { - // portal is in Z direction - return new Location(block.getWorld(), block.getX() + 1 - 2 * Math.round(Math.random()), - block.getY(), block.getZ() + 1); - } - } - - // ============================== - // Find a nearby portal within 16 blocks of the given block - // Not guaranteed to be the nearest - public static NetherPortal findPortal(Block dest) - { - World world = dest.getWorld(); - - // Get list of columns in a circle around the block - ArrayList columns = new ArrayList(); - for (int x = dest.getX() - 16; x <= dest.getX() + 16; ++x) - { - for (int z = dest.getZ() - 16; z <= dest.getZ() + 16; ++z) - { - int dx = dest.getX() - x, dz = dest.getZ() - z; - if (dx * dx + dz * dz <= 256) - { - columns.add(world.getBlockAt(x, 0, z)); - } - } - } - - // For each column try to find a portal block - for (Block col : columns) - { - for (int y = 127; y >= 0; --y) - { - Block b = world.getBlockAt(col.getX(), y, col.getZ()); - if (b.getType().equals(Material.PORTAL) && Math.abs(dest.getY() - y) <= 16) - { - // Huzzah! - return new NetherPortal(b); - } - } - } - - // Nope! - return null; - } - - // Create a new portal at the specified block, fudging position if needed - // Will occasionally end up making portals in bad places, but let's hope not - public static NetherPortal createPortal(Block dest) - { - World world = dest.getWorld(); - - // Try not to spawn within water or lava - Material m = dest.getType(); - while (((m.equals(Material.LAVA) || m.equals(Material.WATER) || m.equals(Material.STATIONARY_LAVA) - || m.equals(Material.STATIONARY_WATER) || m.equals(Material.SAND) || m.equals(Material.GRAVEL))) && - dest.getY() < 120) - { - dest = world.getBlockAt(dest.getX(), dest.getY() + 4, dest.getZ()); - m = dest.getType(); - } - - // Not too high or too low overall - if (dest.getY() > 120) - { - dest = world.getBlockAt(dest.getX(), 120, dest.getZ()); - } - else if (dest.getY() < 8) - { - dest = world.getBlockAt(dest.getX(), 8, dest.getZ()); - } - - // Create the physical portal - // For now, don't worry about direction - - int x = dest.getX(), y = dest.getY(), z = dest.getZ(); - Logger.getLogger("Minecraft").log(Level.INFO, Util.format("creatingPortal", x, y, z)); - - // Clear area around portal - ArrayList columns = new ArrayList(); - for (int x2 = x - 4; x2 <= x + 4; ++x2) - { - for (int z2 = z - 4; z2 <= z + 4; ++z2) - { - double dx = x + 0.5f - x2, dz = z - z2; - if (dx * dx + dz * dz <= 13) - { - columns.add(world.getBlockAt(x2, 0, z2)); - } - } - } - - // Clear area around portal - for (Block col : columns) - { - // Stone platform - world.getBlockAt(col.getX(), y - 1, col.getZ()).setType(Material.STONE); - for (int yd = 0; yd < 4; ++yd) - { - world.getBlockAt(col.getX(), y + yd, col.getZ()).setType(Material.AIR); - } - } - - // Build obsidian frame - for (int xd = -1; xd < 3; ++xd) - { - for (int yd = -1; yd < 4; ++yd) - { - if (xd == -1 || yd == -1 || xd == 2 || yd == 3) - { - world.getBlockAt(x + xd, y + yd, z).setType(Material.OBSIDIAN); - } - } - } - - // Set it alight! - dest.setType(Material.FIRE); - - return new NetherPortal(dest); - } -} diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java index 3c06fb300..d6a649786 100644 --- a/Essentials/src/com/earth2me/essentials/Settings.java +++ b/Essentials/src/com/earth2me/essentials/Settings.java @@ -95,12 +95,6 @@ public class Settings implements ISettings return config.getInt("starting-balance", 0); } - @Override - public boolean getNetherPortalsEnabled() - { - return isNetherEnabled() && config.getBoolean("nether.portals-enabled", false); - } - @Override public boolean isCommandDisabled(final IEssentialsCommand cmd) { @@ -257,18 +251,6 @@ public class Settings implements ISettings return config.getBoolean("reclaim-onlogout", true); } - @Override - public String getNetherName() - { - return config.getString("nether.folder", "nether"); - } - - @Override - public boolean isNetherEnabled() - { - return config.getBoolean("nether.enabled", false); - } - @Override public int getSpawnMobLimit() { @@ -318,12 +300,6 @@ public class Settings implements ISettings config.getString("chat.format", "&7[{GROUP}]&f {DISPLAYNAME}&7:&f {MESSAGE}")); } - @Override - public boolean getGenerateExitPortals() - { - return config.getBoolean("nether.generate-exit-portals", true); - } - @Override public boolean getAnnounceNewPlayers() { @@ -403,22 +379,6 @@ public class Settings implements ISettings return config.getBoolean("protect.disable.warn-on-build-disallow", false); } - @Override - public boolean use1to1RatioInNether() - { - return config.getBoolean("nether.use-1to1-ratio", false); - } - - @Override - public double getNetherRatio() - { - if (config.getBoolean("nether.use-1to1-ratio", false)) - { - return 1.0; - } - return config.getDouble("nether.ratio", 8.0); - } - @Override public boolean isDebug() { diff --git a/Essentials/src/com/earth2me/essentials/Teleport.java b/Essentials/src/com/earth2me/essentials/Teleport.java index 608663561..845f9c3a3 100644 --- a/Essentials/src/com/earth2me/essentials/Teleport.java +++ b/Essentials/src/com/earth2me/essentials/Teleport.java @@ -256,7 +256,7 @@ public class Teleport implements Runnable public void back() throws Exception { - back(null); + now(new Target(user.getLastLocation())); } public void home(IUser user, String home, Trade chargeFor) throws Exception diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java index fe811e50f..3e335a1df 100644 --- a/Essentials/src/com/earth2me/essentials/User.java +++ b/Essentials/src/com/earth2me/essentials/User.java @@ -286,7 +286,10 @@ public class User extends UserData implements Comparable, IReplyTo, IUser public void setDisplayNick(String name) { setDisplayName(name); - setPlayerListName(name); + //TODO: Maybe we need to limit nick length, or try use a string trim. + if (name.length() <= 16) { + setPlayerListName(name); + } } public Teleport getTeleport() diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandworld.java b/Essentials/src/com/earth2me/essentials/commands/Commandworld.java index 77db8e5e3..557f46dbf 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandworld.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandworld.java @@ -17,26 +17,28 @@ public class Commandworld extends EssentialsCommand } @Override - protected void run(Server server, User user, String commandLabel, String[] args) throws Exception + protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { World world; - List worlds = server.getWorlds(); if (args.length < 1) { - World nether = server.getWorld(ess.getSettings().getNetherName()); - if (nether == null) { - for (World world2 : worlds) + World nether = null; + + final List worlds = server.getWorlds(); + + for (World world2 : worlds) + { + if (world2.getEnvironment() == World.Environment.NETHER) { - if (world2.getEnvironment() == World.Environment.NETHER) { - nether = world2; - break; - } - } - if (nether == null) { - return; + nether = world2; + break; } } + if (nether == null) + { + return; + } world = user.getWorld() == nether ? worlds.get(0) : nether; } else @@ -54,23 +56,22 @@ public class Commandworld extends EssentialsCommand double factor; if (user.getWorld().getEnvironment() == World.Environment.NETHER && world.getEnvironment() == World.Environment.NORMAL) { - factor = ess.getSettings().getNetherRatio(); + factor = 8.0; } - else if (user.getWorld().getEnvironment() != world.getEnvironment()) + else if (user.getWorld().getEnvironment() == World.Environment.NORMAL && world.getEnvironment() == World.Environment.NETHER) { - factor = 1.0 / ess.getSettings().getNetherRatio(); + factor = 1.0 / 8.0; } - else - { + else { factor = 1.0; } - Location loc = user.getLocation(); - loc = new Location(world, loc.getBlockX() * factor + .5, loc.getBlockY(), loc.getBlockZ() * factor + .5); + final Location loc = user.getLocation(); + final Location target = new Location(world, loc.getBlockX() * factor + .5, loc.getBlockY(), loc.getBlockZ() * factor + .5); - Trade charge = new Trade(this.getName(), ess); + final Trade charge = new Trade(this.getName(), ess); charge.isAffordableFor(user); - user.getTeleport().teleport(loc, charge); + user.getTeleport().teleport(target, charge); throw new NoChargeException(); } } diff --git a/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java b/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java index 026fb0557..b9d224cec 100644 --- a/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java +++ b/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java @@ -223,7 +223,7 @@ public class EssentialsSign if (signblock.getType() == Material.WALL_SIGN) { final org.bukkit.material.Sign signMat = (org.bukkit.material.Sign)signblock.getState().getData(); - if (signMat.getFacing() == blockFace && isValidSign(new BlockSign(signblock))) + if (signMat != null && signMat.getFacing() == blockFace && isValidSign(new BlockSign(signblock))) { return true; } diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml index 7b1525d40..61cb7aefa 100644 --- a/Essentials/src/config.yml +++ b/Essentials/src/config.yml @@ -79,12 +79,6 @@ reclaim-onlogout: false # Should primitive spawn protection be enabled? For most servers, this should be flase; it is better to use a third-party plugin to protect it. spawn-protection: false -# Nether settings -# Sets wether you want to change the default behaviour of the nether portals. -nether: - portals-enabled: false - generate-exit-portals: false - # Mob limit on spawnmob spawnmob-limit: 10 diff --git a/Essentials/test/com/earth2me/essentials/EssentialsTest.java b/Essentials/test/com/earth2me/essentials/EssentialsTest.java deleted file mode 100644 index 26c5c68e9..000000000 --- a/Essentials/test/com/earth2me/essentials/EssentialsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.earth2me.essentials; - -import junit.framework.TestCase; - - -public class EssentialsTest extends TestCase -{ - public EssentialsTest(String testName) - { - super(testName); - } - - private static void should(String what) - { - System.out.println("Essentials should " + what); - } - - public void testLoadClasses() - { - should("make all classes accessible"); - try - { - ItemDb itemDb = null; - Mob mob = null; - NetherPortal netherPortal = null; - OfflinePlayer offlinePlayer = null; - Settings settings = null; - Spawn spawn = null; - TargetBlock targetBlock = null; - User user = null; - assertNull(itemDb); - assertNull(mob); - assertNull(netherPortal); - assertNull(offlinePlayer); - assertNull(settings); - assertNull(spawn); - assertNull(targetBlock); - assertNull(user); - } - catch (Throwable ex) - { - fail(ex.toString()); - } - } -} diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index 37f1e5213..256d88420 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -25,6 +25,7 @@ v 1.1: v 1.2: - Changed priority of Registered events to lowest. - Fixed an issue with superperms where plugins define perms with inheritance after the root perms +v 1.3: - Rewrote Config loading to use Bukkits Configuration features - Added an opOverride setting in config. If present and set to false, op's will not get overriding permissions in GroupManager. @@ -34,6 +35,7 @@ v 1.2: - Attempt to stop GM wiping groups/users yml's on a bad shut down. - Added event handling to manage new world creation at runtime. - Added the ability to handle unknown worlds at server start. - (GM will create the data files for any worlds it finds which are not in the config.yml) + (GM will create the data files for any worlds it finds which are not in the config.yml) - Fix for Bukkit passing a null To location on a player Portaling - - Fixed manudelsub not correctly selecting the group to remove. \ No newline at end of file + - Fixed manudelsub not correctly selecting the group to remove. + diff --git a/EssentialsGroupManager/src/plugin.yml b/EssentialsGroupManager/src/plugin.yml index b0d2bc4d1..a247c7ad0 100644 --- a/EssentialsGroupManager/src/plugin.yml +++ b/EssentialsGroupManager/src/plugin.yml @@ -1,5 +1,5 @@ name: GroupManager -version: "1.2 (Phoenix)" +version: "1.3 (Phoenix)" main: org.anjocaido.groupmanager.GroupManager website: http://www.anjocaido.info/ description: Provides on-the-fly system for permissions system created by Nijikokun. But all in memory, and with flat-file saving schedule. From 8448ab3e962f5559224977cf0fcb3dd95fb5deea Mon Sep 17 00:00:00 2001 From: ElgarL Date: Tue, 11 Oct 2011 01:07:52 +0100 Subject: [PATCH 6/9] Removed null supression in GroupManager.java --- .../src/org/anjocaido/groupmanager/GroupManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java index 34534aa5f..49cee6001 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java @@ -236,7 +236,7 @@ public class GroupManager extends JavaPlugin { * @param cmd * @param args */ - @SuppressWarnings({"null", "deprecation"}) + @SuppressWarnings({"deprecation"}) @Override public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { boolean playerCanDo = false; From 717a7143928f8379d39cbe797822582e1f75ddae Mon Sep 17 00:00:00 2001 From: snowleo Date: Tue, 11 Oct 2011 12:29:14 +0200 Subject: [PATCH 7/9] CB#1317 B#941 From 7a03eeca1b539ed636f2bea8c44c88ecc05d40df Mon Sep 17 00:00:00 2001 From: snowleo Date: Tue, 11 Oct 2011 12:48:44 +0200 Subject: [PATCH 8/9] Changes for new Bukkit --- .../earth2me/essentials/OfflinePlayer.java | 19 +++++++++++++++++++ .../earth2me/essentials/PlayerWrapper.java | 18 ++++++++++++++++++ .../anjocaido/groupmanager/GroupManager.java | 4 ++-- .../dataholder/worlds/WorldsHolder.java | 2 +- 4 files changed, 40 insertions(+), 3 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java index 1b0058f24..3ca0c17f4 100644 --- a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java +++ b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java @@ -3,6 +3,7 @@ package com.earth2me.essentials; import java.net.InetSocketAddress; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; import java.util.UUID; import org.bukkit.Achievement; @@ -725,4 +726,22 @@ public class OfflinePlayer implements Player { throw new UnsupportedOperationException("Not supported yet."); } + + @Override + public int getTicksLived() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTicksLived(int i) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Map serialize() + { + throw new UnsupportedOperationException("Not supported yet."); + } } diff --git a/Essentials/src/com/earth2me/essentials/PlayerWrapper.java b/Essentials/src/com/earth2me/essentials/PlayerWrapper.java index 4b998af47..ccb61d891 100644 --- a/Essentials/src/com/earth2me/essentials/PlayerWrapper.java +++ b/Essentials/src/com/earth2me/essentials/PlayerWrapper.java @@ -755,5 +755,23 @@ public class PlayerWrapper implements Player { return base.getPlayerListName(); } + + @Override + public int getTicksLived() + { + return base.getTicksLived(); + } + + @Override + public void setTicksLived(int i) + { + base.setTicksLived(i); + } + + @Override + public Map serialize() + { + return base.serialize(); + } } diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java index 0fe8a15d4..23cd1e9b5 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java @@ -159,7 +159,7 @@ public class GroupManager extends JavaPlugin { } }; scheduler = new ScheduledThreadPoolExecutor(1); - int minutes = getConfig().getSaveInterval(); + int minutes = getGMConfig().getSaveInterval(); scheduler.scheduleAtFixedRate(commiter, minutes, minutes, TimeUnit.MINUTES); GroupManager.logger.info("Scheduled Data Saving is set for every " + minutes + " minutes!"); } @@ -1749,7 +1749,7 @@ public class GroupManager extends JavaPlugin { /** * @return the config */ - public GMConfiguration getConfig() { + public GMConfiguration getGMConfig() { return config; } diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java index 50e6ef547..0bcf9a827 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java @@ -111,7 +111,7 @@ public class WorldsHolder { @SuppressWarnings("rawtypes") public void mirrorSetUp() { mirrors.clear(); - Map mirrorsMap = plugin.getConfig().getMirrorsMap(); + Map mirrorsMap = plugin.getGMConfig().getMirrorsMap(); if (mirrorsMap != null) { for (String source : mirrorsMap.keySet()) { // Make sure all non mirrored worlds have a set of data files. From 01a9f491b9083baa8098e78e2dfc9fae6fc2c86a Mon Sep 17 00:00:00 2001 From: ElgarL Date: Tue, 11 Oct 2011 13:10:29 +0100 Subject: [PATCH 9/9] Added two new permission nodes - groupmanager.notify.self & groupmanager.notify.other These allow players/admins to be notified when players are moved between groups. --- EssentialsGroupManager/src/Changelog.txt | 2 ++ EssentialsGroupManager/src/groups.yml | 2 ++ .../anjocaido/groupmanager/GroupManager.java | 26 +++++++++++++++++++ .../org/anjocaido/groupmanager/data/User.java | 5 +++- 4 files changed, 34 insertions(+), 1 deletion(-) diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index e8eebbdc7..fe33a9f15 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -38,3 +38,5 @@ v 1.3: (GM will create the data files for any worlds it finds which are not in the config.yml) - Fix for Bukkit passing a null To location on a player Portaling - Fixed manudelsub not correctly selecting the group to remove. + - Added two new permission nodes - groupmanager.notify.self & groupmanager.notify.other + These allow players/admins to be notified when players are moved between groups. \ No newline at end of file diff --git a/EssentialsGroupManager/src/groups.yml b/EssentialsGroupManager/src/groups.yml index 371c169dd..32954d22f 100644 --- a/EssentialsGroupManager/src/groups.yml +++ b/EssentialsGroupManager/src/groups.yml @@ -8,6 +8,7 @@ groups: - essentials.motd - essentials.rules - essentials.spawn + - groupmanager.notify.self inheritance: [] info: prefix: '&e' @@ -119,6 +120,7 @@ groups: - groupmanager.manuadd - groupmanager.manudel - groupmanager.manwhois + - groupmanager.notify.other inheritance: - builder info: diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java index cf8075377..ac822908f 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java @@ -28,6 +28,7 @@ import org.anjocaido.groupmanager.events.GMWorldListener; import org.anjocaido.groupmanager.utils.GMLoggerHandler; import org.anjocaido.groupmanager.utils.PermissionCheckResult; import org.anjocaido.groupmanager.utils.Tasks; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; @@ -1751,6 +1752,31 @@ public class GroupManager extends JavaPlugin { return false; } + + /** + * Send confirmation of a group change. + * using permission nodes... + * + * groupmanager.notify.self + * groupmanager.notify.other + * + * @param name + * @param msg + */ + public static void notify(String name, String msg) { + + Player player = Bukkit.getServer().getPlayerExact(name); + + for(Player test: Bukkit.getServer().getOnlinePlayers()) { + if (!test.equals(player)){ + if (test.hasPermission("groupmanager.notify.other")) + test.sendMessage(ChatColor.YELLOW + name +" was " + msg); + } else + if ((player != null) && ((player.hasPermission("groupmanager.notify.self")) || (player.hasPermission("groupmanager.notify.other")))) + player.sendMessage(ChatColor.YELLOW + "You we're " + msg); + } + + } /** * @return the config diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java index 46dbb3ddc..a95018fa9 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java @@ -119,9 +119,12 @@ public class User extends DataUnit implements Cloneable { group = getDataSource().getGroup(group.getName()); this.group = group.getName(); flagAsChanged(); - if (GroupManager.isLoaded()) + if (GroupManager.isLoaded()) { if (GroupManager.BukkitPermissions.player_join = false) GroupManager.BukkitPermissions.updateAllPlayers(); + + GroupManager.notify(this.getName(), String.format(" moved to the group %s.", group.getName())); + } } public void addSubGroup(Group subGroup) {