Merge remote-tracking branch 'refs/remotes/origin/update/gem-hunters-11-5' into update/gem-hunters
This commit is contained in:
commit
092c5db6b2
@ -0,0 +1,55 @@
|
||||
package mineplex.core.titles.tracks.standard;
|
||||
|
||||
import mineplex.core.titles.tracks.Track;
|
||||
import mineplex.core.titles.tracks.TrackFormat;
|
||||
import mineplex.core.titles.tracks.TrackTier;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
|
||||
public class GemHuntersTrack extends Track
|
||||
{
|
||||
|
||||
public GemHuntersTrack()
|
||||
{
|
||||
super("gem-hunters-gems", "Gem Hunter Millionaire", "This track is unlocked by earning gems in Gem Hunters");
|
||||
|
||||
getRequirements()
|
||||
.addTier(new TrackTier(
|
||||
"Gem Beggar",
|
||||
"Gain 1,000 Gem Points",
|
||||
this::getStat,
|
||||
1000,
|
||||
new TrackFormat(ChatColor.GRAY)
|
||||
))
|
||||
.addTier(new TrackTier(
|
||||
"Respectable Gem Miner",
|
||||
"Gain 25,000 Gem Points",
|
||||
this::getStat,
|
||||
25000,
|
||||
new TrackFormat(ChatColor.LIGHT_PURPLE)
|
||||
))
|
||||
.addTier(new TrackTier(
|
||||
"Middle Class",
|
||||
"Gain 50,000 Gem Points",
|
||||
this::getStat,
|
||||
50000,
|
||||
new TrackFormat(ChatColor.BLUE, null)
|
||||
))
|
||||
.addTier(new TrackTier(
|
||||
"Gems, Gems, Gems",
|
||||
"Gain 75,000 Gem Points",
|
||||
this::getStat,
|
||||
75000,
|
||||
new TrackFormat(ChatColor.GREEN, null)
|
||||
))
|
||||
.addTier(new TrackTier(
|
||||
"Gem McScrooge",
|
||||
"Gain 100,000 Gem Points",
|
||||
this::getStat,
|
||||
100000,
|
||||
new TrackFormat(ChatColor.RED, ChatColor.RED)
|
||||
));
|
||||
|
||||
getRequirements()
|
||||
.withRequirement(1, "Gem Earned in Gem Hunters");
|
||||
}
|
||||
}
|
@ -1,71 +1,71 @@
|
||||
package nautilus.game.arcade.game.games.castleassault.data;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
|
||||
public class CapturePoint
|
||||
{
|
||||
private static final int POINTS_TO_CAPTURE = 100;
|
||||
private static final long TIME_PER_POINT = 1000;
|
||||
private static final int POINTS_PER_TICK = 1;
|
||||
|
||||
private Location _loc;
|
||||
|
||||
private long _lastCap;
|
||||
private int _points = 0;
|
||||
private GameTeam _owner = null;
|
||||
|
||||
public CapturePoint(GameTeam owner, Location loc)
|
||||
{
|
||||
_owner = owner;
|
||||
|
||||
_loc = loc;
|
||||
}
|
||||
|
||||
public int getMaxPoints()
|
||||
{
|
||||
return POINTS_TO_CAPTURE;
|
||||
}
|
||||
|
||||
public int getPoints()
|
||||
{
|
||||
return _points;
|
||||
}
|
||||
|
||||
public boolean isCaptured()
|
||||
{
|
||||
return _points >= POINTS_TO_CAPTURE;
|
||||
}
|
||||
|
||||
public void update()
|
||||
{
|
||||
if (!UtilTime.elapsed(_lastCap, TIME_PER_POINT))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int capping = 0;
|
||||
for (Player player : UtilPlayer.getInRadius(_loc, 3.5).keySet())
|
||||
{
|
||||
if (UtilPlayer.isSpectator(player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (_owner.HasPlayer(player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
capping++;
|
||||
}
|
||||
|
||||
if (capping > 0 && _points < POINTS_TO_CAPTURE)
|
||||
{
|
||||
_lastCap = System.currentTimeMillis();
|
||||
_points += POINTS_PER_TICK;
|
||||
}
|
||||
}
|
||||
package nautilus.game.arcade.game.games.castleassault.data;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
|
||||
public class CapturePoint
|
||||
{
|
||||
private static final int POINTS_TO_CAPTURE = 100;
|
||||
private static final long TIME_PER_POINT = 1000;
|
||||
private static final int POINTS_PER_TICK = 1;
|
||||
|
||||
private Location _loc;
|
||||
|
||||
private long _lastCap;
|
||||
private int _points = 0;
|
||||
private GameTeam _owner = null;
|
||||
|
||||
public CapturePoint(GameTeam owner, Location loc)
|
||||
{
|
||||
_owner = owner;
|
||||
|
||||
_loc = loc;
|
||||
}
|
||||
|
||||
public int getMaxPoints()
|
||||
{
|
||||
return POINTS_TO_CAPTURE;
|
||||
}
|
||||
|
||||
public int getPoints()
|
||||
{
|
||||
return _points;
|
||||
}
|
||||
|
||||
public boolean isCaptured()
|
||||
{
|
||||
return _points >= POINTS_TO_CAPTURE;
|
||||
}
|
||||
|
||||
public void update()
|
||||
{
|
||||
if (!UtilTime.elapsed(_lastCap, TIME_PER_POINT))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int capping = 0;
|
||||
for (Player player : UtilPlayer.getInRadius(_loc, 3.5).keySet())
|
||||
{
|
||||
if (UtilPlayer.isSpectator(player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (_owner.HasPlayer(player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
capping++;
|
||||
}
|
||||
|
||||
if (capping > 0 && _points < POINTS_TO_CAPTURE)
|
||||
{
|
||||
_lastCap = System.currentTimeMillis();
|
||||
_points += POINTS_PER_TICK;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,47 +1,47 @@
|
||||
package nautilus.game.arcade.game.games.castleassault.data;
|
||||
|
||||
public class KillStreakData
|
||||
{
|
||||
private static final int[] REWARDED_STREAKS = {2, 4, 6, 8};
|
||||
private int _kills;
|
||||
private int _bestStreak;
|
||||
|
||||
public KillStreakData()
|
||||
{
|
||||
_kills = 0;
|
||||
_bestStreak = 0;
|
||||
}
|
||||
|
||||
public int getKills()
|
||||
{
|
||||
return _kills;
|
||||
}
|
||||
|
||||
public int getBestStreak()
|
||||
{
|
||||
return Math.max(_bestStreak, _kills);
|
||||
}
|
||||
|
||||
public boolean addKill(boolean hardLine)
|
||||
{
|
||||
_kills++;
|
||||
for (int streak : REWARDED_STREAKS)
|
||||
{
|
||||
if ((_kills + (hardLine ? 1 : 0)) == streak)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void reset()
|
||||
{
|
||||
if (_kills > _bestStreak)
|
||||
{
|
||||
_bestStreak = _kills;
|
||||
}
|
||||
_kills = 0;
|
||||
}
|
||||
package nautilus.game.arcade.game.games.castleassault.data;
|
||||
|
||||
public class KillStreakData
|
||||
{
|
||||
private static final int[] REWARDED_STREAKS = {2, 4, 6, 8};
|
||||
private int _kills;
|
||||
private int _bestStreak;
|
||||
|
||||
public KillStreakData()
|
||||
{
|
||||
_kills = 0;
|
||||
_bestStreak = 0;
|
||||
}
|
||||
|
||||
public int getKills()
|
||||
{
|
||||
return _kills;
|
||||
}
|
||||
|
||||
public int getBestStreak()
|
||||
{
|
||||
return Math.max(_bestStreak, _kills);
|
||||
}
|
||||
|
||||
public boolean addKill(boolean hardLine)
|
||||
{
|
||||
_kills++;
|
||||
for (int streak : REWARDED_STREAKS)
|
||||
{
|
||||
if ((_kills + (hardLine ? 1 : 0)) == streak)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void reset()
|
||||
{
|
||||
if (_kills > _bestStreak)
|
||||
{
|
||||
_bestStreak = _kills;
|
||||
}
|
||||
_kills = 0;
|
||||
}
|
||||
}
|
@ -1,100 +1,100 @@
|
||||
package nautilus.game.arcade.game.games.castleassault.data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
|
||||
public class ObjectiveTNTSpawner
|
||||
{
|
||||
private static final long TNT_SPAWN_DELAY = 60000;
|
||||
private List<Location> _locs;
|
||||
private Location _lastSpawnLoc;
|
||||
private Item _entity;
|
||||
private long _lastPickedUp;
|
||||
|
||||
public ObjectiveTNTSpawner(List<Location> locs)
|
||||
{
|
||||
_locs = locs;
|
||||
_lastSpawnLoc = null;
|
||||
_entity = null;
|
||||
_lastPickedUp = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public Item getItem()
|
||||
{
|
||||
return _entity;
|
||||
}
|
||||
|
||||
public boolean isSpawned()
|
||||
{
|
||||
return _entity != null;
|
||||
}
|
||||
|
||||
public boolean canPlaceFireAt(Block block)
|
||||
{
|
||||
for (Location loc : _locs)
|
||||
{
|
||||
if (UtilMath.offsetSquared(loc, block.getLocation()) <= 9)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public long getNextTNT()
|
||||
{
|
||||
return (_lastPickedUp + TNT_SPAWN_DELAY) - System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public void spawn()
|
||||
{
|
||||
Location spawn = _locs.get(UtilMath.r(_locs.size()));
|
||||
spawn.getBlock().getRelative(BlockFace.DOWN).setType(Material.REDSTONE_BLOCK);
|
||||
_lastSpawnLoc = spawn.clone();
|
||||
_entity = spawn.getWorld().dropItem(spawn, new ItemStack(Material.TNT));
|
||||
UtilFirework.playFirework(spawn, Type.BURST, Color.RED, false, false);
|
||||
}
|
||||
|
||||
public void pickup()
|
||||
{
|
||||
_entity.getLocation().getBlock().getRelative(BlockFace.DOWN).setType(Material.IRON_BLOCK);
|
||||
_entity.remove();
|
||||
_entity = null;
|
||||
_lastSpawnLoc = null;
|
||||
_lastPickedUp = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public void update()
|
||||
{
|
||||
if (!isSpawned() && UtilTime.elapsed(_lastPickedUp, TNT_SPAWN_DELAY))
|
||||
{
|
||||
spawn();
|
||||
}
|
||||
else if (isSpawned())
|
||||
{
|
||||
_entity.teleport(_lastSpawnLoc);
|
||||
if (!_entity.isValid() || _entity.isDead())
|
||||
{
|
||||
_entity = _lastSpawnLoc.getWorld().dropItem(_lastSpawnLoc, new ItemStack(Material.TNT));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onStart()
|
||||
{
|
||||
_lastPickedUp = System.currentTimeMillis();
|
||||
}
|
||||
package nautilus.game.arcade.game.games.castleassault.data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
|
||||
public class ObjectiveTNTSpawner
|
||||
{
|
||||
private static final long TNT_SPAWN_DELAY = 60000;
|
||||
private List<Location> _locs;
|
||||
private Location _lastSpawnLoc;
|
||||
private Item _entity;
|
||||
private long _lastPickedUp;
|
||||
|
||||
public ObjectiveTNTSpawner(List<Location> locs)
|
||||
{
|
||||
_locs = locs;
|
||||
_lastSpawnLoc = null;
|
||||
_entity = null;
|
||||
_lastPickedUp = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public Item getItem()
|
||||
{
|
||||
return _entity;
|
||||
}
|
||||
|
||||
public boolean isSpawned()
|
||||
{
|
||||
return _entity != null;
|
||||
}
|
||||
|
||||
public boolean canPlaceFireAt(Block block)
|
||||
{
|
||||
for (Location loc : _locs)
|
||||
{
|
||||
if (UtilMath.offsetSquared(loc, block.getLocation()) <= 9)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public long getNextTNT()
|
||||
{
|
||||
return (_lastPickedUp + TNT_SPAWN_DELAY) - System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public void spawn()
|
||||
{
|
||||
Location spawn = _locs.get(UtilMath.r(_locs.size()));
|
||||
spawn.getBlock().getRelative(BlockFace.DOWN).setType(Material.REDSTONE_BLOCK);
|
||||
_lastSpawnLoc = spawn.clone();
|
||||
_entity = spawn.getWorld().dropItem(spawn, new ItemStack(Material.TNT));
|
||||
UtilFirework.playFirework(spawn, Type.BURST, Color.RED, false, false);
|
||||
}
|
||||
|
||||
public void pickup()
|
||||
{
|
||||
_entity.getLocation().getBlock().getRelative(BlockFace.DOWN).setType(Material.IRON_BLOCK);
|
||||
_entity.remove();
|
||||
_entity = null;
|
||||
_lastSpawnLoc = null;
|
||||
_lastPickedUp = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public void update()
|
||||
{
|
||||
if (!isSpawned() && UtilTime.elapsed(_lastPickedUp, TNT_SPAWN_DELAY))
|
||||
{
|
||||
spawn();
|
||||
}
|
||||
else if (isSpawned())
|
||||
{
|
||||
_entity.teleport(_lastSpawnLoc);
|
||||
if (!_entity.isValid() || _entity.isDead())
|
||||
{
|
||||
_entity = _lastSpawnLoc.getWorld().dropItem(_lastSpawnLoc, new ItemStack(Material.TNT));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onStart()
|
||||
{
|
||||
_lastPickedUp = System.currentTimeMillis();
|
||||
}
|
||||
}
|
@ -1,54 +1,54 @@
|
||||
package nautilus.game.arcade.game.games.castleassault.data;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.EnderCrystal;
|
||||
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
|
||||
public class TeamCrystal
|
||||
{
|
||||
private Location _loc;
|
||||
private GameTeam _owner;
|
||||
private EnderCrystal _crystal;
|
||||
private boolean _destroyed;
|
||||
|
||||
public TeamCrystal(GameTeam owner, Location loc)
|
||||
{
|
||||
_owner = owner;
|
||||
_loc = loc;
|
||||
|
||||
spawn();
|
||||
}
|
||||
|
||||
public GameTeam getOwner()
|
||||
{
|
||||
return _owner;
|
||||
}
|
||||
|
||||
public Location getLocation()
|
||||
{
|
||||
return _loc;
|
||||
}
|
||||
|
||||
public boolean isActive()
|
||||
{
|
||||
return !_destroyed;
|
||||
}
|
||||
|
||||
public void spawn()
|
||||
{
|
||||
_destroyed = false;
|
||||
_crystal = _loc.getWorld().spawn(_loc, EnderCrystal.class);
|
||||
_loc.getBlock().getRelative(0, -2, 0).setType(Material.BEACON);
|
||||
}
|
||||
|
||||
public void destroy()
|
||||
{
|
||||
_destroyed = true;
|
||||
_crystal.remove();
|
||||
_crystal = null;
|
||||
_loc.getBlock().getRelative(0, -2, 0).setType(Material.SMOOTH_BRICK);
|
||||
}
|
||||
package nautilus.game.arcade.game.games.castleassault.data;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.EnderCrystal;
|
||||
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
|
||||
public class TeamCrystal
|
||||
{
|
||||
private Location _loc;
|
||||
private GameTeam _owner;
|
||||
private EnderCrystal _crystal;
|
||||
private boolean _destroyed;
|
||||
|
||||
public TeamCrystal(GameTeam owner, Location loc)
|
||||
{
|
||||
_owner = owner;
|
||||
_loc = loc;
|
||||
|
||||
spawn();
|
||||
}
|
||||
|
||||
public GameTeam getOwner()
|
||||
{
|
||||
return _owner;
|
||||
}
|
||||
|
||||
public Location getLocation()
|
||||
{
|
||||
return _loc;
|
||||
}
|
||||
|
||||
public boolean isActive()
|
||||
{
|
||||
return !_destroyed;
|
||||
}
|
||||
|
||||
public void spawn()
|
||||
{
|
||||
_destroyed = false;
|
||||
_crystal = _loc.getWorld().spawn(_loc, EnderCrystal.class);
|
||||
_loc.getBlock().getRelative(0, -2, 0).setType(Material.BEACON);
|
||||
}
|
||||
|
||||
public void destroy()
|
||||
{
|
||||
_destroyed = true;
|
||||
_crystal.remove();
|
||||
_crystal = null;
|
||||
_loc.getBlock().getRelative(0, -2, 0).setType(Material.SMOOTH_BRICK);
|
||||
}
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
<<<<<<< HEAD
|
||||
package nautilus.game.arcade.game.games.castleassault.data;
|
||||
|
||||
import org.bukkit.Location;
|
||||
@ -126,3 +127,127 @@ public class TeamKing
|
||||
return true;
|
||||
}
|
||||
}
|
||||
=======
|
||||
package nautilus.game.arcade.game.games.castleassault.data;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Zombie;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
|
||||
public class TeamKing
|
||||
{
|
||||
private static final int MAX_HEALTH = 600;
|
||||
private Location _loc;
|
||||
private String _name;
|
||||
private GameTeam _owner;
|
||||
private Zombie _entity;
|
||||
private int _health;
|
||||
private String _lastDamager;
|
||||
private long _lastDamage;
|
||||
|
||||
public TeamKing(GameTeam owner, String name, Location loc)
|
||||
{
|
||||
_owner = owner;
|
||||
_loc = loc;
|
||||
_name = name;
|
||||
_health = MAX_HEALTH;
|
||||
_entity = (Zombie) loc.getWorld().spawnEntity(loc, EntityType.ZOMBIE);
|
||||
UtilEnt.vegetate(_entity, true);
|
||||
_entity.getEquipment().setHelmet(new ItemBuilder(Material.DIAMOND_HELMET).setUnbreakable(true).build());
|
||||
_entity.getEquipment().setChestplate(new ItemBuilder(Material.DIAMOND_CHESTPLATE).setUnbreakable(true).build());
|
||||
_entity.getEquipment().setLeggings(new ItemBuilder(Material.DIAMOND_LEGGINGS).setUnbreakable(true).build());
|
||||
_entity.getEquipment().setBoots(new ItemBuilder(Material.DIAMOND_BOOTS).setUnbreakable(true).build());
|
||||
_entity.setRemoveWhenFarAway(false);
|
||||
_entity.setCustomName(owner.GetColor() + name);
|
||||
}
|
||||
|
||||
public GameTeam getOwner()
|
||||
{
|
||||
return _owner;
|
||||
}
|
||||
|
||||
public Location getLocation()
|
||||
{
|
||||
return _loc;
|
||||
}
|
||||
|
||||
public String getName(boolean bold)
|
||||
{
|
||||
return _owner.GetColor() + (bold ? C.Bold : "") + _name;
|
||||
}
|
||||
|
||||
public String getLastDamager()
|
||||
{
|
||||
return _lastDamager;
|
||||
}
|
||||
|
||||
public int getHealth()
|
||||
{
|
||||
return Math.max(_health, 0);
|
||||
}
|
||||
|
||||
public boolean isDead()
|
||||
{
|
||||
return getHealth() <= 0;
|
||||
}
|
||||
|
||||
public void update(boolean beaconsAlive)
|
||||
{
|
||||
_entity.teleport(_loc);
|
||||
for (int y = 0; y <= 4; y++)
|
||||
{
|
||||
for (int x = -4; x <= 4; x++)
|
||||
{
|
||||
for (int z = -4; z <= 4; z++)
|
||||
{
|
||||
Block block = _loc.clone().add(x, y, z).getBlock();
|
||||
if ((block.getType() != Material.IRON_FENCE && block.getType() != Material.IRON_BLOCK) || !beaconsAlive)
|
||||
{
|
||||
block.setType(Material.AIR);
|
||||
}
|
||||
if (beaconsAlive)
|
||||
{
|
||||
if (x == -4 || x == 4 || z == -4 || z == 4)
|
||||
{
|
||||
if (y != 4)
|
||||
{
|
||||
block.setType(Material.IRON_FENCE);
|
||||
}
|
||||
}
|
||||
if (y == 4)
|
||||
{
|
||||
block.setType(Material.IRON_BLOCK);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean handleDamage(String player, double damage)
|
||||
{
|
||||
if (!UtilTime.elapsed(_lastDamage, 400))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
_lastDamager = player;
|
||||
_lastDamage = System.currentTimeMillis();
|
||||
|
||||
int dmg = (int)Math.ceil(damage);
|
||||
|
||||
_health -= dmg;
|
||||
|
||||
UtilEnt.PlayDamageSound(_entity);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
>>>>>>> refs/remotes/origin/update/gem-hunters-11-5
|
||||
|
@ -19,7 +19,8 @@ public class BetaModule extends MiniPlugin
|
||||
"Thank you for playing Gem Hunters!",
|
||||
"Safezones are marked as green areas on your map!",
|
||||
"Players that have super valuable items show up on your map!",
|
||||
"Tell us what you want added next by voting on our features Trello! https://trello.com/b/ia1kjwcx"
|
||||
"Tell us what you want added next by voting on our features Trello! https://trello.com/b/ia1kjwcx",
|
||||
"The highest value player is shown on the map as a red pointer."
|
||||
};
|
||||
|
||||
private int _lastIndex;
|
||||
@ -30,7 +31,7 @@ public class BetaModule extends MiniPlugin
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void annouce(UpdateEvent event)
|
||||
public void announce(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.MIN_01)
|
||||
{
|
||||
|
@ -1,5 +1,7 @@
|
||||
package mineplex.gemhunters.chat;
|
||||
|
||||
import mineplex.gemhunters.economy.EconomyModule;
|
||||
import mineplex.gemhunters.progression.ProgressionModule;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -26,15 +28,19 @@ public class ChatModule extends MiniPlugin
|
||||
|
||||
private final CoreClientManager _clientManager;
|
||||
private final Chat _chat;
|
||||
private final EconomyModule _economy;
|
||||
private final PartyManager _party;
|
||||
|
||||
private final ProgressionModule _progression;
|
||||
|
||||
private ChatModule()
|
||||
{
|
||||
super("Chat");
|
||||
|
||||
_clientManager = require(CoreClientManager.class);
|
||||
_chat = require(Chat.class);
|
||||
_economy = require(EconomyModule.class);
|
||||
_party = require(PartyManager.class);
|
||||
_progression = require(ProgressionModule.class);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
@ -90,7 +96,7 @@ public class ChatModule extends MiniPlugin
|
||||
}
|
||||
else
|
||||
{
|
||||
message += C.cWhite;
|
||||
message = _progression.getTitle(_economy.getGems(player)).getTitle() + " " + message + C.cWhite;
|
||||
}
|
||||
|
||||
message += _chat.getFilteredMessage(player, event.getMessage());
|
||||
|
@ -2,6 +2,7 @@ package mineplex.gemhunters.economy;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -29,6 +30,9 @@ public class EconomyModule extends MiniClientPlugin<Integer>
|
||||
|
||||
private final DonationManager _donation;
|
||||
|
||||
private Player _mostValuable;
|
||||
private int _mostGems;
|
||||
|
||||
public EconomyModule()
|
||||
{
|
||||
super("Economy");
|
||||
@ -117,6 +121,23 @@ public class EconomyModule extends MiniClientPlugin<Integer>
|
||||
return Get(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void Set(Player player, Integer data)
|
||||
{
|
||||
super.Set(player, data);
|
||||
|
||||
if (_mostValuable == null || _mostGems < data)
|
||||
{
|
||||
_mostValuable = player;
|
||||
_mostGems = data;
|
||||
}
|
||||
}
|
||||
|
||||
public Player getMostValuablePlayer()
|
||||
{
|
||||
return _mostValuable;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Integer addPlayer(UUID uuid)
|
||||
{
|
||||
|
@ -1,29 +1,24 @@
|
||||
package mineplex.gemhunters.map;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.map.MapCanvas;
|
||||
import org.bukkit.map.MapCursor;
|
||||
import org.bukkit.map.MapCursorCollection;
|
||||
import org.bukkit.map.MapPalette;
|
||||
import org.bukkit.map.MapRenderer;
|
||||
import org.bukkit.map.MapView;
|
||||
|
||||
import mineplex.core.Managers;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.party.Party;
|
||||
import mineplex.core.party.PartyManager;
|
||||
import mineplex.gemhunters.economy.EconomyModule;
|
||||
import mineplex.gemhunters.loot.LootModule;
|
||||
import mineplex.gemhunters.safezone.SafezoneModule;
|
||||
import mineplex.gemhunters.supplydrop.SupplyDrop;
|
||||
import mineplex.gemhunters.supplydrop.SupplyDropModule;
|
||||
import mineplex.gemhunters.worldevent.WorldEvent;
|
||||
import mineplex.gemhunters.worldevent.WorldEventModule;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.map.*;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* <b>All item map code was adapted from Clans.</b><br>
|
||||
@ -35,6 +30,7 @@ public class ItemMapRenderer extends MapRenderer
|
||||
private static final int STANDARD_Y = 70;
|
||||
|
||||
private final ItemMapModule _itemMap;
|
||||
private final EconomyModule _economy;
|
||||
private final LootModule _loot;
|
||||
private final SafezoneModule _safezone;
|
||||
private final SupplyDropModule _supply;
|
||||
@ -47,6 +43,7 @@ public class ItemMapRenderer extends MapRenderer
|
||||
super(true);
|
||||
|
||||
_itemMap = Managers.require(ItemMapModule.class);
|
||||
_economy = Managers.require(EconomyModule.class);
|
||||
_loot = Managers.require(LootModule.class);
|
||||
_safezone = Managers.require(SafezoneModule.class);
|
||||
_supply = Managers.require(SupplyDropModule.class);
|
||||
@ -273,6 +270,10 @@ public class ItemMapRenderer extends MapRenderer
|
||||
{
|
||||
cursorDisplay = MapCursor.Type.GREEN_POINTER;
|
||||
}
|
||||
else if (other.equals(_economy.getMostValuablePlayer()))
|
||||
{
|
||||
cursorDisplay = MapCursor.Type.RED_POINTER;
|
||||
}
|
||||
|
||||
if (cursorDisplay == null)
|
||||
{
|
||||
|
@ -0,0 +1,41 @@
|
||||
package mineplex.gemhunters.progression;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.ReflectivelyCreateMiniPlugin;
|
||||
import mineplex.core.common.util.C;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@ReflectivelyCreateMiniPlugin
|
||||
public class ProgressionModule extends MiniPlugin
|
||||
{
|
||||
|
||||
private static final List<ProgressionTitle> TITLE_LIST = Arrays.asList(
|
||||
new ProgressionTitle(C.cGray + "Bankrupt", 0),
|
||||
new ProgressionTitle(C.cAqua + "Beggar", 100),
|
||||
new ProgressionTitle(C.cGreen + "Poor", 250),
|
||||
new ProgressionTitle(C.cGreen + "MiddleClass", 500),
|
||||
new ProgressionTitle(C.cGold + "Wealthy", 750),
|
||||
new ProgressionTitle(C.cGold + "Loaded", 1000),
|
||||
new ProgressionTitle(C.cRed + "Millionaire", 5000)
|
||||
);
|
||||
|
||||
public ProgressionModule()
|
||||
{
|
||||
super("Progression");
|
||||
}
|
||||
|
||||
public ProgressionTitle getTitle(int gems)
|
||||
{
|
||||
for (ProgressionTitle title : TITLE_LIST)
|
||||
{
|
||||
if (title.getRequiredGems() >= gems)
|
||||
{
|
||||
return title;
|
||||
}
|
||||
}
|
||||
|
||||
return TITLE_LIST.get(TITLE_LIST.size() - 1);
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package mineplex.gemhunters.progression;
|
||||
|
||||
public class ProgressionTitle
|
||||
{
|
||||
|
||||
private String _title;
|
||||
private int _requiredGems;
|
||||
|
||||
public ProgressionTitle(String title, int requiredGems)
|
||||
{
|
||||
_title = title;
|
||||
_requiredGems = requiredGems;
|
||||
}
|
||||
|
||||
public String getTitle()
|
||||
{
|
||||
return _title;
|
||||
}
|
||||
|
||||
public int getRequiredGems()
|
||||
{
|
||||
return _requiredGems;
|
||||
}
|
||||
}
|
@ -9,6 +9,7 @@ import mineplex.core.recharge.Recharge;
|
||||
import mineplex.gemhunters.death.event.QuitNPCSpawnEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -18,6 +19,7 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
@ -212,6 +214,17 @@ public class SafezoneModule extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void flintAndSteelInteract(PlayerInteractEvent event)
|
||||
{
|
||||
if (event.getItem() == null || event.getItem().getType() != Material.FLINT_AND_STEEL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
public boolean isInSafeZone(HumanEntity player)
|
||||
{
|
||||
return isInSafeZone(player.getLocation()) && _playerStatus.Get((Player) player).getStatusType() != PlayerStatusType.COMBAT;
|
||||
|
@ -1,5 +1,7 @@
|
||||
package mineplex.gemhunters.scoreboard;
|
||||
|
||||
import mineplex.gemhunters.progression.ProgressionModule;
|
||||
import mineplex.gemhunters.progression.ProgressionTitle;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.Managers;
|
||||
@ -17,6 +19,7 @@ public class GemHuntersScoreboard extends WritableMineplexScoreboard
|
||||
|
||||
private final EconomyModule _economy;
|
||||
private final PlayerStatusModule _playerStatus;
|
||||
private final ProgressionModule _progression;
|
||||
private final SupplyDropModule _supplyDrop;
|
||||
|
||||
public GemHuntersScoreboard(Player player)
|
||||
@ -25,6 +28,7 @@ public class GemHuntersScoreboard extends WritableMineplexScoreboard
|
||||
|
||||
_economy = Managers.get(EconomyModule.class);
|
||||
_playerStatus = Managers.get(PlayerStatusModule.class);
|
||||
_progression = Managers.get(ProgressionModule.class);
|
||||
_supplyDrop = Managers.get(SupplyDropModule.class);
|
||||
}
|
||||
|
||||
@ -60,4 +64,9 @@ public class GemHuntersScoreboard extends WritableMineplexScoreboard
|
||||
{
|
||||
return _economy.getGems(player);
|
||||
}
|
||||
|
||||
public String getPrefix(Player perspective, Player subject)
|
||||
{
|
||||
return _progression.getTitle(_economy.getGems(subject)).getTitle() + " " + C.cYellow;
|
||||
}
|
||||
}
|
||||
|
@ -70,17 +70,17 @@ public class ScoreboardModule extends MiniPlugin
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
int gems = _economy.getGems(player);
|
||||
|
||||
|
||||
for (GemHuntersScoreboard scoreboard : _scoreboards.values())
|
||||
{
|
||||
Objective objective = scoreboard.getHandle().getObjective(DisplaySlot.BELOW_NAME);
|
||||
Score score = objective.getScore(player.getName());
|
||||
|
||||
|
||||
if (score.getScore() == gems)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
score.setScore(gems);
|
||||
}
|
||||
}
|
||||
@ -106,45 +106,75 @@ public class ScoreboardModule extends MiniPlugin
|
||||
_scoreboards.remove(player.getUniqueId());
|
||||
}
|
||||
|
||||
public void createPlayerScoreboard(Player player)
|
||||
{
|
||||
if (!_scoreboards.containsKey(player.getUniqueId()))
|
||||
@EventHandler
|
||||
public void updateScoreboard(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC_20)
|
||||
{
|
||||
GemHuntersScoreboard scoreboard = new GemHuntersScoreboard(player);
|
||||
Scoreboard handle = scoreboard.getHandle();
|
||||
return;
|
||||
}
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
createPlayerScoreboard(player);
|
||||
}
|
||||
}
|
||||
|
||||
public void createPlayerScoreboard(Player player)
|
||||
{
|
||||
GemHuntersScoreboard scoreboard;
|
||||
|
||||
if (_scoreboards.containsKey(player.getUniqueId()))
|
||||
{
|
||||
scoreboard = _scoreboards.get(player.getUniqueId());
|
||||
}
|
||||
else
|
||||
{
|
||||
scoreboard = new GemHuntersScoreboard(player);
|
||||
_scoreboards.put(player.getUniqueId(), scoreboard);
|
||||
|
||||
// Gem Counter Undername
|
||||
Objective gemCounter = handle.registerNewObjective("Gems", "Gems");
|
||||
Objective gemCounter = scoreboard.getHandle().registerNewObjective("Gems", "Gems");
|
||||
gemCounter.setDisplaySlot(DisplaySlot.BELOW_NAME);
|
||||
}
|
||||
|
||||
for (GemHuntersScoreboard other : _scoreboards.values())
|
||||
Scoreboard handle = scoreboard.getHandle();
|
||||
|
||||
for (GemHuntersScoreboard other : _scoreboards.values())
|
||||
{
|
||||
// Set the other player's name tag for the player joining
|
||||
Player otherPlayer = other.getOwner();
|
||||
Team team = handle.getTeam(otherPlayer.getName());
|
||||
|
||||
if (team == null)
|
||||
{
|
||||
// Set the other player's name tag for the player joining
|
||||
Player otherPlayer = other.getOwner();
|
||||
Team team = handle.registerNewTeam(otherPlayer.getName());
|
||||
|
||||
team.setPrefix(C.cYellow);
|
||||
//team.setSuffix(scoreboard.getSuffix(player, otherPlayer));
|
||||
team.addEntry(otherPlayer.getName());
|
||||
|
||||
if (player.equals(otherPlayer))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Set the player that is joining
|
||||
Scoreboard otherHandle = other.getHandle();
|
||||
Team otherTeam = otherHandle.registerNewTeam(player.getName());
|
||||
|
||||
otherTeam.setPrefix(C.cYellow);
|
||||
//otherTeam.setSuffix(other.getSuffix(other.getOwner(), player));
|
||||
otherTeam.addEntry(player.getName());
|
||||
team = handle.registerNewTeam(otherPlayer.getName());
|
||||
}
|
||||
|
||||
player.setScoreboard(scoreboard.getHandle());
|
||||
team.setPrefix(scoreboard.getPrefix(player, otherPlayer));
|
||||
//team.setSuffix(scoreboard.getSuffix(player, otherPlayer));
|
||||
team.addEntry(otherPlayer.getName());
|
||||
|
||||
if (player.equals(otherPlayer))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Set the player that is joining
|
||||
Scoreboard otherHandle = other.getHandle();
|
||||
Team otherTeam = otherHandle.getTeam(player.getName());
|
||||
|
||||
if (otherTeam == null)
|
||||
{
|
||||
otherTeam = otherHandle.registerNewTeam(player.getName());
|
||||
}
|
||||
|
||||
otherTeam.setPrefix(other.getPrefix(other.getOwner(), player));
|
||||
//otherTeam.setSuffix(other.getSuffix(other.getOwner(), player));
|
||||
otherTeam.addEntry(player.getName());
|
||||
}
|
||||
|
||||
player.setScoreboard(handle);
|
||||
}
|
||||
|
||||
public void updateTitles()
|
||||
|
@ -199,7 +199,7 @@ public class ShopModule extends MiniPlugin
|
||||
|
||||
String name = NAMES[UtilMath.r(NAMES.length)];
|
||||
|
||||
name = (properties.isSelling() ? C.cGold + "Buying" : C.cGreen + "Selling") + C.cGray + " - " + C.cWhite + name;
|
||||
name = (properties.isSelling() ? C.cGold + "Buy" : C.cGreen + "Sell") + C.cGray + " - " + C.cWhite + name;
|
||||
|
||||
//DebugModule.getInstance().d("Trader at " + UtilWorld.locToStrClean(randomLocation) + " with key=" + key + " and index=" + index + " and max=" + spawned + "/" + max);
|
||||
if (properties.isSelling())
|
||||
|
Loading…
Reference in New Issue
Block a user