Skip to content

Commit cbfe811

Browse files
committed
fix: small fixes
1 parent 8502ffb commit cbfe811

File tree

8 files changed

+21
-15
lines changed

8 files changed

+21
-15
lines changed

src/main/java/io/github/optijava/opt_carpet_addition/commands/ListAdvanceCommand.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ private static int listAdvance(CommandContext<ServerCommandSource> context) {
2424
MinecraftServer minecraftServer = context.getSource().getServer();
2525
StringBuilder sb = new StringBuilder();
2626
for (ServerPlayerEntity s : minecraftServer.getPlayerManager().getPlayerList()) {
27-
//#if MC >= 12004
27+
//#if MC >= 12000
2828
//$$ sb.append(s.getName().getString()).append(" ").append(s.interactionManager.getGameMode().getName()).append(" ").append(s.networkHandler.getLatency()).append("ms ").append(s.getIp()).append(" ").append(s.getGameProfile().getId().toString()).append("\n");
2929
//#else
3030
sb.append(s.getName().getString()).append(" ").append(s.interactionManager.getGameMode().getName()).append(" ").append(s.pingMilliseconds).append("ms ").append(s.getIp()).append(" ").append(s.getGameProfile().getId().toString()).append("\n");

src/main/java/io/github/optijava/opt_carpet_addition/commands/TpLimitCommand.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -84,63 +84,63 @@ public static void registerCommand(CommandDispatcher<ServerCommandSource> dispat
8484

8585
public static int addTpWhitelist(CommandContext<ServerCommandSource> context) {
8686
TpLimit.add(StringArgumentType.getString(context, "prefix"), "TpWhitelist");
87-
OptCarpetAddition.LOGGER.info("Add TpWhitelist prefix : " + StringArgumentType.getString(context, "prefix"));
87+
OptCarpetAddition.LOGGER.info("Add TpWhitelist prefix : {}", StringArgumentType.getString(context, "prefix"));
8888
Messenger.m(context.getSource(), "Add TpWhitelist prefix : " + StringArgumentType.getString(context, "prefix"));
8989
TpLimit.flush();
9090
return 1;
9191
}
9292

9393
public static int addTpBlacklist(CommandContext<ServerCommandSource> context) {
9494
TpLimit.add(StringArgumentType.getString(context, "prefix"), "TpBlacklist");
95-
OptCarpetAddition.LOGGER.info("Add TpBlacklist prefix : " + StringArgumentType.getString(context, "prefix"));
95+
OptCarpetAddition.LOGGER.info("Add TpBlacklist prefix : {}", StringArgumentType.getString(context, "prefix"));
9696
Messenger.m(context.getSource(), "Add TpBlacklist prefix : " + StringArgumentType.getString(context, "prefix"));
9797
TpLimit.flush();
9898
return 1;
9999
}
100100

101101
public static int addTphereWhitelist(CommandContext<ServerCommandSource> context) {
102102
TpLimit.add(StringArgumentType.getString(context, "prefix"), "TphereWhitelist");
103-
OptCarpetAddition.LOGGER.info("Add TphereWhitelist prefix : " + StringArgumentType.getString(context, "prefix"));
103+
OptCarpetAddition.LOGGER.info("Add TphereWhitelist prefix : {}", StringArgumentType.getString(context, "prefix"));
104104
Messenger.m(context.getSource(), "Add TphereWhitelist prefix : " + StringArgumentType.getString(context, "prefix"));
105105
TpLimit.flush();
106106
return 1;
107107
}
108108

109109
public static int addTphereBlacklist(CommandContext<ServerCommandSource> context) {
110110
TpLimit.add(StringArgumentType.getString(context, "prefix"), "TphereBlacklist");
111-
OptCarpetAddition.LOGGER.info(" Add TphereBlacklist prefix : " + StringArgumentType.getString(context, "prefix"));
111+
OptCarpetAddition.LOGGER.info(" Add TphereBlacklist prefix : {}", StringArgumentType.getString(context, "prefix"));
112112
Messenger.m(context.getSource(), "Add TphereBlacklist prefix : " + StringArgumentType.getString(context, "prefix"));
113113
TpLimit.flush();
114114
return 1;
115115
}
116116

117117
public static int removeTpWhitelist(CommandContext<ServerCommandSource> context) {
118118
TpLimit.remove(StringArgumentType.getString(context, "prefix"), "TpWhitelist");
119-
OptCarpetAddition.LOGGER.info("Remove TpWhitelist prefix : " + StringArgumentType.getString(context, "prefix"));
119+
OptCarpetAddition.LOGGER.info("Remove TpWhitelist prefix : {}", StringArgumentType.getString(context, "prefix"));
120120
Messenger.m(context.getSource(), "Remove TpWhitelist prefix : " + StringArgumentType.getString(context, "prefix"));
121121
TpLimit.flush();
122122
return 1;
123123
}
124124

125125
public static int removeTpBlacklist(CommandContext<ServerCommandSource> context) {
126126
TpLimit.remove(StringArgumentType.getString(context, "prefix"), "TpBlacklist");
127-
OptCarpetAddition.LOGGER.info("Remove TpBlacklist prefix : " + StringArgumentType.getString(context, "prefix"));
127+
OptCarpetAddition.LOGGER.info("Remove TpBlacklist prefix : {}", StringArgumentType.getString(context, "prefix"));
128128
Messenger.m(context.getSource(), "Remove TpBlacklist prefix : " + StringArgumentType.getString(context, "prefix"));
129129
TpLimit.flush();
130130
return 1;
131131
}
132132

133133
public static int removeTphereWhitelist(CommandContext<ServerCommandSource> context) {
134134
TpLimit.remove(StringArgumentType.getString(context, "prefix"), "TphereWhitelist");
135-
OptCarpetAddition.LOGGER.info("Remove TphereWhitelist prefix : " + StringArgumentType.getString(context, "prefix"));
135+
OptCarpetAddition.LOGGER.info("Remove TphereWhitelist prefix : {}", StringArgumentType.getString(context, "prefix"));
136136
Messenger.m(context.getSource(), "Remove TphereWhitelist prefix : " + StringArgumentType.getString(context, "prefix"));
137137
TpLimit.flush();
138138
return 1;
139139
}
140140

141141
public static int removeTphereBlacklist(CommandContext<ServerCommandSource> context) {
142142
TpLimit.remove(StringArgumentType.getString(context, "prefix"), "TphereBlacklist");
143-
OptCarpetAddition.LOGGER.info("Remove TphereBlacklist prefix : " + StringArgumentType.getString(context, "prefix"));
143+
OptCarpetAddition.LOGGER.info("Remove TphereBlacklist prefix : {}", StringArgumentType.getString(context, "prefix"));
144144
Messenger.m(context.getSource(), "Remove TphereBlacklist prefix : " + StringArgumentType.getString(context, "prefix"));
145145
TpLimit.flush();
146146
return 1;

src/main/java/io/github/optijava/opt_carpet_addition/mixins/rule/async/MinecraftServer_Mixin.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public void injectShutdown(CallbackInfo ci) {
3939
)
4040
public void injectTickWorlds(BooleanSupplier shouldKeepTicking, CallbackInfo ci, @SuppressWarnings("all") Iterator var2, ServerWorld serverWorld, Throwable throwable) {
4141
if (OptCarpetSettings.optimizePlayerConnect && (throwable instanceof ConcurrentModificationException)) {
42-
OptCarpetAddition.LOGGER.fatal("[OptCarpetAddition] Unexpected exception when ticking world: " + serverWorld.toString(), throwable);
42+
OptCarpetAddition.LOGGER.fatal("[OptCarpetAddition] Unexpected exception when ticking world: {}", serverWorld.toString(), throwable);
4343
OptCarpetAddition.LOGGER.fatal("[OptCarpetAddition] If you see this message, you may need to restart the server. This exception may cause by OptCarpetAddition, if you think so, please send the reports to GitHub Issues.");
4444
OptCarpetAddition.LOGGER.fatal("[OptCarpetAddition] I'm sorry to hear that.");
4545
ci.cancel();

src/main/java/io/github/optijava/opt_carpet_addition/mixins/rule/async/optimizePlayerConnect/ServerLoginNetworkHandler_Mixin.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ public abstract class ServerLoginNetworkHandler_Mixin {
2929
public void injectAddToServer(ServerPlayerEntity player, CallbackInfo ci) {
3030
if (OptCarpetSettings.optimizePlayerConnect) {
3131
Threading.THREAD_POOL.submit(() -> {
32-
OptCarpetAddition.LOGGER.info("[OptCarpetAddition] PlayerConnectThread started. Thread name: " + Thread.currentThread().getName());
33-
OptCarpetAddition.LOGGER.info("[OptCarpetAddition] " + player.getGameProfile().getName() + " is trying to join the server...");
32+
OptCarpetAddition.LOGGER.info("[OptCarpetAddition] PlayerConnectThread started. Thread name: {}", Thread.currentThread().getName());
33+
OptCarpetAddition.LOGGER.info("[OptCarpetAddition] {} is trying to join the server...", player.getGameProfile().getName());
3434
try {
3535
((ServerLoginNetworkHandler) (Object) this).server.getPlayerManager().onPlayerConnect(((ServerLoginNetworkHandler) (Object) this).connection, player);
36-
OptCarpetAddition.LOGGER.info("[OptCarpetAddition] " + player.getGameProfile().getName() + " joined successfully.");
36+
OptCarpetAddition.LOGGER.info("[OptCarpetAddition] {} joined successfully.", player.getGameProfile().getName());
3737
} catch (Throwable t) {
3838
OptCarpetAddition.LOGGER.error("[OptCarpetAddition] Unexpected exception when player %s joined the game.".formatted(player.getGameProfile().getName()), t);
3939
}

src/main/java/io/github/optijava/opt_carpet_addition/mixins/rule/commandLogger/CommandManager_Mixin.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//$$ import com.mojang.brigadier.ParseResults;
55
//#endif
66

7-
//#if MC >= 12004
7+
//#if MC >= 12000
88
//$$ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
99
//#endif
1010
import carpet.CarpetServer;
@@ -19,7 +19,9 @@
1919
import org.spongepowered.asm.mixin.Unique;
2020
import org.spongepowered.asm.mixin.injection.At;
2121
import org.spongepowered.asm.mixin.injection.Inject;
22+
//#if MC < 12000
2223
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
24+
//#endif
2325

2426
@Mixin(CommandManager.class)
2527
public class CommandManager_Mixin {
@@ -31,7 +33,7 @@ public class CommandManager_Mixin {
3133
method = "execute",
3234
at = @At("HEAD")
3335
)
34-
//#if MC >= 12004
36+
//#if MC >= 12000
3537
//$$ public void injectExecute(ParseResults<ServerCommandSource> parseResults, String command, CallbackInfo ci) {
3638
//#elseif MC >= 11900
3739
//$$ public void injectExecute(ParseResults<ServerCommandSource> parseResults, String command, CallbackInfoReturnable<Integer> cir) {

src/main/java/io/github/optijava/opt_carpet_addition/mixins/rule/removeBats/BatEntity_Mixin.java

+2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
import org.spongepowered.asm.mixin.injection.Inject;
1212
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
1313

14+
//#if MC < 11900
1415
import java.util.Random;
16+
//#endif
1517

1618
@Mixin(BatEntity.class)
1719
public class BatEntity_Mixin {

src/main/java/io/github/optijava/opt_carpet_addition/mixins/rule/unescapeChatMessage/ChatMessageC2SPacket_Mixin.java

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public class ChatMessageC2SPacket_Mixin {
1818
* @reason rule: unescapeChatMessage
1919
*/
2020
@Inject(method = "<init>*", at = @At("TAIL"))
21+
@SuppressWarnings("all")
2122
public void injectInit(CallbackInfo ci) {
2223
if (OptCarpetSettings.unescapeChatMessage) {
2324
try {

src/main/java/io/github/optijava/opt_carpet_addition/mixins/rule/unescapeChatMessage/Screen_Mixin.java

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public class Screen_Mixin {
1717
* @reason rule: unescapeChatMessage
1818
*/
1919
@ModifyArg(method = "sendMessage(Ljava/lang/String;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;sendMessage(Ljava/lang/String;Z)V"), index = 0)
20+
@SuppressWarnings("all")
2021
public String injectSendMessage(String message) {
2122
if (OptCarpetSettings.unescapeChatMessage) {
2223
try {

0 commit comments

Comments
 (0)