Fixed issue #18. Gates with 'null' as location did cause exceptions at many locations.
This commit is contained in:
parent
cac6eb6022
commit
ed2683affc
@ -177,7 +177,7 @@ public abstract class BaseGate
|
|||||||
throw new Exception("Gate got closed. It has no exit.");
|
throw new Exception("Gate got closed. It has no exit.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gateBlockLocations.size() == 0) {
|
if (gateBlockLocations == null || gateBlockLocations.size() == 0) {
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
throw new Exception("Gate got closed. The frame is missing or broken.");
|
throw new Exception("Gate got closed. The frame is missing or broken.");
|
||||||
}
|
}
|
||||||
|
@ -142,8 +142,10 @@ public class Gate extends BaseGate implements ConfigurationSerializable
|
|||||||
retVal.put(exitYawKey, exit.getYaw());
|
retVal.put(exitYawKey, exit.getYaw());
|
||||||
}
|
}
|
||||||
|
|
||||||
retVal.put(locationPitchKey, location.getPitch());
|
if (location != null) {
|
||||||
retVal.put(locationYawKey, location.getYaw());
|
retVal.put(locationPitchKey, location.getPitch());
|
||||||
|
retVal.put(locationYawKey, location.getYaw());
|
||||||
|
}
|
||||||
|
|
||||||
List<Map<String, Object>> serializedGateBlocks = new ArrayList<Map<String, Object>>();
|
List<Map<String, Object>> serializedGateBlocks = new ArrayList<Map<String, Object>>();
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ public abstract class BaseCommand
|
|||||||
*/
|
*/
|
||||||
protected boolean hasPermission()
|
protected boolean hasPermission()
|
||||||
{
|
{
|
||||||
if (Plugin.permission == null) // fallback Ð use the standard bukkit permission system
|
if (Plugin.permission == null) // fallback <EFBFBD> use the standard bukkit permission system
|
||||||
{
|
{
|
||||||
return this.sender.hasPermission(this.requiredPermission);
|
return this.sender.hasPermission(this.requiredPermission);
|
||||||
}
|
}
|
||||||
@ -156,7 +156,7 @@ public abstract class BaseCommand
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// sender is no player Ð there is no information about the senders locations
|
// sender is no player <EFBFBD> there is no information about the senders locations
|
||||||
return Plugin.permission.has(this.sender, this.requiredPermission);
|
return Plugin.permission.has(this.sender, this.requiredPermission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,17 +205,23 @@ public abstract class BaseCommand
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean permAtLocation = Plugin.permission.has(this.gate.getLocation().getWorld(), p.getName(), this.requiredPermission);
|
boolean permAtLocation;
|
||||||
|
|
||||||
|
if (this.gate.getLocation() == null) {
|
||||||
|
permAtLocation = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
permAtLocation = Plugin.permission.has(this.gate.getLocation().getWorld(), p.getName(), this.requiredPermission);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
boolean permAtExit;
|
boolean permAtExit;
|
||||||
|
|
||||||
if (this.gate.getExit() == null)
|
if (this.gate.getExit() == null) {
|
||||||
{
|
|
||||||
permAtExit = true;
|
permAtExit = true;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
permAtExit = Plugin.permission.has(this.gate.getExit().getWorld(), p.getName(), this.requiredPermission);
|
permAtExit = Plugin.permission.has(this.gate.getExit().getWorld(), p.getName(), this.requiredPermission);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,6 +48,8 @@ public class CommandCreate extends BaseLocationCommand
|
|||||||
|
|
||||||
Location playerLocation = getValidPlayerLocation();
|
Location playerLocation = getValidPlayerLocation();
|
||||||
|
|
||||||
|
Plugin.log("player location:" + playerLocation);
|
||||||
|
|
||||||
if (playerLocation != null)
|
if (playerLocation != null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -63,7 +65,7 @@ public class CommandCreate extends BaseLocationCommand
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
sendMessage(ChatColor.GREEN + "Gate with id \"" + id + "\" was created.");
|
sendMessage(ChatColor.GREEN + "Gate with id \"" + id + "\" was created.");
|
||||||
sendMessage("Now you should build a frame and:");
|
sendMessage("Now you should build a frame and execute:");
|
||||||
sendMessage(new CommandSetLocation().getUsageTemplate(true, true));
|
sendMessage(new CommandSetLocation().getUsageTemplate(true, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,10 +144,12 @@ public class CommandList extends BaseCommand
|
|||||||
|
|
||||||
for (Gate gate : gatesCopy) {
|
for (Gate gate : gatesCopy) {
|
||||||
|
|
||||||
boolean permissionAtGateLocation = Plugin.permission.has(gate.getLocation().getWorld(), p.getName(), this.requiredPermission);
|
if (gate.getLocation() != null) {
|
||||||
if (!permissionAtGateLocation) {
|
boolean permissionAtGateLocation = Plugin.permission.has(gate.getLocation().getWorld(), p.getName(), this.requiredPermission);
|
||||||
gates.remove(gate);
|
if (!permissionAtGateLocation) {
|
||||||
continue;
|
gates.remove(gate);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gate.getExit() != null) {
|
if (gate.getExit() != null) {
|
||||||
|
@ -51,10 +51,13 @@ public class GateUtil
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if the gate is open and useable
|
// Check if the gate is open and useable
|
||||||
|
if (g.getLocation() == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
World gateWorld = g.getLocation().getWorld();
|
World gateWorld = g.getLocation().getWorld();
|
||||||
|
|
||||||
if (!g.isOpen() || !gateWorld.equals(playerWorld))
|
if (!g.isOpen() || !gateWorld.equals(playerWorld)) {
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user