- Bump minimum Towny version to 0.96.5.5.
This commit is contained in:
Llm Dl committed 2020-12-19 12:06:36 -06:00
1 parent 44978325e5
commit 99d0433b3e
4 files changed
+19 -20

No files matched your search

+2 -1
View File
@@ -356,9 +356,10 @@ v0.84:
- Closes https://github.com/TownyAdvanced/Towny/issues/4087. - Closes https://github.com/TownyAdvanced/Towny/issues/4087.
- Implemented PlayerJoinChatChannelEvent, courtesy of Glare with PR #32. - Implemented PlayerJoinChatChannelEvent, courtesy of Glare with PR #32.
- Closes https://github.com/TownyAdvanced/Towny/issues/4575. - Closes https://github.com/TownyAdvanced/Towny/issues/4575.
v0.85:
- Add persistant leaving for channels. - Add persistant leaving for channels.
- Uses Towny resident metadata, you will be able to see ignored channels on your /res status screen. - Uses Towny resident metadata, you will be able to see ignored channels on your /res status screen.
- Normal joining/leaving commands are used just like before. - Normal joining/leaving commands are used just like before.
- Closes https://github.com/TownyAdvanced/Towny/issues/3133. - Closes https://github.com/TownyAdvanced/Towny/issues/3133.
- Bump minimum Towny version to 0.96.3.0. - Bump minimum Towny version to 0.96.3.0.
v0.85:
- Bump minimum Towny version to 0.96.5.5.
@@ -45,7 +45,7 @@ public class Chat extends JavaPlugin {
private Towny towny = null; private Towny towny = null;
private DynmapAPI dynMap = null; private DynmapAPI dynMap = null;
private static Version requiredTownyVersion = Version.fromString("0.96.3.0"); private static Version requiredTownyVersion = Version.fromString("0.96.5.5");
public static boolean usingPlaceholderAPI = false; public static boolean usingPlaceholderAPI = false;
boolean chatConfigError = false; boolean chatConfigError = false;
boolean channelsConfigError = false; boolean channelsConfigError = false;
@@ -26,6 +26,7 @@ import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.dynmap.DynmapAPI; import org.dynmap.DynmapAPI;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
@@ -48,13 +49,14 @@ public class StandardChannel extends Channel {
Player player = event.getPlayer(); Player player = event.getPlayer();
Set<Player> recipients = null; Set<Player> recipients = null;
Resident resident = null; Resident resident = TownyUniverse.getInstance().getResident(player.getUniqueId());
if (resident == null)
return;
Town town = null; Town town = null;
Nation nation = null; Nation nation = null;
String Format = ""; String Format = "";
try { try {
resident = TownyUniverse.getInstance().getDataSource().getResident(player.getName());
town = resident.getTown(); town = resident.getTown();
nation = resident.getTown().getNation(); nation = resident.getTown().getNation();
} catch (NotRegisteredException e1) { } catch (NotRegisteredException e1) {
@@ -307,6 +309,7 @@ public class StandardChannel extends Channel {
recipients.addAll(event.getRecipients()); recipients.addAll(event.getRecipients());
spies = checkSpying(spies); spies = checkSpying(spies);
String format = formatSpyMessage(type, event.getPlayer()); String format = formatSpyMessage(type, event.getPlayer());
if (format == null) return;
// Remove spies who've already seen the message naturally. // Remove spies who've already seen the message naturally.
for (Player spy : spies) for (Player spy : spies)
@@ -323,12 +326,14 @@ public class StandardChannel extends Channel {
* @param player - Player who chatted. * @param player - Player who chatted.
* @return format - Message format. * @return format - Message format.
*/ */
@Nullable
private String formatSpyMessage(channelTypes type, Player player) { private String formatSpyMessage(channelTypes type, Player player) {
Resident resident = null; Resident resident = TownyUniverse.getInstance().getResident(player.getUniqueId());
if (resident == null)
return null;
Town town = null; Town town = null;
Nation nation = null; Nation nation = null;
try { try {
resident = TownyUniverse.getInstance().getDataSource().getResident(player.getName());
town = resident.getTown(); town = resident.getTown();
nation = resident.getTown().getNation(); nation = resident.getTown().getNation();
} catch (NotRegisteredException e1) { } catch (NotRegisteredException e1) {
@@ -9,7 +9,6 @@ import com.palmergames.bukkit.TownyChat.config.ChatSettings;
import com.palmergames.bukkit.TownyChat.tasks.onPlayerJoinTask; import com.palmergames.bukkit.TownyChat.tasks.onPlayerJoinTask;
import com.palmergames.bukkit.towny.Towny; import com.palmergames.bukkit.towny.Towny;
import com.palmergames.bukkit.towny.TownyMessaging; import com.palmergames.bukkit.towny.TownyMessaging;
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
import com.palmergames.bukkit.towny.exceptions.TownyException; import com.palmergames.bukkit.towny.exceptions.TownyException;
import com.palmergames.bukkit.towny.object.Resident; import com.palmergames.bukkit.towny.object.Resident;
import com.palmergames.bukkit.towny.object.Translation; import com.palmergames.bukkit.towny.object.Translation;
@@ -186,21 +185,15 @@ public class TownyChatPlayerListener implements Listener {
* We found no channels available so modify the chat (if enabled) and exit. * We found no channels available so modify the chat (if enabled) and exit.
*/ */
if (ChatSettings.isModify_chat()) { if (ChatSettings.isModify_chat()) {
try { event.setFormat(ChatSettings.getRelevantFormatGroup(player).getGLOBAL().replace("{channelTag}", "").replace("{msgcolour}", ""));
event.setFormat(ChatSettings.getRelevantFormatGroup(player).getGLOBAL().replace("{channelTag}", "").replace("{msgcolour}", "")); Resident resident = TownyUniverse.getInstance().getResident(player.getUniqueId());
Resident resident = TownyUniverse.getInstance().getDataSource().getResident(player.getName());
LocalTownyChatEvent chatEvent = new LocalTownyChatEvent(event, resident); LocalTownyChatEvent chatEvent = new LocalTownyChatEvent(event, resident);
if (Towny.is116Plus()) { if (Towny.is116Plus()) {
event.setFormat(HexFormatter.translateHexColors(TownyChatFormatter.getChatFormat(chatEvent))); event.setFormat(HexFormatter.translateHexColors(TownyChatFormatter.getChatFormat(chatEvent)));
} else { } else {
event.setFormat(TownyChatFormatter.getChatFormat(chatEvent)); event.setFormat(TownyChatFormatter.getChatFormat(chatEvent));
}
} catch (NotRegisteredException e) {
// World or resident not registered with Towny
e.printStackTrace();
} }
} }
} }