Merge branch 'master' of ssh://184.154.0.242:7999/min/mineplex

This commit is contained in:
libraryaddict 2015-11-16 06:57:09 +13:00
commit aaf3705cc7
88 changed files with 2854 additions and 663 deletions

View File

@ -35,4 +35,4 @@ public class RadarData
{
return _bearing;
}
}
}

View File

@ -84,6 +84,8 @@ public class UtilRadar
text += C.cPurple + C.Bold + "] Radar";
UtilTextTop.display(text, player);
if(bossBar)
{
UtilTextTop.display(text, player);
@ -109,4 +111,4 @@ public class UtilRadar
}
}
}
}
}

View File

@ -277,8 +277,8 @@ public enum Achievement
//Champions
CHAMPIONS_WINS("Champion", 600,
new String[]{"Champions Domination.Wins", "Champions TDM.Wins"},
new String[]{"Win 80 games of Dominate or TDM"},
new String[]{"Champions Domination.Wins", "Champions TDM.Wins", "Champions Capture the Flag.Wins"},
new String[]{"Win 80 games of Dominate, TDM, or CTF"},
new int[]{80},
AchievementCategory.CHAMPIONS),
@ -295,28 +295,40 @@ public enum Achievement
AchievementCategory.CHAMPIONS),
CHAMPIONS_ASSASSINATION("Assassination", 1000,
new String[]{"Champions Domination.Assassination", "Champions TDM.Assassination"},
new String[]{"Champions Domination.Assassination", "Champions TDM.Assassination", "Champions Capture the Flag.Assassination"},
new String[]{"Kill 40 players with Backstab without", "taking any damage from them"},
new int[]{40},
AchievementCategory.CHAMPIONS),
CHAMPIONS_MASS_ELECTROCUTION("Mass Electrocution", 1200,
new String[]{"Champions Domination.MassElectrocution", "Champions TDM.MassElectrocution"},
new String[]{"Champions Domination.MassElectrocution", "Champions TDM.MassElectrocution", "Champions Capture the Flag.MassElectrocution"},
new String[]{"Hit 4 enemies with a Lightning Orb"},
new int[]{1},
AchievementCategory.CHAMPIONS),
CHAMPIONS_THE_LONGEST_SHOT("The Longest Shot", 1200,
new String[]{"Champions Domination.TheLongestShot", "Champions TDM.TheLongestShot"},
new String[]{"Champions Domination.TheLongestShot", "Champions TDM.TheLongestShot", "Champions Capture the Flag.TheLongestShot"},
new String[]{"Kill someone using Longshot who", "is over 64 Blocks away from you"},
new int[]{1},
AchievementCategory.CHAMPIONS),
CHAMPIONS_EARTHQUAKE("Earthquake", 1200,
new String[]{"Champions Domination.Earthquake", "Champions TDM.Earthquake"},
new String[]{"Champions Domination.Earthquake", "Champions TDM.Earthquake", "Champions Capture the Flag.Earthquake"},
new String[]{"Launch 5 enemies using Seismic Slam"},
new int[]{1},
AchievementCategory.CHAMPIONS),
CHAMPIONS_CAPTURES("Sticky Fingers", 2500,
new String[]{"Champions Capture the Flag.Captures"},
new String[]{"Capture the Enemy Flag 20 times"},
new int[]{20},
AchievementCategory.CHAMPIONS),
CHAMPIONS_CLUTCH("Clutch", 600,
new String[]{"Champions Capture the Flag.Clutch"},
new String[]{"Kill the Enemy Flag Carrier in Sudden Death"},
new int[]{1},
AchievementCategory.CHAMPIONS),
//Paintball
SUPER_PAINTBALL_WINS("Paintball King", 600,

View File

@ -78,8 +78,8 @@ public enum AchievementCategory
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED },
Material.BOOK_AND_QUILL, 0, GameCategory.CLASSICS, "Extra Tools Kit"),
CHAMPIONS("Champions", new String[] {"Champions Domination", "Champions TDM"},
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
CHAMPIONS("Champions", new String[] {"Champions Domination", "Champions TDM", "Champions Capture the Flag"},
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED, new StatDisplay("Flags Captured", "Captures") },
Material.BEACON, 0, GameCategory.CHAMPIONS, "Extra Class Skills"),
MASTER_BUILDERS("Master Builders", null,

View File

@ -1,5 +1,9 @@
package mineplex.core.blockrestore;
import java.util.HashMap;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
@ -18,6 +22,8 @@ public class BlockRestoreData
protected long _meltDelay = 0;
protected long _meltLast = 0;
protected HashMap<Location, Byte> _pad = new HashMap<Location, Byte>();
public BlockRestoreData(Block block, int toID, byte toData, int fromID, byte fromData, long expireDelay, long meltDelay)
{
@ -136,6 +142,11 @@ public class BlockRestoreData
{
if (_toID == 78 && _toData == (byte)7)
_block.setTypeIdAndData(80, (byte)0, true);
else if (_toID == 8 || _toID == 9 || _toID == 79)
{
handleLilypad(false);
_block.setTypeIdAndData(_toID, _toData, true);
}
else
_block.setTypeIdAndData(_toID, _toData, true);
}
@ -143,6 +154,7 @@ public class BlockRestoreData
public void restore()
{
_block.setTypeIdAndData(_fromID, _fromData, true);
handleLilypad(true);
}
public void setFromId(int i)
@ -154,4 +166,24 @@ public class BlockRestoreData
{
_fromData = i;
}
private void handleLilypad(boolean restore)
{
if (restore)
{
for (Location l : _pad.keySet())
{
l.getBlock().setType(Material.WATER_LILY);
l.getBlock().setData(_pad.get(l));
}
}
else
{
if (_block.getRelative(BlockFace.UP, 1).getType() == Material.WATER_LILY)
{
_pad.put(_block.getRelative(BlockFace.UP, 1).getLocation(), _block.getRelative(BlockFace.UP, 1).getData());
_block.getRelative(BlockFace.UP, 1).setType(Material.AIR);
}
}
}
}

View File

@ -66,6 +66,8 @@ public enum GameDisplay
MonsterMaze("Monster Maze", Material.ROTTEN_FLESH, (byte)0, GameCategory.ARCADE, 55),
Lobbers("Bomb Lobbers", Material.FIREBALL, (byte) 0, GameCategory.ARCADE, 54),
ChampionsCTF("Champions CTF", "Champions", Material.REDSTONE_BLOCK, (byte)0, GameCategory.CHAMPIONS, 55),
Event("Mineplex Event", Material.CAKE, (byte)0, GameCategory.EVENT, 999);

View File

@ -219,16 +219,16 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
Get(from).LastToTime = System.currentTimeMillis();
// Chiss or defek7
if (to.getName().equals("Chiss") || to.getName().equals("defek7") || to.getName().equals("Phinary") || to.getName().equals("fooify"))
if (to.getName().equals("Chiss") || to.getName().equals("defek7") || to.getName().equals("Phinary") || to.getName().equals("fooify") || to.getName().equals("sampepere"))
{
UtilPlayer.message(from, C.cPurple + to.getName() + " is often AFK or minimized, due to plugin development.");
UtilPlayer.message(from, C.cPurple + "Please be patient if he does not reply instantly.");
}
if(to.getName().equals("ishh"))
/*if(to.getName().equals("ishh"))
{
UtilPlayer.message(from, C.cPurple + "Hi, my name is ishh. If I don't respond to your message, please be patient and try again later!");
}
}*/
// Log
// Logger().logChat("Private Message", from, to.getName(), message);

View File

@ -10,6 +10,7 @@ import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.Sound;
import org.bukkit.entity.Entity;

View File

@ -16,6 +16,7 @@ import net.minecraft.server.v1_8_R3.MathHelper;
import net.minecraft.server.v1_8_R3.MovingObjectPosition;
import net.minecraft.server.v1_8_R3.Vec3D;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.GameMode;
import org.bukkit.Sound;

View File

@ -16,6 +16,8 @@ import mineplex.core.common.util.UtilTime.TimeUnit;
import mineplex.core.punish.Command.PunishCommand;
import mineplex.core.punish.Tokens.PunishClientToken;
import mineplex.core.punish.Tokens.PunishmentToken;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.serverdata.commands.ServerCommandManager;
import org.bukkit.Bukkit;
@ -107,6 +109,33 @@ public class Punish extends MiniPlugin
event.setCancelled(true);
}
}
@EventHandler
public void banRefresh(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
return;
for (Player check : UtilServer.getPlayers())
{
PunishClient client = GetClient(check.getName());
if (client != null && client.IsBanned())
{
Punishment punishment = client.GetPunishment(PunishmentSentence.Ban);
String time = UtilTime.convertString(punishment.GetRemaining(), 0, TimeUnit.FIT);
if (punishment.GetHours() == -1)
time = "Permanent";
String reason = C.cRed + C.Bold + "You are banned for " + time +
"\n" + C.cWhite + punishment.GetReason() +
"\n" + C.cDGreen + "Unfairly banned? Appeal at " + C.cGreen + "www.mineplex.com/appeals"
;
check.kickPlayer(reason);
}
}
}
public void Help(Player caller)
{

View File

@ -0,0 +1,22 @@
package mineplex.core.reward;
import mineplex.core.common.Rank;
import org.bukkit.inventory.ItemStack;
public class RankRewardData extends RewardData
{
private Rank _rank;
public RankRewardData(String friendlyName, ItemStack displayItem, RewardRarity rarity, Rank rank)
{
super(friendlyName, displayItem, rarity);
_rank = rank;
}
public Rank getWonRank()
{
return _rank;
}
}

View File

@ -407,7 +407,7 @@ public class RewardManager
}
if (canGiveMythical && type == RewardType.MythicalChest && !_clientManager.Get(player).GetRank().has(Rank.TITAN))
{
return new RankReward(_clientManager, _statusManager, 0, rarity);
return new RankReward(_clientManager, 0, rarity);
}
else if (!canGiveMythical || _clientManager.Get(player).GetRank().has(Rank.LEGEND))
{
@ -415,7 +415,7 @@ public class RewardManager
}
else
{
return new RankReward(_clientManager, _statusManager, 0, rarity);
return new RankReward(_clientManager, 0, rarity);
}
}

View File

@ -62,7 +62,7 @@ public class GiveawayReward extends Reward
// Dang, I guess we failed!
if (!_clientManager.hasRank(player, Rank.TITAN))
{
Reward reward = new RankReward(_clientManager, _serverStatusManager, 0, getRarity());
Reward reward = new RankReward(_clientManager, 0, getRarity());
reward.giveReward(rewardType, player, rewardDataCallback);
}
else

View File

@ -2,31 +2,28 @@ package mineplex.core.reward.rewards;
import java.util.Random;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank;
import mineplex.core.reward.RankRewardData;
import mineplex.core.reward.Reward;
import mineplex.core.reward.RewardData;
import mineplex.core.reward.RewardRarity;
import mineplex.core.reward.RewardType;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank;
import mineplex.core.reward.Reward;
import mineplex.core.reward.RewardData;
import mineplex.core.reward.RewardRarity;
import mineplex.core.reward.RewardType;
import mineplex.core.status.ServerStatusManager;
import mineplex.core.titangiveaway.redis.TitanChestGiveawayMessage;
public class RankReward extends Reward
{
private Random _random;
private CoreClientManager _clientManager;
private ServerStatusManager _statusManager;
public RankReward(CoreClientManager clientManager, ServerStatusManager statusManager, int weight, RewardRarity rarity)
public RankReward(CoreClientManager clientManager, int weight, RewardRarity rarity)
{
super(rarity, weight);
_clientManager = clientManager;
_statusManager = statusManager;
_random = new Random();
}
@ -47,14 +44,8 @@ public class RankReward extends Reward
_clientManager.Get(player).SetRank(rank, false);
_clientManager.getRepository().saveRank(null, player.getName(), player.getUniqueId(), rank, true);
if (rank == Rank.TITAN)
{
TitanChestGiveawayMessage message = new TitanChestGiveawayMessage(player.getName(), _statusManager.getCurrentServerName());
message.publish();
}
return new RewardData(getRarity().getColor() + rank.Name + " Rank", new ItemStack(Material.NETHER_STAR), getRarity());
return new RankRewardData(getRarity().getColor() + rank.Name + " Rank", new ItemStack(Material.NETHER_STAR), getRarity(), rank);
}
@Override
@ -68,7 +59,7 @@ public class RankReward extends Reward
if (rank == null)
return new RewardData(getRarity().getColor() + "Rank Upgrade Error", new ItemStack(Material.PAPER), getRarity());
return new RewardData(getRarity().getColor() + rank.Name + " Rank", new ItemStack(Material.NETHER_STAR), getRarity());
return new RankRewardData(getRarity().getColor() + rank.Name + " Rank", new ItemStack(Material.NETHER_STAR), getRarity(), rank);
}
@Override

View File

