remove Text#of cause thats client side

This commit is contained in:
Flemmli97 2020-08-25 20:35:38 +02:00
parent 5556860ce4
commit e34714d0a9
8 changed files with 22 additions and 15 deletions

View File

@ -91,7 +91,7 @@ public class CommandClaim {
private static int reloadConfig(CommandContext<ServerCommandSource> context) {
ConfigHandler.reloadConfigs();
context.getSource().sendFeedback(Text.of(ConfigHandler.lang.configReload), true);
context.getSource().sendFeedback(PermHelper.simpleColoredText(ConfigHandler.lang.configReload), true);
return Command.SINGLE_SUCCESS;
}
@ -149,7 +149,7 @@ public class CommandClaim {
else if (!b.get())
player.sendMessage(PermHelper.simpleColoredText(ConfigHandler.lang.deleteClaimError, Formatting.DARK_RED), false);
else
player.sendMessage(PermHelper.simpleColoredText(ConfigHandler.lang.deleteClaim, Formatting.DARK_RED), false);
player.sendMessage(PermHelper.simpleColoredText(ConfigHandler.lang.deleteClaim, Formatting.RED), false);
});
if (!check)
return 0;

View File

@ -2,6 +2,7 @@ package com.flemmli97.flan.gui;
import com.flemmli97.flan.claim.Claim;
import com.flemmli97.flan.claim.ClaimStorage;
import com.flemmli97.flan.claim.PermHelper;
import com.flemmli97.flan.config.ConfigHandler;
import com.flemmli97.flan.player.PlayerClaimData;
import net.minecraft.entity.player.PlayerEntity;
@ -37,7 +38,7 @@ public class ClaimMenuScreenHandler extends ServerOnlyScreenHandler {
@Override
public Text getDisplayName() {
return Text.of(claim.parentClaim() != null ? "SubClaim-Menu" : "Claim-Menu");
return PermHelper.simpleColoredText(claim.parentClaim() != null ? "SubClaim-Menu" : "Claim-Menu");
}
};
player.openHandledScreen(fac);
@ -102,7 +103,7 @@ public class ClaimMenuScreenHandler extends ServerOnlyScreenHandler {
ClaimStorage storage = ClaimStorage.get(player.getServerWorld());
storage.deleteClaim(this.claim, true, PlayerClaimData.get(player).getEditMode(), player.getServerWorld());
player.closeHandledScreen();
player.sendMessage(Text.of(ConfigHandler.lang.deleteClaim), false);
player.sendMessage(PermHelper.simpleColoredText(ConfigHandler.lang.deleteClaim, Formatting.RED), false);
ServerScreenHelper.playSongToPlayer(player, SoundEvents.BLOCK_ANVIL_PLACE, 1, 1f);
} else {
player.closeHandledScreen();

View File

@ -1,5 +1,6 @@
package com.flemmli97.flan.gui;
import com.flemmli97.flan.claim.PermHelper;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Inventory;
@ -34,7 +35,7 @@ public class ConfirmScreenHandler extends ServerOnlyScreenHandler {
@Override
public Text getDisplayName() {
return Text.of("Confirm");
return PermHelper.simpleColoredText("Confirm");
}
};
player.openHandledScreen(fac);

View File

@ -1,6 +1,7 @@
package com.flemmli97.flan.gui;
import com.flemmli97.flan.claim.Claim;
import com.flemmli97.flan.claim.PermHelper;
import com.flemmli97.flan.config.ConfigHandler;
import com.mojang.authlib.GameProfile;
import net.minecraft.block.entity.SkullBlockEntity;
@ -44,7 +45,7 @@ public class GroupPlayerScreenHandler extends ServerOnlyScreenHandler {
@Override
public Text getDisplayName() {
return Text.of(group + "-Players");
return PermHelper.simpleColoredText(group + "-Players");
}
};
player.openHandledScreen(fac);
@ -108,7 +109,7 @@ public class GroupPlayerScreenHandler extends ServerOnlyScreenHandler {
if (fl)
ServerScreenHelper.playSongToPlayer(player, SoundEvents.BLOCK_ANVIL_USE, 1, 1f);
else {
player.sendMessage(Text.of(ConfigHandler.lang.playerGroupAddFail), false);
player.sendMessage(PermHelper.simpleColoredText(ConfigHandler.lang.playerGroupAddFail, Formatting.RED), false);
ServerScreenHelper.playSongToPlayer(player, SoundEvents.ENTITY_VILLAGER_NO, 1, 1f);
}
}, () -> {

View File

@ -2,6 +2,7 @@ package com.flemmli97.flan.gui;
import com.flemmli97.flan.claim.Claim;
import com.flemmli97.flan.claim.EnumPermission;
import com.flemmli97.flan.claim.PermHelper;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Inventory;
@ -39,7 +40,7 @@ public class GroupScreenHandler extends ServerOnlyScreenHandler {
@Override
public Text getDisplayName() {
return Text.of("Claim-Groups");
return PermHelper.simpleColoredText("Claim-Groups");
}
};
player.openHandledScreen(fac);

View File

@ -2,6 +2,7 @@ package com.flemmli97.flan.gui;
import com.flemmli97.flan.claim.Claim;
import com.flemmli97.flan.claim.EnumPermission;
import com.flemmli97.flan.claim.PermHelper;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Inventory;
@ -39,7 +40,7 @@ public class PermissionScreenHandler extends ServerOnlyScreenHandler {
@Override
public Text getDisplayName() {
return Text.of(group == null ? "Global-Permissions" : String.format("%s-Permissions", group));
return PermHelper.simpleColoredText(group == null ? "Global-Permissions" : String.format("%s-Permissions", group));
}
};
player.openHandledScreen(fac);
@ -54,7 +55,7 @@ public class PermissionScreenHandler extends ServerOnlyScreenHandler {
@Override
public Text getDisplayName() {
return Text.of(group == null ? "Global-Permissions" : String.format("%s-Permissions", group));
return PermHelper.simpleColoredText(group == null ? "Global-Permissions" : String.format("%s-Permissions", group));
}
};
player.openHandledScreen(fac);
@ -82,7 +83,7 @@ public class PermissionScreenHandler extends ServerOnlyScreenHandler {
int row = i / 9 - 1;
int id = (i % 9) + row * 7 - 1 + page * 28;
if (id < EnumPermission.values().length)
inv.setStack(i, ServerScreenHelper.fromPermission((Claim) additionalData[0], EnumPermission.values()[id], additionalData[1]==null?null:additionalData[1].toString()));
inv.setStack(i, ServerScreenHelper.fromPermission((Claim) additionalData[0], EnumPermission.values()[id], additionalData[1] == null ? null : additionalData[1].toString()));
}
}
}

