Skip to content

Commit

Permalink
Update Messaging.java
Browse files Browse the repository at this point in the history
  • Loading branch information
Owen3H committed Jan 19, 2023
1 parent e5507fb commit 4844d13
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/main/java/net/emc/emce/utils/Messaging.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import net.minecraft.client.MinecraftClient;
import org.jetbrains.annotations.NotNull;

import java.util.Collections;
import java.util.List;
import java.util.function.Function;

import static net.emc.emce.EarthMCEssentials.instance;
import static net.kyori.adventure.platform.fabric.FabricClientAudiences.of;
Expand All @@ -18,17 +16,17 @@

public class Messaging {
//#region Helper Methods
public static Component create(String key, NamedTextColor keyColour, Object @NotNull ... args) {
public static Component create(String key, NamedTextColor keyColour, Object... args) {
List<Component> argList = Collections.emptyList();
for (Object obj : args) argList.add(Component.text(obj.toString()));

return translatable().key(key).color(keyColour).args(argList).build();
}
//#endregion

private static Component prefix() {
return translatable("mod_prefix");
}
//#endregion

//#region Regular Msg
public static void send(String text) {
Expand Down Expand Up @@ -60,10 +58,9 @@ public static void sendPrefixedActionBar(Component text) {
}
//#endregion

//#region Command
static Function<String, Boolean> sendCmd = getInstance().player.networkHandler::sendCommand;
//#region Send Command
public static void performCommand(String cmd) {
sendCmd.apply(cmd);
getInstance().player.networkHandler.sendCommand(cmd);
}
//endregion

Expand Down

0 comments on commit 4844d13

Please sign in to comment.