- New Channel: AllianceChat
    - Requires Towny 0.95.0.5 or newer.
    - Will send messages to every online ally of your nation.
    - Has its own channel_format in the chatconfig.yml.
    - Your channels.yml will need to have an Alliance channel added.
    - Default channels.yml is:
    alliance:
        commands: [ac]
        type: ALLIANCE
        channeltag: '&f[&2AC&f]'
        messagecolour: '&a'
        permission: 'towny.chat.alliance'
        range: '-1'
This commit is contained in:
Llm Dl committed 2019-11-05 13:37:05 -06:00
1 parent 6df2fac32a
commit 4e9999019b
9 files changed
+71 -4

No files matched your search

+1 -1
View File
@@ -7,7 +7,7 @@
<groupId>com.palmergames.bukkit</groupId>
<artifactId>TownyChat</artifactId>
<packaging>jar</packaging>
<version>0.61</version>
<version>0.62</version>
<licenses>
<license>
+9 -1
View File
@@ -56,7 +56,15 @@ Channels:
messagecolour: '&e'
permission: 'towny.chat.nation'
range: '-1'
alliance:
commands: [ac]
type: ALLIANCE
channeltag: '&f[&2AC&f]'
messagecolour: '&a'
permission: 'towny.chat.alliance'
range: '-1'
admin:
commands: [a,admin]
type: DEFAULT
+18 -1
View File
@@ -256,4 +256,21 @@ v0.60:
v0.61:
- New Config Option: display_modes_set_on_join
- Default: true
- If true players will see [Towny] Modes set: general when they log in.
- If true players will see [Towny] Modes set: general when they log in.
v0.62:
- New Channel: AllianceChat
- Requires Towny 0.95.0.5 or newer.
- Will send messages to every online ally of your nation.
- Has its own channel_format in the chatconfig.yml.
- Your channels.yml will need to have an Alliance channel added.
- Default channels.yml is:
alliance:
commands: [ac]
type: ALLIANCE
channeltag: '&f[&2AC&f]'
messagecolour: '&a'
permission: 'towny.chat.alliance'
range: '-1'
@@ -91,6 +91,16 @@ public class StandardChannel extends Channel {
recipients = checkSpying(recipients);
break;
case ALLIANCE:
if (nation == null) {
event.setCancelled(true);
return;
}
Format = ChatSettings.getRelevantFormatGroup(player).getALLIANCE();
recipients = new HashSet<>(findRecipients(player, TownyAPI.getInstance().getOnlinePlayersAlliance(nation)));
recipients = checkSpying(recipients);
break;
case DEFAULT:
Format = ChatSettings.getRelevantFormatGroup(player).getDEFAULT();
recipients = new HashSet<>(findRecipients(player, new ArrayList<>(event.getRecipients())));
@@ -155,6 +165,9 @@ public class StandardChannel extends Channel {
case NATION:
break;
case ALLIANCE:
break;
case DEFAULT:
break;
@@ -14,7 +14,7 @@ public class channelFormats {
this.name = name.toLowerCase();
}
private String name, GLOBAL, TOWN, NATION, DEFAULT;
private String name, GLOBAL, TOWN, NATION, ALLIANCE, DEFAULT;
/**
* @return a clone of this channelFormats
@@ -26,6 +26,7 @@ public class channelFormats {
clone.setGLOBAL(this.getGLOBAL());
clone.setTOWN(this.getTOWN());
clone.setNATION(this.getNATION());
clone.setALLIANCE(this.getALLIANCE());
clone.setDEFAULT(this.getDEFAULT());
return clone;
@@ -91,6 +92,21 @@ public class channelFormats {
this.NATION = NATION;
}
/**
* @return the ALLIANCE
*/
public String getALLIANCE() {
return this.ALLIANCE;
}
/**
* @param ALLIANCE
* the ALLIANCE to set
*/
public void setALLIANCE(String ALLIANCE) {
this.ALLIANCE = ALLIANCE;
}
/**
* @return the DEFAULT
*/
@@ -4,6 +4,7 @@ package com.palmergames.bukkit.TownyChat.channels;
public enum channelTypes {
TOWN,
NATION,
ALLIANCE,
DEFAULT,
GLOBAL,
PRIVATE
@@ -93,6 +93,10 @@ public enum ChatConfigNodes {
"channel_formats.nation",
"{channelTag} {towntagoverride}{townycolor}{permprefix}{townyprefix}{playername}{townypostfix}{permsuffix}&f:{msgcolour} {msg}",
"# NATION channel types."),
CHANNEL_FORMATS_ALLIANCE(
"channel_formats.alliance",
"{channelTag} {towntagoverride}{townycolor}{permprefix}{townyprefix}{playername}{townypostfix}{permsuffix}&f:{msgcolour} {msg}",
"# ALLIANCE channel types."),
CHANNEL_FORMATS_DEFAULT(
"channel_formats.default",
"{channelTag} {permprefix}{playername}{permsuffix}&f:{msgcolour} {msg}",
@@ -91,12 +91,14 @@ public class ChatSettings extends tag_formats {
|| !chatConfig.contains("worlds." + world + ".global")
|| !chatConfig.contains("worlds." + world + ".town")
|| !chatConfig.contains("worlds." + world + ".nation")
|| !chatConfig.contains("worlds." + world + ".alliance")
|| !chatConfig.contains("worlds." + world + ".default")) {
newChatConfig.createSection("worlds." + world);
ConfigurationSection worldsection = newChatConfig.getConfigurationSection("worlds." + world);
worldsection.set("global", (chatConfig.get("worlds." + world + ".global")!= null) ? chatConfig.get("worlds." + world + ".global") : ChatConfigNodes.CHANNEL_FORMATS_GLOBAL.getDefault());
worldsection.set("town", (chatConfig.get("worlds." + world + ".town")!= null) ? chatConfig.get("worlds." + world + ".town") : ChatConfigNodes.CHANNEL_FORMATS_TOWN.getDefault());
worldsection.set("nation", (chatConfig.get("worlds." + world + ".nation")!= null) ? chatConfig.get("worlds." + world + ".nation") : ChatConfigNodes.CHANNEL_FORMATS_NATION.getDefault());
worldsection.set("alliance", (chatConfig.get("worlds." + world + ".alliance")!= null) ? chatConfig.get("worlds." + world + ".alliance") : ChatConfigNodes.CHANNEL_FORMATS_ALLIANCE.getDefault());
worldsection.set("default", (chatConfig.get("worlds." + world + ".default")!= null) ? chatConfig.get("worlds." + world + ".default") : ChatConfigNodes.CHANNEL_FORMATS_DEFAULT.getDefault());
}
}
@@ -257,6 +257,9 @@ public class ConfigurationHandler {
if (element.equalsIgnoreCase("nation"))
group.setNATION(subNodes.get(element).toString());
if (element.equalsIgnoreCase("alliance"))
group.setALLIANCE(subNodes.get(element).toString());
if (element.equalsIgnoreCase("default"))
group.setDEFAULT(subNodes.get(element).toString());
@@ -283,6 +286,9 @@ public class ConfigurationHandler {
if (element.equalsIgnoreCase("nation"))
group.setNATION(world.get(element).toString());
if (element.equalsIgnoreCase("alliance"))
group.setALLIANCE(world.get(element).toString());
if (element.equalsIgnoreCase("default"))
group.setDEFAULT(world.get(element).toString());