Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ base {

repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
maven { url 'https://repo.bluecolored.de/releases' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url "https://repo.mikeprimm.com/" }
maven { url "https://maven.nucleoid.xyz/" }
maven { url = 'https://jitpack.io' }
maven { url = 'https://repo.bluecolored.de/releases' }
maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url = "https://repo.mikeprimm.com/" }
maven { url = "https://maven.nucleoid.xyz/" }
exclusiveContent {
forRepository {
maven {
Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
org.gradle.jvmargs=-Xmx2G

# Fabric Properties
minecraft_version=26.1
loader_version=0.18.4
minecraft_version=26.2
loader_version=0.19.3

# Mod Properties
mod_version = 2.9.4
maven_group = io.icker
archives_base_name = factions

# Dependencies
fabric_api_version=0.144.1+26.1
fabric_api_version=0.157.0+26.2
lucko_permissions_version=0.7.0
dynmap_api_version=3.7-SNAPSHOT
papi_version=3.0.0-beta.2+26.1
papi_version=3.1.0-beta.1+26.2
styled_chat_version=V5imDrbM
bluemap_api_version=2.7.1
squaremap_api_version=1.2.3
sgui_version=2.0.0+26.1
stapi_version=3.0.1+26.1
stapi_version=3.1.0+26.2
flow_version=1.0.3
6 changes: 3 additions & 3 deletions src/main/java/io/icker/factions/api/persistents/Faction.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public Faction(
this.name = name;
this.motd = motd;
this.description = description;
this.color = color.getName();
this.color = color.name();
this.open = open;
this.power = power;
}
Expand Down Expand Up @@ -124,7 +124,7 @@ public String getName() {
}

public ChatFormatting getColor() {
return ChatFormatting.getByName(color);
return ChatFormatting.valueOf(color.toUpperCase());
}

public String getDescription() {
Expand Down Expand Up @@ -169,7 +169,7 @@ public void setMOTD(String motd) {
}

public void setColor(ChatFormatting color) {
this.color = color.getName();
this.color = color.name();
FactionEvents.MODIFY.invoker().onModify(this);
}

Expand Down
8 changes: 5 additions & 3 deletions src/main/java/io/icker/factions/command/ModifyCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
import net.minecraft.ChatFormatting;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.commands.arguments.ColorArgument;
import net.minecraft.commands.arguments.TeamColorArgument;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.Style;
import net.minecraft.server.level.ServerPlayer;

import net.minecraft.world.scores.TeamColor;
import xyz.nucleoid.server.translations.api.Localization;

import java.util.Locale;
Expand Down Expand Up @@ -112,7 +113,8 @@ private int motd(CommandContext<CommandSourceStack> context) throws CommandSynta
}

private int color(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
ChatFormatting color = ColorArgument.getColor(context, "color");
TeamColor teamColor = TeamColorArgument.getTeamColor(context, "color");
ChatFormatting color = ChatFormatting.valueOf(teamColor.name());

CommandSourceStack source = context.getSource();
ServerPlayer player = source.getPlayerOrException();
Expand Down Expand Up @@ -196,7 +198,7 @@ public LiteralCommandNode<CommandSourceStack> getNode() {
Commands.literal("color")
.requires(Requires.hasPerms("factions.modify.color", 0))
.then(
Commands.argument("color", ColorArgument.color())
Commands.argument("color", TeamColorArgument.teamColor())
.executes(this::color)))
.then(
Commands.literal("open")
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/io/icker/factions/ui/AdminGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import net.minecraft.network.chat.Style;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.inventory.MenuType;
import net.minecraft.world.item.DyeColor;
import net.minecraft.world.item.Items;

import xyz.nucleoid.server.translations.api.Localization;
Expand All @@ -43,7 +44,7 @@ public AdminGui(ServerPlayer player) {
FactionsMod.dynmap == null ? List.of(1, 3, 5, 7) : List.of(0, 2, 4, 6, 8);

for (int i = 0; i < 9; i++)
this.setSlot(i, new GuiElementBuilder(Items.WHITE_STAINED_GLASS_PANE).hideTooltip());
this.setSlot(i, new GuiElementBuilder(Items.STAINED_GLASS_PANE.pick(DyeColor.WHITE)).hideTooltip());

// Bypass icon
this.setSlot(indexes.get(0), buildBypassElement(user));
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/io/icker/factions/ui/InfoGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import net.minecraft.server.players.ProfileResolver;
import net.minecraft.util.Util;
import net.minecraft.world.inventory.MenuType;
import net.minecraft.world.item.DyeColor;
import net.minecraft.world.item.Items;

import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -61,7 +62,7 @@ public InfoGui(ServerPlayer player, Faction faction, @Nullable Runnable closeCal
this.setTitle(Component.translatable("factions.gui.info.title"));

for (int i = 0; i < 9; i++)
this.setSlot(i, new GuiElementBuilder(Items.WHITE_STAINED_GLASS_PANE).hideTooltip());
this.setSlot(i, new GuiElementBuilder(Items.STAINED_GLASS_PANE.pick(DyeColor.WHITE)).hideTooltip());

// Faction info
this.setSlot(
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/io/icker/factions/ui/MemberGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.server.players.ProfileResolver;
import net.minecraft.world.inventory.MenuType;
import net.minecraft.world.item.DyeColor;
import net.minecraft.world.item.Items;

import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -187,7 +188,7 @@ protected DisplayElement getElement(int id) {
for (int i = 0; i < 5; i++)
gui.setSlot(
i,
new GuiElementBuilder(Items.WHITE_STAINED_GLASS_PANE)
new GuiElementBuilder(Items.STAINED_GLASS_PANE.pick(DyeColor.WHITE))
.hideTooltip());
gui.setTitle(
Component.translatable(
Expand Down
35 changes: 18 additions & 17 deletions src/main/java/io/icker/factions/ui/ModifyGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import net.minecraft.network.chat.Style;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.inventory.MenuType;
import net.minecraft.world.item.DyeColor;
import net.minecraft.world.item.Items;

import org.jetbrains.annotations.Nullable;
Expand All @@ -34,7 +35,7 @@ public ModifyGui(ServerPlayer player, Faction faction, @Nullable Runnable closeC

this.setTitle(Component.translatable("factions.gui.modify.title"));
for (int i = 0; i < 9; i++)
this.setSlot(i, new GuiElementBuilder(Items.WHITE_STAINED_GLASS_PANE).hideTooltip());
this.setSlot(i, new GuiElementBuilder(Items.STAINED_GLASS_PANE.pick(DyeColor.WHITE)).hideTooltip());

this.setSlot(
0,
Expand Down Expand Up @@ -215,107 +216,107 @@ public ColorGui(ServerPlayer player, Faction faction, @Nullable Runnable returnC
Component.translatable(
"factions.gui.modify.change_color.select.option.reset"))
.setCallback(() -> colorCallback(ChatFormatting.RESET)));
this.addSlot(new GuiElementBuilder(Items.WHITE_STAINED_GLASS_PANE).hideTooltip());
this.addSlot(new GuiElementBuilder(Items.STAINED_GLASS_PANE.pick(DyeColor.WHITE)).hideTooltip());
this.addSlot(
new GuiElementBuilder(Items.RED_CONCRETE_POWDER)
new GuiElementBuilder(Items.CONCRETE_POWDER.pick(DyeColor.RED))
.setName(
Component.translatable(
"factions.gui.modify.change_color.select.option.red")
.withStyle(ChatFormatting.RED))
.setCallback(() -> colorCallback(ChatFormatting.RED)));
this.addSlot(
new GuiElementBuilder(Items.LIGHT_BLUE_CONCRETE)
new GuiElementBuilder(Items.CONCRETE.pick(DyeColor.LIGHT_BLUE))
.setName(
Component.translatable(
"factions.gui.modify.change_color.select.option.aqua")
.withStyle(ChatFormatting.AQUA))
.setCallback(() -> colorCallback(ChatFormatting.AQUA)));
this.addSlot(
new GuiElementBuilder(Items.BLACK_CONCRETE)
new GuiElementBuilder(Items.CONCRETE.pick(DyeColor.BLACK))
.setName(
Component.translatable(
"factions.gui.modify.change_color.select.option.black")
.withStyle(ChatFormatting.BLACK))
.setCallback(() -> colorCallback(ChatFormatting.BLACK)));
this.addSlot(
new GuiElementBuilder(Items.BLUE_CONCRETE_POWDER)
new GuiElementBuilder(Items.CONCRETE_POWDER.pick(DyeColor.BLUE))
.setName(
Component.translatable(
"factions.gui.modify.change_color.select.option.blue")
.withStyle(ChatFormatting.BLUE))
.setCallback(() -> colorCallback(ChatFormatting.BLUE)));
this.addSlot(
new GuiElementBuilder(Items.CYAN_CONCRETE)
new GuiElementBuilder(Items.CONCRETE.pick(DyeColor.CYAN))
.setName(
Component.translatable(
"factions.gui.modify.change_color.select.option.dark_aqua")
.withStyle(ChatFormatting.DARK_AQUA))
.setCallback(() -> colorCallback(ChatFormatting.DARK_AQUA)));
this.addSlot(
new GuiElementBuilder(Items.BLUE_CONCRETE)
new GuiElementBuilder(Items.CONCRETE.pick(DyeColor.BLUE))
.setName(
Component.translatable(
"factions.gui.modify.change_color.select.option.dark_blue")
.withStyle(ChatFormatting.DARK_BLUE))
.setCallback(() -> colorCallback(ChatFormatting.DARK_BLUE)));
this.addSlot(
new GuiElementBuilder(Items.GRAY_CONCRETE)
new GuiElementBuilder(Items.CONCRETE.pick(DyeColor.GRAY))
.setName(
Component.translatable(
"factions.gui.modify.change_color.select.option.dark_gray")
.withStyle(ChatFormatting.DARK_GRAY))
.setCallback(() -> colorCallback(ChatFormatting.DARK_GRAY)));
this.addSlot(
new GuiElementBuilder(Items.LIGHT_GRAY_CONCRETE)
new GuiElementBuilder(Items.CONCRETE.pick(DyeColor.LIGHT_GRAY))
.setName(
Component.translatable(
"factions.gui.modify.change_color.select.option.gray")
.withStyle(ChatFormatting.GRAY))
.setCallback(() -> colorCallback(ChatFormatting.GRAY)));
this.addSlot(
new GuiElementBuilder(Items.GREEN_CONCRETE)
new GuiElementBuilder(Items.CONCRETE.pick(DyeColor.GREEN))
.setName(
Component.translatable(
"factions.gui.modify.change_color.select.option.dark_green")
.withStyle(ChatFormatting.DARK_GREEN))
.setCallback(() -> colorCallback(ChatFormatting.DARK_GREEN)));
this.addSlot(
new GuiElementBuilder(Items.LIME_CONCRETE)
new GuiElementBuilder(Items.CONCRETE.pick(DyeColor.LIME))
.setName(
Component.translatable(
"factions.gui.modify.change_color.select.option.green")
.withStyle(ChatFormatting.GREEN))
.setCallback(() -> colorCallback(ChatFormatting.GREEN)));
this.addSlot(
new GuiElementBuilder(Items.MAGENTA_CONCRETE)
new GuiElementBuilder(Items.CONCRETE.pick(DyeColor.MAGENTA))
.setName(
Component.translatable(
"factions.gui.modify.change_color.select.option.dark_purple")
.withStyle(ChatFormatting.DARK_PURPLE))
.setCallback(() -> colorCallback(ChatFormatting.DARK_PURPLE)));
this.addSlot(
new GuiElementBuilder(Items.PINK_CONCRETE)
new GuiElementBuilder(Items.CONCRETE.pick(DyeColor.PINK))
.setName(
Component.translatable(
"factions.gui.modify.change_color.select.option.light_purple")
.withStyle(ChatFormatting.LIGHT_PURPLE))
.setCallback(() -> colorCallback(ChatFormatting.LIGHT_PURPLE)));
this.addSlot(
new GuiElementBuilder(Items.RED_CONCRETE)
new GuiElementBuilder(Items.CONCRETE.pick(DyeColor.RED))
.setName(
Component.translatable(
"factions.gui.modify.change_color.select.option.dark_red")
.withStyle(ChatFormatting.DARK_RED))
.setCallback(() -> colorCallback(ChatFormatting.DARK_RED)));
this.addSlot(
new GuiElementBuilder(Items.YELLOW_CONCRETE)
new GuiElementBuilder(Items.CONCRETE.pick(DyeColor.YELLOW))
.setName(
Component.translatable(
"factions.gui.modify.change_color.select.option.gold")
.withStyle(ChatFormatting.GOLD))
.setCallback(() -> colorCallback(ChatFormatting.GOLD)));
this.addSlot(
new GuiElementBuilder(Items.WHITE_CONCRETE)
new GuiElementBuilder(Items.CONCRETE.pick(DyeColor.WHITE))
.setName(
Component.translatable(
"factions.gui.modify.change_color.select.option.white")
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/io/icker/factions/ui/PagedGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.inventory.MenuType;
import net.minecraft.world.inventory.Slot;
import net.minecraft.world.item.DyeColor;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;

Expand Down Expand Up @@ -130,7 +131,7 @@ public record DisplayElement(@Nullable GuiElement element, @Nullable Slot slot)
DisplayElement.of(GuiElementBuilder.from(ItemStack.EMPTY).build());
private static final DisplayElement FILLER =
DisplayElement.of(
new GuiElementBuilder(Items.WHITE_STAINED_GLASS_PANE)
new GuiElementBuilder(Items.STAINED_GLASS_PANE.pick(DyeColor.WHITE))
.setName(Component.empty())
.hideTooltip());

Expand Down
5 changes: 3 additions & 2 deletions src/main/java/io/icker/factions/util/BlueMapWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import io.icker.factions.api.persistents.Home;

import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.scores.TeamColor;

import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -133,9 +134,9 @@ private void generateMarkers() {
.shape(shapes.removeFirst(), -64, 320)
.holes(shapes.toArray(new Shape[0]))
.fillColor(
new Color(faction.getColor().getColor() | 0x40000000))
new Color(TeamColor.byName(faction.getColor().name().toLowerCase()).rgb() | 0x40000000))
.lineColor(
new Color(faction.getColor().getColor() | 0xFF000000))
new Color(TeamColor.byName(faction.getColor().name().toLowerCase()).rgb() | 0xFF000000))
.label(faction.getName())
.detail(info)
.build();
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/io/icker/factions/util/DynmapWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.Level;

import net.minecraft.world.scores.TeamColor;
import org.dynmap.DynmapCommonAPI;
import org.dynmap.DynmapCommonAPIListener;
import org.dynmap.markers.AreaMarker;
Expand Down Expand Up @@ -116,7 +117,7 @@ private void generateMarkers() {
new double[] {pos.getMinBlockZ(), pos.getMaxBlockZ() + 1},
true);
if (marker != null) {
marker.setFillStyle(marker.getFillOpacity(), faction.getColor().getColor());
marker.setFillStyle(marker.getFillOpacity(), TeamColor.byName(faction.getColor().name().toLowerCase()).rgb());
marker.setLineStyle(0, 0, 0);
}
}
Expand Down Expand Up @@ -153,7 +154,7 @@ private void generateMarkers() {
marker.setLineStyle(
marker.getLineWeight(),
marker.getLineOpacity(),
faction.getColor().getColor());
TeamColor.byName(faction.getColor().name().toLowerCase()).rgb());
}
}
}
Expand All @@ -167,9 +168,9 @@ private void updateFaction(Faction faction) {
for (Claim claim : faction.getClaims()) {
AreaMarker marker = markerSet.findAreaMarker(claim.getKey());

marker.setFillStyle(marker.getFillOpacity(), faction.getColor().getColor());
marker.setFillStyle(marker.getFillOpacity(), TeamColor.byName(faction.getColor().name().toLowerCase()).rgb());
marker.setLineStyle(
marker.getLineWeight(), marker.getLineOpacity(), faction.getColor().getColor());
marker.getLineWeight(), marker.getLineOpacity(), TeamColor.byName(faction.getColor().name().toLowerCase()).rgb());
marker.setDescription(info);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public static void init() {
(member) -> {
if (!member.isInFaction()) return Component.nullToEmpty("reset");

return Component.nullToEmpty(member.getFaction().getColor().getName());
return Component.nullToEmpty(member.getFaction().getColor().name());
});

register(
Expand Down
Loading