Merge branch 'master' of http://184.154.0.242:7990/scm/min/mineplex into SSM2PlayerTeams

This commit is contained in:
Sarah 2015-07-30 03:07:41 +02:00
commit 30fa3b3309
42 changed files with 3222 additions and 1817 deletions

View File

@ -51,7 +51,7 @@ public enum GameDisplay
SquidShooter("Squid Shooter", Material.FIREWORK_CHARGE, (byte)0, GameCategory.ARCADE, 43),
Stacker("Super Stacker", Material.BOWL, (byte)0, GameCategory.ARCADE, 42),
SurvivalGames("Survival Games", Material.IRON_SWORD, (byte)0, GameCategory.SURVIVAL, 22),
SurvivalGamesTeams("Survival Games Teams", Material.IRON_SWORD, (byte)0, GameCategory.TEAM_VARIANT, 23),
SurvivalGamesTeams("Survival Games", Material.IRON_SWORD, (byte)0, GameCategory.TEAM_VARIANT, 23),
Tug("Tug of Wool", Material.WHEAT, (byte)0, GameCategory.ARCADE, 44),
TurfWars("Turf Wars", Material.STAINED_CLAY, (byte)14, GameCategory.ARCADE, 45),
UHC("Ultra Hardcore", Material.GOLDEN_APPLE, (byte)0, GameCategory.SURVIVAL, 46),
@ -61,8 +61,8 @@ public enum GameDisplay
Build("Master Builders", Material.WOOD, (byte)0, GameCategory.CLASSICS, 50),
Cards("Craft Against Humanity", Material.MAP, (byte)0, GameCategory.CLASSICS, 51),
Skywars("Skywars", Material.FEATHER, (byte) 0, GameCategory.SURVIVAL, 52),
SkywarsTeams("Skywars Teams", Material.FEATHER, (byte)5, GameCategory.TEAM_VARIANT, 53),
Skywars("Skywars", "Skywars", Material.FEATHER, (byte) 0, GameCategory.SURVIVAL, 52),
SkywarsTeams("Skywars Teams", "Skywars",Material.FEATHER, (byte)5, GameCategory.TEAM_VARIANT, 53),
Event("Mineplex Event", Material.CAKE, (byte)0, GameCategory.EVENT, 999);

View File

@ -1,6 +1,7 @@
package mineplex.core.recharge;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import org.bukkit.entity.Player;
@ -218,6 +219,26 @@ public class Recharge extends MiniPlugin
{
_recharge.put(player.getName(), new NautHashMap<String, RechargeData>());
}
public void Reset(Player player, String stringContains)
{
NautHashMap<String, RechargeData> data = _recharge.get(player.getName());
if (data == null)
return;
Iterator<String> rechargeIter = data.keySet().iterator();
while (rechargeIter.hasNext())
{
String key = rechargeIter.next();
if (key.toLowerCase().contains(stringContains.toLowerCase()))
{
rechargeIter.remove();
}
}
}
public void debug(Player player, String ability)
{

View File

@ -1,5 +1,6 @@
package nautilus.game.arcade;
import java.awt.Event;
import java.io.File;
import java.util.ArrayList;
import java.util.HashSet;
@ -110,6 +111,7 @@ import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.GameServerConfig;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.event.EventModule;
import nautilus.game.arcade.game.games.uhc.UHC;
import nautilus.game.arcade.managers.GameAchievementManager;
import nautilus.game.arcade.managers.GameChatManager;
@ -143,6 +145,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
private Creature _creature;
private DamageManager _damageManager;
private Explosion _explosionManager;
private EventModule _eventManager;
private Fire _fire;
private ProjectileManager _projectileManager;
@ -257,6 +260,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
_cosmeticManager = cosmeticManager;
_portal = portal;
_petManager = petManager;
_eventManager = new EventModule(this, getPlugin());
// Shop
_arcadeShop = new ArcadeShop(this, clientManager, donationManager);
@ -562,6 +566,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation
return _gameWorldManager;
}
public EventModule GetEventModule()
{
return _eventManager;
}
public PreferencesManager getPreferences()
{
return _preferencesManager;
@ -818,6 +827,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, C.Bold + "Server has reached max capacity for gameplay purposes.");
return;
}
else if (_gameHostManager.isEventServer() && Bukkit.getServer().getOnlinePlayers().size() >= 128)
{
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, C.Bold + "Server has reached max capacity for gameplay purposes.");
return;
}
event.allow();
event.setResult(PlayerLoginEvent.Result.ALLOWED);

View File

@ -136,14 +136,14 @@ public class GameTeam
//Spawn near players
if (Host.SpawnNearEnemies)
{
Location loc = UtilAlg.getLocationAwayFromPlayers(_spawns, Host.GetPlayers(true));
Location loc = UtilAlg.getLocationNearPlayers(_spawns, Host.GetPlayers(true), Host.GetPlayers(true));
if (loc != null)
return loc;
}
//Spawn away from players
else
{
Location loc = UtilAlg.getLocationNearPlayers(_spawns, Host.GetPlayers(true), Host.GetPlayers(true));
Location loc = UtilAlg.getLocationAwayFromPlayers(_spawns, Host.GetPlayers(true));
if (loc != null)
return loc;
}

View File

@ -1927,14 +1927,7 @@ public class MineStrike extends TeamGame
{
player.playSound(player.getLocation(), Sound.LEVEL_UP, 1f, 1f);
//Clear reloading things
for (String recharge : Recharge.Instance.Get(player).keySet())
{
if (!recharge.toLowerCase().contains("reload"))
continue;
Recharge.Instance.recharge(player, recharge);
}
Recharge.Instance.Reset(player, "reload");
}
UtilTextMiddle.display(null, winnerLine, 20, 120, 20);

View File

@ -160,8 +160,6 @@ public abstract class Skywars extends Game
WorldTimeSet = 0;
WorldBoundaryKill = false;
SpawnNearAllies = true;
DamageSelf = true;
DamageTeamSelf = true;

View File

@ -170,4 +170,9 @@ public class SoloSkywars extends Skywars
return losers;
}
@Override
public String GetMode()
{
return "Solo Mode";
}
}

