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

@ -45,10 +45,15 @@ public class CmdSetFWarp extends FCommand {
return;
}
}
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);
if (maxWarps <= myFaction.getWarps().size()) {
boolean tooManyWarps = maxWarps <= myFaction.getWarps().size();
if (tooManyWarps && !warpExists) {
fme.msg(TL.COMMAND_SETFWARP_LIMIT, maxWarps);
return;
}
@ -57,7 +62,6 @@ public class CmdSetFWarp extends FCommand {
return;
}
String warp = argAsString(0);
String password = argAsString(1);
LazyLocation loc = new LazyLocation(fme.getPlayer().getLocation());