Fixed merging issues
This commit is contained in:
commit
1904990f84
@ -72,6 +72,11 @@ public enum Rank
|
||||
return _description;
|
||||
}
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
||||
public String getRawTag()
|
||||
{
|
||||
if (Name.equalsIgnoreCase("ALL"))
|
||||
|
@ -71,6 +71,23 @@ public class ShapeWings extends ShapeGrid implements CosmeticShape
|
||||
"00000$$0000000$$00000"
|
||||
};
|
||||
|
||||
public static final String[] BEE_WING_PATTERN = new String[]
|
||||
{
|
||||
"00$$$000$$$00",
|
||||
"0$###$0$###$0",
|
||||
"$$$$$$$$$$$$$",
|
||||
"$#####$#####$",
|
||||
"$$$$$$$$$$$$$",
|
||||
"0$#########$0",
|
||||
"00$$$$$$$$$00",
|
||||
"0$#########$0",
|
||||
"$$$$$$$$$$$$$",
|
||||
"$#####$#####$",
|
||||
"$$$$$$$$$$$$$",
|
||||
"0$###$0$###$0",
|
||||
"00$$$000$$$00"
|
||||
};
|
||||
|
||||
public static final String[] SMALL_BUTTERFLY_WING_PATTERN = new String[]
|
||||
{
|
||||
"0$$00000000$$0",
|
||||
|
@ -56,6 +56,8 @@ public class UtilColor
|
||||
return 13;
|
||||
case DARK_AQUA:
|
||||
return 9;
|
||||
case DARK_RED:
|
||||
return 12;
|
||||
case DARK_PURPLE:
|
||||
return 10;
|
||||
case GOLD:
|
||||
|
@ -51,6 +51,7 @@ import org.bukkit.util.Vector;
|
||||
public class UtilEnt
|
||||
{
|
||||
public static final String FLAG_NO_REMOVE = "noremove";
|
||||
public static final String FLAG_ENTITY_COMPONENT = "component";
|
||||
|
||||
//Custom Entity Names
|
||||
private static HashMap<Entity, String> _nameMap = new HashMap<Entity, String>();
|
||||
@ -312,38 +313,19 @@ public class UtilEnt
|
||||
|
||||
public static void removeGoalSelectors(Entity entity)
|
||||
{
|
||||
try
|
||||
if (((CraftEntity)entity).getHandle() instanceof EntityInsentient)
|
||||
{
|
||||
if (_goalSelector == null)
|
||||
{
|
||||
_goalSelector = EntityInsentient.class.getDeclaredField("goalSelector");
|
||||
_goalSelector.setAccessible(true);
|
||||
}
|
||||
EntityInsentient creature = (EntityInsentient)((CraftEntity)entity).getHandle();
|
||||
creature.goalSelector = new PathfinderGoalSelector(((CraftWorld)entity.getWorld()).getHandle().methodProfiler);
|
||||
}
|
||||
}
|
||||
|
||||
if (((CraftEntity)entity).getHandle() instanceof EntityInsentient)
|
||||
{
|
||||
EntityInsentient creature = (EntityInsentient)((CraftEntity)entity).getHandle();
|
||||
|
||||
PathfinderGoalSelector goalSelector = new PathfinderGoalSelector(((CraftWorld)entity.getWorld()).getHandle().methodProfiler);
|
||||
|
||||
_goalSelector.set(creature, goalSelector);
|
||||
}
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
public static void removeTargetSelectors(Entity entity)
|
||||
{
|
||||
if (((CraftEntity)entity).getHandle() instanceof EntityInsentient)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (IllegalAccessException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (NoSuchFieldException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (SecurityException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
EntityInsentient creature = (EntityInsentient)((CraftEntity)entity).getHandle();
|
||||
creature.targetSelector = new PathfinderGoalSelector(((CraftWorld)entity.getWorld()).getHandle().methodProfiler);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -372,11 +372,12 @@ public class UtilParticle
|
||||
int count, ViewDist dist, Player... players)
|
||||
{
|
||||
PacketPlayOutWorldParticles packet = getPacket(particle, location, offsetX, offsetY, offsetZ, speed, count, true);
|
||||
int distValue = dist.getDist() * dist.getDist();
|
||||
|
||||
for (Player player : players)
|
||||
{
|
||||
// Out of range for player
|
||||
if (UtilMath.offset(player.getLocation(), location) > dist.getDist())
|
||||
if (UtilMath.offsetSquared(player.getLocation(), location) > distValue)
|
||||
continue;
|
||||
|
||||
UtilPlayer.sendPacket(player, packet);
|
||||
|
@ -1133,6 +1133,18 @@ public class UtilPlayer
|
||||
player.spigot().sendMessage(textComponent);
|
||||
}
|
||||
|
||||
public static void closeInventoryIfOpen(Player player)
|
||||
{
|
||||
if (hasOpenInventory(player))
|
||||
player.closeInventory();
|
||||
}
|
||||
|
||||
public static boolean hasOpenInventory(Player player)
|
||||
{
|
||||
EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
|
||||
return entityPlayer.activeContainer != entityPlayer.defaultContainer;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns whether the UUID belongs to a slim skin
|
||||
*/
|
||||
|
@ -0,0 +1,126 @@
|
||||
package mineplex.core;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.EntityPlayer;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayInArmAnimation;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayInBlockDig;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayInBlockPlace;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayInEntityAction;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayInFlying;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayInHeldItemSlot;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayInRightClick;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutCloseWindow;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutOpenWindow;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import mineplex.core.packethandler.IPacketHandler;
|
||||
import mineplex.core.packethandler.PacketHandler;
|
||||
import mineplex.core.packethandler.PacketInfo;
|
||||
|
||||
/**
|
||||
* Why do we need this you ask?
|
||||
* <p>
|
||||
* In 1.8.x, Mojang added Twitch integration, and in standard Mojang fashion completely broke inventory handling.
|
||||
* <p>
|
||||
* Specifically, you are able to close an inventory and not actually trigger an InventoryCloseEvent. This kinda breaks
|
||||
* literally anything relying on that event.
|
||||
* <p>
|
||||
* So we just add lots of strict checks to make sure they can't do much without closing the inventory
|
||||
*/
|
||||
@ReflectivelyCreateMiniPlugin
|
||||
public class TwitchIntegrationFix extends MiniPlugin implements IPacketHandler
|
||||
{
|
||||
private final Map<UUID, Location> _inventoryOpenedAt = new HashMap<>();
|
||||
private final Map<UUID, Long> _inventoryOpenedAtTime = new HashMap<>();
|
||||
|
||||
private TwitchIntegrationFix()
|
||||
{
|
||||
super("Twitch Integration Fix");
|
||||
|
||||
require(PacketHandler.class).addPacketHandler(this, true,
|
||||
PacketPlayOutOpenWindow.class,
|
||||
PacketPlayOutCloseWindow.class,
|
||||
PacketPlayInRightClick.class,
|
||||
PacketPlayInBlockPlace.class,
|
||||
PacketPlayInArmAnimation.class,
|
||||
PacketPlayInBlockDig.class,
|
||||
PacketPlayInHeldItemSlot.class,
|
||||
PacketPlayInUseEntity.class,
|
||||
PacketPlayInFlying.PacketPlayInPosition.class,
|
||||
PacketPlayInFlying.PacketPlayInPositionLook.class
|
||||
);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onQuit(PlayerQuitEvent event)
|
||||
{
|
||||
_inventoryOpenedAt.remove(event.getPlayer().getUniqueId());
|
||||
_inventoryOpenedAtTime.remove(event.getPlayer().getUniqueId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(PacketInfo packetInfo)
|
||||
{
|
||||
EntityPlayer entityPlayer = ((CraftPlayer) packetInfo.getPlayer()).getHandle();
|
||||
if (packetInfo.getPacket() instanceof PacketPlayOutOpenWindow)
|
||||
{
|
||||
_inventoryOpenedAt.put(packetInfo.getPlayer().getUniqueId(), packetInfo.getPlayer().getLocation());
|
||||
_inventoryOpenedAtTime.put(packetInfo.getPlayer().getUniqueId(), entityPlayer.playerConnection.networkManager.packetCount);
|
||||
}
|
||||
else if (packetInfo.getPacket() instanceof PacketPlayOutCloseWindow)
|
||||
{
|
||||
_inventoryOpenedAt.remove(packetInfo.getPlayer().getUniqueId());
|
||||
_inventoryOpenedAtTime.remove(packetInfo.getPlayer().getUniqueId());
|
||||
}
|
||||
else if (packetInfo.getPacket() instanceof PacketPlayInRightClick ||
|
||||
packetInfo.getPacket() instanceof PacketPlayInBlockPlace ||
|
||||
packetInfo.getPacket() instanceof PacketPlayInArmAnimation ||
|
||||
packetInfo.getPacket() instanceof PacketPlayInBlockDig ||
|
||||
packetInfo.getPacket() instanceof PacketPlayInHeldItemSlot ||
|
||||
packetInfo.getPacket() instanceof PacketPlayInUseEntity
|
||||
)
|
||||
{
|
||||
// Impossible to do while inventory is open
|
||||
if (entityPlayer.activeContainer != entityPlayer.defaultContainer && _inventoryOpenedAtTime.containsKey(packetInfo.getPlayer().getUniqueId()))
|
||||
{
|
||||
long openedTime = _inventoryOpenedAtTime.get(packetInfo.getPlayer().getUniqueId());
|
||||
if (entityPlayer.playerConnection.networkManager.packetCount - openedTime > 5)
|
||||
{
|
||||
System.out.println("Impossible packet: " + packetInfo.getPacket().getClass());
|
||||
packetInfo.getPlayer().closeInventory();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (packetInfo.getPacket() instanceof PacketPlayInFlying)
|
||||
{
|
||||
if (entityPlayer.activeContainer != entityPlayer.defaultContainer)
|
||||
{
|
||||
if (_inventoryOpenedAt.containsKey(packetInfo.getPlayer().getUniqueId()))
|
||||
{
|
||||
Location openedAt = _inventoryOpenedAt.get(packetInfo.getPlayer().getUniqueId());
|
||||
if (!packetInfo.getPlayer().getWorld().equals(openedAt.getWorld()))
|
||||
{
|
||||
packetInfo.getPlayer().closeInventory();
|
||||
}
|
||||
else
|
||||
{
|
||||
double distance = packetInfo.getPlayer().getLocation().distanceSquared(openedAt);
|
||||
// You get a 9 block radius before you're considered too far away
|
||||
if (distance > 9 * 9)
|
||||
{
|
||||
packetInfo.getPlayer().closeInventory();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -449,7 +449,7 @@ public enum Achievement
|
||||
|
||||
CHAMPIONS_SPECIAL_WIN("Champion of Champions", 3000,
|
||||
new String[]{"Champions CTF.SpecialWin"},
|
||||
new String[]{"Win the game with 5 more captures than the other team"},
|
||||
new String[]{"Win the game with 5 more flag captures than the other team"},
|
||||
new int[]{1},
|
||||
AchievementCategory.CHAMPIONS),
|
||||
|
||||
|
@ -112,7 +112,7 @@ public enum AchievementCategory
|
||||
|
||||
DRAW_MY_THING("Draw My Thing", null,
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED },
|
||||
Material.BOOK_AND_QUILL, 0, GameCategory.CLASSICS, "Extra Tools Kit", false, GameDisplay.Draw.getGameId()),
|
||||
Material.BOOK_AND_QUILL, 0, GameCategory.CLASSICS, "None", false, GameDisplay.Draw.getGameId()),
|
||||
|
||||
CHAMPIONS("Champions", new String[] {"Champions Domination", "Champions TDM", "Champions CTF"},
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED, new StatDisplay("Flags Captured", "Captures") },
|
||||
|
@ -1,203 +1,254 @@
|
||||
package mineplex.core.aprilfools;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.aprilfools.command.PirateSongCommand;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.twofactor.TwoFactorAuth;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.disguise.DisguiseManager;
|
||||
import mineplex.core.disguise.disguises.DisguiseCow;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import java.util.Map;
|
||||
|
||||
public class AprilFoolsManager extends MiniPlugin
|
||||
{
|
||||
public static AprilFoolsManager Instance;
|
||||
|
||||
/**
|
||||
* Manually can be toggled to enable or disable the April Fools activities.
|
||||
*/
|
||||
private static final boolean ENABLED = false;
|
||||
|
||||
private static final Map<String, String> CHAT_REPLACEMENTS = ImmutableMap.<String, String>builder()
|
||||
.put("you", "ye")
|
||||
.put("yes", "aye")
|
||||
.put("hello", "ahoy")
|
||||
.put("hey", "ahoy")
|
||||
.put("hi", "ahoy")
|
||||
.put("friend", "matey")
|
||||
.put("friends", "mateys")
|
||||
.put("chest", "booty")
|
||||
.put("chests", "booty")
|
||||
.put("treasure", "booty")
|
||||
.put("shards", "riches")
|
||||
.put("sword", "cutlass")
|
||||
.put("my", "me")
|
||||
.put("gold", "dubloon")
|
||||
.put("dog", "seadog")
|
||||
.put("die", "walk the plank")
|
||||
.put("kill", "keelhaul")
|
||||
.put("boat", "ship")
|
||||
.put("drink", "grog")
|
||||
.put("water", "grog")
|
||||
.put("dirt", "flith")
|
||||
.put("flag", "jolly roger")
|
||||
.put("am", "be")
|
||||
.put("are", "be")
|
||||
.put("your", "yer")
|
||||
.put("girl", "lass")
|
||||
.put("woman", "lass")
|
||||
.put("hell", "davy jones' locker")
|
||||
.put("nether", "davy jones' locker")
|
||||
.put("of", "o'")
|
||||
.put("reward", "bounty")
|
||||
.put("prize", "bounty")
|
||||
.put("shoot", "fire in the hole")
|
||||
.put("clumsy", "landlubber")
|
||||
.put("clean", "swab")
|
||||
.put("look", "avast ye")
|
||||
.put("omg", "shiver my timbers")
|
||||
.put("wood", "timber")
|
||||
.put("trash", "poop deck")
|
||||
.put("noob", "shark bait")
|
||||
.put("hack", "scurvy")
|
||||
.put("hacks", "scurvy")
|
||||
.put("hax", "scurvy")
|
||||
.put("haks", "scurvy")
|
||||
.put("hacker", "scurvy")
|
||||
.put("owner", "captain")
|
||||
.put("leader", "captain")
|
||||
.put("lt", "captain")
|
||||
.put("dev", "firstmate")
|
||||
.put("developer", "firstmate")
|
||||
.put("admin", "firstmate")
|
||||
.build();
|
||||
private static final Map<Rank, String> RANK_REPLACEMENTS = ImmutableMap.<Rank, String>builder()
|
||||
.put(Rank.ETERNAL, "Captain")
|
||||
.put(Rank.TITAN, "FirstMate")
|
||||
.put(Rank.LEGEND, "Boatswain")
|
||||
.put(Rank.HERO, "Gunner")
|
||||
.put(Rank.ULTRA, "Parrot")
|
||||
.build();
|
||||
|
||||
private static AprilFoolsManager _instance;
|
||||
private final AprilFoolsRepository _repository;
|
||||
private final TwoFactorAuth _twoFA;
|
||||
|
||||
private boolean _enabled;
|
||||
private DisguiseManager _disguiseManager;
|
||||
private CoreClientManager _clientManager;
|
||||
private boolean _enabledTitle;
|
||||
|
||||
protected AprilFoolsManager(JavaPlugin plugin, CoreClientManager clientManager, DisguiseManager disguiseManager)
|
||||
public AprilFoolsManager()
|
||||
{
|
||||
super("April Fools", plugin);
|
||||
super("April Fools");
|
||||
|
||||
_disguiseManager = disguiseManager;
|
||||
_clientManager = clientManager;
|
||||
_instance = this;
|
||||
_repository = new AprilFoolsRepository();
|
||||
_twoFA = require(TwoFactorAuth.class);
|
||||
setEnabled(true);
|
||||
_enabledTitle = UtilServer.isHubServer() || UtilServer.isTestServer();
|
||||
|
||||
Calendar c = Calendar.getInstance();
|
||||
_enabled = (c.get(Calendar.MONTH) == Calendar.APRIL && c.get(Calendar.DAY_OF_MONTH) == 1);
|
||||
}
|
||||
|
||||
public static void Initialize(JavaPlugin plugin, CoreClientManager clientManager, DisguiseManager disguiseManager)
|
||||
{
|
||||
Instance = new AprilFoolsManager(plugin, clientManager, disguiseManager);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateEnabled(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SLOW)
|
||||
return;
|
||||
|
||||
Calendar c = Calendar.getInstance();
|
||||
_enabled = (c.get(Calendar.MONTH) == Calendar.APRIL && c.get(Calendar.DAY_OF_MONTH) == 1);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void chatAdd(AsyncPlayerChatEvent event)
|
||||
{
|
||||
if (!_enabled)
|
||||
return;
|
||||
|
||||
String[] words = event.getMessage().split(" ");
|
||||
|
||||
String out = "";
|
||||
for (String word : words)
|
||||
if (_enabled)
|
||||
{
|
||||
//Prefix
|
||||
if (Math.random() > 0.85)
|
||||
for (Map.Entry<Rank, String> entry : RANK_REPLACEMENTS.entrySet())
|
||||
{
|
||||
out += "moo";
|
||||
|
||||
for (int i=0 ; i<UtilMath.r(2) ; i++)
|
||||
out += "o";
|
||||
|
||||
out += " " + word + " ";
|
||||
|
||||
entry.getKey().setName(entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Suffix
|
||||
else if (Math.random() > 0.85)
|
||||
@Override
|
||||
public void addCommands()
|
||||
{
|
||||
addCommand(new PirateSongCommand(this));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void chat(AsyncPlayerChatEvent event)
|
||||
{
|
||||
if (!_enabled || _twoFA.isAuthenticating(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
String message = event.getMessage();
|
||||
String pirateMessage = "";
|
||||
|
||||
for (String word : message.split(" "))
|
||||
{
|
||||
String wordLower = word.toLowerCase();
|
||||
wordLower = wordLower.replaceAll("[^a-zA-Z0-9]", "");
|
||||
|
||||
if (CHAT_REPLACEMENTS.containsKey(wordLower))
|
||||
{
|
||||
out += word + " ";
|
||||
String pirateWord = CHAT_REPLACEMENTS.get(wordLower);
|
||||
char[] chars = pirateWord.toCharArray();
|
||||
|
||||
out += "moo";
|
||||
if (Character.isUpperCase(word.charAt(0)))
|
||||
{
|
||||
chars[0] = Character.toUpperCase(chars[0]);
|
||||
}
|
||||
|
||||
for (int i=0 ; i<UtilMath.r(2) ; i++)
|
||||
out += "o";
|
||||
|
||||
out += " ";
|
||||
}
|
||||
|
||||
//Swap
|
||||
else if (Math.random() > 0.99)
|
||||
{
|
||||
out += "moo";
|
||||
|
||||
for (int i=3 ; i<word.length() ; i++)
|
||||
out += "o";
|
||||
|
||||
out += " ";
|
||||
pirateWord = String.valueOf(chars);
|
||||
pirateMessage += pirateWord + " ";
|
||||
}
|
||||
else
|
||||
{
|
||||
out += word + " ";
|
||||
}
|
||||
}
|
||||
|
||||
event.setMessage(out);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateText(UpdateEvent event)
|
||||
{
|
||||
if (!_enabled)
|
||||
return;
|
||||
|
||||
if (event.getType() != UpdateType.SLOW)
|
||||
return;
|
||||
|
||||
if (Math.random() <= 0.99)
|
||||
return;
|
||||
|
||||
UtilTextMiddle.display("Moo", null, 5, 20, 5);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateCow(UpdateEvent event)
|
||||
{
|
||||
if (!_enabled)
|
||||
return;
|
||||
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
//Disguise
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
if (_disguiseManager.getDisguise(player) != null)
|
||||
{
|
||||
//Moo
|
||||
if (Math.random() > 0.8)
|
||||
if (wordLower.length() > 1 && wordLower.charAt(wordLower.length() - 1) == 'g')
|
||||
{
|
||||
if (_disguiseManager.getDisguise(player) instanceof DisguiseCow)
|
||||
{
|
||||
player.getWorld().playSound(player.getLocation(), Sound.COW_IDLE, (float)Math.random() + 0.5f, (float)Math.random() + 0.5f);
|
||||
}
|
||||
int g = word.lastIndexOf('g');
|
||||
char[] chars = word.toCharArray();
|
||||
|
||||
chars[g] = '\'';
|
||||
|
||||
word = String.valueOf(chars);
|
||||
}
|
||||
|
||||
continue;
|
||||
pirateMessage += word + " ";
|
||||
}
|
||||
}
|
||||
|
||||
double random = Math.random();
|
||||
|
||||
if (random > 0.85)
|
||||
{
|
||||
pirateMessage += "matey!";
|
||||
}
|
||||
else if (random > 0.7)
|
||||
{
|
||||
String ar = "ar";
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
if (Math.random() > 0.75)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
ar += "r";
|
||||
}
|
||||
|
||||
//Disguise
|
||||
DisguiseCow disguise = new DisguiseCow(player);
|
||||
disguise.setName(getName(player), _clientManager.Get(player).GetRank());
|
||||
disguise.setCustomNameVisible(true);
|
||||
_disguiseManager.disguise(disguise);
|
||||
pirateMessage += "a" + ar + "gh";
|
||||
}
|
||||
else if (random > 0.55)
|
||||
{
|
||||
pirateMessage += "scallywag";
|
||||
}
|
||||
|
||||
event.setMessage(pirateMessage.trim());
|
||||
}
|
||||
|
||||
public boolean isActive()
|
||||
@EventHandler
|
||||
public void updateRandomMessage(UpdateEvent event)
|
||||
{
|
||||
if (!_enabled || !_enabledTitle || event.getType() != UpdateType.SLOW)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
String message = null;
|
||||
double random = Math.random();
|
||||
|
||||
if (random > 0.99)
|
||||
{
|
||||
message = "Aye Aye Captain!";
|
||||
}
|
||||
else if (random > 0.98)
|
||||
{
|
||||
message = "Arggggggh";
|
||||
}
|
||||
else if (random > 0.97)
|
||||
{
|
||||
message = "Mateyy!";
|
||||
}
|
||||
else if (random > 0.96)
|
||||
{
|
||||
message = "Shiver me timbers!";
|
||||
}
|
||||
|
||||
if (message == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UtilTextMiddle.display("", message, 10, 40, 10);
|
||||
}
|
||||
|
||||
public AprilFoolsRepository getRepository()
|
||||
{
|
||||
return _repository;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled)
|
||||
{
|
||||
_enabled = ENABLED && enabled;
|
||||
}
|
||||
|
||||
public boolean isEnabled()
|
||||
{
|
||||
return _enabled;
|
||||
}
|
||||
|
||||
public String getName(Player player)
|
||||
public static AprilFoolsManager getInstance()
|
||||
{
|
||||
//Name
|
||||
int index = 0;
|
||||
boolean hitVowel = false;
|
||||
for (int i=0 ; i<player.getName().length()-2 && i<5 ; i++)
|
||||
if (_instance == null)
|
||||
{
|
||||
//Detect vowel ;o
|
||||
if (player.getName().toLowerCase().charAt(i) == 'a' ||
|
||||
player.getName().toLowerCase().charAt(i) == 'e' ||
|
||||
player.getName().toLowerCase().charAt(i) == 'i' ||
|
||||
player.getName().toLowerCase().charAt(i) == 'o' ||
|
||||
player.getName().toLowerCase().charAt(i) == 'u')
|
||||
{
|
||||
hitVowel = true;
|
||||
}
|
||||
//Post vowel consonant - stop here
|
||||
else if (hitVowel)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
index = i+1;
|
||||
_instance = new AprilFoolsManager();
|
||||
}
|
||||
|
||||
String name = "Moo" + player.getName().substring(index, player.getName().length());
|
||||
|
||||
if (name.length() > 16)
|
||||
name = name.substring(0, 16);
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean b)
|
||||
{
|
||||
Calendar c = Calendar.getInstance();
|
||||
_enabled = b && (c.get(Calendar.MONTH) == Calendar.APRIL && c.get(Calendar.DAY_OF_MONTH) == 1);
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,48 @@
|
||||
package mineplex.core.aprilfools;
|
||||
|
||||
import mineplex.core.account.CoreClient;
|
||||
import mineplex.serverdata.database.DBPool;
|
||||
import mineplex.serverdata.database.RepositoryBase;
|
||||
import mineplex.serverdata.database.column.ColumnInt;
|
||||
import mineplex.serverdata.database.column.ColumnVarChar;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class AprilFoolsRepository extends RepositoryBase
|
||||
{
|
||||
|
||||
private static final String GET_TREASURE = "SELECT * FROM aprilFoolsTreasure WHERE accountId=?;";
|
||||
private static final String INSERT_TREASURE = "INSERT INTO aprilFoolsTreasure VALUES (?,?);";
|
||||
|
||||
public AprilFoolsRepository()
|
||||
{
|
||||
super(DBPool.getAccount());
|
||||
}
|
||||
|
||||
public void getTreasure(Consumer<List<Integer>> response, CoreClient client)
|
||||
{
|
||||
executeQuery(GET_TREASURE, resultSet ->
|
||||
{
|
||||
List<Integer> found = new ArrayList<>();
|
||||
|
||||
while (resultSet.next())
|
||||
{
|
||||
found.add(resultSet.getInt("treasureId"));
|
||||
}
|
||||
|
||||
response.accept(found);
|
||||
}, new ColumnInt("accountId", client.getAccountId()));
|
||||
}
|
||||
|
||||
public void saveTreasure(CoreClient client, int treasureId)
|
||||
{
|
||||
int accountId = client.getAccountId();
|
||||
|
||||
executeInsert(INSERT_TREASURE, null,
|
||||
new ColumnInt("accountId", accountId),
|
||||
new ColumnInt("treasureId", treasureId)
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package mineplex.core.aprilfools.command;
|
||||
|
||||
import mineplex.core.aprilfools.AprilFoolsManager;
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class PirateSongCommand extends CommandBase<AprilFoolsManager>
|
||||
{
|
||||
|
||||
private static final String[] PIRATE_SONG = {
|
||||
"Are you ready kids?",
|
||||
"Aye aye captain!",
|
||||
"I can't hear you!",
|
||||
"AYE AYE CAPTAIN!",
|
||||
"OOOOOOOOOOOOH",
|
||||
"Who lives in a pineapple under the sea?",
|
||||
"Spongebob Squarepants!"
|
||||
};
|
||||
|
||||
public PirateSongCommand(AprilFoolsManager plugin)
|
||||
{
|
||||
super(plugin, Rank.ADMIN, "piratesong");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
Plugin.runSyncTimer(new BukkitRunnable()
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (index == PIRATE_SONG.length)
|
||||
{
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
UtilTextMiddle.display("", PIRATE_SONG[index++], 10, 60, 10);
|
||||
}
|
||||
}, 20, 100);
|
||||
}
|
||||
}
|
@ -190,6 +190,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
{
|
||||
_youtubers.add(Pair.create("Sigils", "https://www.youtube.com/user/SigilsPlaysGames?sub_confirmation=1"));
|
||||
_youtubers.add(Pair.create("SallyGreenGamer", "https://www.youtube.com/channel/UCt8eypdLUND5CBvgXzEZrxw?sub_confirmation=1"));
|
||||
_youtubers.add(Pair.create("RustyDawgT", "https://www.youtube.com/user/RustyDawgT?sub_confirmation=1"));
|
||||
}
|
||||
_youtubers.add(Pair.create("SamitoD", "https://www.youtube.com/user/SamitoD?sub_confirmation=1"));
|
||||
|
||||
@ -248,6 +249,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
{
|
||||
_youtubers.add(Pair.create("Sigils", "https://www.youtube.com/user/SigilsPlaysGames?sub_confirmation=1"));
|
||||
_youtubers.add(Pair.create("SallyGreenGamer", "https://www.youtube.com/channel/UCt8eypdLUND5CBvgXzEZrxw?sub_confirmation=1"));
|
||||
_youtubers.add(Pair.create("RustyDawgT", "https://www.youtube.com/user/RustyDawgT?sub_confirmation=1"));
|
||||
}
|
||||
_youtubers.add(Pair.create("SamitoD", "https://www.youtube.com/user/SamitoD?sub_confirmation=1"));
|
||||
|
||||
|
@ -205,22 +205,6 @@ public class Chat extends MiniPlugin
|
||||
return true;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void removeChat(AsyncPlayerChatEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
if (event.isAsynchronous())
|
||||
{
|
||||
for (Iterator<Player> playerIterator = event.getRecipients().iterator(); playerIterator.hasNext();)
|
||||
{
|
||||
if (!_preferences.get(playerIterator.next()).isActive(Preference.SHOW_CHAT))
|
||||
playerIterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onSignChange(SignChangeEvent event)
|
||||
{
|
||||
@ -369,7 +353,7 @@ public class Chat extends MiniPlugin
|
||||
msgContainsHack(event.getMessage()))
|
||||
{
|
||||
UtilPlayer.message(sender, F.main("Chat",
|
||||
"Accusing players of cheating in-game is against the rules."
|
||||
"Accusing players of cheating in-game is against the rules. "
|
||||
+ "If you think someone is cheating, please gather evidence and report it at "
|
||||
+ F.link("www.mineplex.com/reports")));
|
||||
event.setCancelled(true);
|
||||
@ -403,6 +387,11 @@ public class Chat extends MiniPlugin
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (event.isAsynchronous())
|
||||
{
|
||||
event.getRecipients().removeIf(player -> !_preferences.get(player).isActive(Preference.SHOW_CHAT));
|
||||
}
|
||||
}
|
||||
|
||||
private boolean msgContainsHack(String msg)
|
||||
|
@ -5,6 +5,8 @@ import org.bukkit.entity.Player;
|
||||
import mineplex.core.chat.Chat;
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
|
||||
public class BroadcastCommand extends CommandBase<Chat>
|
||||
@ -17,6 +19,12 @@ public class BroadcastCommand extends CommandBase<Chat>
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Broadcast", "What are you broadcasting?"));
|
||||
return;
|
||||
}
|
||||
|
||||
String announcement = "";
|
||||
|
||||
for (String arg : args)
|
||||
|
@ -19,6 +19,10 @@ public class DisguiseCommand extends CommandBase<PlayerDisguiseManager> implemen
|
||||
{
|
||||
if (args == null || args.length == 0)
|
||||
{
|
||||
Plugin.runAsync(() ->
|
||||
{
|
||||
new PlayerDisguiseNotification(Plugin.getRealName(caller), caller.getUniqueId(), caller.getName()).publish();
|
||||
});
|
||||
Plugin.undisguise(caller);
|
||||
return;
|
||||
}
|
||||
@ -28,6 +32,11 @@ public class DisguiseCommand extends CommandBase<PlayerDisguiseManager> implemen
|
||||
return;
|
||||
}
|
||||
|
||||
Plugin.runAsync(() ->
|
||||
{
|
||||
new PlayerDisguiseNotification(Plugin.getRealName(caller), caller.getUniqueId(), args[0], args.length > 1 ? args[1] : args[0]).publish();
|
||||
});
|
||||
|
||||
Plugin.disguise(caller, args[0], args.length > 1 ? args[1] : args[0]);
|
||||
}
|
||||
}
|
||||
|
@ -331,6 +331,12 @@ public class PlayerDisguiseManager extends MiniPlugin implements IPacketHandler
|
||||
}
|
||||
}
|
||||
|
||||
public String getRealName(Player caller)
|
||||
{
|
||||
CoreClient coreClient = _clients.Get(caller);
|
||||
return coreClient == null ? caller.getName() : coreClient.getName();
|
||||
}
|
||||
|
||||
public void undisguise(Player caller)
|
||||
{
|
||||
if (!isDisguised(caller))
|
||||
|
@ -0,0 +1,57 @@
|
||||
package mineplex.core.disguise.playerdisguise;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mineplex.serverdata.commands.ServerCommand;
|
||||
|
||||
public class PlayerDisguiseNotification extends ServerCommand
|
||||
{
|
||||
private String _realPlayerName;
|
||||
private UUID _playerUUID;
|
||||
private boolean _disguising;
|
||||
private String _disguisedName;
|
||||
private String _disguisedSkin;
|
||||
|
||||
public PlayerDisguiseNotification(String realPlayerName, UUID playerUUID, String disguisedName, String disguisedSkin)
|
||||
{
|
||||
_realPlayerName = realPlayerName;
|
||||
_playerUUID = playerUUID;
|
||||
_disguising = true;
|
||||
_disguisedName = disguisedName;
|
||||
_disguisedSkin = disguisedSkin;
|
||||
}
|
||||
|
||||
public PlayerDisguiseNotification(String realPlayerName, UUID playerUUID, String disguisedName)
|
||||
{
|
||||
_realPlayerName = realPlayerName;
|
||||
_playerUUID = playerUUID;
|
||||
_disguising = false;
|
||||
_disguisedName = disguisedName;
|
||||
_disguisedSkin = null;
|
||||
}
|
||||
|
||||
public String getRealPlayerName()
|
||||
{
|
||||
return _realPlayerName;
|
||||
}
|
||||
|
||||
public UUID getPlayerUUID()
|
||||
{
|
||||
return _playerUUID;
|
||||
}
|
||||
|
||||
public boolean isDisguising()
|
||||
{
|
||||
return _disguising;
|
||||
}
|
||||
|
||||
public String getDisguisedName()
|
||||
{
|
||||
return _disguisedName;
|
||||
}
|
||||
|
||||
public String getDisguisedSkin()
|
||||
{
|
||||
return _disguisedSkin;
|
||||
}
|
||||
}
|
@ -170,6 +170,7 @@ import mineplex.core.gadget.gadgets.particle.ParticleFireRings;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleLegend;
|
||||
import mineplex.core.gadget.gadgets.particle.spring.ParticleSpringHalo;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleWingsAngel;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleWingsBee;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleWingsDemons;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleWingsInfernal;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleWingsLove;
|
||||
@ -368,6 +369,8 @@ public class GadgetManager extends MiniPlugin
|
||||
addGadget(new ItemBow(this));
|
||||
addGadget(new ItemLovePotion(this));
|
||||
addGadget(new ItemFlowerGift(this));
|
||||
// NEXT MONTH'S PPC
|
||||
//addGadget(new ItemBubbleBlaster(this));
|
||||
|
||||
// Costume
|
||||
addGadget(new OutfitRaveSuitHelmet(this));
|
||||
@ -457,6 +460,7 @@ public class GadgetManager extends MiniPlugin
|
||||
addGadget(new ParticleChristmasTree(this));
|
||||
addGadget(new ParticleWingsLove(this));
|
||||
addGadget(new ParticleSpringHalo(this));
|
||||
addGadget(new ParticleWingsBee(this));
|
||||
|
||||
// Arrow Trails
|
||||
addGadget(new ArrowTrailFrostLord(this));
|
||||
|
@ -86,7 +86,7 @@ public class GameModifierMineStrikeSkin extends GameModifierGadget
|
||||
@Override
|
||||
public void enableCustom(Player player, boolean message)
|
||||
{
|
||||
Manager.getGameModifiers(getGameType()).stream().filter(getWeaponFilter(_weapon)).forEach(g -> g.disable(player));
|
||||
Manager.getGameModifiers(getGameType()).stream().filter(getWeaponFilter(_weapon).and(weapon -> weapon != this)).forEach(g -> g.disable(player));
|
||||
|
||||
super.enableCustom(player, message);
|
||||
}
|
||||
|
@ -0,0 +1,121 @@
|
||||
package mineplex.core.gadget.gadgets.item;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.LineFormat;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.common.util.particles.ColoredParticle;
|
||||
import mineplex.core.common.util.particles.DustSpellColor;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.Ammo;
|
||||
import mineplex.core.gadget.types.ItemGadget;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class ItemBubbleBlaster extends ItemGadget
|
||||
{
|
||||
|
||||
private Map<ArmorStand, Player> _armorStands = new HashMap<>();
|
||||
|
||||
public ItemBubbleBlaster(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Bubble Blaster", UtilText.splitLinesToArray(new String[]{C.cGray + "Placeholder"}, LineFormat.LORE),
|
||||
-14, Material.DIAMOND_BARDING, (byte) 0, 5000, new Ammo("Bubble", "Bubble", Material.DIAMOND_BARDING, (byte) 0, new String[]{C.cGray + "Placeholder"}, -5, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCustom(Player player, boolean message)
|
||||
{
|
||||
super.disableCustom(player, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ActivateCustom(Player player)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler
|
||||
public void Activate(PlayerInteractEvent event)
|
||||
{
|
||||
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
||||
return;
|
||||
|
||||
if (UtilBlock.usable(event.getClickedBlock()))
|
||||
return;
|
||||
|
||||
if (!UtilGear.isMat(event.getPlayer().getItemInHand(), this.getDisplayMaterial()))
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!isActive(player))
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(getDisplayMaterial(), getDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(getName()) + " " + getName())));
|
||||
|
||||
// TODO CHANGE COLOR IF RAINBOW
|
||||
// TODO COOLDOWN AFTER MAX OF 5 SECONDS HOLDING
|
||||
// TODO LAUNCH MULTIPLE WHILE HOLDING
|
||||
|
||||
ArmorStand armorStand = player.getWorld().spawn(player.getLocation().add(0, 1, 0), ArmorStand.class);
|
||||
armorStand.setItemInHand(new ItemStack(Material.STAINED_GLASS, 1, (byte) UtilMath.random.nextInt(15)));
|
||||
armorStand.setSmall(true);
|
||||
armorStand.setVisible(false);
|
||||
|
||||
_armorStands.put(armorStand, player);
|
||||
|
||||
double x = UtilMath.random(0.5, 1) - 1.25, z = UtilMath.random(0.5, 1) - 1.25;
|
||||
double sub = UtilMath.random(0.5, 1);
|
||||
if (sub > 0.75)
|
||||
UtilAction.velocity(armorStand, player.getLocation().getDirection().add(new Vector(x, 0, z)), 0.25, false, 0, 0.5, 1, false);
|
||||
else
|
||||
UtilAction.velocity(armorStand, player.getLocation().getDirection().subtract(new Vector(x, 0, z)), 0.25, false, 0, 0.5, 1, false);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateArmorStand(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
Iterator<Map.Entry<ArmorStand, Player>> iterator = _armorStands.entrySet().iterator();
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
Map.Entry<ArmorStand, Player> entry = iterator.next();
|
||||
ArmorStand armorStand = entry.getKey();
|
||||
Player player = entry.getValue();
|
||||
if (armorStand.getTicksLived() >= 20)
|
||||
{
|
||||
ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, new DustSpellColor(Color.WHITE), armorStand.getLocation());
|
||||
coloredParticle.display();
|
||||
armorStand.remove();
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -4,6 +4,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Item;
|
||||
@ -32,12 +34,14 @@ import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
||||
import mineplex.core.gadget.types.MorphGadget;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.packethandler.IPacketHandler;
|
||||
import mineplex.core.packethandler.PacketInfo;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.visibility.VisibilityManager;
|
||||
|
||||
public class MorphPumpkinKing extends MorphGadget
|
||||
public class MorphPumpkinKing extends MorphGadget implements IPacketHandler
|
||||
{
|
||||
private static final int CROWN_POINTS = 12;
|
||||
|
||||
@ -57,6 +61,7 @@ public class MorphPumpkinKing extends MorphGadget
|
||||
-1,
|
||||
Material.PUMPKIN, (byte)0);
|
||||
|
||||
manager.getPacketManager().addPacketHandler(this, true, PacketPlayInUseEntity.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -124,6 +129,19 @@ public class MorphPumpkinKing extends MorphGadget
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(PacketInfo packetInfo)
|
||||
{
|
||||
if (packetInfo.getPacket() instanceof PacketPlayInUseEntity)
|
||||
{
|
||||
PacketPlayInUseEntity packetPlayInUseEntity = (PacketPlayInUseEntity) packetInfo.getPacket();
|
||||
if (packetPlayInUseEntity.action == PacketPlayInUseEntity.EnumEntityUseAction.ATTACK)
|
||||
for (JackOBomb bomb : _bombs)
|
||||
if (bomb._ent.getEntityId() == packetPlayInUseEntity.a)
|
||||
packetInfo.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
private class JackOBomb
|
||||
{
|
||||
private Player _user;
|
||||
@ -151,6 +169,12 @@ public class MorphPumpkinKing extends MorphGadget
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (!_user.isOnline())
|
||||
{
|
||||
Manager.getDisguiseManager().undisguise(_disguise);
|
||||
_ent.remove();
|
||||
_done = true;
|
||||
}
|
||||
if (System.currentTimeMillis() >= _detonation)
|
||||
{
|
||||
UtilParticle.PlayParticleToAll(ParticleType.HUGE_EXPLOSION, _ent.getLocation(), null, 0, 1, ViewDist.NORMAL);
|
||||
|
@ -63,6 +63,12 @@ public class MorphSquid extends MorphGadget implements IThrown
|
||||
{
|
||||
removeArmor(player);
|
||||
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
||||
|
||||
if (player.getInventory().getBoots() != null && player.getInventory().getBoots().getType() == Material.DIAMOND_BOOTS)
|
||||
{
|
||||
player.getInventory().setBoots(new ItemStack(Material.AIR));
|
||||
player.removePotionEffect(PotionEffectType.SPEED);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -147,12 +147,12 @@ public class MorphVillager extends MorphGadget implements IThrown
|
||||
{
|
||||
if (_gems.contains(event.getItem()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
event.getItem().remove();
|
||||
|
||||
Manager.getDonationManager().rewardCurrency(GlobalCurrency.GEM, event.getPlayer(), getName() + " Pickup", 16);
|
||||
Manager.getDonationManager().rewardCurrency(GlobalCurrency.GEM, event.getPlayer(), getName() + " Pickup", 16 * event.getItem().getItemStack().getAmount());
|
||||
|
||||
event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1f, 2f);
|
||||
|
||||
event.setCancelled(true);
|
||||
event.getItem().remove();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@ import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.LineFormat;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
@ -36,6 +37,9 @@ import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
||||
import mineplex.core.gadget.types.MorphGadget;
|
||||
import mineplex.core.inventory.ClientItem;
|
||||
import mineplex.core.inventory.data.Item;
|
||||
import mineplex.core.mount.DragonMount;
|
||||
import mineplex.core.mount.Mount;
|
||||
import mineplex.core.mount.types.MountDragon;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
@ -59,6 +63,12 @@ public class MorphWither extends MorphGadget
|
||||
@Override
|
||||
public void enableCustom(final Player player, boolean message)
|
||||
{
|
||||
Mount<?> mount = Manager.getMountManager().getActive(player);
|
||||
if (mount instanceof DragonMount)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Gadget", "You cannot enable the " + F.elem(mount.getName()) + " and the " + F.elem(getName()) + " at the same time"));
|
||||
Manager.getMountManager().DeregisterAll(player);
|
||||
}
|
||||
this.applyArmor(player, message);
|
||||
|
||||
player.setMaxHealth(300);
|
||||
|
@ -0,0 +1,55 @@
|
||||
package mineplex.core.gadget.gadgets.particle;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.time.Month;
|
||||
import java.time.YearMonth;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.shape.ShapeWings;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.LineFormat;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.types.ParticleGadget;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class ParticleWingsBee extends ParticleGadget
|
||||
{
|
||||
|
||||
private ShapeWings _wingsBlack = new ShapeWings(UtilParticle.ParticleType.RED_DUST.particleName, new Vector(1, 1, 1), 1, 0, '$', ShapeWings.DEFAULT_ROTATION, ShapeWings.BEE_WING_PATTERN);
|
||||
private ShapeWings _wingsYellow = new ShapeWings(UtilParticle.ParticleType.RED_DUST.particleName, new Vector(1, 1, 1), 1, 0, '#', ShapeWings.DEFAULT_ROTATION, ShapeWings.BEE_WING_PATTERN);
|
||||
|
||||
public ParticleWingsBee(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Bumblebee's Wings",
|
||||
UtilText.splitLineToArray(C.cGray + "Float like a butterfly and sting like a bee with these new spring wings!", LineFormat.LORE),
|
||||
-14, Material.WOOL, (byte) 4, YearMonth.of(2017, Month.APRIL));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playParticle(Player player, UpdateEvent event)
|
||||
{
|
||||
Location loc = player.getLocation().add(0, 1, 0).add(player.getLocation().getDirection().multiply(-0.4));
|
||||
if (Manager.isMoving(player))
|
||||
{
|
||||
if (event.getType() == UpdateType.TICK)
|
||||
{
|
||||
_wingsBlack.displayColoredParticle(loc, Color.BLACK);
|
||||
_wingsYellow.displayColoredParticle(loc, Color.YELLOW);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getType() == UpdateType.FAST)
|
||||
{
|
||||
_wingsBlack.displayColored(loc, Color.BLACK);
|
||||
_wingsYellow.displayColored(loc, Color.YELLOW);
|
||||
}
|
||||
}
|
||||
}
|
@ -26,6 +26,7 @@ public abstract class MorphGadget extends Gadget
|
||||
public void applyArmor(Player player, boolean message)
|
||||
{
|
||||
Manager.removeGadgetType(player, GadgetType.MORPH, this);
|
||||
Manager.removeGadgetType(player, GadgetType.COSTUME);
|
||||
|
||||
_active.add(player);
|
||||
|
||||
|
@ -232,6 +232,7 @@ public abstract class WinEffectGadget extends Gadget
|
||||
public void run() {
|
||||
for(Player p : UtilServer.getPlayers()) {
|
||||
UtilPlayer.hideFromAll(p);
|
||||
p.eject();
|
||||
p.teleport(loc);
|
||||
p.setGameMode(GameMode.ADVENTURE);
|
||||
p.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 10 * 20, 1, false, false));
|
||||
|
@ -41,7 +41,9 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class MessageManager extends MiniClientPlugin<ClientMessage>
|
||||
@ -55,7 +57,7 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
||||
private PreferencesManager _preferences;
|
||||
private Punish _punish;
|
||||
private Chat _chat;
|
||||
private ArrayList<String> _randomMessage;
|
||||
private List<String> _randomMessage;
|
||||
private String _serverName;
|
||||
|
||||
public MessageManager(JavaPlugin plugin, IncognitoManager incognitoManager, CoreClientManager clientManager, PreferencesManager preferences,
|
||||
@ -301,44 +303,50 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
||||
@Override
|
||||
public void enable()
|
||||
{
|
||||
_randomMessage = new ArrayList<String>();
|
||||
_randomMessage.clear();
|
||||
_randomMessage.add("Hello, do you have any wild boars for purchase?");
|
||||
_randomMessage.add("There's a snake in my boot!");
|
||||
_randomMessage.add("Monk, I need a Monk!");
|
||||
_randomMessage.add("Hi, I'm from planet minecraft, op me plz dooooood!");
|
||||
_randomMessage.add("Somebody's poisoned the waterhole!");
|
||||
_randomMessage.add("MORE ORBZ MORE ORBZ MORE ORBZ MORE ORBZ!");
|
||||
_randomMessage.add("Chiss is a chiss and chiss chiss.");
|
||||
_randomMessage.add("*_*");
|
||||
_randomMessage.add("#swag");
|
||||
_randomMessage.add("Everything went better then I thought.");
|
||||
_randomMessage.add("HAVE A CHICKEN!");
|
||||
_randomMessage.add("follow me, i have xrays");
|
||||
_randomMessage.add("I'm making a java");
|
||||
_randomMessage.add("Do you talk to strangers? I have candy if it helps.");
|
||||
_randomMessage.add("Solid 2.9/10");
|
||||
_randomMessage.add("close your eyes to sleep");
|
||||
_randomMessage.add("I crashed because my internet ran out.");
|
||||
_randomMessage.add("I saw morgan freeman on a breaking bad ad on a bus.");
|
||||
_randomMessage.add("Where is the volume control?");
|
||||
_randomMessage.add("I saw you playing on youtube with that guy and stuff.");
|
||||
_randomMessage.add("Your worms must be worse than useless.");
|
||||
_randomMessage.add("meow");
|
||||
_randomMessage.add("7");
|
||||
_randomMessage.add("Don't you wish your girlfriend was hot like me?");
|
||||
_randomMessage.add("how do you play mindcrafts?");
|
||||
_randomMessage.add("7 cats meow meow meow meow meow meow meow");
|
||||
_randomMessage.add("For King Jonalon!!!!!");
|
||||
_randomMessage.add("Do you like apples?");
|
||||
_randomMessage.add("I'm Happy Happy Happy.");
|
||||
_randomMessage.add("kthxbye");
|
||||
_randomMessage.add("i like pie.");
|
||||
_randomMessage.add("Do you play Clash of Clans?");
|
||||
_randomMessage.add("Mmm...Steak!");
|
||||
_randomMessage.add("Poop! Poop everywhere!");
|
||||
_randomMessage.add("I'm so forgetful. Like I was going to say somethin...wait what were we talking about?");
|
||||
_randomMessage.add("Mmm...Steak!");
|
||||
_randomMessage = Arrays.asList(
|
||||
"The FitnessGram™ Pacer Test is a multistage aerobic capacity test that progressively gets more difficult as it continues",
|
||||
"do you feel it now mr krabs?!",
|
||||
"hisssssssss",
|
||||
"what's a leader?",
|
||||
"what guardians?",
|
||||
"rawr!",
|
||||
"where were you when the emus won the great emu war?",
|
||||
"Hello, do you have any wild boars for purchase?",
|
||||
"There's a snake in my boot!",
|
||||
"Monk, I need a Monk!",
|
||||
"Hi, I'm from planet minecraft, op me plz dooooood!",
|
||||
"Somebody's poisoned the waterhole!",
|
||||
"MORE ORBZ MORE ORBZ MORE ORBZ MORE ORBZ!",
|
||||
"Chiss is a chiss and chiss chiss.",
|
||||
"*_*",
|
||||
"#swag",
|
||||
"Everything went better then I thought.",
|
||||
"HAVE A CHICKEN!",
|
||||
"follow me, i have xrays",
|
||||
"I'm making a java",
|
||||
"Solid 2.9/10",
|
||||
"close your eyes to sleep",
|
||||
"I crashed because my internet ran out.",
|
||||
"I saw morgan freeman on a breaking bad ad on a bus.",
|
||||
"Where is the volume control?",
|
||||
"I saw you playing on youtube with that guy and stuff.",
|
||||
"Your worms must be worse than useless.",
|
||||
"meow",
|
||||
"7",
|
||||
"Don't you wish your girlfriend was hot like me?",
|
||||
"how do you play mindcrafts?",
|
||||
"7 cats meow meow meow meow meow meow meow",
|
||||
"For King Jonalon!!!!!",
|
||||
"Do you like apples?",
|
||||
"I'm Happy Happy Happy.",
|
||||
"kthxbye",
|
||||
"i like pie.",
|
||||
"Do you play Clash of Clans?",
|
||||
"Mmm...Steak!",
|
||||
"Poop! Poop everywhere!",
|
||||
"I'm so forgetful. Like I was going to say somethin...wait what were we talking about?",
|
||||
"Mmm...Steak!"
|
||||
);
|
||||
}
|
||||
|
||||
public CoreClientManager GetClientManager()
|
||||
@ -354,11 +362,6 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
||||
return _randomMessage.get(UtilMath.r(_randomMessage.size()));
|
||||
}
|
||||
|
||||
public ArrayList<String> GetRandomMessages()
|
||||
{
|
||||
return _randomMessage;
|
||||
}
|
||||
|
||||
public void Help(Player caller)
|
||||
{
|
||||
Help(caller, null);
|
||||
@ -641,4 +644,9 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
||||
{
|
||||
return _incognitoManager;
|
||||
}
|
||||
|
||||
public PreferencesManager getPreferences()
|
||||
{
|
||||
return this._preferences;
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ public class AdminCommand extends CommandBase<MessageManager>
|
||||
{
|
||||
if (args == null || args.length == 0)
|
||||
{
|
||||
Plugin.Help(caller);
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Usage: " + F.elem("/a <message>")));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -10,6 +10,7 @@ import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.message.MessageManager;
|
||||
import mineplex.core.preferences.Preference;
|
||||
|
||||
public class MessageAdminCommand extends CommandBase<MessageManager>
|
||||
{
|
||||
@ -27,7 +28,24 @@ public class MessageAdminCommand extends CommandBase<MessageManager>
|
||||
}
|
||||
else
|
||||
{
|
||||
String message = args.length > 1 ? F.combine(args, 1, null, false) : Plugin.GetRandomMessage();
|
||||
// Parse Message
|
||||
String message;
|
||||
if (args.length > 1)
|
||||
{
|
||||
message = F.combine(args, 1, null, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Plugin.getPreferences().get(caller).isActive(Preference.RANDOM_MESSAGES))
|
||||
{
|
||||
message = Plugin.GetRandomMessage();
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Cat got your tongue?"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
Plugin.sendMessage(caller, args[0], message, false, true);
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.message.MessageManager;
|
||||
import mineplex.core.preferences.Preference;
|
||||
|
||||
public class MessageCommand extends CommandBase<MessageManager>
|
||||
{
|
||||
@ -35,7 +36,15 @@ public class MessageCommand extends CommandBase<MessageManager>
|
||||
}
|
||||
else
|
||||
{
|
||||
message = Plugin.GetRandomMessage();
|
||||
if (Plugin.getPreferences().get(caller).isActive(Preference.RANDOM_MESSAGES))
|
||||
{
|
||||
message = Plugin.GetRandomMessage();
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Cat got your tongue?"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Plugin.sendMessage(caller, args[0], message, false, false);
|
||||
|
@ -7,6 +7,7 @@ import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.message.MessageManager;
|
||||
import mineplex.core.preferences.Preference;
|
||||
|
||||
public class ResendAdminCommand extends CommandBase<MessageManager>
|
||||
{
|
||||
@ -20,7 +21,7 @@ public class ResendAdminCommand extends CommandBase<MessageManager>
|
||||
{
|
||||
if (args == null || args.length == 0)
|
||||
{
|
||||
Plugin.Help(caller);
|
||||
UtilPlayer.message(caller, F.help(Plugin.getName(), "/ra [message]", GetRequiredRank()));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -41,7 +42,15 @@ public class ResendAdminCommand extends CommandBase<MessageManager>
|
||||
}
|
||||
else
|
||||
{
|
||||
message = Plugin.GetRandomMessage();
|
||||
if (Plugin.getPreferences().get(caller).isActive(Preference.RANDOM_MESSAGES))
|
||||
{
|
||||
message = Plugin.GetRandomMessage();
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Cat got your tongue?"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Plugin.sendMessage(caller, lastTo, message, true, true);
|
||||
|
@ -11,6 +11,8 @@ import org.bukkit.entity.Chicken;
|
||||
import org.bukkit.entity.EnderDragon;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
@ -29,7 +31,7 @@ public class DragonData extends MountData
|
||||
public float Pitch = 0;
|
||||
public Vector Velocity = new Vector(0,0,0);
|
||||
|
||||
public Entity Chicken;
|
||||
public Chicken Chicken;
|
||||
|
||||
public DragonData(DragonMount dragonMount, Player rider)
|
||||
{
|
||||
@ -50,6 +52,7 @@ public class DragonData extends MountData
|
||||
rider.getWorld().playSound(rider.getLocation(), Sound.ENDERDRAGON_GROWL, 20f, 1f);
|
||||
|
||||
Chicken = rider.getWorld().spawn(rider.getLocation(), Chicken.class);
|
||||
Chicken.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 99999999, 1));
|
||||
Dragon.setPassenger(Chicken);
|
||||
|
||||
Chicken.setPassenger(getOwner());
|
||||
|
@ -3,8 +3,13 @@ package mineplex.core.mount;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.Managers;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphWither;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
|
||||
public class DragonMount extends Mount<DragonData>
|
||||
{
|
||||
@ -18,6 +23,14 @@ public class DragonMount extends Mount<DragonData>
|
||||
@Override
|
||||
public void enableCustom(final Player player)
|
||||
{
|
||||
GadgetManager gadgetManager = Managers.get(GadgetManager.class);
|
||||
Gadget morph = gadgetManager.getActive(player, GadgetType.MORPH);
|
||||
if (morph instanceof MorphWither)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Gadget", "You cannot enable the " + F.elem(getName()) + " and the " + F.elem(morph.getName()) + " at the same time"));
|
||||
morph.disable(player, true);
|
||||
}
|
||||
|
||||
player.leaveVehicle();
|
||||
player.eject();
|
||||
|
||||
|
@ -178,7 +178,12 @@ public class MountCart extends Mount<SingleEntityMountData<Minecart>>
|
||||
@EventHandler
|
||||
public void cancelBreak(VehicleDamageEvent event)
|
||||
{
|
||||
if (getActive().values().contains(event.getVehicle()))
|
||||
event.setCancelled(true);
|
||||
for (SingleEntityMountData<Minecart> data : getActive().values())
|
||||
{
|
||||
if (data.getEntity().equals(event.getVehicle()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -50,6 +50,8 @@ public class MountSlime extends Mount<SingleEntityMountData<Slime>>
|
||||
|
||||
mount.getEntity().setCustomName(player.getName() + "'s " + getName());
|
||||
|
||||
UtilEnt.removeTargetSelectors(mount.getEntity());
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(getName()) + "."));
|
||||
|
||||
|
@ -4,6 +4,12 @@ import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import mineplex.core.aprilfools.AprilFoolsManager;
|
||||
import mineplex.core.common.skin.SkinData;
|
||||
import mineplex.core.disguise.DisguiseManager;
|
||||
import mineplex.core.disguise.disguises.DisguisePlayer;
|
||||
import mineplex.core.utils.UtilGameProfile;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
@ -84,6 +90,8 @@ public class NpcManager extends MiniPlugin
|
||||
final Map<UUID, Npc> _npcMap = new HashMap<>();
|
||||
private final Set<UUID> _npcDeletingPlayers = new HashSet<>();
|
||||
|
||||
private final DisguiseManager _disguise;
|
||||
|
||||
public NpcManager(JavaPlugin plugin, Creature creature)
|
||||
{
|
||||
super("NpcManager", plugin);
|
||||
@ -100,6 +108,8 @@ public class NpcManager extends MiniPlugin
|
||||
|
||||
_plugin.getServer().getPluginManager().registerEvents(this, _plugin);
|
||||
|
||||
_disguise = require(DisguiseManager.class);
|
||||
|
||||
try
|
||||
{
|
||||
loadNpcs();
|
||||
@ -295,15 +305,17 @@ public class NpcManager extends MiniPlugin
|
||||
public Entity spawnNpc(Npc npc)
|
||||
{
|
||||
LivingEntity entity = (LivingEntity) _creature.SpawnEntity(npc.getLocation(), EntityType.valueOf(npc.getDatabaseRecord().getEntityType()));
|
||||
String name = null;
|
||||
|
||||
if (npc.getDatabaseRecord().getName() == null)
|
||||
{
|
||||
entity.setCustomNameVisible(false);
|
||||
entity.setCustomName(ChatColor.RESET.toString());
|
||||
name = entity.getCustomName();
|
||||
}
|
||||
else
|
||||
{
|
||||
String name = npc.getDatabaseRecord().getName();
|
||||
name = npc.getDatabaseRecord().getName();
|
||||
for (ChatColor color : ChatColor.values())
|
||||
name = name.replace("(" + color.name().toLowerCase() + ")", color.toString());
|
||||
name = ChatColor.translateAlternateColorCodes('&', name);
|
||||
|
@ -10,6 +10,7 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -195,6 +196,11 @@ public class Portal extends MiniPlugin
|
||||
*/
|
||||
public void sendPlayer(final Player player, String serverName)
|
||||
{
|
||||
if (player.getGameMode() == GameMode.SPECTATOR)
|
||||
{
|
||||
player.setSpectatorTarget(null);
|
||||
}
|
||||
|
||||
ByteArrayOutputStream b = new ByteArrayOutputStream();
|
||||
DataOutputStream out = new DataOutputStream(b);
|
||||
|
||||
|
@ -36,6 +36,7 @@ public class PowerPlayClubRewards
|
||||
.put(YearMonth.of(2017, Month.JANUARY), new UnknownSalesPackageItem("Over Easy Morph"))
|
||||
.put(YearMonth.of(2017, Month.FEBRUARY), new PetItem(PetType.TRUE_LOVE_PET))
|
||||
.put(YearMonth.of(2017, Month.MARCH), new UnknownSalesPackageItem("Gold Pot Morph"))
|
||||
.put(YearMonth.of(2017, Month.APRIL), new UnknownSalesPackageItem("Bumblebee's Wings"))
|
||||
.build();
|
||||
|
||||
public interface PowerPlayClubItem
|
||||
|
@ -46,7 +46,9 @@ public enum Preference
|
||||
|
||||
COMMUNITY_INVITES(true, PreferenceCategory.SOCIAL, Material.BOOK, "Show Community Invites"),
|
||||
|
||||
PARTY_DISPLAY_INVENTORY_UI(true, PreferenceCategory.SOCIAL, Material.CHEST, "Display Parties GUI")
|
||||
PARTY_DISPLAY_INVENTORY_UI(true, PreferenceCategory.SOCIAL, Material.CHEST, "Display Parties GUI"),
|
||||
|
||||
RANDOM_MESSAGES(true, PreferenceCategory.USER, Material.COMMAND, "Send random messages", "Got nothing to say? We got you covered!")
|
||||
;
|
||||
|
||||
private static final Map<Integer, Preference> PREFERENCE_MAP = Maps.newHashMap();
|
||||
|
@ -4,6 +4,8 @@ import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.lifetimes.Lifetime;
|
||||
import mineplex.core.lifetimes.Lifetimed;
|
||||
import mineplex.core.shop.ShopBase;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
|
||||
@ -12,7 +14,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public abstract class ShopPageInventory<PluginType extends MiniPlugin, ShopType extends ShopBase<PluginType>> extends
|
||||
public abstract class ShopPageInventory<PluginType extends Lifetimed, ShopType extends ShopBase<PluginType>> extends
|
||||
ShopPageBase
|
||||
{
|
||||
private int _page;
|
||||
|
@ -38,6 +38,7 @@ import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -750,6 +751,13 @@ public class Titles extends MiniDbClientPlugin<TitleData> implements IPacketHand
|
||||
if (packetInfo.getPacket() instanceof PacketPlayOutNamedEntitySpawn)
|
||||
{
|
||||
PacketPlayOutNamedEntitySpawn packet = (PacketPlayOutNamedEntitySpawn) packetInfo.getPacket();
|
||||
Entity entity = UtilEnt.getEntityById(packet.a);
|
||||
|
||||
if (!(entity instanceof Player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player owner = (Player) UtilEnt.getEntityById(packet.a);
|
||||
if (_gadgetManager.getActive(owner, GadgetType.MORPH) == null)
|
||||
{
|
||||
|
@ -7,6 +7,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import mineplex.core.titles.tracks.award.AprilFools2017Track;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
@ -80,6 +81,7 @@ public class TrackManager extends MiniPlugin
|
||||
|
||||
// Awarded tracks
|
||||
registerTrack(new Bridges2017Track());
|
||||
registerTrack(new AprilFools2017Track());
|
||||
|
||||
// Custom tracks
|
||||
// registerTrack(track("lenny", "Lenny", "( ͡° ͜ʖ ͡°)"));
|
||||
|
@ -0,0 +1,30 @@
|
||||
package mineplex.core.titles.tracks.award;
|
||||
|
||||
import mineplex.core.titles.tracks.ItemizedTrack;
|
||||
import mineplex.core.titles.tracks.TrackFormat;
|
||||
import mineplex.core.titles.tracks.TrackTier;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
|
||||
public class AprilFools2017Track extends ItemizedTrack
|
||||
{
|
||||
|
||||
public AprilFools2017Track()
|
||||
{
|
||||
super(
|
||||
"aprilfools-2017",
|
||||
ChatColor.LIGHT_PURPLE,
|
||||
"Fools 2017",
|
||||
"2017 April Fools Treasure Hunt",
|
||||
"This track is awarded to players who found all the chests in the 2017 April Fools Event",
|
||||
true);
|
||||
|
||||
special();
|
||||
|
||||
getRequirements()
|
||||
.addTier(new TrackTier(
|
||||
"2017 April Fools",
|
||||
null,
|
||||
this::owns,
|
||||
new TrackFormat(ChatColor.LIGHT_PURPLE, ChatColor.DARK_PURPLE)
|
||||
)); }
|
||||
}
|
@ -320,7 +320,7 @@ public class TreasureLocation implements Listener
|
||||
Location centerLocation = treasure.getCenterBlock().getLocation().add(0.5, 0.5, 0.5);
|
||||
if (event.getTo().distanceSquared(centerLocation) > 9)
|
||||
{
|
||||
Location newTo = event.getFrom();
|
||||
Location newTo = centerLocation.clone();
|
||||
newTo.setPitch(event.getTo().getPitch());
|
||||
newTo.setYaw(event.getTo().getYaw());
|
||||
event.setTo(newTo);
|
||||
@ -340,8 +340,13 @@ public class TreasureLocation implements Listener
|
||||
double fromDistanceFromCenter = centerLocation.distanceSquared(fromLocation);
|
||||
if (toDistanceFromCenter < fromDistanceFromCenter)
|
||||
{
|
||||
Location spawnLocation = new Location(player.getWorld(), 0, 64, 0);
|
||||
UtilAction.velocity(player, UtilAlg.getTrajectory(player.getLocation(), spawnLocation).multiply(-1), 1.5, true, 0.8, 0, 1.0, true);
|
||||
Entity target = player;
|
||||
while (target.getVehicle() != null)
|
||||
{
|
||||
target = target.getVehicle();
|
||||
}
|
||||
Location spawnLocation = new Location(target.getWorld(), 0, 64, 0);
|
||||
UtilAction.velocity(target, UtilAlg.getTrajectory(target.getLocation(), spawnLocation).multiply(-1), 1.5, true, 0.8, 0, 1.0, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package mineplex.game.clans;
|
||||
|
||||
import mineplex.core.aprilfools.AprilFoolsManager;
|
||||
import net.minecraft.server.v1_8_R3.MinecraftServer;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
@ -265,6 +266,8 @@ public class Clans extends JavaPlugin
|
||||
|
||||
require(TwoFactorAuth.class);
|
||||
|
||||
AprilFoolsManager.getInstance();
|
||||
|
||||
// Disable spigot item merging
|
||||
for (World world : getServer().getWorlds())
|
||||
{
|
||||
|
@ -166,7 +166,7 @@ public class ClansHub extends JavaPlugin
|
||||
new ResourcePackManager(this, portal);
|
||||
new GlobalPacketManager(this, clientManager, serverStatusManager, inventoryManager, donationManager, petManager, statsManager, hubManager.getBonusManager().getRewardManager());
|
||||
|
||||
AprilFoolsManager.Initialize(this, clientManager, disguiseManager);
|
||||
AprilFoolsManager.getInstance();
|
||||
|
||||
new EternalGiveawayManager(this, clientManager, serverStatusManager);
|
||||
|
||||
|
@ -2,6 +2,7 @@ package mineplex.hub;
|
||||
|
||||
import static mineplex.core.Managers.require;
|
||||
|
||||
import mineplex.hub.modules.AprilFoolsTreasureHunt;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -9,6 +10,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.CustomTagFix;
|
||||
import mineplex.core.PacketsInteractionFix;
|
||||
import mineplex.core.TwitchIntegrationFix;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.achievement.AchievementManager;
|
||||
import mineplex.core.antihack.AntiHack;
|
||||
@ -117,7 +119,8 @@ public class Hub extends JavaPlugin implements IRelation
|
||||
// new ProfileCacheManager(this);
|
||||
ItemStackFactory.Initialize(this, false);
|
||||
Recharge.Initialize(this);
|
||||
VisibilityManager.Initialize(this); Give.Initialize(this);
|
||||
VisibilityManager.Initialize(this);
|
||||
Give.Initialize(this);
|
||||
Punish punish = new Punish(this, clientManager);
|
||||
BlockRestore blockRestore = require(BlockRestore.class);
|
||||
DonationManager donationManager = require(DonationManager.class);
|
||||
@ -159,9 +162,9 @@ public class Hub extends JavaPlugin implements IRelation
|
||||
guardianManager.registerGuardian(new AntiHackGuardian(new Location(Bukkit.getWorld("world"), 0, 100, 0), 50, -50, 105, 95, 50, -50));
|
||||
}
|
||||
|
||||
IgnoreManager ignoreManager = new IgnoreManager(this, clientManager, preferenceManager, portal);
|
||||
IgnoreManager ignoreManager = new IgnoreManager(this, clientManager, preferenceManager, portal);
|
||||
|
||||
FriendManager friendManager = new FriendManager(this, clientManager, preferenceManager, portal);
|
||||
FriendManager friendManager = new FriendManager(this, clientManager, preferenceManager, portal);
|
||||
|
||||
StatsManager statsManager = new StatsManager(this, clientManager);
|
||||
EloManager eloManager = new EloManager(this, clientManager);
|
||||
@ -199,14 +202,11 @@ public class Hub extends JavaPlugin implements IRelation
|
||||
new SnapshotPlugin(this, snapshotManager, clientManager);
|
||||
new ReportPlugin(this, reportManager);
|
||||
|
||||
AprilFoolsManager.Initialize(this, clientManager, disguiseManager);
|
||||
|
||||
new EternalGiveawayManager(this, clientManager, serverStatusManager);
|
||||
|
||||
CombatManager combatManager = new CombatManager(this);
|
||||
|
||||
|
||||
|
||||
DamageManager damage = new DamageManager(this, combatManager, npcManager, disguiseManager, conditionManager);
|
||||
conditionManager.setDamageManager(damage);
|
||||
|
||||
@ -219,13 +219,13 @@ public class Hub extends JavaPlugin implements IRelation
|
||||
SkillFactory skillManager = new SkillFactory(this, damage, this, combatManager, conditionManager, throwManager, disguiseManager, blockRestore, fire, new Movement(this), teleport, energy);
|
||||
ClassManager classManager = new ClassManager(this, clientManager, donationManager, hubManager.GetGadget(), skillManager, itemFactory);
|
||||
|
||||
ClassShopManager shopManager = new ClassShopManager(this, classManager, skillManager, itemFactory, achievementManager, clientManager);
|
||||
ClassShopManager shopManager = new ClassShopManager(this, classManager, skillManager, itemFactory, achievementManager, clientManager);
|
||||
|
||||
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Brute", classManager.GetClass("Brute"), true);
|
||||
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Mage", classManager.GetClass("Mage"), true);
|
||||
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Ranger", classManager.GetClass("Ranger"), true);
|
||||
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Knight", classManager.GetClass("Knight"), true);
|
||||
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Assassin", classManager.GetClass("Assassin"), true);
|
||||
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Brute", classManager.GetClass("Brute"), true);
|
||||
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Mage", classManager.GetClass("Mage"), true);
|
||||
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Ranger", classManager.GetClass("Ranger"), true);
|
||||
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Knight", classManager.GetClass("Knight"), true);
|
||||
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Assassin", classManager.GetClass("Assassin"), true);
|
||||
|
||||
//Updates
|
||||
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1);
|
||||
@ -238,6 +238,12 @@ public class Hub extends JavaPlugin implements IRelation
|
||||
require(TwoFactorAuth.class);
|
||||
require(TeamspeakManager.class);
|
||||
new WebsiteLinkManager(this, clientManager);
|
||||
|
||||
if (AprilFoolsManager.getInstance().isEnabled())
|
||||
{
|
||||
require(AprilFoolsTreasureHunt.class);
|
||||
}
|
||||
require(TwitchIntegrationFix.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -610,11 +610,6 @@ public class HubManager extends MiniClientPlugin<HubClient> implements IChatMess
|
||||
|
||||
Player player = event.getPlayer();
|
||||
String playerName = player.getName();
|
||||
|
||||
// April Fools
|
||||
if (AprilFoolsManager.Instance.isActive())
|
||||
playerName = AprilFoolsManager.Instance.getName(player);
|
||||
|
||||
Rank rank = GetClients().Get(player).getRealOrDisguisedRank();
|
||||
|
||||
//Level Prefix
|
||||
|
@ -0,0 +1,284 @@
|
||||
package mineplex.hub.modules;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.ReflectivelyCreateMiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.aprilfools.AprilFoolsManager;
|
||||
import mineplex.core.common.currency.GlobalCurrency;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.titles.tracks.Track;
|
||||
import mineplex.core.titles.tracks.TrackManager;
|
||||
import mineplex.core.titles.tracks.award.AprilFools2017Track;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.Skull;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@ReflectivelyCreateMiniPlugin
|
||||
public class AprilFoolsTreasureHunt extends MiniPlugin
|
||||
{
|
||||
|
||||
private static final int SHARD_REWARD = 500;
|
||||
private static final String ITEM_REWARD = "Omega Chest";
|
||||
|
||||
private static final int[][] TREASURE = {
|
||||
{
|
||||
0, 72, -10
|
||||
},
|
||||
{
|
||||
-56, 71, -42
|
||||
},
|
||||
{
|
||||
171, 69, -67
|
||||
},
|
||||
{
|
||||
287, 71, -197
|
||||
},
|
||||
{
|
||||
306, 123, -182
|
||||
},
|
||||
{
|
||||
99, 68, -143
|
||||
},
|
||||
{
|
||||
122, 70, -27
|
||||
},
|
||||
{
|
||||
106, 86, 54
|
||||
},
|
||||
{
|
||||
48, 71, 71
|
||||
},
|
||||
{
|
||||
54, 64, 112
|
||||
},
|
||||
{
|
||||
45, 117, 113
|
||||
},
|
||||
{
|
||||
77, 93, 210
|
||||
},
|
||||
{
|
||||
-13, 65, 128
|
||||
},
|
||||
{
|
||||
-22, 65, 110
|
||||
},
|
||||
{
|
||||
-115, 67, 54
|
||||
},
|
||||
{
|
||||
-91, 56, 46
|
||||
},
|
||||
{
|
||||
-14, 29, -10
|
||||
},
|
||||
{
|
||||
13, 39, 36
|
||||
},
|
||||
{
|
||||
99, 48, 49
|
||||
},
|
||||
{
|
||||
-101, 70, 196
|
||||
},
|
||||
{
|
||||
29, 111, 39
|
||||
},
|
||||
{
|
||||
36, 60, -19
|
||||
},
|
||||
{
|
||||
-65, 70, -111
|
||||
},
|
||||
{
|
||||
-88, 55, -77
|
||||
},
|
||||
{
|
||||
-4, 73, -37
|
||||
},
|
||||
{
|
||||
120, 68, -20
|
||||
},
|
||||
{
|
||||
119, 79, 9
|
||||
},
|
||||
{
|
||||
213, 64, -111
|
||||
},
|
||||
{
|
||||
228, 63, -155
|
||||
},
|
||||
{
|
||||
34, 84, -5
|
||||
}
|
||||
};
|
||||
private static final BlockFace[] BLOCK_FACES = {
|
||||
BlockFace.NORTH,
|
||||
BlockFace.EAST,
|
||||
BlockFace.SOUTH,
|
||||
BlockFace.WEST,
|
||||
BlockFace.NORTH_EAST,
|
||||
BlockFace.SOUTH_EAST,
|
||||
BlockFace.SOUTH_WEST,
|
||||
BlockFace.NORTH_WEST
|
||||
};
|
||||
|
||||
private final AprilFoolsManager _aprilFools;
|
||||
private final CoreClientManager _client;
|
||||
private final DonationManager _donation;
|
||||
private final InventoryManager _inventory;
|
||||
private final TrackManager _track;
|
||||
|
||||
private final Map<UUID, List<Integer>> _foundTreasure;
|
||||
private final List<Location> _treasure;
|
||||
private boolean _set;
|
||||
|
||||
private AprilFoolsTreasureHunt()
|
||||
{
|
||||
super("Treasure Hunt");
|
||||
|
||||
_aprilFools = require(AprilFoolsManager.class);
|
||||
_client = require(CoreClientManager.class);
|
||||
_donation = require(DonationManager.class);
|
||||
_inventory = require(InventoryManager.class);
|
||||
_track = require(TrackManager.class);
|
||||
|
||||
_foundTreasure = new HashMap<>();
|
||||
_treasure = new ArrayList<>(TREASURE.length);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void playerJoin(PlayerJoinEvent event)
|
||||
{
|
||||
UUID key = event.getPlayer().getUniqueId();
|
||||
|
||||
_foundTreasure.put(key, new ArrayList<>(TREASURE.length));
|
||||
|
||||
runAsync(() -> _aprilFools.getRepository().getTreasure(data -> _foundTreasure.put(key, data), _client.Get(key)));
|
||||
|
||||
if (!_set)
|
||||
{
|
||||
_set = true;
|
||||
World world = Bukkit.getWorld("world");
|
||||
|
||||
for (int[] cords : TREASURE)
|
||||
{
|
||||
Location location = new Location(world, cords[0], cords[1], cords[2]);
|
||||
Block block = location.getBlock();
|
||||
block.setType(Material.SKULL);
|
||||
block.setData((byte) 1);
|
||||
Skull skull = (Skull) block.getState();
|
||||
skull.setSkullType(SkullType.PLAYER);
|
||||
skull.setOwner("Topplemop");
|
||||
skull.setRotation(BLOCK_FACES[UtilMath.r(BLOCK_FACES.length)]);
|
||||
skull.update();
|
||||
|
||||
_treasure.add(location);
|
||||
}
|
||||
|
||||
Location information = _treasure.get(0).clone();
|
||||
ArmorStand hologram = information.getWorld().spawn(information.add(.5, .5, .5), ArmorStand.class);
|
||||
|
||||
hologram.setSmall(true);
|
||||
hologram.setGravity(false);
|
||||
hologram.setVisible(false);
|
||||
hologram.setCustomNameVisible(true);
|
||||
hologram.setCustomName(C.cDPurple + C.Scramble + "ABC " + C.cPurpleB + "April Fools Treasure Hunt" + C.cDPurple + C.Scramble + " ABC");
|
||||
hologram.setRemoveWhenFarAway(false);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void interactBlock(PlayerInteractEvent event)
|
||||
{
|
||||
if (event.getClickedBlock() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
UUID key = event.getPlayer().getUniqueId();
|
||||
List<Integer> found = _foundTreasure.get(key);
|
||||
Location location = event.getClickedBlock().getLocation();
|
||||
int i = 0;
|
||||
|
||||
for (Location treasure : _treasure)
|
||||
{
|
||||
if (location.equals(treasure))
|
||||
{
|
||||
findChest(player, i);
|
||||
break;
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
private void findChest(Player player, int treasureId)
|
||||
{
|
||||
List<Integer> found = _foundTreasure.get(player.getUniqueId());
|
||||
|
||||
if (found.contains(treasureId))
|
||||
{
|
||||
player.sendMessage(F.main(_moduleName, "You already have found this skull! You have found " + F.count(String.valueOf(found.size())) + "/" + F.count(String.valueOf(_treasure.size())) + "."));
|
||||
return;
|
||||
}
|
||||
|
||||
found.add(treasureId);
|
||||
player.playSound(player.getLocation(), Sound.CAT_MEOW, 1, 0.7F);
|
||||
player.sendMessage(F.main(_moduleName, "Found " + F.count(String.valueOf(found.size())) + "/" + F.count(String.valueOf(_treasure.size()))) + " Treasure Chests +" + F.currency(GlobalCurrency.TREASURE_SHARD, SHARD_REWARD) + ".");
|
||||
_donation.rewardCurrencyUntilSuccess(GlobalCurrency.TREASURE_SHARD, player, "", SHARD_REWARD);
|
||||
|
||||
runAsync(() -> _aprilFools.getRepository().saveTreasure(_client.Get(player.getUniqueId()), treasureId));
|
||||
|
||||
if (found.size() == 1)
|
||||
{
|
||||
player.sendMessage(F.main(_moduleName, "There are " + F.count("30") + " secret " + F.elem("Pirate Heads") + " to find through the lobby."));
|
||||
player.sendMessage(F.main(_moduleName, "Each one is worth " + F.currency(GlobalCurrency.TREASURE_SHARD, SHARD_REWARD) + "."));
|
||||
player.sendMessage(F.main(_moduleName, "If you find all " + F.count("30") + " you will receive an " + C.cAqua + "Omega Chest" + C.mBody + " and an exclusive " + F.elem("Title") + "!"));
|
||||
}
|
||||
else if (found.size() == TREASURE.length)
|
||||
{
|
||||
player.sendMessage(F.main(_moduleName, "Completed the " + F.name("Mineplex April Fools 2017 Treasure Hunt") + "."));
|
||||
|
||||
_inventory.addItemToInventory(data ->
|
||||
{
|
||||
if (data)
|
||||
{
|
||||
player.sendMessage(F.main(_moduleName, "+1 " + C.cAqua + ITEM_REWARD + C.mBody + "!"));
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendMessage(F.main(_moduleName, "Oops, somehow I could not give you the chest, you should inform a staff member!"));
|
||||
}
|
||||
}, player, ITEM_REWARD, 1);
|
||||
|
||||
Track track = _track.getTrack(AprilFools2017Track.class);
|
||||
|
||||
_track.unlockTrack(player, track, result ->
|
||||
{
|
||||
switch (result)
|
||||
{
|
||||
case UNKNOWN_ERROR:
|
||||
player.sendMessage(F.main(_moduleName, "Oops, somehow I could not give you the title track, you should inform a staff member!"));
|
||||
break;
|
||||
case SUCCESS:
|
||||
player.sendMessage(F.main(_moduleName, "Unlocked " + track.getColor() + track.getLongName() + C.mBody + " Title!"));
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -115,7 +115,7 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
|
||||
C.Reset + "",
|
||||
C.Reset + "One team must steal the other",
|
||||
C.Reset + "team's flag. Capture it",
|
||||
C.Reset + "three times to win.",
|
||||
C.Reset + "five times to win.",
|
||||
}, new String[] {"CTF"}, "CTF", new SelectCTFButton(this));
|
||||
|
||||
add(20, Material.BEACON, C.cYellowB + "Dominate " + C.cGray + "Team Game", new String[]
|
||||
|
@ -56,7 +56,7 @@ public class Blink extends SkillActive
|
||||
"",
|
||||
"Using again within 5 seconds De-Blinks,",
|
||||
"returning you to your original location.",
|
||||
"Can be used while Slowed."
|
||||
"Cannot be used while Slowed."
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ public class RopedArrow extends SkillActive
|
||||
{
|
||||
"Prepare a roped arrow;",
|
||||
"Your next arrow will pull you",
|
||||
"pull you in after it hits.",
|
||||
"in after it hits.",
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ package nautilus.game.arcade;
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
|
||||
import mineplex.core.aprilfools.AprilFoolsManager;
|
||||
import net.minecraft.server.v1_8_R3.MinecraftServer;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
@ -14,6 +15,7 @@ import mineplex.core.CustomTagFix;
|
||||
import mineplex.core.FoodDupeFix;
|
||||
import mineplex.core.PacketsInteractionFix;
|
||||
import mineplex.core.TimingsFix;
|
||||
import mineplex.core.TwitchIntegrationFix;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.achievement.AchievementManager;
|
||||
import mineplex.core.antihack.AntiHack;
|
||||
@ -201,6 +203,9 @@ public class Arcade extends JavaPlugin
|
||||
|
||||
require(TwoFactorAuth.class);
|
||||
new WebsiteLinkManager(this, _clientManager);
|
||||
require(TwitchIntegrationFix.class);
|
||||
|
||||
AprilFoolsManager.getInstance();
|
||||
|
||||
//Updates
|
||||
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1);
|
||||
|
@ -41,6 +41,7 @@ import org.bukkit.event.hanging.HangingPlaceEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.world.WorldLoadEvent;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
import org.bukkit.scoreboard.NameTagVisibility;
|
||||
import org.bukkit.scoreboard.Team;
|
||||
import org.bukkit.util.Vector;
|
||||
@ -91,6 +92,7 @@ import nautilus.game.arcade.game.GameTeam.PlayerState;
|
||||
import nautilus.game.arcade.game.games.build.Build;
|
||||
import nautilus.game.arcade.game.games.draw.Draw;
|
||||
import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders;
|
||||
import nautilus.game.arcade.game.modules.AntiExpOrbModule;
|
||||
import nautilus.game.arcade.game.modules.Module;
|
||||
import nautilus.game.arcade.kit.ChampionsKit;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
@ -470,6 +472,8 @@ public abstract class Game extends ListenerComponent implements Lifetimed
|
||||
};
|
||||
|
||||
System.out.println("Loading " + GetName() + "...");
|
||||
|
||||
new AntiExpOrbModule().register(this);
|
||||
}
|
||||
|
||||
// You should never use this so please don't. Use Module.register instead
|
||||
@ -1136,7 +1140,7 @@ public abstract class Game extends ListenerComponent implements Lifetimed
|
||||
}
|
||||
else if (!(kit instanceof ChampionsKit))
|
||||
{
|
||||
player.closeInventory();
|
||||
UtilPlayer.closeInventoryIfOpen(player);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.bridge;
|
||||
|
||||
public class BattleCryManager
|
||||
{
|
||||
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
package nautilus.game.arcade.game.games.bridge;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.*;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
@ -13,13 +12,22 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.events.PlayerDeathOutEvent;
|
||||
import nautilus.game.arcade.game.DebugCommand;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.TeamGame;
|
||||
import nautilus.game.arcade.game.games.bridge.animation.BridgeAnimation;
|
||||
import nautilus.game.arcade.game.games.bridge.animation.BridgeAnimationType;
|
||||
import nautilus.game.arcade.game.games.bridge.animation.custom.CustomBridgeAnimation;
|
||||
import nautilus.game.arcade.game.games.bridge.animation.custom.RadiusCustomBridgeAnimation;
|
||||
import nautilus.game.arcade.game.games.bridge.animation.custom.RandomCustomBridgeAnimation;
|
||||
import nautilus.game.arcade.game.games.bridge.kits.*;
|
||||
import nautilus.game.arcade.game.modules.WorldBorderModule;
|
||||
import nautilus.game.arcade.game.modules.compass.CompassModule;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.PerkBomber;
|
||||
import nautilus.game.arcade.kit.perks.PerkDestructor;
|
||||
import nautilus.game.arcade.ore.OreHider;
|
||||
import nautilus.game.arcade.ore.OreObsfucation;
|
||||
import nautilus.game.arcade.stats.*;
|
||||
@ -38,14 +46,19 @@ import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.entity.EntitySpawnEvent;
|
||||
import org.bukkit.event.entity.ItemSpawnEvent;
|
||||
import org.bukkit.event.inventory.CraftItemEvent;
|
||||
import org.bukkit.event.inventory.PrepareItemCraftEvent;
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.event.player.PlayerBucketEmptyEvent;
|
||||
import org.bukkit.event.player.PlayerBucketFillEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
import org.bukkit.inventory.CraftingInventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class Bridge extends TeamGame implements OreObsfucation
|
||||
{
|
||||
@ -54,28 +67,18 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
*/
|
||||
private static final Material[] PLAYER_DROP_DELAY_MATERIALS = new Material[] { Material.LOG, Material.LOG_2, Material.IRON_ORE, Material.DIAMOND_ORE, Material.COAL_ORE, Material.GOLD_ORE, Material.WORKBENCH, Material.FURNACE };
|
||||
|
||||
//Bridge Timer
|
||||
private int _bridgeTime = 600000;
|
||||
/**
|
||||
* The number of milliseconds from the game start time til the bridges should be built.
|
||||
*/
|
||||
private static final long BRIDGE_TIME = TimeUnit.MINUTES.toMillis(10);
|
||||
|
||||
private static final String CUSTOM_BRIDGE_KEY = "TYPE";
|
||||
|
||||
//Bridge
|
||||
private long _bridgeTime = BRIDGE_TIME;
|
||||
private boolean _bridgesDown = false;
|
||||
|
||||
//Wood Bridge
|
||||
private ArrayList<Location> _woodBridge = new ArrayList<Location>();
|
||||
private HashMap<Location, Integer> _woodBridgeBlocks = null;
|
||||
|
||||
//Lava Bridge
|
||||
private ArrayList<Location> _lavaBridge = new ArrayList<Location>();
|
||||
private ArrayList<Location> _lavaSource = new ArrayList<Location>();
|
||||
|
||||
//Lilly Pad Bridge
|
||||
private NautHashMap<Location, Long> _lillyPads = new NautHashMap<Location, Long>();
|
||||
|
||||
//Mushrooms
|
||||
private NautHashMap<Location, Long> _mushroomStem = new NautHashMap<Location, Long>();
|
||||
private NautHashMap<Location, Long> _mushroomTop = new NautHashMap<Location, Long>();
|
||||
private boolean _stemsGrown = false;
|
||||
|
||||
//Ice
|
||||
private ArrayList<Location> _iceBridge = new ArrayList<Location>();
|
||||
private BridgeAnimation _animation;
|
||||
private CustomBridgeAnimation[] _customAnimations;
|
||||
|
||||
private HashSet<BridgePart> _bridgeParts = new HashSet<BridgePart>();
|
||||
|
||||
@ -97,14 +100,16 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
private int _buildHeight = -1;
|
||||
|
||||
//Player Respawn
|
||||
private HashSet<String> _usedLife = new HashSet<String>();
|
||||
private Set<String> _usedLife = new HashSet<>();
|
||||
|
||||
//Tourney Mode
|
||||
private boolean _tournament;
|
||||
private HashMap<GameTeam, Integer> _tournamentKills = new HashMap<GameTeam, Integer>();
|
||||
private long _tournamentKillMessageTimer = 0;
|
||||
|
||||
private final Map<GameTeam, Location> _averageSpawns = new HashMap<>();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Bridge(ArcadeManager manager)
|
||||
{
|
||||
this(manager, GameType.Bridge);
|
||||
@ -135,7 +140,6 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
new KitApple(manager),
|
||||
new KitBerserker(manager),
|
||||
new KitBrawler(manager),
|
||||
new KitMammoth(manager),
|
||||
new KitArcher(manager),
|
||||
new KitMiner(manager),
|
||||
new KitBomber(manager),
|
||||
@ -154,36 +158,14 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
"The last team alive wins!"
|
||||
});
|
||||
|
||||
List<Kit> kits = Lists.newArrayList(GetKits());
|
||||
List<Kit> finalKits = Lists.newArrayList(kits);
|
||||
|
||||
boolean foundBrawler = false;
|
||||
for(int i = 0; i < kits.size(); i++)
|
||||
{
|
||||
Kit kit = kits.get(i);
|
||||
if(kit.GetName().equalsIgnoreCase("Brawler"))
|
||||
{
|
||||
if(!foundBrawler)
|
||||
{
|
||||
foundBrawler = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
finalKits.remove(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setKits(finalKits.toArray(new Kit[finalKits.size()]));
|
||||
|
||||
_ore = new OreHider();
|
||||
|
||||
// Flags
|
||||
GameTimeout = Manager.IsTournamentServer() ? 5400000 : 3600000;
|
||||
GameTimeout = Manager.IsTournamentServer() ? TimeUnit.MINUTES.toMillis(90) : TimeUnit.MINUTES.toMillis(60);
|
||||
|
||||
Manager.GetExplosion().SetLiquidDamage(false);
|
||||
|
||||
this.StrictAntiHack = true;
|
||||
StrictAntiHack = true;
|
||||
|
||||
DamageSelf = true;
|
||||
|
||||
@ -204,11 +186,7 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
WorldTimeSet = 2000;
|
||||
|
||||
WorldWaterDamage = 0;
|
||||
WorldBoundaryKill = false;
|
||||
|
||||
new CompassModule()
|
||||
.setGiveCompassToAlive(true)
|
||||
.register(this);
|
||||
WorldBoundaryKill = true;
|
||||
|
||||
DeathDropItems = true;
|
||||
|
||||
@ -229,61 +207,144 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
"Killing yourself counts as -1 team kill.",
|
||||
"Team with the most kills wins!"
|
||||
};
|
||||
|
||||
_tournament = true;
|
||||
}
|
||||
|
||||
_customAnimations = new CustomBridgeAnimation[] {
|
||||
new RandomCustomBridgeAnimation(this),
|
||||
new RadiusCustomBridgeAnimation(this)
|
||||
};
|
||||
|
||||
_tournament = Manager.IsTournamentServer();
|
||||
new CompassModule()
|
||||
.setGiveCompassToAlive(true)
|
||||
.register(this);
|
||||
|
||||
// So that we can be 110% sure
|
||||
for (Kit kit : GetKits())
|
||||
{
|
||||
if (kit instanceof KitDestructor)
|
||||
{
|
||||
((KitDestructor) kit).SetEnabled(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
registerDebugCommand(new DebugCommand("bridge", getArcadeManager().getGameCommandRank())
|
||||
{
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
caller.sendMessage(F.main("Debug", "Spawning the bridges."));
|
||||
_bridgeTime = 3000;
|
||||
}
|
||||
});
|
||||
|
||||
registerDebugCommand(new DebugCommand("bridgeinfo", getArcadeManager().getGameCommandRank())
|
||||
{
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (_animation == null || !(_animation instanceof CustomBridgeAnimation))
|
||||
{
|
||||
caller.sendMessage(F.main("Debug", "The bridge animation for this map isn't a custom one."));
|
||||
return;
|
||||
}
|
||||
|
||||
caller.sendMessage(F.main("Debug", "Bridge Info:"));
|
||||
caller.sendMessage(_animation.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void PlayerOut(final PlayerDeathOutEvent event)
|
||||
public void prepare(GameStateChangeEvent event)
|
||||
{
|
||||
if (_bridgesDown)
|
||||
return;
|
||||
|
||||
Player player = event.GetPlayer();
|
||||
|
||||
if (!_usedLife.contains(player.getName()))
|
||||
if (event.GetState() != GameState.Prepare)
|
||||
{
|
||||
_usedLife.add(player.getName());
|
||||
|
||||
UtilPlayer.message(player, F.main("Game", "You used your " + F.elem(C.cAqua + "Early Game Revive") + "."));
|
||||
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
Manager.runSyncLater(() -> _animation.onParse(), 10);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void GameStateChange(GameStateChangeEvent event)
|
||||
public void live(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Live)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!WorldData.GetCustomLocs("WATER_DAMAGE").isEmpty())
|
||||
{
|
||||
WorldWaterDamage = 4;
|
||||
}
|
||||
String name = WorldData.MapName;
|
||||
|
||||
if (WorldWaterDamage > 0)
|
||||
{
|
||||
if (WorldData.MapName.equals("Volcanic Islands"))
|
||||
if (name.equals("Volcanic Islands"))
|
||||
{
|
||||
UtilTextMiddle.display(C.cRed + "Warning", "Water is Boiling Hot", 10, 60, 20);
|
||||
else if (WorldData.MapName.equals("Icelands"))
|
||||
}
|
||||
else if (name.equals("Icelands"))
|
||||
{
|
||||
UtilTextMiddle.display(C.cRed + "Warning", "Water is Freezing Cold", 10, 60, 20);
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilTextMiddle.display(C.cRed + "Warning", "Water is Deadly", 10, 60, 20);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//parse
|
||||
@Override
|
||||
public void ParseData()
|
||||
{
|
||||
ParseLavaBridge();
|
||||
ParseWoodBridge();
|
||||
ParseIceBridge();
|
||||
ParseLillyPad();
|
||||
ParseMushrooms();
|
||||
// Now we need to decide on what bridge animation.
|
||||
typeLoop : for (BridgeAnimationType type : BridgeAnimationType.values())
|
||||
{
|
||||
for (String colours : type.getColoursUsed())
|
||||
{
|
||||
if (WorldData.GetDataLocs(colours).isEmpty())
|
||||
{
|
||||
continue typeLoop;
|
||||
}
|
||||
}
|
||||
|
||||
_animation = type.createInstance(this);
|
||||
break;
|
||||
}
|
||||
|
||||
// If none of the premade ones are usable then we need a custom one!
|
||||
if (_animation == null)
|
||||
{
|
||||
locationLoop : for (String key : WorldData.GetAllCustomLocs().keySet())
|
||||
{
|
||||
if (!key.startsWith(CUSTOM_BRIDGE_KEY))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
String[] split = key.split(" ");
|
||||
|
||||
if (split.length < 2)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
String subKey = split[1];
|
||||
|
||||
for (CustomBridgeAnimation animation : _customAnimations)
|
||||
{
|
||||
if (animation.getTypeKey().equalsIgnoreCase(subKey))
|
||||
{
|
||||
_animation = animation;
|
||||
break locationLoop;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ParseChests();
|
||||
|
||||
@ -403,8 +464,6 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void ParseOre(ArrayList<Location> teamOre)
|
||||
{
|
||||
int coal = (int) ((teamOre.size() / 32d) * _oreDensity);
|
||||
@ -625,368 +684,45 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
}
|
||||
}
|
||||
|
||||
protected void ParseWoodBridge() {
|
||||
_woodBridge = new ArrayList<Location>();
|
||||
|
||||
// Load Wood In
|
||||
for (Location loc : WorldData.GetDataLocs("BROWN")) {
|
||||
_woodBridge.add(loc.getBlock().getLocation());
|
||||
}
|
||||
|
||||
for (Location loc : WorldData.GetDataLocs("GRAY")) {
|
||||
_woodBridge.add(loc.getBlock().getLocation());
|
||||
_woodBridge.add(loc.getBlock().getRelative(BlockFace.UP)
|
||||
.getLocation());
|
||||
}
|
||||
|
||||
// Determine Wood Block
|
||||
_woodBridgeBlocks = new HashMap<Location, Integer>();
|
||||
|
||||
for (Location loc : _woodBridge) {
|
||||
if (_woodBridge.contains(loc.getBlock().getRelative(BlockFace.DOWN)
|
||||
.getLocation())) {
|
||||
_woodBridgeBlocks.put(loc, 85);
|
||||
}
|
||||
|
||||
if (_woodBridge.contains(loc.getBlock().getRelative(BlockFace.UP)
|
||||
.getLocation())) {
|
||||
_woodBridgeBlocks.put(loc, 17);
|
||||
}
|
||||
|
||||
if (!_woodBridgeBlocks.containsKey(loc)) {
|
||||
_woodBridgeBlocks.put(loc, 126);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void ParseLavaBridge() {
|
||||
for (Location loc : WorldData.GetDataLocs("RED")) {
|
||||
_lavaBridge.add(loc.getBlock().getLocation());
|
||||
}
|
||||
|
||||
for (Location loc : WorldData.GetDataLocs("ORANGE")) {
|
||||
_lavaBridge.add(loc.getBlock().getLocation());
|
||||
_lavaBridge.add(loc.getBlock().getRelative(BlockFace.UP)
|
||||
.getLocation());
|
||||
}
|
||||
|
||||
_lavaSource = WorldData.GetDataLocs("BLACK");
|
||||
}
|
||||
|
||||
protected void ParseIceBridge()
|
||||
{
|
||||
_iceBridge = WorldData.GetDataLocs("LIGHT_BLUE");
|
||||
}
|
||||
|
||||
protected void ParseMushrooms()
|
||||
{
|
||||
for (Location loc : WorldData.GetCustomLocs("21"))
|
||||
{
|
||||
_mushroomStem.put(loc, 0L);
|
||||
loc.getBlock().setType(Material.AIR);
|
||||
}
|
||||
|
||||
for (Location loc : WorldData.GetDataLocs("PURPLE"))
|
||||
{
|
||||
_mushroomTop.put(loc, 0L);
|
||||
}
|
||||
}
|
||||
|
||||
protected void ParseLillyPad()
|
||||
{
|
||||
for (Location loc : WorldData.GetDataLocs("LIME"))
|
||||
{
|
||||
_lillyPads.put(loc, 0L);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void BridgeBuild(UpdateEvent event)
|
||||
{
|
||||
if (!IsLive())
|
||||
if (!IsLive() || !UtilTime.elapsed(GetStateTime(), _bridgeTime))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getType() != UpdateType.FASTEST)
|
||||
return;
|
||||
if (_animation != null)
|
||||
{
|
||||
_animation.onUpdate(event.getType());
|
||||
}
|
||||
|
||||
if (!UtilTime.elapsed(this.GetStateTime(), _bridgeTime))
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_bridgesDown)
|
||||
{
|
||||
_bridgesDown = true;
|
||||
|
||||
// WorldBorderModule borderModule = getModule(WorldBorderModule.class);
|
||||
//
|
||||
// for (Player player : GetPlayers(true))
|
||||
// {
|
||||
// borderModule.setSize(player, 10000);
|
||||
// }
|
||||
|
||||
Manager.GetExplosion().SetLiquidDamage(true);
|
||||
this.Announce(C.cRed + C.Bold + "ALERT: " + ChatColor.RESET + C.Bold + "THE BRIDGES ARE SPAWNING!");
|
||||
}
|
||||
Announce(C.cRedB + "ALERT: " + C.Reset + C.Bold + "THE BRIDGES ARE SPAWNING!");
|
||||
UtilTextMiddle.display(C.cRedB + "ALERT", "The BRIDGES ARE SPAWNING!");
|
||||
|
||||
_bridgesDown = true;
|
||||
|
||||
for (Kit kit : this.GetKits())
|
||||
{
|
||||
if (kit instanceof KitDestructor)
|
||||
for (Kit kit : GetKits())
|
||||
{
|
||||
((KitDestructor)kit).SetEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
BuildWood();
|
||||
BuildLava();
|
||||
BuildIce();
|
||||
BuildLillyPad();
|
||||
buildMushroom();
|
||||
}
|
||||
|
||||
protected void BuildLava()
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
if (_lavaBridge != null && _lavaSource != null
|
||||
&& !_lavaBridge.isEmpty() && !_lavaSource.isEmpty()) {
|
||||
// Random Block
|
||||
Location bestLoc = _lavaBridge.get(UtilMath.r(_lavaBridge
|
||||
.size()));
|
||||
|
||||
if (bestLoc.getBlock().getRelative(BlockFace.DOWN)
|
||||
.isLiquid())
|
||||
continue;
|
||||
|
||||
_lavaBridge.remove(bestLoc);
|
||||
|
||||
Location source = _lavaSource.get(UtilMath.r(_lavaSource
|
||||
.size()));
|
||||
|
||||
// Create Part
|
||||
FallingBlock block = bestLoc.getWorld().spawnFallingBlock(
|
||||
source, 87, (byte) 0);
|
||||
BridgePart part = new BridgePart(block, bestLoc, true);
|
||||
_bridgeParts.add(part);
|
||||
|
||||
// Sound
|
||||
source.getWorld().playSound(source, Sound.EXPLODE,
|
||||
5f * (float) Math.random(),
|
||||
0.5f + (float) Math.random());
|
||||
}
|
||||
}
|
||||
|
||||
protected void BuildLillyPad()
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
if (_lillyPads != null && !_lillyPads.isEmpty())
|
||||
{
|
||||
// Random Block
|
||||
Location loc = UtilAlg.Random(_lillyPads.keySet());
|
||||
|
||||
if (!UtilTime.elapsed(_lillyPads.get(loc), 8000))
|
||||
continue;
|
||||
|
||||
if (!loc.getBlock().getRelative(BlockFace.DOWN).isLiquid())
|
||||
continue;
|
||||
|
||||
_lillyPads.remove(loc);
|
||||
|
||||
MapUtil.QuickChangeBlockAt(loc, Material.WATER_LILY);
|
||||
|
||||
// Sound
|
||||
loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 111);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void breakLillyPad(BlockBreakEvent event)
|
||||
{
|
||||
if (event.getBlock().getType() != Material.WATER_LILY)
|
||||
return;
|
||||
|
||||
_lillyPads.put(event.getBlock().getLocation(), System.currentTimeMillis() + (long)(Math.random() * 12000));
|
||||
}
|
||||
|
||||
protected void buildMushroom()
|
||||
{
|
||||
if (_mushroomStem != null && !_mushroomStem.isEmpty())
|
||||
{
|
||||
for (int i=0 ; i<4 && !_mushroomStem.isEmpty() ; i++)
|
||||
{
|
||||
double lowestY = 0;
|
||||
Location lowestLoc = null;
|
||||
|
||||
for (Location loc : _mushroomStem.keySet())
|
||||
if (kit instanceof KitDestructor)
|
||||
{
|
||||
if (!UtilTime.elapsed(_mushroomStem.get(loc), 6000))
|
||||
continue;
|
||||
|
||||
if (lowestLoc == null || loc.getY() < lowestY)
|
||||
{
|
||||
lowestY = loc.getY();
|
||||
lowestLoc = loc;
|
||||
}
|
||||
((KitDestructor) kit).SetEnabled(true);
|
||||
}
|
||||
|
||||
if (lowestLoc == null)
|
||||
continue;
|
||||
|
||||
_mushroomStem.remove(lowestLoc);
|
||||
|
||||
MapUtil.QuickChangeBlockAt(lowestLoc, 100, (byte)15);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_stemsGrown = true;
|
||||
}
|
||||
|
||||
if (_stemsGrown && _mushroomTop != null && !_mushroomTop.isEmpty())
|
||||
{
|
||||
int attempts = 0;
|
||||
int done = 0;
|
||||
while (done < 6 && attempts < 400)
|
||||
{
|
||||
attempts++;
|
||||
|
||||
// Random Block
|
||||
Location loc = UtilAlg.Random(_mushroomTop.keySet());
|
||||
|
||||
if (!UtilTime.elapsed(_mushroomTop.get(loc), 6000))
|
||||
continue;
|
||||
|
||||
Block block = loc.getBlock();
|
||||
|
||||
if (block.getRelative(BlockFace.DOWN).getType() == Material.AIR &&
|
||||
block.getRelative(BlockFace.NORTH).getType() == Material.AIR &&
|
||||
block.getRelative(BlockFace.EAST).getType() == Material.AIR &&
|
||||
block.getRelative(BlockFace.SOUTH).getType() == Material.AIR &&
|
||||
block.getRelative(BlockFace.WEST).getType() == Material.AIR)
|
||||
continue;
|
||||
|
||||
_mushroomTop.remove(loc);
|
||||
|
||||
MapUtil.QuickChangeBlockAt(block.getLocation(), 99, (byte)14);
|
||||
|
||||
done++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void breakMushroom(BlockBreakEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
|
||||
if (event.getBlock().getTypeId() == 100 &&
|
||||
WorldData.GetCustomLocs("21").contains(event.getBlock().getLocation().add(0.5, 0, 0.5)))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
event.getBlock().setType(Material.AIR);
|
||||
|
||||
_mushroomStem.put(event.getBlock().getLocation(), System.currentTimeMillis() + (long)(Math.random() * 12000));
|
||||
}
|
||||
|
||||
if (event.getBlock().getTypeId() == 99 &&
|
||||
WorldData.GetDataLocs("PURPLE").contains(event.getBlock().getLocation().add(0.5, 0, 0.5)))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
event.getBlock().setType(Material.AIR);
|
||||
|
||||
_mushroomTop.put(event.getBlock().getLocation(), System.currentTimeMillis() + (long)(Math.random() * 12000));
|
||||
}
|
||||
}
|
||||
|
||||
protected void BuildIce()
|
||||
{
|
||||
if (_iceBridge == null || _iceBridge.isEmpty() || UtilTime.elapsed(this.GetStateTime(), _bridgeTime + 120000))
|
||||
{
|
||||
WorldData.World.setStorm(false);
|
||||
return;
|
||||
}
|
||||
|
||||
WorldData.World.setStorm(true);
|
||||
|
||||
int attempts = 0;
|
||||
int done = 0;
|
||||
while (done < 5 && attempts < 400)
|
||||
{
|
||||
attempts++;
|
||||
|
||||
// Random Block
|
||||
Location loc = _iceBridge.get(UtilMath.r(_iceBridge.size()));
|
||||
|
||||
Block block = loc.getBlock().getRelative(BlockFace.DOWN);
|
||||
|
||||
if (!block.isLiquid())
|
||||
continue;
|
||||
|
||||
if (block.getRelative(BlockFace.NORTH).isLiquid() &&
|
||||
block.getRelative(BlockFace.EAST).isLiquid() &&
|
||||
block.getRelative(BlockFace.SOUTH).isLiquid() &&
|
||||
block.getRelative(BlockFace.WEST).isLiquid())
|
||||
continue;
|
||||
|
||||
_iceBridge.remove(loc);
|
||||
|
||||
if (Math.random() > 0.25)
|
||||
MapUtil.QuickChangeBlockAt(block.getLocation(), Material.PACKED_ICE);
|
||||
else
|
||||
MapUtil.QuickChangeBlockAt(block.getLocation(), Material.ICE);
|
||||
|
||||
done++;
|
||||
}
|
||||
}
|
||||
|
||||
protected void BuildWood()
|
||||
{
|
||||
if (_woodBridgeBlocks != null && !_woodBridgeBlocks.isEmpty())
|
||||
{
|
||||
ArrayList<Location> toDo = new ArrayList<Location>();
|
||||
|
||||
BlockFace[] faces = new BlockFace[] { BlockFace.NORTH,
|
||||
BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST };
|
||||
|
||||
for (Location loc : _woodBridgeBlocks.keySet())
|
||||
{
|
||||
if (_woodBridgeBlocks.get(loc) == 17)
|
||||
{
|
||||
int adjacent = 0;
|
||||
|
||||
for (BlockFace face : faces)
|
||||
if (loc.getBlock().getRelative(face).getTypeId() != 0)
|
||||
adjacent++;
|
||||
|
||||
if (adjacent > 0)
|
||||
toDo.add(loc);
|
||||
|
||||
} else if (_woodBridgeBlocks.get(loc) == 85)
|
||||
{
|
||||
if (loc.getBlock().getRelative(BlockFace.DOWN).getTypeId() == 0)
|
||||
continue;
|
||||
|
||||
toDo.add(loc);
|
||||
} else if (_woodBridgeBlocks.get(loc) == 126)
|
||||
{
|
||||
int adjacent = 0;
|
||||
|
||||
for (BlockFace face : faces)
|
||||
if (loc.getBlock().getRelative(face).getTypeId() != 0)
|
||||
adjacent++;
|
||||
|
||||
if (adjacent > 0)
|
||||
toDo.add(loc);
|
||||
}
|
||||
}
|
||||
|
||||
if (toDo.size() == 0)
|
||||
return;
|
||||
|
||||
for (Location loc : toDo)
|
||||
{
|
||||
int id = _woodBridgeBlocks.remove(loc);
|
||||
|
||||
Location source = loc.clone().add(0, 30, 0);
|
||||
|
||||
// Create Part
|
||||
FallingBlock block = loc.getWorld().spawnFallingBlock(source,
|
||||
id, (byte) 0);
|
||||
block.setVelocity(new Vector(0, -1, 0));
|
||||
BridgePart part = new BridgePart(block, loc, false);
|
||||
_bridgeParts.add(part);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1119,15 +855,15 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
break;
|
||||
}
|
||||
|
||||
block = block.getRelative(BlockFace.UP);
|
||||
|
||||
if (block.getTypeId() == 0)
|
||||
if (block.getType() != Material.SNOW)
|
||||
{
|
||||
if (Math.random() > 0.5)
|
||||
block.setTypeId(39);
|
||||
else
|
||||
block.setTypeId(40);
|
||||
block = block.getRelative(BlockFace.UP);
|
||||
}
|
||||
|
||||
if (Math.random() > 0.5)
|
||||
block.setTypeId(39);
|
||||
else
|
||||
block.setTypeId(40);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1341,6 +1077,16 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void diamondOreExplode(PerkBomber.BomberExplodeDiamondBlock event)
|
||||
{
|
||||
event.setSpawnDrop(false);
|
||||
event.getBlock().setType(Material.AIR);
|
||||
|
||||
Item item = event.getBlock().getWorld().dropItem(event.getBlock().getLocation().add(.5, .5, .5), new ItemStack(Material.DIAMOND));
|
||||
item.setMetadata("owner", new FixedMetadataValue(Manager.getPlugin(), event.getPlayer().getUniqueId()));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void itemPickup(PlayerPickupItemEvent event)
|
||||
{
|
||||
@ -1515,7 +1261,7 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
else
|
||||
{
|
||||
Scoreboard.write(C.cYellow + C.Bold + "Time Left");
|
||||
Scoreboard.write(UtilTime.MakeStr(5400000 - (System.currentTimeMillis() - this.GetStateTime()), 0));
|
||||
Scoreboard.write(UtilTime.MakeStr(GameTimeout - (System.currentTimeMillis() - GetStateTime()), 0));
|
||||
}
|
||||
|
||||
Scoreboard.draw();
|
||||
@ -1681,7 +1427,7 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
{
|
||||
_tournamentKillMessageTimer = System.currentTimeMillis();
|
||||
|
||||
this.Announce(C.cRed + C.Bold + "ALERT: " + ChatColor.RESET + C.Bold + "FIRST TEAM TO HAVE MOST KILLS WINS!");
|
||||
Announce(C.cRed + C.Bold + "ALERT: " + C.Reset + C.Bold + "FIRST TEAM TO HAVE MOST KILLS WINS!");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1874,23 +1620,34 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
}
|
||||
}
|
||||
|
||||
// @EventHandler
|
||||
// public void liquidBlockDeny(BlockBreakEvent event)
|
||||
// {
|
||||
// if (_bridgesDown)
|
||||
// return;
|
||||
//
|
||||
// if (!IsAlive(event.getPlayer()))
|
||||
// return;
|
||||
//
|
||||
// if (event.getBlock().getRelative(BlockFace.UP).isLiquid() || event.getBlock().getRelative(BlockFace.UP).getRelative(BlockFace.UP).isLiquid())
|
||||
// {
|
||||
// UtilPlayer.message(event.getPlayer(), F.main("Game",
|
||||
// "Cannot tunnel under liquids."));
|
||||
//
|
||||
// event.setCancelled(true);
|
||||
// }
|
||||
// }
|
||||
@EventHandler(priority=EventPriority.HIGHEST)
|
||||
public void revivePlayer(CustomDamageEvent event)
|
||||
{
|
||||
if (!IsLive() || event.isCancelled() || _bridgesDown || !(event.GetDamageeEntity() instanceof Player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.GetDamageePlayer();
|
||||
|
||||
if (player.getHealth() - event.GetDamage() > 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_usedLife.contains(player.getName()))
|
||||
{
|
||||
_usedLife.add(player.getName());
|
||||
|
||||
UtilPlayer.message(player, F.main("Game", "You used your " + F.elem(C.cAqua + "Early Game Revive") + "."));
|
||||
UtilServer.broadcast(F.main("Game", GetTeam(player).GetColor() + player.getName()) + C.cGray + " fell into the void.");
|
||||
|
||||
player.setFallDistance(0);
|
||||
GetTeam(player).SpawnTeleport(player);
|
||||
player.setHealth(20);
|
||||
event.SetCancelled("Early Game Revive");
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void vehicleDeny(PlayerInteractEvent event)
|
||||
@ -1916,16 +1673,6 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
return 12;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void debug(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
if (Manager.GetClients().hasRank(event.getPlayer(), Rank.ADMIN) && event.getMessage().contains("/oretoggle"))
|
||||
_ore.ToggleVisibility();
|
||||
|
||||
if (Manager.GetClients().hasRank(event.getPlayer(), Rank.ADMIN) && event.getMessage().contains("/bridge"))
|
||||
_bridgeTime = 30000;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void disableIceForm(BlockFormEvent event)
|
||||
{
|
||||
@ -1941,6 +1688,83 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void disableDoors(CraftItemEvent event)
|
||||
{
|
||||
if (_bridgesDown)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Material type = event.getRecipe().getResult().getType();
|
||||
|
||||
if (type == Material.WOOD_DOOR || type == Material.IRON_DOOR)
|
||||
{
|
||||
event.setResult(null);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void disableDoors(PlayerPickupItemEvent event)
|
||||
{
|
||||
if (_bridgesDown)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Material type = event.getItem().getItemStack().getType();
|
||||
|
||||
if (type == Material.WOOD_DOOR || type == Material.IRON_DOOR)
|
||||
{
|
||||
event.getItem().remove();
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateBorder(UpdateEvent event)
|
||||
{
|
||||
if (!IsLive() || event.getType() != UpdateType.FAST || _bridgesDown)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (GameTeam team : GetTeamList())
|
||||
{
|
||||
List<Location> border = WorldData.GetCustomLocs("BORDER " + team.getDisplayName());
|
||||
|
||||
if (border.size() < 2)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Location one = border.get(0);
|
||||
Location two = border.get(1);
|
||||
Location average = _averageSpawns.computeIfAbsent(team, k -> UtilAlg.getAverageLocation(team.GetSpawns()));
|
||||
|
||||
one.setY(0);
|
||||
two.setY(256);
|
||||
|
||||
for (Player player : team.GetPlayers(true))
|
||||
{
|
||||
if (player.getGameMode() != GameMode.SURVIVAL)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Location location = player.getLocation();
|
||||
|
||||
if (!UtilAlg.inBoundingBox(location, one, two))
|
||||
{
|
||||
player.setVelocity(UtilAlg.getTrajectory(location, average).multiply(2).add(new Vector(0, 0.5, 0)));
|
||||
player.sendMessage(C.cRedB + "STAY ON YOUR ISLAND!");
|
||||
player.playSound(player.getLocation(), Sound.NOTE_PLING, 1, 0.5F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setBridgeTime(int time)
|
||||
{
|
||||
_bridgeTime = time;
|
||||
@ -1961,6 +1785,11 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
return _chestLoot;
|
||||
}
|
||||
|
||||
public HashSet<BridgePart> getBridgeParts()
|
||||
{
|
||||
return _bridgeParts;
|
||||
}
|
||||
|
||||
public boolean bridgesDown()
|
||||
{
|
||||
return _bridgesDown;
|
||||
|
@ -0,0 +1,45 @@
|
||||
package nautilus.game.arcade.game.games.bridge.animation;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import nautilus.game.arcade.game.games.bridge.Bridge;
|
||||
import nautilus.game.arcade.game.games.bridge.BridgePart;
|
||||
import nautilus.game.arcade.world.WorldData;
|
||||
|
||||
public abstract class BridgeAnimation
|
||||
{
|
||||
|
||||
public static final int AVERAGE_BRIDGE_BLOCKS = 3000;
|
||||
|
||||
protected final Bridge _bridge;
|
||||
protected final WorldData _worldData;
|
||||
|
||||
public BridgeAnimation(Bridge bridge)
|
||||
{
|
||||
_bridge = bridge;
|
||||
_worldData = bridge.WorldData;
|
||||
}
|
||||
|
||||
public abstract void onParse();
|
||||
|
||||
public abstract void onUpdate(UpdateType type);
|
||||
|
||||
public void registerBridgePart(BridgePart part)
|
||||
{
|
||||
_bridge.getBridgeParts().add(part);
|
||||
}
|
||||
|
||||
public boolean isAir(Location location)
|
||||
{
|
||||
return isAir(location.getBlock());
|
||||
}
|
||||
|
||||
public boolean isAir(Block block)
|
||||
{
|
||||
return block.getType() == Material.AIR;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package nautilus.game.arcade.game.games.bridge.animation;
|
||||
|
||||
import nautilus.game.arcade.game.games.bridge.Bridge;
|
||||
|
||||
public enum BridgeAnimationType
|
||||
{
|
||||
|
||||
WOOD(WoodBridgeAnimation.class, "BROWN", "GRAY"),
|
||||
ICE(IceBridgeAnimation.class, "LIGHT_BLUE"),
|
||||
LAVA(LavaBridgeAnimation.class, "BLACK", "RED", "ORANGE"),
|
||||
LILLY(LillyPadBridgeAnimation.class, "LIME"),
|
||||
MUSHROOM(MushroomBridgeAnimation.class, "PURPLE")
|
||||
|
||||
;
|
||||
|
||||
private final Class<? extends BridgeAnimation> _clazz;
|
||||
private final String[] _coloursUsed;
|
||||
|
||||
private BridgeAnimationType(Class<? extends BridgeAnimation> clazz, String... coloursUsed)
|
||||
{
|
||||
_clazz = clazz;
|
||||
_coloursUsed = coloursUsed;
|
||||
}
|
||||
|
||||
public BridgeAnimation createInstance(Bridge bridge)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _clazz.cast(_clazz.getConstructor(Bridge.class).newInstance(bridge));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public String[] getColoursUsed()
|
||||
{
|
||||
return _coloursUsed;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
package nautilus.game.arcade.game.games.bridge.animation;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
|
||||
import mineplex.core.common.util.MapUtil;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import nautilus.game.arcade.game.games.bridge.Bridge;
|
||||
|
||||
public class IceBridgeAnimation extends BridgeAnimation
|
||||
{
|
||||
|
||||
private List<Location> _iceBridge;
|
||||
|
||||
public IceBridgeAnimation(Bridge bridge)
|
||||
{
|
||||
super(bridge);
|
||||
|
||||
_iceBridge = new ArrayList<>(AVERAGE_BRIDGE_BLOCKS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onParse()
|
||||
{
|
||||
_iceBridge = _worldData.GetDataLocs("LIGHT_BLUE");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(UpdateType type)
|
||||
{
|
||||
if (type != UpdateType.FASTEST || _iceBridge.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int attempts = 0;
|
||||
int done = 0;
|
||||
|
||||
while (done < 5 && attempts < 400)
|
||||
{
|
||||
attempts++;
|
||||
|
||||
// Random Block
|
||||
Location loc = UtilAlg.Random(_iceBridge);
|
||||
|
||||
Block block = loc.getBlock().getRelative(BlockFace.DOWN);
|
||||
|
||||
if (!block.isLiquid())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (block.getRelative(BlockFace.NORTH).isLiquid() && block.getRelative(BlockFace.EAST).isLiquid() && block.getRelative(BlockFace.SOUTH).isLiquid() && block.getRelative(BlockFace.WEST).isLiquid())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
_iceBridge.remove(loc);
|
||||
|
||||
if (Math.random() > 0.25)
|
||||
{
|
||||
MapUtil.QuickChangeBlockAt(block.getLocation(), Material.PACKED_ICE);
|
||||
}
|
||||
else
|
||||
{
|
||||
MapUtil.QuickChangeBlockAt(block.getLocation(), Material.ICE);
|
||||
}
|
||||
|
||||
done++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
package nautilus.game.arcade.game.games.bridge.animation;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import nautilus.game.arcade.game.games.bridge.Bridge;
|
||||
import nautilus.game.arcade.game.games.bridge.BridgePart;
|
||||
|
||||
public class LavaBridgeAnimation extends BridgeAnimation
|
||||
{
|
||||
|
||||
private List<Location> _lavaSource;
|
||||
private List<Location> _lavaBridge;
|
||||
|
||||
public LavaBridgeAnimation(Bridge bridge)
|
||||
{
|
||||
super(bridge);
|
||||
|
||||
_lavaSource = new ArrayList<>();
|
||||
_lavaBridge = new ArrayList<>(AVERAGE_BRIDGE_BLOCKS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onParse()
|
||||
{
|
||||
for (Location loc : _worldData.GetDataLocs("RED"))
|
||||
{
|
||||
_lavaBridge.add(loc.getBlock().getLocation());
|
||||
}
|
||||
|
||||
for (Location loc : _worldData.GetDataLocs("ORANGE"))
|
||||
{
|
||||
_lavaBridge.add(loc.getBlock().getLocation());
|
||||
_lavaBridge.add(loc.getBlock().getRelative(BlockFace.UP).getLocation());
|
||||
}
|
||||
|
||||
_lavaSource = _worldData.GetDataLocs("BLACK");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(UpdateType type)
|
||||
{
|
||||
if (type != UpdateType.FASTEST)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
if (!_lavaBridge.isEmpty() && !_lavaSource.isEmpty())
|
||||
{
|
||||
// Random Block
|
||||
Location bestLoc = _lavaBridge.get(UtilMath.r(_lavaBridge.size()));
|
||||
|
||||
if (bestLoc.getBlock().getRelative(BlockFace.DOWN).isLiquid())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
_lavaBridge.remove(bestLoc);
|
||||
|
||||
Location source = _lavaSource.get(UtilMath.r(_lavaSource.size()));
|
||||
|
||||
// Create Part
|
||||
FallingBlock block = bestLoc.getWorld().spawnFallingBlock(source, Material.NETHERRACK, (byte) 0);
|
||||
BridgePart part = new BridgePart(block, bestLoc, true);
|
||||
|
||||
registerBridgePart(part);
|
||||
|
||||
// Sound
|
||||
source.getWorld().playSound(source, Sound.EXPLODE, 5f * (float) Math.random(), 0.5f + (float) Math.random());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
package nautilus.game.arcade.game.games.bridge.animation;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
|
||||
import mineplex.core.common.util.MapUtil;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import nautilus.game.arcade.game.games.bridge.Bridge;
|
||||
|
||||
public class LillyPadBridgeAnimation extends BridgeAnimation
|
||||
{
|
||||
|
||||
private Map<Location, Long> _lillyPads = new HashMap<>();
|
||||
|
||||
public LillyPadBridgeAnimation(Bridge bridge)
|
||||
{
|
||||
super(bridge);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onParse()
|
||||
{
|
||||
for (Location loc : _worldData.GetDataLocs("LIME"))
|
||||
{
|
||||
_lillyPads.put(loc, 0L);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(UpdateType type)
|
||||
{
|
||||
if (type != UpdateType.FASTEST)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
if (_lillyPads != null && !_lillyPads.isEmpty())
|
||||
{
|
||||
// Random Block
|
||||
Location loc = UtilAlg.Random(_lillyPads.keySet());
|
||||
|
||||
if (!UtilTime.elapsed(_lillyPads.get(loc), 8000))
|
||||
continue;
|
||||
|
||||
if (!loc.getBlock().getRelative(BlockFace.DOWN).isLiquid())
|
||||
continue;
|
||||
|
||||
_lillyPads.remove(loc);
|
||||
|
||||
MapUtil.QuickChangeBlockAt(loc, Material.WATER_LILY);
|
||||
|
||||
// Sound
|
||||
loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 111);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,107 @@
|
||||
package nautilus.game.arcade.game.games.bridge.animation;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
|
||||
import mineplex.core.common.util.MapUtil;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import nautilus.game.arcade.game.games.bridge.Bridge;
|
||||
|
||||
public class MushroomBridgeAnimation extends BridgeAnimation
|
||||
{
|
||||
|
||||
private Map<Location, Long> _mushroomStem = new HashMap<>();
|
||||
private Map<Location, Long> _mushroomTop = new HashMap<>();
|
||||
private boolean _stemsGrown = false;
|
||||
|
||||
public MushroomBridgeAnimation(Bridge bridge)
|
||||
{
|
||||
super(bridge);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onParse()
|
||||
{
|
||||
for (Location loc : _worldData.GetCustomLocs("21"))
|
||||
{
|
||||
_mushroomStem.put(loc, 0L);
|
||||
loc.getBlock().setType(Material.AIR);
|
||||
}
|
||||
|
||||
for (Location loc : _worldData.GetDataLocs("PURPLE"))
|
||||
{
|
||||
_mushroomTop.put(loc, 0L);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(UpdateType type)
|
||||
{
|
||||
if (_mushroomStem != null && !_mushroomStem.isEmpty())
|
||||
{
|
||||
for (int i = 0; i < 4 && !_mushroomStem.isEmpty(); i++)
|
||||
{
|
||||
double lowestY = 0;
|
||||
Location lowestLoc = null;
|
||||
|
||||
for (Location loc : _mushroomStem.keySet())
|
||||
{
|
||||
if (!UtilTime.elapsed(_mushroomStem.get(loc), 6000))
|
||||
continue;
|
||||
|
||||
if (lowestLoc == null || loc.getY() < lowestY)
|
||||
{
|
||||
lowestY = loc.getY();
|
||||
lowestLoc = loc;
|
||||
}
|
||||
}
|
||||
|
||||
if (lowestLoc == null)
|
||||
continue;
|
||||
|
||||
_mushroomStem.remove(lowestLoc);
|
||||
|
||||
MapUtil.QuickChangeBlockAt(lowestLoc, 100, (byte) 15);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_stemsGrown = true;
|
||||
}
|
||||
|
||||
if (_stemsGrown && _mushroomTop != null && !_mushroomTop.isEmpty())
|
||||
{
|
||||
int attempts = 0;
|
||||
int done = 0;
|
||||
while (done < 6 && attempts < 400)
|
||||
{
|
||||
attempts++;
|
||||
|
||||
// Random Block
|
||||
Location loc = UtilAlg.Random(_mushroomTop.keySet());
|
||||
|
||||
if (!UtilTime.elapsed(_mushroomTop.get(loc), 6000))
|
||||
continue;
|
||||
|
||||
Block block = loc.getBlock();
|
||||
|
||||
if (block.getRelative(BlockFace.DOWN).getType() == Material.AIR && block.getRelative(BlockFace.NORTH).getType() == Material.AIR && block.getRelative(BlockFace.EAST).getType() == Material.AIR && block.getRelative(BlockFace.SOUTH).getType() == Material.AIR && block.getRelative(BlockFace.WEST).getType() == Material.AIR)
|
||||
continue;
|
||||
|
||||
_mushroomTop.remove(loc);
|
||||
|
||||
MapUtil.QuickChangeBlockAt(block.getLocation(), 99, (byte) 14);
|
||||
|
||||
done++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,129 @@
|
||||
package nautilus.game.arcade.game.games.bridge.animation;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import nautilus.game.arcade.game.games.bridge.Bridge;
|
||||
import nautilus.game.arcade.game.games.bridge.BridgePart;
|
||||
|
||||
public class WoodBridgeAnimation extends BridgeAnimation
|
||||
{
|
||||
|
||||
private static final BlockFace[] FACES = new BlockFace[] { BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST };
|
||||
private static final int Y_MOD = 30;
|
||||
|
||||
private final Map<Location, Material> _woodBridge;
|
||||
|
||||
public WoodBridgeAnimation(Bridge bridge)
|
||||
{
|
||||
super(bridge);
|
||||
|
||||
_woodBridge = new HashMap<>(AVERAGE_BRIDGE_BLOCKS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onParse()
|
||||
{
|
||||
onParse(_worldData.GetDataLocs("BROWN"), false);
|
||||
onParse(_worldData.GetDataLocs("GRAY"), true);
|
||||
}
|
||||
|
||||
public void onParse(List<Location> locations, boolean aboveBelow)
|
||||
{
|
||||
for (Location location : locations)
|
||||
{
|
||||
if (aboveBelow)
|
||||
{
|
||||
_woodBridge.put(location.getBlock().getRelative(BlockFace.UP).getLocation(), Material.FENCE);
|
||||
_woodBridge.put(location, Material.LOG);
|
||||
}
|
||||
else
|
||||
{
|
||||
_woodBridge.put(location, Material.WOOD_STEP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(UpdateType type)
|
||||
{
|
||||
if (type != UpdateType.FASTEST)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
List<Location> toDo = new ArrayList<>();
|
||||
|
||||
for (Location location : _woodBridge.keySet())
|
||||
{
|
||||
Material material = _woodBridge.get(location);
|
||||
|
||||
if (material == Material.LOG)
|
||||
{
|
||||
int adjacent = 0;
|
||||
|
||||
for (BlockFace face : FACES)
|
||||
{
|
||||
if (!isAir(location.getBlock().getRelative(face)))
|
||||
{
|
||||
adjacent++;
|
||||
}
|
||||
}
|
||||
if (adjacent > 0)
|
||||
{
|
||||
toDo.add(location);
|
||||
}
|
||||
}
|
||||
else if (material == Material.FENCE)
|
||||
{
|
||||
if (!isAir(location.getBlock().getRelative(BlockFace.DOWN)))
|
||||
{
|
||||
toDo.add(location);
|
||||
}
|
||||
}
|
||||
else if (material == Material.WOOD_STEP)
|
||||
{
|
||||
int adjacent = 0;
|
||||
|
||||
for (BlockFace face : FACES)
|
||||
{
|
||||
if (!isAir(location.getBlock().getRelative(face)))
|
||||
{
|
||||
adjacent++;
|
||||
}
|
||||
}
|
||||
if (adjacent > 0)
|
||||
{
|
||||
toDo.add(location);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (toDo.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (Location location : toDo)
|
||||
{
|
||||
Material material = _woodBridge.remove(location);
|
||||
Location source = location.clone().add(0, Y_MOD, 0);
|
||||
|
||||
// Create Part
|
||||
FallingBlock block = location.getWorld().spawnFallingBlock(source, material, (byte) 0);
|
||||
block.setVelocity(new Vector(0, -1, 0));
|
||||
BridgePart part = new BridgePart(block, location, false);
|
||||
|
||||
registerBridgePart(part);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,251 @@
|
||||
package nautilus.game.arcade.game.games.bridge.animation.custom;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
import mineplex.core.blockrestore.BlockRestore;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import nautilus.game.arcade.game.games.bridge.Bridge;
|
||||
import nautilus.game.arcade.game.games.bridge.animation.BridgeAnimation;
|
||||
|
||||
public abstract class CustomBridgeAnimation extends BridgeAnimation
|
||||
{
|
||||
|
||||
private static final String BLOCK_IDS_KEY = "BLOCK_IDS";
|
||||
private static final String RATE_KEY = "RATE";
|
||||
private static final String PARTICLE_KEY = "PARTICLE";
|
||||
private static final String SOUND_KEY = "SOUND";
|
||||
private static final String REGION_KEY = "BRIDGE";
|
||||
|
||||
protected final BlockRestore _restore;
|
||||
|
||||
private final String _typeKey;
|
||||
protected final Map<Location, Double> _bridgeBlocks;
|
||||
|
||||
// Configuration
|
||||
protected List<Integer> _blockIds;
|
||||
protected int _rate;
|
||||
protected ParticleType _particle;
|
||||
|
||||
// Sound
|
||||
protected Sound _sound;
|
||||
protected float _pitch;
|
||||
|
||||
protected double _maxDistance;
|
||||
|
||||
public CustomBridgeAnimation(Bridge bridge, String typeKey)
|
||||
{
|
||||
super(bridge);
|
||||
|
||||
_restore = bridge.getArcadeManager().GetBlockRestore();
|
||||
|
||||
_typeKey = typeKey;
|
||||
_bridgeBlocks = new HashMap<>(AVERAGE_BRIDGE_BLOCKS);
|
||||
|
||||
// Defaults
|
||||
// Wood, Logs, Fences
|
||||
_blockIds = Arrays.asList(5, 17, 85);
|
||||
_rate = 1;
|
||||
_particle = ParticleType.BLOCK_DUST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onParse()
|
||||
{
|
||||
List<Integer> blockIds = new ArrayList<>();
|
||||
|
||||
for (String key : _worldData.GetAllCustomLocs().keySet())
|
||||
{
|
||||
String[] split = key.split(" ");
|
||||
String subKey = split[0];
|
||||
|
||||
if (split.length < 2)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (subKey)
|
||||
{
|
||||
|
||||
case BLOCK_IDS_KEY:
|
||||
// Set the block ids that the animation will use
|
||||
|
||||
for (int i = 1; i < split.length; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
blockIds.add(Integer.parseInt(split[i]));
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case RATE_KEY:
|
||||
// Set the rate at which the animation will run at
|
||||
|
||||
try
|
||||
{
|
||||
_rate = Integer.parseInt(split[1]);
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case PARTICLE_KEY:
|
||||
// Set which type of particle will be displayed when a block
|
||||
// spawns
|
||||
|
||||
try
|
||||
{
|
||||
_particle = ParticleType.valueOf(split[1]);
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case SOUND_KEY:
|
||||
// Set the sound and pitch that will be played when a block
|
||||
// spawns
|
||||
|
||||
if (split.length < 3)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_sound = Sound.valueOf(split[1]);
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_pitch = Float.parseFloat(split[2]);
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Set configuration values
|
||||
_blockIds = blockIds;
|
||||
|
||||
// Save all blocks in a big map.
|
||||
for (String key : _worldData.GetAllCustomLocs().keySet())
|
||||
{
|
||||
if (!key.startsWith(REGION_KEY))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
List<Location> locations = _worldData.GetCustomLocs(key);
|
||||
|
||||
if (locations.size() < 2)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for (Location location : locations)
|
||||
{
|
||||
location.getChunk().load();
|
||||
}
|
||||
|
||||
for (Block block : UtilBlock.getInBoundingBox(locations.get(0), locations.get(1)))
|
||||
{
|
||||
if (!_blockIds.contains(block.getTypeId()) || _bridgeBlocks.containsKey(block))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
double dist = UtilMath.offset2d(block.getLocation(), _bridge.GetSpectatorLocation());
|
||||
|
||||
if (dist > _maxDistance)
|
||||
{
|
||||
_maxDistance = dist;
|
||||
}
|
||||
|
||||
_restore.add(block, Material.AIR.getId(), (byte) 0, Integer.MAX_VALUE);
|
||||
_bridgeBlocks.put(block.getLocation(), dist);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onBlockSet(Block block)
|
||||
{
|
||||
World world = _worldData.World;
|
||||
Location location = block.getLocation().add(0.5, 0.5, 0.5);
|
||||
|
||||
if (_particle != null)
|
||||
{
|
||||
if (_particle == ParticleType.BLOCK_DUST)
|
||||
{
|
||||
world.playEffect(location, Effect.STEP_SOUND, block.getType(), block.getData());
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilParticle.PlayParticleToAll(_particle, block.getLocation(), 0.5F, 0.5F, 0.5F, 0.5F, 5, ViewDist.NORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
if (_sound != null)
|
||||
{
|
||||
world.playSound(location, _sound, 1, _pitch);
|
||||
}
|
||||
}
|
||||
|
||||
public final String getTypeKey()
|
||||
{
|
||||
return _typeKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
builder.append("Type: " + _typeKey).append("\n");
|
||||
builder.append("Bridge Blocks: " + _bridgeBlocks.size()).append("\n");
|
||||
builder.append("Block Ids: " + _blockIds).append("\n");
|
||||
builder.append("Rate: " + _rate).append("\n");
|
||||
builder.append("Particle: " + (_particle == null ? "Null" : _particle.getFriendlyName())).append("\n");
|
||||
builder.append("Sound: " + (_sound == null ? "Null" : _sound.toString() + " Pitch: " + _pitch)).append("\n");
|
||||
builder.append("Max Distance: " + _maxDistance).append("\n");
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package nautilus.game.arcade.game.games.bridge.animation.custom;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import nautilus.game.arcade.game.games.bridge.Bridge;
|
||||
|
||||
public class RadiusCustomBridgeAnimation extends CustomBridgeAnimation
|
||||
{
|
||||
|
||||
private double _minDistance;
|
||||
|
||||
public RadiusCustomBridgeAnimation(Bridge bridge)
|
||||
{
|
||||
super(bridge, "RADIUS");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onParse()
|
||||
{
|
||||
super.onParse();
|
||||
|
||||
_minDistance = _maxDistance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(UpdateType type)
|
||||
{
|
||||
if (type != UpdateType.SEC)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_minDistance -= _rate;
|
||||
|
||||
Iterator<Location> iterator = _bridgeBlocks.keySet().iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
Location location = iterator.next();
|
||||
double dist = _bridgeBlocks.get(location);
|
||||
|
||||
if (dist > _minDistance)
|
||||
{
|
||||
Block block = location.getBlock();
|
||||
|
||||
_restore.restore(block);
|
||||
onBlockSet(block);
|
||||
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package nautilus.game.arcade.game.games.bridge.animation.custom;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import nautilus.game.arcade.game.games.bridge.Bridge;
|
||||
|
||||
public class RandomCustomBridgeAnimation extends CustomBridgeAnimation
|
||||
{
|
||||
|
||||
public RandomCustomBridgeAnimation(Bridge bridge)
|
||||
{
|
||||
super(bridge, "RANDOM");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(UpdateType type)
|
||||
{
|
||||
if (type != UpdateType.TICK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Iterator<Location> iterator = _bridgeBlocks.keySet().iterator();
|
||||
int i = 0;
|
||||
|
||||
while (iterator.hasNext() && i < _rate)
|
||||
{
|
||||
i++;
|
||||
Location location = iterator.next();
|
||||
|
||||
Block block = location.getBlock();
|
||||
|
||||
_restore.restore(block);
|
||||
onBlockSet(block);
|
||||
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -21,7 +21,7 @@ public class KitApple extends ProgressingKit
|
||||
};
|
||||
|
||||
private static final Perk[] PERKS = {
|
||||
new PerkApple(10000)
|
||||
new PerkApple(10000, 250)
|
||||
};
|
||||
|
||||
private static final ItemStack IN_HAND = new ItemStack(Material.APPLE);
|
||||
|
@ -22,12 +22,12 @@ public class KitArcher extends ProgressingKit
|
||||
"Highly trained with a bow, probably an elf or something...",
|
||||
" ",
|
||||
"Begin the game with a Bow",
|
||||
receiveArrowString(1, 20, 3),
|
||||
receiveArrowString(1, 20, 4),
|
||||
"Charge Bow to use " + C.cGreen + "Barrage"
|
||||
};
|
||||
|
||||
private static final Perk[] PERKS = {
|
||||
new PerkFletcher(20, 3, true),
|
||||
new PerkFletcher(20, 4, true),
|
||||
new PerkBarrage(5, 250, true, false),
|
||||
};
|
||||
|
||||
@ -53,6 +53,6 @@ public class KitArcher extends ProgressingKit
|
||||
|
||||
Bridge bridge = (Bridge) Manager.GetGame();
|
||||
if(!bridge.hasUsedRevive(player))
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW));
|
||||
player.getInventory().addItem(PLAYER_ITEMS);
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public class KitBerserker extends ProgressingKit
|
||||
};
|
||||
|
||||
private static final Perk[] PERKS = {
|
||||
new PerkLeap("Beserker Leap", 1.2, 1.2, 8000),
|
||||
new PerkLeap("Beserker Leap", 1.2, 1.2, 10000),
|
||||
new PerkAxeman(),
|
||||
};
|
||||
|
||||
|
@ -17,12 +17,12 @@ public class KitBomber extends ProgressingKit
|
||||
private static final String[] DESCRIPTION = {
|
||||
"Crazy bomb throwing guy.",
|
||||
" ",
|
||||
receiveItem("TNT", 1, 30, 2),
|
||||
receiveItem("TNT", 1, 25, 2),
|
||||
C.cYellow + "Click" + C.cWhite + " to throw TNT"
|
||||
};
|
||||
|
||||
private static final Perk[] PERKS = {
|
||||
new PerkBomber(30, 2, -1)
|
||||
new PerkBomber(25, 2, -1)
|
||||
};
|
||||
|
||||
private static final ItemStack IN_HAND = new ItemStack(Material.TNT);
|
||||
|
@ -20,8 +20,8 @@ public class KitBrawler extends ProgressingKit
|
||||
"Giant and muscular, easily smacks others around.",
|
||||
" ",
|
||||
"Begin with an Iron Sword",
|
||||
"Take " + C.cGreen + "75%" + C.cWhite + " knockback",
|
||||
"Deal " + C.cGreen + "125%" + C.cWhite + " knockback",
|
||||
"Take " + C.cGreen + "85%" + C.cWhite + " knockback",
|
||||
"Deal " + C.cGreen + "115%" + C.cWhite + " knockback",
|
||||
"Take " + C.cGreen + "-1" + C.cWhite + " damage from all attacks"
|
||||
};
|
||||
|
||||
|
@ -26,7 +26,7 @@ public class KitDestructor extends ProgressingKit
|
||||
};
|
||||
|
||||
private static final Perk[] PERKS = {
|
||||
new PerkDestructor(40, 2, 400, false)
|
||||
new PerkDestructor(40, 2, 400, 3, false)
|
||||
};
|
||||
|
||||
private static final Achievement[] ACHIEVEMENTS = {
|
||||
@ -44,7 +44,7 @@ public class KitDestructor extends ProgressingKit
|
||||
{
|
||||
super(manager, "Destructor", "bridgedesctructor", KitAvailability.Achievement, 99999, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND);
|
||||
|
||||
this.setAchievementRequirements(ACHIEVEMENTS);
|
||||
setAchievementRequirements(ACHIEVEMENTS);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -14,7 +14,6 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.player.PlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
|
||||
@ -29,7 +28,6 @@ import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.events.PlayerPrepareTeleportEvent;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.games.AbsorptionFix;
|
||||
import nautilus.game.arcade.game.games.bridge.Bridge;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
@ -73,37 +71,7 @@ public class OverpoweredBridge extends Bridge
|
||||
{
|
||||
_starterChests = new HashMap<>();
|
||||
|
||||
ParseLavaBridge();
|
||||
ParseWoodBridge();
|
||||
ParseIceBridge();
|
||||
ParseLillyPad();
|
||||
ParseMushrooms();
|
||||
|
||||
ParseChests();
|
||||
|
||||
ParseOre(WorldData.GetCustomLocs("73")); // Red
|
||||
ParseOre(WorldData.GetCustomLocs("14")); // Yellow
|
||||
ParseOre(WorldData.GetCustomLocs("129")); // Green
|
||||
ParseOre(WorldData.GetCustomLocs("56")); // Blue
|
||||
|
||||
//Mass Teams
|
||||
if (!WorldData.GetCustomLocs("152").isEmpty())
|
||||
ParseOre(WorldData.GetCustomLocs("152"));
|
||||
if (!WorldData.GetCustomLocs("41").isEmpty())
|
||||
ParseOre(WorldData.GetCustomLocs("41"));
|
||||
if (!WorldData.GetCustomLocs("133").isEmpty())
|
||||
ParseOre(WorldData.GetCustomLocs("133"));
|
||||
if (!WorldData.GetCustomLocs("57").isEmpty())
|
||||
ParseOre(WorldData.GetCustomLocs("57"));
|
||||
|
||||
if (!WorldData.GetCustomLocs("100").isEmpty())
|
||||
ParseOre(WorldData.GetCustomLocs("100"));
|
||||
if (!WorldData.GetCustomLocs("86").isEmpty())
|
||||
ParseOre(WorldData.GetCustomLocs("86"));
|
||||
if (!WorldData.GetCustomLocs("103").isEmpty())
|
||||
ParseOre(WorldData.GetCustomLocs("103"));
|
||||
if (!WorldData.GetCustomLocs("22").isEmpty())
|
||||
ParseOre(WorldData.GetCustomLocs("22"));
|
||||
super.ParseData();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -28,7 +28,7 @@ public class KitBrawlAppler extends ProgressingKit
|
||||
|
||||
private static final Perk[] PERKS =
|
||||
{
|
||||
new PerkApple(3000)
|
||||
new PerkApple(3000, 0)
|
||||
};
|
||||
|
||||
private static final ItemStack IN_HAND = new ItemStack(Material.APPLE);
|
||||
|
@ -106,7 +106,7 @@ public class ChampionsCTF extends CaptureTheFlag
|
||||
if (GetKit(player) == null)
|
||||
{
|
||||
SetKit(player, GetKits()[2], true);
|
||||
player.closeInventory();
|
||||
UtilPlayer.closeInventoryIfOpen(player);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ public class ChampionsDominate extends Domination
|
||||
if (GetKit(player) == null)
|
||||
{
|
||||
SetKit(player, GetKits()[2], true);
|
||||
player.closeInventory();
|
||||
UtilPlayer.closeInventoryIfOpen(player);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ public class ChampionsTDM extends TeamDeathmatch
|
||||
if (GetKit(player) == null)
|
||||
{
|
||||
SetKit(player, GetKits()[2], true);
|
||||
player.closeInventory();
|
||||
UtilPlayer.closeInventoryIfOpen(player);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -196,7 +196,7 @@ public class TeamDeathmatch extends TeamGame
|
||||
if (GetKit(player) == null)
|
||||
{
|
||||
SetKit(player, GetKits()[2], true);
|
||||
player.closeInventory();
|
||||
UtilPlayer.closeInventoryIfOpen(player);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,10 @@
|
||||
package nautilus.game.arcade.game.games.dragonescape;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
@ -200,6 +202,18 @@ public class DragonEscape extends SoloGame
|
||||
this.WorldWaterDamage = 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Player> getWinners()
|
||||
{
|
||||
if (GetState().ordinal() >= GameState.End.ordinal())
|
||||
{
|
||||
if (_winner == null)
|
||||
return Collections.emptyList();
|
||||
return Collections.singletonList(_winner);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void SpawnDragon(GameStateChangeEvent event)
|
||||
{
|
||||
|
@ -224,8 +224,8 @@ public class Draw extends SoloGame
|
||||
);
|
||||
|
||||
registerChatStats(
|
||||
new ChatStatData("TotalGuess", "Total Guess'", true),
|
||||
new ChatStatData("PureLuck", "Lucky Guess'", true)
|
||||
new ChatStatData("TotalGuess", "Total Guesses", true),
|
||||
new ChatStatData("PureLuck", "Lucky Guesses", true)
|
||||
);
|
||||
|
||||
new CompassModule()
|
||||
|
@ -14,6 +14,7 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
@ -127,11 +128,24 @@ public class HotbarEditor extends MiniPlugin
|
||||
|
||||
if (UtilItem.isSimilar(item, _item, UtilItem.ItemAttribute.NAME))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
HotbarInventory.open(event.getPlayer(), this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInteract(PlayerInteractEntityEvent event)
|
||||
{
|
||||
ItemStack item = event.getPlayer().getItemInHand();
|
||||
|
||||
if (UtilItem.isSimilar(item, _item, UtilItem.ItemAttribute.NAME))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
HotbarInventory.open(event.getPlayer(), this);
|
||||
}
|
||||
}
|
||||
|
||||
public Gladiators getHost()
|
||||
{
|
||||
return _host;
|
||||
|
@ -5,6 +5,8 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||
|
||||
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
|
||||
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
@ -17,6 +19,7 @@ import nautilus.game.arcade.game.games.champions.kits.KitRanger;
|
||||
import nautilus.game.arcade.game.games.gladiators.Arena;
|
||||
import nautilus.game.arcade.game.games.gladiators.ArenaType;
|
||||
import nautilus.game.arcade.game.games.gladiators.Gladiators;
|
||||
import nautilus.game.arcade.game.games.gladiators.RoundState;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
|
||||
/**
|
||||
@ -89,4 +92,10 @@ public class ChampionsGladiators extends Gladiators
|
||||
return "Champions Gladiators";
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void skill(SkillTriggerEvent event)
|
||||
{
|
||||
if (getRoundState() != RoundState.FIGHTING)
|
||||
event.SetCancelled(true);
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockFromToEvent;
|
||||
import org.bukkit.event.block.BlockGrowEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
|
||||
import mineplex.core.common.util.MapUtil;
|
||||
@ -107,13 +109,25 @@ public class Micro extends TeamGame
|
||||
{
|
||||
Block block = WorldData.World.getBlockAt(x, y, z);
|
||||
|
||||
if (block.getType() == Material.AIR || block.isLiquid())
|
||||
if (block.getType() == Material.AIR)
|
||||
continue;
|
||||
|
||||
_blocks.add(block);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void preventGrow(BlockGrowEvent event)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void preventFlow(BlockFromToEvent event)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void BlockPlace(BlockPlaceEvent event)
|
||||
{
|
||||
|
@ -559,7 +559,7 @@ public class Gun extends StrikeItem
|
||||
C.cYellow + C.Bold + "Damage per Bullet: " + ChatColor.RESET + UtilMath.trim(1, getDamage()),
|
||||
C.cYellow + C.Bold + "Armor Penetration: " + ChatColor.RESET + (int)(_gunStats.getArmorPen()*100) + "%",
|
||||
C.cYellow + C.Bold + "Damage Dropoff: " + ChatColor.RESET + (int)(_gunStats.getDropoff()*1000d) + "% per 10 Blocks",
|
||||
C.cYellow + C.Bold + "Recoil per Shot: " + ChatColor.RESET + _gunStats.getConeIncreaseRate(),
|
||||
C.cYellow + C.Bold + "Recoil per Shot: " + ChatColor.RESET + UtilMath.trim(2, _gunStats.getConeIncreaseRate()),
|
||||
C.cYellow + C.Bold + "Recoil Recovery: " + ChatColor.RESET + _gunStats.getConeReduceRate() + " per Second",
|
||||
};
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ public class SoloSuperSmash extends SuperSmash
|
||||
{
|
||||
super(manager, kits, type, new String[]
|
||||
{
|
||||
"Each player has 3 respawns",
|
||||
"Each player has 4 respawns",
|
||||
"Attack to restore hunger!",
|
||||
"Last player alive wins!"
|
||||
});
|
||||
|
@ -511,7 +511,7 @@ public abstract class SuperSmash extends Game
|
||||
|
||||
if (announce)
|
||||
{
|
||||
player.closeInventory();
|
||||
UtilPlayer.closeInventoryIfOpen(player);
|
||||
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);
|
||||
|
@ -133,6 +133,7 @@ public class Snake extends SoloGame
|
||||
|
||||
this.CreatureAllowOverride = true;
|
||||
Sheep sheep = player.getWorld().spawn(player.getLocation(), Sheep.class);
|
||||
UtilEnt.addFlag(sheep, UtilEnt.FLAG_ENTITY_COMPONENT);
|
||||
this.CreatureAllowOverride = false;
|
||||
|
||||
sheep.setColor(DyeColor.getByDyeData((byte) (i % 16)));
|
||||
@ -447,6 +448,7 @@ public class Snake extends SoloGame
|
||||
//Spawn
|
||||
this.CreatureAllowOverride = true;
|
||||
Sheep tail = loc.getWorld().spawn(loc, Sheep.class);
|
||||
UtilEnt.addFlag(tail, UtilEnt.FLAG_ENTITY_COMPONENT);
|
||||
this.CreatureAllowOverride = false;
|
||||
|
||||
tail.setRemoveWhenFarAway(false);
|
||||
|
@ -1986,7 +1986,7 @@ public abstract class SurvivalGames extends Game
|
||||
@EventHandler
|
||||
public void craftedItems(CraftItemEvent event)
|
||||
{
|
||||
if (UtilItem.isWeapon(event.getCurrentItem()) || UtilItem.isArmor(event.getCurrentItem()))
|
||||
if (UtilItem.isWeapon(event.getCurrentItem()) || UtilItem.isArmor(event.getCurrentItem()) || event.getCurrentItem().getType() == Material.FISHING_ROD)
|
||||
{
|
||||
UtilItem.makeUnbreakable(event.getCurrentItem());
|
||||
}
|
||||
|
@ -380,7 +380,7 @@ public class TurfForts extends TeamGame
|
||||
while (block.getTypeId() == 0 && block.getY() > 0)
|
||||
block = block.getRelative(BlockFace.DOWN);
|
||||
|
||||
if (block.getData() != team.GetColorData())
|
||||
if ((block.getType() != Material.STAINED_CLAY && block.getType() != Material.WOOL) || block.getData() != team.GetColorData())
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Game", "You can only build above " + F.elem(team.GetColor() + team.GetName()) + "."));
|
||||
event.setCancelled(true);
|
||||
|
@ -289,7 +289,6 @@ public abstract class UHC extends Game
|
||||
.setGiveCompass(false)
|
||||
.register(this);
|
||||
new OreVeinEditorModule().removeNonAirVeins().register(this);
|
||||
new AntiExpOrbModule().register(this);
|
||||
new RejoinModule().register(this);
|
||||
new AbsorptionFix(this);
|
||||
|
||||
|
@ -1,10 +1,7 @@
|
||||
package nautilus.game.arcade.game.modules;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import mineplex.core.Managers;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.TeamGame;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
/**
|
||||
|
@ -19,6 +19,7 @@ import mineplex.core.common.util.UtilItem;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
|
||||
import nautilus.game.arcade.events.PlayerKitGiveEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
|
||||
/**
|
||||
* This module handles setting armor for team games such as Micro Battles. It allows you to set the player's armor
|
||||
@ -67,11 +68,15 @@ public class TeamArmorModule extends Module
|
||||
|
||||
public void apply(Player player)
|
||||
{
|
||||
Color color = getGame().GetTeam(player).GetColorBase();
|
||||
GameTeam gameTeam = getGame().GetTeam(player);
|
||||
if (gameTeam == null)
|
||||
return;
|
||||
|
||||
Color color = gameTeam.GetColorBase();
|
||||
|
||||
if (_giveTeamArmor)
|
||||
{
|
||||
String itemName = getGame().GetTeam(player).GetColor() + C.Bold + "Team Armor";
|
||||
String itemName = gameTeam.GetColor() + C.Bold + "Team Armor";
|
||||
_armorNames.add(itemName);
|
||||
player.getInventory().setHelmet(new ItemBuilder(Material.LEATHER_HELMET).setColor(color).setTitle(itemName).setUnbreakable(true).build());
|
||||
player.getInventory().setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(color).setTitle(itemName).setUnbreakable(true).build());
|
||||
@ -81,7 +86,7 @@ public class TeamArmorModule extends Module
|
||||
|
||||
if (_giveHotbarItem && getGame().InProgress())
|
||||
{
|
||||
String teamName = getGame().GetTeam(player).GetFormattedName();
|
||||
String teamName = gameTeam.GetFormattedName();
|
||||
_hotbarNames.add(teamName);
|
||||
player.getInventory().setItem(8, new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(color).setTitle(teamName).setUnbreakable(true).build());
|
||||
}
|
||||
|
@ -0,0 +1,116 @@
|
||||
package nautilus.game.arcade.game.modules;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import mineplex.core.common.Pair;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.packethandler.IPacketHandler;
|
||||
import mineplex.core.packethandler.PacketHandler;
|
||||
import mineplex.core.packethandler.PacketInfo;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutWorldBorder;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutWorldBorder.EnumWorldBorderAction;
|
||||
import net.minecraft.server.v1_8_R3.WorldBorder;
|
||||
|
||||
public class WorldBorderModule extends Module implements IPacketHandler
|
||||
{
|
||||
|
||||
private PacketHandler _packetHandler;
|
||||
private Map<UUID, Double> _sizeToSet;
|
||||
private Map<UUID, Pair<Double, Double>> _centerToSet;
|
||||
|
||||
@Override
|
||||
protected void setup()
|
||||
{
|
||||
_packetHandler = getGame().getArcadeManager().getPacketHandler();
|
||||
_sizeToSet = new HashMap<>();
|
||||
_centerToSet = new HashMap<>();
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void live(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Prepare)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_packetHandler.addPacketHandler(this, PacketPlayOutWorldBorder.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(PacketInfo packetInfo)
|
||||
{
|
||||
UUID player = packetInfo.getPlayer().getUniqueId();
|
||||
PacketPlayOutWorldBorder packet = (PacketPlayOutWorldBorder) packetInfo.getPacket();
|
||||
|
||||
try
|
||||
{
|
||||
Field actionField = packet.getClass().getDeclaredField("a");
|
||||
actionField.setAccessible(true);
|
||||
EnumWorldBorderAction action = (EnumWorldBorderAction) actionField.get(packet);
|
||||
|
||||
if (action == EnumWorldBorderAction.SET_SIZE)
|
||||
{
|
||||
Field sizeField = packet.getClass().getDeclaredField("e");
|
||||
sizeField.setAccessible(true);
|
||||
double newSize = _sizeToSet.get(player);
|
||||
|
||||
sizeField.set(packet, newSize);
|
||||
}
|
||||
else if (action == EnumWorldBorderAction.SET_CENTER)
|
||||
{
|
||||
Field xField = packet.getClass().getDeclaredField("c");
|
||||
Field zField = packet.getClass().getDeclaredField("d");
|
||||
|
||||
xField.setAccessible(true);
|
||||
zField.setAccessible(true);
|
||||
|
||||
Pair<Double, Double> pair = _centerToSet.get(player);
|
||||
|
||||
xField.set(packet, pair.getLeft());
|
||||
zField.set(packet, pair.getRight());
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanup()
|
||||
{
|
||||
_packetHandler.removePacketHandler(this);
|
||||
}
|
||||
|
||||
public void setSize(Player player, double size)
|
||||
{
|
||||
_sizeToSet.put(player.getUniqueId(), size);
|
||||
|
||||
sendPacket(player, EnumWorldBorderAction.SET_SIZE);
|
||||
}
|
||||
|
||||
public void setCenter(Player player, Location location)
|
||||
{
|
||||
_centerToSet.put(player.getUniqueId(), Pair.create(location.getX(), location.getZ()));
|
||||
|
||||
sendPacket(player, EnumWorldBorderAction.SET_CENTER);
|
||||
}
|
||||
|
||||
private void sendPacket(Player player, EnumWorldBorderAction action)
|
||||
{
|
||||
WorldBorder border = ((CraftWorld) player.getWorld()).getHandle().getWorldBorder();
|
||||
UtilPlayer.sendPacket(player, new PacketPlayOutWorldBorder(border, action));
|
||||
}
|
||||
}
|
@ -6,28 +6,29 @@ import mineplex.core.shop.ShopBase;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.modules.compass.CompassModule;
|
||||
import nautilus.game.arcade.game.modules.compass.menu.page.CompassPage;
|
||||
|
||||
public class CompassMenu extends ShopBase<ArcadeManager>
|
||||
public class CompassMenu extends ShopBase<Game>
|
||||
{
|
||||
private CompassModule _compassModule;
|
||||
|
||||
public CompassMenu(CompassModule module)
|
||||
{
|
||||
super(module.getGame().getArcadeManager(), module.getGame().getArcadeManager().GetClients(), module.getGame().getArcadeManager().GetDonation(), "Spectate Menu");
|
||||
super(module.getGame(), module.getGame().getArcadeManager().GetClients(), module.getGame().getArcadeManager().GetDonation(), "Spectate Menu");
|
||||
this._compassModule = module;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ShopPageBase<ArcadeManager, ? extends ShopBase<ArcadeManager>> buildPagesFor(Player player)
|
||||
protected ShopPageBase<Game, ? extends ShopBase<Game>> buildPagesFor(Player player)
|
||||
{
|
||||
return new CompassPage(this, _compassModule, player);
|
||||
}
|
||||
|
||||
public void update()
|
||||
{
|
||||
for (ShopPageBase<ArcadeManager, ? extends ShopBase<ArcadeManager>> shopPage : getPlayerPageMap().values())
|
||||
for (ShopPageBase<Game, ? extends ShopBase<Game>> shopPage : getPlayerPageMap().values())
|
||||
{
|
||||
shopPage.refresh();
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ import mineplex.core.shop.item.ShopItem;
|
||||
import mineplex.core.shop.page.ShopPageInventory;
|
||||
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.modules.compass.CompassEntry;
|
||||
import nautilus.game.arcade.game.modules.compass.CompassModule;
|
||||
@ -28,7 +29,7 @@ import nautilus.game.arcade.game.modules.compass.menu.CompassMenu;
|
||||
import nautilus.game.arcade.game.modules.compass.menu.button.CompassButton;
|
||||
|
||||
public class CompassPage extends
|
||||
ShopPageInventory<ArcadeManager, CompassMenu>
|
||||
ShopPageInventory<Game, CompassMenu>
|
||||
{
|
||||
private CompassModule _compassModule;
|
||||
private IButton[] _buttons;
|
||||
@ -36,7 +37,7 @@ public class CompassPage extends
|
||||
|
||||
public CompassPage(CompassMenu menu, CompassModule compassModule, Player player)
|
||||
{
|
||||
super(compassModule.getGame().getArcadeManager(),
|
||||
super(compassModule.getGame(),
|
||||
menu,
|
||||
compassModule.getGame().getArcadeManager().GetClients(),
|
||||
compassModule.getGame().getArcadeManager().GetDonation(),
|
||||
|
@ -1,6 +1,7 @@
|
||||
package nautilus.game.arcade.gui.privateServer.page;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.game.GameCategory;
|
||||
@ -89,16 +90,24 @@ public class SetGamePage extends BasePage
|
||||
|
||||
private void addGameButton(int slot, final GameType type)
|
||||
{
|
||||
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};
|
||||
List<String> lore = new ArrayList<>();
|
||||
lore.add(ChatColor.RESET + C.cGray + "Make this next Game Type");
|
||||
lore.add("§1");
|
||||
if (type == GameType.UHC || type == GameType.UHCSolo || type == GameType.UHCSoloSpeed || type == GameType.UHCTeamsSpeed)
|
||||
{
|
||||
lore.add(ChatColor.YELLOW + "Left-Click " + C.cGray + "to select");
|
||||
}
|
||||
else
|
||||
{
|
||||
lore.add(ChatColor.YELLOW + "Left-Click " + C.cGray + "for a §fRandom Map§7.");
|
||||
lore.add(ChatColor.YELLOW + "Right-Click " + C.cGray + "to §fChoose Map§7.");
|
||||
}
|
||||
if (_manager.hasWarning().contains(type))
|
||||
{
|
||||
normLore = new String[]{infoString, space, left, right, "§2", "§c§lWARNING: §fThis game was rejected!"};
|
||||
lore.add("§2");
|
||||
lore.add("§c§lWARNING: §fThis game was rejected!");
|
||||
}
|
||||
ShopItem shopItem = new ShopItem(type.GetMaterial(), type.GetMaterialData(), type.GetName(), normLore, 1, false, false);
|
||||
ShopItem shopItem = new ShopItem(type.GetMaterial(), type.GetMaterialData(), type.GetName(), lore.toArray(new String[lore.size()]), 1, false, false);
|
||||
addButton(slot, shopItem, new IButton()
|
||||
{
|
||||
@Override
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user