A lot of changes
This commit is contained in:
parent
4efb4c1493
commit
d86d5172c0
@ -1,11 +1,5 @@
|
||||
package mineplex.core.friend.ui;
|
||||
|
||||
import mineplex.core.command.CommandCenter;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.friend.FriendManager;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import net.minecraft.server.v1_8_R3.BlockPosition;
|
||||
import net.minecraft.server.v1_8_R3.Blocks;
|
||||
import net.minecraft.server.v1_8_R3.ChatMessage;
|
||||
@ -27,6 +21,12 @@ import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
import mineplex.core.command.CommandCenter;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.friend.FriendManager;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
|
||||
public class AddFriendPage implements Listener
|
||||
{
|
||||
private class AnvilContainer extends ContainerAnvil
|
||||
@ -120,31 +120,32 @@ public class AddFriendPage implements Listener
|
||||
_searching = true;
|
||||
final String name = _itemName;
|
||||
|
||||
CommandCenter.Instance.GetClientManager().checkPlayerName(_player, _itemName, new Callback<String>()
|
||||
CommandCenter.Instance.GetClientManager().checkPlayerName(_player, _itemName, result ->
|
||||
{
|
||||
public void run(String result)
|
||||
{
|
||||
_searching = false;
|
||||
// This needs to be run sync otherwise some really dodgy stuff happens.
|
||||
_friends.runSync(() ->
|
||||
{
|
||||
_searching = false;
|
||||
|
||||
if (result != null)
|
||||
{
|
||||
_friends.addFriend(_player, result);
|
||||
_player.playSound(_player.getLocation(), Sound.NOTE_PLING, 1, 1.6f);
|
||||
if (result != null)
|
||||
{
|
||||
_friends.addFriend(_player, result);
|
||||
_player.playSound(_player.getLocation(), Sound.NOTE_PLING, 1, 1.6f);
|
||||
|
||||
unregisterListener();
|
||||
new FriendsGUI(_friends, _player);
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentInventory.setItem(
|
||||
2,
|
||||
new ItemBuilder(Material.PAPER).setTitle(
|
||||
C.cYellow + "0" + C.cGray + " matches for [" + C.cYellow + name + C.cGray + "]")
|
||||
.build());
|
||||
_player.playSound(_player.getLocation(), Sound.ITEM_BREAK, 1, .6f);
|
||||
}
|
||||
}
|
||||
});
|
||||
unregisterListener();
|
||||
new FriendsGUI(_friends, _player);
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentInventory.setItem(
|
||||
2,
|
||||
new ItemBuilder(Material.PAPER).setTitle(
|
||||
C.cYellow + "0" + C.cGray + " matches for [" + C.cYellow + name + C.cGray + "]")
|
||||
.build());
|
||||
_player.playSound(_player.getLocation(), Sound.ITEM_BREAK, 1, .6f);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3698,8 +3698,8 @@ public enum GameKit
|
||||
{
|
||||
"A skilled bowman!",
|
||||
C.blankLine,
|
||||
receiveArrow(1, 3, 3),
|
||||
C.cYellow + "Charge" + C.cGray + " your Bow to use " + C.cGreen + "Barrage"
|
||||
receiveArrow(1, 3, 2),
|
||||
"Your arrows are " + C.cGreen + "Explosive" + C.cGray + "."
|
||||
},
|
||||
new KitEntityData<>
|
||||
(
|
||||
@ -3728,11 +3728,13 @@ public enum GameKit
|
||||
C.blankLine,
|
||||
"Take " + C.cGreen + "85%" + C.cGray + " knockback",
|
||||
"Deal " + C.cGreen + "115%" + C.cGray + " knockback",
|
||||
C.cYellow + "Drop Weapon" + C.cGray + " to " + C.cGreen + "Spawn a Pet Dog",
|
||||
"Your dog increases the speed of nearby sheep."
|
||||
},
|
||||
new KitEntityData<>
|
||||
(
|
||||
Zombie.class,
|
||||
new ItemStack(Material.LEATHER),
|
||||
new ItemStack(Material.STONE_SWORD),
|
||||
new ItemStack[]
|
||||
{
|
||||
new ItemStack(Material.IRON_BOOTS),
|
||||
@ -3751,15 +3753,16 @@ public enum GameKit
|
||||
null,
|
||||
new String[]
|
||||
{
|
||||
"Easily leaps and jumps around.",
|
||||
"Because he delivers letters?",
|
||||
"Easily leaps and jumps around,",
|
||||
"because he delivers letters?",
|
||||
C.blankLine,
|
||||
leap()
|
||||
click(false, "to use " + C.cGreen + "Seismic Slam"),
|
||||
|
||||
},
|
||||
new KitEntityData<>
|
||||
(
|
||||
Zombie.class,
|
||||
new ItemStack(Material.RABBIT_HIDE),
|
||||
new ItemStack(Material.IRON_AXE),
|
||||
new ItemStack[]
|
||||
{
|
||||
new ItemStack(Material.GOLD_BOOTS),
|
||||
|
@ -1659,7 +1659,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
public void onVote(VoteStartEvent event)
|
||||
{
|
||||
getTitles().forceEnable();
|
||||
getCosmeticManager().setActive(true);
|
||||
getCosmeticManager().showInterface(true);
|
||||
getCosmeticManager().setHideParticles(false);
|
||||
}
|
||||
|
||||
|
@ -841,6 +841,7 @@ public abstract class Game extends ListenerComponent implements Lifetimed
|
||||
continue;
|
||||
}
|
||||
|
||||
kit.registerEvents();
|
||||
UtilServer.RegisterEvents(kit);
|
||||
|
||||
if (kit instanceof LinearUpgradeKit)
|
||||
@ -874,6 +875,7 @@ public abstract class Game extends ListenerComponent implements Lifetimed
|
||||
continue;
|
||||
}
|
||||
|
||||
kit.unregisterEvents();
|
||||
HandlerList.unregisterAll(kit);
|
||||
|
||||
if (kit instanceof LinearUpgradeKit)
|
||||
|
@ -10,7 +10,6 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.EnderDragon;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -29,6 +28,7 @@ import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
@ -166,7 +166,23 @@ public class Dragons extends SoloGame
|
||||
return;
|
||||
}
|
||||
|
||||
_dragons.forEach(MineplexDragon::updateTarget);
|
||||
List<Player> alive = GetPlayers(true);
|
||||
|
||||
_dragons.forEach(dragon ->
|
||||
{
|
||||
dragon.updateTarget();
|
||||
|
||||
for (Player player : UtilEnt.getPlayersInsideEntity(dragon.getEntity(), alive))
|
||||
{
|
||||
if (!Recharge.Instance.use(player, "Hit By " + dragon.getEntity().getEntityId(), 2000, false, false))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
player.playEffect(EntityEffect.HURT);
|
||||
UtilAction.velocity(player, UtilAlg.getTrajectory(dragon.getEntity(), player), 1, false, 0, 0.6, 2, true);
|
||||
}
|
||||
});
|
||||
|
||||
for (Item item : _sparkler.GetItems())
|
||||
{
|
||||
@ -195,7 +211,7 @@ public class Dragons extends SoloGame
|
||||
@EventHandler
|
||||
public void dragonArrowDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (event.GetProjectile() == null)
|
||||
if (event.IsCancelled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -204,35 +220,18 @@ public class Dragons extends SoloGame
|
||||
{
|
||||
if (dragon.getEntity().equals(event.GetDamageeEntity()))
|
||||
{
|
||||
dragon.targetSky();
|
||||
if (event.GetProjectile() == null)
|
||||
{
|
||||
dragon.targetSky();
|
||||
}
|
||||
|
||||
event.SetCancelled("Dragon");
|
||||
dragon.getEntity().playEffect(EntityEffect.HURT);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void knockback(CustomDamageEvent event)
|
||||
{
|
||||
if (event.IsCancelled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Entity damager = event.GetDamagerEntity(true);
|
||||
Player damagee = event.GetDamageePlayer();
|
||||
|
||||
if (damagee == null || damager == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
event.SetCancelled("Dragon");
|
||||
event.SetKnockback(false);
|
||||
|
||||
damagee.playEffect(EntityEffect.HURT);
|
||||
UtilAction.velocity(damagee, UtilAlg.getTrajectory(damager, damagee), 1, false, 0, 0.6, 2, true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void fallDamage(CustomDamageEvent event)
|
||||
{
|
||||
|
@ -300,13 +300,13 @@ public class MilkCow extends SoloGame
|
||||
|
||||
event.setCancelled(true);
|
||||
player.setItemInHand(new ItemStack(Material.MILK_BUCKET));
|
||||
player.updateInventory();
|
||||
Bukkit.broadcastMessage(event.getEventName());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void bucketFill(PlayerBucketFillEvent event)
|
||||
{
|
||||
if (!InProgress())
|
||||
if (!InProgress() || event.getBlockClicked() == null || !event.getBlockClicked().isLiquid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilItem;
|
||||
import mineplex.core.common.util.UtilItem.ItemCategory;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
@ -41,11 +42,27 @@ public class PerkSeismicSlam extends Perk
|
||||
private int _radius;
|
||||
private float _knockbackMagnitude;
|
||||
|
||||
private Map<LivingEntity, Long> _live = new HashMap<>();
|
||||
private final ItemCategory _itemCategory;
|
||||
private final Map<LivingEntity, Long> _live = new HashMap<>();
|
||||
|
||||
public PerkSeismicSlam()
|
||||
{
|
||||
super("Seismic Slam", new String[]{C.cYellow + "Right-Click" + C.cGray + " with Spade to " + C.cGreen + "Seismic Slam"});
|
||||
this("Seismic Slam", 0, 0, 0, 0, 0, ItemCategory.SHOVEL);
|
||||
}
|
||||
|
||||
public PerkSeismicSlam(String name, long cooldown, long time, int damage, int radius, float knockbackMagnitude, ItemCategory itemCategory)
|
||||
{
|
||||
super(name, new String[]
|
||||
{
|
||||
C.cYellow + "Right-Click" + C.cGray + " with Spade to " + C.cGreen + "Seismic Slam"
|
||||
});
|
||||
|
||||
_cooldown = cooldown;
|
||||
_time = time;
|
||||
_damage = damage;
|
||||
_radius = radius;
|
||||
_knockbackMagnitude = knockbackMagnitude;
|
||||
_itemCategory = itemCategory;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -59,54 +76,20 @@ public class PerkSeismicSlam extends Perk
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void deactivateDeath(PlayerDeathEvent event)
|
||||
public void leap(PlayerInteractEvent event)
|
||||
{
|
||||
Player player = event.getEntity();
|
||||
|
||||
if (!hasPerk(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_live.containsKey(player))
|
||||
{
|
||||
_live.remove(player);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Leap(PlayerInteractEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!UtilEvent.isAction(event, ActionType.R))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (UtilBlock.usable(event.getClickedBlock()))
|
||||
if (!UtilEvent.isAction(event, ActionType.R) || UtilBlock.usable(event.getClickedBlock()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!UtilItem.isSpade(player.getItemInHand()))
|
||||
if (!UtilItem.is(player.getItemInHand(), _itemCategory) || !hasPerk(player) || !Recharge.Instance.use(player, GetName(), _cooldown, true, true))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!hasPerk(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true))
|
||||
return;
|
||||
|
||||
// Action
|
||||
Vector vec = player.getLocation().getDirection();
|
||||
if (vec.getY() < 0)
|
||||
@ -124,7 +107,7 @@ public class PerkSeismicSlam extends Perk
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Slam(UpdateEvent event)
|
||||
public void slam(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
{
|
||||
@ -151,9 +134,15 @@ public class PerkSeismicSlam extends Perk
|
||||
continue;
|
||||
}
|
||||
|
||||
if (UtilPlayer.isSpectator(cur))
|
||||
// Inform
|
||||
if (cur instanceof Player)
|
||||
{
|
||||
continue;
|
||||
if (!Manager.canHurt(player, (Player) cur))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UtilPlayer.message(cur, F.main(Manager.getName(), F.name(player.getName()) + " hit you with " + F.skill(GetName()) + "."));
|
||||
}
|
||||
|
||||
// Damage Event
|
||||
@ -161,12 +150,6 @@ public class PerkSeismicSlam extends Perk
|
||||
|
||||
// Condition
|
||||
Manager.GetCondition().Factory().Falling(GetName(), cur, player, 10, false, true);
|
||||
|
||||
// Inform
|
||||
if (cur instanceof Player)
|
||||
{
|
||||
UtilPlayer.message(cur, F.main("Game", F.name(player.getName()) + " hit you with " + F.skill(GetName()) + "."));
|
||||
}
|
||||
}
|
||||
|
||||
// Effect
|
||||
@ -185,7 +168,7 @@ public class PerkSeismicSlam extends Perk
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Knockback(CustomDamageEvent event)
|
||||
public void knockback(CustomDamageEvent event)
|
||||
{
|
||||
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
|
||||
{
|
||||
@ -194,4 +177,10 @@ public class PerkSeismicSlam extends Perk
|
||||
|
||||
event.AddKnockback(GetName(), _knockbackMagnitude);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void deactivateDeath(PlayerDeathEvent event)
|
||||
{
|
||||
_live.remove(event.getEntity());
|
||||
}
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ public class SquidShooters extends SoloGame
|
||||
|
||||
if (damagee != null)
|
||||
{
|
||||
damagee.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 8, 0, false, false), true);
|
||||
damagee.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 10, 0, false, false), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,9 @@ import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilItem;
|
||||
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.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.particles.effects.LineParticle;
|
||||
@ -78,14 +80,14 @@ public class KitRetroSquid extends Kit
|
||||
while (!lineParticle.update())
|
||||
{
|
||||
Location from = lineParticle.getLastLocation().subtract(0, 1, 0);
|
||||
Player closet = UtilPlayer.getClosest(from, 2, player);
|
||||
Player closest = UtilPlayer.getClosest(from, 2, player);
|
||||
|
||||
if (closet == null)
|
||||
if (closest == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
from = closet.getLocation();
|
||||
from = closest.getLocation();
|
||||
|
||||
UtilPlayer.getInRadius(from, 2).forEach((hit, scale) ->
|
||||
{
|
||||
@ -94,7 +96,8 @@ public class KitRetroSquid extends Kit
|
||||
return;
|
||||
}
|
||||
|
||||
player.playSound(player.getLocation(), Sound.SUCCESSFUL_HIT, 1, 1);
|
||||
player.playSound(player.getLocation(), Sound.NOTE_PLING, 1, 1);
|
||||
UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, closest.getLocation().add(0, 1, 0), null, 0.1F, 10, ViewDist.LONG);
|
||||
Manager.GetDamage().NewDamageEvent(hit, player, null, DamageCause.CUSTOM, 7 * scale, true, true, true, player.getName(), NAME);
|
||||
});
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package nautilus.game.arcade.game.games.tug;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@ -14,10 +15,11 @@ public class TugItem
|
||||
private final ItemStack _itemStack;
|
||||
private final int _cost;
|
||||
|
||||
TugItem(EntityType entityType, ItemStack itemStack, int cost)
|
||||
TugItem(EntityType entityType, int cost)
|
||||
{
|
||||
_entityType = entityType;
|
||||
_itemStack = new ItemBuilder(itemStack)
|
||||
_itemStack = new ItemBuilder(Material.MONSTER_EGG)
|
||||
.setData(UtilEnt.getEntityEggData(entityType))
|
||||
.setTitle(C.cYellow + "Spawn a " + UtilEnt.getName(entityType) + C.mBody + " - " + C.cGold + cost + " Gold")
|
||||
.build();
|
||||
_cost = cost;
|
||||
|
@ -1,7 +1,10 @@
|
||||
package nautilus.game.arcade.game.games.tug;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@ -16,18 +19,25 @@ import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.EntityInteractEvent;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.mineplex.anticheat.checks.move.Glide;
|
||||
|
||||
import mineplex.core.Managers;
|
||||
import mineplex.core.antihack.AntiHack;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
@ -41,8 +51,10 @@ import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.events.PlayerKitGiveEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.TeamGame;
|
||||
import nautilus.game.arcade.game.games.tug.entities.TugChicken;
|
||||
import nautilus.game.arcade.game.games.tug.entities.TugCow;
|
||||
import nautilus.game.arcade.game.games.tug.entities.TugEntity;
|
||||
import nautilus.game.arcade.game.games.tug.entities.TugPig;
|
||||
import nautilus.game.arcade.game.games.tug.entities.TugSheep;
|
||||
import nautilus.game.arcade.game.games.tug.kits.KitTugArcher;
|
||||
import nautilus.game.arcade.game.games.tug.kits.KitTugLeaper;
|
||||
@ -65,10 +77,10 @@ public class TugOfWool extends TeamGame
|
||||
private static final int GOLD_SLOT = 8;
|
||||
|
||||
private final Set<TugTeam> _teams;
|
||||
private final Set<TugItem> _items;
|
||||
private final List<TugItem> _items;
|
||||
private final Map<Player, Double> _gold;
|
||||
|
||||
private float _speed = 1;
|
||||
private int _animalsPerIteration = 1;
|
||||
private long _lastIncrease;
|
||||
|
||||
public TugOfWool(ArcadeManager manager)
|
||||
@ -81,13 +93,17 @@ public class TugOfWool extends TeamGame
|
||||
}, DESCRIPTION);
|
||||
|
||||
_teams = new HashSet<>();
|
||||
_items = new HashSet<>();
|
||||
_items = new ArrayList<>();
|
||||
_gold = new HashMap<>();
|
||||
|
||||
DamageFall = false;
|
||||
DeathOut = false;
|
||||
DeathSpectateSecs = 10;
|
||||
HungerSet = 20;
|
||||
|
||||
AntiHack antiHack = Managers.get(AntiHack.class);
|
||||
antiHack.addIgnoredCheck(Glide.class);
|
||||
|
||||
registerChatStats(
|
||||
Kills,
|
||||
Deaths,
|
||||
@ -109,12 +125,9 @@ public class TugOfWool extends TeamGame
|
||||
_teams.add(red);
|
||||
_teams.add(blue);
|
||||
|
||||
_items.add(new TugItem(
|
||||
EntityType.COW,
|
||||
new ItemBuilder(Material.MONSTER_EGG, UtilEnt.getEntityEggData(EntityType.COW))
|
||||
.build(),
|
||||
3
|
||||
));
|
||||
_items.add(new TugItem(EntityType.CHICKEN, 3));
|
||||
_items.add(new TugItem(EntityType.PIG, 5));
|
||||
_items.add(new TugItem(EntityType.COW, 10));
|
||||
}
|
||||
|
||||
private List<Location> setupCrops(String key)
|
||||
@ -169,7 +182,7 @@ public class TugOfWool extends TeamGame
|
||||
|
||||
_teams.forEach(team ->
|
||||
{
|
||||
for (int i = 0; i < _animalsPerIteration && team.getEntities().size() < MAX_ANIMALS; i++)
|
||||
if (team.getEntities().size() < MAX_ANIMALS)
|
||||
{
|
||||
team.getEntities().add(spawnTugEntity(EntityType.SHEEP, team));
|
||||
}
|
||||
@ -179,9 +192,8 @@ public class TugOfWool extends TeamGame
|
||||
|
||||
if (UtilTime.elapsed(_lastIncrease, INCREASE_TIME))
|
||||
{
|
||||
Announce(F.main(getArcadeManager().getName(), "Your animals grow hungrier. Their " + F.elem("Speed") + " and " + F.name("Numbers") + " have increased!"));
|
||||
Announce(F.main(getArcadeManager().getName(), "Your animals grow hungrier. Their " + F.elem("Speed") + " have increased!"));
|
||||
_speed *= 1.1;
|
||||
_animalsPerIteration++;
|
||||
DeathSpectateSecs++;
|
||||
_lastIncrease = System.currentTimeMillis();
|
||||
}
|
||||
@ -216,6 +228,10 @@ public class TugOfWool extends TeamGame
|
||||
return new TugSheep(this, team, getSpawn(team));
|
||||
case COW:
|
||||
return new TugCow(this, team, getSpawn(team));
|
||||
case PIG:
|
||||
return new TugPig(this, team, getSpawn(team));
|
||||
case CHICKEN:
|
||||
return new TugChicken(this, team, getSpawn(team));
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
@ -242,13 +258,8 @@ public class TugOfWool extends TeamGame
|
||||
List<Location> targetCrops = team.getEnemy().getCrops();
|
||||
List<TugEntity> targetEntities = team.getEnemy().getEntities();
|
||||
|
||||
team.getEntities().removeIf(tugEntity ->
|
||||
team.getEntities().forEach(tugEntity ->
|
||||
{
|
||||
if (!tugEntity.getEntity().isValid())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
tugEntity.updateName();
|
||||
|
||||
LivingEntity targetEntity = tugEntity.getTargetEntity();
|
||||
@ -267,7 +278,7 @@ public class TugOfWool extends TeamGame
|
||||
tugEntity.move();
|
||||
}
|
||||
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
Location targetLocation = tugEntity.getTargetLocation();
|
||||
@ -277,7 +288,7 @@ public class TugOfWool extends TeamGame
|
||||
// Attempt to target entity. If successful no need to handle anything else
|
||||
if (tugEntity.attemptTarget(otherTugEntity.getEntity()))
|
||||
{
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -288,27 +299,40 @@ public class TugOfWool extends TeamGame
|
||||
|
||||
if (closest == null)
|
||||
{
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
tugEntity.setTargetLocation(closest);
|
||||
}
|
||||
else if (tugEntity.attemptEat())
|
||||
{
|
||||
for (Player player : team.getEnemy().getGameTeam().GetPlayers(true))
|
||||
{
|
||||
incrementGold(player, 3);
|
||||
}
|
||||
|
||||
targetCrops.remove(targetLocation);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Finally move the entity closer to it's target
|
||||
tugEntity.move();
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
_teams.forEach(team -> team.getEntities().removeIf(tugEntity -> !tugEntity.getEntity().isValid()));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void damage(CustomDamageEvent event)
|
||||
{
|
||||
if (!IsLive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
event.SetDamageToLevel(false);
|
||||
|
||||
if (event.IsCancelled())
|
||||
{
|
||||
return;
|
||||
@ -335,7 +359,15 @@ public class TugOfWool extends TeamGame
|
||||
}
|
||||
else
|
||||
{
|
||||
setGold(damager, getGold(damager) + (damagee instanceof Player ? 2 : 1));
|
||||
if (damagee instanceof Player)
|
||||
{
|
||||
incrementGold(damager, 0.3);
|
||||
}
|
||||
else
|
||||
{
|
||||
event.SetKnockback(false);
|
||||
incrementGold(damager, 0.2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -393,7 +425,6 @@ public class TugOfWool extends TeamGame
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -408,13 +439,13 @@ public class TugOfWool extends TeamGame
|
||||
player.getInventory().setItem(slot++, item.getItemStack());
|
||||
}
|
||||
|
||||
setGold(player, 0);
|
||||
setGold(player, _gold.getOrDefault(player, 0D) / 2D);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void itemInteract(PlayerInteractEvent event)
|
||||
{
|
||||
if (!IsLive())
|
||||
if (!IsLive() || event.getAction() == Action.PHYSICAL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -437,7 +468,7 @@ public class TugOfWool extends TeamGame
|
||||
|
||||
if (gold < item.getCost())
|
||||
{
|
||||
player.sendMessage(F.main(Manager.getName(), "You don't " + C.cGold + "Gold" + C.Reset + " to buy a " + F.name(UtilEnt.getName(item.getEntityType())) + ". You need " + F.count(item.getCost() - gold) + " more."));
|
||||
player.sendMessage(F.main(Manager.getName(), "You don't have enough " + C.cGold + "Gold" + C.mBody + " to buy a " + F.name(UtilEnt.getName(item.getEntityType())) + ". You need " + F.count(item.getCost() - gold) + " more."));
|
||||
return;
|
||||
}
|
||||
else if (!Recharge.Instance.use(player, "Buy Animal", PURCHASE_COOLDOWN, true, true))
|
||||
@ -445,13 +476,38 @@ public class TugOfWool extends TeamGame
|
||||
return;
|
||||
}
|
||||
|
||||
setGold(player, gold - item.getCost());
|
||||
incrementGold(player, -item.getCost());
|
||||
spawnFor(item.getEntityType(), player);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void playerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
_gold.remove(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updatePassiveGold(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC || !IsLive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
if (UtilPlayer.isSpectator(player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
incrementGold(player, 0.05);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler
|
||||
public void ScoreboardUpdate(UpdateEvent event)
|
||||
@ -542,25 +598,41 @@ public class TugOfWool extends TeamGame
|
||||
return _speed;
|
||||
}
|
||||
|
||||
public void setGold(Player player, int amount)
|
||||
public void incrementGold(Player player, double amount)
|
||||
{
|
||||
if (amount == 0)
|
||||
setGold(player, _gold.getOrDefault(player, 0D) + amount);
|
||||
}
|
||||
|
||||
public void setGold(Player player, double amount)
|
||||
{
|
||||
if (amount >= 50)
|
||||
{
|
||||
amount = 50;
|
||||
}
|
||||
|
||||
int amountFloor = (int) Math.floor(amount);
|
||||
|
||||
player.setLevel(amountFloor);
|
||||
player.setExp((float) (amount % 1));
|
||||
|
||||
if (amountFloor == 0)
|
||||
{
|
||||
player.getInventory().setItem(GOLD_SLOT, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.getInventory().setItem(GOLD_SLOT, new ItemBuilder(Material.GOLD_NUGGET, Math.max(1, amount))
|
||||
.setTitle(C.cGold + amount + " Gold")
|
||||
player.getInventory().setItem(GOLD_SLOT, new ItemBuilder(Material.GOLD_NUGGET, Math.max(1, amountFloor))
|
||||
.setTitle(C.cGold + amountFloor + " Gold")
|
||||
.addLore("Collect gold by killing animals", "and players! You can then spend", "it on more animals!")
|
||||
.build());
|
||||
}
|
||||
|
||||
_gold.put(player, amount);
|
||||
}
|
||||
|
||||
public int getGold(Player player)
|
||||
{
|
||||
ItemStack itemStack = player.getInventory().getItem(GOLD_SLOT);
|
||||
return itemStack == null ? 0 : itemStack.getAmount();
|
||||
return (int) Math.floor(_gold.getOrDefault(player, 0D));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -571,5 +643,10 @@ public class TugOfWool extends TeamGame
|
||||
String[] args = event.getMessage().split(" ");
|
||||
_speed = Float.parseFloat(args[1]);
|
||||
}
|
||||
else if (event.getMessage().startsWith("/gold"))
|
||||
{
|
||||
String[] args = event.getMessage().split(" ");
|
||||
incrementGold(event.getPlayer(), Integer.parseInt(args[1]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,54 @@
|
||||
package nautilus.game.arcade.game.games.tug.entities;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Chicken;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import nautilus.game.arcade.game.games.tug.TugOfWool;
|
||||
import nautilus.game.arcade.game.games.tug.TugTeam;
|
||||
|
||||
public class TugChicken extends TugEntity<Chicken>
|
||||
{
|
||||
|
||||
public TugChicken(TugOfWool host, TugTeam team, Location spawn)
|
||||
{
|
||||
super(host, team, spawn, 3, 500);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Chicken spawn(Location location)
|
||||
{
|
||||
Chicken chicken = location.getWorld().spawn(location, Chicken.class);
|
||||
|
||||
chicken.setCustomNameVisible(true);
|
||||
chicken.setMaxHealth(20);
|
||||
chicken.setHealth(chicken.getMaxHealth());
|
||||
|
||||
return chicken;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attack(LivingEntity other)
|
||||
{
|
||||
other.damage(4, _entity);
|
||||
_entity.setVelocity(new Vector(0, 0.5, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attemptTarget(LivingEntity other)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void move()
|
||||
{
|
||||
super.move();
|
||||
|
||||
if (_entity.getTicksLived() % 10 == 0)
|
||||
{
|
||||
attackNearby();
|
||||
}
|
||||
}
|
||||
}
|
@ -4,12 +4,10 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Cow;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
|
||||
import nautilus.game.arcade.game.games.tug.TugOfWool;
|
||||
import nautilus.game.arcade.game.games.tug.TugTeam;
|
||||
@ -19,7 +17,7 @@ public class TugCow extends TugEntity<Cow>
|
||||
|
||||
public TugCow(TugOfWool host, TugTeam team, Location spawn)
|
||||
{
|
||||
super(host, team, spawn, 3, 500);
|
||||
super(host, team, spawn, 4, 400);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -28,7 +26,7 @@ public class TugCow extends TugEntity<Cow>
|
||||
Cow cow = location.getWorld().spawn(location, Cow.class);
|
||||
|
||||
cow.setCustomNameVisible(true);
|
||||
cow.setMaxHealth(40);
|
||||
cow.setMaxHealth(60);
|
||||
cow.setHealth(cow.getMaxHealth());
|
||||
|
||||
return cow;
|
||||
@ -37,7 +35,8 @@ public class TugCow extends TugEntity<Cow>
|
||||
@Override
|
||||
public void attack(LivingEntity other)
|
||||
{
|
||||
|
||||
other.damage(20, _entity);
|
||||
other.getWorld().playSound(other.getLocation(), Sound.COW_IDLE, 1, (float) Math.random());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -46,34 +45,22 @@ public class TugCow extends TugEntity<Cow>
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getSpeed()
|
||||
{
|
||||
return super.getSpeed() * 1.5F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void move()
|
||||
{
|
||||
super.move();
|
||||
|
||||
if (_entity.getTicksLived() % 10 == 0)
|
||||
UtilParticle.PlayParticleToAll(ParticleType.CRIT, _entity.getLocation().add(0, 1, 0), 0.5F, 0.5F, 0.5F, 0, 1, ViewDist.LONG);
|
||||
|
||||
if (_entity.getTicksLived() % 5 == 0)
|
||||
{
|
||||
Location location = _entity.getLocation();
|
||||
|
||||
UtilEnt.getInRadius(location, 4).forEach((entity, scale) ->
|
||||
{
|
||||
if (entity.equals(_entity) || entity instanceof Player)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Vector velocity = UtilAlg.getTrajectory(location, entity.getLocation())
|
||||
.setY(0.6);
|
||||
|
||||
UtilAction.velocity(entity, velocity);
|
||||
location.getWorld().playSound(location, Sound.COW_IDLE, 1, (float) Math.random());
|
||||
});
|
||||
attackNearby();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getSpeed()
|
||||
{
|
||||
return super.getSpeed() * 2;
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
@ -30,7 +31,7 @@ public abstract class TugEntity<T extends LivingEntity>
|
||||
protected final TugOfWool _host;
|
||||
protected final TugTeam _team;
|
||||
protected final T _entity;
|
||||
private final int _attackRangeSquared, _attackRate;
|
||||
private final int _attackRange, _attackRate;
|
||||
|
||||
private Location _targetLocation;
|
||||
private LivingEntity _targetEntity;
|
||||
@ -41,7 +42,7 @@ public abstract class TugEntity<T extends LivingEntity>
|
||||
_host = host;
|
||||
_team = team;
|
||||
_entity = spawn(spawn);
|
||||
_attackRangeSquared = attackRange * attackRange;
|
||||
_attackRange = attackRange;
|
||||
_attackRate = attackRate;
|
||||
|
||||
UtilEnt.vegetate(_entity);
|
||||
@ -54,7 +55,7 @@ public abstract class TugEntity<T extends LivingEntity>
|
||||
|
||||
public boolean attemptAttack(LivingEntity other)
|
||||
{
|
||||
if (!UtilTime.elapsed(_lastAttack, _attackRate) || UtilMath.offsetSquared(_entity, other) > _attackRangeSquared)
|
||||
if (!UtilTime.elapsed(_lastAttack, _attackRate) || UtilMath.offsetSquared(_entity, other) > _attackRange * _attackRange)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -139,6 +140,19 @@ public abstract class TugEntity<T extends LivingEntity>
|
||||
UtilEnt.CreatureMoveFast(_entity, location.clone().add(direction), getSpeed());
|
||||
}
|
||||
|
||||
public void attackNearby()
|
||||
{
|
||||
UtilEnt.getInRadius(_entity.getLocation(), _attackRange).forEach((entity, scale) ->
|
||||
{
|
||||
if (entity.equals(_entity) || entity instanceof Player || _team.isEntity(entity))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
attack(entity);
|
||||
});
|
||||
}
|
||||
|
||||
public float getSpeed()
|
||||
{
|
||||
return _host.getSpeed();
|
||||
|
@ -0,0 +1,70 @@
|
||||
package nautilus.game.arcade.game.games.tug.entities;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Pig;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilItem;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
|
||||
import nautilus.game.arcade.game.games.tug.TugOfWool;
|
||||
import nautilus.game.arcade.game.games.tug.TugTeam;
|
||||
|
||||
public class TugPig extends TugEntity<Pig>
|
||||
{
|
||||
|
||||
public TugPig(TugOfWool host, TugTeam team, Location spawn)
|
||||
{
|
||||
super(host, team, spawn, 3, 500);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pig spawn(Location location)
|
||||
{
|
||||
Pig pig = location.getWorld().spawn(location, Pig.class);
|
||||
|
||||
pig.setCustomNameVisible(true);
|
||||
pig.setMaxHealth(20);
|
||||
pig.setHealth(pig.getMaxHealth());
|
||||
|
||||
return pig;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attack(LivingEntity other)
|
||||
{
|
||||
other.damage(8, _entity);
|
||||
|
||||
int ticks = 20;
|
||||
Item item = UtilItem.dropItem(new ItemStack(Material.PORK), _entity.getLocation().add(0, 1, 0), false, false, ticks, false);
|
||||
item.setVelocity(new Vector((Math.random() - 0.5) / 2, 0.3, (Math.random() - 0.5) / 2));
|
||||
|
||||
_host.getArcadeManager().runSyncLater(() ->
|
||||
{
|
||||
Location location = item.getLocation();
|
||||
|
||||
UtilEnt.getInRadius(location, 3).forEach((entity, scale) ->
|
||||
{
|
||||
if (entity.equals(_entity) || entity instanceof Player && _team.getGameTeam().HasPlayer((Player) entity))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_host.getArcadeManager().GetDamage().NewDamageEvent(entity, other, null, DamageCause.CUSTOM, 6 * scale, true, true, true, entity.getName(), "Explosive Pork");
|
||||
});
|
||||
|
||||
item.getWorld().playSound(location, Sound.EXPLODE, 1, 1);
|
||||
UtilParticle.PlayParticleToAll(ParticleType.LARGE_EXPLODE, location, null, 0, 2, ViewDist.NORMAL);
|
||||
}, ticks);
|
||||
}
|
||||
}
|
@ -20,12 +20,14 @@ public class TugSheep extends TugEntity<Sheep>
|
||||
{
|
||||
Sheep sheep = location.getWorld().spawn(location, Sheep.class);
|
||||
sheep.setColor(_team.getGameTeam().getDyeColor());
|
||||
sheep.setMaxHealth(10);
|
||||
sheep.setHealth(sheep.getMaxHealth());
|
||||
return sheep;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attack(LivingEntity other)
|
||||
{
|
||||
other.damage(4 + Math.random(), _entity);
|
||||
other.damage(4, _entity);
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,24 @@
|
||||
package nautilus.game.arcade.game.games.tug.kits;
|
||||
|
||||
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.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.projectiles.ProjectileSource;
|
||||
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
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.UtilPlayer;
|
||||
import mineplex.core.game.kit.GameKit;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.smash.perks.skeleton.PerkBarrage;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.PerkFletcher;
|
||||
@ -44,8 +54,7 @@ public class KitTugArcher extends Kit
|
||||
|
||||
private static final Perk[] PERKS =
|
||||
{
|
||||
new PerkFletcher(3, 3, true),
|
||||
new PerkBarrage(8, 150, true, false, true)
|
||||
new PerkFletcher(3, 2, true),
|
||||
};
|
||||
|
||||
public KitTugArcher(ArcadeManager manager)
|
||||
@ -59,4 +68,31 @@ public class KitTugArcher extends Kit
|
||||
player.getInventory().addItem(PLAYER_ITEMS);
|
||||
player.getInventory().setArmorContents(PLAYER_ARMOUR);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void projectileHit(ProjectileHitEvent event)
|
||||
{
|
||||
ProjectileSource shooter = event.getEntity().getShooter();
|
||||
|
||||
if (!(shooter instanceof Player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = (Player) shooter;
|
||||
|
||||
if (!HasKit(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Location location = event.getEntity().getLocation().add(0, 1, 0);
|
||||
UtilParticle.PlayParticleToAll(ParticleType.HUGE_EXPLOSION, location, null, 0, 1, ViewDist.LONG);
|
||||
location.getWorld().playSound(location, Sound.EXPLODE, 1.3F, 1);
|
||||
|
||||
UtilEnt.getInRadius(event.getEntity().getLocation(), 6).forEach((nearby, scale) ->
|
||||
{
|
||||
Manager.GetDamage().NewDamageEvent(nearby, player, event.getEntity(), DamageCause.CUSTOM, 8 * scale, true, true, false, player.getName(), "Explosive Arrow");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -4,14 +4,14 @@ import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.UtilItem.ItemCategory;
|
||||
import mineplex.core.game.kit.GameKit;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.smash.perks.golem.PerkSeismicSlam;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.PerkLeap;
|
||||
import nautilus.game.arcade.kit.perks.PerkMammoth;
|
||||
|
||||
public class KitTugLeaper extends Kit
|
||||
{
|
||||
@ -41,7 +41,7 @@ public class KitTugLeaper extends Kit
|
||||
|
||||
private static final Perk[] PERKS =
|
||||
{
|
||||
new PerkLeap("Leap", 1.1, 0.9, 3000)
|
||||
new PerkSeismicSlam("Seismic Slam", 5000, 250, 10, 6, 1, ItemCategory.AXE),
|
||||
};
|
||||
|
||||
public KitTugLeaper(ArcadeManager manager)
|
||||
|
@ -1,17 +1,36 @@
|
||||
package nautilus.game.arcade.game.games.tug.kits;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Sheep;
|
||||
import org.bukkit.entity.Wolf;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.SpigotUtil;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilItem;
|
||||
import mineplex.core.game.kit.GameKit;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.smash.perks.skeleton.PerkBarrage;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.PerkFletcher;
|
||||
import nautilus.game.arcade.kit.perks.PerkMammoth;
|
||||
|
||||
public class KitTugSmasher extends Kit
|
||||
@ -19,7 +38,7 @@ public class KitTugSmasher extends Kit
|
||||
|
||||
private static final ItemStack[] PLAYER_ITEMS =
|
||||
{
|
||||
new ItemBuilder(Material.IRON_SWORD)
|
||||
new ItemBuilder(Material.STONE_SWORD)
|
||||
.setUnbreakable(true)
|
||||
.build()
|
||||
};
|
||||
@ -45,6 +64,11 @@ public class KitTugSmasher extends Kit
|
||||
new PerkMammoth()
|
||||
};
|
||||
|
||||
private static final String WOLF_NAME = "Spawn Dog";
|
||||
private static final long WOLF_COOLDOWN = TimeUnit.SECONDS.toMillis(20);
|
||||
|
||||
private final Map<LivingEntity, Player> _petOwners = new HashMap<>();
|
||||
|
||||
public KitTugSmasher(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameKit.TUG_SMASHER, PERKS);
|
||||
@ -56,4 +80,89 @@ public class KitTugSmasher extends Kit
|
||||
player.getInventory().addItem(PLAYER_ITEMS);
|
||||
player.getInventory().setArmorContents(PLAYER_ARMOUR);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void playerDropItem(PlayerDropItemEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!HasKit(player) || !UtilItem.isSword(event.getItemDrop().getItemStack()) || _petOwners.containsValue(player) || !Recharge.Instance.usable(player, WOLF_NAME, true))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Manager.GetGame().CreatureAllowOverride = true;
|
||||
|
||||
GameTeam team = Manager.GetGame().GetTeam(player);
|
||||
|
||||
Wolf wolf = player.getWorld().spawn(player.getLocation(), Wolf.class);
|
||||
wolf.setCollarColor(team.getDyeColor());
|
||||
wolf.setCustomName(team.GetColor() + player.getName() + "'s Dog");
|
||||
wolf.setCustomNameVisible(true);
|
||||
wolf.setMaxHealth(25);
|
||||
wolf.setHealth(25);
|
||||
|
||||
UtilEnt.vegetate(wolf);
|
||||
SpigotUtil.setOldOwner_RemoveMeWhenSpigotFixesThis(wolf, player);
|
||||
wolf.setOwner(player);
|
||||
player.sendMessage(F.main(Manager.getName(), "You spawned your " + F.name("Pet Dog") + "."));
|
||||
|
||||
_petOwners.put(wolf, player);
|
||||
|
||||
Manager.GetGame().CreatureAllowOverride = false;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updatePets(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FASTEST)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_petOwners.forEach((wolf, player) ->
|
||||
{
|
||||
for (LivingEntity entity : UtilEnt.getInRadius(wolf.getLocation(), 6).keySet())
|
||||
{
|
||||
if (entity instanceof Sheep)
|
||||
{
|
||||
entity.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 20, 1, false, false));
|
||||
}
|
||||
}
|
||||
|
||||
UtilEnt.CreatureMove(wolf, player.getLocation(), 1);
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void entityDeath(EntityDeathEvent event)
|
||||
{
|
||||
Player player = _petOwners.remove(event.getEntity());
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
Recharge.Instance.useForce(player, WOLF_NAME, WOLF_COOLDOWN, true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void playerDeath(PlayerDeathEvent event)
|
||||
{
|
||||
_petOwners.entrySet().removeIf(entry ->
|
||||
{
|
||||
if (event.getEntity().equals(entry.getValue()))
|
||||
{
|
||||
entry.getKey().remove();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterEvents()
|
||||
{
|
||||
_petOwners.clear();
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
@ -113,7 +112,7 @@ public class GameTeamModule extends Module
|
||||
{
|
||||
List<Player> partyMembers = new ArrayList<>(party.getMembers());
|
||||
// Remove party members that are already on a team
|
||||
partyMembers.removeIf(other -> game.GetTeam(other) != null);
|
||||
partyMembers.removeIf(other -> game.GetTeam(other) != null || !players.contains(other));
|
||||
|
||||
// Keep going until we just have 1 party member left
|
||||
while (partyMembers.size() > 1)
|
||||
@ -153,7 +152,7 @@ public class GameTeamModule extends Module
|
||||
List<Player> friends = friendManager.Get(player).getFriends().stream()
|
||||
.filter(friendStatus -> friendStatus.Online)
|
||||
.map(friendStatus -> UtilPlayer.searchExact(friendStatus.UUID))
|
||||
.filter(Objects::nonNull)
|
||||
.filter(players::contains)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (!friends.isEmpty())
|
||||
|
@ -50,11 +50,6 @@ public abstract class Kit implements Listener
|
||||
return _gameKit.getDisplayName();
|
||||
}
|
||||
|
||||
public ItemStack GetItemInHand()
|
||||
{
|
||||
return _gameKit.getEntityData().getInHand();
|
||||
}
|
||||
|
||||
public KitAvailability GetAvailability()
|
||||
{
|
||||
return _gameKit.getAvailability();
|
||||
@ -120,4 +115,12 @@ public abstract class Kit implements Listener
|
||||
|
||||
public void Selected(Player player) { }
|
||||
|
||||
public void registerEvents()
|
||||
{
|
||||
}
|
||||
|
||||
public void unregisterEvents()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,112 +0,0 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.EntityEffect;
|
||||
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.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
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.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
public class PerkSeismicSlamCS extends Perk
|
||||
{
|
||||
public PerkSeismicSlamCS()
|
||||
{
|
||||
super("Ground Pound", new String[]
|
||||
{
|
||||
C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Ground Pound"
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Leap(PlayerInteractEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
||||
return;
|
||||
|
||||
if (UtilBlock.usable(event.getClickedBlock()))
|
||||
return;
|
||||
|
||||
if (event.getPlayer().getItemInHand() == null)
|
||||
return;
|
||||
|
||||
if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE"))
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!Kit.HasKit(player))
|
||||
return;
|
||||
|
||||
if (!Recharge.Instance.use(player, GetName(), 10000, true, true))
|
||||
return;
|
||||
|
||||
//Action
|
||||
double range = 6;
|
||||
|
||||
HashMap<LivingEntity, Double> targets = UtilEnt.getInRadius(player.getLocation(), range);
|
||||
for (LivingEntity cur : targets.keySet())
|
||||
{
|
||||
if (!(cur instanceof Player))
|
||||
return;
|
||||
|
||||
if (cur.equals(player))
|
||||
continue;
|
||||
|
||||
Player other = (Player)cur;
|
||||
|
||||
if (!Manager.GetGame().IsAlive(other))
|
||||
continue;
|
||||
|
||||
if (Manager.GetGame().GetTeam(other).equals(Manager.GetGame().GetTeam(player)))
|
||||
continue;
|
||||
|
||||
//Damage Event
|
||||
Manager.GetDamage().NewDamageEvent(cur, player, null,
|
||||
DamageCause.CUSTOM, 8 * targets.get(cur) + 1, false, true, false,
|
||||
player.getName(), GetName());
|
||||
|
||||
//Velocity
|
||||
UtilAction.velocity(cur,
|
||||
UtilAlg.getTrajectory2d(player.getLocation().toVector(), cur.getLocation().toVector()),
|
||||
1.8 * targets.get(cur), true, 0, 0.4 + 1.0 * targets.get(cur), 1.6, true);
|
||||
|
||||
//Condition
|
||||
Manager.GetCondition().Factory().Falling(GetName(), cur, player, 10, false, true);
|
||||
|
||||
//Inform
|
||||
if (cur instanceof Player)
|
||||
UtilPlayer.message((Player)cur, F.main("Game", F.name(player.getName()) +" hit you with " + F.skill(GetName()) + "."));
|
||||
}
|
||||
|
||||
//Effect
|
||||
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_WOOD, 2f, 0.2f);
|
||||
for (Block cur : UtilBlock.getInRadius(player.getLocation(), 4d).keySet())
|
||||
if (UtilBlock.airFoliage(cur.getRelative(BlockFace.UP)) && !UtilBlock.airFoliage(cur))
|
||||
cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, cur.getTypeId());
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
|
||||
}
|
||||
}
|
@ -29,7 +29,6 @@ import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.managers.voting.command.MapRatingsCommand;
|
||||
import nautilus.game.arcade.managers.voting.event.VoteStartEvent;
|
||||
import nautilus.game.arcade.managers.voting.types.MapVote;
|
||||
import nautilus.game.arcade.managers.voting.ui.VotingPage;
|
||||
import nautilus.game.arcade.managers.voting.ui.VotingShop;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user