Skip to content

Commit 4366fc3

Browse files
committed
update to fabric 1.20.4
1 parent cd3b30d commit 4366fc3

21 files changed

+155
-113
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ plugins {
99
defaultTasks("shadowJar")
1010

1111
group = "io.tebex"
12-
version = "2.0.5"
12+
version = "2.0.6"
1313

1414
subprojects {
1515
plugins.apply("java")

fabric/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ dependencies {
3030
minecraft("com.mojang:minecraft:${minecraftVersion}")
3131
mappings("net.fabricmc:yarn:${yarnMappings}:v2")
3232

33-
modImplementation("eu.pb4:sgui:0.5.0")
34-
include("eu.pb4:sgui:0.5.0")
33+
modImplementation("eu.pb4:sgui:1.4.2+1.20.4")
34+
include("eu.pb4:sgui:1.4.2+1.20.4")
3535

3636
modImplementation("net.fabricmc:fabric-loader:${loaderVersion}")
3737
modImplementation("net.fabricmc.fabric-api:fabric-api:${fabricVersion}")

fabric/gradle.properties

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
# Fabric Properties
22
# check these on https://fabricmc.net/develop
3-
minecraft_version=1.16.5
4-
yarn_mappings=1.16.5+build.10
5-
loader_version=0.14.21
3+
minecraft_version=1.20.4
4+
yarn_mappings=1.20.4+build.3
5+
loader_version=0.15.10
6+
7+
#Fabric api
8+
fabric_version=0.97.0+1.20.4
69

710
# Mod Properties
8-
mod_version=1.0.0
11+
mod_version=2.0.6
912
maven_group=io.tebex.plugin
1013
archives_base_name=tebexplugin
1114

12-
# Dependencies
13-
fabric_version=0.42.0+1.16

fabric/src/main/java/io/tebex/plugin/TebexPlugin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ public Map<Object, Integer> getQueuedPlayers() {
203203

204204
@Override
205205
public void dispatchCommand(String command) {
206-
server.getCommandManager().execute(server.getCommandSource(), command);
206+
server.getCommandManager().execute(server.getCommandSource().getDispatcher().parse(command, server.getCommandSource()), command);
207207
}
208208

209209
@Override
@@ -254,7 +254,7 @@ public int getFreeSlots(Object playerId) {
254254
ServerPlayerEntity player = getPlayer(playerId).orElse(null);
255255
if (player == null) return -1;
256256

257-
DefaultedList<ItemStack> inv = player.inventory.main;
257+
DefaultedList<ItemStack> inv = player.getInventory().main;
258258
return (int) inv.stream()
259259
.filter(obj -> obj == null || obj.isEmpty())
260260
.count();

fabric/src/main/java/io/tebex/plugin/command/BuyCommand.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
package io.tebex.plugin.command;
22

33
import com.mojang.brigadier.context.CommandContext;
4-
import com.mojang.brigadier.exceptions.CommandSyntaxException;
54
import io.tebex.plugin.TebexPlugin;
65
import io.tebex.plugin.gui.BuyGUI;
76
import net.minecraft.server.command.ServerCommandSource;
87
import net.minecraft.server.network.ServerPlayerEntity;
9-
import net.minecraft.text.LiteralText;
8+
import net.minecraft.text.Text;
109

1110
public class BuyCommand {
1211
private final TebexPlugin plugin;
@@ -20,8 +19,8 @@ public int execute(CommandContext<ServerCommandSource> context) {
2019
try {
2120
ServerPlayerEntity player = source.getPlayer();
2221
new BuyGUI(plugin).open(player);
23-
} catch (CommandSyntaxException e) {
24-
source.sendFeedback(new LiteralText("§b[Tebex] §7You must be a player to run this command!"), false);
22+
} catch (Exception e) {
23+
source.sendMessage(Text.of("§b[Tebex] §7You must be a player to run this command!"));
2524
}
2625

2726
return 1;

fabric/src/main/java/io/tebex/plugin/command/sub/BanCommand.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import io.tebex.plugin.TebexPlugin;
55
import io.tebex.plugin.command.SubCommand;
66
import net.minecraft.server.command.ServerCommandSource;
7-
import net.minecraft.text.LiteralText;
7+
import net.minecraft.text.Text;
88

99
import java.util.concurrent.ExecutionException;
1010

@@ -28,19 +28,19 @@ public void execute(CommandContext<ServerCommandSource> context) {
2828
} catch (IllegalArgumentException ignored) {}
2929

3030
if (!platform.isSetup()) {
31-
source.sendFeedback(new LiteralText("§b[Tebex] §7This server is not connected to a webstore. Use /tebex secret to set your store key."), false);
31+
source.sendMessage(Text.of("§b[Tebex] §7This server is not connected to a webstore. Use /tebex secret to set your store key."));
3232
return;
3333
}
3434

3535
try {
3636
boolean success = platform.getSDK().createBan(playerName, ip, reason).get();
3737
if (success) {
38-
source.sendFeedback(new LiteralText("§b[Tebex] §7Player banned successfully."), false);
38+
source.sendMessage(Text.of("§b[Tebex] §7Player banned successfully."));
3939
} else {
40-
source.sendFeedback(new LiteralText("§b[Tebex] §7Failed to ban player."), false);
40+
source.sendMessage(Text.of("§b[Tebex] §7Failed to ban player."));
4141
}
4242
} catch (InterruptedException | ExecutionException e) {
43-
source.sendFeedback(new LiteralText("§b[Tebex] §7Error while banning player: " + e.getMessage()), false);
43+
source.sendMessage(Text.of("§b[Tebex] §7Error while banning player: " + e.getMessage()));
4444
}
4545
}
4646

@@ -51,6 +51,6 @@ public String getDescription() {
5151

5252
@Override
5353
public String getUsage() {
54-
return "<playerName> <opt:reason> <opt:ip>";
54+
return "<playerName>";
5555
}
5656
}

fabric/src/main/java/io/tebex/plugin/command/sub/CheckoutCommand.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import io.tebex.sdk.obj.CheckoutUrl;
88
import io.tebex.sdk.platform.config.ServerPlatformConfig;
99
import net.minecraft.server.command.ServerCommandSource;
10-
import net.minecraft.text.LiteralText;
10+
import net.minecraft.text.Text;
1111

1212
import java.util.concurrent.ExecutionException;
1313

@@ -21,16 +21,16 @@ public void execute(CommandContext<ServerCommandSource> context) {
2121
TebexPlugin platform = getPlatform();
2222

2323
if (!platform.isSetup()) {
24-
context.getSource().sendFeedback(new LiteralText("§b[Tebex] §7This server is not connected to a webstore. Use /tebex secret to set your store key."), false);
24+
context.getSource().sendMessage(Text.of("§b[Tebex] §7This server is not connected to a webstore. Use /tebex secret to set your store key."));
2525
return;
2626
}
2727

2828
Integer packageId = context.getArgument("packageId", Integer.class);
2929
try {
3030
CheckoutUrl checkoutUrl = platform.getSDK().createCheckoutUrl(packageId, context.getSource().getName()).get();
31-
context.getSource().sendFeedback(new LiteralText("§b[Tebex] §7Checkout started! Click here to complete payment: " + checkoutUrl.getUrl()), false);
31+
context.getSource().sendMessage(Text.of("§b[Tebex] §7Checkout started! Click here to complete payment: " + checkoutUrl.getUrl()));
3232
} catch (InterruptedException|ExecutionException e) {
33-
context.getSource().sendError(new LiteralText("§b[Tebex] §7Failed to get checkout link for package: " + e.getMessage()));
33+
context.getSource().sendError(Text.of("§b[Tebex] §7Failed to get checkout link for package: " + e.getMessage()));
3434
}
3535
}
3636

fabric/src/main/java/io/tebex/plugin/command/sub/DebugCommand.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import io.tebex.sdk.platform.config.ServerPlatformConfig;
1010
import io.tebex.sdk.util.StringUtil;
1111
import net.minecraft.server.command.ServerCommandSource;
12-
import net.minecraft.text.LiteralText;
12+
import net.minecraft.text.Text;
1313

1414
import java.io.IOException;
1515

@@ -28,21 +28,21 @@ public void execute(CommandContext<ServerCommandSource> context) {
2828

2929
String input = context.getArgument("trueOrFalse", String.class);
3030
if (StringUtil.isTruthy(input)) {
31-
context.getSource().sendFeedback(new LiteralText("§b[Tebex] §7Debug mode enabled."), false);
31+
context.getSource().sendMessage(Text.of("§b[Tebex] §7Debug mode enabled."));
3232
config.setVerbose(true);
3333
configFile.set("verbose", true);
3434
} else if (StringUtil.isFalsy(input)) {
35-
context.getSource().sendFeedback(new LiteralText("§b[Tebex] §7Debug mode disabled."), false);
35+
context.getSource().sendMessage(Text.of("§b[Tebex] §7Debug mode disabled."));
3636
config.setVerbose(false);
3737
configFile.set("verbose", false);
3838
} else {
39-
context.getSource().sendFeedback(new LiteralText("§b[Tebex] §7Invalid command usage. Use /tebex " + this.getName() + " " + getUsage()), false);
39+
context.getSource().sendMessage(Text.of("§b[Tebex] §7Invalid command usage. Use /tebex " + this.getName() + " " + getUsage()));
4040
}
4141

4242
try {
4343
configFile.save();
4444
} catch (IOException e) {
45-
context.getSource().sendFeedback(new LiteralText("§b[Tebex] §7Failed to save configuration file."), false);
45+
context.getSource().sendMessage(Text.of("§b[Tebex] §7Failed to save configuration file."));
4646
}
4747
}
4848

fabric/src/main/java/io/tebex/plugin/command/sub/ForceCheckCommand.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import io.tebex.plugin.TebexPlugin;
55
import io.tebex.plugin.command.SubCommand;
66
import net.minecraft.server.command.ServerCommandSource;
7-
import net.minecraft.text.LiteralText;
7+
import net.minecraft.text.Text;
88

99
public class ForceCheckCommand extends SubCommand {
1010
private final TebexPlugin platform;
@@ -17,13 +17,13 @@ public ForceCheckCommand(TebexPlugin platform) {
1717
@Override
1818
public void execute(CommandContext<ServerCommandSource> context) {
1919
if(! platform.isSetup()) {
20-
context.getSource().sendFeedback(new LiteralText("§cTebex is not setup yet!"), false);
20+
context.getSource().sendMessage(Text.of("§cTebex is not setup yet!"));
2121
return;
2222
}
2323

2424
// if running from console, return
2525
if (context.getSource().getEntity() != null) {
26-
context.getSource().sendFeedback(new LiteralText("§b[Tebex] §7Performing force check..."), false);
26+
context.getSource().sendMessage(Text.of("§b[Tebex] §7Performing force check..."));
2727
}
2828

2929
getPlatform().performCheck(false);

fabric/src/main/java/io/tebex/plugin/command/sub/GoalsCommand.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import io.tebex.plugin.command.SubCommand;
66
import io.tebex.sdk.obj.CommunityGoal;
77
import net.minecraft.server.command.ServerCommandSource;
8-
import net.minecraft.text.LiteralText;
8+
import net.minecraft.text.Text;
99

1010
import java.util.List;
1111
import java.util.concurrent.ExecutionException;
@@ -23,12 +23,12 @@ public void execute(CommandContext<ServerCommandSource> sender) {
2323
List<CommunityGoal> goals = platform.getSDK().getCommunityGoals().get();
2424
for (CommunityGoal goal: goals) {
2525
if (goal.getStatus() != CommunityGoal.Status.DISABLED) {
26-
sender.getSource().sendFeedback(new LiteralText("§b[Tebex] §7Community Goals: "), false);
27-
sender.getSource().sendFeedback(new LiteralText(String.format("§b[Tebex] §7- %s (%.2f/%.2f) [%s]", goal.getName(), goal.getCurrent(), goal.getTarget(), goal.getStatus())), false);
26+
sender.getSource().sendMessage(Text.of("§b[Tebex] §7Community Goals: "));
27+
sender.getSource().sendMessage(Text.of(String.format("§b[Tebex] §7- %s (%.2f/%.2f) [%s]", goal.getName(), goal.getCurrent(), goal.getTarget(), goal.getStatus())));
2828
}
2929
}
3030
} catch (InterruptedException | ExecutionException e) {
31-
sender.getSource().sendFeedback(new LiteralText("§b[Tebex] §7Unexpected response: " + e.getMessage()), false);
31+
sender.getSource().sendMessage(Text.of("§b[Tebex] §7Unexpected response: " + e.getMessage()));
3232
}
3333
}
3434

0 commit comments

Comments
 (0)