View File

@ -468,4 +468,9 @@ public class TeamSkywars extends Skywars
return null;
}
@Override
public String GetMode()
{
return "Team Mode";
}
}

View File

@ -154,4 +154,9 @@ public class SoloSuperSmash extends SuperSmash
return losers;
}
@Override
public String GetMode()
{
return "Solo Mode";
}
}

View File

@ -120,8 +120,6 @@ public abstract class SuperSmash extends Game
this.DeathSpectateSecs = 4;
this.SpawnNearAllies = true;
this.WorldWaterDamage = 1000;
this.HideTeamSheep = true;
@ -180,7 +178,7 @@ public abstract class SuperSmash extends Game
if (lives > 0)
{
UtilPlayer.message(player, C.cRed + C.Bold + "You have died!");
UtilPlayer.message(player, C.cRed + C.Bold + "You have " + lives + (lives == 1 ? "life" : "lives") + " left!");
UtilPlayer.message(player, C.cRed + C.Bold + "You have " + lives + " " + (lives == 1 ? "life" : "lives") + " left!");
player.playSound(player.getLocation(), Sound.NOTE_BASS_GUITAR, 2f, 0.5f);
_lives.put(player, lives);
@ -493,10 +491,4 @@ public abstract class SuperSmash extends Game
int amount = Math.max(1, (int)(event.GetDamage()/2));
UtilPlayer.hunger(damager, amount);
}
public String GetMode()
{
return "Deathmatch";
}
}

View File

@ -413,4 +413,10 @@ public class TeamSuperSmash extends SuperSmash
return null;
}
@Override
public String GetMode()
{
return "Team Mode";
}
}

View File

