many UHC bug fixes

dragon escape bug fixes
barbarians bug fixes
death tag fixes
This commit is contained in:
Chiss 2013-09-13 12:24:33 +10:00
parent 60dd6c84d0
commit b1744e86d8
27 changed files with 619 additions and 172 deletions

View File

@ -1,6 +1,10 @@
package mineplex.core.common.util;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Projectile;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.player.PlayerInteractEvent;
public class UtilEvent
@ -37,4 +41,32 @@ public class UtilEvent
return false;
}
public static LivingEntity GetDamagerEntity(EntityDamageEvent event, boolean ranged)
{
if (!(event instanceof EntityDamageByEntityEvent))
return null;
EntityDamageByEntityEvent eventEE = (EntityDamageByEntityEvent)event;
//Get Damager
if (eventEE.getDamager() instanceof LivingEntity)
return (LivingEntity)eventEE.getDamager();
if (!ranged)
return null;
if (!(eventEE.getDamager() instanceof Projectile))
return null;
Projectile projectile = (Projectile)eventEE.getDamager();
if (projectile.getShooter() == null)
return null;
if (!(projectile.getShooter() instanceof LivingEntity))
return null;
return (LivingEntity)projectile.getShooter();
}
}

View File

@ -13,6 +13,8 @@ import org.bukkit.plugin.java.JavaPlugin;
public class AntiStack extends MiniPlugin
{
private boolean _enabled = true;
public AntiStack(JavaPlugin plugin)
{
super("AntiStack", plugin);
@ -21,6 +23,9 @@ public class AntiStack extends MiniPlugin
@EventHandler (priority=EventPriority.HIGHEST)
public void ItemSpawn(ItemSpawnEvent event)
{
if (!_enabled)
return;
if (event.isCancelled())
return;
@ -43,6 +48,9 @@ public class AntiStack extends MiniPlugin
@EventHandler (priority=EventPriority.HIGHEST)
public void PlayerPickup(PlayerPickupItemEvent event)
{
if (!_enabled)
return;
if (event.isCancelled())
return;
@ -62,6 +70,9 @@ public class AntiStack extends MiniPlugin
@EventHandler
public void HopperPickup(InventoryPickupItemEvent event)
{
if (!_enabled)
return;
if (event.isCancelled())
return;
@ -77,4 +88,9 @@ public class AntiStack extends MiniPlugin
//Set Name
((CraftItemStack)item.getItemStack()).getHandle().c(name);
}
public void SetEnabled(boolean var)
{
_enabled = var;
}
}

View File

@ -246,7 +246,7 @@ public class Creature extends MiniPlugin
for (Player cur : players.keySet())
{
Vector vec = UtilAlg.getTrajectory(event.getEntity().getLocation(), cur.getLocation());
UtilAction.velocity(cur, vec, 1 + 3 * players.get(cur), false, 0, 1 + 1 * (players.get(cur)), 3, true);
UtilAction.velocity(cur, vec, 1 + 2 * players.get(cur), false, 0, 0.5 + 1 * (players.get(cur)), 2, true);
}
}

View File

@ -393,6 +393,9 @@ public class ItemStackFactory extends MiniPlugin
public void StatsArmorRename(ItemStack item, int damage)
{
if (!_customNames)
return;
if (item == null)
return;
@ -407,8 +410,11 @@ public class ItemStackFactory extends MiniPlugin
}
@EventHandler(priority = EventPriority.MONITOR)
public void StatsBowShoot(BlockBreakEvent event)
public void StatsBlockMined(BlockBreakEvent event)
{
if (!_customNames)
return;
if (event.isCancelled())
return;
@ -427,6 +433,9 @@ public class ItemStackFactory extends MiniPlugin
@EventHandler(priority = EventPriority.HIGHEST)
public void StatsKillMob(EntityDeathEvent event)
{
if (!_customNames)
return;
if (!(event.getEntity() instanceof Monster))
return;
@ -454,6 +463,9 @@ public class ItemStackFactory extends MiniPlugin
@EventHandler(priority = EventPriority.MONITOR)
public void StatsBowShoot(EntityShootBowEvent event)
{
if (!_customNames)
return;
if (event.isCancelled())
return;
@ -720,7 +732,6 @@ public class ItemStackFactory extends MiniPlugin
return CreateStack(type.getId(), data, amount, damage, name, lore, null);
}
//XXX
public ItemStack CreateStack(Material type, byte data, int amount, String name, List<String> lore, String owner)
{
return CreateStack(type.getId(), data, amount, (short)0, name, lore, owner);
@ -951,4 +962,14 @@ public class ItemStackFactory extends MiniPlugin
stack.setItemMeta(meta);
}
public void SetUseCustomNames(boolean var)
{
_customNames = var;
}
public void SetCustomNameFormat(String format)
{
_nameFormat = format;
}
}

View File

@ -67,7 +67,7 @@ public class Teleport extends MiniPlugin
LinkedList<Player> listA = new LinkedList<Player>();
//ALL
if (from.equals("%ALL%") && _clientManager.Get(caller).GetRank().Has(caller, Rank.OWNER, false))
if (from.equals("%ALL%"))
for (Player cur : UtilServer.getPlayers())
listA.add(cur);
//Normal

View File

@ -8,9 +8,11 @@ import net.minecraft.server.v1_6_R2.ItemStack;
import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftItemStack;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Fireball;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.plugin.java.JavaPlugin;
@ -23,6 +25,7 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
@ -58,6 +61,131 @@ public class CombatManager extends MiniPlugin
return _combatClients.get(name);
}
//This is a backup, for when CustomDamageEvent is disabled (manually)
@EventHandler(priority = EventPriority.MONITOR)
public void AddAttack(EntityDamageEvent event)
{
if (event.isCancelled())
return;
if (event.getEntity() == null || !(event.getEntity() instanceof Player))
return;
Player damagee = (Player)event.getEntity();
LivingEntity damagerEnt = UtilEvent.GetDamagerEntity(event, true);
//Attacked by Entity
if (damagerEnt != null)
{
if (damagerEnt instanceof Player)
Get((Player)damagerEnt).LastCombat = System.currentTimeMillis();
Get(damagee).Attacked(
UtilEnt.getName(damagerEnt),
event.getDamage(), damagerEnt,
event.getCause() + "");
}
// Damager is WORLD
else
{
DamageCause cause = event.getCause();
String source = "?";
String reason = "-";
if (cause == DamageCause.BLOCK_EXPLOSION)
{
source = "Explosion";
reason = "-";
} else if (cause == DamageCause.CONTACT)
{
source = "Cactus";
reason = "-";
} else if (cause == DamageCause.CUSTOM)
{
source = "Custom";
reason = "-";
} else if (cause == DamageCause.DROWNING)
{
source = "Water";
reason = "-";
} else if (cause == DamageCause.ENTITY_ATTACK)
{
source = "Entity";
reason = "Attack";
} else if (cause == DamageCause.ENTITY_EXPLOSION)
{
source = "Explosion";
reason = "-";
} else if (cause == DamageCause.FALL)
{
source = "Fall";
reason = "-";
} else if (cause == DamageCause.FALLING_BLOCK)
{
source = "Falling Block";
reason = "-";
} else if (cause == DamageCause.FIRE)
{
source = "Fire";
reason = "-";
} else if (cause == DamageCause.FIRE_TICK)
{
source = "Fire";
reason = "-";
} else if (cause == DamageCause.LAVA)
{
source = "Lava";
reason = "-";
} else if (cause == DamageCause.LIGHTNING)
{
source = "Lightning";
reason = "-";
} else if (cause == DamageCause.MAGIC)
{
source = "Magic";
reason = "-";
} else if (cause == DamageCause.MELTING)
{
source = "Melting";
reason = "-";
} else if (cause == DamageCause.POISON)
{
source = "Poison";
reason = "-";
} else if (cause == DamageCause.PROJECTILE)
{
source = "Projectile";
reason = "-";
} else if (cause == DamageCause.STARVATION)
{
source = "Starvation";
reason = "-";
} else if (cause == DamageCause.SUFFOCATION)
{
source = "Suffocation";
reason = "-";
} else if (cause == DamageCause.SUICIDE)
{
source = "Suicide";
reason = "-";
} else if (cause == DamageCause.VOID)
{
source = "Void";
reason = "-";
} else if (cause == DamageCause.WITHER)
{
source = "Wither";
reason = "-";
}
Get(damagee).Attacked(source,
event.getDamage(), null, reason);
}
}
public void AddAttack(CustomDamageEvent event)
{
// Not Player > No Log

View File

@ -9,6 +9,7 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
@ -48,6 +49,8 @@ public class DamageManager extends MiniPlugin
public boolean UseSimpleWeaponDamage = false;
public boolean DisableDamageChanges = false;
private boolean _enabled = true;
public DamageManager(JavaPlugin plugin, CombatManager combatManager, NpcManager npcManager, DisguiseManager disguiseManager)
{
super("Damage Manager", plugin);
@ -73,6 +76,9 @@ public class DamageManager extends MiniPlugin
@EventHandler(priority = EventPriority.HIGHEST)
public void StartDamageEvent(EntityDamageEvent event)
{
if (!_enabled)
return;
boolean preCancel = false;
if (event.isCancelled())
preCancel = true;
@ -82,7 +88,7 @@ public class DamageManager extends MiniPlugin
//Get Data
LivingEntity damagee = GetDamageeEntity(event);
LivingEntity damager = GetDamagerEntity(event, true);
LivingEntity damager = UtilEvent.GetDamagerEntity(event, true);
Projectile projectile = GetProjectile(event);
if (projectile instanceof Fish)
@ -95,8 +101,6 @@ public class DamageManager extends MiniPlugin
//New Event
NewDamageEvent(damagee, damager, projectile, event.getCause(), event.getDamage(), true, false, false, null, null, preCancel);
//event.setDamage(0);
//if (GoldPower(damager))
event.setCancelled(true);
}
@ -506,34 +510,6 @@ public class DamageManager extends MiniPlugin
event.setDamage(damage);
}
private LivingEntity GetDamagerEntity(EntityDamageEvent event, boolean ranged)
{
if (!(event instanceof EntityDamageByEntityEvent))
return null;
EntityDamageByEntityEvent eventEE = (EntityDamageByEntityEvent)event;
//Get Damager
if (eventEE.getDamager() instanceof LivingEntity)
return (LivingEntity)eventEE.getDamager();
if (!ranged)
return null;
if (!(eventEE.getDamager() instanceof Projectile))
return null;
Projectile projectile = (Projectile)eventEE.getDamager();
if (projectile.getShooter() == null)
return null;
if (!(projectile.getShooter() instanceof LivingEntity))
return null;
return (LivingEntity)projectile.getShooter();
}
private LivingEntity GetDamageeEntity(EntityDamageEvent event)
{
if (event.getEntity() instanceof LivingEntity)
@ -554,4 +530,9 @@ public class DamageManager extends MiniPlugin
return null;
}
public void SetEnabled(boolean var)
{
_enabled = var;
}
}

View File

@ -104,7 +104,7 @@ public class Arcade extends JavaPlugin implements INautilusPlugin, IPlugin
new MessageManager(this, _clientManager);
new AntiStack(this);
AntiStack antistack = new AntiStack(this);
GetCreature();
GetSpawn();
@ -118,7 +118,7 @@ public class Arcade extends JavaPlugin implements INautilusPlugin, IPlugin
_damageManager = new DamageManager(this, new CombatManager(this), new NpcManager(this, GetCreature()), disguiseManager);
//Arcade Manager
_gameManager = new ArcadeManager(this, ReadServerConfig(), _clientManager, _donationManager, conditionManager, _damageManager, disguiseManager, GetCreature(), GetBlood(), packetHandler);
_gameManager = new ArcadeManager(this, ReadServerConfig(), _clientManager, _donationManager, conditionManager, _damageManager, disguiseManager, GetCreature(), GetBlood(), antistack, packetHandler);
//Unreferenced Modules
//new AntiStack();

View File

@ -37,6 +37,7 @@ import mineplex.core.MiniPlugin;
import mineplex.core.itemstack.ItemStackFactory;
import me.chiss.Core.Modules.Blood;
import mineplex.core.account.CoreClientManager;
import mineplex.core.antistack.AntiStack;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.chat.Chat;
import mineplex.core.common.Rank;
@ -52,6 +53,7 @@ import mineplex.core.projectile.ProjectileManager;
public class ArcadeManager extends MiniPlugin implements IRelation
{
//Modules
private AntiStack _antistack;
private BlockRestore _blockRestore;
private Blood _blood;
private Chat _chat;
@ -83,13 +85,15 @@ public class ArcadeManager extends MiniPlugin implements IRelation
//Games
private Game _game;
public ArcadeManager(JavaPlugin plugin, GameServerConfig serverConfig, CoreClientManager clientManager, DonationManager donationManager, ConditionManager conditionManager, DamageManager damageManager, DisguiseManager disguiseManager, Creature creature, Blood blood, PacketHandler packetHandler)
public ArcadeManager(JavaPlugin plugin, GameServerConfig serverConfig, CoreClientManager clientManager, DonationManager donationManager, ConditionManager conditionManager, DamageManager damageManager, DisguiseManager disguiseManager, Creature creature, Blood blood, AntiStack antistack, PacketHandler packetHandler)
{
super("Game Manager", plugin);
_serverConfig = serverConfig;
//Modules
_antistack = antistack;
_blockRestore = new BlockRestore(plugin);
_blood = blood;
@ -162,6 +166,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation
return GetServerConfig().GameList;
}
public AntiStack GetAntiStack()
{
return _antistack;
}
public Blood GetBlood()
{
return _blood;
@ -456,12 +465,19 @@ public class ArcadeManager extends MiniPlugin implements IRelation
player.setGameMode(GameMode.SURVIVAL);
player.setAllowFlight(false);
UtilInv.Clear(player);
player.setFoodLevel(20);
player.setSaturation(3f);
player.setExhaustion(0f);
player.setHealth(20);
player.setFireTicks(0);
player.setFallDistance(0);
player.setLevel(0);
player.setExp(0f);
((CraftPlayer)player).getHandle().spectating = false;
((CraftPlayer)player).getHandle().m = true;

View File

@ -59,6 +59,8 @@ public class GameTeam
private int _spawnDistance = 0;
private boolean _visible = true;
public GameTeam(String name, ChatColor color, ArrayList<Location> spawns)
{
_name = name;
@ -295,4 +297,14 @@ public class GameTeam
_players.put(player, state);
}
}
public void SetVisible(boolean b)
{
_visible = b;
}
public boolean GetVisible()
{
return _visible;
}
}

View File

@ -1,13 +1,28 @@
package nautilus.game.arcade.game.games.barbarians;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import mineplex.core.common.util.UtilServer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.barbarians.kits.*;
import nautilus.game.arcade.kit.Kit;
public class Barbarians extends SoloGame
{
private GameTeam _barbs;
private GameTeam _pigs;
public Barbarians(ArcadeManager manager)
{
super(manager, GameType.Barbarians,
@ -16,7 +31,8 @@ public class Barbarians extends SoloGame
{
new KitBrute(manager),
new KitArcher(manager),
new KitBomber(manager)
new KitBomber(manager),
new KitPig(manager)
},
new String[]
@ -25,8 +41,11 @@ public class Barbarians extends SoloGame
"Wooden blocks are breakable.",
"Last player alive wins!"
});
this.DeathOut = false;
this.HungerSet = 20;
this.DamageTeamSelf = true;
this.CompassEnabled = true;
this.BlockBreakAllow.add(5);
this.BlockBreakAllow.add(17);
@ -47,4 +66,111 @@ public class Barbarians extends SoloGame
this.BlockBreakAllow.add(135);
this.BlockBreakAllow.add(136);
}
@Override
@EventHandler
public void CustomTeamGeneration(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Recruit)
return;
_barbs = this.GetTeamList().get(0);
_barbs.SetName("Barbarians");
//Undead Team
_pigs = new GameTeam("Dead", ChatColor.RED, _barbs.GetSpawns());
GetTeamList().add(_pigs);
_pigs.SetVisible(false);
RestrictKits();
}
@Override
public GameTeam ChooseTeam(Player player)
{
return _barbs;
}
@EventHandler
public void PlayerDeath(PlayerDeathEvent event)
{
if (_barbs.HasPlayer(event.getEntity()))
SetChaser(event.getEntity());
}
public void SetChaser(Player player)
{
if (!GetPlaces().contains(player))
GetPlaces().add(0, player);
SetPlayerTeam(player, _pigs);
//Kit
Kit newKit = GetKits()[3];
SetKit(player, newKit, false);
newKit.ApplyKit(player);
//Refresh
for (Player other : UtilServer.getPlayers())
{
other.hidePlayer(player);
other.showPlayer(player);
}
}
@Override
public void EndCheck()
{
if (!IsLive())
return;
if (_barbs.GetPlayers(true).size() <= 1)
{
if (_barbs.GetPlayers(true).size() == 1)
GetPlaces().add(0, GetPlayers(true).get(0));
if (GetPlaces().size() >= 1)
AddGems(GetPlaces().get(0), 15, "1st Place", false);
if (GetPlaces().size() >= 2)
AddGems(GetPlaces().get(1), 10, "2nd Place", false);
if (GetPlaces().size() >= 3)
AddGems(GetPlaces().get(2), 5, "3rd Place", false);
for (Player player : GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
SetState(GameState.End);
AnnounceEnd(GetPlaces());
}
}
@Override
@EventHandler
public void ScoreboardUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
if (_barbs == null || _pigs == null)
return;
GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(_barbs.GetColor() + _barbs.GetName())).setScore(_barbs.GetPlayers(true).size());
GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(_pigs.GetColor() + _pigs.GetName())).setScore(_pigs.GetPlayers(true).size());
}
@Override
public boolean CanJoinTeam(GameTeam team)
{
return (team.GetColor() != ChatColor.RED);
}
@EventHandler
public void BlockBreak(BlockDamageEvent event)
{
event.setInstaBreak(true);
}
}

