Merge remote-tracking branch 'origin/1.18-dev' into 1.18
# Conflicts: # forge/src/main/java/io/github/flemmli97/flan/forgeevent/BlockInteractEventsForge.java
This commit is contained in:
commit
df3f4eb088
@ -10,7 +10,7 @@ import java.util.function.Supplier;
|
||||
public class ClaimPermission {
|
||||
|
||||
private final Supplier<ItemStack> guiItem;
|
||||
public String[] desc;
|
||||
public final String[] desc;
|
||||
public final String id;
|
||||
public final ClaimTest test;
|
||||
public final boolean defaultVal;
|
||||
|
@ -247,7 +247,7 @@ public class Claim implements IPermissionContainer {
|
||||
if (flag != ClaimPermission.PermissionFlag.PASS) {
|
||||
if (flag == ClaimPermission.PermissionFlag.NO) {
|
||||
if (message)
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.noPermissionSimple, ChatFormatting.DARK_RED), true);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("noPermissionSimple"), ChatFormatting.DARK_RED), true);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -259,7 +259,7 @@ public class Claim implements IPermissionContainer {
|
||||
if (global.getValue() || (player != null && this.isAdminIgnore(player)))
|
||||
return true;
|
||||
if (message)
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.noPermissionSimple, ChatFormatting.DARK_RED), true);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("noPermissionSimple"), ChatFormatting.DARK_RED), true);
|
||||
return false;
|
||||
}
|
||||
if (ConfigHandler.config.offlineProtectActivation != -1 && (LogoutTracker.getInstance(this.world.getServer()).justLoggedOut(this.getOwner()) || this.getOwnerPlayer().isPresent())) {
|
||||
@ -275,7 +275,7 @@ public class Claim implements IPermissionContainer {
|
||||
if (this.hasPerm(perm))
|
||||
return true;
|
||||
if (message)
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.noPermissionSimple, ChatFormatting.DARK_RED), true);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("noPermissionSimple"), ChatFormatting.DARK_RED), true);
|
||||
return false;
|
||||
}
|
||||
if (this.isAdminIgnore(player) || player.getUUID().equals(this.owner))
|
||||
@ -292,14 +292,14 @@ public class Claim implements IPermissionContainer {
|
||||
if (map.get(perm))
|
||||
return true;
|
||||
if (message)
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.noPermissionSimple, ChatFormatting.DARK_RED), true);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("noPermissionSimple"), ChatFormatting.DARK_RED), true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (this.hasPerm(perm))
|
||||
return true;
|
||||
if (message)
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.noPermissionSimple, ChatFormatting.DARK_RED), true);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("noPermissionSimple"), ChatFormatting.DARK_RED), true);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -735,20 +735,20 @@ public class Claim implements IPermissionContainer {
|
||||
String ownerName = this.isAdminClaim() ? "Admin" : player.getServer().getProfileCache().get(this.owner).map(GameProfile::getName).orElse("<UNKNOWN>");
|
||||
if (this.parent == null) {
|
||||
if (this.claimName.isEmpty())
|
||||
l.add(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.claimBasicInfo, ownerName, this.minX, this.minZ, this.maxX, this.maxZ, this.subClaims.size()), ChatFormatting.GOLD));
|
||||
l.add(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("claimBasicInfo"), ownerName, this.minX, this.minZ, this.maxX, this.maxZ, this.subClaims.size()), ChatFormatting.GOLD));
|
||||
else
|
||||
l.add(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.claimBasicInfoNamed, ownerName, this.minX, this.minZ, this.maxX, this.maxZ, this.subClaims.size(), this.claimName), ChatFormatting.GOLD));
|
||||
l.add(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("claimBasicInfoNamed"), ownerName, this.minX, this.minZ, this.maxX, this.maxZ, this.subClaims.size(), this.claimName), ChatFormatting.GOLD));
|
||||
} else {
|
||||
if (this.claimName.isEmpty())
|
||||
l.add(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.claimBasicInfoSub, ownerName, this.minX, this.minZ, this.maxX, this.maxZ), ChatFormatting.GOLD));
|
||||
l.add(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("claimBasicInfoSub"), ownerName, this.minX, this.minZ, this.maxX, this.maxZ), ChatFormatting.GOLD));
|
||||
else
|
||||
l.add(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.claimBasicInfoSubNamed, ownerName, this.minX, this.minZ, this.maxX, this.maxZ, this.claimName), ChatFormatting.GOLD));
|
||||
l.add(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("claimBasicInfoSubNamed"), ownerName, this.minX, this.minZ, this.maxX, this.maxZ, this.claimName), ChatFormatting.GOLD));
|
||||
}
|
||||
if (perms) {
|
||||
if (infoType == InfoType.ALL || infoType == InfoType.GLOBAL)
|
||||
l.add(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.claimInfoPerms, this.globalPerm), ChatFormatting.RED));
|
||||
l.add(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("claimInfoPerms"), this.globalPerm), ChatFormatting.RED));
|
||||
if (infoType == InfoType.ALL || infoType == InfoType.GROUP) {
|
||||
l.add(PermHelper.simpleColoredText(ConfigHandler.lang.claimGroupInfoHeader, ChatFormatting.RED));
|
||||
l.add(PermHelper.simpleColoredText(ConfigHandler.langManager.get("claimGroupInfoHeader"), ChatFormatting.RED));
|
||||
Map<String, List<String>> nameToGroup = new HashMap<>();
|
||||
for (Map.Entry<UUID, String> e : this.playersGroups.entrySet()) {
|
||||
player.getServer().getProfileCache().get(e.getKey()).ifPresent(pgroup ->
|
||||
@ -761,8 +761,8 @@ public class Claim implements IPermissionContainer {
|
||||
}
|
||||
for (Map.Entry<String, Map<ClaimPermission, Boolean>> e : this.permissions.entrySet()) {
|
||||
l.add(PermHelper.simpleColoredText(String.format(" %s:", e.getKey()), ChatFormatting.DARK_RED));
|
||||
l.add(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.claimGroupPerms, e.getValue()), ChatFormatting.RED));
|
||||
l.add(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.claimGroupPlayers, nameToGroup.getOrDefault(e.getKey(), new ArrayList<>())), ChatFormatting.RED));
|
||||
l.add(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("claimGroupPerms"), e.getValue()), ChatFormatting.RED));
|
||||
l.add(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("claimGroupPlayers"), nameToGroup.getOrDefault(e.getKey(), new ArrayList<>())), ChatFormatting.RED));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -87,15 +87,15 @@ public class ClaimStorage implements IPermissionStorage {
|
||||
if (conflicts.isEmpty()) {
|
||||
PlayerClaimData data = PlayerClaimData.get(player);
|
||||
if (claim.getPlane() < ConfigHandler.config.minClaimsize) {
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.minClaimSize, ConfigHandler.config.minClaimsize), ChatFormatting.RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("minClaimSize"), ConfigHandler.config.minClaimsize), ChatFormatting.RED), false);
|
||||
return false;
|
||||
}
|
||||
if (!data.isAdminIgnoreClaim() && ConfigHandler.config.maxClaims != -1 && !PermissionNodeHandler.permBelowEqVal(player, PermissionNodeHandler.permMaxClaims, this.playerClaimMap.getOrDefault(player.getUUID(), Sets.newHashSet()).size() + 1, ConfigHandler.config.maxClaims)) {
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.maxClaims, ChatFormatting.RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("maxClaims"), ChatFormatting.RED), false);
|
||||
return false;
|
||||
}
|
||||
if (!data.isAdminIgnoreClaim() && !data.canUseClaimBlocks(claim.getPlane())) {
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.notEnoughBlocks, ChatFormatting.RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("notEnoughBlocks"), ChatFormatting.RED), false);
|
||||
return false;
|
||||
}
|
||||
claim.setClaimID(this.generateUUID());
|
||||
@ -103,14 +103,14 @@ public class ClaimStorage implements IPermissionStorage {
|
||||
this.addClaim(claim);
|
||||
data.addDisplayClaim(claim, EnumDisplayType.MAIN, player.blockPosition().getY());
|
||||
data.updateScoreboard();
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.claimCreateSuccess, ChatFormatting.GOLD), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.claimBlocksFormat,
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("claimCreateSuccess"), ChatFormatting.GOLD), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("claimBlocksFormat"),
|
||||
data.getClaimBlocks(), data.getAdditionalClaims(), data.usedClaimBlocks()), ChatFormatting.GOLD), false);
|
||||
return true;
|
||||
}
|
||||
PlayerClaimData data = PlayerClaimData.get(player);
|
||||
conflicts.forEach(conf -> data.addDisplayClaim(conf, EnumDisplayType.CONFLICT, player.blockPosition().getY()));
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.conflictOther, ChatFormatting.RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("conflictOther"), ChatFormatting.RED), false);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -172,13 +172,13 @@ public class ClaimStorage implements IPermissionStorage {
|
||||
BlockPos opposite = new BlockPos(dims[0] == from.getX() ? dims[1] : dims[0], dims[4], dims[2] == from.getZ() ? dims[3] : dims[2]);
|
||||
Claim newClaim = new Claim(opposite, to, player.getUUID(), player.getLevel());
|
||||
if (newClaim.getPlane() < ConfigHandler.config.minClaimsize) {
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.minClaimSize, ConfigHandler.config.minClaimsize), ChatFormatting.RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("minClaimSize"), ConfigHandler.config.minClaimsize), ChatFormatting.RED), false);
|
||||
return false;
|
||||
}
|
||||
Set<Claim> conflicts = this.conflicts(newClaim, claim);
|
||||
if (!conflicts.isEmpty()) {
|
||||
conflicts.forEach(conf -> PlayerClaimData.get(player).addDisplayClaim(conf, EnumDisplayType.CONFLICT, player.blockPosition().getY()));
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.conflictOther, ChatFormatting.RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("conflictOther"), ChatFormatting.RED), false);
|
||||
return false;
|
||||
}
|
||||
int diff = newClaim.getPlane() - claim.getPlane();
|
||||
@ -197,12 +197,12 @@ public class ClaimStorage implements IPermissionStorage {
|
||||
data.addDisplayClaim(claim, EnumDisplayType.MAIN, player.blockPosition().getY());
|
||||
if (newData instanceof PlayerClaimData)
|
||||
((PlayerClaimData) newData).updateScoreboard();
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.resizeSuccess, ChatFormatting.GOLD), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.claimBlocksFormat,
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("resizeSuccess"), ChatFormatting.GOLD), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("claimBlocksFormat"),
|
||||
newData.getClaimBlocks(), newData.getAdditionalClaims(), newData.usedClaimBlocks()), ChatFormatting.GOLD), false);
|
||||
return true;
|
||||
}
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.notEnoughBlocks, ChatFormatting.RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("notEnoughBlocks"), ChatFormatting.RED), false);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -358,7 +358,7 @@ public class ClaimStorage implements IPermissionStorage {
|
||||
Yaml yml = new Yaml();
|
||||
File griefPrevention = server.getWorldPath(LevelResource.ROOT).resolve("plugins/GriefPreventionData/ClaimData").toFile();
|
||||
if (!griefPrevention.exists()) {
|
||||
src.sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.cantFindData, griefPrevention.getAbsolutePath()), ChatFormatting.DARK_RED), false);
|
||||
src.sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("cantFindData"), griefPrevention.getAbsolutePath()), ChatFormatting.DARK_RED), false);
|
||||
return false;
|
||||
}
|
||||
Map<File, List<File>> subClaimMap = new HashMap<>();
|
||||
@ -392,7 +392,7 @@ public class ClaimStorage implements IPermissionStorage {
|
||||
try {
|
||||
intFileMap.put(Integer.valueOf(f.getName().replace(".yml", "")), f);
|
||||
} catch (NumberFormatException e) {
|
||||
src.sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.errorFile, f.getName(), ChatFormatting.RED)), false);
|
||||
src.sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("errorFile"), f.getName(), ChatFormatting.RED)), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -425,7 +425,7 @@ public class ClaimStorage implements IPermissionStorage {
|
||||
parentClaim.getB().setClaimID(storage.generateUUID());
|
||||
storage.addClaim(parentClaim.getB());
|
||||
} else {
|
||||
src.sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.readConflict, parent.getName(), conflicts), ChatFormatting.DARK_RED), false);
|
||||
src.sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("readConflict"), parent.getName(), conflicts), ChatFormatting.DARK_RED), false);
|
||||
for (Claim claim : conflicts) {
|
||||
int[] dim = claim.getDimensions();
|
||||
MutableComponent text = PermHelper.simpleColoredText(String.format("@[x=%d;z=%d]", dim[0], dim[2]), ChatFormatting.RED);
|
||||
@ -434,7 +434,7 @@ public class ClaimStorage implements IPermissionStorage {
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
src.sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.errorFile, parent.getName(), ChatFormatting.RED)), false);
|
||||
src.sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("errorFile"), parent.getName(), ChatFormatting.RED)), false);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ public record GlobalClaim(ServerLevel world) implements IPermissionContainer {
|
||||
if (global.getValue())
|
||||
return true;
|
||||
if (message)
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.noPermissionSimple, ChatFormatting.DARK_RED), true);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("noPermissionSimple"), ChatFormatting.DARK_RED), true);
|
||||
return false;
|
||||
}
|
||||
return perm != PermissionRegistry.MOBSPAWN && perm != PermissionRegistry.ANIMALSPAWN;
|
||||
|
@ -31,7 +31,7 @@ public class PermHelper {
|
||||
}
|
||||
|
||||
public static void noClaimMessage(ServerPlayer player) {
|
||||
player.displayClientMessage(new TextComponent(ConfigHandler.lang.noClaim).setStyle(Style.EMPTY.applyFormat(ChatFormatting.DARK_RED)), false);
|
||||
player.displayClientMessage(new TextComponent(ConfigHandler.langManager.get("noClaim")).setStyle(Style.EMPTY.applyFormat(ChatFormatting.DARK_RED)), false);
|
||||
}
|
||||
|
||||
public static Consumer<Optional<Boolean>> genericNoPermMessage(ServerPlayer player) {
|
||||
@ -39,7 +39,7 @@ public class PermHelper {
|
||||
if (!b.isPresent())
|
||||
PermHelper.noClaimMessage(player);
|
||||
else if (!b.get())
|
||||
player.displayClientMessage(simpleColoredText(ConfigHandler.lang.noPermission, ChatFormatting.DARK_RED), false);
|
||||
player.displayClientMessage(simpleColoredText(ConfigHandler.langManager.get("noPermission"), ChatFormatting.DARK_RED), false);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ public class CommandClaim {
|
||||
|
||||
private static int reloadConfig(CommandContext<CommandSourceStack> context) {
|
||||
ConfigHandler.reloadConfigs(context.getSource().getServer());
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.configReload), true);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("configReload")), true);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -174,14 +174,14 @@ public class CommandClaim {
|
||||
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
Collection<GameProfile> profs = GameProfileArgument.getGameProfiles(context, "player");
|
||||
if (profs.size() != 1) {
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.onlyOnePlayer, ChatFormatting.RED), false);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("onlyOnePlayer"), ChatFormatting.RED), false);
|
||||
return 0;
|
||||
}
|
||||
GameProfile prof = profs.iterator().next();
|
||||
ClaimStorage storage = ClaimStorage.get(player.getLevel());
|
||||
Claim claim = storage.getClaimAt(player.blockPosition());
|
||||
if (claim == null) {
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.noClaim, ChatFormatting.RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("noClaim"), ChatFormatting.RED), false);
|
||||
return 0;
|
||||
}
|
||||
PlayerClaimData data = PlayerClaimData.get(player);
|
||||
@ -193,16 +193,16 @@ public class CommandClaim {
|
||||
enoughBlocks = newData.canUseClaimBlocks(claim.getPlane());
|
||||
}
|
||||
if (!enoughBlocks) {
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.ownerTransferNoBlocks, ChatFormatting.RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("ownerTransferNoBlocks"), ChatFormatting.RED), false);
|
||||
if (PermissionNodeHandler.perm(context.getSource(), PermissionNodeHandler.cmdAdminMode, true))
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.ownerTransferNoBlocksAdmin, ChatFormatting.RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("ownerTransferNoBlocksAdmin"), ChatFormatting.RED), false);
|
||||
return 0;
|
||||
}
|
||||
if (!storage.transferOwner(claim, player, prof.getId())) {
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.ownerTransferFail, ChatFormatting.RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("ownerTransferFail"), ChatFormatting.RED), false);
|
||||
return 0;
|
||||
}
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.ownerTransferSuccess, prof.getName()), ChatFormatting.GOLD), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("ownerTransferSuccess"), prof.getName()), ChatFormatting.GOLD), false);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -231,10 +231,10 @@ public class CommandClaim {
|
||||
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
PlayerClaimData data = PlayerClaimData.get(player);
|
||||
if (data.setTrappedRescue()) {
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.trappedRescue, ChatFormatting.GOLD), false);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("trappedRescue"), ChatFormatting.GOLD), false);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
} else {
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.trappedFail, ChatFormatting.RED), false);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("trappedFail"), ChatFormatting.RED), false);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -251,9 +251,9 @@ public class CommandClaim {
|
||||
if (!nameUsed) {
|
||||
String name = StringArgumentType.getString(context, "name");
|
||||
claim.setClaimName(name);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.claimNameSet, name), ChatFormatting.GOLD), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("claimNameSet"), name), ChatFormatting.GOLD), false);
|
||||
} else {
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.claimNameUsed, ChatFormatting.DARK_RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("claimNameUsed"), ChatFormatting.DARK_RED), false);
|
||||
}
|
||||
} else {
|
||||
Claim claim = ClaimStorage.get(player.getLevel()).getClaimAt(player.blockPosition());
|
||||
@ -264,9 +264,9 @@ public class CommandClaim {
|
||||
if (!nameUsed) {
|
||||
String name = StringArgumentType.getString(context, "name");
|
||||
sub.setClaimName(name);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.claimNameSet, name), ChatFormatting.GOLD), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("claimNameSet"), name), ChatFormatting.GOLD), false);
|
||||
} else {
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.claimNameUsedSub, ChatFormatting.DARK_RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("claimNameUsedSub"), ChatFormatting.DARK_RED), false);
|
||||
}
|
||||
} else if (claim.canInteract(player, PermissionRegistry.EDITPERMS, player.blockPosition())) {
|
||||
boolean nameUsed = ClaimStorage.get(player.getLevel()).allClaimsFromPlayer(claim.getOwner())
|
||||
@ -274,12 +274,12 @@ public class CommandClaim {
|
||||
if (!nameUsed) {
|
||||
String name = StringArgumentType.getString(context, "name");
|
||||
claim.setClaimName(name);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.claimNameSet, name), ChatFormatting.GOLD), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("claimNameSet"), name), ChatFormatting.GOLD), false);
|
||||
} else {
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.claimNameUsed, ChatFormatting.DARK_RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("claimNameUsed"), ChatFormatting.DARK_RED), false);
|
||||
}
|
||||
} else
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.noPermission, ChatFormatting.DARK_RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("noPermission"), ChatFormatting.DARK_RED), false);
|
||||
}
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
@ -288,7 +288,7 @@ public class CommandClaim {
|
||||
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
PlayerClaimData data = PlayerClaimData.get(player);
|
||||
data.unlockDeathItems();
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.unlockDrops, ConfigHandler.config.dropTicks), ChatFormatting.GOLD), false);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("unlockDrops"), ConfigHandler.config.dropTicks), ChatFormatting.GOLD), false);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -303,7 +303,7 @@ public class CommandClaim {
|
||||
success.add(prof.getName());
|
||||
}
|
||||
}
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.unlockDropsMulti, success), ChatFormatting.GOLD), false);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("unlockDropsMulti"), success), ChatFormatting.GOLD), false);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -322,14 +322,14 @@ public class CommandClaim {
|
||||
Claim claim = ClaimStorage.get(player.getLevel()).getClaimAt(player.blockPosition());
|
||||
PlayerClaimData data = PlayerClaimData.get(player);
|
||||
if (claim == null) {
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.noClaim, ChatFormatting.RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("noClaim"), ChatFormatting.RED), false);
|
||||
return 0;
|
||||
}
|
||||
if (data.getEditMode() == EnumEditMode.SUBCLAIM) {
|
||||
Claim sub = claim.getSubClaim(player.blockPosition());
|
||||
if (sub != null) {
|
||||
List<Component> info = sub.infoString(player, infoType);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.claimSubHeader, ChatFormatting.AQUA), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("claimSubHeader"), ChatFormatting.AQUA), false);
|
||||
for (Component text : info)
|
||||
player.displayClientMessage(text, false);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
@ -349,9 +349,9 @@ public class CommandClaim {
|
||||
if (!b.isPresent())
|
||||
PermHelper.noClaimMessage(player);
|
||||
else if (!b.get())
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.deleteClaimError, ChatFormatting.DARK_RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("deleteClaimError"), ChatFormatting.DARK_RED), false);
|
||||
else
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.deleteClaim, ChatFormatting.RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("deleteClaim"), ChatFormatting.RED), false);
|
||||
});
|
||||
if (!check)
|
||||
return 0;
|
||||
@ -367,11 +367,11 @@ public class CommandClaim {
|
||||
ClaimStorage storage = ClaimStorage.get(world);
|
||||
storage.allClaimsFromPlayer(player.getUUID()).forEach((claim) -> storage.deleteClaim(claim, true, PlayerClaimData.get(player).getEditMode(), player.getLevel()));
|
||||
}
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.deleteAllClaim, ChatFormatting.GOLD), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("deleteAllClaim"), ChatFormatting.GOLD), false);
|
||||
data.setConfirmDeleteAll(false);
|
||||
} else {
|
||||
data.setConfirmDeleteAll(true);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.deleteAllClaimConfirm, ChatFormatting.DARK_RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("deleteAllClaimConfirm"), ChatFormatting.DARK_RED), false);
|
||||
}
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
@ -381,21 +381,21 @@ public class CommandClaim {
|
||||
ClaimStorage storage = ClaimStorage.get(player.getLevel());
|
||||
Claim claim = storage.getClaimAt(player.blockPosition());
|
||||
if (claim == null) {
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.noClaim, ChatFormatting.RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("noClaim"), ChatFormatting.RED), false);
|
||||
return 0;
|
||||
}
|
||||
Claim sub = claim.getSubClaim(player.blockPosition());
|
||||
if (sub == null) {
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.noClaim, ChatFormatting.RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("noClaim"), ChatFormatting.RED), false);
|
||||
return 0;
|
||||
}
|
||||
boolean check = PermHelper.check(player, player.blockPosition(), claim, PermissionRegistry.EDITCLAIM, b -> {
|
||||
if (!b.isPresent())
|
||||
PermHelper.noClaimMessage(player);
|
||||
else if (!b.get())
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.deleteClaimError, ChatFormatting.DARK_RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("deleteClaimError"), ChatFormatting.DARK_RED), false);
|
||||
else
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.deleteSubClaim, ChatFormatting.DARK_RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("deleteSubClaim"), ChatFormatting.DARK_RED), false);
|
||||
});
|
||||
if (!check)
|
||||
return 0;
|
||||
@ -410,7 +410,7 @@ public class CommandClaim {
|
||||
return 0;
|
||||
List<Claim> subs = claim.getAllSubclaims();
|
||||
subs.forEach(claim::deleteSubClaim);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.deleteSubClaimAll, ChatFormatting.DARK_RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("deleteSubClaimAll"), ChatFormatting.DARK_RED), false);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -420,7 +420,7 @@ public class CommandClaim {
|
||||
|
||||
private static int listClaims(CommandContext<CommandSourceStack> context, Collection<GameProfile> profs) throws CommandSyntaxException {
|
||||
if (profs.size() != 1) {
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.onlyOnePlayer, ChatFormatting.RED), false);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("onlyOnePlayer"), ChatFormatting.RED), false);
|
||||
return 0;
|
||||
}
|
||||
GameProfile prof = profs.iterator().next();
|
||||
@ -440,15 +440,15 @@ public class CommandClaim {
|
||||
if (ConfigHandler.config.maxClaimBlocks != -1) {
|
||||
if (player != null) {
|
||||
PlayerClaimData data = PlayerClaimData.get(player);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.claimBlocksFormat,
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("claimBlocksFormat"),
|
||||
data.getClaimBlocks(), data.getAdditionalClaims(), data.usedClaimBlocks()), ChatFormatting.GOLD), false);
|
||||
} else {
|
||||
OfflinePlayerData data = new OfflinePlayerData(server, of);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.claimBlocksFormat,
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("claimBlocksFormat"),
|
||||
data.claimBlocks, data.getAdditionalClaims(), data.usedClaimBlocks()), ChatFormatting.GOLD), false);
|
||||
}
|
||||
}
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.listClaims, ChatFormatting.GOLD), false);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("listClaims"), ChatFormatting.GOLD), false);
|
||||
for (Map.Entry<Level, Collection<Claim>> entry : claims.entrySet())
|
||||
for (Claim claim : entry.getValue())
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(
|
||||
@ -460,7 +460,7 @@ public class CommandClaim {
|
||||
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
PlayerClaimData data = PlayerClaimData.get(player);
|
||||
data.setEditMode(data.getEditMode() == EnumEditMode.DEFAULT ? EnumEditMode.SUBCLAIM : EnumEditMode.DEFAULT);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.editMode, data.getEditMode()), ChatFormatting.GOLD), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("editMode"), data.getEditMode()), ChatFormatting.GOLD), false);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -468,7 +468,7 @@ public class CommandClaim {
|
||||
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
PlayerClaimData data = PlayerClaimData.get(player);
|
||||
data.setAdminIgnoreClaim(!data.isAdminIgnoreClaim());
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.adminMode, data.isAdminIgnoreClaim()), ChatFormatting.GOLD), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("adminMode"), data.isAdminIgnoreClaim()), ChatFormatting.GOLD), false);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -477,11 +477,11 @@ public class CommandClaim {
|
||||
ClaimStorage storage = ClaimStorage.get(src.getLevel());
|
||||
Claim claim = storage.getClaimAt(new BlockPos(src.getPosition()));
|
||||
if (claim == null) {
|
||||
src.sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.noClaim, ChatFormatting.RED), false);
|
||||
src.sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("noClaim"), ChatFormatting.RED), false);
|
||||
return 0;
|
||||
}
|
||||
storage.deleteClaim(claim, true, EnumEditMode.DEFAULT, src.getLevel());
|
||||
src.sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.deleteClaim, ChatFormatting.RED), true);
|
||||
src.sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("deleteClaim"), ChatFormatting.RED), true);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -491,7 +491,7 @@ public class CommandClaim {
|
||||
PlayerClaimData data = PlayerClaimData.get(player);
|
||||
if (!data.confirmedDeleteAll()) {
|
||||
data.setConfirmDeleteAll(true);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.deleteAllClaimConfirm, ChatFormatting.DARK_RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("deleteAllClaimConfirm"), ChatFormatting.DARK_RED), false);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
}
|
||||
@ -503,7 +503,7 @@ public class CommandClaim {
|
||||
}
|
||||
players.add(prof.getName());
|
||||
}
|
||||
src.sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.adminDeleteAll, players), ChatFormatting.GOLD), true);
|
||||
src.sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("adminDeleteAll"), players), ChatFormatting.GOLD), true);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -512,18 +512,18 @@ public class CommandClaim {
|
||||
ClaimStorage storage = ClaimStorage.get(player.getLevel());
|
||||
Claim claim = storage.getClaimAt(player.blockPosition());
|
||||
if (claim == null) {
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.noClaim, ChatFormatting.RED), false);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("noClaim"), ChatFormatting.RED), false);
|
||||
return 0;
|
||||
}
|
||||
storage.toggleAdminClaim(player, claim, BoolArgumentType.getBool(context, "toggle"));
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.setAdminClaim, claim.isAdminClaim()), ChatFormatting.GOLD), true);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("setAdminClaim"), claim.isAdminClaim()), ChatFormatting.GOLD), true);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
|
||||
private static int listAdminClaims(CommandContext<CommandSourceStack> context) {
|
||||
CommandSourceStack src = context.getSource();
|
||||
Collection<Claim> claims = ClaimStorage.get(src.getLevel()).getAdminClaims();
|
||||
src.sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.listAdminClaims, src.getLevel().dimension().location()), ChatFormatting.GOLD), false);
|
||||
src.sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("listAdminClaims"), src.getLevel().dimension().location()), ChatFormatting.GOLD), false);
|
||||
for (Claim claim : claims)
|
||||
src.sendSuccess(PermHelper.simpleColoredText(claim.formattedClaim(), ChatFormatting.YELLOW), false);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
@ -531,11 +531,11 @@ public class CommandClaim {
|
||||
|
||||
private static int readGriefPreventionData(CommandContext<CommandSourceStack> context) {
|
||||
CommandSourceStack src = context.getSource();
|
||||
src.sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.readGriefpreventionData, ChatFormatting.GOLD), true);
|
||||
src.sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("readGriefpreventionData"), ChatFormatting.GOLD), true);
|
||||
if (ClaimStorage.readGriefPreventionData(src.getServer(), src))
|
||||
src.sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.readGriefpreventionClaimDataSuccess, ChatFormatting.GOLD), true);
|
||||
src.sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("readGriefpreventionClaimDataSuccess"), ChatFormatting.GOLD), true);
|
||||
if (PlayerClaimData.readGriefPreventionPlayerData(src.getServer(), src))
|
||||
src.sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.readGriefpreventionPlayerDataSuccess, ChatFormatting.GOLD), true);
|
||||
src.sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("readGriefpreventionPlayerDataSuccess"), ChatFormatting.GOLD), true);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -552,7 +552,7 @@ public class CommandClaim {
|
||||
PlayerClaimData.editForOfflinePlayer(src.getServer(), prof.getId(), amount);
|
||||
players.add(prof.getName());
|
||||
}
|
||||
src.sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.giveClaimBlocks, players, amount), ChatFormatting.GOLD), true);
|
||||
src.sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("giveClaimBlocks"), players, amount), ChatFormatting.GOLD), true);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -575,17 +575,17 @@ public class CommandClaim {
|
||||
}
|
||||
if (remove) {
|
||||
if (claim.removePermGroup(player, group))
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.groupRemove, group), ChatFormatting.GOLD), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("groupRemove"), group), ChatFormatting.GOLD), false);
|
||||
else {
|
||||
PermHelper.genericNoPermMessage(player);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
if (claim.groups().contains(group)) {
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.groupExist, group), ChatFormatting.RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("groupExist"), group), ChatFormatting.RED), false);
|
||||
return 0;
|
||||
} else if (claim.editPerms(player, group, PermissionRegistry.EDITPERMS, -1))
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.groupAdd, group), ChatFormatting.GOLD), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("groupAdd"), group), ChatFormatting.GOLD), false);
|
||||
else {
|
||||
PermHelper.genericNoPermMessage(player);
|
||||
return 0;
|
||||
@ -626,9 +626,9 @@ public class CommandClaim {
|
||||
modified.add(prof.getName());
|
||||
}
|
||||
if (!modified.isEmpty())
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.playerModify, group, modified), ChatFormatting.GOLD), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("playerModify"), group, modified), ChatFormatting.GOLD), false);
|
||||
else
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.playerModifyNo, group, modified), ChatFormatting.RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("playerModifyNo"), group, modified), ChatFormatting.RED), false);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -666,7 +666,7 @@ public class CommandClaim {
|
||||
return 0;
|
||||
}
|
||||
if (!claim.canInteract(player, PermissionRegistry.EDITPERMS, player.blockPosition())) {
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.noPermission, ChatFormatting.DARK_RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("noPermission"), ChatFormatting.DARK_RED), false);
|
||||
return 0;
|
||||
}
|
||||
ClaimPermission perm;
|
||||
@ -676,16 +676,16 @@ public class CommandClaim {
|
||||
if (group != null && PermissionRegistry.globalPerms().contains(perm))
|
||||
throw new IllegalArgumentException();
|
||||
} catch (NullPointerException e) {
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.noSuchPerm, p), ChatFormatting.DARK_RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("noSuchPerm"), p), ChatFormatting.DARK_RED), false);
|
||||
return 0;
|
||||
}
|
||||
String setPerm = mode == 1 ? "true" : mode == 0 ? "false" : "default";
|
||||
if (group == null) {
|
||||
claim.editGlobalPerms(player, perm, mode);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.editPerm, perm, setPerm), ChatFormatting.GOLD), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("editPerm"), perm, setPerm), ChatFormatting.GOLD), false);
|
||||
} else {
|
||||
claim.editPerms(player, group, perm, mode);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.editPermGroup, perm, group, setPerm), ChatFormatting.GOLD), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("editPermGroup"), perm, group, setPerm), ChatFormatting.GOLD), false);
|
||||
}
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
@ -706,12 +706,12 @@ public class CommandClaim {
|
||||
if (PermissionRegistry.globalPerms().contains(perm))
|
||||
throw new IllegalArgumentException();
|
||||
} catch (NullPointerException e) {
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.noSuchPerm, p), ChatFormatting.DARK_RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("noSuchPerm"), p), ChatFormatting.DARK_RED), false);
|
||||
return 0;
|
||||
}
|
||||
String setPerm = mode == 1 ? "true" : mode == 0 ? "false" : "default";
|
||||
if (PlayerClaimData.get(player).editDefaultPerms(group, perm, mode))
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.editPersonalGroup, group, perm, setPerm), ChatFormatting.GOLD), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("editPersonalGroup"), group, perm, setPerm), ChatFormatting.GOLD), false);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -721,7 +721,7 @@ public class CommandClaim {
|
||||
if (claim == null)
|
||||
return 0;
|
||||
claim.setHomePos(player.blockPosition());
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.setHome, player.blockPosition().getX(), player.blockPosition().getY(), player.blockPosition().getZ()), ChatFormatting.GOLD), false);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("setHome"), player.blockPosition().getX(), player.blockPosition().getY(), player.blockPosition().getZ()), ChatFormatting.GOLD), false);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -746,12 +746,12 @@ public class CommandClaim {
|
||||
if (claim.canInteract(player, PermissionRegistry.TELEPORT, pos, false)) {
|
||||
PlayerClaimData data = PlayerClaimData.get(player);
|
||||
if (data.setTeleportTo(pos)) {
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.teleportHome, ChatFormatting.GOLD), false);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("teleportHome"), ChatFormatting.GOLD), false);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.teleportHomeFail, ChatFormatting.RED), false);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("teleportHomeFail"), ChatFormatting.RED), false);
|
||||
} else
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.noPermissionSimple, ChatFormatting.DARK_RED), false);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("noPermissionSimple"), ChatFormatting.DARK_RED), false);
|
||||
return 0;
|
||||
}).orElse(0);
|
||||
}
|
||||
@ -779,18 +779,18 @@ public class CommandClaim {
|
||||
if (enter) {
|
||||
if (sub) {
|
||||
claim.setEnterTitle(claim.enterTitle, text);
|
||||
feedback = ConfigHandler.lang.setEnterSubMessage;
|
||||
feedback = ConfigHandler.langManager.get("setEnterSubMessage");
|
||||
} else {
|
||||
claim.setEnterTitle(text, claim.enterSubtitle);
|
||||
feedback = ConfigHandler.lang.setEnterMessage;
|
||||
feedback = ConfigHandler.langManager.get("setEnterMessage");
|
||||
}
|
||||
} else {
|
||||
if (sub) {
|
||||
claim.setLeaveTitle(claim.leaveTitle, text);
|
||||
feedback = ConfigHandler.lang.setLeaveSubMessage;
|
||||
feedback = ConfigHandler.langManager.get("setLeaveSubMessage");
|
||||
} else {
|
||||
claim.setLeaveTitle(text, claim.leaveSubtitle);
|
||||
feedback = ConfigHandler.lang.setLeaveMessage;
|
||||
feedback = ConfigHandler.langManager.get("setLeaveMessage");
|
||||
}
|
||||
}
|
||||
String[] unf = feedback.split("%s", 2);
|
||||
|
@ -30,7 +30,7 @@ public class CommandHelp {
|
||||
int max = subCommands.size() / 8;
|
||||
if (page > max)
|
||||
page = max;
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.helpHeader, page), ChatFormatting.GOLD), false);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("helpHeader"), page), ChatFormatting.GOLD), false);
|
||||
for (int i = 8 * page; i < 8 * (page + 1); i++)
|
||||
if (i < subCommands.size()) {
|
||||
MutableComponent cmdText = PermHelper.simpleColoredText("- " + subCommands.get(i), ChatFormatting.GRAY);
|
||||
@ -57,18 +57,18 @@ public class CommandHelp {
|
||||
}
|
||||
|
||||
public static int helpCmd(CommandContext<CommandSourceStack> context, String command) {
|
||||
String[] cmdHelp = ConfigHandler.lang.cmdLang.getCommandHelp(command);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.helpCmdHeader, ChatFormatting.DARK_GREEN), false);
|
||||
String[] cmdHelp = ConfigHandler.langManager.getArray("command." + command);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("helpCmdHeader"), ChatFormatting.DARK_GREEN), false);
|
||||
for (int i = 0; i < cmdHelp.length; i++) {
|
||||
if (i == 0) {
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.helpCmdSyntax, cmdHelp[i]), ChatFormatting.GOLD), false);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("helpCmdSyntax"), cmdHelp[i]), ChatFormatting.GOLD), false);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(""), false);
|
||||
} else {
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(cmdHelp[i], ChatFormatting.GOLD), false);
|
||||
}
|
||||
}
|
||||
if (command.equals("help")) {
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.wiki, ChatFormatting.GOLD), false);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("wiki"), ChatFormatting.GOLD), false);
|
||||
MutableComponent wiki = PermHelper.simpleColoredText("https://github.com/Flemmli97/Flan/wiki", ChatFormatting.GREEN);
|
||||
wiki.setStyle(wiki.getStyle().withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://github.com/Flemmli97/Flan/wiki")));
|
||||
context.getSource().sendSuccess(wiki, false);
|
||||
|
@ -40,7 +40,7 @@ public class CommandHelpers {
|
||||
public static GameProfile singleProfile(CommandContext<CommandSourceStack> context, String arg) throws CommandSyntaxException {
|
||||
Collection<GameProfile> profs = GameProfileArgument.getGameProfiles(context, arg);
|
||||
if (profs.size() != 1) {
|
||||
throw new SimpleCommandExceptionType(() -> ConfigHandler.lang.onlyOnePlayer).create();
|
||||
throw new SimpleCommandExceptionType(() -> ConfigHandler.langManager.get("onlyOnePlayer")).create();
|
||||
}
|
||||
return profs.stream().findFirst().get();
|
||||
}
|
||||
|
@ -89,6 +89,8 @@ public class Config {
|
||||
|
||||
public boolean log;
|
||||
|
||||
public String lang = "default";
|
||||
|
||||
public int configVersion = 4;
|
||||
public int preConfigVersion;
|
||||
|
||||
|
@ -20,19 +20,19 @@ public class ConfigHandler {
|
||||
public static final Gson GSON = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create();
|
||||
|
||||
public static Config config;
|
||||
public static LangConfig lang;
|
||||
private static Map<ResourceKey<Level>, Path> claimSavePath = new HashMap<>();
|
||||
public static LangManager langManager;
|
||||
private static final Map<ResourceKey<Level>, Path> claimSavePath = new HashMap<>();
|
||||
private static Path playerSavePath;
|
||||
|
||||
public static void serverLoad(MinecraftServer server) {
|
||||
config = new Config(server);
|
||||
lang = new LangConfig(server);
|
||||
langManager = new LangManager();
|
||||
reloadConfigs(server);
|
||||
}
|
||||
|
||||
public static void reloadConfigs(MinecraftServer server) {
|
||||
config.load();
|
||||
lang.load();
|
||||
langManager.reload(config.lang);
|
||||
ObjectToPermissionMap.reload(server);
|
||||
}
|
||||
|
||||
|
@ -1,71 +0,0 @@
|
||||
package io.github.flemmli97.flan.config;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class LangCommands {
|
||||
|
||||
private final Map<String, String[]> commands = Config.createHashMap(map -> {
|
||||
map.put("help", new String[]{"help <page> | (cmd <command>)", "Shows all available commands or info for the given command."});
|
||||
map.put("menu", new String[]{"menu", "When standing in a claim you have permissions for opens the claim menu."});
|
||||
map.put("claimInfo", new String[]{"claimInfo", "Prints infos about the claim you're standing in."});
|
||||
map.put("delete", new String[]{"delete", "Deletes the current claim."});
|
||||
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 <player>", "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("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>) | 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."});
|
||||
map.put("buyBlocks", new String[]{"buyBlocks <amount>", "Buys <amount> claimblocks. Needs gunpowder currency installed."});
|
||||
map.put("trapped", new String[]{"trapped", "If in a claim not owned by the player attempts to teleport the player out of it after 5 seconds."});
|
||||
map.put("unlockDrops", new String[]{"unlockDrops <players>", "Unlocks dropped items from death so other players can pick them up too. Or all of the given players (needs OP)"});
|
||||
map.put("setHome", new String[]{"setHome", "Standing in a claim with sufficient permission sets that claims home to the players position"});
|
||||
map.put("teleport", new String[]{"teleport self | admin | (other <player>) (<claim name> | <claim uuid>)", "Teleport to the given claims home position. Use admin to teleport to admin claims"});
|
||||
map.put("name", new String[]{"name self <name>", "Sets the current claims name"});
|
||||
|
||||
map.put("reload", new String[]{"reload", "Reloads the config ingame."});
|
||||
map.put("adminMode", new String[]{"adminMode", "Switches to admin mode ignoring all claims."});
|
||||
map.put("readGriefPrevention", new String[]{"readGriefPreventionData", "Parses data from the GriefPrevention plugin to Flan"});
|
||||
map.put("setAdminClaim", new String[]{"setAdminClaim", "Sets a claim to an admin claim."});
|
||||
map.put("listAdminClaims", new String[]{"listAdminClaim", "Lists all admin claims in the current world."});
|
||||
map.put("adminDelete", new String[]{"adminDelete [all <player>]", "Force deletes the current claim or deletes all claims from the specified player."});
|
||||
map.put("giveClaimBlocks", new String[]{"giveClaimBlocks <amount>", "Gives a player additional claim blocks."});
|
||||
});
|
||||
|
||||
public void load(JsonObject obj) throws IllegalAccessException {
|
||||
obj.entrySet().forEach(e -> {
|
||||
String[] val;
|
||||
if (e.getValue().isJsonArray()) {
|
||||
JsonArray arr = e.getValue().getAsJsonArray();
|
||||
val = new String[arr.size()];
|
||||
for (int i = 0; i < arr.size(); i++)
|
||||
val[i] = arr.get(i).getAsString();
|
||||
} else {
|
||||
val = new String[1];
|
||||
val[0] = e.getValue().getAsString();
|
||||
}
|
||||
this.commands.put(e.getKey(), val);
|
||||
});
|
||||
}
|
||||
|
||||
public void save(JsonObject obj) throws IllegalAccessException {
|
||||
this.commands.forEach((cmd, val) -> {
|
||||
JsonArray arr = new JsonArray();
|
||||
if (val != null)
|
||||
for (String s : val)
|
||||
arr.add(s);
|
||||
obj.add(cmd, arr);
|
||||
});
|
||||
}
|
||||
|
||||
public String[] getCommandHelp(String command) {
|
||||
return this.commands.getOrDefault(command, new String[0]);
|
||||
}
|
||||
}
|
@ -1,243 +0,0 @@
|
||||
package io.github.flemmli97.flan.config;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParseException;
|
||||
import io.github.flemmli97.flan.CrossPlatformStuff;
|
||||
import io.github.flemmli97.flan.api.permission.ClaimPermission;
|
||||
import io.github.flemmli97.flan.api.permission.PermissionRegistry;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class LangConfig {
|
||||
|
||||
private File config;
|
||||
|
||||
public String noClaim = "There is no claim here.";
|
||||
public String inspectBlockOwner = "This is %1$s's claim";
|
||||
public String inspectNoClaim = "Nobody owns this block";
|
||||
public String claimBlocksFormat = "Claim Blocks: %1$d + (Bonus) %2$d; Used: %3$d";
|
||||
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: %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";
|
||||
|
||||
public String noPermission = "You don't have the required permissions to do that here!";
|
||||
public String noPermissionSimple = "Sorry you can't do that here!";
|
||||
|
||||
public String configReload = "Configs reloaded";
|
||||
|
||||
public String cantClaimHere = "Sorry you cant claim here";
|
||||
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 %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 %1$s-mode";
|
||||
public String stringScreenReturn = "Click on paper to go back";
|
||||
|
||||
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";
|
||||
public String playerGroupAddFail = "Couldn't add that player to the group either cause the player " +
|
||||
"is already in a group or no player matching the name was found";
|
||||
public String resizeClaim = "Resizing claim";
|
||||
public String resizeSuccess = "Resized Claims";
|
||||
public String claimCreateSuccess = "Created a new claim";
|
||||
public String subClaimCreateSuccess = "Created a new subclaim";
|
||||
public String deleteClaim = "Claim deleted";
|
||||
public String deleteAllClaimConfirm = "Are you sure you want to delete all claims? Type it again to confirm";
|
||||
public String deleteAllClaim = "All claims deleted";
|
||||
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 %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: %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 %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";
|
||||
|
||||
public String claimBasicInfo = "Owner: %1$s, from: [x=%2$d,z=%3$d] to [x=%4$d,z=%5$d]; Subclaim-amount: %6$d";
|
||||
public String claimBasicInfoNamed = "Claim: %7$s, Owner: %1$s, from: [x=%2$d,z=%3$d] to [x=%4$d,z=%5$d]; Subclaim-amount: %6$d";
|
||||
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: %1$s";
|
||||
public String claimGroupInfoHeader = "Groups: ";
|
||||
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: %1$s";
|
||||
|
||||
public String screenEnableText = "Enabled: %1$s";
|
||||
public String screenUneditable = "Non Editable!";
|
||||
public String screenClose = "Close";
|
||||
public String screenNext = "Next";
|
||||
public String screenPrevious = "Prev";
|
||||
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";
|
||||
public String screenMenuGlobal = "Edit Global Permissions";
|
||||
public String screenMenuGroup = "Edit Permissiongroups";
|
||||
public String screenMenuPotion = "Edit Potioneffects";
|
||||
public String screenMenuClaimText = "Edit Enter/Leave Text";
|
||||
public String screenMenuDelete = "Delete Claim";
|
||||
public String screenConfirm = "Confirm";
|
||||
public String screenYes = "Yes";
|
||||
public String screenNo = "No";
|
||||
public String screenGroupPlayers = "%1$s-Players";
|
||||
public String screenRemoveMode = "Remove Mode: %1$s";
|
||||
public String screenGlobalPerms = "Global-Permissions";
|
||||
public String screenGroups = "Claim-Groups";
|
||||
public String screenGroupPerms = "%1$s-Permissions";
|
||||
public String screenPersonalGroups = "Personal-Groups";
|
||||
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";
|
||||
public String buyFail = "Not enough money";
|
||||
public String sellSuccess = "Sold %1$s claimblocks for %2$s";
|
||||
public String buySuccess = "Bought %1$s claimblocks for %2$s";
|
||||
public String currencyMissing = "Missing a supported currency mod";
|
||||
|
||||
public String trappedRescue = "Rescuing. Don't move for 5 seconds";
|
||||
public String trappedFail = "Rescue not necessary or already rescuing";
|
||||
public String trappedMove = "You moved. Aborting teleport";
|
||||
|
||||
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 %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=%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 %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:";
|
||||
|
||||
public LangCommands cmdLang = new LangCommands();
|
||||
|
||||
public LangConfig(MinecraftServer server) {
|
||||
File configDir = CrossPlatformStuff.configPath().resolve("flan").toFile();
|
||||
//server.getSavePath(WorldSavePath.ROOT).resolve("config/claimConfigs").toFile();
|
||||
try {
|
||||
if (!configDir.exists())
|
||||
configDir.mkdirs();
|
||||
this.config = new File(configDir, "flan_lang.json");
|
||||
if (!this.config.exists()) {
|
||||
this.config.createNewFile();
|
||||
this.save();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void load() {
|
||||
try {
|
||||
FileReader reader = new FileReader(this.config);
|
||||
JsonObject obj = ConfigHandler.GSON.fromJson(reader, JsonObject.class);
|
||||
reader.close();
|
||||
for (Field field : this.getClass().getDeclaredFields()) {
|
||||
if (field.getType().equals(String.class) && obj.has(field.getName())) {
|
||||
field.set(this, obj.get(field.getName()).getAsString());
|
||||
}
|
||||
}
|
||||
for (ClaimPermission perm : PermissionRegistry.getPerms()) {
|
||||
if (obj.has(perm.id + ".desc")) {
|
||||
JsonElement pe = obj.get(perm.id + ".desc");
|
||||
if (pe.isJsonObject())
|
||||
throw new JsonParseException("Lang cant be json objects");
|
||||
if (pe.isJsonArray()) {
|
||||
String[] l = new String[pe.getAsJsonArray().size()];
|
||||
for (int i = 0; i < l.length; i++)
|
||||
l[i] = pe.getAsJsonArray().get(i).getAsString();
|
||||
perm.desc = l;
|
||||
} else
|
||||
perm.desc = new String[]{pe.getAsString()};
|
||||
}
|
||||
}
|
||||
JsonObject cmd = ConfigHandler.fromJson(obj, "commands");
|
||||
this.cmdLang.load(cmd);
|
||||
} catch (IOException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
this.save();
|
||||
}
|
||||
|
||||
private void save() {
|
||||
JsonObject obj = new JsonObject();
|
||||
try {
|
||||
for (Field field : this.getClass().getDeclaredFields()) {
|
||||
if (field.getType().equals(String.class)) {
|
||||
obj.addProperty(field.getName(), (String) field.get(this));
|
||||
}
|
||||
}
|
||||
for (ClaimPermission perm : PermissionRegistry.getPerms()) {
|
||||
if (perm.desc.length == 1)
|
||||
obj.addProperty(perm.id + ".desc", perm.desc[0]);
|
||||
else {
|
||||
JsonArray arr = new JsonArray();
|
||||
for (String s : perm.desc)
|
||||
arr.add(s);
|
||||
obj.add(perm.id + ".desc", arr);
|
||||
}
|
||||
}
|
||||
JsonObject cmd = new JsonObject();
|
||||
this.cmdLang.save(cmd);
|
||||
obj.add("commands", cmd);
|
||||
FileWriter writer = new FileWriter(this.config);
|
||||
ConfigHandler.GSON.toJson(obj, writer);
|
||||
writer.close();
|
||||
} catch (IOException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,343 @@
|
||||
package io.github.flemmli97.flan.config;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import io.github.flemmli97.flan.CrossPlatformStuff;
|
||||
import io.github.flemmli97.flan.api.permission.ClaimPermission;
|
||||
import io.github.flemmli97.flan.api.permission.PermissionRegistry;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.nio.file.FileSystemAlreadyExistsException;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class LangManager {
|
||||
|
||||
public static final Gson GSON = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create();
|
||||
|
||||
private final Map<String, String> defaultTranslation = new LinkedHashMap<>();
|
||||
private final Map<String, String[]> defaultTranslationArray = new LinkedHashMap<>();
|
||||
|
||||
private void loadDefault() {
|
||||
this.defaultTranslation.put("noClaim", "There is no claim here.");
|
||||
this.defaultTranslation.put("inspectBlockOwner", "This is %1$s's claim");
|
||||
this.defaultTranslation.put("inspectNoClaim", "Nobody owns this block");
|
||||
this.defaultTranslation.put("claimBlocksFormat", "Claim Blocks: %1$d + (Bonus) %2$d); Used: %3$d");
|
||||
this.defaultTranslation.put("listClaims", "Listing all claims:");
|
||||
this.defaultTranslation.put("listAdminClaims", "Listing all admin-claims in %1$s:");
|
||||
this.defaultTranslation.put("onlyOnePlayer", "Only one player can be used as argument");
|
||||
this.defaultTranslation.put("ownerTransferSuccess", "New Claimowner now: %1$s");
|
||||
this.defaultTranslation.put("ownerTransferFail", "Only the owner may transfer claims");
|
||||
this.defaultTranslation.put("ownerTransferNoBlocks", "The new owner doesnt have enough claimblocks");
|
||||
this.defaultTranslation.put("ownerTransferNoBlocksAdmin", "You can ignore this by switching to admin mode");
|
||||
|
||||
this.defaultTranslation.put("noPermission", "You don't have the required permissions to do that here!");
|
||||
this.defaultTranslation.put("noPermissionSimple", "Sorry you can't do that here!");
|
||||
|
||||
this.defaultTranslation.put("configReload", "Configs reloaded");
|
||||
|
||||
this.defaultTranslation.put("cantClaimHere", "Sorry you cant claim here");
|
||||
this.defaultTranslation.put("minClaimSize", "This is too small. Minimum claimsize is %d");
|
||||
this.defaultTranslation.put("maxClaims", "Maximum amount of claims reached");
|
||||
this.defaultTranslation.put("landClaimDisabledWorld", "Claiming is disabled in this world");
|
||||
this.defaultTranslation.put("editMode", "Editing mode set to %1$s");
|
||||
this.defaultTranslation.put("notEnoughBlocks", "Not enough claim blocks");
|
||||
this.defaultTranslation.put("conflictOther", "Claim would overlap other claims");
|
||||
this.defaultTranslation.put("wrongMode", "Wrong claim mode. You are in %1$s-mode");
|
||||
this.defaultTranslation.put("stringScreenReturn", "Click on paper to go back");
|
||||
|
||||
this.defaultTranslation.put("groupAdd", "Added group %1$s");
|
||||
this.defaultTranslation.put("groupRemove", "Removed group %1$s");
|
||||
this.defaultTranslation.put("groupExist", "Group already exist");
|
||||
this.defaultTranslation.put("playerModify", "Modified permission group for following players to %1$s: %2$s");
|
||||
this.defaultTranslation.put("playerModifyNo", "Couldn't set permission group for the players. Probably cause they already belong to a group");
|
||||
this.defaultTranslation.put("playerGroupAddFail", "Couldn't add that player to the group either cause the player " +
|
||||
"is already in a group or no player matching the name was found");
|
||||
this.defaultTranslation.put("resizeClaim", "Resizing claim");
|
||||
this.defaultTranslation.put("resizeSuccess", "Resized Claims");
|
||||
this.defaultTranslation.put("claimCreateSuccess", "Created a new claim");
|
||||
this.defaultTranslation.put("subClaimCreateSuccess", "Created a new subclaim");
|
||||
this.defaultTranslation.put("deleteClaim", "Claim deleted");
|
||||
this.defaultTranslation.put("deleteAllClaimConfirm", "Are you sure you want to delete all claims? Type it again to confirm");
|
||||
this.defaultTranslation.put("deleteAllClaim", "All claims deleted");
|
||||
this.defaultTranslation.put("deleteClaimError", "You can't delete this claim here");
|
||||
this.defaultTranslation.put("deleteSubClaim", "Subclaim deleted");
|
||||
this.defaultTranslation.put("deleteSubClaimAll", "All Subclaims from this claim deleted");
|
||||
this.defaultTranslation.put("noSuchPerm", "No such Permission %1$s");
|
||||
this.defaultTranslation.put("editPerm", "%1$s now set to %2$s");
|
||||
this.defaultTranslation.put("editPermGroup", "%1$s for %2$s now set to %3$s");
|
||||
this.defaultTranslation.put("editPersonalGroup", "Default permission %1$s for group %2$s now set to %3$s");
|
||||
|
||||
this.defaultTranslation.put("adminMode", "Adminmode (Ignore Claims) set to: %1$s");
|
||||
this.defaultTranslation.put("adminDeleteAll", "Deleted all claims for following players: %1$s");
|
||||
this.defaultTranslation.put("setAdminClaim", "Adminclaim of this claim now: %1$s");
|
||||
this.defaultTranslation.put("readGriefpreventionData", "Reading data from GriefPrevention");
|
||||
this.defaultTranslation.put("readGriefpreventionClaimDataSuccess", "Successfully read claim data");
|
||||
this.defaultTranslation.put("readGriefpreventionPlayerDataSuccess", "Successfully read player data");
|
||||
this.defaultTranslation.put("cantFindData", "No griefprevention data at %1$s");
|
||||
this.defaultTranslation.put("errorFile", "Error reading file %1$s");
|
||||
this.defaultTranslation.put("readConflict", "%1$s conflicts with existing claims. Not added to world! Conflicts:");
|
||||
this.defaultTranslation.put("giveClaimBlocks", "Gave following players %2$d claimblocks: %1$s");
|
||||
|
||||
this.defaultTranslation.put("claimBasicInfo", "Owner: %1$s, from: [x=%2$d,z=%3$d] to [x=%4$d,z=%5$d]); Subclaim-amount: %6$d");
|
||||
this.defaultTranslation.put("claimBasicInfoNamed", "Claim: %7$s, Owner: %1$s, from: [x=%2$d,z=%3$d] to [x=%4$d,z=%5$d]); Subclaim-amount: %6$d");
|
||||
this.defaultTranslation.put("claimSubHeader", "==SubclaimInfo==");
|
||||
this.defaultTranslation.put("claimBasicInfoSub", "Owner: %1$s, from: [x=%2$d,z=%3$d] to [x=%4$d,z=%5$d]");
|
||||
this.defaultTranslation.put("claimBasicInfoSubNamed", "Claim: %6$s, Owner: %1$s, from: [x=%2$d,z=%3$d] to [x=%4$d,z=%5$d]");
|
||||
this.defaultTranslation.put("claimInfoPerms", "Permissions: %1$s");
|
||||
this.defaultTranslation.put("claimGroupInfoHeader", "Groups: ");
|
||||
this.defaultTranslation.put("claimGroupPerms", " Permissions: %1$s");
|
||||
this.defaultTranslation.put("claimGroupPlayers", " Players: %1$s");
|
||||
this.defaultTranslation.put("helpHeader", "Available subcommands are (page %d):");
|
||||
this.defaultTranslation.put("helpCmdHeader", "====================");
|
||||
this.defaultTranslation.put("helpCmdSyntax", "Syntax: %1$s");
|
||||
|
||||
this.defaultTranslation.put("screenEnableText", "Enabled: %1$s");
|
||||
this.defaultTranslation.put("screenUneditable", "Non Editable!");
|
||||
this.defaultTranslation.put("screenClose", "Close");
|
||||
this.defaultTranslation.put("screenNext", "Next");
|
||||
this.defaultTranslation.put("screenPrevious", "Prev");
|
||||
this.defaultTranslation.put("screenAdd", "Add");
|
||||
this.defaultTranslation.put("screenBack", "Back");
|
||||
this.defaultTranslation.put("screenNoPerm", "No Permission");
|
||||
this.defaultTranslation.put("screenFalse", "false");
|
||||
this.defaultTranslation.put("screenTrue", "true");
|
||||
this.defaultTranslation.put("screenDefault", "default");
|
||||
|
||||
this.defaultTranslation.put("screenMenu", "Claim-Menu");
|
||||
this.defaultTranslation.put("screenMenuSub", "SubClaim-Menu");
|
||||
this.defaultTranslation.put("screenMenuGlobal", "Edit Global Permissions");
|
||||
this.defaultTranslation.put("screenMenuGroup", "Edit Permissiongroups");
|
||||
this.defaultTranslation.put("screenMenuPotion", "Edit Potioneffects");
|
||||
this.defaultTranslation.put("screenMenuClaimText", "Edit Enter/Leave Text");
|
||||
this.defaultTranslation.put("screenMenuDelete", "Delete Claim");
|
||||
this.defaultTranslation.put("screenConfirm", "Confirm");
|
||||
this.defaultTranslation.put("screenYes", "Yes");
|
||||
this.defaultTranslation.put("screenNo", "No");
|
||||
this.defaultTranslation.put("screenGroupPlayers", "%1$s-Players");
|
||||
this.defaultTranslation.put("screenRemoveMode", "Remove Mode: %1$s");
|
||||
this.defaultTranslation.put("screenGlobalPerms", "Global-Permissions");
|
||||
this.defaultTranslation.put("screenGroups", "Claim-Groups");
|
||||
this.defaultTranslation.put("screenGroupPerms", "%1$s-Permissions");
|
||||
this.defaultTranslation.put("screenPersonalGroups", "Personal-Groups");
|
||||
this.defaultTranslation.put("screenPersonalPermissions", "Personal Permissions for %1$s");
|
||||
this.defaultTranslation.put("screenPotions", "Claim Potions");
|
||||
this.defaultTranslation.put("screenTitleEditor", "Claim messages");
|
||||
this.defaultTranslation.put("screenTitleEditorSub", "Subclaim messages");
|
||||
this.defaultTranslation.put("screenEnterText", "Edit title text on enter. (Right-Click to use JSON text. See MC Wiki for that)");
|
||||
this.defaultTranslation.put("screenEnterSubText", "Edit subtitle text on enter. (Right-Click to use JSON text. See MC Wiki for that)");
|
||||
this.defaultTranslation.put("screenLeaveText", "Edit title text on leave. (Right-Click to use JSON text. See MC Wiki for that)");
|
||||
this.defaultTranslation.put("screenLeaveSubText", "Edit subtitle text on enter. (Right-Click to use JSON text. See MC Wiki for that)");
|
||||
|
||||
this.defaultTranslation.put("chatClaimTextEdit", "[Click for command]");
|
||||
|
||||
this.defaultTranslation.put("sellDisabled", "Claimblocks selling is disabled");
|
||||
this.defaultTranslation.put("buyDisabled", "Claimblocks purchasing is disabled");
|
||||
this.defaultTranslation.put("sellFail", "Not enough claimblocks to sell");
|
||||
this.defaultTranslation.put("buyFail", "Not enough money");
|
||||
this.defaultTranslation.put("sellSuccess", "Sold %1$s claimblocks for %2$s");
|
||||
this.defaultTranslation.put("buySuccess", "Bought %1$s claimblocks for %2$s");
|
||||
this.defaultTranslation.put("currencyMissing", "Missing a supported currency mod");
|
||||
|
||||
this.defaultTranslation.put("trappedRescue", "Rescuing. Don't move for 5 seconds");
|
||||
this.defaultTranslation.put("trappedFail", "Rescue not necessary or already rescuing");
|
||||
this.defaultTranslation.put("trappedMove", "You moved. Aborting teleport");
|
||||
|
||||
this.defaultTranslation.put("unlockDropsCmd", "Your deathitems are protected. Use %1$s to unlock them for other players");
|
||||
this.defaultTranslation.put("unlockDrops", "Your deathitems are now unlocked for %1$s ticks");
|
||||
this.defaultTranslation.put("unlockDropsMulti", "Unlocked drops for %1$s");
|
||||
|
||||
this.defaultTranslation.put("claimNameSet", "Claims name set to %1$s");
|
||||
this.defaultTranslation.put("claimNameUsed", "The owner of the claim already has another claim with the same name");
|
||||
this.defaultTranslation.put("claimNameUsedSub", "One of the subclaim of this claim already has this name");
|
||||
|
||||
this.defaultTranslation.put("setHome", "Claim home set to [x=%1$s,y=%2$s,z=%3$s]");
|
||||
this.defaultTranslation.put("teleportHome", "Teleporting to claim home. Don't move for 5 seconds");
|
||||
this.defaultTranslation.put("teleportHomeFail", "Teleport already happening");
|
||||
|
||||
this.defaultTranslation.put("setEnterMessage", "Set enter title to %1$s");
|
||||
this.defaultTranslation.put("setEnterSubMessage", "Set enter subtitle to %1$s");
|
||||
this.defaultTranslation.put("setLeaveMessage", "Set leave title to %1$s");
|
||||
this.defaultTranslation.put("setLeaveSubMessage", "Set leave subtitle to %1$s");
|
||||
|
||||
this.defaultTranslation.put("wiki", "For more info check out the wiki:");
|
||||
|
||||
for (ClaimPermission perm : PermissionRegistry.getPerms()) {
|
||||
this.defaultTranslationArray.put(perm.id + ".desc", perm.desc);
|
||||
}
|
||||
this.defaultTranslationArray.put("command.help", new String[]{"help <page> | (cmd <command>)", "Shows all available commands or info for the given command."});
|
||||
this.defaultTranslationArray.put("command.menu", new String[]{"menu", "When standing in a claim you have permissions for opens the claim menu."});
|
||||
this.defaultTranslationArray.put("command.claimInfo", new String[]{"claimInfo", "Prints infos about the claim you're standing in."});
|
||||
this.defaultTranslationArray.put("command.delete", new String[]{"delete", "Deletes the current claim."});
|
||||
this.defaultTranslationArray.put("command.deleteAll", new String[]{"deleteAll", "Deletes all your claims (you need to double type to confirm it so no accidents)."});
|
||||
this.defaultTranslationArray.put("command.deleteSubClaim", new String[]{"deleteSubClaim", "Deletes the current subclaim."});
|
||||
this.defaultTranslationArray.put("command.deleteAllSubClaims", new String[]{"deleteAllSubClaims", "Deletes all subclaim of the current claim."});
|
||||
this.defaultTranslationArray.put("command.list", new String[]{"list <player>", "Lists all claims you have. If op also gives ability to list other players claims."});
|
||||
this.defaultTranslationArray.put("command.switchMode", new String[]{"switchMode", "Switch between normal and subclaim mode."});
|
||||
this.defaultTranslationArray.put("command.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."});
|
||||
this.defaultTranslationArray.put("command.transferClaim", new String[]{"transferClaim <player>", "Gives ownership of the claim to the specified player. Only works if you're the claim owner."});
|
||||
this.defaultTranslationArray.put("command.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"});
|
||||
this.defaultTranslationArray.put("command.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)."});
|
||||
this.defaultTranslationArray.put("command.personalGroups", new String[]{"personalGroups", "Opens the gui to edit personal groups."});
|
||||
this.defaultTranslationArray.put("command.sellBlocks", new String[]{"sellBlocks <amount>", "Sells <amount> claimblocks. Needs gunpowder currency installed."});
|
||||
this.defaultTranslationArray.put("command.buyBlocks", new String[]{"buyBlocks <amount>", "Buys <amount> claimblocks. Needs gunpowder currency installed."});
|
||||
this.defaultTranslationArray.put("command.trapped", new String[]{"trapped", "If in a claim not owned by the player attempts to teleport the player out of it after 5 seconds."});
|
||||
this.defaultTranslationArray.put("command.unlockDrops", new String[]{"unlockDrops <players>", "Unlocks dropped items from death so other players can pick them up too. Or all of the given players (needs OP)"});
|
||||
this.defaultTranslationArray.put("command.setHome", new String[]{"setHome", "Standing in a claim with sufficient permission sets that claims home to the players position"});
|
||||
this.defaultTranslationArray.put("command.teleport", new String[]{"teleport self | admin | (other <player>) (<claim name> | <claim uuid>)", "Teleport to the given claims home position. Use admin to teleport to admin claims"});
|
||||
this.defaultTranslationArray.put("command.name", new String[]{"name self <name>", "Sets the current claims name"});
|
||||
|
||||
this.defaultTranslationArray.put("command.reload", new String[]{"reload", "Reloads the config ingame."});
|
||||
this.defaultTranslationArray.put("command.adminMode", new String[]{"adminMode", "Switches to admin mode ignoring all claims."});
|
||||
this.defaultTranslationArray.put("command.readGriefPrevention", new String[]{"readGriefPreventionData", "Parses data from the GriefPrevention plugin to Flan"});
|
||||
this.defaultTranslationArray.put("command.setAdminClaim", new String[]{"setAdminClaim", "Sets a claim to an admin claim."});
|
||||
this.defaultTranslationArray.put("command.listAdminClaims", new String[]{"listAdminClaim", "Lists all admin claims in the current world."});
|
||||
this.defaultTranslationArray.put("command.adminDelete", new String[]{"adminDelete [all <player>]", "Force deletes the current claim or deletes all claims from the specified player."});
|
||||
this.defaultTranslationArray.put("command.giveClaimBlocks", new String[]{"giveClaimBlocks <amount>", "Gives a player additional claim blocks."});
|
||||
}
|
||||
|
||||
private final Map<String, String> translation = new LinkedHashMap<>();
|
||||
private final Map<String, String[]> translationArr = new LinkedHashMap<>();
|
||||
|
||||
private final Path confDir;
|
||||
|
||||
public LangManager() {
|
||||
this.loadDefault();
|
||||
Path configDir = CrossPlatformStuff.configPath().resolve("flan").resolve("lang");
|
||||
this.confDir = configDir;
|
||||
try {
|
||||
File dir = configDir.toFile();
|
||||
if (!dir.exists())
|
||||
dir.mkdirs();
|
||||
URL url = LangManager.class.getClassLoader().getResource("data/flan/lang");
|
||||
if (url != null) {
|
||||
URI uri = LangManager.class.getClassLoader().getResource("data/flan/lang").toURI();
|
||||
try {
|
||||
FileSystems.newFileSystem(uri, Collections.emptyMap());
|
||||
} catch (FileSystemAlreadyExistsException | IllegalArgumentException ignored) {
|
||||
}
|
||||
Files.walk(Path.of(uri))
|
||||
.filter(p -> p.toString().endsWith(".json"))
|
||||
.forEach(p -> {
|
||||
try {
|
||||
InputStream s = Files.newInputStream(p, StandardOpenOption.READ);
|
||||
File target = configDir.resolve(p.getFileName().toString()).toFile();
|
||||
if (!target.exists())
|
||||
target.createNewFile();
|
||||
OutputStream o = new FileOutputStream(target);
|
||||
s.transferTo(o);
|
||||
s.close();
|
||||
o.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
File def = configDir.resolve("en_us.json").toFile();
|
||||
if (!def.exists()) {
|
||||
File legacy = CrossPlatformStuff.configPath().resolve("flan").resolve("flan_lang.json").toFile();
|
||||
Map<String, String> translation;
|
||||
Map<String, String[]> translationArr;
|
||||
if (legacy.exists()) {
|
||||
FileReader reader = new FileReader(legacy);
|
||||
JsonObject obj = GSON.fromJson(reader, JsonObject.class);
|
||||
reader.close();
|
||||
translation = new LinkedHashMap<>();
|
||||
translationArr = new LinkedHashMap<>();
|
||||
obj.entrySet().forEach(e -> {
|
||||
if (e.getKey().equals("commands")) {
|
||||
JsonObject commands = e.getValue().getAsJsonObject();
|
||||
commands.entrySet().forEach(c -> translationArr.put("command." + c.getKey(), GSON.fromJson(c.getValue(), String[].class)));
|
||||
} else if (legacyPermissionGetter(e.getKey())) {
|
||||
if (e.getValue().isJsonArray())
|
||||
translationArr.put(e.getKey(), GSON.fromJson(e.getValue(), String[].class));
|
||||
else
|
||||
translationArr.put(e.getKey(), new String[]{e.getValue().getAsString()});
|
||||
} else
|
||||
translation.put(e.getKey(), e.getValue().getAsString());
|
||||
});
|
||||
} else {
|
||||
translation = this.defaultTranslation;
|
||||
translationArr = this.defaultTranslationArray;
|
||||
}
|
||||
def.createNewFile();
|
||||
saveTo(def, translation, translationArr);
|
||||
}
|
||||
} catch (IOException | URISyntaxException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
this.reload(ConfigHandler.config.lang);
|
||||
}
|
||||
|
||||
private static boolean legacyPermissionGetter(String id) {
|
||||
try {
|
||||
PermissionRegistry.get(id.replace(".desc", ""));
|
||||
return true;
|
||||
} catch (NullPointerException ignored) {
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void reload(String lang) {
|
||||
try {
|
||||
FileReader reader = new FileReader(this.confDir.resolve(lang + ".json").toFile());
|
||||
JsonObject obj = GSON.fromJson(reader, JsonObject.class);
|
||||
reader.close();
|
||||
obj.entrySet().forEach(e -> {
|
||||
if (e.getValue().isJsonArray()) {
|
||||
JsonArray arr = e.getValue().getAsJsonArray();
|
||||
this.translationArr.put(e.getKey(), GSON.fromJson(arr, String[].class));
|
||||
} else
|
||||
this.translation.put(e.getKey(), e.getValue().getAsString());
|
||||
});
|
||||
//en_us is basically used as a default modifiable file
|
||||
if (lang.equals("en_us")) {
|
||||
this.defaultTranslation.forEach((key, t) -> this.translation.putIfAbsent(key, t));
|
||||
saveTo(this.confDir.resolve("en_us.json").toFile(), this.translation, this.translationArr);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
if (lang.equals("en_us"))
|
||||
e.printStackTrace();
|
||||
else
|
||||
this.reload("en_us");
|
||||
}
|
||||
}
|
||||
|
||||
public String get(String key) {
|
||||
return this.translation.getOrDefault(key, key);
|
||||
}
|
||||
|
||||
public String[] getArray(String key) {
|
||||
return this.translationArr.getOrDefault(key, new String[]{key});
|
||||
}
|
||||
|
||||
private static void saveTo(File file, Map<String, String> translation, Map<String, String[]> translationArr) {
|
||||
try {
|
||||
JsonObject plain = GSON.toJsonTree(translation).getAsJsonObject();
|
||||
JsonObject arr = GSON.toJsonTree(translationArr).getAsJsonObject();
|
||||
arr.entrySet().forEach(e -> plain.add(e.getKey(), e.getValue()));
|
||||
FileWriter writer = new FileWriter(file);
|
||||
GSON.toJson(plain, writer);
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -110,7 +110,7 @@ public class ItemInteractEvents {
|
||||
if (claim.canInteract(player, perm, placePos, false))
|
||||
return InteractionResult.PASS;
|
||||
else if (actualInClaim) {
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.noPermissionSimple, ChatFormatting.DARK_RED), true);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("noPermissionSimple"), ChatFormatting.DARK_RED), true);
|
||||
return InteractionResult.FAIL;
|
||||
}
|
||||
}
|
||||
@ -120,7 +120,7 @@ public class ItemInteractEvents {
|
||||
}
|
||||
return InteractionResult.PASS;
|
||||
} else if (actualInClaim) {
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.noPermissionSimple, ChatFormatting.DARK_RED), true);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("noPermissionSimple"), ChatFormatting.DARK_RED), true);
|
||||
BlockState other = context.getLevel().getBlockState(placePos.above());
|
||||
player.connection.send(new ClientboundBlockUpdatePacket(placePos.above(), other));
|
||||
PlayerClaimData.get(player).addDisplayClaim(claim, EnumDisplayType.MAIN, player.blockPosition().getY());
|
||||
@ -149,16 +149,16 @@ public class ItemInteractEvents {
|
||||
|
||||
public static void claimLandHandling(ServerPlayer player, BlockPos target) {
|
||||
if (!PermissionNodeHandler.perm(player, PermissionNodeHandler.claimCreate, false)) {
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.noPermission, ChatFormatting.DARK_RED), true);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("noPermission"), ChatFormatting.DARK_RED), true);
|
||||
return;
|
||||
}
|
||||
if (ConfigHandler.config.worldWhitelist) {
|
||||
if (!cantClaimInWorld(player.getLevel())) {
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.landClaimDisabledWorld, ChatFormatting.DARK_RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("landClaimDisabledWorld"), ChatFormatting.DARK_RED), false);
|
||||
return;
|
||||
}
|
||||
} else if (cantClaimInWorld(player.getLevel())) {
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.landClaimDisabledWorld, ChatFormatting.DARK_RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("landClaimDisabledWorld"), ChatFormatting.DARK_RED), false);
|
||||
return;
|
||||
}
|
||||
ClaimStorage storage = ClaimStorage.get(player.getLevel());
|
||||
@ -175,9 +175,9 @@ public class ItemInteractEvents {
|
||||
if (subClaim.isCorner(target)) {
|
||||
data.setEditClaim(subClaim, player.blockPosition().getY());
|
||||
data.setEditingCorner(target);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.resizeClaim, ChatFormatting.GOLD), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("resizeClaim"), ChatFormatting.GOLD), false);
|
||||
} else {
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.cantClaimHere, ChatFormatting.RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("cantClaimHere"), ChatFormatting.RED), false);
|
||||
}
|
||||
data.addDisplayClaim(claim, EnumDisplayType.MAIN, player.blockPosition().getY());
|
||||
} else {
|
||||
@ -186,7 +186,7 @@ public class ItemInteractEvents {
|
||||
Set<Claim> fl = claim.resizeSubclaim(data.currentEdit(), data.editingCorner(), target);
|
||||
if (!fl.isEmpty()) {
|
||||
fl.forEach(confl -> data.addDisplayClaim(confl, EnumDisplayType.MAIN, player.blockPosition().getY()));
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.conflictOther, ChatFormatting.RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("conflictOther"), ChatFormatting.RED), false);
|
||||
}
|
||||
data.setEditClaim(null, 0);
|
||||
data.setEditingCorner(null);
|
||||
@ -197,9 +197,9 @@ public class ItemInteractEvents {
|
||||
data.addDisplayClaim(claim, EnumDisplayType.MAIN, player.blockPosition().getY());
|
||||
if (!fl.isEmpty()) {
|
||||
fl.forEach(confl -> data.addDisplayClaim(confl, EnumDisplayType.CONFLICT, player.blockPosition().getY()));
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.conflictOther, ChatFormatting.RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("conflictOther"), ChatFormatting.RED), false);
|
||||
} else {
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.subClaimCreateSuccess, ChatFormatting.GOLD), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("subClaimCreateSuccess"), ChatFormatting.GOLD), false);
|
||||
}
|
||||
data.setEditingCorner(null);
|
||||
}
|
||||
@ -210,22 +210,22 @@ public class ItemInteractEvents {
|
||||
if (claim.isCorner(target)) {
|
||||
data.setEditClaim(claim, player.blockPosition().getY());
|
||||
data.setEditingCorner(target);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.resizeClaim, ChatFormatting.GOLD), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("resizeClaim"), ChatFormatting.GOLD), false);
|
||||
} else if (data.currentEdit() != null) {
|
||||
storage.resizeClaim(data.currentEdit(), data.editingCorner(), target, player);
|
||||
data.setEditClaim(null, 0);
|
||||
data.setEditingCorner(null);
|
||||
} else {
|
||||
data.addDisplayClaim(claim, EnumDisplayType.MAIN, player.blockPosition().getY());
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.cantClaimHere, ChatFormatting.RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("cantClaimHere"), ChatFormatting.RED), false);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
data.addDisplayClaim(claim, EnumDisplayType.MAIN, player.blockPosition().getY());
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.cantClaimHere, ChatFormatting.RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("cantClaimHere"), ChatFormatting.RED), false);
|
||||
}
|
||||
} else if (data.getEditMode() == EnumEditMode.SUBCLAIM) {
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.wrongMode, data.getEditMode()), ChatFormatting.RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("wrongMode"), data.getEditMode()), ChatFormatting.RED), false);
|
||||
} else {
|
||||
if (data.currentEdit() != null) {
|
||||
storage.resizeClaim(data.currentEdit(), data.editingCorner(), target, player);
|
||||
@ -247,12 +247,12 @@ public class ItemInteractEvents {
|
||||
data.setClaimActionCooldown();
|
||||
if (claim != null) {
|
||||
String owner = claim.isAdminClaim() ? "<Admin>" : player.getServer().getProfileCache().get(claim.getOwner()).map(GameProfile::getName).orElse("<UNKOWN>");
|
||||
Component text = PermHelper.simpleColoredText(String.format(ConfigHandler.lang.inspectBlockOwner,
|
||||
Component text = PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("inspectBlockOwner"),
|
||||
owner,
|
||||
target.getX(), target.getY(), target.getZ()), ChatFormatting.GREEN);
|
||||
player.displayClientMessage(text, false);
|
||||
data.addDisplayClaim(claim, EnumDisplayType.MAIN, player.blockPosition().getY());
|
||||
} else
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.inspectNoClaim, ChatFormatting.RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("inspectNoClaim"), ChatFormatting.RED), false);
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ public class ClaimMenuScreenHandler extends ServerOnlyScreenHandler<Claim> {
|
||||
|
||||
@Override
|
||||
public Component getDisplayName() {
|
||||
return PermHelper.simpleColoredText(claim.parentClaim() != null ? ConfigHandler.lang.screenMenuSub : ConfigHandler.lang.screenMenu);
|
||||
return PermHelper.simpleColoredText(claim.parentClaim() != null ? ConfigHandler.langManager.get("screenMenuSub") : ConfigHandler.langManager.get("screenMenu"));
|
||||
}
|
||||
};
|
||||
player.openMenu(fac);
|
||||
@ -50,42 +50,42 @@ public class ClaimMenuScreenHandler extends ServerOnlyScreenHandler<Claim> {
|
||||
switch (i) {
|
||||
case 0 -> {
|
||||
ItemStack close = new ItemStack(Items.TNT);
|
||||
close.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenClose, ChatFormatting.DARK_RED));
|
||||
close.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenClose"), ChatFormatting.DARK_RED));
|
||||
inv.updateStack(i, close);
|
||||
}
|
||||
case 2 -> {
|
||||
ItemStack perm = new ItemStack(Items.BEACON);
|
||||
perm.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenMenuGlobal, ChatFormatting.GOLD));
|
||||
perm.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenMenuGlobal"), ChatFormatting.GOLD));
|
||||
if (player instanceof ServerPlayer && !this.hasEditPerm(claim, (ServerPlayer) player))
|
||||
ServerScreenHelper.addLore(perm, ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenNoPerm, ChatFormatting.DARK_RED));
|
||||
ServerScreenHelper.addLore(perm, ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenNoPerm"), ChatFormatting.DARK_RED));
|
||||
inv.updateStack(i, perm);
|
||||
}
|
||||
case 3 -> {
|
||||
ItemStack group = new ItemStack(Items.WRITABLE_BOOK);
|
||||
group.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenMenuGroup, ChatFormatting.GOLD));
|
||||
group.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenMenuGroup"), ChatFormatting.GOLD));
|
||||
if (player instanceof ServerPlayer && !this.hasEditPerm(claim, (ServerPlayer) player))
|
||||
ServerScreenHelper.addLore(group, ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenNoPerm, ChatFormatting.DARK_RED));
|
||||
ServerScreenHelper.addLore(group, ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenNoPerm"), ChatFormatting.DARK_RED));
|
||||
inv.updateStack(i, group);
|
||||
}
|
||||
case 4 -> {
|
||||
ItemStack potions = new ItemStack(Items.POTION);
|
||||
potions.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenMenuPotion, ChatFormatting.GOLD));
|
||||
potions.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenMenuPotion"), ChatFormatting.GOLD));
|
||||
if (player instanceof ServerPlayer && !this.hasPerm(claim, (ServerPlayer) player, PermissionRegistry.EDITPOTIONS))
|
||||
ServerScreenHelper.addLore(potions, ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenNoPerm, ChatFormatting.DARK_RED));
|
||||
ServerScreenHelper.addLore(potions, ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenNoPerm"), ChatFormatting.DARK_RED));
|
||||
inv.updateStack(i, potions);
|
||||
}
|
||||
case 5 -> {
|
||||
ItemStack sign = new ItemStack(Items.OAK_SIGN);
|
||||
sign.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenMenuClaimText, ChatFormatting.GOLD));
|
||||
sign.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenMenuClaimText"), ChatFormatting.GOLD));
|
||||
if (player instanceof ServerPlayer && !this.hasPerm(claim, (ServerPlayer) player, PermissionRegistry.EDITCLAIM))
|
||||
ServerScreenHelper.addLore(sign, ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenNoPerm, ChatFormatting.DARK_RED));
|
||||
ServerScreenHelper.addLore(sign, ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenNoPerm"), ChatFormatting.DARK_RED));
|
||||
inv.updateStack(i, sign);
|
||||
}
|
||||
case 8 -> {
|
||||
ItemStack delete = new ItemStack(Items.BARRIER);
|
||||
delete.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenMenuDelete, ChatFormatting.RED));
|
||||
delete.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenMenuDelete"), ChatFormatting.RED));
|
||||
if (player instanceof ServerPlayer && !this.hasPerm(claim, (ServerPlayer) player, PermissionRegistry.EDITCLAIM))
|
||||
ServerScreenHelper.addLore(delete, ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenNoPerm, ChatFormatting.DARK_RED));
|
||||
ServerScreenHelper.addLore(delete, ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenNoPerm"), ChatFormatting.DARK_RED));
|
||||
inv.updateStack(i, delete);
|
||||
}
|
||||
default -> inv.updateStack(i, ServerScreenHelper.emptyFiller());
|
||||
@ -145,7 +145,7 @@ public class ClaimMenuScreenHandler extends ServerOnlyScreenHandler<Claim> {
|
||||
ClaimStorage storage = ClaimStorage.get(player.getLevel());
|
||||
storage.deleteClaim(this.claim, true, PlayerClaimData.get(player).getEditMode(), player.getLevel());
|
||||
player.closeContainer();
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.deleteClaim, ChatFormatting.RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("deleteClaim"), ChatFormatting.RED), false);
|
||||
ServerScreenHelper.playSongToPlayer(player, SoundEvents.ANVIL_PLACE, 1, 1f);
|
||||
} else {
|
||||
player.closeContainer();
|
||||
|
@ -41,7 +41,7 @@ public class ClaimTextHandler extends ServerOnlyScreenHandler<Claim> {
|
||||
|
||||
@Override
|
||||
public Component getDisplayName() {
|
||||
return PermHelper.simpleColoredText(claim.parentClaim() != null ? ConfigHandler.lang.screenTitleEditorSub : ConfigHandler.lang.screenTitleEditor);
|
||||
return PermHelper.simpleColoredText(claim.parentClaim() != null ? ConfigHandler.langManager.get("screenTitleEditorSub") : ConfigHandler.langManager.get("screenTitleEditor"));
|
||||
}
|
||||
};
|
||||
player.openMenu(fac);
|
||||
@ -53,33 +53,33 @@ public class ClaimTextHandler extends ServerOnlyScreenHandler<Claim> {
|
||||
switch (i) {
|
||||
case 0 -> {
|
||||
ItemStack close = new ItemStack(Items.TNT);
|
||||
close.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenBack, ChatFormatting.DARK_RED));
|
||||
close.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenBack"), ChatFormatting.DARK_RED));
|
||||
inv.updateStack(i, close);
|
||||
}
|
||||
case 2 -> {
|
||||
ItemStack stack = new ItemStack(Items.OAK_SIGN);
|
||||
stack.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenEnterText, ChatFormatting.GOLD));
|
||||
stack.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenEnterText"), ChatFormatting.GOLD));
|
||||
if (claim.enterTitle != null)
|
||||
ServerScreenHelper.addLore(stack, claim.enterTitle);
|
||||
inv.updateStack(i, stack);
|
||||
}
|
||||
case 3 -> {
|
||||
ItemStack stack2 = new ItemStack(Items.OAK_SIGN);
|
||||
stack2.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenEnterSubText, ChatFormatting.GOLD));
|
||||
stack2.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenEnterSubText"), ChatFormatting.GOLD));
|
||||
if (claim.enterSubtitle != null)
|
||||
ServerScreenHelper.addLore(stack2, claim.enterSubtitle);
|
||||
inv.updateStack(i, stack2);
|
||||
}
|
||||
case 4 -> {
|
||||
ItemStack stack3 = new ItemStack(Items.OAK_SIGN);
|
||||
stack3.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenLeaveText, ChatFormatting.GOLD));
|
||||
stack3.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenLeaveText"), ChatFormatting.GOLD));
|
||||
if (claim.leaveTitle != null)
|
||||
ServerScreenHelper.addLore(stack3, claim.leaveTitle);
|
||||
inv.updateStack(i, stack3);
|
||||
}
|
||||
case 5 -> {
|
||||
ItemStack stack4 = new ItemStack(Items.OAK_SIGN);
|
||||
stack4.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenLeaveSubText, ChatFormatting.GOLD));
|
||||
stack4.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenLeaveSubText"), ChatFormatting.GOLD));
|
||||
if (claim.leaveSubtitle != null)
|
||||
ServerScreenHelper.addLore(stack4, claim.leaveSubtitle);
|
||||
inv.updateStack(i, stack4);
|
||||
@ -123,7 +123,7 @@ public class ClaimTextHandler extends ServerOnlyScreenHandler<Claim> {
|
||||
ServerScreenHelper.playSongToPlayer(player, SoundEvents.VILLAGER_NO, 1, 1f);
|
||||
}));
|
||||
} else {
|
||||
TextComponent text = new TextComponent(ConfigHandler.lang.chatClaimTextEdit);
|
||||
TextComponent text = new TextComponent(ConfigHandler.langManager.get("chatClaimTextEdit"));
|
||||
String command = "/flan claimMessage" + (index == 2 || index == 3 ? " enter" : " leave")
|
||||
+ (index == 2 || index == 4 ? " title" : " subtitle") + " text ";
|
||||
text.withStyle(Style.EMPTY.withClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, command)));
|
||||
|
@ -34,7 +34,7 @@ public class ConfirmScreenHandler extends ServerOnlyScreenHandler<Object> {
|
||||
|
||||
@Override
|
||||
public Component getDisplayName() {
|
||||
return PermHelper.simpleColoredText(ConfigHandler.lang.screenConfirm);
|
||||
return PermHelper.simpleColoredText(ConfigHandler.langManager.get("screenConfirm"));
|
||||
}
|
||||
};
|
||||
player.openMenu(fac);
|
||||
@ -47,12 +47,12 @@ public class ConfirmScreenHandler extends ServerOnlyScreenHandler<Object> {
|
||||
switch (i) {
|
||||
case 3 -> {
|
||||
ItemStack yes = new ItemStack(Items.GREEN_WOOL);
|
||||
yes.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenYes, ChatFormatting.GREEN));
|
||||
yes.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenYes"), ChatFormatting.GREEN));
|
||||
inv.updateStack(i, yes);
|
||||
}
|
||||
case 5 -> {
|
||||
ItemStack no = new ItemStack(Items.RED_WOOL);
|
||||
no.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenNo, ChatFormatting.RED));
|
||||
no.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenNo"), ChatFormatting.RED));
|
||||
inv.updateStack(i, no);
|
||||
}
|
||||
default -> inv.updateStack(i, ServerScreenHelper.emptyFiller());
|
||||
|
@ -54,7 +54,7 @@ public class GroupPlayerScreenHandler extends ServerOnlyScreenHandler<ClaimGroup
|
||||
|
||||
@Override
|
||||
public Component getDisplayName() {
|
||||
return PermHelper.simpleColoredText(String.format(ConfigHandler.lang.screenGroupPlayers, group));
|
||||
return PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("screenGroupPlayers"), group));
|
||||
}
|
||||
};
|
||||
player.openMenu(fac);
|
||||
@ -67,15 +67,15 @@ public class GroupPlayerScreenHandler extends ServerOnlyScreenHandler<ClaimGroup
|
||||
for (int i = 0; i < 54; i++) {
|
||||
if (i == 0) {
|
||||
ItemStack close = new ItemStack(Items.TNT);
|
||||
close.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenBack, ChatFormatting.DARK_RED));
|
||||
close.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenBack"), ChatFormatting.DARK_RED));
|
||||
inv.updateStack(i, close);
|
||||
} else if (i == 3) {
|
||||
ItemStack stack = new ItemStack(Items.ANVIL);
|
||||
stack.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenAdd, ChatFormatting.DARK_GREEN));
|
||||
stack.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenAdd"), ChatFormatting.DARK_GREEN));
|
||||
inv.updateStack(i, stack);
|
||||
} else if (i == 4) {
|
||||
ItemStack stack = new ItemStack(Items.REDSTONE_BLOCK);
|
||||
stack.setHoverName(ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.lang.screenRemoveMode, this.removeMode ? ConfigHandler.lang.screenTrue : ConfigHandler.lang.screenFalse), ChatFormatting.DARK_RED));
|
||||
stack.setHoverName(ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.langManager.get("screenRemoveMode"), this.removeMode ? ConfigHandler.langManager.get("screenTrue") : ConfigHandler.langManager.get("screenFalse")), ChatFormatting.DARK_RED));
|
||||
inv.updateStack(i, stack);
|
||||
} else if (i < 9 || i > 44 || i % 9 == 0 || i % 9 == 8)
|
||||
inv.updateStack(i, ServerScreenHelper.emptyFiller());
|
||||
@ -114,7 +114,7 @@ public class GroupPlayerScreenHandler extends ServerOnlyScreenHandler<ClaimGroup
|
||||
if (fl)
|
||||
ServerScreenHelper.playSongToPlayer(player, SoundEvents.ANVIL_USE, 1, 1f);
|
||||
else {
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.playerGroupAddFail, ChatFormatting.RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("playerGroupAddFail"), ChatFormatting.RED), false);
|
||||
ServerScreenHelper.playSongToPlayer(player, SoundEvents.VILLAGER_NO, 1, 1f);
|
||||
}
|
||||
}, () -> {
|
||||
@ -128,7 +128,7 @@ public class GroupPlayerScreenHandler extends ServerOnlyScreenHandler<ClaimGroup
|
||||
if (index == 4) {
|
||||
this.removeMode = !this.removeMode;
|
||||
ItemStack stack = new ItemStack(Items.REDSTONE_BLOCK);
|
||||
stack.setHoverName(ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.lang.screenRemoveMode, this.removeMode ? ConfigHandler.lang.screenTrue : ConfigHandler.lang.screenFalse), ChatFormatting.DARK_RED));
|
||||
stack.setHoverName(ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.langManager.get("screenRemoveMode"), this.removeMode ? ConfigHandler.langManager.get("screenTrue") : ConfigHandler.langManager.get("screenFalse")), ChatFormatting.DARK_RED));
|
||||
slot.set(stack);
|
||||
ServerScreenHelper.playSongToPlayer(player, SoundEvents.UI_BUTTON_CLICK, 1, 1f);
|
||||
return true;
|
||||
|
@ -39,7 +39,7 @@ public class GroupScreenHandler extends ServerOnlyScreenHandler<Claim> {
|
||||
|
||||
@Override
|
||||
public Component getDisplayName() {
|
||||
return PermHelper.simpleColoredText(ConfigHandler.lang.screenGroups);
|
||||
return PermHelper.simpleColoredText(ConfigHandler.langManager.get("screenGroups"));
|
||||
}
|
||||
};
|
||||
player.openMenu(fac);
|
||||
@ -50,15 +50,15 @@ public class GroupScreenHandler extends ServerOnlyScreenHandler<Claim> {
|
||||
for (int i = 0; i < 54; i++) {
|
||||
if (i == 0) {
|
||||
ItemStack stack = new ItemStack(Items.TNT);
|
||||
stack.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenBack, ChatFormatting.DARK_RED));
|
||||
stack.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenBack"), ChatFormatting.DARK_RED));
|
||||
inv.updateStack(i, stack);
|
||||
} else if (i == 3) {
|
||||
ItemStack stack = new ItemStack(Items.ANVIL);
|
||||
stack.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenAdd, ChatFormatting.DARK_GREEN));
|
||||
stack.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenAdd"), ChatFormatting.DARK_GREEN));
|
||||
inv.updateStack(i, stack);
|
||||
} else if (i == 4) {
|
||||
ItemStack stack = new ItemStack(Items.REDSTONE_BLOCK);
|
||||
stack.setHoverName(ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.lang.screenRemoveMode, this.removeMode ? ConfigHandler.lang.screenTrue : ConfigHandler.lang.screenFalse), ChatFormatting.DARK_RED));
|
||||
stack.setHoverName(ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.langManager.get("screenRemoveMode"), this.removeMode ? ConfigHandler.langManager.get("screenTrue") : ConfigHandler.langManager.get("screenFalse")), ChatFormatting.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 GroupScreenHandler extends ServerOnlyScreenHandler<Claim> {
|
||||
if (index == 4) {
|
||||
this.removeMode = !this.removeMode;
|
||||
ItemStack stack = new ItemStack(Items.REDSTONE_BLOCK);
|
||||
stack.setHoverName(ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.lang.screenRemoveMode, this.removeMode ? ConfigHandler.lang.screenTrue : ConfigHandler.lang.screenFalse), ChatFormatting.DARK_RED));
|
||||
stack.setHoverName(ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.langManager.get("screenRemoveMode"), this.removeMode ? ConfigHandler.langManager.get("screenTrue") : ConfigHandler.langManager.get("screenFalse")), ChatFormatting.DARK_RED));
|
||||
slot.set(stack);
|
||||
ServerScreenHelper.playSongToPlayer(player, SoundEvents.UI_BUTTON_CLICK, 1, 1f);
|
||||
return true;
|
||||
|
@ -39,7 +39,7 @@ public class LockedLecternScreenHandler extends LecternMenu {
|
||||
@Override
|
||||
public boolean clickMenuButton(Player player, int id) {
|
||||
if (id == 3) {
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.noPermissionSimple, ChatFormatting.DARK_RED), false);
|
||||
player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("noPermissionSimple"), ChatFormatting.DARK_RED), false);
|
||||
return false;
|
||||
}
|
||||
return super.clickMenuButton(player, id);
|
||||
|
@ -53,7 +53,7 @@ public class PermissionScreenHandler extends ServerOnlyScreenHandler<ClaimGroup>
|
||||
|
||||
@Override
|
||||
public Component getDisplayName() {
|
||||
return PermHelper.simpleColoredText(group == null ? ConfigHandler.lang.screenGlobalPerms : String.format(ConfigHandler.lang.screenGroupPerms, group));
|
||||
return PermHelper.simpleColoredText(group == null ? ConfigHandler.langManager.get("screenGlobalPerms") : String.format(ConfigHandler.langManager.get("screenGroupPerms"), group));
|
||||
}
|
||||
};
|
||||
player.openMenu(fac);
|
||||
@ -68,11 +68,11 @@ public class PermissionScreenHandler extends ServerOnlyScreenHandler<ClaimGroup>
|
||||
for (int i = 0; i < 54; i++) {
|
||||
if (i == 0) {
|
||||
ItemStack close = new ItemStack(Items.TNT);
|
||||
close.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenBack, ChatFormatting.DARK_RED));
|
||||
close.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenBack"), ChatFormatting.DARK_RED));
|
||||
inv.updateStack(i, close);
|
||||
} else if (i == 51) {
|
||||
ItemStack close = new ItemStack(Items.ARROW);
|
||||
close.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenNext, ChatFormatting.WHITE));
|
||||
close.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenNext"), ChatFormatting.WHITE));
|
||||
inv.updateStack(i, close);
|
||||
} else if (i < 9 || i > 44 || i % 9 == 0 || i % 9 == 8)
|
||||
inv.updateStack(i, ServerScreenHelper.emptyFiller());
|
||||
@ -89,20 +89,20 @@ public class PermissionScreenHandler extends ServerOnlyScreenHandler<ClaimGroup>
|
||||
for (int i = 0; i < 54; i++) {
|
||||
if (i == 0) {
|
||||
ItemStack close = new ItemStack(Items.TNT);
|
||||
close.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenBack, ChatFormatting.DARK_RED));
|
||||
close.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenBack"), ChatFormatting.DARK_RED));
|
||||
this.slots.get(i).set(close);
|
||||
} else if (i == 47) {
|
||||
ItemStack stack = ServerScreenHelper.emptyFiller();
|
||||
if (this.page >= 1) {
|
||||
stack = new ItemStack(Items.ARROW);
|
||||
stack.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenPrevious, ChatFormatting.WHITE));
|
||||
stack.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenPrevious"), ChatFormatting.WHITE));
|
||||
}
|
||||
this.slots.get(i).set(stack);
|
||||
} else if (i == 51) {
|
||||
ItemStack stack = ServerScreenHelper.emptyFiller();
|
||||
if (this.page < this.maxPages) {
|
||||
stack = new ItemStack(Items.ARROW);
|
||||
stack.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenNext, ChatFormatting.WHITE));
|
||||
stack.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenNext"), ChatFormatting.WHITE));
|
||||
}
|
||||
this.slots.get(i).set(stack);
|
||||
} else if (i < 9 || i > 44 || i % 9 == 0 || i % 9 == 8)
|
||||
|
@ -37,7 +37,7 @@ public class PersonalGroupScreenHandler extends ServerOnlyScreenHandler<Object>
|
||||
|
||||
@Override
|
||||
public Component getDisplayName() {
|
||||
return PermHelper.simpleColoredText(ConfigHandler.lang.screenPersonalGroups);
|
||||
return PermHelper.simpleColoredText(ConfigHandler.langManager.get("screenPersonalGroups"));
|
||||
}
|
||||
};
|
||||
player.openMenu(fac);
|
||||
@ -50,15 +50,15 @@ public class PersonalGroupScreenHandler extends ServerOnlyScreenHandler<Object>
|
||||
for (int i = 0; i < 54; i++) {
|
||||
if (i == 0) {
|
||||
ItemStack close = new ItemStack(Items.TNT);
|
||||
close.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenBack, ChatFormatting.DARK_RED));
|
||||
close.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenBack"), ChatFormatting.DARK_RED));
|
||||
inv.updateStack(i, close);
|
||||
} else if (i == 3) {
|
||||
ItemStack stack = new ItemStack(Items.ANVIL);
|
||||
stack.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenAdd, ChatFormatting.DARK_GREEN));
|
||||
stack.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenAdd"), ChatFormatting.DARK_GREEN));
|
||||
inv.updateStack(i, stack);
|
||||
} else if (i == 4) {
|
||||
ItemStack stack = new ItemStack(Items.REDSTONE_BLOCK);
|
||||
stack.setHoverName(ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.lang.screenRemoveMode, this.removeMode ? ConfigHandler.lang.screenTrue : ConfigHandler.lang.screenFalse), ChatFormatting.DARK_RED));
|
||||
stack.setHoverName(ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.langManager.get("screenRemoveMode"), this.removeMode ? ConfigHandler.langManager.get("screenTrue") : ConfigHandler.langManager.get("screenFalse")), ChatFormatting.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.setHoverName(ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.lang.screenRemoveMode, this.removeMode ? ConfigHandler.lang.screenTrue : ConfigHandler.lang.screenFalse), ChatFormatting.DARK_RED));
|
||||
stack.setHoverName(ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.langManager.get("screenRemoveMode"), this.removeMode ? ConfigHandler.langManager.get("screenTrue") : ConfigHandler.langManager.get("screenFalse")), ChatFormatting.DARK_RED));
|
||||
slot.set(stack);
|
||||
ServerScreenHelper.playSongToPlayer(player, SoundEvents.UI_BUTTON_CLICK, 1, 1f);
|
||||
return true;
|
||||
|
@ -44,7 +44,7 @@ public class PersonalPermissionScreenHandler extends ServerOnlyScreenHandler<Str
|
||||
|
||||
@Override
|
||||
public Component getDisplayName() {
|
||||
return PermHelper.simpleColoredText(String.format(ConfigHandler.lang.screenPersonalPermissions, group));
|
||||
return PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("screenPersonalPermissions"), group));
|
||||
}
|
||||
};
|
||||
player.openMenu(fac);
|
||||
@ -61,15 +61,15 @@ public class PersonalPermissionScreenHandler extends ServerOnlyScreenHandler<Str
|
||||
int page = 0;
|
||||
if (i == 0) {
|
||||
ItemStack close = new ItemStack(Items.TNT);
|
||||
close.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenBack, ChatFormatting.DARK_RED));
|
||||
close.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenBack"), ChatFormatting.DARK_RED));
|
||||
inv.updateStack(i, close);
|
||||
} else if (page == 1 && i == 47) {
|
||||
ItemStack close = new ItemStack(Items.ARROW);
|
||||
close.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenPrevious, ChatFormatting.WHITE));
|
||||
close.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenPrevious"), ChatFormatting.WHITE));
|
||||
inv.updateStack(i, close);
|
||||
} else if (page == 0 && i == 51) {
|
||||
ItemStack close = new ItemStack(Items.ARROW);
|
||||
close.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenNext, ChatFormatting.WHITE));
|
||||
close.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenNext"), ChatFormatting.WHITE));
|
||||
inv.updateStack(i, close);
|
||||
} else if (i < 9 || i > 44 || i % 9 == 0 || i % 9 == 8)
|
||||
inv.updateStack(i, ServerScreenHelper.emptyFiller());
|
||||
@ -92,20 +92,20 @@ public class PersonalPermissionScreenHandler extends ServerOnlyScreenHandler<Str
|
||||
for (int i = 0; i < 54; i++) {
|
||||
if (i == 0) {
|
||||
ItemStack close = new ItemStack(Items.TNT);
|
||||
close.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenBack, ChatFormatting.DARK_RED));
|
||||
close.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenBack"), ChatFormatting.DARK_RED));
|
||||
this.slots.get(i).set(close);
|
||||
} else if (i == 47) {
|
||||
ItemStack stack = ServerScreenHelper.emptyFiller();
|
||||
if (this.page >= 1) {
|
||||
stack = new ItemStack(Items.ARROW);
|
||||
stack.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenPrevious, ChatFormatting.WHITE));
|
||||
stack.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenPrevious"), ChatFormatting.WHITE));
|
||||
}
|
||||
this.slots.get(i).set(stack);
|
||||
} else if (i == 51) {
|
||||
ItemStack stack = ServerScreenHelper.emptyFiller();
|
||||
if (this.page < maxPages) {
|
||||
stack = new ItemStack(Items.ARROW);
|
||||
stack.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenNext, ChatFormatting.WHITE));
|
||||
stack.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenNext"), ChatFormatting.WHITE));
|
||||
}
|
||||
this.slots.get(i).set(stack);
|
||||
} else if (i < 9 || i > 44 || i % 9 == 0 || i % 9 == 8)
|
||||
|
@ -50,7 +50,7 @@ public class PotionEditScreenHandler extends ServerOnlyScreenHandler<Claim> {
|
||||
|
||||
@Override
|
||||
public Component getDisplayName() {
|
||||
return PermHelper.simpleColoredText(ConfigHandler.lang.screenPotions);
|
||||
return PermHelper.simpleColoredText(ConfigHandler.langManager.get("screenPotions"));
|
||||
}
|
||||
};
|
||||
player.openMenu(fac);
|
||||
@ -64,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.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenBack, ChatFormatting.DARK_RED));
|
||||
close.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenBack"), ChatFormatting.DARK_RED));
|
||||
inv.updateStack(i, close);
|
||||
} else if (i == 3) {
|
||||
ItemStack stack = new ItemStack(Items.ANVIL);
|
||||
stack.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenAdd, ChatFormatting.DARK_GREEN));
|
||||
stack.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenAdd"), ChatFormatting.DARK_GREEN));
|
||||
inv.updateStack(i, stack);
|
||||
} else if (i == 4) {
|
||||
ItemStack stack = new ItemStack(Items.REDSTONE_BLOCK);
|
||||
stack.setHoverName(ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.lang.screenRemoveMode, this.removeMode ? ConfigHandler.lang.screenTrue : ConfigHandler.lang.screenFalse), ChatFormatting.DARK_RED));
|
||||
stack.setHoverName(ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.langManager.get("screenRemoveMode"), this.removeMode ? ConfigHandler.langManager.get("screenTrue") : ConfigHandler.langManager.get("screenFalse")), ChatFormatting.DARK_RED));
|
||||
inv.updateStack(i, stack);
|
||||
} else if (i < 9 || i > 44 || i % 9 == 0 || i % 9 == 8)
|
||||
inv.updateStack(i, ServerScreenHelper.emptyFiller());
|
||||
@ -137,7 +137,7 @@ public class PotionEditScreenHandler extends ServerOnlyScreenHandler<Claim> {
|
||||
if (index == 4) {
|
||||
this.removeMode = !this.removeMode;
|
||||
ItemStack stack = new ItemStack(Items.REDSTONE_BLOCK);
|
||||
stack.setHoverName(ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.lang.screenRemoveMode, this.removeMode ? ConfigHandler.lang.screenTrue : ConfigHandler.lang.screenFalse), ChatFormatting.DARK_RED));
|
||||
stack.setHoverName(ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.langManager.get("screenRemoveMode"), this.removeMode ? ConfigHandler.langManager.get("screenTrue") : ConfigHandler.langManager.get("screenFalse")), ChatFormatting.DARK_RED));
|
||||
slot.set(stack);
|
||||
ServerScreenHelper.playSongToPlayer(player, SoundEvents.UI_BUTTON_CLICK, 1, 1f);
|
||||
return true;
|
||||
|
@ -36,16 +36,16 @@ public class ServerScreenHelper {
|
||||
ItemStack stack = perm.getItem();
|
||||
stack.setHoverName(ServerScreenHelper.coloredGuiText(perm.id, ChatFormatting.GOLD));
|
||||
List<Component> lore = new ArrayList<>();
|
||||
for (String pdesc : perm.desc) {
|
||||
for (String pdesc : ConfigHandler.langManager.getArray(perm.id + ".desc")) {
|
||||
Component trans = ServerScreenHelper.coloredGuiText(pdesc, ChatFormatting.YELLOW);
|
||||
lore.add(trans);
|
||||
}
|
||||
Config.GlobalType global = ConfigHandler.config.getGlobal(claim.getWorld(), perm);
|
||||
if (!claim.isAdminClaim() && !global.canModify()) {
|
||||
Component text = ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenUneditable, ChatFormatting.DARK_RED);
|
||||
Component text = ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenUneditable"), ChatFormatting.DARK_RED);
|
||||
lore.add(text);
|
||||
String permFlag = global.getValue() ? ConfigHandler.lang.screenTrue : ConfigHandler.lang.screenFalse;
|
||||
Component text2 = ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.lang.screenEnableText, permFlag), permFlag.equals(ConfigHandler.lang.screenTrue) ? ChatFormatting.GREEN : ChatFormatting.RED);
|
||||
String permFlag = global.getValue() ? ConfigHandler.langManager.get("screenTrue") : ConfigHandler.langManager.get("screenFalse");
|
||||
Component text2 = ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.langManager.get("screenEnableText"), permFlag), permFlag.equals(ConfigHandler.langManager.get("screenTrue")) ? ChatFormatting.GREEN : ChatFormatting.RED);
|
||||
lore.add(text2);
|
||||
} else {
|
||||
String permFlag;
|
||||
@ -54,19 +54,19 @@ public class ServerScreenHelper {
|
||||
permFlag = "" + (claim.permEnabled(perm) == 1);
|
||||
else {
|
||||
permFlag = switch (claim.permEnabled(perm)) {
|
||||
case -1 -> ConfigHandler.lang.screenDefault;
|
||||
case 1 -> ConfigHandler.lang.screenTrue;
|
||||
default -> ConfigHandler.lang.screenFalse;
|
||||
case -1 -> ConfigHandler.langManager.get("screenDefault");
|
||||
case 1 -> ConfigHandler.langManager.get("screenTrue");
|
||||
default -> ConfigHandler.langManager.get("screenFalse");
|
||||
};
|
||||
}
|
||||
} else {
|
||||
permFlag = switch (claim.groupHasPerm(group, perm)) {
|
||||
case -1 -> ConfigHandler.lang.screenDefault;
|
||||
case 1 -> ConfigHandler.lang.screenTrue;
|
||||
default -> ConfigHandler.lang.screenFalse;
|
||||
case -1 -> ConfigHandler.langManager.get("screenDefault");
|
||||
case 1 -> ConfigHandler.langManager.get("screenTrue");
|
||||
default -> ConfigHandler.langManager.get("screenFalse");
|
||||
};
|
||||
}
|
||||
Component text = ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.lang.screenEnableText, permFlag), permFlag.equals(ConfigHandler.lang.screenTrue) ? ChatFormatting.GREEN : ChatFormatting.RED);
|
||||
Component text = ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.langManager.get("screenEnableText"), permFlag), permFlag.equals(ConfigHandler.langManager.get("screenTrue")) ? ChatFormatting.GREEN : ChatFormatting.RED);
|
||||
lore.add(text);
|
||||
}
|
||||
addLore(stack, lore);
|
||||
@ -77,25 +77,25 @@ public class ServerScreenHelper {
|
||||
ItemStack stack = perm.getItem();
|
||||
stack.setHoverName(ServerScreenHelper.coloredGuiText(perm.id, ChatFormatting.GOLD));
|
||||
ListTag lore = new ListTag();
|
||||
for (String pdesc : perm.desc) {
|
||||
for (String pdesc : ConfigHandler.langManager.getArray(perm.id + ".desc")) {
|
||||
Component trans = ServerScreenHelper.coloredGuiText(pdesc, ChatFormatting.YELLOW);
|
||||
lore.add(StringTag.valueOf(Component.Serializer.toJson(trans)));
|
||||
}
|
||||
Config.GlobalType global = ConfigHandler.config.getGlobal(player.getLevel(), perm);
|
||||
if (!global.canModify()) {
|
||||
Component text = ServerScreenHelper.coloredGuiText(ConfigHandler.lang.screenUneditable, ChatFormatting.DARK_RED);
|
||||
Component text = ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenUneditable"), ChatFormatting.DARK_RED);
|
||||
lore.add(StringTag.valueOf(Component.Serializer.toJson(text)));
|
||||
String permFlag = String.valueOf(global.getValue());
|
||||
Component text2 = ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.lang.screenEnableText, permFlag), permFlag.equals(ConfigHandler.lang.screenTrue) ? ChatFormatting.GREEN : ChatFormatting.RED);
|
||||
Component text2 = ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.langManager.get("screenEnableText"), permFlag), permFlag.equals(ConfigHandler.langManager.get("screenTrue")) ? ChatFormatting.GREEN : ChatFormatting.RED);
|
||||
lore.add(StringTag.valueOf(Component.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) ? ConfigHandler.lang.screenTrue : ConfigHandler.lang.screenFalse;
|
||||
permFlag = map.get(perm) ? ConfigHandler.langManager.get("screenTrue") : ConfigHandler.langManager.get("screenFalse");
|
||||
else
|
||||
permFlag = ConfigHandler.lang.screenDefault;
|
||||
Component text = ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.lang.screenEnableText, permFlag), permFlag.equals(ConfigHandler.lang.screenTrue) ? ChatFormatting.GREEN : ChatFormatting.RED);
|
||||
permFlag = ConfigHandler.langManager.get("screenDefault");
|
||||
Component text = ServerScreenHelper.coloredGuiText(String.format(ConfigHandler.langManager.get("screenEnableText"), permFlag), permFlag.equals(ConfigHandler.langManager.get("screenTrue")) ? ChatFormatting.GREEN : ChatFormatting.RED);
|
||||
lore.add(StringTag.valueOf(Component.Serializer.toJson(text)));
|
||||
}
|
||||
stack.getOrCreateTagElement("display").put("Lore", lore);
|
||||
|
@ -38,7 +38,7 @@ public class StringResultScreenHandler extends AnvilMenu {
|
||||
stack.setHoverName(PermHelper.simpleColoredText(""));
|
||||
this.inputSlots.setItem(0, stack);
|
||||
ItemStack out = new ItemStack(Items.BOOK);
|
||||
out.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.lang.stringScreenReturn));
|
||||
out.setHoverName(ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("stringScreenReturn")));
|
||||
this.resultSlots.setItem(0, out);
|
||||
this.cons = cons;
|
||||
this.ret = ret;
|
||||
@ -80,7 +80,7 @@ public class StringResultScreenHandler extends AnvilMenu {
|
||||
this.ret.run();
|
||||
else if (i == 2) {
|
||||
String s = slot.getItem().hasCustomHoverName() ? slot.getItem().getHoverName().getContents() : "";
|
||||
if (!s.isEmpty() && !s.equals(ConfigHandler.lang.stringScreenReturn)) {
|
||||
if (!s.isEmpty() && !s.equals(ConfigHandler.langManager.get("stringScreenReturn"))) {
|
||||
this.cons.accept(s);
|
||||
}
|
||||
player.connection.send(new ClientboundSetExperiencePacket(player.experienceProgress, player.totalExperience, player.experienceLevel));
|
||||
@ -97,7 +97,7 @@ public class StringResultScreenHandler extends AnvilMenu {
|
||||
else if (index == 2) {
|
||||
Slot slot = this.slots.get(index);
|
||||
String s = slot.getItem().hasCustomHoverName() ? slot.getItem().getHoverName().getContents() : "";
|
||||
if (!s.isEmpty() && !s.equals(ConfigHandler.lang.stringScreenReturn))
|
||||
if (!s.isEmpty() && !s.equals(ConfigHandler.langManager.get("stringScreenReturn")))
|
||||
this.cons.accept(s);
|
||||
((ServerPlayer) player).connection.send(new ClientboundSetExperiencePacket(player.experienceProgress, player.totalExperience, player.experienceLevel));
|
||||
}
|
||||
|
@ -284,7 +284,7 @@ public class PlayerClaimData implements IPlayerData {
|
||||
this.claimBlockMessage = false;
|
||||
} else if (!this.claimBlockMessage) {
|
||||
this.claimBlockMessage = true;
|
||||
this.player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.claimBlocksFormat,
|
||||
this.player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("claimBlocksFormat"),
|
||||
this.getClaimBlocks(), this.getAdditionalClaims(), this.usedClaimBlocks()), ChatFormatting.GOLD), false);
|
||||
}
|
||||
this.actionCooldown--;
|
||||
@ -320,7 +320,7 @@ public class PlayerClaimData implements IPlayerData {
|
||||
} else if (this.player.position().distanceToSqr(this.trappedPos) > 0.15) {
|
||||
this.trappedTick = -1;
|
||||
this.trappedPos = null;
|
||||
this.player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.lang.trappedMove, ChatFormatting.RED), false);
|
||||
this.player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("trappedMove"), ChatFormatting.RED), false);
|
||||
}
|
||||
}
|
||||
this.deathPickupTick--;
|
||||
@ -342,7 +342,7 @@ public class PlayerClaimData implements IPlayerData {
|
||||
this.defaultGroups.clear();
|
||||
this.defaultGroups.putAll(data.defaultGroups);
|
||||
if (data.setDeathItemOwner())
|
||||
this.player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.unlockDropsCmd, "/flan unlockDrops"), ChatFormatting.GOLD), false);
|
||||
this.player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("unlockDropsCmd"), "/flan unlockDrops"), ChatFormatting.GOLD), false);
|
||||
}
|
||||
|
||||
public void updateScoreboard() {
|
||||
@ -486,7 +486,7 @@ public class PlayerClaimData implements IPlayerData {
|
||||
Flan.log("Reading grief prevention data");
|
||||
File griefPrevention = server.getWorldPath(LevelResource.ROOT).resolve("plugins/GriefPreventionData/PlayerData").toFile();
|
||||
if (!griefPrevention.exists()) {
|
||||
src.sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.cantFindData, griefPrevention.getAbsolutePath()), ChatFormatting.DARK_RED), false);
|
||||
src.sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("cantFindData"), griefPrevention.getAbsolutePath()), ChatFormatting.DARK_RED), false);
|
||||
return false;
|
||||
}
|
||||
for (File f : griefPrevention.listFiles()) {
|
||||
@ -521,7 +521,7 @@ public class PlayerClaimData implements IPlayerData {
|
||||
reader.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
src.sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.errorFile, f.getName(), ChatFormatting.RED)), false);
|
||||
src.sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("errorFile"), f.getName(), ChatFormatting.RED)), false);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -19,17 +19,17 @@ public class CommandCurrencyImpl {
|
||||
|
||||
public static int sellClaimBlocks(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
if (!Flan.gunpowder) {
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.currencyMissing, ChatFormatting.DARK_RED), false);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("currencyMissing"), ChatFormatting.DARK_RED), false);
|
||||
return 0;
|
||||
}
|
||||
if (ConfigHandler.config.sellPrice == -1) {
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.sellDisabled, ChatFormatting.DARK_RED), false);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("sellDisabled"), ChatFormatting.DARK_RED), false);
|
||||
return 0;
|
||||
}
|
||||
int amount = Math.max(0, IntegerArgumentType.getInteger(context, "amount"));
|
||||
PlayerClaimData data = PlayerClaimData.get(context.getSource().getPlayerOrException());
|
||||
if (data.getAdditionalClaims() - Math.max(0, data.usedClaimBlocks() - data.getClaimBlocks()) < amount) {
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.sellFail, ChatFormatting.DARK_RED), false);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("sellFail"), ChatFormatting.DARK_RED), false);
|
||||
return 0;
|
||||
}
|
||||
StoredBalance bal = BalanceHandler.INSTANCE.getUser(context.getSource().getPlayerOrException().getUUID());
|
||||
@ -37,17 +37,17 @@ public class CommandCurrencyImpl {
|
||||
bal.setBalance(bal.getBalance().add(price));
|
||||
BalanceHandler.INSTANCE.updateUser(bal);
|
||||
data.setAdditionalClaims(data.getAdditionalClaims() - amount);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.sellSuccess, amount, price), ChatFormatting.GOLD), false);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("sellSuccess"), amount, price), ChatFormatting.GOLD), false);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
|
||||
public static int buyClaimBlocks(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
if (!Flan.gunpowder) {
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.currencyMissing, ChatFormatting.DARK_RED), false);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("currencyMissing"), ChatFormatting.DARK_RED), false);
|
||||
return 0;
|
||||
}
|
||||
if (ConfigHandler.config.buyPrice == -1) {
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.buyDisabled, ChatFormatting.DARK_RED), false);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("buyDisabled"), ChatFormatting.DARK_RED), false);
|
||||
return 0;
|
||||
}
|
||||
StoredBalance bal = BalanceHandler.INSTANCE.getUser(context.getSource().getPlayerOrException().getUUID());
|
||||
@ -58,10 +58,10 @@ public class CommandCurrencyImpl {
|
||||
data.setAdditionalClaims(data.getAdditionalClaims() + amount);
|
||||
bal.setBalance(bal.getBalance().subtract(price));
|
||||
BalanceHandler.INSTANCE.updateUser(bal);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.buySuccess, amount, price), ChatFormatting.GOLD), false);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("buySuccess"), amount, price), ChatFormatting.GOLD), false);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.buyFail, ChatFormatting.DARK_RED), false);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("buyFail"), ChatFormatting.DARK_RED), false);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -19,33 +19,33 @@ public class CommandCurrencyImpl {
|
||||
|
||||
public static int sellClaimBlocks(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
if (!Flan.diceMCMoneySign) {
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.currencyMissing, ChatFormatting.DARK_RED), false);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("currencyMissing"), ChatFormatting.DARK_RED), false);
|
||||
return 0;
|
||||
}
|
||||
if (ConfigHandler.config.sellPrice == -1) {
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.sellDisabled, ChatFormatting.DARK_RED), false);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("sellDisabled"), ChatFormatting.DARK_RED), false);
|
||||
return 0;
|
||||
}
|
||||
int amount = Math.max(0, IntegerArgumentType.getInteger(context, "amount"));
|
||||
PlayerClaimData data = PlayerClaimData.get(context.getSource().getPlayerOrException());
|
||||
if (data.getAdditionalClaims() - Math.max(0, data.usedClaimBlocks() - data.getClaimBlocks()) < amount) {
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.sellFail, ChatFormatting.DARK_RED), false);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("sellFail"), ChatFormatting.DARK_RED), false);
|
||||
return 0;
|
||||
}
|
||||
double price = amount * ConfigHandler.config.sellPrice;
|
||||
MoneyWSD.get(context.getSource().getLevel()).changeBalance(MoneyMod.AcctTypes.PLAYER.key, context.getSource().getPlayerOrException().getUUID(), price);
|
||||
data.setAdditionalClaims(data.getAdditionalClaims() - amount);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.sellSuccess, amount, price), ChatFormatting.GOLD), false);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("sellSuccess"), amount, price), ChatFormatting.GOLD), false);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
|
||||
public static int buyClaimBlocks(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
|
||||
if (!Flan.diceMCMoneySign) {
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.currencyMissing, ChatFormatting.DARK_RED), false);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("currencyMissing"), ChatFormatting.DARK_RED), false);
|
||||
return 0;
|
||||
}
|
||||
if (ConfigHandler.config.buyPrice == -1) {
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.buyDisabled, ChatFormatting.DARK_RED), false);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("buyDisabled"), ChatFormatting.DARK_RED), false);
|
||||
return 0;
|
||||
}
|
||||
UUID uuid = context.getSource().getPlayerOrException().getUUID();
|
||||
@ -57,10 +57,10 @@ public class CommandCurrencyImpl {
|
||||
PlayerClaimData data = PlayerClaimData.get(context.getSource().getPlayerOrException());
|
||||
data.setAdditionalClaims(data.getAdditionalClaims() + amount);
|
||||
manager.changeBalance(MoneyMod.AcctTypes.PLAYER.key, uuid, -price);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.buySuccess, amount, price), ChatFormatting.GOLD), false);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("buySuccess"), amount, price), ChatFormatting.GOLD), false);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.buyFail, ChatFormatting.DARK_RED), false);
|
||||
context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("buyFail"), ChatFormatting.DARK_RED), false);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user