Added shouldPersistToDisk attribute to BaseCommand. Updated subclasses to reflect the new attribute.
This commit is contained in:
parent
dd5a60cb2a
commit
cd0ebc3a7a
@ -30,6 +30,8 @@ public abstract class BaseCommand
|
|||||||
protected String requiredPermission;
|
protected String requiredPermission;
|
||||||
protected boolean needsPermissionAtCurrentLocation;
|
protected boolean needsPermissionAtCurrentLocation;
|
||||||
|
|
||||||
|
protected boolean shouldPersistToDisk;
|
||||||
|
|
||||||
|
|
||||||
public BaseCommand()
|
public BaseCommand()
|
||||||
{
|
{
|
||||||
@ -61,6 +63,10 @@ public abstract class BaseCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.perform();
|
this.perform();
|
||||||
|
|
||||||
|
if (this.shouldPersistToDisk) {
|
||||||
|
Plugin.instance.saveGates();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ public class CommandClose extends BaseCommand
|
|||||||
requiredPermission = Plugin.permissionManage;
|
requiredPermission = Plugin.permissionManage;
|
||||||
|
|
||||||
needsPermissionAtCurrentLocation = false;
|
needsPermissionAtCurrentLocation = false;
|
||||||
|
shouldPersistToDisk = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ public class CommandCreate extends BaseLocationCommand
|
|||||||
requiredPermission = Plugin.permissionManage;
|
requiredPermission = Plugin.permissionManage;
|
||||||
|
|
||||||
needsPermissionAtCurrentLocation = true;
|
needsPermissionAtCurrentLocation = true;
|
||||||
|
shouldPersistToDisk = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ public class CommandDelete extends BaseCommand
|
|||||||
requiredPermission = Plugin.permissionManage;
|
requiredPermission = Plugin.permissionManage;
|
||||||
|
|
||||||
needsPermissionAtCurrentLocation = false;
|
needsPermissionAtCurrentLocation = false;
|
||||||
|
shouldPersistToDisk = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ public class CommandHelp extends BaseCommand
|
|||||||
|
|
||||||
hasGateParam = false;
|
hasGateParam = false;
|
||||||
needsPermissionAtCurrentLocation = false;
|
needsPermissionAtCurrentLocation = false;
|
||||||
|
shouldPersistToDisk = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ public class CommandInfo extends BaseCommand
|
|||||||
requiredPermission = Plugin.permissionInfo;
|
requiredPermission = Plugin.permissionInfo;
|
||||||
|
|
||||||
needsPermissionAtCurrentLocation = false;
|
needsPermissionAtCurrentLocation = false;
|
||||||
|
shouldPersistToDisk = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ public class CommandList extends BaseCommand
|
|||||||
helpDescription = "lists all availible gates.";
|
helpDescription = "lists all availible gates.";
|
||||||
|
|
||||||
requiredPermission = Plugin.permissionInfo;
|
requiredPermission = Plugin.permissionInfo;
|
||||||
|
shouldPersistToDisk = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ public class CommandOpen extends BaseCommand
|
|||||||
requiredPermission = Plugin.permissionManage;
|
requiredPermission = Plugin.permissionManage;
|
||||||
|
|
||||||
needsPermissionAtCurrentLocation = false;
|
needsPermissionAtCurrentLocation = false;
|
||||||
|
shouldPersistToDisk = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ public class CommandRename extends BaseCommand
|
|||||||
requiredPermission = Plugin.permissionManage;
|
requiredPermission = Plugin.permissionManage;
|
||||||
|
|
||||||
needsPermissionAtCurrentLocation = false;
|
needsPermissionAtCurrentLocation = false;
|
||||||
|
shouldPersistToDisk = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ public class CommandSetExit extends BaseCommand
|
|||||||
requiredPermission = Plugin.permissionManage;
|
requiredPermission = Plugin.permissionManage;
|
||||||
|
|
||||||
needsPermissionAtCurrentLocation = true;
|
needsPermissionAtCurrentLocation = true;
|
||||||
|
shouldPersistToDisk = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -29,8 +30,12 @@ public class CommandSetExit extends BaseCommand
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
System.out.println(gate.getExit());
|
||||||
|
|
||||||
gate.setExit(player.getLocation());
|
gate.setExit(player.getLocation());
|
||||||
sendMessage(ChatColor.GREEN + "The exit of gate '" + gate.getId() + "' is now where you stand.");
|
sendMessage(ChatColor.GREEN + "The exit of gate '" + gate.getId() + "' is now where you stand.");
|
||||||
|
|
||||||
|
System.out.println(gate.getExit());
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
sendMessage(ChatColor.RED + "Setting the exit for the gate failed! See server log for more information");
|
sendMessage(ChatColor.RED + "Setting the exit for the gate failed! See server log for more information");
|
||||||
|
@ -21,6 +21,7 @@ public class CommandSetHidden extends BaseCommand
|
|||||||
requiredPermission = Plugin.permissionManage;
|
requiredPermission = Plugin.permissionManage;
|
||||||
|
|
||||||
needsPermissionAtCurrentLocation = false;
|
needsPermissionAtCurrentLocation = false;
|
||||||
|
shouldPersistToDisk = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ public class CommandSetLocation extends BaseLocationCommand
|
|||||||
requiredPermission = Plugin.permissionManage;
|
requiredPermission = Plugin.permissionManage;
|
||||||
|
|
||||||
needsPermissionAtCurrentLocation = true;
|
needsPermissionAtCurrentLocation = true;
|
||||||
|
shouldPersistToDisk = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ public class CommandSetVisible extends BaseCommand
|
|||||||
requiredPermission = Plugin.permissionManage;
|
requiredPermission = Plugin.permissionManage;
|
||||||
|
|
||||||
needsPermissionAtCurrentLocation = false;
|
needsPermissionAtCurrentLocation = false;
|
||||||
|
shouldPersistToDisk = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user