Merge branch 'master' of ssh://184.154.0.242:7999/min/mineplex
# Conflicts: # Plugins/.idea/artifacts/Nautilus_Game_Arcade_jar.xml # Plugins/.idea/compiler.xml # Plugins/.idea/encodings.xml # Plugins/.idea/misc.xml # Plugins/.idea/modules.xml
This commit is contained in:
commit
f361ae94dc
@ -1,20 +1,20 @@
|
||||
package mineplex.core.common;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
|
||||
public enum Rank
|
||||
{
|
||||
LT("LT", ChatColor.DARK_RED),
|
||||
OWNER("Owner", ChatColor.DARK_RED),
|
||||
DEVELOPER("Dev", ChatColor.RED),
|
||||
ADMIN("Admin", ChatColor.RED),
|
||||
JNR_DEV("Jr.Dev", ChatColor.RED),
|
||||
SNR_MODERATOR("Sr.Mod", ChatColor.GOLD),
|
||||
MODERATOR("Mod", ChatColor.GOLD),
|
||||
JNR_DEV("Jr.Dev", ChatColor.RED),
|
||||
HELPER("Trainee", ChatColor.DARK_AQUA),
|
||||
MAPLEAD("MapLead", ChatColor.DARK_PURPLE),
|
||||
MAPDEV("Builder", ChatColor.BLUE),
|
||||
|
@ -1,7 +1,10 @@
|
||||
package mineplex.core.common.util;
|
||||
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class UtilAction
|
||||
@ -37,6 +40,14 @@ public class UtilAction
|
||||
|
||||
//Velocity
|
||||
ent.setFallDistance(0);
|
||||
ent.setVelocity(vec);
|
||||
|
||||
|
||||
//Debug
|
||||
if (ent instanceof Player && UtilGear.isMat(((Player)ent).getItemInHand(), Material.SUGAR))
|
||||
{
|
||||
Bukkit.broadcastMessage(F.main("Debug", "Velocity Sent: " + vec.length()));
|
||||
}
|
||||
|
||||
ent.setVelocity(vec);
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import java.util.TreeSet;
|
||||
|
||||
|
||||
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -260,4 +261,96 @@ public class UtilAlg
|
||||
return isInPyramid(player.getLocation().getDirection(), UtilAlg.getTrajectory(player.getEyeLocation(), target.getEyeLocation()), angleLimit) ||
|
||||
isInPyramid(player.getLocation().getDirection(), UtilAlg.getTrajectory(player.getEyeLocation(), target.getLocation()), angleLimit);
|
||||
}
|
||||
|
||||
public static Location getLocationAwayFromPlayers(ArrayList<Location> locs, ArrayList<Player> players)
|
||||
{
|
||||
Location bestLoc = null;
|
||||
double bestDist = 0;
|
||||
|
||||
for (Location loc : locs)
|
||||
{
|
||||
double closest = -1;
|
||||
|
||||
for (Player player : players)
|
||||
{
|
||||
//Different Worlds
|
||||
if (!player.getWorld().equals(loc.getWorld()))
|
||||
continue;
|
||||
|
||||
double dist = UtilMath.offsetSquared(player.getLocation(), loc);
|
||||
|
||||
if (closest == -1 || dist < closest)
|
||||
{
|
||||
closest = dist;
|
||||
}
|
||||
}
|
||||
|
||||
if (closest == -1)
|
||||
continue;
|
||||
|
||||
if (bestLoc == null || closest > bestDist)
|
||||
{
|
||||
bestLoc = loc;
|
||||
bestDist = closest;
|
||||
}
|
||||
}
|
||||
|
||||
return bestLoc;
|
||||
}
|
||||
|
||||
public static Location getLocationNearPlayers(ArrayList<Location> locs, ArrayList<Player> players, ArrayList<Player> dontOverlap)
|
||||
{
|
||||
Location bestLoc = null;
|
||||
double bestDist = 0;
|
||||
|
||||
for (Location loc : locs)
|
||||
{
|
||||
double closest = -1;
|
||||
|
||||
boolean valid = true;
|
||||
|
||||
//Dont spawn on other players
|
||||
for (Player player : dontOverlap)
|
||||
{
|
||||
if (!player.getWorld().equals(loc.getWorld()))
|
||||
continue;
|
||||
|
||||
double dist = UtilMath.offsetSquared(player.getLocation(), loc);
|
||||
|
||||
if (dist < 0.8)
|
||||
{
|
||||
valid = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!valid)
|
||||
continue;
|
||||
|
||||
//Find closest player
|
||||
for (Player player : players)
|
||||
{
|
||||
if (!player.getWorld().equals(loc.getWorld()))
|
||||
continue;
|
||||
|
||||
double dist = UtilMath.offsetSquared(player.getLocation(), loc);
|
||||
|
||||
if (closest == -1 || dist < closest)
|
||||
{
|
||||
closest = dist;
|
||||
}
|
||||
}
|
||||
|
||||
if (closest == -1)
|
||||
continue;
|
||||
|
||||
if (bestLoc == null || closest < bestDist)
|
||||
{
|
||||
bestLoc = loc;
|
||||
bestDist = closest;
|
||||
}
|
||||
}
|
||||
|
||||
return bestLoc;
|
||||
}
|
||||
}
|
||||
|
@ -48,6 +48,11 @@ public class UtilText {
|
||||
|
||||
public static boolean isStringSimilar(String newString, String oldString, float matchRequirement)
|
||||
{
|
||||
if (newString.length() <= 3)
|
||||
{
|
||||
return newString.toLowerCase().equals(oldString.toLowerCase());
|
||||
}
|
||||
|
||||
for (int i=0 ; i < newString.length() * matchRequirement ; i++)
|
||||
{
|
||||
int matchFromIndex = 0;
|
||||
@ -56,7 +61,7 @@ public class UtilText {
|
||||
for (int j=0 ; j < oldString.length() ; j++)
|
||||
{
|
||||
//End of newString
|
||||
if (i+j > newString.length())
|
||||
if (i+j >= newString.length())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -19,12 +19,20 @@ public class UpdateRank extends CommandBase<CoreClientManager>
|
||||
{
|
||||
public UpdateRank(CoreClientManager plugin)
|
||||
{
|
||||
super(plugin, Rank.ADMIN, "updateRank");
|
||||
super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV /*On test servers only*/}, "updateRank");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(final Player caller, String[] args)
|
||||
{
|
||||
boolean testServer = Plugin.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing");
|
||||
|
||||
if (Plugin.Get(caller).GetRank() == Rank.JNR_DEV && !testServer)
|
||||
{
|
||||
F.main(Plugin.getName(), F.elem(Rank.JNR_DEV.GetTag(true, true)) + "s are only permitted to set ranks on test servers!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (args == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "/" + AliasUsed + " joeschmo MODERATOR"));
|
||||
@ -52,9 +60,9 @@ public class UpdateRank extends CommandBase<CoreClientManager>
|
||||
|
||||
final Rank rank = tempRank;
|
||||
|
||||
if (rank == Rank.ADMIN || rank == Rank.YOUTUBE || rank == Rank.TWITCH || rank == Rank.MODERATOR || rank == Rank.HELPER || rank == Rank.ALL || rank == Rank.MAPDEV || rank == Rank.SNR_MODERATOR)
|
||||
if (rank == Rank.ADMIN || rank == Rank.YOUTUBE || rank == Rank.TWITCH || rank == Rank.MODERATOR || rank == Rank.HELPER || rank == Rank.ALL || rank == Rank.MAPDEV || rank == Rank.SNR_MODERATOR || rank == Rank.JNR_DEV || rank == Rank.DEVELOPER)
|
||||
{
|
||||
if (rank == Rank.ADMIN && !Plugin.hasRank(caller, Rank.LT))
|
||||
if (!testServer && rank.Has(Rank.ADMIN) && !Plugin.hasRank(caller, Rank.LT))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), ChatColor.RED + "" + ChatColor.BOLD + "Insufficient privileges!"));
|
||||
return;
|
||||
|
@ -56,7 +56,7 @@ public enum Achievement
|
||||
//Survival Games
|
||||
SURVIVAL_GAMES_WINS("Katniss Everdeen", 600,
|
||||
new String[]{"Survival Games.Wins"},
|
||||
new String[]{"Win 30 games of Survival Games"},
|
||||
new String[]{"Win 20 games of Survival Games"},
|
||||
new int[]{30},
|
||||
AchievementCategory.SURVIVAL_GAMES),
|
||||
|
||||
@ -87,7 +87,7 @@ public enum Achievement
|
||||
//Skywars
|
||||
SKYWARS_WINS("Sky King",2000,
|
||||
new String[]{"Skywars.Wins"},
|
||||
new String[]{"Win 30 Games of Skywars"},
|
||||
new String[]{"Win 20 Games of Skywars"},
|
||||
new int[]{30},
|
||||
AchievementCategory.SKYWARS),
|
||||
|
||||
@ -643,39 +643,31 @@ public enum Achievement
|
||||
new String[]{"Throw 2000 TNT"},
|
||||
new int[]{2000},
|
||||
AchievementCategory.BOMB_LOBBERS),
|
||||
|
||||
// BOMB_LOBBERS_REKT_X3("Rekt x3", 800,
|
||||
// new String[]{"Bomb Lobbers.3Kill"},
|
||||
// new String[]{"Kill 3 players with one explosion"},
|
||||
// new int[]{1},
|
||||
// AchievementCategory.BOMB_LOBBERS),
|
||||
|
||||
|
||||
BOMB_LOBBERS_ULTIMATE_KILLER("Ultimate Killer", 800,
|
||||
new String[]{"Bomb Lobbers.Killer"},
|
||||
new String[]{"Kill 6 players in a single game"},
|
||||
new int[]{1},
|
||||
AchievementCategory.BOMB_LOBBERS),
|
||||
|
||||
BOMB_LOBBERS_EXPLOSION_PROOF("Jelly Skin", 1000,
|
||||
BOMB_LOBBERS_EXPLOSION_PROOF("Jelly Skin", 1200,
|
||||
new String[]{"Bomb Lobbers.JellySkin"},
|
||||
new String[]{"Win a game without taking any damage."},
|
||||
new int[]{1},
|
||||
AchievementCategory.BOMB_LOBBERS),
|
||||
|
||||
BOMB_LOBBERS_BEST_TEAM("The Best Team", 800,
|
||||
new String[]{"Bomb Lobbers.BestTeam"},
|
||||
new String[]{"Win a game without losing a teammate"},
|
||||
new int[]{1},
|
||||
AchievementCategory.BOMB_LOBBERS),
|
||||
|
||||
BOMB_LOBBERS_BLAST_PROOF("Blast Proof", 800,
|
||||
new String[]{"Bomb Lobbers.BlastProof"},
|
||||
new String[]{"Win 20 games using Armorer"},
|
||||
new int[]{20},
|
||||
AchievementCategory.BOMB_LOBBERS)
|
||||
|
||||
AchievementCategory.BOMB_LOBBERS),
|
||||
|
||||
BOMB_LOBBERS_SNIPER("Sniper", 10000,
|
||||
new String[]{"Bomb Lobbers.Direct Hit"},
|
||||
new String[]{"Get 50 direct hits"},
|
||||
new int[]{50},
|
||||
AchievementCategory.BOMB_LOBBERS)
|
||||
|
||||
// BOMB_LOBBERS_
|
||||
;
|
||||
|
||||
private String _name;
|
||||
|
@ -208,18 +208,22 @@ public class AchievementManager extends MiniPlugin
|
||||
{
|
||||
int level = get(sender, Achievement.GLOBAL_MINEPLEX_LEVEL).getLevel();
|
||||
|
||||
if (sender.getName().equalsIgnoreCase("B2_mp"))
|
||||
return 101;
|
||||
|
||||
if (rank.Has(Rank.MODERATOR))
|
||||
level = Math.max(level, 5);
|
||||
if (rank.Has(Rank.SNR_MODERATOR))
|
||||
level = Math.max(level, 15);
|
||||
if (rank.Has(Rank.JNR_DEV))
|
||||
level = Math.max(level, 25);
|
||||
if (rank.Has(Rank.ADMIN))
|
||||
level = Math.max(level, 30 + get(sender, Achievement.GLOBAL_GEM_HUNTER).getLevel());
|
||||
if (rank.Has(Rank.OWNER))
|
||||
level = Math.max(level, 50 + get(sender, Achievement.GLOBAL_GEM_HUNTER).getLevel());
|
||||
|
||||
if (sender.getName().equalsIgnoreCase("Phinary"))
|
||||
level = -level;
|
||||
else if (sender.getName().equalsIgnoreCase("B2_mp"))
|
||||
return 101;
|
||||
else if (rank.Has(Rank.OWNER))
|
||||
level = Math.max(level, 50 + get(sender, Achievement.GLOBAL_GEM_HUNTER).getLevel());
|
||||
else if (rank.Has(Rank.ADMIN))
|
||||
level = Math.max(level, 30 + get(sender, Achievement.GLOBAL_GEM_HUNTER).getLevel());
|
||||
else if (rank.Has(Rank.SNR_MODERATOR))
|
||||
level = Math.max(level, 15);
|
||||
else if (rank.Has(Rank.MODERATOR))
|
||||
level = Math.max(level, 5);
|
||||
|
||||
return level;
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ import mineplex.core.cosmetic.ui.button.ActivateGadgetButton;
|
||||
import mineplex.core.cosmetic.ui.button.DeactivateGadgetButton;
|
||||
import mineplex.core.cosmetic.ui.button.GadgetButton;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.gadget.gadgets.MorphBlock;
|
||||
import mineplex.core.gadget.gadgets.MorphNotch;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
@ -68,6 +69,13 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
//setItem(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), "Disabled " + gadget.GetName(), new String[] { "Sorry! Currently disabled until fix is made for 1.8 players!" }, 1, false, false));
|
||||
//return;
|
||||
}
|
||||
else if (gadget instanceof MorphBlock)
|
||||
{
|
||||
//Prevent stacker bug
|
||||
if (getPlayer().getPassenger() != null)
|
||||
return;
|
||||
}
|
||||
|
||||
List<String> itemLore = new ArrayList<String>();
|
||||
|
||||
if (gadget.GetCost(CurrencyType.Coins) >= 0)
|
||||
|
@ -6,12 +6,14 @@ import java.util.List;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
@ -430,4 +432,16 @@ public class GadgetManager extends MiniPlugin
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void chissMeow(PlayerToggleSneakEvent event)
|
||||
{
|
||||
if (event.getPlayer().getName().equals("Chiss"))
|
||||
{
|
||||
if (!event.getPlayer().isSneaking())
|
||||
{
|
||||
event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.CAT_MEOW, 1f, 1f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public enum GameDisplay
|
||||
SquidShooter("Squid Shooter", Material.FIREWORK_CHARGE, (byte)0, GameCategory.ARCADE, 43),
|
||||
Stacker("Super Stacker", Material.BOWL, (byte)0, GameCategory.ARCADE, 42),
|
||||
SurvivalGames("Survival Games", Material.IRON_SWORD, (byte)0, GameCategory.SURVIVAL, 22),
|
||||
SurvivalGamesTeams("Survival Games Teams", Material.IRON_SWORD, (byte)0, GameCategory.TEAM_VARIANT, 23),
|
||||
SurvivalGamesTeams("Survival Games", Material.IRON_SWORD, (byte)0, GameCategory.TEAM_VARIANT, 23),
|
||||
Tug("Tug of Wool", Material.WHEAT, (byte)0, GameCategory.ARCADE, 44),
|
||||
TurfWars("Turf Wars", Material.STAINED_CLAY, (byte)14, GameCategory.ARCADE, 45),
|
||||
UHC("Ultra Hardcore", Material.GOLDEN_APPLE, (byte)0, GameCategory.SURVIVAL, 46),
|
||||
@ -61,7 +61,8 @@ public enum GameDisplay
|
||||
|
||||
Build("Master Builders", Material.WOOD, (byte)0, GameCategory.CLASSICS, 50),
|
||||
Cards("Craft Against Humanity", Material.MAP, (byte)0, GameCategory.CLASSICS, 51),
|
||||
Skywars("Skywars", Material.FEATHER, (byte) 0, GameCategory.SURVIVAL, 52),
|
||||
Skywars("Skywars", "Skywars", Material.FEATHER, (byte) 0, GameCategory.SURVIVAL, 52),
|
||||
SkywarsTeams("Skywars Teams", "Skywars",Material.FEATHER, (byte)5, GameCategory.TEAM_VARIANT, 53),
|
||||
|
||||
Event("Mineplex Event", Material.CAKE, (byte)0, GameCategory.EVENT, 999);
|
||||
|
||||
|
@ -52,7 +52,6 @@ public class MountSheep extends HorseMount
|
||||
|
||||
DisguiseSheep disguise = new DisguiseSheep(horse);
|
||||
disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank());
|
||||
disguise.setCustomNameVisible(true);
|
||||
//disguise.setColor(DyeColor.getByColor(org.bukkit.Color.fromRGB(100, 0, 200)));
|
||||
Manager.getDisguiseManager().disguise(disguise);
|
||||
|
||||
|
@ -48,7 +48,6 @@ public class MountSlime extends Mount<Slime>
|
||||
mount.setSize(2);
|
||||
|
||||
mount.setCustomName(player.getName() + "'s " + GetName());
|
||||
mount.setCustomNameVisible(true);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + "."));
|
||||
|
@ -45,8 +45,8 @@ public class NotificationManager extends MiniPlugin
|
||||
// if (event.getType() == UpdateType.MIN_08)
|
||||
// hugeSale();
|
||||
|
||||
if (event.getType() == UpdateType.MIN_16)
|
||||
sale();
|
||||
// if (event.getType() == UpdateType.MIN_16)
|
||||
// sale();
|
||||
}
|
||||
|
||||
private void sale()
|
||||
|
@ -12,7 +12,7 @@ public class HomeCommand extends CommandBase<NpcManager>
|
||||
{
|
||||
public HomeCommand(NpcManager plugin)
|
||||
{
|
||||
super(plugin, Rank.DEVELOPER, "home");
|
||||
super(plugin, Rank.DEVELOPER, new Rank[] {Rank.JNR_DEV}, "home");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -10,7 +10,7 @@ public class NpcCommand extends MultiCommandBase<NpcManager>
|
||||
{
|
||||
public NpcCommand(NpcManager plugin)
|
||||
{
|
||||
super(plugin, Rank.DEVELOPER, "npc");
|
||||
super(plugin, Rank.DEVELOPER, new Rank[] {Rank.JNR_DEV}, "npc");
|
||||
|
||||
AddCommand(new AddCommand(plugin));
|
||||
AddCommand(new DeleteCommand(plugin));
|
||||
|
@ -14,7 +14,7 @@ public class SendCommand extends CommandBase<Portal>
|
||||
{
|
||||
public SendCommand(Portal plugin)
|
||||
{
|
||||
super(plugin, Rank.ADMIN, "send");
|
||||
super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV}, "send");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -261,7 +261,7 @@ public class PreferencesPage extends ShopPageBase<PreferencesManager, Preference
|
||||
buildPreference(42, Material.SLIME_BALL, "Hub Forcefield", userPreferences.HubForcefield, _toggleHubForcefield);
|
||||
buildPreference(44, Material.SADDLE, "Hub Ignore Velocity", userPreferences.IgnoreVelocity, _toggleHubIgnoreVelocity);
|
||||
}
|
||||
if (getClientManager().Get(getPlayer()).GetRank().Has(Rank.ADMIN))
|
||||
if (getClientManager().Get(getPlayer()).GetRank().Has(Rank.ADMIN) || getClientManager().Get(getPlayer()).GetRank() == Rank.JNR_DEV)
|
||||
{
|
||||
buildPreference(36, Material.NETHER_STAR, "Hub Invisibility", userPreferences.Invisibility, _toggleHubInvisibility);
|
||||
buildPreference(38, Material.SLIME_BALL, "Hub Forcefield", userPreferences.HubForcefield, _toggleHubForcefield);
|
||||
|
@ -7,6 +7,19 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftInventoryCustom;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.antihack.AntiHack;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
@ -23,18 +36,6 @@ import mineplex.core.punish.PunishmentSorter;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftInventoryCustom;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class PunishPage extends CraftInventoryCustom implements Listener
|
||||
{
|
||||
private Punish _plugin;
|
||||
@ -232,14 +233,12 @@ public class PunishPage extends CraftInventoryCustom implements Listener
|
||||
examplePrefixEx + " Forcefield",
|
||||
examplePrefixEx + " Speed Hack",
|
||||
examplePrefixEx + " Reach Hack",
|
||||
examplePrefixEx + " Speed Hack",
|
||||
examplePrefixEx + " Other Hack",
|
||||
" ",
|
||||
examplePrefix + "Hack Reports (SR & FR);",
|
||||
examplePrefixEx + " Forcefield",
|
||||
examplePrefixEx + " Speed Hack",
|
||||
examplePrefixEx + " Reach Hack",
|
||||
examplePrefixEx + " Speed Hack",
|
||||
examplePrefixEx + " Other Hack",
|
||||
examplePrefixEx + " Fly Hack",
|
||||
}
|
||||
@ -294,6 +293,20 @@ public class PunishPage extends CraftInventoryCustom implements Listener
|
||||
}, 1, false, true), new PunishButton(this, Category.ChatOffense, 4, false, -1));
|
||||
}
|
||||
|
||||
if (_plugin.GetClients().Get(_player).GetRank() == Rank.DEVELOPER || _plugin.GetClients().Get(_player).GetRank() == Rank.JNR_DEV)
|
||||
{
|
||||
ShopItem devWarning = new ShopItem(Material.YELLOW_FLOWER, "DEV WARNING", new String[] {ChatColor.RESET + "Developers are advised against using the punish system", ChatColor.RESET + "unless permitted by LT"}, 1, true, true);
|
||||
devWarning.addGlow();
|
||||
|
||||
AddButton(0, devWarning, new IButton()
|
||||
{
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Collections.sort(punishments, new PunishmentSorter());
|
||||
|
||||
int slot = 45;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package mineplex.core.recharge;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
@ -218,6 +219,26 @@ public class Recharge extends MiniPlugin
|
||||
{
|
||||
_recharge.put(player.getName(), new NautHashMap<String, RechargeData>());
|
||||
}
|
||||
|
||||
public void Reset(Player player, String stringContains)
|
||||
{
|
||||
NautHashMap<String, RechargeData> data = _recharge.get(player.getName());
|
||||
|
||||
if (data == null)
|
||||
return;
|
||||
|
||||
Iterator<String> rechargeIter = data.keySet().iterator();
|
||||
|
||||
while (rechargeIter.hasNext())
|
||||
{
|
||||
String key = rechargeIter.next();
|
||||
|
||||
if (key.toLowerCase().contains(stringContains.toLowerCase()))
|
||||
{
|
||||
rechargeIter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void debug(Player player, String ability)
|
||||
{
|
||||
|
@ -49,7 +49,6 @@ public class SecondaryStatHandler implements ILoginProcessor
|
||||
DSLContext context = DSL.using(DBPool.ACCOUNT, SQLDialect.MYSQL);
|
||||
|
||||
final List<Insert> inserts = new ArrayList<>();
|
||||
final List<Delete> deletes = new ArrayList<>();
|
||||
|
||||
for (String statName : oldPlayerStats.getStatsNames())
|
||||
{
|
||||
@ -59,14 +58,9 @@ public class SecondaryStatHandler implements ILoginProcessor
|
||||
.insertInto(Tables.accountStat)
|
||||
.set(Tables.accountStat.accountId, accountId)
|
||||
.set(Tables.accountStat.statId, statId)
|
||||
.set(Tables.accountStat.value, oldPlayerStats.getStat(statName));
|
||||
.set(Tables.accountStat.value, Math.max(oldPlayerStats.getStat(statName), 0L));
|
||||
|
||||
inserts.add(insert);
|
||||
|
||||
Delete delete = context.delete(Tables.accountStats)
|
||||
.where(Tables.accountStats.accountId.equal(accountId));
|
||||
|
||||
deletes.add(delete);
|
||||
}
|
||||
|
||||
context.transaction(new TransactionalRunnable()
|
||||
@ -75,7 +69,6 @@ public class SecondaryStatHandler implements ILoginProcessor
|
||||
public void run(Configuration config) throws Exception
|
||||
{
|
||||
DSL.using(config).batch(inserts).execute();
|
||||
DSL.using(config).batch(deletes).execute();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -87,6 +80,97 @@ public class SecondaryStatHandler implements ILoginProcessor
|
||||
else
|
||||
{
|
||||
_statsManager.replacePlayerHack(playerName, newPlayerStats);
|
||||
|
||||
if (oldPlayerStats.getStatsNames().size() != 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
final DSLContext context = DSL.using(DBPool.ACCOUNT, SQLDialect.MYSQL);
|
||||
final List<Update> updates = new ArrayList<>();
|
||||
final List<Insert> inserts = new ArrayList<>();
|
||||
boolean foundNegativeStat = false;
|
||||
boolean foundLessThanStat = false;
|
||||
|
||||
for (String statName : oldPlayerStats.getStatsNames())
|
||||
{
|
||||
Integer statId = _statsManager.getStatId(statName);
|
||||
|
||||
Insert insert = context
|
||||
.insertInto(Tables.accountStat)
|
||||
.set(Tables.accountStat.accountId, accountId)
|
||||
.set(Tables.accountStat.statId, statId)
|
||||
.set(Tables.accountStat.value, Math.max(oldPlayerStats.getStat(statName), 0L));
|
||||
|
||||
inserts.add(insert);
|
||||
|
||||
Update update = context
|
||||
.update(Tables.accountStat)
|
||||
.set(Tables.accountStat.value, Math.max(oldPlayerStats.getStat(statName), 0L))
|
||||
.where(Tables.accountStat.accountId.eq(accountId))
|
||||
.and(Tables.accountStat.statId.eq(statId));
|
||||
|
||||
updates.add(update);
|
||||
|
||||
if (oldPlayerStats.getStat(statName) < 0)
|
||||
{
|
||||
foundNegativeStat = true;
|
||||
}
|
||||
else if (newPlayerStats.getStat(statName) < oldPlayerStats.getStat(statName))
|
||||
{
|
||||
foundLessThanStat = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (foundNegativeStat && foundLessThanStat)
|
||||
{
|
||||
context.transaction(new TransactionalRunnable()
|
||||
{
|
||||
@Override
|
||||
public void run(Configuration config) throws Exception
|
||||
{
|
||||
int[] updateResult = context.batch(updates).execute();
|
||||
|
||||
for (int i = 0; i < updateResult.length; i++)
|
||||
{
|
||||
if (updateResult[i] > 0)
|
||||
inserts.set(i, null);
|
||||
}
|
||||
|
||||
inserts.removeAll(Collections.singleton(null));
|
||||
|
||||
context.batch(inserts).execute();
|
||||
|
||||
System.out.println("Updating");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
final List<Delete> deletes = new ArrayList<>();
|
||||
|
||||
for (String statName : oldPlayerStats.getStatsNames())
|
||||
{
|
||||
Delete delete = context.delete(Tables.accountStats)
|
||||
.where(Tables.accountStats.accountId.equal(accountId));
|
||||
|
||||
deletes.add(delete);
|
||||
}
|
||||
|
||||
context.transaction(new TransactionalRunnable()
|
||||
{
|
||||
@Override
|
||||
public void run(Configuration config) throws Exception
|
||||
{
|
||||
DSL.using(config).batch(deletes).execute();
|
||||
}
|
||||
});
|
||||
*/
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ public class TimeCommand extends CommandBase<StatsManager>
|
||||
else
|
||||
{
|
||||
long time = Plugin.Get(target).getStat("Global.TimeInGame");
|
||||
UtilPlayer.message(caller, F.main("Time", F.name(target.getName() + " has spent " + F.elem(UtilTime.convertString(time * 1000L, 1, UtilTime.TimeUnit.FIT)) + " in game")));
|
||||
UtilPlayer.message(caller, F.main("Time", F.name(target.getName()) + " has spent " + F.elem(UtilTime.convertString(time * 1000L, 1, UtilTime.TimeUnit.FIT)) + " in game"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ public class HereCommand extends CommandBase<Teleport>
|
||||
{
|
||||
public HereCommand(Teleport plugin)
|
||||
{
|
||||
super(plugin, Rank.ADMIN, "here", "h");
|
||||
super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV}, "here", "h");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -327,6 +327,11 @@ public class TreasureLocation implements Listener
|
||||
_hologram.start();
|
||||
}
|
||||
|
||||
public Treasure getCurrentTreasure()
|
||||
{
|
||||
return _currentTreasure;
|
||||
}
|
||||
|
||||
public void openShop(Player player)
|
||||
{
|
||||
_shop.attemptShopOpen(player);
|
||||
|
@ -125,6 +125,22 @@ public class TreasureManager extends MiniPlugin
|
||||
return _rewardManager.getRewards(player, rewardType);
|
||||
}
|
||||
|
||||
public boolean isOpening(Player player)
|
||||
{
|
||||
for (TreasureLocation treasureLocation : _treasureLocations)
|
||||
{
|
||||
Treasure treasure = treasureLocation.getCurrentTreasure();
|
||||
|
||||
if (treasure == null)
|
||||
continue;
|
||||
|
||||
if (treasure.getPlayer().equals(player))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public BlockRestore getBlockRestore()
|
||||
{
|
||||
return _blockRestore;
|
||||
|
@ -15,7 +15,7 @@ public class RestartServerCommand extends CommandBase<FileUpdater>
|
||||
{
|
||||
public RestartServerCommand(FileUpdater plugin)
|
||||
{
|
||||
super(plugin, Rank.ADMIN, "restart");
|
||||
super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV}, "restart");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -91,7 +91,7 @@ public class VisibilityManager extends MiniPlugin
|
||||
_data.remove(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
//@EventHandler DISABLED
|
||||
public void updateDebug(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.MIN_01)
|
||||
|
@ -1,16 +1,13 @@
|
||||
package mineplex.hub;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
||||
import org.bukkit.entity.Egg;
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -54,7 +51,6 @@ import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
@ -91,11 +87,11 @@ import mineplex.hub.commands.GadgetToggle;
|
||||
import mineplex.hub.commands.GameModeCommand;
|
||||
import mineplex.hub.commands.NewsCommand;
|
||||
import mineplex.hub.modules.ForcefieldManager;
|
||||
import mineplex.hub.modules.HubVisibilityManager;
|
||||
import mineplex.hub.modules.JumpManager;
|
||||
import mineplex.hub.modules.NewsManager;
|
||||
import mineplex.hub.modules.ParkourManager;
|
||||
import mineplex.hub.modules.TextManager;
|
||||
import mineplex.hub.modules.HubVisibilityManager;
|
||||
import mineplex.hub.modules.WorldManager;
|
||||
import mineplex.hub.poll.PollManager;
|
||||
import mineplex.hub.tutorial.TutorialManager;
|
||||
@ -107,7 +103,7 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
public class HubManager extends MiniClientPlugin<HubClient>
|
||||
{
|
||||
// ☃❅ Snowman!
|
||||
public HubType Type = HubType.Normal;
|
||||
public HubType Type = HubType.Normal;
|
||||
|
||||
private BlockRestore _blockRestore;
|
||||
private CoreClientManager _clientManager;
|
||||
@ -499,7 +495,10 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void AdminOP(PlayerJoinEvent event)
|
||||
{
|
||||
if (_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.OWNER))
|
||||
// Give developers operator on their servers
|
||||
boolean testServer = _plugin.getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing");
|
||||
|
||||
if (_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.OWNER) || (testServer && (_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.DEVELOPER) || _clientManager.Get(event.getPlayer()).GetRank() == Rank.JNR_DEV)))
|
||||
event.getPlayer().setOp(true);
|
||||
else
|
||||
event.getPlayer().setOp(false);
|
||||
@ -899,6 +898,11 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
return _gadgetManager;
|
||||
}
|
||||
|
||||
public TreasureManager GetTreasure()
|
||||
{
|
||||
return _treasureManager;
|
||||
}
|
||||
|
||||
public MountManager GetMount()
|
||||
{
|
||||
return _mountManager;
|
||||
|
@ -10,7 +10,7 @@ public class GadgetToggle extends CommandBase<HubManager>
|
||||
{
|
||||
public GadgetToggle(HubManager plugin)
|
||||
{
|
||||
super(plugin, Rank.ADMIN, new String[] {"gadget"});
|
||||
super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV}, new String[] {"gadget"});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -13,7 +13,7 @@ public class GameModeCommand extends CommandBase<HubManager>
|
||||
{
|
||||
public GameModeCommand(HubManager plugin)
|
||||
{
|
||||
super(plugin, Rank.ADMIN, new String[] {"gm"});
|
||||
super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV}, new String[] {"gm"});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -10,7 +10,7 @@ public class NewsCommand extends MultiCommandBase<HubManager>
|
||||
{
|
||||
public NewsCommand(HubManager plugin)
|
||||
{
|
||||
super(plugin, Rank.ADMIN, "news");
|
||||
super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV}, "news");
|
||||
|
||||
AddCommand(new NewsAddCommand(plugin));
|
||||
AddCommand(new NewsDeleteCommand(plugin));
|
||||
|
@ -19,7 +19,7 @@ public class NewsListCommand extends CommandBase<HubManager>
|
||||
{
|
||||
public NewsListCommand(HubManager plugin)
|
||||
{
|
||||
super(plugin, Rank.ADMIN, "list");
|
||||
super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV}, "list");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -42,7 +42,7 @@ public class ForcefieldManager extends MiniPlugin
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
if (Manager.getPreferences().Get(player).HubForcefield && Manager.GetClients().Get(player).GetRank().Has(Rank.ADMIN))
|
||||
if (Manager.getPreferences().Get(player).HubForcefield && (Manager.GetClients().Get(player).GetRank().Has(Rank.ADMIN) || Manager.GetClients().Get(player).GetRank() == Rank.JNR_DEV))
|
||||
{
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
{
|
||||
@ -56,7 +56,7 @@ public class ForcefieldManager extends MiniPlugin
|
||||
if (UtilMath.offset(other, player) > range)
|
||||
continue;
|
||||
|
||||
if (Manager.GetClients().Get(other).GetRank().Has(Rank.ADMIN))
|
||||
if (Manager.GetClients().Get(other).GetRank().Has(Rank.ADMIN) || Manager.GetClients().Get(other).GetRank() == Rank.JNR_DEV)
|
||||
continue;
|
||||
|
||||
if (Recharge.Instance.use(other, "Forcefield Bump", 500, false, false))
|
||||
|
@ -28,6 +28,8 @@ import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.event.StackerEvent;
|
||||
import mineplex.core.gadget.gadgets.MorphBlock;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.projectile.IThrown;
|
||||
import mineplex.core.projectile.ProjectileManager;
|
||||
import mineplex.core.projectile.ProjectileUser;
|
||||
@ -105,15 +107,33 @@ public class StackerManager extends MiniPlugin implements IThrown
|
||||
return;
|
||||
}
|
||||
|
||||
if (Manager.GetGadget().getActive(stacker, GadgetType.Morph) instanceof MorphBlock)
|
||||
{
|
||||
UtilPlayer.message(stacker, F.main("Stacker", "You cannot stack while using the Block Morph."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (Manager.GetTreasure().isOpening(stacker))
|
||||
return;
|
||||
|
||||
stackerEvent = new StackerEvent(stackee);
|
||||
Bukkit.getServer().getPluginManager().callEvent(stackerEvent);
|
||||
if (stackerEvent.isCancelled())
|
||||
return;
|
||||
|
||||
if (stackee instanceof Player && !Manager.CanBump(((Player)stackee)))
|
||||
if (stackee instanceof Player)
|
||||
{
|
||||
UtilPlayer.message(stacker, F.main("Stacker", F.name(UtilEnt.getName(stackee)) + " is not playing stacker."));
|
||||
return;
|
||||
if (!Manager.CanBump(((Player)stackee)))
|
||||
{
|
||||
UtilPlayer.message(stacker, F.main("Stacker", F.name(UtilEnt.getName(stackee)) + " is not playing stacker."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (Manager.GetTreasure().isOpening((Player) stackee))
|
||||
{
|
||||
UtilPlayer.message(stacker, F.main("Stacker", F.main("Stacker", F.name(UtilEnt.getName(stackee)) + " is opening a chest!")));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (stackee instanceof LivingEntity)
|
||||
|
@ -341,7 +341,7 @@ public class ClientClass
|
||||
if (notify)
|
||||
{
|
||||
ListSkills(_client.GetPlayer());
|
||||
_client.GetPlayer().getWorld().playSound(_client.GetPlayer().getLocation(), Sound.LEVEL_UP, 1f, 1f);
|
||||
_client.GetPlayer().playSound(_client.GetPlayer().getLocation(), Sound.LEVEL_UP, 1f, 1f);
|
||||
|
||||
_client.GetPlayer().sendMessage(F.main("Class", "You equipped " + F.skill(customBuild.Name) + "."));
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.player.PlayerVelocityEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.util.Vector;
|
||||
@ -251,34 +252,34 @@ public class DamageManager extends MiniPlugin
|
||||
{
|
||||
if (stack == null)
|
||||
continue;
|
||||
|
||||
|
||||
Map<Enchantment, Integer> enchants = stack.getEnchantments();
|
||||
for (Enchantment e : enchants.keySet())
|
||||
{
|
||||
if (e.equals(Enchantment.PROTECTION_ENVIRONMENTAL))
|
||||
event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false);
|
||||
|
||||
|
||||
else if (e.equals(Enchantment.PROTECTION_FIRE) &&
|
||||
event.GetCause() == DamageCause.FIRE &&
|
||||
event.GetCause() == DamageCause.FIRE_TICK &&
|
||||
event.GetCause() == DamageCause.LAVA)
|
||||
event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false);
|
||||
|
||||
|
||||
else if (e.equals(Enchantment.PROTECTION_FALL) &&
|
||||
event.GetCause() == DamageCause.FALL)
|
||||
event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false);
|
||||
|
||||
|
||||
else if (e.equals(Enchantment.PROTECTION_EXPLOSIONS) &&
|
||||
event.GetCause() == DamageCause.ENTITY_EXPLOSION)
|
||||
event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false);
|
||||
|
||||
|
||||
else if (e.equals(Enchantment.PROTECTION_PROJECTILE) &&
|
||||
event.GetCause() == DamageCause.PROJECTILE)
|
||||
event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Offensive
|
||||
Player damager = event.GetDamagerPlayer(true);
|
||||
if (damager != null)
|
||||
@ -390,11 +391,22 @@ public class DamageManager extends MiniPlugin
|
||||
trajectory.multiply(0.6 * knockback);
|
||||
trajectory.setY(Math.abs(trajectory.getY()));
|
||||
|
||||
//Apply
|
||||
UtilAction.velocity(event.GetDamageeEntity(),
|
||||
trajectory, 0.2 + trajectory.length() * 0.8, false, 0, Math.abs(0.2 * knockback), 0.4 + (0.04 * knockback), true);
|
||||
}
|
||||
//Debug
|
||||
if (event.GetDamageeEntity() instanceof Player && UtilGear.isMat(((Player)event.GetDamageeEntity()).getItemInHand(), Material.SUGAR))
|
||||
{
|
||||
Bukkit.broadcastMessage("--------- " +
|
||||
UtilEnt.getName(event.GetDamageeEntity()) + " hurt by " + UtilEnt.getName(event.GetDamagerEntity(true)) + "-----------" );
|
||||
|
||||
Bukkit.broadcastMessage(F.main("Debug", "Damage: " + event.GetDamage()));
|
||||
}
|
||||
|
||||
|
||||
//Apply
|
||||
double vel = 0.2 + trajectory.length() * 0.8;
|
||||
|
||||
UtilAction.velocity(event.GetDamageeEntity(), trajectory, vel,
|
||||
false, 0, Math.abs(0.2 * knockback), 0.4 + (0.04 * knockback), true);
|
||||
}
|
||||
}
|
||||
catch (IllegalAccessException e)
|
||||
{
|
||||
@ -410,11 +422,20 @@ public class DamageManager extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void debugVel2(PlayerVelocityEvent event)
|
||||
{
|
||||
if (UtilGear.isMat(((Player)event.getPlayer()).getItemInHand(), Material.SUGAR))
|
||||
{
|
||||
Bukkit.broadcastMessage(F.main("Debug", "Event: " + event.getVelocity().length()));
|
||||
}
|
||||
}
|
||||
|
||||
private void DisplayDamage(CustomDamageEvent event)
|
||||
{
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
if (!UtilGear.isMat(player.getItemInHand(), Material.BOOK))
|
||||
if (!UtilGear.isMat(player.getItemInHand(), Material.COMMAND))
|
||||
continue;
|
||||
|
||||
UtilPlayer.message(player, " ");
|
||||
|
@ -1,5 +1,7 @@
|
||||
package mineplex.serverdata;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import mineplex.serverdata.servers.ConnectionData;
|
||||
import mineplex.serverdata.servers.ServerManager;
|
||||
import redis.clients.jedis.Jedis;
|
||||
@ -15,17 +17,20 @@ import com.google.gson.GsonBuilder;
|
||||
* @author Ty
|
||||
*
|
||||
*/
|
||||
public class Utility
|
||||
public class Utility
|
||||
{
|
||||
|
||||
// The Gson instance used to serialize/deserialize objects in JSON form.
|
||||
private static Gson _gson = new GsonBuilder().create();
|
||||
public static Gson getGson() { return _gson; }
|
||||
|
||||
|
||||
// map of all instantiated connection pools, distinguished by their ip:port combination
|
||||
private static final ConcurrentHashMap<String, JedisPool> _pools = new ConcurrentHashMap<String, JedisPool>();
|
||||
|
||||
// Public static jedis pool for interacting with central default jedis repo.
|
||||
private static JedisPool _masterPool;
|
||||
private static JedisPool _slavePool;
|
||||
|
||||
|
||||
/**
|
||||
* @param object - the (non-null) object to serialize
|
||||
* @return the serialized form of {@code object}.
|
||||
@ -34,7 +39,7 @@ public class Utility
|
||||
{
|
||||
return _gson.toJson(object);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param serializedData - the serialized data to be deserialized
|
||||
* @param type - the resulting class type of the object to be deserialized
|
||||
@ -44,7 +49,7 @@ public class Utility
|
||||
{
|
||||
return _gson.fromJson(serializedData, type);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param delimiter - the delimiter character used to separate the concatenated elements
|
||||
* @param elements - the set of string elements to be concatenated and returned.
|
||||
@ -54,15 +59,15 @@ public class Utility
|
||||
{
|
||||
int length = elements.length;
|
||||
String result = length > 0 ? elements[0] : new String();
|
||||
|
||||
|
||||
for (int i = 1; i < length; i++)
|
||||
{
|
||||
result += delimiter + elements[i];
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the current timestamp (in seconds) fetched from the central jedis repository
|
||||
* for synced timestamps.
|
||||
@ -72,7 +77,7 @@ public class Utility
|
||||
long currentTime = 0;
|
||||
JedisPool pool = getPool(false);
|
||||
Jedis jedis = pool.getResource();
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
currentTime = Long.parseLong(jedis.time().get(0));
|
||||
@ -90,10 +95,10 @@ public class Utility
|
||||
pool.returnResource(jedis);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return currentTime;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the current timestamp (in milliseconds) fetched from the central jedis repository
|
||||
* for synced timestamps.
|
||||
@ -121,22 +126,35 @@ public class Utility
|
||||
pool.returnResource(jedis);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return currentTime * 1000;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param connData - the connection data specifying the database to be connected to.
|
||||
* @return a newly instantiated {@link JedisPool} connected to the provided {@link ConnectionData} repository.
|
||||
*/
|
||||
public static JedisPool generatePool(ConnectionData connData)
|
||||
{
|
||||
JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
|
||||
jedisPoolConfig.setMaxWaitMillis(1000);
|
||||
jedisPoolConfig.setMinIdle(5);
|
||||
return new JedisPool(jedisPoolConfig, connData.getHost(), connData.getPort());
|
||||
String key = getConnKey(connData);
|
||||
JedisPool pool = _pools.get(key);
|
||||
if (pool == null)
|
||||
{
|
||||
JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
|
||||
jedisPoolConfig.setMaxWaitMillis(1000);
|
||||
jedisPoolConfig.setMinIdle(5);
|
||||
jedisPoolConfig.setTestOnBorrow(true);
|
||||
|
||||
jedisPoolConfig.setMaxTotal(20);
|
||||
jedisPoolConfig.setBlockWhenExhausted(true);
|
||||
|
||||
pool = new JedisPool(jedisPoolConfig, connData.getHost(), connData.getPort());
|
||||
_pools.put(key, pool);
|
||||
}
|
||||
|
||||
return pool;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param writeable - whether or not the Jedis connections returned should be writeable to.
|
||||
* @return a globally available {@link JedisPool}
|
||||
@ -149,7 +167,7 @@ public class Utility
|
||||
{
|
||||
_masterPool = generatePool(ServerManager.getMasterConnection());
|
||||
}
|
||||
|
||||
|
||||
return _masterPool;
|
||||
}
|
||||
else
|
||||
@ -157,11 +175,17 @@ public class Utility
|
||||
if (_slavePool == null)
|
||||
{
|
||||
ConnectionData slave = ServerManager.getSlaveConnection();
|
||||
|
||||
|
||||
_slavePool = generatePool(slave);
|
||||
}
|
||||
|
||||
|
||||
return _slavePool;
|
||||
}
|
||||
}
|
||||
|
||||
private static String getConnKey(ConnectionData connData)
|
||||
{
|
||||
return connData.getHost() + ":" + connData.getPort();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -83,11 +83,12 @@ public class StaffServer extends JavaPlugin
|
||||
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("efaf9a17-2304-4f42-8433-421523c308dc"), "B2_mp"));
|
||||
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("492ff708-fe76-4c5a-b9ed-a747b5fa20a0"), "Cherdy8s"));
|
||||
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("80f40f29-4d66-4355-a32f-01a65af2a14c"), "rl6"));
|
||||
|
||||
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("cf85f470-5248-4978-8208-435736fa136e"), "RustyRoo"));
|
||||
|
||||
|
||||
((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("377bdea3-badc-448d-81c1-65db43b17ea4"), "Strutt20"));
|
||||
((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("efaf9a17-2304-4f42-8433-421523c308dc"), "B2_mp"));
|
||||
((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("2d5fd31b-0aa5-41db-a62d-a4611a24349a"), "ishh"));
|
||||
((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("cf85f470-5248-4978-8208-435736fa136e"), "RustyRoo"));
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package nautilus.game.arcade;
|
||||
|
||||
import java.awt.Event;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
@ -110,6 +111,7 @@ import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.GameServerConfig;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.event.EventModule;
|
||||
import nautilus.game.arcade.game.games.uhc.UHC;
|
||||
import nautilus.game.arcade.managers.GameAchievementManager;
|
||||
import nautilus.game.arcade.managers.GameChatManager;
|
||||
@ -143,6 +145,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
private Creature _creature;
|
||||
private DamageManager _damageManager;
|
||||
private Explosion _explosionManager;
|
||||
private EventModule _eventManager;
|
||||
|
||||
private Fire _fire;
|
||||
private ProjectileManager _projectileManager;
|
||||
@ -257,6 +260,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
_cosmeticManager = cosmeticManager;
|
||||
_portal = portal;
|
||||
_petManager = petManager;
|
||||
_eventManager = new EventModule(this, getPlugin());
|
||||
|
||||
// Shop
|
||||
_arcadeShop = new ArcadeShop(this, clientManager, donationManager);
|
||||
@ -562,6 +566,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
return _gameWorldManager;
|
||||
}
|
||||
|
||||
public EventModule GetEventModule()
|
||||
{
|
||||
return _eventManager;
|
||||
}
|
||||
|
||||
public PreferencesManager getPreferences()
|
||||
{
|
||||
return _preferencesManager;
|
||||
@ -653,7 +662,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
return;
|
||||
}
|
||||
|
||||
if (!GetServerConfig().PublicServer)
|
||||
if (!GetServerConfig().PublicServer || GetServerConfig().PlayerServerWhitelist)
|
||||
{
|
||||
event.setMotd(ChatColor.GRAY + "Private");
|
||||
return;
|
||||
@ -818,6 +827,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, C.Bold + "Server has reached max capacity for gameplay purposes.");
|
||||
return;
|
||||
}
|
||||
else if (_gameHostManager.isEventServer() && Bukkit.getServer().getOnlinePlayers().size() >= 128)
|
||||
{
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, C.Bold + "Server has reached max capacity for gameplay purposes.");
|
||||
return;
|
||||
}
|
||||
|
||||
event.allow();
|
||||
event.setResult(PlayerLoginEvent.Result.ALLOWED);
|
||||
@ -829,6 +843,18 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void AdminOP(PlayerJoinEvent event)
|
||||
{
|
||||
// Give developers operator on their servers
|
||||
boolean testServer = _plugin.getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing");
|
||||
|
||||
if (_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.OWNER) || (testServer && (_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.DEVELOPER) || _clientManager.Get(event.getPlayer()).GetRank() == Rank.JNR_DEV)))
|
||||
event.getPlayer().setOp(true);
|
||||
else
|
||||
event.getPlayer().setOp(false);
|
||||
}
|
||||
|
||||
public boolean IsAlive(Player player)
|
||||
{
|
||||
if (_game == null)
|
||||
|
@ -38,10 +38,11 @@ import nautilus.game.arcade.game.games.quiver.QuiverTeams;
|
||||
import nautilus.game.arcade.game.games.runner.Runner;
|
||||
import nautilus.game.arcade.game.games.searchanddestroy.SearchAndDestroy;
|
||||
import nautilus.game.arcade.game.games.sheep.SheepGame;
|
||||
import nautilus.game.arcade.game.games.skywars.Skywars;
|
||||
import nautilus.game.arcade.game.games.smash.SuperSmash;
|
||||
import nautilus.game.arcade.game.games.skywars.SoloSkywars;
|
||||
import nautilus.game.arcade.game.games.skywars.TeamSkywars;
|
||||
import nautilus.game.arcade.game.games.smash.SoloSuperSmash;
|
||||
import nautilus.game.arcade.game.games.smash.SuperSmashDominate;
|
||||
import nautilus.game.arcade.game.games.smash.SuperSmashTeam;
|
||||
import nautilus.game.arcade.game.games.smash.TeamSuperSmash;
|
||||
import nautilus.game.arcade.game.games.snake.Snake;
|
||||
import nautilus.game.arcade.game.games.sneakyassassins.SneakyAssassins;
|
||||
import nautilus.game.arcade.game.games.snowfight.SnowFight;
|
||||
@ -49,8 +50,8 @@ import nautilus.game.arcade.game.games.spleef.Spleef;
|
||||
import nautilus.game.arcade.game.games.spleef.SpleefTeams;
|
||||
import nautilus.game.arcade.game.games.squidshooter.SquidShooter;
|
||||
import nautilus.game.arcade.game.games.stacker.Stacker;
|
||||
import nautilus.game.arcade.game.games.survivalgames.SurvivalGames;
|
||||
import nautilus.game.arcade.game.games.survivalgames.SurvivalGamesTeams;
|
||||
import nautilus.game.arcade.game.games.survivalgames.SoloSurvivalGames;
|
||||
import nautilus.game.arcade.game.games.survivalgames.TeamSurvivalGames;
|
||||
import nautilus.game.arcade.game.games.tug.Tug;
|
||||
import nautilus.game.arcade.game.games.turfforts.TurfForts;
|
||||
import nautilus.game.arcade.game.games.uhc.UHC;
|
||||
@ -70,7 +71,7 @@ public enum GameType
|
||||
ChampionsDominate(ChampionsDominate.class, GameDisplay.ChampionsDominate),
|
||||
//ChampionsMOBA(ChampionsMOBA.class, "Champions MOBA", "Champions", Material.SKULL_ITEM, (byte)0, GameCategory.CHAMPIONS, 7),
|
||||
ChampionsTDM(ChampionsTDM.class, GameDisplay.ChampionsTDM),
|
||||
Christmas(Christmas.class, GameDisplay.Christmas),
|
||||
Christmas(Christmas.class, GameDisplay.Christmas, "http://chivebox.com/file/c/xmas.zip", true),
|
||||
DeathTag(DeathTag.class, GameDisplay.DeathTag),
|
||||
DragonEscape(DragonEscape.class, GameDisplay.DragonEscape),
|
||||
DragonEscapeTeams(DragonEscapeTeams.class, GameDisplay.DragonEscapeTeams),
|
||||
@ -81,7 +82,7 @@ public enum GameType
|
||||
Evolution(Evolution.class, GameDisplay.Evolution),
|
||||
//FlappyBird(FlappyBird.class, "Flappy Bird", Material.FEATHER, (byte)0, GameCategory.ARCADE, 17),
|
||||
Gravity(Gravity.class, GameDisplay.Gravity),
|
||||
Halloween(Halloween.class, GameDisplay.Halloween),
|
||||
Halloween(Halloween.class, GameDisplay.Halloween, "http://chivebox.com/file/c/hh.zip", true),
|
||||
HideSeek(HideSeek.class, GameDisplay.HideSeek),
|
||||
HoleInTheWall(HoleInTheWall.class, GameDisplay.HoleInTheWall),
|
||||
Horse(Horse.class, GameDisplay.Horse),
|
||||
@ -98,9 +99,9 @@ public enum GameType
|
||||
SearchAndDestroy(SearchAndDestroy.class, GameDisplay.SearchAndDestroy),
|
||||
Sheep(SheepGame.class, GameDisplay.Sheep),
|
||||
|
||||
Smash(SuperSmash.class, GameDisplay.Smash),
|
||||
Smash(SoloSuperSmash.class, GameDisplay.Smash),
|
||||
SmashDomination(SuperSmashDominate.class, GameDisplay.SmashDomination),
|
||||
SmashTeams(SuperSmashTeam.class, GameDisplay.SmashTeams),
|
||||
SmashTeams(TeamSuperSmash.class, GameDisplay.SmashTeams, new GameType[]{GameType.Smash}, false),
|
||||
Snake(Snake.class, GameDisplay.Snake),
|
||||
SneakyAssassins(SneakyAssassins.class, GameDisplay.SneakyAssassins),
|
||||
SnowFight(SnowFight.class, GameDisplay.SnowFight),
|
||||
@ -108,23 +109,35 @@ public enum GameType
|
||||
SpleefTeams(SpleefTeams.class, GameDisplay.SpleefTeams),
|
||||
SquidShooter(SquidShooter.class, GameDisplay.SquidShooter),
|
||||
Stacker(Stacker.class, GameDisplay.Stacker),
|
||||
SurvivalGames(SurvivalGames.class, GameDisplay.SurvivalGames),
|
||||
SurvivalGamesTeams(SurvivalGamesTeams.class, GameDisplay.SurvivalGamesTeams),
|
||||
SurvivalGames(SoloSurvivalGames.class, GameDisplay.SurvivalGames),
|
||||
SurvivalGamesTeams(TeamSurvivalGames.class, GameDisplay.SurvivalGamesTeams, new GameType[]{GameType.SurvivalGames}, false),
|
||||
Tug(Tug.class, GameDisplay.Tug),
|
||||
TurfWars(TurfForts.class, GameDisplay.TurfWars),
|
||||
UHC(UHC.class, GameDisplay.UHC),
|
||||
WitherAssault(WitherGame.class, GameDisplay.WitherAssault),
|
||||
Wizards(Wizards.class, GameDisplay.Wizards, "http://chivebox.com/file/c/ResWizards.zip", true),
|
||||
ZombieSurvival(ZombieSurvival.class, GameDisplay.ZombieSurvival),
|
||||
|
||||
Build(Build.class, GameDisplay.Build),
|
||||
Cards(Cards.class, GameDisplay.Cards),
|
||||
Skywars(Skywars.class, GameDisplay.Skywars),
|
||||
Skywars(SoloSkywars.class, GameDisplay.Skywars),
|
||||
SkywarsTeams(TeamSkywars.class, GameDisplay.SkywarsTeams, new GameType[]{GameType.Skywars}, false),
|
||||
|
||||
Event(EventGame.class, GameDisplay.Event);
|
||||
Event(EventGame.class, GameDisplay.Event, new GameType[]{
|
||||
GameType.BaconBrawl, GameType.Barbarians, GameType.Bridge, GameType.Build, GameType.Build,
|
||||
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.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,
|
||||
GameType.Stacker, GameType.SurvivalGames, GameType.SurvivalGamesTeams, GameType.Tug, GameType.TurfWars, GameType.UHC,
|
||||
GameType.WitherAssault, GameType.Wizards, GameType.ZombieSurvival}, true);
|
||||
|
||||
GameDisplay _display;
|
||||
boolean _enforceResourcePack;
|
||||
GameType[] _mapSource;
|
||||
boolean _ownMaps;
|
||||
String _resourcePack;
|
||||
Class<? extends Game> _gameClass;
|
||||
|
||||
@ -133,17 +146,29 @@ public enum GameType
|
||||
|
||||
GameType(Class<? extends Game> gameClass, GameDisplay display)
|
||||
{
|
||||
this(gameClass, display, null, false);
|
||||
this(gameClass, display, null, false, null, true);
|
||||
}
|
||||
|
||||
GameType(Class<? extends Game> gameClass, GameDisplay display, String resourcePackUrl, boolean enforceResourcePack)
|
||||
{
|
||||
this(gameClass, display, resourcePackUrl, enforceResourcePack, null, true);
|
||||
}
|
||||
|
||||
GameType(Class<? extends Game> gameClass, GameDisplay display, GameType[] mapSource, boolean ownMap)
|
||||
{
|
||||
this(gameClass, display, null, false, mapSource, ownMap);
|
||||
}
|
||||
|
||||
GameType(Class<? extends Game> gameClass, GameDisplay display, String resourcePackUrl, boolean enforceResourcePack, GameType[] mapSource, boolean ownMaps)
|
||||
{
|
||||
_display = display;
|
||||
_gameClass = gameClass;
|
||||
_resourcePack = resourcePackUrl;
|
||||
_enforceResourcePack = enforceResourcePack;
|
||||
_mapSource = mapSource;
|
||||
_ownMaps = ownMaps;
|
||||
}
|
||||
|
||||
|
||||
public Class<? extends Game> getGameClass()
|
||||
{
|
||||
return _gameClass;
|
||||
@ -158,6 +183,16 @@ public enum GameType
|
||||
{
|
||||
return _resourcePack;
|
||||
}
|
||||
|
||||
public GameType[] getMapSource()
|
||||
{
|
||||
return _mapSource;
|
||||
}
|
||||
|
||||
public boolean ownMaps()
|
||||
{
|
||||
return _ownMaps;
|
||||
}
|
||||
|
||||
public String GetName()
|
||||
{
|
||||
@ -183,4 +218,5 @@ public enum GameType
|
||||
{
|
||||
return _display.getGameCategory();
|
||||
}
|
||||
|
||||
}
|
@ -3,9 +3,8 @@ package nautilus.game.arcade.command;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import net.minecraft.util.com.mojang.authlib.GameProfile;
|
||||
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
@ -13,12 +12,13 @@ import mineplex.core.common.util.ProfileLoader;
|
||||
import mineplex.core.common.util.UUIDFetcher;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.disguise.disguises.DisguisePlayer;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
|
||||
public class DisguiseCommand extends CommandBase<ArcadeManager>
|
||||
{
|
||||
public DisguiseCommand(ArcadeManager plugin)
|
||||
{
|
||||
super(plugin, Rank.ADMIN, new Rank[] {Rank.YOUTUBE, Rank.TWITCH}, "disguise");
|
||||
super(plugin, Rank.ADMIN, new Rank[] {Rank.YOUTUBE, Rank.TWITCH, Rank.JNR_DEV}, "disguise");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,7 +25,7 @@ public class GameCommand extends MultiCommandBase<ArcadeManager>
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Commands List:"));
|
||||
UtilPlayer.message(caller, F.help("/game start", "Start the current game", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/game stop", "Stop the current game", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/game set <GameType> (Map)", "Set the current game or next game", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/game set <GameType> (MapSource) (Map)", "Set the current game or next game", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.main("Tip", "Use TAB for games/maps!"));
|
||||
}
|
||||
}
|
||||
|
@ -29,16 +29,31 @@ public class SetCommand extends CommandBase<ArcadeManager>
|
||||
|
||||
if (args == null || args.length == 0)
|
||||
{
|
||||
caller.sendMessage(F.help("/game set <GameType> (Map)", "Set the current game or next game", Rank.ADMIN));
|
||||
caller.sendMessage(F.help("/game set <GameType> (MapSource) (Map)", "Set the current game or next game", Rank.ADMIN));
|
||||
return;
|
||||
}
|
||||
|
||||
String game = args[0].toLowerCase();
|
||||
|
||||
if (args.length > 1)
|
||||
if (args.length >= 2)
|
||||
{
|
||||
Plugin.GetGameCreationManager().MapPref = args[1];
|
||||
UtilPlayer.message(caller, C.cAqua + C.Bold + "Map Preference: " + ChatColor.RESET + args[1]);
|
||||
String map = "";
|
||||
String source = "";
|
||||
if(args.length == 3)
|
||||
{
|
||||
Plugin.GetGameCreationManager().MapSource = args[1];
|
||||
Plugin.GetGameCreationManager().MapPref = args[2];
|
||||
source = args[1];
|
||||
map = args[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
Plugin.GetGameCreationManager().MapSource = args[0];
|
||||
Plugin.GetGameCreationManager().MapPref = args[1];
|
||||
source = args[0];
|
||||
map = args[1];
|
||||
}
|
||||
UtilPlayer.message(caller, C.cAqua + C.Bold + "Map Preference: " + ChatColor.RESET + source + ":" + map);
|
||||
}
|
||||
|
||||
//Parse Game
|
||||
|
@ -11,7 +11,7 @@ public class WriteCommand extends CommandBase<ArcadeManager>
|
||||
{
|
||||
public WriteCommand(ArcadeManager plugin)
|
||||
{
|
||||
super(plugin, Rank.ADMIN, "write");
|
||||
super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV}, "write");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -86,7 +86,7 @@ public abstract class Game implements Listener
|
||||
protected String[] _gameDesc;
|
||||
|
||||
//Map
|
||||
private ArrayList<String> _files;
|
||||
private HashMap<GameType, ArrayList<String>> _files;
|
||||
|
||||
//State
|
||||
private GameState _gameState = GameState.Loading;
|
||||
@ -193,8 +193,6 @@ public abstract class Game implements Listener
|
||||
public int HungerSet = -1;
|
||||
public int HealthSet = -1;
|
||||
|
||||
public int SpawnDistanceRequirement = 1;
|
||||
|
||||
public boolean PrepareFreeze = true;
|
||||
|
||||
private double _itemMergeRadius = 0;
|
||||
@ -211,6 +209,11 @@ public abstract class Game implements Listener
|
||||
|
||||
public int TickPerTeleport = 1;
|
||||
|
||||
public int FillTeamsInOrderToCount = -1;
|
||||
|
||||
public boolean SpawnNearAllies = false;
|
||||
public boolean SpawnNearEnemies = false;
|
||||
|
||||
public boolean StrictAntiHack = false;
|
||||
|
||||
public boolean DisableKillCommand = true;
|
||||
@ -258,6 +261,9 @@ public abstract class Game implements Listener
|
||||
public boolean CanAddStats = true;
|
||||
public boolean CanGiveLoot = true;
|
||||
|
||||
public boolean HideTeamSheep = false;
|
||||
public boolean ReplaceTeamsWithKits = false;
|
||||
|
||||
public boolean VersionRequire1_8 = false;
|
||||
|
||||
public ArrayList<String> GemBoosters = new ArrayList<String>();
|
||||
@ -281,16 +287,28 @@ public abstract class Game implements Listener
|
||||
Scoreboard = new GameScoreboard(this);
|
||||
|
||||
//Map Select
|
||||
_files = Manager.LoadFiles(GetName());
|
||||
_files = new HashMap<GameType, ArrayList<String>>();
|
||||
for(GameType type : GetWorldHostNames())
|
||||
{
|
||||
_files.put(type, Manager.LoadFiles(type.GetName()));
|
||||
}
|
||||
if (Manager.GetGameCreationManager().MapPref != null)
|
||||
{
|
||||
ArrayList<String> matches = new ArrayList<String>();
|
||||
for (String cur : _files)
|
||||
HashMap<GameType, ArrayList<String>> matches = new HashMap<GameType, ArrayList<String>>();
|
||||
for (GameType game : _files.keySet())
|
||||
{
|
||||
if (cur.toLowerCase().contains(Manager.GetGameCreationManager().MapPref.toLowerCase()))
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
for(String cur : _files.get(game))
|
||||
{
|
||||
matches.add(cur);
|
||||
System.out.print("Map Preference: " + cur);
|
||||
if (cur.toLowerCase().contains(Manager.GetGameCreationManager().MapPref.toLowerCase()))
|
||||
{
|
||||
if(game.toString().toLowerCase().contains(Manager.GetGameCreationManager().MapSource.toLowerCase()))
|
||||
{
|
||||
list.add(cur);
|
||||
System.out.print("Map Preference: " + cur);
|
||||
matches.put(game, list);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -298,6 +316,7 @@ public abstract class Game implements Listener
|
||||
_files = matches;
|
||||
|
||||
Manager.GetGameCreationManager().MapPref = null;
|
||||
Manager.GetGameCreationManager().MapSource = null;
|
||||
}
|
||||
WorldData = new WorldData(this);
|
||||
|
||||
@ -332,7 +351,7 @@ public abstract class Game implements Listener
|
||||
_kits = kits;
|
||||
}
|
||||
|
||||
public ArrayList<String> GetFiles()
|
||||
public HashMap<GameType, ArrayList<String>> GetFiles()
|
||||
{
|
||||
return _files;
|
||||
}
|
||||
@ -341,6 +360,60 @@ public abstract class Game implements Listener
|
||||
{
|
||||
return _gameType.GetName();
|
||||
}
|
||||
|
||||
public GameType[] GetWorldHostNames()
|
||||
{
|
||||
GameType[] mapSource = new GameType[]{GetType()};
|
||||
if(GetType().getMapSource() != null)
|
||||
{
|
||||
if(GetType().ownMaps())
|
||||
{
|
||||
int i = 1;
|
||||
mapSource = new GameType[GetType().getMapSource().length + 1];
|
||||
for(GameType type : GetType().getMapSource())
|
||||
{
|
||||
mapSource[i] = type;
|
||||
i++;
|
||||
}
|
||||
mapSource[0] = GetType();
|
||||
}
|
||||
else
|
||||
{
|
||||
mapSource = GetType().getMapSource();
|
||||
}
|
||||
}
|
||||
return mapSource;
|
||||
}
|
||||
|
||||
public String GetGameNamebyMap(String game, String map)
|
||||
{
|
||||
for(GameType type : _files.keySet())
|
||||
{
|
||||
if(type.GetName().toLowerCase().contains(game.toLowerCase()))
|
||||
{
|
||||
for(String string : _files.get(type))
|
||||
{
|
||||
if(string.toLowerCase().contains(map.toLowerCase()))
|
||||
{
|
||||
return type.GetName();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public GameType GetGameByMapList(ArrayList<String> maps)
|
||||
{
|
||||
for(GameType game : _files.keySet())
|
||||
{
|
||||
if(maps.equals(_files.get(game)))
|
||||
{
|
||||
return game;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String GetMode()
|
||||
{
|
||||
@ -465,9 +538,6 @@ public abstract class Game implements Listener
|
||||
//Add
|
||||
GetTeamList().add(team);
|
||||
|
||||
//Set Spawn Data
|
||||
team.SetSpawnRequirement(this.SpawnDistanceRequirement);
|
||||
|
||||
System.out.println("Created Team: " + team.GetName());
|
||||
}
|
||||
|
||||
@ -549,6 +619,17 @@ public abstract class Game implements Listener
|
||||
|
||||
public GameTeam ChooseTeam(Player player)
|
||||
{
|
||||
if (FillTeamsInOrderToCount != -1)
|
||||
{
|
||||
for (int i = 0; i < _teamList.size(); i++)
|
||||
{
|
||||
if (_teamList.get(i).GetSize() < FillTeamsInOrderToCount)
|
||||
{
|
||||
return _teamList.get(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GameTeam team = null;
|
||||
|
||||
//Random Team
|
||||
@ -1365,4 +1446,5 @@ public abstract class Game implements Listener
|
||||
//End
|
||||
SetState(GameState.End);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -36,6 +36,8 @@ public class GameServerConfig
|
||||
public boolean PlayerKickIdle = true;
|
||||
|
||||
public boolean PublicServer = true;
|
||||
|
||||
public boolean PlayerServerWhitelist = false;
|
||||
|
||||
public boolean IsValid()
|
||||
{
|
||||
|
@ -5,8 +5,10 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
import mineplex.core.account.CoreClient;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
@ -60,19 +62,19 @@ public class GameTeam
|
||||
private HashMap<Player, PlayerState> _players = new HashMap<Player, PlayerState>();
|
||||
|
||||
private ArrayList<Location> _spawns;
|
||||
|
||||
|
||||
private Creature _teamEntity = null;
|
||||
|
||||
private HashSet<Kit> _kitRestrict = new HashSet<Kit>();
|
||||
|
||||
private int _spawnDistance = 0;
|
||||
|
||||
private boolean _visible = true;
|
||||
|
||||
private boolean _displayTag;
|
||||
|
||||
//Records order players go out in
|
||||
protected ArrayList<Player> _places = new ArrayList<Player>();
|
||||
|
||||
public GameTeam(Game host, String name, ChatColor color, ArrayList<Location> spawns)
|
||||
public GameTeam(Game host, String name, ChatColor color, ArrayList<Location> spawns, boolean tags)
|
||||
{
|
||||
Host = host;
|
||||
|
||||
@ -80,6 +82,12 @@ public class GameTeam
|
||||
_name = name;
|
||||
_color = color;
|
||||
_spawns = spawns;
|
||||
_displayTag = tags;
|
||||
}
|
||||
|
||||
public GameTeam(Game host, String name, ChatColor color, ArrayList<Location> spawns)
|
||||
{
|
||||
this(host, name, color, spawns, false);
|
||||
}
|
||||
|
||||
public String GetName()
|
||||
@ -99,40 +107,48 @@ public class GameTeam
|
||||
|
||||
public Location GetSpawn()
|
||||
{
|
||||
// ArrayList<Location> valid = new ArrayList<Location>();
|
||||
|
||||
Location best = null;
|
||||
double bestDist = 0;
|
||||
|
||||
for (Location loc : _spawns)
|
||||
//Keep allies together
|
||||
if (!Host.IsLive() && Host.SpawnNearAllies)
|
||||
{
|
||||
double closestPlayer = -1;
|
||||
|
||||
for (Player player : Host.GetPlayers(true))
|
||||
//Find Location Nearest Ally
|
||||
Location loc = UtilAlg.getLocationNearPlayers(_spawns, GetPlayers(true), Host.GetPlayers(true));
|
||||
if (loc != null)
|
||||
return loc;
|
||||
|
||||
//No allies existed spawned yet
|
||||
|
||||
//Spawn near enemies (used for SG)
|
||||
if (Host.SpawnNearEnemies)
|
||||
{
|
||||
double playerDist = UtilMath.offsetSquared(player.getLocation(), loc);
|
||||
|
||||
if (closestPlayer == -1 || playerDist < closestPlayer)
|
||||
closestPlayer = playerDist;
|
||||
loc = UtilAlg.getLocationNearPlayers(_spawns, Host.GetPlayers(true), Host.GetPlayers(true));
|
||||
if (loc != null)
|
||||
return loc;
|
||||
}
|
||||
|
||||
if (best == null || closestPlayer > bestDist)
|
||||
//Spawn away from enemies
|
||||
else
|
||||
{
|
||||
best = loc;
|
||||
bestDist = closestPlayer;
|
||||
}
|
||||
|
||||
// if (closestPlayer > _spawnDistance * _spawnDistance)
|
||||
// {
|
||||
// valid.add(loc);
|
||||
// }
|
||||
loc = UtilAlg.getLocationAwayFromPlayers(_spawns, Host.GetPlayers(true));
|
||||
if (loc != null)
|
||||
return loc;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Spawn near players
|
||||
if (Host.SpawnNearEnemies)
|
||||
{
|
||||
Location loc = UtilAlg.getLocationNearPlayers(_spawns, Host.GetPlayers(true), Host.GetPlayers(true));
|
||||
if (loc != null)
|
||||
return loc;
|
||||
}
|
||||
//Spawn away from players
|
||||
else
|
||||
{
|
||||
Location loc = UtilAlg.getLocationAwayFromPlayers(_spawns, Host.GetPlayers(true));
|
||||
if (loc != null)
|
||||
return loc;
|
||||
}
|
||||
}
|
||||
|
||||
// if (valid.size() > 0)
|
||||
// valid.get(UtilMath.r(valid.size()));
|
||||
|
||||
if (best != null)
|
||||
return best;
|
||||
|
||||
return _spawns.get(UtilMath.r(_spawns.size()));
|
||||
}
|
||||
@ -149,7 +165,14 @@ public class GameTeam
|
||||
public void DisbandTeam()
|
||||
{
|
||||
for (Player player : _players.keySet())
|
||||
{
|
||||
for(Player other : UtilServer.getPlayers())
|
||||
{
|
||||
other.getScoreboard().getTeam(Host.Manager.GetClients().Get(player).GetRank().Name + _name.toUpperCase()).removePlayer(player);
|
||||
other.getScoreboard().getTeam(Host.Manager.GetClients().Get(player).GetRank().Name).addPlayer(player);
|
||||
}
|
||||
UtilPlayer.message(player, F.main("Team", _color + C.Bold + _displayName + " Team was disbanded."));
|
||||
}
|
||||
|
||||
_players.clear();
|
||||
}
|
||||
@ -333,11 +356,6 @@ public class GameTeam
|
||||
_spawns = spawns;
|
||||
}
|
||||
|
||||
public void SetSpawnRequirement(int value)
|
||||
{
|
||||
_spawnDistance = value;
|
||||
}
|
||||
|
||||
public void SetVisible(boolean b)
|
||||
{
|
||||
_visible = b;
|
||||
@ -347,6 +365,16 @@ public class GameTeam
|
||||
{
|
||||
return _visible;
|
||||
}
|
||||
|
||||
public void setDisplayTag(boolean b)
|
||||
{
|
||||
_displayTag = b;
|
||||
}
|
||||
|
||||
public boolean GetDisplaytag()
|
||||
{
|
||||
return _displayTag;
|
||||
}
|
||||
|
||||
public void SetRespawnTime(double i)
|
||||
{
|
||||
@ -390,6 +418,4 @@ public class GameTeam
|
||||
|
||||
return _places;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -74,8 +74,6 @@ public class Evolution extends SoloGame
|
||||
this.DeathOut = false;
|
||||
|
||||
this.PrepareFreeze = false;
|
||||
|
||||
this.SpawnDistanceRequirement = 16;
|
||||
|
||||
_scoreObj = Scoreboard.GetScoreboard().registerNewObjective("Evolutions", "dummy");
|
||||
_scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME);
|
||||
|
@ -33,12 +33,12 @@ import nautilus.game.arcade.game.TeamGame;
|
||||
import nautilus.game.arcade.game.games.lobbers.events.TNTPreExplodeEvent;
|
||||
import nautilus.game.arcade.game.games.lobbers.events.TNTThrowEvent;
|
||||
import nautilus.game.arcade.game.games.lobbers.kits.KitArmorer;
|
||||
import nautilus.game.arcade.game.games.lobbers.kits.KitPitcher;
|
||||
import nautilus.game.arcade.game.games.lobbers.kits.KitJumper;
|
||||
import nautilus.game.arcade.game.games.lobbers.kits.KitPitcher;
|
||||
import nautilus.game.arcade.game.games.lobbers.kits.KitWaller;
|
||||
import nautilus.game.arcade.game.games.lobbers.trackers.Tracker6Kill;
|
||||
import nautilus.game.arcade.game.games.lobbers.trackers.TrackerBestTeam;
|
||||
import nautilus.game.arcade.game.games.lobbers.trackers.TrackerBlastProof;
|
||||
import nautilus.game.arcade.game.games.lobbers.trackers.TrackerDirectHit;
|
||||
import nautilus.game.arcade.game.games.lobbers.trackers.TrackerNoDamage;
|
||||
import nautilus.game.arcade.game.games.lobbers.trackers.TrackerTNTThrown;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
@ -79,7 +79,6 @@ public class BombLobbers extends TeamGame implements IThrown
|
||||
new KitJumper(manager),
|
||||
new KitArmorer(manager),
|
||||
new KitPitcher(manager),
|
||||
// new KitMortar(manager), << Spare time kit for Bobbeh
|
||||
new KitWaller(manager)
|
||||
}, new String[]
|
||||
{
|
||||
@ -109,7 +108,21 @@ public class BombLobbers extends TeamGame implements IThrown
|
||||
|
||||
HungerSet = 20;
|
||||
|
||||
registerStatTrackers(new Tracker6Kill(this), new TrackerBestTeam(this), new TrackerBlastProof(this), new TrackerNoDamage(this), new TrackerTNTThrown(this));
|
||||
WorldTimeSet = 6000;
|
||||
|
||||
registerStatTrackers(new Tracker6Kill(this), new TrackerBlastProof(this), new TrackerNoDamage(this), new TrackerTNTThrown(this), new TrackerDirectHit(this));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void setTime(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Prepare)
|
||||
return;
|
||||
|
||||
if (WorldData.MapName.equalsIgnoreCase("Intergalactic"))
|
||||
{
|
||||
WorldTimeSet = 18000;
|
||||
}
|
||||
}
|
||||
|
||||
public void addKill(Player player)
|
||||
@ -295,6 +308,8 @@ public class BombLobbers extends TeamGame implements IThrown
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
NautHashMap<TNTPrimed, BombToken> toAdd = new NautHashMap<TNTPrimed, BombToken>();
|
||||
|
||||
Iterator<Entry<TNTPrimed, BombToken>> iterator = _tnt.entrySet().iterator();
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
@ -330,10 +345,16 @@ public class BombLobbers extends TeamGame implements IThrown
|
||||
tnt.getKey().remove();
|
||||
|
||||
iterator.remove();
|
||||
_tnt.put(newTNT, token);
|
||||
toAdd.put(newTNT, token);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Prevent concurrent modification thigns
|
||||
for (Entry<TNTPrimed, BombToken> entry : toAdd.entrySet())
|
||||
{
|
||||
_tnt.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -443,15 +464,15 @@ public class BombLobbers extends TeamGame implements IThrown
|
||||
|
||||
if (team.GetColor() == ChatColor.AQUA)
|
||||
{
|
||||
for (int i = 0 ; i < 5 ; i++)
|
||||
for (int i = 0 ; i < 2 ; i++)
|
||||
UtilParticle.PlayParticle(ParticleType.RED_DUST, newTarget.clone().add(0.0, 0.5, 0.0), -1, 1, 1, 1, 0,
|
||||
ViewDist.LONG, UtilServer.getPlayers());
|
||||
ViewDist.NORMAL, UtilServer.getPlayers());
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0 ; i < 5 ; i++)
|
||||
for (int i = 0 ; i < 2 ; i++)
|
||||
UtilParticle.PlayParticle(ParticleType.RED_DUST, newTarget.clone().add(0.0, 0.5, 0.0), 0, 0, 0, 0, 1,
|
||||
ViewDist.LONG, UtilServer.getPlayers());
|
||||
ViewDist.NORMAL, UtilServer.getPlayers());
|
||||
}
|
||||
|
||||
//UtilParticle.PlayParticle(ParticleType.RED_DUST, newTarget.clone().add(0.0, 0.6, 0.0), team.GetColorBase().getRed(), team.GetColorBase().getGreen(), team.GetColorBase().getBlue(), 1, 0, ViewDist.LONG, UtilServer.getPlayers());
|
||||
@ -540,7 +561,7 @@ public class BombLobbers extends TeamGame implements IThrown
|
||||
if (target != null)
|
||||
UtilAction.velocity(target, UtilAlg.getTrajectory2d(data.GetThrown().getLocation(), target.getLocation()), .2, false, 0, 0.2, .4, true);
|
||||
|
||||
Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, DamageCause.PROJECTILE, 6.0, false, false, true, "Throwing TNT", "Throwing TNT Direct Hit");
|
||||
Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, DamageCause.PROJECTILE, 10.0, false, false, false, "Throwing TNT", "Throwing TNT Direct Hit");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -560,6 +581,6 @@ public class BombLobbers extends TeamGame implements IThrown
|
||||
if (event.GetCause() != DamageCause.ENTITY_EXPLOSION && event.GetCause() != DamageCause.BLOCK_EXPLOSION)
|
||||
return;
|
||||
|
||||
event.AddKnockback("Explosion", 1.5D);
|
||||
event.AddKnockback("Explosion", 1.7D);
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import nautilus.game.arcade.game.games.lobbers.kits.perks.PerkCraftman;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.PerkDummy;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
@ -22,15 +23,18 @@ public class KitArmorer extends Kit
|
||||
{
|
||||
super(manager, "Armorer", KitAvailability.Gem, 2000, new String[]
|
||||
{
|
||||
"He uses his expert armor-making",
|
||||
"skills to block excess damage!",
|
||||
"",
|
||||
C.cGray + "Recieve " + C.cYellow + "Full Gold Armor"
|
||||
C.cGray + "He uses his expert armor-making",
|
||||
C.cGray + "skills to block excess damage!"
|
||||
}, new Perk[]
|
||||
{
|
||||
new PerkDummy("Armorer",
|
||||
new String[]
|
||||
{
|
||||
C.cGray + "Recieve " + C.cYellow + "Full Gold Armor"
|
||||
}),
|
||||
new PerkCraftman()
|
||||
}, EntityType.ZOMBIE,
|
||||
new ItemStack(Material.AIR));
|
||||
new ItemBuilder(Material.GOLD_HELMET).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -50,16 +54,15 @@ public class KitArmorer extends Kit
|
||||
|
||||
UtilInv.Update(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void SpawnCustom(LivingEntity ent)
|
||||
{
|
||||
ent.getEquipment().setHelmet(new ItemBuilder(Material.GOLD_HELMET).build());
|
||||
ent.getEquipment().setChestplate(new ItemBuilder(Material.GOLD_CHESTPLATE).build());
|
||||
ent.getEquipment().setLeggings(new ItemBuilder(Material.GOLD_LEGGINGS).build());
|
||||
ent.getEquipment().setBoots(new ItemBuilder(Material.GOLD_BOOTS).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void SpawnCustom(LivingEntity entity)
|
||||
{
|
||||
entity.getEquipment().setChestplate(new ItemStack(Material.GOLD_CHESTPLATE));
|
||||
entity.getEquipment().setLeggings(new ItemStack(Material.GOLD_LEGGINGS));
|
||||
entity.getEquipment().setBoots(new ItemStack(Material.GOLD_BOOTS));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
|
@ -1,5 +1,6 @@
|
||||
package nautilus.game.arcade.game.games.lobbers.kits;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
@ -8,6 +9,7 @@ import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
|
||||
import nautilus.game.arcade.kit.perks.PerkDummy;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
@ -22,11 +24,15 @@ public class KitJumper extends Kit
|
||||
{
|
||||
super(manager, "Jumper", KitAvailability.Free, 0, new String[]
|
||||
{
|
||||
"Use your jumping abilities to leap away from trouble!",
|
||||
"You take no fall damage."
|
||||
C.cGray + "Use your jumping abilities to leap away from trouble!"
|
||||
}, new Perk[]
|
||||
{
|
||||
new PerkDoubleJump("Double Jump", 1.2, 1.2, false, 6000, true),
|
||||
new PerkDummy("Feathered Boots",
|
||||
new String[]
|
||||
{
|
||||
C.cGray + "You take no fall damage."
|
||||
}),
|
||||
new PerkCraftman()
|
||||
}, EntityType.ZOMBIE, new ItemBuilder(Material.IRON_AXE).build());
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import nautilus.game.arcade.game.games.lobbers.kits.perks.PerkCraftman;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.PerkDummy;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
@ -27,14 +28,16 @@ public class KitPitcher extends Kit
|
||||
{
|
||||
super(manager, "Pitcher", KitAvailability.Gem, 4000, new String[]
|
||||
{
|
||||
"He can easily pitch the perfect shot for any occasion.",
|
||||
"",
|
||||
C.cYellow + "Left Click" + C.cGray + " lever to " + C.cGreen + "Decrease Velocity",
|
||||
C.cYellow + "Right Click" + C.cGray + " lever to " + C.cGreen + "Increase Velocity",
|
||||
"Maximum Velocity of " + C.cYellow + "3.",
|
||||
"Minimum Velocity of " + C.cYellow + "1.",
|
||||
C.cGray + "He can easily pitch the perfect",
|
||||
C.cGray + "shot for any occasion."
|
||||
}, new Perk[]
|
||||
{
|
||||
new PerkDummy("Pitcher",
|
||||
new String[]
|
||||
{
|
||||
C.cYellow + "Left Click" + C.cGray + " lever to " + C.cGreen + "Decrease Velocity. " + C.cGray + "Minimum of 1.",
|
||||
C.cYellow + "Right Click" + C.cGray + " lever to " + C.cGreen + "Increase Velocity. " + C.cGray + "Maximum of 3.",
|
||||
}),
|
||||
new PerkCraftman()
|
||||
}, EntityType.ZOMBIE,
|
||||
new ItemBuilder(Material.LEVER).build());
|
||||
@ -43,7 +46,7 @@ public class KitPitcher extends Kit
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
player.getInventory().setItem(1, new ItemBuilder(Material.LEVER).setTitle(F.item("Velocity Selector")).setAmount(3).build());
|
||||
player.getInventory().setItem(1, new ItemBuilder(Material.LEVER).setTitle(F.item("Velocity Selector")).setAmount(2).build());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -112,11 +115,11 @@ public class KitPitcher extends Kit
|
||||
private double getVelocity(int amount)
|
||||
{
|
||||
if (amount == 1)
|
||||
return 1.5;
|
||||
|
||||
if (amount == 2)
|
||||
return 1.75;
|
||||
|
||||
if (amount == 3)
|
||||
return 2.25;
|
||||
|
||||
return 2.0;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package nautilus.game.arcade.game.games.lobbers.kits;
|
||||
|
||||
import mineplex.core.achievement.Achievement;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
@ -27,6 +28,16 @@ public class KitWaller extends Kit
|
||||
new PerkCraftman()
|
||||
}, EntityType.ZOMBIE,
|
||||
new ItemBuilder(Material.SMOOTH_BRICK).setUnbreakable(true).build());
|
||||
|
||||
this.setAchievementRequirements(new Achievement[]
|
||||
{
|
||||
Achievement.BOMB_LOBBERS_WINS,
|
||||
Achievement.BOMB_LOBBERS_ULTIMATE_KILLER,
|
||||
Achievement.BOMB_LOBBERS_SNIPER,
|
||||
Achievement.BOMB_LOBBERS_PROFESSIONAL_LOBBER,
|
||||
Achievement.BOMB_LOBBERS_EXPLOSION_PROOF,
|
||||
Achievement.BOMB_LOBBERS_BLAST_PROOF
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -36,3 +47,4 @@ public class KitWaller extends Kit
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -4,19 +4,15 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.games.lobbers.events.TNTThrowEvent;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
@ -12,7 +12,6 @@ import org.bukkit.event.EventHandler;
|
||||
|
||||
public class Tracker6Kill extends StatTracker<Game>
|
||||
{
|
||||
|
||||
public Tracker6Kill(Game game)
|
||||
{
|
||||
super(game);
|
||||
|
@ -1,51 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.lobbers.trackers;
|
||||
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.stats.StatTracker;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
public class TrackerBestTeam extends StatTracker<Game>
|
||||
{
|
||||
private NautHashMap<GameTeam, Integer> _teams = new NautHashMap<GameTeam, Integer>();
|
||||
|
||||
public TrackerBestTeam(Game game)
|
||||
{
|
||||
super(game);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onGameStart(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Prepare)
|
||||
return;
|
||||
|
||||
for (GameTeam team : getGame().GetTeamList())
|
||||
{
|
||||
_teams.put(team, team.GetPlayers(true).size());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onGameEnd(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.End)
|
||||
return;
|
||||
|
||||
for (GameTeam team : getGame().GetTeamList())
|
||||
{
|
||||
if (_teams.get(team) == team.GetPlayers(true).size())
|
||||
{
|
||||
for (Player player : team.GetPlayers(true))
|
||||
{
|
||||
addStat(player, "BestTeam", 1, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package nautilus.game.arcade.game.games.lobbers.trackers;
|
||||
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.stats.StatTracker;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
public class TrackerDirectHit extends StatTracker<Game>
|
||||
{
|
||||
public TrackerDirectHit(Game game)
|
||||
{
|
||||
super(game);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onKillDirectHit(CustomDamageEvent event)
|
||||
{
|
||||
if (!getGame().IsLive())
|
||||
return;
|
||||
|
||||
if (event.GetDamagerPlayer(true) == null)
|
||||
return;
|
||||
|
||||
Player damager = event.GetDamagerPlayer(true);
|
||||
|
||||
if (!getGame().IsAlive(damager))
|
||||
return;
|
||||
|
||||
if (event.GetReason() == null)
|
||||
return;
|
||||
|
||||
if (event.GetReason().toLowerCase().contains("direct hit"))
|
||||
addStat(damager, "Direct Hit", 1, false, false);
|
||||
}
|
||||
}
|
@ -3,7 +3,6 @@ package nautilus.game.arcade.game.games.lobbers.trackers;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
@ -16,36 +15,25 @@ import org.bukkit.event.EventPriority;
|
||||
|
||||
public class TrackerNoDamage extends StatTracker<Game>
|
||||
{
|
||||
private Set<String> _noDamage = new HashSet<String>();
|
||||
private Set<String> _damaged = new HashSet<String>();
|
||||
|
||||
public TrackerNoDamage(Game game)
|
||||
{
|
||||
super(game);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onGameStart(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Prepare)
|
||||
return;
|
||||
|
||||
for (Player player : getGame().GetPlayers(true))
|
||||
{
|
||||
_noDamage.add(player.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onGameEnd(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.End)
|
||||
return;
|
||||
|
||||
for (String name : _noDamage)
|
||||
if (event.GetGame().getWinners() == null)
|
||||
return;
|
||||
|
||||
for (Player player : event.GetGame().getWinners())
|
||||
{
|
||||
Player player = UtilPlayer.searchExact(name);
|
||||
|
||||
if (player == null || !player.isOnline())
|
||||
if (_damaged.contains(player.getName()))
|
||||
continue;
|
||||
|
||||
addStat(player, "JellySkin", 1, true, false);
|
||||
@ -61,9 +49,7 @@ public class TrackerNoDamage extends StatTracker<Game>
|
||||
if (event.GetDamageePlayer() == null || !event.GetDamageePlayer().isOnline())
|
||||
return;
|
||||
|
||||
if (_noDamage.contains(event.GetDamageePlayer().getName()))
|
||||
{
|
||||
_noDamage.remove(event.GetDamageePlayer().getName());
|
||||
}
|
||||
if (!_damaged.contains(event.GetDamageePlayer().getName()))
|
||||
_damaged.add(event.GetDamageePlayer().getName());
|
||||
}
|
||||
}
|
||||
}
|
@ -22,5 +22,4 @@ public class TrackerTNTThrown extends StatTracker<Game>
|
||||
|
||||
addStat(event.getPlayer(), "Thrown", 1, false, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1927,14 +1927,7 @@ public class MineStrike extends TeamGame
|
||||
{
|
||||
player.playSound(player.getLocation(), Sound.LEVEL_UP, 1f, 1f);
|
||||
|
||||
//Clear reloading things
|
||||
for (String recharge : Recharge.Instance.Get(player).keySet())
|
||||
{
|
||||
if (!recharge.toLowerCase().contains("reload"))
|
||||
continue;
|
||||
|
||||
Recharge.Instance.recharge(player, recharge);
|
||||
}
|
||||
Recharge.Instance.Reset(player, "reload");
|
||||
}
|
||||
|
||||
UtilTextMiddle.display(null, winnerLine, 20, 120, 20);
|
||||
|
@ -202,7 +202,7 @@ public class Gun extends StrikeItem
|
||||
else if (player.isSneaking() && _gunStats.getGunType() != GunType.SNIPER)
|
||||
cone = cone * 0.8;
|
||||
|
||||
System.out.println("Vision: " + player.hasPotionEffect(PotionEffectType.NIGHT_VISION));
|
||||
//System.out.println("Vision: " + player.hasPotionEffect(PotionEffectType.NIGHT_VISION));
|
||||
|
||||
//Sniper Zoomed
|
||||
if (!player.hasPotionEffect(PotionEffectType.NIGHT_VISION) && _gunStats.getScope() && UtilGear.isMat(player.getInventory().getHelmet(), Material.PUMPKIN))
|
||||
@ -223,7 +223,7 @@ public class Gun extends StrikeItem
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("Cone: " + cone);
|
||||
//System.out.println("Cone: " + cone);
|
||||
|
||||
return cone;
|
||||
}
|
||||
|
@ -72,7 +72,6 @@ public class Quiver extends SoloGame
|
||||
this.DamageSelf = false;
|
||||
this.DamageTeamSelf = true;
|
||||
this.PrepareFreeze = false;
|
||||
this.SpawnDistanceRequirement = 16;
|
||||
this.BlockBreakAllow.add(102);
|
||||
this.BlockBreakAllow.add(20);
|
||||
|
||||
|
@ -59,7 +59,6 @@ public class QuiverTeams extends TeamGame
|
||||
this.DamageSelf = false;
|
||||
this.DamageTeamSelf = false;
|
||||
this.PrepareFreeze = false;
|
||||
this.SpawnDistanceRequirement = 24;
|
||||
this.BlockBreakAllow.add(102);
|
||||
this.BlockBreakAllow.add(20);
|
||||
this.BlockBreakAllow.add(18);
|
||||
|
@ -6,6 +6,7 @@ import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.MapUtil;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
@ -24,6 +25,7 @@ import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
import mineplex.core.explosion.ExplosionEvent;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.loot.ChestLoot;
|
||||
import mineplex.core.loot.RandomItem;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
@ -41,8 +43,8 @@ import nautilus.game.arcade.game.games.skywars.data.TNTGenerator;
|
||||
import nautilus.game.arcade.game.games.skywars.events.PlayerKillZombieEvent;
|
||||
import nautilus.game.arcade.game.games.skywars.kits.KitChicken;
|
||||
import nautilus.game.arcade.game.games.skywars.kits.KitDestructor;
|
||||
import nautilus.game.arcade.game.games.skywars.kits.KitMadScientist;
|
||||
import nautilus.game.arcade.game.games.skywars.kits.KitMiner;
|
||||
import nautilus.game.arcade.game.games.skywars.kits.KitMadScientist;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.ore.OreHider;
|
||||
import nautilus.game.arcade.stats.DeathBomberStatTracker;
|
||||
@ -65,6 +67,7 @@ import org.bukkit.entity.Chicken;
|
||||
import org.bukkit.entity.Egg;
|
||||
import org.bukkit.entity.EnderPearl;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
@ -80,11 +83,13 @@ import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.block.BlockSpreadEvent;
|
||||
import org.bukkit.event.block.LeavesDecayEvent;
|
||||
import org.bukkit.event.entity.EntityCombustEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.EntityTargetLivingEntityEvent;
|
||||
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||
import org.bukkit.event.entity.ItemDespawnEvent;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
@ -92,7 +97,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class Skywars extends SoloGame
|
||||
public abstract class Skywars extends Game
|
||||
{
|
||||
//./parse 19 30 56
|
||||
|
||||
@ -128,23 +133,20 @@ public class Skywars extends SoloGame
|
||||
private ChestLoot _middleBlock = new ChestLoot();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Skywars(ArcadeManager manager)
|
||||
public Skywars(ArcadeManager manager, GameType type, String[] description)
|
||||
{
|
||||
super(manager, GameType.Skywars, new Kit[]
|
||||
super(manager, type, new Kit[]
|
||||
{
|
||||
new KitChicken(manager),
|
||||
new KitMiner(manager),
|
||||
new KitMadScientist(manager),
|
||||
new KitDestructor(manager),
|
||||
|
||||
}, new String[]
|
||||
{
|
||||
"Free for all battle in the sky!",
|
||||
"Craft or loot gear for combat",
|
||||
"Last player alive wins!"
|
||||
});
|
||||
}, description);
|
||||
|
||||
PrepareFreeze = true;
|
||||
|
||||
HideTeamSheep = true;
|
||||
|
||||
CompassEnabled = true;
|
||||
|
||||
@ -159,8 +161,6 @@ public class Skywars extends SoloGame
|
||||
WorldTimeSet = 0;
|
||||
WorldBoundaryKill = false;
|
||||
|
||||
SpawnDistanceRequirement = 48;
|
||||
|
||||
DamageSelf = true;
|
||||
DamageTeamSelf = true;
|
||||
DamageEvP = true;
|
||||
@ -962,6 +962,9 @@ public class Skywars extends SoloGame
|
||||
if (event.GetDamage() >= 1)
|
||||
return;
|
||||
|
||||
if(GetTeam(event.GetDamagerPlayer(true)) == GetTeam(event.GetDamageePlayer()))
|
||||
return;
|
||||
|
||||
if (event.GetProjectile() instanceof Egg || event.GetProjectile() instanceof Snowball)
|
||||
{
|
||||
event.SetCancelled("Egg/Snowball");
|
||||
@ -982,6 +985,25 @@ public class Skywars extends SoloGame
|
||||
event.GetDamageeEntity().setVelocity(vel);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void projectile(EntityDamageByEntityEvent event)
|
||||
{
|
||||
if(event.getDamager() instanceof Snowball || event.getDamager() instanceof Egg || event.getDamager() instanceof EnderPearl)
|
||||
{
|
||||
Projectile prj = (Projectile) event.getDamager();
|
||||
if(prj.getShooter() instanceof Player)
|
||||
{
|
||||
if(event.getEntity() instanceof Player)
|
||||
{
|
||||
if(GetTeam((Player) prj.getShooter()) == GetTeam((Player) event.getEntity()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void fillChest(Player looter, Block block)
|
||||
{
|
||||
@ -1193,63 +1215,6 @@ public class Skywars extends SoloGame
|
||||
_oreHider.BlockBreak(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler
|
||||
public void ScoreboardUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
if (GetTeamList().isEmpty())
|
||||
return;
|
||||
|
||||
Scoreboard.Reset();
|
||||
|
||||
GameTeam team = GetTeamList().get(0);
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(C.cYellow + C.Bold + "Players");
|
||||
if (team.GetPlayers(true).size() > 4)
|
||||
{
|
||||
Scoreboard.Write("" + team.GetPlayers(true).size());
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Player player : team.GetPlayers(true))
|
||||
{
|
||||
Scoreboard.Write(C.cWhite + player.getName());
|
||||
}
|
||||
}
|
||||
|
||||
if (IsLive())
|
||||
{
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(C.cYellow + C.Bold + "Time");
|
||||
Scoreboard.Write(UtilTime.convertString(System.currentTimeMillis() - GetStateTime(), 0, TimeUnit.FIT));
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write((_tntGen.active() ? C.cGreen : C.cRed) + C.Bold + "TNT Spawn");
|
||||
Scoreboard.Write(_tntGen.getScoreboardInfo());
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
|
||||
if (UtilTime.elapsed(GetStateTime(), _crumbleTime))
|
||||
{
|
||||
Scoreboard.Write(C.cRed + C.Bold + "Map Crumble");
|
||||
Scoreboard.Write("Active");
|
||||
}
|
||||
else
|
||||
{
|
||||
Scoreboard.Write(C.cGreen + C.Bold + "Map Crumble");
|
||||
Scoreboard.Write(UtilTime.convertString(_crumbleTime - (System.currentTimeMillis() - GetStateTime()), 0, TimeUnit.FIT));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Scoreboard.Draw();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void tntDamageAttribute(ExplosionPrimeEvent event)
|
||||
{
|
||||
@ -1367,4 +1332,15 @@ public class Skywars extends SoloGame
|
||||
else
|
||||
return 12;
|
||||
}
|
||||
|
||||
public TNTGenerator getTnTGen()
|
||||
{
|
||||
return this._tntGen;
|
||||
}
|
||||
|
||||
public long getCrumbleTime()
|
||||
{
|
||||
return this._crumbleTime;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,178 @@
|
||||
package nautilus.game.arcade.game.games.skywars;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
|
||||
public class SoloSkywars extends Skywars
|
||||
{
|
||||
|
||||
private GameTeam _players;
|
||||
|
||||
public SoloSkywars(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.Skywars,
|
||||
new String[]
|
||||
{
|
||||
"Free for all battle in the sky!",
|
||||
"Craft or loot gear for combat",
|
||||
"Last player alive wins!"
|
||||
});
|
||||
|
||||
this.DamageTeamSelf = true;
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void CustomTeamGeneration(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
_players = GetTeamList().get(0);
|
||||
_players.SetColor(ChatColor.YELLOW);
|
||||
_players.SetName("Players");
|
||||
_players.setDisplayName(C.cYellow + C.Bold + "Players");
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler
|
||||
public void ScoreboardUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
if (GetTeamList().isEmpty())
|
||||
return;
|
||||
|
||||
Scoreboard.Reset();
|
||||
|
||||
GameTeam team = GetTeamList().get(0);
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(C.cYellow + C.Bold + "Players");
|
||||
if (team.GetPlayers(true).size() > 4)
|
||||
{
|
||||
Scoreboard.Write("" + team.GetPlayers(true).size());
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Player player : team.GetPlayers(true))
|
||||
{
|
||||
Scoreboard.Write(C.cWhite + player.getName());
|
||||
}
|
||||
}
|
||||
|
||||
if (IsLive())
|
||||
{
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(C.cYellow + C.Bold + "Time");
|
||||
Scoreboard.Write(UtilTime.convertString(System.currentTimeMillis() - GetStateTime(), 0, TimeUnit.FIT));
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write((this.getTnTGen().active() ? C.cGreen : C.cRed) + C.Bold + "TNT Spawn");
|
||||
Scoreboard.Write(this.getTnTGen().getScoreboardInfo());
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
|
||||
if (UtilTime.elapsed(GetStateTime(), this.getCrumbleTime()))
|
||||
{
|
||||
Scoreboard.Write(C.cRed + C.Bold + "Map Crumble");
|
||||
Scoreboard.Write("Active");
|
||||
}
|
||||
else
|
||||
{
|
||||
Scoreboard.Write(C.cGreen + C.Bold + "Map Crumble");
|
||||
Scoreboard.Write(UtilTime.convertString(this.getCrumbleTime() - (System.currentTimeMillis() - GetStateTime()), 0, TimeUnit.FIT));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Scoreboard.Draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void EndCheck()
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (GetPlayers(true).size() <= 1)
|
||||
{
|
||||
ArrayList<Player> places = GetTeamList().get(0).GetPlacements(true);
|
||||
|
||||
//Announce
|
||||
AnnounceEnd(places);
|
||||
|
||||
//Gems
|
||||
if (places.size() >= 1)
|
||||
AddGems(places.get(0), 20, "1st Place", false, false);
|
||||
|
||||
if (places.size() >= 2)
|
||||
AddGems(places.get(1), 15, "2nd Place", false, false);
|
||||
|
||||
if (places.size() >= 3)
|
||||
AddGems(places.get(2), 10, "3rd Place", false, false);
|
||||
|
||||
for (Player player : GetPlayers(false))
|
||||
if (player.isOnline())
|
||||
AddGems(player, 10, "Participation", false, false);
|
||||
|
||||
//End
|
||||
SetState(GameState.End);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Player> getWinners()
|
||||
{
|
||||
if (GetState().ordinal() >= GameState.End.ordinal())
|
||||
{
|
||||
List<Player> places = GetTeamList().get(0).GetPlacements(true);
|
||||
|
||||
if (places.isEmpty() || !places.get(0).isOnline())
|
||||
return Arrays.asList();
|
||||
else
|
||||
return Arrays.asList(places.get(0));
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Player> getLosers()
|
||||
{
|
||||
List<Player> winners = getWinners();
|
||||
|
||||
if (winners == null)
|
||||
return null;
|
||||
|
||||
List<Player> losers = GetTeamList().get(0).GetPlayers(false);
|
||||
|
||||
losers.removeAll(winners);
|
||||
|
||||
return losers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetMode()
|
||||
{
|
||||
return "Solo Mode";
|
||||
}
|
||||
}
|
@ -0,0 +1,476 @@
|
||||
package nautilus.game.arcade.game.games.skywars;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
public class TeamSkywars extends Skywars
|
||||
{
|
||||
|
||||
private NautHashMap<Player, Player> _teamReqs = new NautHashMap<Player, Player>();
|
||||
|
||||
public TeamSkywars(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.SkywarsTeams,
|
||||
new String[]
|
||||
{
|
||||
"Free for all battle in the sky!",
|
||||
"Craft or loot gear for combat",
|
||||
"Last team alive wins!"
|
||||
});
|
||||
|
||||
this.FillTeamsInOrderToCount = 2;
|
||||
|
||||
this.SpawnNearAllies = true;
|
||||
|
||||
this.DamageTeamSelf = false;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void CustomTeamGeneration(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
ArrayList<Location> initialSpawns = this.GetTeamList().get(0).GetSpawns();
|
||||
this.GetTeamList().clear();
|
||||
|
||||
ArrayList<Location> spawns = new ArrayList<Location>();
|
||||
|
||||
TeamColors color = TeamColors.DARK_AQUA;
|
||||
|
||||
//Create 1 Team for each Spawn
|
||||
int i = 0;
|
||||
for(Location location : initialSpawns)
|
||||
{
|
||||
i++;
|
||||
|
||||
spawns.add(location);
|
||||
|
||||
addRelativeSpawns(spawns, location);
|
||||
|
||||
//Got Spawns
|
||||
color = getNextColor(color);
|
||||
int e = 0;
|
||||
for(GameTeam teams : GetTeamList())
|
||||
{
|
||||
if(teams.GetColor() == color.getColor())
|
||||
{
|
||||
e++;
|
||||
if(getColorName(color.getColor()).length <= e)
|
||||
{
|
||||
e = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
GameTeam team = new GameTeam(this, getColorName(color.getColor())[e], color.getColor(), spawns, true);
|
||||
team.SetVisible(true);
|
||||
GetTeamList().add(team);
|
||||
}
|
||||
}
|
||||
|
||||
private void addRelativeSpawns(ArrayList<Location> spawns, Location location)
|
||||
{
|
||||
//Gather Extra Spawns
|
||||
for(int x = -1; x <= 1; x++)
|
||||
{
|
||||
for(int z = -1; z <= 1; z++)
|
||||
{
|
||||
if(x != 0 && z != 0)
|
||||
{
|
||||
Location newSpawn = location.clone().add(x, 0, z);
|
||||
|
||||
//Search Downward for Solid
|
||||
while (UtilBlock.airFoliage(newSpawn.getBlock().getRelative(BlockFace.DOWN)) && newSpawn.getY() > location.getY()-5)
|
||||
{
|
||||
newSpawn.subtract(0, 1, 0);
|
||||
}
|
||||
|
||||
//Move Up out of Solid
|
||||
while (!UtilBlock.airFoliage(newSpawn.getBlock()) && newSpawn.getY() < location.getY()+5)
|
||||
{
|
||||
newSpawn.add(0, 1, 0);
|
||||
}
|
||||
|
||||
//On Solid, with 2 Air Above
|
||||
if (UtilBlock.airFoliage(newSpawn.getBlock()) &&
|
||||
UtilBlock.airFoliage(newSpawn.getBlock().getRelative(BlockFace.UP)) &&
|
||||
!UtilBlock.airFoliage(newSpawn.getBlock().getRelative(BlockFace.DOWN)))
|
||||
{
|
||||
spawns.add(newSpawn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private enum TeamColors
|
||||
{
|
||||
|
||||
YELLOW(ChatColor.YELLOW, new String[]{"Banana", "Sunshine", "Custard", "Sponge", "Star", "Giraffe", "Lego", "Light"}),
|
||||
GREEN(ChatColor.GREEN, new String[]{"Creepers", "Alien", "Seaweed", "Emerald", "Grinch", "Shrub", "Snake", "Leaf"}),
|
||||
AQUA(ChatColor.AQUA, new String[]{"Diamond", "Ice", "Pool", "Kraken", "Aquatic", "Ocean"}),
|
||||
RED(ChatColor.RED, new String[]{"Heart", "Tomato", "Ruby", "Jam", "Rose", "Apple", "TNT"}),
|
||||
GOLD(ChatColor.GOLD, new String[]{"Mango", "Foxes", "Sunset", "Nuggets", "Lion", "Desert", "Gapple"}),
|
||||
LIGHT_PURPLE(ChatColor.LIGHT_PURPLE, new String[]{"Dream", "Cupcake", "Cake", "Candy", "Unicorn"}),
|
||||
DARK_BLUE(ChatColor.DARK_BLUE, new String[]{"Squid", "Lapis", "Sharks", "Galaxy", "Empoleon"}),
|
||||
DARK_RED(ChatColor.DARK_RED, new String[]{"Rose", "Apple", "Twizzler", "Rocket", "Blood"}),
|
||||
WHITE(ChatColor.WHITE, new String[]{"Ghosts", "Spookies", "Popcorn", "Seagull", "Rice", "Snowman", "Artic"}),
|
||||
BLUE(ChatColor.BLUE, new String[]{"Sky", "Whale", "Lake", "Birds", "Bluebird", "Piplup"}),
|
||||
DARK_GREEN(ChatColor.DARK_GREEN, new String[]{"Forest", "Zombies", "Cactus", "Slime", "Toxic", "Poison"}),
|
||||
DARK_PURPLE(ChatColor.DARK_PURPLE, new String[]{"Amethyst", "Slugs", "Grape", "Witch", "Magic", "Zula"}),
|
||||
DARK_AQUA(ChatColor.DARK_AQUA, new String[]{"Snorlax", "Aquatic", "Clam", "Fish"});
|
||||
|
||||
private ChatColor color;
|
||||
private String[] names;
|
||||
|
||||
private TeamColors(ChatColor color, String[] names)
|
||||
{
|
||||
this.color = color;
|
||||
this.names = names;
|
||||
}
|
||||
|
||||
public ChatColor getColor()
|
||||
{
|
||||
return color;
|
||||
}
|
||||
|
||||
public String[] getNames()
|
||||
{
|
||||
return names;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private String[] getColorName(ChatColor color)
|
||||
{
|
||||
for(TeamColors colors : TeamColors.values())
|
||||
{
|
||||
if(colors.getColor() == color)
|
||||
{
|
||||
return colors.getNames();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private TeamColors getNextColor(TeamColors color)
|
||||
{
|
||||
for(TeamColors colors : TeamColors.values()) {
|
||||
if(colors.ordinal() == color.ordinal() + 1)
|
||||
{
|
||||
return colors;
|
||||
}
|
||||
}
|
||||
return TeamColors.YELLOW;
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler
|
||||
public void ScoreboardUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
if (GetTeamList().isEmpty())
|
||||
return;
|
||||
|
||||
Scoreboard.Reset();
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(C.cYellow + C.Bold + "Teams");
|
||||
|
||||
ArrayList<GameTeam> alive = new ArrayList<GameTeam>();
|
||||
for (GameTeam team : GetTeamList())
|
||||
{
|
||||
if (team.IsTeamAlive())
|
||||
alive.add(team);
|
||||
}
|
||||
|
||||
if (GetPlayers(true).size() <= 4)
|
||||
{
|
||||
for (GameTeam team : GetTeamList())
|
||||
{
|
||||
for (Player player : team.GetPlayers(true))
|
||||
{
|
||||
Scoreboard.Write(team.GetColor() + player.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (alive.size() <= 4)
|
||||
{
|
||||
for (GameTeam team : alive)
|
||||
{
|
||||
Scoreboard.Write(C.cWhite + team.GetPlayers(true).size() + " " + team.GetColor() + team.GetName());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Scoreboard.Write(C.cWhite + alive.size() + " Alive");
|
||||
}
|
||||
|
||||
if (IsLive())
|
||||
{
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(C.cYellow + C.Bold + "Time");
|
||||
Scoreboard.Write(UtilTime.convertString(System.currentTimeMillis() - GetStateTime(), 0, TimeUnit.FIT));
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write((this.getTnTGen().active() ? C.cGreen : C.cRed) + C.Bold + "TNT Spawn");
|
||||
Scoreboard.Write(this.getTnTGen().getScoreboardInfo());
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
|
||||
if (UtilTime.elapsed(GetStateTime(), this.getCrumbleTime()))
|
||||
{
|
||||
Scoreboard.Write(C.cRed + C.Bold + "Map Crumble");
|
||||
Scoreboard.Write("Active");
|
||||
}
|
||||
else
|
||||
{
|
||||
Scoreboard.Write(C.cGreen + C.Bold + "Map Crumble");
|
||||
Scoreboard.Write(UtilTime.convertString(this.getCrumbleTime() - (System.currentTimeMillis() - GetStateTime()), 0, TimeUnit.FIT));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Scoreboard.Draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void EndCheck()
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
ArrayList<GameTeam> teamsAlive = new ArrayList<GameTeam>();
|
||||
|
||||
for (GameTeam team : this.GetTeamList())
|
||||
if (team.GetPlayers(true).size() > 0)
|
||||
teamsAlive.add(team);
|
||||
|
||||
if (teamsAlive.size() <= 1)
|
||||
{
|
||||
//Announce
|
||||
if (teamsAlive.size() > 0)
|
||||
AnnounceEnd(teamsAlive.get(0));
|
||||
|
||||
for (GameTeam team : GetTeamList())
|
||||
{
|
||||
if (WinnerTeam != null && team.equals(WinnerTeam))
|
||||
{
|
||||
for (Player player : team.GetPlayers(false))
|
||||
AddGems(player, 10, "Winning Team", false, false);
|
||||
}
|
||||
|
||||
for (Player player : team.GetPlayers(false))
|
||||
if (player.isOnline())
|
||||
AddGems(player, 10, "Participation", false, false);
|
||||
}
|
||||
|
||||
//End
|
||||
SetState(GameState.End);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Player> getWinners()
|
||||
{
|
||||
if (WinnerTeam == null)
|
||||
return null;
|
||||
|
||||
return WinnerTeam.GetPlayers(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Player> getLosers()
|
||||
{
|
||||
if (WinnerTeam == null)
|
||||
return null;
|
||||
|
||||
List<Player> players = new ArrayList<>();
|
||||
|
||||
for (GameTeam team : GetTeamList())
|
||||
{
|
||||
if (team != WinnerTeam)
|
||||
players.addAll(team.GetPlayers(false));
|
||||
}
|
||||
|
||||
return players;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean CanJoinTeam(GameTeam team)
|
||||
{
|
||||
return team.GetSize() < 2;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void teamSelectInteract(PlayerInteractEntityEvent event)
|
||||
{
|
||||
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 (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 (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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetMode()
|
||||
{
|
||||
return "Team Mode";
|
||||
}
|
||||
}
|
@ -0,0 +1,162 @@
|
||||
package nautilus.game.arcade.game.games.smash;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
|
||||
public class SoloSuperSmash extends SuperSmash
|
||||
{
|
||||
|
||||
private GameTeam _players;
|
||||
|
||||
public SoloSuperSmash(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.Smash, new String[]
|
||||
{
|
||||
"Each player has 3 respawns",
|
||||
"Attack to restore hunger!",
|
||||
"Last player alive wins!"
|
||||
});
|
||||
|
||||
this.DamageTeamSelf = true;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void CustomTeamGeneration(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
_players = GetTeamList().get(0);
|
||||
_players.SetColor(ChatColor.YELLOW);
|
||||
_players.SetName("Players");
|
||||
_players.setDisplayName(C.cYellow + C.Bold + "Players");
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler
|
||||
public void ScoreboardUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
//Wipe Last
|
||||
Scoreboard.Reset();
|
||||
|
||||
if (GetPlayers(true).size() > 14)
|
||||
{
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(C.cGreen + "Players Alive");
|
||||
Scoreboard.Write(GetPlayers(true).size() + " ");
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(C.cRed + "Players Dead");
|
||||
Scoreboard.Write((GetPlayers(false).size() - GetPlayers(true).size()) + " ");
|
||||
}
|
||||
else
|
||||
{
|
||||
Scoreboard.WriteBlank();
|
||||
|
||||
//Write New
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
int lives = GetLives(player);
|
||||
|
||||
String out;
|
||||
if (lives >= 4) out = C.cGreen + player.getName();
|
||||
else if (lives == 3) out = C.cYellow + player.getName();
|
||||
else if (lives == 2) out = C.cGold + player.getName();
|
||||
else if (lives == 1) out = C.cRed + player.getName();
|
||||
else if (lives == 0) out = C.cRed + player.getName();
|
||||
else
|
||||
continue;
|
||||
|
||||
Scoreboard.WriteOrdered("Lives", out, lives, true);
|
||||
}
|
||||
}
|
||||
|
||||
Scoreboard.Draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void EndCheck()
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (GetPlayers(true).size() <= 1)
|
||||
{
|
||||
ArrayList<Player> places = GetTeamList().get(0).GetPlacements(true);
|
||||
|
||||
//Announce
|
||||
AnnounceEnd(places);
|
||||
|
||||
//Gems
|
||||
if (places.size() >= 1)
|
||||
AddGems(places.get(0), 20, "1st Place", false, false);
|
||||
|
||||
if (places.size() >= 2)
|
||||
AddGems(places.get(1), 15, "2nd Place", false, false);
|
||||
|
||||
if (places.size() >= 3)
|
||||
AddGems(places.get(2), 10, "3rd Place", false, false);
|
||||
|
||||
for (Player player : GetPlayers(false))
|
||||
if (player.isOnline())
|
||||
AddGems(player, 10, "Participation", false, false);
|
||||
|
||||
//End
|
||||
SetState(GameState.End);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Player> getWinners()
|
||||
{
|
||||
if (GetState().ordinal() >= GameState.End.ordinal())
|
||||
{
|
||||
List<Player> places = GetTeamList().get(0).GetPlacements(true);
|
||||
|
||||
if (places.isEmpty() || !places.get(0).isOnline())
|
||||
return Arrays.asList();
|
||||
else
|
||||
return Arrays.asList(places.get(0));
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Player> getLosers()
|
||||
{
|
||||
List<Player> winners = getWinners();
|
||||
|
||||
if (winners == null)
|
||||
return null;
|
||||
|
||||
List<Player> losers = GetTeamList().get(0).GetPlayers(false);
|
||||
|
||||
losers.removeAll(winners);
|
||||
|
||||
return losers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetMode()
|
||||
{
|
||||
return "Solo Mode";
|
||||
}
|
||||
}
|
@ -1,40 +1,16 @@
|
||||
package nautilus.game.arcade.game.games.smash;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.Color;
|
||||
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.EnderCrystal;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.BlockFadeEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
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.UtilTime;
|
||||
import mineplex.core.data.BlockData;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
@ -45,19 +21,57 @@ import nautilus.game.arcade.ArcadeFormat;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.SoloGame;
|
||||
import nautilus.game.arcade.game.GameTeam.PlayerState;
|
||||
import nautilus.game.arcade.game.games.smash.kits.*;
|
||||
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.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;
|
||||
import nautilus.game.arcade.kit.SmashKit;
|
||||
import nautilus.game.arcade.stats.KillFastStatTracker;
|
||||
import nautilus.game.arcade.stats.FreeKitWinStatTracker;
|
||||
import nautilus.game.arcade.stats.KillFastStatTracker;
|
||||
import nautilus.game.arcade.stats.OneVThreeStatTracker;
|
||||
import nautilus.game.arcade.stats.RecoveryMasterStatTracker;
|
||||
import nautilus.game.arcade.stats.WinWithoutDyingStatTracker;
|
||||
|
||||
public class SuperSmash extends SoloGame
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.EnderCrystal;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.BlockFadeEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
public abstract class SuperSmash extends Game
|
||||
{
|
||||
private HashMap<Player, Integer> _lives = new HashMap<Player, Integer>();
|
||||
|
||||
@ -68,9 +82,9 @@ public class SuperSmash extends SoloGame
|
||||
|
||||
private HashSet<BlockData> _restoreBlock = new HashSet<BlockData>();
|
||||
|
||||
public SuperSmash(ArcadeManager manager)
|
||||
public SuperSmash(ArcadeManager manager, GameType type, String[] description)
|
||||
{
|
||||
super(manager, GameType.Smash,
|
||||
super(manager, type,
|
||||
|
||||
new Kit[]
|
||||
{
|
||||
@ -98,31 +112,23 @@ public class SuperSmash extends SoloGame
|
||||
|
||||
new KitSheep(manager)
|
||||
|
||||
},
|
||||
|
||||
new String[]
|
||||
{
|
||||
"Each player has 3 respawns",
|
||||
"Attack to restore hunger!",
|
||||
"Last player alive wins!"
|
||||
|
||||
});
|
||||
},description);
|
||||
|
||||
this.DeathOut = false;
|
||||
|
||||
this.DamageTeamSelf = true;
|
||||
|
||||
this.CompassEnabled = true;
|
||||
|
||||
this.DeathSpectateSecs = 4;
|
||||
|
||||
this.SpawnDistanceRequirement = 32;
|
||||
|
||||
this.WorldWaterDamage = 1000;
|
||||
|
||||
|
||||
this.HideTeamSheep = true;
|
||||
|
||||
this.ReplaceTeamsWithKits = true;
|
||||
|
||||
// Add stat table here
|
||||
// Example
|
||||
//Manager.GetStatsManager().addTable("SuperSmashMobStats", "Kills", "Deaths", "Wins", "Losses");
|
||||
// Manager.GetStatsManager().addTable("SuperSmashMobStats", "Kills", "Deaths", "Wins", "Losses");
|
||||
|
||||
registerStatTrackers(
|
||||
new WinWithoutDyingStatTracker(this, "MLGPro"),
|
||||
@ -154,7 +160,7 @@ public class SuperSmash extends SoloGame
|
||||
}
|
||||
}
|
||||
|
||||
private int GetLives(Player player)
|
||||
public int GetLives(Player player)
|
||||
{
|
||||
if (!_lives.containsKey(player))
|
||||
return 0;
|
||||
@ -165,14 +171,14 @@ public class SuperSmash extends SoloGame
|
||||
return _lives.get(player);
|
||||
}
|
||||
|
||||
private boolean LoseLife(Player player)
|
||||
public boolean LoseLife(Player player)
|
||||
{
|
||||
int lives = GetLives(player) - 1;
|
||||
|
||||
if (lives > 0)
|
||||
{
|
||||
UtilPlayer.message(player, C.cRed + C.Bold + "You have died!");
|
||||
UtilPlayer.message(player, C.cRed + C.Bold + "You have " + lives + (lives == 1 ? "life" : "lives") + " left!");
|
||||
UtilPlayer.message(player, C.cRed + C.Bold + "You have " + lives + " " + (lives == 1 ? "life" : "lives") + " left!");
|
||||
player.playSound(player.getLocation(), Sound.NOTE_BASS_GUITAR, 2f, 0.5f);
|
||||
|
||||
_lives.put(player, lives);
|
||||
@ -188,51 +194,6 @@ public class SuperSmash extends SoloGame
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler
|
||||
public void ScoreboardUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
//Wipe Last
|
||||
Scoreboard.Reset();
|
||||
|
||||
if (GetPlayers(true).size() > 14)
|
||||
{
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(C.cGreen + "Players Alive");
|
||||
Scoreboard.Write(GetPlayers(true).size() + " ");
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(C.cRed + "Players Dead");
|
||||
Scoreboard.Write((GetPlayers(false).size() - GetPlayers(true).size()) + " ");
|
||||
}
|
||||
else
|
||||
{
|
||||
Scoreboard.WriteBlank();
|
||||
|
||||
//Write New
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
int lives = GetLives(player);
|
||||
|
||||
String out;
|
||||
if (lives >= 4) out = C.cGreen + player.getName();
|
||||
else if (lives == 3) out = C.cYellow + player.getName();
|
||||
else if (lives == 2) out = C.cGold + player.getName();
|
||||
else if (lives == 1) out = C.cRed + player.getName();
|
||||
else if (lives == 0) out = C.cRed + player.getName();
|
||||
else
|
||||
continue;
|
||||
|
||||
Scoreboard.WriteOrdered("Lives", out, lives, true);
|
||||
}
|
||||
}
|
||||
|
||||
Scoreboard.Draw();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void powerupSpawn(UpdateEvent event)
|
||||
{
|
||||
@ -530,9 +491,4 @@ public class SuperSmash extends SoloGame
|
||||
int amount = Math.max(1, (int)(event.GetDamage()/2));
|
||||
UtilPlayer.hunger(damager, amount);
|
||||
}
|
||||
|
||||
public String GetMode()
|
||||
{
|
||||
return "Deathmatch";
|
||||
}
|
||||
}
|
||||
|
@ -1,377 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.smash;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.BlockFadeEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.ArcadeFormat;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.GameTeam.PlayerState;
|
||||
import nautilus.game.arcade.game.TeamGame;
|
||||
import nautilus.game.arcade.game.games.smash.kits.*;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
|
||||
public class SuperSmashTeam extends TeamGame
|
||||
{
|
||||
private HashMap<Player, Integer> _lives = new HashMap<Player, Integer>();
|
||||
|
||||
public SuperSmashTeam(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.SmashTeams,
|
||||
|
||||
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 KitSheep(manager)
|
||||
|
||||
},
|
||||
|
||||
new String[]
|
||||
{
|
||||
"Each player has 3 respawns",
|
||||
"Attack to restore hunger!",
|
||||
"Last player alive wins!"
|
||||
|
||||
});
|
||||
|
||||
this.DeathOut = false;
|
||||
|
||||
this.DamageTeamSelf = false;
|
||||
|
||||
this.CompassEnabled = true;
|
||||
|
||||
this.SpawnDistanceRequirement = 16;
|
||||
|
||||
this.TeamArmorHotbar = true;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void GameStateChange(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Prepare)
|
||||
return;
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
_lives.put(player, 4);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void PlayerOut(PlayerDeathEvent event)
|
||||
{
|
||||
if (!LoseLife(event.getEntity()))
|
||||
{
|
||||
this.SetPlayerState(event.getEntity(), PlayerState.OUT);
|
||||
}
|
||||
}
|
||||
|
||||
private int GetLives(Player player)
|
||||
{
|
||||
if (!_lives.containsKey(player))
|
||||
return 0;
|
||||
|
||||
if (!IsAlive(player))
|
||||
return 0;
|
||||
|
||||
return _lives.get(player);
|
||||
}
|
||||
|
||||
private boolean LoseLife(Player player)
|
||||
{
|
||||
int lives = GetLives(player) - 1;
|
||||
|
||||
if (lives > 0)
|
||||
{
|
||||
UtilPlayer.message(player, C.cRed + C.Bold + "You have died!");
|
||||
UtilPlayer.message(player, C.cRed + C.Bold + "You have " + lives + " lives left!");
|
||||
player.playSound(player.getLocation(), Sound.NOTE_BASS_GUITAR, 2f, 0.5f);
|
||||
|
||||
_lives.put(player, lives);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(player, C.cRed + C.Bold + "You are out of the game!");
|
||||
player.playSound(player.getLocation(), Sound.EXPLODE, 2f, 1f);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler
|
||||
public void ScoreboardUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
//Wipe Last
|
||||
Scoreboard.Reset();
|
||||
|
||||
if (GetPlayers(true).size() > 14)
|
||||
{
|
||||
for (GameTeam team : this.GetTeamList())
|
||||
{
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(team.GetFormattedName());
|
||||
|
||||
int lives = 0;
|
||||
for (Player player : team.GetPlayers(true))
|
||||
lives += GetLives(player);
|
||||
|
||||
Scoreboard.Write(team.GetColor() + "" + lives + " Lives");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Scoreboard.WriteBlank();
|
||||
|
||||
//Write New
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
int lives = GetLives(player);
|
||||
|
||||
if (lives <= 0)
|
||||
continue;
|
||||
|
||||
Scoreboard.WriteOrdered("Lives", GetTeam(player).GetColor() + player.getName(), lives, true);
|
||||
}
|
||||
}
|
||||
|
||||
Scoreboard.Draw();
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void FallDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (event.IsCancelled())
|
||||
return;
|
||||
|
||||
if (event.GetCause() == DamageCause.FALL)
|
||||
event.SetCancelled("No Fall Damage");
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void Knockback(CustomDamageEvent event)
|
||||
{
|
||||
if (event.IsCancelled())
|
||||
return;
|
||||
|
||||
if (event.GetDamageePlayer() != null)
|
||||
event.AddKnockback("Smash Knockback", 1 + 0.1 * (20 - event.GetDamageePlayer().getHealth()));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void ArenaWalls(CustomDamageEvent event)
|
||||
{
|
||||
if (event.IsCancelled())
|
||||
return;
|
||||
|
||||
if (event.GetCause() == DamageCause.VOID || event.GetCause() == DamageCause.LAVA)
|
||||
{
|
||||
event.GetDamageeEntity().eject();
|
||||
event.GetDamageeEntity().leaveVehicle();
|
||||
|
||||
event.AddMod("Smash", "Super Smash Mobs", 5000, false);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void HealthChange(EntityRegainHealthEvent event)
|
||||
{
|
||||
if (event.getRegainReason() == RegainReason.SATIATED)
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void EntityDeath(EntityDeathEvent event)
|
||||
{
|
||||
event.getDrops().clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void SetKit(Player player, Kit kit, boolean announce)
|
||||
{
|
||||
GameTeam team = GetTeam(player);
|
||||
if (team != null)
|
||||
{
|
||||
if (!team.KitAllowed(kit))
|
||||
{
|
||||
player.playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 0.5f);
|
||||
UtilPlayer.message(player, F.main("Kit", F.elem(team.GetFormattedName()) + " cannot use " + F.elem(kit.GetFormattedName() + " Kit") + "."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_playerKit.put(player, kit);
|
||||
|
||||
if (announce)
|
||||
{
|
||||
player.playSound(player.getLocation(), Sound.ORB_PICKUP, 2f, 1f);
|
||||
UtilPlayer.message(player, F.main("Kit", "You equipped " + F.elem(kit.GetFormattedName() + " Kit") + "."));
|
||||
kit.ApplyKit(player);
|
||||
UtilInv.Update(player);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void AbilityDescription(PlayerInteractEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (player.getItemInHand() == null)
|
||||
return;
|
||||
|
||||
if (player.getItemInHand().getItemMeta() == null)
|
||||
return;
|
||||
|
||||
if (player.getItemInHand().getItemMeta().getDisplayName() == null)
|
||||
return;
|
||||
|
||||
if (player.getItemInHand().getItemMeta().getLore() == null)
|
||||
return;
|
||||
|
||||
if (Manager.GetGame() == null || Manager.GetGame().GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
for (int i=player.getItemInHand().getItemMeta().getLore().size() ; i<=7 ; i++)
|
||||
UtilPlayer.message(player, " ");
|
||||
|
||||
UtilPlayer.message(player, ArcadeFormat.Line);
|
||||
|
||||
UtilPlayer.message(player, "§aAbility - §f§l" + player.getItemInHand().getItemMeta().getDisplayName());
|
||||
|
||||
//Perk Descs
|
||||
for (String line : player.getItemInHand().getItemMeta().getLore())
|
||||
{
|
||||
UtilPlayer.message(player, line);
|
||||
}
|
||||
|
||||
UtilPlayer.message(player, ArcadeFormat.Line);
|
||||
|
||||
player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 2f);
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double GetKillsGems(Player killer, Player killed, boolean assist)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void BlockFade(BlockFadeEvent event)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
private int hungerTick = 0;
|
||||
@EventHandler
|
||||
public void Hunger(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
return;
|
||||
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
hungerTick = (hungerTick + 1)%6;
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
player.setSaturation(3f);
|
||||
player.setExhaustion(0f);
|
||||
|
||||
if (player.getFoodLevel() <= 0)
|
||||
{
|
||||
Manager.GetDamage().NewDamageEvent(player, null, null,
|
||||
DamageCause.STARVATION, 1, false, true, false,
|
||||
"Starvation", GetName());
|
||||
|
||||
UtilPlayer.message(player, F.main("Game", "Attack other players to restore hunger!"));
|
||||
}
|
||||
|
||||
if (hungerTick == 0)
|
||||
UtilPlayer.hunger(player, -1);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void HungerRestore(CustomDamageEvent event)
|
||||
{
|
||||
|
||||
if (event.IsCancelled())
|
||||
return;
|
||||
|
||||
if (event.GetDamagerPlayer(true) == null)
|
||||
return;
|
||||
|
||||
if (event.GetDamageePlayer() == null)
|
||||
return;
|
||||
|
||||
if (GetTeam(event.GetDamageePlayer()) == null)
|
||||
return;
|
||||
|
||||
Player damager = event.GetDamagerPlayer(true);
|
||||
if (damager == null)
|
||||
return;
|
||||
|
||||
if (GetTeam(damager) == null)
|
||||
return;
|
||||
|
||||
if (GetTeam(damager).equals(GetTeam(event.GetDamageePlayer())))
|
||||
return;
|
||||
|
||||
if (!Recharge.Instance.use(damager, "Hunger Restore", 250, false, false))
|
||||
return;
|
||||
|
||||
int amount = Math.max(1, (int)(event.GetDamage()/2));
|
||||
UtilPlayer.hunger(damager, amount);
|
||||
}
|
||||
}
|
@ -0,0 +1,424 @@
|
||||
package nautilus.game.arcade.game.games.smash;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
public class TeamSuperSmash extends SuperSmash
|
||||
{
|
||||
|
||||
public boolean ForceTeamSize = true;
|
||||
public int PlayersPerTeam = 2;
|
||||
public int TeamCount = 0;
|
||||
|
||||
private NautHashMap<Player, Player> _teamReqs = new NautHashMap<Player, Player>();
|
||||
|
||||
public TeamSuperSmash(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.SmashTeams,
|
||||
new String[]
|
||||
{
|
||||
"Each player has 3 respawns",
|
||||
"Attack to restore hunger!",
|
||||
"Last team alive wins!"
|
||||
});
|
||||
|
||||
this.PlayersPerTeam = 2;
|
||||
this.FillTeamsInOrderToCount = 2;
|
||||
|
||||
this.SpawnNearAllies = true;
|
||||
this.DamageTeamSelf = false;
|
||||
|
||||
this.TeamArmorHotbar = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler
|
||||
public void ScoreboardUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
ArrayList<GameTeam> alive = new ArrayList<GameTeam>();
|
||||
for (GameTeam team : GetTeamList())
|
||||
{
|
||||
if (team.IsTeamAlive())
|
||||
alive.add(team);
|
||||
}
|
||||
|
||||
//Wipe Last
|
||||
Scoreboard.Reset();
|
||||
Scoreboard.WriteBlank();
|
||||
|
||||
if (GetPlayers(true).size() < 16)
|
||||
{
|
||||
|
||||
for (GameTeam team : GetTeamList())
|
||||
{
|
||||
for (Player player : team.GetPlayers(true))
|
||||
{
|
||||
int lives = GetLives(player);
|
||||
|
||||
Scoreboard.Write(C.cWhite + lives + " " + team.GetColor() + player.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (alive.size() < 16)
|
||||
{
|
||||
for (GameTeam team : alive)
|
||||
{
|
||||
int lives = 0;
|
||||
|
||||
for (Player player : team.GetPlayers(true))
|
||||
{
|
||||
lives += GetLives(player);
|
||||
}
|
||||
|
||||
Scoreboard.Write(C.cWhite + lives + " " + team.GetColor() + team.GetName());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Scoreboard.Write(C.cYellow + C.Bold + "Teams Alive");
|
||||
Scoreboard.Write(C.cWhite + alive.size());
|
||||
}
|
||||
|
||||
Scoreboard.Draw();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void CustomTeamGeneration(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
ArrayList<Location> spawns = this.GetTeamList().get(0).GetSpawns();
|
||||
this.GetTeamList().clear();
|
||||
|
||||
TeamColors color = TeamColors.DARK_AQUA;
|
||||
|
||||
if(!this.ForceTeamSize)
|
||||
{
|
||||
for(int i = 1; i <= this.TeamCount; i++)
|
||||
{
|
||||
color = getNextColor(color);
|
||||
GameTeam team = new GameTeam(this, String.valueOf(i), color.getColor(), spawns);
|
||||
team.SetVisible(true);
|
||||
GetTeamList().add(team);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(int i = 1; i <= Manager.GetPlayerFull() / this.PlayersPerTeam; i++)
|
||||
{
|
||||
color = getNextColor(color);
|
||||
int e = 0;
|
||||
for(GameTeam teams : GetTeamList())
|
||||
{
|
||||
if(teams.GetColor() == color.getColor())
|
||||
{
|
||||
e++;
|
||||
if(getColorName(color.getColor()).length <= e)
|
||||
{
|
||||
e = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
GameTeam team = new GameTeam(this, getColorName(color.getColor())[e], color.getColor(), spawns, true);
|
||||
team.SetVisible(true);
|
||||
GetTeamList().add(team);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private enum TeamColors
|
||||
{
|
||||
|
||||
YELLOW(ChatColor.YELLOW, new String[]{"Banana", "Sunshine", "Custard", "Sponge", "Star", "Giraffe", "Lego", "Light"}),
|
||||
GREEN(ChatColor.GREEN, new String[]{"Creepers", "Alien", "Seaweed", "Emerald", "Grinch", "Shrub", "Snake", "Leaf"}),
|
||||
AQUA(ChatColor.AQUA, new String[]{"Diamond", "Ice", "Pool", "Kraken", "Aquatic", "Ocean"}),
|
||||
RED(ChatColor.RED, new String[]{"Heart", "Tomato", "Ruby", "Jam", "Rose", "Apple", "TNT"}),
|
||||
GOLD(ChatColor.GOLD, new String[]{"Mango", "Foxes", "Sunset", "Nuggets", "Lion", "Desert", "Gapple"}),
|
||||
LIGHT_PURPLE(ChatColor.LIGHT_PURPLE, new String[]{"Dream", "Cupcake", "Cake", "Candy", "Unicorn"}),
|
||||
DARK_BLUE(ChatColor.DARK_BLUE, new String[]{"Squid", "Lapis", "Sharks", "Galaxy", "Empoleon"}),
|
||||
DARK_RED(ChatColor.DARK_RED, new String[]{"Rose", "Apple", "Twizzler", "Rocket", "Blood"}),
|
||||
WHITE(ChatColor.WHITE, new String[]{"Ghosts", "Spookies", "Popcorn", "Seagull", "Rice", "Snowman", "Artic"}),
|
||||
BLUE(ChatColor.BLUE, new String[]{"Sky", "Whale", "Lake", "Birds", "Bluebird", "Piplup"}),
|
||||
DARK_GREEN(ChatColor.DARK_GREEN, new String[]{"Forest", "Zombies", "Cactus", "Slime", "Toxic", "Poison"}),
|
||||
DARK_PURPLE(ChatColor.DARK_PURPLE, new String[]{"Amethyst", "Slugs", "Grape", "Witch", "Magic", "Zula"}),
|
||||
DARK_AQUA(ChatColor.DARK_AQUA, new String[]{"Snorlax", "Aquatic", "Clam", "Fish"});
|
||||
|
||||
private ChatColor color;
|
||||
private String[] names;
|
||||
|
||||
private TeamColors(ChatColor color, String[] names)
|
||||
{
|
||||
this.color = color;
|
||||
this.names = names;
|
||||
}
|
||||
|
||||
public ChatColor getColor()
|
||||
{
|
||||
return color;
|
||||
}
|
||||
|
||||
public String[] getNames()
|
||||
{
|
||||
return names;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private String[] getColorName(ChatColor color)
|
||||
{
|
||||
for(TeamColors colors : TeamColors.values())
|
||||
{
|
||||
if(colors.getColor() == color)
|
||||
{
|
||||
return colors.getNames();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private TeamColors getNextColor(TeamColors color)
|
||||
{
|
||||
for(TeamColors colors : TeamColors.values()) {
|
||||
if(colors.ordinal() == color.ordinal() + 1)
|
||||
{
|
||||
return colors;
|
||||
}
|
||||
}
|
||||
return TeamColors.YELLOW;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void EndCheck()
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
ArrayList<GameTeam> teamsAlive = new ArrayList<GameTeam>();
|
||||
|
||||
for (GameTeam team : this.GetTeamList())
|
||||
if (team.GetPlayers(true).size() > 0)
|
||||
teamsAlive.add(team);
|
||||
|
||||
if (teamsAlive.size() <= 1)
|
||||
{
|
||||
//Announce
|
||||
if (teamsAlive.size() > 0)
|
||||
AnnounceEnd(teamsAlive.get(0));
|
||||
|
||||
for (GameTeam team : GetTeamList())
|
||||
{
|
||||
if (WinnerTeam != null && team.equals(WinnerTeam))
|
||||
{
|
||||
for (Player player : team.GetPlayers(false))
|
||||
AddGems(player, 10, "Winning Team", false, false);
|
||||
}
|
||||
|
||||
for (Player player : team.GetPlayers(false))
|
||||
if (player.isOnline())
|
||||
AddGems(player, 10, "Participation", false, false);
|
||||
}
|
||||
|
||||
//End
|
||||
SetState(GameState.End);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Player> getWinners()
|
||||
{
|
||||
if (WinnerTeam == null)
|
||||
return null;
|
||||
|
||||
return WinnerTeam.GetPlayers(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Player> getLosers()
|
||||
{
|
||||
if (WinnerTeam == null)
|
||||
return null;
|
||||
|
||||
List<Player> players = new ArrayList<>();
|
||||
|
||||
for (GameTeam team : GetTeamList())
|
||||
{
|
||||
if (team != WinnerTeam)
|
||||
players.addAll(team.GetPlayers(false));
|
||||
}
|
||||
|
||||
return players;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean CanJoinTeam(GameTeam team)
|
||||
{
|
||||
return team.GetSize() < PlayersPerTeam;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void teamSelectInteract(PlayerInteractEntityEvent event)
|
||||
{
|
||||
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 (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 (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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetMode()
|
||||
{
|
||||
return "Team Mode";
|
||||
}
|
||||
}
|
@ -1,58 +1,129 @@
|
||||
package nautilus.game.arcade.game.games.snowfight;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
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.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilSound;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.explosion.ExplosionEvent;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import mineplex.minecraft.game.core.explosion.CustomExplosion;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.TeamGame;
|
||||
import nautilus.game.arcade.game.games.snowfight.kits.KitTactician;
|
||||
import nautilus.game.arcade.game.games.snowfight.kits.KitMedic;
|
||||
import nautilus.game.arcade.game.games.snowfight.kits.KitSportsman;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.SmashKit;
|
||||
import net.minecraft.server.v1_7_R4.EntityFireball;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftFireball;
|
||||
import org.bukkit.entity.Egg;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.entity.Fireball;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.entity.Snowball;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.block.BlockDamageEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.potion.Potion;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.potion.PotionType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.game.TeamGame;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.NullKit;
|
||||
import com.sun.xml.internal.bind.v2.runtime.unmarshaller.XsiNilLoader.Array;
|
||||
|
||||
public class SnowFight extends TeamGame
|
||||
{
|
||||
public SnowFight(ArcadeManager manager)
|
||||
|
||||
private HashMap<Player, Integer> _tiles;
|
||||
private boolean _meteoroids;
|
||||
private boolean _peace;
|
||||
|
||||
public SnowFight(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.SnowFight,
|
||||
|
||||
new Kit[]
|
||||
new Kit[]
|
||||
{
|
||||
new NullKit(manager)
|
||||
new KitSportsman(manager),
|
||||
new KitTactician(manager),
|
||||
new KitMedic(manager)
|
||||
},
|
||||
|
||||
new String[]
|
||||
{
|
||||
"Just like... kill your enemies. with snow."
|
||||
});
|
||||
|
||||
new String[]
|
||||
{
|
||||
"Just like... kill your enemies. with snow.",
|
||||
"Be careful if you are on Ice your body will freeze"
|
||||
});
|
||||
|
||||
this.HungerSet = 20;
|
||||
this.CompassEnabled = true;
|
||||
this.CompassGiveItem = false;
|
||||
this.TeamArmor = true;
|
||||
this.TeamArmorHotbar = true;
|
||||
this.BlockPlace = true;
|
||||
this.BlockBreakAllow = new HashSet<>(Arrays.asList(Material.FENCE.getId()));
|
||||
this._tiles = new HashMap<Player, Integer>();
|
||||
this._meteoroids = false;
|
||||
this._peace = false;
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void GameState(GameStateChangeEvent event)
|
||||
{
|
||||
if(event.GetState() != GameState.Live)
|
||||
return;
|
||||
|
||||
this.Announce(C.cRed + C.Bold + "ALERT: " + ChatColor.RESET + C.Bold + "15 seconds Peace Phase is starting!");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Weather(UpdateEvent event)
|
||||
{
|
||||
@ -69,6 +140,62 @@ public class SnowFight extends TeamGame
|
||||
world.setWeatherDuration(40);
|
||||
world.setTime(4000);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void IceDamage(UpdateEvent event) {
|
||||
if(event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
if(!IsLive())
|
||||
return;
|
||||
|
||||
for(Player player : GetPlayers(true))
|
||||
{
|
||||
if(IsOnIce(player))
|
||||
{
|
||||
Bukkit.getPluginManager().callEvent(new CustomDamageEvent(player, null, null, DamageCause.CUSTOM, 2.0D, false, true, true, "Ice", "Ice", false));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Meteor(UpdateEvent event) {
|
||||
if(event.getType() != UpdateType.TWOSEC)
|
||||
return;
|
||||
|
||||
if(!IsLive())
|
||||
return;
|
||||
|
||||
if(System.currentTimeMillis() <= getGameLiveTime() + (15 * 1000))
|
||||
return;
|
||||
|
||||
if(!_peace)
|
||||
{
|
||||
for(Player player : GetPlayers(false))
|
||||
{
|
||||
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1F, 1F);
|
||||
UtilTextMiddle.display(C.cGold + C.Bold + "Peace Phase ended", "Kill your enemies", player);
|
||||
}
|
||||
this.Announce(C.cRed + C.Bold + "ALERT: " + ChatColor.RESET + C.Bold + "Peace Phase ended");
|
||||
_peace = true;
|
||||
}
|
||||
|
||||
if(System.currentTimeMillis() <= getGameLiveTime() + (195 * 1000))
|
||||
return;
|
||||
|
||||
if(!_meteoroids)
|
||||
{
|
||||
for(Player player : GetPlayers(false))
|
||||
{
|
||||
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1F, 1F);
|
||||
UtilTextMiddle.display(C.cGold + C.Bold + "ICE METEOROIDS!!!", "Avoid the Ice Fields", player);
|
||||
}
|
||||
this.Announce(C.cRed + C.Bold + "ALERT: " + ChatColor.RESET + C.Bold + "METEOROIDS START FALLING!");
|
||||
_meteoroids = true;
|
||||
}
|
||||
makeMeteor();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void BlockDamage(BlockDamageEvent event)
|
||||
@ -84,97 +211,119 @@ public class SnowFight extends TeamGame
|
||||
if (!IsSnow(event.getBlock()))
|
||||
return;
|
||||
|
||||
|
||||
if (UtilInv.contains(player, Material.SNOW_BALL, (byte)0, 16))
|
||||
if (UtilInv.contains(player, Material.SNOW_BALL, (byte) 0, 16))
|
||||
return;
|
||||
|
||||
//Item
|
||||
UtilInv.insert(player, new ItemStack(Material.SNOW_BALL));
|
||||
// Item
|
||||
|
||||
//Snow Height
|
||||
if (!_tiles.containsKey(player))
|
||||
{
|
||||
_tiles.put(player, 0);
|
||||
}
|
||||
|
||||
if (GetKit(player) instanceof KitSportsman)
|
||||
UtilInv.insert(player, new ItemStack(Material.SNOW_BALL));
|
||||
|
||||
|
||||
int tiles = _tiles.get(player);
|
||||
_tiles.put(player, tiles + 1);
|
||||
|
||||
if (!(GetKit(player) instanceof KitSportsman))
|
||||
{
|
||||
if (_tiles.get(player) == 2)
|
||||
{
|
||||
UtilInv.insert(player, new ItemStack(Material.SNOW_BALL));
|
||||
_tiles.put(player, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// Snow Height
|
||||
SnowDecrease(event.getBlock(), 1);
|
||||
|
||||
//Effect
|
||||
event.getBlock().getWorld().playEffect(event.getBlock().getLocation(), Effect.STEP_SOUND, 80);
|
||||
// Effect
|
||||
event.getBlock().getWorld().playEffect(event.getBlock().getLocation(), Effect.STEP_SOUND, 80);
|
||||
}
|
||||
|
||||
// @EventHandler
|
||||
// public void InteractSnowball(PlayerInteractEvent event)
|
||||
// {
|
||||
// Player player = event.getPlayer();
|
||||
//
|
||||
// if (!IsLive())
|
||||
// return;
|
||||
//
|
||||
// if (!IsPlaying(player))
|
||||
// return;
|
||||
//
|
||||
// if (!UtilGear.isMat(player.getItemInHand(), Material.SNOW_BALL))
|
||||
// return;
|
||||
//
|
||||
// event.setCancelled(true);
|
||||
//
|
||||
// if (UtilEvent.isAction(event, ActionType.L))
|
||||
// SnowballThrow(player);
|
||||
//
|
||||
// else if (UtilEvent.isAction(event, ActionType.R_BLOCK))
|
||||
// SnowballPlace(player, event.getClickedBlock(), 1);
|
||||
// }
|
||||
//
|
||||
// private void SnowballPlace(Player player, Block block, int above)
|
||||
// {
|
||||
// if (block.getTypeId() == 78 || UtilBlock.airFoliage(block))
|
||||
// {
|
||||
// //Build
|
||||
// if (block.getTypeId() == 78)
|
||||
// {
|
||||
// block.setTypeIdAndData(78, (byte)(block.getData() + 1), true);
|
||||
//
|
||||
// if (block.getData() >= 7)
|
||||
// block.setTypeIdAndData(80, (byte)0, true);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// block.setTypeIdAndData(78, (byte)0, true);
|
||||
// }
|
||||
//
|
||||
// //Sound
|
||||
// block.getWorld().playSound(block.getLocation(), Sound.STEP_SNOW, 1f, 0.6f);
|
||||
//
|
||||
// //Use Snow
|
||||
// SnowballCount(player, -1);
|
||||
// }
|
||||
// else if ((IsSnow(block) || UtilBlock.solid(block)) && above > 0)
|
||||
// {
|
||||
// SnowballPlace(player, block.getRelative(BlockFace.UP), above - 1);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void SnowballThrow(Player player)
|
||||
// {
|
||||
// //Throw
|
||||
// player.launchProjectile(Snowball.class);
|
||||
//
|
||||
// //Use Snow
|
||||
// SnowballCount(player, -1);
|
||||
//
|
||||
// //Sound
|
||||
// player.getWorld().playSound(player.getLocation(), Sound.STEP_SNOW, 3f, 1.5f);
|
||||
// }
|
||||
// @EventHandler
|
||||
// public void InteractSnowball(PlayerInteractEvent event)
|
||||
// {
|
||||
// Player player = event.getPlayer();
|
||||
//
|
||||
// if (!IsLive())
|
||||
// return;
|
||||
//
|
||||
// if (!IsPlaying(player))
|
||||
// return;
|
||||
//
|
||||
// if (!UtilGear.isMat(player.getItemInHand(), Material.SNOW_BALL))
|
||||
// return;
|
||||
//
|
||||
// event.setCancelled(true);
|
||||
//
|
||||
// if (UtilEvent.isAction(event, ActionType.L))
|
||||
// SnowballThrow(player);
|
||||
//
|
||||
// else if (UtilEvent.isAction(event, ActionType.R_BLOCK))
|
||||
// SnowballPlace(player, event.getClickedBlock(), 1);
|
||||
// }
|
||||
//
|
||||
// private void SnowballPlace(Player player, Block block, int above)
|
||||
// {
|
||||
// if (block.getTypeId() == 78 || UtilBlock.airFoliage(block))
|
||||
// {
|
||||
// //Build
|
||||
// if (block.getTypeId() == 78)
|
||||
// {
|
||||
// block.setTypeIdAndData(78, (byte)(block.getData() + 1), true);
|
||||
//
|
||||
// if (block.getData() >= 7)
|
||||
// block.setTypeIdAndData(80, (byte)0, true);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// block.setTypeIdAndData(78, (byte)0, true);
|
||||
// }
|
||||
//
|
||||
// //Sound
|
||||
// block.getWorld().playSound(block.getLocation(), Sound.STEP_SNOW, 1f,
|
||||
// 0.6f);
|
||||
//
|
||||
// //Use Snow
|
||||
// SnowballCount(player, -1);
|
||||
// }
|
||||
// else if ((IsSnow(block) || UtilBlock.solid(block)) && above > 0)
|
||||
// {
|
||||
// SnowballPlace(player, block.getRelative(BlockFace.UP), above - 1);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void SnowballThrow(Player player)
|
||||
// {
|
||||
// //Throw
|
||||
// player.launchProjectile(Snowball.class);
|
||||
//
|
||||
// //Use Snow
|
||||
// SnowballCount(player, -1);
|
||||
//
|
||||
// //Sound
|
||||
// player.getWorld().playSound(player.getLocation(), Sound.STEP_SNOW, 3f,
|
||||
// 1.5f);
|
||||
// }
|
||||
|
||||
// private void SnowballCount(Player player, int count)
|
||||
// {
|
||||
// if (player.getInventory().getItem(1) != null)
|
||||
// count += player.getInventory().getItem(1).getAmount();
|
||||
//
|
||||
// if (count > 16)
|
||||
// count = 16;
|
||||
//
|
||||
// if (count > 0)
|
||||
// player.getInventory().setItem(1, ItemStackFactory.Instance.CreateStack(Material.SNOW_BALL, count));
|
||||
// else
|
||||
// player.getInventory().setItem(1, null);
|
||||
// }
|
||||
// private void SnowballCount(Player player, int count)
|
||||
// {
|
||||
// if (player.getInventory().getItem(1) != null)
|
||||
// count += player.getInventory().getItem(1).getAmount();
|
||||
//
|
||||
// if (count > 16)
|
||||
// count = 16;
|
||||
//
|
||||
// if (count > 0)
|
||||
// player.getInventory().setItem(1,
|
||||
// ItemStackFactory.Instance.CreateStack(Material.SNOW_BALL, count));
|
||||
// else
|
||||
// player.getInventory().setItem(1, null);
|
||||
// }
|
||||
|
||||
private void SnowDecrease(Block block, int height)
|
||||
{
|
||||
@ -184,30 +333,53 @@ public class SnowFight extends TeamGame
|
||||
if (!IsSnow(block))
|
||||
return;
|
||||
|
||||
//Shuffle Up
|
||||
// Shuffle Up
|
||||
while (IsSnow(block.getRelative(BlockFace.UP)))
|
||||
block = block.getRelative(BlockFace.UP);
|
||||
|
||||
//Snow Block
|
||||
int snowLevel = 8;
|
||||
if (block.getTypeId() == 78)
|
||||
// Snow Block
|
||||
int snowLevel = 8;
|
||||
if (block.getTypeId() == 78)
|
||||
snowLevel = block.getData() + 1;
|
||||
|
||||
//Lower
|
||||
// Lower
|
||||
if (height >= snowLevel)
|
||||
{
|
||||
block.setTypeIdAndData(0, (byte)0, true);
|
||||
SnowDecrease(block.getRelative(BlockFace.DOWN), height-snowLevel);
|
||||
block.setTypeIdAndData(0, (byte) 0, true);
|
||||
SnowDecrease(block.getRelative(BlockFace.DOWN), height - snowLevel);
|
||||
}
|
||||
else
|
||||
{
|
||||
block.setTypeIdAndData(78, (byte)(snowLevel-height-1), true);
|
||||
block.setTypeIdAndData(78, (byte) (snowLevel - height - 1), true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void HealthRegen(EntityRegainHealthEvent event)
|
||||
{
|
||||
if(event.getRegainReason() == RegainReason.SATIATED)
|
||||
{
|
||||
event.setAmount(1);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void GenerallDamage(CustomDamageEvent event)
|
||||
{
|
||||
if(event.GetCause() == DamageCause.ENTITY_ATTACK)
|
||||
event.SetCancelled("No Melee");
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void SnowballDamage(CustomDamageEvent event)
|
||||
{
|
||||
public void SnowballEggDamage(CustomDamageEvent event)
|
||||
{
|
||||
|
||||
if(!_peace)
|
||||
{
|
||||
event.SetCancelled("Peace Phase");
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.IsCancelled())
|
||||
return;
|
||||
|
||||
@ -215,20 +387,249 @@ public class SnowFight extends TeamGame
|
||||
return;
|
||||
|
||||
Projectile proj = event.GetProjectile();
|
||||
if (proj == null) return;
|
||||
|
||||
if (!(proj instanceof Snowball))
|
||||
if (proj == null)
|
||||
return;
|
||||
|
||||
event.AddMod("Snowball", "Snowball", 3, true);
|
||||
|
||||
if(proj instanceof Fireball)
|
||||
return;
|
||||
|
||||
if(proj instanceof Snowball)
|
||||
event.AddMod("Snowball", "Snowball", 2, true);
|
||||
|
||||
event.SetIgnoreRate(true);
|
||||
event.SetIgnoreArmor(true);
|
||||
|
||||
//Effect
|
||||
proj.getWorld().playEffect(proj.getLocation(), Effect.STEP_SOUND, 80);
|
||||
// Effect
|
||||
proj.getWorld().playEffect(proj.getLocation(), Effect.STEP_SOUND, 80);
|
||||
((Player) proj.getShooter()).playSound(((Player) proj.getShooter()).getLocation(), Sound.SUCCESSFUL_HIT, 1, 1);
|
||||
}
|
||||
|
||||
private boolean IsSnow(Block block)
|
||||
{
|
||||
return block.getTypeId() == 78 || block.getTypeId() == 80;
|
||||
}
|
||||
|
||||
private boolean IsOnIce(Player player)
|
||||
{
|
||||
return player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == Material.ICE;
|
||||
}
|
||||
|
||||
|
||||
private void makeMeteor()
|
||||
{
|
||||
|
||||
Location loc = getEndgameLocation();
|
||||
|
||||
if (loc == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
summonMeteor(loc, 20F);
|
||||
|
||||
}
|
||||
|
||||
private void summonMeteor(Location loc, float fireballSize)
|
||||
{
|
||||
Vector vector = new Vector(UtilMath.random.nextDouble() - 0.5D, 0.8, UtilMath.random.nextDouble() - 0.5D).normalize();
|
||||
|
||||
vector.multiply(40);
|
||||
|
||||
loc.add((UtilMath.random.nextDouble() - 0.5) * 7, 0, (UtilMath.random.nextDouble() - 0.5) * 7);
|
||||
|
||||
loc.add(vector);
|
||||
|
||||
final FallingBlock fallingblock = loc.getWorld().spawnFallingBlock(loc, Material.ICE, (byte) 0);
|
||||
|
||||
fallingblock.setMetadata("Meteor", new FixedMetadataValue(getArcadeManager().getPlugin(), fireballSize));
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
int i;
|
||||
|
||||
public void run()
|
||||
{
|
||||
if (fallingblock.isValid() && IsLive())
|
||||
{
|
||||
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, fallingblock.getLocation(), 0.3F, 0.3F, 0.3F, 0, 3,
|
||||
ViewDist.MAX, UtilServer.getPlayers());
|
||||
|
||||
if (i++ % 6 == 0)
|
||||
{
|
||||
fallingblock.getWorld().playSound(fallingblock.getLocation(), Sound.CAT_HISS, 1.3F, 0F);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(getArcadeManager().getPlugin(), 0, 0);
|
||||
|
||||
vector.normalize().multiply(-(0.04 + ((0.5 - 0.05) / 2)));
|
||||
fallingblock.setFireTicks(9999);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void MeteorHit(EntityChangeBlockEvent event)
|
||||
{
|
||||
Entity projectile = event.getEntity();
|
||||
|
||||
float size = 2.5F;
|
||||
double damage = 2.5D;
|
||||
|
||||
for(int i = 1; i <= 10; i++)
|
||||
{
|
||||
if(System.currentTimeMillis() >= getGameLiveTime() + (((30 * i) + 180) * 1000))
|
||||
{
|
||||
size = 2.5F * i;
|
||||
damage = 2.5D * i;
|
||||
}
|
||||
}
|
||||
|
||||
if (projectile.hasMetadata("Meteor"))
|
||||
{
|
||||
|
||||
CustomExplosion explosion = new CustomExplosion(getArcadeManager().GetDamage(), getArcadeManager().GetExplosion(),
|
||||
projectile.getLocation(), size, "Meteor");
|
||||
|
||||
explosion.setBlockExplosionSize(size);
|
||||
explosion.setFallingBlockExplosion(false);
|
||||
explosion.setDropItems(false);
|
||||
explosion.setBlocksDamagedEqually(true);
|
||||
|
||||
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, projectile.getLocation(), 1.0F, 1.0F, 1.0F, 1, 3, ViewDist.MAX, UtilServer.getPlayers());
|
||||
for(Player player : UtilServer.getPlayers()) {
|
||||
player.playSound(projectile.getLocation(), Sound.EXPLODE, 1, 1);
|
||||
}
|
||||
|
||||
boolean fall = true;
|
||||
|
||||
for(Entity player : projectile.getNearbyEntities(size, size, size))
|
||||
{
|
||||
if(player instanceof Player)
|
||||
{
|
||||
Player damagee = (Player) player;
|
||||
Bukkit.getPluginManager().callEvent(new CustomDamageEvent(damagee, null, null, DamageCause.CUSTOM, damage, false, true, true, "Ice Meteoroid", "Ice Meteoroid", false));
|
||||
}
|
||||
}
|
||||
|
||||
for(Block block : UtilBlock.getInRadius(event.getEntity().getLocation(), size).keySet())
|
||||
{
|
||||
if(block.getType() != Material.AIR)
|
||||
{
|
||||
block.setType(Material.ICE);
|
||||
if(block.getRelative(BlockFace.DOWN).getType() == Material.AIR)
|
||||
{
|
||||
// to reduce lag
|
||||
if(fall)
|
||||
{
|
||||
block.getWorld().spawnFallingBlock(block.getLocation(), block.getType(), block.getData());
|
||||
fall = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
fall = true;
|
||||
}
|
||||
block.setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private Location getEndgameLocation()
|
||||
{
|
||||
int chance = UtilMath.r(50) + 3;
|
||||
int accuracy = Math.max((int) (chance - (0.0001 * chance)), 1);
|
||||
|
||||
ArrayList<Player> players = GetPlayers(true);
|
||||
|
||||
for (int a = 0; a < 50; a++)
|
||||
{
|
||||
Player player = players.get(UtilMath.r(players.size()));
|
||||
|
||||
Location location = player.getLocation().add(UtilMath.r(accuracy * 2) - accuracy, 0,
|
||||
UtilMath.r(accuracy * 2) - accuracy);
|
||||
|
||||
location = WorldData.World.getHighestBlockAt(location).getLocation().add(0.5, 0, 0.5);
|
||||
|
||||
if (location.getBlock().getType() == Material.AIR)
|
||||
{
|
||||
location.add(0, -1, 0);
|
||||
}
|
||||
|
||||
if (location.getBlockY() > 0 && location.getBlock().getType() != Material.AIR)
|
||||
{
|
||||
return location;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Place(BlockPlaceEvent event)
|
||||
{
|
||||
if(event.getBlock().getRelative(BlockFace.DOWN).getType() == Material.ICE
|
||||
|| event.getBlock().getRelative(BlockFace.DOWN).getType() == Material.PACKED_ICE
|
||||
|| event.getBlock().getRelative(BlockFace.DOWN).getType() == Material.FENCE)
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cant place a Barrier here!"));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler
|
||||
public void ScoreboardUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
Scoreboard.Reset();
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
if(GetPlayers(true).size() <= 8)
|
||||
{
|
||||
for (GameTeam team : this.GetTeamList())
|
||||
{
|
||||
if (!team.IsTeamAlive())
|
||||
continue;
|
||||
|
||||
for(Player player : team.GetPlayers(true))
|
||||
{
|
||||
Scoreboard.Write(team.GetColor() + player.getName());
|
||||
}
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (GameTeam team : this.GetTeamList())
|
||||
{
|
||||
Scoreboard.Write(team.GetColor() + C.Bold + team.GetName());
|
||||
Scoreboard.Write(team.GetColor() + "Alive " + team.GetPlayers(true).size());
|
||||
Scoreboard.WriteBlank();
|
||||
}
|
||||
}
|
||||
|
||||
long time = 1000 * 195 - (System.currentTimeMillis() - this.GetStateTime());
|
||||
|
||||
if (time > 0)
|
||||
{
|
||||
Scoreboard.Write(C.cYellow + C.Bold + "Meteoroids:");
|
||||
if(IsLive())
|
||||
Scoreboard.Write(UtilTime.MakeStr(time, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
Scoreboard.Write(C.cGold + C.Bold + "Meteoroids!");
|
||||
}
|
||||
|
||||
Scoreboard.Draw();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,140 @@
|
||||
package nautilus.game.arcade.game.games.snowfight.kits;
|
||||
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Egg;
|
||||
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.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.PotionSplashEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||
import org.bukkit.potion.Potion;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.potion.PotionType;
|
||||
|
||||
public class KitMedic extends Kit
|
||||
{
|
||||
|
||||
public KitMedic(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Medic", KitAvailability.Free,
|
||||
|
||||
new String[]
|
||||
{
|
||||
"To the rescue...!",
|
||||
" ",
|
||||
"Gets 1 Snowball every second tile.",
|
||||
"Left-Click Snow to pick up Snowballs (Max. 16)",
|
||||
"Right-Click Snowballs to throw them.",
|
||||
" ",
|
||||
"Gets 1 Healing Potion every 32 seconds [max. 1]",
|
||||
"Slowness II when hit.",
|
||||
" ",
|
||||
"Supports all nearby allies with REGENERATION."
|
||||
},
|
||||
|
||||
new Perk[]
|
||||
{
|
||||
},
|
||||
EntityType.SKELETON,
|
||||
new ItemStack(Material.POTION));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void SpawnCustom(LivingEntity ent)
|
||||
{
|
||||
ent.getEquipment().setHelmet(new ItemStack(Material.LEATHER_HELMET));
|
||||
ent.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE));
|
||||
ent.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));
|
||||
ent.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Aura(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
for (Player player : Manager.GetGame().GetPlayers(true))
|
||||
{
|
||||
if (!HasKit(player))
|
||||
continue;
|
||||
|
||||
for (Player other : Manager.GetGame().GetPlayers(true))
|
||||
{
|
||||
if (other.equals(player))
|
||||
continue;
|
||||
|
||||
if (UtilMath.offset(player, other) > 4)
|
||||
continue;
|
||||
|
||||
if( Manager.GetGame().GetTeam(player).equals(Manager.GetGame().GetTeam(other)))
|
||||
Manager.GetCondition().Factory().Regen("Aura", other, player, 1.9, 0, false, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void KitItems(UpdateEvent event)
|
||||
{
|
||||
if(!Manager.GetGame().IsLive())
|
||||
return;
|
||||
|
||||
if (event.getType() == UpdateType.SLOWEST)
|
||||
{
|
||||
for (Player player : Manager.GetGame().GetPlayers(true))
|
||||
{
|
||||
if (!HasKit(player))
|
||||
continue;
|
||||
|
||||
Potion potion = new Potion(PotionType.INSTANT_HEAL);
|
||||
potion.setSplash(true);
|
||||
player.getInventory().setItem(1, potion.toItemStack(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Splash(PotionSplashEvent event)
|
||||
{
|
||||
if(event.getEntity().getShooter() instanceof Player)
|
||||
{
|
||||
if(!HasKit((Player) event.getEntity().getShooter()))
|
||||
return;
|
||||
|
||||
for(Entity entity : event.getAffectedEntities())
|
||||
{
|
||||
if(entity instanceof Player)
|
||||
{
|
||||
Manager.GetCondition().Factory().Slow("Heal Potion", (Player)entity, (Player)event.getEntity().getShooter(), 5.0, 1, false, false, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
package nautilus.game.arcade.game.games.snowfight.kits;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.PerkFallDamage;
|
||||
|
||||
public class KitSportsman extends Kit
|
||||
{
|
||||
|
||||
public KitSportsman(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Sportsman", KitAvailability.Free,
|
||||
|
||||
new String[]
|
||||
{
|
||||
"Trained to be the fastest on snow and ice.",
|
||||
"",
|
||||
"Gets 1 Snowball every tile",
|
||||
"Left-Click Snow to pick up Snowballs (Max. 16)",
|
||||
"Right-Click Snowballs to throw them.",
|
||||
"",
|
||||
"Supports all nearby allies with SPEED."
|
||||
},
|
||||
|
||||
new Perk[]
|
||||
{
|
||||
new PerkFallDamage(3)
|
||||
},
|
||||
EntityType.SKELETON,
|
||||
new ItemStack(Material.SNOW_BALL));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void SpawnCustom(LivingEntity ent)
|
||||
{
|
||||
ent.getEquipment().setHelmet(new ItemStack(Material.LEATHER_HELMET));
|
||||
ent.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE));
|
||||
ent.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));
|
||||
ent.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Aura(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
for (Player player : Manager.GetGame().GetPlayers(true))
|
||||
{
|
||||
if (!HasKit(player))
|
||||
continue;
|
||||
|
||||
for (Player other : Manager.GetGame().GetPlayers(true))
|
||||
{
|
||||
if (other.equals(player))
|
||||
continue;
|
||||
|
||||
if (UtilMath.offset(player, other) > 4)
|
||||
continue;
|
||||
|
||||
if( Manager.GetGame().GetTeam(player).equals(Manager.GetGame().GetTeam(other)))
|
||||
Manager.GetCondition().Factory().Speed("Aura", other, player, 1.9, 0, false, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,118 @@
|
||||
package nautilus.game.arcade.game.games.snowfight.kits;
|
||||
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.PerkFallDamage;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||
import org.bukkit.potion.PotionType;
|
||||
|
||||
public class KitTactician extends Kit
|
||||
{
|
||||
|
||||
public KitTactician(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Tactician", KitAvailability.Free,
|
||||
new String[]
|
||||
{
|
||||
"No Snowfight is complete without a tactical game!",
|
||||
" ",
|
||||
"Gets 1 Snowball every second tile.",
|
||||
"Left-Click Snow to pick up Snowballs (Max. 16)",
|
||||
"Right-Click Snowballs to throw them.",
|
||||
" ",
|
||||
"Gets 1 Barrier every 32 seconds [max. 2]",
|
||||
"Place Barriers to improve your defense.",
|
||||
"You cant place Barriers above Ice, Packed Ice or Fences.",
|
||||
" ",
|
||||
"Supports all nearby allies with RESISTANCE."
|
||||
}, new Perk[]
|
||||
{
|
||||
},
|
||||
EntityType.SKELETON,
|
||||
new ItemStack(Material.FENCE));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
player.getInventory().setItem(7, ItemStackFactory.Instance.CreateStack(Material.COMPASS.getId(), (byte) 0, 1, "§a§lTracking Compass"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void SpawnCustom(LivingEntity ent)
|
||||
{
|
||||
ent.getEquipment().setHelmet(new ItemStack(Material.LEATHER_HELMET));
|
||||
ent.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE));
|
||||
ent.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));
|
||||
ent.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Aura(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
for (Player player : Manager.GetGame().GetPlayers(true))
|
||||
{
|
||||
if (!HasKit(player))
|
||||
continue;
|
||||
|
||||
for (Player other : Manager.GetGame().GetPlayers(true))
|
||||
{
|
||||
if (other.equals(player))
|
||||
continue;
|
||||
|
||||
if (UtilMath.offset(player, other) > 4)
|
||||
continue;
|
||||
|
||||
if( Manager.GetGame().GetTeam(player).equals(Manager.GetGame().GetTeam(other)))
|
||||
Manager.GetCondition().Factory().Protection("Aura", other, player, 1.9, 0, false, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void KitItems(UpdateEvent event)
|
||||
{
|
||||
if(!Manager.GetGame().IsLive())
|
||||
return;
|
||||
|
||||
if (event.getType() == UpdateType.SLOWEST)
|
||||
{
|
||||
for (Player player : Manager.GetGame().GetPlayers(true))
|
||||
{
|
||||
if (!HasKit(player))
|
||||
continue;
|
||||
|
||||
int amount = 0;
|
||||
if (player.getInventory().getItem(1) != null && UtilInv.contains(player, Material.FENCE, (byte) 0, 1))
|
||||
amount = 2;
|
||||
else
|
||||
amount = 1;
|
||||
player.getInventory().setItem(1, ItemStackFactory.Instance.CreateStack(Material.FENCE, (byte) 0, amount, "Barrier"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -48,7 +48,6 @@ public class SquidShooter extends SoloGame
|
||||
this.DamageSelf = false;
|
||||
this.DamageTeamSelf = true;
|
||||
this.PrepareFreeze = false;
|
||||
this.SpawnDistanceRequirement = 16;
|
||||
this.CompassEnabled = true;
|
||||
this.KitRegisterState = GameState.Prepare;
|
||||
}
|
||||
|
@ -0,0 +1,181 @@
|
||||
package nautilus.game.arcade.game.games.survivalgames;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
public class SoloSurvivalGames extends SurvivalGames
|
||||
{
|
||||
|
||||
private GameTeam _players;
|
||||
|
||||
public SoloSurvivalGames(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.SurvivalGames,
|
||||
new String[]
|
||||
{
|
||||
"Search for chests to find loot",
|
||||
|
||||
"Slaughter your opponents",
|
||||
|
||||
"Stay away from the borders!",
|
||||
|
||||
"Last tribute alive wins!"
|
||||
});
|
||||
|
||||
this.DamageTeamSelf = true;
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void CustomTeamGeneration(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
_players = GetTeamList().get(0);
|
||||
_players.SetColor(ChatColor.YELLOW);
|
||||
_players.SetName("Players");
|
||||
_players.setDisplayName(C.cYellow + C.Bold + "Players");
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler
|
||||
public void ScoreboardUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
if (GetTeamList().isEmpty())
|
||||
return;
|
||||
|
||||
Scoreboard.Reset();
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
|
||||
GameTeam team = GetTeamList().get(0);
|
||||
|
||||
Scoreboard.Write(C.cGreen + C.Bold + "Time");
|
||||
Scoreboard.Write(UtilTime.convertString(this.getSecondsSinceStart() * 1000, 0, TimeUnit.FIT));
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
|
||||
Scoreboard.Write(C.cYellow + C.Bold + "Tributes");
|
||||
if (team.GetPlayers(true).size() > 7)
|
||||
{
|
||||
Scoreboard.Write("" + team.GetPlayers(true).size());
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Player player : team.GetPlayers(true))
|
||||
{
|
||||
Scoreboard.Write(C.cWhite + player.getName());
|
||||
}
|
||||
}
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
|
||||
if (this.getChestRefillTime() > 0 && this.getDeathMatchTime() > 60)
|
||||
{
|
||||
Scoreboard.Write(C.cGold + C.Bold + "Chest Refill");
|
||||
Scoreboard.Write(UtilTime.convertString(this.getChestRefillTime() * 1000, 0, TimeUnit.FIT));
|
||||
}
|
||||
else if (this.getDeathMatchTime() > 0)
|
||||
{
|
||||
Scoreboard.Write(C.cRed + C.Bold + "Deathmatch");
|
||||
Scoreboard.Write(UtilTime.convertString(
|
||||
Math.min(this.getDeathMatchTime(), this.isDeathMatchTeleported() ? 10 : this.getDeathMatchTime()) * 1000, 0, TimeUnit.FIT));
|
||||
}
|
||||
else
|
||||
{
|
||||
Scoreboard.Write(C.cRed + C.Bold + "Game End");
|
||||
Scoreboard.Write(UtilTime.convertString(Math.max(0, this.getGameEndTime()) * 1000, 0, TimeUnit.FIT));
|
||||
}
|
||||
|
||||
Scoreboard.Draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void EndCheck()
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (GetPlayers(true).size() <= 1)
|
||||
{
|
||||
ArrayList<Player> places = GetTeamList().get(0).GetPlacements(true);
|
||||
|
||||
//Announce
|
||||
AnnounceEnd(places);
|
||||
|
||||
//Gems
|
||||
if (places.size() >= 1)
|
||||
AddGems(places.get(0), 20, "1st Place", false, false);
|
||||
|
||||
if (places.size() >= 2)
|
||||
AddGems(places.get(1), 15, "2nd Place", false, false);
|
||||
|
||||
if (places.size() >= 3)
|
||||
AddGems(places.get(2), 10, "3rd Place", false, false);
|
||||
|
||||
for (Player player : GetPlayers(false))
|
||||
if (player.isOnline())
|
||||
AddGems(player, 10, "Participation", false, false);
|
||||
|
||||
//End
|
||||
SetState(GameState.End);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Player> getWinners()
|
||||
{
|
||||
if (GetState().ordinal() >= GameState.End.ordinal())
|
||||
{
|
||||
List<Player> places = GetTeamList().get(0).GetPlacements(true);
|
||||
|
||||
if (places.isEmpty() || !places.get(0).isOnline())
|
||||
return Arrays.asList();
|
||||
else
|
||||
return Arrays.asList(places.get(0));
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Player> getLosers()
|
||||
{
|
||||
List<Player> winners = getWinners();
|
||||
|
||||
if (winners == null)
|
||||
return null;
|
||||
|
||||
List<Player> losers = GetTeamList().get(0).GetPlayers(false);
|
||||
|
||||
losers.removeAll(winners);
|
||||
|
||||
return losers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetMode()
|
||||
{
|
||||
return "Solo Mode";
|
||||
}
|
||||
}
|
@ -114,7 +114,7 @@ import net.minecraft.server.v1_7_R4.TileEntityChest;
|
||||
import net.minecraft.server.v1_7_R4.WorldServer;
|
||||
import net.minecraft.util.com.mojang.authlib.GameProfile;
|
||||
|
||||
public class SurvivalGames extends SoloGame
|
||||
public abstract class SurvivalGames extends Game
|
||||
{
|
||||
// Chest loot
|
||||
private ChestLoot _baseLoot = new ChestLoot(true);
|
||||
@ -168,9 +168,9 @@ public class SurvivalGames extends SoloGame
|
||||
*/
|
||||
private Field _ticksField;
|
||||
|
||||
public SurvivalGames(ArcadeManager manager)
|
||||
public SurvivalGames(ArcadeManager manager, GameType type, String[] description)
|
||||
{
|
||||
super(manager, GameType.SurvivalGames,
|
||||
super(manager, type,
|
||||
|
||||
new Kit[]
|
||||
{
|
||||
@ -195,18 +195,7 @@ public class SurvivalGames extends SoloGame
|
||||
new KitBarbarian(manager),
|
||||
|
||||
new KitHorseman(manager),
|
||||
},
|
||||
|
||||
new String[]
|
||||
{
|
||||
"Search for chests to find loot",
|
||||
|
||||
"Slaughter your opponents",
|
||||
|
||||
"Stay away from the borders!",
|
||||
|
||||
"Last tribute alive wins!"
|
||||
});
|
||||
}, description);
|
||||
|
||||
_help = new String[]
|
||||
{
|
||||
@ -220,6 +209,10 @@ public class SurvivalGames extends SoloGame
|
||||
// Manager.GetAntiStack().SetEnabled(false);
|
||||
|
||||
StrictAntiHack = true;
|
||||
|
||||
HideTeamSheep = true;
|
||||
|
||||
this.ReplaceTeamsWithKits = true;
|
||||
|
||||
GameTimeout = 1500000;
|
||||
|
||||
@ -227,9 +220,7 @@ public class SurvivalGames extends SoloGame
|
||||
|
||||
WorldTimeSet = 0;
|
||||
WorldBoundaryKill = false;
|
||||
|
||||
SpawnDistanceRequirement = 48;
|
||||
|
||||
|
||||
DamageSelf = true;
|
||||
DamageTeamSelf = true;
|
||||
|
||||
@ -757,7 +748,8 @@ public class SurvivalGames extends SoloGame
|
||||
WorldTimeSet = 0;
|
||||
WorldData.World.setTime(15000);
|
||||
|
||||
GetTeamList().get(0).SpawnTeleport(false);
|
||||
for (GameTeam team : GetTeamList())
|
||||
team.SpawnTeleport(false);
|
||||
|
||||
_borderPositions.clear();
|
||||
|
||||
@ -1683,62 +1675,6 @@ public class SurvivalGames extends SoloGame
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler
|
||||
public void ScoreboardUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
if (GetTeamList().isEmpty())
|
||||
return;
|
||||
|
||||
Scoreboard.Reset();
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
|
||||
GameTeam team = GetTeamList().get(0);
|
||||
|
||||
Scoreboard.Write(C.cGreen + C.Bold + "Time");
|
||||
Scoreboard.Write(UtilTime.convertString(_secondsSinceStart * 1000, 0, TimeUnit.FIT));
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
|
||||
Scoreboard.Write(C.cYellow + C.Bold + "Tributes");
|
||||
if (team.GetPlayers(true).size() > 7)
|
||||
{
|
||||
Scoreboard.Write("" + team.GetPlayers(true).size());
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Player player : team.GetPlayers(true))
|
||||
{
|
||||
Scoreboard.Write(C.cWhite + player.getName());
|
||||
}
|
||||
}
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
|
||||
if (_chestRefillTime > 0 && _deathMatchTime > 60)
|
||||
{
|
||||
Scoreboard.Write(C.cGold + C.Bold + "Chest Refill");
|
||||
Scoreboard.Write(UtilTime.convertString(_chestRefillTime * 1000, 0, TimeUnit.FIT));
|
||||
}
|
||||
else if (_deathMatchTime > 0)
|
||||
{
|
||||
Scoreboard.Write(C.cRed + C.Bold + "Deathmatch");
|
||||
Scoreboard.Write(UtilTime.convertString(
|
||||
Math.min(_deathMatchTime, _deathMatchTeleported ? 10 : _deathMatchTime) * 1000, 0, TimeUnit.FIT));
|
||||
}
|
||||
else
|
||||
{
|
||||
Scoreboard.Write(C.cRed + C.Bold + "Game End");
|
||||
Scoreboard.Write(UtilTime.convertString(Math.max(0, _gameEndTime) * 1000, 0, TimeUnit.FIT));
|
||||
}
|
||||
|
||||
Scoreboard.Draw();
|
||||
}
|
||||
|
||||
private void setBorder()
|
||||
{
|
||||
_borderStartedMoving = System.currentTimeMillis();
|
||||
@ -2295,4 +2231,30 @@ public class SurvivalGames extends SoloGame
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getSecondsSinceStart()
|
||||
{
|
||||
return this._secondsSinceStart;
|
||||
}
|
||||
|
||||
public int getChestRefillTime()
|
||||
{
|
||||
return this._chestRefillTime;
|
||||
}
|
||||
|
||||
public int getDeathMatchTime()
|
||||
{
|
||||
return this._deathMatchTime;
|
||||
}
|
||||
|
||||
public boolean isDeathMatchTeleported()
|
||||
{
|
||||
return this._deathMatchTeleported;
|
||||
}
|
||||
|
||||
public int getGameEndTime()
|
||||
{
|
||||
return this._gameEndTime;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,38 +7,6 @@ import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.Chest;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.ItemFrame;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Snowball;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockBurnEvent;
|
||||
import org.bukkit.event.block.BlockFadeEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.block.BlockSpreadEvent;
|
||||
import org.bukkit.event.block.LeavesDecayEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||
import org.bukkit.event.entity.ItemSpawnEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.hanging.HangingBreakEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.MapUtil;
|
||||
@ -52,9 +20,9 @@ import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
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.UtilTime;
|
||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
@ -72,9 +40,56 @@ import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.TeamGame;
|
||||
import nautilus.game.arcade.game.games.survivalgames.kit.*;
|
||||
import nautilus.game.arcade.game.games.survivalgames.kit.KitArcher;
|
||||
import nautilus.game.arcade.game.games.survivalgames.kit.KitAssassin;
|
||||
import nautilus.game.arcade.game.games.survivalgames.kit.KitAxeman;
|
||||
import nautilus.game.arcade.game.games.survivalgames.kit.KitBeastmaster;
|
||||
import nautilus.game.arcade.game.games.survivalgames.kit.KitBomber;
|
||||
import nautilus.game.arcade.game.games.survivalgames.kit.KitBrawler;
|
||||
import nautilus.game.arcade.game.games.survivalgames.kit.KitHorseman;
|
||||
import nautilus.game.arcade.game.games.survivalgames.kit.KitKnight;
|
||||
import nautilus.game.arcade.game.games.survivalgames.kit.KitLooter;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
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.block.Chest;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.ItemFrame;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Snowball;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockBurnEvent;
|
||||
import org.bukkit.event.block.BlockFadeEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.block.BlockSpreadEvent;
|
||||
import org.bukkit.event.block.LeavesDecayEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||
import org.bukkit.event.entity.ItemSpawnEvent;
|
||||
import org.bukkit.event.hanging.HangingBreakEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class SurvivalGamesTeams extends TeamGame
|
||||
{
|
||||
private HashSet<Location> _openedChest = new HashSet<Location>();
|
||||
@ -114,7 +129,7 @@ public class SurvivalGamesTeams extends TeamGame
|
||||
|
||||
public SurvivalGamesTeams(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.SurvivalGamesTeams,
|
||||
super(manager, GameType.SurvivalGames,
|
||||
|
||||
new Kit[]
|
||||
{
|
||||
@ -161,8 +176,9 @@ public class SurvivalGamesTeams extends TeamGame
|
||||
this.WorldTimeSet = 0;
|
||||
this.WorldBoundaryKill = false;
|
||||
|
||||
this.SpawnDistanceRequirement = 48;
|
||||
|
||||
SpawnNearAllies = true;
|
||||
SpawnNearEnemies = true; //This is to ensure theres no 'gaps' of 1 between teams, hence forcing a team to get split.
|
||||
|
||||
this.DamageSelf = true;
|
||||
this.DamageTeamSelf = false;
|
||||
|
||||
|
@ -0,0 +1,446 @@
|
||||
package nautilus.game.arcade.game.games.survivalgames;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
public class TeamSurvivalGames extends SurvivalGames
|
||||
{
|
||||
|
||||
public boolean ForceTeamSize = true;
|
||||
public int PlayersPerTeam = 2;
|
||||
public int TeamCount = 0;
|
||||
|
||||
private NautHashMap<Player, Player> _teamReqs = new NautHashMap<Player, Player>();
|
||||
|
||||
public TeamSurvivalGames(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.SurvivalGamesTeams,
|
||||
new String[]
|
||||
{
|
||||
"Search for chests to find loot",
|
||||
"Slaughter your opponents",
|
||||
"Stay away from the Deep Freeze!",
|
||||
"Last team alive wins!"
|
||||
});
|
||||
|
||||
this.PlayersPerTeam = 2;
|
||||
this.FillTeamsInOrderToCount = 2;
|
||||
|
||||
this.SpawnNearAllies = true;
|
||||
this.SpawnNearEnemies = true;
|
||||
|
||||
this.DamageTeamSelf = false;
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void CustomTeamGeneration(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
ArrayList<Location> spawns = this.GetTeamList().get(0).GetSpawns();
|
||||
this.GetTeamList().clear();
|
||||
|
||||
TeamColors color = TeamColors.DARK_AQUA;
|
||||
|
||||
if(!this.ForceTeamSize)
|
||||
{
|
||||
for(int i = 1; i <= this.TeamCount; i++)
|
||||
{
|
||||
color = getNextColor(color);
|
||||
GameTeam team = new GameTeam(this, String.valueOf(i), color.getColor(), spawns);
|
||||
team.SetVisible(true);
|
||||
GetTeamList().add(team);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(int i = 1; i <= Manager.GetPlayerFull() / this.PlayersPerTeam; i++)
|
||||
{
|
||||
//Got Spawns
|
||||
color = getNextColor(color);
|
||||
int e = 0;
|
||||
for(GameTeam teams : GetTeamList())
|
||||
{
|
||||
if(teams.GetColor() == color.getColor())
|
||||
{
|
||||
e++;
|
||||
if(getColorName(color.getColor()).length <= e)
|
||||
{
|
||||
e = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
GameTeam team = new GameTeam(this, getColorName(color.getColor())[e], color.getColor(), spawns, true);
|
||||
team.SetVisible(true);
|
||||
GetTeamList().add(team);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private enum TeamColors
|
||||
{
|
||||
|
||||
YELLOW(ChatColor.YELLOW, new String[]{"Banana", "Sunshine", "Custard", "Sponge", "Star", "Giraffe", "Lego", "Light"}),
|
||||
GREEN(ChatColor.GREEN, new String[]{"Creepers", "Alien", "Seaweed", "Emerald", "Grinch", "Shrub", "Snake", "Leaf"}),
|
||||
AQUA(ChatColor.AQUA, new String[]{"Diamond", "Ice", "Pool", "Kraken", "Aquatic", "Ocean"}),
|
||||
RED(ChatColor.RED, new String[]{"Heart", "Tomato", "Ruby", "Jam", "Rose", "Apple", "TNT"}),
|
||||
GOLD(ChatColor.GOLD, new String[]{"Mango", "Foxes", "Sunset", "Nuggets", "Lion", "Desert", "Gapple"}),
|
||||
LIGHT_PURPLE(ChatColor.LIGHT_PURPLE, new String[]{"Dream", "Cupcake", "Cake", "Candy", "Unicorn"}),
|
||||
DARK_BLUE(ChatColor.DARK_BLUE, new String[]{"Squid", "Lapis", "Sharks", "Galaxy", "Empoleon"}),
|
||||
DARK_RED(ChatColor.DARK_RED, new String[]{"Rose", "Apple", "Twizzler", "Rocket", "Blood"}),
|
||||
WHITE(ChatColor.WHITE, new String[]{"Ghosts", "Spookies", "Popcorn", "Seagull", "Rice", "Snowman", "Artic"}),
|
||||
BLUE(ChatColor.BLUE, new String[]{"Sky", "Whale", "Lake", "Birds", "Bluebird", "Piplup"}),
|
||||
DARK_GREEN(ChatColor.DARK_GREEN, new String[]{"Forest", "Zombies", "Cactus", "Slime", "Toxic", "Poison"}),
|
||||
DARK_PURPLE(ChatColor.DARK_PURPLE, new String[]{"Amethyst", "Slugs", "Grape", "Witch", "Magic", "Zula"}),
|
||||
DARK_AQUA(ChatColor.DARK_AQUA, new String[]{"Snorlax", "Aquatic", "Clam", "Fish"});
|
||||
|
||||
private ChatColor color;
|
||||
private String[] names;
|
||||
|
||||
private TeamColors(ChatColor color, String[] names)
|
||||
{
|
||||
this.color = color;
|
||||
this.names = names;
|
||||
}
|
||||
|
||||
public ChatColor getColor()
|
||||
{
|
||||
return color;
|
||||
}
|
||||
|
||||
public String[] getNames()
|
||||
{
|
||||
return names;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private String[] getColorName(ChatColor color)
|
||||
{
|
||||
for(TeamColors colors : TeamColors.values())
|
||||
{
|
||||
if(colors.getColor() == color)
|
||||
{
|
||||
return colors.getNames();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private TeamColors getNextColor(TeamColors color)
|
||||
{
|
||||
for(TeamColors colors : TeamColors.values()) {
|
||||
if(colors.ordinal() == color.ordinal() + 1)
|
||||
{
|
||||
return colors;
|
||||
}
|
||||
}
|
||||
return TeamColors.YELLOW;
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler
|
||||
public void ScoreboardUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
if (GetTeamList().isEmpty())
|
||||
return;
|
||||
|
||||
Scoreboard.Reset();
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
|
||||
Scoreboard.Write(C.cGreen + C.Bold + "Time");
|
||||
Scoreboard.Write(UtilTime.convertString(this.getSecondsSinceStart() * 1000, 0, TimeUnit.FIT));
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(C.cYellow + C.Bold + "Teams");
|
||||
|
||||
ArrayList<GameTeam> alive = new ArrayList<GameTeam>();
|
||||
for (GameTeam team : GetTeamList())
|
||||
{
|
||||
if (team.IsTeamAlive())
|
||||
alive.add(team);
|
||||
}
|
||||
|
||||
if (GetPlayers(true).size() <= 7)
|
||||
{
|
||||
for (GameTeam team : GetTeamList())
|
||||
{
|
||||
for (Player player : team.GetPlayers(true))
|
||||
{
|
||||
Scoreboard.Write(team.GetColor() + player.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (alive.size() <= 7)
|
||||
{
|
||||
for (GameTeam team : alive)
|
||||
{
|
||||
Scoreboard.Write(C.cWhite + team.GetPlayers(true).size() + " " + team.GetColor() + team.GetName());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Scoreboard.Write(C.cWhite + alive.size() + " Alive");
|
||||
}
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
|
||||
if (this.getChestRefillTime() > 0 && this.getDeathMatchTime() > 60)
|
||||
{
|
||||
Scoreboard.Write(C.cGold + C.Bold + "Chest Refill");
|
||||
Scoreboard.Write(UtilTime.convertString(this.getChestRefillTime() * 1000, 0, TimeUnit.FIT));
|
||||
}
|
||||
else if (this.getDeathMatchTime() > 0)
|
||||
{
|
||||
Scoreboard.Write(C.cRed + C.Bold + "Deathmatch");
|
||||
Scoreboard.Write(UtilTime.convertString(
|
||||
Math.min(this.getDeathMatchTime(), this.isDeathMatchTeleported() ? 10 : this.getDeathMatchTime()) * 1000, 0, TimeUnit.FIT));
|
||||
}
|
||||
else
|
||||
{
|
||||
Scoreboard.Write(C.cRed + C.Bold + "Game End");
|
||||
Scoreboard.Write(UtilTime.convertString(Math.max(0, this.getGameEndTime()) * 1000, 0, TimeUnit.FIT));
|
||||
}
|
||||
|
||||
Scoreboard.Draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void EndCheck()
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
ArrayList<GameTeam> teamsAlive = new ArrayList<GameTeam>();
|
||||
|
||||
for (GameTeam team : this.GetTeamList())
|
||||
if (team.GetPlayers(true).size() > 0)
|
||||
teamsAlive.add(team);
|
||||
|
||||
if (teamsAlive.size() <= 1)
|
||||
{
|
||||
//Announce
|
||||
if (teamsAlive.size() > 0)
|
||||
AnnounceEnd(teamsAlive.get(0));
|
||||
|
||||
for (GameTeam team : GetTeamList())
|
||||
{
|
||||
if (WinnerTeam != null && team.equals(WinnerTeam))
|
||||
{
|
||||
for (Player player : team.GetPlayers(false))
|
||||
AddGems(player, 10, "Winning Team", false, false);
|
||||
}
|
||||
|
||||
for (Player player : team.GetPlayers(false))
|
||||
if (player.isOnline())
|
||||
AddGems(player, 10, "Participation", false, false);
|
||||
}
|
||||
|
||||
//End
|
||||
SetState(GameState.End);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Player> getWinners()
|
||||
{
|
||||
if (WinnerTeam == null)
|
||||
return null;
|
||||
|
||||
return WinnerTeam.GetPlayers(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Player> getLosers()
|
||||
{
|
||||
if (WinnerTeam == null)
|
||||
return null;
|
||||
|
||||
List<Player> players = new ArrayList<>();
|
||||
|
||||
for (GameTeam team : GetTeamList())
|
||||
{
|
||||
if (team != WinnerTeam)
|
||||
players.addAll(team.GetPlayers(false));
|
||||
}
|
||||
|
||||
return players;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean CanJoinTeam(GameTeam team)
|
||||
{
|
||||
return team.GetSize() < PlayersPerTeam;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void teamSelectInteract(PlayerInteractEntityEvent event)
|
||||
{
|
||||
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 (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 (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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetMode()
|
||||
{
|
||||
return "Team Mode";
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,36 @@
|
||||
package nautilus.game.arcade.game.games.wither.events;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
public class HumanReviveEvent extends PlayerEvent
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
private final Player _revivedPlayer;
|
||||
|
||||
public HumanReviveEvent(Player who, Player revivedPlayer)
|
||||
{
|
||||
super(who);
|
||||
|
||||
_revivedPlayer = revivedPlayer;
|
||||
}
|
||||
|
||||
public Player getRevivedPlayer()
|
||||
{
|
||||
return _revivedPlayer;
|
||||
}
|
||||
|
||||
}
|
@ -24,22 +24,20 @@ public class KitHumanArcher extends Kit
|
||||
{
|
||||
public KitHumanArcher(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Human Archer", KitAvailability.Free,
|
||||
super(manager, "Human Archer", KitAvailability.Free,
|
||||
|
||||
new String[]
|
||||
{
|
||||
""
|
||||
},
|
||||
new String[]
|
||||
{
|
||||
""
|
||||
},
|
||||
|
||||
new Perk[]
|
||||
{
|
||||
new Perk[]
|
||||
{
|
||||
new PerkDoubleJump("Double Jump", 1.2, 1, true, 4000, true),
|
||||
new PerkWitherArrowBlind(6),
|
||||
new PerkFletcher(4, 4, true),
|
||||
|
||||
},
|
||||
EntityType.ZOMBIE,
|
||||
null);
|
||||
|
||||
}, EntityType.ZOMBIE, null);
|
||||
|
||||
}
|
||||
|
||||
@ -48,20 +46,20 @@ public class KitHumanArcher extends Kit
|
||||
{
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW));
|
||||
|
||||
ItemStack potion = new ItemStack(Material.POTION, 2, (short)16429); // 16422
|
||||
PotionMeta potionMeta = (PotionMeta)potion.getItemMeta();
|
||||
|
||||
ItemStack potion = new ItemStack(Material.POTION, 2, (short) 16429); // 16422
|
||||
PotionMeta potionMeta = (PotionMeta) potion.getItemMeta();
|
||||
potionMeta.setDisplayName(ChatColor.RESET + "Revival Potion");
|
||||
potion.setItemMeta(potionMeta);
|
||||
player.getInventory().addItem(potion);
|
||||
|
||||
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void SpawnCustom(LivingEntity ent)
|
||||
public void SpawnCustom(LivingEntity ent)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,50 @@
|
||||
package nautilus.game.arcade.game.games.wither.kit;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
|
||||
public class KitHumanEditor extends Kit
|
||||
{
|
||||
public KitHumanEditor(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Human Editor", KitAvailability.Gem, 5000,
|
||||
new String[]
|
||||
{
|
||||
" ", "Can " + C.cYellow + "Edit " + C.cGray + "the terrain to they and their comrade's benefits", " "
|
||||
},
|
||||
new Perk[]
|
||||
{
|
||||
new PerkDoubleJump("Double Jump", 1, 0.8, true, 6000, true),
|
||||
},
|
||||
EntityType.ZOMBIE, new ItemStack(Material.STONE_PICKAXE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_AXE));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_PICKAXE));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_SPADE));
|
||||
|
||||
ItemStack potion = new ItemStack(Material.POTION, 2, (short) 16429); // 16422
|
||||
PotionMeta potionMeta = (PotionMeta) potion.getItemMeta();
|
||||
potionMeta.setDisplayName(ChatColor.RESET + "Revival Potion");
|
||||
potion.setItemMeta(potionMeta);
|
||||
player.getInventory().addItem(potion);
|
||||
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
}
|
||||
}
|
@ -18,12 +18,13 @@ import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.PerkBlockRestorer;
|
||||
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
|
||||
import nautilus.game.arcade.kit.perks.PerkIronShell;
|
||||
import nautilus.game.arcade.kit.perks.PerkWitherMedicRefill;
|
||||
|
||||
public class KitHumanBuilder extends Kit
|
||||
public class KitHumanMedic extends Kit
|
||||
{
|
||||
public KitHumanBuilder(ArcadeManager manager)
|
||||
public KitHumanMedic(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Human Builder", KitAvailability.Free,
|
||||
super(manager, "Human Medic", KitAvailability.Gem, 2000,
|
||||
|
||||
new String[]
|
||||
{
|
||||
@ -33,7 +34,7 @@ public class KitHumanBuilder extends Kit
|
||||
new Perk[]
|
||||
{
|
||||
new PerkDoubleJump("Double Jump", 1, 0.8, true, 6000, true),
|
||||
new PerkIronShell(),
|
||||
new PerkWitherMedicRefill(45, 1),
|
||||
new PerkBlockRestorer()
|
||||
},
|
||||
EntityType.ZOMBIE,
|
||||
@ -45,7 +46,9 @@ public class KitHumanBuilder extends Kit
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE));
|
||||
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
|
||||
ItemStack potion = new ItemStack(Material.POTION, 2, (short)16429); // 16422
|
||||
PotionMeta potionMeta = (PotionMeta)potion.getItemMeta();
|
||||
@ -53,8 +56,6 @@ public class KitHumanBuilder extends Kit
|
||||
potion.setItemMeta(potionMeta);
|
||||
player.getInventory().addItem(potion);
|
||||
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
}
|
||||
|
||||
@Override
|
@ -26,57 +26,60 @@ public class KitWitherMinion extends Kit
|
||||
{
|
||||
public KitWitherMinion(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Wither", KitAvailability.Free,
|
||||
super(manager, "Wither", KitAvailability.Free,
|
||||
|
||||
new String[]
|
||||
{
|
||||
""
|
||||
},
|
||||
new String[]
|
||||
{
|
||||
""
|
||||
},
|
||||
|
||||
new Perk[]
|
||||
{
|
||||
new PerkWitherArrows(),
|
||||
new PerkWitherAttack(),
|
||||
new PerkWitherMinion()
|
||||
},
|
||||
EntityType.WITHER,
|
||||
null);
|
||||
new Perk[]
|
||||
{
|
||||
new PerkWitherArrows(), new PerkWitherAttack(),
|
||||
new PerkWitherMinion(), new PerkWitherCompassScent()
|
||||
}, EntityType.WITHER, null);
|
||||
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void SpawnCustom(LivingEntity ent)
|
||||
// {
|
||||
// ent.setMaxHealth(300);
|
||||
// ent.setHealth(300);
|
||||
//
|
||||
// DisguiseWither disguise = new DisguiseWither(ent);
|
||||
// disguise.SetName(C.cYellow + "Wither");
|
||||
// disguise.SetCustomNameVisible(true);
|
||||
// Manager.GetDisguise().disguise(disguise);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// @Override
|
||||
// public void SpawnCustom(LivingEntity ent)
|
||||
// {
|
||||
// ent.setMaxHealth(300);
|
||||
// ent.setHealth(300);
|
||||
//
|
||||
// DisguiseWither disguise = new DisguiseWither(ent);
|
||||
// disguise.SetName(C.cYellow + "Wither");
|
||||
// disguise.SetCustomNameVisible(true);
|
||||
// Manager.GetDisguise().disguise(disguise);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.GOLD_SWORD, (byte)0, 1,
|
||||
C.cYellow + C.Bold + "Left-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Wither Skull"));
|
||||
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD, (byte)0, 1,
|
||||
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Skeletal Minions"));
|
||||
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.COMPASS, (byte)0, 1,
|
||||
C.cYellow + C.Bold + "Human Finder X-9000"));
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
player.getInventory().addItem(
|
||||
ItemStackFactory.Instance.CreateStack(Material.GOLD_SWORD,
|
||||
(byte) 0, 1, C.cYellow + C.Bold + "Left-Click"
|
||||
+ C.cWhite + C.Bold + " - " + C.cGreen + C.Bold
|
||||
+ "Wither Skull"));
|
||||
|
||||
//Disguise
|
||||
player.getInventory().addItem(
|
||||
ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD,
|
||||
(byte) 0, 1, C.cYellow + C.Bold + "Right-Click"
|
||||
+ C.cWhite + C.Bold + " - " + C.cGreen + C.Bold
|
||||
+ "Skeletal Minions"));
|
||||
|
||||
player.getInventory().addItem(
|
||||
ItemStackFactory.Instance
|
||||
.CreateStack(Material.COMPASS, (byte) 0, 1, C.cYellow
|
||||
+ C.Bold + "Human Finder X-9000"));
|
||||
|
||||
// Disguise
|
||||
DisguiseWither disguise = new DisguiseWither(player);
|
||||
|
||||
if (Manager.GetGame().GetTeam(player) != null)
|
||||
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
|
||||
else
|
||||
disguise.setName(player.getName());
|
||||
if (Manager.GetGame().GetTeam(player) != null)
|
||||
disguise.setName(Manager.GetGame().GetTeam(player).GetColor()
|
||||
+ player.getName());
|
||||
else disguise.setName(player.getName());
|
||||
|
||||
disguise.setCustomNameVisible(true);
|
||||
Manager.GetDisguise().disguise(disguise);
|
||||
@ -87,25 +90,25 @@ public class KitWitherMinion extends Kit
|
||||
{
|
||||
if (event.IsCancelled())
|
||||
return;
|
||||
|
||||
|
||||
Player player = event.GetDamageePlayer();
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
|
||||
if (HasKit(player))
|
||||
event.SetCancelled("Wither Immunity");
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void witherMeleeCancel(CustomDamageEvent event)
|
||||
{
|
||||
if (event.IsCancelled())
|
||||
return;
|
||||
|
||||
|
||||
Player player = event.GetDamagerPlayer(true);
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
|
||||
if (!HasKit(player))
|
||||
return;
|
||||
|
||||
@ -120,7 +123,7 @@ public class KitWitherMinion extends Kit
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
if (!HasKit(player))
|
||||
|
@ -0,0 +1,41 @@
|
||||
package nautilus.game.arcade.gui.privateServer.button;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
|
||||
|
||||
/**
|
||||
* Created by WilliamTiger.
|
||||
* All the code and any API's associated with it
|
||||
* are not to be used anywhere else without written
|
||||
* consent of William Burns. 2015.
|
||||
* 08/07/2015
|
||||
*/
|
||||
public class ChooseMapButton implements IButton
|
||||
{
|
||||
private ArcadeManager _arcadeManager;
|
||||
private PrivateServerShop _privateServerShop;
|
||||
private GameType _gameType;
|
||||
private String _map;
|
||||
|
||||
public ChooseMapButton(ArcadeManager arcadeManager, PrivateServerShop privateServerShop, GameType gameType, String map)
|
||||
{
|
||||
_arcadeManager = arcadeManager;
|
||||
_privateServerShop = privateServerShop;
|
||||
_gameType = gameType;
|
||||
_map = map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
_arcadeManager.GetGameCreationManager().MapPref = _map;
|
||||
_arcadeManager.GetGame().setGame(_gameType, player, true);
|
||||
player.closeInventory();
|
||||
return;
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package nautilus.game.arcade.gui.privateServer.button;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
|
||||
import nautilus.game.arcade.gui.privateServer.page.GameVotingPage;
|
||||
|
||||
/**
|
||||
* Created by WilliamTiger.
|
||||
* All the code and any API's associated with it
|
||||
* are not to be used anywhere else without written
|
||||
* consent of William Burns. 2015.
|
||||
* 24/07/15
|
||||
*/
|
||||
public class GameVotingButton implements IButton
|
||||
{
|
||||
private ArcadeManager _arcadeManager;
|
||||
private PrivateServerShop _shop;
|
||||
|
||||
public GameVotingButton(ArcadeManager arcadeManager, PrivateServerShop shop)
|
||||
{
|
||||
_shop = shop;
|
||||
_arcadeManager = arcadeManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
_shop.openPageForPlayer(player, new GameVotingPage(_arcadeManager, _shop, player));
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package nautilus.game.arcade.gui.privateServer.button;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
|
||||
import nautilus.game.arcade.gui.privateServer.page.WhitelistedPage;
|
||||
|
||||
/**
|
||||
* Created by WilliamTiger.
|
||||
* All the code and any API's associated with it
|
||||
* are not to be used anywhere else without written
|
||||
* consent of William Burns. 2015.
|
||||
* 29/07/15
|
||||
*/
|
||||
public class WhitelistButton implements IButton
|
||||
{
|
||||
private ArcadeManager _arcadeManager;
|
||||
private PrivateServerShop _shop;
|
||||
|
||||
public WhitelistButton(ArcadeManager arcadeManager, PrivateServerShop shop)
|
||||
{
|
||||
_shop = shop;
|
||||
_arcadeManager = arcadeManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
_shop.openPageForPlayer(player, new WhitelistedPage(_arcadeManager, _shop, player));
|
||||
}
|
||||
}
|
@ -44,6 +44,18 @@ public abstract class BasePage extends ShopPageBase<ArcadeManager, PrivateServer
|
||||
});
|
||||
}
|
||||
|
||||
public void addBackToSetGamePage()
|
||||
{
|
||||
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
|
||||
{
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
getShop().openPageForPlayer(player, new SetGamePage(getPlugin(), getShop(), player));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public ItemStack getPlayerHead(String playerName, String title)
|
||||
{
|
||||
return getPlayerHead(playerName, title, null);
|
||||
|
@ -0,0 +1,43 @@
|
||||
package nautilus.game.arcade.gui.privateServer.page;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
|
||||
import nautilus.game.arcade.gui.privateServer.button.ChooseMapButton;
|
||||
|
||||
/**
|
||||
* Created by WilliamTiger.
|
||||
* All the code and any API's associated with it
|
||||
* are not to be used anywhere else without written
|
||||
* consent of William Burns. 2015.
|
||||
* 08/07/2015
|
||||
*/
|
||||
public class ChooseMapPage extends BasePage
|
||||
{
|
||||
private GameType _gameType;
|
||||
|
||||
public ChooseMapPage(ArcadeManager plugin, PrivateServerShop shop, Player player, GameType gameType)
|
||||
{
|
||||
super(plugin, shop, "Choose Map", player);
|
||||
_gameType = gameType;
|
||||
|
||||
buildPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void buildPage()
|
||||
{
|
||||
addBackToSetGamePage();
|
||||
|
||||
int slot = 9;
|
||||
for (String cur : getPlugin().LoadFiles(_gameType.GetName())){
|
||||
ChooseMapButton btn = new ChooseMapButton(getPlugin(), getShop(), _gameType, cur);
|
||||
addButton(slot, new ShopItem(Material.PAPER, cur.split("_")[1], new String[]{"§7Click to select map."}, 1, false), btn);
|
||||
slot++;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package nautilus.game.arcade.gui.privateServer.page;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
@ -9,6 +10,7 @@ import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.game.GameCategory;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
@ -30,6 +32,8 @@ public class EditRotationPage extends BasePage
|
||||
|
||||
List<GameType> enabledGames = getPlugin().GetServerConfig().GameList;
|
||||
|
||||
//Old code I'm not removing in-case the old style is wanted. - William
|
||||
/*
|
||||
int arcadeSlot = 9;
|
||||
int classicSlot = 13;
|
||||
int survivalSlot = 15;
|
||||
@ -64,13 +68,40 @@ public class EditRotationPage extends BasePage
|
||||
|
||||
addGameButton(slot, type, enabledGames.contains(type));
|
||||
}
|
||||
*/
|
||||
|
||||
ArrayList<GameCategory> allowedCats = new ArrayList<GameCategory>();
|
||||
allowedCats.add(GameCategory.ARCADE);
|
||||
allowedCats.add(GameCategory.CLASSICS);
|
||||
allowedCats.add(GameCategory.SURVIVAL);
|
||||
allowedCats.add(GameCategory.CHAMPIONS);
|
||||
allowedCats.add(GameCategory.EXTRA);
|
||||
allowedCats.add(GameCategory.TEAM_VARIANT);
|
||||
|
||||
int gameSlot = 9;
|
||||
for (GameCategory cat : _manager.getGames(getPlayer()).keySet())
|
||||
{
|
||||
if (!allowedCats.contains(cat))
|
||||
continue;
|
||||
|
||||
for (GameType type : _manager.getGames(getPlayer()).get(cat))
|
||||
{
|
||||
addGameButton(gameSlot, type, enabledGames.contains(type));
|
||||
gameSlot++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addGameButton(int slot, final GameType type, boolean enabled)
|
||||
{
|
||||
String titleString = ChatColor.RESET + (enabled ? C.cGreen : C.cRed) + ChatColor.BOLD + type.GetLobbyName();
|
||||
String titleString = ChatColor.RESET + (enabled ? C.cGreen : C.cRed) + ChatColor.BOLD + type.GetName();
|
||||
String infoString = ChatColor.RESET + C.cGray + (enabled ? "Click to Disable" : "Click to Enable");
|
||||
ShopItem shopItem = new ShopItem(type.GetMaterial(), type.GetMaterialData(), titleString, new String[]{infoString}, 1, false, false);
|
||||
String[] lore = new String[]{infoString};
|
||||
if (_manager.hasWarning().contains(type))
|
||||
{
|
||||
lore = new String[]{infoString, "§1", "§c§lWARNING: §fThis game was rejected!"};
|
||||
}
|
||||
ShopItem shopItem = new ShopItem(type.GetMaterial(), type.GetMaterialData(), titleString, lore, 1, false, false);
|
||||
int itemCount = enabled ? 1 : 0;
|
||||
|
||||
addButtonFakeCount(slot, shopItem, new IButton()
|
||||
|
@ -0,0 +1,174 @@
|
||||
package nautilus.game.arcade.gui.privateServer.page;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.game.GameCategory;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
|
||||
|
||||
/**
|
||||
* Created by WilliamTiger.
|
||||
* All the code and any API's associated with it
|
||||
* are not to be used anywhere else without written
|
||||
* consent of William Burns. 2015.
|
||||
* 24/07/15
|
||||
*/
|
||||
public class GameVotingPage extends BasePage
|
||||
{
|
||||
public GameVotingPage(ArcadeManager plugin, PrivateServerShop shop, Player player)
|
||||
{
|
||||
super(plugin, shop, "Game Voting Menu", player, 54);
|
||||
buildPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void buildPage()
|
||||
{
|
||||
boolean host = getPlugin().GetGameHostManager().isHost(getPlayer());
|
||||
|
||||
if (host)
|
||||
{
|
||||
addBackButton(4);
|
||||
addStartVoteButton(0);
|
||||
addEndVoteButton(8);
|
||||
}
|
||||
else
|
||||
{
|
||||
addCloseButton(4);
|
||||
}
|
||||
|
||||
ArrayList<GameCategory> allowedCats = new ArrayList<GameCategory>();
|
||||
allowedCats.add(GameCategory.ARCADE);
|
||||
allowedCats.add(GameCategory.CLASSICS);
|
||||
allowedCats.add(GameCategory.SURVIVAL);
|
||||
allowedCats.add(GameCategory.CHAMPIONS);
|
||||
allowedCats.add(GameCategory.EXTRA);
|
||||
allowedCats.add(GameCategory.TEAM_VARIANT);
|
||||
|
||||
int gameSlot = 9;
|
||||
for (GameCategory cat : _manager.getGames(getPlayer()).keySet())
|
||||
{
|
||||
if (!allowedCats.contains(cat))
|
||||
continue;
|
||||
|
||||
for (GameType type : _manager.getGames(getPlayer()).get(cat))
|
||||
{
|
||||
addGameButton(gameSlot, type);
|
||||
gameSlot++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addCloseButton(int slot)
|
||||
{
|
||||
ShopItem item = new ShopItem(Material.BED, (byte)0, "§cClose Menu", new String[]{}, 1, false, false);
|
||||
addButton(slot, item, new IButton()
|
||||
{
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
player.closeInventory();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void addEndVoteButton(int slot)
|
||||
{
|
||||
ShopItem item = new ShopItem(Material.REDSTONE_BLOCK, (byte)0, "§c§lEnd Vote", new String[]{}, 1, false, false);
|
||||
addButton(slot, item, new IButton()
|
||||
{
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
if (!_manager.isHost(player)) //Double Check...
|
||||
return;
|
||||
|
||||
getPlugin().GetGameHostManager().setVoteInProgress(false);
|
||||
for (Player p : UtilServer.getPlayers())
|
||||
{
|
||||
UtilPlayer.message(p, F.main("Vote", "The vote has ended!"));
|
||||
}
|
||||
refresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void addStartVoteButton(int slot)
|
||||
{
|
||||
String warning = "§c§lWARNING: §fThis will reset current votes!";
|
||||
ShopItem item = new ShopItem(Material.EMERALD_BLOCK, (byte)0, "Start Vote", new String[]{warning}, 1, false, false);
|
||||
addButton(slot, item, new IButton()
|
||||
{
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
if (!_manager.isHost(player)) //Double Check...
|
||||
return;
|
||||
|
||||
getPlugin().GetGameHostManager().setVoteInProgress(true);
|
||||
getPlugin().GetGameHostManager().getVotes().clear();
|
||||
for (Player p : UtilServer.getPlayers())
|
||||
{
|
||||
UtilPlayer.message(p, F.main("Vote", "A vote has started! Use " + F.skill("/vote") + " to vote."));
|
||||
p.playSound(p.getLocation(), Sound.NOTE_BASS, 1F, 1F);
|
||||
}
|
||||
refresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void addGameButton(int slot, final GameType type)
|
||||
{
|
||||
String click = "§7Click to vote for this Game Type";
|
||||
int votes = 0;
|
||||
for (GameType cur : getPlugin().GetGameHostManager().getVotes().values())
|
||||
{
|
||||
if (cur.equals(type))
|
||||
votes++;
|
||||
}
|
||||
String curVotes = "§7Votes: §e" + votes;
|
||||
String[] lore = new String[]{click, curVotes};
|
||||
if (_manager.hasWarning().contains(type))
|
||||
{
|
||||
lore = new String[]{click, curVotes, "§1", "§c§lWARNING: §fThis game was rejected!"};
|
||||
}
|
||||
ShopItem item = new ShopItem(type.GetMaterial(), type.GetMaterialData(), type.GetName(), new String[]{click, curVotes}, 1, false, false);
|
||||
if (votes >= 1)
|
||||
{
|
||||
addButton(slot, item, new IButton()
|
||||
{
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
getPlugin().GetGameHostManager().getVotes().put(player.getName(), type);
|
||||
refresh();
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
addButtonFakeCount(slot, item, new IButton()
|
||||
{
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
getPlugin().GetGameHostManager().getVotes().put(player.getName(), type);
|
||||
refresh();
|
||||
}
|
||||
}, votes);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
@ -16,6 +16,7 @@ import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
|
||||
import nautilus.game.arcade.gui.privateServer.button.BanButton;
|
||||
import nautilus.game.arcade.gui.privateServer.button.EditRotationButton;
|
||||
import nautilus.game.arcade.gui.privateServer.button.GameVotingButton;
|
||||
import nautilus.game.arcade.gui.privateServer.button.GiveAdminButton;
|
||||
import nautilus.game.arcade.gui.privateServer.button.KillButton;
|
||||
import nautilus.game.arcade.gui.privateServer.button.PlayerHeadButton;
|
||||
@ -25,12 +26,13 @@ import nautilus.game.arcade.gui.privateServer.button.OptionsButton;
|
||||
import nautilus.game.arcade.gui.privateServer.button.StartGameButton;
|
||||
import nautilus.game.arcade.gui.privateServer.button.StopGameButton;
|
||||
import nautilus.game.arcade.gui.privateServer.button.UnbanButton;
|
||||
import nautilus.game.arcade.gui.privateServer.button.WhitelistButton;
|
||||
|
||||
public class MenuPage extends BasePage
|
||||
{
|
||||
public MenuPage(ArcadeManager plugin, PrivateServerShop shop, Player player)
|
||||
{
|
||||
super(plugin, shop, "Private Server Menu", player, 9*3);
|
||||
super(plugin, shop, "Private Server Menu", player, 9*4);
|
||||
buildPage();
|
||||
}
|
||||
|
||||
@ -95,6 +97,12 @@ public class MenuPage extends BasePage
|
||||
KillButton killButton = new KillButton(getPlugin());
|
||||
addButton(8 + 18, new ShopItem(Material.TNT, "Kill Private Server",
|
||||
new String[]{ChatColor.RESET + C.cGray + "Shift-Right Click to Kill Private Server"}, 1, false), killButton);
|
||||
|
||||
GameVotingButton votingButton = new GameVotingButton(getPlugin(), getShop());
|
||||
addButton(3 + 27, new ShopItem(Material.BOOKSHELF, "Game Voting", new String[]{}, 1, false), votingButton);
|
||||
|
||||
WhitelistButton whitelistButton = new WhitelistButton(getPlugin(), getShop());
|
||||
addButton(5 + 27, new ShopItem(Material.PAPER, "Whitelisted Players", new String[]{}, 1, false), whitelistButton);
|
||||
}
|
||||
|
||||
OptionsButton optionsButton = new OptionsButton(getPlugin(), getShop());
|
||||
|
@ -43,7 +43,7 @@ public class OptionsPage extends BasePage
|
||||
}
|
||||
});
|
||||
|
||||
buildPreference(13, Material.PAPER, "Enforce Whitelist (Coming Soon)", false, new IButton()
|
||||
buildPreference(13, Material.PAPER, "Enforce Whitelist", _config.PlayerServerWhitelist, new IButton()
|
||||
{
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
@ -116,7 +116,9 @@ public class OptionsPage extends BasePage
|
||||
|
||||
private void toggleWhitelist()
|
||||
{
|
||||
// TODO CHISSPIE
|
||||
_config.PlayerServerWhitelist = !_config.PlayerServerWhitelist;
|
||||
if (_config.PlayerServerWhitelist == true)
|
||||
_config.PublicServer = false;
|
||||
refresh();
|
||||
}
|
||||
|
||||
@ -138,6 +140,14 @@ public class OptionsPage extends BasePage
|
||||
ChatColor.RED + " ",
|
||||
ChatColor.RESET + "Click to " + (preference ? "Disable" : "Enable") };
|
||||
|
||||
if (name.equalsIgnoreCase("Enforce Whitelist"))
|
||||
{
|
||||
description = new String[] {
|
||||
"" + (preference ? ChatColor.GREEN + "Enabled" : ChatColor.RED + "Disabled"),
|
||||
ChatColor.RED + " ",
|
||||
ChatColor.RESET + "Click to " + (preference ? "Disable" : "Enable"), "", "§7Use §a/whitelist §e<name>" };
|
||||
}
|
||||
|
||||
addButton(index, new ShopItem(material, data, (preference ? ChatColor.GREEN : ChatColor.RED) + name, description, 1, false, false), button);
|
||||
addButton(index + 9, new ShopItem(Material.INK_SACK, (preference ? (byte) 10 : (byte) 8), (preference ? ChatColor.GREEN : ChatColor.RED) + name, description, 1, false, false), button);
|
||||
}
|
||||
|
@ -1,10 +1,14 @@
|
||||
package nautilus.game.arcade.gui.privateServer.page;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.game.GameCategory;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
@ -24,6 +28,8 @@ public class SetGamePage extends BasePage
|
||||
{
|
||||
addBackButton(4);
|
||||
|
||||
//Old code I'm not removing in-case you want the old style - William.
|
||||
/*
|
||||
int arcadeSlot = 9;
|
||||
int classicSlot = 13;
|
||||
int survivalSlot = 15;
|
||||
@ -58,19 +64,59 @@ public class SetGamePage extends BasePage
|
||||
|
||||
addGameButton(slot, type);
|
||||
}
|
||||
*/
|
||||
|
||||
ArrayList<GameCategory> allowedCats = new ArrayList<GameCategory>();
|
||||
allowedCats.add(GameCategory.ARCADE);
|
||||
allowedCats.add(GameCategory.CLASSICS);
|
||||
allowedCats.add(GameCategory.SURVIVAL);
|
||||
allowedCats.add(GameCategory.CHAMPIONS);
|
||||
allowedCats.add(GameCategory.EXTRA);
|
||||
allowedCats.add(GameCategory.TEAM_VARIANT);
|
||||
|
||||
int gameSlot = 9;
|
||||
for (GameCategory cat : _manager.getGames(getPlayer()).keySet())
|
||||
{
|
||||
if (!allowedCats.contains(cat))
|
||||
continue;
|
||||
|
||||
for (GameType type : _manager.getGames(getPlayer()).get(cat))
|
||||
{
|
||||
addGameButton(gameSlot, type);
|
||||
gameSlot++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addGameButton(int slot, final GameType type)
|
||||
{
|
||||
String infoString = ChatColor.RESET + C.cGray + "Click to make this next Game Type";
|
||||
ShopItem shopItem = new ShopItem(type.GetMaterial(), type.GetMaterialData(), type.GetLobbyName(), new String[]{infoString}, 1, false, false);
|
||||
String infoString = ChatColor.RESET + C.cGray + "Make this next Game Type";
|
||||
String space = "§1";
|
||||
String left = ChatColor.YELLOW + "Left-Click " + C.cGray + "for a §fRandom Map§7.";
|
||||
String right = ChatColor.YELLOW + "Right-Click " + C.cGray + "to §fChoose Map§7.";
|
||||
String[] normLore = new String[]{infoString, space, left, right};
|
||||
if (_manager.hasWarning().contains(type))
|
||||
{
|
||||
normLore = new String[]{infoString, space, left, right, "§2", "§c§lWARNING: §fThis game was rejected!"};
|
||||
}
|
||||
ShopItem shopItem = new ShopItem(type.GetMaterial(), type.GetMaterialData(), type.GetName(), normLore, 1, false, false);
|
||||
addButton(slot, shopItem, new IButton()
|
||||
{
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
getPlugin().GetGame().setGame(type, player, true);
|
||||
player.closeInventory();
|
||||
if (clickType == ClickType.LEFT)
|
||||
{
|
||||
getPlugin().GetGame().setGame(type, player, true);
|
||||
player.closeInventory();
|
||||
return;
|
||||
}
|
||||
else if (clickType == ClickType.RIGHT)
|
||||
{
|
||||
getShop().openPageForPlayer(player, new ChooseMapPage(getPlugin(), getShop(), player, type));
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -0,0 +1,45 @@
|
||||
package nautilus.game.arcade.gui.privateServer.page;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
|
||||
|
||||
/**
|
||||
* Created by WilliamTiger.
|
||||
* All the code and any API's associated with it
|
||||
* are not to be used anywhere else without written
|
||||
* consent of William Burns. 2015.
|
||||
* 29/07/15
|
||||
*/
|
||||
public class WhitelistedPage extends PlayerPage
|
||||
{
|
||||
public WhitelistedPage(ArcadeManager plugin, PrivateServerShop shop, Player player)
|
||||
{
|
||||
super(plugin, shop, "Whitelisted Players", player);
|
||||
buildPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showPlayer(Player player)
|
||||
{
|
||||
if (getPlugin().GetGameHostManager().getWhitelist().contains(player.getName()))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clicked(int slot, Player player)
|
||||
{
|
||||
getPlugin().GetGameHostManager().getWhitelist().remove(player.getName());
|
||||
getPlugin().GetPortal().sendToHub(player, "You are no longer whitelisted.");
|
||||
getPlayer().sendMessage(F.main("Whitelist", "§e" + player.getName() + " §7is no longer whitelisted."));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayString(Player player)
|
||||
{
|
||||
return "Click to remove from whitelist";
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
public class PerkDummy extends Perk
|
||||
{
|
||||
|
||||
public PerkDummy(String name, String[] perkDesc)
|
||||
{
|
||||
super(name, perkDesc);
|
||||
}
|
||||
|
||||
}
|
@ -131,7 +131,10 @@ public class PerkNeedler extends SmashPerk
|
||||
DamageCause.THORNS, 1.1, true, true, false,
|
||||
damager.getName(), GetName());
|
||||
|
||||
Manager.GetCondition().Factory().Poison(GetName(), event.GetDamageeEntity(), damager, 2, 0, false, false, false);
|
||||
if(Manager.GetGame().GetTeam(event.GetDamageePlayer()) != Manager.GetGame().GetTeam(damager))
|
||||
{
|
||||
Manager.GetCondition().Factory().Poison(GetName(), event.GetDamageeEntity(), damager, 2, 0, false, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -2,42 +2,21 @@ package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
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.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.WitherSkull;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
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.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
@ -45,6 +24,19 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.data.IBlockRestorer;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.WitherSkull;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
public class PerkWitherAttack extends Perk
|
||||
{
|
||||
private ArrayList<WitherSkull> _active = new ArrayList<WitherSkull>();
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user