Repaired singeplayer command permission system.
This commit is contained in:
parent
5fd25d5a45
commit
f8d2a69743
@ -59,6 +59,9 @@ public class ConfigHandler {
|
||||
@Comment("\nMinimal permission level required to run commands\n")
|
||||
public int permissionLevel = 4;
|
||||
|
||||
@Comment("\nPlayer on singleplayer is always allowed to run command. Warning! On lan party everyone will be allowed to run it.\n")
|
||||
public boolean alwaysSingleplayerAllowed = true;
|
||||
|
||||
@Comment("\nPlayers allowed to run backup commands without sufficient permission level\n")
|
||||
public Set<String> whitelist = new HashSet<>();
|
||||
|
||||
|
@ -52,11 +52,12 @@ public class TextileBackup implements ModInitializer {
|
||||
LiteralArgumentBuilder.<ServerCommandSource>literal("backup")
|
||||
.requires((ctx) -> {
|
||||
try {
|
||||
return (config.whitelist.contains(ctx.getEntityOrThrow().getEntityName()) ||
|
||||
return ((config.whitelist.contains(ctx.getEntityOrThrow().getEntityName()) ||
|
||||
ctx.hasPermissionLevel(config.permissionLevel)) &&
|
||||
!config.blacklist.contains(ctx.getEntityOrThrow().getEntityName());
|
||||
!config.blacklist.contains(ctx.getEntityOrThrow().getEntityName())) ||
|
||||
(ctx.getMinecraftServer().isSinglePlayer() &&
|
||||
config.alwaysSingleplayerAllowed);
|
||||
}catch (Exception e){ //Command was called from server console.
|
||||
System.out.println("Server!");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -77,9 +77,6 @@ public class BackupHelper {
|
||||
)
|
||||
);
|
||||
}catch(Exception e){
|
||||
System.out.println(e.getClass());
|
||||
System.out.println(e.toString());
|
||||
|
||||
creationTime = LocalDateTime.from(
|
||||
Utilities.getBackupDateTimeFormatter().parse(
|
||||
f.getName().split(".zip")[0].split("#")[0]
|
||||
|
Loading…
Reference in New Issue
Block a user