View File

@ -58,6 +58,8 @@ public class DeathTag extends SoloGame
this.HungerSet = 20;
this.CompassEnabled = true;
this.PrepareFreeze = false;
}
@Override
@ -165,7 +167,7 @@ public class DeathTag extends SoloGame
if (event.getType() != UpdateType.FAST)
return;
int req = 1 + _runners.GetPlayers(true).size()/20;
int req = 1 + (int) ((System.currentTimeMillis() - GetStateTime()) / 30000);
while (_chasers.GetPlayers(true).size() < req && _runners.GetPlayers(true).size() > 0)
{
@ -216,6 +218,7 @@ public class DeathTag extends SoloGame
}
UtilPlayer.message(player, C.cRed + C.Bold + "You are now a Chaser!");
UtilPlayer.message(player, C.cRed + C.Bold + "KILL THEM ALL!!!!!!");
}
@Override

View File

@ -20,10 +20,12 @@ import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
@ -38,6 +40,8 @@ public class DragonEscape extends SoloGame
private ArrayList<DragonScore> _ranks = new ArrayList<DragonScore>();
private ArrayList<String> _lastScoreboard = new ArrayList<String>();
private NautHashMap<Player, Long> _warpTime = new NautHashMap<Player, Long>();
private Location _dragon;
private ArrayList<Location> _waypoints;
@ -175,9 +179,12 @@ public class DragonEscape extends SoloGame
//Shortcut
if (postNode - preNode >= 2)
{
score.Player.damage(500);
UtilPlayer.message(player, F.main("Game", "You were killed for trying to cheat!"));
return false;
if (!_warpTime.containsKey(score.Player) || UtilTime.elapsed(_warpTime.get(score.Player), 1000))
{
score.Player.damage(500);
UtilPlayer.message(player, F.main("Game", "You were killed for trying to cheat!"));
return false;
}
}
//Finish
@ -210,8 +217,6 @@ public class DragonEscape extends SoloGame
return score;
}
public int GetWaypointIndex(Location loc)
{
int best = -1;
@ -281,7 +286,7 @@ public class DragonEscape extends SoloGame
_lastScoreboard.add(out);
GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(out)).setScore((int)score.Score); //16-i
GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(out)).setScore(16-i);
}
}
@ -413,6 +418,9 @@ public class DragonEscape extends SoloGame
player.setVelocity(new Vector(0,0,0));
player.setFallDistance(0);
//Record
_warpTime.put(player, System.currentTimeMillis());
//Inform
UtilPlayer.message(player, F.main("Game", "You warped to " + F.name(target.getName()) + "!"));