@ -1,9 +1,12 @@
package nautilus.game.arcade.game.games.snowfight;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
@ -25,6 +28,7 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.minecraft.game.core.explosion.CustomExplosion;
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.TeamGame;
import nautilus.game.arcade.game.games.snowfight.kits.KitTactician;
@ -57,6 +61,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
@ -72,38 +77,53 @@ import org.bukkit.potion.PotionType;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
import com.sun.xml.internal.bind.v2.runtime.unmarshaller.XsiNilLoader.Array;
public class SnowFight extends TeamGame
{
private HashMap<Player, Integer> _tiles;
private boolean _meteoroids;
private boolean _peace;
public SnowFight(ArcadeManager manager)
{
super(manager, GameType.SnowFight,
new Kit[]
{
new KitSportsman(manager),
new KitTactician(manager),
new KitMedic(manager)
},
new Kit[]
{
new KitSportsman(manager),
new KitTactician(manager),
new KitMedic(manager)
},
new String[]
{
"Just like... kill your enemies. with snow.",
"Be careful if you are on Ice your body will freeze"
});
new String[]
{
"Just like... kill your enemies. with snow.",
"Be careful if you are on Ice your body will freeze"
});
this.HungerSet = 20;
this.CompassEnabled = true;
this.CompassGiveItem = false;
this.TeamArmor = true;
this.TeamArmorHotbar = true;
this.BlockPlace = true;
this.BlockBreakAllow = new HashSet<>(Arrays.asList(Material.FENCE.getId()));
this._tiles = new HashMap<Player, Integer>();
this._meteoroids = false;
this._peace = false;
}
@EventHandler
public void GameState(GameStateChangeEvent event)
{
if(event.GetState() != GameState.Live)
return;
this.Announce(C.cRed + C.Bold + "ALERT: " + ChatColor.RESET + C.Bold + "15 seconds Peace Phase is starting!");
}
@EventHandler
public void Weather(UpdateEvent event)
{
@ -120,33 +140,10 @@ public class SnowFight extends TeamGame
world.setWeatherDuration(40);
world.setTime(4000);
}
@EventHandler
public void KitItems(UpdateEvent event)
{
if(!IsLive())
return;
if (event.getType() == UpdateType.SLOWER)
{
for (Player player : GetPlayers(true))
{
if (GetKit(player) instanceof KitTactician)
{
int amount = 0;
if (player.getInventory().getItem(1) != null && player.getInventory().getItem(1).getAmount() <= 2)
amount = 2;
else
amount = 1;
player.getInventory().setItem(1, ItemStackFactory.Instance.CreateStack(Material.EGG, (byte) 0, amount, "Slow Egg"));
}
}
}
}
@EventHandler
public void IceDamage(UpdateEvent event) {
if(event.getType() != UpdateType.SEC)
if(event.getType() != UpdateType.FAST)
return;
if(!IsLive())
@ -156,7 +153,7 @@ public class SnowFight extends TeamGame
{
if(IsOnIce(player))
{
Bukkit.getPluginManager().callEvent(new CustomDamageEvent(player, null, null, DamageCause.CUSTOM, 4.0D, false, true, true, "Ice", "Ice", false));
Bukkit.getPluginManager().callEvent(new CustomDamageEvent(player, null, null, DamageCause.CUSTOM, 2.0D, false, true, true, "Ice", "Ice", false));
}
}
@ -170,7 +167,21 @@ public class SnowFight extends TeamGame
if(!IsLive())
return;
if(System.currentTimeMillis() <= getGameLiveTime() + (4 * 60 * 1000))
if(System.currentTimeMillis() <= getGameLiveTime() + (15 * 1000))
return;
if(!_peace)
{
for(Player player : GetPlayers(false))
{
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1F, 1F);
UtilTextMiddle.display(C.cGold + C.Bold + "Peace Phase ended", "Kill your enemies", player);
}
this.Announce(C.cRed + C.Bold + "ALERT: " + ChatColor.RESET + C.Bold + "Peace Phase ended");
_peace = true;
}
if(System.currentTimeMillis() <= getGameLiveTime() + (195 * 1000))
return;
if(!_meteoroids)
@ -356,12 +367,19 @@ public class SnowFight extends TeamGame
public void GenerallDamage(CustomDamageEvent event)
{
if(event.GetCause() == DamageCause.ENTITY_ATTACK)
event.AddMod(event.GetDamagerPlayer(false).getName(), "Melee", 1, true);
event.SetCancelled("No Melee");
}
@EventHandler(priority = EventPriority.HIGH)
public void SnowballEggDamage(CustomDamageEvent event)
{
if(!_peace)
{
event.SetCancelled("Peace Phase");
return;
}
if (event.IsCancelled())
return;
@ -374,13 +392,6 @@ public class SnowFight extends TeamGame
if(proj instanceof Fireball)
return;
if(proj instanceof Egg)
{
event.GetDamageePlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 100, 1));
event.GetDamageePlayer().addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 40, 0));
event.AddMod("Egg", "Egg", 3, true);
}
if(proj instanceof Snowball)
event.AddMod("Snowball", "Snowball", 2, true);
@ -464,33 +475,45 @@ public class SnowFight extends TeamGame
{
Entity projectile = event.getEntity();
int size = 3;
float size = 2.5F;
double damage = 2.5D;
for(int i = 1; i <= 10; i++)
{
if(System.currentTimeMillis() >= getGameLiveTime() + (((30 * i) + 300) * 1000))
if(System.currentTimeMillis() >= getGameLiveTime() + (((30 * i) + 180) * 1000))
{
size = 3 * i;
size = 2.5F * i;
damage = 2.5D * i;
}
}
if (projectile.hasMetadata("Meteor"))
{
projectile.remove();
CustomExplosion explosion = new CustomExplosion(getArcadeManager().GetDamage(), getArcadeManager().GetExplosion(),
projectile.getLocation(), size, "Meteor");
explosion.setBlockExplosionSize(size);
explosion.setFallingBlockExplosionAmount(20);
explosion.setFallingBlockExplosion(false);
explosion.setDropItems(false);
explosion.setBlocksDamagedEqually(true);
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, projectile.getLocation(), 1.0F, 1.0F, 1.0F, 1, 3, ViewDist.MAX, UtilServer.getPlayers());
for(Player player : UtilServer.getPlayers()) {
player.playSound(projectile.getLocation(), Sound.EXPLODE, 1, 1);
}
boolean fall = true;
for(Entity player : projectile.getNearbyEntities(size, size, size))
{
if(player instanceof Player)
{
Player damagee = (Player) player;
Bukkit.getPluginManager().callEvent(new CustomDamageEvent(damagee, null, null, DamageCause.CUSTOM, damage, false, true, true, "Ice Meteoroid", "Ice Meteoroid", false));
}
}
for(Block block : UtilBlock.getInRadius(event.getEntity().getLocation(), size).keySet())
{
if(block.getType() != Material.AIR)
@ -498,7 +521,16 @@ public class SnowFight extends TeamGame
block.setType(Material.ICE);
if(block.getRelative(BlockFace.DOWN).getType() == Material.AIR)
{
block.getWorld().spawnFallingBlock(block.getLocation(), block.getType(), block.getData());
// to reduce lag
if(fall)
{
block.getWorld().spawnFallingBlock(block.getLocation(), block.getType(), block.getData());
fall = false;
}
else
{
fall = true;
}
block.setType(Material.AIR);
}
}
@ -537,6 +569,18 @@ public class SnowFight extends TeamGame
return null;
}
@EventHandler
public void Place(BlockPlaceEvent event)
{
if(event.getBlock().getRelative(BlockFace.DOWN).getType() == Material.ICE
|| event.getBlock().getRelative(BlockFace.DOWN).getType() == Material.PACKED_ICE
|| event.getBlock().getRelative(BlockFace.DOWN).getType() == Material.FENCE)
{
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cant place a Barrier here!"));
event.setCancelled(true);
}
}
@Override
@EventHandler
public void ScoreboardUpdate(UpdateEvent event)
@ -569,7 +613,7 @@ public class SnowFight extends TeamGame
}
}
long time = 1000 * 60 * 4 - (System.currentTimeMillis() - this.GetStateTime());
long time = 1000 * 195 - (System.currentTimeMillis() - this.GetStateTime());
if (time > 0)
{

View File

@ -1,6 +1,10 @@
package nautilus.game.arcade.game.games.snowfight.kits;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
@ -8,12 +12,19 @@ import nautilus.game.arcade.kit.Perk;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.entity.Egg;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.PotionSplashEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.potion.Potion;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.potion.PotionType;
public class KitMedic extends Kit
@ -31,8 +42,10 @@ public class KitMedic extends Kit
"Left-Click Snow to pick up Snowballs (Max. 16)",
"Right-Click Snowballs to throw them.",
" ",
"Has 5 Healing Potions.",
"Right-Click Potions to throw them and heal nearby Players."
"Gets 1 Healing Potion every 32 seconds [max. 1]",
"Slowness II when hit.",
" ",
"Supports all nearby allies with REGENERATION."
},
new Perk[]
@ -48,12 +61,7 @@ public class KitMedic extends Kit
public void GiveItems(Player player)
{
player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
Potion potion = new Potion(PotionType.INSTANT_HEAL);
potion.setLevel(2);
potion.setSplash(true);
for(int i = 3; i <= 7; i++) {
player.getInventory().setItem(i, potion.toItemStack(1));
}
player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
}
@Override
@ -65,4 +73,68 @@ public class KitMedic extends Kit
ent.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS));
}
@EventHandler
public void Aura(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!HasKit(player))
continue;
for (Player other : Manager.GetGame().GetPlayers(true))
{
if (other.equals(player))
continue;
if (UtilMath.offset(player, other) > 4)
continue;
if( Manager.GetGame().GetTeam(player).equals(Manager.GetGame().GetTeam(other)))
Manager.GetCondition().Factory().Regen("Aura", other, player, 1.9, 0, false, false, false);
}
}
}
@EventHandler
public void KitItems(UpdateEvent event)
{
if(!Manager.GetGame().IsLive())
return;
if (event.getType() == UpdateType.SLOWEST)
{
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!HasKit(player))
continue;
Potion potion = new Potion(PotionType.INSTANT_HEAL);
potion.setSplash(true);
player.getInventory().setItem(1, potion.toItemStack(1));
}
}
}
@EventHandler
public void Splash(PotionSplashEvent event)
{
if(event.getEntity().getShooter() instanceof Player)
{
if(!HasKit((Player) event.getEntity().getShooter()))
return;
for(Entity entity : event.getAffectedEntities())
{
if(entity instanceof Player)
{
Manager.GetCondition().Factory().Slow("Heal Potion", (Player)entity, (Player)event.getEntity().getShooter(), 5.0, 1, false, false, false, false);
}
}
}
}
}

