fix some things not using translation

This commit is contained in:
Flemmli97 2021-09-21 11:56:57 +02:00
parent e7588b9aa0
commit 3df646d93e
14 changed files with 141 additions and 121 deletions

View File

@ -578,16 +578,16 @@ public class Claim implements IPermissionContainer {
this.homePos = new BlockPos(home.get(0).getAsInt(), home.get(1).getAsInt(), home.get(2).getAsInt());
}
String message = ConfigHandler.fromJson(obj, "EnterTitle", "");
if(!message.isEmpty())
if (!message.isEmpty())
this.enterTitle = Text.Serializer.fromJson(message);
message = ConfigHandler.fromJson(obj, "EnterSubtitle", "");
if(!message.isEmpty())
if (!message.isEmpty())
this.enterSubtitle = Text.Serializer.fromJson(message);
message = ConfigHandler.fromJson(obj, "LeaveTitle", "");
if(!message.isEmpty())
if (!message.isEmpty())
this.leaveTitle = Text.Serializer.fromJson(message);
message = ConfigHandler.fromJson(obj, "LeaveSubtitle", "");
if(!message.isEmpty())
if (!message.isEmpty())
this.leaveSubtitle = Text.Serializer.fromJson(message);
JsonObject potion = ConfigHandler.fromJson(obj, "Potions");
potion.entrySet().forEach(e -> this.potions.put(CrossPlatformStuff.registryStatusEffects().getFromId(new Identifier(e.getKey())), e.getValue().getAsInt()));

View File

@ -56,7 +56,7 @@ public class CommandClaim {
.then(CommandManager.literal("addClaim").requires(src -> PermissionNodeHandler.perm(src, PermissionNodeHandler.claimCreate))
.then(CommandManager.argument("from", BlockPosArgumentType.blockPos()).then(CommandManager.argument("to", BlockPosArgumentType.blockPos()).executes(CommandClaim::addClaim)))
.then(CommandManager.literal("all").executes(CommandClaim::addClaimAll))
.then(CommandManager.literal("rect").then(CommandManager.argument("x", IntegerArgumentType.integer()).then(CommandManager.argument("z", IntegerArgumentType.integer()).executes(ctx->CommandClaim.addClaimRect(ctx, IntegerArgumentType.getInteger(ctx, "x"), IntegerArgumentType.getInteger(ctx, "z")))))))
.then(CommandManager.literal("rect").then(CommandManager.argument("x", IntegerArgumentType.integer()).then(CommandManager.argument("z", IntegerArgumentType.integer()).executes(ctx -> CommandClaim.addClaimRect(ctx, IntegerArgumentType.getInteger(ctx, "x"), IntegerArgumentType.getInteger(ctx, "z")))))))
.then(CommandManager.literal("menu").requires(src -> PermissionNodeHandler.perm(src, PermissionNodeHandler.cmdMenu)).executes(CommandClaim::openMenu))
.then(CommandManager.literal("setHome").requires(src -> PermissionNodeHandler.perm(src, PermissionNodeHandler.cmdHome)).executes(CommandClaim::setClaimHome))
.then(CommandManager.literal("trapped").requires(src -> PermissionNodeHandler.perm(src, PermissionNodeHandler.cmdTrapped)).executes(CommandClaim::trapped))
@ -164,8 +164,8 @@ public class CommandClaim {
ClaimStorage storage = ClaimStorage.get(player.getServerWorld());
boolean evenX = x % 2 == 0;
boolean evenZ = z % 2 == 0;
BlockPos from = player.getBlockPos().add(evenX ? -(int)((x-1)*0.5) : -(int)(x*0.5), -5, evenZ ? -(int)((z-1)*0.5) : -(int)(z*0.5));
BlockPos to = player.getBlockPos().add((int)(x*0.5), -5, (int)(z*0.5));
BlockPos from = player.getBlockPos().add(evenX ? -(int) ((x - 1) * 0.5) : -(int) (x * 0.5), -5, evenZ ? -(int) ((z - 1) * 0.5) : -(int) (z * 0.5));
BlockPos to = player.getBlockPos().add((int) (x * 0.5), -5, (int) (z * 0.5));
storage.createClaim(from, to, player);
return Command.SINGLE_SUCCESS;
}

View File

