Skip to content

Commit

Permalink
Fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
replaceitem committed Sep 27, 2024
1 parent 43d59b0 commit b326302
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 24 deletions.
7 changes: 1 addition & 6 deletions src/main/java/net/replaceitem/discarpet/Discarpet.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,6 @@ public void onGameStarted() {
Registration.registerParsables();
}

@Override
public void onServerLoaded(MinecraftServer server) {

}

@Override
public void onServerClosed(MinecraftServer server) {
LOGGER.info("Disconnecting all Discord bots");
Expand Down Expand Up @@ -148,7 +143,7 @@ public static void loadBots(ServerCommandSource source) {
if(bot == null) return;
discordBots.put(bot.getId(), bot);
String msg = "Bot " + botId + " sucessfully logged in";
if(intents.size() != 0) {
if(!intents.isEmpty()) {
msg += " with intents " + intents.stream().map(Enum::toString).collect(Collectors.joining(","));
}
MutableText text = Text.literal(msg).styled(style -> style.withColor(Formatting.GREEN));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,9 @@ protected void runBotEvent(Bot bot, Object... params) {
}

private void callHandlerInBotApps(Bot triggerBot, Supplier<List<Value>> argumentSupplier) {
callHandlerInBotApps(triggerBot, argumentSupplier, DEFAULT_SOURCE_SUPPLIER);
}
private void callHandlerInBotApps(Bot triggerBot, Supplier<List<Value>> argumentSupplier, Supplier<ServerCommandSource> cmdSourceSupplier) {
if(CarpetServer.minecraft_server != null && !CarpetServer.minecraft_server.isRunning()) return; //prevent errors when event triggers while stopping server
((CallbackListAccessor) handler).callRemoveCallsIf(callback -> !triggerBot.equals(Discarpet.getBotInHost(CarpetServer.scriptServer.getAppHostByName(callback.host))));
handler.call(argumentSupplier,cmdSourceSupplier);
handler.call(argumentSupplier,DEFAULT_SOURCE_SUPPLIER);
}

private static final Supplier<ServerCommandSource> DEFAULT_SOURCE_SUPPLIER = () -> {
Expand Down Expand Up @@ -71,13 +68,4 @@ public void run(Bot bot, A a, B b, C c) {
runBotEvent(bot, a, b, c);
}
}
public static class Args4<A,B,C,D> extends BotEvents {
public Args4(String name) {
super(name, 4, false);
}

public void run(Bot bot, A a, B b, C c, D d) {
runBotEvent(bot, a, b, c, d);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@ public String getTypeString() {
return "dc_" + this.getDiscordTypeString();
}

@Override
public boolean isNull() {
return false;
}

@Override
@NotNull
public String getString() {
Expand Down

0 comments on commit b326302

Please sign in to comment.