Make a lot of changes from the Community Ideas Board
This commit is contained in:
parent
99bb64c6c8
commit
96da8aa857
@ -16,9 +16,19 @@ import mineplex.core.stats.StatsManager;
|
|||||||
public enum AchievementCategory
|
public enum AchievementCategory
|
||||||
{
|
{
|
||||||
GLOBAL("Global", null,
|
GLOBAL("Global", null,
|
||||||
new StatDisplay[] { StatDisplay.GEMS_EARNED, null, new StatDisplay("Games Played", "GamesPlayed"), StatDisplay.TIME_IN_GAME, null,
|
new StatDisplay[]
|
||||||
new StatDisplay("Daily Rewards", "DailyReward"), new StatDisplay("Times Voted", "DailyVote"), null, new StatDisplay("Chests Opened", "Treasure.Old", "Treasure.Ancient", "Treasure.Mythical") },
|
{
|
||||||
Material.EMERALD, 0, GameCategory.GLOBAL, "None", false, -1),
|
StatDisplay.GEMS_EARNED,
|
||||||
|
new StatDisplay("Exp Earned", "ExpEarned"),
|
||||||
|
null,
|
||||||
|
new StatDisplay("Games Played", "GamesPlayed"),
|
||||||
|
StatDisplay.TIME_IN_GAME,
|
||||||
|
null,
|
||||||
|
new StatDisplay("Daily Rewards", "DailyReward"),
|
||||||
|
new StatDisplay("Times Voted", "DailyVote"),
|
||||||
|
null,
|
||||||
|
new StatDisplay("Chests Opened", "Treasure.Old", "Treasure.Ancient", "Treasure.Mythical")
|
||||||
|
}, Material.EMERALD, 0, GameCategory.GLOBAL, "None", false, -1),
|
||||||
|
|
||||||
HOLIDAY("Holiday Achievements", null,
|
HOLIDAY("Holiday Achievements", null,
|
||||||
new StatDisplay[] {},
|
new StatDisplay[] {},
|
||||||
|
@ -12,6 +12,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.bukkit.inventory.meta.BannerMeta;
|
import org.bukkit.inventory.meta.BannerMeta;
|
||||||
|
|
||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
|
import mineplex.core.common.currency.GlobalCurrency;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.LineFormat;
|
import mineplex.core.common.util.LineFormat;
|
||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
@ -42,9 +43,6 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
|||||||
private static final String VISIBILITY_EVERYWHERE = "Visible Everywhere";
|
private static final String VISIBILITY_EVERYWHERE = "Visible Everywhere";
|
||||||
private static final String VISIBILITY_GAMES = "Visible in Games";
|
private static final String VISIBILITY_GAMES = "Visible in Games";
|
||||||
private static final String VISIBILITY_GAME_HUB = "Visible in Game Lobbies";
|
private static final String VISIBILITY_GAME_HUB = "Visible in Game Lobbies";
|
||||||
private static final ItemStack PANE = new ItemBuilder(Material.STAINED_GLASS_PANE, (byte) 3)
|
|
||||||
.setTitle(C.cBlack)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
public Menu(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player)
|
public Menu(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player)
|
||||||
{
|
{
|
||||||
@ -242,11 +240,15 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ItemStack pane = new ItemBuilder(Material.STAINED_GLASS_PANE, (byte) 3)
|
||||||
|
.setTitle(C.cAqua + _donationManager.Get(getPlayer()).getBalance(GlobalCurrency.TREASURE_SHARD) + " Shards")
|
||||||
|
.build();
|
||||||
|
|
||||||
for (int i = 0; i < getSize(); i++)
|
for (int i = 0; i < getSize(); i++)
|
||||||
{
|
{
|
||||||
if (getItem(i) == null)
|
if (getItem(i) == null)
|
||||||
{
|
{
|
||||||
setItem(i, PANE);
|
setItem(i, pane);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,17 @@
|
|||||||
package mineplex.core.gadget.gadgets.doublejump;
|
package mineplex.core.gadget.gadgets.doublejump;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Color;
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import mineplex.core.common.util.LineFormat;
|
import mineplex.core.common.util.LineFormat;
|
||||||
import mineplex.core.common.util.UtilFirework;
|
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||||
import mineplex.core.common.util.UtilText;
|
import mineplex.core.common.util.UtilText;
|
||||||
import mineplex.core.common.util.banner.CountryFlag;
|
import mineplex.core.common.util.banner.CountryFlag;
|
||||||
|
import mineplex.core.common.util.particles.ColoredParticle;
|
||||||
|
import mineplex.core.common.util.particles.DustSpellColor;
|
||||||
import mineplex.core.gadget.GadgetManager;
|
import mineplex.core.gadget.GadgetManager;
|
||||||
import mineplex.core.gadget.types.DoubleJumpEffectGadget;
|
import mineplex.core.gadget.types.DoubleJumpEffectGadget;
|
||||||
|
|
||||||
@ -25,7 +29,24 @@ public class DoubleJumpFreedom extends DoubleJumpEffectGadget
|
|||||||
@Override
|
@Override
|
||||||
public void doEffect(Player player)
|
public void doEffect(Player player)
|
||||||
{
|
{
|
||||||
UtilFirework.playFreedomFirework(player.getLocation());
|
DustSpellColor red = new DustSpellColor(Color.RED), blue = new DustSpellColor(Color.BLUE), white = new DustSpellColor(Color.WHITE);
|
||||||
|
Location location = player.getLocation().add(0, 1, 0);
|
||||||
|
|
||||||
|
for (int i = 0; i < 5; i++)
|
||||||
|
{
|
||||||
|
playParticleAt(location, red);
|
||||||
|
playParticleAt(location, blue);
|
||||||
|
playParticleAt(location, white);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void playParticleAt(Location location, DustSpellColor colour)
|
||||||
|
{
|
||||||
|
double x = Math.random() - 0.5, y = Math.random() - 0.5, z = Math.random() - 0.5;
|
||||||
|
|
||||||
|
new ColoredParticle(ParticleType.RED_DUST, colour, location.add(x, y, z))
|
||||||
|
.display();
|
||||||
|
|
||||||
|
location.subtract(x, y, z);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
package mineplex.core.gadget.gadgets.morph;
|
package mineplex.core.gadget.gadgets.morph;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
@ -24,6 +27,7 @@ public class MorphOcelot extends MorphGadget
|
|||||||
super(manager, "Ocelot Morph", new String[]
|
super(manager, "Ocelot Morph", new String[]
|
||||||
{
|
{
|
||||||
C.cGray + "Meeeeeeeeeeoooooooowwwwww",
|
C.cGray + "Meeeeeeeeeeoooooooowwwwww",
|
||||||
|
C.cGreen + "Crouch" + C.cWhite + " to meow."
|
||||||
}, CostConstants.LEVEL_REWARDS, Material.MONSTER_EGG, UtilEnt.getEntityEggData(EntityType.OCELOT));
|
}, CostConstants.LEVEL_REWARDS, Material.MONSTER_EGG, UtilEnt.getEntityEggData(EntityType.OCELOT));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,4 +50,17 @@ public class MorphOcelot extends MorphGadget
|
|||||||
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
||||||
player.removePotionEffect(PotionEffectType.SPEED);
|
player.removePotionEffect(PotionEffectType.SPEED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true)
|
||||||
|
public void playerToggleSneak(PlayerToggleSneakEvent event)
|
||||||
|
{
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
if (!event.isSneaking() || !isActive(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.getWorld().playSound(player.getLocation(), Sound.CAT_MEOW, 1, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,9 @@ public enum Preference implements Permission
|
|||||||
|
|
||||||
BYPASS_CHAT_FILTER(false, PreferenceCategory.EXCLUSIVE, Material.GLASS, "Bypass Chat Filter", "Enabling this will allow you", "to bypass the chat filter everywhere.", "", "Proceed with caution."),
|
BYPASS_CHAT_FILTER(false, PreferenceCategory.EXCLUSIVE, Material.GLASS, "Bypass Chat Filter", "Enabling this will allow you", "to bypass the chat filter everywhere.", "", "Proceed with caution."),
|
||||||
|
|
||||||
COLOR_SUFFIXES(true, PreferenceCategory.USER, Material.WOOL, "Color Chat Suffixes", "Enabling this will color your", "chat suffixes like ¯\\_(ツ)_/¯", "based on your rank.")
|
COLOR_SUFFIXES(true, PreferenceCategory.USER, Material.WOOL, "Color Chat Suffixes", "Enabling this will color your", "chat suffixes like ¯\\_(ツ)_/¯", "based on your rank."),
|
||||||
|
|
||||||
|
PARTICLES_IN_GAME(true, PreferenceCategory.GAME_PLAY, Material.NETHER_STAR, "Display Particles", "Enabling this will show your selected", "particle aura in game.")
|
||||||
|
|
||||||
|
|
||||||
;
|
;
|
||||||
|
@ -9,7 +9,7 @@ public class PreferencesCommand extends CommandBase<PreferencesManager>
|
|||||||
{
|
{
|
||||||
public PreferencesCommand(PreferencesManager plugin)
|
public PreferencesCommand(PreferencesManager plugin)
|
||||||
{
|
{
|
||||||
super(plugin, PreferencesManager.Perm.PREFERENCES_COMMAND, "prefs");
|
super(plugin, PreferencesManager.Perm.PREFERENCES_COMMAND, "pref", "prefs");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -45,7 +45,6 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -70,6 +69,7 @@ import mineplex.core.itemstack.ItemBuilder;
|
|||||||
import mineplex.core.packethandler.IPacketHandler;
|
import mineplex.core.packethandler.IPacketHandler;
|
||||||
import mineplex.core.packethandler.PacketHandler;
|
import mineplex.core.packethandler.PacketHandler;
|
||||||
import mineplex.core.packethandler.PacketInfo;
|
import mineplex.core.packethandler.PacketInfo;
|
||||||
|
import mineplex.core.stats.event.PlayerStatsLoadedEvent;
|
||||||
import mineplex.core.titles.commands.TrackCommand;
|
import mineplex.core.titles.commands.TrackCommand;
|
||||||
import mineplex.core.titles.tracks.Track;
|
import mineplex.core.titles.tracks.Track;
|
||||||
import mineplex.core.titles.tracks.TrackFormat;
|
import mineplex.core.titles.tracks.TrackFormat;
|
||||||
@ -155,14 +155,18 @@ public class Titles extends MiniDbClientPlugin<TitleData> implements IPacketHand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
private void onJoin(PlayerJoinEvent event)
|
private void onJoin(PlayerStatsLoadedEvent event)
|
||||||
{
|
{
|
||||||
if (Get(event.getPlayer()) != null)
|
Player player = event.getPlayer();
|
||||||
|
TitleData data = Get(player);
|
||||||
|
|
||||||
|
if (data != null)
|
||||||
{
|
{
|
||||||
Track track = _trackManager.getTrackById(Get(event.getPlayer()).getTrackId());
|
Track track = _trackManager.getTrackById(data.getTrackId());
|
||||||
if (track != null && track.getRequirements().getTier(event.getPlayer()) != null)
|
|
||||||
|
if (track != null && track.getRequirements().getTier(player) != null)
|
||||||
{
|
{
|
||||||
toggleActiveTrack(event.getPlayer(), track);
|
toggleActiveTrack(player, track);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -282,7 +282,7 @@ public class ClansUtility
|
|||||||
|
|
||||||
public boolean isSafe(Player player)
|
public boolean isSafe(Player player)
|
||||||
{
|
{
|
||||||
if (!UtilTime.elapsed(_clansManager.getCombatManager().Get(player).GetLastCombatEngaged(), Spawn.COMBAT_TAG_DURATION)) return false;
|
if (!UtilTime.elapsed(_clansManager.getCombatManager().getLog(player).GetLastCombatEngaged(), Spawn.COMBAT_TAG_DURATION)) return false;
|
||||||
|
|
||||||
return isSafe(player.getLocation());
|
return isSafe(player.getLocation());
|
||||||
}
|
}
|
||||||
|
@ -1054,9 +1054,9 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!UtilTime.elapsed(_clansManager.getCombatManager().Get(caller).GetLastCombatEngaged(), 15000))
|
if (!UtilTime.elapsed(_clansManager.getCombatManager().getLog(caller).GetLastCombatEngaged(), 15000))
|
||||||
{
|
{
|
||||||
long remain = _clansManager.getCombatManager().Get(caller).GetLastCombatEngaged() + 15000 - System.currentTimeMillis();
|
long remain = _clansManager.getCombatManager().getLog(caller).GetLastCombatEngaged() + 15000 - System.currentTimeMillis();
|
||||||
UtilPlayer.message(caller, F.main("Clans", "You are combat tagged for " + F.elem(UtilTime.MakeStr(remain)) + "!"));
|
UtilPlayer.message(caller, F.main("Clans", "You are combat tagged for " + F.elem(UtilTime.MakeStr(remain)) + "!"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ public class KillCommand extends CommandBase<ClansManager>
|
|||||||
@Override
|
@Override
|
||||||
public void Execute(Player caller, String[] args)
|
public void Execute(Player caller, String[] args)
|
||||||
{
|
{
|
||||||
if (!UtilTime.elapsed(Plugin.getCombatManager().Get(caller).GetLastCombatEngaged(), Spawn.COMBAT_TAG_DURATION))
|
if (!UtilTime.elapsed(Plugin.getCombatManager().getLog(caller).GetLastCombatEngaged(), Spawn.COMBAT_TAG_DURATION))
|
||||||
{
|
{
|
||||||
UtilPlayer.message(caller, F.main("Clans", "You cannot use this command whilst in combat."));
|
UtilPlayer.message(caller, F.main("Clans", "You cannot use this command whilst in combat."));
|
||||||
return;
|
return;
|
||||||
|
@ -246,13 +246,13 @@ public class BossNetherPortal implements Listener
|
|||||||
ClansManager.getInstance().getNetherManager().OverworldOrigins.remove((Player)event.getEntity());
|
ClansManager.getInstance().getNetherManager().OverworldOrigins.remove((Player)event.getEntity());
|
||||||
((Player)event.getEntity()).removePotionEffect(PotionEffectType.NIGHT_VISION);
|
((Player)event.getEntity()).removePotionEffect(PotionEffectType.NIGHT_VISION);
|
||||||
UtilPlayer.message(event.getEntity(), F.main(ClansManager.getInstance().getNetherManager().getName(), "You have escaped " + F.clansNether("The Nether") + "!"));
|
UtilPlayer.message(event.getEntity(), F.main(ClansManager.getInstance().getNetherManager().getName(), "You have escaped " + F.clansNether("The Nether") + "!"));
|
||||||
ClansManager.getInstance().getCombatManager().Get((Player)event.getEntity()).SetLastCombatEngaged(System.currentTimeMillis() - Spawn.COMBAT_TAG_DURATION);
|
ClansManager.getInstance().getCombatManager().getLog((Player)event.getEntity()).SetLastCombatEngaged(System.currentTimeMillis() - Spawn.COMBAT_TAG_DURATION);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ClansManager.getInstance().getNetherManager().InNether.put((Player)event.getEntity(), Expire);
|
ClansManager.getInstance().getNetherManager().InNether.put((Player)event.getEntity(), Expire);
|
||||||
event.getEntity().teleport(ClansManager.getInstance().getNetherManager().getNetherWorld().getSpawnLocation());
|
event.getEntity().teleport(ClansManager.getInstance().getNetherManager().getNetherWorld().getSpawnLocation());
|
||||||
ClansManager.getInstance().getCombatManager().Get((Player)event.getEntity()).SetLastCombatEngaged(System.currentTimeMillis() - Spawn.COMBAT_TAG_DURATION);
|
ClansManager.getInstance().getCombatManager().getLog((Player)event.getEntity()).SetLastCombatEngaged(System.currentTimeMillis() - Spawn.COMBAT_TAG_DURATION);
|
||||||
ClansManager.getInstance().ClanTips.displayTip(TipType.ENTER_NETHER, (Player)event.getEntity());
|
ClansManager.getInstance().ClanTips.displayTip(TipType.ENTER_NETHER, (Player)event.getEntity());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -454,7 +454,7 @@ public class NetherManager extends MiniPlugin
|
|||||||
OverworldOrigins.remove(event.getPlayer());
|
OverworldOrigins.remove(event.getPlayer());
|
||||||
event.getPlayer().removePotionEffect(PotionEffectType.NIGHT_VISION);
|
event.getPlayer().removePotionEffect(PotionEffectType.NIGHT_VISION);
|
||||||
UtilPlayer.message(event.getPlayer(), F.main(getName(), "You have escaped " + F.clansNether("The Nether") + "!"));
|
UtilPlayer.message(event.getPlayer(), F.main(getName(), "You have escaped " + F.clansNether("The Nether") + "!"));
|
||||||
ClansManager.getInstance().getCombatManager().Get(event.getPlayer()).SetLastCombatEngaged(System.currentTimeMillis() - Spawn.COMBAT_TAG_DURATION);
|
ClansManager.getInstance().getCombatManager().getLog(event.getPlayer()).SetLastCombatEngaged(System.currentTimeMillis() - Spawn.COMBAT_TAG_DURATION);
|
||||||
}, 1);
|
}, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -481,7 +481,7 @@ public class NetherManager extends MiniPlugin
|
|||||||
player.teleport(getReturnLocation(player));
|
player.teleport(getReturnLocation(player));
|
||||||
OverworldOrigins.remove(player);
|
OverworldOrigins.remove(player);
|
||||||
player.removePotionEffect(PotionEffectType.NIGHT_VISION);
|
player.removePotionEffect(PotionEffectType.NIGHT_VISION);
|
||||||
ClansManager.getInstance().getCombatManager().Get(player).SetLastCombatEngaged(System.currentTimeMillis() - Spawn.COMBAT_TAG_DURATION);
|
ClansManager.getInstance().getCombatManager().getLog(player).SetLastCombatEngaged(System.currentTimeMillis() - Spawn.COMBAT_TAG_DURATION);
|
||||||
UtilPlayer.message(player, F.main(getName(), "You have been forced to escape " + F.clansNether("The Nether") + " to survive its demonic poisons!"));
|
UtilPlayer.message(player, F.main(getName(), "You have been forced to escape " + F.clansNether("The Nether") + " to survive its demonic poisons!"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -257,13 +257,13 @@ public class NetherPortal implements Listener
|
|||||||
ClansManager.getInstance().getNetherManager().OverworldOrigins.remove((Player)event.getEntity());
|
ClansManager.getInstance().getNetherManager().OverworldOrigins.remove((Player)event.getEntity());
|
||||||
((Player)event.getEntity()).removePotionEffect(PotionEffectType.NIGHT_VISION);
|
((Player)event.getEntity()).removePotionEffect(PotionEffectType.NIGHT_VISION);
|
||||||
UtilPlayer.message(event.getEntity(), F.main(ClansManager.getInstance().getNetherManager().getName(), "You have escaped " + F.clansNether("The Nether") + "!"));
|
UtilPlayer.message(event.getEntity(), F.main(ClansManager.getInstance().getNetherManager().getName(), "You have escaped " + F.clansNether("The Nether") + "!"));
|
||||||
ClansManager.getInstance().getCombatManager().Get((Player)event.getEntity()).SetLastCombatEngaged(System.currentTimeMillis() - Spawn.COMBAT_TAG_DURATION);
|
ClansManager.getInstance().getCombatManager().getLog((Player)event.getEntity()).SetLastCombatEngaged(System.currentTimeMillis() - Spawn.COMBAT_TAG_DURATION);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ClansManager.getInstance().getNetherManager().InNether.put((Player)event.getEntity(), Expire);
|
ClansManager.getInstance().getNetherManager().InNether.put((Player)event.getEntity(), Expire);
|
||||||
event.getEntity().teleport(ClansManager.getInstance().getNetherManager().getNetherWorld().getSpawnLocation());
|
event.getEntity().teleport(ClansManager.getInstance().getNetherManager().getNetherWorld().getSpawnLocation());
|
||||||
ClansManager.getInstance().getCombatManager().Get((Player)event.getEntity()).SetLastCombatEngaged(System.currentTimeMillis() - Spawn.COMBAT_TAG_DURATION);
|
ClansManager.getInstance().getCombatManager().getLog((Player)event.getEntity()).SetLastCombatEngaged(System.currentTimeMillis() - Spawn.COMBAT_TAG_DURATION);
|
||||||
ClansManager.getInstance().ClanTips.displayTip(TipType.ENTER_NETHER, (Player)event.getEntity());
|
ClansManager.getInstance().ClanTips.displayTip(TipType.ENTER_NETHER, (Player)event.getEntity());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ public class ForceTeleportCommand extends CommandBase<NetherManager>
|
|||||||
UtilPlayer.message(caller, F.main(ClansManager.getInstance().getNetherManager().getName(), "You have escaped " + F.clansNether("The Nether") + "!"));
|
UtilPlayer.message(caller, F.main(ClansManager.getInstance().getNetherManager().getName(), "You have escaped " + F.clansNether("The Nether") + "!"));
|
||||||
ClansManager.getInstance().runSyncLater(() ->
|
ClansManager.getInstance().runSyncLater(() ->
|
||||||
{
|
{
|
||||||
ClansManager.getInstance().getCombatManager().Get(caller).SetLastCombatEngaged(System.currentTimeMillis());
|
ClansManager.getInstance().getCombatManager().getLog(caller).SetLastCombatEngaged(System.currentTimeMillis());
|
||||||
}, 20);
|
}, 20);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -191,7 +191,7 @@ public class Spawn extends MiniPlugin
|
|||||||
{
|
{
|
||||||
if (isSafe(cur.getLocation()))
|
if (isSafe(cur.getLocation()))
|
||||||
{
|
{
|
||||||
long lastDamager = _clansManager.getCombatManager().Get(cur).GetLastCombatEngaged();
|
long lastDamager = _clansManager.getCombatManager().getLog(cur).GetLastCombatEngaged();
|
||||||
long duration = System.currentTimeMillis() - lastDamager;
|
long duration = System.currentTimeMillis() - lastDamager;
|
||||||
|
|
||||||
if (!UtilTime.elapsed(lastDamager, COMBAT_TAG_DURATION))
|
if (!UtilTime.elapsed(lastDamager, COMBAT_TAG_DURATION))
|
||||||
@ -224,7 +224,7 @@ public class Spawn extends MiniPlugin
|
|||||||
{
|
{
|
||||||
if (!isSafe(event.GetPlayer().getLocation()))
|
if (!isSafe(event.GetPlayer().getLocation()))
|
||||||
{
|
{
|
||||||
_clansManager.getCombatManager().Get(event.GetPlayer()).SetLastCombatEngaged(System.currentTimeMillis());
|
_clansManager.getCombatManager().getLog(event.GetPlayer()).SetLastCombatEngaged(System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -275,7 +275,7 @@ public class Spawn extends MiniPlugin
|
|||||||
public void onRespawn(PlayerRespawnEvent event)
|
public void onRespawn(PlayerRespawnEvent event)
|
||||||
{
|
{
|
||||||
event.setRespawnLocation(getSpawnLocation());
|
event.setRespawnLocation(getSpawnLocation());
|
||||||
_clansManager.getCombatManager().Get(event.getPlayer()).SetLastCombatEngaged(System.currentTimeMillis() - Spawn.COMBAT_TAG_DURATION);
|
_clansManager.getCombatManager().getLog(event.getPlayer()).SetLastCombatEngaged(System.currentTimeMillis() - Spawn.COMBAT_TAG_DURATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -506,7 +506,7 @@ public class Spawn extends MiniPlugin
|
|||||||
|
|
||||||
public boolean isCombatTagged(Player player)
|
public boolean isCombatTagged(Player player)
|
||||||
{
|
{
|
||||||
return !UtilTime.elapsed(_clansManager.getCombatManager().Get(player).GetLastCombatEngaged(), Spawn.COMBAT_TAG_DURATION);
|
return !UtilTime.elapsed(_clansManager.getCombatManager().getLog(player).GetLastCombatEngaged(), Spawn.COMBAT_TAG_DURATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void teleport(final Player player, final Location location, int delay)
|
public void teleport(final Player player, final Location location, int delay)
|
||||||
|
@ -11,10 +11,14 @@ import org.bukkit.inventory.PlayerInventory;
|
|||||||
|
|
||||||
import mineplex.core.MiniPlugin;
|
import mineplex.core.MiniPlugin;
|
||||||
import mineplex.core.ReflectivelyCreateMiniPlugin;
|
import mineplex.core.ReflectivelyCreateMiniPlugin;
|
||||||
|
import mineplex.core.achievement.Achievement;
|
||||||
|
import mineplex.core.achievement.AchievementData;
|
||||||
|
import mineplex.core.achievement.AchievementManager;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.cosmetic.CosmeticManager;
|
import mineplex.core.cosmetic.CosmeticManager;
|
||||||
import mineplex.core.itemstack.ItemBuilder;
|
import mineplex.core.itemstack.ItemBuilder;
|
||||||
|
import mineplex.core.stats.event.PlayerStatsLoadedEvent;
|
||||||
import mineplex.core.titles.Titles;
|
import mineplex.core.titles.Titles;
|
||||||
import mineplex.hub.HubManager;
|
import mineplex.hub.HubManager;
|
||||||
|
|
||||||
@ -31,6 +35,7 @@ public class HubPlayerManager extends MiniPlugin
|
|||||||
.addLore("Click to open the Lobby Selector.")
|
.addLore("Click to open the Lobby Selector.")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
private final AchievementManager _achievementManager;
|
||||||
private final CosmeticManager _cosmeticManager;
|
private final CosmeticManager _cosmeticManager;
|
||||||
private final HubManager _hubManager;
|
private final HubManager _hubManager;
|
||||||
private final Titles _titles;
|
private final Titles _titles;
|
||||||
@ -39,6 +44,7 @@ public class HubPlayerManager extends MiniPlugin
|
|||||||
{
|
{
|
||||||
super("Hub Player");
|
super("Hub Player");
|
||||||
|
|
||||||
|
_achievementManager = require(AchievementManager.class);
|
||||||
_cosmeticManager = require(CosmeticManager.class);
|
_cosmeticManager = require(CosmeticManager.class);
|
||||||
_hubManager = require(HubManager.class);
|
_hubManager = require(HubManager.class);
|
||||||
_titles = require(Titles.class);
|
_titles = require(Titles.class);
|
||||||
@ -58,6 +64,18 @@ public class HubPlayerManager extends MiniPlugin
|
|||||||
giveHotbar(player);
|
giveHotbar(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void statsLoad(PlayerStatsLoadedEvent event)
|
||||||
|
{
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
AchievementData data = _achievementManager.get(player, Achievement.GLOBAL_MINEPLEX_LEVEL);
|
||||||
|
float levelPercentage = (float) data.getExpRemainder() / data.getExpNextLevel();
|
||||||
|
|
||||||
|
player.setLevel(data.getLevel());
|
||||||
|
player.setExp(Math.min(0, Math.max(0.999F, levelPercentage)));
|
||||||
|
}
|
||||||
|
|
||||||
public void giveHotbar(Player player)
|
public void giveHotbar(Player player)
|
||||||
{
|
{
|
||||||
PlayerInventory inventory = player.getInventory();
|
PlayerInventory inventory = player.getInventory();
|
||||||
|
@ -82,7 +82,7 @@ public class Stealth extends Skill
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!UtilTime.elapsed(Factory.Combat().Get(player).GetLastCombat(), 4000))
|
if (!UtilTime.elapsed(Factory.Combat().getLog(player).GetLastCombat(), 4000))
|
||||||
{
|
{
|
||||||
UtilPlayer.message(player, F.main(GetClassType().name(), "You cannot use " + F.skill(GetName()) + " while in Combat."));
|
UtilPlayer.message(player, F.main(GetClassType().name(), "You cannot use " + F.skill(GetName()) + " while in Combat."));
|
||||||
return;
|
return;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package mineplex.minecraft.game.core.combat;
|
package mineplex.minecraft.game.core.combat;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.WeakHashMap;
|
import java.util.WeakHashMap;
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
@ -9,12 +10,12 @@ import org.bukkit.entity.LivingEntity;
|
|||||||
|
|
||||||
public class ClientCombat
|
public class ClientCombat
|
||||||
{
|
{
|
||||||
private LinkedList<CombatLog> _kills = new LinkedList<CombatLog>();
|
private final LinkedList<CombatLog> _kills = new LinkedList<>();
|
||||||
private LinkedList<CombatLog> _assists = new LinkedList<CombatLog>();
|
private final LinkedList<CombatLog> _assists = new LinkedList<>();
|
||||||
private LinkedList<CombatLog> _deaths = new LinkedList<CombatLog>();
|
private final LinkedList<CombatLog> _deaths = new LinkedList<>();
|
||||||
|
|
||||||
private WeakHashMap<LivingEntity, Long> _lastHurt = new WeakHashMap<LivingEntity, Long>();
|
private final Map<LivingEntity, Long> _lastHurt = new WeakHashMap<>();
|
||||||
private WeakHashMap<LivingEntity, Long> _lastHurtBy = new WeakHashMap<LivingEntity, Long>();
|
private final Map<LivingEntity, Long> _lastHurtBy = new WeakHashMap<>();
|
||||||
private long _lastHurtByWorld = 0;
|
private long _lastHurtByWorld = 0;
|
||||||
|
|
||||||
public LinkedList<CombatLog> GetKills()
|
public LinkedList<CombatLog> GetKills()
|
||||||
|
@ -5,16 +5,17 @@ import java.util.LinkedList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
import mineplex.minecraft.game.core.damage.DamageChange;
|
import mineplex.minecraft.game.core.damage.DamageChange;
|
||||||
|
|
||||||
public class CombatLog
|
public class CombatLog
|
||||||
{
|
{
|
||||||
|
|
||||||
private final LinkedList<CombatComponent> _damager = new LinkedList<>();
|
private final LinkedList<CombatComponent> _damager = new LinkedList<>();
|
||||||
private final CombatComponent _player;
|
private final CombatComponent _player;
|
||||||
private final long _expireTime;
|
private final long _expireTime;
|
||||||
@ -23,13 +24,13 @@ public class CombatLog
|
|||||||
private CombatComponent _killer;
|
private CombatComponent _killer;
|
||||||
private int _assistants;
|
private int _assistants;
|
||||||
|
|
||||||
private String _killedColor = ChatColor.YELLOW + "";
|
private String _killedColor = C.cYellow;
|
||||||
private String _killerColor = ChatColor.YELLOW + "";
|
private String _killerColor = C.cYellow;
|
||||||
|
|
||||||
protected CombatComponent LastDamager;
|
private CombatComponent LastDamager;
|
||||||
protected long _lastDamaged;
|
private long _lastDamaged;
|
||||||
protected long _lastCombat;
|
private long _lastCombat;
|
||||||
protected long _lastCombatEngaged;
|
private long _lastCombatEngaged;
|
||||||
|
|
||||||
public CombatLog(Player player, long expireTime)
|
public CombatLog(Player player, long expireTime)
|
||||||
{
|
{
|
||||||
@ -52,6 +53,7 @@ public class CombatLog
|
|||||||
{
|
{
|
||||||
Attacked(damagerName, damage, damagerEnt, attackName, mod, new HashMap<>());
|
Attacked(damagerName, damage, damagerEnt, attackName, mod, new HashMap<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Attacked(String damagerName, double damage, LivingEntity damagerEnt, String attackName, List<DamageChange> mod, Map<String, Object> metadata)
|
public void Attacked(String damagerName, double damage, LivingEntity damagerEnt, String attackName, List<DamageChange> mod, Map<String, Object> metadata)
|
||||||
{
|
{
|
||||||
// Add Attacked
|
// Add Attacked
|
||||||
@ -121,7 +123,9 @@ public class CombatLog
|
|||||||
for (int i = 0; i < 8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
if (i < _damager.size())
|
if (i < _damager.size())
|
||||||
out.add(F.desc("#" + i, _damager.get(i).Display(_deathTime)));
|
{
|
||||||
|
out.add(F.desc("#" + (i + 1), _damager.get(i).Display(_deathTime)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
|
@ -6,6 +6,7 @@ import java.util.Iterator;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import net.minecraft.server.v1_8_R3.ItemStack;
|
import net.minecraft.server.v1_8_R3.ItemStack;
|
||||||
|
|
||||||
@ -21,10 +22,10 @@ import org.bukkit.event.EventPriority;
|
|||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
|
||||||
import mineplex.core.MiniPlugin;
|
import mineplex.core.MiniClientPlugin;
|
||||||
import mineplex.core.ReflectivelyCreateMiniPlugin;
|
import mineplex.core.ReflectivelyCreateMiniPlugin;
|
||||||
import mineplex.core.account.event.ClientUnloadEvent;
|
|
||||||
import mineplex.core.common.Pair;
|
import mineplex.core.common.Pair;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
@ -36,11 +37,13 @@ import mineplex.core.itemstack.ItemStackFactory;
|
|||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||||
|
import mineplex.minecraft.game.core.combat.event.CombatQuitEvent;
|
||||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||||
|
|
||||||
@ReflectivelyCreateMiniPlugin
|
@ReflectivelyCreateMiniPlugin
|
||||||
public class CombatManager extends MiniPlugin
|
public class CombatManager extends MiniClientPlugin<ClientCombat>
|
||||||
{
|
{
|
||||||
|
|
||||||
public enum AttackReason
|
public enum AttackReason
|
||||||
{
|
{
|
||||||
Attack,
|
Attack,
|
||||||
@ -48,29 +51,24 @@ public class CombatManager extends MiniPlugin
|
|||||||
DefaultWeaponName
|
DefaultWeaponName
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Map<UUID, CombatLog> _active = new HashMap<>();
|
private static final long EXPIRE_TIME = TimeUnit.SECONDS.toMillis(15);
|
||||||
private final Map<UUID, ClientCombat> _combatClients = new HashMap<>();
|
|
||||||
|
|
||||||
|
private final Map<UUID, CombatLog> _active = new HashMap<>();
|
||||||
private final Set<UUID> _removeList = new HashSet<>();
|
private final Set<UUID> _removeList = new HashSet<>();
|
||||||
|
|
||||||
protected long ExpireTime = 15000;
|
private AttackReason _attackReason;
|
||||||
|
|
||||||
protected AttackReason _attackReason = AttackReason.CustomWeaponName;
|
|
||||||
|
|
||||||
public CombatManager()
|
public CombatManager()
|
||||||
{
|
{
|
||||||
super("Death");
|
super("Death");
|
||||||
|
|
||||||
|
_attackReason = AttackReason.CustomWeaponName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@Override
|
||||||
public void unload(ClientUnloadEvent event)
|
protected ClientCombat addPlayer(UUID uuid)
|
||||||
{
|
{
|
||||||
_combatClients.remove(event.getUniqueId());
|
return new ClientCombat();
|
||||||
}
|
|
||||||
|
|
||||||
public ClientCombat Get(UUID uuid)
|
|
||||||
{
|
|
||||||
return _combatClients.computeIfAbsent(uuid, k -> new ClientCombat());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//This is a backup, for when CustomDamageEvent is disabled (manually)
|
//This is a backup, for when CustomDamageEvent is disabled (manually)
|
||||||
@ -91,7 +89,7 @@ public class CombatManager extends MiniPlugin
|
|||||||
{
|
{
|
||||||
if (damagerEnt instanceof Player)
|
if (damagerEnt instanceof Player)
|
||||||
{
|
{
|
||||||
Get((Player) damagerEnt).SetLastCombat(System.currentTimeMillis());
|
getLog((Player) damagerEnt).SetLastCombat(System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
String cause;
|
String cause;
|
||||||
@ -143,7 +141,7 @@ public class CombatManager extends MiniPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Get(damagee).Attacked(UtilEnt.getName(damagerEnt), event.getDamage(), damagerEnt, cause, null);
|
getLog(damagee).Attacked(UtilEnt.getName(damagerEnt), event.getDamage(), damagerEnt, cause, null);
|
||||||
}
|
}
|
||||||
// Damager is WORLD
|
// Damager is WORLD
|
||||||
else
|
else
|
||||||
@ -151,7 +149,7 @@ public class CombatManager extends MiniPlugin
|
|||||||
DamageCause cause = event.getCause();
|
DamageCause cause = event.getCause();
|
||||||
Pair<String, String> source = getSourceAndReason(cause);
|
Pair<String, String> source = getSourceAndReason(cause);
|
||||||
|
|
||||||
Get(damagee).Attacked(source.getLeft(), event.getDamage(), null, source.getRight(), null);
|
getLog(damagee).Attacked(source.getLeft(), event.getDamage(), null, source.getRight(), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,12 +222,12 @@ public class CombatManager extends MiniPlugin
|
|||||||
|
|
||||||
if (event.GetDamagerEntity(true) instanceof Player)
|
if (event.GetDamagerEntity(true) instanceof Player)
|
||||||
{
|
{
|
||||||
Get(event.GetDamagerPlayer(true)).SetLastCombat(System.currentTimeMillis());
|
getLog(event.GetDamagerPlayer(true)).SetLastCombat(System.currentTimeMillis());
|
||||||
Get(event.GetDamagerPlayer(true)).SetLastCombatEngaged(System.currentTimeMillis());
|
getLog(event.GetDamagerPlayer(true)).SetLastCombatEngaged(System.currentTimeMillis());
|
||||||
Get(event.GetDamageePlayer()).SetLastCombatEngaged(System.currentTimeMillis());
|
getLog(event.GetDamageePlayer()).SetLastCombatEngaged(System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
Get(event.GetDamageePlayer()).Attacked(UtilEnt.getName(event.GetDamagerEntity(true)), (int) event.GetDamage(), event.GetDamagerEntity(true), reason, event.GetDamageMod(), event.getMetadata());
|
getLog(event.GetDamageePlayer()).Attacked(UtilEnt.getName(event.GetDamagerEntity(true)), (int) event.GetDamage(), event.GetDamagerEntity(true), reason, event.GetDamageMod(), event.getMetadata());
|
||||||
}
|
}
|
||||||
// Damager is WORLD
|
// Damager is WORLD
|
||||||
else
|
else
|
||||||
@ -242,7 +240,7 @@ public class CombatManager extends MiniPlugin
|
|||||||
source.setRight(event.GetReason());
|
source.setRight(event.GetReason());
|
||||||
}
|
}
|
||||||
|
|
||||||
Get(event.GetDamageePlayer()).Attacked(source.getLeft(), (int) event.GetDamage(), null, source.getRight(), event.GetDamageMod(), event.getMetadata());
|
getLog(event.GetDamageePlayer()).Attacked(source.getLeft(), (int) event.GetDamage(), null, source.getRight(), event.GetDamageMod(), event.getMetadata());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -255,19 +253,15 @@ public class CombatManager extends MiniPlugin
|
|||||||
{
|
{
|
||||||
case BLOCK_EXPLOSION:
|
case BLOCK_EXPLOSION:
|
||||||
source = "Explosion";
|
source = "Explosion";
|
||||||
reason = "-";
|
|
||||||
break;
|
break;
|
||||||
case CONTACT:
|
case CONTACT:
|
||||||
source = "Cactus";
|
source = "Cactus";
|
||||||
reason = "-";
|
|
||||||
break;
|
break;
|
||||||
case CUSTOM:
|
case CUSTOM:
|
||||||
source = "Custom";
|
source = "Custom";
|
||||||
reason = "-";
|
|
||||||
break;
|
break;
|
||||||
case DROWNING:
|
case DROWNING:
|
||||||
source = "Water";
|
source = "Water";
|
||||||
reason = "-";
|
|
||||||
break;
|
break;
|
||||||
case ENTITY_ATTACK:
|
case ENTITY_ATTACK:
|
||||||
source = "Entity";
|
source = "Entity";
|
||||||
@ -275,67 +269,51 @@ public class CombatManager extends MiniPlugin
|
|||||||
break;
|
break;
|
||||||
case ENTITY_EXPLOSION:
|
case ENTITY_EXPLOSION:
|
||||||
source = "Explosion";
|
source = "Explosion";
|
||||||
reason = "-";
|
|
||||||
break;
|
break;
|
||||||
case FALL:
|
case FALL:
|
||||||
source = "Fall";
|
source = "Fall";
|
||||||
reason = "-";
|
|
||||||
break;
|
break;
|
||||||
case FALLING_BLOCK:
|
case FALLING_BLOCK:
|
||||||
source = "Falling Block";
|
source = "Falling Block";
|
||||||
reason = "-";
|
|
||||||
break;
|
break;
|
||||||
case FIRE:
|
case FIRE:
|
||||||
source = "Fire";
|
source = "Fire";
|
||||||
reason = "-";
|
|
||||||
break;
|
break;
|
||||||
case FIRE_TICK:
|
case FIRE_TICK:
|
||||||
source = "Fire";
|
source = "Fire";
|
||||||
reason = "-";
|
|
||||||
break;
|
break;
|
||||||
case LAVA:
|
case LAVA:
|
||||||
source = "Lava";
|
source = "Lava";
|
||||||
reason = "-";
|
|
||||||
break;
|
break;
|
||||||
case LIGHTNING:
|
case LIGHTNING:
|
||||||
source = "Lightning";
|
source = "Lightning";
|
||||||
reason = "-";
|
|
||||||
break;
|
break;
|
||||||
case MAGIC:
|
case MAGIC:
|
||||||
source = "Magic";
|
source = "Magic";
|
||||||
reason = "-";
|
|
||||||
break;
|
break;
|
||||||
case MELTING:
|
case MELTING:
|
||||||
source = "Melting";
|
source = "Melting";
|
||||||
reason = "-";
|
|
||||||
break;
|
break;
|
||||||
case POISON:
|
case POISON:
|
||||||
source = "Poison";
|
source = "Poison";
|
||||||
reason = "-";
|
|
||||||
break;
|
break;
|
||||||
case PROJECTILE:
|
case PROJECTILE:
|
||||||
source = "Projectile";
|
source = "Projectile";
|
||||||
reason = "-";
|
|
||||||
break;
|
break;
|
||||||
case STARVATION:
|
case STARVATION:
|
||||||
source = "Starvation";
|
source = "Starvation";
|
||||||
reason = "-";
|
|
||||||
break;
|
break;
|
||||||
case SUFFOCATION:
|
case SUFFOCATION:
|
||||||
source = "Suffocation";
|
source = "Suffocation";
|
||||||
reason = "-";
|
|
||||||
break;
|
break;
|
||||||
case SUICIDE:
|
case SUICIDE:
|
||||||
source = "Suicide";
|
source = "Suicide";
|
||||||
reason = "-";
|
|
||||||
break;
|
break;
|
||||||
case VOID:
|
case VOID:
|
||||||
source = "Void";
|
source = "Void";
|
||||||
reason = "-";
|
|
||||||
break;
|
break;
|
||||||
case WITHER:
|
case WITHER:
|
||||||
source = "Wither";
|
source = "Wither";
|
||||||
reason = "-";
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -343,7 +321,31 @@ public class CombatManager extends MiniPlugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW)
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
public void HandleDeath(PlayerDeathEvent event)
|
public void playerQuit(PlayerQuitEvent event)
|
||||||
|
{
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
CombatLog log = _active.get(player.getUniqueId());
|
||||||
|
|
||||||
|
if (log == null || log.GetAttackers().isEmpty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CombatQuitEvent combatQuitEvent = new CombatQuitEvent(player);
|
||||||
|
// Cancelled by default
|
||||||
|
combatQuitEvent.setCancelled(true);
|
||||||
|
UtilServer.CallEvent(combatQuitEvent);
|
||||||
|
|
||||||
|
if (combatQuitEvent.isCancelled())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
playerDeath(new PlayerDeathEvent(player, null, 0, null));
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
|
public void playerDeath(PlayerDeathEvent event)
|
||||||
{
|
{
|
||||||
event.setDeathMessage(null);
|
event.setDeathMessage(null);
|
||||||
|
|
||||||
@ -497,9 +499,9 @@ public class CombatManager extends MiniPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public CombatLog Get(Player player)
|
public CombatLog getLog(Player player)
|
||||||
{
|
{
|
||||||
return _active.computeIfAbsent(player.getUniqueId(), k -> new CombatLog(player, ExpireTime));
|
return _active.computeIfAbsent(player.getUniqueId(), k -> new CombatLog(player, EXPIRE_TIME));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
|
@ -0,0 +1,42 @@
|
|||||||
|
package mineplex.minecraft.game.core.combat.event;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
import org.bukkit.event.player.PlayerEvent;
|
||||||
|
|
||||||
|
public class CombatQuitEvent extends PlayerEvent implements Cancellable
|
||||||
|
{
|
||||||
|
|
||||||
|
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList()
|
||||||
|
{
|
||||||
|
return HANDLER_LIST;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean _cancelled;
|
||||||
|
|
||||||
|
public CombatQuitEvent(Player who)
|
||||||
|
{
|
||||||
|
super(who);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCancelled(boolean cancelled)
|
||||||
|
{
|
||||||
|
_cancelled = cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCancelled()
|
||||||
|
{
|
||||||
|
return _cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HandlerList getHandlers()
|
||||||
|
{
|
||||||
|
return HANDLER_LIST;
|
||||||
|
}
|
||||||
|
}
|
@ -274,27 +274,6 @@ public class DamageManager extends MiniPlugin
|
|||||||
projectile.remove();
|
projectile.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
private boolean GoldPower(LivingEntity damager)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Player player = (Player)damager;
|
|
||||||
if (!Util().Gear().isGold(player.getItemInHand()))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!player.getInventory().contains(Material.GOLD_NUGGET))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
UtilInv.remove(player, Material.GOLD_NUGGET, (byte)0, 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
public CustomDamageEvent NewDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile proj,
|
public CustomDamageEvent NewDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile proj,
|
||||||
DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor,
|
DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor,
|
||||||
|
@ -125,6 +125,7 @@ import mineplex.minecraft.game.classcombat.item.event.ItemTriggerEvent;
|
|||||||
import mineplex.minecraft.game.classcombat.shop.ClassCombatShop;
|
import mineplex.minecraft.game.classcombat.shop.ClassCombatShop;
|
||||||
import mineplex.minecraft.game.classcombat.shop.ClassShopManager;
|
import mineplex.minecraft.game.classcombat.shop.ClassShopManager;
|
||||||
import mineplex.minecraft.game.core.IRelation;
|
import mineplex.minecraft.game.core.IRelation;
|
||||||
|
import mineplex.minecraft.game.core.combat.event.CombatQuitEvent;
|
||||||
import mineplex.minecraft.game.core.condition.Condition;
|
import mineplex.minecraft.game.core.condition.Condition;
|
||||||
import mineplex.minecraft.game.core.condition.ConditionManager;
|
import mineplex.minecraft.game.core.condition.ConditionManager;
|
||||||
import mineplex.minecraft.game.core.damage.DamageManager;
|
import mineplex.minecraft.game.core.damage.DamageManager;
|
||||||
@ -137,6 +138,7 @@ import nautilus.game.arcade.command.CancelNextGameCommand;
|
|||||||
import nautilus.game.arcade.command.GameCommand;
|
import nautilus.game.arcade.command.GameCommand;
|
||||||
import nautilus.game.arcade.command.GoToNextGameCommand;
|
import nautilus.game.arcade.command.GoToNextGameCommand;
|
||||||
import nautilus.game.arcade.command.KitUnlockCommand;
|
import nautilus.game.arcade.command.KitUnlockCommand;
|
||||||
|
import nautilus.game.arcade.command.MapCommand;
|
||||||
import nautilus.game.arcade.command.ReturnToHubCommand;
|
import nautilus.game.arcade.command.ReturnToHubCommand;
|
||||||
import nautilus.game.arcade.command.SpectatorCommand;
|
import nautilus.game.arcade.command.SpectatorCommand;
|
||||||
import nautilus.game.arcade.command.TauntCommand;
|
import nautilus.game.arcade.command.TauntCommand;
|
||||||
@ -188,7 +190,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
BYPASS_MPS_WHITELIST,
|
BYPASS_MPS_WHITELIST,
|
||||||
RETURN_TO_HUB_COMMAND,
|
RETURN_TO_HUB_COMMAND,
|
||||||
TOURNAMENT_STOP_COMMAND,
|
TOURNAMENT_STOP_COMMAND,
|
||||||
SPECTATOR_COMMAND
|
SPECTATOR_COMMAND,
|
||||||
|
MAP_COMMAND
|
||||||
}
|
}
|
||||||
|
|
||||||
// Modules
|
// Modules
|
||||||
@ -664,6 +667,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
PermissionGroup.MOD.setPermission(Perm.BYPASS_MPS_WHITELIST, true, true);
|
PermissionGroup.MOD.setPermission(Perm.BYPASS_MPS_WHITELIST, true, true);
|
||||||
PermissionGroup.EVENTMOD.setPermission(Perm.TOURNAMENT_STOP_COMMAND, false, true);
|
PermissionGroup.EVENTMOD.setPermission(Perm.TOURNAMENT_STOP_COMMAND, false, true);
|
||||||
PermissionGroup.PLAYER.setPermission(Perm.SPECTATOR_COMMAND, true, true);
|
PermissionGroup.PLAYER.setPermission(Perm.SPECTATOR_COMMAND, true, true);
|
||||||
|
PermissionGroup.PLAYER.setPermission(Perm.MAP_COMMAND, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -671,6 +675,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
{
|
{
|
||||||
addCommand(new GameCommand(this));
|
addCommand(new GameCommand(this));
|
||||||
addCommand(new KitUnlockCommand(this));
|
addCommand(new KitUnlockCommand(this));
|
||||||
|
addCommand(new MapCommand(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameChatManager getGameChatManager()
|
public GameChatManager getGameChatManager()
|
||||||
@ -1565,11 +1570,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
return _serverConfig.PlayerKickIdle;
|
return _serverConfig.PlayerKickIdle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetDesiredPlayerAmount()
|
|
||||||
{
|
|
||||||
return _serverConfig.MaxPlayers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String GetHost()
|
public String GetHost()
|
||||||
{
|
{
|
||||||
return _serverConfig.HostName;
|
return _serverConfig.HostName;
|
||||||
@ -1637,7 +1637,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
}
|
}
|
||||||
else if (event.GetState() == GameState.Prepare || event.GetState() == GameState.Loading || event.GetState() == GameState.Dead)
|
else if (event.GetState() == GameState.Prepare || event.GetState() == GameState.Loading || event.GetState() == GameState.Dead)
|
||||||
{
|
{
|
||||||
if (event.GetGame().GadgetsDisabled)
|
Game game = event.GetGame();
|
||||||
|
|
||||||
|
if (game.GadgetsDisabled)
|
||||||
{
|
{
|
||||||
if (getCosmeticManager().isShowingInterface())
|
if (getCosmeticManager().isShowingInterface())
|
||||||
{
|
{
|
||||||
@ -1646,12 +1648,36 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!event.GetGame().AllowParticles)
|
if (game.AllowParticles)
|
||||||
|
{
|
||||||
|
for (Player player : UtilServer.getPlayersCollection())
|
||||||
|
{
|
||||||
|
Gadget gadget = getCosmeticManager().getGadgetManager().getActive(player, GadgetType.PARTICLE);
|
||||||
|
|
||||||
|
if (gadget == null || isVanished(player))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getPreferences().get(player).isActive(Preference.PARTICLES_IN_GAME))
|
||||||
|
{
|
||||||
|
if (!gadget.isActive(player))
|
||||||
|
{
|
||||||
|
gadget.enable(player, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gadget.disable(player, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
getCosmeticManager().setHideParticles(true);
|
getCosmeticManager().setHideParticles(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.GetGame().ShowWeaponNames)
|
if (game.ShowWeaponNames)
|
||||||
{
|
{
|
||||||
getCosmeticManager().getGadgetManager().setShowWeaponNames(true);
|
getCosmeticManager().getGadgetManager().setShowWeaponNames(true);
|
||||||
}
|
}
|
||||||
@ -1695,54 +1721,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public void saveBasicStats(final Game game)
|
|
||||||
{
|
|
||||||
if (!IsTournamentServer())
|
|
||||||
return;
|
|
||||||
|
|
||||||
final Map<UUID, Boolean> data = new HashMap<>();
|
|
||||||
|
|
||||||
for (Player loser : game.getLosers())
|
|
||||||
data.put(loser.getUniqueId(), false);
|
|
||||||
|
|
||||||
for (Player winner : game.getWinners())
|
|
||||||
data.put(winner.getUniqueId(), true);
|
|
||||||
|
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), new Runnable()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
getArcadeRepository().saveBasicStats(game.GetType(), IsTournamentServer(), (int) (System.currentTimeMillis() - game.getGameLiveTime()), data);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/*public void saveLeaderboardStats(Game game)
|
|
||||||
{
|
|
||||||
final TournamentType type = TournamentType.getTournamentType(game.GetType());
|
|
||||||
|
|
||||||
if (type != null)
|
|
||||||
{
|
|
||||||
final Map<UUID, Boolean> data = new HashMap<>();
|
|
||||||
|
|
||||||
for (Player loser : game.getLosers())
|
|
||||||
data.put(loser.getUniqueId(), false);
|
|
||||||
|
|
||||||
for (Player winner : game.getWinners())
|
|
||||||
data.put(winner.getUniqueId(), true);
|
|
||||||
|
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), new Runnable()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
getArcadeRepository().saveLeaderboardStats(0, type.ordinal(), data);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
public boolean isGameInProgress()
|
public boolean isGameInProgress()
|
||||||
{
|
{
|
||||||
return _game != null && _game.InProgress();
|
return _game != null && _game.InProgress();
|
||||||
@ -1763,11 +1741,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
_preferencesManager.save(preferences);
|
_preferencesManager.save(preferences);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IdleManager getIdleManager()
|
|
||||||
{
|
|
||||||
return _idleManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void enableChampionsModules()
|
public void enableChampionsModules()
|
||||||
{
|
{
|
||||||
_classManager.setEnabled(true);
|
_classManager.setEnabled(true);
|
||||||
@ -1854,9 +1827,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
|
|
||||||
public boolean isSpectator(Entity player)
|
public boolean isSpectator(Entity player)
|
||||||
{
|
{
|
||||||
if (player instanceof Player)
|
return UtilPlayer.isSpectator(player);
|
||||||
return UtilPlayer.isSpectator(player);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
@ -2018,6 +1989,17 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void combatQuit(CombatQuitEvent event)
|
||||||
|
{
|
||||||
|
if (_game == null || !_game.IsLive())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
event.setCancelled(false);
|
||||||
|
}
|
||||||
|
|
||||||
public List<Player> getValidPlayersForGameStart()
|
public List<Player> getValidPlayersForGameStart()
|
||||||
{
|
{
|
||||||
return PlayerSelector.selectPlayers(
|
return PlayerSelector.selectPlayers(
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
package nautilus.game.arcade.command;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mineplex.core.command.CommandBase;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
|
||||||
|
import nautilus.game.arcade.ArcadeManager;
|
||||||
|
import nautilus.game.arcade.ArcadeManager.Perm;
|
||||||
|
import nautilus.game.arcade.game.Game;
|
||||||
|
|
||||||
|
public class MapCommand extends CommandBase<ArcadeManager>
|
||||||
|
{
|
||||||
|
|
||||||
|
public MapCommand(ArcadeManager plugin)
|
||||||
|
{
|
||||||
|
super(plugin, Perm.MAP_COMMAND, "map", "whatmap");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void Execute(Player caller, String[] args)
|
||||||
|
{
|
||||||
|
Game game = Plugin.GetGame();
|
||||||
|
|
||||||
|
if (game == null || game.WorldData == null)
|
||||||
|
{
|
||||||
|
caller.sendMessage(F.main(Plugin.getName(), "Is this the work of an enemy stand? There's no map?"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
caller.sendMessage(F.main(Plugin.getName(), game.WorldData.getFormattedName()));
|
||||||
|
}
|
||||||
|
}
|
@ -33,7 +33,7 @@ public class TauntCommand extends CommandBase<ArcadeManager>
|
|||||||
gameDisplay = game.GetType().getDisplay();
|
gameDisplay = game.GetType().getDisplay();
|
||||||
}
|
}
|
||||||
TauntCommandEvent event = new TauntCommandEvent(player, _arcadeManager.isGameInProgress(),
|
TauntCommandEvent event = new TauntCommandEvent(player, _arcadeManager.isGameInProgress(),
|
||||||
_arcadeManager.GetGame().IsAlive(player), UtilPlayer.isSpectator(player), combatManager.Get(player).GetLastCombatEngaged(),
|
_arcadeManager.GetGame().IsAlive(player), UtilPlayer.isSpectator(player), combatManager.getLog(player).GetLastCombatEngaged(),
|
||||||
gameDisplay);
|
gameDisplay);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ public abstract class Game extends ListenerComponent implements Lifetimed
|
|||||||
|
|
||||||
// Player Data
|
// Player Data
|
||||||
private NautHashMap<Player, HashMap<String, GemData>> _gemCount = new NautHashMap<Player, HashMap<String, GemData>>();
|
private NautHashMap<Player, HashMap<String, GemData>> _gemCount = new NautHashMap<Player, HashMap<String, GemData>>();
|
||||||
private NautHashMap<Player, HashMap<String, Integer>> _stats = new NautHashMap<Player, HashMap<String, Integer>>();
|
private final Map<Player, Map<String, Integer>> _stats = new HashMap<>();
|
||||||
private NautHashMap<Player, Long> _playerInTime = new NautHashMap<>();
|
private NautHashMap<Player, Long> _playerInTime = new NautHashMap<>();
|
||||||
|
|
||||||
// Player Location Store
|
// Player Location Store
|
||||||
@ -1364,7 +1364,7 @@ public abstract class Game extends ListenerComponent implements Lifetimed
|
|||||||
|
|
||||||
UtilPlayer.message(player, ArcadeFormat.Line);
|
UtilPlayer.message(player, ArcadeFormat.Line);
|
||||||
|
|
||||||
UtilPlayer.message(player, C.cGreen + "Game - " + C.cYellow + C.Bold + this.GetName());
|
UtilPlayer.message(player, C.cGreen + "Game - " + C.cWhiteB + GetName());
|
||||||
UtilPlayer.message(player, "");
|
UtilPlayer.message(player, "");
|
||||||
|
|
||||||
for (String line : this.GetDesc())
|
for (String line : this.GetDesc())
|
||||||
@ -1373,8 +1373,7 @@ public abstract class Game extends ListenerComponent implements Lifetimed
|
|||||||
}
|
}
|
||||||
|
|
||||||
UtilPlayer.message(player, "");
|
UtilPlayer.message(player, "");
|
||||||
UtilPlayer.message(player, C.cGreen + "Map - " + C.cYellow + C.Bold + WorldData.MapName + ChatColor.RESET + C.cGray
|
UtilPlayer.message(player, WorldData.getFormattedName());
|
||||||
+ " created by " + C.cYellow + C.Bold + WorldData.MapAuthor);
|
|
||||||
|
|
||||||
UtilPlayer.message(player, ArcadeFormat.Line);
|
UtilPlayer.message(player, ArcadeFormat.Line);
|
||||||
}
|
}
|
||||||
@ -1469,8 +1468,7 @@ public abstract class Game extends ListenerComponent implements Lifetimed
|
|||||||
}
|
}
|
||||||
|
|
||||||
UtilPlayer.message(player, "");
|
UtilPlayer.message(player, "");
|
||||||
UtilPlayer.message(player, "§aMap - §f§l" + WorldData.MapName + C.cGray + " created by " + "§f§l"
|
UtilPlayer.message(player, WorldData.getFormattedName());
|
||||||
+ WorldData.MapAuthor);
|
|
||||||
|
|
||||||
UtilPlayer.message(player, ArcadeFormat.Line);
|
UtilPlayer.message(player, ArcadeFormat.Line);
|
||||||
}
|
}
|
||||||
@ -1542,8 +1540,7 @@ public abstract class Game extends ListenerComponent implements Lifetimed
|
|||||||
}
|
}
|
||||||
|
|
||||||
UtilPlayer.message(player, "");
|
UtilPlayer.message(player, "");
|
||||||
UtilPlayer.message(player, "§aMap - §f§l" + WorldData.MapName + C.cGray + " created by " + "§f§l"
|
UtilPlayer.message(player, WorldData.getFormattedName());
|
||||||
+ WorldData.MapAuthor);
|
|
||||||
|
|
||||||
UtilPlayer.message(player, ArcadeFormat.Line);
|
UtilPlayer.message(player, ArcadeFormat.Line);
|
||||||
}
|
}
|
||||||
@ -1679,7 +1676,7 @@ public abstract class Game extends ListenerComponent implements Lifetimed
|
|||||||
|
|
||||||
public abstract List<Player> getLosers();
|
public abstract List<Player> getLosers();
|
||||||
|
|
||||||
public NautHashMap<Player, HashMap<String, Integer>> GetStats()
|
public Map<Player, Map<String, Integer>> GetStats()
|
||||||
{
|
{
|
||||||
return _stats;
|
return _stats;
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ import java.util.Set;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.bukkit.Color;
|
import org.bukkit.Color;
|
||||||
|
import org.bukkit.Effect;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
@ -282,9 +283,13 @@ public class CakeTeamModule extends CakeModule
|
|||||||
_samePlayer = false;
|
_samePlayer = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Location location = block.getLocation();
|
||||||
|
|
||||||
|
block.getWorld().playEffect(location, Effect.STEP_SOUND, Material.CAKE);
|
||||||
|
|
||||||
if (data < 6)
|
if (data < 6)
|
||||||
{
|
{
|
||||||
block.getWorld().playSound(block.getLocation(), Sound.EAT, 1, 1);
|
block.getWorld().playSound(location, Sound.EAT, 1, 1);
|
||||||
block.setData((byte) (data + 1));
|
block.setData((byte) (data + 1));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package nautilus.game.arcade.game.games.minestrike.items.guns;
|
package nautilus.game.arcade.game.games.minestrike.items.guns;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -345,7 +345,7 @@ public class Gun extends StrikeItem
|
|||||||
Player owner = UtilPlayer.searchExact(getOwnerName());
|
Player owner = UtilPlayer.searchExact(getOwnerName());
|
||||||
if (owner != null)
|
if (owner != null)
|
||||||
{
|
{
|
||||||
HashMap<String, Integer> localStatsMap = game.getHost().GetStats().get(owner);
|
Map<String, Integer> localStatsMap = game.getHost().GetStats().get(owner);
|
||||||
if (localStatsMap != null)
|
if (localStatsMap != null)
|
||||||
{
|
{
|
||||||
Integer kills = localStatsMap.get(game.getHost().GetName() + "." + getStatNameKills(true));
|
Integer kills = localStatsMap.get(game.getHost().GetName() + "." + getStatNameKills(true));
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package nautilus.game.arcade.game.games.wizards.spells;
|
package nautilus.game.arcade.game.games.wizards.spells;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
@ -61,7 +60,7 @@ public class SpellGust extends Spell implements SpellClick
|
|||||||
|
|
||||||
Wizards.getArcadeManager().GetCondition().Factory().Falling("Gust", target, player, 40, false, true);
|
Wizards.getArcadeManager().GetCondition().Factory().Falling("Gust", target, player, 40, false, true);
|
||||||
|
|
||||||
Wizards.Manager.GetDamage().GetCombatManager().Get(target).Attacked(player.getName(), 0, player, "Gust", new ArrayList<DamageChange>());
|
Wizards.Manager.GetDamage().GetCombatManager().getLog(target).Attacked(player.getName(), 0, player, "Gust", new ArrayList<DamageChange>());
|
||||||
|
|
||||||
UtilAction.velocity(target, vec);
|
UtilAction.velocity(target, vec);
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package nautilus.game.arcade.managers;
|
package nautilus.game.arcade.managers;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -8,19 +9,16 @@ import org.bukkit.event.EventHandler;
|
|||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
|
||||||
import mineplex.core.account.permissions.Permission;
|
import mineplex.core.account.permissions.Permission;
|
||||||
import mineplex.core.account.permissions.PermissionGroup;
|
import mineplex.core.account.permissions.PermissionGroup;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.UtilMath;
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
|
||||||
|
|
||||||
import nautilus.game.arcade.ArcadeManager;
|
import nautilus.game.arcade.ArcadeManager;
|
||||||
import nautilus.game.arcade.GameType;
|
|
||||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||||
|
import nautilus.game.arcade.game.Game;
|
||||||
import nautilus.game.arcade.game.Game.GameState;
|
import nautilus.game.arcade.game.Game.GameState;
|
||||||
import nautilus.game.arcade.stats.StatTracker;
|
import nautilus.game.arcade.stats.StatTracker;
|
||||||
|
|
||||||
@ -31,68 +29,91 @@ public class GameStatManager implements Listener
|
|||||||
STAT_BOOST_COMMAND,
|
STAT_BOOST_COMMAND,
|
||||||
}
|
}
|
||||||
|
|
||||||
ArcadeManager Manager;
|
final ArcadeManager Manager;
|
||||||
|
|
||||||
private final HashMap<UUID, Long> _joinTimes = new HashMap<>();
|
private final Map<UUID, Long> _joinTimes = new HashMap<>();
|
||||||
|
|
||||||
public GameStatManager(ArcadeManager manager)
|
public GameStatManager(ArcadeManager manager)
|
||||||
{
|
{
|
||||||
Manager = manager;
|
Manager = manager;
|
||||||
|
|
||||||
Manager.getPluginManager().registerEvents(this, Manager.getPlugin());
|
Manager.registerEvents(this);
|
||||||
|
|
||||||
generatePermissions();
|
generatePermissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generatePermissions()
|
private void generatePermissions()
|
||||||
{
|
{
|
||||||
|
|
||||||
PermissionGroup.LT.setPermission(Perm.STAT_BOOST_COMMAND, true, true);
|
PermissionGroup.LT.setPermission(Perm.STAT_BOOST_COMMAND, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void StatEnableDisable(GameStateChangeEvent event)
|
public void statEnableDisable(GameStateChangeEvent event)
|
||||||
{
|
{
|
||||||
if (!Manager.IsRewardStats())
|
if (!Manager.IsRewardStats() || event.GetState() != GameState.Live)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
if (event.GetState() != GameState.Live)
|
|
||||||
return;
|
|
||||||
|
|
||||||
//int requirement = (int)((double)event.GetGame().Manager.GetPlayerFull() * 0.75d);
|
|
||||||
int requirement = 2;
|
int requirement = 2;
|
||||||
|
|
||||||
event.GetGame().CanAddStats = (double)event.GetGame().GetPlayers(true).size() >= requirement;
|
event.GetGame().CanAddStats = event.GetGame().GetPlayers(true).size() >= requirement;
|
||||||
|
|
||||||
if (!event.GetGame().CanAddStats)
|
if (!event.GetGame().CanAddStats)
|
||||||
|
{
|
||||||
event.GetGame().Announce(C.Bold + "Stats/Achievements Disabled. Requires " + requirement + " Players.", event.GetGame().PlaySoundGameStart);
|
event.GetGame().Announce(C.Bold + "Stats/Achievements Disabled. Requires " + requirement + " Players.", event.GetGame().PlaySoundGameStart);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void StatRegister(GameStateChangeEvent event)
|
public void statRecord(GameStateChangeEvent event)
|
||||||
{
|
{
|
||||||
if (!Manager.IsRewardStats())
|
if (!Manager.IsRewardStats() || event.GetState() != GameState.Dead)
|
||||||
return;
|
|
||||||
|
|
||||||
if (event.GetState() != GameState.Dead)
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (Player player : event.GetGame().GetStats().keySet())
|
|
||||||
{
|
{
|
||||||
for (String stat : event.GetGame().GetStats().get(player).keySet())
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
event.GetGame().GetStats().forEach((player, statMap) ->
|
||||||
|
{
|
||||||
|
statMap.forEach((stat, value) ->
|
||||||
|
{
|
||||||
|
if (value > 0)
|
||||||
|
{
|
||||||
|
Manager.GetStatsManager().incrementStat(player, stat, value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
|
public void statRecord(PlayerQuitEvent event)
|
||||||
|
{
|
||||||
|
Game game = Manager.GetGame();
|
||||||
|
|
||||||
|
if (game == null || !game.IsLive())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
Map<String, Integer> stats = game.GetStats().remove(player);
|
||||||
|
|
||||||
|
if (stats == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
stats.forEach((stat, value) ->
|
||||||
|
{
|
||||||
|
if (value > 0)
|
||||||
{
|
{
|
||||||
int value = event.GetGame().GetStats().get(player).get(stat);
|
|
||||||
|
|
||||||
if (value <= 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
Manager.GetStatsManager().incrementStat(player, stat, value);
|
Manager.GetStatsManager().incrementStat(player, stat, value);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void StatGameRecord(GameStateChangeEvent event)
|
public void statTrackCleanup(GameStateChangeEvent event)
|
||||||
{
|
{
|
||||||
if (event.GetState() == GameState.End)
|
if (event.GetState() == GameState.End)
|
||||||
{
|
{
|
||||||
@ -121,35 +142,4 @@ public class GameStatManager implements Listener
|
|||||||
Manager.GetStatsManager().incrementStat(event.getPlayer(), "Global.TimeInGame", timeInGame);
|
Manager.GetStatsManager().incrementStat(event.getPlayer(), "Global.TimeInGame", timeInGame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void statBoostCommand(PlayerCommandPreprocessEvent event)
|
|
||||||
{
|
|
||||||
if (event.getMessage().startsWith("/statboost ") && Manager.GetClients().Get(event.getPlayer()).hasPermission(Perm.STAT_BOOST_COMMAND))
|
|
||||||
{
|
|
||||||
event.setCancelled(true);
|
|
||||||
|
|
||||||
String[] tokens = event.getMessage().split(" ");
|
|
||||||
|
|
||||||
if (tokens.length < 2)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Player player = UtilPlayer.searchOnline(event.getPlayer(), tokens[1], true);
|
|
||||||
if (player == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (GameType type : GameType.values())
|
|
||||||
{
|
|
||||||
int wins = UtilMath.r(50);
|
|
||||||
int loss = UtilMath.r(50);
|
|
||||||
int play = wins+loss;
|
|
||||||
|
|
||||||
Manager.GetStatsManager().incrementStat(player, type.getName() + ".Wins", wins);
|
|
||||||
Manager.GetStatsManager().incrementStat(player, type.getName() + ".Losses", loss);
|
|
||||||
Manager.GetStatsManager().incrementStat(player, type.getName() + ".GamesPlayed", play);
|
|
||||||
}
|
|
||||||
|
|
||||||
event.getPlayer().sendMessage("Gave Stats: " + player.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -2,6 +2,7 @@ package nautilus.game.arcade.managers;
|
|||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
@ -14,15 +15,16 @@ import org.bukkit.event.world.ChunkUnloadEvent;
|
|||||||
|
|
||||||
public class GameWorldManager implements Listener
|
public class GameWorldManager implements Listener
|
||||||
{
|
{
|
||||||
ArcadeManager Manager;
|
|
||||||
|
final ArcadeManager Manager;
|
||||||
|
|
||||||
private HashSet<WorldData> _worldLoader = new HashSet<WorldData>();
|
private final Set<WorldData> _worldLoader = new HashSet<>();
|
||||||
|
|
||||||
public GameWorldManager(ArcadeManager manager)
|
public GameWorldManager(ArcadeManager manager)
|
||||||
{
|
{
|
||||||
Manager = manager;
|
Manager = manager;
|
||||||
|
|
||||||
Manager.getPluginManager().registerEvents(this, Manager.getPlugin());
|
Manager.registerEvents(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -54,16 +56,6 @@ public class GameWorldManager implements Listener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
@EventHandler
|
|
||||||
public void ChunkLoad(ChunkPreLoadEvent event)
|
|
||||||
{
|
|
||||||
if (Manager.GetGame() != null)
|
|
||||||
if (Manager.GetGame().WorldData != null)
|
|
||||||
Manager.GetGame().WorldData.ChunkLoad(event);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void ChunkUnload(ChunkUnloadEvent event)
|
public void ChunkUnload(ChunkUnloadEvent event)
|
||||||
{
|
{
|
||||||
|
@ -1,39 +1,27 @@
|
|||||||
package nautilus.game.arcade.stats;
|
package nautilus.game.arcade.stats;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
|
||||||
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||||
|
|
||||||
import nautilus.game.arcade.game.Game;
|
import nautilus.game.arcade.game.Game;
|
||||||
|
|
||||||
public class DeathsStatTracker extends StatTracker<Game>
|
public class DeathsStatTracker extends StatTracker<Game>
|
||||||
{
|
{
|
||||||
|
|
||||||
public DeathsStatTracker(Game game)
|
public DeathsStatTracker(Game game)
|
||||||
{
|
{
|
||||||
super(game);
|
super(game);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
@EventHandler
|
||||||
public void onCombatDeath(CombatDeathEvent event)
|
public void onCombatDeath(CombatDeathEvent event)
|
||||||
{
|
{
|
||||||
if (getGame().GetState() != Game.GameState.Live)
|
if (!getGame().IsLive())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (event.GetLog().GetPlayer() == null)
|
addStat(event.GetEvent().getEntity(), "Deaths", 1, false, false);
|
||||||
return;
|
|
||||||
|
|
||||||
if (!event.GetLog().GetPlayer().IsPlayer())
|
|
||||||
return;
|
|
||||||
|
|
||||||
Player player = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName());
|
|
||||||
if (player == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
addStat(player, "Deaths", 1, false, false);
|
|
||||||
|
|
||||||
// if (getGame().GetKit(player) != null)
|
|
||||||
// addStat(player, getGame().GetKit(player).getName() + " Deaths", 1, false, false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ import org.spigotmc.SpigotConfig;
|
|||||||
import mineplex.core.common.Pair;
|
import mineplex.core.common.Pair;
|
||||||
import mineplex.core.common.api.enderchest.EnderchestWorldLoader;
|
import mineplex.core.common.api.enderchest.EnderchestWorldLoader;
|
||||||
import mineplex.core.common.timing.TimingManager;
|
import mineplex.core.common.timing.TimingManager;
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.FileUtil;
|
import mineplex.core.common.util.FileUtil;
|
||||||
import mineplex.core.common.util.MapUtil;
|
import mineplex.core.common.util.MapUtil;
|
||||||
import mineplex.core.common.util.UtilMath;
|
import mineplex.core.common.util.UtilMath;
|
||||||
@ -490,4 +491,8 @@ public class WorldData
|
|||||||
return _dataEntries.get(key);
|
return _dataEntries.get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getFormattedName()
|
||||||
|
{
|
||||||
|
return C.cGreen + "Map - " + C.cWhiteB + MapName + C.cGray + " created by " + C.cWhiteB + MapAuthor;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user