@ -33,6 +33,19 @@ public class Config {
public int minClaimsize = 100;
public int defaultClaimDepth = 10;
public int maxClaims = -1;
public String[] blacklistedWorlds = new String[0];
public boolean worldWhitelist;
public Item claimingItem = Items.GOLDEN_HOE;
public Item inspectionItem = Items.STICK;
public int claimDisplayTime = 1000;
public int permissionLevel = 2;
public int sellPrice = -1;
public int buyPrice = -1;
public boolean lenientBlockEntityCheck;
public List<String> ignoredBlocks = Lists.newArrayList(
"universal_graves:grave"
@ -49,18 +62,6 @@ public class Config {
"graves.marker" //vanilla tweaks
);
public String[] blacklistedWorlds = new String[0];
public boolean worldWhitelist;
public Item claimingItem = Items.GOLDEN_HOE;
public Item inspectionItem = Items.STICK;
public int claimDisplayTime = 1000;
public int permissionLevel = 2;
public int sellPrice = -1;
public int buyPrice = -1;
public int dropTicks = 6000;
public int inactivityTime = 30;
@ -128,6 +129,23 @@ public class Config {
this.minClaimsize = ConfigHandler.fromJson(obj, "minClaimsize", this.minClaimsize);
this.defaultClaimDepth = ConfigHandler.fromJson(obj, "defaultClaimDepth", this.defaultClaimDepth);
this.maxClaims = ConfigHandler.fromJson(obj, "maxClaims", this.maxClaims);
JsonArray arr = ConfigHandler.arryFromJson(obj, "blacklistedWorlds");
this.blacklistedWorlds = new String[arr.size()];
for (int i = 0; i < arr.size(); i++)
this.blacklistedWorlds[i] = arr.get(i).getAsString();
this.worldWhitelist = ConfigHandler.fromJson(obj, "worldWhitelist", this.worldWhitelist);
if (obj.has("claimingItem"))
this.claimingItem = CrossPlatformStuff.registryItems().getFromId(new Identifier((obj.get("claimingItem").getAsString())));
if (obj.has("inspectionItem"))
this.inspectionItem = CrossPlatformStuff.registryItems().getFromId(new Identifier((obj.get("inspectionItem").getAsString())));
this.claimDisplayTime = ConfigHandler.fromJson(obj, "claimDisplayTime", this.claimDisplayTime);
this.permissionLevel = ConfigHandler.fromJson(obj, "permissionLevel", this.permissionLevel);
this.sellPrice = ConfigHandler.fromJson(obj, "sellPrice", this.sellPrice);
this.buyPrice = ConfigHandler.fromJson(obj, "buyPrice", this.buyPrice);
this.lenientBlockEntityCheck = ConfigHandler.fromJson(obj, "lenientBlockEntityCheck", this.lenientBlockEntityCheck);
this.ignoredBlocks.clear();
ConfigHandler.arryFromJson(obj, "ignoredBlocks").forEach(e -> this.ignoredBlocks.add(e.getAsString()));
@ -138,16 +156,14 @@ public class Config {
this.entityTagIgnore.clear();
ConfigHandler.arryFromJson(obj, "entityTagIgnore").forEach(e -> this.entityTagIgnore.add(e.getAsString()));
JsonArray arr = ConfigHandler.arryFromJson(obj, "blacklistedWorlds");
this.blacklistedWorlds = new String[arr.size()];
for (int i = 0; i < arr.size(); i++)
this.blacklistedWorlds[i] = arr.get(i).getAsString();
this.worldWhitelist = ConfigHandler.fromJson(obj, "worldWhitelist", this.worldWhitelist);
if (obj.has("claimingItem"))
this.claimingItem = CrossPlatformStuff.registryItems().getFromId(new Identifier((obj.get("claimingItem").getAsString())));
if (obj.has("inspectionItem"))
this.inspectionItem = CrossPlatformStuff.registryItems().getFromId(new Identifier((obj.get("inspectionItem").getAsString())));
this.claimDisplayTime = ConfigHandler.fromJson(obj, "claimDisplayTime", this.claimDisplayTime);
this.dropTicks = ConfigHandler.fromJson(obj, "dropTicks", this.dropTicks);
this.inactivityTime = ConfigHandler.fromJson(obj, "inactivityTimeDays", this.inactivityTime);
this.inactivityBlocksMax = ConfigHandler.fromJson(obj, "inactivityBlocksMax", this.inactivityBlocksMax);
this.deletePlayerFile = ConfigHandler.fromJson(obj, "deletePlayerFile", this.deletePlayerFile);
this.bannedDeletionTime = ConfigHandler.fromJson(obj, "bannedDeletionTime", this.bannedDeletionTime);
this.offlineProtectActivation = ConfigHandler.fromJson(obj, "offlineProtectActivation", this.offlineProtectActivation);
this.log = ConfigHandler.fromJson(obj, "enableLogs", this.log);
this.defaultGroups.clear();
JsonObject defP = ConfigHandler.fromJson(obj, "defaultGroups");
defP.entrySet().forEach(e -> {
@ -181,16 +197,6 @@ public class Config {
}
this.globalDefaultPerms.put(e.getKey(), perms);
});
this.log = ConfigHandler.fromJson(obj, "enableLogs", this.log);
this.permissionLevel = ConfigHandler.fromJson(obj, "permissionLevel", this.permissionLevel);
this.sellPrice = ConfigHandler.fromJson(obj, "sellPrice", this.sellPrice);
this.buyPrice = ConfigHandler.fromJson(obj, "buyPrice", this.buyPrice);
this.dropTicks = ConfigHandler.fromJson(obj, "dropTicks", this.dropTicks);
this.inactivityTime = ConfigHandler.fromJson(obj, "inactivityTimeDays", this.inactivityTime);
this.inactivityBlocksMax = ConfigHandler.fromJson(obj, "inactivityBlocksMax", this.inactivityBlocksMax);
this.deletePlayerFile = ConfigHandler.fromJson(obj, "deletePlayerFile", this.deletePlayerFile);
this.bannedDeletionTime = ConfigHandler.fromJson(obj, "bannedDeletionTime", this.bannedDeletionTime);
this.offlineProtectActivation = ConfigHandler.fromJson(obj, "offlineProtectActivation", this.offlineProtectActivation);
} catch (IOException e) {
e.printStackTrace();
}
@ -208,6 +214,21 @@ public class Config {
obj.addProperty("minClaimsize", this.minClaimsize);
obj.addProperty("defaultClaimDepth", this.defaultClaimDepth);
obj.addProperty("maxClaims", this.maxClaims);
JsonArray arr = new JsonArray();
for (String blacklistedWorld : this.blacklistedWorlds)
arr.add(blacklistedWorld);
obj.add("blacklistedWorlds", arr);
obj.addProperty("worldWhitelist", this.worldWhitelist);
obj.addProperty("claimingItem", CrossPlatformStuff.registryItems().getIDFrom(this.claimingItem).toString());
obj.addProperty("inspectionItem", CrossPlatformStuff.registryItems().getIDFrom(this.inspectionItem).toString());
obj.addProperty("claimDisplayTime", this.claimDisplayTime);
obj.addProperty("permissionLevel", this.permissionLevel);
obj.addProperty("sellPrice", this.sellPrice);
obj.addProperty("buyPrice", this.buyPrice);
JsonArray blocks = new JsonArray();
this.ignoredBlocks.forEach(blocks::add);
obj.add("ignoredBlocks", blocks);
@ -222,15 +243,14 @@ public class Config {
this.entityTagIgnore.forEach(entitiesTags::add);
obj.add("entityTagIgnore", entitiesTags);
JsonArray arr = new JsonArray();
for (String blacklistedWorld : this.blacklistedWorlds)
arr.add(blacklistedWorld);
obj.add("blacklistedWorlds", arr);
obj.addProperty("worldWhitelist", this.worldWhitelist);
obj.addProperty("claimingItem", CrossPlatformStuff.registryItems().getIDFrom(this.claimingItem).toString());
obj.addProperty("inspectionItem", CrossPlatformStuff.registryItems().getIDFrom(this.inspectionItem).toString());
obj.addProperty("claimDisplayTime", this.claimDisplayTime);
obj.addProperty("permissionLevel", this.permissionLevel);
obj.addProperty("dropTicks", this.dropTicks);
obj.addProperty("inactivityTimeDays", this.inactivityTime);
obj.addProperty("inactivityBlocksMax", this.inactivityBlocksMax);
obj.addProperty("deletePlayerFile", this.deletePlayerFile);
obj.addProperty("bannedDeletionTime", this.bannedDeletionTime);
obj.addProperty("offlineProtectActivation", this.offlineProtectActivation);
obj.addProperty("enableLogs", this.log);
JsonObject defPerm = new JsonObject();
this.defaultGroups.forEach((key, value) -> {
JsonObject perm = new JsonObject();
@ -245,15 +265,6 @@ public class Config {
global.add(key, perm);
});
obj.add("globalDefaultPerms", global);
obj.addProperty("enableLogs", this.log);
obj.addProperty("sellPrice", this.sellPrice);
obj.addProperty("buyPrice", this.buyPrice);
obj.addProperty("dropTicks", this.dropTicks);
obj.addProperty("inactivityTimeDays", this.inactivityTime);
obj.addProperty("inactivityBlocksMax", this.inactivityBlocksMax);
obj.addProperty("deletePlayerFile", this.deletePlayerFile);
obj.addProperty("bannedDeletionTime", this.bannedDeletionTime);
obj.addProperty("offlineProtectActivation", this.offlineProtectActivation);
try {
FileWriter writer = new FileWriter(this.config);
ConfigHandler.GSON.toJson(obj, writer);

View File

@ -19,7 +19,7 @@ public class LangCommands {
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("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("addClaim", new String[]{"addClaim (<x y z> <x y z>) | all | (rect x z)", "Creates a claim with the given positions. Same as using the claim tool.", "<all> uses up all remaining blocks for a squared claim centered around the player", "<rect> creates a rectangular claim centered around the player"});
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)."});
map.put("personalGroups", new String[]{"personalGroups", "Opens the gui to edit personal groups."});
map.put("sellBlocks", new String[]{"sellBlocks <amount>", "Sells <amount> claimblocks. Needs gunpowder currency installed."});

View File

@ -26,7 +26,7 @@ public class LangConfig {
public String listClaims = "Listing all claims:";
public String listAdminClaims = "Listing all admin-claims in %1$s:";
public String onlyOnePlayer = "Only one player can be used as argument";
public String ownerTransferSuccess = "New Claimowner now: %s";
public String ownerTransferSuccess = "New Claimowner now: %1$s";
public String ownerTransferFail = "Only the owner may transfer claims";
public String ownerTransferNoBlocks = "The new owner doesnt have enough claimblocks";
public String ownerTransferNoBlocksAdmin = "You can ignore this by switching to admin mode";
@ -40,14 +40,14 @@ public class LangConfig {
public String minClaimSize = "This is too small. Minimum claimsize is %d";
public String maxClaims = "Maximum amount of claims reached";
public String landClaimDisabledWorld = "Claiming is disabled in this world";
public String editMode = "Editing mode set to %s";
public String editMode = "Editing mode set to %1$s";
public String notEnoughBlocks = "Not enough claim blocks";
public String conflictOther = "Claim would overlap other claims";
public String wrongMode = "Wrong claim mode. You are in %s-mode";
public String wrongMode = "Wrong claim mode. You are in %1$s-mode";
public String stringScreenReturn = "Click on paper to go back";
public String groupAdd = "Added group %s";
public String groupRemove = "Removed group %s";
public String groupAdd = "Added group %1$s";
public String groupRemove = "Removed group %1$s";
public String groupExist = "Group already exist";
public String playerModify = "Modified permission group for following players to %1$s: %2$s";
public String playerModifyNo = "Couldn't set permission group for the players. Probably cause they already belong to a group";
@ -63,19 +63,19 @@ public class LangConfig {
public String deleteClaimError = "You can't delete this claim here";
public String deleteSubClaim = "Subclaim deleted";
public String deleteSubClaimAll = "All Subclaims from this claim deleted";
public String noSuchPerm = "No such Permission %s";
public String noSuchPerm = "No such Permission %1$s";
public String editPerm = "%1$s now set to %2$s";
public String editPermGroup = "%1$s for %2$s now set to %3$s";
public String editPersonalGroup = "Default permission %1$s for group %2$s now set to %3$s";
public String adminMode = "Adminmode (Ignore Claims) set to: %s";
public String adminDeleteAll = "Deleted all claims for following players: %s";
public String setAdminClaim = "Adminclaim of this claim now: %s";
public String adminMode = "Adminmode (Ignore Claims) set to: %1$s";
public String adminDeleteAll = "Deleted all claims for following players: %1$s";
public String setAdminClaim = "Adminclaim of this claim now: %1$s";
public String readGriefpreventionData = "Reading data from GriefPrevention";
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 cantFindData = "No griefprevention data at %1$s";
public String errorFile = "Error reading file %1$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";
@ -84,15 +84,15 @@ public class LangConfig {
public String claimSubHeader = "==SubclaimInfo==";
public String claimBasicInfoSub = "Owner: %1$s, from: [x=%2$d,z=%3$d] to [x=%4$d,z=%5$d]";
public String claimBasicInfoSubNamed = "Claim: %6$s, Owner: %1$s, from: [x=%2$d,z=%3$d] to [x=%4$d,z=%5$d]";
public String claimInfoPerms = "Permissions: %s";
public String claimInfoPerms = "Permissions: %1$s";
public String claimGroupInfoHeader = "Groups: ";
public String claimGroupPerms = " Permissions: %s";
public String claimGroupPlayers = " Players: %s";
public String claimGroupPerms = " Permissions: %1$s";
public String claimGroupPlayers = " Players: %1$s";
public String helpHeader = "Available subcommands are (page %d):";
public String helpCmdHeader = "====================";
public String helpCmdSyntax = "Syntax: %s";
public String helpCmdSyntax = "Syntax: %1$s";
public String screenEnableText = "Enabled: %s";
public String screenEnableText = "Enabled: %1$s";
public String screenUneditable = "Non Editable!";
public String screenClose = "Close";
public String screenNext = "Next";
@ -100,6 +100,9 @@ public class LangConfig {
public String screenAdd = "Add";
public String screenBack = "Back";
public String screenNoPerm = "No Permission";
public String screenFalse = "false";
public String screenTrue = "true";
public String screenDefault = "default";
public String screenMenu = "Claim-Menu";
public String screenMenuSub = "SubClaim-Menu";
@ -111,18 +114,23 @@ public class LangConfig {
public String screenConfirm = "Confirm";
public String screenYes = "Yes";
public String screenNo = "No";
public String screenGroupPlayers = "%s-Players";
public String screenRemoveMode = "Remove Mode: %s";
public String screenGroupPlayers = "%1$s-Players";
public String screenRemoveMode = "Remove Mode: %1$s";
public String screenGlobalPerms = "Global-Permissions";
public String screenGroupPerms = "%s-Permissions";
public String screenGroups = "Claim-Groups";
public String screenGroupPerms = "%1$s-Permissions";
public String screenPersonalGroups = "Personal-Groups";
public String screenPersonalPermissions = "Personal Permissions for %s";
public String screenPersonalPermissions = "Personal Permissions for %1$s";
public String screenPotions = "Claim Potions";
public String screenTitleEditor = "Claim messages";
public String screenTitleEditorSub = "Subclaim messages";
public String screenEnterText = "Edit title text on enter. (Right-Click to use JSON text. See MC Wiki for that)";
public String screenEnterSubText = "Edit subtitle text on enter. (Right-Click to use JSON text. See MC Wiki for that)";
public String screenLeaveText = "Edit title text on leave. (Right-Click to use JSON text. See MC Wiki for that)";
public String screenLeaveSubText = "Edit subtitle text on enter. (Right-Click to use JSON text. See MC Wiki for that)";
public String chatClaimTextEdit = "[Click for command]";
public String sellDisabled = "Claimblocks selling is disabled";
public String buyDisabled = "Claimblocks purchasing is disabled";
public String sellFail = "Not enough claimblocks to sell";
@ -135,22 +143,22 @@ public class LangConfig {
public String trappedFail = "Rescue not necessary or already rescuing";
public String trappedMove = "You moved. Aborting teleport";
public String unlockDropsCmd = "Your deathitems are protected. Use %s to unlock them for other players";
public String unlockDrops = "Your deathitems are now unlocked for %s ticks";
public String unlockDropsMulti = "Unlocked drops for %s";
public String unlockDropsCmd = "Your deathitems are protected. Use %1$s to unlock them for other players";
public String unlockDrops = "Your deathitems are now unlocked for %1$s ticks";
public String unlockDropsMulti = "Unlocked drops for %1$s";
public String claimNameSet = "Claims name set to %s";
public String claimNameSet = "Claims name set to %1$s";
public String claimNameUsed = "The owner of the claim already has another claim with the same name";
public String claimNameUsedSub = "One of the subclaim of this claim already has this name";
public String setHome = "Claim home set to [x=%s,y=%s,z=%s]";
public String setHome = "Claim home set to [x=%1$s,y=%2$s,z=%3$s]";
public String teleportHome = "Teleporting to claim home. Don't move for 5 seconds";
public String teleportHomeFail = "Teleport already happening";
public String setEnterMessage = "Set enter title to %s";
public String setEnterSubMessage = "Set enter subtitle to %s";
public String setLeaveMessage = "Set leave title to %s";
public String setLeaveSubMessage = "Set leave subtitle to %s";
public String setEnterMessage = "Set enter title to %1$s";
public String setEnterSubMessage = "Set enter subtitle to %1$s";
public String setLeaveMessage = "Set leave title to %1$s";
public String setLeaveSubMessage = "Set leave subtitle to %1$s";
public String wiki = "For more info check out the wiki:";

View File

@ -41,7 +41,7 @@ public class ClaimTextHandler extends ServerOnlyScreenHandler<Claim> {
@Override
public Text getDisplayName() {
return PermHelper.simpleColoredText(claim.parentClaim() != null ? ConfigHandler.lang.screenMenuSub : ConfigHandler.lang.screenMenu);
return PermHelper.simpleColoredText(claim.parentClaim() != null ? ConfigHandler.lang.screenTitleEditorSub : ConfigHandler.lang.screenTitleEditor);
}
};
player.openHandledScreen(fac);

View File

@ -75,7 +75,7 @@ public class GroupPlayerScreenHandler extends ServerOnlyScreenHandler<ClaimGroup
inv.updateStack(i, stack);
} else if (i == 4) {
ItemStack stack = new ItemStack(Items.REDSTONE_BLOCK);
stack.setCustomName(ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.lang.screenRemoveMode, this.removeMode), Formatting.DARK_RED));
stack.setCustomName(ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.lang.screenRemoveMode, this.removeMode ? ConfigHandler.lang.screenTrue : ConfigHandler.lang.screenFalse), Formatting.DARK_RED));
inv.updateStack(i, stack);
} else if (i < 9 || i > 44 || i % 9 == 0 || i % 9 == 8)
inv.updateStack(i, ServerScreenHelper.emptyFiller());
@ -130,7 +130,7 @@ public class GroupPlayerScreenHandler extends ServerOnlyScreenHandler<ClaimGroup
if (index == 4) {
this.removeMode = !this.removeMode;
ItemStack stack = new ItemStack(Items.REDSTONE_BLOCK);
stack.setCustomName(ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.lang.screenRemoveMode, this.removeMode), Formatting.DARK_RED));
stack.setCustomName(ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.lang.screenRemoveMode, this.removeMode ? ConfigHandler.lang.screenTrue : ConfigHandler.lang.screenFalse), Formatting.DARK_RED));
slot.setStack(stack);
ServerScreenHelper.playSongToPlayer(player, SoundEvents.UI_BUTTON_CLICK, 1, 1f);
return true;

View File

@ -3,6 +3,7 @@ package io.github.flemmli97.flan.gui;
import io.github.flemmli97.flan.api.permission.PermissionRegistry;
import io.github.flemmli97.flan.claim.Claim;
import io.github.flemmli97.flan.claim.PermHelper;
import io.github.flemmli97.flan.config.ConfigHandler;
import io.github.flemmli97.flan.gui.inv.SeparateInv;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
@ -38,7 +39,7 @@ public class GroupScreenHandler extends ServerOnlyScreenHandler<Claim> {
@Override
public Text getDisplayName() {
return PermHelper.simpleColoredText("Claim-Groups");
return PermHelper.simpleColoredText(ConfigHandler.lang.screenGroups);
}
};
player.openHandledScreen(fac);
@ -48,16 +49,16 @@ public class GroupScreenHandler extends ServerOnlyScreenHandler<Claim> {
protected void fillInventoryWith(PlayerEntity player, SeparateInv inv, Claim claim) {
for (int i = 0; i < 54; i++) {
if (i == 0) {
ItemStack close = new ItemStack(Items.TNT);
close.setCustomName(ServerScreenHelper.coloredGuiText("Back", Formatting.DARK_RED));
inv.updateStack(i, close);
ItemStack stack = new ItemStack(Items.TNT);
stack.setCustomName(ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenBack, Formatting.DARK_RED));
inv.updateStack(i, stack);
} else if (i == 3) {
ItemStack stack = new ItemStack(Items.ANVIL);
stack.setCustomName(ServerScreenHelper.coloredGuiText("Add", Formatting.DARK_GREEN));
stack.setCustomName(ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenAdd, Formatting.DARK_GREEN));
inv.updateStack(i, stack);
} else if (i == 4) {
ItemStack stack = new ItemStack(Items.REDSTONE_BLOCK);
stack.setCustomName(ServerScreenHelper.coloredGuiText("Remove Mode: " + this.removeMode, Formatting.DARK_RED));
stack.setCustomName(ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.lang.screenRemoveMode, this.removeMode ? ConfigHandler.lang.screenTrue : ConfigHandler.lang.screenFalse), Formatting.DARK_RED));
inv.updateStack(i, stack);
} else if (i < 9 || i > 44 || i % 9 == 0 || i % 9 == 8)
inv.updateStack(i, ServerScreenHelper.emptyFiller());
@ -105,7 +106,7 @@ public class GroupScreenHandler extends ServerOnlyScreenHandler<Claim> {
if (index == 4) {
this.removeMode = !this.removeMode;
ItemStack stack = new ItemStack(Items.REDSTONE_BLOCK);
stack.setCustomName(ServerScreenHelper.coloredGuiText("Remove Mode: " + this.removeMode, Formatting.DARK_RED));
stack.setCustomName(ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.lang.screenRemoveMode, this.removeMode ? ConfigHandler.lang.screenTrue : ConfigHandler.lang.screenFalse), Formatting.DARK_RED));
slot.setStack(stack);
ServerScreenHelper.playSongToPlayer(player, SoundEvents.UI_BUTTON_CLICK, 1, 1f);
return true;

View File

@ -53,7 +53,7 @@ public class PermissionScreenHandler extends ServerOnlyScreenHandler<ClaimGroup>
@Override
public Text getDisplayName() {
return PermHelper.simpleColoredText(group == null ? "Global-Permissions" : String.format("%s-Permissions", group));
return PermHelper.simpleColoredText(group == null ? ConfigHandler.lang.screenGlobalPerms : String.format(ConfigHandler.lang.screenGroupPerms, group));
}
};
player.openHandledScreen(fac);

View File

@ -58,7 +58,7 @@ public class PersonalGroupScreenHandler extends ServerOnlyScreenHandler<Object>
inv.updateStack(i, stack);
} else if (i == 4) {
ItemStack stack = new ItemStack(Items.REDSTONE_BLOCK);
stack.setCustomName(ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.lang.screenRemoveMode, this.removeMode), Formatting.DARK_RED));
stack.setCustomName(ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.lang.screenRemoveMode, this.removeMode ? ConfigHandler.lang.screenTrue : ConfigHandler.lang.screenFalse), Formatting.DARK_RED));
inv.updateStack(i, stack);
} else if (i < 9 || i > 44 || i % 9 == 0 || i % 9 == 8)
inv.updateStack(i, ServerScreenHelper.emptyFiller());
@ -106,7 +106,7 @@ public class PersonalGroupScreenHandler extends ServerOnlyScreenHandler<Object>
if (index == 4) {
this.removeMode = !this.removeMode;
ItemStack stack = new ItemStack(Items.REDSTONE_BLOCK);
stack.setCustomName(ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.lang.screenRemoveMode, this.removeMode), Formatting.DARK_RED));
stack.setCustomName(ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.lang.screenRemoveMode, this.removeMode ? ConfigHandler.lang.screenTrue : ConfigHandler.lang.screenFalse), Formatting.DARK_RED));
slot.setStack(stack);
ServerScreenHelper.playSongToPlayer(player, SoundEvents.UI_BUTTON_CLICK, 1, 1f);
return true;

