Numerous fixes related to reloading the plugin, flairs and yeehaws

This commit is contained in:
Norbi Peti 2016-06-25 12:51:04 +02:00
parent ffa7c3f850
commit 88557f85cb
9 changed files with 17 additions and 7 deletions

View file

@ -21,6 +21,8 @@ commands:
description: Enable chat only mode. Useful for chat clients. description: Enable chat only mode. Useful for chat clients.
shrug: shrug:
description: Shrug. description: Shrug.
yeehaw:
description: This command makes you yeehaw.
author: NorbiPeti author: NorbiPeti
depend: [Essentials, Towny, Minigames, Votifier, WorldGuard, WorldEdit, ProtocolLib, FastLogin, Vault, AuthMe] depend: [Essentials, Towny, Minigames, Votifier, WorldGuard, WorldEdit, ProtocolLib, FastLogin, Vault, AuthMe]
permissions: permissions:

View file

@ -46,6 +46,9 @@ public class MaybeOfflinePlayer {
player.FlairTime = FlairTimeNone; player.FlairTime = FlairTimeNone;
player.FlairState = FlairStates.NoComment; player.FlairState = FlairStates.NoComment;
player.UserNames = new ArrayList<>(); player.UserNames = new ArrayList<>();
Player p = Bukkit.getPlayer(uuid);
if (p != null)
player.PlayerName = p.getName();
AllPlayers.put(uuid, player); AllPlayers.put(uuid, player);
return player; return player;
} }

View file

@ -74,7 +74,6 @@ public class PlayerListener implements Listener {
final Player p = event.getPlayer(); final Player p = event.getPlayer();
MaybeOfflinePlayer mp = MaybeOfflinePlayer.AddPlayerIfNeeded(p MaybeOfflinePlayer mp = MaybeOfflinePlayer.AddPlayerIfNeeded(p
.getUniqueId()); .getUniqueId());
mp.PlayerName = p.getName();
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();

View file

@ -63,8 +63,8 @@ public class CommandCaller implements CommandExecutor {
{ {
PluginCommand pc = plugin.getCommand(c.GetCommandPath()); PluginCommand pc = plugin.getCommand(c.GetCommandPath());
if (pc == null) if (pc == null)
System.out.println("Can't find top-level command: " new Exception("Can't find top-level command: "
+ c.GetCommandPath()); + c.GetCommandPath()).printStackTrace();
else else
pc.setExecutor(cc); pc.setExecutor(cc);
} }

View file

@ -26,7 +26,7 @@ public class MWikiCommand extends TBMCCommandBase {
else else
sender.sendMessage("§bMinecraft Wiki link: http://minecraft.gamepedia.com/index.php?search=" sender.sendMessage("§bMinecraft Wiki link: http://minecraft.gamepedia.com/index.php?search="
+ query + "&title=Special%3ASearch&go=Go"); + query + "&title=Special%3ASearch&go=Go");
return false; return true;
} }
@Override @Override

View file

@ -19,7 +19,7 @@ public class YeehawCommand extends TBMCCommandBase {
p.playSound(p.getLocation(), "tbmc.yeehaw", 1f, 1f); p.playSound(p.getLocation(), "tbmc.yeehaw", 1f, 1f);
p.sendMessage("§b* " p.sendMessage("§b* "
+ (sender instanceof Player ? ((Player) sender) + (sender instanceof Player ? ((Player) sender)
.getDisplayName() : sender.getName()) + " YEEHAWs."); .getDisplayName() : sender.getName()) + " §bYEEHAWs.");
} //Even a cmdblock could yeehaw in theory } //Even a cmdblock could yeehaw in theory
return true; return true;
} }

View file

@ -12,7 +12,7 @@ public final class ShrugCommand extends AppendTextCommandBase {
@Override @Override
public String GetAppendedText() { public String GetAppendedText() {
return "¯\\_(ツ)_/¯"; return "¯\\\\\\_(ツ)\\_/¯"; //TODO: Escape format codes
} }
@Override @Override

View file

@ -1,8 +1,10 @@
package io.github.norbipeti.thebuttonmcchat.commands.ucmds.admin; package io.github.norbipeti.thebuttonmcchat.commands.ucmds.admin;
import io.github.norbipeti.thebuttonmcchat.MaybeOfflinePlayer;
import io.github.norbipeti.thebuttonmcchat.PluginMain; import io.github.norbipeti.thebuttonmcchat.PluginMain;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class ConfirmCommand extends AdminCommandBase { public class ConfirmCommand extends AdminCommandBase {
@ -21,9 +23,13 @@ public class ConfirmCommand extends AdminCommandBase {
.sendMessage("§6-- Reloading The Button Minecraft plugin...§r"); .sendMessage("§6-- Reloading The Button Minecraft plugin...§r");
sender.sendMessage("§6-- Reloading The Button Minecraft plugin...§r"); sender.sendMessage("§6-- Reloading The Button Minecraft plugin...§r");
PluginMain.LoadFiles(true); PluginMain.LoadFiles(true);
// TODO: Add players online
for (Player p : PluginMain.GetPlayers())
MaybeOfflinePlayer.AddPlayerIfNeeded(p.getUniqueId());
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");
ReloadCommand.Reloader = null;
} catch (Exception e) { } catch (Exception e) {
System.out.println("Error!\n" + e); System.out.println("Error!\n" + e);
if (sender != PluginMain.Console) if (sender != PluginMain.Console)

View file

@ -20,7 +20,7 @@ public final class ReloadCommand extends AdminCommandBase {
public boolean OnCommand(CommandSender sender, String alias, public boolean OnCommand(CommandSender sender, String alias,
String[] args) { String[] args) {
Reloader = sender; Reloader = sender;
sender.sendMessage("§bMake sure to save the current settings before you modify and reload them! Type /u admin confirm when done.§r"); sender.sendMessage("§bMake sure to save the current settings before you modify and reload them! Type /u admin confirm when ready.§r");
return true; return true;
} }