View File

@ -20,7 +20,7 @@ public class KitWarper extends Kit
new String[]
{
"Use your Enderpearl to instantlyy warp",
"Use your Enderpearl to instantly warp",
"to the player in front of you!"
},

View File

@ -26,6 +26,7 @@ import org.bukkit.scoreboard.Objective;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.updater.UpdateType;
@ -317,7 +318,7 @@ public class MilkCow extends SoloGame
SetScore(event.getPlayer(), GetScore(event.getPlayer())+1);
event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.BURP, 2f, 1f);
Manager.GetCondition().Factory().Regen("Drink Milk", event.getPlayer(), event.getPlayer(), 6, 1, false, false, false);
UtilPlayer.health(event.getPlayer(), 8);
}
public void SetScore(Player player, double level)
@ -331,7 +332,7 @@ public class MilkCow extends SoloGame
{
score.Score = level;
if (level == 6)
if (level == 15)
End();
return;

View File

@ -20,7 +20,7 @@ public class KitCow extends SmashKit
{
public KitCow(ArcadeManager manager)
{
super(manager, "The Disgusting Cow", KitAvailability.Blue,
super(manager, "The Angry Cow", KitAvailability.Free,
new String[]
{
@ -28,7 +28,7 @@ public class KitCow extends SmashKit
new Perk[]
{
new PerkDamageSet(4),
new PerkDamageSet(5),
new PerkKnockbackMultiplier(4),
new PerkCharge(),
new PerkCowBomb(),

View File

@ -30,7 +30,7 @@ public class KitFarmerJump extends Kit
new PerkDoubleJump("Double Jump", 1, 0.8, false)
},
EntityType.VILLAGER,
EntityType.ZOMBIE,
new ItemStack(Material.IRON_HOE));
}

View File

@ -123,6 +123,7 @@ public class KitKnight extends SmashKit
_horses.add(horse);
_mounts.put(player, horse);
/*
final Player fPlayer = player;
Manager.GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable()
@ -132,6 +133,7 @@ public class KitKnight extends SmashKit
horse.setPassenger(fPlayer);
}
}, 1);
*/
}
@EventHandler

View File

@ -18,10 +18,10 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.scoreboard.Score;
import mineplex.core.common.util.C;
@ -221,16 +221,12 @@ public class TurfForts extends TeamGame
}
@EventHandler
public void BowCancel(PlayerInteractEvent event)
public void BowCancel(EntityShootBowEvent event)
{
if (!_fight)
{
if (UtilGear.isMat(event.getPlayer().getItemInHand(), Material.BOW))
{
event.setCancelled(true);
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot attack during Build Time!"));
}
event.setCancelled(true);
UtilPlayer.message(event.getEntity(), F.main("Game", "You cannot attack during Build Time!"));
}
}
@ -513,9 +509,12 @@ public class TurfForts extends TeamGame
for (Player player : team.GetPlayers(true))
{
Block block = player.getLocation().getBlock().getRelative(BlockFace.DOWN);
while (block.getTypeId() == 0)
while (block.getTypeId() == 0 && block.getY() > 0)
block = block.getRelative(BlockFace.DOWN);
if (block.getTypeId() == 0)
continue;
byte data = block.getData();
//Slow

View File

@ -26,7 +26,7 @@ public class KitInfiltrator extends Kit
new Perk[]
{
new PerkConstructor("Constructor", 4, 4, Material.WOOL, "Wool", false),
new PerkFletcher(12, 1, false),
new PerkFletcher(8, 1, false),
},
EntityType.ZOMBIE,
new ItemStack(Material.IRON_SWORD));

View File

@ -25,7 +25,7 @@ public class KitMarksman extends Kit
new Perk[]
{
new PerkConstructor("Constructor", 4, 8, Material.WOOL, "Wool", false),
new PerkFletcher(4, 2, false),
new PerkFletcher(2, 2, false),
},
EntityType.ZOMBIE,

View File

@ -1,6 +1,7 @@
package nautilus.game.arcade.game.games.uhc;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import org.bukkit.ChatColor;
@ -10,6 +11,7 @@ import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.World.Environment;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Entity;
@ -21,6 +23,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
@ -28,7 +31,6 @@ import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.event.inventory.PrepareItemCraftEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerItemConsumeEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerKickEvent;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerMoveEvent;
@ -45,6 +47,8 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.MapUtil;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
@ -62,7 +66,6 @@ import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.CombatLog;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeFormat;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
@ -103,11 +106,6 @@ public class UHC extends TeamGame
"Last team alive wins!"
});
// Flags
this.DamagePvP = false;
this.DamageSelf = true;
this.DamageTeamSelf = true;
this.DeathDropItems = true;
this.ItemDrop = true;
@ -146,8 +144,8 @@ public class UHC extends TeamGame
//Disable Custom Mob Drops (and EXP Disable)
Manager.GetCreature().SetDisableCustomDrops(true);
//Disable Weapon Damage Mods
Manager.GetDamage().DisableDamageChanges = true;
//Disable Anti-Stack
Manager.GetAntiStack().SetEnabled(false);
}
@ -214,6 +212,9 @@ public class UHC extends TeamGame
if (event.GetState() != GameState.Prepare)
return;
//Disable Damage Manager
Manager.GetDamage().SetEnabled(false);
WorldData.World.setTime(2000);
//Kill Mobs
@ -234,18 +235,11 @@ public class UHC extends TeamGame
Manager.GetCondition().Factory().Blind("Start Blind", player, player, 8, 1, false, false, false);
Manager.GetCondition().Factory().Slow("Start Slow", player, player, 8, 4, false, false, false, false);
player.setSaturation(0f);
player.setSaturation(3f);
player.setExhaustion(0f);
}
}
@EventHandler
public void PlayerJoinMap(PlayerJoinEvent event)
{
//event.getPlayer().getInventory().remove(Material.MAP);
//event.getPlayer().getInventory().addItem(_map.GetMap());
}
@EventHandler
public void WorldBoundaryCheck(PlayerMoveEvent event)
{
@ -363,7 +357,7 @@ public class UHC extends TeamGame
for (GameTeam team : GetTeamList())
{
Location loc = WorldData.World.getHighestBlockAt(-1000 + UtilMath.r(2000), -1000 + UtilMath.r(2000)).getLocation();
Location loc = GetRandomSpawn(null);
//Ensure 250 Blocks between Teams
while (true)
@ -385,20 +379,58 @@ public class UHC extends TeamGame
if (!clash)
break;
loc = WorldData.World.getHighestBlockAt(-1000 + UtilMath.r(2000), -1000 + UtilMath.r(2000)).getLocation();
loc = GetRandomSpawn(null);
}
team.GetSpawns().add(loc);
while (team.GetSpawns().size() < 5)
{
Location other = WorldData.World.getHighestBlockAt(loc.getBlockX() - 5 + UtilMath.r(10), loc.getBlockZ() - 5 + UtilMath.r(10)).getLocation();
Location other = GetRandomSpawn(loc);
team.GetSpawns().add(other);
}
}
}
public Location GetRandomSpawn(Location around)
{
HashSet<Material> ignore = new HashSet<Material>();
ignore.add(Material.LEAVES);
Location loc = null;
while (loc == null)
{
Block block = null;
//Get Team Location
if (around == null)
{
block = UtilBlock.getHighest(WorldData.World, -900 + UtilMath.r(1800), -900 + UtilMath.r(1800), ignore);
}
//Get Radius Location
else
{
block = UtilBlock.getHighest(WorldData.World, around.getBlockX() - 5 + UtilMath.r(10), around.getBlockZ() - 5 + UtilMath.r(10), ignore);
}
//Check Validity
//Liquid
if (block.getRelative(BlockFace.DOWN).isLiquid())
continue;
//Suffocated
if (block.getTypeId() != 0 || block.getRelative(BlockFace.UP).getTypeId() != 0)
continue;
loc = block.getLocation().add(0.5, 0, 0.5);
}
return loc;
}
@EventHandler
public void GhastDrops(EntityDeathEvent event)
{
@ -421,7 +453,9 @@ public class UHC extends TeamGame
event.getDrops().add(ItemStackFactory.Instance.CreateStack(Material.SKULL, (byte)3, 1, team.GetColor() + player.getName() + "'s Head"));
//Lightning
player.getWorld().strikeLightningEffect(player.getLocation());
Location loc = player.getLocation();
loc.setY(-150);
player.getWorld().strikeLightningEffect(loc);
//Time
_deathTime.put(player.getName(), System.currentTimeMillis());
@ -529,25 +563,61 @@ public class UHC extends TeamGame
}
@EventHandler
public void DamageRecord(CustomDamageEvent event)
public void DamageRecord(EntityDamageEvent event)
{
if (event.IsCancelled())
if (event.isCancelled())
return;
Player damagee = event.GetDamageePlayer();
if (damagee == null) return;
LivingEntity damagerEnt = UtilEvent.GetDamagerEntity(event, true);
Player damager = event.GetDamagerPlayer(true);
if (damager == null) return;
//No PvP
if (_gameMinutes < 20)
{
if (damagerEnt != null && damagerEnt instanceof Player && event.getEntity() instanceof Player)
{
event.setCancelled(true);
return;
}
}
_combatTime.put(damagee, System.currentTimeMillis());
_combatTime.put(damager, System.currentTimeMillis());
}
//Damager
if (damagerEnt != null)
{
if (damagerEnt instanceof Player)
{
Player damager = (Player)damagerEnt;
@EventHandler(priority = EventPriority.LOWEST)
public void DamageToLevelDisable(CustomDamageEvent event)
{
event.SetDamageToLevel(false);
//Damager Not Alive
if (!IsAlive(damager))
{
event.setCancelled(true);
return;
}
//Damager Alive
else
{
_combatTime.put(damager, System.currentTimeMillis());
}
}
}
//Damagee
if (event.getEntity() instanceof Player)
{
Player damagee = (Player)event.getEntity();
//Damagee Not Alive
if (!IsAlive(damagee))
{
event.setCancelled(true);
return;
}
//Damagee Alive
else if (damagerEnt != null && damagerEnt instanceof Player)
{
_combatTime.put(damagee, System.currentTimeMillis());
}
}
}
@EventHandler
@ -888,34 +958,40 @@ public class UHC extends TeamGame
}
@EventHandler
public void SpecialDamage(CustomDamageEvent event)
public void SpecialDamage(EntityDamageEvent event)
{
if (event.IsCancelled())
if (event.isCancelled())
return;
Player player = event.GetDamageePlayer();
if (player != null)
//Damager
LivingEntity damagerEnt = UtilEvent.GetDamagerEntity(event, true);
if (damagerEnt != null)
{
GameTeam team = GetTeam(player);
if (team != null)
if (damagerEnt instanceof Player)
{
if (team.GetColor() == ChatColor.DARK_GRAY)
Player damager = (Player)damagerEnt;
GameTeam team = GetTeam(damager);
if (team != null && team.GetColor() == ChatColor.DARK_GRAY)
{
event.SetCancelled("Special Cancel");
event.setCancelled(true);
return;
}
}
}
player = event.GetDamagerPlayer(true);
if (player != null)
//Damagee
if (event.getEntity() instanceof Player)
{
GameTeam team = GetTeam(player);
if (team != null)
Player damagee = (Player)event.getEntity();
GameTeam team = GetTeam(damagee);
if (team != null && team.GetColor() == ChatColor.DARK_GRAY)
{
if (team.GetColor() == ChatColor.DARK_GRAY)
{
event.SetCancelled("Special Cancel");
}
event.setCancelled(true);
return;
}
}
}
@ -993,17 +1069,22 @@ public class UHC extends TeamGame
if (((int)player.getHealth()) % 2 == 0)
health += (int)(player.getHealth()/2);
else
health += player.getHealth()/2d;
health += UtilMath.trim(1, player.getHealth()/2d);
String name = team.GetColor() + player.getName();
int length = 16 - (name.length() + health.length());
if (length < 0)
try
{
name = name.substring(0, name.length() + length);
}
while (name.length() + health.length() > 16)
name = name.substring(0, name.length()-1);
player.setPlayerListName(name + health);
player.setPlayerListName(name + health);
}
catch (Exception e)
{
System.out.println("TAB NAME: " + name + health);
e.printStackTrace();
}
}
}
@ -1140,6 +1221,18 @@ public class UHC extends TeamGame
if (team.GetColor() != ChatColor.DARK_GRAY)
if (team.GetPlayers(true).size() > 0)
teamsAlive.add(team);
/*
{
for (Player player : team.GetPlayers(true))
{
if (player.isOnline())
{
teamsAlive.add(team);
break;
}
}
}
*/
if (teamsAlive.size() <= 1)
{

View File

@ -43,7 +43,7 @@ public class PerkCharge extends Perk
if (!Kit.HasKit(player))
continue;
player.getWorld().playSound(player.getLocation(), Sound.COW_WALK, 2f, 1f);
player.getWorld().playSound(player.getLocation(), Sound.COW_WALK, 0.8f, 1f);
Manager.GetCondition().Factory().Speed(GetName(), player, player, 0.9, 2, false, false, false);
@ -63,7 +63,7 @@ public class PerkCharge extends Perk
//Damage Event
Manager.GetDamage().NewDamageEvent(cur, player, null,
DamageCause.CUSTOM, 2, false, false, false,
DamageCause.CUSTOM, 3, false, false, false,
player.getName(), GetName());
//Velocity

View File

@ -9,6 +9,7 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.Vector;
@ -191,4 +192,15 @@ public class PerkCreeperExplode extends Perk
event.AddKnockback(GetName(), 2.5);
}
@EventHandler
public void Death(PlayerDeathEvent event)
{
if (!Kit.HasKit(event.getEntity()))
return;
_active.remove(event.getEntity());
DecreaseSize(event.getEntity());
}
}

