Various fixes
This commit is contained in:
parent
13ec4e43ad
commit
381955ef1a
11 changed files with 127 additions and 163 deletions
|
@ -1,5 +1,5 @@
|
||||||
name: TheButtonMCChatPlugin
|
name: TheButtonMCChatPlugin
|
||||||
main: io.github.norbipeti.thebuttonmcchat.PluginMain
|
main: buttondevteam.thebuttonmcchat.PluginMain
|
||||||
version: 4.0
|
version: 4.0
|
||||||
commands:
|
commands:
|
||||||
u:
|
u:
|
||||||
|
@ -24,7 +24,7 @@ commands:
|
||||||
yeehaw:
|
yeehaw:
|
||||||
description: This command makes you yeehaw.
|
description: This command makes you yeehaw.
|
||||||
author: NorbiPeti
|
author: NorbiPeti
|
||||||
depend: [Essentials, Towny, Minigames, Votifier, WorldGuard, WorldEdit, ProtocolLib, Vault]
|
depend: [Essentials, Towny, Minigames, Votifier, WorldGuard, WorldEdit, ProtocolLib, Vault, ButtonPluginBucket]
|
||||||
permissions:
|
permissions:
|
||||||
tbmc.admin:
|
tbmc.admin:
|
||||||
description: Gives access to /un- commands and /u admin commands
|
description: Gives access to /un- commands and /u admin commands
|
||||||
|
|
|
@ -7,8 +7,6 @@ import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class ChatPlayer {
|
public class ChatPlayer {
|
||||||
|
@ -37,71 +35,12 @@ public class ChatPlayer {
|
||||||
|
|
||||||
public UUID UUID;
|
public UUID UUID;
|
||||||
|
|
||||||
public static HashMap<UUID, ChatPlayer> AllPlayers = new HashMap<>();
|
public static HashMap<UUID, ChatPlayer> OnlinePlayers = new HashMap<>();
|
||||||
|
|
||||||
public static ChatPlayer AddPlayerIfNeeded(UUID uuid) {
|
|
||||||
if (!AllPlayers.containsKey(uuid)) {
|
|
||||||
ChatPlayer player = new ChatPlayer();
|
|
||||||
player.UUID = uuid;
|
|
||||||
player.FlairTime = FlairTimeNone;
|
|
||||||
player.FlairState = FlairStates.NoComment;
|
|
||||||
player.UserNames = new ArrayList<>();
|
|
||||||
Player p = Bukkit.getPlayer(uuid);
|
|
||||||
if (p != null)
|
|
||||||
player.PlayerName = p.getName();
|
|
||||||
AllPlayers.put(uuid, player);
|
|
||||||
return player;
|
|
||||||
}
|
|
||||||
return AllPlayers.get(uuid);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void Load(YamlConfiguration yc) {
|
|
||||||
ConfigurationSection cs = yc.getConfigurationSection("players");
|
|
||||||
for (String key : cs.getKeys(false)) {
|
|
||||||
ConfigurationSection cs2 = cs.getConfigurationSection(key);
|
|
||||||
ChatPlayer mp = AddPlayerIfNeeded(java.util.UUID
|
|
||||||
.fromString(cs2.getString("uuid")));
|
|
||||||
mp.UserName = cs2.getString("username");
|
|
||||||
String tmp = cs2.getString("flairtime");
|
|
||||||
if (tmp.equals("--"))
|
|
||||||
mp.FlairTime = FlairTimeNonPresser;
|
|
||||||
else if (tmp.equals("??"))
|
|
||||||
mp.FlairTime = FlairTimeCantPress;
|
|
||||||
else if (tmp.length() > 0)
|
|
||||||
mp.FlairTime = Short.parseShort(tmp);
|
|
||||||
String flairstate = cs2.getString("flairstate");
|
|
||||||
if (flairstate != null)
|
|
||||||
mp.FlairState = FlairStates.valueOf(flairstate);
|
|
||||||
else
|
|
||||||
mp.FlairState = FlairStates.NoComment;
|
|
||||||
mp.PlayerName = cs2.getString("playername");
|
|
||||||
mp.UserNames = cs2.getStringList("usernames");
|
|
||||||
mp.FCount = cs2.getInt("fcount");
|
|
||||||
mp.FDeaths = cs2.getInt("fdeaths");
|
|
||||||
mp.FlairCheater = cs2.getBoolean("flaircheater");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void Save(YamlConfiguration yc) {
|
|
||||||
ConfigurationSection cs = yc.createSection("players");
|
|
||||||
for (ChatPlayer mp : ChatPlayer.AllPlayers.values()) {
|
|
||||||
ConfigurationSection cs2 = cs.createSection(mp.UUID.toString());
|
|
||||||
cs2.set("playername", mp.PlayerName);
|
|
||||||
cs2.set("username", mp.UserName);
|
|
||||||
cs2.set("flairtime", mp.FlairTime);
|
|
||||||
cs2.set("flairstate", mp.FlairState.toString());
|
|
||||||
cs2.set("uuid", mp.UUID.toString());
|
|
||||||
cs2.set("usernames", mp.UserNames);
|
|
||||||
cs2.set("fcount", mp.FCount);
|
|
||||||
cs2.set("fdeaths", mp.FDeaths);
|
|
||||||
cs2.set("flaircheater", mp.FlairCheater);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ChatPlayer GetFromName(String name) {
|
public static ChatPlayer GetFromName(String name) {
|
||||||
Player p = Bukkit.getPlayer(name);
|
Player p = Bukkit.getPlayer(name); // TODO
|
||||||
if (p != null)
|
if (p != null)
|
||||||
return AllPlayers.get(p.getUniqueId());
|
return OnlinePlayers.get(p.getUniqueId());
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -132,8 +71,7 @@ public class ChatPlayer {
|
||||||
// Flairs from Command Block The Button - Teams
|
// Flairs from Command Block The Button - Teams
|
||||||
// PluginMain.Instance.getServer().getScoreboardManager().getMainScoreboard().getTeams().add()
|
// PluginMain.Instance.getServer().getScoreboardManager().getMainScoreboard().getTeams().add()
|
||||||
Player p = Bukkit.getPlayer(UUID);
|
Player p = Bukkit.getPlayer(UUID);
|
||||||
p.setPlayerListName(String.format("%s%s", p.getName(),
|
p.setPlayerListName(String.format("%s%s", p.getName(), GetFormattedFlair()));
|
||||||
GetFormattedFlair()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public short GetFlairColor() {
|
public short GetFlairColor() {
|
||||||
|
@ -163,6 +101,6 @@ public class ChatPlayer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ChatPlayer GetFromPlayer(Player p) {
|
public static ChatPlayer GetFromPlayer(Player p) {
|
||||||
return ChatPlayer.AllPlayers.get(p.getUniqueId());
|
return ChatPlayer.OnlinePlayers.get(p.getUniqueId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class ChatProcessing {
|
||||||
|
|
||||||
ChatPlayer mp = null;
|
ChatPlayer mp = null;
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
mp = ChatPlayer.AllPlayers.get(player.getUniqueId());
|
mp = ChatPlayer.OnlinePlayers.get(player.getUniqueId());
|
||||||
if (message.equalsIgnoreCase("F")) {
|
if (message.equalsIgnoreCase("F")) {
|
||||||
if (!mp.PressedF && PlayerListener.ActiveF) {
|
if (!mp.PressedF && PlayerListener.ActiveF) {
|
||||||
PlayerListener.FCount++;
|
PlayerListener.FCount++;
|
||||||
|
@ -109,7 +109,7 @@ public class ChatProcessing {
|
||||||
System.out.println("Error: Can't find player " + match + " but it was reported as online.");
|
System.out.println("Error: Can't find player " + match + " but it was reported as online.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ChatPlayer mpp = ChatPlayer.AddPlayerIfNeeded(p.getUniqueId());
|
ChatPlayer mpp = ChatPlayer.GetFromPlayer(p);
|
||||||
if (PlayerListener.NotificationSound == null)
|
if (PlayerListener.NotificationSound == null)
|
||||||
p.playSound(p.getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER, 1.0f, 0.5f); // TODO:
|
p.playSound(p.getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER, 1.0f, 0.5f); // TODO:
|
||||||
// Airhorn
|
// Airhorn
|
||||||
|
@ -143,7 +143,7 @@ public class ChatProcessing {
|
||||||
"Error: Can't find player " + match + " but it was reported as online.");
|
"Error: Can't find player " + match + " but it was reported as online.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ChatPlayer mpp = ChatPlayer.AddPlayerIfNeeded(p.getUniqueId());
|
ChatPlayer mpp = ChatPlayer.GetFromPlayer(p);
|
||||||
if (PlayerListener.NotificationSound == null)
|
if (PlayerListener.NotificationSound == null)
|
||||||
p.playSound(p.getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER, 1.0f, 0.5f); // TODO:
|
p.playSound(p.getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER, 1.0f, 0.5f); // TODO:
|
||||||
// Airhorn
|
// Airhorn
|
||||||
|
|
|
@ -2,6 +2,7 @@ package buttondevteam.thebuttonmcchat;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.Timer;
|
import java.util.Timer;
|
||||||
|
@ -41,6 +42,10 @@ import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import au.com.mineauz.minigames.MinigamePlayer;
|
import au.com.mineauz.minigames.MinigamePlayer;
|
||||||
import au.com.mineauz.minigames.Minigames;
|
import au.com.mineauz.minigames.Minigames;
|
||||||
|
import buttondevteam.core.player.TBMCPlayer;
|
||||||
|
import buttondevteam.core.player.TBMCPlayerAddEvent;
|
||||||
|
import buttondevteam.core.player.TBMCPlayerLoadEvent;
|
||||||
|
import buttondevteam.core.player.TBMCPlayerSaveEvent;
|
||||||
import buttondevteam.thebuttonmcchat.commands.ucmds.KittycannonCommand;
|
import buttondevteam.thebuttonmcchat.commands.ucmds.KittycannonCommand;
|
||||||
|
|
||||||
import com.earth2me.essentials.Essentials;
|
import com.earth2me.essentials.Essentials;
|
||||||
|
@ -66,7 +71,7 @@ public class PlayerListener implements Listener {
|
||||||
if (essentials == null)
|
if (essentials == null)
|
||||||
essentials = ((Essentials) Bukkit.getPluginManager().getPlugin("Essentials"));
|
essentials = ((Essentials) Bukkit.getPluginManager().getPlugin("Essentials"));
|
||||||
final Player p = event.getPlayer();
|
final Player p = event.getPlayer();
|
||||||
ChatPlayer mp = ChatPlayer.AddPlayerIfNeeded(p.getUniqueId());
|
ChatPlayer mp = ChatPlayer.GetFromPlayer(p);
|
||||||
if (!mp.FlairState.equals(FlairStates.NoComment)) {
|
if (!mp.FlairState.equals(FlairStates.NoComment)) {
|
||||||
PluginMain.ConfirmUserMessage(mp);
|
PluginMain.ConfirmUserMessage(mp);
|
||||||
Timer timer = new Timer();
|
Timer timer = new Timer();
|
||||||
|
@ -193,6 +198,56 @@ public class PlayerListener implements Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerLoad(TBMCPlayerLoadEvent e) {
|
||||||
|
YamlConfiguration yc = e.GetPlayerConfig();
|
||||||
|
ChatPlayer cp = new ChatPlayer();
|
||||||
|
cp.UUID = UUID.fromString(yc.getString("uuid"));
|
||||||
|
cp.UserName = yc.getString("username");
|
||||||
|
String tcp = yc.getString("flairtime");
|
||||||
|
if (tcp.equals("--"))
|
||||||
|
cp.SetFlair(ChatPlayer.FlairTimeNonPresser);
|
||||||
|
else if (tcp.equals("??"))
|
||||||
|
cp.SetFlair(ChatPlayer.FlairTimeCantPress);
|
||||||
|
else if (tcp.length() > 0)
|
||||||
|
cp.SetFlair(Short.parseShort(tcp));
|
||||||
|
String flairstate = yc.getString("flairstate");
|
||||||
|
if (flairstate != null)
|
||||||
|
cp.FlairState = FlairStates.valueOf(flairstate);
|
||||||
|
else
|
||||||
|
cp.FlairState = FlairStates.NoComment;
|
||||||
|
cp.UserNames = yc.getStringList("usernames");
|
||||||
|
cp.FCount = yc.getInt("fcount");
|
||||||
|
cp.FDeaths = yc.getInt("fdeaths");
|
||||||
|
cp.FlairCheater = yc.getBoolean("flaircheater");
|
||||||
|
ChatPlayer.OnlinePlayers.put(cp.UUID, cp);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerSave(TBMCPlayerSaveEvent e) {
|
||||||
|
YamlConfiguration yc = e.GetPlayerConfig();
|
||||||
|
ChatPlayer cp = ChatPlayer.OnlinePlayers.get(e.GetPlayer().UUID);
|
||||||
|
yc.set("username", cp.UserName);
|
||||||
|
yc.set("flairtime", cp.GetFlairTime());
|
||||||
|
yc.set("flairstate", cp.FlairState.toString());
|
||||||
|
yc.set("uuid", cp.UUID.toString());
|
||||||
|
yc.set("usernames", cp.UserNames);
|
||||||
|
yc.set("fcount", cp.FCount);
|
||||||
|
yc.set("fdeaths", cp.FDeaths);
|
||||||
|
yc.set("flaircheater", cp.FlairCheater);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerAdd(TBMCPlayerAddEvent e) {
|
||||||
|
TBMCPlayer p = e.GetPlayer();
|
||||||
|
ChatPlayer player = new ChatPlayer();
|
||||||
|
player.UUID = p.UUID;
|
||||||
|
player.SetFlair(ChatPlayer.FlairTimeNone);
|
||||||
|
player.FlairState = FlairStates.NoComment; //TODO: NullPointerException
|
||||||
|
player.UserNames = new ArrayList<>(); //TODO: Move some code here from join?
|
||||||
|
ChatPlayer.OnlinePlayers.put(p.UUID, player);
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerLeave(PlayerQuitEvent event) {
|
public void onPlayerLeave(PlayerQuitEvent event) {
|
||||||
String deletenick = null;
|
String deletenick = null;
|
||||||
|
@ -227,7 +282,7 @@ public class PlayerListener implements Listener {
|
||||||
if (event.getMessage().length() < 2)
|
if (event.getMessage().length() < 2)
|
||||||
return;
|
return;
|
||||||
int index = event.getMessage().indexOf(" ");
|
int index = event.getMessage().indexOf(" ");
|
||||||
ChatPlayer mp = ChatPlayer.AllPlayers.get(event.getPlayer().getUniqueId());
|
ChatPlayer mp = ChatPlayer.OnlinePlayers.get(event.getPlayer().getUniqueId());
|
||||||
String cmd = "";
|
String cmd = "";
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
cmd = event.getMessage().substring(1);
|
cmd = event.getMessage().substring(1);
|
||||||
|
@ -486,10 +541,10 @@ public class PlayerListener implements Listener {
|
||||||
Ftimer.cancel();
|
Ftimer.cancel();
|
||||||
ActiveF = true;
|
ActiveF = true;
|
||||||
FCount = 0;
|
FCount = 0;
|
||||||
FPlayer = ChatPlayer.AllPlayers.get(e.getEntity().getUniqueId());
|
FPlayer = ChatPlayer.OnlinePlayers.get(e.getEntity().getUniqueId());
|
||||||
FPlayer.FDeaths++;
|
FPlayer.FDeaths++;
|
||||||
for (Player p : PluginMain.GetPlayers()) {
|
for (Player p : PluginMain.GetPlayers()) {
|
||||||
ChatPlayer mp = ChatPlayer.AllPlayers.get(p.getUniqueId());
|
ChatPlayer mp = ChatPlayer.OnlinePlayers.get(p.getUniqueId());
|
||||||
mp.PressedF = false;
|
mp.PressedF = false;
|
||||||
p.sendMessage("§bPress F to pay respects.§r");
|
p.sendMessage("§bPress F to pay respects.§r");
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,21 +56,17 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
try {
|
try {
|
||||||
System.out.println("Extracting necessary libraries...");
|
System.out.println("Extracting necessary libraries...");
|
||||||
final File[] libs = new File[] {
|
final File[] libs = new File[] { new File(getDataFolder(), "htmlcleaner-2.16.jar"),
|
||||||
new File(getDataFolder(), "htmlcleaner-2.16.jar"),
|
|
||||||
new File(getDataFolder(), "reflections-0.9.10.jar"),
|
new File(getDataFolder(), "reflections-0.9.10.jar"),
|
||||||
new File(getDataFolder(), "javassist-3.19.0-GA.jar") };
|
new File(getDataFolder(), "javassist-3.19.0-GA.jar") };
|
||||||
for (final File lib : libs) {
|
for (final File lib : libs) {
|
||||||
if (!lib.exists()) {
|
if (!lib.exists()) {
|
||||||
JarUtils.extractFromJar(lib.getName(),
|
JarUtils.extractFromJar(lib.getName(), lib.getAbsolutePath());
|
||||||
lib.getAbsolutePath());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (final File lib : libs) {
|
for (final File lib : libs) {
|
||||||
if (!lib.exists()) {
|
if (!lib.exists()) {
|
||||||
getLogger().warning(
|
getLogger().warning("Failed to load plugin! Could not find lib: " + lib.getName());
|
||||||
"Failed to load plugin! Could not find lib: "
|
|
||||||
+ lib.getName());
|
|
||||||
Bukkit.getServer().getPluginManager().disablePlugin(this);
|
Bukkit.getServer().getPluginManager().disablePlugin(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -80,15 +76,18 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
getServer().getPluginManager().registerEvents(new PlayerListener(),
|
getServer().getPluginManager().registerEvents(new PlayerListener(), this);
|
||||||
this);
|
|
||||||
CommandCaller.RegisterCommands(this);
|
CommandCaller.RegisterCommands(this);
|
||||||
Instance = this;
|
Instance = this;
|
||||||
Console = this.getServer().getConsoleSender();
|
Console = this.getServer().getConsoleSender();
|
||||||
LoadFiles(false);
|
LoadFiles(false);
|
||||||
|
|
||||||
SB = PluginMain.Instance.getServer().getScoreboardManager()
|
SB = PluginMain.Instance.getServer().getScoreboardManager().getMainScoreboard(); // Main
|
||||||
.getMainScoreboard(); // Main can be detected with @a[score_...]
|
// can
|
||||||
|
// be
|
||||||
|
// detected
|
||||||
|
// with
|
||||||
|
// @a[score_...]
|
||||||
if (SB.getObjective("town") == null)
|
if (SB.getObjective("town") == null)
|
||||||
SB.registerNewObjective("town", "dummy");
|
SB.registerNewObjective("town", "dummy");
|
||||||
if (SB.getObjective("nation") == null)
|
if (SB.getObjective("nation") == null)
|
||||||
|
@ -97,8 +96,7 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
|
||||||
SB.registerNewObjective("admin", "dummy");
|
SB.registerNewObjective("admin", "dummy");
|
||||||
if (SB.getObjective("mod") == null)
|
if (SB.getObjective("mod") == null)
|
||||||
SB.registerNewObjective("mod", "dummy");
|
SB.registerNewObjective("mod", "dummy");
|
||||||
TU = ((Towny) Bukkit.getPluginManager().getPlugin("Towny"))
|
TU = ((Towny) Bukkit.getPluginManager().getPlugin("Towny")).getTownyUniverse();
|
||||||
.getTownyUniverse();
|
|
||||||
Towns = new ArrayList<Town>(TU.getTownsMap().values());
|
Towns = new ArrayList<Town>(TU.getTownsMap().values());
|
||||||
Nations = new ArrayList<Nation>(TU.getNationsMap().values());
|
Nations = new ArrayList<Nation>(TU.getNationsMap().values());
|
||||||
|
|
||||||
|
@ -136,14 +134,11 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
|
||||||
private void ThreadMethod() {
|
private void ThreadMethod() {
|
||||||
while (!stop) {
|
while (!stop) {
|
||||||
try {
|
try {
|
||||||
String body = DownloadString(FlairThreadURL
|
String body = DownloadString(FlairThreadURL + ".json?limit=1000");
|
||||||
+ ".json?limit=1000");
|
JSONArray json = new JSONArray(body).getJSONObject(1).getJSONObject("data").getJSONArray("children");
|
||||||
JSONArray json = new JSONArray(body).getJSONObject(1)
|
|
||||||
.getJSONObject("data").getJSONArray("children");
|
|
||||||
for (Object obj : json) {
|
for (Object obj : json) {
|
||||||
JSONObject item = (JSONObject) obj;
|
JSONObject item = (JSONObject) obj;
|
||||||
String author = item.getJSONObject("data").getString(
|
String author = item.getJSONObject("data").getString("author");
|
||||||
"author");
|
|
||||||
String ign = item.getJSONObject("data").getString("body");
|
String ign = item.getJSONObject("data").getString("body");
|
||||||
int start = ign.indexOf("IGN:") + "IGN:".length();
|
int start = ign.indexOf("IGN:") + "IGN:".length();
|
||||||
if (start == -1 + "IGN:".length()) // +length: 2015.08.10.
|
if (start == -1 + "IGN:".length()) // +length: 2015.08.10.
|
||||||
|
@ -185,10 +180,8 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DownloadFlair(ChatPlayer mp)
|
public void DownloadFlair(ChatPlayer mp) throws MalformedURLException, IOException {
|
||||||
throws MalformedURLException, IOException {
|
String[] flairdata = DownloadString("http://karmadecay.com/thebutton-data.php?users=" + mp.UserName)
|
||||||
String[] flairdata = DownloadString(
|
|
||||||
"http://karmadecay.com/thebutton-data.php?users=" + mp.UserName)
|
|
||||||
.replace("\"", "").split(":");
|
.replace("\"", "").split(":");
|
||||||
String flair;
|
String flair;
|
||||||
if (flairdata.length > 1)
|
if (flairdata.length > 1)
|
||||||
|
@ -205,8 +198,7 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
|
||||||
|
|
||||||
public static Exception LastException; // 2015.08.09.
|
public static Exception LastException; // 2015.08.09.
|
||||||
|
|
||||||
public String DownloadString(String urlstr) throws MalformedURLException,
|
public String DownloadString(String urlstr) throws MalformedURLException, IOException {
|
||||||
IOException {
|
|
||||||
URL url = new URL(urlstr);
|
URL url = new URL(urlstr);
|
||||||
URLConnection con = url.openConnection();
|
URLConnection con = url.openConnection();
|
||||||
con.setRequestProperty("User-Agent", "TheButtonAutoFlair");
|
con.setRequestProperty("User-Agent", "TheButtonAutoFlair");
|
||||||
|
@ -218,8 +210,7 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
|
||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetFlair(ChatPlayer p, String text, String flairclass,
|
private void SetFlair(ChatPlayer p, String text, String flairclass, String username) {
|
||||||
String username) {
|
|
||||||
p.UserName = username;
|
p.UserName = username;
|
||||||
p.FlairState = FlairStates.Recognised;
|
p.FlairState = FlairStates.Recognised;
|
||||||
switch (flairclass) {
|
switch (flairclass) {
|
||||||
|
@ -263,13 +254,11 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
|
||||||
p.SetFlair(Short.parseShort(text));
|
p.SetFlair(Short.parseShort(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean CheckForJoinDate(ChatPlayer mp)
|
public static boolean CheckForJoinDate(ChatPlayer mp) throws Exception {
|
||||||
throws Exception {
|
|
||||||
return JoinedBefore(mp, 2015, 4, 1);
|
return JoinedBefore(mp, 2015, 4, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean JoinedBefore(ChatPlayer mp, int year,
|
public static boolean JoinedBefore(ChatPlayer mp, int year, int month, int day) throws Exception {
|
||||||
int month, int day) throws Exception {
|
|
||||||
URL url = new URL("https://www.reddit.com/u/" + mp.UserName);
|
URL url = new URL("https://www.reddit.com/u/" + mp.UserName);
|
||||||
URLConnection con = url.openConnection();
|
URLConnection con = url.openConnection();
|
||||||
con.setRequestProperty("User-Agent", "TheButtonAutoFlair");
|
con.setRequestProperty("User-Agent", "TheButtonAutoFlair");
|
||||||
|
@ -283,16 +272,16 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
|
||||||
SimpleDateFormat parserSDF = new SimpleDateFormat("yyyy-MM-dd");
|
SimpleDateFormat parserSDF = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
joindate = joindate.split("T")[0];
|
joindate = joindate.split("T")[0];
|
||||||
Date date = parserSDF.parse(joindate);
|
Date date = parserSDF.parse(joindate);
|
||||||
return date.before(new Calendar.Builder()
|
return date.before(new Calendar.Builder().setTimeZone(TimeZone.getTimeZone("UTC")).setDate(year, month, day)
|
||||||
.setTimeZone(TimeZone.getTimeZone("UTC"))
|
.build().getTime());
|
||||||
.setDate(year, month, day).build().getTime());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ConfirmUserMessage(ChatPlayer mp) {
|
public static void ConfirmUserMessage(ChatPlayer mp) {
|
||||||
Player p = Bukkit.getPlayer(mp.UUID);
|
Player p = Bukkit.getPlayer(mp.UUID);
|
||||||
if (mp.FlairState.equals(FlairStates.Commented) && p != null)
|
if (mp.FlairState.equals(FlairStates.Commented) && p != null)
|
||||||
if (mp.UserNames.size() > 1)
|
if (mp.UserNames.size() > 1)
|
||||||
p.sendMessage("§9Multiple Reddit users commented your name. You can select with /u accept.§r §6Type /u accept or /u ignore§r");
|
p.sendMessage(
|
||||||
|
"§9Multiple Reddit users commented your name. You can select with /u accept.§r §6Type /u accept or /u ignore§r");
|
||||||
else
|
else
|
||||||
p.sendMessage("§9A Reddit user commented your name. Is that you?§r §6Type /u accept or /u ignore§r");
|
p.sendMessage("§9A Reddit user commented your name. Is that you?§r §6Type /u accept or /u ignore§r");
|
||||||
}
|
}
|
||||||
|
@ -307,21 +296,19 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
|
||||||
public static void LoadFiles(boolean reload) {
|
public static void LoadFiles(boolean reload) {
|
||||||
if (reload) {
|
if (reload) {
|
||||||
System.out.println("TBMC chat plugin cleanup for reloading...");
|
System.out.println("TBMC chat plugin cleanup for reloading...");
|
||||||
ChatPlayer.AllPlayers.clear();
|
ChatPlayer.OnlinePlayers.clear();
|
||||||
AnnounceMessages.clear();
|
AnnounceMessages.clear();
|
||||||
}
|
}
|
||||||
System.out.println("Loading files for TBMC chat plugin...");
|
System.out.println("Loading files for TBMC chat plugin...");
|
||||||
try {
|
try {
|
||||||
File file = new File("thebuttonmc.yml");
|
File file = new File("thebuttonmc.yml"); // TODO
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
YamlConfiguration yc = new YamlConfiguration();
|
YamlConfiguration yc = new YamlConfiguration();
|
||||||
yc.load(file);
|
yc.load(file);
|
||||||
ChatPlayer.Load(yc);
|
PlayerListener.NotificationSound = yc.getString("notificationsound");
|
||||||
PlayerListener.NotificationSound = yc
|
PlayerListener.NotificationPitch = yc.getDouble("notificationpitch");
|
||||||
.getString("notificationsound");
|
AnnounceTime = yc.getInt("announcetime"); // TODO: Move out to
|
||||||
PlayerListener.NotificationPitch = yc
|
// the core
|
||||||
.getDouble("notificationpitch");
|
|
||||||
AnnounceTime = yc.getInt("announcetime");
|
|
||||||
AnnounceMessages.addAll(yc.getStringList("announcements"));
|
AnnounceMessages.addAll(yc.getStringList("announcements"));
|
||||||
PlayerListener.AlphaDeaths = yc.getInt("alphadeaths");
|
PlayerListener.AlphaDeaths = yc.getInt("alphadeaths");
|
||||||
}
|
}
|
||||||
|
@ -340,10 +327,9 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
|
||||||
try {
|
try {
|
||||||
File file = new File("thebuttonmc.yml");
|
File file = new File("thebuttonmc.yml");
|
||||||
YamlConfiguration yc = new YamlConfiguration();
|
YamlConfiguration yc = new YamlConfiguration();
|
||||||
ChatPlayer.Save(yc);
|
|
||||||
yc.set("notificationsound", PlayerListener.NotificationSound);
|
yc.set("notificationsound", PlayerListener.NotificationSound);
|
||||||
yc.set("notificationpitch", PlayerListener.NotificationPitch);
|
yc.set("notificationpitch", PlayerListener.NotificationPitch);
|
||||||
yc.set("announcetime", AnnounceTime);
|
yc.set("announcetime", AnnounceTime); // TODO: Move out to the core
|
||||||
yc.set("announcements", AnnounceMessages);
|
yc.set("announcements", AnnounceMessages);
|
||||||
yc.set("alphadeaths", PlayerListener.AlphaDeaths);
|
yc.set("alphadeaths", PlayerListener.AlphaDeaths);
|
||||||
yc.save(file);
|
yc.save(file);
|
||||||
|
@ -355,18 +341,15 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addClassPath(final URL url) throws IOException {
|
private void addClassPath(final URL url) throws IOException {
|
||||||
final URLClassLoader sysloader = (URLClassLoader) ClassLoader
|
final URLClassLoader sysloader = (URLClassLoader) ClassLoader.getSystemClassLoader();
|
||||||
.getSystemClassLoader();
|
|
||||||
final Class<URLClassLoader> sysclass = URLClassLoader.class;
|
final Class<URLClassLoader> sysclass = URLClassLoader.class;
|
||||||
try {
|
try {
|
||||||
final Method method = sysclass.getDeclaredMethod("addURL",
|
final Method method = sysclass.getDeclaredMethod("addURL", new Class[] { URL.class });
|
||||||
new Class[] { URL.class });
|
|
||||||
method.setAccessible(true);
|
method.setAccessible(true);
|
||||||
method.invoke(sysloader, new Object[] { url });
|
method.invoke(sysloader, new Object[] { url });
|
||||||
} catch (final Throwable t) {
|
} catch (final Throwable t) {
|
||||||
t.printStackTrace();
|
t.printStackTrace();
|
||||||
throw new IOException("Error adding " + url
|
throw new IOException("Error adding " + url + " to system classloader");
|
||||||
+ " to system classloader");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -375,9 +358,8 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
|
||||||
public static Chat chat = null;
|
public static Chat chat = null;
|
||||||
|
|
||||||
private boolean setupPermissions() {
|
private boolean setupPermissions() {
|
||||||
RegisteredServiceProvider<Permission> permissionProvider = getServer()
|
RegisteredServiceProvider<Permission> permissionProvider = getServer().getServicesManager()
|
||||||
.getServicesManager().getRegistration(
|
.getRegistration(net.milkbowl.vault.permission.Permission.class);
|
||||||
net.milkbowl.vault.permission.Permission.class);
|
|
||||||
if (permissionProvider != null) {
|
if (permissionProvider != null) {
|
||||||
permission = permissionProvider.getProvider();
|
permission = permissionProvider.getProvider();
|
||||||
}
|
}
|
||||||
|
@ -385,9 +367,8 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean setupChat() {
|
private boolean setupChat() {
|
||||||
RegisteredServiceProvider<Chat> chatProvider = getServer()
|
RegisteredServiceProvider<Chat> chatProvider = getServer().getServicesManager()
|
||||||
.getServicesManager().getRegistration(
|
.getRegistration(net.milkbowl.vault.chat.Chat.class);
|
||||||
net.milkbowl.vault.chat.Chat.class);
|
|
||||||
if (chatProvider != null) {
|
if (chatProvider != null) {
|
||||||
chat = chatProvider.getProvider();
|
chat = chatProvider.getProvider();
|
||||||
}
|
}
|
||||||
|
@ -396,9 +377,8 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean setupEconomy() {
|
private boolean setupEconomy() {
|
||||||
RegisteredServiceProvider<Economy> economyProvider = getServer()
|
RegisteredServiceProvider<Economy> economyProvider = getServer().getServicesManager()
|
||||||
.getServicesManager().getRegistration(
|
.getRegistration(net.milkbowl.vault.economy.Economy.class);
|
||||||
net.milkbowl.vault.economy.Economy.class);
|
|
||||||
if (economyProvider != null) {
|
if (economyProvider != null) {
|
||||||
economy = economyProvider.getProvider();
|
economy = economyProvider.getProvider();
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ public final class ChatonlyCommand extends TBMCCommandBase {
|
||||||
@Override
|
@Override
|
||||||
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
||||||
Player player=(Player)sender;
|
Player player=(Player)sender;
|
||||||
ChatPlayer p = ChatPlayer.AllPlayers.get(player
|
ChatPlayer p = ChatPlayer.OnlinePlayers.get(player
|
||||||
.getUniqueId());
|
.getUniqueId());
|
||||||
p.ChatOnly = true;
|
p.ChatOnly = true;
|
||||||
player.setGameMode(GameMode.SPECTATOR);
|
player.setGameMode(GameMode.SPECTATOR);
|
||||||
|
|
|
@ -12,7 +12,6 @@ import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.PluginCommand;
|
import org.bukkit.command.PluginCommand;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.Plugin;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.reflections.Reflections;
|
import org.reflections.Reflections;
|
||||||
import org.reflections.scanners.SubTypesScanner;
|
import org.reflections.scanners.SubTypesScanner;
|
||||||
|
@ -46,7 +45,7 @@ public class CommandCaller implements CommandExecutor {
|
||||||
Reflections rf = new Reflections(
|
Reflections rf = new Reflections(
|
||||||
new ConfigurationBuilder().setUrls(ClasspathHelper.forClassLoader(plugin.getClass().getClassLoader()))
|
new ConfigurationBuilder().setUrls(ClasspathHelper.forClassLoader(plugin.getClass().getClassLoader()))
|
||||||
.addClassLoader(plugin.getClass().getClassLoader()).addScanners(new SubTypesScanner())
|
.addClassLoader(plugin.getClass().getClassLoader()).addScanners(new SubTypesScanner())
|
||||||
.filterInputsBy((String pkg) -> pkg.contains("io.github.norbipeti.thebuttonmcchat.commands")));
|
.filterInputsBy((String pkg) -> pkg.contains("buttondevteam.thebuttonmcchat.commands")));
|
||||||
Set<Class<? extends TBMCCommandBase>> cmds = rf.getSubTypesOf(TBMCCommandBase.class);
|
Set<Class<? extends TBMCCommandBase>> cmds = rf.getSubTypesOf(TBMCCommandBase.class);
|
||||||
for (Class<? extends TBMCCommandBase> cmd : cmds) {
|
for (Class<? extends TBMCCommandBase> cmd : cmds) {
|
||||||
try {
|
try {
|
||||||
|
@ -102,7 +101,7 @@ public class CommandCaller implements CommandExecutor {
|
||||||
Bukkit.getConsoleSender().sendMessage("§cInternal error: Command not registered to CommandCaller");
|
Bukkit.getConsoleSender().sendMessage("§cInternal error: Command not registered to CommandCaller");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (cmd.GetModOnly() && PluginMain.permission.has(sender, "tbmc.admin")) {
|
if (cmd.GetModOnly() && !PluginMain.permission.has(sender, "tbmc.admin")) {
|
||||||
sender.sendMessage("§cYou need to be a mod to use this command.");
|
sender.sendMessage("§cYou need to be a mod to use this command.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,7 @@ public final class OOCCommand extends TBMCCommandBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] GetHelpText(String alias) {
|
public String[] GetHelpText(String alias) {
|
||||||
return new String[] {
|
return new String[] { "§6---- Out-of-character message ----",
|
||||||
"§6---- Out-of-character message ----",
|
|
||||||
"This command will put a [OCC] tag before your message indicating that you are talking out of character",
|
"This command will put a [OCC] tag before your message indicating that you are talking out of character",
|
||||||
"Usage: /" + alias + " <message>" };
|
"Usage: /" + alias + " <message>" };
|
||||||
}
|
}
|
||||||
|
@ -21,12 +20,12 @@ public final class OOCCommand extends TBMCCommandBase {
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
ChatPlayer.AddPlayerIfNeeded(player.getUniqueId()).RPMode = false;
|
ChatPlayer.GetFromPlayer(player).RPMode = false;
|
||||||
String message = "";
|
String message = "";
|
||||||
for (String arg : args)
|
for (String arg : args)
|
||||||
message += arg + " ";
|
message += arg + " ";
|
||||||
player.chat(message.substring(0, message.length() - 1));
|
player.chat(message.substring(0, message.length() - 1));
|
||||||
ChatPlayer.AddPlayerIfNeeded(player.getUniqueId()).RPMode = true;
|
ChatPlayer.GetFromPlayer(player).RPMode = true;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,16 +11,14 @@ public class CCommand extends UCommandBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] GetHelpText(String alias) {
|
public String[] GetHelpText(String alias) {
|
||||||
return new String[] { "§6---- Rainbow mode ----",
|
return new String[] { "§6---- Rainbow mode ----", "This command allows you to talk in rainbow colors",
|
||||||
"This command allows you to talk in rainbow colors",
|
|
||||||
"You need to be a donator or a mod to use this command" };
|
"You need to be a donator or a mod to use this command" };
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
ChatPlayer p = ChatPlayer.AddPlayerIfNeeded(player
|
ChatPlayer p = ChatPlayer.GetFromPlayer(player);
|
||||||
.getUniqueId());
|
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
if (PluginMain.permission.has(player, "tbmc.rainbow")) {
|
if (PluginMain.permission.has(player, "tbmc.rainbow")) {
|
||||||
p.RainbowPresserColorMode = !p.RainbowPresserColorMode;
|
p.RainbowPresserColorMode = !p.RainbowPresserColorMode;
|
||||||
|
@ -38,15 +36,13 @@ public class CCommand extends UCommandBase {
|
||||||
p.RainbowPresserColorMode = false;
|
p.RainbowPresserColorMode = false;
|
||||||
p.OtherColorMode = null;
|
p.OtherColorMode = null;
|
||||||
try {
|
try {
|
||||||
p.OtherColorMode = ChatFormatter.Color.valueOf(args[0]
|
p.OtherColorMode = ChatFormatter.Color.valueOf(args[0].toLowerCase());
|
||||||
.toLowerCase());
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
player.sendMessage("§cUnknown message color: " + args[0]);
|
player.sendMessage("§cUnknown message color: " + args[0]);
|
||||||
player.sendMessage("§cUse color names, like blue, or dark_aqua");
|
player.sendMessage("§cUse color names, like blue, or dark_aqua");
|
||||||
}
|
}
|
||||||
if (p.OtherColorMode != null)
|
if (p.OtherColorMode != null)
|
||||||
player.sendMessage(String.format(
|
player.sendMessage(String.format("§eMessage color set to %s", p.OtherColorMode));
|
||||||
"§eMessage color set to %s", p.OtherColorMode));
|
|
||||||
else
|
else
|
||||||
player.sendMessage("§eMessage color reset.");
|
player.sendMessage("§eMessage color reset.");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class ConfirmCommand extends AdminCommandBase {
|
||||||
PluginMain.LoadFiles(true);
|
PluginMain.LoadFiles(true);
|
||||||
// TODO: Add players online
|
// TODO: Add players online
|
||||||
for (Player p : PluginMain.GetPlayers())
|
for (Player p : PluginMain.GetPlayers())
|
||||||
ChatPlayer.AddPlayerIfNeeded(p.getUniqueId());
|
ChatPlayer.GetFromPlayer(p);
|
||||||
if (sender != PluginMain.Console)
|
if (sender != PluginMain.Console)
|
||||||
PluginMain.Console.sendMessage("§6-- Reloading done!§r");
|
PluginMain.Console.sendMessage("§6-- Reloading done!§r");
|
||||||
sender.sendMessage("§6-- Reloading done!§r");
|
sender.sendMessage("§6-- Reloading done!§r");
|
||||||
|
|
|
@ -11,17 +11,14 @@ public class SetFlairCommand extends AdminCommandBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] GetHelpText(String alias) {
|
public String[] GetHelpText(String alias) {
|
||||||
return new String[] {
|
return new String[] { "§6---- Set flair -----", "Set a flair for a player",
|
||||||
"§6---- Set flair -----",
|
|
||||||
"Set a flair for a player",
|
|
||||||
"Usage: /u admin setflair <player> <flairtime (or non-presser, cant-press, none)> <cheater(true/false)> [username]",
|
"Usage: /u admin setflair <player> <flairtime (or non-presser, cant-press, none)> <cheater(true/false)> [username]",
|
||||||
"Example 1: /u admin setflair NorbiPeti 19 false NorbiPeti --> orange (19s)",
|
"Example 1: /u admin setflair NorbiPeti 19 false NorbiPeti --> orange (19s)",
|
||||||
"Example 2: /u admin setflair iie 0 true asde --> purple (0s)" };
|
"Example 2: /u admin setflair iie 0 true asde --> purple (0s)" };
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean OnCommand(CommandSender sender, String alias,
|
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
||||||
String[] args) {
|
|
||||||
if (args.length < 3) {
|
if (args.length < 3) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -41,7 +38,8 @@ public class SetFlairCommand extends AdminCommandBase {
|
||||||
try {
|
try {
|
||||||
flairtime = Short.parseShort(args[1]);
|
flairtime = Short.parseShort(args[1]);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
sender.sendMessage("§cFlairtime must be a number, \"non-presser\", \"cant-press\" or \"none\". Run without args to see usage.");
|
sender.sendMessage(
|
||||||
|
"§cFlairtime must be a number, \"non-presser\", \"cant-press\" or \"none\". Run without args to see usage.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} // TODO: Split config to per-player
|
} // TODO: Split config to per-player
|
||||||
|
@ -54,8 +52,7 @@ public class SetFlairCommand extends AdminCommandBase {
|
||||||
sender.sendMessage("§cUnknown value for cheater parameter. Run without args to see usage.");
|
sender.sendMessage("§cUnknown value for cheater parameter. Run without args to see usage.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
ChatPlayer mp = ChatPlayer.AddPlayerIfNeeded(p
|
ChatPlayer mp = ChatPlayer.GetFromPlayer(p);
|
||||||
.getUniqueId());
|
|
||||||
mp.SetFlair(flairtime, cheater);
|
mp.SetFlair(flairtime, cheater);
|
||||||
mp.FlairState = FlairStates.Accepted;
|
mp.FlairState = FlairStates.Accepted;
|
||||||
if (args.length < 4)
|
if (args.length < 4)
|
||||||
|
@ -65,8 +62,8 @@ public class SetFlairCommand extends AdminCommandBase {
|
||||||
if (!mp.UserNames.contains(args[3]))
|
if (!mp.UserNames.contains(args[3]))
|
||||||
mp.UserNames.add(args[3]);
|
mp.UserNames.add(args[3]);
|
||||||
}
|
}
|
||||||
sender.sendMessage("§bThe flair has been set. Player: " + mp.PlayerName
|
sender.sendMessage(
|
||||||
+ " Flair: " + mp.GetFormattedFlair() + "§r");
|
"§bThe flair has been set. Player: " + mp.PlayerName + " Flair: " + mp.GetFormattedFlair() + "§r");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue