Skip to content

1.19/dev #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 28, 2023
Merged
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

[1902.1.15]

### Added
* Added `/ftbranks node list <rank>` command to view the permissions nodes that are added to a given rank
* Some backend code improvements for Fabric, related to player display name processing
* Now using a custom Fabric event in FTB Library for better inter-mod compatibility with upcoming Fabric version of FTB Essentials

[1902.1.14]

### Fixed
Expand Down
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ allprojects {
apply plugin: "java"
apply plugin: "architectury-plugin"
apply plugin: "maven-publish"
apply from: "https://files.latmod.com/public/markdown-git-changelog.gradle"
apply from: "https://raw.githubusercontent.com/FTBTeam/mods-meta/main/gradle/git-md-changelog.gradle"

def ENV = System.getenv()
version = "${mod_version}-build.${ENV.GITHUB_RUN_NUMBER ?: 9999}"
Expand All @@ -38,6 +38,8 @@ allprojects {
}

repositories {
mavenLocal()

maven {
url "https://maven.architectury.dev/"
}
Expand Down
25 changes: 25 additions & 0 deletions common/src/main/java/dev/ftb/mods/ftbranks/FTBRanksCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ public static void register(CommandDispatcher<CommandSourceStack> dispatcher, Co
)
)
)
.then(Commands.literal("list")
.then(Commands.argument("rank", StringArgumentType.word())
.suggests((context, builder) -> suggestRanks(builder))
.executes(context -> listNodes(context.getSource(), StringArgumentType.getString(context, "rank")))
)
)
)
.then(Commands.literal("condition")
.then(Commands.argument("rank", StringArgumentType.word())
Expand Down Expand Up @@ -228,6 +234,7 @@ private static int listRanksOf(CommandSourceStack source, ServerPlayer player) {

return 1;
}

private static int listPlayersWith(CommandSourceStack source, String rankName) throws CommandSyntaxException {
Rank rank = getRank(rankName);

Expand All @@ -242,6 +249,24 @@ private static int listPlayersWith(CommandSourceStack source, String rankName) t
return 1;
}

private static int listNodes(CommandSourceStack source, String rankName) throws CommandSyntaxException {
Rank rank = getRank(rankName);

Collection<String> nodes = rank.getPermissions();
if (nodes.isEmpty()) {
source.sendSuccess(Component.literal(String.format("No permission nodes in rank '%s'", rankName)).withStyle(ChatFormatting.GOLD), false);
} else {
source.sendSuccess(Component.literal(String.format("%d permission node(s) in rank '%s':", nodes.size(), rankName)).withStyle(ChatFormatting.GREEN), false);
source.sendSuccess(Component.literal("-".repeat(20)).withStyle(ChatFormatting.GREEN), false);
nodes.forEach(node -> {
source.sendSuccess(Component.literal(String.format("%s = %s", node, rank.getPermission(node))).withStyle(ChatFormatting.YELLOW), false);
});
source.sendSuccess(Component.literal("-".repeat(20)).withStyle(ChatFormatting.GREEN), false);
}

return 1;
}

private static int setNode(CommandSourceStack source, String rankName, String node, String value) throws CommandSyntaxException {
Rank rank = getRank(rankName);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package dev.ftb.mods.ftbranks;

import dev.architectury.injectables.annotations.ExpectPlatform;
import dev.architectury.utils.GameInstance;
import dev.ftb.mods.ftblibrary.util.PlayerDisplayNameUtil;
import dev.ftb.mods.ftbranks.api.FTBRanksAPI;
import dev.ftb.mods.ftbranks.impl.FTBRanksAPIImpl;
import dev.ftb.mods.ftbranks.impl.TextComponentParser;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.HoverEvent;
import net.minecraft.network.chat.Style;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.player.Player;

Expand Down Expand Up @@ -39,8 +41,10 @@ public static Component formatPlayerName(Player player, Component originalName)
}
}

@ExpectPlatform
public static void refreshPlayerNames() {
throw new AssertionError();
MinecraftServer server = GameInstance.getServer();
if (server != null) {
server.getPlayerList().getPlayers().forEach(PlayerDisplayNameUtil::refreshDisplayName);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package dev.ftb.mods.ftbranks.impl.condition;

import dev.ftb.mods.ftblibrary.snbt.SNBTCompoundTag;
import dev.ftb.mods.ftbranks.FTBRanks;
import dev.ftb.mods.ftbranks.api.RankCondition;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
Expand All @@ -25,6 +26,9 @@ public class PlaytimeCondition implements RankCondition {
public PlaytimeCondition(SNBTCompoundTag tag) {
time = tag.getInt("time");

if (!tag.contains("time_unit")) {
FTBRanks.LOGGER.warn("missing 'time_unit' field in playtime condition - assuming 'ticks'");
}
switch (tag.getString("time_unit")) {
case "seconds" -> timeUnit = SECONDS;
case "minutes" -> timeUnit = MINUTES;
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package dev.ftb.mods.ftbranks.fabric;

import dev.ftb.mods.ftblibrary.fabric.PlayerDisplayNameCallback;
import dev.ftb.mods.ftbranks.FTBRanks;
import dev.ftb.mods.ftbranks.MessageDecorator;
import dev.ftb.mods.ftbranks.PlayerNameFormatting;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.message.v1.ServerMessageDecoratorEvent;
import net.minecraft.network.chat.MutableComponent;
Expand All @@ -22,5 +24,7 @@ public void onInitialize() {
}
return CompletableFuture.completedFuture(message);
});

PlayerDisplayNameCallback.EVENT.register(PlayerNameFormatting::formatPlayerName);
}
}

This file was deleted.

4 changes: 2 additions & 2 deletions fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"depends": {
"fabric": "*",
"minecraft": "~1.19",
"architectury": ">=3.2.52",
"ftblibrary": ">=1801.3.5-build.98"
"architectury": ">=6.3.49",
"ftblibrary": ">=1902.3.16-build.191"
},
"mixins": [
"ftbranks-common.mixins.json",
Expand Down
1 change: 0 additions & 1 deletion fabric/src/main/resources/ftbranks-fabric.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"package": "dev.ftb.mods.ftbranks.core.mixin.fabric",
"compatibilityLevel": "JAVA_8",
"mixins": [
"PlayerMixin"
],
"client": [
],
Expand Down

This file was deleted.

6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ org.gradle.daemon=false
mod_id=ftbranks
archives_base_name=ftb-ranks
maven_group=dev.ftb.mods
mod_version=1902.1.14
mod_version=1902.1.15
mod_author=FTB Team

minecraft_version=1.19.2
architectury_version=6.2.43
ftb_library_version=1902.3.10-build.156
architectury_version=6.3.49
ftb_library_version=1902.3.16-build.191

fabric_loader_version=0.14.9
fabric_api_version=0.60.0+1.19.2
Expand Down