Merge branch 'master' of ssh://184.154.0.242:7999/min/mineplex
This commit is contained in:
commit
51bc53262d
@ -0,0 +1,69 @@
|
||||
package mineplex.core.common.util;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
/**
|
||||
* Created by Shaun on 11/12/2014.
|
||||
*/
|
||||
public class UtilColor
|
||||
{
|
||||
|
||||
public static byte chatColorToClayData(ChatColor chatColor)
|
||||
{
|
||||
//TODO
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static byte chatColorToWoolData(ChatColor chatColor)
|
||||
{
|
||||
switch (chatColor)
|
||||
{
|
||||
// 0: white
|
||||
// 1: orange
|
||||
// 2: magenta
|
||||
// 3: light blue
|
||||
// 4: yellow
|
||||
// 5: lime
|
||||
// 6: pink
|
||||
// 7: gray
|
||||
// 8: light gray
|
||||
// 9: cyan
|
||||
// 10: purple
|
||||
// 11: blue
|
||||
// 12: brown
|
||||
// 13: green
|
||||
// 14: red
|
||||
// 15: black
|
||||
case BLACK:
|
||||
return 1;
|
||||
case DARK_BLUE:
|
||||
return 11;
|
||||
case DARK_GREEN:
|
||||
return 13;
|
||||
case DARK_AQUA:
|
||||
return 9;
|
||||
case DARK_PURPLE:
|
||||
return 10;
|
||||
case GOLD:
|
||||
return 1;
|
||||
case GRAY:
|
||||
return 8;
|
||||
case DARK_GRAY:
|
||||
return 7;
|
||||
case BLUE:
|
||||
return 11;
|
||||
case GREEN:
|
||||
return 5;
|
||||
case AQUA:
|
||||
return 3;
|
||||
case RED:
|
||||
return 14;
|
||||
case LIGHT_PURPLE:
|
||||
return 2;
|
||||
case YELLOW:
|
||||
return 4;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
@ -89,6 +89,20 @@ public abstract class CommandBase<PluginType extends MiniPlugin> implements ICom
|
||||
return matches;
|
||||
}
|
||||
|
||||
protected List<String> getMatches(String start, Enum[] numerators)
|
||||
{
|
||||
List<String> matches = new ArrayList<String>();
|
||||
|
||||
for (Enum e : numerators)
|
||||
{
|
||||
String s = e.toString();
|
||||
if (s.toLowerCase().startsWith(start.toLowerCase()))
|
||||
matches.add(s);
|
||||
}
|
||||
|
||||
return matches;
|
||||
}
|
||||
|
||||
protected List<String> getPlayerMatches(Player sender, String start)
|
||||
{
|
||||
List<String> matches = new ArrayList<String>();
|
||||
@ -103,4 +117,5 @@ public abstract class CommandBase<PluginType extends MiniPlugin> implements ICom
|
||||
|
||||
return matches;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,9 +1,13 @@
|
||||
package mineplex.core.command;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public abstract class MultiCommandBase<PluginType extends MiniPlugin> extends CommandBase<PluginType>
|
||||
@ -66,6 +70,35 @@ public abstract class MultiCommandBase<PluginType extends MiniPlugin> extends Co
|
||||
Help(caller, args);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, String commandLabel, String[] args)
|
||||
{
|
||||
if (args.length == 1)
|
||||
{
|
||||
List<String> possibleMatches = new ArrayList<String>();
|
||||
|
||||
for (ICommand command : Commands.values())
|
||||
{
|
||||
possibleMatches.addAll(command.Aliases());
|
||||
}
|
||||
|
||||
return getMatches(args[0], possibleMatches);
|
||||
}
|
||||
else if (args.length > 1)
|
||||
{
|
||||
String commandName = args[0];
|
||||
|
||||
ICommand command = Commands.get(commandName);
|
||||
|
||||
if (command != null)
|
||||
{
|
||||
return command.onTabComplete(sender, commandLabel, args);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected abstract void Help(Player caller, String[] args);
|
||||
}
|
||||
|
@ -239,4 +239,9 @@ public abstract class ShopBase<PluginType extends MiniPlugin> implements Listene
|
||||
}
|
||||
|
||||
protected abstract ShopPageBase<PluginType, ? extends ShopBase<PluginType>> BuildPagesFor(Player player);
|
||||
|
||||
public boolean isPlayerInShop(Player player)
|
||||
{
|
||||
return PlayerPageMap.containsKey(player.getName());
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ public class ShopItem extends CraftItemStack
|
||||
_deliveryName = deliveryName;
|
||||
_displayItem = displayItem;
|
||||
_deliveryAmount = deliveryAmount;
|
||||
_lore = itemStack.getItemMeta().getLore().toArray(new String[0]);
|
||||
|
||||
CraftItemStack craftItem = CraftItemStack.asCraftCopy(itemStack);
|
||||
getHandle().tag = craftItem.getHandle().tag;
|
||||
|
@ -6,6 +6,8 @@ import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
@ -27,17 +29,24 @@ import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.gui.SpectatorShop;
|
||||
|
||||
public class CompassAddon extends MiniPlugin
|
||||
{
|
||||
public ArcadeManager Manager;
|
||||
|
||||
private SpectatorShop _spectatorShop;
|
||||
|
||||
public CompassAddon(JavaPlugin plugin, ArcadeManager manager)
|
||||
{
|
||||
super("Compass Addon", plugin);
|
||||
|
||||
Manager = manager;
|
||||
|
||||
_spectatorShop = new SpectatorShop(this, manager, manager.GetClients(), manager.GetDonation());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -179,7 +188,7 @@ public class CompassAddon extends MiniPlugin
|
||||
@EventHandler
|
||||
public void SpectatorTeleport(PlayerInteractEvent event)
|
||||
{
|
||||
if (Manager.GetGame() == null)
|
||||
if (Manager.GetGame() == null)
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
@ -192,12 +201,28 @@ public class CompassAddon extends MiniPlugin
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
if (!Recharge.Instance.use(player, "Spectate", 5000, true, false))
|
||||
if (event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK || !Manager.GetGame().CompassSpectatorMenu)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// Teleport to nearest player when you left click compass
|
||||
|
||||
GameTeam team = Manager.GetGame().GetTeam(player);
|
||||
if (!Recharge.Instance.use(player, "Spectate", 5000, true, false))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
spectateNearestPlayer(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Right click - open spectator menu
|
||||
|
||||
_spectatorShop.attemptShopOpen(player);
|
||||
}
|
||||
}
|
||||
|
||||
private void spectateNearestPlayer(Player spectator)
|
||||
{
|
||||
GameTeam team = Manager.GetGame().GetTeam(spectator);
|
||||
|
||||
Player target = null;
|
||||
double bestDist = 0;
|
||||
@ -207,10 +232,10 @@ public class CompassAddon extends MiniPlugin
|
||||
GameTeam otherTeam = Manager.GetGame().GetTeam(other);
|
||||
|
||||
//Same Team (Not Solo Game) && Alive
|
||||
if (Manager.GetGame().GetTeamList().size() > 1 && (team != null && team.equals(otherTeam)) && Manager.GetGame().IsAlive(player))
|
||||
if (Manager.GetGame().GetTeamList().size() > 1 && (team != null && team.equals(otherTeam)) && Manager.GetGame().IsAlive(spectator))
|
||||
continue;
|
||||
|
||||
double dist = UtilMath.offset(player, other);
|
||||
double dist = UtilMath.offset(spectator, other);
|
||||
|
||||
if (target == null || dist < bestDist)
|
||||
{
|
||||
@ -221,7 +246,41 @@ public class CompassAddon extends MiniPlugin
|
||||
|
||||
if (target != null)
|
||||
{
|
||||
player.teleport(target.getLocation().add(0, 1, 0));
|
||||
spectator.teleport(target.getLocation().add(0, 1, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void closeShop(GameStateChangeEvent event)
|
||||
{
|
||||
// Close shop when a game ends
|
||||
if (event.GetState().equals(Game.GameState.End))
|
||||
{
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
if (_spectatorShop.isPlayerInShop(player))
|
||||
player.closeInventory();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateShop(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
return;
|
||||
|
||||
_spectatorShop.update();
|
||||
}
|
||||
|
||||
// This prevents other modules from cancelling clicks in
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onInventoryClick(InventoryClickEvent event)
|
||||
{
|
||||
if (event.getClickedInventory() != null && event.getWhoClicked() != null && event.getWhoClicked().getGameMode() == GameMode.CREATIVE && event.getClickedInventory().getTitle().equals("Spectate Menu"))
|
||||
{
|
||||
event.setCancelled(false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
package nautilus.game.arcade.command;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
@ -83,4 +85,12 @@ public class SetCommand extends CommandBase<ArcadeManager>
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, String commandLabel, String[] args)
|
||||
{
|
||||
String lastArg = args[args.length - 1];
|
||||
|
||||
return getMatches(lastArg, GameType.values());
|
||||
}
|
||||
}
|
||||
|
@ -57,6 +57,7 @@ import nautilus.game.arcade.world.WorldData;
|
||||
|
||||
public abstract class Game implements Listener
|
||||
{
|
||||
|
||||
public long getGameLiveTime()
|
||||
{
|
||||
return _gameLiveTime;
|
||||
@ -210,6 +211,7 @@ public abstract class Game implements Listener
|
||||
//Addons
|
||||
public boolean CompassEnabled = false;
|
||||
public boolean CompassGiveItem = true;
|
||||
public boolean CompassSpectatorMenu = true;
|
||||
|
||||
public boolean SoupEnabled = true;
|
||||
public boolean TeamArmor = false;
|
||||
|
@ -197,6 +197,8 @@ public class CastleSiege extends TeamGame
|
||||
this.WorldTimeSet = 14000; //14000
|
||||
this.BlockPlaceAllow.add(85);
|
||||
|
||||
this.CompassSpectatorMenu = false;
|
||||
|
||||
_kingName = C.cYellow + C.Bold + "King Sparklez";
|
||||
|
||||
GameTeam notRedTeam = null;
|
||||
|
@ -163,6 +163,9 @@ public class UHC extends TeamGame
|
||||
this.GemDoubleEnabled = false;
|
||||
this.GemHunterEnabled = false;
|
||||
|
||||
// TODO design a better way to handle spectator gui for UHC
|
||||
this.CompassSpectatorMenu = false;
|
||||
|
||||
WorldTimeSet = -1;
|
||||
|
||||
CraftRecipes();
|
||||
|
@ -0,0 +1,41 @@
|
||||
package nautilus.game.arcade.gui;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.CurrencyType;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.shop.ShopBase;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.addons.CompassAddon;
|
||||
import nautilus.game.arcade.gui.page.SpectatorPage;
|
||||
|
||||
/**
|
||||
* Created by shaun on 14-09-24.
|
||||
*/
|
||||
public class SpectatorShop extends ShopBase<CompassAddon>
|
||||
{
|
||||
|
||||
private ArcadeManager _arcadeManager;
|
||||
|
||||
public SpectatorShop(CompassAddon plugin, ArcadeManager arcadeManager, CoreClientManager clientManager, DonationManager donationManager, CurrencyType... currencyTypes)
|
||||
{
|
||||
super(plugin, clientManager, donationManager, "Spectate Menu", currencyTypes);
|
||||
_arcadeManager = arcadeManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ShopPageBase<CompassAddon, ? extends ShopBase<CompassAddon>> BuildPagesFor(Player player)
|
||||
{
|
||||
return new SpectatorPage(Plugin, _arcadeManager, this, ClientManager, DonationManager, player);
|
||||
}
|
||||
|
||||
public void update()
|
||||
{
|
||||
for (ShopPageBase<CompassAddon, ? extends ShopBase<CompassAddon>> shopPage : PlayerPageMap.values())
|
||||
{
|
||||
shopPage.Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package nautilus.game.arcade.gui.button;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.shop.item.SingleButton;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
|
||||
/**
|
||||
* Created by shaun on 14-09-26.
|
||||
*/
|
||||
public class SpectatorButton extends SingleButton
|
||||
{
|
||||
private ArcadeManager _arcadeManager;
|
||||
private Player _player;
|
||||
private Player _target;
|
||||
|
||||
public SpectatorButton(ArcadeManager arcadeManager, Player player, Player target)
|
||||
{
|
||||
_arcadeManager = arcadeManager;
|
||||
_player = player;
|
||||
_target = target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Clicked(Player player)
|
||||
{
|
||||
// Make sure this player is still a spectator
|
||||
if (!((CraftPlayer) player).getHandle().spectating)
|
||||
return;
|
||||
|
||||
if (_arcadeManager.IsAlive(_target))
|
||||
{
|
||||
_player.teleport(_target.getLocation().add(0, 1, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
_player.sendMessage(F.main("Spectate", F.name(_target.getName()) + " is no longer alive."));
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,158 @@
|
||||
package nautilus.game.arcade.gui.page;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
import org.bukkit.scoreboard.Team;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilColor;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.addons.CompassAddon;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.gui.SpectatorShop;
|
||||
import nautilus.game.arcade.gui.button.SpectatorButton;
|
||||
|
||||
/**
|
||||
* Created by shaun on 14-09-24.
|
||||
*/
|
||||
|
||||
public class SpectatorPage extends ShopPageBase<CompassAddon, SpectatorShop>
|
||||
{
|
||||
private ArcadeManager _arcadeManager;
|
||||
|
||||
public SpectatorPage(CompassAddon plugin, ArcadeManager arcadeManager, SpectatorShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player)
|
||||
{
|
||||
super(plugin, shop, clientManager, donationManager, "Spectator Menu", player);
|
||||
_arcadeManager = arcadeManager;
|
||||
BuildPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void BuildPage()
|
||||
{
|
||||
int playerCount = _arcadeManager.GetGame().GetPlayers(true).size();
|
||||
List<GameTeam> teamList = _arcadeManager.GetGame().GetTeamList();
|
||||
|
||||
if (teamList.size() == 1 && playerCount < 28)
|
||||
buildSingleTeam(teamList.get(0), playerCount);
|
||||
else
|
||||
buildMultipleTeams(teamList, playerCount);
|
||||
|
||||
}
|
||||
|
||||
private void buildSingleTeam(GameTeam team, int playerCount)
|
||||
{
|
||||
setItem(13, getTeamItem(team, playerCount));
|
||||
|
||||
int slot = 19;
|
||||
|
||||
for (Player other : team.GetPlayers(true))
|
||||
{
|
||||
addPlayerItem(slot, team, other);
|
||||
|
||||
if ((slot + 2) % 9 == 0)
|
||||
slot += 3;
|
||||
else
|
||||
slot++;
|
||||
}
|
||||
}
|
||||
|
||||
private void buildMultipleTeams(List<GameTeam> teamList, int playerCount)
|
||||
{
|
||||
int currentRow = 0;
|
||||
|
||||
for (GameTeam team : teamList)
|
||||
{
|
||||
ArrayList<Player> teamPlayers = team.GetPlayers(true);
|
||||
int rowsNeeded = (teamPlayers.size() / 8) + 1;
|
||||
|
||||
for (int row = 0; row < rowsNeeded; row++)
|
||||
{
|
||||
int woolSlot = (row * 9) + (currentRow * 9);
|
||||
|
||||
|
||||
// TODO Need to handle too many players in a better way
|
||||
if (woolSlot >= getSize())
|
||||
continue;
|
||||
|
||||
setItem(woolSlot, getTeamItem(team, teamPlayers.size()));
|
||||
|
||||
int startPlayerIndex = row * 9;
|
||||
for (int playerIndex = startPlayerIndex; playerIndex < teamPlayers.size() && playerIndex < startPlayerIndex + 9; playerIndex++)
|
||||
{
|
||||
Player other = teamPlayers.get(playerIndex);
|
||||
int slot = woolSlot + 1 + playerIndex;
|
||||
|
||||
// TODO Need to handle too many players in a better way
|
||||
if (slot >= getSize())
|
||||
continue;
|
||||
|
||||
addPlayerItem(slot, team, other);
|
||||
}
|
||||
}
|
||||
|
||||
// Add a line in between teams if the player count is low enough and there are less than 4 teams
|
||||
if (rowsNeeded == 1 && teamList.size() < 4 && playerCount <= 26)
|
||||
currentRow += 2;
|
||||
else
|
||||
currentRow += rowsNeeded;
|
||||
}
|
||||
}
|
||||
|
||||
private void addPlayerItem(int slot, GameTeam team, Player other)
|
||||
{
|
||||
ItemStack playerItem = getPlayerItem(team, other);
|
||||
ShopItem shopItem = new ShopItem(playerItem, other.getName(), other.getName(), 1, false, false);
|
||||
AddButton(slot, shopItem, new SpectatorButton(_arcadeManager, Player, other));
|
||||
}
|
||||
|
||||
private ItemStack getTeamItem(GameTeam team, int playerCount)
|
||||
{
|
||||
ItemStack item = new ItemStack(Material.WOOL, 1, (short)0, UtilColor.chatColorToWoolData(team.GetColor()));
|
||||
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.setDisplayName(team.GetFormattedName());
|
||||
meta.setLore(Arrays.asList(" ", ChatColor.RESET + C.cYellow + "Players Alive: " + C.cWhite + playerCount));
|
||||
item.setItemMeta(meta);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
private ItemStack getPlayerItem(GameTeam team, Player other)
|
||||
{
|
||||
ItemStack item = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3);
|
||||
|
||||
double distance = UtilMath.offset(Player, other);
|
||||
double heightDifference = other.getLocation().getY() - Player.getLocation().getY();
|
||||
|
||||
ArrayList<String> lore = new ArrayList<String>();
|
||||
lore.add(" ");
|
||||
lore.add(ChatColor.RESET + C.cYellow + "Kit: " + C.cWhite + _arcadeManager.GetGame().GetKit(other).GetName());
|
||||
lore.add(ChatColor.RESET + C.cYellow + "Distance: " + C.cWhite + UtilMath.trim(1, distance));
|
||||
lore.add(ChatColor.RESET + C.cYellow + "Height Difference: " + C.cWhite + UtilMath.trim(1, heightDifference));
|
||||
lore.add(" ");
|
||||
lore.add(ChatColor.RESET + C.Line + "Click to Spectate");
|
||||
SkullMeta skullMeta = ((SkullMeta) item.getItemMeta());
|
||||
skullMeta.setOwner(other.getName());
|
||||
skullMeta.setDisplayName(team.GetColor() + other.getName());
|
||||
skullMeta.setLore(lore);
|
||||
item.setItemMeta(skullMeta);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
}
|
@ -163,8 +163,7 @@ public class GamePlayerManager implements Listener
|
||||
if (event.getWhoClicked().getGameMode() == GameMode.CREATIVE)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
event.getWhoClicked().closeInventory();
|
||||
System.out.println(this.getClass().getName() + " 153");
|
||||
// event.getWhoClicked().closeInventory();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,17 +81,26 @@ public class MiscManager implements Listener
|
||||
if (player.getGameMode() != GameMode.SURVIVAL && !player.isOp())
|
||||
{
|
||||
event.setCancelled(true);
|
||||
player.closeInventory();
|
||||
System.out.println(this.getClass().getName() + " 84");
|
||||
// player.closeInventory();
|
||||
}
|
||||
|
||||
else if (Manager.GetGame().IsLive() && !Manager.GetGame().IsAlive(player) && !((CraftPlayer)player).getHandle().spectating)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
player.closeInventory();
|
||||
System.out.println(this.getClass().getName() + " 91");
|
||||
// player.closeInventory();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void InventoryClickClose(InventoryClickEvent event)
|
||||
{
|
||||
Player player = UtilPlayer.searchExact(event.getWhoClicked().getName());
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (event.getClickedInventory().getViewers().contains(player))
|
||||
player.closeInventory();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void addClockPrevent(InventoryOpenEvent event)
|
||||
|
Loading…
Reference in New Issue
Block a user