summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2011-11-15 22:52:42 +0100
committersnowleo <schneeleo@gmail.com>2011-11-15 22:52:42 +0100
commit16be86953ffabe4736e939fde6fe4125f247724f (patch)
treee265fc2e3e631dad4c3697f6b0f2a2dd6344d3f8
parent1f527cdb9e3439a175d01bb80c4eedbc127bcb17 (diff)
parenteda827b244e3cc4cb58513bb6306c154cc3e8d5d (diff)
downloadEssentials-16be86953ffabe4736e939fde6fe4125f247724f.tar
Essentials-16be86953ffabe4736e939fde6fe4125f247724f.tar.gz
Essentials-16be86953ffabe4736e939fde6fe4125f247724f.tar.lz
Essentials-16be86953ffabe4736e939fde6fe4125f247724f.tar.xz
Essentials-16be86953ffabe4736e939fde6fe4125f247724f.zip
Merge branch 'refs/heads/master' into release
-rw-r--r--Essentials/src/com/earth2me/essentials/Essentials.java1
-rw-r--r--Essentials/src/com/earth2me/essentials/Util.java19
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandbigtree.java11
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java21
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtree.java9
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignFree.java7
-rw-r--r--EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java2
-rw-r--r--EssentialsGroupManager/src/globalgroups.yml5
-rw-r--r--EssentialsGroupManager/src/groups.yml8
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java19
10 files changed, 70 insertions, 32 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java
index a571483f6..392321f9f 100644
--- a/Essentials/src/com/earth2me/essentials/Essentials.java
+++ b/Essentials/src/com/earth2me/essentials/Essentials.java
@@ -221,6 +221,7 @@ public class Essentials extends JavaPlugin implements IEssentials
@Override
public void onDisable()
{
+ Economy.setEss(null);
Trade.closeLog();
}
diff --git a/Essentials/src/com/earth2me/essentials/Util.java b/Essentials/src/com/earth2me/essentials/Util.java
index c1b0ed7bf..067c8115f 100644
--- a/Essentials/src/com/earth2me/essentials/Util.java
+++ b/Essentials/src/com/earth2me/essentials/Util.java
@@ -28,6 +28,8 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
public class Util
@@ -221,6 +223,7 @@ public class Util
// The player can stand inside these materials
private static final Set<Integer> AIR_MATERIALS = new HashSet<Integer>();
+ private static final HashSet<Byte> AIR_MATERIALS_TARGET = new HashSet<Byte>();
static {
AIR_MATERIALS.add(Material.AIR.getId());
@@ -256,7 +259,21 @@ public class Util
AIR_MATERIALS.add(Material.MELON_STEM.getId());
AIR_MATERIALS.add(Material.VINE.getId());
//TODO: Add 1.9 materials
-
+
+ for (Integer integer : AIR_MATERIALS)
+ {
+ AIR_MATERIALS_TARGET.add(integer.byteValue());
+ }
+ AIR_MATERIALS_TARGET.add((byte)Material.WATER.getId());
+ AIR_MATERIALS_TARGET.add((byte)Material.STATIONARY_WATER.getId());
+ }
+
+ public static Location getTarget(final LivingEntity entity) throws Exception {
+ final Block block = entity.getTargetBlock(AIR_MATERIALS_TARGET, 300);
+ if (block == null) {
+ throw new Exception("Not targeting a block");
+ }
+ return block.getLocation();
}
public static Location getSafeDestination(final Location loc) throws Exception
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbigtree.java b/Essentials/src/com/earth2me/essentials/commands/Commandbigtree.java
index ded3ffdaf..c6cf83df4 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandbigtree.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandbigtree.java
@@ -1,6 +1,5 @@
package com.earth2me.essentials.commands;
-import com.earth2me.essentials.TargetBlock;
import org.bukkit.Server;
import org.bukkit.TreeType;
import com.earth2me.essentials.User;
@@ -31,14 +30,10 @@ public class Commandbigtree extends EssentialsCommand
{
throw new NotEnoughArgumentsException();
}
-
- final int[] ignore =
- {
- 8, 9
- };
- final Location loc = (new TargetBlock(user, 300, 0.2, ignore)).getTargetBlock().getLocation();
+
+ final Location loc = Util.getTarget(user);
final Location safeLocation = Util.getSafeDestination(loc);
- final boolean success = user.getWorld().generateTree(safeLocation, (TreeType)tree);
+ final boolean success = user.getWorld().generateTree(safeLocation, tree);
if (success)
{
user.sendMessage(Util.i18n("bigTreeSuccess"));
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java
index 043f23172..fd9eeaa84 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java
@@ -1,5 +1,6 @@
package com.earth2me.essentials.commands;
+import com.earth2me.essentials.OfflinePlayer;
import com.earth2me.essentials.Trade;
import org.bukkit.Server;
import com.earth2me.essentials.User;
@@ -14,34 +15,36 @@ public class Commandtpaccept extends EssentialsCommand
}
@Override
- public void run(Server server, User user, String commandLabel, String[] args) throws Exception
+ public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
- User p = user.getTeleportRequest();
- if (p == null)
+ final User target = user.getTeleportRequest();
+ if (target == null
+ || target.getBase() instanceof OfflinePlayer
+ || (user.isTeleportRequestHere() && !target.isAuthorized("essentials.tpahere")))
{
throw new Exception(Util.i18n("noPendingRequest"));
}
- Trade charge = new Trade(this.getName(), ess);
+ final Trade charge = new Trade(this.getName(), ess);
if (user.isTeleportRequestHere())
{
charge.isAffordableFor(user);
}
else
{
- charge.isAffordableFor(p);
+ charge.isAffordableFor(target);
}
user.sendMessage(Util.i18n("requestAccepted"));
- p.sendMessage(Util.format("requestAcceptedFrom", user.getDisplayName()));
-
+ target.sendMessage(Util.format("requestAcceptedFrom", user.getDisplayName()));
+
if (user.isTeleportRequestHere())
{
- user.getTeleport().teleport(p, charge);
+ user.getTeleport().teleport(target, charge);
}
else
{
- p.getTeleport().teleport(user, charge);
+ target.getTeleport().teleport(user, charge);
}
user.requestTeleport(null, false);
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtree.java b/Essentials/src/com/earth2me/essentials/commands/Commandtree.java
index 8013453ab..26bc9a8ee 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtree.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtree.java
@@ -1,13 +1,10 @@
package com.earth2me.essentials.commands;
-import com.earth2me.essentials.TargetBlock;
import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.TreeType;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
-import org.bukkit.Material;
-import org.bukkit.block.Block;
public class Commandtree extends EssentialsCommand
@@ -20,7 +17,7 @@ public class Commandtree extends EssentialsCommand
@Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
- Object tree = new Object();
+ TreeType tree;
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
@@ -46,9 +43,9 @@ public class Commandtree extends EssentialsCommand
{
8, 9
};
- final Location loc = (new TargetBlock(user, 300, 0.2, ignore)).getTargetBlock().getLocation();
+ final Location loc = Util.getTarget(user);
final Location safeLocation = Util.getSafeDestination(loc);
- final boolean success = user.getWorld().generateTree(safeLocation, (TreeType)tree);
+ final boolean success = user.getWorld().generateTree(safeLocation, tree);
if (success)
{
user.sendMessage(Util.i18n("treeSpawned"));
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignFree.java b/Essentials/src/com/earth2me/essentials/signs/SignFree.java
index 8939f4bea..8a7c27fe7 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignFree.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignFree.java
@@ -4,7 +4,9 @@ import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.InventoryWorkaround;
import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
+import com.earth2me.essentials.Util;
import net.minecraft.server.InventoryPlayer;
+import org.bukkit.Material;
import org.bukkit.craftbukkit.inventory.CraftInventoryPlayer;
import org.bukkit.inventory.ItemStack;
@@ -27,6 +29,11 @@ public class SignFree extends EssentialsSign
protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException
{
final ItemStack item = getItemStack(sign.getLine(1), 1, ess);
+ if (item.getType() == Material.AIR)
+ {
+ throw new SignException(Util.format("cantSpawnItem", "Air"));
+ }
+
item.setAmount(item.getType().getMaxStackSize()*9*4);
final CraftInventoryPlayer inv = new CraftInventoryPlayer(new InventoryPlayer(player.getHandle()));
inv.clear();
diff --git a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java
index 5a6553f0e..8926f77e8 100644
--- a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java
+++ b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java
@@ -79,7 +79,7 @@ public class EssentialsGeoIPPlayerListener extends PlayerListener implements ICo
{
u.setGeoLocation(sb.toString());
}
- if (config.getBoolean("show-on-login", true))
+ if (config.getBoolean("show-on-login", true) && !u.isHidden())
{
for (Player player : event.getPlayer().getServer().getOnlinePlayers())
{
diff --git a/EssentialsGroupManager/src/globalgroups.yml b/EssentialsGroupManager/src/globalgroups.yml
index 43c225b6a..9662baf43 100644
--- a/EssentialsGroupManager/src/globalgroups.yml
+++ b/EssentialsGroupManager/src/globalgroups.yml
@@ -142,11 +142,6 @@ groups:
g:bukkit_admin:
permissions:
- - bPermissions.admin
- - bPermissions.demote.admin
- - bPermissions.gui
- - bPermissions.iplock.lock
- - bPermissions.promote.admin
- bukkit.broadcast
- bukkit.broadcast.admin
- bukkit.command
diff --git a/EssentialsGroupManager/src/groups.yml b/EssentialsGroupManager/src/groups.yml
index ac4abeb4a..81fb4f030 100644
--- a/EssentialsGroupManager/src/groups.yml
+++ b/EssentialsGroupManager/src/groups.yml
@@ -1,3 +1,11 @@
+# Group inheritance
+# any inherited groups prefixed with a g: are global groups
+# These groups are defined in the globalgroups.yml
+# and can be inherited in any worlds groups/users.yml.
+#
+# Groups without the g: prefix are groups local to this world
+# and defined in the this groups.yml file.
+
groups:
Default:
default: true
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java
index 8f5fad5cf..e8e01967f 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java
@@ -881,6 +881,7 @@ public class WorldDataHolder {
Map<String, Object> root = new HashMap<String, Object>();
Map<String, Object> groupsMap = new HashMap<String, Object>();
+
root.put("groups", groupsMap);
for (String groupKey : ph.groups.keySet()) {
Group group = ph.groups.get(groupKey);
@@ -910,10 +911,24 @@ public class WorldDataHolder {
opt.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
final Yaml yaml = new Yaml(opt);
try {
- yaml.dump(root, new OutputStreamWriter(new FileOutputStream(groupsFile), "UTF-8"));
+ OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(groupsFile), "UTF-8");
+
+ String newLine = System.getProperty("line.separator");
+
+ out.write("# Group inheritance" + newLine);
+ out.write("# any inherited groups prefixed with a g: are global groups" + newLine);
+ out.write("# These groups are defined in the globalgroups.yml" + newLine);
+ out.write("# and can be inherited in any worlds groups/users.yml." + newLine);
+ out.write("#" + newLine);
+ out.write("# Groups without the g: prefix are groups local to this world" + newLine);
+ out.write("# and defined in the this groups.yml file." + newLine);
+ out.write(newLine);
+
+ yaml.dump(root, out);
} catch (UnsupportedEncodingException ex) {
} catch (FileNotFoundException ex) {
- }
+ } catch (IOException e) {
+ }
}
// Update the LastModified time.