mirror of
https://github.com/darksaid98/TownyChat.git
synced 2026-12-04 14:38:58 +00:00
Fixed {townformatted} and {nationformatted} to display correctly.
This commit is contained in:
1 parent
f368d6d25b
commit
69022478d2
5 files changed
+22
-9
No files matched your search
@@ -38,3 +38,6 @@ v0.7:
|
|||||||
target: 'minecraft' #
|
target: 'minecraft' #
|
||||||
formatting:
|
formatting:
|
||||||
chat: '%foreground%[%red%%ircPrefix%%sender%%foreground%] %message%'
|
chat: '%foreground%[%red%%ircPrefix%%sender%%foreground%] %message%'
|
||||||
|
v0.8:
|
||||||
|
- Fixed {townformatted} and {nationformatted} to display correctly.
|
||||||
|
|
||||||
@@ -73,11 +73,15 @@ public class Chat extends JavaPlugin {
|
|||||||
|
|
||||||
test = pm.getPlugin("CraftIRC");
|
test = pm.getPlugin("CraftIRC");
|
||||||
if (test != null) {
|
if (test != null) {
|
||||||
if (Double.valueOf(test.getDescription().getVersion()) >= 3.1) {
|
try {
|
||||||
craftIRC = (CraftIRC) test;
|
if (Double.valueOf(test.getDescription().getVersion()) >= 3.1) {
|
||||||
irc = new CraftIRCHandler(towny, craftIRC, "towny");
|
craftIRC = (CraftIRC) test;
|
||||||
} else
|
irc = new CraftIRCHandler(towny, craftIRC, "towny");
|
||||||
logger.warning("TownyChat requires CraftIRC version 3.1 or higher to relay chat.");
|
} else
|
||||||
|
logger.warning("TownyChat requires CraftIRC version 3.1 or higher to relay chat.");
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
logger.warning("Non number format found for craftIRC version string!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public class TownyChatFormatter {
|
|||||||
replacer.registerFormatReplacement(Pattern.quote("{townformatted}"), new TownyChatReplacerCallable() {
|
replacer.registerFormatReplacement(Pattern.quote("{townformatted}"), new TownyChatReplacerCallable() {
|
||||||
@Override
|
@Override
|
||||||
public String call(String match, TownyChatEvent event) throws Exception {
|
public String call(String match, TownyChatEvent event) throws Exception {
|
||||||
return formatTownyTag(event.getResident(), false, true);
|
return formatTownTag(event.getResident(), false, true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
replacer.registerFormatReplacement(Pattern.quote("{towntag}"), new TownyChatReplacerCallable() {
|
replacer.registerFormatReplacement(Pattern.quote("{towntag}"), new TownyChatReplacerCallable() {
|
||||||
@@ -246,7 +246,9 @@ public class TownyChatFormatter {
|
|||||||
public static String formatTownTag(Resident resident, Boolean override, Boolean full) {
|
public static String formatTownTag(Resident resident, Boolean override, Boolean full) {
|
||||||
try {
|
try {
|
||||||
if (resident.hasTown())
|
if (resident.hasTown())
|
||||||
if (resident.getTown().hasTag())
|
if (full)
|
||||||
|
return String.format(TownySettings.getChatTownTagFormat(), resident.getTown().getName());
|
||||||
|
else if (resident.getTown().hasTag())
|
||||||
return String.format(TownySettings.getChatTownTagFormat(), resident.getTown().getTag());
|
return String.format(TownySettings.getChatTownTagFormat(), resident.getTown().getTag());
|
||||||
else if (override)
|
else if (override)
|
||||||
return String.format(TownySettings.getChatTownTagFormat(), resident.getTown().getName());
|
return String.format(TownySettings.getChatTownTagFormat(), resident.getTown().getName());
|
||||||
@@ -259,7 +261,9 @@ public class TownyChatFormatter {
|
|||||||
public static String formatNationTag(Resident resident, Boolean override, Boolean full) {
|
public static String formatNationTag(Resident resident, Boolean override, Boolean full) {
|
||||||
try {
|
try {
|
||||||
if (resident.hasNation())
|
if (resident.hasNation())
|
||||||
if (resident.getTown().getNation().hasTag())
|
if (full)
|
||||||
|
return String.format(TownySettings.getChatNationTagFormat(), resident.getTown().getNation().getName());
|
||||||
|
else if (resident.getTown().getNation().hasTag())
|
||||||
return String.format(TownySettings.getChatNationTagFormat(), resident.getTown().getNation().getTag());
|
return String.format(TownySettings.getChatNationTagFormat(), resident.getTown().getNation().getTag());
|
||||||
else if (override)
|
else if (override)
|
||||||
return String.format(TownySettings.getChatNationTagFormat(), resident.getTown().getNation().getName());
|
return String.format(TownySettings.getChatNationTagFormat(), resident.getTown().getNation().getName());
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ public class TownyPlayerHighestListener extends PlayerListener {
|
|||||||
try {
|
try {
|
||||||
if (plugin.getEssentials().getUser(player).isMuted()) {
|
if (plugin.getEssentials().getUser(player).isMuted()) {
|
||||||
TownyMessaging.sendErrorMsg(player, "Unable to talk...You are currently muted!");
|
TownyMessaging.sendErrorMsg(player, "Unable to talk...You are currently muted!");
|
||||||
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (TownyException e) {
|
} catch (TownyException e) {
|
||||||
@@ -125,6 +126,7 @@ public class TownyPlayerHighestListener extends PlayerListener {
|
|||||||
try {
|
try {
|
||||||
if (plugin.getEssentials().getUser(player).isMuted()) {
|
if (plugin.getEssentials().getUser(player).isMuted()) {
|
||||||
TownyMessaging.sendErrorMsg(player, "Unable to talk...You are currently muted!");
|
TownyMessaging.sendErrorMsg(player, "Unable to talk...You are currently muted!");
|
||||||
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (TownyException e) {
|
} catch (TownyException e) {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
name: TownyChat
|
name: TownyChat
|
||||||
main: com.palmergames.bukkit.TownyChat.Chat
|
main: com.palmergames.bukkit.TownyChat.Chat
|
||||||
version: 0.7
|
version: 0.8
|
||||||
author: ElgarL
|
author: ElgarL
|
||||||
website: http://code.google.com/a/eclipselabs.org/p/towny/
|
website: http://code.google.com/a/eclipselabs.org/p/towny/
|
||||||
description: >
|
description: >
|
||||||
|
|||||||
Reference in new issue
Block a user