Merge remote-tracking branch 'origin/develop' into develop
# Conflicts: # Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java
This commit is contained in:
commit
40f6969413
@ -152,6 +152,21 @@ public class UtilAlg
|
||||
return list.get(UtilMath.r(list.size()));
|
||||
}
|
||||
|
||||
public static <T> T Random(List<T> list, List<T> exclude)
|
||||
{
|
||||
int attempts = 0;
|
||||
T element;
|
||||
|
||||
do
|
||||
{
|
||||
element = Random(list);
|
||||
attempts++;
|
||||
}
|
||||
while (element != null && exclude.contains(element) && attempts < 15);
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
public static boolean inBoundingBox(Location loc, Location cornerA, Location cornerB)
|
||||
{
|
||||
if (loc.getX() <= Math.min(cornerA.getX(), cornerB.getX())) return false;
|
||||
@ -515,4 +530,5 @@ public class UtilAlg
|
||||
{
|
||||
return new AxisAlignedBB(a.getX(), a.getY(), a.getZ(), b.getX(), b.getY(), b.getZ());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1405,6 +1405,9 @@ public class UtilBlock
|
||||
itemStack.setType(Material.DARK_OAK_DOOR_ITEM);
|
||||
itemStack.setDurability((short) 0);
|
||||
break;
|
||||
case ANVIL:
|
||||
itemStack.setDurability((short) (itemStack.getDurability() / 4));
|
||||
break;
|
||||
}
|
||||
|
||||
return itemStacks;
|
||||
|
@ -471,6 +471,13 @@ public class CoreClientManager extends MiniPlugin
|
||||
if (event.getReason().contains("You logged in from another location"))
|
||||
{
|
||||
_duplicateLoginGlitchPreventionList.add(event.getPlayer().getName());
|
||||
Bukkit.getScheduler().runTask(_plugin, new Runnable() {
|
||||
public void run() {
|
||||
if(!_clientList.containsKey(event.getPlayer().getName())) return;
|
||||
Player p = _clientList.get(event.getPlayer().getName()).GetPlayer();
|
||||
p.kickPlayer("You're already logged in.");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -478,7 +485,7 @@ public class CoreClientManager extends MiniPlugin
|
||||
public void Quit(PlayerQuitEvent event)
|
||||
{
|
||||
// When an account is logged in to this server and the same account name logs in
|
||||
// Then it Fires events in this order (original, new for accounts)
|
||||
// Then it Fires events in this order (original, new for acco unts)
|
||||
// AsyncPreLogin -> new
|
||||
// PlayerLogin -> new
|
||||
// PlayerKick -> old
|
||||
|
@ -854,7 +854,37 @@ public enum Achievement
|
||||
new String[]{"Type Wars.Wins"},
|
||||
new String[]{"Win 30 Games"},
|
||||
new int[]{30},
|
||||
AchievementCategory.TYPE_WARS);
|
||||
AchievementCategory.TYPE_WARS),
|
||||
|
||||
SPEED_BUILDERS_SPEED_MASTER("Speed Master", 800,
|
||||
new String[]{"Speed Builders.Wins"},
|
||||
new String[]{"Win 10 Games of Speed Builder"},
|
||||
new int[]{10},
|
||||
AchievementCategory.SPEED_BUILDERS),
|
||||
|
||||
SPEED_BUILDERS_DEPENDABLE("Dependable", 1200,
|
||||
new String[]{"Speed Builders.PerfectBuild"},
|
||||
new String[]{"Complete 50 Perfect Builds"},
|
||||
new int[]{50},
|
||||
AchievementCategory.SPEED_BUILDERS),
|
||||
|
||||
SPEED_BUILDERS_FIRST_BUILD("First Build!", 1800,
|
||||
new String[]{"Speed Builders.PerfectFirst"},
|
||||
new String[]{"Be the first person to complete a build in the game 10 times"},
|
||||
new int[]{10},
|
||||
AchievementCategory.SPEED_BUILDERS),
|
||||
|
||||
SPEED_BUILDERS_PERFECTIONIST("Perfectionist", 2200,
|
||||
new String[]{"Speed Builders.PerfectWins"},
|
||||
new String[]{"Win a game of Speed Builder with a perfect build every round"},
|
||||
new int[]{1},
|
||||
AchievementCategory.SPEED_BUILDERS),
|
||||
|
||||
SPEED_BUILDERS_SPEEDIEST("Speediest Builderizer", 2000,
|
||||
new String[]{"Speed Builders.SpeediestBuilderizer"},
|
||||
new String[]{"Perfect a build in less than 10 seconds"},
|
||||
new int[]{1},
|
||||
AchievementCategory.SPEED_BUILDERS);
|
||||
|
||||
private String _name;
|
||||
private String[] _desc;
|
||||
|
@ -2,10 +2,6 @@ package mineplex.core.achievement;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
@ -14,6 +10,10 @@ import mineplex.core.game.GameDisplay;
|
||||
import mineplex.core.stats.PlayerStats;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public enum AchievementCategory
|
||||
{
|
||||
GLOBAL("Global", null,
|
||||
@ -157,7 +157,11 @@ public enum AchievementCategory
|
||||
|
||||
TYPE_WARS("Type Wars", null,
|
||||
new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, new StatDisplay("Minions killed", "MinionKills"), new StatDisplay("Words Per Minute", false, true, "MinionKills", "TimeInGame"), StatDisplay.GEMS_EARNED},
|
||||
Material.NAME_TAG, 0, GameCategory.CLASSICS, null);
|
||||
Material.NAME_TAG, 0, GameCategory.CLASSICS, null),
|
||||
|
||||
SPEED_BUILDERS("Speed Builders", null,
|
||||
new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED, null, new StatDisplay("Perfect Builds", "PerfectBuild")},
|
||||
Material.QUARTZ_BLOCK, 0, GameCategory.CLASSICS, null);
|
||||
|
||||
|
||||
private String _name;
|
||||
|
@ -49,7 +49,7 @@ public class AchievementMainPage extends ShopPageBase<AchievementManager, Achiev
|
||||
"XXXXOXXXO",
|
||||
"OXOXOXOXO",
|
||||
"OXOXOXOXO",
|
||||
"XOXOXOXOX").getItemSlots();
|
||||
"OXOXOXOXO").getItemSlots();
|
||||
int listSlot = 0;
|
||||
|
||||
for (AchievementCategory category : AchievementCategory.values())
|
||||
|
@ -108,7 +108,7 @@ public class CosmeticManager extends MiniPlugin
|
||||
if (event.getPlayer().isOnline())
|
||||
{
|
||||
event.getPlayer().getInventory().remove(Material.CHEST);
|
||||
event.getPlayer().getInventory().setItem(_interfaceSlot, ItemStackFactory.Instance.CreateStack(Material.CHEST, (byte)0, 1, ChatColor.RESET + C.cGreen + "Inventory Menu"));
|
||||
event.getPlayer().getInventory().setItem(_interfaceSlot, ItemStackFactory.Instance.CreateStack(Material.CHEST, (byte)0, 1, ChatColor.RESET + C.cGreen + "Cosmetic Menu"));
|
||||
event.getPlayer().updateInventory();
|
||||
}
|
||||
}
|
||||
|
@ -160,12 +160,12 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
if (enabled.containsKey(type)) addGlow(deathSlot);
|
||||
|
||||
type = GadgetType.Item;
|
||||
lore = getLore(ownedCount.get(type), maxCount.get(type), "All sorts of zaney contraptions to use on your friends and foes.", "Usable in Lobbies", enabled.get(type));
|
||||
lore = getLore(ownedCount.get(type), maxCount.get(type), "All sorts of zany contraptions to use on your friends and foes.", "Usable in Lobbies", enabled.get(type));
|
||||
addButton(gadgetSlot, new ShopItem(Material.MELON_BLOCK, "Gadgets", lore, 1, false), new OpenGadgets(this, enabled.get(type)));
|
||||
if (enabled.containsKey(type)) addGlow(gadgetSlot);
|
||||
|
||||
type = GadgetType.Morph;
|
||||
lore = getLore(ownedCount.get(type), maxCount.get(type), "Ever want to be a tiger? Well, you can’t be a tiger! That’s silly! But you can be many other things!", "Usable in Lobbies", enabled.get(type));
|
||||
lore = getLore(ownedCount.get(type), maxCount.get(type), "Have you ever wanted to be a tiger? Well, you can't be a tiger! That's silly! But you can be many other things!", "Usable in Lobbies", enabled.get(type));
|
||||
addButton(morphSlot, new ShopItem(Material.LEATHER, "Morphs", lore, 1, false), new OpenMorphs(this, enabled.get(type)));
|
||||
if (enabled.containsKey(type)) addGlow(morphSlot);
|
||||
|
||||
|
@ -193,7 +193,7 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
}
|
||||
else if (getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType() != EntityType.WITHER)
|
||||
{
|
||||
addButton(slot, new ShopItem(petExtra.GetMaterial(), (byte) 0, "Rename " + getPlugin().getPetManager().getActivePet(getPlayer().getName()).getCustomName() + " for " + C.cYellow + petExtra.GetCost(CurrencyType.Coins) + C.cGreen + " Coins", itemLore.toArray(new String[itemLore.size()]), 1, false, false), new RenamePetButton(this));
|
||||
addButton(slot, new ShopItem(petExtra.GetMaterial(), (byte) 0, "Rename " + getPlugin().getPetManager().getActivePet(getPlayer().getName()).getCustomName() + " for " + C.cYellow + petExtra.GetCost(CurrencyType.Coins) + C.cGreen + " Shards", itemLore.toArray(new String[itemLore.size()]), 1, false, false), new RenamePetButton(this));
|
||||
}
|
||||
|
||||
slot++;
|
||||
|
@ -20,7 +20,7 @@ public class ArrowTrailCandyCane extends ArrowEffectGadget
|
||||
public ArrowTrailCandyCane(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Candy Cane Arrows",
|
||||
UtilText.splitLineToArray(C.cGray + "The real reason no one visits the North Pole? Santa’s Elves are deadly shots.", LineFormat.LORE),
|
||||
UtilText.splitLineToArray(C.cGray + "The real reason no one visits the North Pole? Santa's Elves are deadly shots.", LineFormat.LORE),
|
||||
-3,
|
||||
Material.INK_SACK, (byte)1);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ public class ArrowTrailFrostLord extends ArrowEffectGadget
|
||||
public ArrowTrailFrostLord(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Arrows of the Frost Lord",
|
||||
UtilText.splitLineToArray(C.cGray + "The Frost Lord’s arrows bring a blast of winter in the wind of their passing.", LineFormat.LORE),
|
||||
UtilText.splitLineToArray(C.cGray + "The Frost Lord's arrows bring a blast of winter in the wind of their passing.", LineFormat.LORE),
|
||||
-3,
|
||||
Material.SNOW_BALL, (byte)0, "Frost Lord");
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ public class DeathCandyCane extends DeathEffectGadget
|
||||
public DeathCandyCane(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Candy Cane Remains",
|
||||
UtilText.splitLineToArray(C.cGray + "The biggest enemy of the Holidays, is January.", LineFormat.LORE),
|
||||
UtilText.splitLineToArray(C.cGray + "The biggest enemy of the Holidays is January.", LineFormat.LORE),
|
||||
-3,
|
||||
Material.INK_SACK, (byte)1);
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ public class HatCoal extends HatGadget
|
||||
public HatCoal(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Lump of Coal Hat",
|
||||
UtilText.splitLineToArray(C.cGray + "When life gives you coal, make a wierd cube hat out it!", LineFormat.LORE),
|
||||
UtilText.splitLineToArray(C.cGray + "When life gives you coal, make a weird cube hat out it!", LineFormat.LORE),
|
||||
-1,
|
||||
new ItemStack(Material.COAL_BLOCK));
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ public class HatGrinch extends HatGadget
|
||||
public HatGrinch(GadgetManager manager)
|
||||
{
|
||||
super(manager, "The Grinch",
|
||||
UtilText.splitLineToArray(C.cGray + "Great! Now where’s the Roast Beast?!", LineFormat.LORE),
|
||||
UtilText.splitLineToArray(C.cGray + "Great! Now where's the Roast Beast?!", LineFormat.LORE),
|
||||
-3,
|
||||
SkinData.THE_GRINCH.getSkull(), "The Grinch Hat");
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ public class HatPresent extends HatGadget
|
||||
public HatPresent(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Present",
|
||||
UtilText.splitLineToArray(C.cGray + "WHAT IN THE PRESENT? Oh, it's just you...", LineFormat.LORE),
|
||||
UtilText.splitLineToArray(C.cGray + "WHAT'S IN THE PRESENT? Oh, it's just you...", LineFormat.LORE),
|
||||
-3,
|
||||
SkinData.PRESENT.getSkull());
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ public class HatRudolph extends HatGadget
|
||||
public HatRudolph(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Rudolph",
|
||||
UtilText.splitLineToArray(C.cGray + "WHAT IN THE PRESENT? Oh, it's just you...", LineFormat.LORE),
|
||||
UtilText.splitLineToArray(C.cGray + "HEY YOU! Wanna lead Santa's sleigh team?", LineFormat.LORE),
|
||||
-3,
|
||||
SkinData.RUDOLPH.getSkull());
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ public class ItemCoinBomb extends ItemGadget
|
||||
public ItemCoinBomb(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Treasure Party Bomb",
|
||||
UtilText.splitLineToArray(C.cWhite + "It's party time! You'll be everyones favourite player when you use one of these!", LineFormat.LORE),
|
||||
UtilText.splitLineToArray(C.cWhite + "It's party time! You'll be everyone's favourite player when you use one of these!", LineFormat.LORE),
|
||||
-1,
|
||||
Material.PRISMARINE, (byte)0,
|
||||
30000, new Ammo("Treasure Party Bomb", "1 Coin Party Bomb", Material.PRISMARINE, (byte)0, new String[] { C.cWhite + "1 Treasure Party Bomb" }, 2000, 1));
|
||||
|
@ -32,7 +32,7 @@ public class ItemPartyPopper extends ItemGadget implements IThrown
|
||||
public ItemPartyPopper(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Party Popper",
|
||||
UtilText.splitLineToArray(C.cWhite + "Celebrate by blasting confetti into peoples eyes!", LineFormat.LORE),
|
||||
UtilText.splitLineToArray(C.cWhite + "Celebrate by blasting confetti into peoples' eyes!", LineFormat.LORE),
|
||||
1, Material.GOLDEN_CARROT, (byte) 0, 1000, new Ammo("Party Popper", "1 Party Popper", Material.GOLDEN_CARROT,
|
||||
(byte) 0, new String[]
|
||||
{
|
||||
|
@ -59,7 +59,7 @@ public class MorphBunny extends MorphGadget
|
||||
"#" + C.cWhite + "Charge Crouch to use Super Jump",
|
||||
"#" + C.cWhite + "Left Click to use Hide Easter Egg",
|
||||
C.blankLine,
|
||||
"#" + C.cRed +C.Bold + "WARNING: " + ChatColor.RESET + "Hide Easter Egg uses 500 Coins" ,
|
||||
"#" + C.cRed +C.Bold + "WARNING: " + ChatColor.RESET + "Hide Easter Egg uses 500 Shards" ,
|
||||
}, LineFormat.LORE),
|
||||
-5,
|
||||
Material.MONSTER_EGG, (byte)98);
|
||||
@ -154,7 +154,7 @@ public class MorphBunny extends MorphGadget
|
||||
|
||||
if (Manager.getDonationManager().Get(player.getName()).GetBalance(CurrencyType.Coins) < 500)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Gadget", "You do not have enough Coins."));
|
||||
UtilPlayer.message(player, F.main("Gadget", "You do not have enough Shards."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -183,7 +183,7 @@ public class MorphBunny extends MorphGadget
|
||||
ChatColor.RESET + C.Bold + " hid an " +
|
||||
C.cYellow + C.Bold + "Easter Egg" +
|
||||
ChatColor.RESET + C.Bold + " worth " +
|
||||
C.cYellow + C.Bold + "450 Coins");
|
||||
C.cYellow + C.Bold + "450 Shards");
|
||||
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
other.playSound(other.getLocation(), Sound.CAT_HIT, 1.5f, 1.5f);
|
||||
|
@ -29,7 +29,7 @@ public class MorphSlime extends MorphGadget
|
||||
{
|
||||
super(manager, "Big Larry Morph", UtilText.splitLinesToArray(new String[]
|
||||
{
|
||||
C.cGray + "Have you ever looked at Big Larry and thought, \'I really want to be that guy!\'? Well, today is your lucky day!",
|
||||
C.cGray + "Have you ever looked at Big Larry and thought, \'I really want to be that guy\'!? Well, today is your lucky day!",
|
||||
C.blankLine,
|
||||
"#" + C.cWhite + "Left Click to use Bounce",
|
||||
C.blankLine,
|
||||
|
@ -46,7 +46,7 @@ public class MorphTitan extends MorphGadget
|
||||
{
|
||||
super(manager, "Elder Guardian Morph", UtilText.splitLinesToArray(new String[]
|
||||
{
|
||||
C.cGray + "From the depths of the sea, the Elder Guardian posseses powers more amazing than any seen before!",
|
||||
C.cGray + "From the depths of the sea, the Elder Guardian possesses powers more amazing than any seen before!",
|
||||
C.blankLine,
|
||||
"#" + C.cWhite + "Left-Click to use Guardians Laser",
|
||||
}, LineFormat.LORE),
|
||||
|
@ -29,7 +29,7 @@ public class ParticleCandyCane extends ParticleGadget
|
||||
public ParticleCandyCane(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Crushed Candy Cane",
|
||||
UtilText.splitLineToArray(C.cGray + "There’s no such thing as too much Christmas Candy. Don’t listen to your dentist.", LineFormat.LORE),
|
||||
UtilText.splitLineToArray(C.cGray + "There's no such thing as too much Christmas Candy. Don't listen to your dentist.", LineFormat.LORE),
|
||||
-3, Material.INK_SACK, (byte)1);
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ public class ParticleEnchant extends ParticleGadget
|
||||
public ParticleEnchant(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Enchanted",
|
||||
UtilText.splitLineToArray(C.cGray + "The wisdom of the universe suddenly find you extremely attractive, and wants to \'enchant\' you.", LineFormat.LORE),
|
||||
UtilText.splitLineToArray(C.cGray + "The wisdom of the universe suddenly finds you extremely attractive, and wants to \'enchant\' you.", LineFormat.LORE),
|
||||
-2,
|
||||
Material.BOOK, (byte)0);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ public class ParticleFrostLord extends ParticleGadget
|
||||
public ParticleFrostLord(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Wind of the Frost Lord",
|
||||
UtilText.splitLineToArray(C.cGray + "He’s not passing wind okay? HE HAS A CONDITION!", LineFormat.LORE),
|
||||
UtilText.splitLineToArray(C.cGray + "He's not passing wind, okay? HE HAS A CONDITION!", LineFormat.LORE),
|
||||
-3,
|
||||
Material.SNOW_BALL, (byte)0, "Frost Lord");
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ public class ParticleGreen extends ParticleGadget
|
||||
public ParticleGreen(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Green Ring",
|
||||
UtilText.splitLineToArray(C.cGray + "With these sparkles, you can sparkle while sparkle with CaptainSparklez!", LineFormat.LORE),
|
||||
UtilText.splitLineToArray(C.cGray + "With these sparkles, you can sparkle while sparkling with CaptainSparklez!", LineFormat.LORE),
|
||||
-2,
|
||||
Material.EMERALD, (byte)0);
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ public class ParticleHelix extends ParticleGadget
|
||||
public ParticleHelix(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Blood Helix",
|
||||
UtilText.splitLineToArray(C.cGray + "Blood magic is very dangerous... but also very cool!", LineFormat.LORE),
|
||||
UtilText.splitLineToArray(C.cGray + "Blood magic is very dangerous...but also very cool!", LineFormat.LORE),
|
||||
-2,
|
||||
Material.REDSTONE, (byte)0);
|
||||
}
|
||||
|
@ -67,6 +67,9 @@ public enum GameDisplay
|
||||
MonsterLeague("Monster League", Material.MINECART, (byte)0, GameCategory.ARCADE, 56),
|
||||
|
||||
Lobbers("Bomb Lobbers", Material.FIREBALL, (byte) 0, GameCategory.ARCADE, 54),
|
||||
|
||||
SpeedBuilders("Speed Builders", Material.QUARTZ_BLOCK, (byte) 0, GameCategory.CLASSICS, 60),
|
||||
|
||||
ChampionsCTF("Champions CTF", "Champions", Material.BANNER, DyeColor.RED.getDyeData(), GameCategory.CHAMPIONS, 56),
|
||||
BouncyBalls("Bouncy Balls", Material.SLIME_BALL, (byte)0, GameCategory.ARCADE, 57),
|
||||
Gladiators("Gladiators", Material.IRON_SWORD, (byte)0, GameCategory.ARCADE, 58),
|
||||
|
@ -32,7 +32,7 @@ public class MountBabyReindeer extends HorseMount
|
||||
public MountBabyReindeer(MountManager manager)
|
||||
{
|
||||
super(manager, "Baby Reindeer",
|
||||
UtilText.splitLineToArray(C.cGray + "One of Santas baby reindeers. He's still learning how to fly...", LineFormat.LORE),
|
||||
UtilText.splitLineToArray(C.cGray + "One of Santa's baby reindeers. He's still learning how to fly...", LineFormat.LORE),
|
||||
Material.GOLDEN_CARROT, (byte) 0, -3, Color.CREAMY, Style.WHITEFIELD, Variant.HORSE, 0, null);
|
||||
}
|
||||
|
||||
|
@ -128,8 +128,19 @@ public class Parse
|
||||
String name = "";
|
||||
|
||||
try
|
||||
{
|
||||
{
|
||||
name = s.getLine(0);
|
||||
|
||||
if (s.getLine(1) != null && s.getLine(1).length() > 0)
|
||||
name += " " + s.getLine(1);
|
||||
|
||||
if (s.getLine(2) != null && s.getLine(2).length() > 0)
|
||||
name += " " + s.getLine(2);
|
||||
|
||||
if (s.getLine(3) != null && s.getLine(3).length() > 0)
|
||||
name += " " + s.getLine(3);
|
||||
|
||||
System.out.println("Custom Location: " + name);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -31,6 +31,8 @@ import mineplex.core.energy.Energy;
|
||||
import mineplex.core.explosion.Explosion;
|
||||
import mineplex.core.explosion.ExplosionEvent;
|
||||
import mineplex.core.facebook.FacebookManager;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.giveaway.GiveawayManager;
|
||||
import mineplex.core.hologram.HologramManager;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
@ -901,6 +903,10 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
HubClock(player);
|
||||
|
||||
GetDisguise().undisguise(player);
|
||||
|
||||
Gadget morph = getCosmeticManager().getGadgetManager().getActive(player, GadgetType.Morph);
|
||||
if (morph.IsActive(player))
|
||||
morph.Disable(player);
|
||||
}
|
||||
|
||||
public ArrayList<String> LoadFiles(String gameName)
|
||||
@ -1166,6 +1172,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
if (event.GetState() == GameState.Recruit)
|
||||
{
|
||||
getCosmeticManager().setActive(true);
|
||||
getCosmeticManager().setHideParticles(false);
|
||||
}
|
||||
else if (event.GetState() == GameState.Prepare || event.GetState() == GameState.Loading || event.GetState() == GameState.Dead)
|
||||
{
|
||||
@ -1177,6 +1184,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
getCosmeticManager().disableItemsForGame();
|
||||
}
|
||||
}
|
||||
|
||||
if (!event.GetGame().AllowParticles)
|
||||
getCosmeticManager().setHideParticles(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
package nautilus.game.arcade;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import mineplex.core.game.GameCategory;
|
||||
import mineplex.core.game.GameDisplay;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
@ -54,6 +52,7 @@ 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;
|
||||
import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders;
|
||||
import nautilus.game.arcade.game.games.spleef.Spleef;
|
||||
import nautilus.game.arcade.game.games.spleef.SpleefTeams;
|
||||
import nautilus.game.arcade.game.games.squidshooter.SquidShooter;
|
||||
@ -68,6 +67,8 @@ import nautilus.game.arcade.game.games.wither.WitherGame;
|
||||
import nautilus.game.arcade.game.games.wizards.Wizards;
|
||||
import nautilus.game.arcade.game.games.zombiesurvival.ZombieSurvival;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
public enum GameType
|
||||
{
|
||||
//Mini
|
||||
@ -113,6 +114,7 @@ public enum GameType
|
||||
Snake(Snake.class, GameDisplay.Snake),
|
||||
SneakyAssassins(SneakyAssassins.class, GameDisplay.SneakyAssassins),
|
||||
SnowFight(SnowFight.class, GameDisplay.SnowFight),
|
||||
SpeedBuilders(SpeedBuilders.class, GameDisplay.SpeedBuilders),
|
||||
Spleef(Spleef.class, GameDisplay.Spleef),
|
||||
SpleefTeams(SpleefTeams.class, GameDisplay.SpleefTeams),
|
||||
SquidShooter(SquidShooter.class, GameDisplay.SquidShooter),
|
||||
|
@ -311,6 +311,8 @@ public abstract class Game implements Listener
|
||||
public boolean EnableTutorials = false;
|
||||
|
||||
public boolean FixSpawnFacing = true;
|
||||
|
||||
public boolean AllowEntitySpectate = true;
|
||||
|
||||
private IPacketHandler _useEntityPacketHandler;
|
||||
private int _deadBodyCount;
|
||||
@ -1751,4 +1753,6 @@ public abstract class Game implements Listener
|
||||
}
|
||||
|
||||
public void addTutorials(){}
|
||||
|
||||
public void disable(){}
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ public abstract class Part implements Listener
|
||||
|
||||
Host.GetSleigh().AddPresent(present.getBlock().getLocation());
|
||||
|
||||
Host.SantaSay("Well done " + event.getPlayer().getName() + "! You collected a present!", null);
|
||||
Host.SantaSay("Well done, " + event.getPlayer().getName() + "! You collected a present!", null);
|
||||
}
|
||||
|
||||
public void SetObjectiveText(String text, double percent)
|
||||
|
@ -143,7 +143,7 @@ public class Part5 extends Part
|
||||
|
||||
_a = true;
|
||||
_dialogueDelay = System.currentTimeMillis();
|
||||
Host.SantaSay("WHAT IS THIS?! Who's castle is this?!", ChristmasAudio.BANTER_A);
|
||||
Host.SantaSay("WHAT IS THIS?! Whose castle is this?!", ChristmasAudio.BANTER_A);
|
||||
}
|
||||
else if (_a && !_b && UtilTime.elapsed(_dialogueDelay, _delayTime))
|
||||
{
|
||||
|
@ -1095,4 +1095,11 @@ public class Gladiators extends SoloGame
|
||||
|
||||
Scoreboard.Draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disable()
|
||||
{
|
||||
_hotbarEditor.deregisterSelf(); // De-register as listener
|
||||
_hotbarEditor.onDisable(); // Fully disable
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
@ -37,6 +39,7 @@ public class HotbarEditor extends MiniPlugin
|
||||
{
|
||||
private Gladiators _host;
|
||||
private ItemStack _item;
|
||||
private Listener _pageListener;
|
||||
|
||||
public HotbarEditor(JavaPlugin plugin, Gladiators gladiators)
|
||||
{
|
||||
@ -46,7 +49,14 @@ public class HotbarEditor extends MiniPlugin
|
||||
_item = new ItemBuilder(Material.NAME_TAG).setTitle(C.cGold + "Hotbar Editor")
|
||||
.addLore(C.cGray + "Right click to edit your Gladiators hotbar").build();
|
||||
|
||||
getPluginManager().registerEvents(new HotbarPageListener(this), getPlugin());
|
||||
_pageListener = new HotbarPageListener(this);
|
||||
getPluginManager().registerEvents(_pageListener, getPlugin());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disable()
|
||||
{
|
||||
HandlerList.unregisterAll(_pageListener);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -81,6 +91,9 @@ public class HotbarEditor extends MiniPlugin
|
||||
{
|
||||
if (event.getMessage().equalsIgnoreCase("/spec"))
|
||||
{
|
||||
if (_host == null)
|
||||
return;
|
||||
|
||||
if (!_host.IsAlive(event.getPlayer())
|
||||
&& !UtilInv.contains(event.getPlayer(), _item.getType(), (byte) 0, 1))
|
||||
{
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,10 @@
|
||||
package nautilus.game.arcade.game.games.speedbuilders;
|
||||
|
||||
public enum SpeedBuildersState
|
||||
{
|
||||
|
||||
VIEWING,
|
||||
BUILDING,
|
||||
REVIEWING;
|
||||
|
||||
}
|
@ -0,0 +1,198 @@
|
||||
package nautilus.game.arcade.game.games.speedbuilders.data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mineplex.core.common.util.MapUtil;
|
||||
import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders;
|
||||
import net.minecraft.server.v1_8_R3.BlockPosition;
|
||||
import net.minecraft.server.v1_8_R3.BlockStairs;
|
||||
import net.minecraft.server.v1_8_R3.BlockStairs.EnumStairShape;
|
||||
import net.minecraft.server.v1_8_R3.IBlockData;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.material.Stairs;
|
||||
|
||||
public class BuildData
|
||||
{
|
||||
public SpeedBuilders Game;
|
||||
|
||||
public Location BuildMin;
|
||||
|
||||
public BlockState[][][] Build;
|
||||
public BlockState[][] Ground;
|
||||
|
||||
//Store stair shapes for stair fix
|
||||
public EnumStairShape[][][] StairShapes;
|
||||
|
||||
public String BuildText;
|
||||
|
||||
public ArrayList<MobData> Mobs = new ArrayList<MobData>();
|
||||
|
||||
private int _timeAdd = 0;
|
||||
private int _timeSubtract = 0;
|
||||
private int _timeEqual = -1;
|
||||
private double _timeMultiplier = 1.0;
|
||||
|
||||
public BuildData(Location loc, String buildText, SpeedBuilders game)
|
||||
{
|
||||
Build = new BlockState[game.BuildSize][game.BuildSize][game.BuildSize];
|
||||
Ground = new BlockState[game.BuildSize][game.BuildSize];
|
||||
|
||||
StairShapes = new EnumStairShape[game.BuildSize][game.BuildSize][game.BuildSize];
|
||||
|
||||
Game = game;
|
||||
|
||||
Location groundMin = loc.clone().subtract(game.BuildSizeDiv2, 11, game.BuildSizeDiv2);
|
||||
|
||||
for (int x = 0; x < game.BuildSize; x++)
|
||||
{
|
||||
for (int z = 0; z < game.BuildSize; z++)
|
||||
{
|
||||
Ground[x][z] = groundMin.clone().add(x, 0, z).getBlock().getState();
|
||||
}
|
||||
}
|
||||
|
||||
parseText(buildText);
|
||||
|
||||
Location buildMin = loc.clone().subtract(game.BuildSizeDiv2, 10, game.BuildSizeDiv2);
|
||||
|
||||
BuildMin = buildMin;
|
||||
|
||||
for (int x = 0; x < game.BuildSize; x++)
|
||||
{
|
||||
for (int y = 0; y < game.BuildSize; y++)
|
||||
{
|
||||
for (int z = 0; z < game.BuildSize; z++)
|
||||
{
|
||||
Block block = buildMin.clone().add(x, y, z).getBlock();
|
||||
|
||||
if (block.getType() == Material.SIGN_POST)
|
||||
{
|
||||
Sign sign = (Sign) block.getState();
|
||||
|
||||
EntityType type = null;
|
||||
|
||||
try
|
||||
{
|
||||
type = EntityType.valueOf(sign.getLine(0).toUpperCase());
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
// Not a entity sign or someone messed up...
|
||||
}
|
||||
|
||||
if (type != null)
|
||||
{
|
||||
Mobs.add(new MobData(type, x, y, z));
|
||||
|
||||
MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR);
|
||||
}
|
||||
}
|
||||
|
||||
Build[x][y][z] = block.getState();
|
||||
|
||||
if (block.getState().getData() instanceof Stairs)
|
||||
{
|
||||
net.minecraft.server.v1_8_R3.Block nmsBlock = CraftMagicNumbers.getBlock(block);
|
||||
|
||||
IBlockData blockData = nmsBlock.getBlockData();
|
||||
blockData = nmsBlock.updateState(blockData, ((CraftWorld) block.getWorld()).getHandle(), new BlockPosition(block.getX(), block.getY(), block.getZ()));
|
||||
|
||||
StairShapes[x][y][z] = blockData.get(BlockStairs.SHAPE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void parseText(String buildText)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String part : buildText.split(" "))
|
||||
{
|
||||
if (part.matches("^time[\\Q+-=\\E][0-9]+$"))
|
||||
{
|
||||
// + - = add subtract or set seconds
|
||||
try
|
||||
{
|
||||
int num = Integer.parseInt(part.substring(5));
|
||||
switch (part.charAt(4))
|
||||
{
|
||||
case '-':
|
||||
_timeSubtract = num;
|
||||
break;
|
||||
case '=':
|
||||
_timeEqual = num;
|
||||
break;
|
||||
default:
|
||||
_timeAdd = num;
|
||||
}
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
System.out.println("Failed parsing data for customloc: " + buildText);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
else if (part.matches("^time\\*[0-9]*\\.?[0-9]+$"))
|
||||
{
|
||||
// * multiply by a number
|
||||
try
|
||||
{
|
||||
double num = Double.parseDouble(part.substring(5));
|
||||
_timeMultiplier = num;
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
System.out.println("Failed parsing data for customloc: " + buildText);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.append(part + " ");
|
||||
}
|
||||
}
|
||||
|
||||
BuildText = sb.toString().trim();
|
||||
}
|
||||
|
||||
public int getBuildTime(int unmodified)
|
||||
{
|
||||
int newTime = unmodified;
|
||||
newTime += _timeAdd;
|
||||
newTime -= _timeSubtract;
|
||||
newTime = (int) (_timeMultiplier * newTime);
|
||||
if (_timeEqual != -1) newTime = _timeEqual;
|
||||
|
||||
// limit to range of 5-60 seconds
|
||||
return Math.min(Math.max(newTime, 5), 60);
|
||||
}
|
||||
|
||||
public int getPerfectScore()
|
||||
{
|
||||
int nonAirBlocks = 0;
|
||||
|
||||
for (int x = 0; x < Game.BuildSize; x++)
|
||||
{
|
||||
for (int y = 0; y < Game.BuildSize; y++)
|
||||
{
|
||||
for (int z = 0; z < Game.BuildSize; z++)
|
||||
{
|
||||
if (Build[x][y][z].getType() != Material.AIR)
|
||||
nonAirBlocks++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nonAirBlocks + Mobs.size();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,227 @@
|
||||
package nautilus.game.arcade.game.games.speedbuilders.data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mineplex.core.common.util.MapUtil;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.hologram.Hologram;
|
||||
|
||||
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.block.BlockState;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.Bed;
|
||||
import org.bukkit.material.Door;
|
||||
|
||||
public class DemolitionData
|
||||
{
|
||||
|
||||
public RecreationData Parent;
|
||||
|
||||
public NautHashMap<Block, BlockState> Blocks;
|
||||
public ArrayList<Entity> Mobs;
|
||||
|
||||
public long Start;
|
||||
|
||||
private Hologram _hologram;
|
||||
|
||||
private boolean _flickerAir = true;
|
||||
private long _lastFlicker = System.currentTimeMillis();
|
||||
|
||||
public DemolitionData(RecreationData parent, ArrayList<Block> blocks, ArrayList<Entity> mobs)
|
||||
{
|
||||
Parent = parent;
|
||||
|
||||
Blocks = new NautHashMap<Block, BlockState>();
|
||||
Mobs = mobs;
|
||||
|
||||
for (Block block : blocks)
|
||||
{
|
||||
Blocks.put(block, block.getState());
|
||||
}
|
||||
|
||||
Start = System.currentTimeMillis();
|
||||
|
||||
spawnHologram();
|
||||
}
|
||||
|
||||
public void spawnHologram()
|
||||
{
|
||||
if (Parent.Game.InstaBreak)
|
||||
return;
|
||||
|
||||
Location loc = Parent.getMidpoint();
|
||||
|
||||
if (!Blocks.isEmpty())
|
||||
loc = Blocks.keySet().iterator().next().getLocation().add(0.5, 0.5, 0.5);
|
||||
else if (!Mobs.isEmpty())
|
||||
loc = UtilAlg.Random(Mobs).getLocation().add(0, 1, 0);
|
||||
|
||||
_hologram = new Hologram(Parent.Game.Manager.getHologramManager(), loc, "3");
|
||||
|
||||
_hologram.start();
|
||||
}
|
||||
|
||||
public void despawnHologram()
|
||||
{
|
||||
if (_hologram == null)
|
||||
return;
|
||||
|
||||
_hologram.stop();
|
||||
|
||||
_hologram = null;
|
||||
}
|
||||
|
||||
public void update()
|
||||
{
|
||||
if (Parent.Game.InstaBreak)
|
||||
{
|
||||
breakBlocks();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (_hologram == null)
|
||||
spawnHologram();
|
||||
|
||||
int secondsLeft = (int) Math.ceil((3000 - (System.currentTimeMillis() - Start)) / 1000.0D);
|
||||
|
||||
if (secondsLeft < 0)
|
||||
secondsLeft = 0;
|
||||
|
||||
_hologram.setText("" + secondsLeft);
|
||||
|
||||
if (UtilTime.elapsed(_lastFlicker, 500))
|
||||
{
|
||||
_lastFlicker = System.currentTimeMillis();
|
||||
|
||||
for (Block block : Blocks.keySet())
|
||||
{
|
||||
if (_flickerAir)
|
||||
MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR);
|
||||
else
|
||||
Blocks.get(block).update(true, false);
|
||||
}
|
||||
|
||||
for (Entity entity : Mobs)
|
||||
{
|
||||
if (_flickerAir)
|
||||
UtilEnt.ghost(entity, true, true);
|
||||
else
|
||||
UtilEnt.ghost(entity, true, false);
|
||||
}
|
||||
|
||||
_flickerAir = !_flickerAir;
|
||||
}
|
||||
|
||||
if (secondsLeft == 0)
|
||||
breakBlocks();
|
||||
}
|
||||
|
||||
public void cancelBreak()
|
||||
{
|
||||
despawnHologram();
|
||||
|
||||
for (Block block : Blocks.keySet())
|
||||
{
|
||||
Blocks.get(block).update(true, false);
|
||||
}
|
||||
|
||||
for (Entity entity : Mobs)
|
||||
{
|
||||
UtilEnt.ghost(entity, true, false);
|
||||
}
|
||||
|
||||
Parent.BlocksForDemolition.remove(this);
|
||||
}
|
||||
|
||||
public void breakBlocks()
|
||||
{
|
||||
despawnHologram();
|
||||
|
||||
//Effect will play for all blocks even two-parted ones
|
||||
for (Block block : Blocks.keySet())
|
||||
{
|
||||
Blocks.get(block).update(true, false);
|
||||
|
||||
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());
|
||||
}
|
||||
|
||||
for (Block block : Blocks.keySet())
|
||||
{
|
||||
if (block.getType() == Material.AIR)
|
||||
continue;
|
||||
|
||||
//Ignore top double plant blocks
|
||||
if (block.getType() == Material.DOUBLE_PLANT)
|
||||
{
|
||||
if (block.getData() > 7)
|
||||
continue;
|
||||
}
|
||||
|
||||
for (ItemStack itemStack : UtilBlock.blockToInventoryItemStacks(block))
|
||||
{
|
||||
Item item = block.getWorld().dropItem(block.getLocation().add(0.5, 0.5, 0.5), itemStack);
|
||||
|
||||
Parent.DroppedItems.put(item, System.currentTimeMillis());
|
||||
}
|
||||
|
||||
//Destroy the other part
|
||||
if (block.getType() == Material.BED_BLOCK)
|
||||
{
|
||||
Bed bed = (Bed) block.getState().getData();
|
||||
|
||||
if (bed.isHeadOfBed())
|
||||
MapUtil.QuickChangeBlockAt(block.getRelative(bed.getFacing().getOppositeFace()).getLocation(), Material.AIR);
|
||||
else
|
||||
MapUtil.QuickChangeBlockAt(block.getRelative(bed.getFacing()).getLocation(), Material.AIR);
|
||||
}
|
||||
else if (block.getType() == Material.WOODEN_DOOR || block.getType() == Material.IRON_DOOR_BLOCK || block.getType() == Material.SPRUCE_DOOR || block.getType() == Material.BIRCH_DOOR || block.getType() == Material.JUNGLE_DOOR || block.getType() == Material.ACACIA_DOOR || block.getType() == Material.DARK_OAK_DOOR)
|
||||
{
|
||||
Door door = (Door) block.getState().getData();
|
||||
|
||||
if (door.isTopHalf())
|
||||
MapUtil.QuickChangeBlockAt(block.getRelative(BlockFace.DOWN).getLocation(), Material.AIR);
|
||||
else
|
||||
MapUtil.QuickChangeBlockAt(block.getRelative(BlockFace.UP).getLocation(), Material.AIR);
|
||||
}
|
||||
else if (block.getType() == Material.DOUBLE_PLANT)
|
||||
{
|
||||
//The top block does not carry the correct data
|
||||
if (block.getData() <= 7)
|
||||
MapUtil.QuickChangeBlockAt(block.getRelative(BlockFace.UP).getLocation(), Material.AIR);
|
||||
else
|
||||
MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR);
|
||||
}
|
||||
|
||||
MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR);
|
||||
}
|
||||
|
||||
for (Entity entity : Mobs)
|
||||
{
|
||||
ItemStack spawnEgg = new ItemStack(Material.MONSTER_EGG, 1, entity.getType().getTypeId());
|
||||
|
||||
Item item = entity.getWorld().dropItem(entity.getLocation().add(0, 1, 0), spawnEgg);
|
||||
|
||||
Parent.DroppedItems.put(item, System.currentTimeMillis());
|
||||
|
||||
entity.remove();
|
||||
|
||||
Parent.Mobs.remove(entity);
|
||||
}
|
||||
|
||||
Parent.BlocksForDemolition.remove(this);
|
||||
|
||||
Parent.Game.checkPerfectBuild(Parent.Player);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package nautilus.game.arcade.game.games.speedbuilders.data;
|
||||
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
public class MobData
|
||||
{
|
||||
|
||||
public EntityType EntityType;
|
||||
|
||||
public int DX;
|
||||
public int DY;
|
||||
public int DZ;
|
||||
|
||||
public MobData(EntityType entityType, int dx, int dy, int dz)
|
||||
{
|
||||
EntityType = entityType;
|
||||
|
||||
DX = dx;
|
||||
DY = dy;
|
||||
DZ = dz;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,444 @@
|
||||
package nautilus.game.arcade.game.games.speedbuilders.data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.MapUtil;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.hologram.Hologram;
|
||||
import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders;
|
||||
import net.minecraft.server.v1_8_R3.BlockPosition;
|
||||
import net.minecraft.server.v1_8_R3.BlockStairs;
|
||||
import net.minecraft.server.v1_8_R3.BlockStairs.EnumStairShape;
|
||||
import net.minecraft.server.v1_8_R3.IBlockData;
|
||||
|
||||
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.block.BlockState;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.Bed;
|
||||
import org.bukkit.material.Door;
|
||||
import org.bukkit.material.Stairs;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class RecreationData
|
||||
{
|
||||
|
||||
public SpeedBuilders Game;
|
||||
|
||||
public Player Player;
|
||||
|
||||
public BlockState[][] DefaultGround;
|
||||
|
||||
public Location OriginalBuildLocation;
|
||||
|
||||
public Location CornerA;
|
||||
public Location CornerB;
|
||||
|
||||
public Location PlayerSpawn;
|
||||
|
||||
public NautHashMap<Item, Long> DroppedItems = new NautHashMap<Item, Long>();
|
||||
|
||||
public ArrayList<DemolitionData> BlocksForDemolition = new ArrayList<DemolitionData>();
|
||||
|
||||
public ArrayList<Entity> Mobs = new ArrayList<Entity>();
|
||||
|
||||
private Hologram _hologram;
|
||||
|
||||
public RecreationData(SpeedBuilders game, Player player, Location loc, Location playerSpawn)
|
||||
{
|
||||
Game = game;
|
||||
|
||||
DefaultGround = new BlockState[game.BuildSize][game.BuildSize];
|
||||
|
||||
Player = player;
|
||||
|
||||
OriginalBuildLocation = loc;
|
||||
|
||||
CornerA = loc.clone().subtract(game.BuildSizeDiv2, 0, game.BuildSizeDiv2);
|
||||
CornerB = loc.clone().add(game.BuildSizeDiv2, game.BuildSizeMin1, game.BuildSizeDiv2);
|
||||
|
||||
PlayerSpawn = playerSpawn;
|
||||
|
||||
for (int x = 0; x < game.BuildSize; x++)
|
||||
{
|
||||
for (int z = 0; z < game.BuildSize; z++)
|
||||
{
|
||||
DefaultGround[x][z] = CornerA.clone().add(x, -1, z).getBlock().getState();
|
||||
}
|
||||
}
|
||||
|
||||
Vector mid = game.getJudgeSpawn().toVector().subtract(loc.toVector()).multiply(0.4);
|
||||
Location hologramLocation = loc.clone().add(mid).add(0, 1, 0);
|
||||
Location above = loc.clone().add(0.5, game.BuildSize + 0.5, 0.5);
|
||||
_hologram = new Hologram(game.getArcadeManager().getHologramManager(), hologramLocation, C.cYellow + player.getName());
|
||||
_hologram.start();
|
||||
}
|
||||
|
||||
public boolean inBuildArea(Block block)
|
||||
{
|
||||
if (block.getX() < Math.min(CornerA.getBlockX(), CornerB.getBlockX()))
|
||||
return false;
|
||||
|
||||
if (block.getY() < Math.min(CornerA.getBlockY(), CornerB.getBlockY()))
|
||||
return false;
|
||||
|
||||
if (block.getZ() < Math.min(CornerA.getBlockZ(), CornerB.getBlockZ()))
|
||||
return false;
|
||||
|
||||
if (block.getX() > Math.max(CornerA.getBlockX(), CornerB.getBlockX()))
|
||||
return false;
|
||||
|
||||
if (block.getY() > Math.max(CornerA.getBlockY(), CornerB.getBlockY()))
|
||||
return false;
|
||||
|
||||
if (block.getZ() > Math.max(CornerA.getBlockZ(), CornerB.getBlockZ()))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean inBuildArea(Location loc)
|
||||
{
|
||||
if (loc.getX() < Math.min(CornerA.getBlockX(), CornerB.getBlockX()))
|
||||
return false;
|
||||
|
||||
if (loc.getY() < Math.min(CornerA.getBlockY(), CornerB.getBlockY()))
|
||||
return false;
|
||||
|
||||
if (loc.getZ() < Math.min(CornerA.getBlockZ(), CornerB.getBlockZ()))
|
||||
return false;
|
||||
|
||||
if (loc.getX() > Math.max(CornerA.getBlockX(), CornerB.getBlockX()) + 1)
|
||||
return false;
|
||||
|
||||
if (loc.getY() > Math.max(CornerA.getBlockY(), CornerB.getBlockY()) + 1)
|
||||
return false;
|
||||
|
||||
if (loc.getZ() > Math.max(CornerA.getBlockZ(), CornerB.getBlockZ()) + 1)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void clearBuildArea(boolean resetGround)
|
||||
{
|
||||
for (Block block : getBlocks())
|
||||
{
|
||||
MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR);
|
||||
}
|
||||
|
||||
for (Entity entity : Mobs)
|
||||
{
|
||||
entity.remove();
|
||||
}
|
||||
|
||||
Mobs.clear();
|
||||
|
||||
if (resetGround)
|
||||
{
|
||||
for (int x = 0; x < Game.BuildSize; x++)
|
||||
{
|
||||
for (int z = 0; z < Game.BuildSize; z++)
|
||||
{
|
||||
MapUtil.QuickChangeBlockAt(CornerA.clone().add(x, -1, z), DefaultGround[x][z].getType(), DefaultGround[x][z].getRawData());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void pasteBuildData(BuildData buildData)
|
||||
{
|
||||
clearBuildArea(true);
|
||||
|
||||
for (int x = 0; x < Game.BuildSize; x++)
|
||||
{
|
||||
for (int z = 0; z < Game.BuildSize; z++)
|
||||
{
|
||||
MapUtil.QuickChangeBlockAt(CornerA.clone().add(x, -1, z), buildData.Ground[x][z].getType(), buildData.Ground[x][z].getRawData());
|
||||
}
|
||||
}
|
||||
|
||||
for (int x = 0; x < Game.BuildSize; x++)
|
||||
{
|
||||
for (int y = 0; y < Game.BuildSize; y++)
|
||||
{
|
||||
for (int z = 0; z < Game.BuildSize; z++)
|
||||
{
|
||||
MapUtil.QuickChangeBlockAt(CornerA.clone().add(x, y, z), buildData.Build[x][y][z].getType(), buildData.Build[x][y][z].getRawData());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Game.CreatureAllowOverride = true;
|
||||
|
||||
for (MobData mobData : buildData.Mobs)
|
||||
{
|
||||
Location loc = CornerA.clone().add(mobData.DX + 0.5, mobData.DY, mobData.DZ + 0.5);
|
||||
|
||||
Entity entity = loc.getWorld().spawnEntity(loc, mobData.EntityType);
|
||||
|
||||
UtilEnt.Vegetate(entity, true);
|
||||
UtilEnt.ghost(entity, true, false);
|
||||
|
||||
Mobs.add(entity);
|
||||
}
|
||||
|
||||
Game.CreatureAllowOverride = false;
|
||||
}
|
||||
|
||||
public void breakAndDropItems()
|
||||
{
|
||||
for (Block block : getBlocks())
|
||||
{
|
||||
if (block.getType() == Material.AIR)
|
||||
continue;
|
||||
|
||||
//Ignore top double plant blocks
|
||||
if (block.getType() == Material.DOUBLE_PLANT)
|
||||
{
|
||||
if (block.getData() > 7)
|
||||
continue;
|
||||
}
|
||||
|
||||
for (ItemStack itemStack : UtilBlock.blockToInventoryItemStacks(block))
|
||||
{
|
||||
UtilInv.insert(Player, itemStack);
|
||||
}
|
||||
|
||||
//Destroy the other part
|
||||
if (block.getType() == Material.BED_BLOCK)
|
||||
{
|
||||
Bed bed = (Bed) block.getState().getData();
|
||||
|
||||
if (bed.isHeadOfBed())
|
||||
MapUtil.QuickChangeBlockAt(block.getRelative(bed.getFacing().getOppositeFace()).getLocation(), Material.AIR);
|
||||
else
|
||||
MapUtil.QuickChangeBlockAt(block.getRelative(bed.getFacing()).getLocation(), Material.AIR);
|
||||
}
|
||||
else if (block.getType() == Material.WOODEN_DOOR || block.getType() == Material.IRON_DOOR_BLOCK || block.getType() == Material.SPRUCE_DOOR || block.getType() == Material.BIRCH_DOOR || block.getType() == Material.JUNGLE_DOOR || block.getType() == Material.ACACIA_DOOR || block.getType() == Material.DARK_OAK_DOOR)
|
||||
{
|
||||
Door door = (Door) block.getState().getData();
|
||||
|
||||
if (door.isTopHalf())
|
||||
MapUtil.QuickChangeBlockAt(block.getRelative(BlockFace.DOWN).getLocation(), Material.AIR);
|
||||
else
|
||||
MapUtil.QuickChangeBlockAt(block.getRelative(BlockFace.UP).getLocation(), Material.AIR);
|
||||
}
|
||||
else if (block.getType() == Material.DOUBLE_PLANT)
|
||||
{
|
||||
//The top block does not carry the correct data
|
||||
if (block.getData() <= 7)
|
||||
MapUtil.QuickChangeBlockAt(block.getRelative(BlockFace.UP).getLocation(), Material.AIR);
|
||||
else
|
||||
MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR);
|
||||
}
|
||||
}
|
||||
|
||||
for (Entity entity : Mobs)
|
||||
{
|
||||
ItemStack spawnEgg = new ItemStack(Material.MONSTER_EGG, 1, entity.getType().getTypeId());
|
||||
|
||||
UtilInv.insert(Player, spawnEgg);
|
||||
}
|
||||
|
||||
CornerA.getWorld().playEffect(getMidpoint(), Effect.STEP_SOUND, Material.LOG.getId());
|
||||
|
||||
clearBuildArea(false);
|
||||
}
|
||||
|
||||
public boolean isEmptyBuild(BuildData buildData)
|
||||
{
|
||||
for (Block block : getBlocks())
|
||||
{
|
||||
if (block.getType() != Material.AIR)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!buildData.Mobs.isEmpty())
|
||||
return Mobs.isEmpty();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public int calculateScoreFromBuild(BuildData buildData)
|
||||
{
|
||||
int score = 0;
|
||||
|
||||
for (int x = 0; x < Game.BuildSize; x++)
|
||||
{
|
||||
for (int y = 0; y < Game.BuildSize; y++)
|
||||
{
|
||||
for (int z = 0; z < Game.BuildSize; z++)
|
||||
{
|
||||
Block currentBlock = CornerA.clone().add(x, y, z).getBlock();
|
||||
BlockState expectedState = buildData.Build[x][y][z];
|
||||
|
||||
if (expectedState.getType() == Material.AIR)
|
||||
continue;
|
||||
|
||||
if (expectedState.getType() == currentBlock.getType() && expectedState.getRawData() == currentBlock.getData())
|
||||
{
|
||||
score++;
|
||||
continue;
|
||||
}
|
||||
|
||||
//Ender portal direction fix & 0x4 is a check to see if the frame has an ender eye in it
|
||||
if (currentBlock.getType() == Material.ENDER_PORTAL_FRAME && expectedState.getType() == Material.ENDER_PORTAL_FRAME && (currentBlock.getData() & 0x4) == (expectedState.getRawData() & 0x4))
|
||||
{
|
||||
score++;
|
||||
continue;
|
||||
}
|
||||
|
||||
//Sapling growth fix
|
||||
if (expectedState.getType() == Material.SAPLING && currentBlock.getType() == Material.SAPLING)
|
||||
{
|
||||
if (currentBlock.getData() % 8 == expectedState.getRawData() % 8)
|
||||
score++;
|
||||
}
|
||||
|
||||
//Fix for leaves decay flags
|
||||
if ((expectedState.getType() == Material.LEAVES && currentBlock.getType() == Material.LEAVES) || ((expectedState.getType() == Material.LEAVES_2 && currentBlock.getType() == Material.LEAVES_2)))
|
||||
{
|
||||
if (currentBlock.getData() % 4 == expectedState.getRawData() % 4)
|
||||
score++;
|
||||
}
|
||||
|
||||
//Fix for corner stair shape
|
||||
if (currentBlock.getState().getData() instanceof Stairs && expectedState.getData() instanceof Stairs)
|
||||
{
|
||||
net.minecraft.server.v1_8_R3.Block nmsBlock = CraftMagicNumbers.getBlock(currentBlock);
|
||||
|
||||
IBlockData blockData = nmsBlock.getBlockData();
|
||||
blockData = nmsBlock.updateState(blockData, ((CraftWorld) currentBlock.getWorld()).getHandle(), new BlockPosition(currentBlock.getX(), currentBlock.getY(), currentBlock.getZ()));
|
||||
|
||||
EnumStairShape expectedShape = buildData.StairShapes[x][y][z];
|
||||
EnumStairShape currentShape = blockData.get(BlockStairs.SHAPE);
|
||||
|
||||
if ((expectedShape == EnumStairShape.INNER_LEFT && currentShape == EnumStairShape.INNER_RIGHT) || (expectedShape == EnumStairShape.INNER_RIGHT && currentShape == EnumStairShape.INNER_LEFT) || (expectedShape == EnumStairShape.OUTER_LEFT && currentShape == EnumStairShape.OUTER_RIGHT) || (expectedShape == EnumStairShape.OUTER_RIGHT && currentShape == EnumStairShape.OUTER_LEFT))
|
||||
score++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (MobData mobData : buildData.Mobs)
|
||||
{
|
||||
for (Entity entity : Mobs)
|
||||
{
|
||||
int dx = (int) (entity.getLocation().getX() - (CornerA.getX() + 0.5));
|
||||
int dy = (int) (entity.getLocation().getY() - CornerA.getY());
|
||||
int dz = (int) (entity.getLocation().getZ() - (CornerA.getZ() + 0.5));
|
||||
|
||||
if (mobData.EntityType == entity.getType() && mobData.DX == dx && mobData.DY == dy && mobData.DZ == dz)
|
||||
{
|
||||
score++;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return score;
|
||||
}
|
||||
|
||||
public Location getMidpoint()
|
||||
{
|
||||
return UtilAlg.getMidpoint(CornerA, CornerB.clone().add(1, 1, 1));
|
||||
}
|
||||
|
||||
public List<Block> getBlocks()
|
||||
{
|
||||
return UtilBlock.getInBoundingBox(CornerA, CornerB);
|
||||
}
|
||||
|
||||
public boolean isQueuedForDemolition(Block block)
|
||||
{
|
||||
for (DemolitionData demolition : BlocksForDemolition)
|
||||
{
|
||||
if (demolition.Blocks.containsKey(block))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isQueuedForDemolition(Entity entity)
|
||||
{
|
||||
for (DemolitionData demolition : BlocksForDemolition)
|
||||
{
|
||||
if (demolition.Mobs.contains(entity))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void addToDemolition(Block block)
|
||||
{
|
||||
if (isQueuedForDemolition(block))
|
||||
return;
|
||||
|
||||
ArrayList<Block> blocks = new ArrayList<Block>();
|
||||
blocks.add(block);
|
||||
|
||||
//Add the other part of the block
|
||||
if (block.getType() == Material.BED_BLOCK)
|
||||
{
|
||||
Bed bed = (Bed) block.getState().getData();
|
||||
|
||||
if (bed.isHeadOfBed())
|
||||
blocks.add(block.getRelative(bed.getFacing().getOppositeFace()));
|
||||
else
|
||||
blocks.add(block.getRelative(bed.getFacing()));
|
||||
}
|
||||
else if (block.getType() == Material.WOODEN_DOOR || block.getType() == Material.IRON_DOOR_BLOCK || block.getType() == Material.SPRUCE_DOOR || block.getType() == Material.BIRCH_DOOR || block.getType() == Material.JUNGLE_DOOR || block.getType() == Material.ACACIA_DOOR || block.getType() == Material.DARK_OAK_DOOR)
|
||||
{
|
||||
Door door = (Door) block.getState().getData();
|
||||
|
||||
if (door.isTopHalf())
|
||||
blocks.add(block.getRelative(BlockFace.DOWN));
|
||||
else
|
||||
blocks.add(block.getRelative(BlockFace.UP));
|
||||
}
|
||||
else if (block.getType() == Material.DOUBLE_PLANT)
|
||||
{
|
||||
if (block.getData() > 7)
|
||||
blocks.add(block.getRelative(BlockFace.DOWN));
|
||||
else
|
||||
blocks.add(block.getRelative(BlockFace.UP));
|
||||
}
|
||||
|
||||
BlocksForDemolition.add(new DemolitionData(this, blocks, new ArrayList<Entity>()));
|
||||
}
|
||||
|
||||
public void addToDemolition(Entity entity)
|
||||
{
|
||||
if (isQueuedForDemolition(entity))
|
||||
return;
|
||||
|
||||
ArrayList<Entity> mobs = new ArrayList<Entity>();
|
||||
mobs.add(entity);
|
||||
|
||||
BlocksForDemolition.add(new DemolitionData(this, new ArrayList<Block>(), mobs));
|
||||
}
|
||||
|
||||
public void removeHologram()
|
||||
{
|
||||
_hologram.stop();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package nautilus.game.arcade.game.games.speedbuilders.events;
|
||||
|
||||
import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class PerfectBuildEvent extends Event
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private Player _player;
|
||||
private SpeedBuilders _game;
|
||||
private long _timeElapsed; // Build time elapsed in ms
|
||||
|
||||
public PerfectBuildEvent(Player player, long timeElapsed, SpeedBuilders game)
|
||||
{
|
||||
_player = player;
|
||||
_timeElapsed = timeElapsed;
|
||||
_game = game;
|
||||
}
|
||||
|
||||
public Player getPlayer()
|
||||
{
|
||||
return _player;
|
||||
}
|
||||
|
||||
public long getTimeElapsed()
|
||||
{
|
||||
return _timeElapsed;
|
||||
}
|
||||
|
||||
public SpeedBuilders getGame()
|
||||
{
|
||||
return _game;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package nautilus.game.arcade.game.games.speedbuilders.kits;
|
||||
|
||||
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.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class DefaultKit extends Kit
|
||||
{
|
||||
|
||||
public DefaultKit(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Speed Builder", KitAvailability.Free,
|
||||
new String[]
|
||||
{
|
||||
"Professional build recreator!",
|
||||
},
|
||||
new Perk[]
|
||||
{
|
||||
|
||||
},
|
||||
EntityType.ZOMBIE, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package nautilus.game.arcade.game.games.speedbuilders.stattrackers;
|
||||
|
||||
import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders;
|
||||
import nautilus.game.arcade.game.games.speedbuilders.events.PerfectBuildEvent;
|
||||
import nautilus.game.arcade.stats.StatTracker;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
public class DependableTracker extends StatTracker<SpeedBuilders>
|
||||
{
|
||||
|
||||
public DependableTracker(SpeedBuilders game)
|
||||
{
|
||||
super(game);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPerfectBuild(PerfectBuildEvent event)
|
||||
{
|
||||
addStat(event.getPlayer(), "PerfectBuild", 1, false, false);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package nautilus.game.arcade.game.games.speedbuilders.stattrackers;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders;
|
||||
import nautilus.game.arcade.game.games.speedbuilders.events.PerfectBuildEvent;
|
||||
import nautilus.game.arcade.stats.StatTracker;
|
||||
|
||||
public class FirstBuildTracker extends StatTracker<SpeedBuilders>
|
||||
{
|
||||
|
||||
private boolean _first = true;
|
||||
|
||||
public FirstBuildTracker(SpeedBuilders game)
|
||||
{
|
||||
super(game);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPerfectBuild(PerfectBuildEvent event)
|
||||
{
|
||||
if (_first)
|
||||
{
|
||||
addStat(event.getPlayer(), "PerfectFirst", 1, false, false);
|
||||
|
||||
_first = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package nautilus.game.arcade.game.games.speedbuilders.stattrackers;
|
||||
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders;
|
||||
import nautilus.game.arcade.game.games.speedbuilders.events.PerfectBuildEvent;
|
||||
import nautilus.game.arcade.stats.StatTracker;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
public class PerfectionistTracker extends StatTracker<SpeedBuilders>
|
||||
{
|
||||
|
||||
private SpeedBuilders _game;
|
||||
|
||||
private NautHashMap<Player, Integer> _perfectBuilds = new NautHashMap<Player, Integer>();
|
||||
|
||||
public PerfectionistTracker(SpeedBuilders game)
|
||||
{
|
||||
super(game);
|
||||
|
||||
_game = game;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPerfectBuild(PerfectBuildEvent event)
|
||||
{
|
||||
int previousPerfectBuilds = _perfectBuilds.containsKey(event.getPlayer()) ? _perfectBuilds.get(event.getPlayer()) : 0;
|
||||
|
||||
_perfectBuilds.put(event.getPlayer(), previousPerfectBuilds + 1);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEnd(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.End)
|
||||
return;
|
||||
|
||||
for (Entry<Player, Integer> entry : _perfectBuilds.entrySet())
|
||||
{
|
||||
if (entry.getValue().intValue() == _game.getRoundsPlayed())
|
||||
addStat(entry.getKey(), "PerfectWins", 1, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package nautilus.game.arcade.game.games.speedbuilders.stattrackers;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders;
|
||||
import nautilus.game.arcade.game.games.speedbuilders.events.PerfectBuildEvent;
|
||||
import nautilus.game.arcade.stats.StatTracker;
|
||||
|
||||
public class SpeediestBuilderizerTracker extends StatTracker<SpeedBuilders>
|
||||
{
|
||||
public SpeediestBuilderizerTracker(SpeedBuilders game)
|
||||
{
|
||||
super(game);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPerfectBuild(PerfectBuildEvent event)
|
||||
{
|
||||
if (event.getTimeElapsed() < 10000) // 10 Seconds
|
||||
addStat(event.getPlayer(), "SpeediestBuilderizer", 1, true, false);
|
||||
}
|
||||
|
||||
}
|
@ -122,7 +122,7 @@ public class Minion
|
||||
"Purpose", "Symptom", "Sticks", "Measure", "Slimes", "Greece", "Spooky", "Coffee", "Aliens", "Cities",
|
||||
"Bikini", "Mortal", "Serena", "Future", "Bottle", "Helmet", "Crunch", "Afraid", "Threat", "Static",
|
||||
"Happy", "Knife", "Scary", "Lapis", "Skirt", "Waves", "Calem", "Clock", "Taste", "Lucas",
|
||||
"Anger", "Spork", "Maike", "Candy", "Shirt", "Tides", "Ocean", "Crawl", "Smell", "React",
|
||||
"Anger", "Spork", "Make", "Candy", "Shirt", "Tides", "Ocean", "Crawl", "Smell", "React",
|
||||
"Dolls", "Roses", "Trips", "Flute", "Pants", "Brick", "Three", "Ethan", "Uncle", "Lunch",
|
||||
"Legos", "Tulip", "Beach", "Wipes", "Heels", "Straw", "Seven", "Hands", "Queen", "Books",
|
||||
"Couch", "Grass", "Clans", "Frame", "Nails", "Cream", "Eight", "Belly", "Crown", "Polls",
|
||||
|
@ -1,10 +1,15 @@
|
||||
package nautilus.game.arcade.gui.spectatorMenu.button;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTextBottom;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
|
||||
@ -33,7 +38,26 @@ public class SpectatorButton implements IButton
|
||||
|
||||
if (_arcadeManager.IsAlive(_target))
|
||||
{
|
||||
_player.teleport(_target.getLocation().add(0, 1, 0));
|
||||
if(clickType == ClickType.RIGHT)
|
||||
{
|
||||
_player.closeInventory();
|
||||
_player.teleport(_target.getLocation().add(0, 1, 0));
|
||||
_arcadeManager.runSyncLater(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
_player.setGameMode(GameMode.SPECTATOR);
|
||||
_player.setSpectatorTarget(_target);
|
||||
UtilTextBottom.display(C.cYellow + "You are spectating " + F.game(_target.getName()), player);
|
||||
UtilPlayer.message(_player, F.main("Game", "Sneak to stop spectating"));
|
||||
}
|
||||
}, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
_player.teleport(_target.getLocation().add(0, 1, 0));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -228,7 +228,8 @@ public class SpectatorPage extends
|
||||
lore.add(ChatColor.RESET + C.cYellow + "Height Difference: " + C.cWhite
|
||||
+ UtilMath.trim(1, heightDifference));
|
||||
lore.add(" ");
|
||||
lore.add(ChatColor.RESET + C.Line + "Click to Spectate");
|
||||
lore.add(ChatColor.YELLOW + "Left Click" + ChatColor.RESET + " Teleport");
|
||||
lore.add(ChatColor.YELLOW + "Right Click" + ChatColor.RESET + " Spectate");
|
||||
SkullMeta skullMeta = ((SkullMeta) item.getItemMeta());
|
||||
skullMeta.setOwner(other.getName());
|
||||
skullMeta.setDisplayName(team.GetColor() + other.getName());
|
||||
|
@ -97,6 +97,7 @@ public class GameCreationManager implements Listener
|
||||
{
|
||||
Game game = gameIterator.next();
|
||||
|
||||
game.disable();
|
||||
|
||||
HandlerList.unregisterAll(game);
|
||||
|
||||
|
@ -888,7 +888,7 @@ public class GameFlagManager implements Listener
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
if (!game.isInsideMap(player) && game.IsAlive(player))
|
||||
{
|
||||
{
|
||||
//Riding a Projectile, edgecase
|
||||
if (player.getVehicle() != null && player.getVehicle() instanceof Projectile)
|
||||
{
|
||||
@ -897,38 +897,36 @@ public class GameFlagManager implements Listener
|
||||
((CraftPlayer)player).getHandle().spectating = false;
|
||||
}
|
||||
|
||||
if (!Manager.IsAlive(player) || ((CraftPlayer)player).getHandle().spectating)
|
||||
if (!game.WorldBoundaryKill)
|
||||
{
|
||||
player.teleport(game.GetSpectatorLocation());
|
||||
UtilPlayer.message(player, C.cRed + C.Bold + "WARNING: " + C.cWhite + C.Bold + "RETURN TO PLAYABLE AREA!");
|
||||
|
||||
if (game.GetType() != GameType.Gravity)
|
||||
{
|
||||
if (player.getLocation().getY() > game.WorldData.MaxY)
|
||||
UtilAction.velocity(player, UtilAlg.getTrajectory2d(player.getLocation(), game.GetSpectatorLocation()), 1, true, 0, 0, 10, true);
|
||||
else
|
||||
UtilAction.velocity(player, UtilAlg.getTrajectory2d(player.getLocation(), game.GetSpectatorLocation()), 1, true, 0.4, 0, 10, true);
|
||||
}
|
||||
|
||||
Manager.GetDamage().NewDamageEvent(player, null, null,
|
||||
DamageCause.VOID, 4, false, false, false,
|
||||
"Border", "Border Damage");
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 1f);
|
||||
player.getWorld().playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 1f);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!game.WorldBoundaryKill)
|
||||
{
|
||||
UtilPlayer.message(player, C.cRed + C.Bold + "WARNING: " + C.cWhite + C.Bold + "RETURN TO PLAYABLE AREA!");
|
||||
|
||||
if (game.GetType() != GameType.Gravity)
|
||||
{
|
||||
if (player.getLocation().getY() > game.WorldData.MaxY)
|
||||
UtilAction.velocity(player, UtilAlg.getTrajectory2d(player.getLocation(), game.GetSpectatorLocation()), 1, true, 0, 0, 10, true);
|
||||
else
|
||||
UtilAction.velocity(player, UtilAlg.getTrajectory2d(player.getLocation(), game.GetSpectatorLocation()), 1, true, 0.4, 0, 10, true);
|
||||
}
|
||||
|
||||
Manager.GetDamage().NewDamageEvent(player, null, null,
|
||||
DamageCause.VOID, 4, false, false, false,
|
||||
"Border", "Border Damage");
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 1f);
|
||||
player.getWorld().playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 1f);
|
||||
}
|
||||
else
|
||||
{
|
||||
Manager.GetDamage().NewDamageEvent(player, null, null,
|
||||
DamageCause.VOID, 9001, false, false, false,
|
||||
"Border", "Border Damage");
|
||||
}
|
||||
}
|
||||
Manager.GetDamage().NewDamageEvent(player, null, null,
|
||||
DamageCause.VOID, 9001, false, false, false,
|
||||
"Border", "Border Damage");
|
||||
}
|
||||
}
|
||||
|
||||
if (!game.isInsideMap(player) && (!Manager.IsAlive(player) || ((CraftPlayer)player).getHandle().spectating))
|
||||
{
|
||||
player.teleport(game.GetSpectatorLocation());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,34 @@
|
||||
package nautilus.game.arcade.managers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextBottom;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||
import org.bukkit.event.vehicle.VehicleDamageEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class GameSpectatorManager implements Listener
|
||||
{
|
||||
@ -22,9 +41,9 @@ public class GameSpectatorManager implements Listener
|
||||
Manager.getPluginManager().registerEvents(this, Manager.getPlugin());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
|
||||
public void interactCancel(PlayerInteractEvent event)
|
||||
{
|
||||
{
|
||||
if (Manager.GetGame() == null)
|
||||
return;
|
||||
|
||||
@ -32,6 +51,56 @@ public class GameSpectatorManager implements Listener
|
||||
|
||||
if (!Manager.GetGame().IsAlive(player))
|
||||
event.setCancelled(true);
|
||||
|
||||
processClick(player, event.getAction());
|
||||
}
|
||||
|
||||
public void processClick(Player player, Action action)
|
||||
{
|
||||
if (Manager.GetGame() == null)
|
||||
return;
|
||||
|
||||
if(!Manager.GetGame().AllowEntitySpectate)
|
||||
return;
|
||||
|
||||
if(!Manager.GetGame().IsLive())
|
||||
return;
|
||||
|
||||
if(player.getGameMode() != GameMode.SPECTATOR)
|
||||
return;
|
||||
|
||||
if(player.getSpectatorTarget() == null)
|
||||
return;
|
||||
|
||||
if(!(player.getSpectatorTarget() instanceof Player))
|
||||
return;
|
||||
|
||||
List<Player> players = Manager.GetGame().GetPlayers(true);
|
||||
int currentPlayer = 0;
|
||||
for(Player otherPlayer : players)
|
||||
{
|
||||
currentPlayer++;
|
||||
if(((Player) player.getSpectatorTarget()) == otherPlayer)
|
||||
break;
|
||||
}
|
||||
|
||||
if(action == Action.LEFT_CLICK_AIR || action == Action.LEFT_CLICK_BLOCK)
|
||||
currentPlayer = currentPlayer - 2;
|
||||
else
|
||||
return;
|
||||
|
||||
if(currentPlayer < 0)
|
||||
currentPlayer = players.size() - 1;
|
||||
|
||||
if(currentPlayer >= players.size())
|
||||
currentPlayer = 0;
|
||||
|
||||
if(players.get(currentPlayer) == null)
|
||||
return;
|
||||
|
||||
Player specPlayer = players.get(currentPlayer);
|
||||
|
||||
setSpectating(player, specPlayer);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
@ -51,7 +120,127 @@ public class GameSpectatorManager implements Listener
|
||||
}
|
||||
|
||||
if (!Manager.GetGame().IsAlive(player))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
if(Manager.GetGame().IsLive())
|
||||
{
|
||||
if(Manager.GetGame().AllowEntitySpectate)
|
||||
{
|
||||
setSpectating(player, event.getRightClicked());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateSpecEntitys(UpdateEvent event)
|
||||
{
|
||||
if(event.getType() != UpdateType.FASTER)
|
||||
return;
|
||||
|
||||
if(Manager.GetGame() == null)
|
||||
return;
|
||||
|
||||
if(Manager.GetGame().IsLive() || Manager.GetGame().GetState() == GameState.End)
|
||||
{
|
||||
if(Manager.GetGame().AllowEntitySpectate)
|
||||
{
|
||||
for(Player player : UtilServer.getPlayers())
|
||||
{
|
||||
if (!Manager.GetGame().IsAlive(player))
|
||||
{
|
||||
if(player.getGameMode() == GameMode.SPECTATOR)
|
||||
{
|
||||
if(player.getSpectatorTarget() == null)
|
||||
{
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
player.setAllowFlight(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void spectatedEntityDeath(PlayerDeathEvent event)
|
||||
{
|
||||
if(Manager.GetGame() == null)
|
||||
return;
|
||||
|
||||
if(Manager.GetGame().IsLive() || Manager.GetGame().GetState() == GameState.End)
|
||||
{
|
||||
if(Manager.GetGame().AllowEntitySpectate)
|
||||
{
|
||||
for(Player player : UtilServer.getPlayers())
|
||||
{
|
||||
if (!Manager.GetGame().IsAlive(player))
|
||||
{
|
||||
if(player.getGameMode() == GameMode.SPECTATOR)
|
||||
{
|
||||
if(player.getSpectatorTarget() == event.getEntity())
|
||||
{
|
||||
if(Manager.GetGame().GetPlayers(true).size() >= 1)
|
||||
{
|
||||
setSpectating(player, Manager.GetGame().GetPlayers(true).get(UtilMath.r(Manager.GetGame().GetPlayers(true).size())));
|
||||
return;
|
||||
}
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
player.setAllowFlight(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void dismountEntity(PlayerToggleSneakEvent event)
|
||||
{
|
||||
if(Manager.GetGame() == null)
|
||||
return;
|
||||
|
||||
if(Manager.GetGame().IsLive() || Manager.GetGame().GetState() == GameState.End)
|
||||
{
|
||||
if(Manager.GetGame().AllowEntitySpectate)
|
||||
{
|
||||
if(!Manager.GetGame().IsAlive(event.getPlayer()))
|
||||
{
|
||||
if(event.getPlayer().getGameMode() == GameMode.SPECTATOR)
|
||||
{
|
||||
event.getPlayer().setGameMode(GameMode.SURVIVAL);
|
||||
event.getPlayer().setAllowFlight(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setSpectating(Player player, Entity target)
|
||||
{
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
player.teleport(target.getLocation().add(0, 1, 0));
|
||||
player.getInventory().setHeldItemSlot(5);
|
||||
Manager.runSyncLater(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if(target instanceof Player)
|
||||
{
|
||||
if(!Manager.GetGame().IsAlive(target))
|
||||
return;
|
||||
}
|
||||
player.setGameMode(GameMode.SPECTATOR);
|
||||
player.setSpectatorTarget(target);
|
||||
if(target instanceof Player)
|
||||
UtilTextBottom.display(C.cYellow + "You are spectating " + F.game(((Player) target).getName()), player);
|
||||
|
||||
UtilPlayer.message(player, F.main("Game", "Sneak to stop spectating"));
|
||||
}
|
||||
}, 3);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
|
Loading…
Reference in New Issue
Block a user