View File

@ -4,6 +4,7 @@ import com.google.common.collect.Lists;
import io.github.flemmli97.flan.CrossPlatformStuff;
import io.github.flemmli97.flan.claim.Claim;
import io.github.flemmli97.flan.claim.PermHelper;
import io.github.flemmli97.flan.config.ConfigHandler;
import io.github.flemmli97.flan.gui.inv.SeparateInv;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffectInstance;
@ -49,7 +50,7 @@ public class PotionEditScreenHandler extends ServerOnlyScreenHandler<Claim> {
@Override
public Text getDisplayName() {
return PermHelper.simpleColoredText("Claim Potions");
return PermHelper.simpleColoredText(ConfigHandler.lang.screenPotions);
}
};
player.openHandledScreen(fac);
@ -63,15 +64,15 @@ public class PotionEditScreenHandler extends ServerOnlyScreenHandler<Claim> {
for (int i = 0; i < 54; i++) {
if (i == 0) {
ItemStack close = new ItemStack(Items.TNT);
close.setCustomName(ServerScreenHelper.coloredGuiText("Back", Formatting.DARK_RED));
close.setCustomName(ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenBack, Formatting.DARK_RED));
inv.updateStack(i, close);
} else if (i == 3) {
ItemStack stack = new ItemStack(Items.ANVIL);
stack.setCustomName(ServerScreenHelper.coloredGuiText("Add", Formatting.DARK_GREEN));
stack.setCustomName(ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenAdd, Formatting.DARK_GREEN));
inv.updateStack(i, stack);
} else if (i == 4) {
ItemStack stack = new ItemStack(Items.REDSTONE_BLOCK);
stack.setCustomName(ServerScreenHelper.coloredGuiText("Remove Mode: " + this.removeMode, Formatting.DARK_RED));
stack.setCustomName(ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.lang.screenRemoveMode, this.removeMode ? ConfigHandler.lang.screenTrue : ConfigHandler.lang.screenFalse), Formatting.DARK_RED));
inv.updateStack(i, stack);
} else if (i < 9 || i > 44 || i % 9 == 0 || i % 9 == 8)
inv.updateStack(i, ServerScreenHelper.emptyFiller());
@ -136,7 +137,7 @@ public class PotionEditScreenHandler extends ServerOnlyScreenHandler<Claim> {
if (index == 4) {
this.removeMode = !this.removeMode;
ItemStack stack = new ItemStack(Items.REDSTONE_BLOCK);
stack.setCustomName(ServerScreenHelper.coloredGuiText("Remove Mode: " + this.removeMode, Formatting.DARK_RED));
stack.setCustomName(ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.lang.screenRemoveMode, this.removeMode ? ConfigHandler.lang.screenTrue : ConfigHandler.lang.screenFalse), Formatting.DARK_RED));
slot.setStack(stack);
ServerScreenHelper.playSongToPlayer(player, SoundEvents.UI_BUTTON_CLICK, 1, 1f);
return true;

