Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex

This commit is contained in:
Jonathan Williams 2014-08-15 11:54:19 -05:00
commit 3f827a310a
26 changed files with 251 additions and 102 deletions

View File

@ -10,11 +10,13 @@ public class CloseButton implements IButton
public void ClickedLeft(Player player)
{
player.closeInventory();
System.out.println(this.getClass().getName() + " 13");
}
@Override
public void ClickedRight(Player player)
{
player.closeInventory();
System.out.println(this.getClass().getName() + " 19");
}
}

View File

@ -426,6 +426,7 @@ public class PunishPage extends CraftInventoryCustom implements Listener
{
_plugin.AddPunishment(_target, category, _reason, _player, severity, ban, punishTime);
_player.closeInventory();
System.out.println(this.getClass().getName() + " 429");
ClosePunish();
}
@ -451,6 +452,7 @@ public class PunishPage extends CraftInventoryCustom implements Listener
{
punishment.Remove(_player.getName(), _reason);
_player.closeInventory();
System.out.println(this.getClass().getName() + " 455");
ClosePunish();
}
}

View File

@ -181,6 +181,7 @@ public abstract class ShopBase<PluginType extends MiniPlugin> implements Listene
PlayerPageMap.get(event.getPlayer().getName()).Dispose();
event.getPlayer().closeInventory();
System.out.println(this.getClass().getName() + " 184");
CloseShopForPlayer(event.getPlayer());
PlayerPageMap.remove(event.getPlayer().getName());
@ -199,6 +200,8 @@ public abstract class ShopBase<PluginType extends MiniPlugin> implements Listene
SetCurrentPageForPlayer(player, page);
player.openInventory(page);
System.out.println(this.getClass().getName() + " - player.openInventory(page);");
}
public void SetCurrentPageForPlayer(Player player, ShopPageBase<PluginType, ? extends ShopBase<PluginType>> page)

View File

@ -104,7 +104,11 @@ public class ConfirmationPage<PluginType extends MiniPlugin, ShopType extends Sh
if (_returnPage != null)
Shop.OpenPageForPlayer(player, _returnPage);
else
{
player.closeInventory();
System.out.println(this.getClass().getName() + " 109");
}
}
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)
{
Player.closeInventory();
System.out.println(this.getClass().getName() + " 291");
}
}
catch (Exception exception)

View File

@ -135,6 +135,7 @@ public class QueuePage extends ShopPageBase<QueueManager, QueueShop>
if (_closeOnNextUpdate)
{
Player.closeInventory();
System.out.println(this.getClass().getName() + " 138");
return;
}
@ -187,6 +188,7 @@ public class QueuePage extends ShopPageBase<QueueManager, QueueShop>
Plugin.respondToInvite(player, false);
player.closeInventory();
System.out.println(this.getClass().getName() + " 191");
}
private void buildSquareAt(int slot, ShopItem item, IButton button)

View File

@ -26,6 +26,10 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
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.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
@ -635,6 +639,30 @@ public class MapParser extends JavaPlugin implements Listener
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
public void Updates(PlayerMoveEvent event)
{

View File

@ -57,6 +57,8 @@ public class ClassCombatShop extends ShopBase<ClassShopManager>
if (!CanOpenShop(player))
return false;
System.out.println(this.getClass().getName() + " - I CAN OPEN SHOP");
OpenedShop.add(player.getName());
OpenShopForPlayer(player);

View File

@ -149,6 +149,7 @@ public class CustomBuildPage extends ShopPageBase<ClassShopManager, ClassCombatS
clientClass.EquipCustomBuild(customBuild);
Player.closeInventory();
System.out.println(this.getClass().getName() + " 152");
}
@SuppressWarnings("deprecation")

View File

