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.
shrug:
description: Shrug.
yeehaw:
description: This command makes you yeehaw.
author: NorbiPeti
depend: [Essentials, Towny, Minigames, Votifier, WorldGuard, WorldEdit, ProtocolLib, FastLogin, Vault, AuthMe]
permissions:

View file

@ -46,6 +46,9 @@ public class MaybeOfflinePlayer {
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;
}

View file

@ -74,7 +74,6 @@ public class PlayerListener implements Listener {
final Player p = event.getPlayer();
MaybeOfflinePlayer mp = MaybeOfflinePlayer.AddPlayerIfNeeded(p
.getUniqueId());
mp.PlayerName = p.getName();
if (!mp.FlairState.equals(FlairStates.NoComment)) {
PluginMain.ConfirmUserMessage(mp);
Timer timer = new Timer();

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -20,7 +20,7 @@ public final class ReloadCommand extends AdminCommandBase {
public boolean OnCommand(CommandSender sender, String alias,
String[] args) {
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;
}