mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-03 22:15:45 +00:00
Don't sync data over network
This commit is contained in:
1 parent
d7b3b01c2b
commit
4131f811b7
14 files changed
+55
-298
No files matched your search
+2
-2
@@ -70,7 +70,7 @@ public class BukkitChatHandler implements Listener {
|
||||
|
||||
if (event.isAsynchronous()) {
|
||||
final Map<CarbonUser, Component> messages =
|
||||
selectedChannel.parseMessage(user, event.getMessage(), false);
|
||||
selectedChannel.parseMessage(user, event.getMessage());
|
||||
|
||||
for (final Map.Entry<CarbonUser, Component> entry : messages.entrySet()) {
|
||||
if (entry.getValue().equals(Component.empty())) {
|
||||
@@ -87,7 +87,7 @@ public class BukkitChatHandler implements Listener {
|
||||
} else {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(this.carbonChat, () -> {
|
||||
selectedChannel.sendComponentsAndLog(user.identity(),
|
||||
selectedChannel.parseMessage(user, event.getMessage(), false));
|
||||
selectedChannel.parseMessage(user, event.getMessage()));
|
||||
|
||||
// if (this.carbonChat.getConfig().getBoolean("show-tips")) {
|
||||
// this.carbonChat.logger().info("Tip: Sync chat event! I cannot set the message format due to this. :(");
|
||||
|
||||
+9
-77
@@ -142,7 +142,7 @@ public class BukkitPlayerUser implements PlayerUser, ForwardingAudience.Single {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void nickname(@Nullable String newNickname, final boolean fromRemote) {
|
||||
public void nickname(@Nullable String newNickname) {
|
||||
this.nickname = newNickname;
|
||||
|
||||
final OfflinePlayer player = Bukkit.getOfflinePlayer(this.uuid());
|
||||
@@ -160,19 +160,6 @@ public class BukkitPlayerUser implements PlayerUser, ForwardingAudience.Single {
|
||||
onlinePlayer.setPlayerListName(newNickname);
|
||||
}
|
||||
}
|
||||
|
||||
if (!fromRemote) {
|
||||
final String nick = this.nickname;
|
||||
|
||||
if (nick == null) {
|
||||
this.carbonChat.messageManager().sendMessage("nickname-reset", this.uuid(), byteArray -> {
|
||||
});
|
||||
} else {
|
||||
this.carbonChat.messageManager().sendMessage("nickname", this.uuid(), byteArray -> {
|
||||
byteArray.writeUTF(nick);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -204,19 +191,8 @@ public class BukkitPlayerUser implements PlayerUser, ForwardingAudience.Single {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customChatColor(final @Nullable TextColor customChatColor, final boolean fromRemote) {
|
||||
public void customChatColor(final @Nullable TextColor customChatColor) {
|
||||
this.customChatColor = customChatColor;
|
||||
|
||||
if (!fromRemote) {
|
||||
if (customChatColor == null) {
|
||||
this.carbonChat.messageManager().sendMessage("custom-chat-color-reset", this.uuid(), byteArray -> {
|
||||
});
|
||||
} else {
|
||||
this.carbonChat.messageManager().sendMessage("custom-chat-color", this.uuid(), byteArray -> {
|
||||
byteArray.writeUTF(customChatColor.asHexString());
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -241,7 +217,7 @@ public class BukkitPlayerUser implements PlayerUser, ForwardingAudience.Single {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selectedChannel(final @NonNull ChatChannel chatChannel, final boolean fromRemote) {
|
||||
public void selectedChannel(final @NonNull ChatChannel chatChannel) {
|
||||
final String failureMessage = chatChannel.switchFailureMessage();
|
||||
|
||||
final ChannelSwitchEvent event = new ChannelSwitchEvent(chatChannel, this, failureMessage);
|
||||
@@ -258,12 +234,6 @@ public class BukkitPlayerUser implements PlayerUser, ForwardingAudience.Single {
|
||||
this.selectedChannelKey = chatChannel.key();
|
||||
this.selectedChannel = chatChannel;
|
||||
|
||||
if (!fromRemote) {
|
||||
this.carbonChat.messageManager().sendMessage("selected-channel", this.uuid(), byteArray -> {
|
||||
byteArray.writeUTF(chatChannel.key());
|
||||
});
|
||||
}
|
||||
|
||||
final OfflinePlayer player = Bukkit.getOfflinePlayer(this.uuid());
|
||||
|
||||
if (player.isOnline()) {
|
||||
@@ -284,20 +254,12 @@ public class BukkitPlayerUser implements PlayerUser, ForwardingAudience.Single {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ignoringUser(final @NonNull UUID uuid, final boolean ignoring, final boolean fromRemote) {
|
||||
public void ignoringUser(final @NonNull UUID uuid, final boolean ignoring) {
|
||||
if (ignoring) {
|
||||
this.ignoredUsers.add(uuid);
|
||||
} else {
|
||||
this.ignoredUsers.remove(uuid);
|
||||
}
|
||||
|
||||
if (!fromRemote) {
|
||||
this.carbonChat.messageManager().sendMessage("ignoring-user", this.uuid(), byteArray -> {
|
||||
byteArray.writeLong(uuid.getMostSignificantBits());
|
||||
byteArray.writeLong(uuid.getLeastSignificantBits());
|
||||
byteArray.writeBoolean(ignoring);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -357,14 +319,8 @@ public class BukkitPlayerUser implements PlayerUser, ForwardingAudience.Single {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void muted(final boolean muted, final boolean fromRemote) {
|
||||
public void muted(final boolean muted) {
|
||||
this.muted = muted;
|
||||
|
||||
if (!fromRemote) {
|
||||
this.carbonChat.messageManager().sendMessage("muted", this.uuid(), byteArray -> {
|
||||
byteArray.writeBoolean(muted);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -373,14 +329,8 @@ public class BukkitPlayerUser implements PlayerUser, ForwardingAudience.Single {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shadowMuted(final boolean shadowMuted, final boolean fromRemote) {
|
||||
public void shadowMuted(final boolean shadowMuted) {
|
||||
this.shadowMuted = shadowMuted;
|
||||
|
||||
if (!fromRemote) {
|
||||
this.carbonChat.messageManager().sendMessage("shadow-muted", this.uuid(), byteArray -> {
|
||||
byteArray.writeBoolean(shadowMuted);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -394,26 +344,14 @@ public class BukkitPlayerUser implements PlayerUser, ForwardingAudience.Single {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void replyTarget(final @Nullable UUID target, final boolean fromRemote) {
|
||||
public void replyTarget(final @Nullable UUID target) {
|
||||
this.replyTarget = target;
|
||||
|
||||
if (!fromRemote) {
|
||||
if (target != null) {
|
||||
this.carbonChat.messageManager().sendMessage("reply-target", this.uuid(), byteArray -> {
|
||||
byteArray.writeLong(target.getMostSignificantBits());
|
||||
byteArray.writeLong(target.getLeastSignificantBits());
|
||||
});
|
||||
} else {
|
||||
this.carbonChat.messageManager().sendMessage("reply-target-reset", this.uuid(), byteArray -> {
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull UserChannelSettings channelSettings(final @NonNull ChatChannel channel) {
|
||||
return this.channelSettings.computeIfAbsent(channel.key(), name -> {
|
||||
return new SimpleUserChannelSettings(this.uuid, channel.key());
|
||||
return new SimpleUserChannelSettings(this.uuid);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -422,14 +360,8 @@ public class BukkitPlayerUser implements PlayerUser, ForwardingAudience.Single {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spyingWhispers(final boolean spyingWhispers, final boolean fromRemote) {
|
||||
public void spyingWhispers(final boolean spyingWhispers) {
|
||||
this.spyingWhispers = spyingWhispers;
|
||||
|
||||
if (!fromRemote) {
|
||||
this.carbonChat.messageManager().sendMessage("spying-whispers", this.uuid(), byteArray -> {
|
||||
byteArray.writeBoolean(spyingWhispers);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+4
-33
@@ -17,12 +17,10 @@ public class SimpleUserChannelSettings implements UserChannelSettings {
|
||||
private boolean ignored;
|
||||
private @Nullable String color;
|
||||
private @NonNull UUID uuid;
|
||||
private @NonNull String channel;
|
||||
|
||||
@SuppressWarnings("initialization.fields.uninitialized")
|
||||
public SimpleUserChannelSettings(final @NonNull UUID uuid, final @NonNull String channel) {
|
||||
public SimpleUserChannelSettings(final @NonNull UUID uuid) {
|
||||
this.uuid = uuid;
|
||||
this.channel = channel;
|
||||
}
|
||||
|
||||
private @NonNull CarbonUser user() {
|
||||
@@ -35,15 +33,8 @@ public class SimpleUserChannelSettings implements UserChannelSettings {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spying(final boolean spying, final boolean fromRemote) {
|
||||
public void spying(final boolean spying) {
|
||||
this.spying = spying;
|
||||
|
||||
if (!fromRemote) {
|
||||
this.carbonChat.messageService().sendMessage("spying-channel", this.uuid, byteArray -> {
|
||||
byteArray.writeUTF(this.channel);
|
||||
byteArray.writeBoolean(spying);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -52,15 +43,8 @@ public class SimpleUserChannelSettings implements UserChannelSettings {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ignoring(final boolean ignored, final boolean fromRemote) {
|
||||
public void ignoring(final boolean ignored) {
|
||||
this.ignored = ignored;
|
||||
|
||||
if (!fromRemote) {
|
||||
this.carbonChat.messageService().sendMessage("ignoring-channel", this.uuid, byteArray -> {
|
||||
byteArray.writeUTF(this.channel);
|
||||
byteArray.writeBoolean(ignored);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -73,25 +57,12 @@ public class SimpleUserChannelSettings implements UserChannelSettings {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void color(final @Nullable TextColor color, final boolean fromRemote) {
|
||||
public void color(final @Nullable TextColor color) {
|
||||
if (color == null) {
|
||||
this.color = null;
|
||||
} else {
|
||||
this.color = color.asHexString();
|
||||
}
|
||||
|
||||
if (!fromRemote) {
|
||||
final String newColor = this.color;
|
||||
|
||||
if (newColor == null || newColor.isEmpty()) {
|
||||
this.carbonChat.messageService().sendMessage("channel-color-reset", this.uuid, byteArray -> {
|
||||
});
|
||||
} else {
|
||||
this.carbonChat.messageService().sendMessage("channel-color", this.uuid, byteArray -> {
|
||||
byteArray.writeUTF(newColor);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user