readGriefprevention log

This commit is contained in:
Flemmli97 2021-06-09 14:31:15 +02:00
parent e5227d6713
commit efee056fd5
6 changed files with 23 additions and 12 deletions

View File

@ -10,6 +10,8 @@ Flan 1.4.1
Basically now a worldguard version
- Add locking items when the player dies so other players cant pick it up.
Use /flan unlockItems to allow it.
- /flan help finished: command are clickable now and give additional info on the commands
- Log the file path when /flan readGriefPrevention can't find the files
Flan 1.4.0
======================

View File

@ -316,11 +316,13 @@ public class ClaimStorage {
}
}
public static void readGriefPreventionData(MinecraftServer server, ServerCommandSource src) {
public static boolean readGriefPreventionData(MinecraftServer server, ServerCommandSource src) {
Yaml yml = new Yaml();
File griefPrevention = server.getSavePath(WorldSavePath.ROOT).resolve("plugins/GriefPreventionData/ClaimData").toFile();
if (!griefPrevention.exists())
return;
if (!griefPrevention.exists()) {
src.sendFeedback(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.cantFindData, griefPrevention.getAbsolutePath()), Formatting.DARK_RED), false);
return false;
}
Map<File, List<File>> subClaimMap = new HashMap<>();
Map<Integer, File> intFileMap = new HashMap<>();
@ -401,6 +403,7 @@ public class ClaimStorage {
} catch (IOException e) {
e.printStackTrace();
}
return true;
}
private static Set<ClaimPermission> complementOf(ClaimPermission... perms) {

View File

@ -436,9 +436,10 @@ public class CommandClaim {
private static int readGriefPreventionData(CommandContext<ServerCommandSource> context) {
ServerCommandSource src = context.getSource();
src.sendFeedback(PermHelper.simpleColoredText(ConfigHandler.lang.readGriefpreventionData, Formatting.GOLD), true);
ClaimStorage.readGriefPreventionData(src.getMinecraftServer(), src);
PlayerClaimData.readGriefPreventionPlayerData(src.getMinecraftServer(), src);
src.sendFeedback(PermHelper.simpleColoredText(ConfigHandler.lang.readGriefpreventionDataSuccess, Formatting.GOLD), true);
if (ClaimStorage.readGriefPreventionData(src.getMinecraftServer(), src))
src.sendFeedback(PermHelper.simpleColoredText(ConfigHandler.lang.readGriefpreventionClaimDataSuccess, Formatting.GOLD), true);
if (PlayerClaimData.readGriefPreventionPlayerData(src.getMinecraftServer(), src))
src.sendFeedback(PermHelper.simpleColoredText(ConfigHandler.lang.readGriefpreventionPlayerDataSuccess, Formatting.GOLD), true);
return Command.SINGLE_SUCCESS;
}

View File

@ -15,9 +15,9 @@ public class LangCommands {
map.put("deleteAll", new String[]{"deleteAll", "Deletes all your claims (you need to double type to confirm it so no accidents)."});
map.put("deleteSubClaim", new String[]{"deleteSubClaim", "Deletes the current subclaim."});
map.put("deleteAllSubClaims", new String[]{"deleteAllSubClaims", "Deletes all subclaim of the current claim."});
map.put("list", new String[]{"list", "Lists all claims you have. if op also gives ability to list other players claims."});
map.put("list", new String[]{"list", "Lists all claims you have. If op also gives ability to list other players claims."});
map.put("switchMode", new String[]{"switchMode", "Switch between normal and subclaim mode."});
map.put("group", new String[]{"group (add | remove <name>) | (players add | remove <player> [overwrite])", "Adds/removes the group with that name. Also editable via the claim menu.", " adds/remove a player to the group. if overwrite then will overwrite the players current group else does nothing. Also editable via the claim menu."});
map.put("group", new String[]{"group (add | remove <name>) | (players add | remove <player> [overwrite])", "- Adds/removes the group with that name. Also editable via the claim menu.", "- Adds/remove a player to the group. If overwrite then will overwrite the players current group else does nothing. Also editable via the claim menu."});
map.put("transferClaim", new String[]{"transferClaim <player>", "Gives ownership of the claim to the specified player. Only works if you're the claim owner."});
map.put("addClaim", new String[]{"addClaim <x y z> <x y z>", "Creates a claim with the given positions. Same as using the claim tool."});
map.put("permission", new String[]{"permission {global | (group <name>) | (personal <name>)} <permission> true | false | default", " Sets global/group/personal permissions. Also editable via the claim menu (for group perm right click on the group in the menu)."});

View File

@ -71,7 +71,9 @@ public class LangConfig {
public String adminDeleteAll = "Deleted all claims for following players: %s";
public String setAdminClaim = "Adminclaim of this claim now: %s";
public String readGriefpreventionData = "Reading data from GriefPrevention";
public String readGriefpreventionDataSuccess = "Successfully read data";
public String readGriefpreventionClaimDataSuccess = "Successfully read claim data";
public String readGriefpreventionPlayerDataSuccess = "Successfully read player data";
public String cantFindData = "No griefprevention data at %s";
public String errorFile = "Error reading file %s";
public String readConflict = "%1$s conflicts with existing claims. Not added to world! Conflicts:";
public String giveClaimBlocks = "Gave following players %2$d claimblocks: %1$s";

View File

@ -377,11 +377,13 @@ public class PlayerClaimData {
return usedClaimsBlocks;
}
public static void readGriefPreventionPlayerData(MinecraftServer server, ServerCommandSource src) {
public static boolean readGriefPreventionPlayerData(MinecraftServer server, ServerCommandSource src) {
Flan.log("Reading grief prevention data");
File griefPrevention = server.getSavePath(WorldSavePath.ROOT).resolve("plugins/GriefPreventionData/PlayerData").toFile();
if (!griefPrevention.exists())
return;
if (!griefPrevention.exists()) {
src.sendFeedback(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.cantFindData, griefPrevention.getAbsolutePath()), Formatting.DARK_RED), false);
return false;
}
for (File f : griefPrevention.listFiles()) {
try {
if (f.getName().contains("."))
@ -417,5 +419,6 @@ public class PlayerClaimData {
src.sendFeedback(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.errorFile, f.getName(), Formatting.RED)), false);
}
}
return true;
}
}