Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex
This commit is contained in:
commit
bd19369ddb
@ -1,11 +1,14 @@
|
||||
package mineplex.core.donation;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UUIDFetcher;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
|
||||
public class CoinCommand extends CommandBase<DonationManager>
|
||||
@ -20,32 +23,58 @@ public class CoinCommand extends CommandBase<DonationManager>
|
||||
{
|
||||
if (args.length < 2)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Coin", "Missing Args"));
|
||||
UtilPlayer.message(caller, F.main("Coin", "Missing Args: " + F.elem("/coin <player> <amount>")));
|
||||
return;
|
||||
}
|
||||
|
||||
//Try Online
|
||||
final Player target = UtilPlayer.searchOnline(caller, args[0], true);
|
||||
String targetName = args[0];
|
||||
String coinsString = args[1];
|
||||
Player target = UtilPlayer.searchExact(targetName);
|
||||
|
||||
if (target == null)
|
||||
return;
|
||||
{
|
||||
UUID uuid = UUIDFetcher.getUUIDOf(targetName);
|
||||
if (uuid != null)
|
||||
{
|
||||
rewardCoins(caller, null, targetName, uuid, coinsString);
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Coin", "Could not find player " + F.name(targetName)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rewardCoins(caller, target, target.getName(), target.getUniqueId(), coinsString);
|
||||
}
|
||||
}
|
||||
|
||||
//Give Coins to Target
|
||||
private void rewardCoins(final Player caller, final Player target, final String targetName, final UUID uuid, String coinsString)
|
||||
{
|
||||
try
|
||||
{
|
||||
final int coins = Integer.parseInt(args[1]);
|
||||
Plugin.RewardCoins(new Callback<Boolean>()
|
||||
{
|
||||
public void run(Boolean completed)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Coin", "You gave " + F.elem(coins + " Coins") + " to " + F.name(target.getName()) + "."));
|
||||
UtilPlayer.message(target, F.main("Coin", F.name(caller.getName()) + " gave you " + F.elem(coins + " Coins") + "."));
|
||||
}
|
||||
}, caller.getName(), target.getName(), target.getUniqueId(), coins);
|
||||
int coins = Integer.parseInt(coinsString);
|
||||
rewardCoins(caller, target, targetName, uuid, coins);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Coin", "Invalid Coins Amount"));
|
||||
}
|
||||
}
|
||||
|
||||
private void rewardCoins(final Player caller, final Player target, final String targetName, final UUID uuid, final int coins)
|
||||
{
|
||||
Plugin.RewardCoins(new Callback<Boolean>()
|
||||
{
|
||||
public void run(Boolean completed)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Coin", "You gave " + F.elem(coins + " Coins") + " to " + F.name(targetName) + "."));
|
||||
|
||||
if (target != null)
|
||||
{
|
||||
UtilPlayer.message(target, F.main("Coin", F.name(caller.getName()) + " gave you " + F.elem(coins + " Coins") + "."));
|
||||
}
|
||||
}
|
||||
}, caller.getName(), targetName, uuid, coins);
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,14 @@
|
||||
package mineplex.core.donation;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UUIDFetcher;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
|
||||
public class GemCommand extends CommandBase<DonationManager>
|
||||
@ -20,32 +23,58 @@ public class GemCommand extends CommandBase<DonationManager>
|
||||
{
|
||||
if (args.length < 2)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Gem", "Missing Args"));
|
||||
UtilPlayer.message(caller, F.main("gem", "Missing Args: " + F.elem("/gem <player> <amount>")));
|
||||
return;
|
||||
}
|
||||
|
||||
//Try Online
|
||||
final Player target = UtilPlayer.searchOnline(caller, args[0], true);
|
||||
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
//Give Gems to Target
|
||||
|
||||
String targetName = args[0];
|
||||
String gemsString = args[1];
|
||||
Player target = UtilPlayer.searchExact(targetName);
|
||||
|
||||
if (target == null)
|
||||
{
|
||||
UUID uuid = UUIDFetcher.getUUIDOf(targetName);
|
||||
if (uuid != null)
|
||||
{
|
||||
rewardGems(caller, null, targetName, uuid, gemsString);
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Gem", "Could not find player " + F.name(targetName)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rewardGems(caller, target, target.getName(), target.getUniqueId(), gemsString);
|
||||
}
|
||||
}
|
||||
|
||||
private void rewardGems(final Player caller, final Player target, final String targetName, final UUID uuid, String gemsString)
|
||||
{
|
||||
try
|
||||
{
|
||||
final int gems = Integer.parseInt(args[1]);
|
||||
Plugin.RewardGems(new Callback<Boolean>()
|
||||
{
|
||||
public void run(Boolean completed)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Gem", "You gave " + F.elem(gems + " Gems") + " to " + F.name(target.getName()) + "."));
|
||||
UtilPlayer.message(target, F.main("Gem", F.name(caller.getName()) + " gave you " + F.elem(gems + " Gems") + "."));
|
||||
}
|
||||
}, caller.getName(), target.getName(), target.getUniqueId(), gems);
|
||||
int gems = Integer.parseInt(gemsString);
|
||||
rewardGems(caller, target, targetName, uuid, gems);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Gem", "Invalid Gem Amount"));
|
||||
UtilPlayer.message(caller, F.main("gem", "Invalid gems Amount"));
|
||||
}
|
||||
}
|
||||
|
||||
private void rewardGems(final Player caller, final Player target, final String targetName, final UUID uuid, final int gems)
|
||||
{
|
||||
Plugin.RewardGems(new Callback<Boolean>()
|
||||
{
|
||||
public void run(Boolean completed)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("gem", "You gave " + F.elem(gems + " gems") + " to " + F.name(targetName) + "."));
|
||||
|
||||
if (target != null)
|
||||
{
|
||||
UtilPlayer.message(target, F.main("gem", F.name(caller.getName()) + " gave you " + F.elem(gems + " gems") + "."));
|
||||
}
|
||||
}
|
||||
}, caller.getName(), targetName, uuid, gems);
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
import mineplex.core.MiniClientPlugin;
|
||||
import mineplex.core.account.event.RetrieveClientInformationEvent;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.inventory.command.GiveItemCommand;
|
||||
import mineplex.core.inventory.data.Category;
|
||||
import mineplex.core.inventory.data.InventoryRepository;
|
||||
import mineplex.core.inventory.data.Item;
|
||||
@ -129,4 +130,10 @@ public class InventoryManager extends MiniClientPlugin<ClientInventory>
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void AddCommands()
|
||||
{
|
||||
AddCommand(new GiveItemCommand(this));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,69 @@
|
||||
package mineplex.core.inventory.command;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UUIDFetcher;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
|
||||
/**
|
||||
* Created by Shaun on 10/26/2014.
|
||||
*/
|
||||
public class GiveItemCommand extends CommandBase<InventoryManager>
|
||||
{
|
||||
public GiveItemCommand(InventoryManager plugin)
|
||||
{
|
||||
super(plugin, Rank.ADMIN, "giveitem");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (args == null || args.length < 3)
|
||||
{
|
||||
displayUsage(caller);
|
||||
return;
|
||||
}
|
||||
|
||||
final String playerName = args[0];
|
||||
final int amount = Integer.parseInt(args[1]);
|
||||
String tempItemName = "";
|
||||
for (int i = 2; i < args.length; i++)
|
||||
{
|
||||
tempItemName += args[i] + " ";
|
||||
}
|
||||
final String itemName = tempItemName.trim();
|
||||
|
||||
Player player = UtilPlayer.searchExact(playerName);
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
Plugin.addItemToInventory(player, "Item", itemName, amount);
|
||||
UtilPlayer.message(caller, F.main("Item", "You gave " + F.elem(amount + " " + itemName) + " to player " + F.name(playerName)));
|
||||
UtilPlayer.message(player, F.main("Item", F.name(caller.getName()) + " gave you " + F.elem(amount + " " + itemName)));
|
||||
}
|
||||
else
|
||||
{
|
||||
UUID uuid = UUIDFetcher.getUUIDOf(playerName);
|
||||
if (uuid != null)
|
||||
{
|
||||
Plugin.addItemToInventoryForOffline(uuid.toString(), "Item", itemName, amount);
|
||||
UtilPlayer.message(caller, F.main("Item", "You gave " + F.elem(amount + " " + itemName) + " to offline player " + F.name(playerName)));
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Item", "Player " + F.name(playerName) + " does not exist!"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void displayUsage(Player caller)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Item", "Usage: " + F.elem("/giveitem <playername> <item name> <amount>")));
|
||||
}
|
||||
}
|
@ -83,11 +83,14 @@ public class Npc
|
||||
|
||||
public void returnToPost()
|
||||
{
|
||||
EntityCreature ec = ((CraftCreature) _entity).getHandle();
|
||||
if (_entity instanceof CraftCreature)
|
||||
{
|
||||
EntityCreature ec = ((CraftCreature) _entity).getHandle();
|
||||
|
||||
ec.getNavigation().a(getLocation().getX(), getLocation().getY(), getLocation().getZ(), .8f);
|
||||
ec.getNavigation().a(getLocation().getX(), getLocation().getY(), getLocation().getZ(), .8f);
|
||||
|
||||
_returning = true;
|
||||
_returning = true;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isReturning()
|
||||
@ -95,13 +98,16 @@ public class Npc
|
||||
return _returning;
|
||||
}
|
||||
|
||||
public void clearGoals(Entity entity)
|
||||
public void clearGoals()
|
||||
{
|
||||
_returning = false;
|
||||
if (_entity instanceof CraftCreature)
|
||||
{
|
||||
_returning = false;
|
||||
|
||||
Location entityLocation = entity.getLocation();
|
||||
EntityCreature ec = ((CraftCreature) entity).getHandle();
|
||||
ec.getNavigation().a(entityLocation.getX(), entityLocation.getY(), entityLocation.getZ(), .8f);
|
||||
Location entityLocation = _entity.getLocation();
|
||||
EntityCreature ec = ((CraftCreature) _entity).getHandle();
|
||||
ec.getNavigation().a(entityLocation.getX(), entityLocation.getY(), entityLocation.getZ(), .8f);
|
||||
}
|
||||
}
|
||||
|
||||
public NpcManager getNpcManager()
|
||||
|
@ -451,15 +451,15 @@ public class NpcManager extends MiniPlugin
|
||||
entity.setVelocity(new Vector(0, 0, 0));
|
||||
npc.setFailedAttempts(0);
|
||||
}
|
||||
else if (!npc.isInRadius(entity.getLocation()))
|
||||
else if (!npc.isInRadius(entity.getLocation()) && npc.getEntity() instanceof CraftCreature)
|
||||
{
|
||||
npc.returnToPost();
|
||||
npc.incrementFailedAttempts();
|
||||
}
|
||||
else
|
||||
else if (npc.getEntity() instanceof CraftCreature)
|
||||
{
|
||||
if (npc.isReturning())
|
||||
npc.clearGoals(entity);
|
||||
npc.clearGoals();
|
||||
|
||||
npc.setFailedAttempts(0);
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ public class ServerNpcPage extends ShopPageBase<ServerManager, ServerNpcShop> im
|
||||
}
|
||||
}
|
||||
|
||||
AddButton(40, new ShopItem(Material.GOLD_BLOCK, C.cAqua + yellowCount++ + " Games In Progress", new String[]{MESSAGE_SPECTATE}, yellowCount > 64 ? 1 : yellowCount, false), new SingleButton()
|
||||
AddButton(40, new ShopItem(Material.GOLD_BLOCK, C.cAqua + yellowCount + " Game" + (yellowCount == 1 ? "" : "s") + " In Progress", new String[]{MESSAGE_SPECTATE}, yellowCount > 64 ? 1 : yellowCount, false), new SingleButton()
|
||||
{
|
||||
@Override
|
||||
public void Clicked(Player player)
|
||||
|
@ -2,10 +2,12 @@ package mineplex.minecraft.game.core.combat;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
import mineplex.minecraft.game.core.damage.DamageChange;
|
||||
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -32,12 +34,12 @@ public class CombatComponent
|
||||
}
|
||||
}
|
||||
|
||||
public void AddDamage(String source, double dmg)
|
||||
public void AddDamage(String source, double dmg, List<DamageChange> mod)
|
||||
{
|
||||
if (source == null)
|
||||
source = "-";
|
||||
|
||||
GetDamage().addFirst(new CombatDamage(source, dmg));
|
||||
GetDamage().addFirst(new CombatDamage(source, dmg, mod));
|
||||
LastDamage = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
|
@ -1,16 +1,23 @@
|
||||
package mineplex.minecraft.game.core.combat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mineplex.minecraft.game.core.damage.DamageChange;
|
||||
|
||||
public class CombatDamage
|
||||
{
|
||||
private String _name;
|
||||
private double _dmg;
|
||||
private long _time;
|
||||
private List<DamageChange> _mod = new ArrayList<>();
|
||||
|
||||
public CombatDamage(String name, double dmg)
|
||||
public CombatDamage(String name, double dmg, List<DamageChange> mod)
|
||||
{
|
||||
_name = name;
|
||||
_dmg = dmg;
|
||||
_time = System.currentTimeMillis();
|
||||
_mod = mod;
|
||||
}
|
||||
|
||||
public String GetName()
|
||||
@ -27,4 +34,9 @@ public class CombatDamage
|
||||
{
|
||||
return _time;
|
||||
}
|
||||
|
||||
public List<DamageChange> getDamageMod()
|
||||
{
|
||||
return _mod;
|
||||
}
|
||||
}
|
||||
|
@ -3,9 +3,11 @@ package mineplex.minecraft.game.core.combat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.minecraft.game.core.damage.DamageChange;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
@ -45,12 +47,12 @@ public class CombatLog
|
||||
}
|
||||
|
||||
public void Attacked(String damagerName, double damage,
|
||||
LivingEntity damagerEnt, String attackName)
|
||||
LivingEntity damagerEnt, String attackName, List<DamageChange> mod)
|
||||
{
|
||||
// Add Attacked
|
||||
CombatComponent comp = GetEnemy(damagerName, damagerEnt);
|
||||
|
||||
comp.AddDamage(attackName, damage);
|
||||
comp.AddDamage(attackName, damage, mod);
|
||||
|
||||
// Set Last
|
||||
LastDamager = comp;
|
||||
|
@ -84,7 +84,7 @@ public class CombatManager extends MiniPlugin
|
||||
Get(damagee).Attacked(
|
||||
UtilEnt.getName(damagerEnt),
|
||||
event.getDamage(), damagerEnt,
|
||||
event.getCause() + "");
|
||||
event.getCause() + "", null);
|
||||
}
|
||||
// Damager is WORLD
|
||||
else
|
||||
@ -181,7 +181,7 @@ public class CombatManager extends MiniPlugin
|
||||
}
|
||||
|
||||
Get(damagee).Attacked(source,
|
||||
event.getDamage(), null, reason);
|
||||
event.getDamage(), null, reason, null);
|
||||
}
|
||||
|
||||
}
|
||||
@ -231,7 +231,7 @@ public class CombatManager extends MiniPlugin
|
||||
Get(event.GetDamageePlayer()).Attacked(
|
||||
UtilEnt.getName(event.GetDamagerEntity(true)),
|
||||
(int) event.GetDamage(), event.GetDamagerEntity(true),
|
||||
reason);
|
||||
reason, event.GetDamageMod());
|
||||
}
|
||||
// Damager is WORLD
|
||||
else
|
||||
@ -331,7 +331,7 @@ public class CombatManager extends MiniPlugin
|
||||
reason = event.GetReason();
|
||||
|
||||
Get(event.GetDamageePlayer()).Attacked(source,
|
||||
(int) event.GetDamage(), null, reason);
|
||||
(int) event.GetDamage(), null, reason, event.GetDamageMod());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ public class KitSheepPig extends Kit
|
||||
{
|
||||
public KitSheepPig(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "'Pig'", KitAvailability.Gem, 5000,
|
||||
super(manager, "Pig", KitAvailability.Gem, 5000,
|
||||
|
||||
new String[]
|
||||
{
|
||||
|
@ -51,42 +51,12 @@ import nautilus.game.arcade.game.SoloGame;
|
||||
import nautilus.game.arcade.game.games.snake.kits.KitInvulnerable;
|
||||
import nautilus.game.arcade.game.games.snake.kits.KitSpeed;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.stats.CannibalStatTracker;
|
||||
import nautilus.game.arcade.stats.ChooChooStatTracker;
|
||||
import nautilus.game.arcade.stats.KillsWithinGameStatTracker;
|
||||
import nautilus.game.arcade.stats.SlimySheepStatTracker;
|
||||
|
||||
public class Snake extends SoloGame
|
||||
{
|
||||
public static class TailCollisionEvent extends PlayerEvent
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
private final Player _killer;
|
||||
|
||||
public TailCollisionEvent(Player who, Player killer)
|
||||
{
|
||||
super(who);
|
||||
|
||||
_killer = killer;
|
||||
}
|
||||
|
||||
public Player getKiller()
|
||||
{
|
||||
return _killer;
|
||||
}
|
||||
}
|
||||
|
||||
public static class TailGrowEvent extends PlayerEvent
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
@ -177,7 +147,7 @@ public class Snake extends SoloGame
|
||||
this.GemMultiplier = 0.5;
|
||||
|
||||
registerStatTrackers(
|
||||
new CannibalStatTracker(this),
|
||||
new KillsWithinGameStatTracker(this, 8, "Cannibal"),
|
||||
new ChooChooStatTracker(this),
|
||||
new SlimySheepStatTracker(this)
|
||||
);
|
||||
@ -395,8 +365,6 @@ public class Snake extends SoloGame
|
||||
Manager.GetDamage().NewDamageEvent(player, killer, null,
|
||||
DamageCause.CUSTOM, 500, false, true, false,
|
||||
killer.getName(), "Snake Tail");
|
||||
|
||||
Bukkit.getPluginManager().callEvent(new TailCollisionEvent(player, killer));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -175,7 +175,7 @@ public class PerkBomber extends Perk
|
||||
@EventHandler
|
||||
public void ExplosionPrime(ExplosionPrimeEvent event)
|
||||
{
|
||||
Player player = _tntMap.remove(event.getEntity());
|
||||
Player player = _tntMap.get(event.getEntity());
|
||||
if (player != null)
|
||||
{
|
||||
for (Player other : UtilPlayer.getNearby(event.getEntity().getLocation(), 14))
|
||||
@ -185,7 +185,7 @@ public class PerkBomber extends Perk
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onEntityExplode(EntityExplodeEvent event)
|
||||
{
|
||||
Player player = _tntMap.remove(event.getEntity());
|
||||
@ -198,16 +198,9 @@ public class PerkBomber extends Perk
|
||||
|
||||
if (block.getType() == Material.DIAMOND_ORE)
|
||||
{
|
||||
Bukkit.getPluginManager().callEvent(new BomberExplodeDiamondBlock(player, block));
|
||||
block.breakNaturally();
|
||||
it.remove();
|
||||
|
||||
if (Math.random() < event.getYield())
|
||||
{
|
||||
block.breakNaturally();
|
||||
|
||||
Bukkit.getPluginManager().callEvent(new BomberExplodeDiamondBlock(player, block));
|
||||
}
|
||||
else
|
||||
block.setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,37 +0,0 @@
|
||||
package nautilus.game.arcade.stats;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.games.snake.Snake;
|
||||
|
||||
public class CannibalStatTracker extends StatTracker<Game>
|
||||
{
|
||||
private final Map<UUID, Integer> _kills = new HashMap<>();
|
||||
|
||||
public CannibalStatTracker(Game game)
|
||||
{
|
||||
super(game);
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onTailCollision(Snake.TailCollisionEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
Integer killCount = _kills.get(event.getKiller().getUniqueId());
|
||||
|
||||
killCount = (killCount == null ? 0 : killCount) + 1;
|
||||
|
||||
_kills.put(event.getKiller().getUniqueId(), killCount);
|
||||
|
||||
if (killCount >= 8)
|
||||
addStat(event.getKiller(), "Cannibal", 1, true, false);
|
||||
}
|
||||
}
|
@ -24,7 +24,7 @@ public class KaboomStatTracker extends StatTracker<MineStrike>
|
||||
{
|
||||
for (Player player : event.getDamagedPlayers())
|
||||
{
|
||||
if (!player.isDead())
|
||||
if (player.getHealth() != player.getMaxHealth())
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,10 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.minecraft.game.core.combat.CombatComponent;
|
||||
import mineplex.minecraft.game.core.combat.CombatDamage;
|
||||
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||
import mineplex.minecraft.game.core.damage.DamageChange;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
|
||||
public class KillReasonStatTracker extends StatTracker<Game>
|
||||
@ -49,6 +52,27 @@ public class KillReasonStatTracker extends StatTracker<Game>
|
||||
|
||||
if (event.GetLog().GetLastDamager() != null && event.GetLog().GetLastDamager().GetReason() != null && event.GetLog().GetLastDamager().GetReason().contains(getReason()))
|
||||
addStat(killer, getStatName(), 1, false, false);
|
||||
else
|
||||
{
|
||||
for (CombatComponent component : event.GetLog().GetAttackers())
|
||||
{
|
||||
for (CombatDamage damage : component.GetDamage())
|
||||
{
|
||||
if (damage.getDamageMod() != null)
|
||||
{
|
||||
for (DamageChange mod : damage.getDamageMod())
|
||||
{
|
||||
if (mod.GetReason() != null && mod.GetReason().contains(getReason()))
|
||||
{
|
||||
addStat(killer, getStatName(), 1, false, false);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getStatName()
|
||||
|
@ -69,7 +69,7 @@ public class KillsWithConditionStatTracker extends StatTracker<Game>
|
||||
return;
|
||||
|
||||
Condition condition = getGame().Manager.GetCondition().GetActiveCondition(player, getConditionType());
|
||||
if (condition != null && condition.GetType() == getConditionType() && condition.GetReason() != null && condition.GetReason().contains("Flash Bang"))
|
||||
if (condition != null && condition.GetType() == getConditionType() && condition.GetReason() != null && condition.GetReason().contains(getConditionReason()))
|
||||
{
|
||||
Integer kills = _kills.get(player.getUniqueId());
|
||||
kills = (kills == null ? 0 : kills) + 1;
|
||||
|
@ -14,15 +14,15 @@ import nautilus.game.arcade.game.Game;
|
||||
|
||||
public class KillsWithinGameStatTracker extends StatTracker<Game>
|
||||
{
|
||||
private final int _necessarykillCount;
|
||||
private final int _necessaryKillCount;
|
||||
private final String _statName;
|
||||
private final Map<UUID, Integer> _kills = new HashMap<>();
|
||||
|
||||
public KillsWithinGameStatTracker(Game game, int necessarykillCount, String statName)
|
||||
public KillsWithinGameStatTracker(Game game, int necessaryKillCount, String statName)
|
||||
{
|
||||
super(game);
|
||||
|
||||
_necessarykillCount = necessarykillCount;
|
||||
_necessaryKillCount = necessaryKillCount;
|
||||
_statName = statName;
|
||||
}
|
||||
|
||||
@ -31,9 +31,9 @@ public class KillsWithinGameStatTracker extends StatTracker<Game>
|
||||
return _statName;
|
||||
}
|
||||
|
||||
public int getNecessarykillCount()
|
||||
public int getNecessaryKillCount()
|
||||
{
|
||||
return _necessarykillCount;
|
||||
return _necessaryKillCount;
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
@ -56,7 +56,7 @@ public class KillsWithinGameStatTracker extends StatTracker<Game>
|
||||
killCount = (killCount == null ? 0 : killCount) + 1;
|
||||
_kills.put(player.getUniqueId(), killCount);
|
||||
|
||||
if (killCount == 12)
|
||||
if (killCount == getNecessaryKillCount())
|
||||
addStat(player, getStatName(), 1, true, false);
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ public class SlimySheepStatTracker extends StatTracker<Game>
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onTailCollision(Snake.SlimeUpgradeEvent event)
|
||||
public void onSlimeUpgrade(Snake.SlimeUpgradeEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user