View File

@ -44,8 +44,8 @@ public class ServerScreenHelper {
if (!claim.isAdminClaim() && !global.canModify()) {
Text text = ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenUneditable, Formatting.DARK_RED);
lore.add(text);
String permFlag = String.valueOf(global.getValue());
Text text2 = ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.lang.screenEnableText, permFlag), permFlag.equals("true") ? Formatting.GREEN : Formatting.RED);
String permFlag = global.getValue() ? ConfigHandler.lang.screenTrue : ConfigHandler.lang.screenFalse;
Text text2 = ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.lang.screenEnableText, permFlag), permFlag.equals(ConfigHandler.lang.screenTrue) ? Formatting.GREEN : Formatting.RED);
lore.add(text2);
} else {
String permFlag;
@ -55,30 +55,30 @@ public class ServerScreenHelper {
else {
switch (claim.permEnabled(perm)) {
case -1:
permFlag = "default";
permFlag = ConfigHandler.lang.screenDefault;
break;
case 1:
permFlag = "true";
permFlag = ConfigHandler.lang.screenTrue;
break;
default:
permFlag = "false";
permFlag = ConfigHandler.lang.screenFalse;
break;
}
}
} else {
switch (claim.groupHasPerm(group, perm)) {
case -1:
permFlag = "default";
permFlag = ConfigHandler.lang.screenDefault;
break;
case 1:
permFlag = "true";
permFlag = ConfigHandler.lang.screenTrue;
break;
default:
permFlag = "false";
permFlag = ConfigHandler.lang.screenFalse;
break;
}
}
Text text = ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.lang.screenEnableText, permFlag), permFlag.equals("true") ? Formatting.GREEN : Formatting.RED);
Text text = ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.lang.screenEnableText, permFlag), permFlag.equals(ConfigHandler.lang.screenTrue) ? Formatting.GREEN : Formatting.RED);
lore.add(text);
}
addLore(stack, lore);
@ -98,16 +98,16 @@ public class ServerScreenHelper {
Text text = ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenUneditable, Formatting.DARK_RED);
lore.add(StringTag.of(Text.Serializer.toJson(text)));
String permFlag = String.valueOf(global.getValue());
Text text2 = ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.lang.screenEnableText, permFlag), permFlag.equals("true") ? Formatting.GREEN : Formatting.RED);
Text text2 = ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.lang.screenEnableText, permFlag), permFlag.equals(ConfigHandler.lang.screenTrue) ? Formatting.GREEN : Formatting.RED);
lore.add(StringTag.of(Text.Serializer.toJson(text2)));
} else {
String permFlag;
Map<ClaimPermission, Boolean> map = PlayerClaimData.get(player).playerDefaultGroups().getOrDefault(group, new HashMap<>());
if (map.containsKey(perm))
permFlag = map.get(perm) ? "true" : "false";
permFlag = map.get(perm) ? ConfigHandler.lang.screenTrue : ConfigHandler.lang.screenFalse;
else
permFlag = "default";
Text text = ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.lang.screenEnableText, permFlag), permFlag.equals("true") ? Formatting.GREEN : Formatting.RED);
permFlag = ConfigHandler.lang.screenDefault;
Text text = ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.lang.screenEnableText, permFlag), permFlag.equals(ConfigHandler.lang.screenTrue) ? Formatting.GREEN : Formatting.RED);
lore.add(StringTag.of(Text.Serializer.toJson(text)));
}
stack.getOrCreateSubTag("display").put("Lore", lore);