View File

@ -5,16 +5,21 @@ import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import mineplex.core.common.util.UtilMath;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
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.PerkFallDamage;
public class KitSportsman extends Kit
{
@ -31,11 +36,12 @@ public class KitSportsman extends Kit
"Left-Click Snow to pick up Snowballs (Max. 16)",
"Right-Click Snowballs to throw them.",
"",
"Use your compass to find and kill your enemies."
"Supports all nearby allies with SPEED."
},
new Perk[]
{
new PerkFallDamage(3)
},
EntityType.SKELETON,
new ItemStack(Material.SNOW_BALL));
@ -45,10 +51,8 @@ public class KitSportsman extends Kit
@Override
public void GiveItems(Player player)
{
player.getInventory().setItem(1, ItemStackFactory.Instance.CreateStack(Material.COMPASS.getId(), (byte) 0, 1, "§a§lTracking Compass"));
player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, 0));
}
@Override
@ -60,4 +64,29 @@ public class KitSportsman extends Kit
ent.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS));
}
@EventHandler
public void Aura(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!HasKit(player))
continue;
for (Player other : Manager.GetGame().GetPlayers(true))
{
if (other.equals(player))
continue;
if (UtilMath.offset(player, other) > 4)
continue;
if( Manager.GetGame().GetTeam(player).equals(Manager.GetGame().GetTeam(other)))
Manager.GetCondition().Factory().Speed("Aura", other, player, 1.9, 0, false, false, false);
}
}
}
}

View File

@ -1,6 +1,12 @@
package nautilus.game.arcade.game.games.snowfight.kits;
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.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
@ -12,8 +18,10 @@ import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.potion.PotionType;
public class KitTactician extends Kit
{
@ -29,15 +37,16 @@ public class KitTactician extends Kit
"Left-Click Snow to pick up Snowballs (Max. 16)",
"Right-Click Snowballs to throw them.",
" ",
"Gets 1 Slow Egg every 16 seconds (Max. 2)",
"Right-Click Slow Eggs to throw them.",
"Causes Blindness and Slowness II when hit."
"Gets 1 Barrier every 32 seconds [max. 2]",
"Place Barriers to improve your defense.",
"You cant place Barriers above Ice, Packed Ice or Fences.",
" ",
"Supports all nearby allies with RESISTANCE."
}, new Perk[]
{
new PerkFallDamage(2)
},
EntityType.SKELETON,
new ItemStack(Material.EGG));
new ItemStack(Material.FENCE));
}
@ -46,6 +55,7 @@ public class KitTactician extends Kit
{
player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
player.getInventory().setItem(7, ItemStackFactory.Instance.CreateStack(Material.COMPASS.getId(), (byte) 0, 1, "§a§lTracking Compass"));
}
@Override
@ -56,5 +66,53 @@ public class KitTactician extends Kit
ent.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));
ent.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS));
}
@EventHandler
public void Aura(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!HasKit(player))
continue;
for (Player other : Manager.GetGame().GetPlayers(true))
{
if (other.equals(player))
continue;
if (UtilMath.offset(player, other) > 4)
continue;
if( Manager.GetGame().GetTeam(player).equals(Manager.GetGame().GetTeam(other)))
Manager.GetCondition().Factory().Protection("Aura", other, player, 1.9, 0, false, false, false);
}
}
}
@EventHandler
public void KitItems(UpdateEvent event)
{
if(!Manager.GetGame().IsLive())
return;
if (event.getType() == UpdateType.SLOWEST)
{
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!HasKit(player))
continue;
int amount = 0;
if (player.getInventory().getItem(1) != null && UtilInv.contains(player, Material.FENCE, (byte) 0, 1))
amount = 2;
else
amount = 1;
player.getInventory().setItem(1, ItemStackFactory.Instance.CreateStack(Material.FENCE, (byte) 0, amount, "Barrier"));
}
}
}
}

View File

@ -173,4 +173,9 @@ public class SoloSurvivalGames extends SurvivalGames
return losers;
}
@Override
public String GetMode()
{
return "Solo Mode";
}
}

View File

@ -220,9 +220,7 @@ public abstract class SurvivalGames extends Game
WorldTimeSet = 0;
WorldBoundaryKill = false;
SpawnNearAllies = true;
SpawnNearEnemies = true; //This is to ensure theres no 'gaps' of 1 between teams, hence forcing a team to get split.
DamageSelf = true;
DamageTeamSelf = true;

View File

@ -176,7 +176,9 @@ public class SurvivalGamesTeams extends TeamGame
this.WorldTimeSet = 0;
this.WorldBoundaryKill = false;
SpawnNearAllies = true;
SpawnNearEnemies = true; //This is to ensure theres no 'gaps' of 1 between teams, hence forcing a team to get split.
this.DamageSelf = true;
this.DamageTeamSelf = false;

View File

@ -438,4 +438,9 @@ public class TeamSurvivalGames extends SurvivalGames
return null;
}
@Override
public String GetMode()
{
return "Team Mode";
}
}

View File

