Sheep Game?
This commit is contained in:
parent
d99a3c9253
commit
2b56b970fa
@ -93,31 +93,6 @@
|
||||
</jar>
|
||||
<copy file="../bin/PvP.jar" todir="../../Testing/PvP/plugins"/>
|
||||
</target>
|
||||
<target name ="Tutorial" description="Tutorial">
|
||||
<jar jarfile="../bin/Tutorial.jar">
|
||||
<fileset dir="../Nautilus.Game.Tutorial/bin">
|
||||
<include name="**/*.class"/>
|
||||
</fileset>
|
||||
<fileset dir="../Core/bin">
|
||||
<include name="**/*.class"/>
|
||||
</fileset>
|
||||
<fileset dir="../Nautilus.Core/bin">
|
||||
<include name="**/*.class"/>
|
||||
</fileset>
|
||||
<fileset dir="../Nautilus.Game.Tutorial">
|
||||
<include name="*.yml"/>
|
||||
</fileset>
|
||||
|
||||
<zipfileset src="../Libraries/httpclient-4.2.jar" />
|
||||
<zipfileset src="../Libraries/httpcore-4.2.jar" />
|
||||
<zipfileset src="../Libraries/httpclient-cache-4.2.jar" />
|
||||
<zipfileset src="../Libraries/httpmime-4.2.jar" />
|
||||
<zipfileset src="../Libraries/gson-2.2.1.jar" />
|
||||
<zipfileset src="../Libraries/commons-logging-1.1.1.jar" />
|
||||
<zipfileset src="../Libraries/commons-codec-1.6.jar" />
|
||||
</jar>
|
||||
<copy file="../bin/Tutorial.jar" todir="../../Testing/Tutorial/plugins"/>
|
||||
</target>
|
||||
<target name ="Arcade" description="Arcade">
|
||||
<jar jarfile="../bin/Arcade.jar">
|
||||
<fileset dir="../Nautilus.Game.Arcade/bin">
|
||||
|
@ -247,5 +247,22 @@ public class UtilInv
|
||||
}
|
||||
}
|
||||
|
||||
public static void refreshDurability(Player player, Material type)
|
||||
{
|
||||
for (ItemStack item : player.getInventory().getContents())
|
||||
if (item != null)
|
||||
if (item.getType() == type)
|
||||
{
|
||||
if (item.getDurability() == 0)
|
||||
{
|
||||
item.setDurability((short) 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
item.setDurability((short) 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -14,5 +14,5 @@
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${BUILD_FILES}\common.xml"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,auto,clean"/>
|
||||
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/Nautilus.Game.Tutorial}"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/Nautilus.Game.Arcade}"/>
|
||||
</launchConfiguration>
|
||||
|
@ -0,0 +1,40 @@
|
||||
package nautilus.game.arcade.events;
|
||||
|
||||
import nautilus.game.arcade.game.Game;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class PlayerGameRespawnEvent extends Event
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Game _game;
|
||||
private Player _player;
|
||||
|
||||
public PlayerGameRespawnEvent(Game game, Player player)
|
||||
{
|
||||
_game = game;
|
||||
_player = player;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public Game GetGame()
|
||||
{
|
||||
return _game;
|
||||
}
|
||||
|
||||
public Player GetPlayer()
|
||||
{
|
||||
return _player;
|
||||
}
|
||||
}
|
@ -20,6 +20,7 @@ import nautilus.game.arcade.ArcadeFormat;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.events.PlayerGameRespawnEvent;
|
||||
import nautilus.game.arcade.events.PlayerStateChangeEvent;
|
||||
import nautilus.game.arcade.game.GameTeam.PlayerState;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
@ -629,6 +630,10 @@ public abstract class Game implements Listener
|
||||
|
||||
Manager.Clear(player);
|
||||
|
||||
//Event
|
||||
PlayerGameRespawnEvent event = new PlayerGameRespawnEvent(this, player);
|
||||
UtilServer.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
//Re-Give Kit
|
||||
Manager.GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable()
|
||||
{
|
||||
|
@ -0,0 +1,41 @@
|
||||
package nautilus.game.arcade.game.games.moba;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.game.TeamGame;
|
||||
import nautilus.game.arcade.game.games.sheep.kits.*;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.NullKit;
|
||||
|
||||
public class Moba extends TeamGame
|
||||
{
|
||||
private ArrayList<String> _lastScoreboard = new ArrayList<String>();
|
||||
|
||||
public Moba(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.Sheep,
|
||||
|
||||
new Kit[]
|
||||
{
|
||||
new NullKit(manager)
|
||||
},
|
||||
|
||||
new String[]
|
||||
{
|
||||
"..."
|
||||
});
|
||||
|
||||
this.DeathOut = false;
|
||||
this.DeathSpectateSecs = 8;
|
||||
|
||||
this.HungerSet = 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ParseData()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -2,9 +2,11 @@ package nautilus.game.arcade.game.games.sheep;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
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.UtilDisplay;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
@ -104,6 +106,7 @@ public class SheepData
|
||||
Host.AddGems(Holder, 3, "Sheep Captured", true);
|
||||
|
||||
UtilPlayer.message(Holder, F.main("Game", "You captured a Sheep!"));
|
||||
UtilDisplay.displayTextBar(Host.Manager.GetPlugin(), Holder, 0f, C.cGreen + C.Bold + "You captured a Sheep!");
|
||||
}
|
||||
|
||||
Holder = null;
|
||||
|
@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.sheep;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
@ -15,39 +16,55 @@ import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Chicken;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Giant;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Sheep;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.entity.PlayerLeashEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||
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.UtilDisplay;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.projectile.IThrown;
|
||||
import mineplex.core.projectile.ProjectileUser;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.events.PlayerGameRespawnEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.TeamGame;
|
||||
import nautilus.game.arcade.game.games.sheep.kits.*;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import net.minecraft.server.v1_6_R3.Item;
|
||||
|
||||
public class SheepGame extends TeamGame
|
||||
{
|
||||
@ -72,7 +89,8 @@ public class SheepGame extends TeamGame
|
||||
new Kit[]
|
||||
{
|
||||
new KitBeserker(manager),
|
||||
new KitArcher(manager)
|
||||
new KitArcher(manager),
|
||||
new KitBrute(manager)
|
||||
},
|
||||
|
||||
new String[]
|
||||
@ -177,6 +195,9 @@ public class SheepGame extends TeamGame
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!Recharge.Instance.usable(player, "Sheep Stack"))
|
||||
return;
|
||||
|
||||
if (player.getItemInHand() != null && player.getItemInHand().getType() != Material.SADDLE)
|
||||
return;
|
||||
|
||||
@ -186,6 +207,11 @@ public class SheepGame extends TeamGame
|
||||
if (!IsAlive(event.getPlayer()))
|
||||
return;
|
||||
|
||||
if (player.getPassenger() != null && player.getPassenger() instanceof Player)
|
||||
{
|
||||
DropSheep(player);
|
||||
}
|
||||
|
||||
//Holding too many
|
||||
int count = 0;
|
||||
Entity top = player;
|
||||
@ -226,11 +252,67 @@ public class SheepGame extends TeamGame
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Drop(PlayerDropItemEvent event)
|
||||
public void StackPlayer(PlayerInteractEntityEvent event)
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (!(event.getRightClicked() instanceof Player))
|
||||
return;
|
||||
|
||||
if (event.getRightClicked().getVehicle() != null)
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
Player other = (Player)event.getRightClicked();
|
||||
|
||||
if (!(GetKit(player) instanceof KitBrute))
|
||||
return;
|
||||
|
||||
if (!GetTeam(player).HasPlayer(other))
|
||||
return;
|
||||
|
||||
if (player.getPassenger() != null)
|
||||
DropSheep(player);
|
||||
|
||||
if (!Recharge.Instance.usable(player, "Sheep Stack"))
|
||||
return;
|
||||
|
||||
if (player.getItemInHand() != null && player.getItemInHand().getType() != Material.SADDLE)
|
||||
return;
|
||||
|
||||
if (event.getPlayer().getGameMode() != GameMode.SURVIVAL)
|
||||
return;
|
||||
|
||||
if (!IsAlive(event.getPlayer()))
|
||||
return;
|
||||
|
||||
//Effect
|
||||
event.getRightClicked().getWorld().playEffect(event.getRightClicked().getLocation(), Effect.STEP_SOUND, 35);
|
||||
|
||||
//Stack
|
||||
player.setPassenger(other);
|
||||
|
||||
//Audio
|
||||
player.playSound(player.getLocation(), Sound.VILLAGER_YES, 2f, 3f);
|
||||
other.playSound(player.getLocation(), Sound.VILLAGER_NO, 2f, 3f);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(other, F.main("Skill", F.elem(GetTeam(player).GetColor() + player.getName()) + " picked you up."));
|
||||
UtilPlayer.message(player, F.main("Skill", "You picked up " + F.elem(GetTeam(player).GetColor() + player.getName()) + "."));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void DeathDrop(PlayerDeathEvent event)
|
||||
{
|
||||
DropSheep(event.getEntity());
|
||||
}
|
||||
|
||||
public void DropSheep(Player player)
|
||||
{
|
||||
boolean hadSheep = false;
|
||||
|
||||
Entity top = event.getPlayer();
|
||||
Entity top = player;
|
||||
while (top.getVehicle() != null)
|
||||
{
|
||||
top = top.getVehicle();
|
||||
@ -240,9 +322,22 @@ public class SheepGame extends TeamGame
|
||||
}
|
||||
|
||||
if (hadSheep)
|
||||
UtilDisplay.displayTextBar(Manager.GetPlugin(), event.getPlayer(), 0f, C.cWhite + C.Bold + "You dropped your Sheep!");
|
||||
UtilDisplay.displayTextBar(Manager.GetPlugin(), player, 0f, C.cRed + C.Bold + "You dropped your Sheep!");
|
||||
|
||||
event.getPlayer().setExp(0f);
|
||||
player.setExp(0f);
|
||||
|
||||
player.getInventory().remove(Material.WOOL);
|
||||
|
||||
Manager.GetCondition().EndCondition(player, ConditionType.SLOW, null);
|
||||
|
||||
//Audio
|
||||
player.playSound(player.getLocation(), Sound.SHEEP_IDLE, 2f, 1f);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Drop(PlayerDropItemEvent event)
|
||||
{
|
||||
DropSheep(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -315,6 +410,13 @@ public class SheepGame extends TeamGame
|
||||
UtilEnt.getName(event.GetDamagerEntity(true)), event.GetReason());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void DamageSuffocate(CustomDamageEvent event)
|
||||
{
|
||||
if (event.GetCause() == DamageCause.SUFFOCATION)
|
||||
event.SetCancelled("Sheep Game");
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void DamageUnstack(CustomDamageEvent event)
|
||||
{
|
||||
@ -327,22 +429,7 @@ public class SheepGame extends TeamGame
|
||||
Player player = event.GetDamageePlayer();
|
||||
if (player == null) return;
|
||||
|
||||
boolean hadSheep = false;
|
||||
|
||||
Entity rider = player.getPassenger();
|
||||
while (rider != null)
|
||||
{
|
||||
rider.leaveVehicle();
|
||||
rider.setVelocity(new Vector(0.25 - Math.random()/2, Math.random()/2, 0.25 - Math.random()/2));
|
||||
rider = rider.getPassenger();
|
||||
|
||||
hadSheep = true;
|
||||
}
|
||||
|
||||
if (hadSheep)
|
||||
UtilDisplay.displayTextBar(Manager.GetPlugin(), player, 0f, C.cRed + C.Bold + "You dropped your Sheep!");
|
||||
|
||||
player.setExp(0f);
|
||||
DropSheep(player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -352,6 +439,12 @@ public class SheepGame extends TeamGame
|
||||
event.getWhoClicked().closeInventory();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void RespawnInvul(PlayerGameRespawnEvent event)
|
||||
{
|
||||
Manager.GetCondition().Factory().Regen("Respawn", event.GetPlayer(), event.GetPlayer(), 5, 3, false, false, true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ScoreboardTimer(UpdateEvent event)
|
||||
{
|
||||
@ -544,4 +637,29 @@ public class SheepGame extends TeamGame
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
@EventHandler
|
||||
public void Giant(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
if (event.getMessage().contains("/giant"))
|
||||
{
|
||||
Giant giant = event.getPlayer().getWorld().spawn(event.getPlayer().getLocation(), Giant.class);
|
||||
|
||||
Entity top = giant;
|
||||
for (int i=0 ; i < 10 ; i++)
|
||||
{
|
||||
Entity buffer = event.getPlayer().getWorld().spawn(event.getPlayer().getLocation(), Chicken.class);
|
||||
top.setPassenger(buffer);
|
||||
top = buffer;
|
||||
}
|
||||
|
||||
top.setPassenger(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Invul(CustomDamageEvent event)
|
||||
{
|
||||
event.SetCancelled("True");
|
||||
}*/
|
||||
}
|
||||
|
@ -5,10 +5,15 @@ 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 mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
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;
|
||||
@ -75,4 +80,13 @@ public class KitArcher extends Kit
|
||||
ent.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));
|
||||
ent.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void RefreshInventory(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() == UpdateType.SLOW)
|
||||
for (Player player : Manager.GetGame().GetPlayers(true))
|
||||
if (this.HasKit(player))
|
||||
UtilInv.refreshDurability(player, Material.WOOD_SWORD);
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
@ -22,21 +23,23 @@ public class KitBrute extends Kit
|
||||
|
||||
new String[]
|
||||
{
|
||||
"Can throw sheep at enemies!"
|
||||
"Can throw sheep at enemies!",
|
||||
"",
|
||||
C.cYellow + "Right-Click" + C.cGray + " with Sword to " + C.cGreen + "Throw Sheep"
|
||||
},
|
||||
|
||||
new Perk[]
|
||||
{
|
||||
new PerkLeap("Beserker Leap", 1.2, 1.2, 8000)
|
||||
new PerkThrower(manager)
|
||||
},
|
||||
EntityType.ZOMBIE,
|
||||
new ItemStack(Material.IRON_AXE));
|
||||
new ItemStack(Material.IRON_SWORD));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.SADDLE));
|
||||
|
||||
ItemStack helm = new ItemStack(Material.LEATHER_HELMET);
|
||||
|
@ -56,6 +56,9 @@ public class PerkInfernalHorror extends Perk
|
||||
if (event.GetCause() == DamageCause.FIRE_TICK)
|
||||
return;
|
||||
|
||||
if (event.GetCause() == DamageCause.VOID)
|
||||
return;
|
||||
|
||||
Player damager = event.GetDamagerPlayer(true);
|
||||
if (damager == null) return;
|
||||
|
||||
|
@ -0,0 +1,132 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
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.UtilEvent.ActionType;
|
||||
import mineplex.core.projectile.IThrown;
|
||||
import mineplex.core.projectile.ProjectileUser;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
public class PerkThrower extends Perk implements IThrown
|
||||
{
|
||||
public PerkThrower(ArcadeManager manager)
|
||||
{
|
||||
super("Thrower", new String[]
|
||||
{
|
||||
C.cGray + "You can pick up team mates!",
|
||||
C.cYellow + "Right-Click" + C.cGray + " with Sword to " + C.cGreen + "Throw Sheep",
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Throw(PlayerInteractEvent event)
|
||||
{
|
||||
if (!UtilEvent.isAction(event, ActionType.R))
|
||||
return;
|
||||
|
||||
Player thrower = event.getPlayer();
|
||||
|
||||
if (!UtilGear.isMat(thrower.getItemInHand(), Material.IRON_SWORD))
|
||||
return;
|
||||
|
||||
if (thrower.getPassenger() == null)
|
||||
return;
|
||||
|
||||
Entity throwee = thrower.getPassenger();
|
||||
if (throwee == null)
|
||||
return;
|
||||
|
||||
thrower.eject();
|
||||
|
||||
Entity throweeStack = throwee.getPassenger();
|
||||
if (throweeStack != null)
|
||||
{
|
||||
throwee.eject();
|
||||
throweeStack.leaveVehicle();
|
||||
|
||||
final Entity fThrower = thrower;
|
||||
final Entity fThroweeStack = throweeStack;
|
||||
|
||||
Manager.GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
fThrower.setPassenger(fThroweeStack);
|
||||
}
|
||||
}, 2);
|
||||
}
|
||||
|
||||
//Throw
|
||||
UtilAction.velocity(throwee, thrower.getLocation().getDirection(), 1.4, false, 0, 0.3, 0.8, true);
|
||||
Manager.GetProjectile().AddThrow(throwee, thrower, this, -1, true, false, true, false, 2d);
|
||||
|
||||
//Audio
|
||||
thrower.getWorld().playSound(thrower.getLocation(), Sound.SHEEP_IDLE, 2f, 3f);
|
||||
|
||||
//Disallow stacking for 0.5s
|
||||
Recharge.Instance.useForce(thrower, "Sheep Stack", 500);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Collide(LivingEntity target, Block block, ProjectileUser data)
|
||||
{
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
if (target instanceof Player)
|
||||
{
|
||||
if (!Manager.GetGame().IsAlive((Player)target))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//Damage Event
|
||||
Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null,
|
||||
DamageCause.CUSTOM, 6, false, true, false,
|
||||
UtilEnt.getName(data.GetThrower()), GetName());
|
||||
|
||||
//Bounce
|
||||
Vector dir = UtilAlg.getTrajectory(data.GetThrown(), target);
|
||||
if (dir.getY() < 0) dir.setY(0);
|
||||
UtilAction.velocity(target, dir, 1.2, false, 0, 0.4, 1, true);
|
||||
|
||||
dir = UtilAlg.getTrajectory(target, data.GetThrown());
|
||||
if (dir.getY() < 0) dir.setY(0);
|
||||
UtilAction.velocity(data.GetThrown(), dir, 1.2, false, 0, 0.4, 1, true);
|
||||
|
||||
//Effect
|
||||
data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.SHEEP_IDLE, 3f, 5f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Idle(ProjectileUser data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Expire(ProjectileUser data)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -555,7 +555,7 @@ public class GameFlagManager implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
//RESPAW
|
||||
//RESPAWN
|
||||
if (game.DeathSpectateSecs <= 0)
|
||||
{
|
||||
//Teleport
|
||||
@ -577,6 +577,7 @@ public class GameFlagManager implements Listener
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
//TIMER
|
||||
else
|
||||
{
|
||||
UtilInv.Clear(player);
|
||||
@ -585,6 +586,13 @@ public class GameFlagManager implements Listener
|
||||
player.setGameMode(GameMode.CREATIVE);
|
||||
player.setFlying(true);
|
||||
|
||||
for (int i=0 ; i<9 ; i++)
|
||||
player.getInventory().setItem(i, new ItemStack(Material.SKULL));
|
||||
|
||||
UtilAction.velocity(player, new Vector(0,0,0), 1, true, 0.4, 0, 1, true);
|
||||
|
||||
UtilPlayer.message(player, C.cWhite + C.Bold + "You will respawn in " + game.DeathSpectateSecs + " seconds...");
|
||||
|
||||
Manager.GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
|
Loading…
Reference in New Issue
Block a user