[Version 0.7.6.5]

- Resolve issue with buttons on glass gates falling off
 - /sg reload can now be used ingame (stargate.admin.reload permission)
This commit is contained in:
Steven Scott 2012-03-31 10:49:58 -07:00
parent 9b81b6191b
commit cfd059d24c
3 changed files with 30 additions and 6 deletions

4
README
View File

@ -49,6 +49,7 @@ stargate.free -- Allow free use/creation/destruction of gates
stargate.admin -- Allow all admin features (Hidden/Private only so far)
stargate.admin.private -- Allow use of Private gates not owned by user
stargate.admin.hidden -- Allow access to Hidden gates not ownerd by user
stargate.admin.reload -- Allow use of /sg reload
=============
Default Permissions
@ -204,6 +205,9 @@ createConflict=Gate conflicts with existing gate
=============
Changes
=============
[Version 0.7.6.5]
- Resolve issue with buttons on glass gates falling off
- /sg reload can now be used ingame (stargate.admin.reload permission)
[Version 0.7.6.4]
- Move blockBreak to HIGHEST priority, this resolves issues with region protection plugins
[Version 0.7.6.3]

View File

@ -57,6 +57,7 @@ public class Portal {
// Static variables used to store portal lists
private static final HashMap<Blox, Portal> lookupBlocks = new HashMap<Blox, Portal>();
private static final HashMap<Blox, Portal> lookupEntrances = new HashMap<Blox, Portal>();
private static final HashMap<Blox, Portal> lookupControls = new HashMap<Blox, Portal>();
private static final ArrayList<Portal> allPortals = new ArrayList<Portal>();
private static final HashMap<String, ArrayList<String>> allPortalsNet = new HashMap<String, ArrayList<String>>();
private static final HashMap<String, HashMap<String, Portal>> lookupNamesNet = new HashMap<String, HashMap<String, Portal>>();
@ -717,11 +718,15 @@ public class Portal {
lookupBlocks.remove(block);
}
// Include the sign and button
lookupBlocks.remove(new Blox(id.getBlock()));
lookupBlocks.remove(id);
if (button != null) {
lookupBlocks.remove(button);
}
lookupControls.remove(id);
if (button != null)
lookupControls.remove(button);
for (Blox entrance : getEntrances()) {
lookupEntrances.remove(entrance);
}
@ -768,11 +773,15 @@ public class Portal {
lookupBlocks.put(block, this);
}
// Include the sign and button
lookupBlocks.put(new Blox(id.getBlock()), this);
lookupBlocks.put(id, this);
if (button != null) {
lookupBlocks.put(button, this);
}
lookupControls.put(id, this);
if (button != null)
lookupControls.put(button, this);
for (Blox entrance : getEntrances()) {
lookupEntrances.put(entrance, this);
}
@ -1059,6 +1068,10 @@ public class Portal {
return lookupEntrances.get(new Blox(block));
}
public static Portal getByControl(Block block) {
return lookupControls.get(new Blox(block));
}
public static Portal getByBlock(Block block) {
return lookupBlocks.get(new Blox(block));
}
@ -1128,6 +1141,7 @@ public class Portal {
lookupBlocks.clear();
lookupNamesNet.clear();
lookupEntrances.clear();
lookupControls.clear();
allPortals.clear();
allPortalsNet.clear();
}

View File

@ -259,11 +259,11 @@ public class Stargate extends JavaPlugin {
}
}
public static void sendMessage(Player player, String message) {
public static void sendMessage(CommandSender player, String message) {
sendMessage(player, message, true);
}
public static void sendMessage(Player player, String message, boolean error) {
public static void sendMessage(CommandSender player, String message, boolean error) {
if (message.isEmpty()) return;
message = message.replaceAll("(&([a-f0-9]))", "\u00A7$2");
if (error)
@ -976,6 +976,8 @@ public class Stargate extends JavaPlugin {
Block block = event.getBlock();
Portal portal = Portal.getByEntrance(block);
if (portal != null) event.setCancelled(true);
portal = Portal.getByControl(block);
if (portal != null) event.setCancelled(true);
}
@EventHandler
@ -1200,8 +1202,11 @@ public class Stargate extends JavaPlugin {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) {
Stargate.sendMessage((Player)sender, "Permission Denied");
return true;
Player p = (Player)sender;
if (!hasPerm(p, "stargate.admin") && !hasPerm(p, "stargate.admin.reload")) {
sendMessage(sender, "Permission Denied");
return true;
}
}
String cmd = command.getName();
if (cmd.equalsIgnoreCase("sg")) {
@ -1241,6 +1246,7 @@ public class Stargate extends JavaPlugin {
iConomyHandler.register = null;
iConomyHandler.economy = null;
}
sendMessage(sender, "Stargate reloaded");
return true;
}
return false;