Did #48 and added a note
- Cleaned PlayerListener (#48) - Added a note for reload command
This commit is contained in:
parent
854ba613b5
commit
b1fe758003
4 changed files with 11 additions and 56 deletions
|
@ -143,7 +143,7 @@ public class PlayerListener implements Listener {
|
||||||
|
|
||||||
cp.RPMode = true;
|
cp.RPMode = true;
|
||||||
|
|
||||||
cp.FlairUpdate(); // Update display
|
cp.FlairUpdate();
|
||||||
|
|
||||||
if (cp.ChatOnly || p.getGameMode().equals(GameMode.SPECTATOR)) {
|
if (cp.ChatOnly || p.getGameMode().equals(GameMode.SPECTATOR)) {
|
||||||
cp.ChatOnly = false;
|
cp.ChatOnly = false;
|
||||||
|
@ -213,7 +213,6 @@ public class PlayerListener implements Listener {
|
||||||
String cmd = "";
|
String cmd = "";
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
cmd = event.getMessage().substring(1);
|
cmd = event.getMessage().substring(1);
|
||||||
// System.out.println("cmd: " + cmd);
|
|
||||||
if (cmd.equalsIgnoreCase(Channel.GlobalChat.Command)) {
|
if (cmd.equalsIgnoreCase(Channel.GlobalChat.Command)) {
|
||||||
mp.CurrentChannel = Channel.GlobalChat;
|
mp.CurrentChannel = Channel.GlobalChat;
|
||||||
event.getPlayer().sendMessage("§6You are now talking in: §b" + mp.CurrentChannel.DisplayName);
|
event.getPlayer().sendMessage("§6You are now talking in: §b" + mp.CurrentChannel.DisplayName);
|
||||||
|
@ -249,7 +248,6 @@ public class PlayerListener implements Listener {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cmd = event.getMessage().substring(1, index);
|
cmd = event.getMessage().substring(1, index);
|
||||||
// System.out.println("cmd: " + cmd);
|
|
||||||
if (cmd.equalsIgnoreCase(Channel.GlobalChat.Command)) {
|
if (cmd.equalsIgnoreCase(Channel.GlobalChat.Command)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
Channel c = mp.CurrentChannel;
|
Channel c = mp.CurrentChannel;
|
||||||
|
@ -293,32 +291,6 @@ public class PlayerListener implements Listener {
|
||||||
p.sendMessage(String.format("* %s %s", event.getPlayer().getDisplayName(), message));
|
p.sendMessage(String.format("* %s %s", event.getPlayer().getDisplayName(), message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* boolean tping = false; boolean tphering = false; if (cmd.equalsIgnoreCase("tpa") || cmd.equalsIgnoreCase("call") || cmd.equalsIgnoreCase("ecall") || cmd.equalsIgnoreCase("etpa") ||
|
|
||||||
* cmd.equalsIgnoreCase("tpask") || cmd.equalsIgnoreCase("etpask")) tping = true; if (cmd.equalsIgnoreCase("tpahere") || cmd.equalsIgnoreCase("etpahere")) tphering = true;
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* for (HelpTopic ht : PluginMain.Instance.getServer() .getHelpMap().getHelpTopics()) { if (ht.getName().equalsIgnoreCase("/tpa")) { tping = true; break; } }
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* for (HelpTopic ht : PluginMain.Instance.getServer() .getHelpMap().getHelpTopics()) { if (ht.getName().equalsIgnoreCase("/tpahere")) tphering = true; break; }
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* if (tphering) { Player target = Bukkit.getPlayer(event.getMessage() .substring(index + 1).split(" ")[0]); if (target != null && BoardColl.get()
|
|
||||||
* .getFactionAt(PS.valueOf(target.getLocation())) .getId().equalsIgnoreCase("tower")) { event.getPlayer() .sendMessage( "§cYou are not allowed to teleport players out from the Tower");
|
|
||||||
* event.setCancelled(true); } }
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
* for (String s : Bukkit.getCommandAliases().get("/tpahere")) { if (cmd.equalsIgnoreCase(s)) { tping = true; break; } }
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
* if (tping) { if ( // MPlayer.get(event.getPlayer()).getFaction().getId ().equalsIgnoreCase("nomansland")) // { BoardColl .get() .getFactionAt(
|
|
||||||
* PS.valueOf(event.getPlayer().getLocation())) .getId().equalsIgnoreCase("tower")) { event.getPlayer().sendMessage( "§cYou are not allowed to teleport to the Tower");
|
|
||||||
* event.setCancelled(true); } }
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
if (cmd.equalsIgnoreCase("sethome")) {
|
if (cmd.equalsIgnoreCase("sethome")) {
|
||||||
TownyUniverse tu = PluginMain.Instance.TU;
|
TownyUniverse tu = PluginMain.Instance.TU;
|
||||||
|
@ -357,7 +329,6 @@ public class PlayerListener implements Listener {
|
||||||
}
|
}
|
||||||
} else if (cmd.toLowerCase().startsWith("un")) {
|
} else if (cmd.toLowerCase().startsWith("un")) {
|
||||||
for (HelpTopic ht : PluginMain.Instance.getServer().getHelpMap().getHelpTopics()) {
|
for (HelpTopic ht : PluginMain.Instance.getServer().getHelpMap().getHelpTopics()) {
|
||||||
// event.getPlayer().sendMessage("HT: " + ht.getName());
|
|
||||||
if (ht.getName().equalsIgnoreCase("/" + cmd))
|
if (ht.getName().equalsIgnoreCase("/" + cmd))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -395,8 +366,7 @@ public class PlayerListener implements Listener {
|
||||||
public void onTabComplete(PlayerChatTabCompleteEvent e) {
|
public void onTabComplete(PlayerChatTabCompleteEvent e) {
|
||||||
String name = e.getLastToken();
|
String name = e.getLastToken();
|
||||||
for (String nickname : nicknames.keySet()) {
|
for (String nickname : nicknames.keySet()) {
|
||||||
if (nickname.startsWith(name)
|
if (nickname.startsWith(name) && !nickname.equals(Bukkit.getPlayer(nicknames.get(nickname)).getName()))
|
||||||
&& !nickname.equals(Bukkit.getPlayer(nicknames.get(nickname)).getName()))
|
|
||||||
e.getTabCompletions().add(nickname);
|
e.getTabCompletions().add(nickname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -425,11 +395,7 @@ public class PlayerListener implements Listener {
|
||||||
if (e.getEntity().getName().equals("Alpha_Bacca44"))
|
if (e.getEntity().getName().equals("Alpha_Bacca44"))
|
||||||
AlphaDeaths++;
|
AlphaDeaths++;
|
||||||
MinigamePlayer mgp = Minigames.plugin.pdata.getMinigamePlayer(e.getEntity());
|
MinigamePlayer mgp = Minigames.plugin.pdata.getMinigamePlayer(e.getEntity());
|
||||||
if ((mgp != null && !mgp.isInMinigame()) && new Random().nextBoolean()) { // Don't
|
if ((mgp != null && !mgp.isInMinigame()) && new Random().nextBoolean()) { // Don't store Fs for NPCs
|
||||||
// store
|
|
||||||
// Fs
|
|
||||||
// for
|
|
||||||
// NPCs
|
|
||||||
if (Ftimer != null)
|
if (Ftimer != null)
|
||||||
Ftimer.cancel();
|
Ftimer.cancel();
|
||||||
ActiveF = true;
|
ActiveF = true;
|
||||||
|
@ -460,28 +426,19 @@ public class PlayerListener implements Listener {
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerItemPickup(PlayerPickupItemEvent e) {
|
public void onPlayerItemPickup(PlayerPickupItemEvent e) {
|
||||||
// System.out.println("A");
|
|
||||||
MinigamePlayer mp = Minigames.plugin.pdata.getMinigamePlayer(e.getPlayer());
|
MinigamePlayer mp = Minigames.plugin.pdata.getMinigamePlayer(e.getPlayer());
|
||||||
// System.out.println("B");
|
|
||||||
|
|
||||||
/*
|
|
||||||
* if (!e.getPlayer().isOp() && (!mp.isInMinigame() || mp.getMinigame().getName(false) .equalsIgnoreCase(Commands.KittyCannonMinigame))) return;
|
|
||||||
*/
|
|
||||||
if (!(mp.isInMinigame()
|
if (!(mp.isInMinigame()
|
||||||
&& mp.getMinigame().getName(false).equalsIgnoreCase(KittycannonCommand.KittyCannonMinigame)))
|
&& mp.getMinigame().getName(false).equalsIgnoreCase(KittycannonCommand.KittyCannonMinigame)))
|
||||||
return;
|
return;
|
||||||
// System.out.println("C");
|
|
||||||
ItemStack item = e.getItem().getItemStack();
|
ItemStack item = e.getItem().getItemStack();
|
||||||
if (!item.getType().equals(Material.SKULL_ITEM) && !item.getType().equals(Material.SKULL))
|
if (!item.getType().equals(Material.SKULL_ITEM) && !item.getType().equals(Material.SKULL))
|
||||||
return;
|
return;
|
||||||
// System.out.println("D");
|
|
||||||
SkullMeta meta = (SkullMeta) item.getItemMeta();
|
SkullMeta meta = (SkullMeta) item.getItemMeta();
|
||||||
if (!meta.getDisplayName().equals("§rOcelot Head") || !meta.getOwner().equals("MHF_Ocelot"))
|
if (!meta.getDisplayName().equals("§rOcelot Head") || !meta.getOwner().equals("MHF_Ocelot"))
|
||||||
return;
|
return;
|
||||||
// System.out.println("E");
|
|
||||||
if (meta.getLore() == null || meta.getLore().size() == 0)
|
if (meta.getLore() == null || meta.getLore().size() == 0)
|
||||||
return;
|
return;
|
||||||
// System.out.println("F");
|
|
||||||
ItemStack hat = e.getPlayer().getInventory().getHelmet();
|
ItemStack hat = e.getPlayer().getInventory().getHelmet();
|
||||||
if (!(hat != null && (hat.getType().equals(Material.SKULL) || hat.getType().equals(Material.SKULL_ITEM))
|
if (!(hat != null && (hat.getType().equals(Material.SKULL) || hat.getType().equals(Material.SKULL_ITEM))
|
||||||
&& ((SkullMeta) hat.getItemMeta()).getDisplayName().equals("§rWolf Head")))
|
&& ((SkullMeta) hat.getItemMeta()).getDisplayName().equals("§rWolf Head")))
|
||||||
|
@ -608,7 +565,6 @@ public class PlayerListener implements Listener {
|
||||||
}
|
}
|
||||||
if (cmd.toLowerCase().startsWith("un")) {
|
if (cmd.toLowerCase().startsWith("un")) {
|
||||||
for (HelpTopic ht : PluginMain.Instance.getServer().getHelpMap().getHelpTopics()) {
|
for (HelpTopic ht : PluginMain.Instance.getServer().getHelpMap().getHelpTopics()) {
|
||||||
// event.getSender().sendMessage("HT: " + ht.getName());
|
|
||||||
if (ht.getName().equalsIgnoreCase("/" + cmd))
|
if (ht.getName().equalsIgnoreCase("/" + cmd))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,7 @@ public final class ReloadCommand extends AdminCommandBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] GetHelpText(String alias) {
|
public String[] GetHelpText(String alias) {
|
||||||
return new String[] {
|
return new String[] { "§6---- Reload plugin ----", "This command allows you to reload the plugin's config",
|
||||||
"§6---- Reload plugin ----",
|
|
||||||
"This command allows you to reload the plugin's config",
|
|
||||||
"This isn't the same as reloading the server, and should not cause any issues with other plugins",
|
"This isn't the same as reloading the server, and should not cause any issues with other plugins",
|
||||||
"Save the config by using /u admin save before you reload it",
|
"Save the config by using /u admin save before you reload it",
|
||||||
"Because of this, you'll need to confirm the reload with /u admin confirm" };
|
"Because of this, you'll need to confirm the reload with /u admin confirm" };
|
||||||
|
@ -17,10 +15,11 @@ public final class ReloadCommand extends AdminCommandBase {
|
||||||
public static CommandSender Reloader;
|
public static CommandSender Reloader;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
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 ready.§r");
|
sender.sendMessage(
|
||||||
|
"§bMake sure to save the current settings before you modify and reload them! Type /u admin confirm when ready.§r");
|
||||||
|
sender.sendMessage("§bNote that this command may not set players up correctly as of now.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,9 +31,9 @@ public class UpdatePlugin extends AdminCommandBase {
|
||||||
sender.sendMessage("Updating plugin...");
|
sender.sendMessage("Updating plugin...");
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(PluginMain.Instance, () -> {
|
Bukkit.getScheduler().runTaskAsynchronously(PluginMain.Instance, () -> {
|
||||||
String ret = "";
|
String ret = "";
|
||||||
if ((ret = TBMCCoreAPI.UpdatePlugin(args[0])).length() > 0) {
|
if ((ret = TBMCCoreAPI.UpdatePlugin(args[0])).length() > 0)
|
||||||
sender.sendMessage(ret);
|
sender.sendMessage(ret);
|
||||||
} else
|
else
|
||||||
sender.sendMessage("Updating done!");
|
sender.sendMessage("Updating done!");
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -194,7 +194,7 @@ public final class ChatFormatter {
|
||||||
.append(", ").append(priority).append(")").toString();
|
.append(", ").append(priority).append(")").toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Format implements TellrawSerializableEnum { // TODO: Flag!
|
public enum Format implements TellrawSerializableEnum {
|
||||||
Bold("bold"), Underlined("underlined"), Italic("italic"), Strikethrough("strikethrough"), Obfuscated(
|
Bold("bold"), Underlined("underlined"), Italic("italic"), Strikethrough("strikethrough"), Obfuscated(
|
||||||
"obfuscated");
|
"obfuscated");
|
||||||
// TODO: Add format codes to /u c <mode>
|
// TODO: Add format codes to /u c <mode>
|
||||||
|
|
Loading…
Reference in a new issue