View File

@ -139,9 +139,10 @@ public class GameCreationManager implements Listener
private void CreateGame(GameType gameType)
{
//Reset Damage Changes
//Reset Changes
Manager.GetDamage().DisableDamageChanges = false;
Manager.GetCreature().SetDisableCustomDrops(false);
Manager.GetDamage().SetEnabled(true);
HashMap<String, ChatColor> pastTeams = null;

View File

@ -166,12 +166,8 @@ public class GameFlagManager implements Listener
if (game == null || !game.IsAlive(player) || game.GetState() != GameState.Live)
{
if (player.isOp() && player.getGameMode() == GameMode.CREATIVE)
{
return;
}
event.setCancelled(true);
return;
}

View File

@ -304,7 +304,11 @@ public class GameLobbyManager implements IPacketRunnable, Listener
if (game.GetKits().length > 1 || game.GetType() != GameType.UHC)
{
//Display
ArrayList<GameTeam> teams = game.GetTeamList();
ArrayList<GameTeam> teams = new ArrayList<GameTeam>();
for (GameTeam team : game.GetTeamList())
if (team.GetVisible())
teams.add(team);
//Positions
double space = 6;
@ -410,12 +414,8 @@ public class GameLobbyManager implements IPacketRunnable, Listener
_teams.put(ent, new LobbyEnt(ent, entLoc, teamsB.get(i)));
}
}
}
CreateScoreboards();
}