mirror of
https://github.com/darksaid98/TownyChat.git
synced 2026-12-03 06:28:57 +00:00
v0.85:
- Bump minimum Towny version to 0.96.5.5.
This commit is contained in:
1 parent
44978325e5
commit
99d0433b3e
5 files changed
+22
-23
No files matched your search
@@ -356,9 +356,10 @@ v0.84:
|
||||
- Closes https://github.com/TownyAdvanced/Towny/issues/4087.
|
||||
- Implemented PlayerJoinChatChannelEvent, courtesy of Glare with PR #32.
|
||||
- Closes https://github.com/TownyAdvanced/Towny/issues/4575.
|
||||
v0.85:
|
||||
- Add persistant leaving for channels.
|
||||
- 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.
|
||||
- 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 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;
|
||||
boolean chatConfigError = false;
|
||||
boolean channelsConfigError = false;
|
||||
|
||||
@@ -286,7 +286,7 @@ public abstract class Channel {
|
||||
|
||||
private void playerAddIgnoreMeta(Player player) {
|
||||
StringDataField icdf = new StringDataField("townychat_ignoredChannels", "", "Ignored TownyChat Channels");
|
||||
Resident resident = TownyUniverse.getInstance().getResident(player.getUniqueId());
|
||||
Resident resident = TownyUniverse.getInstance().getResident(player.getUniqueId());
|
||||
if (resident == null)
|
||||
return;
|
||||
|
||||
@@ -305,7 +305,7 @@ public abstract class Channel {
|
||||
|
||||
private void playerRemoveIgnoreMeta(Player player) {
|
||||
StringDataField icdf = new StringDataField("townychat_ignoredChannels", "", "Ignored TownyChat Channels");
|
||||
Resident resident = TownyUniverse.getInstance().getResident(player.getUniqueId());
|
||||
Resident resident = TownyUniverse.getInstance().getResident(player.getUniqueId());
|
||||
if (resident == null || !resident.hasMeta(icdf.getKey()))
|
||||
return;
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.dynmap.DynmapAPI;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
@@ -48,13 +49,14 @@ public class StandardChannel extends Channel {
|
||||
|
||||
Player player = event.getPlayer();
|
||||
Set<Player> recipients = null;
|
||||
Resident resident = null;
|
||||
Resident resident = TownyUniverse.getInstance().getResident(player.getUniqueId());
|
||||
if (resident == null)
|
||||
return;
|
||||
Town town = null;
|
||||
Nation nation = null;
|
||||
String Format = "";
|
||||
|
||||
try {
|
||||
resident = TownyUniverse.getInstance().getDataSource().getResident(player.getName());
|
||||
town = resident.getTown();
|
||||
nation = resident.getTown().getNation();
|
||||
} catch (NotRegisteredException e1) {
|
||||
@@ -307,6 +309,7 @@ public class StandardChannel extends Channel {
|
||||
recipients.addAll(event.getRecipients());
|
||||
spies = checkSpying(spies);
|
||||
String format = formatSpyMessage(type, event.getPlayer());
|
||||
if (format == null) return;
|
||||
|
||||
// Remove spies who've already seen the message naturally.
|
||||
for (Player spy : spies)
|
||||
@@ -323,12 +326,14 @@ public class StandardChannel extends Channel {
|
||||
* @param player - Player who chatted.
|
||||
* @return format - Message format.
|
||||
*/
|
||||
@Nullable
|
||||
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;
|
||||
Nation nation = null;
|
||||
try {
|
||||
resident = TownyUniverse.getInstance().getDataSource().getResident(player.getName());
|
||||
town = resident.getTown();
|
||||
nation = resident.getTown().getNation();
|
||||
} 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.towny.Towny;
|
||||
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.object.Resident;
|
||||
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.
|
||||
*/
|
||||
if (ChatSettings.isModify_chat()) {
|
||||
try {
|
||||
event.setFormat(ChatSettings.getRelevantFormatGroup(player).getGLOBAL().replace("{channelTag}", "").replace("{msgcolour}", ""));
|
||||
Resident resident = TownyUniverse.getInstance().getDataSource().getResident(player.getName());
|
||||
event.setFormat(ChatSettings.getRelevantFormatGroup(player).getGLOBAL().replace("{channelTag}", "").replace("{msgcolour}", ""));
|
||||
Resident resident = TownyUniverse.getInstance().getResident(player.getUniqueId());
|
||||
|
||||
LocalTownyChatEvent chatEvent = new LocalTownyChatEvent(event, resident);
|
||||
LocalTownyChatEvent chatEvent = new LocalTownyChatEvent(event, resident);
|
||||
|
||||
if (Towny.is116Plus()) {
|
||||
event.setFormat(HexFormatter.translateHexColors(TownyChatFormatter.getChatFormat(chatEvent)));
|
||||
} else {
|
||||
event.setFormat(TownyChatFormatter.getChatFormat(chatEvent));
|
||||
}
|
||||
|
||||
} catch (NotRegisteredException e) {
|
||||
// World or resident not registered with Towny
|
||||
e.printStackTrace();
|
||||
if (Towny.is116Plus()) {
|
||||
event.setFormat(HexFormatter.translateHexColors(TownyChatFormatter.getChatFormat(chatEvent)));
|
||||
} else {
|
||||
event.setFormat(TownyChatFormatter.getChatFormat(chatEvent));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user