@ -15,6 +15,7 @@ import redis.clients.jedis.Pipeline;
import redis.clients.jedis.Response;
import redis.clients.jedis.Transaction;
import redis.clients.jedis.Tuple;
import redis.clients.jedis.exceptions.JedisConnectionException;
/**
* 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));
}
}
catch (JedisConnectionException exception)
{
exception.printStackTrace();
_jedisPool.returnBrokenResource(jedis);
jedis = null;
}
finally
{
if (jedis != null)
{
_jedisPool.returnResource(jedis);
}
}
return servers;
}
@ -92,10 +102,19 @@ public class RedisServerRepository implements ServerRepository
String serializedData = jedis.get(dataKey);
server = Utility.deserialize(serializedData, MinecraftServer.class);
}
catch (JedisConnectionException exception)
{
exception.printStackTrace();
_jedisPool.returnBrokenResource(jedis);
jedis = null;
}
finally
{
if (jedis != null)
{
_jedisPool.returnResource(jedis);
}
}
return server;
}
@ -118,11 +137,20 @@ public class RedisServerRepository implements ServerRepository
transaction.zadd(setKey, expiry, serverName);
transaction.exec();
}
catch (JedisConnectionException exception)
{
exception.printStackTrace();
_jedisPool.returnBrokenResource(jedis);
jedis = null;
}
finally
{
if (jedis != null)
{
_jedisPool.returnResource(jedis);
}
}
}
@Override
public void removeServerStatus(MinecraftServer serverData)
@ -140,11 +168,20 @@ public class RedisServerRepository implements ServerRepository
transaction.zrem(setKey, serverName);
transaction.exec();
}
catch (JedisConnectionException exception)
{
exception.printStackTrace();
_jedisPool.returnBrokenResource(jedis);
jedis = null;
}
finally
{
if (jedis != null)
{
_jedisPool.returnResource(jedis);
}
}
}
@Override
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
{
if (jedis != null)
{
_jedisPool.returnResource(jedis);
}
}
Map<String, ServerGroup> serverGroups = new HashMap<String, ServerGroup>();
for (ServerGroup serverGroup : getServerGroups())
@ -231,10 +277,19 @@ public class RedisServerRepository implements ServerRepository
servers.add(new ServerGroup(data, _region));
}
}
catch (JedisConnectionException exception)
{
exception.printStackTrace();
_jedisPool.returnBrokenResource(jedis);
jedis = null;
}
finally
{
if (jedis != null)
{
_jedisPool.returnResource(jedis);
}
}
return servers;
}
@ -255,10 +310,19 @@ public class RedisServerRepository implements ServerRepository
String max = "+inf";
names = jedis.zrangeByScore(key, min, max);
}
catch (JedisConnectionException exception)
{
exception.printStackTrace();
_jedisPool.returnBrokenResource(jedis);
jedis = null;
}
finally
{
if (jedis != null)
{
_jedisPool.returnResource(jedis);
}
}
return names;
}
@ -301,10 +365,19 @@ public class RedisServerRepository implements ServerRepository
servers.add(Utility.deserialize(serializedData, MinecraftServer.class));
}
}
catch (JedisConnectionException exception)
{
exception.printStackTrace();
_jedisPool.returnBrokenResource(jedis);
jedis = null;
}
finally
{
if (jedis != null)
{
_jedisPool.returnResource(jedis);
}
}
return servers;
}

View File

@ -100,5 +100,6 @@ public class TeamArmorAddon extends MiniPlugin
event.setCancelled(true);
event.getWhoClicked().closeInventory();
System.out.println(this.getClass().getName() + " 103");
}
}

View File

@ -373,8 +373,6 @@ public abstract class Game implements Listener
//Set Spawn Data
team.SetSpawnRequirement(this.SpawnDistanceRequirement);
System.out.println("Created Team: " + team.GetName());
}
@ -393,8 +391,6 @@ public abstract class Game implements Listener
return false;
}
public void RestrictKits()
{
//Null Default
@ -409,7 +405,6 @@ public abstract class Game implements Listener
for (Perk perk : kit.GetPerks())
UtilServer.getServer().getPluginManager().registerEvents(perk, Manager.GetPlugin());
}
}
public void DeregisterKits()
@ -1065,7 +1060,7 @@ public abstract class Game implements Listener
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))
_stats.put(player, new HashMap<String, Integer>());
@ -1079,7 +1074,7 @@ public abstract class Game implements Listener
if (_stats.get(player).containsKey(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()

View File

@ -61,7 +61,7 @@ public class ChampionsDominate extends Domination
{
SetKit(player, GetKits()[2], true);
player.closeInventory();
System.out.println("Closing inventory from validate kit");
System.out.println(this.getClass().getName() + " 64");
}
}

View File

@ -57,7 +57,7 @@ public class ChampionsTDM extends TeamDeathmatch
{
SetKit(player, GetKits()[2], true);
player.closeInventory();
System.out.println("Closing inventory from validate kit");
System.out.println(this.getClass().getName() + " 61");
}
}

View File

@ -164,6 +164,7 @@ public class TeamDeathmatch extends TeamGame
{
SetKit(player, GetKits()[2], true);
player.closeInventory();
System.out.println(this.getClass().getName() + " 167");
}
}

View File

@ -37,7 +37,7 @@ import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.mineware.order.Order;
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;
public class MineWare extends SoloGame

View File

@ -4,10 +4,13 @@ import java.lang.reflect.Field;
import java.util.HashMap;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftArrow;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player;
import org.bukkit.entity.Snowball;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
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.UtilBlock;
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.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
@ -36,7 +43,7 @@ public class Spleef extends SoloGame
new Kit[]
{
new KitLeaper(manager),
new KitSnowballer(manager),
new KitBrawler(manager),
new KitArcher(manager)
},
@ -54,9 +61,54 @@ public class Spleef extends SoloGame
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
public void ArrowDamage(ProjectileHitEvent event)
{
if (!(event.getEntity() instanceof Arrow))
return;
final Arrow arrow = (Arrow)event.getEntity();
final double velocity = arrow.getVelocity().length();
@ -89,11 +141,11 @@ public class Spleef extends SoloGame
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())
{
BlockFade(other, player);
BlockFade(other, player, true);
}
arrow.remove();
@ -117,10 +169,17 @@ public class Spleef extends SoloGame
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)
{
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())
{
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);
if (!slowDamage)
{
Break(block);
return;
}
//Wool and Stained Clay
if (block.getTypeId() == 35 || block.getTypeId() == 159)
{

View File

@ -35,7 +35,7 @@ public class SpleefTeams extends TeamGame
new Kit[]
{
new KitLeaper(manager),
new KitSnowballer(manager),
new KitBrawler(manager),
new KitArcher(manager)
},

View File

@ -20,22 +20,23 @@ public class KitBrawler extends Kit
new String[]
{
"Much stronger knockback than other kits."
"Very leap. Such knockback. Wow."
},
new Perk[]
{
new PerkLeap("Leap", 1.2, 1.2, 6000),
new PerkSmasher(),
new PerkKnockback(0.6)
},
EntityType.ZOMBIE,
new ItemStack(Material.IRON_SWORD));
EntityType.SKELETON,
new ItemStack(Material.IRON_AXE));
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE));
}
}

View File

@ -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));
}
}

View File

@ -264,6 +264,7 @@ public class GameFlagManager implements Listener
{
event.setCancelled(true);
event.getWhoClicked().closeInventory();
System.out.println(this.getClass().getName() + " 267");
}
}

View File

@ -1147,6 +1147,7 @@ public class GameLobbyManager implements IPacketRunnable, Listener
{
event.setCancelled(true);
event.getWhoClicked().closeInventory();
System.out.println(this.getClass().getName() + " 1150");
}
}

View File

@ -150,6 +150,7 @@ public class GamePlayerManager implements Listener
{
event.setCancelled(true);
event.getWhoClicked().closeInventory();
System.out.println(this.getClass().getName() + " 153");
}
}

View File

@ -81,12 +81,14 @@ public class MiscManager implements Listener
{
event.setCancelled(true);
player.closeInventory();
System.out.println(this.getClass().getName() + " 84");
}
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");
}
}

View File

@ -16,5 +16,6 @@ public class InventoryClose extends Action
public void CustomAction(Player player)
{
player.closeInventory();
System.out.println(this.getClass().getName() + " 19");
}
}