mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 14:38:52 +00:00
Fix redis message not sending full payload, fix list formatting again, fix config not copying defaults and remove unnecessary stuff from default config
This commit is contained in:
1 parent
0bfc2faf2d
commit
15efffa881
9 files changed
+14
-17
No files matched your search
@@ -187,6 +187,8 @@ public final class HuskHomes extends JavaPlugin {
|
||||
public void onEnable() {
|
||||
// Fetch config file
|
||||
saveDefaultConfig();
|
||||
getConfig().options().copyDefaults(true);
|
||||
saveConfig();
|
||||
settings.reload();
|
||||
|
||||
// Load the messages (in the right language)
|
||||
|
||||
@@ -180,7 +180,7 @@ public class EditHomeCommand extends CommandBase implements TabCompleter {
|
||||
}
|
||||
|
||||
// Confirmation message
|
||||
MessageManager.sendMessage(p, "edit_home_update_description", descriptionChangedHome.getName(), MineDown.escape(newDescriptionString.replace("]", "\\]").replace("[", "\\[").replace("(", "\\(").replace(")", "\\)")));
|
||||
MessageManager.sendMessage(p, "edit_home_update_description", descriptionChangedHome.getName(), MineDown.escape(newDescriptionString).replace("]", "\\]").replace("[", "\\[").replace("(", "\\(").replace(")", "\\)"));
|
||||
} catch (SQLException e) {
|
||||
plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred editing a home description.");
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ public class EditWarpCommand extends CommandBase implements TabCompleter {
|
||||
}
|
||||
|
||||
// Confirmation message
|
||||
MessageManager.sendMessage(p, "edit_warp_update_description", warpName, MineDown.escape(newDescriptionString.replace("]", "\\]").replace("[", "\\[").replace("(", "\\(").replace(")", "\\)")));
|
||||
MessageManager.sendMessage(p, "edit_warp_update_description", warpName, MineDown.escape(newDescriptionString).replace("]", "\\]").replace("[", "\\[").replace("(", "\\(").replace(")", "\\)"));
|
||||
} catch (SQLException e) {
|
||||
plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred editing a warp's description.");
|
||||
}
|
||||
|
||||
@@ -67,10 +67,11 @@ public class HomeListCommand extends CommandBase {
|
||||
|
||||
ArrayList<String> homeList = new ArrayList<>();
|
||||
for (Home home : homes) {
|
||||
homeList.add(MessageManager.getRawMessage("home_list_item", home.getName(), MineDown.escape(home.getDescription().replace("]", "\\]")
|
||||
homeList.add(MessageManager.getRawMessage("home_list_item", home.getName(), MineDown.escape(home.getDescription())
|
||||
.replace("]", "\\]")
|
||||
.replace("[", "\\[")
|
||||
.replace("(", "\\(")
|
||||
.replace(")", "\\)"))));
|
||||
.replace(")", "\\)")));
|
||||
}
|
||||
|
||||
final int itemsPerPage = HuskHomes.getSettings().getPrivateHomesPerPage();
|
||||
|
||||
@@ -44,10 +44,10 @@ public class PublicHomeListCommand extends CommandBase {
|
||||
}
|
||||
ArrayList<String> publicHomeList = new ArrayList<>();
|
||||
for (Home home : homes) {
|
||||
publicHomeList.add(MessageManager.getRawMessage("public_home_list_item", home.getName(), home.getOwnerUsername(), MineDown.escape(home.getDescription().replace("]", "\\]")
|
||||
publicHomeList.add(MessageManager.getRawMessage("public_home_list_item", home.getName(), home.getOwnerUsername(), MineDown.escape(home.getDescription()).replace("]", "\\]")
|
||||
.replace("[", "\\[")
|
||||
.replace("(", "\\(")
|
||||
.replace(")", "\\)"))));
|
||||
.replace(")", "\\)")));
|
||||
}
|
||||
|
||||
final int itemsPerPage = HuskHomes.getSettings().getPublicHomesPerPage();
|
||||
|
||||
@@ -48,10 +48,10 @@ public class WarpListCommand extends CommandBase {
|
||||
}
|
||||
}
|
||||
warpList.add(MessageManager.getRawMessage("warp_list_item", warp.getName(),
|
||||
MineDown.escape(warp.getDescription().replace("]", "\\]")
|
||||
MineDown.escape(warp.getDescription()).replace("]", "\\]")
|
||||
.replace("[", "\\[")
|
||||
.replace("(", "\\(")
|
||||
.replace(")", "\\)"))));
|
||||
.replace(")", "\\)")));
|
||||
}
|
||||
if (warpList.isEmpty()) {
|
||||
MessageManager.sendMessage(player, "error_no_warps_set");
|
||||
|
||||
@@ -8,6 +8,7 @@ import redis.clients.jedis.Jedis;
|
||||
|
||||
public class RedisMessage extends Message {
|
||||
|
||||
public static final String REDIS_MESSAGE_HEADER_SEPARATOR = "£";
|
||||
private static final HuskHomes plugin = HuskHomes.getInstance();
|
||||
|
||||
public RedisMessage(String targetPlayerName, MessageType pluginMessageType, String... messageData) {
|
||||
@@ -30,7 +31,7 @@ public class RedisMessage extends Message {
|
||||
publisher.auth(jedisPassword);
|
||||
}
|
||||
publisher.connect();
|
||||
publisher.publish(RedisReceiver.REDIS_CHANNEL, getClusterId() + ":" + getPluginMessageString(getMessageType()) + ":" + target);
|
||||
publisher.publish(RedisReceiver.REDIS_CHANNEL, getClusterId() + ":" + getPluginMessageString(getMessageType()) + ":" + target + REDIS_MESSAGE_HEADER_SEPARATOR + getMessageData());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class RedisReceiver {
|
||||
|
||||
/* HuskHomes Redis messages have a header formatted as such:
|
||||
* <cluster_id>:<message_type>:<target_player>£ followed by the message arguments and data. */
|
||||
final String[] splitMessage = message.split("£");
|
||||
final String[] splitMessage = message.split(RedisMessage.REDIS_MESSAGE_HEADER_SEPARATOR);
|
||||
final String messageHeader = splitMessage[0];
|
||||
int clusterID;
|
||||
|
||||
|
||||
@@ -66,13 +66,6 @@ spawn_command:
|
||||
bungee_network_spawn:
|
||||
enabled: false
|
||||
warp_name: 'Spawn'
|
||||
position:
|
||||
world:
|
||||
x:
|
||||
y:
|
||||
z:
|
||||
yaw:
|
||||
pitch:
|
||||
random_teleport_command:
|
||||
enabled: true
|
||||
cooldown: 30
|
||||
|
||||
Reference in new issue
Block a user