Merge pull request #145 from Mineplex-LLC/develop
Merge 'develop' into 'project-cosmetics'
This commit is contained in:
commit
2121d736a6
@ -1617,4 +1617,35 @@ public class UtilBlock
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static boolean water(Material type)
|
||||
{
|
||||
return type == Material.WATER || type == Material.STATIONARY_WATER;
|
||||
}
|
||||
|
||||
public static boolean lava(Material type)
|
||||
{
|
||||
return type == Material.LAVA || type == Material.STATIONARY_LAVA;
|
||||
}
|
||||
|
||||
public static boolean liquid(Material type)
|
||||
{
|
||||
return water(type) || lava(type);
|
||||
}
|
||||
|
||||
public static boolean water(Block block)
|
||||
{
|
||||
return water(block.getType());
|
||||
}
|
||||
|
||||
public static boolean lava(Block block)
|
||||
{
|
||||
return lava(block.getType());
|
||||
}
|
||||
|
||||
public static boolean liquid(Block block)
|
||||
{
|
||||
return liquid(block.getType());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -22,9 +22,9 @@ public class TestRank extends CommandBase<CoreClientManager>
|
||||
@Override
|
||||
public void Execute(final Player caller, String[] args)
|
||||
{
|
||||
if (!Plugin.Get(caller).GetRank(true).has(Rank.JNR_DEV))
|
||||
if (!Plugin.Get(caller).GetRank(true).has(Rank.SNR_MODERATOR))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Permissions", "This requires Permission Rank [" + Rank.JNR_DEV.getTag(false, true) + C.cGray + "]."));
|
||||
UtilPlayer.message(caller, F.main("Permissions", "This requires Permission Rank [" + Rank.SNR_MODERATOR.getTag(false, true) + C.cGray + "]."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -65,6 +65,14 @@ public class TestRank extends CommandBase<CoreClientManager>
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), ChatColor.RED + "" + ChatColor.BOLD + "Invalid rank!"));
|
||||
return;
|
||||
}
|
||||
if (Plugin.Get(caller).GetRank(true) == Rank.SNR_MODERATOR)
|
||||
{
|
||||
if (tempRank.has(Rank.TWITCH))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Command", "You can only test Player ranks!"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Plugin.Get(caller).SetRank(tempRank, true);
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Your rank has been set to " + tempRank.getTag(false, false) + C.cGray + "!"));
|
||||
|
@ -714,6 +714,67 @@ public enum Achievement
|
||||
new int[]{1},
|
||||
AchievementCategory.MINE_STRIKE),
|
||||
|
||||
//Bawk Bawk Battles
|
||||
BAWK_BAWK_BATTLES_VETERAN("Veteran", 1000,
|
||||
new String[]{"Bawk Bawk Battles.Veteran"},
|
||||
new String[]{"Win 50 games of Bawk Bawk Battles"},
|
||||
new int[] {50},
|
||||
AchievementCategory.BAWK_BAWK_BATTLES),
|
||||
|
||||
BAWK_BAWK_BATTLES_PINATA_MASTER("Pinata Master", 1000,
|
||||
new String[]{"Bawk Bawk Battles.PinataMaster"},
|
||||
new String[]{C.cGray + "Chicken Shooting Challenge", "Shoot 500 chickens"},
|
||||
new int[] {500},
|
||||
AchievementCategory.BAWK_BAWK_BATTLES),
|
||||
|
||||
BAWK_BAWK_BATTLES_SURF_UP("Surf Up", 1000,
|
||||
new String[]{"Bawk Bawk Battles.SurfUp"},
|
||||
new String[]{C.cGray + "Wave Crush Challenge", "Avoid 500 waves"},
|
||||
new int[] {500},
|
||||
AchievementCategory.BAWK_BAWK_BATTLES),
|
||||
|
||||
BAWK_BAWK_BATTLES_MILK_MAN("Milk Man", 600,
|
||||
new String[]{"Bawk Bawk Battles.MilkMan"},
|
||||
new String[]{C.cGray + "Milk A Cow Challenge", "Deliver 300 buckets of milk to the farmer"},
|
||||
new int[] {300},
|
||||
AchievementCategory.BAWK_BAWK_BATTLES),
|
||||
|
||||
BAWK_BAWK_BATTLES_DRAGON_KING("Dragon King", 600,
|
||||
new String[]{"Bawk Bawk Battles.DragonKing"},
|
||||
new String[]{C.cGray + "Egg Smash Challenge", "Smash 300 dragon eggs"},
|
||||
new int[] {300},
|
||||
AchievementCategory.BAWK_BAWK_BATTLES),
|
||||
|
||||
BAWK_BAWK_BATTLES_PIXEL_NINJA("Pixel Ninja", 200,
|
||||
new String[]{"Bawk Bawk Battles.PixelNinja"},
|
||||
new String[]{C.cGray + "Falling Blocks Challenge", "Dodge 100 waves of falling blocks"},
|
||||
new int[] {100},
|
||||
AchievementCategory.BAWK_BAWK_BATTLES),
|
||||
|
||||
BAWK_BAWK_BATTLES_ELITE_ARCHER("Elite Archer", 200,
|
||||
new String[]{"Bawk Bawk Battles.EliteArcher"},
|
||||
new String[]{C.cGray + "Mini OITQ Challenge", "Kill 100 players"},
|
||||
new int[] {100},
|
||||
AchievementCategory.BAWK_BAWK_BATTLES),
|
||||
|
||||
BAWK_BAWK_BATTLES_TAG_MASTER("Tag Master", 500,
|
||||
new String[]{"Bawk Bawk Battles.TagMaster"},
|
||||
new String[]{C.cGray + "Reverse Tag Challenge", "Win 5 entire rounds", "without being untagged"},
|
||||
new int[] {5},
|
||||
AchievementCategory.BAWK_BAWK_BATTLES),
|
||||
|
||||
BAWK_BAWK_BATTLES_SPEEDY_BUILDERS("Speedy Builders", 500,
|
||||
new String[]{"Bawk Bawk Battles.SpeedyBuilders"},
|
||||
new String[]{C.cGray + "Build Race Challenge", "Place all blocks in your", "inventory within 15 seconds"},
|
||||
new int[] {3},
|
||||
AchievementCategory.BAWK_BAWK_BATTLES),
|
||||
|
||||
// BAWK_BAWK_BATTLES_BOUNCING_SHADOW("Bouncing Shadow", 500,
|
||||
// new String[]{"Bawk Bawk Battles.BouncingShadow"},
|
||||
// new String[]{C.cGray + "Bouncing Block Challenge", "Win 3 entire rounds", "without stepping on red wool"},
|
||||
// new int[] {3},
|
||||
// AchievementCategory.BAWK_BAWK_BATTLES),
|
||||
|
||||
//Bomb Lobbers
|
||||
BOMB_LOBBERS_WINS("Master Bomber", 1200,
|
||||
new String[]{"Bomb Lobbers.Wins"},
|
||||
|
@ -2,6 +2,10 @@ package mineplex.core.achievement;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
@ -10,10 +14,6 @@ import mineplex.core.game.GameDisplay;
|
||||
import mineplex.core.stats.PlayerStats;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public enum AchievementCategory
|
||||
{
|
||||
GLOBAL("Global", null,
|
||||
@ -62,6 +62,10 @@ public enum AchievementCategory
|
||||
new StatDisplay("Kills as Undead"), new StatDisplay("Deaths as Undead"), StatDisplay.GEMS_EARNED },
|
||||
Material.DIAMOND_CHESTPLATE, 0, GameCategory.CLASSICS, null, false, GameDisplay.CastleSiege.getGameId()),
|
||||
|
||||
BAWK_BAWK_BATTLES("Bawk Bawk Battles", null,
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED },
|
||||
Material.EGG, 0, GameCategory.CLASSICS, null, false, GameDisplay.BawkBawkBattles.getGameId()),
|
||||
|
||||
BLOCK_HUNT("Block Hunt", null,
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||
Material.GRASS, 0, GameCategory.CLASSICS, "Infestor Kit", false, GameDisplay.HideSeek.getGameId()),
|
||||
|
@ -46,7 +46,7 @@ public class AchievementMainPage extends ShopPageBase<AchievementManager, Achiev
|
||||
protected void buildPage()
|
||||
{
|
||||
ArrayList<Integer> pageLayout = new ItemLayout(
|
||||
"XXXXOXXXO",
|
||||
"XXXXOXOXO",
|
||||
"OXOXOXOXO",
|
||||
"OXOXOXOXO",
|
||||
"OXOXOXOXO").getItemSlots();
|
||||
|
@ -71,7 +71,7 @@ public class YoutubeButton implements GuiItem
|
||||
message = "Click here to visit our YouTube page!";
|
||||
}
|
||||
|
||||
new JsonMessage(C.cAquaB + message).click(ClickEvent.OPEN_URL, "https://www.youtube.com/mineplexgamesofficial").sendToPlayer(_player);
|
||||
new JsonMessage(C.cAquaB + message).click(ClickEvent.OPEN_URL, "http://youtube.com/mineplexgamesofficial?sub_confirmation=1").sendToPlayer(_player);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -6,6 +6,7 @@ import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.boosters.command.BoosterCommand;
|
||||
import mineplex.core.boosters.event.BoosterActivateEvent;
|
||||
import mineplex.core.boosters.event.BoosterExpireEvent;
|
||||
import mineplex.core.boosters.event.BoosterItemGiveEvent;
|
||||
import mineplex.core.boosters.event.BoosterUpdateEvent;
|
||||
import mineplex.core.boosters.gui.BoosterShop;
|
||||
import mineplex.core.boosters.redis.BoosterUpdateRepository;
|
||||
@ -14,6 +15,7 @@ import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
@ -361,6 +363,11 @@ public class BoosterManager extends MiniPlugin
|
||||
{
|
||||
if (_giveInterfaceItem && !UtilGear.isMat(player.getInventory().getItem(INTERFACE_SLOT), Material.EMERALD))
|
||||
{
|
||||
BoosterItemGiveEvent event = new BoosterItemGiveEvent(player);
|
||||
UtilServer.CallEvent(event);
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
player.getInventory().setItem(INTERFACE_SLOT, INTERFACE_ITEM);
|
||||
|
||||
UtilInv.Update(player);
|
||||
|
@ -0,0 +1,48 @@
|
||||
package mineplex.core.boosters.event;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a player is about to receive a booster gem. If cancelled the player will not receive said gem
|
||||
*/
|
||||
public class BoosterItemGiveEvent extends Event implements Cancellable
|
||||
{
|
||||
private Player _player;
|
||||
private boolean _cancelled;
|
||||
|
||||
public BoosterItemGiveEvent(Player player)
|
||||
{
|
||||
this._player = player;
|
||||
}
|
||||
|
||||
public Player getPlayer()
|
||||
{
|
||||
return this._player;
|
||||
}
|
||||
|
||||
public boolean isCancelled()
|
||||
{
|
||||
return this._cancelled;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancelled)
|
||||
{
|
||||
this._cancelled = cancelled;
|
||||
}
|
||||
|
||||
private static final HandlerList _handlers = new HandlerList();
|
||||
|
||||
private static HandlerList getHandlerList()
|
||||
{
|
||||
return _handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return getHandlerList();
|
||||
}
|
||||
}
|
@ -51,7 +51,7 @@ public class FountainManager extends MiniPlugin
|
||||
|
||||
World world = Bukkit.getWorlds().get(0);//-43.5, 66, -38.5
|
||||
|
||||
int goal = !new File("eu.dat").exists() ? 300000000 : 5000000;
|
||||
int goal = !new File("eu.dat").exists() ? 200000000 : 20000000;
|
||||
_gemFountain = new Fountain(new Location(world, -32.5, 72, -23.5), new Location(world, -43.5, 67, -38.5),
|
||||
C.cGreen + "Gem Fountain", "GemFountain_01", goal, this, clientManager, donationManager, _hologramManager, _statsManager);
|
||||
}
|
||||
|
@ -303,7 +303,7 @@ public abstract class WinEffectGadget extends Gadget
|
||||
public Schematic pasteScematic(String schematicName) {
|
||||
try
|
||||
{
|
||||
Schematic schematic = UtilSchematic.loadSchematic(new File("schematic" + File.separator + schematicName + ".schematic"));
|
||||
Schematic schematic = UtilSchematic.loadSchematic(new File("../../update/schematic/" + schematicName + ".schematic"));
|
||||
if (schematic != null)
|
||||
schematic.paste(getBaseLocation(), false, true);
|
||||
return schematic;
|
||||
|
@ -32,7 +32,7 @@ public enum GameDisplay
|
||||
Micro("Micro Battle", Material.LAVA_BUCKET, (byte)0, GameCategory.ARCADE, 24),
|
||||
MilkCow("Milk the Cow", Material.MILK_BUCKET, (byte)0, GameCategory.ARCADE, 27),
|
||||
MineStrike("MineStrike", Material.TNT, (byte)0, GameCategory.CHAMPIONS, 25),// Temp set to CHAMPIONS to fix UI bug
|
||||
MineWare("MineWare", Material.PAPER, (byte)0, GameCategory.EXTRA, 26),
|
||||
BawkBawkBattles("Bawk Bawk Battles", Material.EGG, (byte)0, GameCategory.EXTRA, 26),
|
||||
OldMineWare("Old MineWare", Material.PAPER, (byte)0, GameCategory.EXTRA, 26),
|
||||
Paintball("Super Paintball", Material.ENDER_PEARL, (byte)0, GameCategory.ARCADE, 28),
|
||||
Quiver("One in the Quiver", Material.ARROW, (byte)0, GameCategory.ARCADE, 29),
|
||||
|
@ -16,7 +16,6 @@ import mineplex.core.globalpacket.command.GlobalPacketCommand;
|
||||
import mineplex.core.globalpacket.listeners.GlobalGiveCoins;
|
||||
import mineplex.core.globalpacket.listeners.GlobalGiveGems;
|
||||
import mineplex.core.globalpacket.listeners.GlobalGiveItem;
|
||||
import mineplex.core.globalpacket.listeners.GlobalRawr;
|
||||
import mineplex.core.globalpacket.redis.GlobalPacketHandler;
|
||||
import mineplex.core.globalpacket.redis.GlobalPacketMessage;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
@ -49,7 +48,6 @@ public class GlobalPacketManager extends MiniPlugin
|
||||
getPluginManager().registerEvents(new GlobalGiveItem(inventoryManager, _rewardManager), getPlugin());
|
||||
getPluginManager().registerEvents(new GlobalGiveGems(donationManager), getPlugin());
|
||||
getPluginManager().registerEvents(new GlobalGiveCoins(donationManager, clientManager), getPlugin());
|
||||
getPluginManager().registerEvents(new GlobalRawr(), getPlugin());
|
||||
}
|
||||
|
||||
public void callGlobalCommand(Player caller, String[] args)
|
||||
|
@ -1,50 +0,0 @@
|
||||
package mineplex.core.globalpacket.listeners;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.globalpacket.event.GlobalPacketEvent;
|
||||
|
||||
/**
|
||||
* Created by William (WilliamTiger).
|
||||
* 18/11/15
|
||||
*/
|
||||
public class GlobalRawr implements Listener
|
||||
{
|
||||
|
||||
@EventHandler
|
||||
public void globalRawr(GlobalPacketEvent e)
|
||||
{
|
||||
if (e.getParts() == null || e.getParts().length < 1)
|
||||
return;
|
||||
|
||||
if (!e.getParts()[0].equalsIgnoreCase("rawr"))
|
||||
return;
|
||||
|
||||
if (e.getParts().length < 2)
|
||||
{
|
||||
if (e.getCaller() != null)
|
||||
UtilPlayer.message(e.getCaller(), F.main("Global", "/global rawr <msg>"));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
String msg = "";
|
||||
for (int i = 1; i < e.getParts().length; i++)
|
||||
{
|
||||
msg += e.getParts()[i] + " ";
|
||||
}
|
||||
msg = msg.trim();
|
||||
|
||||
for (Player p : UtilServer.getPlayers())
|
||||
{
|
||||
UtilTextMiddle.display("§6§lRAWR!", "§e" + msg, p);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,12 +1,8 @@
|
||||
package mineplex.core.packethandler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.mineplex.spigot.PacketProcessor;
|
||||
import mineplex.core.MiniPlugin;
|
||||
import net.minecraft.server.v1_8_R3.Packet;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -15,16 +11,22 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.mineplex.spigot.PacketProcessor;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
|
||||
public class PacketHandler extends MiniPlugin
|
||||
{
|
||||
private NautHashMap<Player, PacketVerifier> _playerVerifierMap = new NautHashMap<Player, PacketVerifier>();
|
||||
private HashMap<Class, ArrayList<IPacketHandler>> _forceMainThread = new HashMap<Class, ArrayList<IPacketHandler>>();
|
||||
private HashMap<Class, ArrayList<IPacketHandler>> _packetHandlers = new HashMap<Class, ArrayList<IPacketHandler>>();
|
||||
private Map<Player, PacketVerifier> _playerVerifierMap = new HashMap<>();
|
||||
|
||||
private Map<Class<? extends Packet>, Set<IPacketHandler>> _forceMainThread = new HashMap<>();
|
||||
private Map<Class<? extends Packet>, Map<ListenerPriority, List<IPacketHandler>>> _packetHandlers = new HashMap<>();
|
||||
|
||||
public PacketHandler(JavaPlugin plugin)
|
||||
{
|
||||
@ -40,18 +42,6 @@ public class PacketHandler extends MiniPlugin
|
||||
.get(event.getPlayer()));
|
||||
}
|
||||
|
||||
public boolean handlePacket(Player player, Packet packet)
|
||||
{
|
||||
if (!_playerVerifierMap.containsKey(player))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
PacketVerifier verifier = _playerVerifierMap.get(player);
|
||||
|
||||
return handlePacket(new PacketInfo(player, packet, verifier));
|
||||
}
|
||||
|
||||
public boolean handlePacket(PacketInfo packetInfo)
|
||||
{
|
||||
if (!_packetHandlers.containsKey(packetInfo.getPacket().getClass()))
|
||||
@ -60,15 +50,18 @@ public class PacketHandler extends MiniPlugin
|
||||
return true;
|
||||
}
|
||||
|
||||
for (IPacketHandler handler : _packetHandlers.get(packetInfo.getPacket().getClass()))
|
||||
for (Entry<ListenerPriority, List<IPacketHandler>> entry : _packetHandlers.get(packetInfo.getPacket().getClass()).entrySet())
|
||||
{
|
||||
try
|
||||
for (IPacketHandler handler : entry.getValue())
|
||||
{
|
||||
handler.handle(packetInfo);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
try
|
||||
{
|
||||
handler.handle(packetInfo);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -90,72 +83,106 @@ public class PacketHandler extends MiniPlugin
|
||||
@SafeVarargs
|
||||
public final void addPacketHandler(IPacketHandler packetHandler, Class<? extends Packet>... packetsToListen)
|
||||
{
|
||||
if (packetsToListen.length == 0)
|
||||
{
|
||||
throw new IllegalArgumentException("When registering a new packet listener, add the packets its going to listen to");
|
||||
}
|
||||
|
||||
addPacketHandler(packetHandler, false, packetsToListen);
|
||||
addPacketHandler(packetHandler, ListenerPriority.NORMAL, false, packetsToListen);
|
||||
}
|
||||
|
||||
/**
|
||||
* This should only be used for incoming packets
|
||||
*/
|
||||
public void addPacketHandler(IPacketHandler packetHandler, boolean forceMainThread,
|
||||
Class<? extends Packet>... packetsToListen)
|
||||
@SafeVarargs
|
||||
public final void addPacketHandler(IPacketHandler packetHandler, boolean forceMainThread, Class<? extends Packet>... packetsToListen)
|
||||
{
|
||||
if (packetsToListen.length == 0)
|
||||
{
|
||||
throw new IllegalArgumentException("When registering a new packet listener, add the packets its going to listen to");
|
||||
}
|
||||
|
||||
for (Class c : packetsToListen)
|
||||
addPacketHandler(packetHandler, ListenerPriority.NORMAL, forceMainThread, packetsToListen);
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
public final void addPacketHandler(IPacketHandler packetHandler, ListenerPriority priority, Class<? extends Packet>... packetsToListen)
|
||||
{
|
||||
if (packetsToListen.length == 0)
|
||||
{
|
||||
throw new IllegalArgumentException("When registering a new packet listener, add the packets its going to listen to");
|
||||
}
|
||||
|
||||
addPacketHandler(packetHandler, priority, false, packetsToListen);
|
||||
}
|
||||
|
||||
/**
|
||||
* This should only be used for incoming packets
|
||||
*/
|
||||
@SafeVarargs
|
||||
public final void addPacketHandler(IPacketHandler packetHandler, ListenerPriority priority, boolean forceMainThread,
|
||||
Class<? extends Packet>... packetsToListen)
|
||||
{
|
||||
if (packetsToListen.length == 0)
|
||||
{
|
||||
throw new IllegalArgumentException("When registering a new packet listener, add the packets its going to listen to");
|
||||
}
|
||||
|
||||
for (Class<? extends Packet> c : packetsToListen)
|
||||
{
|
||||
if (forceMainThread)
|
||||
{
|
||||
if (!_forceMainThread.containsKey(c))
|
||||
{
|
||||
_forceMainThread.put(c, new ArrayList());
|
||||
}
|
||||
|
||||
_forceMainThread.get(c).add(packetHandler);
|
||||
_forceMainThread
|
||||
.computeIfAbsent(c, key -> new HashSet<>())
|
||||
.add(packetHandler);
|
||||
}
|
||||
|
||||
if (!_packetHandlers.containsKey(c))
|
||||
{
|
||||
_packetHandlers.put(c, new ArrayList());
|
||||
}
|
||||
_packetHandlers
|
||||
.computeIfAbsent(c, key -> new TreeMap<>())
|
||||
.computeIfAbsent(priority, key -> new ArrayList<>())
|
||||
.add(packetHandler);
|
||||
|
||||
_packetHandlers.get(c).add(packetHandler);
|
||||
PacketProcessor.addPacket(c, forceMainThread || _forceMainThread.containsKey(c));
|
||||
}
|
||||
}
|
||||
|
||||
public void removePacketHandler(IPacketHandler packetHandler)
|
||||
{
|
||||
Iterator<Entry<Class, ArrayList<IPacketHandler>>> itel = _packetHandlers.entrySet().iterator();
|
||||
Iterator<Entry<Class<? extends Packet>, Map<ListenerPriority, List<IPacketHandler>>>> itel = _packetHandlers.entrySet().iterator();
|
||||
|
||||
while (itel.hasNext())
|
||||
{
|
||||
Entry<Class, ArrayList<IPacketHandler>> entry = itel.next();
|
||||
Entry<Class<? extends Packet>, Map<ListenerPriority, List<IPacketHandler>>> entry = itel.next();
|
||||
|
||||
if (entry.getValue().remove(packetHandler))
|
||||
Set<ListenerPriority> removedFrom = new HashSet<>();
|
||||
|
||||
for (Entry<ListenerPriority, List<IPacketHandler>> ent : entry.getValue().entrySet())
|
||||
{
|
||||
if (_forceMainThread.containsKey(entry.getKey()) && _forceMainThread.get(entry.getKey()).remove(packetHandler))
|
||||
if (ent.getValue().remove(packetHandler))
|
||||
{
|
||||
if (_forceMainThread.get(entry.getKey()).isEmpty())
|
||||
{
|
||||
_forceMainThread.remove(entry.getKey());
|
||||
PacketProcessor.addPacket(entry.getKey(), false);
|
||||
}
|
||||
removedFrom.add(ent.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
if (entry.getValue().isEmpty())
|
||||
for (ListenerPriority priority : removedFrom)
|
||||
{
|
||||
if (entry.getValue().get(priority).isEmpty())
|
||||
{
|
||||
PacketProcessor.removePacket(entry.getKey());
|
||||
itel.remove();
|
||||
entry.getValue().remove(priority);
|
||||
}
|
||||
}
|
||||
|
||||
if (_forceMainThread.containsKey(entry.getKey()) && _forceMainThread.get(entry.getKey()).remove(packetHandler))
|
||||
{
|
||||
if (_forceMainThread.get(entry.getKey()).isEmpty())
|
||||
{
|
||||
_forceMainThread.remove(entry.getKey());
|
||||
PacketProcessor.addPacket(entry.getKey(), false);
|
||||
}
|
||||
}
|
||||
|
||||
if (entry.getValue().isEmpty())
|
||||
{
|
||||
PacketProcessor.removePacket(entry.getKey());
|
||||
itel.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum ListenerPriority
|
||||
{
|
||||
HIGH, NORMAL, LOW
|
||||
}
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ public class PersonalServerManager extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
final ServerGroup serverGroup = new ServerGroup(serverName, serverName, host.getName(), ram, cpu, 1, 0, UtilMath.random.nextInt(250) + 19999, true, "arcade.zip", "Arcade.jar", "plugins/Arcade/", minPlayers, maxPlayers,
|
||||
final ServerGroup serverGroup = new ServerGroup(serverName, serverName, host.getName(), ram, cpu, 1, 0, UtilMath.random.nextInt(250) + 19999, null, true, "arcade.zip", "Arcade.jar", "plugins/Arcade/", minPlayers, maxPlayers,
|
||||
true, false, false, games, "", "", "Player", true, event, false, true, false, true, true, false, false, false, false, true, true, true, false, false, "", _us ? Region.US : Region.EU, "", "", "", "");
|
||||
|
||||
getPlugin().getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable()
|
||||
|
@ -88,6 +88,15 @@ public class ProjectileManager extends MiniPlugin
|
||||
sound, soundVolume, soundPitch, null, 0, effectRate, particle, 0F, 0F, 0F, 0F, 1, hitboxMult));
|
||||
}
|
||||
|
||||
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
|
||||
long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle,
|
||||
Sound sound, float soundVolume, float soundPitch, ParticleType particle, UpdateType effectRate, float hitboxMult, double charge)
|
||||
{
|
||||
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
|
||||
expireTime, hitPlayer, hitNonPlayerEntity, hitBlock, idle, false,
|
||||
sound, soundVolume, soundPitch, null, 0, effectRate, particle, 0F, 0F, 0F, 0F, 1, hitboxMult, charge));
|
||||
}
|
||||
|
||||
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
|
||||
long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle,
|
||||
Sound sound, float soundVolume, float soundPitch, ParticleType particle, float pX, float pY, float pZ, float pS, int pC, UpdateType effectRate, float hitboxMult)
|
||||
@ -133,14 +142,14 @@ public class ProjectileManager extends MiniPlugin
|
||||
}
|
||||
|
||||
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
|
||||
long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle,
|
||||
Sound sound, float soundVolume, float soundPitch, ParticleType particle, UpdateType effectRate, float hitboxMult, List<Player> canHit)
|
||||
long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle,
|
||||
Sound sound, float soundVolume, float soundPitch, ParticleType particle, UpdateType effectRate, float hitboxMult, List<Player> canHit)
|
||||
{
|
||||
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
|
||||
expireTime, hitPlayer, hitNonPlayerEntity, hitBlock, idle, false,
|
||||
sound, soundVolume, soundPitch, null, 0, effectRate, particle, 0F, 0F, 0F, 0F, 1, hitboxMult, canHit));
|
||||
expireTime, hitPlayer, hitNonPlayerEntity, hitBlock, idle, false,
|
||||
sound, soundVolume, soundPitch, null, 0, effectRate, particle, 0F, 0F, 0F, 0F, 1, hitboxMult, canHit));
|
||||
}
|
||||
|
||||
|
||||
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
|
||||
long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle,
|
||||
Sound sound, float soundVolume, float soundPitch, ParticleType particle, float pX, float pY, float pZ, float pS, int pC, UpdateType effectRate, float hitboxMult, List<Player> canHit)
|
||||
|
@ -62,6 +62,8 @@ public class ProjectileUser
|
||||
private UpdateType _effectRate = UpdateType.TICK;
|
||||
|
||||
private double _hitboxGrow;
|
||||
|
||||
private double _charge;
|
||||
|
||||
private List<Player> _canHit;
|
||||
|
||||
@ -104,6 +106,47 @@ public class ProjectileUser
|
||||
_canHit = null;
|
||||
}
|
||||
|
||||
public ProjectileUser(ProjectileManager throwInput, Entity thrown, LivingEntity thrower, IThrown callback,
|
||||
long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle, boolean pickup,
|
||||
Sound sound, float soundVolume, float soundPitch,
|
||||
Effect effect, int effectData, UpdateType effectRate,
|
||||
ParticleType particle, float particleX, float particleY,
|
||||
float particleZ, float particleS, int particleC, double hitboxMult, double charge)
|
||||
{
|
||||
Throw = throwInput;
|
||||
|
||||
_thrown = thrown;
|
||||
_thrower = thrower;
|
||||
_callback = callback;
|
||||
|
||||
_expireTime = expireTime;
|
||||
_startTime = System.currentTimeMillis();
|
||||
|
||||
_hitPlayer = hitPlayer;
|
||||
_hitNonPlayerEntity = hitNonPlayerEntity;
|
||||
_hitBlock = hitBlock;
|
||||
_idle = idle;
|
||||
_pickup = pickup;
|
||||
|
||||
_sound = sound;
|
||||
_soundVolume = soundVolume;
|
||||
_soundPitch = soundPitch;
|
||||
_particle = particle;
|
||||
_particleX = particleX;
|
||||
_particleY = particleY;
|
||||
_particleZ = particleZ;
|
||||
_particleS = particleS;
|
||||
_particleC = particleC;
|
||||
_effect = effect;
|
||||
_effectData = effectData;
|
||||
_effectRate = effectRate;
|
||||
|
||||
_hitboxGrow = hitboxMult;
|
||||
_canHit = null;
|
||||
|
||||
_charge = charge;
|
||||
}
|
||||
|
||||
public ProjectileUser(ProjectileManager throwInput, Entity thrown, LivingEntity thrower, IThrown callback,
|
||||
long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle, boolean pickup,
|
||||
Sound sound, float soundVolume, float soundPitch,
|
||||
@ -142,6 +185,7 @@ public class ProjectileUser
|
||||
_hitboxGrow = hitboxMult;
|
||||
_canHit = canHit;
|
||||
}
|
||||
|
||||
|
||||
public void effect(UpdateEvent event)
|
||||
{
|
||||
@ -311,6 +355,11 @@ public class ProjectileUser
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public double getCharge()
|
||||
{
|
||||
return _charge;
|
||||
}
|
||||
|
||||
public IThrown getIThrown()
|
||||
{
|
||||
|
@ -2,7 +2,10 @@ package mineplex.core.youtube;
|
||||
|
||||
import mineplex.core.MiniDbClientPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
@ -14,6 +17,7 @@ import java.time.ZonedDateTime;
|
||||
|
||||
public class YoutubeManager extends MiniDbClientPlugin<YoutubeClient>
|
||||
{
|
||||
private static final int REWARD_MESSAGE_DELAY_SECONDS = 30;
|
||||
private final YoutubeRepository _repository;
|
||||
private final DonationManager _donationManager;
|
||||
|
||||
@ -48,7 +52,11 @@ public class YoutubeManager extends MiniDbClientPlugin<YoutubeClient>
|
||||
}
|
||||
YoutubeClient client = Get(player);
|
||||
client.setClickDate(ZonedDateTime.now(ZoneOffset.UTC).toLocalDate());
|
||||
_repository.attemptYoutube(player, client, () -> _donationManager.RewardCoinsLater("YouTube", player, 250));
|
||||
_repository.attemptYoutube(player, client, () ->
|
||||
{
|
||||
_donationManager.RewardCoinsLater("YouTube", player, 250);
|
||||
Bukkit.getScheduler().runTaskLater(getClientManager().getPlugin(), () -> UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem("250 Treasure Shards") + " for watching the YouTube video")), REWARD_MESSAGE_DELAY_SECONDS * 20L);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -33,7 +33,7 @@ public class Blink extends SkillActive
|
||||
{
|
||||
private HashMap<Player, Location> _loc = new HashMap<Player, Location>();
|
||||
private HashMap<Player, Long> _blinkTime = new HashMap<Player, Long>();
|
||||
|
||||
|
||||
public Blink(SkillFactory skills, String name, ClassType classType, SkillType skillType,
|
||||
int cost, int levels,
|
||||
int energy, int energyMod,
|
||||
@ -206,6 +206,9 @@ public class Blink extends SkillActive
|
||||
done = true;
|
||||
}
|
||||
|
||||
target.setYaw(player.getLocation().getYaw());
|
||||
target.setPitch(player.getLocation().getPitch());
|
||||
|
||||
player.teleport(target);
|
||||
|
||||
player.setFallDistance(0);
|
||||
|
@ -29,6 +29,7 @@ import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillActive;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||
|
||||
@ -213,10 +214,11 @@ public class Evade extends SkillActive
|
||||
{
|
||||
Player player = activeIter.next();
|
||||
|
||||
if (!player.isOnline() || !player.isBlocking() || UtilTime.elapsed(_active.get(player), 750))
|
||||
if (!player.isOnline() || !player.isBlocking() || UtilTime.elapsed(_active.get(player), 1000))
|
||||
{
|
||||
activeIter.remove();
|
||||
UtilPlayer.message(player, F.main(GetClassType().name(), "You failed to " + F.skill(GetName()) + "."));
|
||||
Recharge.Instance.useForce(player, GetName(), 10000l, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
@ -28,7 +29,6 @@ import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||
import mineplex.minecraft.game.classcombat.Skill.Skill;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
|
||||
import net.minecraft.server.v1_8_R3.Material;
|
||||
|
||||
public class Recall extends Skill
|
||||
{
|
||||
@ -69,6 +69,12 @@ public class Recall extends Skill
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
if (UtilBlock.water(player.getLocation().getBlock()))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
|
||||
return;
|
||||
}
|
||||
|
||||
//Check Allowed
|
||||
SkillTriggerEvent trigger = new SkillTriggerEvent(player, GetName(), GetClassType());
|
||||
Bukkit.getServer().getPluginManager().callEvent(trigger);
|
||||
|
@ -6,12 +6,14 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import mineplex.minecraft.game.classcombat.Skill.Skill;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
|
||||
public class ViperStrikes extends Skill
|
||||
{
|
||||
@ -21,8 +23,8 @@ public class ViperStrikes extends Skill
|
||||
|
||||
SetDesc(new String[]
|
||||
{
|
||||
"Your attacks give enemies",
|
||||
"Shock, Slow 1 and Poison 1",
|
||||
"Your attacks give",
|
||||
"enemies Poison 1",
|
||||
"for #0#1 seconds."
|
||||
});
|
||||
}
|
||||
@ -47,10 +49,9 @@ public class ViperStrikes extends Skill
|
||||
|
||||
LivingEntity damagee = event.GetDamageeEntity();
|
||||
if (damagee == null) return;
|
||||
|
||||
//Confuse
|
||||
Factory.Condition().Factory().PoisonShock(GetName(), damagee, damager, level, false);
|
||||
Factory.Condition().Factory().Slow(GetName(), damagee, damager, level, 0, false, false, true, false);
|
||||
|
||||
Factory.Damage().NewDamageEvent(damagee, damager, null, DamageCause.POISON, 0, false, true, true, damager.getName(), GetName());
|
||||
damagee.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 20 * (2 + level), 0));
|
||||
|
||||
//Sound
|
||||
damager.getWorld().playSound(damager.getLocation(), Sound.SPIDER_IDLE, 1f, 2f);
|
||||
|
@ -9,32 +9,34 @@ import org.bukkit.Effect;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
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.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.ItemSpawnEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.projectile.IThrown;
|
||||
import mineplex.core.projectile.ProjectileUser;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.projectile.IThrown;
|
||||
import mineplex.core.projectile.ProjectileUser;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillCharge;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||
import mineplex.minecraft.game.classcombat.Skill.event.BlockTossExpireEvent;
|
||||
@ -90,7 +92,7 @@ public class BlockToss extends SkillCharge implements IThrown
|
||||
@Override
|
||||
public String GetRechargeString()
|
||||
{
|
||||
return "Recharge: " + "#4#-0.5 Seconds";
|
||||
return "Recharge: " + "#5.5#-0.5 Seconds";
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -193,7 +195,22 @@ public class BlockToss extends SkillCharge implements IThrown
|
||||
//Effect
|
||||
player.getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, block.getMaterial().getId());
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void Damage(EntityDamageByEntityEvent event)
|
||||
{
|
||||
Entity vehicle = event.getEntity().getVehicle();
|
||||
|
||||
if (_holding.containsKey(vehicle))
|
||||
{
|
||||
Player attacker = (Player) event.getDamager();
|
||||
|
||||
//Forward Damage
|
||||
Factory.Damage().NewDamageEvent((Player) vehicle, attacker, Factory.Damage().GetProjectile(event),
|
||||
event.getCause(), event.getDamage(), true, false, false, null, null, event.isCancelled());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Throw(UpdateEvent event)
|
||||
{
|
||||
@ -224,7 +241,7 @@ public class BlockToss extends SkillCharge implements IThrown
|
||||
}
|
||||
|
||||
//Throw
|
||||
if (!cur.isBlocking())
|
||||
if (!cur.isBlocking() || (_charge.containsKey(cur) && _charge.get(cur) >= 1))
|
||||
throwSet.add(cur);
|
||||
|
||||
//Charged Tick
|
||||
@ -241,7 +258,7 @@ public class BlockToss extends SkillCharge implements IThrown
|
||||
for (Player cur : throwSet)
|
||||
{
|
||||
Recharge.Instance.recharge(cur, GetName());
|
||||
Recharge.Instance.use(cur, GetName(), 4000 - (500 * getLevel(cur)), false, true);
|
||||
Recharge.Instance.use(cur, GetName(), 5500 - (500 * getLevel(cur)), false, true);
|
||||
|
||||
FallingBlock block = _holding.remove(cur);
|
||||
float charge = _charge.remove(cur);
|
||||
|
@ -24,7 +24,7 @@ public class CripplingBlow extends Skill
|
||||
{
|
||||
"Your powerful axe attacks give",
|
||||
"targets Slow 2 for 1.5 second,",
|
||||
"as well as 50% less knockback."
|
||||
"as well as 25% less knockback."
|
||||
});
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ public class CripplingBlow extends Skill
|
||||
|
||||
//Damage
|
||||
event.AddMod(damager.getName(), GetName(), 0, true);
|
||||
event.AddKnockback(GetName(), 0.5);
|
||||
event.AddKnockback(GetName(), 0.75);
|
||||
|
||||
//Event
|
||||
UtilServer.getServer().getPluginManager().callEvent(new SkillEvent(damager, GetName(), ClassType.Brute, damagee));
|
||||
|
@ -73,7 +73,7 @@ public class DwarfToss extends SkillActive
|
||||
{
|
||||
if (_used.contains(player))
|
||||
return false;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -96,7 +96,13 @@ public class DwarfToss extends SkillActive
|
||||
{
|
||||
int level = getLevel(player);
|
||||
if (level == 0) return false;
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
//Check Material
|
||||
if (player.getItemInHand() != null)
|
||||
if (!_itemSet.contains(player.getItemInHand().getType()))
|
||||
@ -337,6 +343,9 @@ public class DwarfToss extends SkillActive
|
||||
target.leaveVehicle();
|
||||
final double mult = (1.8) * timeScale;
|
||||
|
||||
//Protection
|
||||
Factory.Condition().Factory().Invulnerable(GetName(), target, target, 1.25, false, false);
|
||||
|
||||
//Delay
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(Factory.getPlugin(), new Runnable()
|
||||
{
|
||||
|
@ -101,16 +101,16 @@ public class FleshHook extends SkillActiveCharge implements IThrown
|
||||
//Release Charge
|
||||
else if (_charge.containsKey(cur))
|
||||
{
|
||||
float charge = _charge.remove(cur);
|
||||
double charge = _charge.remove(cur);
|
||||
|
||||
//Action
|
||||
Item item = cur.getWorld().dropItem(cur.getEyeLocation().add(cur.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(131));
|
||||
UtilAction.velocity(item, cur.getLocation().getDirection(),
|
||||
1 + charge , false, 0, 0.2, 20, false);
|
||||
1 + charge, false, 0, 0.2, 20, false);
|
||||
|
||||
Factory.Projectile().AddThrow(item, cur, this, -1, true, true, true, true,
|
||||
Sound.FIRE_IGNITE, 1.4f, 0.8f, ParticleType.CRIT, UpdateType.TICK, 0.6f);
|
||||
|
||||
Sound.FIRE_IGNITE, 1.4f, 0.8f, ParticleType.CRIT, UpdateType.TICK, 0.6f, charge);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(cur, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + "."));
|
||||
|
||||
@ -148,14 +148,14 @@ public class FleshHook extends SkillActiveCharge implements IThrown
|
||||
//Pull
|
||||
UtilAction.velocity(target,
|
||||
UtilAlg.getTrajectory(target.getLocation(), player.getLocation()),
|
||||
1.2 + (0.3 * level), false, 0, 0.7, 1.2, true);
|
||||
velocity, 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, 5 + level, false, true, false,
|
||||
DamageCause.CUSTOM, (5 + level) * data.getCharge(), false, true, false,
|
||||
player.getName(), GetName());
|
||||
|
||||
|
||||
|
@ -21,7 +21,7 @@ public class Intimidation extends Skill
|
||||
SetDesc(new String[]
|
||||
{
|
||||
"You intimidate nearby enemies;",
|
||||
"Enemies within #3#3 blocks receive Slow 1.",
|
||||
"Enemies within #4#2 blocks receive Slow 1.",
|
||||
});
|
||||
}
|
||||
|
||||
@ -36,7 +36,7 @@ public class Intimidation extends Skill
|
||||
int level = getLevel(cur);
|
||||
if (level == 0) continue;
|
||||
|
||||
HashMap<Player, Double> targets = UtilPlayer.getInRadius(cur.getLocation(), 3 + (level * 3));
|
||||
HashMap<Player, Double> targets = UtilPlayer.getInRadius(cur.getLocation(), 3 + (level * 2));
|
||||
for (Player other : targets.keySet())
|
||||
if (!other.equals(cur))
|
||||
if (Factory.Relation().canHurt(cur, other))
|
||||
|
@ -52,7 +52,7 @@ public class AxeThrow extends SkillActive implements IThrown
|
||||
SetDesc(new String[]
|
||||
{
|
||||
"Throw your axe with #0.7#0.1 velocity, ",
|
||||
"dealing #5.5#0.5 damage.",
|
||||
"dealing #4.5#0.5 damage.",
|
||||
"",
|
||||
"You pull your axe back to you when it",
|
||||
"collides with anything.",
|
||||
@ -107,7 +107,7 @@ public class AxeThrow extends SkillActive implements IThrown
|
||||
if (level <= 0)
|
||||
return;
|
||||
|
||||
double damage = 5.5 + 0.5 * level;
|
||||
double damage = 4.5 + 0.5 * level;
|
||||
|
||||
//Damage Event
|
||||
Factory.Damage().NewDamageEvent(target, data.getThrower(), null,
|
||||
|
@ -46,7 +46,7 @@ public class HiltSmash extends SkillActive
|
||||
SetDesc(new String[]
|
||||
{
|
||||
"Smash the hilt of your sword into",
|
||||
"your opponent, dealing #2#1 damage",
|
||||
"your opponent, dealing #1#1 damage",
|
||||
"and Slow 3 for #0.5#0.5 seconds."
|
||||
});
|
||||
}
|
||||
@ -153,7 +153,7 @@ public class HiltSmash extends SkillActive
|
||||
|
||||
//Damage Event
|
||||
Factory.Damage().NewDamageEvent((LivingEntity)ent, player, null,
|
||||
DamageCause.CUSTOM, 2 + level, false, true, false,
|
||||
DamageCause.CUSTOM, 1 + level, false, true, false,
|
||||
player.getName(), GetName());
|
||||
|
||||
//Sound
|
||||
|
@ -30,7 +30,7 @@ public class Swordsmanship extends Skill
|
||||
{
|
||||
"Prepare a powerful sword attack;",
|
||||
"You gain 1 Charge every #5#-1 seconds.",
|
||||
"You can store a maximum of #0#1 Charges.",
|
||||
"You can store a maximum of #1#1 Charges.",
|
||||
"",
|
||||
"When you next attack, your damage is",
|
||||
"increased by the number of your Charges,",
|
||||
@ -79,7 +79,7 @@ public class Swordsmanship extends Skill
|
||||
if (!Recharge.Instance.use(cur, GetName(), 5000 - (1000 * level), false, false))
|
||||
continue;
|
||||
|
||||
int max = level;
|
||||
int max = 1 + level;
|
||||
|
||||
int charge = 1;
|
||||
if (_charges.containsKey(cur))
|
||||
|
@ -67,7 +67,7 @@ public class Blizzard extends SkillActive
|
||||
@Override
|
||||
public String GetEnergyString()
|
||||
{
|
||||
return "Energy: #34#-2 per Second";
|
||||
return "Energy: #42#-2 per Second";
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -114,7 +114,7 @@ public class Blizzard extends SkillActive
|
||||
}
|
||||
|
||||
//Energy
|
||||
if (!Factory.Energy().Use(cur, GetName(), 1.7 - (0.1 * level), true, true))
|
||||
if (!Factory.Energy().Use(cur, GetName(), 2.1 - (0.1 * level), true, true))
|
||||
{
|
||||
_active.remove(cur);
|
||||
continue;
|
||||
|
@ -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 #3#1.5 seconds.",
|
||||
"thats lasts for #3#1 seconds.",
|
||||
});
|
||||
}
|
||||
|
||||
@ -171,7 +171,7 @@ public class IcePrison extends SkillActive implements IThrown
|
||||
if (!UtilBlock.airFoliage(freeze))
|
||||
return;
|
||||
|
||||
long time = 3500 + (1500 * level);
|
||||
long time = 3500 + (1000 * level);
|
||||
|
||||
int yDiff = freeze.getY() - mid.getY();
|
||||
|
||||
|
@ -152,6 +152,12 @@ public class Immolate extends Skill
|
||||
Remove(cur);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (cur.getLocation().getBlock().getType() == Material.WATER || cur.getLocation().getBlock().getType() == Material.STATIONARY_WATER)
|
||||
{
|
||||
Remove(cur);
|
||||
continue;
|
||||
}
|
||||
|
||||
//Energy
|
||||
if (!Factory.Energy().Use(cur, GetName(), 0.65 - (level * 0.05), true, true))
|
||||
|
@ -53,7 +53,7 @@ public class Inferno extends SkillActive
|
||||
@Override
|
||||
public String GetEnergyString()
|
||||
{
|
||||
return "Energy: #34#-2 per Second";
|
||||
return "Energy: #42#-2 per Second";
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -100,7 +100,7 @@ public class Inferno extends SkillActive
|
||||
}
|
||||
|
||||
//Energy
|
||||
if (!Factory.Energy().Use(cur, GetName(), 1.7 - (0.1 * level), true, false))
|
||||
if (!Factory.Energy().Use(cur, GetName(), 2.1 - (0.1 * level), true, false))
|
||||
{
|
||||
_active.remove(cur);
|
||||
continue;
|
||||
@ -113,7 +113,7 @@ public class Inferno extends SkillActive
|
||||
itemStack.setItemMeta(meta);
|
||||
|
||||
Item fire = cur.getWorld().dropItem(cur.getEyeLocation().add(cur.getLocation().getDirection()), itemStack);
|
||||
Factory.Fire().Add(fire, cur, 0.7, 0, 0.3 + (0.1 * level), 1, GetName(), false);
|
||||
Factory.Fire().Add(fire, cur, 0.7, 0, 0.3 + (0.1 * level), .25, GetName(), false);
|
||||
|
||||
fire.teleport(cur.getEyeLocation());
|
||||
double x = 0.07 - (UtilMath.r(14)/100d);
|
||||
|
@ -42,8 +42,8 @@ public class LifeBonds extends Skill
|
||||
{
|
||||
"Drop Axe/Sword to Toggle.",
|
||||
"",
|
||||
"Transfers life from healthy allies",
|
||||
"to nearby allies with less health.",
|
||||
"Transfers life from yourself to",
|
||||
"nearby allies with less health.",
|
||||
"",
|
||||
"Transfers #0.5#0.5 health every second.",
|
||||
"Maximum range of #3#3 Blocks from user."
|
||||
@ -188,9 +188,6 @@ public class LifeBonds extends Skill
|
||||
int level = getLevel(cur);
|
||||
|
||||
//Bonds
|
||||
Player highest = null;
|
||||
double highestHp = 0;
|
||||
|
||||
Player lowest = null;
|
||||
double lowestHp = 20;
|
||||
|
||||
@ -199,12 +196,6 @@ public class LifeBonds extends Skill
|
||||
if (Factory.Relation().canHurt(cur, other) && !other.equals(cur))
|
||||
continue;
|
||||
|
||||
if (highest == null || other.getHealth() > highestHp)
|
||||
{
|
||||
highest = other;
|
||||
highestHp = other.getHealth();
|
||||
}
|
||||
|
||||
if (lowest == null || other.getHealth() < lowestHp)
|
||||
{
|
||||
lowest = other;
|
||||
@ -213,18 +204,18 @@ public class LifeBonds extends Skill
|
||||
}
|
||||
|
||||
//Nothing to Transfer
|
||||
if (highest == null || lowest == null || highest.equals(lowest) || highestHp - lowestHp < 2)
|
||||
if (cur.equals(lowest) || cur.getHealth() - lowestHp < 2)
|
||||
continue;
|
||||
|
||||
double amount = 0.5 + (0.5 * level);
|
||||
|
||||
amount = Math.min((double)(highestHp - lowestHp) / 2d, amount);
|
||||
amount = Math.min((double)(cur.getHealth() - lowestHp) / 2d, amount);
|
||||
|
||||
//Steal
|
||||
UtilPlayer.health(highest, -amount);
|
||||
UtilPlayer.health(cur, -amount);
|
||||
|
||||
//Hearts
|
||||
_hearts.add(new LifeBondsData(highest.getLocation().add(0, 0.8, 0), lowest, amount));
|
||||
_hearts.add(new LifeBondsData(cur.getLocation().add(0, 0.8, 0), lowest, amount));
|
||||
|
||||
//Effect
|
||||
//highest.getWorld().playEffect(highest.getLocation(), Effect.STEP_SOUND, 18);
|
||||
|
@ -22,7 +22,7 @@ public class MagmaBlade extends Skill
|
||||
SetDesc(new String[]
|
||||
{
|
||||
"Your sword deals an additional,",
|
||||
"#0.5#0.5 damage to burning opponents,",
|
||||
"#0.25#0.25 damage to burning opponents,",
|
||||
"but also extinguishes them.",
|
||||
});
|
||||
}
|
||||
@ -54,7 +54,7 @@ public class MagmaBlade extends Skill
|
||||
if (level == 0) return;
|
||||
|
||||
//Damage
|
||||
event.AddMod(damager.getName(), GetName(), 0.5 + 0.5 * level, true);
|
||||
event.AddMod(damager.getName(), GetName(), 0.25 + 0.25 * level, true);
|
||||
|
||||
//Effect
|
||||
damager.getWorld().playSound(damager.getLocation(), Sound.FIZZ, 0.8f, 0f);
|
||||
|
@ -18,18 +18,24 @@ import mineplex.minecraft.game.classcombat.Skill.Skill;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.util.BlockIterator;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
public class Sharpshooter extends Skill
|
||||
{
|
||||
private WeakHashMap<Player, Integer> _missedCount = new WeakHashMap<Player, Integer>();
|
||||
private WeakHashMap<Player, Integer> _hitCount = new WeakHashMap<Player, Integer>();
|
||||
private HashMap<Entity, Player> _arrows = new HashMap<Entity, Player>();
|
||||
private HashMap<Arrow, Player> _arrows = new HashMap<Arrow, Player>();
|
||||
|
||||
public Sharpshooter(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)
|
||||
{
|
||||
@ -53,9 +59,15 @@ public class Sharpshooter extends Skill
|
||||
|
||||
int level = getLevel((Player)event.getEntity());
|
||||
if (level == 0) return;
|
||||
|
||||
|
||||
if (!(event.getProjectile() instanceof Arrow))
|
||||
{
|
||||
System.out.println(GetName() + " : " + event.getEntity().getName() + " shot bow but resulting projectile was now Arrow?!?!?!?");
|
||||
return;
|
||||
}
|
||||
|
||||
//Store
|
||||
_arrows.put(event.getProjectile(), (Player)event.getEntity());
|
||||
_arrows.put((Arrow) event.getProjectile(), (Player)event.getEntity());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
@ -98,9 +110,46 @@ public class Sharpshooter extends Skill
|
||||
|
||||
projectile.remove();
|
||||
|
||||
_missedCount.remove(player);
|
||||
|
||||
Recharge.Instance.useForce(player, GetName() + " Timer", 5000);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void missReset(ProjectileHitEvent event)
|
||||
{
|
||||
final Projectile projectile = event.getEntity();
|
||||
Factory.runSyncLater(() -> {
|
||||
if (!projectile.isDead() && _arrows.containsKey(projectile))
|
||||
{
|
||||
Player shooter = (Player) projectile.getShooter();
|
||||
|
||||
if (!_hitCount.containsKey(shooter))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_missedCount.containsKey(shooter))
|
||||
{
|
||||
_missedCount.put(shooter, Integer.valueOf(1));
|
||||
}
|
||||
else
|
||||
{
|
||||
_missedCount.put(shooter, Integer.valueOf(_missedCount.get(shooter).intValue() + 1));
|
||||
|
||||
// Reset
|
||||
if (_missedCount.get(shooter).intValue() >= 2)
|
||||
{
|
||||
_hitCount.remove(shooter);
|
||||
_missedCount.remove(shooter);
|
||||
UtilPlayer.message(shooter, F.main(GetClassType().name(), GetName() + " : " + F.elem("Damage Bonus Reset")));
|
||||
shooter.playSound(shooter.getLocation(), Sound.NOTE_PLING, 1f, 0.75f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 3l);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void resetViaTime(UpdateEvent event)
|
||||
{
|
||||
@ -148,5 +197,6 @@ public class Sharpshooter extends Skill
|
||||
public void Reset(Player player)
|
||||
{
|
||||
_hitCount.remove(player);
|
||||
_missedCount.remove(player);
|
||||
}
|
||||
}
|
||||
|
@ -1,28 +1,26 @@
|
||||
package mineplex.minecraft.game.classcombat.Skill.Ranger;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
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;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||
import mineplex.minecraft.game.classcombat.Skill.Skill;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
|
||||
public class VitalitySpores extends Skill
|
||||
{
|
||||
private HashMap<Player, Long> _lastMove = new HashMap<Player, Long>();
|
||||
private HashMap<Player, Long> _lastDamage = new HashMap<>();
|
||||
|
||||
public VitalitySpores(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)
|
||||
{
|
||||
@ -30,47 +28,52 @@ public class VitalitySpores extends Skill
|
||||
|
||||
SetDesc(new String[]
|
||||
{
|
||||
"While standing still, forest spores",
|
||||
"heal you for #0#0.5 health per 2 seconds."
|
||||
"After getting hit, if no damage is taken",
|
||||
"for 10 Seconds then you will receive",
|
||||
"Regeneration #2#0 for #5#1 Seconds",
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void playerMove(PlayerMoveEvent event)
|
||||
public void damage(CustomDamageEvent event)
|
||||
{
|
||||
if (doesUserHaveSkill(event.getPlayer()) && UtilMath.offset(event.getFrom(), event.getTo()) > 0)
|
||||
_lastMove.put(event.getPlayer(), System.currentTimeMillis());
|
||||
if (doesUserHaveSkill(event.GetDamageePlayer()))
|
||||
{
|
||||
if (event.GetDamageePlayer().hasPotionEffect(PotionEffectType.REGENERATION))
|
||||
{
|
||||
event.GetDamageePlayer().removePotionEffect(PotionEffectType.REGENERATION);
|
||||
}
|
||||
else
|
||||
{
|
||||
_lastDamage.put(event.GetDamageePlayer(), Long.valueOf(System.currentTimeMillis()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void update(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
{
|
||||
return;
|
||||
|
||||
for (Player cur : GetUsers())
|
||||
{
|
||||
int level = getLevel(cur);
|
||||
if (level == 0) continue;
|
||||
|
||||
if (!_lastMove.containsKey(cur))
|
||||
continue;
|
||||
|
||||
if (UtilTime.elapsed(_lastMove.get(cur), 2000))
|
||||
}
|
||||
|
||||
Iterator<Entry<Player, Long>> iterator = _lastDamage.entrySet().iterator();
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
Entry<Player, Long> entry = iterator.next();
|
||||
|
||||
if (UtilTime.elapsed(entry.getValue().longValue(), 10000))
|
||||
{
|
||||
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());
|
||||
}
|
||||
iterator.remove();
|
||||
entry.getKey().addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, (20 * (5 + getLevel(entry.getKey()))), 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Reset(Player player)
|
||||
{
|
||||
_lastMove.remove(player);
|
||||
_lastDamage.remove(player);
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public class WolfsPounce extends SkillChargeSword
|
||||
"Taking damage cancels charge.",
|
||||
"",
|
||||
"Colliding with another player",
|
||||
"mid-air deals up to #4#1 damage",
|
||||
"mid-air deals up to #2#1 damage",
|
||||
"and Slow 2 for 3 seconds."
|
||||
|
||||
});
|
||||
@ -128,7 +128,7 @@ public class WolfsPounce extends SkillChargeSword
|
||||
if (_chargeStore.containsKey(damager))
|
||||
charge = _chargeStore.remove(damager);
|
||||
|
||||
int damage = (int)((4 + getLevel(damager)) * charge);
|
||||
int damage = (int)((2 + getLevel(damager)) * charge);
|
||||
|
||||
//Damage Event
|
||||
Factory.Damage().NewDamageEvent(damagee, damager, null,
|
||||
|
@ -221,10 +221,6 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
|
||||
AddSkill(new Fitness(this, "Mana Pool", ClassType.Mage, SkillType.GlobalPassive, 1, 3));
|
||||
AddSkill(new Recharge(this, "Mana Regeneration", ClassType.Mage, SkillType.GlobalPassive, 1, 3));
|
||||
|
||||
AddSkill(new Fitness(this, "Fitness", ClassType.Assassin, SkillType.GlobalPassive, 1, 3));
|
||||
AddSkill(new Recharge(this, "Rest", ClassType.Assassin, SkillType.GlobalPassive, 1, 3));
|
||||
|
||||
|
||||
//AddSkill(new Stamina(this, "Stamina", ClassType.Global, SkillType.GlobalPassive, 1, 1));
|
||||
//AddSkill(new Swim(this, "Swim", ClassType.Global, SkillType.GlobalPassive, 1, 1));
|
||||
}
|
||||
@ -235,9 +231,9 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
|
||||
|
||||
//Sword
|
||||
AddSkill(new Evade(this, "Evade", ClassType.Assassin, SkillType.Sword,
|
||||
1, 4,
|
||||
2, 1,
|
||||
0, 0,
|
||||
6500, -500, true,
|
||||
2500, -500, true,
|
||||
new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD},
|
||||
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
|
||||
|
||||
@ -337,7 +333,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
|
||||
AddSkill(new Takedown(this, "Takedown", ClassType.Brute, SkillType.Axe,
|
||||
1, 5,
|
||||
0, 0,
|
||||
21000, -1000, true,
|
||||
17000, -1000, true,
|
||||
new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE},
|
||||
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
|
||||
|
||||
@ -374,7 +370,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
|
||||
AddSkill(new Riposte(this, "Riposte", ClassType.Knight, SkillType.Sword,
|
||||
1, 5,
|
||||
0, 0,
|
||||
11000, -1000, false,
|
||||
15000, -1000, false,
|
||||
new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD},
|
||||
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
|
||||
|
||||
@ -411,7 +407,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
|
||||
AddSkill(new AxeThrow(this, "Roped Axe Throw", ClassType.Knight, SkillType.Axe,
|
||||
1, 5,
|
||||
0, 0,
|
||||
3300, -300, true,
|
||||
4300, -300, true,
|
||||
new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE},
|
||||
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
|
||||
|
||||
|
@ -72,7 +72,9 @@ public class Condition
|
||||
|
||||
protected boolean _add = false;
|
||||
protected boolean _live = false;
|
||||
|
||||
|
||||
protected boolean _cancelPotion;
|
||||
|
||||
protected boolean _showIndicator = true;
|
||||
|
||||
public Condition(ConditionManager manager, String reason, LivingEntity ent, LivingEntity source,
|
||||
@ -101,6 +103,35 @@ public class Condition
|
||||
//Live if NOT Additive
|
||||
_live = !add;
|
||||
}
|
||||
|
||||
public Condition(ConditionManager manager, String reason, LivingEntity ent, LivingEntity source,
|
||||
ConditionType type, int mult, int ticks, boolean add, Material visualType, byte visualData, boolean showIndicator, boolean ambient, boolean cancelPotion)
|
||||
{
|
||||
Manager = manager;
|
||||
_time = System.currentTimeMillis();
|
||||
|
||||
_reason = reason;
|
||||
|
||||
_ent = ent;
|
||||
_source = source;
|
||||
|
||||
_type = type;
|
||||
_mult = mult;
|
||||
_ticks = ticks;
|
||||
_ticksTotal = ticks;
|
||||
_ambient = ambient;
|
||||
|
||||
_indicatorType = visualType;
|
||||
_indicatorData = visualData;
|
||||
_showIndicator = showIndicator;
|
||||
|
||||
_cancelPotion = cancelPotion;
|
||||
|
||||
_add = add;
|
||||
|
||||
//Live if NOT Additive
|
||||
_live = !add;
|
||||
}
|
||||
|
||||
public boolean Tick()
|
||||
{
|
||||
@ -124,6 +155,11 @@ public class Condition
|
||||
|
||||
public void Add()
|
||||
{
|
||||
if (_cancelPotion)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
PotionEffectType type = PotionEffectType.getByName(_type.toString());
|
||||
|
@ -239,10 +239,16 @@ public class ConditionFactory
|
||||
|
||||
public Condition Poison(String reason, LivingEntity ent, LivingEntity source,
|
||||
double duration, int mult, boolean extend, boolean showIndicator, boolean ambient)
|
||||
{
|
||||
return Poison(reason, ent, source, duration, mult, extend, showIndicator, ambient, false);
|
||||
}
|
||||
|
||||
public Condition Poison(String reason, LivingEntity ent, LivingEntity source,
|
||||
double duration, int mult, boolean extend, boolean showIndicator, boolean ambient, boolean cancelPotion)
|
||||
{
|
||||
return Manager.AddCondition(new Condition(Manager, reason, ent, source,
|
||||
ConditionType.POISON, mult, (int)(20 * duration), extend,
|
||||
Material.SLIME_BALL, (byte)14, showIndicator, ambient));
|
||||
Material.SLIME_BALL, (byte)14, showIndicator, ambient, cancelPotion));
|
||||
}
|
||||
|
||||
public Condition PoisonShock(String reason, LivingEntity ent, LivingEntity source,
|
||||
|
@ -44,6 +44,7 @@ public class CustomDamageEvent extends Event implements Cancellable
|
||||
private boolean _damageeBrute = false;
|
||||
private boolean _damageToLevel = true;
|
||||
private boolean _arrowShow = true;
|
||||
private boolean _projectileDamageSelf = false;
|
||||
|
||||
public CustomDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile projectile, Location knockbackOrigin,
|
||||
DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor, String initialSource,
|
||||
@ -169,6 +170,27 @@ public class CustomDamageEvent extends Event implements Cancellable
|
||||
return _projectile;
|
||||
}
|
||||
|
||||
public boolean getProjectileDamageSelf()
|
||||
{
|
||||
return _projectileDamageSelf;
|
||||
}
|
||||
|
||||
public void setProjectileDamageSelf(boolean projectileDamageSelf)
|
||||
{
|
||||
_projectileDamageSelf = projectileDamageSelf;
|
||||
if(!projectileDamageSelf)
|
||||
{
|
||||
_cancellers.remove("Self Projectile Damage");
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!_cancellers.contains("Self Projectile Damage"))
|
||||
{
|
||||
_cancellers.add("Self Projectile Damage");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setShowArrows(boolean show)
|
||||
{
|
||||
_arrowShow = show;
|
||||
|
@ -8,24 +8,6 @@ import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.disguise.DisguiseManager;
|
||||
import mineplex.core.npc.NpcManager;
|
||||
import mineplex.minecraft.game.core.combat.CombatManager;
|
||||
import mineplex.minecraft.game.core.condition.ConditionManager;
|
||||
import mineplex.minecraft.game.core.damage.compatibility.NpcProtectListener;
|
||||
import net.minecraft.server.v1_8_R3.DamageSource;
|
||||
import net.minecraft.server.v1_8_R3.EntityHuman;
|
||||
import net.minecraft.server.v1_8_R3.EntityLiving;
|
||||
|
||||
import org.bukkit.EntityEffect;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
@ -48,6 +30,24 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.disguise.DisguiseManager;
|
||||
import mineplex.core.npc.NpcManager;
|
||||
import mineplex.minecraft.game.core.combat.CombatManager;
|
||||
import mineplex.minecraft.game.core.condition.ConditionManager;
|
||||
import mineplex.minecraft.game.core.damage.compatibility.NpcProtectListener;
|
||||
import net.minecraft.server.v1_8_R3.DamageSource;
|
||||
import net.minecraft.server.v1_8_R3.EntityHuman;
|
||||
import net.minecraft.server.v1_8_R3.EntityLiving;
|
||||
|
||||
public class DamageManager extends MiniPlugin
|
||||
{
|
||||
private CombatManager _combatManager;
|
||||
@ -231,24 +231,42 @@ public class DamageManager extends MiniPlugin
|
||||
@EventHandler
|
||||
public void onEntityCombust(EntityCombustByEntityEvent event)
|
||||
{
|
||||
if (!_enabled)
|
||||
return;
|
||||
|
||||
if (!(event.getCombuster() instanceof Player || event.getCombuster() instanceof Arrow))
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void removeDemArrowsCrazyMan(EntityDamageEvent event)
|
||||
/**
|
||||
* Removes arrows after hit, especially in cases where arrows may bounce, like if the damage was cancelled.
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void removeArrows(EntityDamageEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
{
|
||||
Projectile projectile = GetProjectile(event);
|
||||
Projectile projectile = GetProjectile(event);
|
||||
|
||||
if (projectile instanceof Arrow)
|
||||
{
|
||||
projectile.teleport(new Location(projectile.getWorld(), 0, 0, 0));
|
||||
projectile.remove();
|
||||
}
|
||||
if (projectile instanceof Arrow)
|
||||
{
|
||||
projectile.teleport(new Location(projectile.getWorld(), 0, 0, 0));
|
||||
projectile.remove();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes arrows after hit, especially in cases where arrows may bounce, like if the damage was cancelled.
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void removeArrows(CustomDamageEvent event)
|
||||
{
|
||||
Projectile projectile = event.GetProjectile();
|
||||
|
||||
if (projectile instanceof Arrow)
|
||||
{
|
||||
projectile.teleport(new Location(projectile.getWorld(), 0, 0, 0));
|
||||
projectile.remove();
|
||||
}
|
||||
}
|
||||
/*
|
||||
@ -315,6 +333,12 @@ public class DamageManager extends MiniPlugin
|
||||
event.SetCancelled("0 Health");
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.GetProjectile() != null && event.GetDamageeEntity().equals(event.GetProjectile().getShooter()) && !event.getProjectileDamageSelf())
|
||||
{
|
||||
event.SetCancelled("Self Projectile Damage");
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.GetDamageePlayer() != null)
|
||||
{
|
||||
@ -375,6 +399,10 @@ public class DamageManager extends MiniPlugin
|
||||
Player damagee = event.GetDamageePlayer();
|
||||
if (damagee != null)
|
||||
{
|
||||
if (event.GetDamage() <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (getTotalEnchantReduction(damagee.getInventory().getArmorContents(), event.GetCause()) > 0)
|
||||
{
|
||||
event.AddMult("Ench Prot", damagee.getName(), getTotalEnchantReduction(damagee.getInventory().getArmorContents(), event.GetCause()), false);
|
||||
@ -432,6 +460,8 @@ public class DamageManager extends MiniPlugin
|
||||
Player player = event.GetDamagerPlayer(true);
|
||||
if (player != null)
|
||||
{
|
||||
if (player.equals(event.GetDamageeEntity()) && !event.getProjectileDamageSelf()) return;
|
||||
|
||||
player.playSound(player.getLocation(), Sound.ORB_PICKUP, 0.5f, 0.5f);
|
||||
}
|
||||
}
|
||||
@ -456,6 +486,11 @@ public class DamageManager extends MiniPlugin
|
||||
if (event.GetDamageeEntity().getHealth() <= 0)
|
||||
return;
|
||||
|
||||
if (event.GetProjectile() != null &&
|
||||
event.GetDamageeEntity().equals(event.GetProjectile().getShooter()) &&
|
||||
!event.getProjectileDamageSelf())
|
||||
return;
|
||||
|
||||
//Player Conditions
|
||||
if (event.GetDamageePlayer() != null)
|
||||
{
|
||||
@ -510,14 +545,21 @@ public class DamageManager extends MiniPlugin
|
||||
origin = event.GetDamagerEntity(true).getLocation();
|
||||
if (event.getKnockbackOrigin() != null)
|
||||
origin = event.getKnockbackOrigin();
|
||||
else if (event.GetProjectile() != null)
|
||||
origin = event.GetProjectile().getLocation();
|
||||
|
||||
//Vec
|
||||
Vector trajectory = UtilAlg.getTrajectory2d(origin, event.GetDamageeEntity().getLocation());
|
||||
trajectory.multiply(0.6 * knockback);
|
||||
trajectory.setY(Math.abs(trajectory.getY()));
|
||||
|
||||
|
||||
//Special handling for projectiles
|
||||
if(event.GetProjectile() != null && event.getKnockbackOrigin() == null)
|
||||
{
|
||||
trajectory = event.GetProjectile().getVelocity();
|
||||
trajectory.setY(0);
|
||||
trajectory.multiply(0.6 * knockback / trajectory.length());
|
||||
trajectory.setY(0.5);
|
||||
}
|
||||
|
||||
//Apply
|
||||
double vel = 0.2 + trajectory.length() * 0.8;
|
||||
|
||||
|
@ -24,6 +24,8 @@ public class ServerGroup
|
||||
private int _requiredTotalServers;
|
||||
private int _requiredJoinableServers;
|
||||
|
||||
private String _uptimes;
|
||||
|
||||
private boolean _arcadeGroup;
|
||||
private String _worldZip;
|
||||
private String _plugin;
|
||||
@ -78,6 +80,7 @@ public class ServerGroup
|
||||
_requiredTotalServers = Integer.valueOf(data.get("totalServers"));
|
||||
_requiredJoinableServers = Integer.valueOf(data.get("joinableServers"));
|
||||
_portSection = Integer.valueOf(data.get("portSection"));
|
||||
_uptimes = data.get("uptimes");
|
||||
_arcadeGroup = Boolean.valueOf(data.get("arcadeGroup"));
|
||||
_worldZip = data.get("worldZip");
|
||||
_plugin = data.get("plugin");
|
||||
@ -120,7 +123,7 @@ public class ServerGroup
|
||||
parseServers(serverStatuses);
|
||||
}
|
||||
|
||||
public ServerGroup(String name, String prefix, String host, int ram, int cpu, int totalServers, int joinable, int portSection, boolean arcade, String worldZip, String plugin, String configPath
|
||||
public ServerGroup(String name, String prefix, String host, int ram, int cpu, int totalServers, int joinable, int portSection, String uptimes, boolean arcade, String worldZip, String plugin, String configPath
|
||||
, int minPlayers, int maxPlayers, boolean pvp, boolean tournament, boolean tournamentPoints, String games, String modes, String boosterGroup, String serverType, boolean noCheat, boolean worldEdit, boolean teamRejoin
|
||||
, boolean teamAutoJoin, boolean teamForceBalance, boolean gameAutoStart, boolean gameTimeout, boolean rewardGems, boolean rewardItems, boolean rewardStats
|
||||
, boolean rewardAchievements, boolean hotbarInventory, boolean hotbarHubClock, boolean playerKickIdle, boolean staffOnly, boolean whitelist, String resourcePack, Region region
|
||||
@ -134,6 +137,7 @@ public class ServerGroup
|
||||
_requiredTotalServers = totalServers;
|
||||
_requiredJoinableServers = joinable;
|
||||
_portSection = portSection;
|
||||
_uptimes = uptimes;
|
||||
_arcadeGroup = arcade;
|
||||
_worldZip = worldZip;
|
||||
_plugin = plugin;
|
||||
@ -232,6 +236,7 @@ public class ServerGroup
|
||||
public String getServerNpcName() { return _npcName; }
|
||||
public String getPortalBottomCornerLocation() { return _portalBottomCornerLocation; }
|
||||
public String getPortalTopCornerLocation() { return _portalTopCornerLocation; }
|
||||
public String getUptimes() { return _uptimes; }
|
||||
|
||||
public Set<MinecraftServer> getServers() { return _servers; }
|
||||
|
||||
@ -358,6 +363,7 @@ public class ServerGroup
|
||||
_dataMap.put("totalServers", _requiredTotalServers + "");
|
||||
_dataMap.put("joinableServers", _requiredJoinableServers + "");
|
||||
_dataMap.put("portSection", _portSection + "");
|
||||
_dataMap.put("uptimes", _uptimes);
|
||||
_dataMap.put("arcadeGroup", _arcadeGroup + "");
|
||||
_dataMap.put("worldZip", _worldZip);
|
||||
_dataMap.put("plugin", _plugin);
|
||||
@ -368,6 +374,7 @@ public class ServerGroup
|
||||
_dataMap.put("tournament", _tournament + "");
|
||||
_dataMap.put("tournamentPoints", _tournamentPoints + "");
|
||||
_dataMap.put("games", _games);
|
||||
_dataMap.put("modes", _modes);
|
||||
_dataMap.put("serverType", _serverType);
|
||||
_dataMap.put("addNoCheat", _addNoCheat + "");
|
||||
_dataMap.put("teamRejoin", _teamRejoin + "");
|
||||
|
@ -216,6 +216,7 @@ public class Arcade extends JavaPlugin
|
||||
config.ServerType = _serverConfiguration.getServerGroup().getServerType();
|
||||
config.MinPlayers = _serverConfiguration.getServerGroup().getMinPlayers();
|
||||
config.MaxPlayers = _serverConfiguration.getServerGroup().getMaxPlayers();
|
||||
config.Uptimes = _serverConfiguration.getServerGroup().getUptimes();
|
||||
config.Tournament = _serverConfiguration.getServerGroup().getTournament();
|
||||
config.TournamentPoints = _serverConfiguration.getServerGroup().getTournamentPoints();
|
||||
config.TeamRejoin = _serverConfiguration.getServerGroup().getTeamRejoin();
|
||||
|
@ -172,7 +172,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
private KitProgressionManager _kitProgressionManager;
|
||||
private ProgressingKitManager _progressionKitManager;
|
||||
private BoosterManager _boosterManager;
|
||||
|
||||
private GameSpectatorManager _spectatorManager;
|
||||
private ServerUptimeManager _serverUptimeManager;
|
||||
|
||||
private IncognitoManager _incognitoManager;
|
||||
|
||||
private TaskManager _taskManager;
|
||||
@ -290,7 +292,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
YoutubeManager youtubeManager = new YoutubeManager(plugin, clientManager, donationManager);
|
||||
_bonusManager = new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, youtubeManager, _cosmeticManager.getGadgetManager(), boosterManager);
|
||||
new GameLootManager(this, petManager, _bonusManager.getRewardManager());
|
||||
new GameSpectatorManager(this);
|
||||
_spectatorManager = new GameSpectatorManager(this);
|
||||
_gameWorldManager = new GameWorldManager(this);
|
||||
new MiscManager(this);
|
||||
_hologramManager = hologramManager;
|
||||
@ -330,7 +332,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
|
||||
_kitProgressionManager = new KitProgressionManager(getPlugin(), clientManager);
|
||||
_progressionKitManager = new ProgressingKitManager(this);
|
||||
|
||||
_serverUptimeManager = new ServerUptimeManager(this);
|
||||
|
||||
if (GetHost() != null && !GetHost().isEmpty())
|
||||
{
|
||||
Bukkit.getScheduler().runTaskLater(plugin, () -> Portal.transferPlayer(GetHost(), _serverStatusManager.getCurrentServerName()), 80L);
|
||||
@ -1705,4 +1708,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
{
|
||||
return _kitProgressionManager;
|
||||
}
|
||||
|
||||
public GameSpectatorManager getGameSpectatorManager()
|
||||
{
|
||||
return _spectatorManager;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package nautilus.game.arcade;
|
||||
|
||||
import mineplex.core.common.MinecraftVersion;
|
||||
import mineplex.core.common.Pair;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
|
||||
/**
|
||||
@ -14,16 +16,34 @@ public class GameMode
|
||||
private GameType _gameType;
|
||||
private String _name;
|
||||
|
||||
private Pair<MinecraftVersion, String>[] _resourcePackUrls;
|
||||
private boolean _enforceResourcePack;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param gameMode Game class that in most cases extends the host game class
|
||||
* @param name Gamemode name
|
||||
*/
|
||||
public GameMode(Class<? extends Game> gameMode, GameType gameType, String name)
|
||||
{
|
||||
this(gameMode, gameType, name, null, false);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param gameMode Game class that in most cases extends the host game class
|
||||
* @param gameType original GameType of modded game
|
||||
* @param name Gamemode name
|
||||
* @param resourcePackUrls URLs to 1.8/1.9 resource pack
|
||||
* @param enforceResourcePack enforece resource pack on players
|
||||
*/
|
||||
public GameMode(Class<? extends Game> gameMode, GameType gameType, String name, Pair<MinecraftVersion, String>[] resourcePackUrls, boolean enforceResourcePack)
|
||||
{
|
||||
_gameMode = gameMode;
|
||||
_gameType = gameType;
|
||||
_name = name;
|
||||
_resourcePackUrls = resourcePackUrls;
|
||||
_enforceResourcePack = enforceResourcePack;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -52,5 +72,23 @@ public class GameMode
|
||||
{
|
||||
return _gameType;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Gamemode resource pack URLs
|
||||
*/
|
||||
public Pair<MinecraftVersion, String>[] getResPackURLs()
|
||||
{
|
||||
return _resourcePackUrls;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Gamemode enforcing of resource packs
|
||||
*/
|
||||
public boolean enforceResourcePack()
|
||||
{
|
||||
return _enforceResourcePack;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package nautilus.game.arcade;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import mineplex.core.common.MinecraftVersion;
|
||||
import mineplex.core.common.Pair;
|
||||
import mineplex.core.game.GameCategory;
|
||||
@ -10,6 +12,7 @@ import nautilus.game.arcade.game.games.barbarians.Barbarians;
|
||||
import nautilus.game.arcade.game.games.bossbattles.BossBattles;
|
||||
import nautilus.game.arcade.game.games.bouncyballs.BouncyBalls;
|
||||
import nautilus.game.arcade.game.games.bridge.Bridge;
|
||||
import nautilus.game.arcade.game.games.bridge.modes.LuckyBridges;
|
||||
import nautilus.game.arcade.game.games.bridge.modes.OverpoweredBridge;
|
||||
import nautilus.game.arcade.game.games.bridge.modes.SpeedBridges ;
|
||||
import nautilus.game.arcade.game.games.build.Build;
|
||||
@ -20,6 +23,7 @@ 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.champions.modes.SmashDom;
|
||||
import nautilus.game.arcade.game.games.christmas.Christmas;
|
||||
import nautilus.game.arcade.game.games.deathtag.DeathTag;
|
||||
import nautilus.game.arcade.game.games.dragonescape.DragonEscape;
|
||||
@ -33,6 +37,7 @@ import nautilus.game.arcade.game.games.evolution.Evolution;
|
||||
import nautilus.game.arcade.game.games.gladiators.Gladiators;
|
||||
import nautilus.game.arcade.game.games.gladiators.modes.ChampionsGladiators;
|
||||
import nautilus.game.arcade.game.games.gladiators.modes.OverpoweredGladiators;
|
||||
import nautilus.game.arcade.game.games.gladiators.modes.SmashGladiators;
|
||||
import nautilus.game.arcade.game.games.gravity.Gravity;
|
||||
import nautilus.game.arcade.game.games.halloween.Halloween;
|
||||
import nautilus.game.arcade.game.games.hideseek.HideSeek;
|
||||
@ -41,11 +46,14 @@ import nautilus.game.arcade.game.games.holeinwall.HoleInTheWall;
|
||||
import nautilus.game.arcade.game.games.horsecharge.Horse;
|
||||
import nautilus.game.arcade.game.games.lobbers.BombLobbers;
|
||||
import nautilus.game.arcade.game.games.micro.Micro;
|
||||
import nautilus.game.arcade.game.games.micro.modes.CookieFight;
|
||||
import nautilus.game.arcade.game.games.micro.modes.OverpoweredMicroBattles;
|
||||
import nautilus.game.arcade.game.games.micro.modes.TinySmash;
|
||||
import nautilus.game.arcade.game.games.micro.modes.TinyWinners;
|
||||
import nautilus.game.arcade.game.games.milkcow.MilkCow;
|
||||
import nautilus.game.arcade.game.games.minecraftleague.MinecraftLeague;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||
import nautilus.game.arcade.game.games.minestrike.Minestrike;
|
||||
import nautilus.game.arcade.game.games.mineware.BawkBawkBattles;
|
||||
import nautilus.game.arcade.game.games.monsterleague.MonsterLeague;
|
||||
import nautilus.game.arcade.game.games.monstermaze.MonsterMaze;
|
||||
import nautilus.game.arcade.game.games.oldmineware.OldMineWare;
|
||||
@ -59,9 +67,12 @@ import nautilus.game.arcade.game.games.runner.modes.FasterThanLight;
|
||||
import nautilus.game.arcade.game.games.searchanddestroy.SearchAndDestroy;
|
||||
import nautilus.game.arcade.game.games.sheep.SheepGame;
|
||||
import nautilus.game.arcade.game.games.sheep.modes.EweHeroes;
|
||||
import nautilus.game.arcade.game.games.sheep.modes.OverpoweredSheepQuest;
|
||||
import nautilus.game.arcade.game.games.sheep.modes.SmashSheep;
|
||||
import nautilus.game.arcade.game.games.skywars.SoloSkywars;
|
||||
import nautilus.game.arcade.game.games.skywars.TeamSkywars;
|
||||
import nautilus.game.arcade.game.games.skywars.modes.OverpoweredSkywars;
|
||||
import nautilus.game.arcade.game.games.skywars.modes.SkySmash;
|
||||
import nautilus.game.arcade.game.games.skywars.modes.UHCSkywars;
|
||||
import nautilus.game.arcade.game.games.smash.SoloSuperSmash;
|
||||
import nautilus.game.arcade.game.games.smash.SuperSmashDominate;
|
||||
@ -78,7 +89,9 @@ import nautilus.game.arcade.game.games.squidshooter.SquidShooter;
|
||||
import nautilus.game.arcade.game.games.stacker.Stacker;
|
||||
import nautilus.game.arcade.game.games.survivalgames.SoloSurvivalGames;
|
||||
import nautilus.game.arcade.game.games.survivalgames.TeamSurvivalGames;
|
||||
import nautilus.game.arcade.game.games.survivalgames.modes.ChangingKits;
|
||||
import nautilus.game.arcade.game.games.survivalgames.modes.OverpoweredSurvival;
|
||||
import nautilus.game.arcade.game.games.survivalgames.modes.StrikeGames;
|
||||
import nautilus.game.arcade.game.games.survivalgames.modes.UHCSurvivalgames;
|
||||
import nautilus.game.arcade.game.games.tug.Tug;
|
||||
import nautilus.game.arcade.game.games.turfforts.TurfForts;
|
||||
@ -92,7 +105,6 @@ import nautilus.game.arcade.game.games.valentines.Valentines;
|
||||
import nautilus.game.arcade.game.games.wither.WitherGame;
|
||||
import nautilus.game.arcade.game.games.wizards.Wizards;
|
||||
import nautilus.game.arcade.game.games.zombiesurvival.ZombieSurvival;
|
||||
import org.bukkit.Material;
|
||||
|
||||
public enum GameType
|
||||
{
|
||||
@ -132,12 +144,12 @@ public enum GameType
|
||||
Lobbers(BombLobbers.class, GameDisplay.Lobbers),
|
||||
Micro(Micro.class, GameDisplay.Micro),
|
||||
MilkCow(MilkCow.class, GameDisplay.MilkCow),
|
||||
MineStrike(MineStrike.class, GameDisplay.MineStrike, new Pair[]
|
||||
MineStrike(Minestrike.class, GameDisplay.MineStrike, new Pair[]
|
||||
{
|
||||
Pair.create(MinecraftVersion.Version1_8, "http://file.mineplex.com/ResMinestrike.zip"),
|
||||
Pair.create(MinecraftVersion.Version1_9, "http://file.mineplex.com/ResMinestrike19.zip")
|
||||
}, true),
|
||||
MineWare(MineWare.class, GameDisplay.MineWare),
|
||||
BawkBawkBattles(BawkBawkBattles.class, GameDisplay.BawkBawkBattles),
|
||||
MinecraftLeague(MinecraftLeague.class, GameDisplay.Minecraft_League),
|
||||
OldMineWare(OldMineWare.class, GameDisplay.OldMineWare),
|
||||
Paintball(Paintball.class, GameDisplay.Paintball),
|
||||
@ -187,7 +199,7 @@ public enum GameType
|
||||
GameType.Cards, GameType.CastleSiege, GameType.ChampionsDominate, GameType.ChampionsTDM, GameType.Christmas,
|
||||
GameType.DeathTag, GameType.DragonEscape, GameType.DragonEscapeTeams, GameType.DragonRiders, GameType.Dragons,
|
||||
GameType.Draw, GameType.Evolution, GameType.Gravity, GameType.Halloween, GameType.HideSeek,
|
||||
GameType.HoleInTheWall, GameType.Horse, GameType.Micro, GameType.MilkCow, GameType.MineStrike, GameType.MineWare,
|
||||
GameType.HoleInTheWall, GameType.Horse, GameType.Micro, GameType.MilkCow, GameType.MineStrike, GameType.BawkBawkBattles,
|
||||
GameType.OldMineWare, GameType.Paintball, GameType.Quiver, GameType.QuiverTeams, GameType.Runner, GameType.SearchAndDestroy,
|
||||
GameType.Sheep, GameType.Skywars, GameType.SkywarsTeams, GameType.Smash, GameType.SmashDomination, GameType.SmashTeams,
|
||||
GameType.Snake, GameType.SneakyAssassins, GameType.SnowFight, GameType.Spleef, GameType.SpleefTeams, GameType.SquidShooter,
|
||||
@ -195,20 +207,42 @@ public enum GameType
|
||||
GameType.WitherAssault, GameType.Wizards, GameType.ZombieSurvival}, true),
|
||||
|
||||
Brawl(null, new GameMode[]{
|
||||
new GameMode(OverpoweredBridge.class, GameType.Bridge, "OP Bridges"), new GameMode(SpeedBridges.class, GameType.Bridge, "Speed Bridges"),
|
||||
new GameMode(OverpoweredGladiators.class, GameType.Gladiators, "OP Gladiators"), new GameMode(ChampionsGladiators.class, GameType.Gladiators, "Champions Gladiators"),
|
||||
new GameMode(OverpoweredSkywars.class, GameType.Skywars, "OP Skywars"), new GameMode(UHCSkywars.class, GameType.Skywars, "UHC Skywars"),
|
||||
new GameMode(TeamBuild.class, GameType.Build, "Team Master Builders"), new GameMode(DukesOfDecoration.class, GameType.Build, "Dukes Of Decoration"),
|
||||
new GameMode(CutClean.class, GameType.UHC, "Cut Clean"), new GameMode(GodBattles.class, GameType.UHC, "God Battles"),
|
||||
new GameMode(BloodDiamonds.class, GameType.UHC, "Blood Diamonds"), new GameMode(Assassins.class, GameType.UHC, "Assassins"),
|
||||
new GameMode(OverpoweredSurvival.class, GameType.SurvivalGames, "OP Survival Games"), new GameMode(UHCSurvivalgames.class, GameType.SurvivalGames, "UHC Survivalgames"),
|
||||
new GameMode(UltraSpleef.class, GameType.Spleef, "Ultra Spleef"),
|
||||
new GameMode(RandomKitSSM.class, GameType.Smash, "Random Kit SSM"),
|
||||
new GameMode(EweHeroes.class, GameType.Sheep, "Heroes Of The Ewe"),
|
||||
new GameMode(FasterThanLight.class, GameType.Runner, "Faster Than Light"),
|
||||
new GameMode(BunnyHop.class, GameType.Quiver, "Bunny Hop"),
|
||||
new GameMode(OverpoweredBridge.class, GameType.Bridge, "OP Bridges"),
|
||||
new GameMode(SpeedBridges.class, GameType.Bridge, "Speed Bridges"),
|
||||
new GameMode(LuckyBridges.class, GameType.Bridge, "Lucky Bridges"),
|
||||
new GameMode(OverpoweredGladiators.class, GameType.Gladiators, "OP Gladiators"),
|
||||
new GameMode(ChampionsGladiators.class, GameType.Gladiators, "Champions Gladiators"),
|
||||
new GameMode(SmashGladiators.class, GameType.Gladiators, "Smash Gladiators"),
|
||||
new GameMode(OverpoweredSkywars.class, GameType.Skywars, "OP Skywars"),
|
||||
new GameMode(UHCSkywars.class, GameType.Skywars, "UHC Skywars"),
|
||||
new GameMode(SkySmash.class, GameType.Skywars, "Sky Smash"),
|
||||
new GameMode(TeamBuild.class, GameType.Build, "Team Master Builders"),
|
||||
new GameMode(DukesOfDecoration.class, GameType.Build, "Dukes Of Decoration"),
|
||||
new GameMode(CutClean.class, GameType.UHC, "Cut Clean"),
|
||||
new GameMode(GodBattles.class, GameType.UHC, "God Battles"),
|
||||
new GameMode(BloodDiamonds.class, GameType.UHC, "Blood Diamonds"),
|
||||
new GameMode(Assassins.class, GameType.UHC, "Assassins"),
|
||||
new GameMode(OverpoweredSurvival.class, GameType.SurvivalGames, "OP Survival Games"),
|
||||
new GameMode(UHCSurvivalgames.class, GameType.SurvivalGames, "UHC Survivalgames"),
|
||||
new GameMode(ChangingKits.class, GameType.SurvivalGames, "Changing Kits"),
|
||||
new GameMode(StrikeGames.class, GameType.SurvivalGames, "Strike Games", new Pair[]
|
||||
{
|
||||
Pair.create(MinecraftVersion.Version1_8, "http://file.mineplex.com/ResStrikeGames18.zip"),
|
||||
Pair.create(MinecraftVersion.Version1_9, "http://file.mineplex.com/ResStrikeGames19.zip")
|
||||
}, true),
|
||||
new GameMode(TinyWinners.class, GameType.Micro, "Tiny Winners"),
|
||||
new GameMode(Countdown.class, GameType.HideSeek, "Countdown"),
|
||||
new GameMode(OverpoweredMicroBattles.class, GameType.Micro, "OP Micro Battles"),
|
||||
new GameMode(CookieFight.class, GameType.Micro, "Cookie Fight"),
|
||||
new GameMode(TinySmash.class, GameType.Micro, "Tiny Smash"),
|
||||
new GameMode(UltraSpleef.class, GameType.Spleef, "Ultra Spleef"),
|
||||
new GameMode(RandomKitSSM.class, GameType.Smash, "Random Kit SSM"),
|
||||
new GameMode(EweHeroes.class, GameType.Sheep, "Heroes Of The Ewe"),
|
||||
new GameMode(SmashSheep.class, GameType.Sheep, "Smash Sheep"),
|
||||
new GameMode(OverpoweredSheepQuest.class, GameType.Sheep, "OP Sheep Quest"),
|
||||
new GameMode(FasterThanLight.class, GameType.Runner, "Faster Than Light"),
|
||||
new GameMode(BunnyHop.class, GameType.Quiver, "Bunny Hop"),
|
||||
new GameMode(Countdown.class, GameType.HideSeek, "Countdown"),
|
||||
new GameMode(SmashDom.class, GameType.ChampionsDominate, "Smash Dominate"),
|
||||
}, GameDisplay.Brawl, null, false, null, false, true);
|
||||
|
||||
GameDisplay _display;
|
||||
@ -277,13 +311,21 @@ public enum GameType
|
||||
return _gameModes;
|
||||
}
|
||||
|
||||
public boolean isEnforceResourcePack()
|
||||
public boolean isEnforceResourcePack(Game game)
|
||||
{
|
||||
if (hasGamemodes())
|
||||
{
|
||||
return getGameMode(game.getClass()).enforceResourcePack();
|
||||
}
|
||||
return _enforceResourcePack;
|
||||
}
|
||||
|
||||
public Pair<MinecraftVersion, String>[] getResourcePackUrls()
|
||||
public Pair<MinecraftVersion, String>[] getResourcePackUrls(Game game)
|
||||
{
|
||||
if (hasGamemodes())
|
||||
{
|
||||
return getGameMode(game.getClass()).getResPackURLs();
|
||||
}
|
||||
return _resourcePacks;
|
||||
}
|
||||
|
||||
@ -331,18 +373,28 @@ public enum GameType
|
||||
return _display.getKitGameName();
|
||||
}
|
||||
|
||||
public GameType getModeGameType(Class<? extends Game> game)
|
||||
public boolean isUsingGameModes()
|
||||
{
|
||||
return _gameMaps;
|
||||
}
|
||||
|
||||
public GameMode getGameMode(Class<? extends Game> game)
|
||||
{
|
||||
for (GameMode mode : getGameModes())
|
||||
{
|
||||
if (mode.getGameClass() != null && mode.getGameClass().getName().contentEquals(game.getName()))
|
||||
{
|
||||
return mode.getType();
|
||||
return mode;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public GameType getModeGameType(Class<? extends Game> game)
|
||||
{
|
||||
return getGameMode(game).getType();
|
||||
}
|
||||
|
||||
public boolean isUsingGameModesMaps()
|
||||
{
|
||||
return _gameMaps;
|
||||
|
@ -99,7 +99,7 @@ public class CompassAddon extends MiniPlugin
|
||||
|
||||
if (target != null)
|
||||
{
|
||||
if (Manager.GetGame().CompassGiveItem || Manager.isSpectator(player))
|
||||
if (Manager.GetGame().CompassGiveItem || (Manager.GetGame().CompassGiveItemSpectators && Manager.isSpectator(player)))
|
||||
if (!player.getInventory().contains(Material.COMPASS))
|
||||
{
|
||||
if (player.getOpenInventory() == null || player.getOpenInventory().getCursor() == null || player.getOpenInventory().getCursor().getType() != Material.COMPASS)
|
||||
|
@ -2,10 +2,12 @@ package nautilus.game.arcade.game;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import mineplex.core.common.util.*;
|
||||
import mineplex.core.disguise.disguises.DisguisePlayer;
|
||||
import mineplex.core.elo.EloPlayer;
|
||||
import mineplex.core.elo.EloTeam;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.packethandler.IPacketHandler;
|
||||
import mineplex.core.packethandler.PacketInfo;
|
||||
@ -22,6 +24,7 @@ import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.events.PlayerGameRespawnEvent;
|
||||
import nautilus.game.arcade.events.PlayerStateChangeEvent;
|
||||
import nautilus.game.arcade.game.GameTeam.PlayerState;
|
||||
import nautilus.game.arcade.game.modules.Module;
|
||||
import nautilus.game.arcade.kit.*;
|
||||
import nautilus.game.arcade.managers.GameLobbyManager;
|
||||
import nautilus.game.arcade.managers.chat.ChatStatData;
|
||||
@ -32,6 +35,7 @@ import nautilus.game.arcade.world.WorldData;
|
||||
import net.minecraft.server.v1_8_R3.EntityItem;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity;
|
||||
import net.minecraft.server.v1_8_R3.WorldServer;
|
||||
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
@ -204,6 +208,7 @@ public abstract class Game implements Listener
|
||||
public int HungerSet = -1;
|
||||
public int HealthSet = -1;
|
||||
|
||||
public boolean SpawnTeleport = true;
|
||||
public boolean PrepareFreeze = true;
|
||||
|
||||
private double _itemMergeRadius = 0;
|
||||
@ -238,6 +243,7 @@ public abstract class Game implements Listener
|
||||
// Addons
|
||||
public boolean CompassEnabled = false;
|
||||
public boolean CompassGiveItem = true;
|
||||
public boolean CompassGiveItemSpectators = true;
|
||||
|
||||
public boolean SoupEnabled = true;
|
||||
public boolean TeamArmor = false;
|
||||
@ -311,8 +317,6 @@ public abstract class Game implements Listener
|
||||
|
||||
public boolean AllowEntitySpectate = true;
|
||||
|
||||
public boolean PlayerTeamSelection = false;
|
||||
|
||||
public boolean TeamMode = false;
|
||||
|
||||
public boolean TeamPerSpawn = false;
|
||||
@ -332,6 +336,8 @@ public abstract class Game implements Listener
|
||||
private NautHashMap<Player, Player> _teamReqs = new NautHashMap<Player, Player>();
|
||||
public WinEffectManager WinEffectManager = new WinEffectManager();
|
||||
|
||||
private Map<Class<? extends Module>, Module> _modules = new HashMap<>();
|
||||
|
||||
public Game(ArcadeManager manager, GameType gameType, Kit[] kits, String[] gameDesc)
|
||||
{
|
||||
Manager = manager;
|
||||
@ -395,7 +401,7 @@ public abstract class Game implements Listener
|
||||
new ExperienceStatTracker(this), new WinStatTracker(this), new LoseStatTracker(this), new DamageDealtStatTracker(
|
||||
this), new DamageTakenStatTracker(this), new GamesPlayedStatTracker(this));
|
||||
|
||||
Manager.getResourcePackManager().setResourcePack(gameType.getResourcePackUrls(), gameType.isEnforceResourcePack());
|
||||
Manager.getResourcePackManager().setResourcePack(gameType.getResourcePackUrls(this), gameType.isEnforceResourcePack(this));
|
||||
|
||||
_useEntityPacketHandler = new IPacketHandler()
|
||||
{
|
||||
@ -418,6 +424,20 @@ public abstract class Game implements Listener
|
||||
System.out.println("Loading " + GetName() + "...");
|
||||
}
|
||||
|
||||
public void registerModule(Module module)
|
||||
{
|
||||
if (!_modules.containsKey(module.getClass()))
|
||||
{
|
||||
module.initialize(this);
|
||||
_modules.put(module.getClass(), module);
|
||||
UtilServer.RegisterEvents(module);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalStateException("Module " + module.getClass() + " is already registered");
|
||||
}
|
||||
}
|
||||
|
||||
public void setKits(Kit[] kits)
|
||||
{
|
||||
_kits = kits;
|
||||
@ -850,6 +870,11 @@ public abstract class Game implements Listener
|
||||
}
|
||||
|
||||
public void SetKit(Player player, Kit kit, boolean announce)
|
||||
{
|
||||
SetKit(player, kit, announce, true);
|
||||
}
|
||||
|
||||
public void SetKit(Player player, Kit kit, boolean announce, boolean apply)
|
||||
{
|
||||
GameTeam team = GetTeam(player);
|
||||
if (team != null)
|
||||
@ -880,7 +905,7 @@ public abstract class Game implements Listener
|
||||
UtilPlayer.message(player, F.main("Kit", "You equipped " + F.elem(kit.GetFormattedName() + " Kit") + "."));
|
||||
}
|
||||
|
||||
if (InProgress())
|
||||
if (InProgress() && apply)
|
||||
{
|
||||
kit.ApplyKit(player);
|
||||
}
|
||||
@ -1656,6 +1681,18 @@ public abstract class Game implements Listener
|
||||
// End
|
||||
SetState(GameState.End);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void disableParticles(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() == GameState.Prepare && Manager.getCosmeticManager().getGadgetManager().hideParticles())
|
||||
{
|
||||
for (Player player : GetPlayers(false))
|
||||
{
|
||||
getArcadeManager().getCosmeticManager().getGadgetManager().removeGadgetType(player, GadgetType.PARTICLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onGameStart(GameStateChangeEvent event)
|
||||
@ -1897,157 +1934,6 @@ public abstract class Game implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void teamSelectInteract(PlayerInteractEntityEvent event)
|
||||
{
|
||||
if (!PlayerTeamSelection)
|
||||
return;
|
||||
|
||||
if (GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
if (event.getRightClicked() == null)
|
||||
return;
|
||||
|
||||
if (!(event.getRightClicked() instanceof Player))
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
//Observer
|
||||
if (Manager.IsObserver(player))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Game", "Spectators cannot partake in games."));
|
||||
return;
|
||||
}
|
||||
|
||||
selectTeamMate(player, (Player) event.getRightClicked());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void teamSelectCommand(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
if (!PlayerTeamSelection)
|
||||
return;
|
||||
|
||||
if (GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
if (!event.getMessage().toLowerCase().startsWith("/team "))
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
Player target = UtilPlayer.searchOnline(event.getPlayer(), event.getMessage().split(" ")[1],
|
||||
true);
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
//Observer
|
||||
if (Manager.IsObserver(event.getPlayer()))
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(),
|
||||
F.main("Game", "Spectators cannot partake in games."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getPlayer().equals(target))
|
||||
return;
|
||||
|
||||
selectTeamMate(event.getPlayer(), target);
|
||||
}
|
||||
|
||||
public void selectTeamMate(Player player, Player ally)
|
||||
{
|
||||
//Accept Invite
|
||||
if (_teamReqs.containsKey(ally) && _teamReqs.get(ally).equals(player))
|
||||
{
|
||||
//Remove Prefs
|
||||
_teamReqs.remove(player);
|
||||
_teamReqs.remove(ally);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player,
|
||||
F.main("Game", "You accepted " + ally.getName() + "'s Team Request!"));
|
||||
UtilPlayer.message(ally,
|
||||
F.main("Game", player.getName() + " accepted your Team Request!"));
|
||||
|
||||
//Leave Old Teams
|
||||
if (GetTeam(player) != null)
|
||||
GetTeam(player).DisbandTeam();
|
||||
|
||||
if (GetTeam(ally) != null)
|
||||
GetTeam(ally).DisbandTeam();
|
||||
|
||||
//Get Team
|
||||
GameTeam team = getEmptyTeam();
|
||||
if (team == null)
|
||||
return;
|
||||
|
||||
//Join Team
|
||||
SetPlayerTeam(player, team, true);
|
||||
SetPlayerTeam(ally, team, true);
|
||||
}
|
||||
//Send Invite
|
||||
else
|
||||
{
|
||||
//Already on Team with Target
|
||||
if (GetTeam(player) != null)
|
||||
if (GetTeam(player).HasPlayer(ally))
|
||||
return;
|
||||
|
||||
//Inform Player
|
||||
UtilPlayer.message(player,
|
||||
F.main("Game", "You sent a Team Request to " + ally.getName() + "!"));
|
||||
|
||||
//Inform Target
|
||||
if (Recharge.Instance.use(player, "Team Req " + ally.getName(), 2000, false, false))
|
||||
{
|
||||
UtilPlayer.message(ally,
|
||||
F.main("Game", player.getName() + " sent you a Team Request!"));
|
||||
UtilPlayer.message(ally, F.main("Game",
|
||||
"Type " + F.elem("/team " + player.getName()) + " to accept!"));
|
||||
}
|
||||
|
||||
//Add Pref
|
||||
_teamReqs.put(player, ally);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void teamQuit(PlayerQuitEvent event)
|
||||
{
|
||||
if (!PlayerTeamSelection)
|
||||
return;
|
||||
|
||||
if (GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (GetTeam(player) != null)
|
||||
GetTeam(player).DisbandTeam();
|
||||
|
||||
Iterator<Player> teamIter = _teamReqs.keySet().iterator();
|
||||
while (teamIter.hasNext())
|
||||
{
|
||||
Player sender = teamIter.next();
|
||||
if (sender.equals(player) || _teamReqs.get(sender).equals(player))
|
||||
teamIter.remove();
|
||||
}
|
||||
}
|
||||
|
||||
public GameTeam getEmptyTeam()
|
||||
{
|
||||
for (GameTeam team : GetTeamList())
|
||||
{
|
||||
if (team.GetPlayers(false).isEmpty())
|
||||
return team;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void CustomTeamGeneration(GameStateChangeEvent event)
|
||||
{
|
||||
@ -2271,4 +2157,17 @@ public abstract class Game implements Listener
|
||||
{
|
||||
}
|
||||
|
||||
public void cleanupModules()
|
||||
{
|
||||
for (Module module : this._modules.values())
|
||||
{
|
||||
module.cleanup();
|
||||
HandlerList.unregisterAll(module);
|
||||
}
|
||||
}
|
||||
|
||||
public <T extends Module> T getModule(Class<T> clazz)
|
||||
{
|
||||
return clazz.cast(_modules.get(clazz));
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,9 @@ public class GameServerConfig
|
||||
public String BoosterGroup = null;
|
||||
public int MinPlayers = -1;
|
||||
public int MaxPlayers = -1;
|
||||
|
||||
public String Uptimes;
|
||||
|
||||
public ArrayList<GameType> GameList = new ArrayList<GameType>();
|
||||
public ArrayList<String> GameModeList = new ArrayList<String>();
|
||||
|
||||
|
@ -24,6 +24,7 @@ import org.bukkit.Location;
|
||||
import org.bukkit.entity.Creature;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scoreboard.Team;
|
||||
|
||||
public class GameTeam
|
||||
{
|
||||
@ -114,7 +115,7 @@ public class GameTeam
|
||||
return _spawns;
|
||||
}
|
||||
|
||||
private Location fixFacing(Location loc)
|
||||
public Location fixFacing(Location loc)
|
||||
{
|
||||
if (Host.FixSpawnFacing)
|
||||
{
|
||||
@ -192,7 +193,11 @@ public class GameTeam
|
||||
{
|
||||
for(Player other : UtilServer.getPlayers())
|
||||
{
|
||||
other.getScoreboard().getTeam(Host.Manager.GetClients().Get(player).GetRank().Name + _name.toUpperCase()).removePlayer(player);
|
||||
Team team = other.getScoreboard().getTeam(Host.Manager.GetClients().Get(player).GetRank().Name + _name.toUpperCase());
|
||||
if (team != null)
|
||||
{
|
||||
team.removePlayer(player);
|
||||
}
|
||||
other.getScoreboard().getTeam(Host.Manager.GetClients().Get(player).GetRank().Name).addPlayer(player);
|
||||
}
|
||||
UtilPlayer.message(player, F.main("Team", _color + C.Bold + getDisplayName() + " Team was disbanded."));
|
||||
|
@ -0,0 +1,74 @@
|
||||
package nautilus.game.arcade.game.games.bridge.modes;
|
||||
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.game.games.AbsorptionFix;
|
||||
import nautilus.game.arcade.game.games.bridge.Bridge;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* LuckyBridges gamemode for Bridges
|
||||
*
|
||||
* @author xXVevzZXx
|
||||
*/
|
||||
public class LuckyBridges extends Bridge
|
||||
{
|
||||
|
||||
private HashMap<Material, List<Material>> _drops;
|
||||
|
||||
public LuckyBridges(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.Brawl);
|
||||
|
||||
_drops = new HashMap<>();
|
||||
|
||||
_drops.put(Material.DIAMOND_ORE, Arrays.asList(
|
||||
Material.DIAMOND_HELMET, Material.DIAMOND_CHESTPLATE, Material.DIAMOND_LEGGINGS, Material.DIAMOND_BOOTS,
|
||||
Material.DIAMOND_PICKAXE, Material.DIAMOND_AXE, Material.DIAMOND_SWORD));
|
||||
|
||||
|
||||
_drops.put(Material.IRON_ORE, Arrays.asList(
|
||||
Material.IRON_HELMET, Material.IRON_CHESTPLATE, Material.IRON_LEGGINGS, Material.IRON_BOOTS,
|
||||
Material.IRON_PICKAXE, Material.IRON_AXE, Material.IRON_SWORD));
|
||||
|
||||
|
||||
_drops.put(Material.GOLD_ORE, Arrays.asList(
|
||||
Material.GOLD_HELMET, Material.GOLD_CHESTPLATE, Material.GOLD_LEGGINGS, Material.GOLD_BOOTS,
|
||||
Material.GOLD_PICKAXE, Material.GOLD_AXE, Material.GOLD_SWORD, Material.GOLDEN_APPLE));
|
||||
|
||||
new AbsorptionFix(this);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void mine(BlockBreakEvent event)
|
||||
{
|
||||
List<Material> blockDrops = _drops.get(event.getBlock().getType());
|
||||
if (blockDrops != null)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
event.getBlock().setType(Material.AIR);
|
||||
|
||||
Bukkit.getScheduler().runTask(Manager.getPlugin(), () ->
|
||||
event.getBlock().getWorld().dropItem(
|
||||
event.getBlock().getLocation().add(0.5, 0.2, 0.5),
|
||||
new ItemStack(blockDrops.get(UtilMath.r(blockDrops.size()))))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetMode()
|
||||
{
|
||||
return "Lucky Bridges";
|
||||
}
|
||||
|
||||
}
|
@ -54,12 +54,6 @@ public class OverpoweredBridge extends Bridge
|
||||
Manager.GetDamage().SetEnabled(false);
|
||||
|
||||
new AbsorptionFix(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ParseData()
|
||||
{
|
||||
_starterChests = new HashMap<>();
|
||||
_starterItems = new HashMap<>();
|
||||
|
||||
_starterItems.put(Material.WOOD, 64);
|
||||
@ -72,6 +66,12 @@ public class OverpoweredBridge extends Bridge
|
||||
_starterItems.put(Material.EXP_BOTTLE, 64);
|
||||
_starterItems.put(Material.COOKED_BEEF, 64);
|
||||
_starterItems.put(Material.DIAMOND, 300);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ParseData()
|
||||
{
|
||||
_starterChests = new HashMap<>();
|
||||
|
||||
ParseLavaBridge();
|
||||
ParseWoodBridge();
|
||||
|
@ -5,6 +5,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import nautilus.game.arcade.game.modules.TeamModule;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
@ -40,7 +41,9 @@ public class TeamBuild extends Build
|
||||
super(manager, GameType.Brawl);
|
||||
|
||||
TeamMode = true;
|
||||
PlayerTeamSelection = true;
|
||||
|
||||
registerModule(new TeamModule());
|
||||
|
||||
TeamPerSpawn = true;
|
||||
FillTeamsInOrderToCount = 2;
|
||||
|
||||
|
@ -1,9 +1,7 @@
|
||||
package nautilus.game.arcade.game.games.champions;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.inventory.data.Item;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.combat.DeathMessageType;
|
||||
@ -28,7 +26,6 @@ import nautilus.game.arcade.stats.SpecialWinStatTracker;
|
||||
import nautilus.game.arcade.stats.TheLongestShotStatTracker;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
@ -16,7 +16,6 @@ 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.managers.chat.ChatStatData;
|
||||
import nautilus.game.arcade.stats.ElectrocutionStatTracker;
|
||||
import nautilus.game.arcade.stats.KillReasonStatTracker;
|
||||
import nautilus.game.arcade.stats.SeismicSlamStatTracker;
|
||||
|
@ -16,7 +16,6 @@ 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.managers.chat.ChatStatData;
|
||||
import nautilus.game.arcade.stats.ElectrocutionStatTracker;
|
||||
import nautilus.game.arcade.stats.KillAllOpposingStatTracker;
|
||||
import nautilus.game.arcade.stats.KillReasonStatTracker;
|
||||
|
@ -0,0 +1,109 @@
|
||||
package nautilus.game.arcade.game.games.champions.modes;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.game.games.common.Domination;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitBlaze;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitChicken;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitCow;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitCreeper;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitEnderman;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitGolem;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitMagmaCube;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitPig;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSheep;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSkeletalHorse;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSkeleton;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSkySquid;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSlime;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSnowman;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSpider;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitWitch;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitWitherSkeleton;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitWolf;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitZombie;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
|
||||
/**
|
||||
* SmashDom
|
||||
*
|
||||
* @author xXVevzZXx
|
||||
*/
|
||||
public class SmashDom extends Domination
|
||||
{
|
||||
|
||||
public SmashDom(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.Brawl, new Kit[]
|
||||
{
|
||||
new KitSkeleton(manager),
|
||||
new KitGolem(manager),
|
||||
new KitSpider(manager),
|
||||
new KitSlime(manager),
|
||||
|
||||
new KitCreeper(manager),
|
||||
new KitEnderman(manager),
|
||||
new KitSnowman(manager),
|
||||
new KitWolf(manager),
|
||||
|
||||
|
||||
new KitBlaze(manager),
|
||||
new KitWitch(manager),
|
||||
new KitChicken(manager),
|
||||
new KitSkeletalHorse(manager),
|
||||
new KitPig(manager),
|
||||
new KitSkySquid(manager),
|
||||
new KitWitherSkeleton(manager),
|
||||
new KitMagmaCube(manager),
|
||||
new KitZombie(manager),
|
||||
new KitCow(manager),
|
||||
|
||||
new KitSheep(manager)
|
||||
});
|
||||
|
||||
|
||||
Manager.GetDamage().UseSimpleWeaponDamage = false;
|
||||
Manager.getCosmeticManager().setHideParticles(true);
|
||||
|
||||
Manager.getClassManager().GetItemFactory().getProximityManager().setProxyLimit(6);
|
||||
Manager.getClassManager().deregisterSelf();
|
||||
|
||||
StrictAntiHack = true;
|
||||
|
||||
InventoryOpenChest = true;
|
||||
|
||||
EnableSupply = false;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void noFallDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (event.IsCancelled())
|
||||
return;
|
||||
|
||||
if (event.GetCause() == DamageCause.FALL)
|
||||
event.SetCancelled("No Fall Damage");
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void customKnockback(CustomDamageEvent event)
|
||||
{
|
||||
if (event.IsCancelled())
|
||||
return;
|
||||
|
||||
if (event.GetDamageePlayer() != null)
|
||||
event.AddKnockback("Smash Knockback", 1 + 0.1 * (20 - event.GetDamageePlayer().getHealth()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetMode()
|
||||
{
|
||||
return "Smash Dominate";
|
||||
}
|
||||
|
||||
}
|
@ -48,6 +48,10 @@ import nautilus.game.arcade.kit.Kit;
|
||||
|
||||
public class Domination extends TeamGame
|
||||
{
|
||||
//Configuration
|
||||
public boolean EnableEmerald = true;
|
||||
public boolean EnableSupply = true;
|
||||
|
||||
//Map Data
|
||||
private ArrayList<CapturePoint> _points = new ArrayList<CapturePoint>();
|
||||
private ArrayList<Emerald> _emerald = new ArrayList<Emerald>();
|
||||
@ -179,10 +183,20 @@ public class Domination extends TeamGame
|
||||
public void PowerupPickup(PlayerPickupItemEvent event)
|
||||
{
|
||||
for (Emerald cur : _emerald)
|
||||
cur.Pickup(event.getPlayer(), event.getItem());
|
||||
{
|
||||
if (EnableEmerald)
|
||||
cur.Pickup(event.getPlayer(), event.getItem());
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
for (Resupply cur : _resupply)
|
||||
cur.Pickup(event.getPlayer(), event.getItem());
|
||||
{
|
||||
if (EnableSupply)
|
||||
cur.Pickup(event.getPlayer(), event.getItem());
|
||||
else
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -0,0 +1,109 @@
|
||||
package nautilus.game.arcade.game.games.gladiators.modes;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.game.games.gladiators.ArenaType;
|
||||
import nautilus.game.arcade.game.games.gladiators.Gladiators;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitBlaze;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitChicken;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitCow;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitCreeper;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitEnderman;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitGolem;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitMagmaCube;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitPig;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSheep;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSkeletalHorse;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSkeleton;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSkySquid;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSlime;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSnowman;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSpider;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitWitch;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitWitherSkeleton;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitWolf;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitZombie;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
|
||||
/**
|
||||
* SmashGladiators
|
||||
*
|
||||
* @author xXVevzZXx
|
||||
*/
|
||||
public class SmashGladiators extends Gladiators
|
||||
{
|
||||
public SmashGladiators(ArcadeManager manager)
|
||||
{
|
||||
super(manager, new Kit[]
|
||||
{
|
||||
new KitSkeleton(manager),
|
||||
new KitGolem(manager),
|
||||
new KitSpider(manager),
|
||||
new KitSlime(manager),
|
||||
|
||||
new KitCreeper(manager),
|
||||
new KitEnderman(manager),
|
||||
new KitSnowman(manager),
|
||||
new KitWolf(manager),
|
||||
|
||||
|
||||
new KitBlaze(manager),
|
||||
new KitWitch(manager),
|
||||
new KitChicken(manager),
|
||||
new KitSkeletalHorse(manager),
|
||||
new KitPig(manager),
|
||||
new KitSkySquid(manager),
|
||||
new KitWitherSkeleton(manager),
|
||||
new KitMagmaCube(manager),
|
||||
new KitZombie(manager),
|
||||
new KitCow(manager),
|
||||
|
||||
new KitSheep(manager)
|
||||
}, GameType.Brawl);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void noFallDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (event.IsCancelled())
|
||||
return;
|
||||
|
||||
if (event.GetCause() == DamageCause.FALL)
|
||||
event.SetCancelled("No Fall Damage");
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void customKnockback(CustomDamageEvent event)
|
||||
{
|
||||
if (event.IsCancelled())
|
||||
return;
|
||||
|
||||
if (event.GetDamageePlayer() != null)
|
||||
event.AddKnockback("Smash Knockback", 1 + 0.1 * (20 - event.GetDamageePlayer().getHealth()));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void giveLoadout(Player p, ArenaType type)
|
||||
{
|
||||
if (!GetPlayers(true).contains(p))
|
||||
return;
|
||||
|
||||
GetKit(p).ApplyKit(p);
|
||||
|
||||
p.playSound(p.getLocation(), Sound.LEVEL_UP, 1f, 1f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetMode()
|
||||
{
|
||||
return "Smash Gladiators";
|
||||
}
|
||||
}
|
@ -4,6 +4,15 @@ import mineplex.core.common.util.*;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.packethandler.IPacketHandler;
|
||||
import mineplex.core.packethandler.PacketInfo;
|
||||
@ -311,13 +320,14 @@ public class HideSeek extends TeamGame
|
||||
{
|
||||
if (event.GetState() == GameState.Prepare)
|
||||
{
|
||||
System.out.println("prep");
|
||||
this.getArcadeManager().getPacketHandler().addPacketHandler(_blockDisguise, PacketPlayOutSpawnEntityLiving.class, PacketPlayOutEntityDestroy.class);
|
||||
this.getArcadeManager().getPacketHandler().addPacketHandler(_useEntity, true, PacketPlayInUseEntity.class);
|
||||
}
|
||||
else if (event.GetState() == GameState.Dead)
|
||||
{
|
||||
this.getArcadeManager().getPacketHandler().removePacketHandler(_blockDisguise);
|
||||
this.getArcadeManager().getPacketHandler().removePacketHandler(_useEntity);
|
||||
this.getArcadeManager().getPacketHandler().removePacketHandler(_blockDisguise);
|
||||
this.getArcadeManager().getPacketHandler().removePacketHandler(_useEntity);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,19 @@ public class Micro extends TeamGame
|
||||
private ArrayList<Block> _blocks = new ArrayList<Block>();
|
||||
private ArrayList<Block> _glass = new ArrayList<Block>();
|
||||
|
||||
public Micro(ArcadeManager manager, GameType type)
|
||||
{
|
||||
this(manager,
|
||||
|
||||
new Kit[]
|
||||
{
|
||||
new KitArcher(manager),
|
||||
new KitWorker(manager),
|
||||
new KitFighter(manager)
|
||||
},
|
||||
GameType.Micro);
|
||||
}
|
||||
|
||||
public Micro(ArcadeManager manager, Kit[] kits, GameType type)
|
||||
{
|
||||
super(manager, type, kits,
|
||||
@ -54,16 +67,8 @@ public class Micro extends TeamGame
|
||||
|
||||
public Micro(ArcadeManager manager)
|
||||
{
|
||||
this(manager,
|
||||
|
||||
new Kit[]
|
||||
{
|
||||
new KitArcher(manager),
|
||||
new KitWorker(manager),
|
||||
new KitFighter(manager)
|
||||
},
|
||||
GameType.Micro);
|
||||
|
||||
this(manager, GameType.Micro);
|
||||
|
||||
registerStatTrackers(
|
||||
new KillsWithinGameStatTracker(this, 8, "Annihilation")
|
||||
);
|
||||
|
@ -0,0 +1,55 @@
|
||||
package nautilus.game.arcade.game.games.micro.modes;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.games.micro.Micro;
|
||||
|
||||
/**
|
||||
* CookieFight
|
||||
*
|
||||
* @author xXVevzZXx
|
||||
*/
|
||||
public class CookieFight extends Micro
|
||||
{
|
||||
|
||||
private int _enchantmentLevel;
|
||||
|
||||
public CookieFight(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.Brawl);
|
||||
|
||||
_enchantmentLevel = 250;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void cookie(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Live)
|
||||
return;
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
ItemStack item = new ItemStack(Material.COOKIE);
|
||||
item.addUnsafeEnchantment(Enchantment.KNOCKBACK, _enchantmentLevel);
|
||||
player.getInventory().addItem(item);
|
||||
|
||||
UtilPlayer.message(player, F.main("Game", "Oh look, you got a Cookie!"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetMode()
|
||||
{
|
||||
return "Cookie Fight";
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package nautilus.game.arcade.game.games.micro.modes;
|
||||
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.game.games.AbsorptionFix;
|
||||
import nautilus.game.arcade.game.games.micro.Micro;
|
||||
import nautilus.game.arcade.game.games.micro.modes.kits.KitOverlord;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
|
||||
/**
|
||||
* OPMicroBattles
|
||||
*
|
||||
* @author xXVevzZXx
|
||||
*/
|
||||
public class OverpoweredMicroBattles extends Micro
|
||||
{
|
||||
|
||||
public OverpoweredMicroBattles(ArcadeManager manager)
|
||||
{
|
||||
super(manager,
|
||||
new Kit[]
|
||||
{
|
||||
new KitOverlord(manager)
|
||||
},
|
||||
GameType.Brawl);
|
||||
|
||||
TeamArmor = false;
|
||||
|
||||
new AbsorptionFix(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetMode()
|
||||
{
|
||||
return "OP Micro Battles";
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
package nautilus.game.arcade.game.games.micro.modes;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.game.games.micro.Micro;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitBlaze;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitChicken;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitCow;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitCreeper;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitEnderman;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitGolem;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitMagmaCube;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitPig;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSheep;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSkeletalHorse;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSkeleton;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSkySquid;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSlime;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSnowman;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSpider;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitWitch;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitWitherSkeleton;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitWolf;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitZombie;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
|
||||
/**
|
||||
* TinySmash
|
||||
*
|
||||
* @author xXVevzZXx
|
||||
*/
|
||||
public class TinySmash extends Micro
|
||||
{
|
||||
|
||||
public TinySmash(ArcadeManager manager)
|
||||
{
|
||||
super(manager, new Kit[]
|
||||
{
|
||||
new KitSkeleton(manager),
|
||||
new KitGolem(manager),
|
||||
new KitSpider(manager),
|
||||
new KitSlime(manager),
|
||||
|
||||
new KitCreeper(manager),
|
||||
new KitEnderman(manager),
|
||||
new KitSnowman(manager),
|
||||
new KitWolf(manager),
|
||||
|
||||
|
||||
new KitBlaze(manager),
|
||||
new KitWitch(manager),
|
||||
new KitChicken(manager),
|
||||
new KitSkeletalHorse(manager),
|
||||
new KitPig(manager),
|
||||
new KitSkySquid(manager),
|
||||
new KitWitherSkeleton(manager),
|
||||
new KitMagmaCube(manager),
|
||||
new KitZombie(manager),
|
||||
new KitCow(manager),
|
||||
|
||||
new KitSheep(manager)
|
||||
}, GameType.Brawl);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void noFallDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (event.IsCancelled())
|
||||
return;
|
||||
|
||||
if (event.GetCause() == DamageCause.FALL)
|
||||
event.SetCancelled("No Fall Damage");
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void customKnockback(CustomDamageEvent event)
|
||||
{
|
||||
if (event.IsCancelled())
|
||||
return;
|
||||
|
||||
if (event.GetDamageePlayer() != null)
|
||||
event.AddKnockback("Smash Knockback", 1 + 0.1 * (20 - event.GetDamageePlayer().getHealth()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetMode()
|
||||
{
|
||||
return "Tiny Smash";
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package nautilus.game.arcade.game.games.micro.modes.kits;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.ProgressingKit;
|
||||
import nautilus.game.arcade.kit.perks.PerkFletcher;
|
||||
|
||||
public class KitOverlord extends ProgressingKit
|
||||
{
|
||||
private static final String[] DESCRIPTION = {
|
||||
"You tell me I'm OP?!",
|
||||
};
|
||||
|
||||
private static final Perk[] PERKS = {
|
||||
new PerkFletcher(3, 16, true)
|
||||
};
|
||||
|
||||
private static final ItemStack IN_HAND = new ItemStack(Material.GOLDEN_APPLE);
|
||||
|
||||
private static final ItemStack[] PLAYER_ITEMS = {
|
||||
ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD),
|
||||
ItemStackFactory.Instance.CreateStack(Material.DIAMOND_PICKAXE),
|
||||
ItemStackFactory.Instance.CreateStack(Material.BOW),
|
||||
ItemStackFactory.Instance.CreateStack(Material.GOLDEN_APPLE, 5)
|
||||
};
|
||||
|
||||
public KitOverlord(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Overlord", "microoverlord", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
player.getInventory().addItem(PLAYER_ITEMS);
|
||||
|
||||
player.getInventory().setHelmet(new ItemStack(Material.DIAMOND_HELMET));
|
||||
player.getInventory().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE));
|
||||
player.getInventory().setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS));
|
||||
player.getInventory().setBoots(new ItemStack(Material.DIAMOND_BOOTS));
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package nautilus.game.arcade.game.games.minestrike;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.game.games.minestrike.data.Bullet;
|
||||
|
||||
public class CustomGunDamageEvent extends PlayerEvent
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
private Bullet _bullet;
|
||||
private final boolean _headshot;
|
||||
private CustomDamageEvent _damageEvent;
|
||||
private GunModule _game;
|
||||
|
||||
public CustomGunDamageEvent(Bullet _bullet, Player _target, boolean _headshot, CustomDamageEvent _damageEvent, GunModule game)
|
||||
{
|
||||
super(_target);
|
||||
this._bullet = _bullet;
|
||||
this._headshot = _headshot;
|
||||
this._damageEvent = _damageEvent;
|
||||
this._game = game;
|
||||
}
|
||||
|
||||
public Bullet getBullet()
|
||||
{
|
||||
return _bullet;
|
||||
}
|
||||
|
||||
public boolean isHeadshot()
|
||||
{
|
||||
return _headshot;
|
||||
}
|
||||
|
||||
public CustomDamageEvent getDamageEvent()
|
||||
{
|
||||
return _damageEvent;
|
||||
}
|
||||
|
||||
public GunModule getGame()
|
||||
{
|
||||
return _game;
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,35 @@
|
||||
package nautilus.game.arcade.game.games.minestrike;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
public class PlayerHeadshotEvent extends PlayerEvent
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
private final Player _shooter;
|
||||
|
||||
public PlayerHeadshotEvent(Player who, Player shooter)
|
||||
{
|
||||
super(who);
|
||||
|
||||
_shooter = shooter;
|
||||
}
|
||||
|
||||
public Player getShooter()
|
||||
{
|
||||
return _shooter;
|
||||
}
|
||||
}
|
@ -35,15 +35,15 @@ import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
|
||||
public class ShopManager
|
||||
{
|
||||
private MineStrike Host;
|
||||
private Minestrike Host;
|
||||
|
||||
private HashMap<Player, HashMap<Integer, StrikeItem>> _shop = new HashMap<Player, HashMap<Integer, StrikeItem>>();
|
||||
private HashMap<Player, Integer> _money = new HashMap<Player, Integer>();
|
||||
private HashSet<Player> _inShop = new HashSet<Player>();
|
||||
|
||||
public ShopManager(MineStrike host)
|
||||
public ShopManager(Minestrike minestrike)
|
||||
{
|
||||
Host = host;
|
||||
Host = minestrike;
|
||||
}
|
||||
|
||||
public void enterShop(Player player)
|
||||
@ -60,27 +60,27 @@ public class ShopManager
|
||||
|
||||
//Pistols
|
||||
slot = 9;
|
||||
addItem(team.GetColor() == ChatColor.RED ? new Gun(GunStats.GLOCK_18) : new Gun(GunStats.P2000), player, slot++);
|
||||
addItem(new Gun(GunStats.P250), player, slot++);
|
||||
addItem(new Gun(GunStats.CZ75), player, slot++);
|
||||
addItem(new Gun(GunStats.DEAGLE), player, slot++);
|
||||
addItem(team.GetColor() == ChatColor.RED ? new Gun(GunStats.GLOCK_18, Host.getGunModule()) : new Gun(GunStats.P2000, Host.getGunModule()), player, slot++);
|
||||
addItem(new Gun(GunStats.P250, Host.getGunModule()), player, slot++);
|
||||
addItem(new Gun(GunStats.CZ75, Host.getGunModule()), player, slot++);
|
||||
addItem(new Gun(GunStats.DEAGLE, Host.getGunModule()), player, slot++);
|
||||
|
||||
//Shotgun
|
||||
slot = 18;
|
||||
addItem(new Shotgun(GunStats.NOVA), player, slot++);
|
||||
addItem(new Shotgun(GunStats.XM1014), player, slot++);
|
||||
addItem(new Shotgun(GunStats.NOVA, Host.getGunModule()), player, slot++);
|
||||
addItem(new Shotgun(GunStats.XM1014, Host.getGunModule()), player, slot++);
|
||||
|
||||
//SMG
|
||||
addItem(new Gun(GunStats.PPBIZON), player, slot++);
|
||||
addItem(new Gun(GunStats.P90), player, slot++);
|
||||
addItem(new Gun(GunStats.PPBIZON, Host.getGunModule()), player, slot++);
|
||||
addItem(new Gun(GunStats.P90, Host.getGunModule()), player, slot++);
|
||||
|
||||
//Rifles
|
||||
slot = 27;
|
||||
addItem(team.GetColor() == ChatColor.RED ? new Gun(GunStats.GALIL) : new Gun(GunStats.FAMAS), player, slot++);
|
||||
addItem(team.GetColor() == ChatColor.RED ? new Gun(GunStats.AK47) : new Gun(GunStats.M4A4), player, slot++);
|
||||
addItem(team.GetColor() == ChatColor.RED ? new Gun(GunStats.SG553) : new Gun(GunStats.AUG), player, slot++);
|
||||
addItem(new Gun(GunStats.SSG08), player, slot++);
|
||||
addItem(new Gun(GunStats.AWP), player, slot++);
|
||||
addItem(team.GetColor() == ChatColor.RED ? new Gun(GunStats.GALIL, Host.getGunModule()) : new Gun(GunStats.FAMAS, Host.getGunModule()), player, slot++);
|
||||
addItem(team.GetColor() == ChatColor.RED ? new Gun(GunStats.AK47, Host.getGunModule()) : new Gun(GunStats.M4A4, Host.getGunModule()), player, slot++);
|
||||
addItem(team.GetColor() == ChatColor.RED ? new Gun(GunStats.SG553, Host.getGunModule()) : new Gun(GunStats.AUG, Host.getGunModule()), player, slot++);
|
||||
addItem(new Gun(GunStats.SSG08, Host.getGunModule()), player, slot++);
|
||||
addItem(new Gun(GunStats.AWP, Host.getGunModule()), player, slot++);
|
||||
|
||||
//Grenades
|
||||
addItem(new FlashBang(), player, 14);
|
||||
@ -203,10 +203,11 @@ public class ShopManager
|
||||
|
||||
if (item == null)
|
||||
return;
|
||||
|
||||
|
||||
if (hasItem(player, item))
|
||||
return;
|
||||
|
||||
|
||||
if (getMoney(player) < item.getCost())
|
||||
{
|
||||
player.playSound(player.getLocation(), Sound.NOTE_BASS, 1f, 1f);
|
||||
@ -217,11 +218,11 @@ public class ShopManager
|
||||
if (item instanceof Gun)
|
||||
{
|
||||
Gun gun = (Gun)item;
|
||||
Host.dropSlotItem(player, gun.getSlot());
|
||||
Host.getGunModule().dropSlotItem(player, gun.getSlot());
|
||||
gun.giveToPlayer(player, true);
|
||||
gun.updateWeaponName(player, Host);
|
||||
gun.updateWeaponName(player, Host.getGunModule());
|
||||
gun.updateSkin(player, Host.getArcadeManager().getCosmeticManager().getGadgetManager());
|
||||
Host.registerGun(gun, player);
|
||||
Host.getGunModule().registerGun(gun, player);
|
||||
}
|
||||
|
||||
//Grenade
|
||||
@ -235,7 +236,7 @@ public class ShopManager
|
||||
return;
|
||||
}
|
||||
|
||||
Host.registerGrenade(grenade, player);
|
||||
Host.getGunModule().registerGrenade(grenade, player);
|
||||
}
|
||||
|
||||
//Use 250 instead of 255, to show that its kevlar/helmet
|
||||
|
@ -2,7 +2,7 @@ package nautilus.game.arcade.game.games.minestrike.data;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.minestrike.GunModule;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.guns.Gun;
|
||||
|
||||
import org.bukkit.Location;
|
||||
@ -25,7 +25,7 @@ public class Bullet
|
||||
|
||||
public HashSet<Player> WhizzSound = new HashSet<Player>();
|
||||
|
||||
public Bullet(Entity bullet, Gun gun, Player shooter, MineStrike game)
|
||||
public Bullet(Entity bullet, Gun gun, Player shooter, GunModule game)
|
||||
{
|
||||
Bullet = bullet;
|
||||
Gun = gun;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package nautilus.game.arcade.game.games.minestrike.items;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -17,9 +18,10 @@ import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.minestrike.GunModule;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.grenades.Grenade;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.guns.Gun;
|
||||
|
||||
@ -36,6 +38,8 @@ public abstract class StrikeItem
|
||||
private String _ownerName;
|
||||
|
||||
private ItemStack _stack = null;
|
||||
|
||||
private int _identifier;
|
||||
|
||||
public StrikeItem(StrikeItemType type, String name, String[] desc, int cost, int gemCost, Material skin)
|
||||
{
|
||||
@ -48,6 +52,11 @@ public abstract class StrikeItem
|
||||
|
||||
//Make Stack
|
||||
_stack = new ItemStack(skin);
|
||||
|
||||
_identifier = UtilMath.r(9000) + 1000;
|
||||
|
||||
addID();
|
||||
|
||||
fixStackName();
|
||||
}
|
||||
|
||||
@ -86,12 +95,20 @@ public abstract class StrikeItem
|
||||
return _skinData;
|
||||
}
|
||||
|
||||
public void addID()
|
||||
{
|
||||
ItemMeta meta = _stack.getItemMeta();
|
||||
meta.setLore(Arrays.asList(ChatColor.RED + "" + ChatColor.BOLD + "Identifier: " + _identifier));
|
||||
_stack.setItemMeta(meta);
|
||||
}
|
||||
|
||||
public void setSkin(Material skinMaterial, byte skinData)
|
||||
{
|
||||
_skinMaterial = skinMaterial;
|
||||
_skinData = skinData;
|
||||
|
||||
_stack = new ItemStack(skinMaterial, 1, (short) 0, skinData);
|
||||
addID();
|
||||
}
|
||||
|
||||
public String getOwnerName()
|
||||
@ -104,7 +121,7 @@ public abstract class StrikeItem
|
||||
_ownerName = ownerName;
|
||||
}
|
||||
|
||||
public void drop(MineStrike game, Player player, boolean natural, boolean onlyDeregisterAndRemove)
|
||||
public void drop(GunModule game, Player player, boolean natural, boolean onlyDeregisterAndRemove)
|
||||
{
|
||||
_stack.setAmount(1);
|
||||
|
||||
@ -160,6 +177,22 @@ public abstract class StrikeItem
|
||||
|
||||
public boolean isStack(ItemStack stack)
|
||||
{
|
||||
if (stack.hasItemMeta())
|
||||
{
|
||||
if (stack.getItemMeta().hasLore())
|
||||
{
|
||||
if (getStack().hasItemMeta())
|
||||
{
|
||||
if (getStack().getItemMeta().hasLore())
|
||||
{
|
||||
if (UtilGear.isMat(stack, _skinMaterial))
|
||||
return stack.getItemMeta().getLore().get(0).equalsIgnoreCase(getStack().getItemMeta().getLore().get(0));
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return UtilGear.isMat(stack, _skinMaterial);
|
||||
}
|
||||
|
||||
@ -184,7 +217,7 @@ public abstract class StrikeItem
|
||||
_stack.setItemMeta(meta);
|
||||
}
|
||||
|
||||
public abstract boolean pickup(MineStrike game, Player player);
|
||||
public abstract boolean pickup(GunModule game, Player player);
|
||||
|
||||
public ItemStack getShopItem(int money, boolean alreadyHas)
|
||||
{
|
||||
|
@ -8,7 +8,7 @@ import org.bukkit.entity.Player;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.minestrike.GunModule;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItem;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
|
||||
|
||||
@ -24,7 +24,7 @@ public class DefusalKit extends StrikeItem
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pickup(MineStrike game, Player player)
|
||||
public boolean pickup(GunModule game, Player player)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.minestrike.GunModule;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItem;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
|
||||
|
||||
@ -23,7 +23,7 @@ public class Armor extends StrikeItem
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pickup(MineStrike game, Player player)
|
||||
public boolean pickup(GunModule game, Player player)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -2,16 +2,6 @@ package nautilus.game.arcade.game.games.minestrike.items.grenades;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.minestrike.Radio;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -21,6 +11,15 @@ import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
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.UtilServer;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.minestrike.GunModule;
|
||||
import nautilus.game.arcade.game.games.minestrike.Radio;
|
||||
|
||||
public abstract class FireGrenadeBase extends Grenade
|
||||
{
|
||||
private long _baseTime;
|
||||
@ -37,7 +36,7 @@ public abstract class FireGrenadeBase extends Grenade
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateCustom(MineStrike game, Entity ent)
|
||||
public boolean updateCustom(GunModule game, Entity ent)
|
||||
{
|
||||
// Fixed grenade effect not being activated when thrown in the ground.
|
||||
// Looks like ent.isOnGround() worked, while we previously used UtilEnt.isGrounded(ent).
|
||||
@ -52,7 +51,7 @@ public abstract class FireGrenadeBase extends Grenade
|
||||
return false;
|
||||
}
|
||||
|
||||
private void createFire(final MineStrike game, final Location loc)
|
||||
private void createFire(final GunModule game, final Location loc)
|
||||
{
|
||||
//Sound
|
||||
loc.getWorld().playSound(loc, Sound.IRONGOLEM_THROW, 1f, 1f);
|
||||
@ -114,9 +113,9 @@ public abstract class FireGrenadeBase extends Grenade
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playSound(MineStrike game, Player player)
|
||||
public void playSound(GunModule game, Player player)
|
||||
{
|
||||
GameTeam team = game.GetTeam(player);
|
||||
GameTeam team = game.getHost().GetTeam(player);
|
||||
if (team == null)
|
||||
return;
|
||||
|
||||
|
@ -9,7 +9,7 @@ import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.minestrike.GunModule;
|
||||
import nautilus.game.arcade.game.games.minestrike.Radio;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
@ -33,7 +33,7 @@ public class FlashBang extends Grenade
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateCustom(MineStrike game, Entity ent)
|
||||
public boolean updateCustom(GunModule game, Entity ent)
|
||||
{
|
||||
if (UtilTime.elapsed(_throwTime, 2000))
|
||||
{
|
||||
@ -43,7 +43,7 @@ public class FlashBang extends Grenade
|
||||
HashMap<Player, Double> players = UtilPlayer.getInRadius(ent.getLocation(), 48);
|
||||
for (Player player : players.keySet())
|
||||
{
|
||||
if (!game.IsAlive(player))
|
||||
if (!game.getHost().IsAlive(player))
|
||||
continue;
|
||||
|
||||
//Line of Sight
|
||||
@ -83,9 +83,9 @@ public class FlashBang extends Grenade
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playSound(MineStrike game, Player player)
|
||||
public void playSound(GunModule game, Player player)
|
||||
{
|
||||
GameTeam team = game.GetTeam(player);
|
||||
GameTeam team = game.getHost().GetTeam(player);
|
||||
if (team == null)
|
||||
return;
|
||||
|
||||
|
@ -11,6 +11,7 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
@ -20,7 +21,7 @@ import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.minestrike.GunModule;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItem;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
|
||||
|
||||
@ -132,9 +133,20 @@ public abstract class Grenade extends StrikeItem
|
||||
return true;
|
||||
}
|
||||
|
||||
public void throwGrenade(Player player, boolean wasLeftClick, MineStrike game)
|
||||
{
|
||||
player.setItemInHand(null);
|
||||
public void throwGrenade(Player player, boolean wasLeftClick, GunModule game)
|
||||
{
|
||||
|
||||
if (player.getItemInHand().getAmount() < 2)
|
||||
{
|
||||
player.setItemInHand(null);
|
||||
}
|
||||
else
|
||||
{
|
||||
int amount = player.getItemInHand().getAmount();
|
||||
ItemStack stack = getStack();
|
||||
stack.setAmount(amount - 1);
|
||||
player.setItemInHand(stack);
|
||||
}
|
||||
|
||||
_thrower = player;
|
||||
|
||||
@ -151,9 +163,13 @@ public abstract class Grenade extends StrikeItem
|
||||
_lastLoc = ent.getLocation();
|
||||
|
||||
UtilPlayer.message(player, F.main("Game", "You threw " + getName() + "."));
|
||||
|
||||
|
||||
game.registerThrownGrenade(ent, this);
|
||||
game.deregisterGrenade(this);
|
||||
|
||||
if (player.getItemInHand().getAmount() < 2)
|
||||
{
|
||||
game.deregisterGrenade(this);
|
||||
}
|
||||
|
||||
//Sound
|
||||
playSound(game, player);
|
||||
@ -161,7 +177,7 @@ public abstract class Grenade extends StrikeItem
|
||||
_throwTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public boolean update(MineStrike game, Entity ent)
|
||||
public boolean update(GunModule game, Entity ent)
|
||||
{
|
||||
if (UtilTime.elapsed(_throwTime, 20000))
|
||||
return true;
|
||||
@ -233,10 +249,10 @@ public abstract class Grenade extends StrikeItem
|
||||
_lastLoc = ent.getLocation();
|
||||
}
|
||||
|
||||
public abstract boolean updateCustom(MineStrike game, Entity ent);
|
||||
public abstract boolean updateCustom(GunModule game, Entity ent);
|
||||
|
||||
@Override
|
||||
public boolean pickup(MineStrike game, Player player)
|
||||
public boolean pickup(GunModule game, Player player)
|
||||
{
|
||||
if (giveToPlayer(player, false))
|
||||
{
|
||||
@ -255,5 +271,5 @@ public abstract class Grenade extends StrikeItem
|
||||
return C.cDGreen + C.Bold + "Grenade" + ChatColor.RESET;
|
||||
}
|
||||
|
||||
public abstract void playSound(MineStrike game, Player player);
|
||||
public abstract void playSound(GunModule game, Player player);
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.minestrike.GunModule;
|
||||
import nautilus.game.arcade.game.games.minestrike.Radio;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
@ -34,7 +34,7 @@ public class HighExplosive extends Grenade
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateCustom(MineStrike game, Entity ent)
|
||||
public boolean updateCustom(GunModule game, Entity ent)
|
||||
{
|
||||
if (UtilTime.elapsed(_throwTime, 2000))
|
||||
{
|
||||
@ -48,12 +48,12 @@ public class HighExplosive extends Grenade
|
||||
List<Player> damagedPlayers = new ArrayList<>();
|
||||
for (Player player : players.keySet())
|
||||
{
|
||||
if (!game.IsAlive(player))
|
||||
if (!game.getHost().IsAlive(player))
|
||||
continue;
|
||||
|
||||
// Damage Event
|
||||
Player damager = null;
|
||||
if (game.IsAlive(_thrower))
|
||||
if (game.getHost().IsAlive(_thrower))
|
||||
{
|
||||
damager = _thrower;
|
||||
}
|
||||
@ -74,9 +74,9 @@ public class HighExplosive extends Grenade
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playSound(MineStrike game, Player player)
|
||||
public void playSound(GunModule game, Player player)
|
||||
{
|
||||
GameTeam team = game.GetTeam(player);
|
||||
GameTeam team = game.getHost().GetTeam(player);
|
||||
if (team == null)
|
||||
return;
|
||||
|
||||
|
@ -10,7 +10,7 @@ import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.minestrike.GunModule;
|
||||
import nautilus.game.arcade.game.games.minestrike.Radio;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
@ -36,7 +36,7 @@ public class Smoke extends Grenade
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateCustom(final MineStrike game, Entity ent)
|
||||
public boolean updateCustom(final GunModule game, Entity ent)
|
||||
{
|
||||
if (UtilTime.elapsed(_throwTime, 2000) && (UtilEnt.isGrounded(ent) || !ent.isValid()))
|
||||
{
|
||||
@ -95,9 +95,9 @@ public class Smoke extends Grenade
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playSound(MineStrike game, Player player)
|
||||
public void playSound(GunModule game, Player player)
|
||||
{
|
||||
GameTeam team = game.GetTeam(player);
|
||||
GameTeam team = game.getHost().GetTeam(player);
|
||||
if (team == null)
|
||||
return;
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package nautilus.game.arcade.game.games.minestrike.items.guns;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
@ -32,10 +33,11 @@ import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.GameModifierMineStrikeSkin;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.MineStrikeSkin;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.recharge.RechargedEvent;
|
||||
import mineplex.core.stats.PlayerStats;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.minestrike.GunModule;
|
||||
import nautilus.game.arcade.game.games.minestrike.data.Bullet;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItem;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
|
||||
@ -59,11 +61,15 @@ public class Gun extends StrikeItem
|
||||
|
||||
protected int _kills = -1;
|
||||
protected String _activeSkinName = "Default";
|
||||
|
||||
protected GunModule _module;
|
||||
|
||||
public Gun(GunStats gunStats)
|
||||
public Gun(GunStats gunStats, GunModule module)
|
||||
{
|
||||
super(gunStats.getItemType(), gunStats.getName(), gunStats.getDesc(), gunStats.getCost(), gunStats.getGemCost(), gunStats.getSkin());
|
||||
|
||||
|
||||
_module = module;
|
||||
|
||||
_gunStats = gunStats;
|
||||
|
||||
if (gunStats.getItemType() == StrikeItemType.PRIMARY_WEAPON)
|
||||
@ -75,11 +81,11 @@ public class Gun extends StrikeItem
|
||||
|
||||
_loadedAmmo = gunStats.getClipSize();
|
||||
_reserveAmmo = gunStats.getClipReserve() * gunStats.getClipSize();
|
||||
|
||||
|
||||
updateWeaponName(null, null);
|
||||
}
|
||||
|
||||
public void shoot(final Player player, final MineStrike game)
|
||||
public void shoot(final Player player, final GunModule game)
|
||||
{
|
||||
if (_reloading)
|
||||
return;
|
||||
@ -94,7 +100,7 @@ public class Gun extends StrikeItem
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
if (game.IsAlive(player))
|
||||
if (game.getHost().IsAlive(player))
|
||||
shootOnce(player, game);
|
||||
}
|
||||
}, 2);
|
||||
@ -109,7 +115,7 @@ public class Gun extends StrikeItem
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
if (game.IsAlive(player))
|
||||
if (game.getHost().IsAlive(player))
|
||||
shootOnce(player, game);
|
||||
}
|
||||
}, i);
|
||||
@ -117,7 +123,7 @@ public class Gun extends StrikeItem
|
||||
}
|
||||
}
|
||||
|
||||
public void shootOnce(Player player, MineStrike game)
|
||||
public void shootOnce(Player player, GunModule game)
|
||||
{
|
||||
if (_reloading)
|
||||
return;
|
||||
@ -167,7 +173,7 @@ public class Gun extends StrikeItem
|
||||
reload(player);
|
||||
}
|
||||
|
||||
public Bullet fireBullet(Player player, MineStrike game)
|
||||
public Bullet fireBullet(Player player, GunModule game)
|
||||
{
|
||||
//Instant?
|
||||
boolean instant = game.getBulletType() == 1 || (game.getBulletType() == 2 && _gunStats.getGunType() == GunType.SNIPER);
|
||||
@ -186,7 +192,7 @@ public class Gun extends StrikeItem
|
||||
Vector cof = new Vector(Math.random() - 0.5, (Math.random() - 0.2) * (5d/8d), Math.random() - 0.5);
|
||||
cof.normalize();
|
||||
cof.multiply(cone);
|
||||
cof.multiply(MineStrike.CONE);
|
||||
cof.multiply(_module.CONE);
|
||||
|
||||
cof.add(player.getLocation().getDirection());
|
||||
cof.normalize();
|
||||
@ -307,12 +313,12 @@ public class Gun extends StrikeItem
|
||||
|
||||
public void displayAmmo(Player player)
|
||||
{
|
||||
if (!UtilGear.isMat(player.getItemInHand(), getStack().getType()))
|
||||
if (_module.getGunInHand(player, null) != this)
|
||||
return;
|
||||
|
||||
//Weapon Bob during reload
|
||||
if (_reloading)
|
||||
updateWeaponName(player, null);
|
||||
updateWeaponName(player, null, false);
|
||||
|
||||
if (!Recharge.Instance.usable(player, getName() + " Reload"))
|
||||
return;
|
||||
@ -323,7 +329,7 @@ public class Gun extends StrikeItem
|
||||
UtilTextBottom.display(C.cRed + "No Ammo", player);
|
||||
}
|
||||
|
||||
public void updateWeaponName(Player player, MineStrike game)
|
||||
public void updateWeaponName(Player player, GunModule game, boolean setItem)
|
||||
{
|
||||
if(game != null)
|
||||
{
|
||||
@ -331,24 +337,24 @@ public class Gun extends StrikeItem
|
||||
{
|
||||
new BukkitRunnable() {
|
||||
public void run() {
|
||||
PlayerStats remoteStats = game.getArcadeManager().GetStatsManager().Get(player);
|
||||
_kills = (int) remoteStats.getStat(game.GetName() + "." + getStatNameKills(true));
|
||||
PlayerStats remoteStats = game.getHost().getArcadeManager().GetStatsManager().Get(player);;
|
||||
_kills = (int) remoteStats.getStat(game.getHost().GetName() + "." + getStatNameKills(true));
|
||||
|
||||
Player owner = UtilPlayer.searchExact(getOwnerName());
|
||||
if(owner != null) {
|
||||
HashMap<String, Integer> localStatsMap = game.GetStats().get(owner);
|
||||
HashMap<String, Integer> localStatsMap = game.getHost().GetStats().get(owner);
|
||||
if(localStatsMap != null)
|
||||
{
|
||||
Integer kills = localStatsMap.get(game.GetName() + "." + getStatNameKills(true));
|
||||
Integer kills = localStatsMap.get(game.getHost().GetName() + "." + getStatNameKills(true));
|
||||
if(kills != null)
|
||||
{
|
||||
_kills += kills.intValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
updateWeaponName(player, null);
|
||||
updateWeaponName(player, null, setItem);
|
||||
}
|
||||
}.runTaskAsynchronously(game.getArcadeManager().getPlugin());
|
||||
}.runTaskAsynchronously(game.getHost().getArcadeManager().getPlugin());
|
||||
}
|
||||
}
|
||||
int kls = _kills;
|
||||
@ -368,11 +374,18 @@ public class Gun extends StrikeItem
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
player.getInventory().setItem(_slot, getStack());
|
||||
if (setItem)
|
||||
player.getInventory().setItem(_slot, getStack());
|
||||
|
||||
_reloadTick = !_reloadTick;
|
||||
}
|
||||
}
|
||||
|
||||
public void updateWeaponName(Player player, GunModule module)
|
||||
{
|
||||
updateWeaponName(player, module, true);
|
||||
}
|
||||
|
||||
public void incrementKill() {
|
||||
_kills++;
|
||||
}
|
||||
@ -399,7 +412,7 @@ public class Gun extends StrikeItem
|
||||
loc.getWorld().playSound(loc, Sound.PISTON_RETRACT, 1f, 0.8f);
|
||||
}
|
||||
|
||||
public void cancelReloadCheck(Player player, MineStrike game)
|
||||
public void cancelReloadCheck(Player player, GunModule game)
|
||||
{
|
||||
if (!_reloading)
|
||||
return;
|
||||
@ -457,6 +470,19 @@ public class Gun extends StrikeItem
|
||||
|
||||
owner.getInventory().setItem(_slot, getStack());
|
||||
}
|
||||
|
||||
public void enableSkin()
|
||||
{
|
||||
MineStrikeSkin skin = null;
|
||||
for (MineStrikeSkin otherSkin : MineStrikeSkin.values())
|
||||
{
|
||||
if (otherSkin.getWeaponName().equalsIgnoreCase(_gunStats.getName()))
|
||||
skin = otherSkin;
|
||||
}
|
||||
|
||||
setSkin(skin.getSkinMaterial(), skin.getSkinData());
|
||||
_activeSkinName = skin.getSkinName();
|
||||
}
|
||||
|
||||
public int getSlot()
|
||||
{
|
||||
@ -492,7 +518,7 @@ public class Gun extends StrikeItem
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pickup(MineStrike game, Player player)
|
||||
public boolean pickup(GunModule game, Player player)
|
||||
{
|
||||
if (player.getInventory().getItem(_slot) != null && player.getInventory().getItem(_slot).getType() != Material.AIR)
|
||||
return false;
|
||||
|
@ -1,12 +1,14 @@
|
||||
package nautilus.game.arcade.game.games.minestrike.items.guns;
|
||||
|
||||
import nautilus.game.arcade.game.games.minestrike.GunModule;
|
||||
|
||||
public class GunFactory
|
||||
{
|
||||
public Gun createGun(GunStats gun)
|
||||
public Gun createGun(GunStats gun, GunModule module)
|
||||
{
|
||||
if (gun.getGunType() == GunType.SHOTGUN)
|
||||
return new Shotgun(gun);
|
||||
return new Shotgun(gun, module);
|
||||
|
||||
return new Gun(gun);
|
||||
return new Gun(gun, module);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package nautilus.game.arcade.game.games.minestrike.items.guns;
|
||||
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.minestrike.GunModule;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
|
||||
|
||||
import org.bukkit.Material;
|
||||
@ -375,7 +375,7 @@ public enum GunStats
|
||||
|
||||
public double getConeIncreaseRate()
|
||||
{
|
||||
return _coneIncreaseRate * MineStrike.RECOIL;
|
||||
return _coneIncreaseRate * GunModule.RECOIL;
|
||||
}
|
||||
|
||||
public boolean getScope()
|
||||
|
@ -1,6 +1,6 @@
|
||||
package nautilus.game.arcade.game.games.minestrike.items.guns;
|
||||
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.minestrike.GunModule;
|
||||
|
||||
public enum GunType
|
||||
{
|
||||
@ -40,17 +40,17 @@ public enum GunType
|
||||
|
||||
public double getMovePenalty()
|
||||
{
|
||||
return _movePenalty * MineStrike.MOVE_PENALTY;
|
||||
return _movePenalty * GunModule.MOVE_PENALTY;
|
||||
}
|
||||
|
||||
public double getSprintPenalty()
|
||||
{
|
||||
return _sprintPentalty * MineStrike.MOVE_PENALTY;
|
||||
return _sprintPentalty * GunModule.MOVE_PENALTY;
|
||||
}
|
||||
|
||||
public double getJumpPenalty()
|
||||
{
|
||||
return _jumpPenalty * MineStrike.MOVE_PENALTY;
|
||||
return _jumpPenalty * GunModule.MOVE_PENALTY;
|
||||
}
|
||||
|
||||
public float getVolume()
|
||||
|
@ -5,7 +5,7 @@ import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.minestrike.GunModule;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
|
||||
|
||||
import org.bukkit.Location;
|
||||
@ -18,15 +18,15 @@ public class Shotgun extends Gun
|
||||
{
|
||||
private int _pellets;
|
||||
|
||||
public Shotgun(GunStats gunStats)
|
||||
public Shotgun(GunStats gunStats, GunModule module)
|
||||
{
|
||||
super(gunStats);
|
||||
super(gunStats, module);
|
||||
|
||||
_pellets = gunStats.getPellets();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shoot(Player player, MineStrike game)
|
||||
public void shoot(Player player, GunModule game)
|
||||
{
|
||||
if (_reloading)
|
||||
return;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,63 @@
|
||||
package nautilus.game.arcade.game.games.mineware;
|
||||
|
||||
/**
|
||||
* This class contains a list of fields that are used as settings for the main game class.
|
||||
*/
|
||||
public class BawkBawkBattlesSettings
|
||||
{
|
||||
private boolean _crumbling = false;
|
||||
private boolean _waiting = true;
|
||||
private boolean _messagesSent = false;
|
||||
private boolean _sendingMessages = false;
|
||||
private boolean _challengeStarted = false;
|
||||
|
||||
public void setCrumbling(boolean flag)
|
||||
{
|
||||
_crumbling = flag;
|
||||
}
|
||||
|
||||
public boolean isCrumbling()
|
||||
{
|
||||
return _crumbling;
|
||||
}
|
||||
|
||||
public void setWaiting(boolean flag)
|
||||
{
|
||||
_waiting = flag;
|
||||
}
|
||||
|
||||
public boolean isWaiting()
|
||||
{
|
||||
return _waiting;
|
||||
}
|
||||
|
||||
public void markMessagesAsSent(boolean flag)
|
||||
{
|
||||
_messagesSent = flag;
|
||||
}
|
||||
|
||||
public boolean areMessagesSent()
|
||||
{
|
||||
return _messagesSent;
|
||||
}
|
||||
|
||||
public void markMessagesAsSending(boolean flag)
|
||||
{
|
||||
_sendingMessages = flag;
|
||||
}
|
||||
|
||||
public boolean areMessagesBeingSent()
|
||||
{
|
||||
return _sendingMessages;
|
||||
}
|
||||
|
||||
public void setChallengeStarted(boolean flag)
|
||||
{
|
||||
_challengeStarted = flag;
|
||||
}
|
||||
|
||||
public boolean isChallengeStarted()
|
||||
{
|
||||
return _challengeStarted;
|
||||
}
|
||||
}
|
@ -1,249 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.mineware;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.hologram.Hologram;
|
||||
import mineplex.core.hologram.Hologram.HologramTarget;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public abstract class Challenge implements Listener
|
||||
{
|
||||
public enum ChallengeType
|
||||
{
|
||||
LastStanding, FirstComplete
|
||||
}
|
||||
|
||||
public MineWare Host;
|
||||
|
||||
private String _order;
|
||||
|
||||
protected long StartTime;
|
||||
protected long Duration;
|
||||
|
||||
private Location _center;
|
||||
|
||||
protected HashSet<Player> Completed = new HashSet<Player>();
|
||||
protected HashSet<Player> Lost = new HashSet<Player>();
|
||||
private HashSet<Block> _modifiedBlocks = new HashSet<Block>();
|
||||
protected int Places;
|
||||
private ChallengeType _challengeType;
|
||||
|
||||
public Challenge(MineWare host, ChallengeType challengeType, String challengeName)
|
||||
{
|
||||
Host = host;
|
||||
_order = challengeName;
|
||||
_center = new Location(host.WorldData.World, 0, 0, 0);
|
||||
_challengeType = challengeType;
|
||||
|
||||
setBorder(-100, 100, 0, 256, -100, 100);
|
||||
}
|
||||
|
||||
public long getMaxTime()
|
||||
{
|
||||
return 60000;
|
||||
}
|
||||
|
||||
public HashSet<Block> getModifiedBlocks()
|
||||
{
|
||||
return _modifiedBlocks;
|
||||
}
|
||||
|
||||
public String getMessage(Player player)
|
||||
{
|
||||
return _order;
|
||||
}
|
||||
|
||||
public void setBorder(int minX, int maxX, int minY, int maxY, int minZ, int maxZ)
|
||||
{
|
||||
Host.WorldData.MinX = minX;
|
||||
Host.WorldData.MaxX = maxX;
|
||||
Host.WorldData.MinY = minY;
|
||||
Host.WorldData.MaxY = maxY;
|
||||
Host.WorldData.MinZ = minZ;
|
||||
Host.WorldData.MaxZ = maxZ;
|
||||
}
|
||||
|
||||
protected void addBlock(Block block)
|
||||
{
|
||||
_modifiedBlocks.add(block);
|
||||
}
|
||||
|
||||
public void StartOrder()
|
||||
{
|
||||
setupPlayers();
|
||||
|
||||
Completed.clear();
|
||||
|
||||
StartTime = System.currentTimeMillis();
|
||||
|
||||
Duration = getMaxTime();
|
||||
|
||||
Places = (int) Math.ceil(getChallengers().size() / 2D);
|
||||
}
|
||||
|
||||
public void EndOrder()
|
||||
{
|
||||
cleanupRoom();
|
||||
}
|
||||
|
||||
protected void displayCount(Player player, Location loc, String string)
|
||||
{
|
||||
final Hologram hologram = new Hologram(Host.Manager.getHologramManager(), loc, string);
|
||||
hologram.setHologramTarget(HologramTarget.WHITELIST);
|
||||
hologram.addPlayer(player);
|
||||
hologram.start();
|
||||
final long expires = System.currentTimeMillis() + 500;
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
if (!Host.IsLive() || expires < System.currentTimeMillis())
|
||||
{
|
||||
hologram.stop();
|
||||
cancel();
|
||||
}
|
||||
else
|
||||
{
|
||||
hologram.setLocation(hologram.getLocation().add(0, 0.1, 0));
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(Host.Manager.getPlugin(), 0, 0);
|
||||
}
|
||||
|
||||
public abstract ArrayList<Location> getSpawns();
|
||||
|
||||
public abstract void cleanupRoom();
|
||||
|
||||
/**
|
||||
* Register border
|
||||
*/
|
||||
public abstract void setupPlayers();
|
||||
|
||||
public abstract void generateRoom();
|
||||
|
||||
public String GetOrder()
|
||||
{
|
||||
return _order.toUpperCase();
|
||||
}
|
||||
|
||||
public boolean isInsideMap(Player player)
|
||||
{
|
||||
return Host.isInsideMap(player.getLocation());
|
||||
}
|
||||
|
||||
public boolean Finish()
|
||||
{
|
||||
ArrayList<Player> players = getChallengers();
|
||||
|
||||
if (players.size() <= Completed.size())
|
||||
return true;
|
||||
|
||||
if (_challengeType == ChallengeType.LastStanding)
|
||||
{
|
||||
if (players.size() <= Places)
|
||||
{
|
||||
for (Player player : players)
|
||||
{
|
||||
SetCompleted(player);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (_challengeType == ChallengeType.FirstComplete)
|
||||
{
|
||||
if (Completed.size() >= Places)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return UtilTime.elapsed(StartTime, Duration);
|
||||
}
|
||||
|
||||
public int GetTimeLeft()
|
||||
{
|
||||
return (int) ((Duration - (System.currentTimeMillis() - StartTime)) / 1000);
|
||||
}
|
||||
|
||||
public void SetCompleted(Player player)
|
||||
{
|
||||
if (Completed.contains(player))
|
||||
return;
|
||||
|
||||
Completed.add(player);
|
||||
UtilPlayer.message(player, C.cGreen + C.Bold + "You completed the task!");
|
||||
player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1f);
|
||||
UtilInv.Clear(player);
|
||||
}
|
||||
|
||||
public HashSet<Player> getLost()
|
||||
{
|
||||
return Lost;
|
||||
}
|
||||
|
||||
public void setLost(Player player)
|
||||
{
|
||||
Host.LoseLife(player, false);
|
||||
UtilInv.Clear(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all players that are alive, regardless of having won or not.
|
||||
*/
|
||||
public ArrayList<Player> getChallengers()
|
||||
{
|
||||
return Host.getChallengers();
|
||||
}
|
||||
|
||||
public boolean IsCompleted(Player player)
|
||||
{
|
||||
return Completed.contains(player);
|
||||
}
|
||||
|
||||
public float GetTimeLeftPercent()
|
||||
{
|
||||
float a = (float) (Duration - (System.currentTimeMillis() - StartTime));
|
||||
float b = (float) (Duration);
|
||||
return a / b;
|
||||
}
|
||||
|
||||
public final int GetRemainingPlaces()
|
||||
{
|
||||
if (_challengeType == ChallengeType.FirstComplete)
|
||||
{
|
||||
return Places - Completed.size();
|
||||
}
|
||||
else if (_challengeType == ChallengeType.LastStanding)
|
||||
{
|
||||
return getChallengers().size() - Places;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getMinPlayers()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public Location getCenter()
|
||||
{
|
||||
return _center.clone();
|
||||
}
|
||||
|
||||
public boolean hasWinner()
|
||||
{
|
||||
return !Completed.isEmpty();
|
||||
}
|
||||
|
||||
}
|
@ -1,564 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.mineware;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
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 mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilTextTop;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
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.game.SoloGame;
|
||||
import nautilus.game.arcade.game.GameTeam.PlayerState;
|
||||
import nautilus.game.arcade.game.games.holeinwall.KitNormal;
|
||||
import nautilus.game.arcade.game.games.mineware.challenges.*;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
|
||||
public class MineWare extends SoloGame
|
||||
{
|
||||
private HashMap<Player, Integer> _lives = new HashMap<Player, Integer>();
|
||||
|
||||
private Challenge _order;
|
||||
private ArrayList<Block> _lastOrderBlocks;
|
||||
private long _orderTime;
|
||||
private boolean _orderWaiting = true;
|
||||
|
||||
private ArrayList<Class<? extends Challenge>> _orders = new ArrayList<Class<? extends Challenge>>();
|
||||
private ArrayList<Class<? extends Challenge>> _ordersCopy = new ArrayList<Class<? extends Challenge>>();
|
||||
|
||||
public MineWare(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.MineWare,
|
||||
|
||||
new Kit[]
|
||||
{
|
||||
new KitNormal(manager),
|
||||
},
|
||||
|
||||
new String[]
|
||||
{
|
||||
"Follow the orders given in chat!",
|
||||
"First half to follow it win the round.",
|
||||
"Other players lose one life.", "Last player with lives wins!"
|
||||
});
|
||||
|
||||
DamageTeamSelf = true;
|
||||
DamagePvP = false;
|
||||
DamagePvE = false;
|
||||
DamageEvP = false;
|
||||
DamageFall = false;
|
||||
InventoryClick = true;
|
||||
DamageSelf = false;
|
||||
DeathOut = false;
|
||||
AutomaticRespawn = false;
|
||||
DeathMessages = false;
|
||||
|
||||
Manager.GetCreature().SetDisableCustomDrops(true);
|
||||
|
||||
PopulateOrders();
|
||||
|
||||
registerChatStats();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void EndCheck()
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
int living = 0;
|
||||
|
||||
for (Player player : GetPlayers(false))
|
||||
{
|
||||
if (GetLives(player) > 0)
|
||||
{
|
||||
living++;
|
||||
}
|
||||
}
|
||||
|
||||
if (living <= 1)
|
||||
{
|
||||
SetState(GameState.End);
|
||||
AnnounceEnd(getWinners());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInsideMap(Player player)
|
||||
{
|
||||
if (_order != null && !_orderWaiting)
|
||||
{
|
||||
return _order.isInsideMap(player);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onLive(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Live)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_orderTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public void PopulateOrders()
|
||||
{
|
||||
_orders.add(ChallengeShootChickens.class);
|
||||
_orders.add(ChallengeStandOnColor.class);
|
||||
_orders.add(ChallengeMilkACow.class);
|
||||
_orders.add(ChallengeDragonEgg.class);
|
||||
// _orders.add(ChallengeBlockShot.class);
|
||||
_orders.add(ChallengeChestLoot.class);
|
||||
_orders.add(ChallengeLavaRun.class);
|
||||
_orders.add(ChallengeNavigateMaze.class);
|
||||
// _orders.add(ChallengePickASide.class);
|
||||
_orders.add(ChallengeHitTargets.class);
|
||||
// _orders.add(ChallengeNameThatSound.class);
|
||||
_orders.add(ChallengeVolleyPig.class);
|
||||
// _orders.add(ChallengeSkyFall.class);
|
||||
_orders.add(ChallengeSmashOff.class);
|
||||
_orders.add(ChallengeTntLauncher.class);
|
||||
//_orders.add(ChallengeSpleef.class); TODO
|
||||
//_orders.add(ChallengeRunner.class); TODO
|
||||
// _orders.add(ChallengeDiamondFall.class);
|
||||
}
|
||||
|
||||
public Challenge GetOrder()
|
||||
{
|
||||
for (int i = 0; i < _orders.size() * 4; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_ordersCopy.isEmpty())
|
||||
{
|
||||
_ordersCopy.addAll(_orders);
|
||||
}
|
||||
|
||||
Challenge challenge = _ordersCopy
|
||||
.remove(UtilMath.r(_ordersCopy.size()))
|
||||
.getConstructor(MineWare.class).newInstance(this);
|
||||
|
||||
if (getChallengers().size() >= challenge.getMinPlayers())
|
||||
{
|
||||
System.out.print("Using challenge "
|
||||
+ challenge.getClass().getSimpleName());
|
||||
return challenge;
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.print("Cannot use challenge "
|
||||
+ challenge.getClass().getSimpleName()
|
||||
+ ", not enough players");
|
||||
|
||||
}
|
||||
}
|
||||
catch (InvocationTargetException ex)
|
||||
{
|
||||
ex.getCause().printStackTrace();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void GameStateChange(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Prepare)
|
||||
return;
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
_lives.put(player, 5);
|
||||
|
||||
_order = GetOrder();
|
||||
_order.generateRoom();
|
||||
|
||||
GetTeamList().get(0).SetSpawns(_order.getSpawns());
|
||||
SpectatorSpawn = UtilWorld.averageLocation(_order.getSpawns()).add(0,
|
||||
7, 0);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void CancelOrder(GameStateChangeEvent event)
|
||||
{
|
||||
if (_order == null)
|
||||
return;
|
||||
|
||||
if (_orderWaiting)
|
||||
return;
|
||||
|
||||
if (event.GetState() == GameState.Live)
|
||||
return;
|
||||
|
||||
// Deregister
|
||||
HandlerList.unregisterAll(_order);
|
||||
|
||||
_order.EndOrder();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDamage(CustomDamageEvent event)
|
||||
{
|
||||
event.SetDamageToLevel(false);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDeath(PlayerDeathEvent event)
|
||||
{
|
||||
if (_order == null)
|
||||
return;
|
||||
|
||||
_order.getLost().add(event.getEntity());
|
||||
LoseLife(event.getEntity(), true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onQuit(PlayerQuitEvent event)
|
||||
{
|
||||
_lives.remove(event.getPlayer());
|
||||
}
|
||||
|
||||
public ArrayList<Player> getChallengers()
|
||||
{
|
||||
ArrayList<Player> challengers = new ArrayList<Player>();
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
if (!UtilPlayer.isSpectator(player))
|
||||
{
|
||||
challengers.add(player);
|
||||
}
|
||||
}
|
||||
|
||||
return challengers;
|
||||
}
|
||||
|
||||
public void sayChallenge(Challenge challenge)
|
||||
{
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 1f);
|
||||
String message = C.cYellow
|
||||
+ C.Bold
|
||||
+ (IsAlive(player) ? challenge.getMessage(player)
|
||||
: challenge.GetOrder());
|
||||
|
||||
UtilPlayer.message(player, message);
|
||||
UtilTextMiddle.display(message, null);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInteract(PlayerInteractEvent event)
|
||||
{
|
||||
if (!_orderWaiting)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void PlayerMoveCancel(PlayerMoveEvent event)
|
||||
{
|
||||
if (!PrepareFreeze)
|
||||
return;
|
||||
|
||||
if (!_orderWaiting)
|
||||
return;
|
||||
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (!IsAlive(event.getPlayer()))
|
||||
return;
|
||||
|
||||
if (UtilMath.offset2d(event.getFrom(), event.getTo()) <= 0)
|
||||
return;
|
||||
|
||||
event.getFrom().setPitch(event.getTo().getPitch());
|
||||
event.getFrom().setYaw(event.getTo().getYaw());
|
||||
|
||||
event.setTo(event.getFrom());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void UpdateOrder(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
// New Order
|
||||
if (_order == null)
|
||||
{
|
||||
if (!UtilTime.elapsed(_orderTime, 1500))
|
||||
return;
|
||||
|
||||
for (Player player : GetPlayers(false))
|
||||
{
|
||||
if (_lives.containsKey(player) && _lives.get(player) > 0)
|
||||
{
|
||||
Manager.Clear(player);
|
||||
}
|
||||
}
|
||||
|
||||
_order = GetOrder();
|
||||
|
||||
if (_order == null)
|
||||
{
|
||||
System.out.println("No challenge suitable");
|
||||
SetState(GameState.Dead);
|
||||
return;
|
||||
}
|
||||
|
||||
for (Block block : _lastOrderBlocks)
|
||||
{
|
||||
if (block.getState() instanceof InventoryHolder)
|
||||
{
|
||||
((InventoryHolder) block.getState()).getInventory().clear();
|
||||
}
|
||||
|
||||
block.setTypeIdAndData(Material.AIR.getId(), (byte) 0, false);
|
||||
}
|
||||
|
||||
_order.generateRoom();
|
||||
|
||||
ArrayList<Location> spawns = _order.getSpawns();
|
||||
|
||||
GetTeamList().get(0).SetSpawns(_order.getSpawns());
|
||||
SpectatorSpawn = UtilWorld.averageLocation(spawns).add(0, 7, 0);
|
||||
|
||||
ArrayList<Location> toTeleport = new ArrayList<Location>();
|
||||
|
||||
for (int i = 0; i < spawns.size(); i++)
|
||||
{
|
||||
Location furthest = null;
|
||||
double furthestDist = 0;
|
||||
|
||||
for (Location spawn : spawns)
|
||||
{
|
||||
if (toTeleport.contains(spawn))
|
||||
continue;
|
||||
|
||||
double dist = 0;
|
||||
|
||||
for (Location loc : toTeleport)
|
||||
{
|
||||
dist += loc.distance(spawn);
|
||||
}
|
||||
|
||||
if (furthest == null || furthestDist < dist)
|
||||
{
|
||||
furthest = spawn;
|
||||
furthestDist = dist;
|
||||
}
|
||||
}
|
||||
|
||||
toTeleport.add(furthest);
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
|
||||
for (Player player : getChallengers())
|
||||
{
|
||||
player.teleport(toTeleport.get(i++));
|
||||
|
||||
if (i >= toTeleport.size())
|
||||
{
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
for (Player player : GetPlayers(false))
|
||||
{
|
||||
if (!IsAlive(player))
|
||||
{
|
||||
player.teleport(SpectatorSpawn);
|
||||
}
|
||||
}
|
||||
|
||||
if (_order instanceof ChallengeSeperateRooms)
|
||||
{
|
||||
((ChallengeSeperateRooms) _order).assignRooms();
|
||||
}
|
||||
|
||||
_orderTime = System.currentTimeMillis();
|
||||
_orderWaiting = true;
|
||||
/*
|
||||
* XXX GetObjectiveSide().setDisplayName( ChatColor.WHITE +
|
||||
* "§lMineWare " + C.cGreen + "§l" + "Round " + _orderCount);
|
||||
*/
|
||||
}
|
||||
else if (_orderWaiting)
|
||||
{
|
||||
if (!UtilTime.elapsed(_orderTime, 1000))
|
||||
return;
|
||||
|
||||
_orderWaiting = false;
|
||||
|
||||
_order.StartOrder();
|
||||
|
||||
// Register
|
||||
UtilServer.getServer().getPluginManager()
|
||||
.registerEvents(_order, Manager.getPlugin());
|
||||
|
||||
sayChallenge(_order);
|
||||
}
|
||||
// Update Order
|
||||
else
|
||||
{
|
||||
if (_order.Finish())
|
||||
{
|
||||
_orderTime = System.currentTimeMillis();
|
||||
|
||||
for (Player player : getChallengers())
|
||||
{
|
||||
getArcadeManager().GetDisguise().undisguise(player);
|
||||
UtilInv.Clear(player);
|
||||
|
||||
if (_order.hasWinner() && !_order.IsCompleted(player))
|
||||
{
|
||||
LoseLife(player, true);
|
||||
}
|
||||
}
|
||||
|
||||
// Deregister
|
||||
HandlerList.unregisterAll(_order);
|
||||
|
||||
_order.EndOrder();
|
||||
|
||||
_lastOrderBlocks = new ArrayList<Block>(
|
||||
_order.getModifiedBlocks());
|
||||
// Remove blocks from top to bottom, prevents blocks popping
|
||||
// off.
|
||||
Collections.sort(_lastOrderBlocks, new Comparator<Block>()
|
||||
{
|
||||
|
||||
@Override
|
||||
public int compare(Block o1, Block o2)
|
||||
{
|
||||
return new Integer(o2.getY()).compareTo(o1.getY());
|
||||
}
|
||||
});
|
||||
|
||||
_order = null;
|
||||
|
||||
EndCheck();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set Level
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
UtilTextTop.display(C.cYellow
|
||||
+ C.Bold
|
||||
+ (IsAlive(player) ? _order.getMessage(player)
|
||||
: _order.GetOrder()), player);
|
||||
player.setLevel(_order.GetRemainingPlaces());
|
||||
player.setExp(_order.GetTimeLeftPercent());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int GetLives(Player player)
|
||||
{
|
||||
if (!_lives.containsKey(player))
|
||||
return 0;
|
||||
|
||||
return _lives.get(player);
|
||||
}
|
||||
|
||||
public void LoseLife(Player player, boolean isDeath)
|
||||
{
|
||||
if (!isDeath)
|
||||
{
|
||||
Manager.addSpectator(player, true);
|
||||
}
|
||||
|
||||
if (_order == null || _order.IsCompleted(player))
|
||||
return;
|
||||
|
||||
int lives = GetLives(player);
|
||||
|
||||
lives -= 1;
|
||||
_lives.put(player, lives);
|
||||
|
||||
if (lives > 0)
|
||||
{
|
||||
UtilPlayer
|
||||
.message(player, C.cRed + C.Bold + "You failed the task!");
|
||||
UtilPlayer.message(player, C.cRed + C.Bold + "You have " + lives
|
||||
+ " lives left!");
|
||||
player.playSound(player.getLocation(), Sound.NOTE_BASS_GUITAR, 2f,
|
||||
0.5f);
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(player, C.cRed + C.Bold
|
||||
+ "You are out of the game!");
|
||||
player.playSound(player.getLocation(), Sound.EXPLODE, 2f, 1f);
|
||||
|
||||
Scoreboard.ResetScore(player.getName());
|
||||
|
||||
SetPlayerState(player, PlayerState.OUT);
|
||||
|
||||
if (isDeath)
|
||||
{
|
||||
Manager.addSpectator(player, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int GetScoreboardScore(Player player)
|
||||
{
|
||||
return GetLives(player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ItemDrop(PlayerDropItemEvent event)
|
||||
{
|
||||
event.getItemDrop().remove();
|
||||
}
|
||||
}
|
@ -0,0 +1,951 @@
|
||||
package nautilus.game.arcade.game.games.mineware.challenge;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
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.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerItemHeldEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
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.hologram.Hologram.HologramTarget;
|
||||
import mineplex.core.projectile.ProjectileUser;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
|
||||
import nautilus.game.arcade.game.games.mineware.BawkBawkBattles;
|
||||
import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent;
|
||||
import nautilus.game.arcade.game.games.mineware.events.ChallengeStartEvent;
|
||||
import nautilus.game.arcade.kit.ProgressingKit.CustomFirework;
|
||||
import nautilus.game.arcade.world.WorldData;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* This class contains the base structure of a challenge.
|
||||
* All challenges should trigger any functionality inside
|
||||
* {@link #createSpawns()}, {@link #createMap()}, {@link #onStart()} and {@link #onEnd()}.
|
||||
* </p>
|
||||
*
|
||||
* Additionally, {@link #onTimerFinish()} and {@link #onCollide(LivingEntity, Block, ProjectileUser)} can be overrided.
|
||||
*/
|
||||
public abstract class Challenge implements Listener
|
||||
{
|
||||
protected static final int TICK_MULTIPLIER = 20;
|
||||
private static final int TITLE_FADE_IN_TICKS = 5;
|
||||
private static final int TITLE_STAY_TICKS = 40;
|
||||
private static final int TITLE_FADE_OUT_TICKS = 5;
|
||||
|
||||
private static final int BORDER_MIN_X = -100;
|
||||
private static final int BORDER_MAX_X = 100;
|
||||
private static final int BORDER_MIN_Y = 0;
|
||||
private static final int BORDER_MAX_Y = 256;
|
||||
private static final int BORDER_MIN_Z = -100;
|
||||
private static final int BORDER_MAX_Z = 100;
|
||||
private static final int COMPLETE_COUNT_DIVIDER = 2;
|
||||
|
||||
private static final int WINNER_ADD_CRITERIA = 3; // players
|
||||
private static final int CHICKEN_ATTACK_CRITERIA = 2; // players
|
||||
|
||||
private static final int CHALLENGE_CLOAK_DURATION = 7777;
|
||||
private static final int COMPLETION_GEMS = 3;
|
||||
private static final int STARTING_SOON_MESSAGE_CRITERIA = 2; // players
|
||||
|
||||
private static final double BLOCK_CENTER_ADD = 0.5;
|
||||
private static final int CRUMBLE_CHANCE = 4;
|
||||
|
||||
private static final int PLAYER_COUNT_FOR_GAME_END = 1;
|
||||
private static final int COMPLETION_TITLE_STAY_TICKS = 30;
|
||||
private static final float COMPLETION_SOUND_VOLUME = 2.0F;
|
||||
private static final float COMPLETION_SOUND_PITCH = 1.0F;
|
||||
|
||||
private static final float LOST_SOUND_VOLUME = 2.0F;
|
||||
private static final float LOST_SOUND_PITCH = 1.0F;
|
||||
|
||||
protected static final int INVENTORY_HOTBAR_SLOTS = 8;
|
||||
|
||||
private static final int BLOCK_BREAK_PARTICLE_COUNT = 10;
|
||||
private static final int GRASS_SPAWN_CHANCE = 4;
|
||||
private static final int FLOWER_SPAWN_CHANCE = 8;
|
||||
private static final int FLOWER_DATA_RANGE = 7;
|
||||
|
||||
private static final int DOUBLE_PLANT_CHANCE = 3;
|
||||
private static final int DOUBLE_PLANT_DATA_RANGE = 5;
|
||||
private static final byte DOUBLE_PLANT_PART_DATA = 8;
|
||||
|
||||
private static final int DISPLAY_COUNT_EXPIRE_AFTER = 1000;
|
||||
private static final double DISPLAY_COUNT_ELEVATION_RATE = 0.05;
|
||||
|
||||
private static final int DEFAULT_ARENA_SIZE = 8;
|
||||
private static final int ARENA_SIZE_DIVIDER = 2;
|
||||
private static final int ARENA_SIZE_LIMIT = 40;
|
||||
|
||||
protected final BawkBawkBattles Host;
|
||||
protected final ChallengeSettings Settings;
|
||||
protected final ChallengeData Data;
|
||||
|
||||
private ChallengeType _type;
|
||||
private String _name;
|
||||
private String[] _description;
|
||||
|
||||
public Challenge(BawkBawkBattles host, ChallengeType type, String name, String... description)
|
||||
{
|
||||
Host = host;
|
||||
_type = type;
|
||||
_name = name;
|
||||
_description = description;
|
||||
|
||||
Settings = new ChallengeSettings(this);
|
||||
Data = new ChallengeData();
|
||||
}
|
||||
|
||||
public void markSpawnLocations()
|
||||
{
|
||||
for (Location spawn : Data.getDefinedSpawns())
|
||||
{
|
||||
Block markedBlock = spawn.getBlock().getRelative(BlockFace.DOWN);
|
||||
markedBlock.setType(Material.EMERALD_BLOCK);
|
||||
addBlock(markedBlock);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The list of spawn locations where players will be teleported.
|
||||
*
|
||||
* @return ArrayList<Location>
|
||||
*/
|
||||
public abstract ArrayList<Location> createSpawns();
|
||||
|
||||
/**
|
||||
* The list of actions to perform in order for the map to be created.
|
||||
*/
|
||||
public abstract void createMap();
|
||||
|
||||
/**
|
||||
* The list of actions to perform once the challenge is started.
|
||||
*/
|
||||
public void onStart()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* The list of actions to perform after the challenge has ended.
|
||||
*/
|
||||
public void onEnd()
|
||||
{
|
||||
}
|
||||
|
||||
public void spawn(boolean firstRun)
|
||||
{
|
||||
if (firstRun)
|
||||
{
|
||||
ArrayList<Player> players = Host.GetPlayers(false);
|
||||
|
||||
for (int i = 0; i < players.size(); i++)
|
||||
{
|
||||
Player player = players.get(i);
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
Host.getPlayerTeam().SpawnTeleport(player);
|
||||
}
|
||||
}.runTaskLater(Host.Manager.getPlugin(), i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Host.getPlayerTeam().SpawnTeleport(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void start()
|
||||
{
|
||||
setBorder(BORDER_MIN_X, BORDER_MAX_X, BORDER_MIN_Y, BORDER_MAX_Y, BORDER_MIN_Z, BORDER_MAX_Z);
|
||||
|
||||
Settings.setStartTime(System.currentTimeMillis());
|
||||
Settings.setMaxCompletedCount((int) Math.ceil(getPlayersAlive().size() / COMPLETE_COUNT_DIVIDER));
|
||||
|
||||
if (Settings.isInventoryLocked())
|
||||
{
|
||||
setLockedInventorySlot();
|
||||
}
|
||||
|
||||
onStart();
|
||||
callStartEvent();
|
||||
}
|
||||
|
||||
private void setLockedInventorySlot()
|
||||
{
|
||||
for (Player player : getPlayersAlive())
|
||||
{
|
||||
player.getInventory().setHeldItemSlot(Settings.getLockedSlot());
|
||||
}
|
||||
}
|
||||
|
||||
private void callStartEvent()
|
||||
{
|
||||
Bukkit.getServer().getPluginManager().callEvent(new ChallengeStartEvent(this));
|
||||
Host.Manager.getPluginManager().registerEvents(this, Host.Manager.getPlugin());
|
||||
}
|
||||
|
||||
public boolean canFinish()
|
||||
{
|
||||
ArrayList<Player> players = getPlayersAlive();
|
||||
|
||||
int alive = getPlayersIn(true).size();
|
||||
int completed = Data.getCompletedPlayers().size();
|
||||
int lost = Data.getLostPlayers().size();
|
||||
|
||||
boolean maxTimeReached = UtilTime.elapsed(Settings.getStartTime(), Settings.getDuration());
|
||||
|
||||
if (maxTimeReached)
|
||||
{
|
||||
if (!Settings.shouldHideTimerRanOutMessage())
|
||||
{
|
||||
UtilServer.broadcast(F.main("Game", "Challenge timer has ran out."));
|
||||
}
|
||||
|
||||
onTimerFinish();
|
||||
return true;
|
||||
}
|
||||
else if (alive <= completed)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (_type == ChallengeType.LastStanding)
|
||||
{
|
||||
if (alive <= Settings.getMaxCompletedCount())
|
||||
{
|
||||
for (Player player : players)
|
||||
{
|
||||
setCompleted(player);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (lost > alive)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (_type == ChallengeType.FirstComplete && completed >= Settings.getMaxCompletedCount())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return maxTimeReached;
|
||||
}
|
||||
|
||||
public void end()
|
||||
{
|
||||
handleRemainingPlayers();
|
||||
callEndEvent();
|
||||
|
||||
if (Data.hasInvisiblePlayers())
|
||||
{
|
||||
removeCloakedPlayers();
|
||||
}
|
||||
|
||||
onEnd();
|
||||
Data.reset();
|
||||
}
|
||||
|
||||
private void removeCloakedPlayers()
|
||||
{
|
||||
for (Player player : Data.getInvisiblePlayers())
|
||||
{
|
||||
Host.Manager.GetCondition().EndCondition(player, ConditionType.CLOAK, "Challenge Ended");
|
||||
}
|
||||
}
|
||||
|
||||
private void callEndEvent()
|
||||
{
|
||||
Host.Manager.getPluginManager().callEvent(new ChallengeEndEvent(this));
|
||||
HandlerList.unregisterAll(this);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void death(PlayerDeathEvent event)
|
||||
{
|
||||
if (!Host.IsLive() || Host.getChickenTeam().HasPlayer(event.getEntity()))
|
||||
return;
|
||||
|
||||
Player player = event.getEntity();
|
||||
|
||||
Location death = player.getLocation().clone();
|
||||
Data.addLostPlayer(player);
|
||||
|
||||
Host.getDeathEffect().playDeath(player, death);
|
||||
handleDeath(player);
|
||||
}
|
||||
|
||||
private void handleDeath(Player player)
|
||||
{
|
||||
int alive = Host.getPlayersWithRemainingLives();
|
||||
int lives = loseLife(player);
|
||||
|
||||
if (lives <= 0 && alive <= WINNER_ADD_CRITERIA)
|
||||
{
|
||||
Host.getWinners().add(player);
|
||||
}
|
||||
|
||||
if (lives <= 0 && alive > CHICKEN_ATTACK_CRITERIA)
|
||||
{
|
||||
Host.GetScoreboard().ResetScore(player.getName());
|
||||
Host.getChickenAttack().start(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
handleFailure(player);
|
||||
}
|
||||
}
|
||||
|
||||
private int loseLife(Player player)
|
||||
{
|
||||
int lives = Host.lives(player);
|
||||
lives--;
|
||||
|
||||
if (lives >= 0)
|
||||
{
|
||||
Host.setLives(player, lives);
|
||||
}
|
||||
|
||||
return lives;
|
||||
}
|
||||
|
||||
private void handleFailure(Player player)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Game", C.cRed + "You failed to complete the task."));
|
||||
Host.showLivesLeft(player);
|
||||
Host.Manager.addSpectator(player, true);
|
||||
Host.Manager.GetCondition().Factory().Cloak("Challenge Death", player, player, CHALLENGE_CLOAK_DURATION, true, true);
|
||||
}
|
||||
|
||||
private void handleRemainingPlayers()
|
||||
{
|
||||
for (Player player : getPlayersAlive())
|
||||
{
|
||||
if (Data.hasAnyoneCompleted() && !Data.isDone(player))
|
||||
{
|
||||
int lives = Host.lives(player);
|
||||
|
||||
if (lives > 1)
|
||||
{
|
||||
setLost(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
handleDeath(player);
|
||||
}
|
||||
}
|
||||
|
||||
addGems(player);
|
||||
}
|
||||
}
|
||||
|
||||
private void addGems(Player player)
|
||||
{
|
||||
if (Data.isCompleted(player))
|
||||
{
|
||||
Host.AddGems(player, COMPLETION_GEMS, "Completed Challenges", true, true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void startingSoon(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC || !Host.IsLive() || Host.getPlayersWithRemainingLives() <= STARTING_SOON_MESSAGE_CRITERIA)
|
||||
return;
|
||||
|
||||
HashSet<Player> players = new HashSet<Player>();
|
||||
players.addAll(Data.getCompletedPlayers());
|
||||
players.addAll(Data.getLostPlayers());
|
||||
|
||||
for (Player player : players)
|
||||
{
|
||||
if (!Host.getChickenTeam().HasPlayer(player) && Host.lives(player) > 0)
|
||||
{
|
||||
UtilTextBottom.display(C.Bold + "Next challenge will begin shortly.", player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void lockInventory(PlayerItemHeldEvent event)
|
||||
{
|
||||
if (!isChallengeValid())
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!isPlayerValid(player))
|
||||
return;
|
||||
|
||||
if (Settings.isInventoryLocked())
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@EventHandler
|
||||
public void crumble(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FASTEST || !Host.IsLive() || !Settings.canCrumble() || !Host.getSettings().isCrumbling())
|
||||
return;
|
||||
|
||||
Block qualifiedBlock = null;
|
||||
double furthestDistance = 0;
|
||||
|
||||
if (Data.getModifiedBlocks().isEmpty())
|
||||
{
|
||||
Host.getSettings().setCrumbling(false);
|
||||
return;
|
||||
}
|
||||
|
||||
for (Block currentBlock : Data.getModifiedBlocks())
|
||||
{
|
||||
double theBlocksDistance = UtilMath.offset2d(Host.GetSpectatorLocation(), currentBlock.getLocation().add(BLOCK_CENTER_ADD, BLOCK_CENTER_ADD, BLOCK_CENTER_ADD));
|
||||
|
||||
if (qualifiedBlock == null || furthestDistance < theBlocksDistance)
|
||||
{
|
||||
qualifiedBlock = currentBlock;
|
||||
furthestDistance = theBlocksDistance;
|
||||
}
|
||||
}
|
||||
|
||||
while (!qualifiedBlock.getRelative(BlockFace.DOWN).isEmpty())
|
||||
{
|
||||
qualifiedBlock = qualifiedBlock.getRelative(BlockFace.DOWN);
|
||||
}
|
||||
|
||||
Data.removeModifiedBlock(qualifiedBlock);
|
||||
|
||||
if (UtilMath.r(CRUMBLE_CHANCE) == 0)
|
||||
{
|
||||
qualifiedBlock.getWorld().spawnFallingBlock(qualifiedBlock.getLocation().add(BLOCK_CENTER_ADD, BLOCK_CENTER_ADD, BLOCK_CENTER_ADD), qualifiedBlock.getType(), qualifiedBlock.getData());
|
||||
}
|
||||
|
||||
resetBlock(qualifiedBlock);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void quit(PlayerQuitEvent event)
|
||||
{
|
||||
if (!Host.IsLive())
|
||||
return;
|
||||
|
||||
Data.removePlayer(event.getPlayer());
|
||||
}
|
||||
|
||||
protected void setCompleted(Player player, boolean cloak)
|
||||
{
|
||||
if (Data.isDone(player))
|
||||
return;
|
||||
|
||||
if (shouldShowEffects()) // Check if the game is not about to end.
|
||||
{
|
||||
if (cloak)
|
||||
{
|
||||
cloak(player, true);
|
||||
}
|
||||
|
||||
CustomFirework.spawn(
|
||||
player.getLocation().add(0, 1, 0),
|
||||
FireworkEffect.builder().with(Type.BALL_LARGE).withColor(Color.GREEN).build(),
|
||||
player);
|
||||
|
||||
alert(player, C.cGreen + "You have completed the challenge!", COMPLETION_TITLE_STAY_TICKS);
|
||||
player.playSound(player.getLocation(), Sound.LEVEL_UP, COMPLETION_SOUND_VOLUME, COMPLETION_SOUND_PITCH);
|
||||
}
|
||||
|
||||
Data.addCompletedPlayer(player);
|
||||
Host.Manager.GetDisguise().undisguise(player);
|
||||
UtilPlayer.clearPotionEffects(player);
|
||||
UtilInv.Clear(player);
|
||||
}
|
||||
|
||||
private boolean shouldShowEffects()
|
||||
{
|
||||
if (Host.getPlayersWithRemainingLives() == PLAYER_COUNT_FOR_GAME_END)
|
||||
{
|
||||
int playerOneLives = Host.lives(getPlayersAlive().get(0));
|
||||
int playerTwoLives = Host.lives(getPlayersAlive().get(1));
|
||||
|
||||
boolean playerOneCompleted = Data.isDone(getPlayersAlive().get(0));
|
||||
boolean playerTwoCompleted = Data.isDone(getPlayersAlive().get(1));
|
||||
|
||||
if (!playerOneCompleted && !playerTwoCompleted && (playerOneLives == 1 || playerTwoLives == 2))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void setCompleted(Player player)
|
||||
{
|
||||
setCompleted(player, false);
|
||||
}
|
||||
|
||||
protected void setLost(Player player, boolean cloak)
|
||||
{
|
||||
if (Data.isDone(player))
|
||||
return;
|
||||
|
||||
Data.addLostPlayer(player);
|
||||
loseLife(player);
|
||||
|
||||
if (cloak)
|
||||
{
|
||||
cloak(player, false);
|
||||
}
|
||||
|
||||
UtilPlayer.message(player, F.main("Game", C.cRed + "You failed to complete the task."));
|
||||
Host.showLivesLeft(player);
|
||||
player.playSound(player.getLocation(), Sound.NOTE_BASS, LOST_SOUND_VOLUME, LOST_SOUND_PITCH);
|
||||
|
||||
Host.Manager.GetDisguise().undisguise(player);
|
||||
UtilPlayer.clearPotionEffects(player);
|
||||
UtilInv.Clear(player);
|
||||
}
|
||||
|
||||
protected void setLost(Player player)
|
||||
{
|
||||
setLost(player, false);
|
||||
}
|
||||
|
||||
private void cloak(Player player, boolean completed)
|
||||
{
|
||||
Data.addInvisiblePlayer(player);
|
||||
String reason = "Lost";
|
||||
|
||||
if (completed)
|
||||
{
|
||||
reason = "Completed";
|
||||
}
|
||||
|
||||
Host.Manager.GetCondition().Factory().Cloak(reason, player, player, CHALLENGE_CLOAK_DURATION, true, false);
|
||||
}
|
||||
|
||||
protected void alert(Player player, String message)
|
||||
{
|
||||
alert(player, message, TITLE_STAY_TICKS);
|
||||
}
|
||||
|
||||
protected void alert(Player player, String message, int stayTicks)
|
||||
{
|
||||
UtilTextMiddle.display(null, message, TITLE_FADE_IN_TICKS, stayTicks, TITLE_FADE_OUT_TICKS, player);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void setBlock(Block block, Material type, byte data)
|
||||
{
|
||||
UtilBlock.setQuick(block.getWorld(), block.getX(), block.getY(), block.getZ(), type.getId(), data);
|
||||
}
|
||||
|
||||
public void setBlock(Block block, Material type)
|
||||
{
|
||||
setBlock(block, type, (byte) 0);
|
||||
}
|
||||
|
||||
public void setData(Block block, byte data)
|
||||
{
|
||||
setBlock(block, block.getType(), data);
|
||||
}
|
||||
|
||||
public void resetBlock(Block block)
|
||||
{
|
||||
setBlock(block, Material.AIR, (byte) 0);
|
||||
}
|
||||
|
||||
protected void addBlock(Block... blocks)
|
||||
{
|
||||
for (Block block : blocks)
|
||||
{
|
||||
if (!block.isEmpty())
|
||||
{
|
||||
Data.addModifiedBlock(block);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void addItem(ItemStack... items)
|
||||
{
|
||||
for (Player player : getPlayersAlive())
|
||||
{
|
||||
for (ItemStack item : items)
|
||||
{
|
||||
UtilInv.insert(player, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void setItem(int slot, ItemStack item)
|
||||
{
|
||||
for (Player player : getPlayersAlive())
|
||||
{
|
||||
player.getInventory().setItem(slot, item);
|
||||
}
|
||||
}
|
||||
|
||||
protected void fillItem(ItemStack item)
|
||||
{
|
||||
for (Player player : getPlayersAlive())
|
||||
{
|
||||
for (int i = 0; i <= INVENTORY_HOTBAR_SLOTS; i++)
|
||||
{
|
||||
player.getInventory().setItem(i, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void removeItem(Material type, byte data)
|
||||
{
|
||||
for (Player player : getPlayersAlive())
|
||||
{
|
||||
UtilInv.removeAll(player, type, data);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void blockBreakEffect(Block block, boolean resetBlock)
|
||||
{
|
||||
UtilParticle.PlayParticle(ParticleType.BLOCK_DUST.getParticle(block.getType(), block.getData()), block.getLocation(), 0, 0, 0, 0, BLOCK_BREAK_PARTICLE_COUNT, ViewDist.NORMAL, UtilServer.getPlayers());
|
||||
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());
|
||||
|
||||
if (resetBlock)
|
||||
{
|
||||
resetBlock(block);
|
||||
}
|
||||
}
|
||||
|
||||
protected void addEffect(PotionEffectType type, int duration, int amplifier)
|
||||
{
|
||||
for (Player player : getPlayersAlive())
|
||||
{
|
||||
player.addPotionEffect(new PotionEffect(type, duration, amplifier));
|
||||
}
|
||||
}
|
||||
|
||||
protected void addEffect(PotionEffectType type, int amplifier)
|
||||
{
|
||||
addEffect(type, Integer.MAX_VALUE, amplifier);
|
||||
}
|
||||
|
||||
protected void removeEffect(PotionEffectType type)
|
||||
{
|
||||
for (Player player : getPlayersAlive())
|
||||
{
|
||||
player.removePotionEffect(type);
|
||||
}
|
||||
}
|
||||
|
||||
protected void remove(EntityType type)
|
||||
{
|
||||
for (Entity entity : Host.WorldData.World.getEntities())
|
||||
{
|
||||
if (entity.getType() == type && !Host.getDeathEffect().isDeathEffectItem(entity))
|
||||
{
|
||||
entity.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected Block generateGrass(Block block)
|
||||
{
|
||||
return generateGrass(block, false);
|
||||
}
|
||||
|
||||
protected Block generateGrass(Block block, boolean bushes)
|
||||
{
|
||||
if (UtilMath.r(GRASS_SPAWN_CHANCE) == 0)
|
||||
{
|
||||
if (UtilMath.r(FLOWER_SPAWN_CHANCE) == 0)
|
||||
{
|
||||
makeFlower(block);
|
||||
}
|
||||
else
|
||||
{
|
||||
makeGrass(block, bushes);
|
||||
}
|
||||
}
|
||||
|
||||
return block;
|
||||
}
|
||||
|
||||
private void makeFlower(Block block)
|
||||
{
|
||||
Material flower = Material.YELLOW_FLOWER;
|
||||
byte data = 0;
|
||||
|
||||
if (UtilMath.random.nextBoolean())
|
||||
{
|
||||
flower = Material.RED_ROSE;
|
||||
|
||||
if (UtilMath.random.nextBoolean())
|
||||
{
|
||||
data = (byte) (UtilMath.r(FLOWER_DATA_RANGE) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
setBlock(block, flower, data);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void makeGrass(Block block, boolean bushes)
|
||||
{
|
||||
if (bushes && UtilMath.r(DOUBLE_PLANT_CHANCE) == 0)
|
||||
{
|
||||
Block above = block.getRelative(BlockFace.UP);
|
||||
byte plantData = (byte) UtilMath.r(DOUBLE_PLANT_DATA_RANGE);
|
||||
|
||||
setBlock(block, Material.DOUBLE_PLANT, plantData);
|
||||
setBlock(above, Material.DOUBLE_PLANT, DOUBLE_PLANT_PART_DATA);
|
||||
|
||||
addBlock(above);
|
||||
}
|
||||
else
|
||||
{
|
||||
block.setType(Material.LONG_GRASS);
|
||||
block.setData((byte) 1);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isChallengeValid()
|
||||
{
|
||||
return Host.IsLive() && Host.getSettings().isChallengeStarted();
|
||||
}
|
||||
|
||||
protected boolean isPlayerValid(Player player)
|
||||
{
|
||||
return getPlayersAlive().contains(player) && Host.IsAlive(player) && !Data.isDone(player);
|
||||
}
|
||||
|
||||
public void setBorder(int minX, int maxX, int minY, int maxY, int minZ, int maxZ)
|
||||
{
|
||||
WorldData data = Host.WorldData;
|
||||
|
||||
data.MinX = minX;
|
||||
data.MaxX = (int) (maxX + Settings.getMapCenter().getX());
|
||||
data.MinY = minY;
|
||||
data.MaxY = (int) (maxY + Settings.getMapCenter().getY());
|
||||
data.MinZ = minZ;
|
||||
data.MaxZ = (int) (maxZ + Settings.getMapCenter().getZ());
|
||||
}
|
||||
|
||||
protected void displayCount(Player player, Location loc, String text)
|
||||
{
|
||||
Hologram hologram = createHologram(player, loc, text);
|
||||
long expiry = System.currentTimeMillis() + DISPLAY_COUNT_EXPIRE_AFTER;
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
if (!Host.IsLive() || expiry < System.currentTimeMillis())
|
||||
{
|
||||
hologram.stop();
|
||||
cancel();
|
||||
}
|
||||
else
|
||||
{
|
||||
elevateHologram(hologram);
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(Host.Manager.getPlugin(), 0L, 1L);
|
||||
}
|
||||
|
||||
private Hologram createHologram(Player player, Location loc, String text)
|
||||
{
|
||||
Hologram hologram = new Hologram(Host.Manager.getHologramManager(), loc, text);
|
||||
hologram.setHologramTarget(HologramTarget.WHITELIST);
|
||||
hologram.addPlayer(player);
|
||||
hologram.start();
|
||||
|
||||
return hologram;
|
||||
}
|
||||
|
||||
private void elevateHologram(Hologram hologram)
|
||||
{
|
||||
hologram.setLocation(hologram.getLocation().add(0, DISPLAY_COUNT_ELEVATION_RATE, 0));
|
||||
}
|
||||
|
||||
public boolean isInsideMap(Player player)
|
||||
{
|
||||
return Host.isInsideMap(player.getLocation());
|
||||
}
|
||||
|
||||
private static final int TIME_LEFT_DIVIDER = 1000;
|
||||
|
||||
public int getTimeLeft()
|
||||
{
|
||||
return (int) ((Settings.getDuration() - (System.currentTimeMillis() - Settings.getStartTime())) / TIME_LEFT_DIVIDER);
|
||||
}
|
||||
|
||||
public ArrayList<Player> getPlayersAlive()
|
||||
{
|
||||
return Host.getPlayersAlive();
|
||||
}
|
||||
|
||||
public ArrayList<Player> getPlayersIn(boolean ignoreCompleted)
|
||||
{
|
||||
ArrayList<Player> list = new ArrayList<Player>();
|
||||
|
||||
for (Player player : getPlayersAlive())
|
||||
{
|
||||
if (Data.isLost(player) || (ignoreCompleted && Data.isCompleted(player)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
list.add(player);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public float getTimeLeftPercent()
|
||||
{
|
||||
float a = (float) (Settings.getDuration() - (System.currentTimeMillis() - Settings.getStartTime()));
|
||||
float b = (float) (Settings.getDuration());
|
||||
return a / b;
|
||||
}
|
||||
|
||||
public final int getRemainingPlaces()
|
||||
{
|
||||
if (_type == ChallengeType.FirstComplete)
|
||||
return Settings.getMaxCompletedCount() - Data.getCompletedPlayers().size();
|
||||
else if (_type == ChallengeType.LastStanding)
|
||||
return getPlayersAlive().size() - Settings.getMaxCompletedCount();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getArenaSize()
|
||||
{
|
||||
return getArenaSize(DEFAULT_ARENA_SIZE);
|
||||
}
|
||||
|
||||
public int getArenaSize(int minBlocks)
|
||||
{
|
||||
int size = (int) (minBlocks + Math.ceil(Host.getPlayersWithRemainingLives() / ARENA_SIZE_DIVIDER));
|
||||
return size > ARENA_SIZE_LIMIT ? ARENA_SIZE_LIMIT : size;
|
||||
}
|
||||
|
||||
public BawkBawkBattles getHost()
|
||||
{
|
||||
return Host;
|
||||
}
|
||||
|
||||
public ChallengeType getType()
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
public String[] getDescription()
|
||||
{
|
||||
return _description;
|
||||
}
|
||||
|
||||
public Location getCenter()
|
||||
{
|
||||
return Settings.getMapCenter();
|
||||
}
|
||||
|
||||
public ChallengeSettings getSettings()
|
||||
{
|
||||
return Settings;
|
||||
}
|
||||
|
||||
public ChallengeData getData()
|
||||
{
|
||||
return Data;
|
||||
}
|
||||
|
||||
/**
|
||||
* tadahtech's circle method (temporarily used instead of UtilShapes.getCircle)
|
||||
*/
|
||||
protected List<Location> circle(Location loc, Integer r, Integer h, Boolean hollow, Boolean sphere, int plusY)
|
||||
{
|
||||
List<Location> circleblocks = new ArrayList<>();
|
||||
|
||||
int cx = loc.getBlockX();
|
||||
int cy = loc.getBlockY();
|
||||
int cz = loc.getBlockZ();
|
||||
|
||||
for (int x = cx - r; x <= cx + r; x++)
|
||||
{
|
||||
for (int z = cz - r; z <= cz + r; z++)
|
||||
{
|
||||
for (int y = (sphere ? cy - r : cy); y < (sphere ? cy + r : cy + h); y++)
|
||||
{
|
||||
double dist = (cx - x) * (cx - x) + (cz - z) * (cz - z) + (sphere ? (cy - y) * (cy - y) : 0);
|
||||
if (dist < r * r && !(hollow && dist < (r - 1) * (r - 1)))
|
||||
{
|
||||
Location l = new Location(loc.getWorld(), x, y + plusY, z);
|
||||
circleblocks.add(l);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return circleblocks;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called when the challenge timer runs out. <br>
|
||||
* Used for overriding purposes only.
|
||||
*/
|
||||
public void onTimerFinish()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void onCollide(LivingEntity target, Block block, ProjectileUser data)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,169 @@
|
||||
package nautilus.game.arcade.game.games.mineware.challenge;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
|
||||
/**
|
||||
* This class contains a list of collection fields to store challenge data.
|
||||
*/
|
||||
public class ChallengeData
|
||||
{
|
||||
private List<Location> _spawns = new ArrayList<>();
|
||||
private Set<Player> _invisible = new HashSet<>();
|
||||
private Set<Block> _modifiedBlocks = new LinkedHashSet<>();
|
||||
private Set<Player> _completed = new HashSet<>();
|
||||
private Set<Player> _lost = new HashSet<>();
|
||||
|
||||
public void reset()
|
||||
{
|
||||
_spawns.clear();
|
||||
_invisible.clear();
|
||||
_modifiedBlocks.clear();
|
||||
_completed.clear();
|
||||
_lost.clear();
|
||||
}
|
||||
|
||||
public void setSpawns(ArrayList<Location> spawns)
|
||||
{
|
||||
_spawns = spawns;
|
||||
}
|
||||
|
||||
public List<Location> getDefinedSpawns()
|
||||
{
|
||||
return _spawns;
|
||||
}
|
||||
|
||||
public boolean isSpawnLocation(Location location)
|
||||
{
|
||||
for (Location spawn : _spawns)
|
||||
{
|
||||
if ((int) spawn.getX() == (int) location.getX() && (int) spawn.getY() == (int) location.getY() && (int) spawn.getZ() == (int) location.getZ())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isNearSpawnLocation(Location location)
|
||||
{
|
||||
for (Location spawn : _spawns)
|
||||
{
|
||||
Block spawnBlock = spawn.getBlock();
|
||||
|
||||
Block[] near = {
|
||||
spawnBlock.getRelative(BlockFace.NORTH),
|
||||
spawnBlock.getRelative(BlockFace.EAST),
|
||||
spawnBlock.getRelative(BlockFace.SOUTH),
|
||||
spawnBlock.getRelative(BlockFace.WEST),
|
||||
spawnBlock.getRelative(BlockFace.NORTH_EAST),
|
||||
spawnBlock.getRelative(BlockFace.NORTH_WEST),
|
||||
spawnBlock.getRelative(BlockFace.SOUTH_EAST),
|
||||
spawnBlock.getRelative(BlockFace.SOUTH_WEST)
|
||||
};
|
||||
|
||||
for (Block block : near)
|
||||
{
|
||||
if (UtilAlg.isSimilar(block.getLocation(), location))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void removePlayer(Player player)
|
||||
{
|
||||
_lost.remove(player);
|
||||
_completed.remove(player);
|
||||
_invisible.remove(player);
|
||||
}
|
||||
|
||||
public boolean isCompleted(Player player)
|
||||
{
|
||||
return _completed.contains(player);
|
||||
}
|
||||
|
||||
public boolean isDone(Player player)
|
||||
{
|
||||
return _completed.contains(player) || _lost.contains(player);
|
||||
}
|
||||
|
||||
public boolean isLost(Player player)
|
||||
{
|
||||
return _lost.contains(player);
|
||||
}
|
||||
|
||||
public void addInvisiblePlayer(Player player)
|
||||
{
|
||||
_invisible.add(player);
|
||||
}
|
||||
|
||||
public Set<Player> getInvisiblePlayers()
|
||||
{
|
||||
return _invisible;
|
||||
}
|
||||
|
||||
public boolean hasInvisiblePlayers()
|
||||
{
|
||||
return !_invisible.isEmpty();
|
||||
}
|
||||
|
||||
public void addModifiedBlock(Block block)
|
||||
{
|
||||
_modifiedBlocks.add(block);
|
||||
}
|
||||
|
||||
public boolean isModifiedBlock(Block block)
|
||||
{
|
||||
return _modifiedBlocks.contains(block);
|
||||
}
|
||||
|
||||
public void removeModifiedBlock(Block block)
|
||||
{
|
||||
_modifiedBlocks.remove(block);
|
||||
}
|
||||
|
||||
public Set<Block> getModifiedBlocks()
|
||||
{
|
||||
return _modifiedBlocks;
|
||||
}
|
||||
|
||||
public void addCompletedPlayer(Player player)
|
||||
{
|
||||
_completed.add(player);
|
||||
}
|
||||
|
||||
public Set<Player> getCompletedPlayers()
|
||||
{
|
||||
return _completed;
|
||||
}
|
||||
|
||||
public boolean hasAnyoneCompleted()
|
||||
{
|
||||
return !_completed.isEmpty();
|
||||
}
|
||||
|
||||
public void addLostPlayer(Player player)
|
||||
{
|
||||
_lost.add(player);
|
||||
}
|
||||
|
||||
public Set<Player> getLostPlayers()
|
||||
{
|
||||
return _lost;
|
||||
}
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package nautilus.game.arcade.game.games.mineware.challenge;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
|
||||
public class ChallengeList
|
||||
{
|
||||
private List<Challenge> _challenges = new ArrayList<>();
|
||||
private List<Challenge> _played = new ArrayList<>();
|
||||
private Challenge _restricted;
|
||||
|
||||
public Challenge random()
|
||||
{
|
||||
if (_restricted == null)
|
||||
{
|
||||
if (_played.size() == _challenges.size())
|
||||
{
|
||||
_played.clear();
|
||||
return UtilMath.randomElement(_challenges);
|
||||
}
|
||||
else
|
||||
{
|
||||
Challenge challenge = UtilMath.randomElement(_challenges);
|
||||
|
||||
while (_played.contains(challenge))
|
||||
{
|
||||
challenge = UtilMath.randomElement(_challenges);
|
||||
}
|
||||
|
||||
return challenge;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return _restricted;
|
||||
}
|
||||
}
|
||||
|
||||
public void add(Challenge... challenges)
|
||||
{
|
||||
for (Challenge challenge : challenges)
|
||||
{
|
||||
_challenges.add(challenge);
|
||||
}
|
||||
}
|
||||
|
||||
public void addPlayed(Challenge challenge)
|
||||
{
|
||||
_played.add(challenge);
|
||||
}
|
||||
|
||||
public boolean restrict(String name)
|
||||
{
|
||||
for (Challenge challenge : _challenges)
|
||||
{
|
||||
if (challenge.getName().contains(name))
|
||||
{
|
||||
System.out.println("Restricted: " + challenge.getName());
|
||||
_restricted = challenge;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void resetPlayed()
|
||||
{
|
||||
_played.clear();
|
||||
}
|
||||
|
||||
public void unrestrict()
|
||||
{
|
||||
_restricted = null;
|
||||
}
|
||||
|
||||
public int size()
|
||||
{
|
||||
return _challenges.size();
|
||||
}
|
||||
|
||||
public int played()
|
||||
{
|
||||
return _played.size();
|
||||
}
|
||||
}
|
@ -0,0 +1,151 @@
|
||||
package nautilus.game.arcade.game.games.mineware.challenge;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
||||
/**
|
||||
* This class contains a list of fields that are used as settings for the challenge class.
|
||||
*/
|
||||
public class ChallengeSettings
|
||||
{
|
||||
private Challenge _challenge;
|
||||
private int _minPlayers = 2;
|
||||
private int _maxPlayers = 250;
|
||||
private int _maxCompletedCount;
|
||||
private long _startTime;
|
||||
private long _duration = 60000;
|
||||
|
||||
private boolean _useMapHeight;
|
||||
private boolean _lockInventory;
|
||||
private int _lockedSlot = 0;
|
||||
private boolean _teamBased;
|
||||
private boolean _canCrumble;
|
||||
private boolean _hideTimerRanOutMessage;
|
||||
|
||||
private double _centerX;
|
||||
private double _centerY;
|
||||
private double _centerZ;
|
||||
|
||||
public ChallengeSettings(Challenge challenge)
|
||||
{
|
||||
_challenge = challenge;
|
||||
}
|
||||
|
||||
public Challenge getChallenge()
|
||||
{
|
||||
return _challenge;
|
||||
}
|
||||
|
||||
public void setMinPlayers(int minPlayers)
|
||||
{
|
||||
_minPlayers = minPlayers;
|
||||
}
|
||||
|
||||
public int getMinPlayers()
|
||||
{
|
||||
return _minPlayers;
|
||||
}
|
||||
|
||||
public void setMaxPlayers(int maxPlayers)
|
||||
{
|
||||
_maxPlayers = maxPlayers;
|
||||
}
|
||||
|
||||
public int getMaxPlayers()
|
||||
{
|
||||
return _maxPlayers;
|
||||
}
|
||||
|
||||
public Location getMapCenter()
|
||||
{
|
||||
return new Location(_challenge.getHost().WorldData.World, _centerX, _centerY, _centerZ);
|
||||
}
|
||||
|
||||
public void setMaxCompletedCount(int maxCompletedCount)
|
||||
{
|
||||
_maxCompletedCount = maxCompletedCount;
|
||||
}
|
||||
|
||||
public int getMaxCompletedCount()
|
||||
{
|
||||
return _maxCompletedCount;
|
||||
}
|
||||
|
||||
public void setStartTime(long startTime)
|
||||
{
|
||||
_startTime = startTime;
|
||||
}
|
||||
|
||||
public long getStartTime()
|
||||
{
|
||||
return _startTime;
|
||||
}
|
||||
|
||||
public void setDuration(long duration)
|
||||
{
|
||||
_duration = duration;
|
||||
}
|
||||
|
||||
public long getDuration()
|
||||
{
|
||||
return _duration;
|
||||
}
|
||||
|
||||
public void setUseMapHeight()
|
||||
{
|
||||
_useMapHeight = true;
|
||||
_centerX = -1;
|
||||
_centerY = 62;
|
||||
_centerZ = 10;
|
||||
}
|
||||
|
||||
public boolean canUseMapHeight()
|
||||
{
|
||||
return _useMapHeight;
|
||||
}
|
||||
|
||||
public void setLockInventory(int lockedSlot)
|
||||
{
|
||||
_lockInventory = true;
|
||||
_lockedSlot = lockedSlot;
|
||||
}
|
||||
|
||||
public boolean isInventoryLocked()
|
||||
{
|
||||
return _lockInventory;
|
||||
}
|
||||
|
||||
public int getLockedSlot()
|
||||
{
|
||||
return _lockedSlot;
|
||||
}
|
||||
|
||||
public void setTeamBased()
|
||||
{
|
||||
_teamBased = true;
|
||||
}
|
||||
|
||||
public boolean isTeamBased()
|
||||
{
|
||||
return _teamBased;
|
||||
}
|
||||
|
||||
public void setCanCruble()
|
||||
{
|
||||
_canCrumble = true;
|
||||
}
|
||||
|
||||
public boolean canCrumble()
|
||||
{
|
||||
return _canCrumble;
|
||||
}
|
||||
|
||||
public void hideTimerRanOutMessage()
|
||||
{
|
||||
_hideTimerRanOutMessage = true;
|
||||
}
|
||||
|
||||
public boolean shouldHideTimerRanOutMessage()
|
||||
{
|
||||
return _hideTimerRanOutMessage;
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package nautilus.game.arcade.game.games.mineware.challenge;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* This class holds a list of players under a common group name, that represents a team.
|
||||
*/
|
||||
public class ChallengeTeam
|
||||
{
|
||||
private String _name;
|
||||
private Set<Player> _players = new LinkedHashSet<>();
|
||||
|
||||
public ChallengeTeam(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
public void add(Player player)
|
||||
{
|
||||
_players.add(player);
|
||||
}
|
||||
|
||||
public void remove(Player player)
|
||||
{
|
||||
_players.remove(player);
|
||||
}
|
||||
|
||||
public void reset()
|
||||
{
|
||||
_players.clear();
|
||||
}
|
||||
|
||||
public boolean isMember(Player player)
|
||||
{
|
||||
return _players.contains(player);
|
||||
}
|
||||
|
||||
public int getSize()
|
||||
{
|
||||
return _players.size();
|
||||
}
|
||||
|
||||
public List<Player> getPlayers()
|
||||
{
|
||||
return new ArrayList<>(_players);
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package nautilus.game.arcade.game.games.mineware.challenge;
|
||||
|
||||
/**
|
||||
* The ending condition of a challenge.
|
||||
*/
|
||||
public enum ChallengeType
|
||||
{
|
||||
LastStanding("Last Standing"),
|
||||
FirstComplete("First Complete");
|
||||
|
||||
private String _name;
|
||||
|
||||
ChallengeType(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package nautilus.game.arcade.game.games.mineware.challenge;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* Tracks boolean related data used for statistic trackers.
|
||||
*/
|
||||
public interface LogicTracker
|
||||
{
|
||||
public boolean hasData(Player player);
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package nautilus.game.arcade.game.games.mineware.challenge;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* Tracks number related data used for statistic trackers.
|
||||
*/
|
||||
public interface NumberTracker
|
||||
{
|
||||
public Number getData(Player player);
|
||||
|
||||
public boolean hasData(Player player);
|
||||
}
|
@ -0,0 +1,300 @@
|
||||
package nautilus.game.arcade.game.games.mineware.challenge;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.projectile.ProjectileUser;
|
||||
import nautilus.game.arcade.game.games.mineware.BawkBawkBattles;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* This class contains the base structure of a team challenge.
|
||||
* All challenges should trigger any functionality inside
|
||||
* {@link #createSpawns()}, {@link #createMap()}, {@link #onStart()} and {@link #onEnd()}.
|
||||
* </p>
|
||||
*
|
||||
* Additionally, {@link #onTimerFinish()} and {@link #onCollide(LivingEntity, Block, ProjectileUser)} can be overrided.
|
||||
*/
|
||||
public abstract class TeamChallenge extends Challenge
|
||||
{
|
||||
private static final int TEAM_EVEN_NUMBER = 2;
|
||||
private static final int TEAM_SEPERATOR = 2;
|
||||
|
||||
private ChallengeTeam _firstTeam;
|
||||
private ChallengeTeam _secondTeam;
|
||||
private boolean _teamSpawn;
|
||||
private byte _firstTeamSpawnBlockData;
|
||||
private byte _secondTeamSpawnBlockData;
|
||||
|
||||
public TeamChallenge(BawkBawkBattles host, ChallengeType type, String firstTeam, String secondTeam, boolean teamSpawn, byte firstTeamSpawnBlockData, byte secondTeamSpawnBlockData, String name, String... description)
|
||||
{
|
||||
super(host, type, name, description);
|
||||
|
||||
_firstTeam = new ChallengeTeam(firstTeam);
|
||||
_secondTeam = new ChallengeTeam(secondTeam);
|
||||
_teamSpawn = teamSpawn;
|
||||
_firstTeamSpawnBlockData = firstTeamSpawnBlockData;
|
||||
_secondTeamSpawnBlockData = secondTeamSpawnBlockData;
|
||||
}
|
||||
|
||||
public TeamChallenge(BawkBawkBattles host, ChallengeType type, String firstTeam, String secondTeam, String name, String... description)
|
||||
{
|
||||
this(host, type, firstTeam, secondTeam, false, (byte) 0, (byte) 0, name, description);
|
||||
}
|
||||
|
||||
/*
|
||||
* Called automatically only when _teamSpawn is true.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void spawn(boolean firstRun)
|
||||
{
|
||||
if (_teamSpawn)
|
||||
{
|
||||
autoSelectTeams();
|
||||
|
||||
List<Player> firstTeam = _firstTeam.getPlayers();
|
||||
List<Player> secondTeam = _secondTeam.getPlayers();
|
||||
|
||||
int firstTeamIndex = 0;
|
||||
int secondTeamIndex = 0;
|
||||
|
||||
int players = Host.getPlayersWithRemainingLives();
|
||||
int teleported = 0;
|
||||
|
||||
List<Location> randomSpawns = Data.getDefinedSpawns();
|
||||
Collections.shuffle(randomSpawns);
|
||||
|
||||
while (teleported < players)
|
||||
{
|
||||
for (Location spawn : randomSpawns)
|
||||
{
|
||||
Block block = spawn.getBlock().getRelative(BlockFace.DOWN);
|
||||
|
||||
if (block.getData() == _firstTeamSpawnBlockData && firstTeamIndex < firstTeam.size())
|
||||
{
|
||||
Player player = firstTeam.get(firstTeamIndex);
|
||||
|
||||
if (firstRun)
|
||||
{
|
||||
teleportWithDelay(player, spawn, teleported);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.teleport(spawn);
|
||||
}
|
||||
|
||||
firstTeamIndex++;
|
||||
teleported++;
|
||||
}
|
||||
else if (block.getData() == _secondTeamSpawnBlockData && secondTeamIndex < secondTeam.size())
|
||||
{
|
||||
Player player = secondTeam.get(secondTeamIndex);
|
||||
|
||||
if (firstRun)
|
||||
{
|
||||
teleportWithDelay(player, spawn, teleported);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.teleport(spawn);
|
||||
}
|
||||
|
||||
secondTeamIndex++;
|
||||
teleported++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
super.spawn(firstRun);
|
||||
}
|
||||
}
|
||||
|
||||
private void teleportWithDelay(Player player, final Location spawn, int teleported)
|
||||
{
|
||||
new BukkitRunnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
player.teleport(spawn);
|
||||
}
|
||||
}.runTaskLater(Host.Manager.getPlugin(), teleported);
|
||||
}
|
||||
|
||||
/*
|
||||
* Called automatically only when _teamSpawn is true.
|
||||
*/
|
||||
protected void autoSelectTeams()
|
||||
{
|
||||
ArrayList<Player> players = Host.GetPlayers(false);
|
||||
Collections.shuffle(players);
|
||||
int size = 0;
|
||||
|
||||
if (players.size() % TEAM_EVEN_NUMBER == 0)
|
||||
{
|
||||
for (Player player : players)
|
||||
{
|
||||
if (size < players.size() / TEAM_SEPERATOR)
|
||||
{
|
||||
_firstTeam.add(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
_secondTeam.add(player);
|
||||
}
|
||||
|
||||
size++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < players.size(); i++)
|
||||
{
|
||||
Player player = players.get(i);
|
||||
|
||||
if (i == players.size() - 1)
|
||||
{
|
||||
if (UtilMath.random.nextBoolean())
|
||||
{
|
||||
_firstTeam.add(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
_secondTeam.add(player);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (size < (int) players.size() / TEAM_SEPERATOR)
|
||||
{
|
||||
_firstTeam.add(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
_secondTeam.add(player);
|
||||
}
|
||||
}
|
||||
|
||||
size++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void end()
|
||||
{
|
||||
_firstTeam.reset();
|
||||
_secondTeam.reset();
|
||||
super.end();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFinish()
|
||||
{
|
||||
int firstTeamAlive = 0;
|
||||
|
||||
for (Player firstTeamPlayer : _firstTeam.getPlayers())
|
||||
{
|
||||
if (isPlayerValid(firstTeamPlayer))
|
||||
{
|
||||
firstTeamAlive++;
|
||||
}
|
||||
}
|
||||
|
||||
int secondTeamAlive = 0;
|
||||
|
||||
for (Player secondTeamPlayer : _secondTeam.getPlayers())
|
||||
{
|
||||
if (isPlayerValid(secondTeamPlayer))
|
||||
{
|
||||
secondTeamAlive++;
|
||||
}
|
||||
}
|
||||
|
||||
boolean firstTeamDominant = firstTeamAlive > 0 && secondTeamAlive == 0;
|
||||
boolean secondTeamDominant = secondTeamAlive > 0 && firstTeamAlive == 0;
|
||||
|
||||
if (firstTeamDominant)
|
||||
{
|
||||
for (Player firstTeamPlayer : _firstTeam.getPlayers())
|
||||
{
|
||||
setCompleted(firstTeamPlayer);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (secondTeamDominant)
|
||||
{
|
||||
for (Player secondTeamPlayer : _secondTeam.getPlayers())
|
||||
{
|
||||
setCompleted(secondTeamPlayer);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.canFinish();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
if (!isChallengeValid())
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
ChallengeTeam team = getTeam(player);
|
||||
|
||||
if (team != null)
|
||||
{
|
||||
team.remove(player);
|
||||
}
|
||||
}
|
||||
|
||||
public ChallengeTeam getTeam(Player player)
|
||||
{
|
||||
if (_firstTeam.isMember(player))
|
||||
{
|
||||
return _firstTeam;
|
||||
}
|
||||
else
|
||||
{
|
||||
return _secondTeam;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean areOnSameTeam(Player player1, Player player2)
|
||||
{
|
||||
return (_firstTeam.isMember(player1) && _firstTeam.isMember(player2)) || (_secondTeam.isMember(player1) && _secondTeam.isMember(player2));
|
||||
}
|
||||
|
||||
public ChallengeTeam getFirstTeam()
|
||||
{
|
||||
return _firstTeam;
|
||||
}
|
||||
|
||||
public ChallengeTeam getSecondTeam()
|
||||
{
|
||||
return _secondTeam;
|
||||
}
|
||||
|
||||
public boolean shouldTeamSpawn()
|
||||
{
|
||||
return _teamSpawn;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user