aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorHacktheTime <l4bg0jb7@duck.com>2023-09-26 17:01:49 +0200
committerHacktheTime <l4bg0jb7@duck.com>2023-09-26 17:01:49 +0200
commit1e8c85d2bbf1d8a6fb7bc125becd790c15654dbe (patch)
treeebdbf63e2f7cd08ee162f8dd17ae784d680d671b /src/main/java
parent9d673ac2a30da174b17978b78a1af49a915df677 (diff)
downloadBBsentials-1e8c85d2bbf1d8a6fb7bc125becd790c15654dbe.tar.gz
BBsentials-1e8c85d2bbf1d8a6fb7bc125becd790c15654dbe.tar.bz2
BBsentials-1e8c85d2bbf1d8a6fb7bc125becd790c15654dbe.zip
null pointer connection bug fixes
added contributers to mod json
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/de/hype/bbsentials/chat/Chat.java3
-rw-r--r--src/main/java/de/hype/bbsentials/client/Commands/CommandsOLD.java25
-rw-r--r--src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java12
3 files changed, 14 insertions, 26 deletions
diff --git a/src/main/java/de/hype/bbsentials/chat/Chat.java b/src/main/java/de/hype/bbsentials/chat/Chat.java
index 9e6a01e..1685cf7 100644
--- a/src/main/java/de/hype/bbsentials/chat/Chat.java
+++ b/src/main/java/de/hype/bbsentials/chat/Chat.java
@@ -188,8 +188,9 @@ public class Chat {
else if (message.contains("invited you to join their party")) {
if (lastPartyDisbandedMessage != null && partyDisbandedMap != null) {
Instant lastDisbandedInstant = partyDisbandedMap.get(getPlayerNameFromMessage(lastPartyDisbandedMessage));
+ if (config.acceptReparty){
if (lastDisbandedInstant != null && lastDisbandedInstant.isAfter(Instant.now().minusSeconds(20)) && (getPlayerNameFromMessage(message).equals(getPlayerNameFromMessage(lastPartyDisbandedMessage)))) {
- sendCommand("/p accept " + getPlayerNameFromMessage(lastPartyDisbandedMessage));
+ sendCommand("/p accept " + getPlayerNameFromMessage(lastPartyDisbandedMessage));}
}
}
if (!MinecraftClient.getInstance().isWindowFocused()) {
diff --git a/src/main/java/de/hype/bbsentials/client/Commands/CommandsOLD.java b/src/main/java/de/hype/bbsentials/client/Commands/CommandsOLD.java
index 11b3dda..74de17a 100644
--- a/src/main/java/de/hype/bbsentials/client/Commands/CommandsOLD.java
+++ b/src/main/java/de/hype/bbsentials/client/Commands/CommandsOLD.java
@@ -158,7 +158,7 @@ public class CommandsOLD {
.then(ClientCommandManager.argument("Z", IntegerArgumentType.integer())
.then(ClientCommandManager.argument("ContactWay", StringArgumentType.string())
.suggests(((context, builder) -> {
- return CommandSource.suggestMatching(new String[]{"/msg " + getConfig().getUsername() + " bb:party me", "/p join " + config.getUsername()}, builder);
+ return CommandSource.suggestMatching(new String[]{"\"/msg " + getConfig().getUsername() + " bb:party me\"", "\"/p join " + config.getUsername()+"\""}, builder);
}))
.executes((context) -> {
String item = StringArgumentType.getString(context, "Item");
@@ -180,23 +180,6 @@ public class CommandsOLD {
});/*chchest*/
event.register((dispatcher, registryAccess) -> {
dispatcher.register(
- ClientCommandManager.literal("bbserver")
- .then(ClientCommandManager.argument("Message", StringArgumentType.greedyString())
- .executes((context) -> {
- String message = StringArgumentType.getString(context, "Message");
- if (message.equals("bb:reconnect")) {
- BBsentials.connectToBBserver();
- }
- else {
- BBsentials.bbserver.sendMessage(message);
- }
- return 1;
- })
- )
- );
- });/*BBserver*/
- event.register((dispatcher, registryAccess) -> {
- dispatcher.register(
ClientCommandManager.literal("bc")
.then(ClientCommandManager.argument("Message to Bingo Chat", StringArgumentType.greedyString())
.executes((context) -> {
@@ -283,7 +266,7 @@ public class CommandsOLD {
)
.executes((context) -> {
int hub = IntegerArgumentType.getInteger(context, "Hub");
- String location = "bea";
+ String location = StringArgumentType.getString(context, "location");
boolean lessWaste = Boolean.parseBoolean(StringArgumentType.getString(context, "lasswaste"));
splashAnnounce(hub, location, "", lessWaste);
return 1;
@@ -291,7 +274,7 @@ public class CommandsOLD {
))
.executes((context) -> {
int hub = IntegerArgumentType.getInteger(context, "Hub");
- String location = StringArgumentType.getString(context, "location");
+ String location = "bea";
splashAnnounce(hub, location, "", true);
return 1;
})
@@ -320,7 +303,7 @@ public class CommandsOLD {
ClientCommandManager.literal(commandName)
.executes((context) -> {
try {
- BBsentials.bbserver.sendPacket(new MiningEventPacket(event,//TODO get the island
+ BBsentials.bbserver.sendPacket(new MiningEventPacket(event,
config.getUsername(), Objects.requireNonNull(BBUtils.getCurrentIsland())));
} catch (Exception e) {
Chat.sendPrivateMessageToSelf("§c" + e.getMessage());
diff --git a/src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java b/src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java
index 53e534c..a40c621 100644
--- a/src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java
+++ b/src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java
@@ -198,6 +198,7 @@ public class BBsentialConnection {
}
} catch (InterruptedException e) {
e.printStackTrace();
+ } catch (NullPointerException ignored) {
}
});
messageSenderThread.start();
@@ -227,8 +228,11 @@ public class BBsentialConnection {
if (BBsentials.getConfig().isDetailedDevModeEnabled()) {
Chat.sendPrivateMessageToSelf("§bBBDev-s: " + message);
}
- if (socket.isConnected() && writer != null) {
- writer.println(message);
+ try {
+ if (socket.isConnected() && writer != null) {
+ writer.println(message);
+ }
+ } catch (NullPointerException ignored) {
}
}
@@ -348,7 +352,7 @@ public class BBsentialConnection {
int waitTime;
if (packet.splasherUsername.equals(config.getUsername())) {
- SplashStatusUpdateListener splashStatusUpdateListener = new SplashStatusUpdateListener(this,packet);
+ SplashStatusUpdateListener splashStatusUpdateListener = new SplashStatusUpdateListener(this, packet);
BBsentials.splashStatusUpdateListener = splashStatusUpdateListener;
executionService.submit(splashStatusUpdateListener);
}
@@ -362,7 +366,7 @@ public class BBsentialConnection {
}
BBsentials.executionService.schedule(() -> {
SplashManager.display(packet.splashId);
- }, waitTime, TimeUnit.MILLISECONDS);
+ }, waitTime, TimeUnit.MILLISECONDS);
}
}