@ -6,30 +6,25 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Random;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers;
import org.bukkit.entity.Player;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.PacketPlayOutBlockAction;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.hologram.HologramManager;
import mineplex.core.reward.RankRewardData;
import mineplex.core.reward.Reward;
import mineplex.core.reward.RewardData;
import mineplex.core.reward.RewardRarity;
import mineplex.core.reward.RewardType;
import mineplex.core.status.ServerStatusManager;
import mineplex.core.titangiveaway.redis.TitanChestGiveawayMessage;
import mineplex.core.treasure.animation.Animation;
import mineplex.core.treasure.animation.BlockChangeAnimation;
import mineplex.core.treasure.animation.ChestOpenAnimation;
@ -37,8 +32,17 @@ import mineplex.core.treasure.animation.ChestSpawnAnimation;
import mineplex.core.treasure.animation.LootLegendaryAnimation;
import mineplex.core.treasure.animation.LootMythicalAnimation;
import mineplex.core.treasure.animation.LootRareAnimation;
import mineplex.core.treasure.animation.TreasureRemoveAnimation;
import mineplex.core.treasure.animation.LootUncommonAnimation;
import mineplex.core.treasure.animation.TreasureRemoveAnimation;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.PacketPlayOutBlockAction;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers;
import org.bukkit.entity.Player;
/**
* Created by Shaun on 8/27/2014.
@ -62,6 +66,7 @@ public class Treasure
private Reward[] _rewards;
private RewardType _rewardType;
private ConcurrentHashMap<Integer, RewardData> _rewardData = new ConcurrentHashMap<Integer, RewardData>();
private int _currentReward;
private boolean _finished;
@ -70,15 +75,16 @@ public class Treasure
private LinkedList<Animation> _animations;
private HologramManager _hologramManager;
private ServerStatusManager _statusManager;
public Treasure(Player player, Reward[] rewards, RewardType rewardType, Block centerBlock, Block[] chestBlocks, TreasureType treasureType, BlockRestore blockRestore, HologramManager hologramManager)
public Treasure(Player player, Reward[] rewards, RewardType rewardType, Block centerBlock, Block[] chestBlocks, TreasureType treasureType, BlockRestore blockRestore, HologramManager hologramManager, ServerStatusManager statusManager)
{
this(player, new Random(), rewards, rewardType, centerBlock, chestBlocks, treasureType, hologramManager);
this(player, new Random(), rewards, rewardType, centerBlock, chestBlocks, treasureType, hologramManager, statusManager);
_blockRestore = blockRestore;
}
public Treasure(Player player, Random seed, Reward[] rewards, RewardType rewardType, Block centerBlock, Block[] chestBlocks, TreasureType treasureType, HologramManager hologramManager)
public Treasure(Player player, Random seed, Reward[] rewards, RewardType rewardType, Block centerBlock, Block[] chestBlocks, TreasureType treasureType, HologramManager hologramManager, ServerStatusManager statusManager)
{
_player = player;
_random = seed;
@ -88,6 +94,7 @@ public class Treasure
_centerBlock = centerBlock;
_animations = new LinkedList<Animation>();
_hologramManager = hologramManager;
_statusManager = statusManager;
_currentChest = 0;
_currentReward = 0;
@ -101,6 +108,19 @@ public class Treasure
}
_animations.add(new BlockChangeAnimation(this, _otherBlockInfo));
for (int i = 0; i < _rewards.length; i++)
{
Reward reward = _rewards[i];
final int count = i;
reward.giveReward(_rewardType, player, new Callback<RewardData>()
{
@Override
public void run(RewardData data) {
_rewardData.put(count, data);
}
});
}
}
public int getFinishedTickCount()
@ -203,14 +223,15 @@ public class Treasure
final ChestData data = getChestData(block);
if (data != null && !data.isOpened() && _currentReward < _rewards.length)
{
final Reward reward = _rewards[_currentReward];
//final Reward reward = _rewards[_currentReward];
final RewardData rewardData = _rewardData.get(_currentReward);
data.setOpened(true);
_currentReward++;
reward.giveReward(_rewardType, _player, new Callback<RewardData>()
{
@Override
public void run(RewardData rewardData)
{
//reward.giveReward(_rewardType, _player, new Callback<RewardData>()
//{
//@Override
//public void run(RewardData rewardData)
//{
if (swapList)
{
BlockInfo info = getBlockInfo(block);
@ -222,22 +243,30 @@ public class Treasure
_animations.add(chestOpenTask);
// Extra effects based off the rarity of the treasure
if (reward.getRarity() == RewardRarity.UNCOMMON)
if (rewardData.getRarity() == RewardRarity.UNCOMMON)
{
_animations.add(new LootUncommonAnimation(Treasure.this, data.getBlock()));
}
else if (reward.getRarity() == RewardRarity.RARE)
else if (rewardData.getRarity() == RewardRarity.RARE)
{
_animations.add(new LootRareAnimation(Treasure.this, data.getBlock().getLocation().add(0.5, 1.5, 0.5)));
Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cPurple + "Rare " + rewardData.getFriendlyName()));
}
else if (reward.getRarity() == RewardRarity.LEGENDARY)
else if (rewardData.getRarity() == RewardRarity.LEGENDARY)
{
_animations.add(new LootLegendaryAnimation(Treasure.this, data.getBlock()));
Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cGreen + "Legendary " + rewardData.getFriendlyName()));
}
else if (reward.getRarity() == RewardRarity.MYTHICAL)
else if (rewardData.getRarity() == RewardRarity.MYTHICAL)
{
if (rewardData instanceof RankRewardData)
{
if (((RankRewardData)rewardData).getWonRank() == Rank.TITAN)
{
TitanChestGiveawayMessage message = new TitanChestGiveawayMessage(_player.getName(), _statusManager.getCurrentServerName());
message.publish();
}
}
_animations.add(new LootMythicalAnimation(Treasure.this, data.getBlock()));
Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cRed + "Mythical " + rewardData.getFriendlyName()));
}
@ -248,8 +277,8 @@ public class Treasure
_animations.add(animation);
_finished = true;
}
}
});
//}
//});
}
}

View File

@ -2,6 +2,26 @@ package mineplex.core.treasure;
import java.util.List;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.event.GadgetBlockEvent;
import mineplex.core.hologram.Hologram;
import mineplex.core.hologram.HologramManager;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.reward.Reward;
import mineplex.core.status.ServerStatusManager;
import mineplex.core.treasure.event.TreasureFinishEvent;
import mineplex.core.treasure.event.TreasureStartEvent;
import mineplex.core.treasure.gui.TreasureShop;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@ -18,31 +38,13 @@ import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerVelocityEvent;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.event.GadgetBlockEvent;
import mineplex.core.hologram.Hologram;
import mineplex.core.hologram.HologramManager;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.reward.Reward;
import mineplex.core.treasure.event.TreasureFinishEvent;
import mineplex.core.treasure.event.TreasureStartEvent;
import mineplex.core.treasure.gui.TreasureShop;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class TreasureLocation implements Listener
{
private TreasureManager _treasureManager;
private InventoryManager _inventoryManager;
private Hologram _hologram;
private HologramManager _hologramManager;
private ServerStatusManager _statusManager;
private Treasure _currentTreasure;
private Block _chestBlock;
private byte _chestBlockData;
@ -50,7 +52,7 @@ public class TreasureLocation implements Listener
private TreasureShop _shop;
private Location _resetLocation;
public TreasureLocation(TreasureManager treasureManager, InventoryManager inventoryManager, CoreClientManager clientManager, DonationManager donationManager, Block chestBlock, Block[] chestSpawns, Location resetLocation, HologramManager hologramManager)
public TreasureLocation(TreasureManager treasureManager, InventoryManager inventoryManager, CoreClientManager clientManager, DonationManager donationManager, Block chestBlock, Block[] chestSpawns, Location resetLocation, HologramManager hologramManager, ServerStatusManager statusManager)
{
_treasureManager = treasureManager;
_resetLocation = resetLocation;
@ -59,6 +61,7 @@ public class TreasureLocation implements Listener
_chestBlockData = _chestBlock.getData();
_chestSpawns = chestSpawns;
_hologramManager = hologramManager;
_statusManager = statusManager;
_currentTreasure = null;
_hologram = new Hologram(_hologramManager, chestBlock.getLocation().add(0.5, 2.5, 0.5), C.cGreen + C.Bold + "Open Treasure");
setHoloChestVisible(true);
@ -107,7 +110,7 @@ public class TreasureLocation implements Listener
Bukkit.broadcastMessage(F.main("Treasure", F.name(player.getName()) + " is opening a " + treasureType.getName()));
Reward[] rewards = _treasureManager.getRewards(player, treasureType.getRewardType());
Treasure treasure = new Treasure(player, rewards, treasureType.getRewardType(), _chestBlock, _chestSpawns, treasureType, _treasureManager.getBlockRestore(), _hologramManager);
Treasure treasure = new Treasure(player, rewards, treasureType.getRewardType(), _chestBlock, _chestSpawns, treasureType, _treasureManager.getBlockRestore(), _hologramManager, _statusManager);
_currentTreasure = treasure;
UtilTextMiddle.display(treasureType.getName(), "Choose 4 Chests To Open", 20, 180, 20, player);

View File

@ -65,7 +65,7 @@ public class TreasureManager extends MiniPlugin
Block chestLoc7 = world.getBlockAt(-18, 72, -16);
Block chestLoc8 = world.getBlockAt(-16, 72, -18);
Location resetLocation = new Location(world, -23.5, 72, -23.5);
_treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager));
_treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager, statusManager));
}
{
@ -79,7 +79,7 @@ public class TreasureManager extends MiniPlugin
Block chestLoc7 = world.getBlockAt(18, 72, 16);
Block chestLoc8 = world.getBlockAt(16, 72, 18);
Location resetLocation = new Location(world, 23.5, 72, 23.5);
_treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager));
_treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager, statusManager));
}
{
@ -93,7 +93,7 @@ public class TreasureManager extends MiniPlugin
Block chestLoc7 = world.getBlockAt(18, 72, -16);
Block chestLoc8 = world.getBlockAt(16, 72, -18);
Location resetLocation = new Location(world, 23.5, 72, -23.5);
_treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager));
_treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager, statusManager));
}
{
@ -107,7 +107,7 @@ public class TreasureManager extends MiniPlugin
Block chestLoc7 = world.getBlockAt(-18, 72, 16);
Block chestLoc8 = world.getBlockAt(-16, 72, 18);
Location resetLocation = new Location(world, -23.5, 72, 23.5);
_treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager));
_treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager, statusManager));
}
for (TreasureLocation treasureLocation : _treasureLocations)

View File

@ -138,7 +138,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
StatsManager statsManager = new StatsManager(plugin, _clientManager);
AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, donationManager);
ClassShopManager shopManager = new ClassShopManager(plugin, _classManager, skillManager, itemFactory, achievementManager, _clientManager);
ClassShopManager shopManager = new ClassShopManager(plugin, _classManager, skillManager, itemFactory, achievementManager, _clientManager, false);
_classShop = new ClassCombatShop(shopManager, _clientManager, donationManager, true, "Class Shop");
_warManager = new WarManager(plugin, this);

View File

@ -167,15 +167,15 @@ public class Hub extends JavaPlugin implements IRelation
ItemFactory itemFactory = new ItemFactory(this, blockRestore, conditionManager, damage, energy, fire, throwManager, webServerAddress);
SkillFactory skillManager = new SkillFactory(this, damage, this, combatManager, conditionManager, throwManager, disguiseManager, blockRestore, fire, new Movement(this), teleport, energy, webServerAddress);
ClassManager classManager = new ClassManager(this, clientManager, donationManager, skillManager, itemFactory, webServerAddress);
ClassManager classManager = new ClassManager(this, clientManager, donationManager, hubManager.GetGadget(), skillManager, itemFactory, webServerAddress);
ClassShopManager shopManager = new ClassShopManager(this, classManager, skillManager, itemFactory, achievementManager, clientManager);
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Brute", classManager.GetClass("Brute"));
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Mage", classManager.GetClass("Mage"));
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Ranger", classManager.GetClass("Ranger"));
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Knight", classManager.GetClass("Knight"));
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Assassin", classManager.GetClass("Assassin"));
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Brute", classManager.GetClass("Brute"), true);
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Mage", classManager.GetClass("Mage"), true);
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Ranger", classManager.GetClass("Ranger"), true);
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Knight", classManager.GetClass("Knight"), true);
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Assassin", classManager.GetClass("Assassin"), true);
//Updates
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1);

View File

@ -60,9 +60,12 @@ public class TextManager extends MiniPlugin
UtilBlockText.MakeText("TEAM DEATHMATCH", locComp.clone().add(15, 21, 0), faceComp, 159, (byte)1, TextAlign.CENTER);
UtilBlockText.MakeText("TEAM DEATHMATCH", locComp.clone().add(16, 21, 0), faceComp, (Manager.Type == HubType.Halloween) ? 89 : 159, (Manager.Type == HubType.Halloween) ? (byte)0 : (byte)15, TextAlign.CENTER);
UtilBlockText.MakeText("CAPTURE THE FLAG", locComp.clone().add(15, 28, 0), faceComp, 159, (byte)14, TextAlign.CENTER);
UtilBlockText.MakeText("CAPTURE THE FLAG", locComp.clone().add(16, 28, 0), faceComp, (Manager.Type == HubType.Halloween) ? 89 : 159, (Manager.Type == HubType.Halloween) ? (byte)0 : (byte)15, TextAlign.CENTER);
UtilBlockText.MakeText("CLANS", locComp.clone().add(15, 28, 0), faceComp, 159, (byte)14, TextAlign.CENTER);
UtilBlockText.MakeText("CLANS", locComp.clone().add(16, 28, 0), faceComp, (Manager.Type == HubType.Halloween) ? 89 : 159, (Manager.Type == HubType.Halloween) ? (byte)0 : (byte)15, TextAlign.CENTER);
// UtilBlockText.MakeText("CLANS", locComp.clone().add(15, 28, 0), faceComp, 159, (byte)14, TextAlign.CENTER);
// UtilBlockText.MakeText("CLANS", locComp.clone().add(16, 28, 0), faceComp, (Manager.Type == HubType.Halloween) ? 89 : 159, (Manager.Type == HubType.Halloween) ? (byte)0 : (byte)15, TextAlign.CENTER);
//Arcade
UtilBlockText.MakeText("ARCADE", locArcade, faceArcade, 159, (byte)5, TextAlign.CENTER);

View File

@ -15,6 +15,7 @@ public enum GameType
CastleSiege("Castle Siege"),
ChampionsTDM("Champions TDM", "Champions"),
ChampionsDominate("Champions Domination", "Champions"),
ChampionsCTF("Champions CTF", "Champions"),
ChampionsMOBA("Champions MOBA", "Champions"),
Christmas("Christmas Chaos"),
DeathTag("Death Tag"),

View File

@ -2,7 +2,18 @@ package mineplex.minecraft.game.classcombat.Class;
import java.util.Collection;
import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;
import mineplex.core.MiniClientPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.account.event.ClientWebResponseEvent;
import mineplex.core.common.Rank;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.classcombat.Class.repository.ClassRepository;
import mineplex.minecraft.game.classcombat.Class.repository.token.ClientClassTokenWrapper;
@ -10,14 +21,6 @@ import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildTok
import mineplex.minecraft.game.classcombat.Skill.ISkill;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.classcombat.item.ItemFactory;
import mineplex.core.MiniClientPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.account.event.ClientWebResponseEvent;
import mineplex.core.common.Rank;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.donation.DonationManager;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@ -34,12 +37,15 @@ public class ClassManager extends MiniClientPlugin<ClientClass> implements IClas
private SkillFactory _skillFactory;
private ItemFactory _itemFactory;
private ClassRepository _repository;
private GadgetManager _gadgetManager;
private HashMap<String, IPvpClass> _classes;
private HashMap<Integer, IPvpClass> _classSalesPackageIdMap;
private Object _clientLock = new Object();
private boolean _enabled = true;
private ConcurrentHashMap<String, Callback<String>> _messageSuppressed;
public ClassManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager,
SkillFactory skillFactory, ItemFactory itemFactory, String webAddress)
@ -54,6 +60,26 @@ public class ClassManager extends MiniClientPlugin<ClientClass> implements IClas
_repository = new ClassRepository(webAddress);
_classes = new HashMap<String, IPvpClass>();
_classSalesPackageIdMap = new HashMap<Integer, IPvpClass>();
_messageSuppressed = new ConcurrentHashMap<String, Callback<String>>();
PopulateClasses();
}
public ClassManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, GadgetManager gadgetManager,
SkillFactory skillFactory, ItemFactory itemFactory, String webAddress)
{
super("Class Manager", plugin);
_plugin = plugin;
_clientManager = clientManager;
_donationManager = donationManager;
_gadgetManager = gadgetManager;
_skillFactory = skillFactory;
_itemFactory = itemFactory;
_repository = new ClassRepository(webAddress);
_classes = new HashMap<String, IPvpClass>();
_classSalesPackageIdMap = new HashMap<Integer, IPvpClass>();
_messageSuppressed = new ConcurrentHashMap<String, Callback<String>>();
PopulateClasses();
}
@ -300,6 +326,11 @@ public class ClassManager extends MiniClientPlugin<ClientClass> implements IClas
{
return _repository;
}
public GadgetManager getGadgetManager()
{
return _gadgetManager;
}
@EventHandler
public void SkillDisplay(PlayerCommandPreprocessEvent event)
@ -344,4 +375,25 @@ public class ClassManager extends MiniClientPlugin<ClientClass> implements IClas
{
_enabled = var;
}
public void hideNextEquipMessage(String name)
{
_messageSuppressed.put(name, new Callback<String>()
{
public void run(String name)
{
_messageSuppressed.remove(name);
}
});
}
public void forceRemoveFromSuppressed(String name)
{
_messageSuppressed.remove(name);
}
public Callback<String> getMessageSuppressedCallback(String name)
{
return _messageSuppressed.get(name);
}
}

View File

@ -563,13 +563,15 @@ public class ClientClass
public void DisplaySkills(Player player)
{
player.sendMessage("------------------------------------------");
String bar = "------------------------------------------";
player.sendMessage(bar);
for (SkillType type : _lastSkillMap.keySet())
{
if (_lastSkillMap.get(type).getKey() == null)
continue;
player.sendMessage(C.cGreen + type + ": " + C.cWhite + _lastSkillMap.get(type).getKey().GetName() + " " + _lastSkillMap.get(type).getValue());
}
player.sendMessage(bar);
}
//This is used to fix a dual class bug using Twitch broadcasting GUI (F6)

View File

@ -1,6 +1,5 @@
package mineplex.minecraft.game.classcombat.Class;
import java.util.HashMap;
import java.util.HashSet;
import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken;

View File

@ -1,10 +1,11 @@
package mineplex.minecraft.game.classcombat.Class;
import java.util.HashSet;
import java.util.concurrent.ConcurrentHashMap;
import mineplex.core.common.util.F;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken;
import mineplex.minecraft.game.classcombat.Skill.ISkill;
@ -194,13 +195,17 @@ public class PvpClass implements IPvpClass
!((LeatherArmorMeta)inv.getBoots().getItemMeta()).getColor().equals(_leatherColor))
continue;
}
if (_classes.getGadgetManager().getActive(cur, GadgetType.Costume) != null)
continue;
Equip(cur);
Equip(cur, _classes.getMessageSuppressedCallback(cur.getName()) == null);
_classes.getMessageSuppressedCallback(cur.getName()).run(cur.getName());
}
}
}
public void Equip(Player player)
public void Equip(Player player, boolean inform)
{
ClientClass client = _classes.Get(player);
@ -208,12 +213,12 @@ public class PvpClass implements IPvpClass
if (customBuild != null)
{
client.EquipCustomBuild(customBuild, true, true);
client.EquipCustomBuild(customBuild, inform, true);
}
else
{
client.SetGameClass(this);
client.EquipCustomBuild(client.GetCustomBuilds(this).get(0), true, true);
client.EquipCustomBuild(client.GetCustomBuilds(this).get(0), inform, true);
}
//Ensure Sneak Removed

View File

@ -55,7 +55,7 @@ public class Flash extends SkillActive
@Override
public String GetRechargeString()
{
return "Recharge: #10#-1 Seconds per Charge";
return "Recharge: #8#-1 Seconds per Charge";
}
@Override
@ -84,7 +84,7 @@ public class Flash extends SkillActive
}
@EventHandler
public void Recharge(UpdateEvent event)
public void recharge(UpdateEvent event)
{
for (Player cur : GetUsers())
{
@ -100,7 +100,7 @@ public class Flash extends SkillActive
if (charges >= 1 + level)
continue;
if (!mineplex.core.recharge.Recharge.Instance.use(cur, "Flash Recharge", 10000 - (1000 * level), false, false))
if (!mineplex.core.recharge.Recharge.Instance.use(cur, "Flash Recharge", 8000 - (1000 * level), false, false))
continue;
_flash.put(cur, charges + 1);

View File

@ -107,6 +107,9 @@ public class Illusion extends SkillActive
UtilEnt.Vegetate(skel);
UtilEnt.silence(skel, true);
skel.setMaxHealth(7);
skel.setHealth(7);
ClassCombatCreatureAllowSpawnEvent disableEvent = new ClassCombatCreatureAllowSpawnEvent(false);
UtilServer.getServer().getPluginManager().callEvent(disableEvent);

View File

@ -31,6 +31,7 @@ import org.bukkit.event.player.PlayerDropItemEvent;
public class Recall extends Skill
{
private HashMap<Player, LinkedList<Location>> _locMap = new HashMap<Player, LinkedList<Location>>();
private HashMap<Player, LinkedList<Double>> _healthMap = new HashMap<Player, LinkedList<Double>>();
public Recall(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)
{
@ -52,7 +53,7 @@ public class Recall extends Skill
}
@EventHandler
public void Use(PlayerDropItemEvent event)
public void use(PlayerDropItemEvent event)
{
Player player = event.getPlayer();
@ -79,14 +80,22 @@ public class Recall extends Skill
if (locs == null)
return;
LinkedList<Double> health = _healthMap.remove(player);
if (health == null)
return;
//Heal
player.setHealth(health.getLast());
//Effect
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f);
//Teleport
Location current = player.getLocation();
Location target = locs.getLast();
player.teleport(target);
//Inform
UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + "."));
@ -102,21 +111,32 @@ public class Recall extends Skill
}
@EventHandler
public void StoreLocation(UpdateEvent event)
public void storeLocation(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player cur : GetUsers())
{
//Create
if (!_locMap.containsKey(cur))
_locMap.put(cur, new LinkedList<Location>());
if (!_healthMap.containsKey(cur))
_healthMap.put(cur, new LinkedList<Double>());
//Store
_locMap.get(cur).addFirst(cur.getLocation());
_healthMap.get(cur).addFirst(cur.getHealth());
int level = getLevel(cur);
//Cull
if (_locMap.get(cur).size() > (2 + 2 * level) * 20)
_locMap.get(cur).removeLast();
if (_healthMap.get(cur).size() > (2 + 2 * level) * 20)
_healthMap.get(cur).removeLast();
}
}

View File

@ -52,7 +52,7 @@ public class SilencingArrow extends SkillActive
SetDesc(new String[]
{
"Your next arrow will Silence",
"target for #1#3 seconds.",
"target for #2#2 seconds.",
"",
"Silence stops skills being used."
});
@ -129,7 +129,7 @@ public class SilencingArrow extends SkillActive
if (level == 0) return;
//Confuse
Factory.Condition().Factory().Silence(GetName(), damagee, damager, 3 + 3*level, true, true);
Factory.Condition().Factory().Silence(GetName(), damagee, damager, 2 + 2*level, true, true);
//Effect
damagee.getWorld().playSound(damagee.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f);

View File

@ -14,6 +14,7 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
@ -104,15 +105,15 @@ public class BlockToss extends SkillCharge implements IThrown
if (!Recharge.Instance.use(player, GetName(), 1000, false, false))
return;
//Door
if (grab.getRelative(BlockFace.UP).getTypeId() == 64 || grab.getRelative(BlockFace.UP).getTypeId() == 71)
//Door and Banner
if (grab.getRelative(BlockFace.UP).getTypeId() == 64 || grab.getRelative(BlockFace.UP).getTypeId() == 71 || grab.getRelative(BlockFace.UP).getType() == Material.STANDING_BANNER)
{
UtilPlayer.message(player, F.main(GetName(), "You cannot grab this block."));
return;
}
// Ladder and beacon grabs
if (grab.getType() == Material.LADDER || grab.getType() == Material.BEACON)
if (grab.getType() == Material.LADDER || grab.getType() == Material.BEACON || grab.getType() == Material.WEB || grab.getType() == Material.STANDING_BANNER || grab.getType() == Material.WALL_BANNER)
{
UtilPlayer.message(player, F.main(GetName(), "You cannot grab this block."));
return;
@ -135,6 +136,12 @@ public class BlockToss extends SkillCharge implements IThrown
}
}
}
if (Factory.BlockRestore().Contains(grab))
{
UtilPlayer.message(player, F.main(GetName(), "You cannot grab this block."));
return;
}
//Block to Item
FallingBlock block = player.getWorld().spawnFallingBlock(player.getEyeLocation(), event.getClickedBlock().getType(), event.getClickedBlock().getData());
@ -266,6 +273,19 @@ public class BlockToss extends SkillCharge implements IThrown
}
@EventHandler
public void blockSolidify(EntityChangeBlockEvent event)
{
if (_falling.containsKey(event.getEntity()))
{
event.setCancelled(true);
createBlock((FallingBlock)event.getEntity(), event.getBlock());
_falling.remove(event.getEntity());
}
}
@EventHandler
public void CreateBlock(UpdateEvent event)
{
@ -282,21 +302,27 @@ public class BlockToss extends SkillCharge implements IThrown
continue;
fallIter.remove();
Block block = fall.getLocation().getBlock();
if (block.getType() != fall.getMaterial())
continue;
block.setTypeIdAndData(0, (byte)0, false);
//Block Replace
Factory.BlockRestore().Add(block, fall.getBlockId(), (byte)0, 10000);
//Effect
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());
createBlock(fall, fall.getLocation().getBlock());
}
}
public void createBlock(FallingBlock fall, Block block)
{
if (!UtilBlock.airFoliage(block))
return;
int id = fall.getBlockId();
if (id == 12) id = Material.SANDSTONE.getId();
if (id == 13) id = Material.STONE.getId();
//Block Replace
Factory.BlockRestore().Add(block, id, (byte)0, 10000);
//Effect
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());
}
@EventHandler
public void ItemSpawn(ItemSpawnEvent event)

View File

@ -18,7 +18,7 @@ public class Colossus extends Skill
SetDesc(new String[]
{
"You are so huge that you take",
"#15#20 % less knockback from attacks."
"35% less knockback from attacks."
});
}
@ -36,7 +36,7 @@ public class Colossus extends Skill
//Damage
event.AddMod(damagee.getName(), GetName(), 0, false);
event.AddKnockback(GetName(), 0.85 - 0.20*level);
event.AddKnockback(GetName(), 0.35);
}
@Override

View File

@ -24,7 +24,7 @@ public class CripplingBlow extends Skill
{
"Your powerful axe attacks give",
"targets Slow 2 for 1.5 second,",
"as well as no knockback."
"as well as 50% less knockback."
});
}
@ -57,7 +57,7 @@ public class CripplingBlow extends Skill
//Damage
event.AddMod(damager.getName(), GetName(), 0, true);
event.SetKnockback(false);
event.AddKnockback(GetName(), 0.5);
//Event
UtilServer.getServer().getPluginManager().callEvent(new SkillEvent(damager, GetName(), ClassType.Brute, damagee));

View File

@ -58,7 +58,7 @@ public class DwarfToss extends SkillActive
SetDesc(new String[]
{
"Hold Block to pick up target player.",
"Release Block to throw with #1.2#0.2 velocity.",
"Release Block to throw target player.",
"",
"Players you are holding cannot harm",
"you, or be harmed by others.",
@ -209,8 +209,8 @@ public class DwarfToss extends SkillActive
_time.put(player, System.currentTimeMillis());
//Inform
UtilPlayer.message(player, F.main(GetClassType().name(), "You picked up " + F.name(UtilEnt.getName(target)) + " with " + F.skill(GetName(level)) + "."));
UtilPlayer.message(target, F.main(GetClassType().name(), F.name(player.getName()) + " grabbed you with " + F.skill(GetName(level)) + "."));
UtilPlayer.message(player, F.main(GetClassType().name(), "You picked up " + F.name(UtilEnt.getName(target)) + " with " + F.skill(GetName()) + "."));
UtilPlayer.message(target, F.main(GetClassType().name(), F.name(player.getName()) + " grabbed you with " + F.skill(GetName()) + "."));
//Hide!
if (target instanceof Player)
@ -303,9 +303,8 @@ public class DwarfToss extends SkillActive
{
LivingEntity target = _holding.remove(cur);
_time.remove(cur);
int level = getLevel(cur);
UtilPlayer.message(cur, F.main(GetClassType().name(), F.name(UtilEnt.getName(target)) + " escaped your " + F.skill(GetName(level)) + "."));
UtilPlayer.message(cur, F.main(GetClassType().name(), F.name(UtilEnt.getName(target)) + " escaped your " + F.skill(GetName()) + "."));
//Show!
if (target instanceof Player)
@ -316,7 +315,6 @@ public class DwarfToss extends SkillActive
{
final LivingEntity target = _holding.remove(cur);
long time = _time.remove(cur);
int level = getLevel(cur);
//Time Reduce
double timeScale = 1;
@ -332,7 +330,7 @@ public class DwarfToss extends SkillActive
//Throw
cur.eject();
target.leaveVehicle();
final double mult = (1.2 + (0.2 * level)) * timeScale;
final double mult = (1.8) * timeScale;
//Delay
Bukkit.getScheduler().scheduleSyncDelayedTask(Factory.getPlugin(), new Runnable()
@ -351,8 +349,8 @@ public class DwarfToss extends SkillActive
}, 5);
//Inform
UtilPlayer.message(cur, F.main(GetClassType().name(), "You threw " + F.name(UtilEnt.getName(target)) + " with " + F.skill(GetName(level)) + "."));
UtilPlayer.message(target, F.main(GetClassType().name(), F.name(cur.getName()) + " threw you with " + F.skill(GetName(level)) + "."));
UtilPlayer.message(cur, F.main(GetClassType().name(), "You threw " + F.name(UtilEnt.getName(target)) + " with " + F.skill(GetName()) + "."));
UtilPlayer.message(target, F.main(GetClassType().name(), F.name(cur.getName()) + " threw you with " + F.skill(GetName()) + "."));
}
}

View File

@ -51,8 +51,8 @@ public class FleshHook extends SkillActiveCharge implements IThrown
GetChargeString(),
"",
"If Flesh Hook hits a player, it",
"deals up to #2#2 damage, and rips them",
"towards you with #1.2#0.2 velocity.",
"deals up to #5#1 damage, and rips them",
"towards you with #1.2#0.3 velocity.",
});
}
@ -142,14 +142,14 @@ public class FleshHook extends SkillActiveCharge implements IThrown
//Pull
UtilAction.velocity(target,
UtilAlg.getTrajectory(target.getLocation(), player.getLocation()),
1.2 + (0.2 * level), false, 0, 0.8, 1.5, true);
1.2 + (0.3 * level), false, 0, 0.7, 1.2, true);
//Condition
Factory.Condition().Factory().Falling(GetName(), target, player, 10, false, true);
//Damage Event
Factory.Damage().NewDamageEvent(target, player, null,
DamageCause.CUSTOM, velocity * (1 + (1*level)), false, true, false,
DamageCause.CUSTOM, 5 + level, false, true, false,
player.getName(), GetName());

View File

@ -81,7 +81,7 @@ public class SeismicSlam extends SkillActive
{
"Jump up and slam back into the ground.",
"Players within #5.5#0.5 Blocks take up to",
"#1#1 damage and are thrown into the air.",
"#1#1 damage and are smashed away from you.",
});
}
@ -151,7 +151,7 @@ public class SeismicSlam extends SkillActive
//Velocity
UtilAction.velocity(cur,
UtilAlg.getTrajectory2d(player.getLocation().toVector(), cur.getLocation().toVector()),
0.4 + 2 * targets.get(cur), true, 0, 0.2 + 1.2 * targets.get(cur), 1.6, true);
0.6 + 2 * targets.get(cur), true, 0, 0.2 + 1.0 * targets.get(cur), 1.4, true);
//Condition
Factory.Condition().Factory().Falling(GetName(), cur, player, 10, false, true);

View File

@ -95,9 +95,6 @@ public class AxeThrow extends SkillActive implements IThrown
//Store
_thrown.put(item, player);
//Inform
UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + "."));
}
@Override

View File

@ -67,8 +67,9 @@ public class HoldPosition extends SkillActive
double duration = 3 + (1 * level);
//Action
Factory.Condition().Factory().Slow(GetName(), player, player, duration, 3, false, true, false, true);
Factory.Condition().Factory().Protection(GetName(), player, player, duration, 2, false, true, true);
Factory.Condition().Factory().Slow(GetName(), player, player, duration, 2, false, true, false, true);
Factory.Condition().Factory().Protection(GetName(), player, player, duration, 2, false, false, true);
Factory.Condition().Factory().Jump(GetName(), player, player, duration, 250, false, false, true);
//Inform
UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + "."));

View File

@ -49,7 +49,7 @@ public class Riposte extends SkillActive
"to riposte.",
"",
"If successful, you deal an additional",
"#0.5#0.5 bonus damage.",
"#0#0.5 bonus damage.",
"",
"You must block, parry, then riposte",
"all within 1 second of each other."
@ -155,15 +155,13 @@ public class Riposte extends SkillActive
_prepare.remove(damager);
//Damage
event.AddMod(damager.getName(), GetName(), 0.5 + 0.5 * level, true);
event.AddMod(damager.getName(), GetName(), 0.5 * level, true);
//Effect
damager.getWorld().playSound(damager.getLocation(), Sound.ZOMBIE_METAL, 1f, 1.2f);
//UtilPlayer.health(damager, 1);
//UtilParticle.PlayParticle(ParticleType.HEART, damager.getEyeLocation(), 0, 0.3f, 0, 0, 1);
//Inform
UtilPlayer.message(damager, F.main(GetClassType().name(), "You countered with " + F.skill(GetName(level)) + "."));

View File

@ -46,10 +46,9 @@ public class ArcticArmor extends Skill
"",
"Create a freezing area around you",
"in a #3#1 Block radius. Allies inside",
"this area receive Protection 1.",
"this area receive Protection 2.",
"",
"You are permanently immune to the",
"Slowing effect of snow."
"You receive Protection 1."
});
}
@ -154,6 +153,8 @@ public class ArcticArmor extends Skill
HashMap<Block, Double> blocks = UtilBlock.getInRadius(cur.getLocation().getBlock().getLocation(), 3d + level);
for (Block block : blocks.keySet())
{
if (block.getType().toString().contains("BANNER") || block.getRelative(BlockFace.UP).getType().toString().contains("BANNER"))
continue;
//Freeze
if (!block.getRelative(BlockFace.UP).isLiquid())
if (block.getLocation().getY() <= cur.getLocation().getY())
@ -177,7 +178,7 @@ public class ArcticArmor extends Skill
//Protection
for (Player other : UtilPlayer.getNearby(cur.getLocation(), 3 + getLevel(cur)))
if (!Factory.Relation().canHurt(cur, other) || other.equals(cur))
Factory.Condition().Factory().Protection(GetName(), other, cur, 1.9, 0, false, true, true);
Factory.Condition().Factory().Protection(GetName(), other, cur, 1.9, cur.equals(other) ? 0 : 1, false, true, true);
}
}
@ -221,43 +222,6 @@ public class ArcticArmor extends Skill
}
}
}
// @EventHandler
// public void Slow(UpdateEvent event)
// {
// if (event.getType() != UpdateType.TICK)
// return;
//
// for (Player cur : UtilServer.getPlayers())
// {
// if (cur.getLocation().getChunk() == null)
// continue;
//
// Block block = cur.getLocation().getBlock();
//
// if (block.getTypeId() != 78)
// continue;
//
// if (block.getData() == 0)
// continue;
//
// if (getLevel(cur) > 0)
// continue;
//
// int level = 0;
// if (block.getData() == 2 || block.getData() == 3)
// level = 1;
// else if (block.getData() == 4 || block.getData() == 5)
// level = 2;
// else if (block.getData() == 6 || block.getData() == 7)
// level = 3;
//
// //Slow
// Factory.Condition().Factory().Custom("Thick Snow", cur, cur,
// ConditionType.SLOW, 1.9, level, false,
// Material.SNOW_BALL, (byte)0, true);
// }
// }
@EventHandler
public void Particle(UpdateEvent event)

View File

@ -149,44 +149,60 @@ public class Blizzard extends SkillActive
}
//Target
HashSet<Byte> ignore = new HashSet<Byte>();
ignore.add((byte) 0);
ignore.add((byte) 78);
ignore.add((byte) 80);
// HashSet<Byte> ignore = new HashSet<Byte>();
// ignore.add((byte) 0);
// ignore.add((byte) 78);
// ignore.add((byte) 80);
Block target = cur.getTargetBlock(ignore, 7);
// Block target = cur.getTargetBlock(ignore, 7);
//Snow
if (target == null || target.getType() == Material.AIR || UtilMath.offset(target.getLocation(), cur.getLocation()) > 5)
for (int i=0 ; i<1+level ; i++)
{
Projectile snow = cur.launchProjectile(Snowball.class);
double mult = 0.25 + 0.15 * level;
double x = (0.2 - (UtilMath.r(40)/100d)) * mult;
double y = (UtilMath.r(20)/100d) * mult;
double z = (0.2 - (UtilMath.r(40)/100d)) * mult;
snow.setVelocity(cur.getLocation().getDirection().add(new Vector(x,y,z)).multiply(2));
_snowball.put(snow, cur);
}
if (target == null || target.getType() == Material.AIR)
continue;
if (UtilMath.offset(target.getLocation(), cur.getLocation()) > 7)
continue;
HashMap<Block, Double> blocks = UtilBlock.getInRadius(target.getLocation(), 2d, 1);
for (Block block : blocks.keySet())
//Snowballs
// if (target == null || target.getType() == Material.AIR || UtilMath.offset(target.getLocation(), cur.getLocation()) > 5)
// for (int i=0 ; i<1+level ; i++)
// {
// Projectile snow = cur.launchProjectile(Snowball.class);
//
// double mult = 0.25 + 0.15 * level;
// double x = (0.2 - (UtilMath.r(40)/100d)) * mult;
// double y = (UtilMath.r(20)/100d) * mult;
// double z = (0.2 - (UtilMath.r(40)/100d)) * mult;
//
//
//
// snow.setVelocity(cur.getLocation().getDirection().add(new Vector(x,y,z)).multiply(2));
// _snowball.put(snow, cur);
// }
//
// if (target == null || target.getType() == Material.AIR)
// continue;
//
// if (UtilMath.offset(target.getLocation(), cur.getLocation()) > 7)
// continue;
//
// HashMap<Block, Double> blocks = UtilBlock.getInRadius(target.getLocation(), 2d, 1);
// for (Block block : blocks.keySet())
// {
// Factory.BlockRestore().Snow(block, (byte)(1 + (int)(2*blocks.get(block))), (byte)(7*level), 2500, 250, 3);
// }
//Snowballs
for (int i=0 ; i<1+level ; i++)
{
Factory.BlockRestore().Snow(block, (byte)(1 + (int)(2*blocks.get(block))), (byte)(7*level), 2500, 250, 3);
Projectile snow = cur.launchProjectile(Snowball.class);
double mult = 0.25 + 0.15 * level;
double x = (0.2 - (UtilMath.r(40)/100d)) * mult;
double y = (UtilMath.r(20)/100d) * mult;
double z = (0.2 - (UtilMath.r(40)/100d)) * mult;
snow.setVelocity(cur.getLocation().getDirection().add(new Vector(x,y,z)).multiply(2));
_snowball.put(snow, cur);
}
//Effect
target.getWorld().playEffect(target.getLocation(), Effect.STEP_SOUND, 80);
// target.getWorld().playEffect(target.getLocation(), Effect.STEP_SOUND, 80);
cur.getWorld().playSound(cur.getLocation(), Sound.STEP_SNOW, 0.1f, 0.5f);
}
}
@ -213,30 +229,33 @@ public class Blizzard extends SkillActive
UtilAction.velocity(damagee, proj.getVelocity().multiply(0.1).add(new Vector(0, 0.15, 0)));
}
@EventHandler
public void SnowballForm(ProjectileHitEvent event)
{
if (!(event.getEntity() instanceof Snowball))
return;
if (_snowball.remove(event.getEntity()) == null)
return;
Factory.BlockRestore().Snow(event.getEntity().getLocation().getBlock(), (byte)1, (byte)7, 2000, 250, 0);
}
// @EventHandler
// public void SnowballForm(ProjectileHitEvent event)
// {
// if (!(event.getEntity() instanceof Snowball))
// return;
//
// if (_snowball.remove(event.getEntity()) == null)
// return;
//
// Factory.BlockRestore().Snow(event.getEntity().getLocation().getBlock(), (byte)1, (byte)7, 2000, 250, 0);
// }
@EventHandler
public void clearInvalidSnowballedPlayers(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
if (event.getType() != UpdateType.FASTER)
return;
for (Iterator<Entry<Projectile, Player>> snowBallIterator = _snowball.entrySet().iterator(); snowBallIterator.hasNext();)
{
Entry<Projectile, Player> entry = snowBallIterator.next();
if (!entry.getKey().isValid() || entry.getKey().getTicksLived() > 60 || !entry.getValue().isOnline())
if (!entry.getKey().isValid() || entry.getKey().getTicksLived() > 25 || !entry.getValue().isOnline())
{
snowBallIterator.remove();
entry.getKey().remove();
}
}
}

View File

@ -114,6 +114,10 @@ public class FissureData
//Cannot raise
if (block.getTypeId() == 46)
return false;
if (block.getType().toString().contains("BANNER"))
return false;
if (block.getRelative(BlockFace.UP).getType().toString().contains("BANNER"))
return false;
Block up = block.getRelative(0, _height + 1, 0);

View File

@ -48,7 +48,7 @@ public class IcePrison extends SkillActive implements IThrown
{
"Launch an icy orb. When it collides,",
"it creates a hollow sphere of ice",
"thats lasts for #2#1 seconds.",
"thats lasts for #3#1.5 seconds.",
});
}
@ -148,7 +148,7 @@ public class IcePrison extends SkillActive implements IThrown
if (!UtilBlock.airFoliage(freeze))
return;
long time = 2500 + (1000 * level);
long time = 3500 + (1500 * level);
int yDiff = freeze.getY() - mid.getY();

View File

@ -282,7 +282,7 @@ public class LifeBonds extends Skill
HashSet<Item> remove = new HashSet<Item>();
for (Item cur : _items)
if (UtilEnt.isGrounded(cur) || cur.getTicksLived() > 400 || cur.isDead() || !cur.isValid())
if (UtilEnt.isGrounded(cur) || cur.getTicksLived() > 40 || cur.isDead() || !cur.isValid())
remove.add(cur);
for (Item cur : remove)

View File

@ -11,12 +11,14 @@ import org.bukkit.event.*;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockIgniteEvent;
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.core.common.util.F;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
@ -24,6 +26,9 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.minecraft.game.classcombat.Skill.SkillActive;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.core.condition.Condition;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import org.bukkit.event.player.*;
@ -78,8 +83,8 @@ public class LightningOrb extends SkillActive implements IThrown
"Launch a lightning orb. Upon a direct",
"hit with player, or #5#-0.4 seconds, it will",
"strike all enemies within #3#0.5 Blocks ",
"with lightning, giving them Slow 2",
"for 4 seconds."
"with lightning, dealing #4#1 damage and",
"giving Slow 2 for 4 seconds."
});
}
@ -101,7 +106,7 @@ public class LightningOrb extends SkillActive implements IThrown
//Action
Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(57));
item.setVelocity(player.getLocation().getDirection());
Factory.Projectile().AddThrow(item, player, this, System.currentTimeMillis() + 5000 - (400 * level), true, true, false, false,
Factory.Projectile().AddThrow(item, player, this, 5000 - (400 * level), true, true, false, false,
Sound.FIZZ, 0.6f, 1.6f, ParticleType.FIREWORKS_SPARK, UpdateType.TICK, 0.4f);
//Inform
@ -147,12 +152,6 @@ public class LightningOrb extends SkillActive implements IThrown
HashMap<LivingEntity, Double> hit = UtilEnt.getInRadius(data.GetThrown().getLocation(), 3 + 0.5 * level);
//Lightning Condition
for (LivingEntity cur : hit.keySet())
{
Factory.Condition().Factory().Lightning(GetName(), cur, player, 0, 0.5, false, true);
}
List<LivingEntity> struck = new ArrayList<>();
//Lightning
@ -161,14 +160,16 @@ public class LightningOrb extends SkillActive implements IThrown
if (cur.equals(player))
continue;
if (cur instanceof Player)
{
//Inform
UtilPlayer.message(cur, F.main(GetClassType().name(), F.name(player.getName()) + " hit you with " + F.skill(GetName(level)) + "."));
}
//Inform
UtilPlayer.message(cur, F.main(GetClassType().name(), F.name(player.getName()) + " hit you with " + F.skill(GetName(level)) + "."));
//Lightning
cur.getWorld().strikeLightning(cur.getLocation());
cur.getWorld().strikeLightningEffect(cur.getLocation());
//Damage Event
Factory.Damage().NewDamageEvent(cur, player, null,
DamageCause.LIGHTNING, 4 + level, false, true, false,
player.getName(), GetName());
struck.add(cur);
}
@ -180,18 +181,19 @@ public class LightningOrb extends SkillActive implements IThrown
continue;
Factory.Condition().Factory().Slow(GetName(), cur, player, 4, 1, false, true, true, true);
Factory.Condition().Factory().Shock(GetName(), cur, player, 1, false, true);
}
Bukkit.getPluginManager().callEvent(new LightningOrbEvent(player, struck));
}
@EventHandler
public void CancelFire(BlockIgniteEvent event)
{
if (event.getCause() == IgniteCause.LIGHTNING)
event.setCancelled(true);
}
@Override
public void Reset(Player player)
{

View File

@ -105,6 +105,26 @@ public class Void extends Skill
_active.remove(cur);
}
}
@EventHandler
public void inWater(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player cur : GetUsers())
{
if (!_active.contains(cur))
continue;
if (cur.getLocation().getBlock().getTypeId() == 8 || cur.getLocation().getBlock().getTypeId() == 9)
{
UtilPlayer.message(cur, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
_active.remove(cur);
Factory.Condition().EndCondition(cur, null, GetName());
}
}
}
@EventHandler
public void Audio(UpdateEvent event)

View File

@ -32,7 +32,7 @@ public class Barrage extends SkillChargeBow
SkillType skillType, int cost, int maxLevel)
{
super(skills, name, classType, skillType, cost, maxLevel,
0.012f, 0.006f, false, true);
0.016f, 0.008f, false, true);
SetDesc(new String[]
{

View File

@ -67,6 +67,12 @@ public class Disengage extends SkillActive
return false;
}
if (player.getLocation().getBlock().getType() == Material.WEB)
{
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " while trapped in a cobweb!"));
return false;
}
return true;
}

View File

@ -55,10 +55,13 @@ public class HealingShot extends SkillActive
SetDesc(new String[]
{
"Prepare a healing shot;",
"Prepare a Healing Shot;",
"",
"Your next arrow will give its target",
"Regeneration 2 for #5#1 seconds,",
"and remove all negative effects."
"Regeneration 3 for #3#1 seconds,",
"and remove all negative effects.",
"",
"Gives Nausea to enemies for #5#1 seconds."
});
}
@ -109,7 +112,7 @@ public class HealingShot extends SkillActive
@SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.NORMAL)
public void ArrowHit(EntityDamageEvent event)
public void arrowHit(EntityDamageEvent event)
{
if (event.getCause() != DamageCause.PROJECTILE)
return;
@ -128,10 +131,10 @@ public class HealingShot extends SkillActive
if (!_arrows.contains((Entity)projectile))
return;
if (!(event.getEntity() instanceof LivingEntity))
if (!(event.getEntity() instanceof Player))
return;
LivingEntity damagee = (LivingEntity)event.getEntity();
Player damagee = (Player)event.getEntity();
if (projectile.getShooter() == null)
return;
@ -150,14 +153,21 @@ public class HealingShot extends SkillActive
projectile.remove();
//Regen
Factory.Condition().Factory().Regen(GetName(), damagee, damager, 3 + 2 * level, 1, false, true, true);
//Remove Bad
damagee.setFireTicks(0);
damagee.removePotionEffect(PotionEffectType.SLOW);
damagee.removePotionEffect(PotionEffectType.POISON);
damagee.removePotionEffect(PotionEffectType.CONFUSION);
damagee.removePotionEffect(PotionEffectType.WEAKNESS);
if (Factory.Relation().canHurt(damager, damagee))
{
Factory.Condition().Factory().Regen(GetName(), damagee, damager, 3 + level, 2, false, false, false);
//Remove Bad
damagee.setFireTicks(0);
damagee.removePotionEffect(PotionEffectType.SLOW);
damagee.removePotionEffect(PotionEffectType.POISON);
damagee.removePotionEffect(PotionEffectType.CONFUSION);
damagee.removePotionEffect(PotionEffectType.WEAKNESS);
}
else
{
Factory.Condition().Factory().Confuse(GetName(), damagee, damager, 5 + level, 2, false, false, false);
}
//Effect
damagee.getWorld().playSound(damagee.getLocation(), Sound.LEVEL_UP, 1f, 1.5f);
@ -181,7 +191,7 @@ public class HealingShot extends SkillActive
}
@EventHandler
public void Particle(UpdateEvent event)
public void particle(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
@ -194,7 +204,7 @@ public class HealingShot extends SkillActive
}
@EventHandler
public void Clean(UpdateEvent event)
public void clean(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
return;

View File

@ -1,178 +1,178 @@
package mineplex.minecraft.game.classcombat.Skill.Ranger;
import java.util.HashSet;
import java.util.Iterator;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilServer;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.minecraft.game.classcombat.Skill.SkillActive;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
public class IncendiaryShot extends SkillActive
{
private HashSet<Entity> _arrows = new HashSet<Entity>();
private HashSet<Player> _active = new HashSet<Player>();
public IncendiaryShot(SkillFactory skills, String name, ClassType classType, SkillType skillType,
int cost, int levels,
int energy, int energyMod,
long recharge, long rechargeMod, boolean rechargeInform,
Material[] itemArray,
Action[] actionArray)
{
super(skills, name, classType, skillType,
cost, levels,
energy, energyMod,
recharge, rechargeMod, rechargeInform,
itemArray,
actionArray);
SetDesc(new String[]
{
"Prepare an incendiary shot;",
"Your next arrow will ignite",
"its target for #2#1 seconds."
});
}
@Override
public boolean CustomCheck(Player player, int level)
{
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9)
{
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false;
}
return true;
}
@Override
public void Skill(Player player, int level)
{
//Action
_active.add(player);
//Inform
UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + "."));
//Effect
player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f);
}
@EventHandler
public void ShootBow(EntityShootBowEvent event)
{
if (!(event.getEntity() instanceof Player))
return;
if (!(event.getProjectile() instanceof Arrow))
return;
Player player = (Player)event.getEntity();
if (!_active.remove(player))
return;
//Inform
UtilPlayer.message(player, F.main(GetClassType().name(), "You fired " + F.skill(GetName(getLevel(player))) + "."));
_arrows.add(event.getProjectile());
event.getProjectile().setFireTicks(200);
}
@EventHandler(priority = EventPriority.HIGH)
public void ArrowHit(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
if (event.GetCause() != DamageCause.PROJECTILE)
return;
Projectile projectile = event.GetProjectile();
if (projectile == null) return;
if (!_arrows.contains((Entity)projectile))
return;
LivingEntity damagee = event.GetDamageeEntity();
if (damagee == null) return;
Player damager = event.GetDamagerPlayer(true);
if (damager == null) return;
//Level
int level = getLevel(damager);
if (level == 0) return;
//Ignite
Factory.Condition().Factory().Ignite(GetName(), damagee, damager, 2 + level, true, true);
//Damage
event.AddMod(damager.getName(), GetName(), 0, true);
//Effect
damagee.getWorld().playSound(damagee.getLocation(), Sound.FIZZ, 2f, 1.5f);
//Remove
projectile.remove();
}
@EventHandler
public void Particle(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Entity ent : _arrows)
{
UtilParticle.PlayParticle(ParticleType.FLAME, ent.getLocation(), 0, 0, 0, 0, 1,
ViewDist.MAX, UtilServer.getPlayers());
}
}
@EventHandler
public void Clean(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
return;
for (Iterator<Entity> arrowIterator = _arrows.iterator(); arrowIterator.hasNext();)
{
Entity arrow = arrowIterator.next();
if (arrow.isDead() || !arrow.isValid() || arrow.isOnGround())
{
arrowIterator.remove();
}
}
}
@Override
public void Reset(Player player)
{
_active.remove(player);
}
}
//package mineplex.minecraft.game.classcombat.Skill.Ranger;
//
//import java.util.HashSet;
//import java.util.Iterator;
//
//import org.bukkit.Material;
//import org.bukkit.Sound;
//import org.bukkit.entity.Arrow;
//import org.bukkit.entity.Entity;
//import org.bukkit.entity.LivingEntity;
//import org.bukkit.entity.Player;
//import org.bukkit.entity.Projectile;
//import org.bukkit.event.EventHandler;
//import org.bukkit.event.EventPriority;
//import org.bukkit.event.block.Action;
//import org.bukkit.event.entity.EntityShootBowEvent;
//import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
//
//import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
//import mineplex.minecraft.game.core.damage.CustomDamageEvent;
//import mineplex.core.common.util.F;
//import mineplex.core.common.util.UtilParticle;
//import mineplex.core.common.util.UtilServer;
//import mineplex.core.updater.event.UpdateEvent;
//import mineplex.core.updater.UpdateType;
//import mineplex.core.common.util.UtilPlayer;
//import mineplex.core.common.util.UtilParticle.ParticleType;
//import mineplex.core.common.util.UtilParticle.ViewDist;
//import mineplex.minecraft.game.classcombat.Skill.SkillActive;
//import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
//
//public class IncendiaryShot extends SkillActive
//{
// private HashSet<Entity> _arrows = new HashSet<Entity>();
// private HashSet<Player> _active = new HashSet<Player>();
//
// public IncendiaryShot(SkillFactory skills, String name, ClassType classType, SkillType skillType,
// int cost, int levels,
// int energy, int energyMod,
// long recharge, long rechargeMod, boolean rechargeInform,
// Material[] itemArray,
// Action[] actionArray)
// {
// super(skills, name, classType, skillType,
// cost, levels,
// energy, energyMod,
// recharge, rechargeMod, rechargeInform,
// itemArray,
// actionArray);
//
// SetDesc(new String[]
// {
// "Prepare an incendiary shot;",
// "Your next arrow will ignite",
// "its target for #2#1 seconds."
// });
// }
//
// @Override
// public boolean CustomCheck(Player player, int level)
// {
// if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9)
// {
// UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
// return false;
// }
//
// return true;
// }
//
// @Override
// public void Skill(Player player, int level)
// {
// //Action
// _active.add(player);
//
// //Inform
// UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + "."));
//
// //Effect
// player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f);
// }
//
// @EventHandler
// public void ShootBow(EntityShootBowEvent event)
// {
// if (!(event.getEntity() instanceof Player))
// return;
//
// if (!(event.getProjectile() instanceof Arrow))
// return;
//
// Player player = (Player)event.getEntity();
//
// if (!_active.remove(player))
// return;
//
// //Inform
// UtilPlayer.message(player, F.main(GetClassType().name(), "You fired " + F.skill(GetName(getLevel(player))) + "."));
//
// _arrows.add(event.getProjectile());
// event.getProjectile().setFireTicks(200);
// }
//
// @EventHandler(priority = EventPriority.HIGH)
// public void ArrowHit(CustomDamageEvent event)
// {
// if (event.IsCancelled())
// return;
//
// if (event.GetCause() != DamageCause.PROJECTILE)
// return;
//
// Projectile projectile = event.GetProjectile();
// if (projectile == null) return;
//
// if (!_arrows.contains((Entity)projectile))
// return;
//
// LivingEntity damagee = event.GetDamageeEntity();
// if (damagee == null) return;
//
// Player damager = event.GetDamagerPlayer(true);
// if (damager == null) return;
//
// //Level
// int level = getLevel(damager);
// if (level == 0) return;
//
// //Ignite
// Factory.Condition().Factory().Ignite(GetName(), damagee, damager, 2 + level, true, true);
//
// //Damage
// event.AddMod(damager.getName(), GetName(), 0, true);
//
// //Effect
// damagee.getWorld().playSound(damagee.getLocation(), Sound.FIZZ, 2f, 1.5f);
//
// //Remove
// projectile.remove();
// }
//
// @EventHandler
// public void Particle(UpdateEvent event)
// {
// if (event.getType() != UpdateType.TICK)
// return;
//
// for (Entity ent : _arrows)
// {
// UtilParticle.PlayParticle(ParticleType.FLAME, ent.getLocation(), 0, 0, 0, 0, 1,
// ViewDist.MAX, UtilServer.getPlayers());
// }
// }
//
// @EventHandler
// public void Clean(UpdateEvent event)
// {
// if (event.getType() != UpdateType.SEC)
// return;
//
// for (Iterator<Entity> arrowIterator = _arrows.iterator(); arrowIterator.hasNext();)
// {
// Entity arrow = arrowIterator.next();
//
// if (arrow.isDead() || !arrow.isValid() || arrow.isOnGround())
// {
// arrowIterator.remove();
// }
// }
// }
//
// @Override
// public void Reset(Player player)
// {
// _active.remove(player);
// }
//}

View File

@ -9,12 +9,15 @@ import org.bukkit.Sound;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
@ -31,6 +34,7 @@ import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.minecraft.game.classcombat.Skill.SkillActive;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class NapalmShot extends SkillActive
{
@ -53,9 +57,13 @@ public class NapalmShot extends SkillActive
SetDesc(new String[]
{
"Prepare a napalm shot;",
"Prepare a Napalm Shot;",
"",
"Your next arrow will burst into",
"#8#8 flames on impact."
"#8#8 flames on impact.",
"",
"If your arrow hit an enemy, it",
"will ignite them for #2#1 seconds."
});
}
@ -85,7 +93,7 @@ public class NapalmShot extends SkillActive
}
@EventHandler
public void BowShoot(EntityShootBowEvent event)
public void bowShoot(EntityShootBowEvent event)
{
if (!(event.getEntity() instanceof Player))
return;
@ -105,8 +113,46 @@ public class NapalmShot extends SkillActive
event.getProjectile().setFireTicks(120);
}
@EventHandler(priority = EventPriority.HIGH)
public void arrowDamage(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
if (event.GetCause() != DamageCause.PROJECTILE)
return;
Projectile projectile = event.GetProjectile();
if (projectile == null) return;
if (!_arrows.contains((Entity)projectile))
return;
LivingEntity damagee = event.GetDamageeEntity();
if (damagee == null) return;
Player damager = event.GetDamagerPlayer(true);
if (damager == null) return;
//Level
int level = getLevel(damager);
if (level == 0) return;
//Ignite
Factory.Condition().Factory().Ignite(GetName(), damagee, damager, 2 + level, true, true);
//Damage
event.AddMod(damager.getName(), GetName(), 0, true);
//Effect
damagee.getWorld().playSound(damagee.getLocation(), Sound.FIZZ, 2f, 1.5f);
//Remove
projectile.remove();
}
@EventHandler
public void ProjectileHit(ProjectileHitEvent event)
public void projectileHit(ProjectileHitEvent event)
{
Projectile proj = event.getEntity();
@ -142,20 +188,20 @@ public class NapalmShot extends SkillActive
}
@EventHandler
public void Particle(UpdateEvent event)
public void particle(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Entity ent : _arrows)
{
UtilParticle.PlayParticle(ParticleType.LAVA, ent.getLocation(), 0, 0, 0, 0, 1,
UtilParticle.PlayParticle(ParticleType.FLAME, ent.getLocation(), 0, 0, 0, 0, 1,
ViewDist.MAX, UtilServer.getPlayers());
}
}
@EventHandler
public void Clean(UpdateEvent event)
public void clean(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
return;

View File

@ -34,7 +34,7 @@ public class Overcharge extends SkillChargeBow
SkillType skillType, int cost, int maxLevel)
{
super(skills, name, classType, skillType, cost, maxLevel,
0.012f, 0.006f, false, true);
0.016f, 0.008f, false, true);
SetDesc(new String[]
{

View File

@ -2,18 +2,21 @@ package mineplex.minecraft.game.classcombat.Skill.Ranger;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.WeakHashMap;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.classcombat.Skill.Skill;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import org.bukkit.Sound;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
@ -33,17 +36,16 @@ public class Sharpshooter extends Skill
SetDesc(new String[]
{
"Consecutive arrow hits deal an",
"additional #1#0.5 damage.",
"Hitting with arrows increases",
"arrow damage by 1 for 5 seconds.",
"",
"Stacks up to #1#1 times",
"",
"Missing an arrow resets the bonus.",
"Stacks up to #0#2 times, and each",
"hit sets duration to 5 seconds."
});
}
@EventHandler
public void ShootBow(EntityShootBowEvent event)
public void shootBow(EntityShootBowEvent event)
{
if (!(event.getEntity() instanceof Player))
return;
@ -56,7 +58,7 @@ public class Sharpshooter extends Skill
}
@EventHandler(priority = EventPriority.HIGH)
public void Damage(CustomDamageEvent event)
public void damage(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
@ -76,48 +78,69 @@ public class Sharpshooter extends Skill
if (event.GetDamagerEntity(true) != null && event.GetDamagerEntity(true).equals(event.GetDamageeEntity()))
return;
int bonus = 1;
if (_hitCount.containsKey(player))
{
//Damage
event.AddMod(player.getName(), GetName(), _hitCount.get(player) * (1 + 0.5 * level), true);
bonus = _hitCount.get(player);
//Damage
event.AddMod(player.getName(), GetName(), bonus, true);
//Increase
bonus = Math.min(bonus + 1, 2 * level);
_hitCount.put(player, bonus);
//Inform
UtilPlayer.message((Entity)projectile.getShooter(), F.main(GetClassType().name(), GetName() + ": " +
F.elem(bonus + " Consecutive Hits") + C.cGray + " (" + F.skill("+" + bonus + "Damage" ) + C.cGray + ")" ) );
int limit = Math.min(1 + level, _hitCount.get(player) + 1);
_hitCount.put(player, limit);
//Inform
UtilPlayer.message((Entity)projectile.getShooter(), F.main(GetClassType().name(), GetName() + ": " +
F.elem(_hitCount.get(player) + " Consecutive Hits") + C.cGray + " (" + F.skill("+"+ (1 + 0.5 * limit) + "Damage" ) + C.cGray + ")" ) );
}
else
{
_hitCount.put(player, 1);
}
player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 0.8f + (float)(bonus * 0.2));
projectile.remove();
}
@EventHandler
public void Clean(UpdateEvent event)
public void resetViaTime(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
if (event.getType() != UpdateType.TICK)
return;
HashSet<Entity> remove = new HashSet<Entity>();
for (Entity cur : _arrows.keySet())
if (cur.isDead() || !cur.isValid() || cur.isOnGround())
remove.add(cur);
for (Entity cur : remove)
Iterator<Player> playerIter = _hitCount.keySet().iterator();
while (playerIter.hasNext())
{
Player player = _arrows.remove(cur);
if (player != null)
if (_hitCount.remove(player) != null)
UtilPlayer.message(player, F.main(GetClassType().name(), GetName() + ": " + F.elem("0 Consecutive Hits")));
}
Player player = playerIter.next();
if (Recharge.Instance.usable(player, GetName() + " Timer"))
{
playerIter.remove();
UtilPlayer.message(player, F.main(GetClassType().name(), GetName() + ": " + F.elem("Damage Bonus Reset")));
player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 0.75f);
}
}
}
// @EventHandler
// public void resetViaMiss(UpdateEvent event)
// {
// if (event.getType() != UpdateType.FAST)
// return;
//
// HashSet<Entity> remove = new HashSet<Entity>();
//
// for (Entity cur : _arrows.keySet())
// if (cur.isDead() || !cur.isValid() || cur.isOnGround())
// remove.add(cur);
//
// for (Entity cur : remove)
// {
// Player player = _arrows.remove(cur);
//
// if (player != null)
// if (_hitCount.remove(player) != null)
// UtilPlayer.message(player, F.main(GetClassType().name(), GetName() + ": " + F.elem("0 Consecutive Hits")));
// }
// }
@Override
public void Reset(Player player)

View File

@ -1,12 +1,16 @@
package mineplex.minecraft.game.classcombat.Skill.Ranger;
import java.util.HashMap;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerMoveEvent;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
@ -18,24 +22,30 @@ import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
public class VitalitySpores extends Skill
{
private HashMap<Player, Long> _lastMove = new HashMap<Player, Long>();
public VitalitySpores(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)
{
super(skills, name, classType, skillType, cost, levels);
SetDesc(new String[]
{
"After #5#-1 seconds of not taking damage,",
"forest spores surround you, restoring",
"1 health per second.",
"",
"This remains until you take damage."
"While standing still, forest spores",
"heal you for #0#0.5 health per 2 seconds."
});
}
@EventHandler
public void Update(UpdateEvent event)
public void playerMove(PlayerMoveEvent event)
{
if (event.getType() != UpdateType.SEC)
if (UtilMath.offset(event.getFrom(), event.getTo()) > 0)
_lastMove.put(event.getPlayer(), System.currentTimeMillis());
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player cur : GetUsers())
@ -43,13 +53,17 @@ public class VitalitySpores extends Skill
int level = getLevel(cur);
if (level == 0) continue;
if (UtilTime.elapsed(Factory.Combat().Get(cur).GetLastDamaged(), 5000 - 1000*level))
if (!_lastMove.containsKey(cur))
continue;
if (UtilTime.elapsed(_lastMove.get(cur), 2000))
{
//Factory.Condition().Factory().Regen(GetName(), cur, cur, 3.9 + 2*level, 0, false, true, true);
UtilPlayer.health(cur, 1);
UtilPlayer.health(cur, 0.5 * level);
UtilParticle.PlayParticle(ParticleType.HEART, cur.getEyeLocation().add(UtilAlg.getBehind(cur.getLocation().getDirection().multiply(0.5))), 0, 0.2f, 0, 0, 1,
ViewDist.LONG, UtilServer.getPlayers());
_lastMove.put(cur, System.currentTimeMillis());
}
}
}

View File

@ -118,7 +118,7 @@ public abstract class SkillChargeBow extends SkillCharge implements Listener
continue;
//Delay
if (!UtilTime.elapsed(_chargeStart.get(cur), 1200))
if (!UtilTime.elapsed(_chargeStart.get(cur), 1000))
continue;
float charge = _charge.get(cur);

View File

@ -201,21 +201,21 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
AddSkill(new MarkedForDeath(this, "Marked for Death", ClassType.Assassin, SkillType.Bow,
1, 4,
40, 0,
20000, 0, true,
20000, -2000, true,
new Material[] {Material.BOW},
new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK}));
AddSkill(new SmokeArrow(this, "Smoke Arrow", ClassType.Assassin, SkillType.Bow,
1, 4,
40, 0,
20000, 0, true,
20000, -2000, true,
new Material[] {Material.BOW},
new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK}));
AddSkill(new SilencingArrow(this, "Silencing Arrow", ClassType.Assassin, SkillType.Bow,
1, 4,
40, 0,
20000, 0, true,
20000, -2000, true,
new Material[] {Material.BOW},
new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK}));
@ -238,9 +238,9 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
//Sword
AddSkill(new DwarfToss(this, "Dwarf Toss", ClassType.Brute, SkillType.Sword,
1, 5,
2, 1,
0, 0,
20000, -2000, true,
16000, 0, true,
new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
@ -257,21 +257,21 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
AddSkill(new SeismicSlam(this, "Seismic Slam", ClassType.Brute, SkillType.Axe,
1, 5,
0, 0,
30000, -2000, true,
24000, -2000, true,
new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
AddSkill(new Takedown(this, "Takedown", ClassType.Brute, SkillType.Axe,
1, 5,
0, 0,
30000, -3000, true,
24000, -2000, true,
new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
AddSkill(new WhirlwindAxe(this, "Whirlwind Axe", ClassType.Brute, SkillType.Axe,
1, 5,
0, 0,
30000, -3000, true,
24000, -2000, true,
new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
@ -282,7 +282,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
//Passive B
AddSkill(new CripplingBlow(this, "Crippling Blow", ClassType.Brute, SkillType.PassiveB, 2, 1));
AddSkill(new Colossus(this, "Colossus", ClassType.Brute, SkillType.PassiveB, 1, 3));
AddSkill(new Colossus(this, "Colossus", ClassType.Brute, SkillType.PassiveB, 2, 1));
AddSkill(new Overwhelm(this, "Overwhelm", ClassType.Brute, SkillType.PassiveB, 1, 3));
}
@ -331,7 +331,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
AddSkill(new ShieldSmash(this, "Shield Smash", ClassType.Knight, SkillType.Axe,
1, 5,
0, 0,
10000, -1000, true,
15000, -1000, true,
new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
@ -400,7 +400,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
AddSkill(new LightningOrb(this, "Lightning Orb", ClassType.Mage, SkillType.Axe,
1, 5,
60, -2,
11000, -1000, true,
13000, -1000, true,
new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
@ -408,7 +408,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
AddSkill(new Fissure(this, "Fissure", ClassType.Mage, SkillType.Axe,
1, 5,
60, -3,
11000, -1000, true,
13000, -1000, true,
new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
@ -434,13 +434,12 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
AddSkill(new GlacialBlade(this, "Glacial Blade", ClassType.Mage, SkillType.PassiveB,
1, 3,
16, -2,
1200, -200, false,
1200, -250, false,
new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD},
new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK}));
AddSkill(new MagmaBlade(this, "Magma Blade", ClassType.Mage, SkillType.PassiveB, 1, 3));
AddSkill(new NullBlade(this, "Null Blade", ClassType.Mage, SkillType.PassiveB, 1, 3));
//AddSkill(new RootingAxe(this, "Rooting Axe", ClassType.Mage, SkillType.PassiveB, 5, 3));
}
public void AddRanger()
@ -451,7 +450,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
AddSkill(new Disengage(this, "Disengage", ClassType.Ranger, SkillType.Sword,
1, 4,
0, 0,
18000, -2000, true,
16000, -1000, true,
new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
@ -480,12 +479,12 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
new Material[] {Material.BOW},
new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK}));
AddSkill(new IncendiaryShot(this, "Incendiary Shot", ClassType.Ranger, SkillType.Bow,
1, 4,
0, 0,
20000, -2000, true,
new Material[] {Material.BOW},
new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK}));
// AddSkill(new IncendiaryShot(this, "Incendiary Shot", ClassType.Ranger, SkillType.Bow,
// 1, 4,
// 0, 0,
// 20000, -2000, true,
// new Material[] {Material.BOW},
// new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK}));
AddSkill(new NapalmShot(this, "Napalm Shot", ClassType.Ranger, SkillType.Bow,
1, 4,
@ -523,9 +522,9 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
//Passive B
AddSkill(new BarbedArrows(this, "Barbed Arrows", ClassType.Ranger, SkillType.PassiveB, 1, 3));
AddSkill(new HeavyArrows(this, "Heavy Arrows", ClassType.Ranger, SkillType.PassiveB, 1, 3));
//AddSkill(new Shadowmeld(this, "Shadowmeld", ClassType.Ranger, SkillType.PassiveB, 5, 3));
AddSkill(new Longshot(this, "Longshot", ClassType.Ranger, SkillType.PassiveB, 1, 3));
AddSkill(new Sharpshooter(this, "Sharpshooter", ClassType.Ranger, SkillType.PassiveB, 1, 3));
//AddSkill(new Shadowmeld(this, "Shadowmeld", ClassType.Ranger, SkillType.PassiveB, 5, 3));
//AddSkill(new Fletcher(this, "Fletcher", ClassType.Ranger, SkillType.PassiveB, 5, 3));
}

View File

@ -156,11 +156,11 @@ public abstract class ItemUsable extends Item implements IThrown
//Throw
long expire = -1;
if (_throwExpire >= 0)
expire = System.currentTimeMillis() + _throwExpire;
expire = _throwExpire;
org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(GetType()));
UtilAction.velocity(ent, player.getLocation().getDirection(), _throwPower, false, 0, 0.2, 10, false);
Factory.Throw().AddThrow(ent, player, this, expire, _throwPlayer, _throwBlock, _throwIdle, _throwPickup, 0.5f);
Factory.Throw().AddThrow(ent, player, this, expire, _throwPlayer, _throwPlayer, _throwBlock, _throwIdle, _throwPickup, 0.5f);
ThrowCustom(event, ent);
}

View File

@ -69,13 +69,23 @@ public class ProximityExplosive extends ItemUsable
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
//Arm
_armed.put(data.GetThrown(), data.GetThrower());
//Effect
data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 7);
data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.NOTE_PLING, 0.5f, 2f);
}
@Override
public void Idle(ProjectileUser data)
{
//Arm
_armed.put(data.GetThrown(), data.GetThrower());
//Effect
data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 7);
data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.NOTE_PLING, 0.5f, 2f);
}
@Override

View File

@ -66,13 +66,23 @@ public class ProximityZapper extends ItemUsable
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
//Arm
_armed.put(data.GetThrown(), data.GetThrower());
//Effect
data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 7);
data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.NOTE_PLING, 0.5f, 2f);
}
@Override
public void Idle(ProjectileUser data)
{
//Arm
_armed.put(data.GetThrown(), data.GetThrower());
//Effect
data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 7);
data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.NOTE_PLING, 0.5f, 2f);
}
@Override

View File

@ -28,6 +28,7 @@ public class ClassCombatShop extends ShopBase<ClassShopManager>
private IPvpClass _gameClass;
private boolean _takeAwayStuff;
private boolean _skillsOnly;
private boolean _hub;
public ClassCombatShop(ClassShopManager plugin, CoreClientManager clientManager, DonationManager donationManager, boolean skillsOnly, String name)
{
@ -36,12 +37,13 @@ public class ClassCombatShop extends ShopBase<ClassShopManager>
_skillsOnly = skillsOnly;
}
public ClassCombatShop(ClassShopManager plugin, CoreClientManager clientManager, DonationManager donationManager, boolean skillsOnly, String name, IPvpClass iPvpClass)
public ClassCombatShop(ClassShopManager plugin, CoreClientManager clientManager, DonationManager donationManager, boolean skillsOnly, String name, IPvpClass iPvpClass, boolean hub)
{
super(plugin, clientManager, donationManager, name, CurrencyType.Gems);
_gameClass = iPvpClass;
_takeAwayStuff = true;
_skillsOnly = skillsOnly;
_hub = hub;
}
protected void openShopForPlayer(Player player)
@ -65,15 +67,22 @@ public class ClassCombatShop extends ShopBase<ClassShopManager>
ShopPageBase<ClassShopManager, ClassCombatShop> page = null;
if (getPlugin().GetClassManager().Get(player).GetGameClass() == null)
{
// page = new ArmorPage(_plugin, this, _clientManager, _donationManager, player);
UtilPlayer.message(player, F.main(getPlugin().getName(), ChatColor.RED + "You need to have an armor set on to modify class builds."));
player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, .6f);
return false;
}
else
page = new CustomBuildPage(getPlugin(), this, getClientManager(), getDonationManager(), player);
if (!_hub)
{
if (getPlugin().GetClassManager().Get(player).GetGameClass() == null)
{
// page = new ArmorPage(_plugin, this, _clientManager, _donationManager, player);
UtilPlayer.message(player, F.main(getPlugin().getName(), ChatColor.RED + "You need to have an armor set on to modify class builds."));
player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, .6f);
return false;
}
else
page = new CustomBuildPage(getPlugin(), this, getClientManager(), getDonationManager(), player);
}
else
{
page = new CustomBuildPage(getPlugin(), this, getClientManager(), getDonationManager(), player, _gameClass);
}
getOpenedShop().add(player.getName());
openShopForPlayer(player);

View File

@ -60,6 +60,8 @@ public class ClassShopManager extends MiniPlugin
Achievement.CHAMPIONS_MASS_ELECTROCUTION,
Achievement.CHAMPIONS_THE_LONGEST_SHOT,
Achievement.CHAMPIONS_WINS,
Achievement.CHAMPIONS_CAPTURES,
Achievement.CHAMPIONS_CLUTCH
});
}
}

View File

@ -1,9 +1,10 @@
package mineplex.minecraft.game.classcombat.shop.page;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.donation.DonationManager;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.minecraft.game.classcombat.Class.ClientClass;
import mineplex.minecraft.game.classcombat.Class.IPvpClass;
import mineplex.minecraft.game.classcombat.Class.event.ClassSetupEvent;
@ -14,11 +15,10 @@ import mineplex.minecraft.game.classcombat.shop.ClassShopManager;
import mineplex.minecraft.game.classcombat.shop.button.DeleteCustomBuildButton;
import mineplex.minecraft.game.classcombat.shop.button.EditAndSaveCustomBuildButton;
import mineplex.minecraft.game.classcombat.shop.button.SelectCustomBuildButton;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.donation.DonationManager;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.page.ShopPageBase;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
public class CustomBuildPage extends ShopPageBase<ClassShopManager, ClassCombatShop>
{
@ -31,6 +31,14 @@ public class CustomBuildPage extends ShopPageBase<ClassShopManager, ClassCombatS
buildPage();
}
public CustomBuildPage(ClassShopManager shopManager, ClassCombatShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player, IPvpClass kit)
{
super(shopManager, shop, clientManager, donationManager, " Custom Build", player);
_pvpClass = kit;
buildPage();
}
@Override
protected void buildPage()

View File

@ -2,6 +2,7 @@ package mineplex.minecraft.game.core.condition;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.visibility.VisibilityManager;
@ -253,6 +254,15 @@ public class ConditionEffect implements Listener
Condition condition = Manager.GetActiveCondition(ent, ConditionType.LIGHTNING);
if (condition == null) return;
if (event.GetDamageePlayer() != null)
{
if (!Recharge.Instance.use(event.GetDamageePlayer(), "Lightning by " + UtilEnt.getName(condition.GetSource()), 1000, false, false))
{
event.SetCancelled("Lightning Rate");
return;
}
}
//Damage
event.SetDamager(condition.GetSource());

View File

@ -111,6 +111,9 @@ public class Fire extends MiniPlugin
if (!_fire.containsKey(fire))
return;
if (_fire.get(fire).GetOwner().equals(player))
return;
event.setCancelled(true);
if (((CraftPlayer)player).getHandle().spectating)

View File

@ -236,7 +236,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation
_explosionManager.SetDebris(false);
if (serverConfig.GameList.contains(GameType.ChampionsDominate)
|| serverConfig.GameList.contains(GameType.ChampionsTDM))
|| serverConfig.GameList.contains(GameType.ChampionsTDM)
|| serverConfig.GameList.contains(GameType.ChampionsCTF))
{
_conditionManager = new SkillConditionManager(plugin);
}
@ -318,7 +319,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
_conditionManager, _projectileManager, _disguiseManager, _blockRestore, _fire, new Movement(plugin), teleport,
_energy, webAddress);
_classManager = new ClassManager(plugin, clientManager, donationManager, _skillFactory, _itemFactory,
_classManager = new ClassManager(plugin, clientManager, donationManager, _cosmeticManager.getGadgetManager(), _skillFactory, _itemFactory,
webAddress);
_classShopManager = new ClassShopManager(_plugin, _classManager, _skillFactory, _itemFactory, _achievementManager, clientManager);
@ -1334,7 +1335,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
public void toggleChampionsModules(GameType gameType)
{
boolean isChamps = gameType == GameType.ChampionsDominate || gameType == GameType.ChampionsTDM;
boolean isChamps = gameType == GameType.ChampionsDominate || gameType == GameType.ChampionsTDM || gameType == GameType.ChampionsCTF;
if (_enabled == isChamps)
{

View File

@ -11,6 +11,7 @@ import nautilus.game.arcade.game.games.bridge.Bridge;
import nautilus.game.arcade.game.games.build.Build;
import nautilus.game.arcade.game.games.cards.Cards;
import nautilus.game.arcade.game.games.castlesiege.CastleSiege;
import nautilus.game.arcade.game.games.champions.ChampionsCTF;
import nautilus.game.arcade.game.games.champions.ChampionsDominate;
import nautilus.game.arcade.game.games.champions.ChampionsTDM;
import nautilus.game.arcade.game.games.christmas.Christmas;
@ -69,6 +70,7 @@ public enum GameType
Barbarians(Barbarians.class, GameDisplay.Barbarians),
Bridge(Bridge.class, GameDisplay.Bridge),
CastleSiege(CastleSiege.class, GameDisplay.CastleSiege),
ChampionsCTF(ChampionsCTF.class, GameDisplay.ChampionsCTF),
ChampionsDominate(ChampionsDominate.class, GameDisplay.ChampionsDominate),
//ChampionsMOBA(ChampionsMOBA.class, "Champions MOBA", "Champions", Material.SKULL_ITEM, (byte)0, GameCategory.CHAMPIONS, 7),
ChampionsTDM(ChampionsTDM.class, GameDisplay.ChampionsTDM),

View File

@ -28,9 +28,9 @@ public class TeamArmorAddon extends MiniPlugin
@EventHandler
public void GiveArmor(PlayerKitGiveEvent event)
{
Player player = event.GetPlayer();
Player player = event.getPlayer();
if (event.GetGame().TeamArmor)
if (event.getGame().TeamArmor)
{
ItemStack helm = new ItemStack(Material.LEATHER_HELMET);
LeatherArmorMeta metaHelm = (LeatherArmorMeta)helm.getItemMeta();
@ -57,7 +57,7 @@ public class TeamArmorAddon extends MiniPlugin
player.getInventory().setBoots(boots);
}
if (event.GetGame().TeamArmorHotbar && event.GetGame().InProgress())
if (event.getGame().TeamArmorHotbar && event.getGame().InProgress())
{
ItemStack armor = new ItemStack(Material.LEATHER_CHESTPLATE);
LeatherArmorMeta meta = (LeatherArmorMeta)armor.getItemMeta();

View File

@ -0,0 +1,73 @@
package nautilus.game.arcade.events;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.kit.Kit;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class PlayerKitApplyEvent extends Event implements Cancellable
{
private static final HandlerList handlers = new HandlerList();
private Game _game;
private Kit _kit;
private Player _player;
private boolean _cancelled = false;
private String _cancelMessage = "";
public PlayerKitApplyEvent(Game game, Kit kit, Player player)
{
_game = game;
_kit = kit;
_player = player;
}
public HandlerList getHandlers()
{
return handlers;
}
public static HandlerList getHandlerList()
{
return handlers;
}
public Game getGame()
{
return _game;
}
public Kit getKit()
{
return _kit;
}
public Player getPlayer()
{
return _player;
}
public String getCancelMessage()
{
return _cancelMessage;
}
public void setCancelMessage(String message)
{
_cancelMessage = message;
}
@Override
public boolean isCancelled()
{
return _cancelled;
}
@Override
public void setCancelled(boolean cancelled)
{
_cancelled = cancelled;
}
}

View File

@ -32,17 +32,17 @@ public class PlayerKitGiveEvent extends Event
return handlers;
}
public Game GetGame()
public Game getGame()
{
return _game;
}
public Kit GetKit()
public Kit getKit()
{
return _kit;
}
public Player GetPlayer()
public Player getPlayer()
{
return _player;
}

View File

@ -0,0 +1,143 @@
package nautilus.game.arcade.game.games.champions;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.DeathMessageType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.champions.kits.KitAssassin;
import nautilus.game.arcade.game.games.champions.kits.KitBrute;
import nautilus.game.arcade.game.games.champions.kits.KitKnight;
import nautilus.game.arcade.game.games.champions.kits.KitMage;
import nautilus.game.arcade.game.games.champions.kits.KitRanger;
import nautilus.game.arcade.game.games.common.CaptureTheFlag;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.CapturesStatTracker;
import nautilus.game.arcade.stats.ClutchStatTracker;
import nautilus.game.arcade.stats.ElectrocutionStatTracker;
import nautilus.game.arcade.stats.KillReasonStatTracker;
import nautilus.game.arcade.stats.SeismicSlamStatTracker;
import nautilus.game.arcade.stats.TheLongestShotStatTracker;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.inventory.InventoryType;
public class ChampionsCTF extends CaptureTheFlag
{
public ChampionsCTF(ArcadeManager manager)
{
super(manager, GameType.ChampionsCTF,
new Kit[]
{
new KitBrute(manager),
new KitRanger(manager),
new KitKnight(manager),
new KitMage(manager),
new KitAssassin(manager),
});
_help = new String[]
{
"Make sure you use all of your Skill/Item Tokens",
"Collect Resupply Chests to restock your inventory",
"Customize your Class to suit your play style",
"Gold Sword boosts Sword Skill by 1 Level",
"Gold Axe boosts Axe Skill by 1 Level",
"Gold/Iron Weapons deal 6 damage",
"Diamond Weapons deal 7 damage",
};
Manager.GetDamage().UseSimpleWeaponDamage = false;
Manager.getCosmeticManager().setHideParticles(true);
this.StrictAntiHack = true;
InventoryOpenChest = true;
EloRanking = false;
EloStart = 1000;
this.DontAllowOverfill = true;
this.DisableKillCommand = false;
registerStatTrackers(
new KillReasonStatTracker(this, "Backstab", "Assassination", false),
new ElectrocutionStatTracker(this),
new TheLongestShotStatTracker(this),
new SeismicSlamStatTracker(this),
new CapturesStatTracker(this, "Captures"),
new ClutchStatTracker(this, "Clutch")
);
new ChampsFixer(this);
}
@Override
public void ValidateKit(Player player, GameTeam team)
{
//Set to Default Knight
if (GetKit(player) == null)
{
SetKit(player, GetKits()[2], true);
player.closeInventory();
}
}
@Override
public DeathMessageType GetDeathMessageType()
{
return DeathMessageType.Detailed;
}
@EventHandler
public void WaterArrowCancel(EntityShootBowEvent event)
{
if (event.getEntity().getLocation().getBlock().isLiquid())
{
UtilPlayer.message(event.getEntity(), F.main("Game", "You cannot use your Bow while swimming."));
event.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void InventoryDamageCancel(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
Player player = event.GetDamageePlayer();
if (player == null)
return;
if (!IsAlive(player))
return;
if (player.getOpenInventory() == null || player.getOpenInventory().getTopInventory() == null)
return;
if (player.getOpenInventory().getTopInventory().getType() == InventoryType.CHEST)
player.closeInventory();
}
@EventHandler
public void validateSkills(UpdateEvent event)
{
if (event.getType() == UpdateType.SEC)
{
for (Player player : GetPlayers(true))
{
Manager.getClassManager().Get(player).validateClassSkills(player);
}
}
}
}

View File

@ -16,8 +16,8 @@ import nautilus.game.arcade.game.games.champions.kits.KitMage;
import nautilus.game.arcade.game.games.champions.kits.KitRanger;
import nautilus.game.arcade.game.games.common.Domination;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.KillReasonStatTracker;
import nautilus.game.arcade.stats.ElectrocutionStatTracker;
import nautilus.game.arcade.stats.KillReasonStatTracker;
import nautilus.game.arcade.stats.SeismicSlamStatTracker;
import nautilus.game.arcade.stats.TheLongestShotStatTracker;
@ -76,6 +76,8 @@ public class ChampionsDominate extends Domination
new TheLongestShotStatTracker(this),
new SeismicSlamStatTracker(this)
);
new ChampsFixer(this);
}
@Override

View File

@ -1,11 +1,5 @@
package nautilus.game.arcade.game.games.champions;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.inventory.InventoryType;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.updater.UpdateType;
@ -22,13 +16,19 @@ import nautilus.game.arcade.game.games.champions.kits.KitMage;
import nautilus.game.arcade.game.games.champions.kits.KitRanger;
import nautilus.game.arcade.game.games.common.TeamDeathmatch;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.KillReasonStatTracker;
import nautilus.game.arcade.stats.ElectrocutionStatTracker;
import nautilus.game.arcade.stats.KillAllOpposingStatTracker;
import nautilus.game.arcade.stats.KillReasonStatTracker;
import nautilus.game.arcade.stats.SeismicSlamStatTracker;
import nautilus.game.arcade.stats.TheLongestShotStatTracker;
import nautilus.game.arcade.stats.WinWithoutLosingTeammateStatTracker;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.inventory.InventoryType;
public class ChampionsTDM extends TeamDeathmatch
{
public ChampionsTDM(ArcadeManager manager)
@ -76,6 +76,8 @@ public class ChampionsTDM extends TeamDeathmatch
new TheLongestShotStatTracker(this),
new SeismicSlamStatTracker(this)
);
new ChampsFixer(this);
}
@Override

View File

@ -0,0 +1,101 @@
package nautilus.game.arcade.game.games.champions;
import mineplex.core.common.util.UtilServer;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.Skill.Skill;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerKitApplyEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.Game.GameState;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryType;
public class ChampsFixer implements Listener
{
private Game _host;
public ChampsFixer(Game game)
{
_host = game;
Bukkit.getPluginManager().registerEvents(this, _host.getArcadeManager().getPlugin());
}
@EventHandler
public void disable(GameStateChangeEvent event)
{
if (event.GetGame() != _host)
return;
if (event.GetState() == GameState.Dead)
HandlerList.unregisterAll(this);
}
@EventHandler(priority = EventPriority.HIGHEST)
public void fixDwarf(PlayerKitApplyEvent event)
{
if (!_host.IsLive())
return;
if (event.isCancelled())
return;
if (event.getPlayer().getPassenger() == null)
return;
event.setCancelled(true);
event.setCancelMessage("You cannot change kits while holding someone in Dwarf Toss!");
}
@EventHandler(priority = EventPriority.HIGHEST)
public void fixBlizzard(PlayerKitApplyEvent event)
{
if (!_host.IsLive())
return;
if (event.isCancelled())
return;
_host.getArcadeManager().getClassManager().GetSkillFactory().GetSkill("Blizzard").Reset(event.getPlayer());
}
@EventHandler
public void onUpdate(UpdateEvent event)
{
if (!_host.IsLive())
return;
for (Player player : UtilServer.getPlayers())
{
if (player.getOpenInventory() == null || player.getOpenInventory().getTopInventory() == null)
continue;
if (player.getOpenInventory().getTopInventory().getType() == InventoryType.CHEST)
for (Skill skill : _host.getArcadeManager().getClassManager().GetSkillFactory().GetAllSkills())
skill.Reset(player);
}
}
@EventHandler
public void fixAxe(BlockDamageEvent event)
{
if (!_host.IsLive())
return;
event.setCancelled(true);
}
@EventHandler
public void fixArmor(InventoryClickEvent event)
{
event.setCancelled(true);
}
}

View File

@ -0,0 +1,845 @@
package nautilus.game.arcade.game.games.common;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.RadarData;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilRadar;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime;
import mineplex.core.elo.EloPlayer;
import mineplex.core.elo.EloTeam;
import mineplex.core.elo.GameResult;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.CombatComponent;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerGameRespawnEvent;
import nautilus.game.arcade.events.PlayerKitApplyEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.champions.ChampionsCTF;
import nautilus.game.arcade.game.games.common.ctf_data.CarrierCombatDeathEvent;
import nautilus.game.arcade.game.games.common.ctf_data.Flag;
import nautilus.game.arcade.game.games.common.dominate_data.PlayerData;
import nautilus.game.arcade.game.games.common.dominate_data.Resupply;
import nautilus.game.arcade.kit.Kit;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockPhysicsEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.ItemDespawnEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffectType;
public class CaptureTheFlag extends TeamGame
{
//Map Data
private Location _redFlag;
private Location _blueFlag;
private ArrayList<Flag> _flags = new ArrayList<Flag>();
private ArrayList<Resupply> _resupply = new ArrayList<Resupply>();
//Stats
private HashMap<String, PlayerData> _stats = new HashMap<String, PlayerData>();
//Captures
private static int _victoryCaps = 5;
private int _redScore = 0;
private int _blueScore = 0;
//Times
private long _gameTime = 420000;
//protected String[] _blockedItems = new String[] {"SWORD", "AXE", "BOW"};
private boolean _suddenDeath = false;
private HashMap<Player, List<ItemStack>> _hotbars = new HashMap<Player, List<ItemStack>>();
private HashMap<Player, ItemStack> _helmets = new HashMap<Player, ItemStack>();
private boolean _redFlickerStage = false;
private boolean _blueFlickerStage = false;
public CaptureTheFlag(ArcadeManager manager, GameType type, Kit[] kits)
{
super(manager, type, kits,
new String[]
{
"Capture The Opponent's Flag",
"First team to " + _victoryCaps + " Captures",
"Or with the most Captures after 7 minutes wins"
});
this.DeathOut = false;
this.PrepareFreeze = true;
this.HungerSet = 20;
this.WorldTimeSet = 2000;
this.DeathSpectateSecs = 10;
}
@Override
public void ParseData()
{
_redFlag = WorldData.GetDataLocs("RED").get(0);
_blueFlag = WorldData.GetDataLocs("BLUE").get(0);
for (GameTeam team : GetTeamList())
{
if (team.GetColor() == ChatColor.RED || team.GetColor() == ChatColor.BLUE || team.GetColor() == ChatColor.AQUA)
{
_flags.add(new Flag(this, team.GetColor() == ChatColor.RED ? _redFlag : _blueFlag, team));
}
}
for (Location loc : WorldData.GetDataLocs("YELLOW"))
{
_resupply.add(new Resupply(this, loc));
}
//Kit spawning
if (this instanceof ChampionsCTF)
{
CreatureAllowOverride = true;
for (int i = 0; i < GetKits().length && i < WorldData.GetDataLocs("LIGHT_BLUE").size() && i < WorldData.GetDataLocs("PINK").size(); i++)
{
Entity ent = GetKits()[i].SpawnEntity(WorldData.GetDataLocs("PINK").get(i));
Manager.GetLobby().AddKitLocation(ent, GetKits()[i], WorldData.GetDataLocs("PINK").get(i));
ent = GetKits()[i].SpawnEntity(WorldData.GetDataLocs("LIGHT_BLUE").get(i));
Manager.GetLobby().AddKitLocation(ent, GetKits()[i], WorldData.GetDataLocs("LIGHT_BLUE").get(i));
}
CreatureAllowOverride = false;
}
//End kit spawning
}
@EventHandler
public void customTeamGeneration(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Recruit)
return;
for (GameTeam team : GetTeamList())
if (team.GetColor() == ChatColor.AQUA)
team.SetColor(ChatColor.BLUE);
}
@EventHandler(priority = EventPriority.HIGHEST)
public void blockLiquidFlow(BlockPhysicsEvent event)
{
Material matOfBlock = event.getBlock().getType();
if (matOfBlock == Material.STATIONARY_WATER || matOfBlock == Material.SAND || matOfBlock == Material.GRAVEL || matOfBlock == Material.STATIONARY_LAVA)
{
event.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onTNTExplode(EntityExplodeEvent event)
{
if (!IsLive())
return;
if (event.getEntityType() == EntityType.PRIMED_TNT)
{
event.setCancelled(true);
}
}
@EventHandler
public void updates(UpdateEvent event)
{
if (!IsLive())
return;
if (event.getType() == UpdateType.FASTEST)
{
for (Flag flag : _flags)
flag.update();
Iterator<Player> hotbarIter = _hotbars.keySet().iterator();
while (hotbarIter.hasNext())
{
Player player = hotbarIter.next();
if (!player.isOnline() || UtilPlayer.isSpectator(player) || !IsAlive(player))
hotbarIter.remove();
}
Iterator<Player> helmetIter = _helmets.keySet().iterator();
while (helmetIter.hasNext())
{
Player player = helmetIter.next();
if (!player.isOnline() || UtilPlayer.isSpectator(player) || !IsAlive(player))
helmetIter.remove();
}
}
else if (event.getType() == UpdateType.TICK)
{
for (Flag flag : _flags)
{
if (flag.getCarrier() == null)
for (Player player : GetPlayers(true))
if (UtilMath.offset2d(player.getLocation(), flag.getPlacedLocation()) < .5 && player.getLocation().getY() > flag.getPlacedLocation().getY() - 2 && player.getLocation().getY() < flag.getPlacedLocation().getY() + 3)
flag.pickup(player);
}
}
else if (event.getType() == UpdateType.FAST)
{
for (Resupply resupply : _resupply)
resupply.Update();
getFlag(true).handleBottomInfo(_redFlickerStage, ChatColor.RED);
getFlag(false).handleBottomInfo(_blueFlickerStage, ChatColor.AQUA);
}
else if (event.getType() == UpdateType.SEC)
for (Flag flag : _flags)
flag.handleRespawn();
else
progressTime();
}
public void progressTime()
{
if (_suddenDeath) return;
long remain = _gameTime - (System.currentTimeMillis() - GetStateTime());
if (remain <= 0)
{
if (_redScore > _blueScore)
endCheckScore(_redScore);
else if(_redScore < _blueScore)
endCheckScore(_blueScore);
else
{
_suddenDeath = true;
this.DeathOut = true;
UtilTextMiddle.display(C.cYellow + "Sudden Death", "Next Capture Wins! No Respawns!");
return;
}
}
}
public void addCapture(GameTeam team)
{
if (_suddenDeath)
{
if (team.GetColor() == ChatColor.RED)
{
_redScore = _redScore + 1;
endCheckScore(_redScore);
}
else
{
_blueScore = _blueScore + 1;
endCheckScore(_blueScore);
}
}
else
{
if (team.GetColor() == ChatColor.RED)
{
_redScore = Math.min(_victoryCaps, _redScore + 1);
}
else
{
_blueScore = Math.min(_victoryCaps, _blueScore + 1);
}
endCheckScore(_victoryCaps);
}
}
public void saveInventory(Player player)
{
List<ItemStack> items = new ArrayList<ItemStack>();
for (int i = 0; i < 9; i++)
{
if (player.getInventory().getItem(i) != null)
items.add(i, player.getInventory().getItem(i));
else
items.add(i, new ItemStack(Material.AIR));
}
_hotbars.put(player, items);
_helmets.put(player, player.getInventory().getHelmet());
}
public void resetInventory(Player player)
{
if (_hotbars.containsKey(player))
{
List<ItemStack> items = _hotbars.get(player);
for (int i = 0; i < items.size(); i++)
{
if (items.get(i).getType() != Material.AIR)
player.getInventory().setItem(i, items.get(i));
else
player.getInventory().setItem(i, new ItemStack(Material.AIR));
}
getArcadeManager().getClassManager().hideNextEquipMessage(player.getName());
player.getInventory().setHelmet(_helmets.get(player));
//getArcadeManager().getClassManager().toggleMessage(player.getName(), false);
player.updateInventory();
player.removePotionEffect(PotionEffectType.SLOW);
_hotbars.remove(player);
_helmets.remove(player);
}
}
public boolean isAtHome(ChatColor team)
{
for (Flag flag : _flags)
{
if (flag.getTeam().GetColor() == team)
return flag.isAtHome();
}
return false;
}
public Location getRedFlag()
{
return _redFlag;
}
public Location getBlueFlag()
{
return _blueFlag;
}
public boolean isInZone(Location location, boolean red)
{
if (red)
{
if (UtilMath.offset(location, _redFlag) < 4)
return true;
}
else
{
if (UtilMath.offset(location, _blueFlag) < 4)
return true;
}
return false;
}
public boolean isSuddenDeath()
{
return _suddenDeath;
}
private boolean isEnemyCarrier(Player check, Player stat)
{
if (GetTeam(check).GetColor() == GetTeam(stat).GetColor()) return false;
for (Flag f : _flags)
{
if (f.getCarrier() == null) continue;
if (f.getCarrier().getName().equalsIgnoreCase(check.getName())) return true;
}
return false;
}
private String getVisualResult(ChatColor base)
{
String newc = base.toString();
if (base == ChatColor.BLUE)
newc = C.cDBlue;
if (base == ChatColor.RED)
newc = C.cDRed;
return newc;
}
private Flag getFlag(boolean red)
{
if (red)
{
for (Flag f : _flags)
if (f.getTeam().GetColor() == ChatColor.RED)
return f;
}
else
{
for (Flag f : _flags)
if (f.getTeam().GetColor() == ChatColor.BLUE)
return f;
}
return null;
}
@Override
@EventHandler
public void ScoreboardUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
scoreboardWrite();
}
private void scoreboardWrite()
{
if (!InProgress())
return;
//Wipe Last
Scoreboard.Reset();
//Scores
Scoreboard.WriteBlank();
Scoreboard.Write(C.cRedB + "Red Team");
Scoreboard.Write(_redScore + " Captures");
String redMessage = "Flag Dropped";
if (getFlag(true).isAtHome())
{
redMessage = "Flag Safe";
_redFlickerStage = false;
}
if (getFlag(true).getCarrier() != null)
redMessage = "Flag Taken";
if (_redFlickerStage)
{
Scoreboard.Write(C.cRed + redMessage);
_redFlickerStage = false;
}
else
{
Scoreboard.Write(redMessage);
_redFlickerStage = true;
}
//Flag in play stuff
Scoreboard.WriteBlank();
Scoreboard.Write(C.cAquaB + "Blue Team");
Scoreboard.Write(_blueScore + " Captures");
String blueMessage = "Flag Dropped";
if (getFlag(false).isAtHome())
{
blueMessage = "Flag Safe";
_blueFlickerStage = false;
}
if (getFlag(false).getCarrier() != null)
blueMessage = "Flag Taken";
if (_blueFlickerStage)
{
Scoreboard.Write(C.cAqua + blueMessage);
_blueFlickerStage = false;
}
else
{
Scoreboard.Write(blueMessage);
_blueFlickerStage = true;
}
//Flag in play stuff
Scoreboard.WriteBlank();
Scoreboard.Write(C.cYellowB + "Score to Win");
Scoreboard.Write(_victoryCaps + " Captures");
Scoreboard.WriteBlank();
if (_suddenDeath)
{
Scoreboard.Write(C.cYellowB + "Sudden Death");
Scoreboard.Write("Next Cap Wins");
Scoreboard.Write("No Respawns");
}
else
{
Scoreboard.Write(C.cYellowB + "Time Left");
Scoreboard.Write(UtilTime.MakeStr(Math.max(_gameTime - (System.currentTimeMillis() - GetStateTime()), 0)) + C.cWhite);
}
Scoreboard.Draw();
}
public void endCheckScore(int needed)
{
if (!IsLive())
return;
GameTeam winner = null;
if (_redScore >= needed)
winner = GetTeam(ChatColor.RED);
else if (_blueScore >= needed)
winner = GetTeam(ChatColor.BLUE);
if (winner == null)
return;
scoreboardWrite();
//Announce
AnnounceEnd(winner);
for (GameTeam team : GetTeamList())
{
if (WinnerTeam != null && team.equals(WinnerTeam))
{
for (Player player : team.GetPlayers(false))
AddGems(player, 10, "Winning Team", false, false);
}
for (Player player : team.GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false, false);
}
if (EloRanking)
{
EloTeam teamWinner = new EloTeam();
EloTeam teamLoser = new EloTeam();
for (GameTeam team : GetTeamList())
{
if (WinnerTeam != null && team.equals(WinnerTeam))
{
for (Player player : WinnerTeam.GetPlayers(false))
{
EloPlayer eloPlayer = new EloPlayer();
eloPlayer.UniqueId = player.getUniqueId().toString();
eloPlayer.Rating = Manager.getEloManager().getElo(player.getUniqueId(), GetName());
teamWinner.addPlayer(eloPlayer);
}
}
else
{
for (Player player : team.GetPlayers(false))
{
EloPlayer eloPlayer = new EloPlayer();
eloPlayer.UniqueId = player.getUniqueId().toString();
eloPlayer.Rating = Manager.getEloManager().getElo(player.getUniqueId(), GetName());
teamLoser.addPlayer(eloPlayer);
}
}
}
for (EloPlayer eloPlayer : Manager.getEloManager().getNewRatings(teamWinner, teamLoser, GameResult.Win).getPlayers())
{
Manager.getEloManager().saveElo(eloPlayer.UniqueId, GetName(), eloPlayer.Rating);
}
for (EloPlayer eloPlayer : Manager.getEloManager().getNewRatings(teamLoser, teamWinner, GameResult.Loss).getPlayers())
{
Manager.getEloManager().saveElo(eloPlayer.UniqueId, GetName(), eloPlayer.Rating);
}
}
//End
SetState(GameState.End);
}
@Override
public double GetKillsGems(Player killer, Player killed, boolean assist)
{
if (assist)
return .5;
if (_suddenDeath)
return 2;
return 1;
}
@Override
public String GetMode()
{
return "Capture the Flag";
}
@EventHandler
public void respawnRegen(PlayerGameRespawnEvent event)
{
Manager.GetCondition().Factory().Regen("Respawn", event.GetPlayer(), event.GetPlayer(), 8, 3, false, false, false);
Manager.GetCondition().Factory().Protection("Respawn", event.GetPlayer(), event.GetPlayer(), 8, 3, false, false, false);
}
public PlayerData getStats(Player player)
{
if (!_stats.containsKey(player.getName()))
_stats.put(player.getName(), new PlayerData(player.getName()));
return _stats.get(player.getName());
}
@EventHandler
public void statsKillAssistDeath(CombatDeathEvent event)
{
Game game = Manager.GetGame();
if (game == null) return;
if (!(event.GetEvent().getEntity() instanceof Player))
return;
Player killed = (Player)event.GetEvent().getEntity();
getStats(killed).Deaths++;
if (event.GetLog().GetKiller() != null)
{
Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
if (killer != null && !killer.equals(killed))
getStats(killer).Kills++;
}
for (CombatComponent log : event.GetLog().GetAttackers())
{
if (event.GetLog().GetKiller() != null && log.equals(event.GetLog().GetKiller()))
continue;
Player assist = UtilPlayer.searchExact(log.GetName());
//Assist
if (assist != null)
getStats(assist).Assists++;
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void statsKillAssistDeath(CustomDamageEvent event)
{
Player damager = event.GetDamagerPlayer(true);
if (damager != null)
{
getStats(damager).DamageDealt += event.GetDamage();
}
Player damagee = event.GetDamageePlayer();
if (damagee != null)
{
getStats(damagee).DamageTaken += event.GetDamage();
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void usableInteract(PlayerInteractEvent event)
{
if (UtilBlock.usable(event.getClickedBlock()))
event.setCancelled(true);
}
@EventHandler
public void selectKit(PlayerKitApplyEvent event)
{
if (this instanceof ChampionsCTF)
{
for (Flag flag : _flags)
if (!flag.isAtHome())
if (flag.getCarrier() != null)
if (flag.getCarrier().getName().equals(event.getPlayer().getName()))
{
event.setCancelled(true);
event.setCancelMessage("You cannot change kits while holding a flag!");
}
if (_suddenDeath)
{
event.setCancelled(true);
event.setCancelMessage("You cannot change kits during Sudden Death!");
}
}
}
@EventHandler
public void dropFlag(PlayerDropItemEvent event)
{
for (Flag flag : _flags)
if ((flag.getRepresentation().getType() == event.getItemDrop().getItemStack().getType()) || (event.getItemDrop().getItemStack().getType() == Material.COMPASS))
if (flag.getCarrier() != null)
if (flag.getCarrier().getName().equals(event.getPlayer().getName()))
{
event.setCancelled(false);
event.getItemDrop().remove();
flag.drop(event.getPlayer());
resetInventory(event.getPlayer());
}
}
@EventHandler
public void radarUpdate(UpdateEvent event)
{
if (!InProgress())
return;
if (event.getType() != UpdateType.TICK)
return;
ArrayList<RadarData> data = new ArrayList<RadarData>();
for (Flag f : _flags)
{
if (f.getCarrier() == null)
data.add(new RadarData(f.getPlacedLocation(), f.getTeam().GetColor() + ""));
else
data.add(new RadarData(f.getCarrier().getLocation(), getVisualResult(f.getTeam().GetColor()) + ""));
}
data.add(new RadarData(_redFlag, C.cRed + ""));
data.add(new RadarData(_blueFlag, C.cBlue + ""));
for (Player player : UtilServer.getPlayers())
UtilRadar.displayRadar(player, data);
}
@EventHandler
public void useCmd(PlayerCommandPreprocessEvent event)
{
if (!InProgress())
return;
if (event.getMessage().contains("/suddendeath"))
{
boolean authorized = Manager.GetClients().Get(event.getPlayer()).GetRank().has(Rank.JNR_DEV);
if (Manager.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing"))
if (Manager.GetClients().Get(event.getPlayer()).GetRank().has(Rank.SNR_MODERATOR))
authorized = true;
if (Manager.GetGameHostManager().isPrivateServer())
if (Manager.GetGameHostManager().isAdmin(event.getPlayer(), false))
authorized = true;
if (Manager.GetGameHostManager().isEventServer())
if (Manager.GetClients().Get(event.getPlayer()).GetRank().has(Rank.SNR_MODERATOR))
authorized = true;
if (authorized)
{
if (_redScore < _blueScore)
_redScore = _blueScore;
else
_blueScore = _redScore;
_gameTime = (System.currentTimeMillis() - GetStateTime()) + 11;
for (Player pl : UtilServer.getPlayers())
UtilPlayer.message(pl, C.cYellowB + event.getPlayer().getName() + " has equalized both teams and enabled Sudden Death!");
}
else
UtilPlayer.message(event.getPlayer(), F.main("Game", "You do not have permission to use this game modifier!"));
event.setCancelled(true);
}
}
@EventHandler
public void powerupPickup(PlayerPickupItemEvent event)
{
if (!IsLive())
return;
for (Flag f : _flags)
if (f.getCarrier() == event.getPlayer())
return;
if (_suddenDeath)
return;
for (Resupply resupply : _resupply)
resupply.Pickup(event.getPlayer(), event.getItem());
}
//Dont allow powerups to despawn
@EventHandler
public void itemDespawn(ItemDespawnEvent event)
{
event.setCancelled(true);
}
@EventHandler
public void onDie(CombatDeathEvent event)
{
Player player = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName());
if (event.GetLog().GetKiller() != null)
{
if (event.GetLog().GetKiller().IsPlayer())
{
Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
if (isEnemyCarrier(player, killer))
{
CarrierCombatDeathEvent e = new CarrierCombatDeathEvent(player, killer);
Bukkit.getPluginManager().callEvent(e);
}
}
}
for (Flag flag : _flags)
flag.drop(player);
getArcadeManager().getClassManager().forceRemoveFromSuppressed(player.getName());
}
@EventHandler
public void onQuit(PlayerQuitEvent event)
{
for (Flag flag : _flags)
flag.drop(event.getPlayer());
getArcadeManager().getClassManager().forceRemoveFromSuppressed(event.getPlayer().getName());
}
@EventHandler
public void equalizeBrute(CustomDamageEvent event)
{
if (event.GetDamageePlayer() == null)
return;
boolean carrier = false;
for (Flag flag : _flags)
if (flag.getCarrier() != null)
if (flag.getCarrier().getName().equals(event.GetDamageePlayer().getName()))
carrier = true;
if (carrier)
{
if (event.GetDamageePlayer().getInventory().getChestplate() != null)
if (event.GetDamageePlayer().getInventory().getChestplate().getType() == Material.DIAMOND_CHESTPLATE)
event.SetBrute();
}
}
}

View File

@ -7,6 +7,9 @@ import java.util.HashMap;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
@ -24,8 +27,12 @@ import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.RadarData;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilRadar;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextTop;
import mineplex.core.elo.EloPlayer;
import mineplex.core.elo.EloTeam;
import mineplex.core.elo.GameResult;
@ -435,4 +442,22 @@ public class Domination extends TeamGame
if (UtilBlock.usable(event.getClickedBlock()))
event.setCancelled(true);
}
@EventHandler
public void radarUpdate(UpdateEvent event)
{
if (!InProgress())
return;
if (event.getType() != UpdateType.TICK)
return;
ArrayList<RadarData> data = new ArrayList<RadarData>();
for (CapturePoint point : _points)
data.add(new RadarData(point.getLocation(), point.getRadarTag()));
for (Player player : UtilServer.getPlayers())
UtilRadar.displayRadar(player, data);
}
}

View File

@ -0,0 +1,36 @@
package nautilus.game.arcade.game.games.common.ctf_data;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class CarrierCombatDeathEvent extends Event
{
private static final HandlerList handlers = new HandlerList();
private Player _killed;
private Player _killer;
public CarrierCombatDeathEvent(Player killed, Player killer)
{
_killed = killed;
_killer = killer;
}
public HandlerList getHandlers()
{
return handlers;
}
public static HandlerList getHandlerList()
{
return handlers;
}
public Player GetPlayer(boolean killer)
{
if (killer)
return _killer;
else
return _killed;
}
}

View File

@ -0,0 +1,436 @@
package nautilus.game.arcade.game.games.common.ctf_data;
import java.util.ArrayList;
import java.util.List;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextBottom;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime;
import mineplex.core.hologram.Hologram;
import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.common.CaptureTheFlag;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.DyeColor;
import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Banner;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.banner.Pattern;
import org.bukkit.block.banner.PatternType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BannerMeta;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
public class Flag
{
private CaptureTheFlag _host;
private Location _spawn;
private Location _particleLoc;
private Location _beacon;
private Block _flagBlock;
private Material _priorBlock;
private Byte _priorData;
private GameTeam _team;
private ChatColor _enemy;
private ItemStack _representation;
private DyeColor _dyeData;
private List<Pattern> _patterns;
private Player _holding = null;
private boolean _moved = false;
private boolean _dropped = false;
private long _dropTime = 0;
private int _respawnTimer;
private Hologram _name, _time;
private String _displayName;
public Flag(CaptureTheFlag host, Location spawn, GameTeam team)
{
_host = host;
_spawn = spawn;
_beacon = _spawn.clone().add(0, -2, 0);
_team = team;
_displayName = team.GetColor() + team.GetName() + "'s Flag".replace("s's", "s'");
_patterns = new ArrayList<Pattern>();
ItemStack i;
if (team.GetColor() == ChatColor.RED)
{
i = new ItemStack(Material.BANNER);
_dyeData = DyeColor.RED;
_enemy = ChatColor.BLUE;
_patterns.add(new Pattern(DyeColor.WHITE, PatternType.CROSS));
}
else
{
i = new ItemStack(Material.BANNER);
_dyeData = DyeColor.BLUE;
_enemy = ChatColor.RED;
_patterns.add(new Pattern(DyeColor.WHITE, PatternType.CIRCLE_MIDDLE));
}
BannerMeta im = (BannerMeta) i.getItemMeta();
im.setBaseColor(_dyeData);
im.setPatterns(_patterns);
im.setDisplayName(_displayName);
i.setItemMeta(im);
_representation = i;
_name = new Hologram(_host.getArcadeManager().getHologramManager(), spawn, team.GetColor() + team.GetName() + "'s Flag".replace("s's", "s'"));
_time = new Hologram(_host.getArcadeManager().getHologramManager(), spawn, "");
spawnFlag(spawn);
}
public GameTeam getTeam()
{
return _team;
}
public boolean isAtHome()
{
return !_moved;
}
public Player getCarrier()
{
return _holding;
}
public Location getPlacedLocation()
{
return _flagBlock.getLocation().clone().add(0.5, 0, 0.5);
}
public ItemStack getRepresentation()
{
return _representation;
}
public String getDisplayName()
{
return _displayName;
}
private void announceSteal(Player cap, boolean steal)
{
if (steal)
UtilTextMiddle.display("", _host.GetTeam(cap).GetColor() + cap.getName() + C.cWhite + " stole " + _team.GetColor() + _team.GetName() + " Flag!", 0, 60, 10);
else
UtilTextMiddle.display("", _host.GetTeam(cap).GetColor() + cap.getName() + C.cWhite + " picked up " + _team.GetColor() + _team.GetName() + " Flag!", 0, 60, 10);
}
private void announceDrop(Player player)
{
UtilTextMiddle.display("", _enemy + player.getName() + C.cWhite + " dropped " + _team.GetColor() + _team.GetName() + " Flag!", 0, 60, 10);
}
private void announceCapture(Player player)
{
UtilTextMiddle.display("", _host.GetTeam(player).GetColor() + player.getName() + C.cWhite + " scored for " + _host.GetTeam(player).GetColor() + _host.GetTeam(player).GetName(), 0, 60, 10);
}
private void announceReturn()
{
UtilTextMiddle.display("", _team.GetColor() + _team.GetName() + " Flag " + C.cWhite + " has returned to base", 0, 60, 10);
}
public void update()
{
if (!_moved || _dropped)
{
_flagBlock.setType(Material.STANDING_BANNER);
Banner banner = (Banner) _flagBlock.getState();
banner.setBaseColor(_dyeData);
banner.setPatterns(_patterns);
banner.update();
}
if (_moved)
{
if (_dropped)
{
Integer r = Math.max(0, _respawnTimer);
_time.setText(remainColor(r) + r.toString());
if (_respawnTimer > -1)
return;
deleteFlag();
_moved = false;
_dropped = false;
spawnFlag(_spawn);
announceReturn();
UtilFirework.playFirework(_spawn.clone().add(0, 1, 0), FireworkEffect.builder().flicker(false).withColor(_team.GetColorBase()).with(Type.BURST).trail(true).build());
return;
}
if (_holding == null)
return;
while (UtilMath.offset(_particleLoc, _holding.getEyeLocation().clone().add(0.0, 0.5, 0.0)) > .2)
{
if (_team.GetColor() == ChatColor.RED)
{
for (int i = 0 ; i < 2 ; i++)
UtilParticle.PlayParticle(ParticleType.RED_DUST, _particleLoc, 0, 0, 0, 0, 1,
ViewDist.MAX, UtilServer.getPlayers());
}
else
{
for (int i = 0 ; i < 2 ; i++)
UtilParticle.PlayParticle(ParticleType.RED_DUST, _particleLoc, -1, 1, 1, 1, 0,
ViewDist.MAX, UtilServer.getPlayers());
}
_particleLoc.add(UtilAlg.getTrajectory(_particleLoc, _holding.getEyeLocation().clone().add(0.0, 0.5, 0.0)).multiply(.2));
}
if (_host.GetTeam(_holding).GetColor() == ChatColor.RED)
_holding.setCompassTarget(_host.getRedFlag());
else
_holding.setCompassTarget(_host.getBlueFlag());
if (!_holding.hasPotionEffect(PotionEffectType.SLOW))
_holding.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 1000000, 1));
//_holding.getWorld().playSound(_holding.getLocation(), Sound.NOTE_STICKS, 2f, 1f);
score(_holding);
}
}
public void handleRespawn()
{
if (_moved)
{
if (_dropped)
{
_respawnTimer = _respawnTimer - 1;
}
else
{
if (_respawnTimer < 15)
_respawnTimer = _respawnTimer + 1;
}
}
}
public void handleBottomInfo(boolean flicker, ChatColor color)
{
if (_holding != null)
{
if (flicker)
UtilTextBottom.display(color + "Return the Flag to your Capture Zone!", _holding);
else
UtilTextBottom.display("Return the Flag to your Capture Zone!", _holding);
}
}
private ChatColor remainColor(int remain)
{
if (remain >= 9) return ChatColor.GREEN;
if ((remain < 9) && (remain >= 6)) return ChatColor.YELLOW;
return ChatColor.RED;
}
@SuppressWarnings("deprecation")
public void spawnFlag(Location loc)
{
while (!UtilBlock.airFoliage(loc.getBlock().getRelative(BlockFace.DOWN)))
loc.add(0, -1, 0);
while (!UtilBlock.airFoliage(loc.getBlock()))
loc.add(0, 1, 0);
_flagBlock = loc.getBlock();
_host.getArcadeManager().getClassManager().GetSkillFactory().BlockRestore().Restore(_flagBlock);
_priorBlock = loc.getBlock().getType();
_priorData = loc.getBlock().getData();
_flagBlock.setType(Material.STANDING_BANNER);
Banner banner = (Banner) _flagBlock.getState();
banner.setBaseColor(_dyeData);
banner.setPatterns(_patterns);
banner.update();
if (!_moved)
{
_name.setLocation(loc.getBlock().getLocation().clone().add(0.5, 3, 0.5));
_name.start();
_beacon.getBlock().setType(Material.BEACON);
_respawnTimer = 15;
}
else
{
_name.setLocation(loc.getBlock().getLocation().clone().add(0.5, 3, 0.5));
_name.start();
Integer re = Math.max(0, _respawnTimer);
_time.setText(remainColor(re) + re.toString());
_time.setLocation(loc.getBlock().getLocation().clone().add(0.5, 2.5, 0.5));
_time.start();
}
}
@SuppressWarnings("deprecation")
private void deleteFlag()
{
_flagBlock.setType(_priorBlock);
_flagBlock.setData(_priorData);
_beacon.getBlock().setType(Material.WOOL);
_beacon.getBlock().setData(_dyeData.getWoolData());
_name.stop();
_time.stop();
}
public boolean pickup(Player player)
{
if (_holding == null)
{
if (!UtilPlayer.isSpectator(player))
{
if (_host.IsAlive(player))
{
if (_host.GetTeam(player) != _team)
{
if (_dropped)
{
if (!UtilTime.elapsed(_dropTime, 3000))
return false;
}
deleteFlag();
_host.saveInventory(player);
for (int i = 0; i < 9; i++)
player.getInventory().setItem(i, _representation);
ItemStack compass = new ItemStack(Material.COMPASS);
ItemMeta im = compass.getItemMeta();
im.setDisplayName(C.cDAqua + "Your Base");
compass.setItemMeta(im);
player.getInventory().setItem(4, compass);
player.getInventory().setHelmet(_representation);
player.updateInventory();
player.getInventory().setHeldItemSlot(4);
for (PotionEffect effect : player.getActivePotionEffects())
player.removePotionEffect(effect.getType());
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 1000000, 1));
player.setPassenger(null);
if (_moved)
announceSteal(player, false);
else
announceSteal(player, true);
_particleLoc = player.getEyeLocation().clone().add(0.0, 0.5, 0.0);
_holding = player;
_dropped = false;
_dropTime = 0;
_moved = true;
return true;
}
}
}
}
return false;
}
public void drop(Player player)
{
if (_moved)
{
if (_holding != null)
{
if (_holding.getUniqueId() == player.getUniqueId())
{
spawnFlag(player.getLocation());
announceDrop(player);
_holding = null;
_dropped = true;
_dropTime = System.currentTimeMillis();
}
}
}
}
public void score(Player player)
{
if (_moved)
{
if (_holding != null)
{
if (_holding.getUniqueId() == player.getUniqueId())
{
if (_team.GetColor() == ChatColor.RED)
if (!_host.isInZone(player.getLocation(), false)) return;
if (_team.GetColor() == ChatColor.BLUE)
if (!_host.isInZone(player.getLocation(), true)) return;
if (!_host.isAtHome(_team.GetColor() == ChatColor.RED ? ChatColor.BLUE : ChatColor.RED))
{
if (Recharge.Instance.use(player, "No Cap Message", 1000, false, false))
UtilTextMiddle.display("", C.cRed + "Your flag must be at home to capture!", player);
return;
}
_host.resetInventory(player);
announceCapture(player);
_host.AddGems(player, 10, "Enemy Flag Captured", true, true);
PlayerCaptureFlagEvent event = new PlayerCaptureFlagEvent(player);
Bukkit.getPluginManager().callEvent(event);
_host.addCapture(_host.GetTeam(player));
_moved = false;
_dropped = false;
_dropTime = 0;
spawnFlag(_spawn);
_holding = null;
}
}
}
}
}

View File

@ -0,0 +1,31 @@
package nautilus.game.arcade.game.games.common.ctf_data;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class PlayerCaptureFlagEvent extends Event
{
private static final HandlerList handlers = new HandlerList();
private Player _player;
public PlayerCaptureFlagEvent(Player player)
{
_player = player;
}
public HandlerList getHandlers()
{
return handlers;
}
public static HandlerList getHandlerList()
{
return handlers;
}
public Player GetPlayer()
{
return _player;
}
}

View File

@ -452,4 +452,25 @@ public class CapturePoint
Host.AddGems(player, amount / 25d, "Control Point Score", true, true);
Host.GetStats(player).CaptureScore += amount;
}
public Location getLocation()
{
return _loc.clone();
}
public String getRadarTag()
{
String out = "";
if (_owner != null)
{
if (_owner.GetColor() == ChatColor.BLUE)
out += ChatColor.AQUA;
else
out += _owner.GetColor();
}
return out + _name.substring(0, Math.min(1, _name.length()));
}
}

View File

@ -68,12 +68,18 @@ public class Emerald
public void Pickup(Player player, Item item)
{
if (!Host.IsLive())
return;
if (_ent == null)
return;
if (!_ent.equals(item))
return;
if (_ent.getTicksLived() <= 40)
return;
if (!Host.IsAlive(player))
return;

View File

@ -68,12 +68,18 @@ public class Resupply
public void Pickup(Player player, Item item)
{
if (!Host.IsLive())
return;
if (_ent == null)
return;
if (!_ent.equals(item))
return;
if (_ent.getTicksLived() <= 40)
return;
if (!Host.IsAlive(player))
return;

View File

@ -200,7 +200,7 @@ public class DragonEscape extends SoloGame
@EventHandler
public void Invisibility(PlayerKitGiveEvent event)
{
Manager.GetCondition().Factory().Invisible(GetName(), event.GetPlayer(), event.GetPlayer(), 40, 0, false, false, false);
Manager.GetCondition().Factory().Invisible(GetName(), event.getPlayer(), event.getPlayer(), 40, 0, false, false, false);
}
@EventHandler

View File

@ -339,45 +339,45 @@ public class MineStrike extends TeamGame
@EventHandler
public void giveStartEquipment(PlayerKitGiveEvent event)
{
GameTeam team = GetTeam(event.GetPlayer());
GameTeam team = GetTeam(event.getPlayer());
if (team == null)
return;
if (team.GetColor() == ChatColor.RED)
{
if (IsAlive(event.GetPlayer()))
if (IsAlive(event.getPlayer()))
{
//Pistol
Gun gun = new Gun(GunStats.GLOCK_18);
registerGun(gun, event.GetPlayer());
gun.giveToPlayer(event.GetPlayer(), true);
registerGun(gun, event.getPlayer());
gun.giveToPlayer(event.getPlayer(), true);
//Knife
event.GetPlayer().getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, "Knife"));
event.getPlayer().getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, "Knife"));
//Armor
giveTeamArmor(event.GetPlayer(), Color.fromRGB(255, 0, 0));
giveTeamArmor(event.getPlayer(), Color.fromRGB(255, 0, 0));
}
}
else if (team.GetColor() == ChatColor.AQUA)
{
if (IsAlive(event.GetPlayer()))
if (IsAlive(event.getPlayer()))
{
//Pistol
Gun gun = new Gun(GunStats.P2000);
registerGun(gun, event.GetPlayer());
gun.giveToPlayer(event.GetPlayer(), true);
registerGun(gun, event.getPlayer());
gun.giveToPlayer(event.getPlayer(), true);
//Knife
event.GetPlayer().getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, "Knife"));
event.getPlayer().getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, "Knife"));
//Armor
giveTeamArmor(event.GetPlayer(), Color.fromRGB(0, 0, 255));
giveTeamArmor(event.getPlayer(), Color.fromRGB(0, 0, 255));
}
}
//Enter Shop
_shopManager.enterShop(event.GetPlayer());
_shopManager.enterShop(event.getPlayer());
}
@EventHandler(priority = EventPriority.MONITOR)

View File

@ -580,7 +580,7 @@ public class TurfForts extends TeamGame
@EventHandler(ignoreCancelled = true)
public void onSpawn(PlayerKitGiveEvent event)
{
Player player = event.GetPlayer();
Player player = event.getPlayer();
if (this.playersThatNeedBlocks.contains(player.getUniqueId()))
{
this.playersThatNeedBlocks.remove(player.getUniqueId());

View File

@ -1,6 +1,15 @@
package nautilus.game.arcade.kit;
import org.bukkit.Bukkit;
import mineplex.core.achievement.Achievement;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import nautilus.game.arcade.ArcadeFormat;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.events.PlayerKitGiveEvent;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Entity;
@ -12,17 +21,6 @@ import org.bukkit.entity.Skeleton.SkeletonType;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
import mineplex.core.achievement.Achievement;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import nautilus.game.arcade.ArcadeFormat;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.events.PlayerKitGiveEvent;
public abstract class Kit implements Listener
{
public ArcadeManager Manager;

View File

@ -100,6 +100,7 @@ public class GameHostManager implements Listener
//Hero Games
heroGames.add(GameType.ChampionsDominate);
heroGames.add(GameType.ChampionsTDM);
heroGames.add(GameType.ChampionsCTF);
heroGames.add(GameType.HideSeek);
heroGames.add(GameType.Draw);

View File

@ -7,6 +7,7 @@ import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTabTitle;
import mineplex.core.donation.Donor;
import mineplex.core.recharge.Recharge;
@ -15,6 +16,7 @@ import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.PlayerKitApplyEvent;
import nautilus.game.arcade.events.PlayerStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.Game.GameState;
@ -29,7 +31,6 @@ import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@ -316,58 +317,65 @@ public class GamePlayerManager implements Listener
public void KitClick(final Player player, final Kit kit, final Entity entity)
{
kit.DisplayDesc(player);
if (Manager.GetGame() == null)
return;
if (!Manager.GetGame().HasKit(kit))
return;
Donor donor = Manager.GetDonation().Get(player.getName());
if (kit.GetAvailability() == KitAvailability.Free || //Free
Manager.hasKitsUnlocked(player) || //YouTube
(kit.GetAvailability() == KitAvailability.Achievement && //Achievement
Manager.GetAchievement().hasCategory(player, kit.getAchievementRequirement())) ||
donor.OwnsUnknownPackage(Manager.GetGame().GetType().GetKitGameName() + " " + kit.GetName()) || //Green
Manager.GetClients().Get(player).GetRank().has(Rank.MAPDEV) || //STAFF
donor.OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA") || //Single Ultra (Old)
Manager.GetServerConfig().Tournament) //Tournament
PlayerKitApplyEvent kitEvent = new PlayerKitApplyEvent(Manager.GetGame(), kit, player);
UtilServer.getServer().getPluginManager().callEvent(kitEvent);
if (!kitEvent.isCancelled())
{
Manager.GetGame().SetKit(player, kit, true);
}
else if (kit.GetAvailability() == KitAvailability.Gem && donor.GetBalance(CurrencyType.Gems) >= kit.GetCost())
{
Manager.GetShop().openPageForPlayer(player, new ConfirmationPage<ArcadeManager, ArcadeShop>(
Manager, Manager.GetShop(), Manager.GetClients(), Manager.GetDonation(), new Runnable()
kit.DisplayDesc(player);
if (Manager.GetGame() == null)
return;
if (!Manager.GetGame().HasKit(kit))
return;
Donor donor = Manager.GetDonation().Get(player.getName());
if (kit.GetAvailability() == KitAvailability.Free || //Free
Manager.hasKitsUnlocked(player) || //YouTube
(kit.GetAvailability() == KitAvailability.Achievement && //Achievement
Manager.GetAchievement().hasCategory(player, kit.getAchievementRequirement())) ||
donor.OwnsUnknownPackage(Manager.GetGame().GetType().GetKitGameName() + " " + kit.GetName()) || //Green
Manager.GetClients().Get(player).GetRank().has(Rank.MAPDEV) || //STAFF
donor.OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA") || //Single Ultra (Old)
Manager.GetServerConfig().Tournament) //Tournament
{
public void run()
{
if (player.isOnline())
{
Manager.GetGame().SetKit(player, kit, true);
UtilPlayer.sendPacket(player, new PacketPlayOutEntityMetadata(entity.getEntityId(), ((CraftEntity) entity).getHandle().getDataWatcher(), true));
}
}
}, null, new KitPackage(Manager.GetGame().GetType().GetKitGameName(), kit), CurrencyType.Gems, player));
}
else if (kit.GetAvailability() == KitAvailability.Achievement)
{
UtilPlayer.message(player, F.main("Kit", "You have not unlocked all " + F.elem(C.cPurple + Manager.GetGame().GetName() + " Achievements") + "."));
Manager.GetGame().SetKit(player, kit, true);
}
else if (kit.GetAvailability() == KitAvailability.Gem && donor.GetBalance(CurrencyType.Gems) >= kit.GetCost())
{
Manager.GetShop().openPageForPlayer(player, new ConfirmationPage<ArcadeManager, ArcadeShop>(
Manager, Manager.GetShop(), Manager.GetClients(), Manager.GetDonation(), new Runnable()
{
public void run()
{
if (player.isOnline())
{
Manager.GetGame().SetKit(player, kit, true);
UtilPlayer.sendPacket(player, new PacketPlayOutEntityMetadata(entity.getEntityId(), ((CraftEntity) entity).getHandle().getDataWatcher(), true));
}
}
}, null, new KitPackage(Manager.GetGame().GetType().GetKitGameName(), kit), CurrencyType.Gems, player));
}
else if (kit.GetAvailability() == KitAvailability.Achievement)
{
UtilPlayer.message(player, F.main("Kit", "You have not unlocked all " + F.elem(C.cPurple + Manager.GetGame().GetName() + " Achievements") + "."));
}
else
{
player.playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 0.5f);
UtilPlayer.message(player, F.main("Kit", "You do not have enough " + F.elem(C.cGreen + "Gems") + "."));
}
}
else
{
player.playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 0.5f);
UtilPlayer.message(player, F.main("Kit", "You do not have enough " + F.elem(C.cGreen + "Gems") + "."));
}
UtilPlayer.message(player, F.main("Game", kitEvent.getCancelMessage()));
}
@EventHandler(priority = EventPriority.HIGHEST)
@ -415,4 +423,4 @@ public class GamePlayerManager implements Listener
player.teleport(target);
}
}
}
}

View File

@ -0,0 +1,29 @@
package nautilus.game.arcade.stats;
import nautilus.game.arcade.game.games.common.CaptureTheFlag;
import nautilus.game.arcade.game.games.common.ctf_data.PlayerCaptureFlagEvent;
import org.bukkit.event.EventHandler;
public class CapturesStatTracker extends StatTracker<CaptureTheFlag>
{
private final String _stat;
public CapturesStatTracker(CaptureTheFlag game, String stat)
{
super(game);
_stat = stat;
}
@EventHandler
public void onCapture(PlayerCaptureFlagEvent event)
{
addStat(event.GetPlayer(), getStat(), 1, false, false);
}
public String getStat()
{
return _stat;
}
}

View File

@ -0,0 +1,37 @@
package nautilus.game.arcade.stats;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.common.CaptureTheFlag;
import nautilus.game.arcade.game.games.common.ctf_data.CarrierCombatDeathEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
public class ClutchStatTracker extends StatTracker<CaptureTheFlag>
{
private final String _stat;
public ClutchStatTracker(CaptureTheFlag game, String stat)
{
super(game);
_stat = stat;
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CarrierCombatDeathEvent event)
{
if (getGame().GetState() != Game.GameState.Live)
return;
if (!getGame().isSuddenDeath())
return;
addStat(event.GetPlayer(true), getStat(), 1, false, false);
}
public String getStat()
{
return _stat;
}
}