mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-03 06:28:54 +00:00
Add better channel switch failure messages
This commit is contained in:
1 parent
6ca2b9c4c8
commit
c351aa5e48
9 files changed
+69
-25
No files matched your search
@@ -4,12 +4,7 @@ import com.palmergames.bukkit.towny.TownyAPI;
|
||||
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
|
||||
import com.palmergames.bukkit.towny.object.Resident;
|
||||
import net.draycia.simplechat.SimpleChat;
|
||||
import net.draycia.simplechat.channels.ChatChannel;
|
||||
import net.draycia.simplechat.storage.ChatUser;
|
||||
import net.kyori.adventure.text.format.TextColor;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class AllianceChatChannel extends SimpleChatChannel {
|
||||
|
||||
@@ -54,6 +49,16 @@ public class AllianceChatChannel extends SimpleChatChannel {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isInTown(ChatUser user) {
|
||||
try {
|
||||
return TownyAPI.getInstance().getDataSource().getResident(user.asPlayer().getName()).hasTown();
|
||||
} catch (NotRegisteredException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAllianceChat() {
|
||||
return true;
|
||||
|
||||
@@ -5,12 +5,7 @@ import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
|
||||
import com.palmergames.bukkit.towny.object.Nation;
|
||||
import com.palmergames.bukkit.towny.object.Resident;
|
||||
import net.draycia.simplechat.SimpleChat;
|
||||
import net.draycia.simplechat.channels.ChatChannel;
|
||||
import net.draycia.simplechat.storage.ChatUser;
|
||||
import net.kyori.adventure.text.format.TextColor;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class NationChatChannel extends SimpleChatChannel {
|
||||
|
||||
@@ -77,6 +72,16 @@ public class NationChatChannel extends SimpleChatChannel {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isInNation(ChatUser user) {
|
||||
try {
|
||||
return TownyAPI.getInstance().getDataSource().getResident(user.asPlayer().getName()).hasNation();
|
||||
} catch (NotRegisteredException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNationChat() {
|
||||
return true;
|
||||
|
||||
@@ -2,12 +2,7 @@ package net.draycia.simplechat.channels.impls;
|
||||
|
||||
import com.gmail.nossr50.api.PartyAPI;
|
||||
import net.draycia.simplechat.SimpleChat;
|
||||
import net.draycia.simplechat.channels.ChatChannel;
|
||||
import net.draycia.simplechat.storage.ChatUser;
|
||||
import net.kyori.adventure.text.format.TextColor;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class PartyChatChannel extends SimpleChatChannel {
|
||||
|
||||
@@ -50,6 +45,10 @@ public class PartyChatChannel extends SimpleChatChannel {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isInParty(ChatUser user) {
|
||||
return PartyAPI.inParty(user.asPlayer());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPartyChat() {
|
||||
return true;
|
||||
|
||||
@@ -4,12 +4,7 @@ import com.palmergames.bukkit.towny.TownyAPI;
|
||||
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
|
||||
import com.palmergames.bukkit.towny.object.Resident;
|
||||
import net.draycia.simplechat.SimpleChat;
|
||||
import net.draycia.simplechat.channels.ChatChannel;
|
||||
import net.draycia.simplechat.storage.ChatUser;
|
||||
import net.kyori.adventure.text.format.TextColor;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class TownChatChannel extends SimpleChatChannel {
|
||||
|
||||
@@ -72,6 +67,16 @@ public class TownChatChannel extends SimpleChatChannel {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isInTown(ChatUser user) {
|
||||
try {
|
||||
return TownyAPI.getInstance().getDataSource().getResident(user.asPlayer().getName()).hasTown();
|
||||
} catch (NotRegisteredException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTownChat() {
|
||||
return true;
|
||||
|
||||
Reference in new issue
Block a user