Final push
This commit is contained in:
parent
2f77f53648
commit
3f0494a7bb
@ -185,7 +185,7 @@ public enum GameKit
|
||||
"Guess he burnt the bacon",
|
||||
C.blankLine,
|
||||
click(false, "Axe to launch " + C.cGreen + "Crispy Bacon"),
|
||||
"Players on fire take " + C.cGreen + "+30%" + C.cGray + "knockback."
|
||||
"Players on fire take " + C.cGreen + "+30%" + C.cGray + " knockback."
|
||||
},
|
||||
new KitEntityData<>
|
||||
(
|
||||
|
@ -24,7 +24,7 @@ public class HubPlayerManager extends MiniPlugin
|
||||
|
||||
private static final ItemStack GAME_MENU = new ItemBuilder(Material.COMPASS)
|
||||
.setTitle(C.cGreen + "Quick Compass")
|
||||
.addLore("Click to open the Quick Compas.")
|
||||
.addLore("Click to open the Quick Compass.")
|
||||
.build();
|
||||
private static final ItemStack LOBBY_MENU = new ItemBuilder(Material.WATCH)
|
||||
.setTitle(C.cGreen + "Lobby Selector")
|
||||
|
@ -104,7 +104,7 @@ public class DeathTag extends SoloGame
|
||||
{
|
||||
if (Math.random() < 0.5)
|
||||
{
|
||||
MapUtil.QuickChangeBlockAt(location, Material.WOOL, (byte) 15);
|
||||
MapUtil.QuickChangeBlockAt(location, Material.GOLD_BLOCK);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -153,20 +153,12 @@ public class BombLobbers extends TeamGame implements IThrown
|
||||
|
||||
public void addKill(Player player)
|
||||
{
|
||||
_kills.put(player, _kills.containsKey(player) ? _kills.get(player) + 1 : 1);
|
||||
_kills.put(player, _kills.getOrDefault(player, 0D) + 1);
|
||||
}
|
||||
|
||||
public double getKills(Player player)
|
||||
{
|
||||
if (_kills.containsKey(player))
|
||||
{
|
||||
return _kills.get(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
_kills.put(player, 0.0);
|
||||
return 0;
|
||||
}
|
||||
return _kills.getOrDefault(player, 0D);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -1,17 +1,17 @@
|
||||
package nautilus.game.arcade.game.games.lobbers.kits;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.game.kit.GameKit;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.events.PlayerKitApplyEvent;
|
||||
import nautilus.game.arcade.game.games.lobbers.kits.perks.PerkCraftman;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
@ -24,16 +24,19 @@ public class KitArmorer extends Kit
|
||||
private static final Perk[] PERKS =
|
||||
{
|
||||
new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
|
||||
new PerkDummy("Armorer", Collections.singletonList(C.cGray + "Receive " + C.cYellow + "Full Gold Armor").toArray(new String[1])),
|
||||
new PerkDummy("Armorer", new String[]
|
||||
{
|
||||
C.cGray + "Receive " + C.cYellow + "Full Iron Armor"
|
||||
}),
|
||||
new PerkCraftman(),
|
||||
};
|
||||
|
||||
private static final ItemStack[] PLAYER_ARMOR =
|
||||
{
|
||||
ItemStackFactory.Instance.CreateStack(Material.GOLD_BOOTS),
|
||||
ItemStackFactory.Instance.CreateStack(Material.GOLD_LEGGINGS),
|
||||
ItemStackFactory.Instance.CreateStack(Material.GOLD_CHESTPLATE),
|
||||
ItemStackFactory.Instance.CreateStack(Material.GOLD_HELMET),
|
||||
ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS),
|
||||
ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS),
|
||||
ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE),
|
||||
ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET),
|
||||
};
|
||||
|
||||
public KitArmorer(ArcadeManager manager)
|
||||
@ -44,6 +47,14 @@ public class KitArmorer extends Kit
|
||||
@Override
|
||||
public void ApplyKit(Player player)
|
||||
{
|
||||
PlayerKitApplyEvent applyEvent = new PlayerKitApplyEvent(Manager.GetGame(), this, player);
|
||||
UtilServer.CallEvent(applyEvent);
|
||||
|
||||
if (applyEvent.isCancelled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UtilInv.Clear(player);
|
||||
|
||||
for (Perk perk : GetPerks())
|
||||
|
@ -11,11 +11,13 @@ import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.game.kit.GameKit;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.events.PlayerKitApplyEvent;
|
||||
import nautilus.game.arcade.game.games.lobbers.events.TNTThrowEvent;
|
||||
import nautilus.game.arcade.game.games.lobbers.kits.perks.PerkCraftman;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
@ -52,6 +54,14 @@ public class KitPitcher extends Kit
|
||||
@Override
|
||||
public void ApplyKit(Player player)
|
||||
{
|
||||
PlayerKitApplyEvent applyEvent = new PlayerKitApplyEvent(Manager.GetGame(), this, player);
|
||||
UtilServer.CallEvent(applyEvent);
|
||||
|
||||
if (applyEvent.isCancelled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UtilInv.Clear(player);
|
||||
|
||||
for (Perk perk : GetPerks())
|
||||
|
@ -840,9 +840,9 @@ public class TurfForts extends TeamGame
|
||||
|
||||
Location nearest = UtilAlg.findClosest(location, averages.keySet());
|
||||
|
||||
if (!averages.get(nearest).equals(team))
|
||||
if (!averages.get(nearest).equals(team) && Recharge.Instance.use(player, "Spawn Damage", 2000, false, false))
|
||||
{
|
||||
knockback(player, team);
|
||||
Manager.GetDamage().NewDamageEvent(player, null, null, DamageCause.CUSTOM, _fight ? 2 : 500, false, true, true, GetName(), "Spawn");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ public class KitHumanArcher extends Kit
|
||||
|
||||
private static final Perk[] PERKS =
|
||||
{
|
||||
new PerkDoubleJump("Double Jump", 1.2, 1, true, 4000, true),
|
||||
new PerkDoubleJump("Double Jump", 1.2, 1, true, 6000, true),
|
||||
new PerkWitherArrowBlind(6),
|
||||
new PerkFletcher(4, 4, true),
|
||||
};
|
||||
|
@ -1,37 +1,41 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilItem;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.event.PerkLeapEvent;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Horse;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
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.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.event.PerkLeapEvent;
|
||||
|
||||
public class PerkLeap extends Perk
|
||||
{
|
||||
private String _name;
|
||||
private double _power;
|
||||
private double _heightMax;
|
||||
private long _recharge;
|
||||
private int _maxUses;
|
||||
|
||||
private Map<String, Integer> _uses = new HashMap<>();
|
||||
private final String _name;
|
||||
private final double _power, _heightMax;
|
||||
private final long _recharge;
|
||||
private final int _maxUses;
|
||||
|
||||
private final Map<String, Integer> _uses = new HashMap<>();
|
||||
|
||||
public PerkLeap(String name, double power, double heightLimit, long recharge)
|
||||
{
|
||||
@ -61,36 +65,28 @@ public class PerkLeap extends Perk
|
||||
_maxUses = uses;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
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 (!UtilItem.isAxe(event.getPlayer().getItemInHand()))
|
||||
if (!UtilEvent.isAction(event, ActionType.R) || UtilBlock.usable(event.getClickedBlock()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
ItemStack itemStack = player.getItemInHand();
|
||||
|
||||
if (!hasPerk(player))
|
||||
if (itemStack == null || !UtilItem.isAxe(itemStack) || !hasPerk(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//Check Uses
|
||||
if (_maxUses > 0)
|
||||
{
|
||||
if (!_uses.containsKey(player.getName()))
|
||||
_uses.put(player.getName(), _maxUses);
|
||||
int count = _uses.computeIfAbsent(player.getName(), k -> _maxUses);
|
||||
|
||||
if (_uses.get(player.getName()) <= 0)
|
||||
if (count <= 0)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(_name) + " anymore."));
|
||||
return;
|
||||
@ -99,7 +95,9 @@ public class PerkLeap extends Perk
|
||||
|
||||
//Energy
|
||||
if (!Recharge.Instance.use(player, _name, _recharge, false, true))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//Use Use
|
||||
if (_maxUses > 0)
|
||||
@ -108,6 +106,7 @@ public class PerkLeap extends Perk
|
||||
count--;
|
||||
|
||||
player.setExp(Math.min(0.99f, (float)count/(float)_maxUses));
|
||||
player.getItemInHand().setAmount(count);
|
||||
|
||||
_uses.put(player.getName(), count);
|
||||
}
|
||||
@ -142,6 +141,27 @@ public class PerkLeap extends Perk
|
||||
_uses.remove(event.getEntity().getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registeredEvents()
|
||||
{
|
||||
for (Player player : Manager.GetGame().GetPlayers(true))
|
||||
{
|
||||
if (!hasPerk(player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for (ItemStack itemStack : player.getInventory().getContents())
|
||||
{
|
||||
if (UtilItem.isAxe(itemStack))
|
||||
{
|
||||
itemStack.setAmount(_maxUses);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisteredEvents()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user