mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-11-23 10:45:54 +01:00
Added message for ChatSpy
This commit is contained in:
parent
14f211bd80
commit
05e7a0e2d5
@ -18,6 +18,7 @@ import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public class ChatSpyCommand extends SubCommand {
|
||||
@ -45,39 +46,57 @@ public class ChatSpyCommand extends SubCommand {
|
||||
case "global":
|
||||
if(!playerData.isGlobalChatSpy()){
|
||||
playerData.enableGlobalChatSpy();
|
||||
messageManager.sendMessage(player, languageLoad.getString("Command.Island.Admin.Bank.ByConsole.Message"));
|
||||
messageManager.sendMessage(player, languageLoad.getString("Command.Island.Admin.ChatSpy.GlobalEnabled.Message"));
|
||||
} else {
|
||||
messageManager.sendMessage(player, languageLoad.getString("Command.Island.Admin.Bank.ByConsole.Message"));
|
||||
messageManager.sendMessage(player, languageLoad.getString("Command.Island.Admin.ChatSpy.GlobalAlreadyEnabled.Message"));
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1f, 1f);
|
||||
}
|
||||
break;
|
||||
case "add":
|
||||
if(args.length > 2){
|
||||
Island island = islandManager.getIslandByPlayer(new OfflinePlayer(UUID.fromString(args[1])).getBukkitOfflinePlayer());
|
||||
OfflinePlayer offlinePlayer = new OfflinePlayer(args[1]);
|
||||
Island island = islandManager.getIslandByPlayer(offlinePlayer.getBukkitOfflinePlayer());
|
||||
if(island != null) {
|
||||
playerData.addChatSpyIsland(island);
|
||||
messageManager.sendMessage(player, languageLoad.getString("Command.Island.Admin.ChatSpy.Add.Message"));
|
||||
} else {
|
||||
messageManager.sendMessage(player, languageLoad.getString("Command.Island.Admin.ChatSpy.NullIsland.Message"));
|
||||
}
|
||||
} else {
|
||||
messageManager.sendMessage(player, languageLoad.getString("Command.Island.Admin.Bank.Unexpected.Message"));
|
||||
messageManager.sendMessage(player, languageLoad.getString("Command.Island.Admin.ChatSpy.InvalidArgNumber.Message"));
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1f, 1f);
|
||||
}
|
||||
break;
|
||||
case "remove":
|
||||
if(args.length > 2){
|
||||
Island island = islandManager.getIslandByPlayer(new OfflinePlayer(UUID.fromString(args[1])).getBukkitOfflinePlayer());
|
||||
OfflinePlayer offlinePlayer = new OfflinePlayer(args[1]);
|
||||
Island island = islandManager.getIslandByPlayer(offlinePlayer.getBukkitOfflinePlayer());
|
||||
if(island != null) {
|
||||
playerData.removeChatSpyIsland(island);
|
||||
messageManager.sendMessage(player, languageLoad.getString("Command.Island.Admin.ChatSpy.Remove.Message"));
|
||||
} else {
|
||||
messageManager.sendMessage(player, languageLoad.getString("Command.Island.Admin.ChatSpy.NullIsland.Message"));
|
||||
}
|
||||
} else {
|
||||
messageManager.sendMessage(player, languageLoad.getString("Command.Island.Admin.Bank.Unexpected.Message"));
|
||||
messageManager.sendMessage(player, languageLoad.getString("Command.Island.Admin.ChatSpy.InvalidArgNumber.Message"));
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1f, 1f);
|
||||
}
|
||||
break;
|
||||
case "list":
|
||||
|
||||
Set<UUID> uuidSet = playerData.getChatSpyIslands();
|
||||
if(!uuidSet.isEmpty()){
|
||||
messageManager.sendMessage(player, languageLoad.getString("Command.Island.Admin.ChatSpy.List.Start.Message"));
|
||||
for(UUID uuid : uuidSet) {
|
||||
messageManager.sendMessage(player, languageLoad.getString("Command.Island.Admin.ChatSpy.List.List.Message")
|
||||
.replace("%owner", new OfflinePlayer(uuid).getName()));
|
||||
}
|
||||
messageManager.sendMessage(player, languageLoad.getString("Command.Island.Admin.ChatSpy.List.End.Message"));
|
||||
} else {
|
||||
messageManager.sendMessage(player, languageLoad.getString("Command.Island.Admin.ChatSpy.List.Empty.Message"));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
messageManager.sendMessage(player, languageLoad.getString("Command.Island.Admin.Bank.Unexpected.Message"));
|
||||
messageManager.sendMessage(player, languageLoad.getString("Command.Island.Admin.ChatSpy.InvalidArgNumber.Message"));
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1f, 1f);
|
||||
break;
|
||||
}
|
||||
@ -118,6 +137,6 @@ public class ChatSpyCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public String[] getArguments() {
|
||||
return new String[0];
|
||||
return new String[]{"toggle", "global", "add", "remove", "list"};
|
||||
}
|
||||
}
|
||||
|
@ -350,6 +350,10 @@ public class PlayerData {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(skyblock, this::save);
|
||||
}
|
||||
|
||||
public Set<UUID> getChatSpyIslands() {
|
||||
return new HashSet<>(spiedIslands);
|
||||
}
|
||||
|
||||
public void addChatSpyIsland(Island island) {
|
||||
this.addChatSpyIsland(island.getOwnerUUID());
|
||||
}
|
||||
|
@ -183,6 +183,27 @@ Command:
|
||||
Message: '&bSkyBlock &8| &aInfo&8: &eChat spy enabled.'
|
||||
Disabled:
|
||||
Message: '&bSkyBlock &8| &aInfo&8: &eChat spy disabled.'
|
||||
GlobalEnabled:
|
||||
Message: '&bSkyBlock &8| &aInfo&8: &eEnabled global chat spy.'
|
||||
GlobalAlreadyEnabled:
|
||||
Message: '&bSkyBlock &8| &cError&8: &eGlobal chat spy already enabled.'
|
||||
Add:
|
||||
Message: '&bSkyBlock &8| &aInfo&8: &eAdded %owner''s island to chat spy.'
|
||||
Remove:
|
||||
Message: '&bSkyBlock &8| &aInfo&8: &eRemoved %owner''s island to chat spy.'
|
||||
NullIsland:
|
||||
Message: '&bSkyBlock &8| &cError&8: &ePlayer does not have an island.'
|
||||
InvalidArgNumber:
|
||||
Message: '&bSkyBlock &8| &cError&8: &eInvalid arguments number.'
|
||||
List:
|
||||
Start:
|
||||
Message: '&bSkyBlock &8| &aInfo&8: &eCurrently spied island''s chats:'
|
||||
List:
|
||||
Message: '&a- &e%owner'
|
||||
End:
|
||||
Message: '&a---------'
|
||||
Empty:
|
||||
Message: '&bSkyBlock &8| &aInfo&8: &eYou are not spying on any island''s chat. Global mode is enabled.'
|
||||
Reload:
|
||||
Info:
|
||||
Message: '&f&oReload all loaded files.'
|
||||
|
Loading…
Reference in New Issue
Block a user