Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex
This commit is contained in:
commit
3f827a310a
@ -10,11 +10,13 @@ public class CloseButton implements IButton
|
|||||||
public void ClickedLeft(Player player)
|
public void ClickedLeft(Player player)
|
||||||
{
|
{
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
|
System.out.println(this.getClass().getName() + " 13");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void ClickedRight(Player player)
|
public void ClickedRight(Player player)
|
||||||
{
|
{
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
|
System.out.println(this.getClass().getName() + " 19");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -426,6 +426,7 @@ public class PunishPage extends CraftInventoryCustom implements Listener
|
|||||||
{
|
{
|
||||||
_plugin.AddPunishment(_target, category, _reason, _player, severity, ban, punishTime);
|
_plugin.AddPunishment(_target, category, _reason, _player, severity, ban, punishTime);
|
||||||
_player.closeInventory();
|
_player.closeInventory();
|
||||||
|
System.out.println(this.getClass().getName() + " 429");
|
||||||
ClosePunish();
|
ClosePunish();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -451,6 +452,7 @@ public class PunishPage extends CraftInventoryCustom implements Listener
|
|||||||
{
|
{
|
||||||
punishment.Remove(_player.getName(), _reason);
|
punishment.Remove(_player.getName(), _reason);
|
||||||
_player.closeInventory();
|
_player.closeInventory();
|
||||||
|
System.out.println(this.getClass().getName() + " 455");
|
||||||
ClosePunish();
|
ClosePunish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -181,6 +181,7 @@ public abstract class ShopBase<PluginType extends MiniPlugin> implements Listene
|
|||||||
PlayerPageMap.get(event.getPlayer().getName()).Dispose();
|
PlayerPageMap.get(event.getPlayer().getName()).Dispose();
|
||||||
|
|
||||||
event.getPlayer().closeInventory();
|
event.getPlayer().closeInventory();
|
||||||
|
System.out.println(this.getClass().getName() + " 184");
|
||||||
CloseShopForPlayer(event.getPlayer());
|
CloseShopForPlayer(event.getPlayer());
|
||||||
|
|
||||||
PlayerPageMap.remove(event.getPlayer().getName());
|
PlayerPageMap.remove(event.getPlayer().getName());
|
||||||
@ -199,6 +200,8 @@ public abstract class ShopBase<PluginType extends MiniPlugin> implements Listene
|
|||||||
SetCurrentPageForPlayer(player, page);
|
SetCurrentPageForPlayer(player, page);
|
||||||
|
|
||||||
player.openInventory(page);
|
player.openInventory(page);
|
||||||
|
|
||||||
|
System.out.println(this.getClass().getName() + " - player.openInventory(page);");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetCurrentPageForPlayer(Player player, ShopPageBase<PluginType, ? extends ShopBase<PluginType>> page)
|
public void SetCurrentPageForPlayer(Player player, ShopPageBase<PluginType, ? extends ShopBase<PluginType>> page)
|
||||||
|
@ -104,7 +104,11 @@ public class ConfirmationPage<PluginType extends MiniPlugin, ShopType extends Sh
|
|||||||
if (_returnPage != null)
|
if (_returnPage != null)
|
||||||
Shop.OpenPageForPlayer(player, _returnPage);
|
Shop.OpenPageForPlayer(player, _returnPage);
|
||||||
else
|
else
|
||||||
|
{
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
|
System.out.println(this.getClass().getName() + " 109");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BuildSquareAt(int slot, ShopItem item, IButton button)
|
private void BuildSquareAt(int slot, ShopItem item, IButton button)
|
||||||
@ -288,6 +292,7 @@ public class ConfirmationPage<PluginType extends MiniPlugin, ShopType extends Sh
|
|||||||
else if (Player != null)
|
else if (Player != null)
|
||||||
{
|
{
|
||||||
Player.closeInventory();
|
Player.closeInventory();
|
||||||
|
System.out.println(this.getClass().getName() + " 291");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
|
@ -135,6 +135,7 @@ public class QueuePage extends ShopPageBase<QueueManager, QueueShop>
|
|||||||
if (_closeOnNextUpdate)
|
if (_closeOnNextUpdate)
|
||||||
{
|
{
|
||||||
Player.closeInventory();
|
Player.closeInventory();
|
||||||
|
System.out.println(this.getClass().getName() + " 138");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,6 +188,7 @@ public class QueuePage extends ShopPageBase<QueueManager, QueueShop>
|
|||||||
Plugin.respondToInvite(player, false);
|
Plugin.respondToInvite(player, false);
|
||||||
|
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
|
System.out.println(this.getClass().getName() + " 191");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildSquareAt(int slot, ShopItem item, IButton button)
|
private void buildSquareAt(int slot, ShopItem item, IButton button)
|
||||||
|
@ -26,6 +26,10 @@ import org.bukkit.entity.LivingEntity;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.block.BlockBurnEvent;
|
||||||
|
import org.bukkit.event.block.BlockFadeEvent;
|
||||||
|
import org.bukkit.event.block.BlockSpreadEvent;
|
||||||
|
import org.bukkit.event.block.LeavesDecayEvent;
|
||||||
import org.bukkit.event.entity.EntitySpawnEvent;
|
import org.bukkit.event.entity.EntitySpawnEvent;
|
||||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||||
@ -635,6 +639,30 @@ public class MapParser extends JavaPlugin implements Listener
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void DisableBurn(BlockBurnEvent event)
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void DisableFire(BlockSpreadEvent event)
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void DisableFade(BlockFadeEvent event)
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void DisableDecay(LeavesDecayEvent event)
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void Updates(PlayerMoveEvent event)
|
public void Updates(PlayerMoveEvent event)
|
||||||
{
|
{
|
||||||
|
@ -57,6 +57,8 @@ public class ClassCombatShop extends ShopBase<ClassShopManager>
|
|||||||
if (!CanOpenShop(player))
|
if (!CanOpenShop(player))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
System.out.println(this.getClass().getName() + " - I CAN OPEN SHOP");
|
||||||
|
|
||||||
OpenedShop.add(player.getName());
|
OpenedShop.add(player.getName());
|
||||||
|
|
||||||
OpenShopForPlayer(player);
|
OpenShopForPlayer(player);
|
||||||
|
@ -149,6 +149,7 @@ public class CustomBuildPage extends ShopPageBase<ClassShopManager, ClassCombatS
|
|||||||
clientClass.EquipCustomBuild(customBuild);
|
clientClass.EquipCustomBuild(customBuild);
|
||||||
|
|
||||||
Player.closeInventory();
|
Player.closeInventory();
|
||||||
|
System.out.println(this.getClass().getName() + " 152");
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
|
@ -15,6 +15,7 @@ import redis.clients.jedis.Pipeline;
|
|||||||
import redis.clients.jedis.Response;
|
import redis.clients.jedis.Response;
|
||||||
import redis.clients.jedis.Transaction;
|
import redis.clients.jedis.Transaction;
|
||||||
import redis.clients.jedis.Tuple;
|
import redis.clients.jedis.Tuple;
|
||||||
|
import redis.clients.jedis.exceptions.JedisConnectionException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RedisServerRepository offers a Redis-based implementation of {@link ServerRepository}
|
* RedisServerRepository offers a Redis-based implementation of {@link ServerRepository}
|
||||||
@ -71,10 +72,19 @@ public class RedisServerRepository implements ServerRepository
|
|||||||
servers.add(Utility.deserialize(serializedData, MinecraftServer.class));
|
servers.add(Utility.deserialize(serializedData, MinecraftServer.class));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (JedisConnectionException exception)
|
||||||
|
{
|
||||||
|
exception.printStackTrace();
|
||||||
|
_jedisPool.returnBrokenResource(jedis);
|
||||||
|
jedis = null;
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
|
{
|
||||||
|
if (jedis != null)
|
||||||
{
|
{
|
||||||
_jedisPool.returnResource(jedis);
|
_jedisPool.returnResource(jedis);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return servers;
|
return servers;
|
||||||
}
|
}
|
||||||
@ -92,10 +102,19 @@ public class RedisServerRepository implements ServerRepository
|
|||||||
String serializedData = jedis.get(dataKey);
|
String serializedData = jedis.get(dataKey);
|
||||||
server = Utility.deserialize(serializedData, MinecraftServer.class);
|
server = Utility.deserialize(serializedData, MinecraftServer.class);
|
||||||
}
|
}
|
||||||
|
catch (JedisConnectionException exception)
|
||||||
|
{
|
||||||
|
exception.printStackTrace();
|
||||||
|
_jedisPool.returnBrokenResource(jedis);
|
||||||
|
jedis = null;
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
|
{
|
||||||
|
if (jedis != null)
|
||||||
{
|
{
|
||||||
_jedisPool.returnResource(jedis);
|
_jedisPool.returnResource(jedis);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return server;
|
return server;
|
||||||
}
|
}
|
||||||
@ -118,11 +137,20 @@ public class RedisServerRepository implements ServerRepository
|
|||||||
transaction.zadd(setKey, expiry, serverName);
|
transaction.zadd(setKey, expiry, serverName);
|
||||||
transaction.exec();
|
transaction.exec();
|
||||||
}
|
}
|
||||||
|
catch (JedisConnectionException exception)
|
||||||
|
{
|
||||||
|
exception.printStackTrace();
|
||||||
|
_jedisPool.returnBrokenResource(jedis);
|
||||||
|
jedis = null;
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
|
{
|
||||||
|
if (jedis != null)
|
||||||
{
|
{
|
||||||
_jedisPool.returnResource(jedis);
|
_jedisPool.returnResource(jedis);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeServerStatus(MinecraftServer serverData)
|
public void removeServerStatus(MinecraftServer serverData)
|
||||||
@ -140,11 +168,20 @@ public class RedisServerRepository implements ServerRepository
|
|||||||
transaction.zrem(setKey, serverName);
|
transaction.zrem(setKey, serverName);
|
||||||
transaction.exec();
|
transaction.exec();
|
||||||
}
|
}
|
||||||
|
catch (JedisConnectionException exception)
|
||||||
|
{
|
||||||
|
exception.printStackTrace();
|
||||||
|
_jedisPool.returnBrokenResource(jedis);
|
||||||
|
jedis = null;
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
|
{
|
||||||
|
if (jedis != null)
|
||||||
{
|
{
|
||||||
_jedisPool.returnResource(jedis);
|
_jedisPool.returnResource(jedis);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean serverExists(String serverName)
|
public boolean serverExists(String serverName)
|
||||||
@ -186,10 +223,19 @@ public class RedisServerRepository implements ServerRepository
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
catch (JedisConnectionException exception)
|
||||||
|
{
|
||||||
|
exception.printStackTrace();
|
||||||
|
_jedisPool.returnBrokenResource(jedis);
|
||||||
|
jedis = null;
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
|
{
|
||||||
|
if (jedis != null)
|
||||||
{
|
{
|
||||||
_jedisPool.returnResource(jedis);
|
_jedisPool.returnResource(jedis);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Map<String, ServerGroup> serverGroups = new HashMap<String, ServerGroup>();
|
Map<String, ServerGroup> serverGroups = new HashMap<String, ServerGroup>();
|
||||||
for (ServerGroup serverGroup : getServerGroups())
|
for (ServerGroup serverGroup : getServerGroups())
|
||||||
@ -231,10 +277,19 @@ public class RedisServerRepository implements ServerRepository
|
|||||||
servers.add(new ServerGroup(data, _region));
|
servers.add(new ServerGroup(data, _region));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (JedisConnectionException exception)
|
||||||
|
{
|
||||||
|
exception.printStackTrace();
|
||||||
|
_jedisPool.returnBrokenResource(jedis);
|
||||||
|
jedis = null;
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
|
{
|
||||||
|
if (jedis != null)
|
||||||
{
|
{
|
||||||
_jedisPool.returnResource(jedis);
|
_jedisPool.returnResource(jedis);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return servers;
|
return servers;
|
||||||
}
|
}
|
||||||
@ -255,10 +310,19 @@ public class RedisServerRepository implements ServerRepository
|
|||||||
String max = "+inf";
|
String max = "+inf";
|
||||||
names = jedis.zrangeByScore(key, min, max);
|
names = jedis.zrangeByScore(key, min, max);
|
||||||
}
|
}
|
||||||
|
catch (JedisConnectionException exception)
|
||||||
|
{
|
||||||
|
exception.printStackTrace();
|
||||||
|
_jedisPool.returnBrokenResource(jedis);
|
||||||
|
jedis = null;
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
|
{
|
||||||
|
if (jedis != null)
|
||||||
{
|
{
|
||||||
_jedisPool.returnResource(jedis);
|
_jedisPool.returnResource(jedis);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
@ -301,10 +365,19 @@ public class RedisServerRepository implements ServerRepository
|
|||||||
servers.add(Utility.deserialize(serializedData, MinecraftServer.class));
|
servers.add(Utility.deserialize(serializedData, MinecraftServer.class));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (JedisConnectionException exception)
|
||||||
|
{
|
||||||
|
exception.printStackTrace();
|
||||||
|
_jedisPool.returnBrokenResource(jedis);
|
||||||
|
jedis = null;
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
|
{
|
||||||
|
if (jedis != null)
|
||||||
{
|
{
|
||||||
_jedisPool.returnResource(jedis);
|
_jedisPool.returnResource(jedis);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return servers;
|
return servers;
|
||||||
}
|
}
|
||||||
|
@ -100,5 +100,6 @@ public class TeamArmorAddon extends MiniPlugin
|
|||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
event.getWhoClicked().closeInventory();
|
event.getWhoClicked().closeInventory();
|
||||||
|
System.out.println(this.getClass().getName() + " 103");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -373,8 +373,6 @@ public abstract class Game implements Listener
|
|||||||
//Set Spawn Data
|
//Set Spawn Data
|
||||||
team.SetSpawnRequirement(this.SpawnDistanceRequirement);
|
team.SetSpawnRequirement(this.SpawnDistanceRequirement);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
System.out.println("Created Team: " + team.GetName());
|
System.out.println("Created Team: " + team.GetName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -393,8 +391,6 @@ public abstract class Game implements Listener
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void RestrictKits()
|
public void RestrictKits()
|
||||||
{
|
{
|
||||||
//Null Default
|
//Null Default
|
||||||
@ -409,7 +405,6 @@ public abstract class Game implements Listener
|
|||||||
for (Perk perk : kit.GetPerks())
|
for (Perk perk : kit.GetPerks())
|
||||||
UtilServer.getServer().getPluginManager().registerEvents(perk, Manager.GetPlugin());
|
UtilServer.getServer().getPluginManager().registerEvents(perk, Manager.GetPlugin());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeregisterKits()
|
public void DeregisterKits()
|
||||||
@ -1065,7 +1060,7 @@ public abstract class Game implements Listener
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddStat(Player player, String stat, int amount, boolean global)
|
public void AddStat(Player player, String stat, int amount, boolean limitTo1, boolean global)
|
||||||
{
|
{
|
||||||
if (!_stats.containsKey(player))
|
if (!_stats.containsKey(player))
|
||||||
_stats.put(player, new HashMap<String, Integer>());
|
_stats.put(player, new HashMap<String, Integer>());
|
||||||
@ -1079,7 +1074,7 @@ public abstract class Game implements Listener
|
|||||||
if (_stats.get(player).containsKey(stat))
|
if (_stats.get(player).containsKey(stat))
|
||||||
past = _stats.get(player).get(stat);
|
past = _stats.get(player).get(stat);
|
||||||
|
|
||||||
_stats.get(player).put(stat, past + amount);
|
_stats.get(player).put(stat, limitTo1 ? Math.max(1, past + amount) : past + amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public NautHashMap<Player, HashMap<String, Integer>> GetStats()
|
public NautHashMap<Player, HashMap<String, Integer>> GetStats()
|
||||||
|
@ -61,7 +61,7 @@ public class ChampionsDominate extends Domination
|
|||||||
{
|
{
|
||||||
SetKit(player, GetKits()[2], true);
|
SetKit(player, GetKits()[2], true);
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
System.out.println("Closing inventory from validate kit");
|
System.out.println(this.getClass().getName() + " 64");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ public class ChampionsTDM extends TeamDeathmatch
|
|||||||
{
|
{
|
||||||
SetKit(player, GetKits()[2], true);
|
SetKit(player, GetKits()[2], true);
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
System.out.println("Closing inventory from validate kit");
|
System.out.println(this.getClass().getName() + " 61");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,6 +164,7 @@ public class TeamDeathmatch extends TeamGame
|
|||||||
{
|
{
|
||||||
SetKit(player, GetKits()[2], true);
|
SetKit(player, GetKits()[2], true);
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
|
System.out.println(this.getClass().getName() + " 167");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ import nautilus.game.arcade.events.GameStateChangeEvent;
|
|||||||
import nautilus.game.arcade.game.SoloGame;
|
import nautilus.game.arcade.game.SoloGame;
|
||||||
import nautilus.game.arcade.game.games.mineware.order.Order;
|
import nautilus.game.arcade.game.games.mineware.order.Order;
|
||||||
import nautilus.game.arcade.game.games.mineware.random.*;
|
import nautilus.game.arcade.game.games.mineware.random.*;
|
||||||
import nautilus.game.arcade.game.games.spleef.kits.KitLeaper;
|
import nautilus.game.arcade.game.games.runner.kits.KitLeaper;
|
||||||
import nautilus.game.arcade.kit.Kit;
|
import nautilus.game.arcade.kit.Kit;
|
||||||
|
|
||||||
public class MineWare extends SoloGame
|
public class MineWare extends SoloGame
|
||||||
|
@ -4,10 +4,13 @@ import java.lang.reflect.Field;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.bukkit.Effect;
|
import org.bukkit.Effect;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftArrow;
|
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftArrow;
|
||||||
import org.bukkit.entity.Arrow;
|
import org.bukkit.entity.Arrow;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.Snowball;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.block.BlockDamageEvent;
|
import org.bukkit.event.block.BlockDamageEvent;
|
||||||
@ -17,7 +20,11 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
|||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UtilBlock;
|
import mineplex.core.common.util.UtilBlock;
|
||||||
import mineplex.core.common.util.UtilEnt;
|
import mineplex.core.common.util.UtilEnt;
|
||||||
|
import mineplex.core.common.util.UtilInv;
|
||||||
|
import mineplex.core.common.util.UtilMath;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.itemstack.ItemStackFactory;
|
||||||
|
import mineplex.core.recharge.Recharge;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import nautilus.game.arcade.ArcadeManager;
|
import nautilus.game.arcade.ArcadeManager;
|
||||||
@ -36,7 +43,7 @@ public class Spleef extends SoloGame
|
|||||||
|
|
||||||
new Kit[]
|
new Kit[]
|
||||||
{
|
{
|
||||||
new KitLeaper(manager),
|
new KitSnowballer(manager),
|
||||||
new KitBrawler(manager),
|
new KitBrawler(manager),
|
||||||
new KitArcher(manager)
|
new KitArcher(manager)
|
||||||
},
|
},
|
||||||
@ -54,9 +61,54 @@ public class Spleef extends SoloGame
|
|||||||
this.PrepareFreeze = false;
|
this.PrepareFreeze = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void SnowballDamage(ProjectileHitEvent event)
|
||||||
|
{
|
||||||
|
if (!(event.getEntity() instanceof Snowball))
|
||||||
|
return;
|
||||||
|
|
||||||
|
Snowball ball = (Snowball)event.getEntity();
|
||||||
|
|
||||||
|
if (ball.getShooter() == null || !(ball.getShooter() instanceof Player))
|
||||||
|
return;
|
||||||
|
|
||||||
|
Location loc = ball.getLocation().add(ball.getVelocity().multiply(0.8));
|
||||||
|
|
||||||
|
Block block = loc.getBlock();
|
||||||
|
|
||||||
|
//Find Nearest if hit nothing :O
|
||||||
|
if (block.getType() == Material.AIR)
|
||||||
|
{
|
||||||
|
Block closest = null;
|
||||||
|
double closestDist = 0;
|
||||||
|
|
||||||
|
for (Block other : UtilBlock.getSurrounding(block, true))
|
||||||
|
{
|
||||||
|
if (other.getType() == Material.AIR)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
double dist = UtilMath.offset(loc, other.getLocation().add(0.5, 0.5, 0.5));
|
||||||
|
|
||||||
|
if (closest == null || dist < closestDist)
|
||||||
|
{
|
||||||
|
closest = other;
|
||||||
|
closestDist = dist;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (closest != null)
|
||||||
|
block = closest;
|
||||||
|
}
|
||||||
|
|
||||||
|
BlockFade(block, (Player)ball.getShooter(), false);
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void ArrowDamage(ProjectileHitEvent event)
|
public void ArrowDamage(ProjectileHitEvent event)
|
||||||
{
|
{
|
||||||
|
if (!(event.getEntity() instanceof Arrow))
|
||||||
|
return;
|
||||||
|
|
||||||
final Arrow arrow = (Arrow)event.getEntity();
|
final Arrow arrow = (Arrow)event.getEntity();
|
||||||
final double velocity = arrow.getVelocity().length();
|
final double velocity = arrow.getVelocity().length();
|
||||||
|
|
||||||
@ -89,11 +141,11 @@ public class Spleef extends SoloGame
|
|||||||
|
|
||||||
double radius = 0.5 + velocity/1.6d;
|
double radius = 0.5 + velocity/1.6d;
|
||||||
|
|
||||||
BlockFade(block, player);
|
BlockFade(block, player, false);
|
||||||
|
|
||||||
for (Block other : UtilBlock.getInRadius(block.getLocation().add(0.5, 0.5, 0.5), radius).keySet())
|
for (Block other : UtilBlock.getInRadius(block.getLocation().add(0.5, 0.5, 0.5), radius).keySet())
|
||||||
{
|
{
|
||||||
BlockFade(other, player);
|
BlockFade(other, player, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
arrow.remove();
|
arrow.remove();
|
||||||
@ -117,10 +169,17 @@ public class Spleef extends SoloGame
|
|||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
BlockFade(event.getBlock(), event.getPlayer());
|
BlockFade(event.getBlock(), event.getPlayer(), false);
|
||||||
|
|
||||||
|
//Snowball
|
||||||
|
if (GetKit(event.getPlayer()) instanceof KitSnowballer)
|
||||||
|
if (!UtilInv.contains(event.getPlayer(), Material.SNOW_BALL, (byte)0, 16))
|
||||||
|
event.getPlayer().getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.SNOW_BALL));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
|
//Ignore
|
||||||
|
//@EventHandler
|
||||||
public void LeapDamage(PerkLeapEvent event)
|
public void LeapDamage(PerkLeapEvent event)
|
||||||
{
|
{
|
||||||
if (!UtilEnt.isGrounded(event.GetPlayer()))
|
if (!UtilEnt.isGrounded(event.GetPlayer()))
|
||||||
@ -128,16 +187,25 @@ public class Spleef extends SoloGame
|
|||||||
|
|
||||||
for (Block block : UtilBlock.getInRadius(event.GetPlayer().getLocation().subtract(0, 1, 0), 3d, 0).keySet())
|
for (Block block : UtilBlock.getInRadius(event.GetPlayer().getLocation().subtract(0, 1, 0), 3d, 0).keySet())
|
||||||
{
|
{
|
||||||
BlockFade(block, event.GetPlayer());
|
BlockFade(block, event.GetPlayer(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void BlockFade(Block block, Player player)
|
public void BlockFade(Block block, Player player, boolean slowDamage)
|
||||||
{
|
{
|
||||||
AddStat(player, "BlocksBroken", 1, false);
|
AddStat(player, "BlocksBroken", 1, false, false);
|
||||||
|
|
||||||
|
//Prevent Super Hunger from Bow
|
||||||
|
if (Recharge.Instance.use(player, GetName() + " Hunger", 50, false, false))
|
||||||
|
if (block.getTypeId() != 7)
|
||||||
UtilPlayer.hunger(player, 1);
|
UtilPlayer.hunger(player, 1);
|
||||||
|
|
||||||
|
if (!slowDamage)
|
||||||
|
{
|
||||||
|
Break(block);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//Wool and Stained Clay
|
//Wool and Stained Clay
|
||||||
if (block.getTypeId() == 35 || block.getTypeId() == 159)
|
if (block.getTypeId() == 35 || block.getTypeId() == 159)
|
||||||
{
|
{
|
||||||
|
@ -35,7 +35,7 @@ public class SpleefTeams extends TeamGame
|
|||||||
|
|
||||||
new Kit[]
|
new Kit[]
|
||||||
{
|
{
|
||||||
new KitLeaper(manager),
|
new KitSnowballer(manager),
|
||||||
new KitBrawler(manager),
|
new KitBrawler(manager),
|
||||||
new KitArcher(manager)
|
new KitArcher(manager)
|
||||||
},
|
},
|
||||||
|
@ -20,22 +20,23 @@ public class KitBrawler extends Kit
|
|||||||
|
|
||||||
new String[]
|
new String[]
|
||||||
{
|
{
|
||||||
"Much stronger knockback than other kits."
|
"Very leap. Such knockback. Wow."
|
||||||
},
|
},
|
||||||
|
|
||||||
new Perk[]
|
new Perk[]
|
||||||
{
|
{
|
||||||
|
new PerkLeap("Leap", 1.2, 1.2, 6000),
|
||||||
new PerkSmasher(),
|
new PerkSmasher(),
|
||||||
new PerkKnockback(0.6)
|
new PerkKnockback(0.6)
|
||||||
},
|
},
|
||||||
EntityType.ZOMBIE,
|
EntityType.SKELETON,
|
||||||
new ItemStack(Material.IRON_SWORD));
|
new ItemStack(Material.IRON_AXE));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void GiveItems(Player player)
|
public void GiveItems(Player player)
|
||||||
{
|
{
|
||||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD));
|
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,41 +0,0 @@
|
|||||||
package nautilus.game.arcade.game.games.spleef.kits;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.EntityType;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import mineplex.core.itemstack.ItemStackFactory;
|
|
||||||
import nautilus.game.arcade.ArcadeManager;
|
|
||||||
import nautilus.game.arcade.kit.Kit;
|
|
||||||
import nautilus.game.arcade.kit.KitAvailability;
|
|
||||||
import nautilus.game.arcade.kit.Perk;
|
|
||||||
import nautilus.game.arcade.kit.perks.*;
|
|
||||||
|
|
||||||
public class KitLeaper extends Kit
|
|
||||||
{
|
|
||||||
public KitLeaper(ArcadeManager manager)
|
|
||||||
{
|
|
||||||
super(manager, "Jumper", KitAvailability.Free,
|
|
||||||
|
|
||||||
new String[]
|
|
||||||
{
|
|
||||||
"Leap to escape and damage blocks!"
|
|
||||||
},
|
|
||||||
|
|
||||||
new Perk[]
|
|
||||||
{
|
|
||||||
new PerkLeap("Smashing Leap", 1.2, 1.2, 8000),
|
|
||||||
new PerkKnockback(0.3)
|
|
||||||
},
|
|
||||||
EntityType.PIG_ZOMBIE,
|
|
||||||
new ItemStack(Material.STONE_AXE));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void GiveItems(Player player)
|
|
||||||
{
|
|
||||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_AXE));
|
|
||||||
}
|
|
||||||
}
|
|
@ -264,6 +264,7 @@ public class GameFlagManager implements Listener
|
|||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
event.getWhoClicked().closeInventory();
|
event.getWhoClicked().closeInventory();
|
||||||
|
System.out.println(this.getClass().getName() + " 267");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1147,6 +1147,7 @@ public class GameLobbyManager implements IPacketRunnable, Listener
|
|||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
event.getWhoClicked().closeInventory();
|
event.getWhoClicked().closeInventory();
|
||||||
|
System.out.println(this.getClass().getName() + " 1150");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,6 +150,7 @@ public class GamePlayerManager implements Listener
|
|||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
event.getWhoClicked().closeInventory();
|
event.getWhoClicked().closeInventory();
|
||||||
|
System.out.println(this.getClass().getName() + " 153");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,12 +81,14 @@ public class MiscManager implements Listener
|
|||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
|
System.out.println(this.getClass().getName() + " 84");
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (Manager.GetGame().IsLive() && !Manager.GetGame().IsAlive(player) && !((CraftPlayer)player).getHandle().spectating)
|
else if (Manager.GetGame().IsLive() && !Manager.GetGame().IsAlive(player) && !((CraftPlayer)player).getHandle().spectating)
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
|
System.out.println(this.getClass().getName() + " 91");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,5 +16,6 @@ public class InventoryClose extends Action
|
|||||||
public void CustomAction(Player player)
|
public void CustomAction(Player player)
|
||||||
{
|
{
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
|
System.out.println(this.getClass().getName() + " 19");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user