View File

@ -2,6 +2,7 @@ package com.flemmli97.flan.gui;
import com.flemmli97.flan.claim.Claim;
import com.flemmli97.flan.claim.EnumPermission;
import com.flemmli97.flan.claim.PermHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.nbt.ListTag;
@ -19,7 +20,7 @@ public class ServerScreenHelper {
public static ItemStack emptyFiller() {
ItemStack stack = new ItemStack(Items.GRAY_STAINED_GLASS_PANE);
stack.setCustomName(Text.of(""));
stack.setCustomName(PermHelper.simpleColoredText(""));
return stack;
}

View File

@ -1,6 +1,7 @@
package com.flemmli97.flan.gui;
import com.flemmli97.flan.claim.Claim;
import com.flemmli97.flan.claim.PermHelper;
import com.flemmli97.flan.config.ConfigHandler;
import com.google.common.collect.Lists;
import net.minecraft.entity.player.PlayerEntity;
@ -33,10 +34,10 @@ public class StringResultScreenHandler extends AnvilScreenHandler {
private StringResultScreenHandler(int syncId, PlayerInventory playerInventory, Consumer<String> cons, Runnable ret) {
super(syncId, playerInventory);
ItemStack stack = new ItemStack(Items.PAPER);
stack.setCustomName(Text.of(""));
stack.setCustomName(PermHelper.simpleColoredText(""));
this.input.setStack(0, stack);
ItemStack out = new ItemStack(Items.BOOK);
out.setCustomName(Text.of(ConfigHandler.lang.stringScreenReturn));
out.setCustomName(PermHelper.simpleColoredText(ConfigHandler.lang.stringScreenReturn));
this.output.setStack(0, out);
this.cons = cons;
this.ret = ret;
@ -52,7 +53,7 @@ public class StringResultScreenHandler extends AnvilScreenHandler {
@Override
public Text getDisplayName() {
return Text.of("");
return PermHelper.simpleColoredText("");
}
};
player.openHandledScreen(fac);