mirror of
https://github.com/Aust1n46/VentureChat.git
synced 2025-05-23 10:39:05 +00:00
Removed mail command. Essentials mail command is more widely used.
This commit is contained in:
parent
d81e1d0872
commit
016371d5bf
@ -66,7 +66,6 @@ import mineverse.Aust1n46.chat.command.chat.Kickchannel;
|
||||
import mineverse.Aust1n46.chat.command.chat.Kickchannelall;
|
||||
import mineverse.Aust1n46.chat.command.chat.Leave;
|
||||
import mineverse.Aust1n46.chat.command.chat.Listen;
|
||||
import mineverse.Aust1n46.chat.command.chat.Mail;
|
||||
import mineverse.Aust1n46.chat.command.chat.Me;
|
||||
import mineverse.Aust1n46.chat.command.chat.Nick;
|
||||
import mineverse.Aust1n46.chat.command.chat.Party;
|
||||
@ -257,11 +256,6 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
||||
while(b.hasMoreTokens()) {
|
||||
blockedCommands.add(b.nextToken());
|
||||
}
|
||||
List<String> mail = new ArrayList<String>();
|
||||
StringTokenizer ma = new StringTokenizer(PlayerData.getPlayerData().getConfigurationSection("players." + uuidString).getString("mail"), ",");
|
||||
while(ma.hasMoreTokens()) {
|
||||
mail.add(ma.nextToken());
|
||||
}
|
||||
boolean host = PlayerData.getPlayerData().getConfigurationSection("players." + uuidString).getBoolean("host");
|
||||
UUID party = PlayerData.getPlayerData().getConfigurationSection("players." + uuidString).getString("party").length() > 0 ? UUID.fromString(PlayerData.getPlayerData().getConfigurationSection("players." + uuidString).getString("party")) : null;
|
||||
boolean filter = PlayerData.getPlayerData().getConfigurationSection("players." + uuidString).getBoolean("filter");
|
||||
@ -273,7 +267,7 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
||||
boolean rangedSpy = PlayerData.getPlayerData().getConfigurationSection("players." + uuidString).getBoolean("rangedspy", false);
|
||||
boolean messageToggle = PlayerData.getPlayerData().getConfigurationSection("players." + uuidString).getBoolean("messagetoggle", true);
|
||||
boolean bungeeToggle = PlayerData.getPlayerData().getConfigurationSection("players." + uuidString).getBoolean("bungeetoggle", true);
|
||||
players.add(new MineverseChatPlayer(uuid, name, currentChannel, ignores, listening, mutes, blockedCommands, mail, host, party, filter, notifications, nickname, jsonFormat, spy, commandSpy, rangedSpy, messageToggle, bungeeToggle));
|
||||
players.add(new MineverseChatPlayer(uuid, name, currentChannel, ignores, listening, mutes, blockedCommands, host, party, filter, notifications, nickname, jsonFormat, spy, commandSpy, rangedSpy, messageToggle, bungeeToggle));
|
||||
}
|
||||
}
|
||||
for(Player p : this.getServer().getOnlinePlayers()) {
|
||||
@ -344,7 +338,6 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
||||
commands.put("kickchannelall", new Kickchannelall("kickchannelall"));
|
||||
commands.put("leave", new Leave("leave"));
|
||||
commands.put("listen", new Listen("listen"));
|
||||
commands.put("mail", new Mail("mail"));
|
||||
commands.put("me", new Me("me"));
|
||||
commands.put("message", new Message("message"));
|
||||
commands.put("tell", new Message("tell"));
|
||||
@ -1042,9 +1035,8 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
||||
listening.add(current.getName());
|
||||
HashMap<String, Integer> mutes = new HashMap<String, Integer>();
|
||||
Set<String> blockedCommands = new HashSet<String>();
|
||||
List<String> mail = new ArrayList<String>();
|
||||
String jsonFormat = "Default";
|
||||
s = new MineverseChatPlayer(uuid, name, current, ignores, listening, mutes, blockedCommands, mail, false, null, true, true, name, jsonFormat, false, false, false, true, true);
|
||||
s = new MineverseChatPlayer(uuid, name, current, ignores, listening, mutes, blockedCommands, false, null, true, true, name, jsonFormat, false, false, false, true, true);
|
||||
MineverseChat.players.add(s);
|
||||
}
|
||||
p.getPlayer().sendMessage(msg.replace("{playerfrom}", sName).replace("{playerto}", Format.FormatStringAll(p.getNickname())));
|
||||
|
@ -25,7 +25,6 @@ public class MineverseChatPlayer {
|
||||
private Set<String> listening;
|
||||
private HashMap<String, Integer> mutes;
|
||||
private Set<String> blockedCommands;
|
||||
private List<String> mail;
|
||||
private boolean host;
|
||||
private UUID party;
|
||||
private boolean filter;
|
||||
@ -53,6 +52,7 @@ public class MineverseChatPlayer {
|
||||
private boolean bungeeToggle;
|
||||
|
||||
//buttons variable no longer used
|
||||
//mail variable no longer used
|
||||
@Deprecated
|
||||
public MineverseChatPlayer(UUID uuid, String name, ChatChannel currentChannel, Set<UUID> ignores, Set<String> listening, HashMap<String, Integer> mutes, Set<String> blockedCommands, List<String> mail, boolean host, UUID party, boolean filter, boolean notifications, String nickname, String jsonFormat, boolean spy, boolean commandSpy, boolean rangedSpy, boolean buttons, boolean messageToggle, boolean bungeeToggle) {
|
||||
this.uuid = uuid;
|
||||
@ -62,7 +62,6 @@ public class MineverseChatPlayer {
|
||||
this.listening = listening;
|
||||
this.mutes = mutes;
|
||||
this.blockedCommands = blockedCommands;
|
||||
this.mail = mail;
|
||||
this.host = host;
|
||||
this.party = party;
|
||||
this.filter = filter;
|
||||
@ -88,7 +87,7 @@ public class MineverseChatPlayer {
|
||||
this.bungeeToggle = bungeeToggle;
|
||||
}
|
||||
|
||||
public MineverseChatPlayer(UUID uuid, String name, ChatChannel currentChannel, Set<UUID> ignores, Set<String> listening, HashMap<String, Integer> mutes, Set<String> blockedCommands, List<String> mail, boolean host, UUID party, boolean filter, boolean notifications, String nickname, String jsonFormat, boolean spy, boolean commandSpy, boolean rangedSpy, boolean messageToggle, boolean bungeeToggle) {
|
||||
public MineverseChatPlayer(UUID uuid, String name, ChatChannel currentChannel, Set<UUID> ignores, Set<String> listening, HashMap<String, Integer> mutes, Set<String> blockedCommands, boolean host, UUID party, boolean filter, boolean notifications, String nickname, String jsonFormat, boolean spy, boolean commandSpy, boolean rangedSpy, boolean messageToggle, boolean bungeeToggle) {
|
||||
this.uuid = uuid;
|
||||
this.name = name;
|
||||
this.currentChannel = currentChannel;
|
||||
@ -96,7 +95,6 @@ public class MineverseChatPlayer {
|
||||
this.listening = listening;
|
||||
this.mutes = mutes;
|
||||
this.blockedCommands = blockedCommands;
|
||||
this.mail = mail;
|
||||
this.host = host;
|
||||
this.party = party;
|
||||
this.filter = filter;
|
||||
@ -262,26 +260,6 @@ public class MineverseChatPlayer {
|
||||
return this.blockedCommands.contains(command);
|
||||
}
|
||||
|
||||
public List<String> getMail() {
|
||||
return this.mail;
|
||||
}
|
||||
|
||||
public void addMail(String mail) {
|
||||
this.mail.add(mail);
|
||||
}
|
||||
|
||||
public void removeMail(String mail) {
|
||||
this.mail.remove(mail);
|
||||
}
|
||||
|
||||
public void removeMail(int index) {
|
||||
this.mail.remove(index);
|
||||
}
|
||||
|
||||
public void clearMail() {
|
||||
this.mail.clear();
|
||||
}
|
||||
|
||||
public boolean isHost() {
|
||||
return this.host;
|
||||
}
|
||||
|
@ -1,89 +0,0 @@
|
||||
package mineverse.Aust1n46.chat.command.chat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
import mineverse.Aust1n46.chat.MineverseChat;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatAPI;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatPlayer;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannelInfo;
|
||||
import mineverse.Aust1n46.chat.command.MineverseCommand;
|
||||
import mineverse.Aust1n46.chat.utilities.Format;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class Mail extends MineverseCommand {
|
||||
private MineverseChat plugin;
|
||||
private ChatChannelInfo cc = MineverseChat.ccInfo;
|
||||
|
||||
public Mail(String name) {
|
||||
super(name);
|
||||
this.plugin = MineverseChat.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String command, String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
plugin.getServer().getConsoleSender().sendMessage(ChatColor.RED + "This command must be run by a player.");
|
||||
return;
|
||||
}
|
||||
MineverseChatPlayer mcp = MineverseChatAPI.getMineverseChatPlayer((Player) sender);
|
||||
if (mcp.getPlayer().hasPermission("venturechat.mail")) {
|
||||
try {
|
||||
switch (args[0]) {
|
||||
case "send": {
|
||||
try {
|
||||
MineverseChatPlayer tp = MineverseChatAPI.getMineverseChatPlayer(args[1]);
|
||||
if (tp == null) {
|
||||
mcp.getPlayer().sendMessage(ChatColor.RED + "Player: " + args[1] + " has never played before.");
|
||||
return;
|
||||
}
|
||||
String msg = args[2];
|
||||
for (int x = 3; x < args.length; x++) {
|
||||
if (args[x].length() > 0)
|
||||
msg += " " + args[x];
|
||||
}
|
||||
mcp.getPlayer().sendMessage(ChatColor.GOLD + "Sent mail: " + ChatColor.RED + Format.FormatStringAll(msg) + ChatColor.GOLD + " to: " + ChatColor.RED + tp.getName());
|
||||
tp.addMail(msg);
|
||||
if(tp.isOnline()) {
|
||||
tp.getPlayer().sendMessage(ChatColor.RED + mcp.getName() + ChatColor.GOLD + " has sent you mail. /mail read");
|
||||
}
|
||||
return;
|
||||
}
|
||||
catch (Exception e) {
|
||||
mcp.getPlayer().sendMessage(ChatColor.RED + "Invalid arguments, /mail send [player] [message]");
|
||||
return;
|
||||
}
|
||||
}
|
||||
case "read": {
|
||||
for (String s : mcp.getMail()) {
|
||||
if (s.length() > 0) {
|
||||
mcp.getPlayer().sendMessage(ChatColor.GOLD + Format.FormatStringAll(s));
|
||||
}
|
||||
}
|
||||
mcp.getPlayer().sendMessage(ChatColor.GOLD + "To clear mail, type /mail clear");
|
||||
return;
|
||||
}
|
||||
case "clear": {
|
||||
mcp.clearMail();
|
||||
mcp.getPlayer().sendMessage(ChatColor.GOLD + "Cleared your mail.");
|
||||
return;
|
||||
}
|
||||
default: {
|
||||
mcp.getPlayer().sendMessage(ChatColor.RED + "Invalid arguments, /mail [send, read, sendall, clear]");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
mcp.getPlayer().sendMessage(ChatColor.RED + "Invalid arguments, /mail [send, read, sendall, clear]");
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
@ -94,11 +94,6 @@ public class PlayerData {
|
||||
blockedCommands = blockedCommands.substring(0, blockedCommands.length() - 1);
|
||||
}
|
||||
cs.set("blockedcommands", blockedCommands);
|
||||
String mail = "";
|
||||
for(String s : p.getMail()) {
|
||||
mail += s + "\n";
|
||||
}
|
||||
cs.set("mail", mail);
|
||||
cs.set("host", p.isHost());
|
||||
cs.set("party", p.hasParty() ? p.getParty().toString() : "");
|
||||
cs.set("filter", p.hasFilter());
|
||||
|
@ -1,11 +1,9 @@
|
||||
package mineverse.Aust1n46.chat.listeners;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
@ -75,9 +73,8 @@ public class LoginListener implements Listener {
|
||||
listening.add(current.getName());
|
||||
HashMap<String, Integer> mutes = new HashMap<String, Integer>();
|
||||
Set<String> blockedCommands = new HashSet<String>();
|
||||
List<String> mail = new ArrayList<String>();
|
||||
String jsonFormat = "Default";
|
||||
mcp = new MineverseChatPlayer(uuid, name, current, ignores, listening, mutes, blockedCommands, mail, false, null, true, true, name, jsonFormat, false, false, false, true, true);
|
||||
mcp = new MineverseChatPlayer(uuid, name, current, ignores, listening, mutes, blockedCommands, false, null, true, true, name, jsonFormat, false, false, false, true, true);
|
||||
MineverseChat.players.add(mcp);
|
||||
}
|
||||
mcp.setName(event.getPlayer().getName());
|
||||
@ -118,17 +115,6 @@ public class LoginListener implements Listener {
|
||||
if(!plugin.getConfig().getConfigurationSection("login").getBoolean("enabled", true)) {
|
||||
event.setJoinMessage("");
|
||||
}
|
||||
int counter = 0;
|
||||
for(String s : mcp.getMail()) {
|
||||
if(s.length() > 0) {
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
if(counter > 0) {
|
||||
String keyword = "messages";
|
||||
if(counter == 1) keyword = "message";
|
||||
mcp.getPlayer().sendMessage("You have " + counter + " unread " + keyword + ". /mail read");
|
||||
}
|
||||
/*
|
||||
* if(MineverseChat.onlinePlayers.size() == 1) {
|
||||
* plugin.updatePlayerList(sync, true); }
|
||||
@ -186,11 +172,6 @@ public class LoginListener implements Listener {
|
||||
blockedCommands = blockedCommands.substring(0, blockedCommands.length() - 1);
|
||||
}
|
||||
cs.set("blockedcommands", blockedCommands);
|
||||
String mail = "";
|
||||
for(String s : mcp.getMail()) {
|
||||
mail += s + "\n";
|
||||
}
|
||||
cs.set("mail", mail);
|
||||
cs.set("host", mcp.isHost());
|
||||
cs.set("party", mcp.hasParty() ? mcp.getParty().toString() : "");
|
||||
cs.set("filter", mcp.hasFilter());
|
||||
|
Loading…
x
Reference in New Issue
Block a user