mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 22:15:08 +00:00
Fix compilation and issues
This commit is contained in:
1 parent
067162e9e6
commit
6fd35ebba0
3 files changed
+24
-17
No files matched your search
@@ -20,14 +20,14 @@ import java.util.regex.Pattern;
|
||||
|
||||
public class SimpleChatChannel extends ChatChannel {
|
||||
|
||||
private String name;
|
||||
private String key;
|
||||
|
||||
private SimpleChat simpleChat;
|
||||
|
||||
private SimpleChatChannel() { }
|
||||
|
||||
public SimpleChatChannel(String name, SimpleChat simpleChat) {
|
||||
this.name = name;
|
||||
public SimpleChatChannel(String key, SimpleChat simpleChat) {
|
||||
this.key = key;
|
||||
this.simpleChat = simpleChat;
|
||||
}
|
||||
|
||||
@@ -258,7 +258,7 @@ public class SimpleChatChannel extends ChatChannel {
|
||||
public Map<String, String> getFormats() {
|
||||
HashMap<String, String> formats = new HashMap<>();
|
||||
|
||||
ConfigurationSection section = simpleChat.getConfig().getConfigurationSection(getName());
|
||||
ConfigurationSection section = simpleChat.getConfig().getConfigurationSection("channels").getConfigurationSection(getKey());
|
||||
ConfigurationSection formatSection = section.getConfigurationSection("formats");
|
||||
|
||||
if (formatSection == null) {
|
||||
@@ -299,7 +299,8 @@ public class SimpleChatChannel extends ChatChannel {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
String name = (String) getSetting("name");
|
||||
return name == null ? key : name;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -360,7 +361,7 @@ public class SimpleChatChannel extends ChatChannel {
|
||||
}
|
||||
|
||||
private Object getSetting(String key) {
|
||||
ConfigurationSection section = simpleChat.getConfig().getConfigurationSection(getName());
|
||||
ConfigurationSection section = simpleChat.getConfig().getConfigurationSection("channels").getConfigurationSection(getKey());
|
||||
|
||||
if (section.contains(key)) {
|
||||
return section.get(key);
|
||||
@@ -374,4 +375,9 @@ public class SimpleChatChannel extends ChatChannel {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -41,6 +41,7 @@ public class ToggleCommand extends BaseCommand {
|
||||
}
|
||||
|
||||
@CommandPermission("simplechat.toggle.others")
|
||||
@Subcommand("other")
|
||||
@CommandCompletion("@chatchannel @players")
|
||||
public void baseCommand(Player player, @Conditions("canuse:true") ChatChannel channel, ChatUser user) {
|
||||
String message;
|
||||
@@ -63,6 +64,6 @@ public class ToggleCommand extends BaseCommand {
|
||||
|
||||
simpleChat.getUserService().wrap(player).sendMessage(MiniMessage.get().parse(otherMessage,
|
||||
"br", "\n", "color", "<color:" + channel.getColor().toString() + ">",
|
||||
"channel", channel.getName()));
|
||||
"channel", channel.getName(), "player", user.asOfflinePlayer().getName()));
|
||||
}
|
||||
}
|
||||
@@ -21,9 +21,9 @@ public class ChannelManager {
|
||||
|
||||
ConfigurationSection section = simpleChat.getConfig().getConfigurationSection("channels").getConfigurationSection(key);
|
||||
|
||||
String name = section.contains("name") ? section.getString("name") : key;
|
||||
String name = section.getString("name");
|
||||
|
||||
if (name.length() > 16) {
|
||||
if (name != null && name.length() > 16) {
|
||||
simpleChat.getLogger().warning("Channel name [" + name + "] too long! Max length: 16.");
|
||||
simpleChat.getLogger().warning("Skipping channel, please check your settings!");
|
||||
continue;
|
||||
@@ -37,23 +37,23 @@ public class ChannelManager {
|
||||
|
||||
switch (type.toLowerCase()) {
|
||||
case "towny":
|
||||
channel = new TownChatChannel(name, simpleChat);
|
||||
channel = new TownChatChannel(key, simpleChat);
|
||||
hasTownChat = true;
|
||||
break;
|
||||
case "nation":
|
||||
channel = new NationChatChannel(name, simpleChat);
|
||||
channel = new NationChatChannel(key, simpleChat);
|
||||
hasNationChat = true;
|
||||
break;
|
||||
case "alliance":
|
||||
channel = new AllianceChatChannel(name, simpleChat);
|
||||
channel = new AllianceChatChannel(key, simpleChat);
|
||||
hasAllianceChat = true;
|
||||
break;
|
||||
case "party":
|
||||
channel = new PartyChatChannel(name, simpleChat);
|
||||
channel = new PartyChatChannel(key, simpleChat);
|
||||
hasPartyChat = true;
|
||||
break;
|
||||
case "normal":
|
||||
channel = new SimpleChatChannel(name, simpleChat);
|
||||
channel = new SimpleChatChannel(key, simpleChat);
|
||||
break;
|
||||
default:
|
||||
simpleChat.getLogger().warning("Invalid channel type for channel [" + key + "]. Skipping channel.");
|
||||
@@ -62,14 +62,14 @@ public class ChannelManager {
|
||||
|
||||
if (channel.isTownChat() || channel.isNationChat() || channel.isAllianceChat()) {
|
||||
if (!Bukkit.getPluginManager().isPluginEnabled("Towny")) {
|
||||
simpleChat.getLogger().warning("Towny related channel with name [" + channel.getName() + "] found, but Towny isn't installed. Skipping channel.");
|
||||
simpleChat.getLogger().warning("Towny related channel with key [" + key + "] found, but Towny isn't installed. Skipping channel.");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (channel.isPartyChat()) {
|
||||
if (!Bukkit.getPluginManager().isPluginEnabled("mcMMO")) {
|
||||
simpleChat.getLogger().warning("mcMMO related channel with name [" + channel.getName() + "] found, but mcMMO isn't installed. Skipping channel.");
|
||||
simpleChat.getLogger().warning("mcMMO related channel with key [" + key + "] found, but mcMMO isn't installed. Skipping channel.");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -78,7 +78,7 @@ public class ChannelManager {
|
||||
|
||||
CommandManager commandManager = simpleChat.getCommandManager().getCommandManager();
|
||||
|
||||
String commandName = section.contains("aliases") ? section.getString("aliases") : channel.getName();
|
||||
String commandName = section.contains("aliases") ? section.getString("aliases") : key;
|
||||
|
||||
commandManager.getCommandReplacements().addReplacement("channelName", commandName);
|
||||
commandManager.registerCommand(new AliasedChannelCommand(simpleChat, channel));
|
||||
|
||||
Reference in new issue
Block a user