Added /tableflip, /unflip, /chatonly and the ability to unlaugh the console
This commit is contained in:
parent
e8ebd8c41e
commit
53d8567148
7 changed files with 217 additions and 175 deletions
Binary file not shown.
13
plugin.yml
13
plugin.yml
|
@ -17,10 +17,17 @@ commands:
|
||||||
description: Unlaugh the last laugh.
|
description: Unlaugh the last laugh.
|
||||||
mwiki:
|
mwiki:
|
||||||
description: Search the wiki.
|
description: Search the wiki.
|
||||||
usage: "&vUsage: /mwiki [query]&r"
|
usage: "&cUsage: /mwiki [query]&r"
|
||||||
dontrunthiscmd:
|
dontrunthiscmd:
|
||||||
warmode:
|
tableflip:
|
||||||
description: Toggles war mode
|
description: Flip a table.
|
||||||
|
usage: "&cUsage: /tableflip [message]&r"
|
||||||
|
unflip:
|
||||||
|
description: Unflip a flip.
|
||||||
|
usage: "&cUsage: /unflip [message]&r"
|
||||||
|
chatonly:
|
||||||
|
description: Enable chat only mode. Useful for chat clients.
|
||||||
|
usage: "&cUsage: /chatonly&r"
|
||||||
author: NorbiPeti
|
author: NorbiPeti
|
||||||
depend: [Essentials, Towny, Minigames, Votifier, Factions, WorldGuard, WorldEdit, ProtocolLib, FastLogin, Vault, AuthMe]
|
depend: [Essentials, Towny, Minigames, Votifier, Factions, WorldGuard, WorldEdit, ProtocolLib, FastLogin, Vault, AuthMe]
|
||||||
permissions:
|
permissions:
|
||||||
|
|
|
@ -26,6 +26,11 @@ public class ChatProcessing {
|
||||||
PlayerListener.essentials = (Essentials) (Bukkit.getPluginManager()
|
PlayerListener.essentials = (Essentials) (Bukkit.getPluginManager()
|
||||||
.getPlugin("Essentials"));
|
.getPlugin("Essentials"));
|
||||||
Player player = (sender instanceof Player ? (Player) sender : null);
|
Player player = (sender instanceof Player ? (Player) sender : null);
|
||||||
|
|
||||||
|
if (player != null
|
||||||
|
&& PlayerListener.essentials.getUser(player).isMuted())
|
||||||
|
return true;
|
||||||
|
|
||||||
MaybeOfflinePlayer mp = null;
|
MaybeOfflinePlayer mp = null;
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
mp = MaybeOfflinePlayer.AllPlayers.get(player.getUniqueId());
|
mp = MaybeOfflinePlayer.AllPlayers.get(player.getUniqueId());
|
||||||
|
@ -41,16 +46,28 @@ public class ChatProcessing {
|
||||||
}
|
}
|
||||||
|
|
||||||
String msg = message.toLowerCase();
|
String msg = message.toLowerCase();
|
||||||
if (player != null && msg.contains("lol")) {
|
if (msg.contains("lol")) {
|
||||||
Commands.Lastlol = MaybeOfflinePlayer.AllPlayers.get(player
|
if (player != null) {
|
||||||
.getUniqueId());
|
Commands.Lastlol = player;
|
||||||
Commands.Lastlolornot = true;
|
Commands.Lastlolornot = true;
|
||||||
|
Commands.Lastlolconsole = false;
|
||||||
|
} else {
|
||||||
|
Commands.Lastlolornot = true;
|
||||||
|
Commands.Lastlolconsole = true;
|
||||||
|
Commands.Lastlol = null;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < PlayerListener.LaughStrings.length; i++) {
|
for (int i = 0; i < PlayerListener.LaughStrings.length; i++) {
|
||||||
if (msg.contains(PlayerListener.LaughStrings[i])) {
|
if (msg.contains(PlayerListener.LaughStrings[i])) {
|
||||||
Commands.Lastlol = MaybeOfflinePlayer.AllPlayers.get(player
|
if (player != null) {
|
||||||
.getUniqueId());
|
Commands.Lastlol = player;
|
||||||
Commands.Lastlolornot = false;
|
Commands.Lastlolornot = false;
|
||||||
|
Commands.Lastlolconsole = false;
|
||||||
|
} else {
|
||||||
|
Commands.Lastlolornot = false;
|
||||||
|
Commands.Lastlolconsole = true;
|
||||||
|
Commands.Lastlol = null;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,7 +76,7 @@ public class ChatProcessing {
|
||||||
: mp.CurrentChannel);
|
: mp.CurrentChannel);
|
||||||
|
|
||||||
String colormode = currentchannel.Color;
|
String colormode = currentchannel.Color;
|
||||||
if (mp.OtherColorMode.length() > 0)
|
if (mp != null && mp.OtherColorMode.length() > 0)
|
||||||
colormode = mp.OtherColorMode;
|
colormode = mp.OtherColorMode;
|
||||||
if (message.startsWith(">"))
|
if (message.startsWith(">"))
|
||||||
colormode = "green"; // If greentext, ignore channel or player
|
colormode = "green"; // If greentext, ignore channel or player
|
||||||
|
@ -99,11 +116,7 @@ public class ChatProcessing {
|
||||||
hadurls = true;
|
hadurls = true;
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
}
|
}
|
||||||
if (mp != null && mp.RainbowPresserColorMode) { // TODO:
|
if (mp != null && mp.RainbowPresserColorMode) {
|
||||||
// Rainbow
|
|
||||||
// mode
|
|
||||||
// for
|
|
||||||
// console
|
|
||||||
if (item.startsWith(RainbowPresserColors[rpc])) { // Prevent
|
if (item.startsWith(RainbowPresserColors[rpc])) { // Prevent
|
||||||
// words
|
// words
|
||||||
// being
|
// being
|
||||||
|
@ -196,16 +209,16 @@ public class ChatProcessing {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player != null
|
|
||||||
&& PlayerListener.essentials.getUser(player).isMuted())
|
|
||||||
return true;
|
|
||||||
|
|
||||||
StringBuilder json = new StringBuilder();
|
StringBuilder json = new StringBuilder();
|
||||||
json.append("[\"\",");
|
json.append("[\"\",");
|
||||||
json.append(String
|
json.append(String
|
||||||
.format("{\"text\":\"[%s]%s\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"Copy message\",\"color\":\"blue\"}},\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"%s\"}},",
|
.format("%s{\"text\":\"[%s]%s\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"Copy message\",\"color\":\"blue\"}},\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"%s\"}},",
|
||||||
currentchannel.DisplayName,
|
(mp != null && mp.ChatOnly ? "{\"text\":\"[C]\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Chat only\",\"color\":\"blue\"}]}}},"
|
||||||
(mp != null && !mp.RPMode ? "[OOC]" : ""), suggestmsg));
|
// (mp != null && mp.ChatOnly ?
|
||||||
|
// "{\"text:\":\"\"}," - I have been staring at
|
||||||
|
// this one line for hours... Hours...
|
||||||
|
: ""), currentchannel.DisplayName, (mp != null
|
||||||
|
&& !mp.RPMode ? "[OOC]" : ""), suggestmsg));
|
||||||
json.append("{\"text\":\" <\"},");
|
json.append("{\"text\":\" <\"},");
|
||||||
json.append(String.format("{\"text\":\"%s%s\",",
|
json.append(String.format("{\"text\":\"%s%s\",",
|
||||||
(player != null ? player.getDisplayName() : sender.getName()),
|
(player != null ? player.getDisplayName() : sender.getName()),
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
package tk.sznp.thebuttonautoflair;
|
package tk.sznp.thebuttonautoflair;
|
||||||
|
|
||||||
import me.steffansk1997.OreRegenerator.OreRegenerator;
|
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.command.BlockCommandSender;
|
import org.bukkit.command.BlockCommandSender;
|
||||||
|
@ -19,10 +18,6 @@ import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
import com.earth2me.essentials.Mob;
|
import com.earth2me.essentials.Mob;
|
||||||
import com.earth2me.essentials.Mob.MobException;
|
import com.earth2me.essentials.Mob.MobException;
|
||||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
|
||||||
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
|
||||||
import com.sk89q.worldguard.protection.flags.StateFlag;
|
|
||||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
|
||||||
|
|
||||||
import au.com.mineauz.minigames.MinigamePlayer;
|
import au.com.mineauz.minigames.MinigamePlayer;
|
||||||
import au.com.mineauz.minigames.Minigames;
|
import au.com.mineauz.minigames.Minigames;
|
||||||
|
@ -37,8 +32,9 @@ import java.util.Timer;
|
||||||
|
|
||||||
public class Commands implements CommandExecutor {
|
public class Commands implements CommandExecutor {
|
||||||
|
|
||||||
public static MaybeOfflinePlayer Lastlol = null;
|
public static Player Lastlol = null;
|
||||||
public static boolean Lastlolornot;
|
public static boolean Lastlolornot;
|
||||||
|
public static boolean Lastlolconsole;
|
||||||
|
|
||||||
// This method is called, when somebody uses our command
|
// This method is called, when somebody uses our command
|
||||||
@Override
|
@Override
|
||||||
|
@ -55,9 +51,9 @@ public class Commands implements CommandExecutor {
|
||||||
switch (args[0].toLowerCase()) {
|
switch (args[0].toLowerCase()) {
|
||||||
case "accept": {
|
case "accept": {
|
||||||
if (args.length < 2 && p.UserNames.size() > 1) {
|
if (args.length < 2 && p.UserNames.size() > 1) {
|
||||||
player.sendMessage("§9Multiple users commented your name. §bPlease pick one using /u accept <username>");
|
player.sendMessage("§9Multiple users commented your name. §bPlease pick one using /u accept <username>");
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("§6Usernames:");
|
sb.append("§6Usernames:");
|
||||||
for (String username : p.UserNames)
|
for (String username : p.UserNames)
|
||||||
sb.append(" ").append(username);
|
sb.append(" ").append(username);
|
||||||
player.sendMessage(sb.toString());
|
player.sendMessage(sb.toString());
|
||||||
|
@ -65,22 +61,22 @@ public class Commands implements CommandExecutor {
|
||||||
}
|
}
|
||||||
if (p.FlairState.equals(FlairStates.NoComment)
|
if (p.FlairState.equals(FlairStates.NoComment)
|
||||||
|| p.UserNames.size() == 0) {
|
|| p.UserNames.size() == 0) {
|
||||||
player.sendMessage("§cError: You need to write your username to the reddit thread at /r/TheButtonMinecraft§r");
|
player.sendMessage("§cError: You need to write your username to the reddit thread at /r/TheButtonMinecraft§r");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (args.length > 1 && !p.UserNames.contains(args[1])) {
|
if (args.length > 1 && !p.UserNames.contains(args[1])) {
|
||||||
player.sendMessage("§cError: Unknown name: " + args[1]
|
player.sendMessage("§cError: Unknown name: " + args[1]
|
||||||
+ "§r");
|
+ "§r");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (p.Working) {
|
if (p.Working) {
|
||||||
player.sendMessage("§cError: Something is already in progress.§r");
|
player.sendMessage("§cError: Something is already in progress.§r");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((args.length > 1 ? args[1] : p.UserNames.get(0))
|
if ((args.length > 1 ? args[1] : p.UserNames.get(0))
|
||||||
.equals(p.UserName)) {
|
.equals(p.UserName)) {
|
||||||
player.sendMessage("§cYou already have this user's flair.§r");
|
player.sendMessage("§cYou already have this user's flair.§r");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (args.length > 1)
|
if (args.length > 1)
|
||||||
|
@ -88,7 +84,7 @@ public class Commands implements CommandExecutor {
|
||||||
else
|
else
|
||||||
p.UserName = p.UserNames.get(0);
|
p.UserName = p.UserNames.get(0);
|
||||||
|
|
||||||
player.sendMessage("§bObtaining flair...");
|
player.sendMessage("§bObtaining flair...");
|
||||||
p.Working = true;
|
p.Working = true;
|
||||||
Timer timer = new Timer();
|
Timer timer = new Timer();
|
||||||
PlayerJoinTimerTask tt = new PlayerJoinTimerTask() {
|
PlayerJoinTimerTask tt = new PlayerJoinTimerTask() {
|
||||||
|
@ -113,7 +109,7 @@ public class Commands implements CommandExecutor {
|
||||||
String flair = mp.GetFormattedFlair();
|
String flair = mp.GetFormattedFlair();
|
||||||
mp.FlairState = FlairStates.Accepted;
|
mp.FlairState = FlairStates.Accepted;
|
||||||
PluginMain.ConfirmUserMessage(mp);
|
PluginMain.ConfirmUserMessage(mp);
|
||||||
player.sendMessage("§bYour flair has been set:§r "
|
player.sendMessage("§bYour flair has been set:§r "
|
||||||
+ flair);
|
+ flair);
|
||||||
mp.Working = false;
|
mp.Working = false;
|
||||||
}
|
}
|
||||||
|
@ -124,7 +120,7 @@ public class Commands implements CommandExecutor {
|
||||||
}
|
}
|
||||||
case "ignore": {
|
case "ignore": {
|
||||||
if (p.FlairState.equals(FlairStates.Accepted)) {
|
if (p.FlairState.equals(FlairStates.Accepted)) {
|
||||||
player.sendMessage("§cSorry, but ignoring the flair is no longer possible. As with the original Button, you can't undo what already happened.");
|
player.sendMessage("§cSorry, but ignoring the flair is no longer possible. As with the original Button, you can't undo what already happened.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (p.FlairState.equals(FlairStates.Commented)) {
|
if (p.FlairState.equals(FlairStates.Commented)) {
|
||||||
|
@ -135,9 +131,9 @@ public class Commands implements CommandExecutor {
|
||||||
p.FlairState = FlairStates.Ignored;
|
p.FlairState = FlairStates.Ignored;
|
||||||
p.SetFlairTime("");
|
p.SetFlairTime("");
|
||||||
p.UserName = "";
|
p.UserName = "";
|
||||||
player.sendMessage("§bYou have removed your flair. You can still use /u accept to get one.§r");
|
player.sendMessage("§bYou have removed your flair. You can still use /u accept to get one.§r");
|
||||||
} else
|
} else
|
||||||
player.sendMessage("§cYou already removed your flair.§r");
|
player.sendMessage("§cYou already removed your flair.§r");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "admin": // 2015.08.09.
|
case "admin": // 2015.08.09.
|
||||||
|
@ -154,16 +150,16 @@ public class Commands implements CommandExecutor {
|
||||||
break;
|
break;
|
||||||
case "name": {
|
case "name": {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
player.sendMessage("§cUsage: /u name <playername>§r");
|
player.sendMessage("§cUsage: /u name <playername>§r");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
MaybeOfflinePlayer mp = MaybeOfflinePlayer
|
MaybeOfflinePlayer mp = MaybeOfflinePlayer
|
||||||
.GetFromName(args[1]);
|
.GetFromName(args[1]);
|
||||||
if (mp == null) {
|
if (mp == null) {
|
||||||
player.sendMessage("§cUnknown user: " + args[1]);
|
player.sendMessage("§cUnknown user: " + args[1]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
player.sendMessage("§bUsername of " + args[1] + ": "
|
player.sendMessage("§bUsername of " + args[1] + ": "
|
||||||
+ mp.UserName);
|
+ mp.UserName);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -190,11 +186,11 @@ public class Commands implements CommandExecutor {
|
||||||
p.RainbowPresserColorMode = !p.RainbowPresserColorMode;
|
p.RainbowPresserColorMode = !p.RainbowPresserColorMode;
|
||||||
p.OtherColorMode = "";
|
p.OtherColorMode = "";
|
||||||
if (p.RainbowPresserColorMode)
|
if (p.RainbowPresserColorMode)
|
||||||
player.sendMessage("§eRainbow colors §aenabled.");
|
player.sendMessage("§eRainbow colors §aenabled.");
|
||||||
else
|
else
|
||||||
player.sendMessage("§eRainbow colors §cdisabled.");
|
player.sendMessage("§eRainbow colors §cdisabled.");
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage("§cYou don't have permission for this command. Donate to get it!");
|
player.sendMessage("§cYou don't have permission for this command. Donate to get it!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -203,12 +199,12 @@ public class Commands implements CommandExecutor {
|
||||||
p.OtherColorMode = args[1];
|
p.OtherColorMode = args[1];
|
||||||
if (p.OtherColorMode.length() > 0)
|
if (p.OtherColorMode.length() > 0)
|
||||||
player.sendMessage(String.format(
|
player.sendMessage(String.format(
|
||||||
"§eMessage color set to %s",
|
"§eMessage color set to %s",
|
||||||
p.OtherColorMode));
|
p.OtherColorMode));
|
||||||
else
|
else
|
||||||
player.sendMessage("§eMessage color reset.");
|
player.sendMessage("§eMessage color reset.");
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage("§cYou don't have permission for this command.");
|
player.sendMessage("§cYou don't have permission for this command.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -234,31 +230,44 @@ public class Commands implements CommandExecutor {
|
||||||
}
|
}
|
||||||
case "unlaugh":
|
case "unlaugh":
|
||||||
case "unlol": {
|
case "unlol": {
|
||||||
Player p = null;
|
if (Lastlol != null) {
|
||||||
if (Lastlol != null
|
Lastlol.addPotionEffect(new PotionEffect(
|
||||||
&& (p = Bukkit.getPlayer(Lastlol.UUID)) != null) {
|
|
||||||
p.addPotionEffect(new PotionEffect(
|
|
||||||
PotionEffectType.BLINDNESS, 10 * 20, 5, false,
|
PotionEffectType.BLINDNESS, 10 * 20, 5, false,
|
||||||
false));
|
false));
|
||||||
for (Player pl : PluginMain.GetPlayers())
|
for (Player pl : PluginMain.GetPlayers())
|
||||||
pl.sendMessage(player.getDisplayName()
|
pl.sendMessage(player.getDisplayName()
|
||||||
+ (Lastlolornot ? " unlolled " : " unlaughed ")
|
+ (Lastlolornot ? " unlolled " : " unlaughed ")
|
||||||
+ p.getDisplayName());
|
+ Lastlol.getDisplayName());
|
||||||
Bukkit.getServer()
|
Bukkit.getServer()
|
||||||
.getConsoleSender()
|
.getConsoleSender()
|
||||||
.sendMessage(
|
.sendMessage(
|
||||||
player.getDisplayName()
|
player.getDisplayName()
|
||||||
+ (Lastlolornot ? " unlolled "
|
+ (Lastlolornot ? " unlolled "
|
||||||
: " unlaughed ")
|
: " unlaughed ")
|
||||||
+ p.getDisplayName());
|
+ Lastlol.getDisplayName());
|
||||||
Lastlol = null;
|
Lastlol = null;
|
||||||
|
} else if (Lastlolconsole) {
|
||||||
|
for (Player pl : PluginMain.GetPlayers())
|
||||||
|
pl.sendMessage(player.getDisplayName()
|
||||||
|
+ (Lastlolornot ? " unlolled " : " unlaughed ")
|
||||||
|
+ Bukkit.getServer().getConsoleSender()
|
||||||
|
.getName());
|
||||||
|
Bukkit.getServer()
|
||||||
|
.getConsoleSender()
|
||||||
|
.sendMessage(
|
||||||
|
player.getDisplayName()
|
||||||
|
+ (Lastlolornot ? " unlolled "
|
||||||
|
: " unlaughed ")
|
||||||
|
+ Bukkit.getServer()
|
||||||
|
.getConsoleSender()
|
||||||
|
.getName());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "yeehaw": {
|
case "yeehaw": {
|
||||||
for (Player p : PluginMain.GetPlayers()) {
|
for (Player p : PluginMain.GetPlayers()) {
|
||||||
p.playSound(p.getLocation(), "tbmc.yeehaw", 1f, 1f);
|
p.playSound(p.getLocation(), "tbmc.yeehaw", 1f, 1f);
|
||||||
p.sendMessage("§b* " + p.getDisplayName() + " YEEHAWs.");
|
p.sendMessage("§b* " + p.getDisplayName() + " YEEHAWs.");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -266,25 +275,28 @@ public class Commands implements CommandExecutor {
|
||||||
DoMWiki(player, args);
|
DoMWiki(player, args);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "warmode": {
|
case "tableflip": {
|
||||||
ApplicableRegionSet ars = ((WorldGuardPlugin) Bukkit
|
String msg = "(╯°□°)╯︵ ┻━┻";
|
||||||
.getPluginManager().getPlugin("WorldGuard"))
|
if (args.length > 0) {
|
||||||
.getRegionManager(player.getWorld())
|
msg = args[0] + " " + msg;
|
||||||
.getApplicableRegions(player.getLocation());
|
|
||||||
for (ProtectedRegion pr : ars) {
|
|
||||||
if (pr.getFlag(OreRegenerator.FLAG_REGENORES) == StateFlag.State.ALLOW) {
|
|
||||||
pr.setFlag(OreRegenerator.FLAG_REGENORES,
|
|
||||||
StateFlag.State.DENY);
|
|
||||||
sender.sendMessage("§eWarmode §cdisabled §ein "
|
|
||||||
+ pr.getId());
|
|
||||||
} else {
|
|
||||||
pr.setFlag(OreRegenerator.FLAG_REGENORES,
|
|
||||||
StateFlag.State.ALLOW);
|
|
||||||
sender.sendMessage("§eWarmode §aenabled §ein "
|
|
||||||
+ pr.getId());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
player.chat(msg);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
case "unflip": {
|
||||||
|
String msg = "┬─┬ ノ( ゜-゜ノ)";
|
||||||
|
if (args.length > 0) {
|
||||||
|
msg = args[0] + "" + msg;
|
||||||
|
}
|
||||||
|
player.chat(msg);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
case "chatonly": {
|
||||||
|
MaybeOfflinePlayer p = MaybeOfflinePlayer.AllPlayers.get(player
|
||||||
|
.getUniqueId());
|
||||||
|
p.ChatOnly = true;
|
||||||
|
player.setGameMode(GameMode.SPECTATOR);
|
||||||
|
player.sendMessage("§bChat-only mode enabled. You are now invincible.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -305,17 +317,15 @@ public class Commands implements CommandExecutor {
|
||||||
switch (cmd.getName()) {
|
switch (cmd.getName()) {
|
||||||
case "unlaugh":
|
case "unlaugh":
|
||||||
case "unlol": {
|
case "unlol": {
|
||||||
Player p = null;
|
if (Lastlol != null) {
|
||||||
if (Lastlol != null
|
Lastlol.addPotionEffect(new PotionEffect(
|
||||||
&& (p = Bukkit.getPlayer(Lastlol.UUID)) != null) {
|
|
||||||
p.addPotionEffect(new PotionEffect(
|
|
||||||
PotionEffectType.BLINDNESS, 10 * 20, 5, false,
|
PotionEffectType.BLINDNESS, 10 * 20, 5, false,
|
||||||
false));
|
false));
|
||||||
for (Player pl : PluginMain.GetPlayers())
|
for (Player pl : PluginMain.GetPlayers())
|
||||||
pl.sendMessage(Bukkit.getServer().getConsoleSender()
|
pl.sendMessage(Bukkit.getServer().getConsoleSender()
|
||||||
.getName()
|
.getName()
|
||||||
+ (Lastlolornot ? " unlolled " : " unlaughed ")
|
+ (Lastlolornot ? " unlolled " : " unlaughed ")
|
||||||
+ p.getDisplayName());
|
+ Lastlol.getDisplayName());
|
||||||
Bukkit.getServer()
|
Bukkit.getServer()
|
||||||
.getConsoleSender()
|
.getConsoleSender()
|
||||||
.sendMessage(
|
.sendMessage(
|
||||||
|
@ -323,7 +333,7 @@ public class Commands implements CommandExecutor {
|
||||||
.getName()
|
.getName()
|
||||||
+ (Lastlolornot ? " unlolled "
|
+ (Lastlolornot ? " unlolled "
|
||||||
: " unlaughed ")
|
: " unlaughed ")
|
||||||
+ p.getDisplayName());
|
+ Lastlol.getDisplayName());
|
||||||
Lastlol = null;
|
Lastlol = null;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -336,7 +346,7 @@ public class Commands implements CommandExecutor {
|
||||||
private static void DoReload(Player player) {
|
private static void DoReload(Player player) {
|
||||||
try {
|
try {
|
||||||
PluginMain.Console
|
PluginMain.Console
|
||||||
.sendMessage("§6-- Reloading The Button Minecraft plugin...§r");
|
.sendMessage("§6-- Reloading The Button Minecraft plugin...§r");
|
||||||
PluginMain.LoadFiles(true); // 2015.08.09.
|
PluginMain.LoadFiles(true); // 2015.08.09.
|
||||||
for (Player p : PluginMain.GetPlayers()) {
|
for (Player p : PluginMain.GetPlayers()) {
|
||||||
MaybeOfflinePlayer mp = MaybeOfflinePlayer.AddPlayerIfNeeded(p
|
MaybeOfflinePlayer mp = MaybeOfflinePlayer.AddPlayerIfNeeded(p
|
||||||
|
@ -345,21 +355,21 @@ public class Commands implements CommandExecutor {
|
||||||
|| mp.FlairState.equals(FlairStates.Commented)) {
|
|| mp.FlairState.equals(FlairStates.Commented)) {
|
||||||
PluginMain.ConfirmUserMessage(mp);
|
PluginMain.ConfirmUserMessage(mp);
|
||||||
}
|
}
|
||||||
String msg = "§bNote: The auto-flair plugin has been reloaded. You might need to wait 10s to have your flair.§r"; // 2015.08.09.
|
String msg = "§bNote: The auto-flair plugin has been reloaded. You might need to wait 10s to have your flair.§r"; // 2015.08.09.
|
||||||
p.sendMessage(msg); // 2015.08.09.
|
p.sendMessage(msg); // 2015.08.09.
|
||||||
}
|
}
|
||||||
PluginMain.Console.sendMessage("§6-- Reloading done!§r");
|
PluginMain.Console.sendMessage("§6-- Reloading done!§r");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("Error!\n" + e);
|
System.out.println("Error!\n" + e);
|
||||||
if (player != null)
|
if (player != null)
|
||||||
player.sendMessage("§cAn error occured. See console for details.§r");
|
player.sendMessage("§cAn error occured. See console for details.§r");
|
||||||
PluginMain.LastException = e; // 2015.08.09.
|
PluginMain.LastException = e; // 2015.08.09.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Player ReloadPlayer; // 2015.08.09.
|
private static Player ReloadPlayer; // 2015.08.09.
|
||||||
|
|
||||||
private static String DoAdminUsage = "§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin|togglerpshow|toggledebug|savepos|loadpos§r";
|
private static String DoAdminUsage = "§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin|togglerpshow|toggledebug|savepos|loadpos§r";
|
||||||
|
|
||||||
private static void DoAdmin(Player player, String[] args) {
|
private static void DoAdmin(Player player, String[] args) {
|
||||||
if (player == null || PluginMain.permission.has(player, "tbmc.admin")) {
|
if (player == null || PluginMain.permission.has(player, "tbmc.admin")) {
|
||||||
|
@ -374,7 +384,7 @@ public class Commands implements CommandExecutor {
|
||||||
ReloadPlayer = player; // 2015.08.09.
|
ReloadPlayer = player; // 2015.08.09.
|
||||||
SendMessage(
|
SendMessage(
|
||||||
player,
|
player,
|
||||||
"§bMake sure to save the current settings before you modify and reload them! Type /u admin confirm when done.§r");
|
"§bMake sure to save the current settings before you modify and reload them! Type /u admin confirm when done.§r");
|
||||||
break;
|
break;
|
||||||
case "playerinfo":
|
case "playerinfo":
|
||||||
DoPlayerInfo(player, args);
|
DoPlayerInfo(player, args);
|
||||||
|
@ -387,12 +397,12 @@ public class Commands implements CommandExecutor {
|
||||||
DoReload(player); // 2015.08.09.
|
DoReload(player); // 2015.08.09.
|
||||||
else
|
else
|
||||||
SendMessage(player,
|
SendMessage(player,
|
||||||
"§cYou need to do /u admin reload first.§r");
|
"§cYou need to do /u admin reload first.§r");
|
||||||
break;
|
break;
|
||||||
case "save":
|
case "save":
|
||||||
PluginMain.SaveFiles(); // 2015.08.09.
|
PluginMain.SaveFiles(); // 2015.08.09.
|
||||||
SendMessage(player,
|
SendMessage(player,
|
||||||
"§bSaved files. Now you can edit them and reload if you want.§r");
|
"§bSaved files. Now you can edit them and reload if you want.§r");
|
||||||
break;
|
break;
|
||||||
case "setflair":
|
case "setflair":
|
||||||
DoSetFlair(player, args);
|
DoSetFlair(player, args);
|
||||||
|
@ -423,19 +433,19 @@ public class Commands implements CommandExecutor {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
player.sendMessage("§cYou don't have permission to use this command.§r");
|
player.sendMessage("§cYou don't have permission to use this command.§r");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void DoPlayerInfo(Player player, String[] args) { // 2015.08.09.
|
private static void DoPlayerInfo(Player player, String[] args) { // 2015.08.09.
|
||||||
// args[0] is "admin" - args[1] is "playerinfo"
|
// args[0] is "admin" - args[1] is "playerinfo"
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
String message = "§cUsage: /u admin playerinfo <player>§r";
|
String message = "§cUsage: /u admin playerinfo <player>§r";
|
||||||
SendMessage(player, message);
|
SendMessage(player, message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MaybeOfflinePlayer p = MaybeOfflinePlayer.GetFromName(args[2]);
|
MaybeOfflinePlayer p = MaybeOfflinePlayer.GetFromName(args[2]);
|
||||||
if (p == null) {
|
if (p == null) {
|
||||||
String message = "§cPlayer not found: " + args[2] + "§r";
|
String message = "§cPlayer not found: " + args[2] + "§r";
|
||||||
SendMessage(player, message);
|
SendMessage(player, message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -444,7 +454,7 @@ public class Commands implements CommandExecutor {
|
||||||
SendMessage(player, "Username: " + p.UserName);
|
SendMessage(player, "Username: " + p.UserName);
|
||||||
SendMessage(player, "Flair state: " + p.FlairState);
|
SendMessage(player, "Flair state: " + p.FlairState);
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("§6Usernames:");
|
sb.append("§6Usernames:");
|
||||||
for (String username : p.UserNames)
|
for (String username : p.UserNames)
|
||||||
sb.append(" ").append(username);
|
sb.append(" ").append(username);
|
||||||
SendMessage(player, sb.toString());
|
SendMessage(player, sb.toString());
|
||||||
|
@ -474,15 +484,15 @@ public class Commands implements CommandExecutor {
|
||||||
targetplayer.FlairState = FlairStates.Accepted;
|
targetplayer.FlairState = FlairStates.Accepted;
|
||||||
targetplayer.UserName = "";
|
targetplayer.UserName = "";
|
||||||
SendMessage(player,
|
SendMessage(player,
|
||||||
"§bThe flair has been set. Player: "
|
"§bThe flair has been set. Player: "
|
||||||
+ targetplayer.PlayerName + " Flair: "
|
+ targetplayer.PlayerName + " Flair: "
|
||||||
+ targetplayer.GetFormattedFlair() + "§r");
|
+ targetplayer.GetFormattedFlair() + "§r");
|
||||||
} else {
|
} else {
|
||||||
SendMessage(
|
SendMessage(
|
||||||
player,
|
player,
|
||||||
"§cSorry, but you can't change an existing flair. (Use -- as time to set non-presser or can't press)");
|
"§cSorry, but you can't change an existing flair. (Use -- as time to set non-presser or can't press)");
|
||||||
SendMessage(Bukkit.getPlayer(targetplayer.UUID),
|
SendMessage(Bukkit.getPlayer(targetplayer.UUID),
|
||||||
"§cYour flair cannot be changed.");
|
"§cYour flair cannot be changed.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -490,12 +500,12 @@ public class Commands implements CommandExecutor {
|
||||||
// args[0] is "admin" - args[1] is "setflair"
|
// args[0] is "admin" - args[1] is "setflair"
|
||||||
if (args.length < 4) {
|
if (args.length < 4) {
|
||||||
SendMessage(player,
|
SendMessage(player,
|
||||||
"§cUsage: /u admin setflair <playername> <flaircolor> [number]");
|
"§cUsage: /u admin setflair <playername> <flaircolor> [number]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Player p = Bukkit.getPlayer(args[2]);
|
Player p = Bukkit.getPlayer(args[2]);
|
||||||
if (p == null) {
|
if (p == null) {
|
||||||
SendMessage(player, "§cPLayer not found.&r");
|
SendMessage(player, "§cPLayer not found.&r");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
short flaircolor = 0x00;
|
short flaircolor = 0x00;
|
||||||
|
@ -503,7 +513,7 @@ public class Commands implements CommandExecutor {
|
||||||
flaircolor = Short.parseShort(args[3], 16);
|
flaircolor = Short.parseShort(args[3], 16);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
SendMessage(player,
|
SendMessage(player,
|
||||||
"§cFlaircolor must be a hexadecimal number (don't include &).");
|
"§cFlaircolor must be a hexadecimal number (don't include &).");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SetPlayerFlair(player,
|
SetPlayerFlair(player,
|
||||||
|
@ -535,14 +545,14 @@ public class Commands implements CommandExecutor {
|
||||||
if (player == null || player.isOp()
|
if (player == null || player.isOp()
|
||||||
|| player.getName().equals("NorbiPeti")) {
|
|| player.getName().equals("NorbiPeti")) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
String message = "§cUsage: /u announce add|remove|settime|list|edit§r";
|
String message = "§cUsage: /u announce add|remove|settime|list|edit§r";
|
||||||
SendMessage(player, message);
|
SendMessage(player, message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
switch (args[1].toLowerCase()) {
|
switch (args[1].toLowerCase()) {
|
||||||
case "add":
|
case "add":
|
||||||
if (args.length < 3) {
|
if (args.length < 3) {
|
||||||
SendMessage(player, "§cUsage: /u announce add <message>");
|
SendMessage(player, "§cUsage: /u announce add <message>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
@ -551,13 +561,13 @@ public class Commands implements CommandExecutor {
|
||||||
if (i != args.length - 1)
|
if (i != args.length - 1)
|
||||||
sb.append(" ");
|
sb.append(" ");
|
||||||
}
|
}
|
||||||
String finalmessage = sb.toString().replace('&', '§');
|
String finalmessage = sb.toString().replace('&', '§');
|
||||||
PluginMain.AnnounceMessages.add(finalmessage);
|
PluginMain.AnnounceMessages.add(finalmessage);
|
||||||
SendMessage(player, "§bAnnouncement added.§r");
|
SendMessage(player, "§bAnnouncement added.§r");
|
||||||
break;
|
break;
|
||||||
case "remove":
|
case "remove":
|
||||||
if (args.length < 3) {
|
if (args.length < 3) {
|
||||||
SendMessage(player, "§cUsage: /u announce remove <index>");
|
SendMessage(player, "§cUsage: /u announce remove <index>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PluginMain.AnnounceMessages.remove(Integer.parseInt(args[2]));
|
PluginMain.AnnounceMessages.remove(Integer.parseInt(args[2]));
|
||||||
|
@ -565,33 +575,33 @@ public class Commands implements CommandExecutor {
|
||||||
case "settime":
|
case "settime":
|
||||||
if (args.length < 3) {
|
if (args.length < 3) {
|
||||||
SendMessage(player,
|
SendMessage(player,
|
||||||
"§cUsage: /u announce settime <minutes>");
|
"§cUsage: /u announce settime <minutes>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PluginMain.AnnounceTime = Integer.parseInt(args[2]) * 60 * 1000;
|
PluginMain.AnnounceTime = Integer.parseInt(args[2]) * 60 * 1000;
|
||||||
SendMessage(player, "Time set between announce messages");
|
SendMessage(player, "Time set between announce messages");
|
||||||
break;
|
break;
|
||||||
case "list":
|
case "list":
|
||||||
SendMessage(player, "§bList of announce messages:§r");
|
SendMessage(player, "§bList of announce messages:§r");
|
||||||
SendMessage(player, "§bFormat: [index] message§r");
|
SendMessage(player, "§bFormat: [index] message§r");
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (String message : PluginMain.AnnounceMessages)
|
for (String message : PluginMain.AnnounceMessages)
|
||||||
SendMessage(player, "[" + i++ + "] " + message);
|
SendMessage(player, "[" + i++ + "] " + message);
|
||||||
SendMessage(player,
|
SendMessage(player,
|
||||||
"§bCurrent wait time between announcements: "
|
"§bCurrent wait time between announcements: "
|
||||||
+ PluginMain.AnnounceTime / 60 / 1000
|
+ PluginMain.AnnounceTime / 60 / 1000
|
||||||
+ " minute(s)§r");
|
+ " minute(s)§r");
|
||||||
break;
|
break;
|
||||||
case "edit":
|
case "edit":
|
||||||
if (commandblock == null) {
|
if (commandblock == null) {
|
||||||
SendMessage(
|
SendMessage(
|
||||||
player,
|
player,
|
||||||
"§cError: This command can only be used from a command block. Use /u announce remove.");
|
"§cError: This command can only be used from a command block. Use /u announce remove.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (args.length < 4) {
|
if (args.length < 4) {
|
||||||
commandblock
|
commandblock
|
||||||
.sendMessage("§cUsage: /u announce edit <index> <message>");
|
.sendMessage("§cUsage: /u announce edit <index> <message>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
StringBuilder sb1 = new StringBuilder();
|
StringBuilder sb1 = new StringBuilder();
|
||||||
|
@ -600,7 +610,7 @@ public class Commands implements CommandExecutor {
|
||||||
if (i1 != args.length - 1)
|
if (i1 != args.length - 1)
|
||||||
sb1.append(" ");
|
sb1.append(" ");
|
||||||
}
|
}
|
||||||
String finalmessage1 = sb1.toString().replace('&', '§');
|
String finalmessage1 = sb1.toString().replace('&', '§');
|
||||||
int index = Integer.parseInt(args[2]);
|
int index = Integer.parseInt(args[2]);
|
||||||
if (index > 100)
|
if (index > 100)
|
||||||
break;
|
break;
|
||||||
|
@ -611,7 +621,7 @@ public class Commands implements CommandExecutor {
|
||||||
commandblock.sendMessage("Announcement edited.");
|
commandblock.sendMessage("Announcement edited.");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
String message = "§cUsage: /u announce add|remove|settime|list|edit§r";
|
String message = "§cUsage: /u announce add|remove|settime|list|edit§r";
|
||||||
SendMessage(player, message);
|
SendMessage(player, message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -622,7 +632,7 @@ public class Commands implements CommandExecutor {
|
||||||
private static void DoSaveLoadPos(Player player, String[] args) { // 2015.08.09.
|
private static void DoSaveLoadPos(Player player, String[] args) { // 2015.08.09.
|
||||||
// args[0] is "admin" - args[1] is "savepos|loadpos"
|
// args[0] is "admin" - args[1] is "savepos|loadpos"
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
String message = "§cUsage: /u admin savepos|loadpos <player>§r";
|
String message = "§cUsage: /u admin savepos|loadpos <player>§r";
|
||||||
SendMessage(player, message);
|
SendMessage(player, message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -632,14 +642,14 @@ public class Commands implements CommandExecutor {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
if (!MaybeOfflinePlayer.AllPlayers.containsKey(p.getUniqueId())) {
|
if (!MaybeOfflinePlayer.AllPlayers.containsKey(p.getUniqueId())) {
|
||||||
String message = "§cPlayer not found: " + args[2] + "§r";
|
String message = "§cPlayer not found: " + args[2] + "§r";
|
||||||
SendMessage(player, message);
|
SendMessage(player, message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(p
|
MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(p
|
||||||
.getUniqueId());
|
.getUniqueId());
|
||||||
if (p == null) {
|
if (p == null) {
|
||||||
String message = "§cPlayer is not online: " + args[2] + "§r";
|
String message = "§cPlayer is not online: " + args[2] + "§r";
|
||||||
SendMessage(player, message);
|
SendMessage(player, message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -649,7 +659,7 @@ public class Commands implements CommandExecutor {
|
||||||
if (mp.SavedLocation != null)
|
if (mp.SavedLocation != null)
|
||||||
p.teleport(mp.SavedLocation);
|
p.teleport(mp.SavedLocation);
|
||||||
} else {
|
} else {
|
||||||
String message = "§cUsage: /u admin savepos|loadpos <player>§r";
|
String message = "§cUsage: /u admin savepos|loadpos <player>§r";
|
||||||
SendMessage(player, message);
|
SendMessage(player, message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -660,7 +670,7 @@ public class Commands implements CommandExecutor {
|
||||||
private static void DoUpdateDynmap(Player player, String[] args) {
|
private static void DoUpdateDynmap(Player player, String[] args) {
|
||||||
// args[0] is "admin" - args[1] is "updatedynmap"
|
// args[0] is "admin" - args[1] is "updatedynmap"
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
String message = "§cUsage: /u admin updatedynmap <password>§r";
|
String message = "§cUsage: /u admin updatedynmap <password>§r";
|
||||||
SendMessage(player, message);
|
SendMessage(player, message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -673,14 +683,14 @@ public class Commands implements CommandExecutor {
|
||||||
private static void DoKittyCannon(Player player, String[] args) {
|
private static void DoKittyCannon(Player player, String[] args) {
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
SendMessage(player,
|
SendMessage(player,
|
||||||
"§cThis command can only be used by a player.§r");
|
"§cThis command can only be used by a player.§r");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MinigamePlayer mp = Minigames.plugin.pdata.getMinigamePlayer(player);
|
MinigamePlayer mp = Minigames.plugin.pdata.getMinigamePlayer(player);
|
||||||
if (!(mp.isInMinigame() && mp.getMinigame().getName(false)
|
if (!(mp.isInMinigame() && mp.getMinigame().getName(false)
|
||||||
.equalsIgnoreCase(Commands.KittyCannonMinigame))) {
|
.equalsIgnoreCase(Commands.KittyCannonMinigame))) {
|
||||||
SendMessage(player,
|
SendMessage(player,
|
||||||
"§cYou can only use KittyCannon in it's minigame!");
|
"§cYou can only use KittyCannon in it's minigame!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -711,7 +721,7 @@ public class Commands implements CommandExecutor {
|
||||||
final ItemStack head = new ItemStack(
|
final ItemStack head = new ItemStack(
|
||||||
Material.SKULL_ITEM, 1, (short) 3, (byte) 3);
|
Material.SKULL_ITEM, 1, (short) 3, (byte) 3);
|
||||||
SkullMeta im = (SkullMeta) head.getItemMeta();
|
SkullMeta im = (SkullMeta) head.getItemMeta();
|
||||||
im.setDisplayName("§rOcelot Head");
|
im.setDisplayName("§rOcelot Head");
|
||||||
im.setOwner("MHF_Ocelot");
|
im.setOwner("MHF_Ocelot");
|
||||||
im.setLore(lore);
|
im.setLore(lore);
|
||||||
head.setItemMeta(im);
|
head.setItemMeta(im);
|
||||||
|
@ -729,10 +739,10 @@ public class Commands implements CommandExecutor {
|
||||||
query = query.trim();
|
query = query.trim();
|
||||||
if (args.length == 0)
|
if (args.length == 0)
|
||||||
SendMessage(player,
|
SendMessage(player,
|
||||||
"§bMinecraft Wiki link: http://minecraft.gamepedia.com/");
|
"§bMinecraft Wiki link: http://minecraft.gamepedia.com/");
|
||||||
else
|
else
|
||||||
SendMessage(player,
|
SendMessage(player,
|
||||||
"§bMinecraft Wiki link: http://minecraft.gamepedia.com/index.php?search="
|
"§bMinecraft Wiki link: http://minecraft.gamepedia.com/index.php?search="
|
||||||
+ query + "&title=Special%3ASearch&go=Go");
|
+ query + "&title=Special%3ASearch&go=Go");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ public class MaybeOfflinePlayer {
|
||||||
public int FDeaths;
|
public int FDeaths;
|
||||||
public boolean RainbowPresserColorMode = false;
|
public boolean RainbowPresserColorMode = false;
|
||||||
public String OtherColorMode = "";
|
public String OtherColorMode = "";
|
||||||
|
public boolean ChatOnly = false;
|
||||||
|
|
||||||
public UUID UUID;
|
public UUID UUID;
|
||||||
|
|
||||||
|
@ -132,4 +133,8 @@ public class MaybeOfflinePlayer {
|
||||||
public String GetFlairTime() {
|
public String GetFlairTime() {
|
||||||
return FlairTime;
|
return FlairTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static MaybeOfflinePlayer GetFromPlayer(Player p) {
|
||||||
|
return MaybeOfflinePlayer.AllPlayers.get(p.getUniqueId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,9 @@ import java.util.TimerTask;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import com.palmergames.bukkit.towny.Towny;
|
import com.palmergames.bukkit.towny.Towny;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
@ -150,30 +152,31 @@ public class PlayerListener implements Listener {
|
||||||
"authme.player.*");
|
"authme.player.*");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ispremium)
|
if (ispremium) {
|
||||||
{
|
Bukkit.getScheduler().runTaskLater(PluginMain.Instance,
|
||||||
Bukkit.getScheduler().runTaskLater(PluginMain.Instance, new Runnable(){
|
new Runnable() {
|
||||||
public void run()
|
public void run() {
|
||||||
{
|
AuthMe.getInstance().api.forceLogout(p);
|
||||||
AuthMe.getInstance().api.forceLogout(p);
|
}
|
||||||
}
|
}, 100);
|
||||||
}, 100);
|
Bukkit.getScheduler().runTaskLater(PluginMain.Instance,
|
||||||
Bukkit.getScheduler().runTaskLater(PluginMain.Instance, new Runnable(){
|
new Runnable() {
|
||||||
public void run()
|
public void run() {
|
||||||
{
|
AuthMe.getInstance().api.forceLogin(p);
|
||||||
AuthMe.getInstance().api.forceLogin(p);
|
}
|
||||||
}
|
}, 120);
|
||||||
}, 120);
|
} else if (!mp.FlairState.equals(FlairStates.Accepted)
|
||||||
|
&& !mp.FlairState.equals(FlairStates.Commented)) {
|
||||||
|
String json = String
|
||||||
|
.format("[\"\",{\"text\":\"Welcome! You appear to log in from a non-premium account. Please verify your /r/thebutton flair to play, \",\"color\":\"aqua\"},{\"text\":\"[here].\",\"color\":\"aqua\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"%s\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread\",\"color\":\"aqua\"}]}}}]",
|
||||||
|
PluginMain.FlairThreadURL);
|
||||||
|
PluginMain.Instance.getServer().dispatchCommand(PluginMain.Console,
|
||||||
|
"tellraw " + mp.PlayerName + " " + json);
|
||||||
}
|
}
|
||||||
else if(!mp.FlairState.equals(FlairStates.Accepted) && !mp.FlairState
|
|
||||||
.equals(FlairStates.Commented))
|
if (mp.ChatOnly) {
|
||||||
{
|
mp.ChatOnly = false;
|
||||||
String json = String
|
p.setGameMode(GameMode.SURVIVAL);
|
||||||
.format("[\"\",{\"text\":\"Welcome! You appear to log in from a non-premium account. Please verify your /r/thebutton flair to play, \",\"color\":\"aqua\"},{\"text\":\"[here].\",\"color\":\"aqua\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"%s\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread\",\"color\":\"aqua\"}]}}}]",
|
|
||||||
PluginMain.FlairThreadURL);
|
|
||||||
PluginMain.Instance.getServer().dispatchCommand(
|
|
||||||
PluginMain.Console,
|
|
||||||
"tellraw " + mp.PlayerName + " " + json);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,19 +405,19 @@ public class PlayerListener implements Listener {
|
||||||
|| cmd.equalsIgnoreCase("tp")) {
|
|| cmd.equalsIgnoreCase("tp")) {
|
||||||
MinigamePlayer mgp = Minigames.plugin.pdata.getMinigamePlayer(event
|
MinigamePlayer mgp = Minigames.plugin.pdata.getMinigamePlayer(event
|
||||||
.getPlayer());
|
.getPlayer());
|
||||||
String currentWorld = event.getPlayer().getLocation().getWorld().getName();
|
String currentWorld = event.getPlayer().getLocation().getWorld()
|
||||||
|
.getName();
|
||||||
Location currentLocation = event.getPlayer().getLocation();
|
Location currentLocation = event.getPlayer().getLocation();
|
||||||
TownyUniverse universe = Towny.getPlugin(Towny.class).getTownyUniverse();
|
TownyUniverse universe = Towny.getPlugin(Towny.class)
|
||||||
|
.getTownyUniverse();
|
||||||
if (mgp.isInMinigame()
|
if (mgp.isInMinigame()
|
||||||
&& mgp.getMinigame().getMechanic().getMechanic()
|
&& mgp.getMinigame().getMechanic().getMechanic()
|
||||||
.equals("creativeglobal")) {
|
.equals("creativeglobal")) {
|
||||||
mgp.setAllowTeleport(true);
|
mgp.setAllowTeleport(true);
|
||||||
}
|
} else if (TownyUniverse.isWarTime()) {
|
||||||
else if (TownyUniverse.isWarTime())
|
|
||||||
{
|
|
||||||
War war = universe.getWarEvent();
|
War war = universe.getWarEvent();
|
||||||
if (war.isWarZone(new WorldCoord(currentWorld, currentLocation.getBlockX(), currentLocation.getBlockZ())))
|
if (war.isWarZone(new WorldCoord(currentWorld, currentLocation
|
||||||
{
|
.getBlockX(), currentLocation.getBlockZ()))) {
|
||||||
event.getPlayer().sendMessage(
|
event.getPlayer().sendMessage(
|
||||||
"§cError: You can't teleport out of a war zone!");
|
"§cError: You can't teleport out of a war zone!");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
@ -590,9 +593,7 @@ public class PlayerListener implements Listener {
|
||||||
e.getPlayer().damage(1f * item.getAmount(),
|
e.getPlayer().damage(1f * item.getAmount(),
|
||||||
Bukkit.getPlayer(meta.getLore().get(0)));
|
Bukkit.getPlayer(meta.getLore().get(0)));
|
||||||
e.getItem().remove();
|
e.getItem().remove();
|
||||||
// System.out.println("G");
|
e.setCancelled(true);
|
||||||
e.setCancelled(true); // TODO: /tableflip /unflip with spam detection
|
|
||||||
// System.out.println("H");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -611,18 +612,6 @@ public class PlayerListener implements Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @EventHandler public void onPlayerLogin(PlayerLoginEvent e) {
|
|
||||||
* System.out.println("Result:" + e.getResult());
|
|
||||||
* System.out.println("Kick message: " + e.getKickMessage()); }
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @EventHandler public void onPlayerPreLogin(AsyncPlayerPreLoginEvent e) {
|
|
||||||
* System.out.println("Pre - LoginResult:" + e.getLoginResult());
|
|
||||||
* System.out.println("Pre - Kick message: " + e.getKickMessage()); }
|
|
||||||
*/
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerMove(PlayerMoveEvent e) {
|
public void onPlayerMove(PlayerMoveEvent e) {
|
||||||
// minecraft:tp @a[x=190,y=-80,z=45,dx=5,dy=50,dz=5] 190 1 45
|
// minecraft:tp @a[x=190,y=-80,z=45,dx=5,dy=50,dz=5] 190 1 45
|
||||||
|
@ -647,6 +636,10 @@ public class PlayerListener implements Listener {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MaybeOfflinePlayer mp=MaybeOfflinePlayer.GetFromPlayer(e.getPlayer());
|
||||||
|
if(mp.ChatOnly)
|
||||||
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
|
@ -665,6 +658,12 @@ public class PlayerListener implements Listener {
|
||||||
e.getPlayer().sendMessage(
|
e.getPlayer().sendMessage(
|
||||||
"§cYou are not allowed to teleport to/from No Mans Land.");
|
"§cYou are not allowed to teleport to/from No Mans Land.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(MaybeOfflinePlayer.GetFromPlayer(e.getPlayer()).ChatOnly)
|
||||||
|
{
|
||||||
|
e.setCancelled(true);
|
||||||
|
e.getPlayer().sendMessage("§cYou are not allowed to teleport while in chat-only mode.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
|
|
@ -94,10 +94,18 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
|
||||||
this.getCommand("mwiki").setExecutor(comm);
|
this.getCommand("mwiki").setExecutor(comm);
|
||||||
this.getCommand("mwiki").setUsage(
|
this.getCommand("mwiki").setUsage(
|
||||||
this.getCommand("mwiki").getUsage().replace('&', '§'));
|
this.getCommand("mwiki").getUsage().replace('&', '§'));
|
||||||
this.getCommand("warmode").setExecutor(comm);
|
this.getCommand("tableflip").setExecutor(comm);
|
||||||
Instance = this; // 2015.08.08.
|
this.getCommand("tableflip").setUsage(
|
||||||
Console = this.getServer().getConsoleSender(); // 2015.08.12.
|
this.getCommand("tableflip").getUsage().replace('&', '§'));
|
||||||
LoadFiles(false); // 2015.08.09.
|
this.getCommand("unflip").setExecutor(comm);
|
||||||
|
this.getCommand("unflip").setUsage(
|
||||||
|
this.getCommand("unflip").getUsage().replace('&', '§'));
|
||||||
|
this.getCommand("chatonly").setExecutor(comm);
|
||||||
|
this.getCommand("chatonly").setUsage(
|
||||||
|
this.getCommand("chatonly").getUsage().replace('&', '§'));
|
||||||
|
Instance = this;
|
||||||
|
Console = this.getServer().getConsoleSender();
|
||||||
|
LoadFiles(false);
|
||||||
|
|
||||||
SB = PluginMain.Instance.getServer().getScoreboardManager()
|
SB = PluginMain.Instance.getServer().getScoreboardManager()
|
||||||
.getMainScoreboard(); // Main can be detected with @a[score_...]
|
.getMainScoreboard(); // Main can be detected with @a[score_...]
|
||||||
|
|
Loading…
Reference in a new issue