@ -0,0 +1,36 @@
package nautilus.game.arcade.game.games.wither.events;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
public class HumanReviveEvent extends PlayerEvent
{
private static final HandlerList handlers = new HandlerList();
public static HandlerList getHandlerList()
{
return handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
private final Player _revivedPlayer;
public HumanReviveEvent(Player who, Player revivedPlayer)
{
super(who);
_revivedPlayer = revivedPlayer;
}
public Player getRevivedPlayer()
{
return _revivedPlayer;
}
}

View File

@ -24,22 +24,20 @@ public class KitHumanArcher extends Kit
{
public KitHumanArcher(ArcadeManager manager)
{
super(manager, "Human Archer", KitAvailability.Free,
super(manager, "Human Archer", KitAvailability.Free,
new String[]
{
""
},
new String[]
{
""
},
new Perk[]
{
new Perk[]
{
new PerkDoubleJump("Double Jump", 1.2, 1, true, 4000, true),
new PerkWitherArrowBlind(6),
new PerkFletcher(4, 4, true),
},
EntityType.ZOMBIE,
null);
}, EntityType.ZOMBIE, null);
}
@ -48,20 +46,20 @@ public class KitHumanArcher extends Kit
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW));
ItemStack potion = new ItemStack(Material.POTION, 2, (short)16429); // 16422
PotionMeta potionMeta = (PotionMeta)potion.getItemMeta();
ItemStack potion = new ItemStack(Material.POTION, 2, (short) 16429); // 16422
PotionMeta potionMeta = (PotionMeta) potion.getItemMeta();
potionMeta.setDisplayName(ChatColor.RESET + "Revival Potion");
potion.setItemMeta(potionMeta);
player.getInventory().addItem(potion);
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
}
@Override
public void SpawnCustom(LivingEntity ent)
public void SpawnCustom(LivingEntity ent)
{
}
}

View File

@ -0,0 +1,50 @@
package nautilus.game.arcade.game.games.wither.kit;
import mineplex.core.common.util.C;
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.PerkDoubleJump;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.PotionMeta;
public class KitHumanEditor extends Kit
{
public KitHumanEditor(ArcadeManager manager)
{
super(manager, "Human Editor", KitAvailability.Gem, 5000,
new String[]
{
" ", "Can " + C.cYellow + "Edit " + C.cGray + "the terrain to they and their comrade's benefits", " "
},
new Perk[]
{
new PerkDoubleJump("Double Jump", 1, 0.8, true, 6000, true),
},
EntityType.ZOMBIE, new ItemStack(Material.STONE_PICKAXE));
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_AXE));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_PICKAXE));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_SPADE));
ItemStack potion = new ItemStack(Material.POTION, 2, (short) 16429); // 16422
PotionMeta potionMeta = (PotionMeta) potion.getItemMeta();
potionMeta.setDisplayName(ChatColor.RESET + "Revival Potion");
potion.setItemMeta(potionMeta);
player.getInventory().addItem(potion);
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
}
}

View File