View File

@ -13,7 +13,6 @@ import io.github.flemmli97.flan.player.PlayerDataHandler;
import io.github.flemmli97.flan.scoreboard.ClaimCriterias;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerEntityEvents;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
import net.fabricmc.fabric.api.event.player.AttackBlockCallback;
@ -37,7 +36,7 @@ public class FlanFabric implements ModInitializer {
ServerLifecycleEvents.SERVER_STARTING.register(FlanFabric::serverLoad);
ServerLifecycleEvents.SERVER_STARTED.register(FlanFabric::serverFinishLoad);
ServerTickEvents.START_SERVER_TICK.register(WorldEvents::serverTick);
ServerPlayConnectionEvents.DISCONNECT.register((handler,server)->PlayerEvents.onLogout(handler.player));
ServerPlayConnectionEvents.DISCONNECT.register((handler, server) -> PlayerEvents.onLogout(handler.player));
CommandRegistrationCallback.EVENT.register(CommandClaim::register);
Flan.permissionAPI = FabricLoader.getInstance().isModLoaded("fabric-permissions-api-v0");

View File

@ -43,7 +43,7 @@ public class ServerEvents {
}
public static void serverTick(TickEvent.WorldTickEvent event) {
if(event.phase == TickEvent.Phase.START && event.world.getServer() != null && event.world.getRegistryKey() == World.OVERWORLD)
if (event.phase == TickEvent.Phase.START && event.world.getServer() != null && event.world.getRegistryKey() == World.OVERWORLD)
LogoutTracker.getInstance(event.world.getServer()).tick();
}
}