Added API with documentation, renamed player class
This commit is contained in:
parent
b6bf563b4b
commit
fb869c7662
14 changed files with 127 additions and 77 deletions
52
src/io/github/norbipeti/thebuttonmcchat/API.java
Normal file
52
src/io/github/norbipeti/thebuttonmcchat/API.java
Normal file
|
@ -0,0 +1,52 @@
|
|||
package io.github.norbipeti.thebuttonmcchat;
|
||||
|
||||
import io.github.norbipeti.thebuttonmcchat.commands.CommandCaller;
|
||||
import io.github.norbipeti.thebuttonmcchat.commands.TBMCCommandBase;
|
||||
import io.github.norbipeti.thebuttonmcchat.commands.ucmds.admin.PlayerInfoCommand;
|
||||
|
||||
public class API {
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* This method adds a command, adding it to help for example.
|
||||
* </p>
|
||||
* <p>
|
||||
* The command must be registered in the caller plugin's plugin.yml.
|
||||
* Otherwise the plugin will output a messsage to console.
|
||||
* </p>
|
||||
*
|
||||
* @param plugin
|
||||
* The caller plugin
|
||||
* @param cmd
|
||||
* The command to add
|
||||
*/
|
||||
public void AddCommand(Plugin plugin, TBMCCommandBase cmd) {
|
||||
CommandCaller.AddCommand(plugin, cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Add player information for {@link PlayerInfoCommand}. Only mods can see
|
||||
* the given information.
|
||||
* </p>
|
||||
*
|
||||
* @param player
|
||||
* @param infoline
|
||||
*/
|
||||
public void AddPlayerInfoForMods(TBMCPlayer player, String infoline) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Add player information for hover text at {@link ChatProcessing}. Every
|
||||
* online player can see the given information.
|
||||
* </p>
|
||||
*
|
||||
* @param player
|
||||
* @param infoline
|
||||
*/
|
||||
public void AddPlayerInfoForHover(TBMCPlayer player, String infoline) {
|
||||
// TODO
|
||||
}
|
||||
}
|
|
@ -7,6 +7,6 @@ public abstract class PlayerJoinTimerTask extends TimerTask {
|
|||
@Override
|
||||
public abstract void run();
|
||||
|
||||
public MaybeOfflinePlayer mp;
|
||||
public TBMCPlayer mp;
|
||||
|
||||
}
|
||||
|
|
|
@ -156,7 +156,7 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
|
|||
else
|
||||
ign = ign.substring(start, end);
|
||||
ign = ign.trim();
|
||||
MaybeOfflinePlayer mp = MaybeOfflinePlayer.GetFromName(ign);
|
||||
TBMCPlayer mp = TBMCPlayer.GetFromName(ign);
|
||||
if (mp == null)
|
||||
continue;
|
||||
if (!JoinedBefore(mp, 2015, 6, 5))
|
||||
|
@ -185,7 +185,7 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
|
|||
}
|
||||
}
|
||||
|
||||
public void DownloadFlair(MaybeOfflinePlayer mp)
|
||||
public void DownloadFlair(TBMCPlayer mp)
|
||||
throws MalformedURLException, IOException {
|
||||
String[] flairdata = DownloadString(
|
||||
"http://karmadecay.com/thebutton-data.php?users=" + mp.UserName)
|
||||
|
@ -218,7 +218,7 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
|
|||
return body;
|
||||
}
|
||||
|
||||
private void SetFlair(MaybeOfflinePlayer p, String text, String flairclass,
|
||||
private void SetFlair(TBMCPlayer p, String text, String flairclass,
|
||||
String username) {
|
||||
p.UserName = username;
|
||||
p.FlairState = FlairStates.Recognised;
|
||||
|
@ -233,26 +233,26 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
|
|||
{
|
||||
try {
|
||||
if (CheckForJoinDate(p)) {
|
||||
p.SetFlair(MaybeOfflinePlayer.FlairTimeNonPresser);
|
||||
p.SetFlair(TBMCPlayer.FlairTimeNonPresser);
|
||||
} else {
|
||||
p.SetFlair(MaybeOfflinePlayer.FlairTimeCantPress);
|
||||
p.SetFlair(TBMCPlayer.FlairTimeCantPress);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
p.FlairState = FlairStates.Commented; // Flair unknown
|
||||
p.SetFlair(MaybeOfflinePlayer.FlairTimeNone);
|
||||
p.SetFlair(TBMCPlayer.FlairTimeNone);
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
if (CheckForJoinDate(p)) {
|
||||
p.FlairState = FlairStates.Commented; // Flair unknown
|
||||
p.SetFlair(MaybeOfflinePlayer.FlairTimeNone);
|
||||
p.SetFlair(TBMCPlayer.FlairTimeNone);
|
||||
} else {
|
||||
p.SetFlair(MaybeOfflinePlayer.FlairTimeCantPress);
|
||||
p.SetFlair(TBMCPlayer.FlairTimeCantPress);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
p.FlairState = FlairStates.Commented; // Flair unknown
|
||||
p.SetFlair(MaybeOfflinePlayer.FlairTimeNone);
|
||||
p.SetFlair(TBMCPlayer.FlairTimeNone);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -263,12 +263,12 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
|
|||
p.SetFlair(Short.parseShort(text));
|
||||
}
|
||||
|
||||
public static boolean CheckForJoinDate(MaybeOfflinePlayer mp)
|
||||
public static boolean CheckForJoinDate(TBMCPlayer mp)
|
||||
throws Exception {
|
||||
return JoinedBefore(mp, 2015, 4, 1);
|
||||
}
|
||||
|
||||
public static boolean JoinedBefore(MaybeOfflinePlayer mp, int year,
|
||||
public static boolean JoinedBefore(TBMCPlayer mp, int year,
|
||||
int month, int day) throws Exception {
|
||||
URL url = new URL("https://www.reddit.com/u/" + mp.UserName);
|
||||
URLConnection con = url.openConnection();
|
||||
|
@ -288,7 +288,7 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
|
|||
.setDate(year, month, day).build().getTime());
|
||||
}
|
||||
|
||||
public static void ConfirmUserMessage(MaybeOfflinePlayer mp) {
|
||||
public static void ConfirmUserMessage(TBMCPlayer mp) {
|
||||
Player p = Bukkit.getPlayer(mp.UUID);
|
||||
if (mp.FlairState.equals(FlairStates.Commented) && p != null)
|
||||
if (mp.UserNames.size() > 1)
|
||||
|
@ -307,7 +307,7 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
|
|||
public static void LoadFiles(boolean reload) {
|
||||
if (reload) {
|
||||
System.out.println("TBMC chat plugin cleanup for reloading...");
|
||||
MaybeOfflinePlayer.AllPlayers.clear();
|
||||
TBMCPlayer.AllPlayers.clear();
|
||||
AnnounceMessages.clear();
|
||||
}
|
||||
System.out.println("Loading files for TBMC chat plugin...");
|
||||
|
@ -316,7 +316,7 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
|
|||
if (file.exists()) {
|
||||
YamlConfiguration yc = new YamlConfiguration();
|
||||
yc.load(file);
|
||||
MaybeOfflinePlayer.Load(yc);
|
||||
TBMCPlayer.Load(yc);
|
||||
PlayerListener.NotificationSound = yc
|
||||
.getString("notificationsound");
|
||||
PlayerListener.NotificationPitch = yc
|
||||
|
@ -340,7 +340,7 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
|
|||
try {
|
||||
File file = new File("thebuttonmc.yml");
|
||||
YamlConfiguration yc = new YamlConfiguration();
|
||||
MaybeOfflinePlayer.Save(yc);
|
||||
TBMCPlayer.Save(yc);
|
||||
yc.set("notificationsound", PlayerListener.NotificationSound);
|
||||
yc.set("notificationpitch", PlayerListener.NotificationPitch);
|
||||
yc.set("announcetime", AnnounceTime);
|
||||
|
|
|
@ -11,7 +11,7 @@ import org.bukkit.configuration.ConfigurationSection;
|
|||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class MaybeOfflinePlayer {
|
||||
public class TBMCPlayer {
|
||||
public String PlayerName;
|
||||
public String UserName;
|
||||
public List<String> UserNames;
|
||||
|
@ -37,11 +37,11 @@ public class MaybeOfflinePlayer {
|
|||
|
||||
public UUID UUID;
|
||||
|
||||
public static HashMap<UUID, MaybeOfflinePlayer> AllPlayers = new HashMap<>();
|
||||
public static HashMap<UUID, TBMCPlayer> AllPlayers = new HashMap<>();
|
||||
|
||||
public static MaybeOfflinePlayer AddPlayerIfNeeded(UUID uuid) {
|
||||
public static TBMCPlayer AddPlayerIfNeeded(UUID uuid) {
|
||||
if (!AllPlayers.containsKey(uuid)) {
|
||||
MaybeOfflinePlayer player = new MaybeOfflinePlayer();
|
||||
TBMCPlayer player = new TBMCPlayer();
|
||||
player.UUID = uuid;
|
||||
player.FlairTime = FlairTimeNone;
|
||||
player.FlairState = FlairStates.NoComment;
|
||||
|
@ -59,7 +59,7 @@ public class MaybeOfflinePlayer {
|
|||
ConfigurationSection cs = yc.getConfigurationSection("players");
|
||||
for (String key : cs.getKeys(false)) {
|
||||
ConfigurationSection cs2 = cs.getConfigurationSection(key);
|
||||
MaybeOfflinePlayer mp = AddPlayerIfNeeded(java.util.UUID
|
||||
TBMCPlayer mp = AddPlayerIfNeeded(java.util.UUID
|
||||
.fromString(cs2.getString("uuid")));
|
||||
mp.UserName = cs2.getString("username");
|
||||
String tmp = cs2.getString("flairtime");
|
||||
|
@ -84,7 +84,7 @@ public class MaybeOfflinePlayer {
|
|||
|
||||
public static void Save(YamlConfiguration yc) {
|
||||
ConfigurationSection cs = yc.createSection("players");
|
||||
for (MaybeOfflinePlayer mp : MaybeOfflinePlayer.AllPlayers.values()) {
|
||||
for (TBMCPlayer mp : TBMCPlayer.AllPlayers.values()) {
|
||||
ConfigurationSection cs2 = cs.createSection(mp.UUID.toString());
|
||||
cs2.set("playername", mp.PlayerName);
|
||||
cs2.set("username", mp.UserName);
|
||||
|
@ -98,7 +98,7 @@ public class MaybeOfflinePlayer {
|
|||
}
|
||||
}
|
||||
|
||||
public static MaybeOfflinePlayer GetFromName(String name) {
|
||||
public static TBMCPlayer GetFromName(String name) {
|
||||
Player p = Bukkit.getPlayer(name);
|
||||
if (p != null)
|
||||
return AllPlayers.get(p.getUniqueId());
|
||||
|
@ -162,7 +162,7 @@ public class MaybeOfflinePlayer {
|
|||
return FlairTime;
|
||||
}
|
||||
|
||||
public static MaybeOfflinePlayer GetFromPlayer(Player p) {
|
||||
return MaybeOfflinePlayer.AllPlayers.get(p.getUniqueId());
|
||||
public static TBMCPlayer GetFromPlayer(Player p) {
|
||||
return TBMCPlayer.AllPlayers.get(p.getUniqueId());
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package io.github.norbipeti.thebuttonmcchat.commands;
|
||||
|
||||
import io.github.norbipeti.thebuttonmcchat.MaybeOfflinePlayer;
|
||||
import io.github.norbipeti.thebuttonmcchat.TBMCPlayer;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -21,7 +21,7 @@ public final class ChatonlyCommand extends TBMCCommandBase {
|
|||
@Override
|
||||
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
||||
Player player=(Player)sender;
|
||||
MaybeOfflinePlayer p = MaybeOfflinePlayer.AllPlayers.get(player
|
||||
TBMCPlayer p = TBMCPlayer.AllPlayers.get(player
|
||||
.getUniqueId());
|
||||
p.ChatOnly = true;
|
||||
player.setGameMode(GameMode.SPECTATOR);
|
||||
|
|
|
@ -33,26 +33,18 @@ public class CommandCaller implements CommandExecutor {
|
|||
|
||||
public static void RegisterCommands(PluginMain plugin) {
|
||||
if (instance != null) {
|
||||
new Exception("Only one instance of CommandCaller is allowed")
|
||||
.printStackTrace();
|
||||
new Exception("Only one instance of CommandCaller is allowed").printStackTrace();
|
||||
return;
|
||||
}
|
||||
System.out.println("Registering commands...");
|
||||
|
||||
CommandCaller cc = new CommandCaller();
|
||||
instance = cc;
|
||||
if (instance == null)
|
||||
instance = new CommandCaller();
|
||||
Reflections rf = new Reflections(
|
||||
new ConfigurationBuilder()
|
||||
.setUrls(
|
||||
ClasspathHelper.forClassLoader(plugin
|
||||
.getClass().getClassLoader()))
|
||||
.addClassLoader(plugin.getClass().getClassLoader())
|
||||
.addScanners(new SubTypesScanner())
|
||||
.filterInputsBy(
|
||||
(String pkg) -> pkg
|
||||
.contains("io.github.norbipeti.thebuttonmcchat.commands")));
|
||||
Set<Class<? extends TBMCCommandBase>> cmds = rf
|
||||
.getSubTypesOf(TBMCCommandBase.class);
|
||||
new ConfigurationBuilder().setUrls(ClasspathHelper.forClassLoader(plugin.getClass().getClassLoader()))
|
||||
.addClassLoader(plugin.getClass().getClassLoader()).addScanners(new SubTypesScanner())
|
||||
.filterInputsBy((String pkg) -> pkg.contains("io.github.norbipeti.thebuttonmcchat.commands")));
|
||||
Set<Class<? extends TBMCCommandBase>> cmds = rf.getSubTypesOf(TBMCCommandBase.class);
|
||||
for (Class<? extends TBMCCommandBase> cmd : cmds) {
|
||||
try {
|
||||
if (Modifier.isAbstract(cmd.getModifiers()))
|
||||
|
@ -63,8 +55,7 @@ public class CommandCaller implements CommandExecutor {
|
|||
{
|
||||
PluginCommand pc = plugin.getCommand(c.GetCommandPath());
|
||||
if (pc == null)
|
||||
new Exception("Can't find top-level command: "
|
||||
+ c.GetCommandPath()).printStackTrace();
|
||||
new Exception("Can't find top-level command: " + c.GetCommandPath()).printStackTrace();
|
||||
else
|
||||
pc.setExecutor(cc);
|
||||
}
|
||||
|
@ -76,9 +67,22 @@ public class CommandCaller implements CommandExecutor {
|
|||
}
|
||||
}
|
||||
|
||||
public static void AddCommand(Plugin plugin, TBMCCommandBase cmd) {
|
||||
if (instance == null)
|
||||
instance = new CommandCaller();
|
||||
commands.put(cmd.GetCommandPath(), cmd);
|
||||
if (!c.GetCommandPath().contains("/")) // Top-level command
|
||||
{
|
||||
PluginCommand pc = plugin.getCommand(cmd.GetCommandPath());
|
||||
if (pc == null)
|
||||
new Exception("Can't find top-level command: " + c.GetCommandPath()).printStackTrace();
|
||||
else
|
||||
pc.setExecutor(instance);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command,
|
||||
String alias, String[] args) {
|
||||
public boolean onCommand(CommandSender sender, Command command, String alias, String[] args) {
|
||||
String path = command.getName();
|
||||
for (String arg : args)
|
||||
path += "/" + arg;
|
||||
|
@ -92,20 +96,15 @@ public class CommandCaller implements CommandExecutor {
|
|||
if (cmd == null) {
|
||||
sender.sendMessage("§cInternal error: Command not registered to CommandCaller");
|
||||
if (sender != Bukkit.getConsoleSender())
|
||||
Bukkit.getConsoleSender()
|
||||
.sendMessage(
|
||||
"§cInternal error: Command not registered to CommandCaller");
|
||||
Bukkit.getConsoleSender().sendMessage("§cInternal error: Command not registered to CommandCaller");
|
||||
return true;
|
||||
}
|
||||
if (cmd.GetPlayerOnly() && sender == Bukkit.getConsoleSender()) {
|
||||
sender.sendMessage("§cOnly ingame players can use this command.");
|
||||
return true;
|
||||
}
|
||||
if (!cmd.OnCommand(
|
||||
sender,
|
||||
alias,
|
||||
(args.length > 0 ? Arrays.copyOfRange(args, args.length - argc,
|
||||
args.length) : args)))
|
||||
if (!cmd.OnCommand(sender, alias,
|
||||
(args.length > 0 ? Arrays.copyOfRange(args, args.length - argc, args.length) : args)))
|
||||
sender.sendMessage(cmd.GetHelpText(alias));
|
||||
return true;
|
||||
}
|
||||
|
@ -115,8 +114,7 @@ public class CommandCaller implements CommandExecutor {
|
|||
cmds.add("§6---- Subcommands ----");
|
||||
for (TBMCCommandBase cmd : CommandCaller.GetCommands().values()) {
|
||||
if (cmd.GetCommandPath().startsWith(command.GetCommandPath() + "/")) {
|
||||
int ind = cmd.GetCommandPath().indexOf('/',
|
||||
command.GetCommandPath().length() + 2);
|
||||
int ind = cmd.GetCommandPath().indexOf('/', command.GetCommandPath().length() + 2);
|
||||
if (ind >= 0)
|
||||
continue;
|
||||
cmds.add(cmd.GetCommandPath().replace('/', ' '));
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package io.github.norbipeti.thebuttonmcchat.commands;
|
||||
|
||||
import io.github.norbipeti.thebuttonmcchat.MaybeOfflinePlayer;
|
||||
import io.github.norbipeti.thebuttonmcchat.TBMCPlayer;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -21,12 +21,12 @@ public final class OOCCommand extends TBMCCommandBase {
|
|||
if (args.length == 0) {
|
||||
return false;
|
||||
} else {
|
||||
MaybeOfflinePlayer.AddPlayerIfNeeded(player.getUniqueId()).RPMode = false;
|
||||
TBMCPlayer.AddPlayerIfNeeded(player.getUniqueId()).RPMode = false;
|
||||
String message = "";
|
||||
for (String arg : args)
|
||||
message += arg + " ";
|
||||
player.chat(message.substring(0, message.length() - 1));
|
||||
MaybeOfflinePlayer.AddPlayerIfNeeded(player.getUniqueId()).RPMode = true;
|
||||
TBMCPlayer.AddPlayerIfNeeded(player.getUniqueId()).RPMode = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package io.github.norbipeti.thebuttonmcchat.commands.ucmds;
|
||||
|
||||
import io.github.norbipeti.thebuttonmcchat.FlairStates;
|
||||
import io.github.norbipeti.thebuttonmcchat.MaybeOfflinePlayer;
|
||||
import io.github.norbipeti.thebuttonmcchat.TBMCPlayer;
|
||||
import io.github.norbipeti.thebuttonmcchat.PlayerJoinTimerTask;
|
||||
import io.github.norbipeti.thebuttonmcchat.PluginMain;
|
||||
|
||||
|
@ -22,7 +22,7 @@ public class AcceptCommand extends UCommandBase {
|
|||
@Override
|
||||
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
||||
final Player player = (Player) sender;
|
||||
MaybeOfflinePlayer p = MaybeOfflinePlayer.GetFromPlayer(player);
|
||||
TBMCPlayer p = TBMCPlayer.GetFromPlayer(player);
|
||||
if (args.length < 1 && p.UserNames.size() > 1) {
|
||||
player.sendMessage("§9Multiple users commented your name. §bPlease pick one using /u accept <username>");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package io.github.norbipeti.thebuttonmcchat.commands.ucmds;
|
||||
|
||||
import io.github.norbipeti.thebuttonmcchat.ChatFormatter;
|
||||
import io.github.norbipeti.thebuttonmcchat.MaybeOfflinePlayer;
|
||||
import io.github.norbipeti.thebuttonmcchat.TBMCPlayer;
|
||||
import io.github.norbipeti.thebuttonmcchat.PluginMain;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -19,7 +19,7 @@ public class CCommand extends UCommandBase {
|
|||
@Override
|
||||
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
||||
Player player = (Player) sender;
|
||||
MaybeOfflinePlayer p = MaybeOfflinePlayer.AddPlayerIfNeeded(player
|
||||
TBMCPlayer p = TBMCPlayer.AddPlayerIfNeeded(player
|
||||
.getUniqueId());
|
||||
if (args.length < 1) {
|
||||
if (PluginMain.permission.has(player, "tbmc.rainbow")) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package io.github.norbipeti.thebuttonmcchat.commands.ucmds;
|
||||
|
||||
import io.github.norbipeti.thebuttonmcchat.FlairStates;
|
||||
import io.github.norbipeti.thebuttonmcchat.MaybeOfflinePlayer;
|
||||
import io.github.norbipeti.thebuttonmcchat.TBMCPlayer;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -19,7 +19,7 @@ public final class IgnoreCommand extends UCommandBase {
|
|||
@Override
|
||||
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
||||
final Player player = (Player) sender;
|
||||
MaybeOfflinePlayer p = MaybeOfflinePlayer.GetFromPlayer(player);
|
||||
TBMCPlayer p = TBMCPlayer.GetFromPlayer(player);
|
||||
if (p.FlairState.equals(FlairStates.Accepted)) {
|
||||
player.sendMessage("§cYou can only ignore the \"write yoőu rname in the thread\" message.");
|
||||
return true;
|
||||
|
@ -30,7 +30,7 @@ public final class IgnoreCommand extends UCommandBase {
|
|||
}
|
||||
if (!p.FlairState.equals(FlairStates.Ignored)) {
|
||||
p.FlairState = FlairStates.Ignored;
|
||||
p.SetFlair(MaybeOfflinePlayer.FlairTimeNone);
|
||||
p.SetFlair(TBMCPlayer.FlairTimeNone);
|
||||
p.UserName = "";
|
||||
player.sendMessage("§bYou have ignored the message. You can still use /u accept to get a flair.§r");
|
||||
} else
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package io.github.norbipeti.thebuttonmcchat.commands.ucmds;
|
||||
|
||||
import io.github.norbipeti.thebuttonmcchat.MaybeOfflinePlayer;
|
||||
import io.github.norbipeti.thebuttonmcchat.TBMCPlayer;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
|
@ -19,7 +19,7 @@ public class NameCommand extends UCommandBase {
|
|||
if (args.length == 1) {
|
||||
return false;
|
||||
}
|
||||
MaybeOfflinePlayer mp = MaybeOfflinePlayer.GetFromName(args[1]);
|
||||
TBMCPlayer mp = TBMCPlayer.GetFromName(args[1]);
|
||||
if (mp == null) {
|
||||
sender.sendMessage("§cUnknown user (player has to be online): "
|
||||
+ args[1]);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package io.github.norbipeti.thebuttonmcchat.commands.ucmds.admin;
|
||||
|
||||
import io.github.norbipeti.thebuttonmcchat.MaybeOfflinePlayer;
|
||||
import io.github.norbipeti.thebuttonmcchat.TBMCPlayer;
|
||||
import io.github.norbipeti.thebuttonmcchat.PluginMain;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -25,7 +25,7 @@ public class ConfirmCommand extends AdminCommandBase {
|
|||
PluginMain.LoadFiles(true);
|
||||
// TODO: Add players online
|
||||
for (Player p : PluginMain.GetPlayers())
|
||||
MaybeOfflinePlayer.AddPlayerIfNeeded(p.getUniqueId());
|
||||
TBMCPlayer.AddPlayerIfNeeded(p.getUniqueId());
|
||||
if (sender != PluginMain.Console)
|
||||
PluginMain.Console.sendMessage("§6-- Reloading done!§r");
|
||||
sender.sendMessage("§6-- Reloading done!§r");
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package io.github.norbipeti.thebuttonmcchat.commands.ucmds.admin;
|
||||
|
||||
import io.github.norbipeti.thebuttonmcchat.MaybeOfflinePlayer;
|
||||
import io.github.norbipeti.thebuttonmcchat.TBMCPlayer;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
|
@ -20,7 +20,7 @@ public class PlayerInfoCommand extends AdminCommandBase {
|
|||
if (args.length == 0) {
|
||||
return false;
|
||||
}
|
||||
MaybeOfflinePlayer p = MaybeOfflinePlayer.GetFromName(args[0]);
|
||||
TBMCPlayer p = TBMCPlayer.GetFromName(args[0]);
|
||||
if (p == null) {
|
||||
sender.sendMessage("§cPlayer not found: " + args[0]
|
||||
+ " - Currently only online players can be viewed§r");
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package io.github.norbipeti.thebuttonmcchat.commands.ucmds.admin;
|
||||
|
||||
import io.github.norbipeti.thebuttonmcchat.FlairStates;
|
||||
import io.github.norbipeti.thebuttonmcchat.MaybeOfflinePlayer;
|
||||
import io.github.norbipeti.thebuttonmcchat.TBMCPlayer;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -32,11 +32,11 @@ public class SetFlairCommand extends AdminCommandBase {
|
|||
}
|
||||
short flairtime = 0x00;
|
||||
if (args[1].equalsIgnoreCase("non-presser"))
|
||||
flairtime = MaybeOfflinePlayer.FlairTimeNonPresser;
|
||||
flairtime = TBMCPlayer.FlairTimeNonPresser;
|
||||
else if (args[1].equalsIgnoreCase("cant-press"))
|
||||
flairtime = MaybeOfflinePlayer.FlairTimeCantPress;
|
||||
flairtime = TBMCPlayer.FlairTimeCantPress;
|
||||
else if (args[1].equalsIgnoreCase("none"))
|
||||
flairtime = MaybeOfflinePlayer.FlairTimeNone;
|
||||
flairtime = TBMCPlayer.FlairTimeNone;
|
||||
else {
|
||||
try {
|
||||
flairtime = Short.parseShort(args[1]);
|
||||
|
@ -54,7 +54,7 @@ public class SetFlairCommand extends AdminCommandBase {
|
|||
sender.sendMessage("§cUnknown value for cheater parameter. Run without args to see usage.");
|
||||
return true;
|
||||
}
|
||||
MaybeOfflinePlayer mp = MaybeOfflinePlayer.AddPlayerIfNeeded(p
|
||||
TBMCPlayer mp = TBMCPlayer.AddPlayerIfNeeded(p
|
||||
.getUniqueId());
|
||||
mp.SetFlair(flairtime, cheater);
|
||||
mp.FlairState = FlairStates.Accepted;
|
||||
|
|
Loading…
Reference in a new issue