@ -18,12 +18,13 @@ import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkBlockRestorer;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkIronShell;
import nautilus.game.arcade.kit.perks.PerkWitherMedicRefill;
public class KitHumanBuilder extends Kit
public class KitHumanMedic extends Kit
{
public KitHumanBuilder(ArcadeManager manager)
public KitHumanMedic(ArcadeManager manager)
{
super(manager, "Human Builder", KitAvailability.Free,
super(manager, "Human Medic", KitAvailability.Gem, 2000,
new String[]
{
@ -33,7 +34,7 @@ public class KitHumanBuilder extends Kit
new Perk[]
{
new PerkDoubleJump("Double Jump", 1, 0.8, true, 6000, true),
new PerkIronShell(),
new PerkWitherMedicRefill(45, 1),
new PerkBlockRestorer()
},
EntityType.ZOMBIE,
@ -45,7 +46,9 @@ public class KitHumanBuilder extends Kit
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
ItemStack potion = new ItemStack(Material.POTION, 2, (short)16429); // 16422
PotionMeta potionMeta = (PotionMeta)potion.getItemMeta();
@ -53,8 +56,6 @@ public class KitHumanBuilder extends Kit
potion.setItemMeta(potionMeta);
player.getInventory().addItem(potion);
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
}
@Override

View File

@ -26,57 +26,60 @@ public class KitWitherMinion extends Kit
{
public KitWitherMinion(ArcadeManager manager)
{
super(manager, "Wither", KitAvailability.Free,
super(manager, "Wither", KitAvailability.Free,
new String[]
{
""
},
new String[]
{
""
},
new Perk[]
{
new PerkWitherArrows(),
new PerkWitherAttack(),
new PerkWitherMinion()
},
EntityType.WITHER,
null);
new Perk[]
{
new PerkWitherArrows(), new PerkWitherAttack(),
new PerkWitherMinion(), new PerkWitherCompassScent()
}, EntityType.WITHER, null);
}
// @Override
// public void SpawnCustom(LivingEntity ent)
// {
// ent.setMaxHealth(300);
// ent.setHealth(300);
//
// DisguiseWither disguise = new DisguiseWither(ent);
// disguise.SetName(C.cYellow + "Wither");
// disguise.SetCustomNameVisible(true);
// Manager.GetDisguise().disguise(disguise);
// }
// @Override
// public void SpawnCustom(LivingEntity ent)
// {
// ent.setMaxHealth(300);
// ent.setHealth(300);
//
// DisguiseWither disguise = new DisguiseWither(ent);
// disguise.SetName(C.cYellow + "Wither");
// disguise.SetCustomNameVisible(true);
// Manager.GetDisguise().disguise(disguise);
// }
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.GOLD_SWORD, (byte)0, 1,
C.cYellow + C.Bold + "Left-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Wither Skull"));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Skeletal Minions"));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.COMPASS, (byte)0, 1,
C.cYellow + C.Bold + "Human Finder X-9000"));
public void GiveItems(Player player)
{
player.getInventory().addItem(
ItemStackFactory.Instance.CreateStack(Material.GOLD_SWORD,
(byte) 0, 1, C.cYellow + C.Bold + "Left-Click"
+ C.cWhite + C.Bold + " - " + C.cGreen + C.Bold
+ "Wither Skull"));
//Disguise
player.getInventory().addItem(
ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD,
(byte) 0, 1, C.cYellow + C.Bold + "Right-Click"
+ C.cWhite + C.Bold + " - " + C.cGreen + C.Bold
+ "Skeletal Minions"));
player.getInventory().addItem(
ItemStackFactory.Instance
.CreateStack(Material.COMPASS, (byte) 0, 1, C.cYellow
+ C.Bold + "Human Finder X-9000"));
// Disguise
DisguiseWither disguise = new DisguiseWither(player);
if (Manager.GetGame().GetTeam(player) != null)
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
else
disguise.setName(player.getName());
if (Manager.GetGame().GetTeam(player) != null)
disguise.setName(Manager.GetGame().GetTeam(player).GetColor()
+ player.getName());
else disguise.setName(player.getName());
disguise.setCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
@ -87,25 +90,25 @@ public class KitWitherMinion extends Kit
{
if (event.IsCancelled())
return;
Player player = event.GetDamageePlayer();
if (player == null)
return;
if (HasKit(player))
event.SetCancelled("Wither Immunity");
}
@EventHandler(priority = EventPriority.LOWEST)
public void witherMeleeCancel(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
Player player = event.GetDamagerPlayer(true);
if (player == null)
return;
if (!HasKit(player))
return;
@ -120,7 +123,7 @@ public class KitWitherMinion extends Kit
{
if (event.getType() != UpdateType.TICK)
return;
for (Player player : UtilServer.getPlayers())
{
if (!HasKit(player))

View File

@ -0,0 +1,34 @@
package nautilus.game.arcade.gui.privateServer.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.IButton;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
import nautilus.game.arcade.gui.privateServer.page.WhitelistedPage;
/**
* Created by WilliamTiger.
* All the code and any API's associated with it
* are not to be used anywhere else without written
* consent of William Burns. 2015.
* 29/07/15
*/
public class WhitelistButton implements IButton
{
private ArcadeManager _arcadeManager;
private PrivateServerShop _shop;
public WhitelistButton(ArcadeManager arcadeManager, PrivateServerShop shop)
{
_shop = shop;
_arcadeManager = arcadeManager;
}
@Override
public void onClick(Player player, ClickType clickType)
{
_shop.openPageForPlayer(player, new WhitelistedPage(_arcadeManager, _shop, player));
}
}

View File

@ -76,12 +76,13 @@ public class EditRotationPage extends BasePage
allowedCats.add(GameCategory.SURVIVAL);
allowedCats.add(GameCategory.CHAMPIONS);
allowedCats.add(GameCategory.EXTRA);
allowedCats.add(GameCategory.TEAM_VARIANT);
int gameSlot = 9;
for (GameCategory cat : _manager.getGames(getPlayer()).keySet())
{
if (!allowedCats.contains(cat))
return;
continue;
for (GameType type : _manager.getGames(getPlayer()).get(cat))
{

View File

@ -54,12 +54,13 @@ public class GameVotingPage extends BasePage
allowedCats.add(GameCategory.SURVIVAL);
allowedCats.add(GameCategory.CHAMPIONS);
allowedCats.add(GameCategory.EXTRA);
allowedCats.add(GameCategory.TEAM_VARIANT);
int gameSlot = 9;
for (GameCategory cat : _manager.getGames(getPlayer()).keySet())
{
if (!allowedCats.contains(cat))
return;
continue;
for (GameType type : _manager.getGames(getPlayer()).get(cat))
{

View File

@ -26,6 +26,7 @@ import nautilus.game.arcade.gui.privateServer.button.OptionsButton;
import nautilus.game.arcade.gui.privateServer.button.StartGameButton;
import nautilus.game.arcade.gui.privateServer.button.StopGameButton;
import nautilus.game.arcade.gui.privateServer.button.UnbanButton;
import nautilus.game.arcade.gui.privateServer.button.WhitelistButton;
public class MenuPage extends BasePage
{
@ -94,11 +95,14 @@ public class MenuPage extends BasePage
addButton(4 + 18, new ShopItem(Material.GOLD_SWORD, "Remove Admin", new String[]{}, 1, false), removeAdminButton);
KillButton killButton = new KillButton(getPlugin());
addButton(4 + 27, new ShopItem(Material.TNT, "Kill Private Server",
addButton(8 + 18, new ShopItem(Material.TNT, "Kill Private Server",
new String[]{ChatColor.RESET + C.cGray + "Shift-Right Click to Kill Private Server"}, 1, false), killButton);
GameVotingButton votingButton = new GameVotingButton(getPlugin(), getShop());
addButton(8 + 18, new ShopItem(Material.BOOKSHELF, "Game Voting", new String[]{}, 1, false), votingButton);
addButton(3 + 27, new ShopItem(Material.BOOKSHELF, "Game Voting", new String[]{}, 1, false), votingButton);
WhitelistButton whitelistButton = new WhitelistButton(getPlugin(), getShop());
addButton(5 + 27, new ShopItem(Material.PAPER, "Whitelisted Players", new String[]{}, 1, false), whitelistButton);
}
OptionsButton optionsButton = new OptionsButton(getPlugin(), getShop());

View File

@ -117,6 +117,8 @@ public class OptionsPage extends BasePage
private void toggleWhitelist()
{
_config.PlayerServerWhitelist = !_config.PlayerServerWhitelist;
if (_config.PlayerServerWhitelist == true)
_config.PublicServer = false;
refresh();
}

View File

@ -72,6 +72,7 @@ public class SetGamePage extends BasePage
allowedCats.add(GameCategory.SURVIVAL);
allowedCats.add(GameCategory.CHAMPIONS);
allowedCats.add(GameCategory.EXTRA);
allowedCats.add(GameCategory.TEAM_VARIANT);
int gameSlot = 9;
for (GameCategory cat : _manager.getGames(getPlayer()).keySet())

View File

@ -0,0 +1,45 @@
package nautilus.game.arcade.gui.privateServer.page;
import org.bukkit.entity.Player;
import mineplex.core.common.util.F;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
/**
* Created by WilliamTiger.
* All the code and any API's associated with it
* are not to be used anywhere else without written
* consent of William Burns. 2015.
* 29/07/15
*/
public class WhitelistedPage extends PlayerPage
{
public WhitelistedPage(ArcadeManager plugin, PrivateServerShop shop, Player player)
{
super(plugin, shop, "Whitelisted Players", player);
buildPage();
}
@Override
public boolean showPlayer(Player player)
{
if (getPlugin().GetGameHostManager().getWhitelist().contains(player.getName()))
return true;
return false;
}
@Override
public void clicked(int slot, Player player)
{
getPlugin().GetGameHostManager().getWhitelist().remove(player.getName());
getPlugin().GetPortal().sendToHub(player, "You are no longer whitelisted.");
getPlayer().sendMessage(F.main("Whitelist", "§e" + player.getName() + " §7is no longer whitelisted."));
}
@Override
public String getDisplayString(Player player)
{
return "Click to remove from whitelist";
}
}

View File

@ -2,42 +2,21 @@ package nautilus.game.arcade.kit.perks;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.WitherSkull;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
@ -45,6 +24,19 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.data.IBlockRestorer;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.WitherSkull;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.player.PlayerInteractEvent;
public class PerkWitherAttack extends Perk
{
private ArrayList<WitherSkull> _active = new ArrayList<WitherSkull>();

View File

@ -0,0 +1,169 @@
package nautilus.game.arcade.kit.perks;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilServer;
import mineplex.core.hologram.Hologram;
import mineplex.core.hologram.Hologram.HologramTarget;
import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
public class PerkWitherCompassScent extends Perk
{
public PerkWitherCompassScent()
{
super("Smell Humans", new String[]
{
C.cYellow + "Right-Click" + C.cGray + " with a compass to use " + C.cGreen + "Wither Scent"
});
}
@EventHandler
public void compassRightClick(PlayerInteractEvent event)
{
if(event.isCancelled())
return;
if(!UtilEvent.isAction(event, ActionType.R))
return;
if (!UtilGear.isMat(event.getPlayer().getItemInHand(), Material.COMPASS))
return;
if(!Kit.HasKit(event.getPlayer()))
return;
if (!Recharge.Instance.use(event.getPlayer(), GetName(), 30*1000, true, true))
return;
event.setCancelled(true);
Player player = event.getPlayer();
// Code from Wizards changed to WitherGame:
Location loc = player.getEyeLocation().subtract(0, 1, 0);
final ArrayList<Integer[]> colors = new ArrayList<Integer[]>();
for (int x = -1; x <= 1; x++)
{
for (int y = -1; y <= 1; y++)
{
for (int z = -1; z <= 1; z++)
{
colors.add(new Integer[]
{
x, y, z
});
}
}
}
Collections.shuffle(colors);
for (Player enemy : Manager.GetGame().GetPlayers(true))
{
if (enemy == player)
{
continue;
}
if(Manager.GetGame().GetTeam(enemy).GetName().contentEquals("Withers"))
{
continue;
}
final double playerDist = Math.min(7, UtilMath.offset(enemy, player));
final Vector traj = UtilAlg.getTrajectory(player.getLocation(), enemy.getEyeLocation()).multiply(0.1);
final Hologram hologram = new Hologram(Manager.GetGame().getArcadeManager().getHologramManager(), loc.clone().add(0, 0.3, 0)
.add(traj.clone().normalize().multiply(playerDist)), enemy.getName());
hologram.setHologramTarget(HologramTarget.WHITELIST);
hologram.addPlayer(player);
hologram.start();
final Location location = loc.clone();
final Integer[] ints = colors.remove(0);
new BukkitRunnable()
{
int dist;
int tick;
HashMap<Location, Integer> locations = new HashMap<Location, Integer>();
public void run()
{
tick++;
Iterator<Entry<Location, Integer>> itel = locations.entrySet().iterator();
while (itel.hasNext())
{
Entry<Location, Integer> entry = itel.next();
if ((entry.getValue() + tick) % 3 == 0)
{
// Colored redstone dust
UtilParticle.PlayParticle(ParticleType.RED_DUST, entry.getKey(), ints[0], ints[1], ints[2], 1, 0,
ViewDist.LONG, UtilServer.getPlayers());
}
if (entry.getValue() < tick)
{
itel.remove();
}
}
if (dist <= playerDist * 10)
{
for (int a = 0; a < 2; a++)
{
// Colored redstone dust
UtilParticle.PlayParticle(ParticleType.RED_DUST, location, ints[0], ints[1], ints[2], 1, 0,
ViewDist.LONG, UtilServer.getPlayers());
locations.put(location.clone(), tick + 50);
location.add(traj);
dist++;
}
}
else if (locations.isEmpty())
{
hologram.stop();
cancel();
}
}
}.runTaskTimer(Manager.GetGame().getArcadeManager().getPlugin(), 0, 0);
}
player.playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 1.5F, 1);
}
}

View File

@ -0,0 +1,73 @@
package nautilus.game.arcade.kit.perks;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.PotionMeta;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilServer;
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.kit.Perk;
public class PerkWitherMedicRefill extends Perk
{
private int _max = 0;
private int _time = 0;
public PerkWitherMedicRefill(int timeInSeconds, int max)
{
super("Healing Hands", new String[]
{
C.cGray + "Receive 1 healing bottle every " + timeInSeconds + " seconds if you're inventory is clearned from a bottle.",
});
this._time = timeInSeconds;
this._max = max;
}
@EventHandler
public void bottleRefill(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
for (Player player : UtilServer.getPlayers())
{
if (Manager.isSpectator(player))
continue;
if (!Kit.HasKit(player))
continue;
if (!Manager.GetGame().IsAlive(player))
continue;
if (!Recharge.Instance.use(player, GetName(), _time * 1000, false, false))
continue;
//Add
ItemStack potion = new ItemStack(Material.POTION, 1, (short)16429); // 16422
PotionMeta potionMeta = (PotionMeta)potion.getItemMeta();
potionMeta.setDisplayName(ChatColor.RESET + "Revival Potion");
potion.setItemMeta(potionMeta);
if (UtilInv.contains(player, "Revival Potion", Material.POTION, potion.getData().getData(), _max))
continue;
player.getInventory().addItem(potion);
player.playSound(player.getLocation(), Sound.ITEM_PICKUP, 2f, 1f);
}
}
}

View File

@ -76,7 +76,7 @@ public class PerkWitherMinion extends Perk
Manager.GetGame().CreatureAllowOverride = true;
for (int i=0 ; i<3 ; i++)
for (int i=0 ; i<2 ; i++)
{
Skeleton skel = player.getWorld().spawn(player.getEyeLocation(), Skeleton.class);
_ents.add(skel);

View File

@ -77,7 +77,7 @@ public class GameChatManager implements Listener
}
else if (Manager.GetGameHostManager().isAdmin(event.getPlayer(), false))
{
if (Manager.GetGame() != null && Manager.GetGame().GetType() == GameType.Event)
if (Manager.GetGameHostManager().isEventServer())
rankStr = C.cDGreen + C.Bold + "Event Admin ";
else
rankStr = C.cDGreen + C.Bold + "MPS Admin ";

View File

@ -109,10 +109,6 @@ public class GameHostManager implements Listener
legendGames.add(GameType.Build);
legendGames.add(GameType.UHC);
legendGames.add(GameType.MineStrike);
legendGames.add(GameType.SnowFight);
legendGames.add(GameType.Gravity);
legendGames.add(GameType.Barbarians);
legendGames.add(GameType.SmashDomination);
legendGames.add(GameType.Skywars);
// Team variants - Currently being remade.
/*
@ -128,6 +124,13 @@ public class GameHostManager implements Listener
legendGames.add(GameType.MilkCow);
legendGames.add(GameType.SearchAndDestroy);
legendGames.add(GameType.ZombieSurvival);
legendGames.add(GameType.SurvivalGamesTeams);
legendGames.add(GameType.SkywarsTeams);
legendGames.add(GameType.SmashTeams);
legendGames.add(GameType.SnowFight);
legendGames.add(GameType.Gravity);
legendGames.add(GameType.Barbarians);
legendGames.add(GameType.SmashDomination);
//Config Defaults
if (Manager.GetHost() != null && Manager.GetHost().length() > 0)
@ -179,7 +182,7 @@ public class GameHostManager implements Listener
@EventHandler
public void voteNotification(UpdateEvent e)
{
if (e.getType() != UpdateType.FASTER)
if (e.getType() != UpdateType.FAST)
return;
if (!_voteInProgress)
@ -187,31 +190,13 @@ public class GameHostManager implements Listener
if (_voteNotificationStage == 1)
{
UtilTextBottom.display("§e§l> §6§lUse §e§l/vote §6§lto vote for a game! §e§l<", UtilServer.getPlayers());
UtilTextBottom.display(C.cYellow + C.Bold + "Type " + C.cGold + C.Bold + "/vote" + C.cYellow + C.Bold + " to vote for next game", UtilServer.getPlayers());
_voteNotificationStage++;
return;
}
else if (_voteNotificationStage == 2)
{
UtilTextBottom.display("§a§l> §2§lUse §a§l/vote §2§lto vote for a game! §a§l<", UtilServer.getPlayers());
_voteNotificationStage++;
return;
}
else if (_voteNotificationStage == 3)
{
UtilTextBottom.display("§c§l> §4§lUse §c§l/vote §4§lto vote for a game! §c§l<", UtilServer.getPlayers());
_voteNotificationStage++;
return;
}
else if (_voteNotificationStage == 4)
{
UtilTextBottom.display("§b§l> §3§lUse §b§l/vote §3§lto vote for a game! §b§l<", UtilServer.getPlayers());
_voteNotificationStage++;
return;
}
else if (_voteNotificationStage == 5)
{
UtilTextBottom.display("§d§l> §5§lUse §d§l/vote §5§lto vote for a game! §d§l<", UtilServer.getPlayers());
UtilTextBottom.display(C.cGold + C.Bold + "Type " + C.cYellow + C.Bold + "/vote" + C.cGold + C.Bold + " to vote for next game", UtilServer.getPlayers());
_voteNotificationStage = 1;
return;
}
@ -223,6 +208,8 @@ public class GameHostManager implements Listener
Player p = event.getPlayer();
if (Manager.GetServerConfig().PlayerServerWhitelist){
if (!getWhitelist().contains(p.getName())){
if (_host == p)
return;
Manager.GetPortal().sendToHub(p, "You aren't on the whitelist of this Mineplex Private Server.");
}
}
@ -404,7 +391,7 @@ public class GameHostManager implements Listener
}
msg = msg.trim();
Bukkit.broadcastMessage("§6§l" + event.getPlayer().getName() + " §e" + msg);
Bukkit.broadcastMessage("<EFBFBD>6<EFBFBD>l" + event.getPlayer().getName() + " <EFBFBD>e" + msg);
}
@EventHandler
@ -693,29 +680,7 @@ public class GameHostManager implements Listener
else
return 4;
}
@EventHandler
public void setHostDebug(PlayerCommandPreprocessEvent event)
{
if (!event.getPlayer().isOp())
return;
if (!event.getMessage().toLowerCase().startsWith("/sethost "))
return;
Manager.GetServerConfig().HostName = event.getMessage().split(" ")[1];
event.getPlayer().sendMessage("Set host to: " + event.getMessage().split(" ")[1]);
_host = Bukkit.getPlayerExact(Manager.GetServerConfig().HostName);
if (_host != null)
_hostRank = Manager.GetClients().Get(_host).GetRank();
setDefaultConfig();
event.setCancelled(true);
}
@EventHandler
public void setEventGame(PlayerCommandPreprocessEvent event)
{
@ -823,4 +788,25 @@ public class GameHostManager implements Listener
{
return _voteInProgress;
}
public Rank getHostRank()
{
return _hostRank;
}
public void setHostRank(Rank rank)
{
_hostRank = rank;
}
public Player getHost()
{
return _host;
}
public void setHost(Player player)
{
_host = player;
}
}

View File

@ -867,9 +867,9 @@ public class GameLobbyManager implements Listener, IPacketHandler
WriteGameLine(game.GetType().GetLobbyName(), 0, 159, (byte)14);
if (game.GetMode() == null)
WriteGameLine(" ", 1, 159, (byte)14);
WriteGameLine(" ", 1, 159, (byte)1);
else
WriteGameLine(game.GetMode(), 1, 159, (byte)14);
WriteGameLine(game.GetMode(), 1, 159, (byte)1);
DisplayWaiting();
CreateKits(game);

View File

@ -0,0 +1,25 @@
package nautilus.game.arcade.stats;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.wither.events.HumanReviveEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
public class WitherAssaultReviveTracker extends StatTracker<Game>
{
public WitherAssaultReviveTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(HumanReviveEvent event)
{
if (getGame().GetState() != Game.GameState.Live)
return;
addStat(event.getPlayer(), "WitherHeal", 1, false, false);
}
}