Merge pull request #82 from James-Frowen/1.6.x

Allowing warps to be replaced at max warps
This commit is contained in:
Naman 2019-01-30 03:28:02 +00:00 committed by GitHub
commit d89c35b1bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,9 +46,14 @@ public class CmdSetFWarp extends FCommand {
} }
} }
String warp = argAsString(0);
// Checks if warp with same name already exists and ignores maxWarp check if it does.
boolean warpExists = myFaction.isWarp(warp);
int maxWarps = SavageFactions.plugin.getConfig().getInt("max-warps", 5); int maxWarps = SavageFactions.plugin.getConfig().getInt("max-warps", 5);
if (maxWarps <= myFaction.getWarps().size()) { boolean tooManyWarps = maxWarps <= myFaction.getWarps().size();
if (tooManyWarps && !warpExists) {
fme.msg(TL.COMMAND_SETFWARP_LIMIT, maxWarps); fme.msg(TL.COMMAND_SETFWARP_LIMIT, maxWarps);
return; return;
} }
@ -57,7 +62,6 @@ public class CmdSetFWarp extends FCommand {
return; return;
} }
String warp = argAsString(0);
String password = argAsString(1); String password = argAsString(1);
LazyLocation loc = new LazyLocation(fme.getPlayer().getLocation()); LazyLocation loc = new LazyLocation(fme.getPlayer().getLocation());