Merge branch 'master' of ssh://184.154.0.242:7999/min/mineplex
This commit is contained in:
commit
9518d9f438
@ -11,10 +11,12 @@ import mineplex.serverdata.data.Data;
|
||||
*/
|
||||
public class GlobalMotd implements Data
|
||||
{
|
||||
|
||||
// The unique name representing this MOTD set
|
||||
private String _name;
|
||||
|
||||
private String _headline;
|
||||
public String getHeadline() { return _headline; }
|
||||
|
||||
// List of lines describing the MOTD
|
||||
private List<String> _motd;
|
||||
public List<String> getMotd() { return _motd; }
|
||||
@ -24,9 +26,10 @@ public class GlobalMotd implements Data
|
||||
* @param name
|
||||
* @param motd
|
||||
*/
|
||||
public GlobalMotd(String name, List<String> motd)
|
||||
public GlobalMotd(String name, String headline, List<String> motd)
|
||||
{
|
||||
_name = name;
|
||||
_headline = headline;
|
||||
_motd = motd;
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,6 @@ import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import mineplex.serverdata.Region;
|
||||
import mineplex.serverdata.data.BungeeServer;
|
||||
import mineplex.serverdata.data.DataRepository;
|
||||
import mineplex.serverdata.redis.RedisDataRepository;
|
||||
import mineplex.serverdata.servers.ServerManager;
|
||||
@ -23,7 +22,7 @@ public class MotdManager implements Listener, Runnable, CustomMotdFactory
|
||||
|
||||
private DataRepository<GlobalMotd> _repository;
|
||||
|
||||
private String firstLine = " §b§l§m §8§l§m[ §r §9§lMineplex§r §f§lGames§r §8§l§m ]§b§l§m §r";
|
||||
private String _firstLine = " §b§l§m §8§l§m[ §r §9§lMineplex§r §f§lGames§r §8§l§m ]§b§l§m §r";
|
||||
private List<String> _motdLines;
|
||||
|
||||
public MotdManager(Plugin plugin)
|
||||
@ -42,7 +41,7 @@ public class MotdManager implements Listener, Runnable, CustomMotdFactory
|
||||
{
|
||||
net.md_5.bungee.api.ServerPing serverPing = event.getResponse();
|
||||
|
||||
String motd = firstLine;
|
||||
String motd = _firstLine;
|
||||
if (_motdLines != null && _motdLines.size() > 0)
|
||||
{
|
||||
motd += "\n" + _motdLines.get(0);
|
||||
@ -60,14 +59,33 @@ public class MotdManager implements Listener, Runnable, CustomMotdFactory
|
||||
_repository.removeElement("MainMotd");
|
||||
|
||||
List<String> lines = new ArrayList<String>();
|
||||
lines.add(" §e§lSurvival Games §a§lBIG UPDATE!"); // TODO: Implement in-game command to update MOTD?
|
||||
lines.add(" §d§lHero Sale §a§l33% Off");
|
||||
lines.add(" §e§lSurvival Games §a§lBIG UPDATE!");
|
||||
lines.add(" §a§lDouble Gems for 1.8 Players!");
|
||||
lines.add(" §e§lChampions Update §a§lBalance Patch");
|
||||
lines.add(" §6§lSpecial Egg Baskets!");
|
||||
lines.add(" §e§lBunny Morph §a§lLimited Time!");
|
||||
lines.add(" §d§lHero Sale §a§l33% Off");
|
||||
lines.add(" §a§lDouble Gems for 1.8 Players!");
|
||||
|
||||
updateMainMotd(lines);
|
||||
/*
|
||||
lines.add("§a§l MOO");
|
||||
lines.add("§a§l MOO");
|
||||
lines.add("§a§l MOO");
|
||||
lines.add("§a§l MOO");
|
||||
lines.add("§a§l MOO");
|
||||
lines.add("§a§l MOO");
|
||||
lines.add("§a§l MOO");
|
||||
lines.add("§a§l MOO");
|
||||
lines.add("§a§l MOO");
|
||||
*/
|
||||
|
||||
updateMainMotd(" §b§l§m §8§l§m[ §r §9§lMineplex§r §f§lGames§r §8§l§m ]§b§l§m §r", lines);
|
||||
//updateMainMotd(" §b§l§m §8§l§m[ §r §9§lMooplex§r §f§lGames§r §8§l§m ]§b§l§m §r", lines);
|
||||
}
|
||||
|
||||
_motdLines = _repository.getElement("MainMotd").getMotd(); // Update MOTD lines
|
||||
GlobalMotd motd = _repository.getElement("MainMotd");
|
||||
_motdLines = motd.getMotd();
|
||||
_firstLine = motd.getHeadline();
|
||||
|
||||
InitialHandler.setCustomMotdFactory(this);
|
||||
}
|
||||
|
||||
@ -75,9 +93,9 @@ public class MotdManager implements Listener, Runnable, CustomMotdFactory
|
||||
* Update the main {@link GlobalMotd} determining the MOTD for Bungee instances.
|
||||
* @param motdLines - the lines to update the MOTD to.
|
||||
*/
|
||||
public void updateMainMotd(List<String> motdLines)
|
||||
public void updateMainMotd(String headline, List<String> motdLines)
|
||||
{
|
||||
_repository.addElement(new GlobalMotd("MainMotd", motdLines));
|
||||
_repository.addElement(new GlobalMotd("MainMotd", headline, motdLines));
|
||||
}
|
||||
|
||||
public List<String> getMotdLines()
|
||||
|
@ -220,7 +220,13 @@ public class CoreClientManager extends MiniPlugin
|
||||
|
||||
if (client.getAccountId() > 0)
|
||||
_accountCacheRepository.addElement(new AccountCache(uuid, client.getAccountId()));
|
||||
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
exception.printStackTrace();
|
||||
}
|
||||
finally
|
||||
{
|
||||
Bukkit.getServer().getScheduler().runTask(getPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
@ -230,14 +236,6 @@ public class CoreClientManager extends MiniPlugin
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
exception.printStackTrace();
|
||||
}
|
||||
finally
|
||||
{
|
||||
runnable.run();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ public class UpdateRank extends CommandBase<CoreClientManager>
|
||||
|
||||
final Rank rank = tempRank;
|
||||
|
||||
if ((rank == Rank.YOUTUBE && Plugin.Get(caller).GetRank().Has(Rank.OWNER)) || rank == Rank.MODERATOR || rank == Rank.HELPER || rank == Rank.ALL || rank == Rank.MAPDEV || rank == Rank.SNR_MODERATOR)
|
||||
if (rank == Rank.YOUTUBE || rank == Rank.MODERATOR || rank == Rank.HELPER || rank == Rank.ALL || rank == Rank.MAPDEV || rank == Rank.SNR_MODERATOR)
|
||||
{
|
||||
Plugin.getRepository().matchPlayerName(new Callback<List<String>>()
|
||||
{
|
||||
|
@ -97,11 +97,13 @@ public class AntiHack extends MiniPlugin
|
||||
_movementDetectors = new ArrayList<Detector>();
|
||||
_combatDetectors = new ArrayList<Detector>();
|
||||
|
||||
_movementDetectors.add(new Fly(this));
|
||||
_movementDetectors.add(new Idle(this));
|
||||
_movementDetectors.add(new Speed(this));
|
||||
// _movementDetectors.add(new Fly(this));
|
||||
// _movementDetectors.add(new Idle(this));
|
||||
// _movementDetectors.add(new Speed(this));
|
||||
//
|
||||
// _combatDetectors.add(new Reach(this));
|
||||
|
||||
_combatDetectors.add(new Reach(this));
|
||||
_enabled = false;
|
||||
}
|
||||
|
||||
public static void Initialize(JavaPlugin plugin, Punish punish, Portal portal, PreferencesManager preferences, CoreClientManager clientManager)
|
||||
|
@ -6,6 +6,7 @@ import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.minecraft.server.v1_7_R4.Block;
|
||||
@ -899,53 +900,6 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
||||
}
|
||||
}
|
||||
|
||||
/*public void reApplyDisguise(final DisguiseBase disguise, final Player player)
|
||||
{
|
||||
PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(disguise.GetEntityId());
|
||||
|
||||
if (disguise.GetEntity() == ((CraftPlayer) player).getHandle())
|
||||
return;
|
||||
|
||||
EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
|
||||
|
||||
entityPlayer.playerConnection.sendPacket(destroyPacket);
|
||||
|
||||
List<Packet> tempArmor = new ArrayList<Packet>();
|
||||
|
||||
if (disguise instanceof DisguiseInsentient && disguise.GetEntity() instanceof LivingEntity)
|
||||
{
|
||||
if (((DisguiseInsentient) disguise).armorVisible())
|
||||
{
|
||||
for (Packet armorPacket : ((DisguiseInsentient) disguise).getArmorPackets())
|
||||
tempArmor.add(armorPacket);
|
||||
}
|
||||
}
|
||||
|
||||
final List<Packet> armorPackets = tempArmor;
|
||||
|
||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
|
||||
entityPlayer.playerConnection.sendPacket(disguise.GetSpawnPacket());
|
||||
|
||||
if (disguise instanceof DisguisePlayer && ((DisguisePlayer) disguise).getSleepingDirection() != null)
|
||||
{
|
||||
for (Packet packet : getBedPackets(player.getLocation(), (DisguisePlayer) disguise))
|
||||
{
|
||||
entityPlayer.playerConnection.sendPacket(packet);
|
||||
}
|
||||
}
|
||||
|
||||
for (Packet packet : armorPackets)
|
||||
{
|
||||
entityPlayer.playerConnection.sendPacket(packet);
|
||||
}
|
||||
}
|
||||
});
|
||||
}*/
|
||||
|
||||
private void prepareChunk(Location loc)
|
||||
{
|
||||
int chunkX = getChunk(loc.getX());
|
||||
@ -1157,4 +1111,34 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
||||
entityPlayer.playerConnection.sendPacket(disguise.GetMetaDataPacket());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void cleanDisguises(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SLOWER || _disguisePlayerMap.isEmpty())
|
||||
return;
|
||||
|
||||
for (Iterator<DisguiseBase> disguiseIterator = _disguisePlayerMap.keySet().iterator(); disguiseIterator.hasNext();)
|
||||
{
|
||||
DisguiseBase disguise = disguiseIterator.next();
|
||||
|
||||
if (!(disguise.GetEntity() instanceof EntityPlayer))
|
||||
continue;
|
||||
|
||||
EntityPlayer disguisedPlayer = (EntityPlayer)disguise.GetEntity();
|
||||
|
||||
if (Bukkit.getPlayerExact(disguisedPlayer.getName()) == null || !disguisedPlayer.isAlive() || !disguisedPlayer.valid)
|
||||
disguiseIterator.remove();
|
||||
else
|
||||
{
|
||||
for (Iterator<Player> playerIterator = _disguisePlayerMap.get(disguise).iterator(); playerIterator.hasNext();)
|
||||
{
|
||||
Player player = playerIterator.next();
|
||||
|
||||
if (!player.isOnline() || !player.isValid())
|
||||
playerIterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -251,22 +251,35 @@ public class DonationManager extends MiniDbClientPlugin<Donor>
|
||||
if (event.getType() != UpdateType.SLOWER)
|
||||
return;
|
||||
|
||||
for (Player player : _coinQueue.keySet())
|
||||
for (final Player player : _coinQueue.keySet())
|
||||
{
|
||||
String caller = null;
|
||||
int total = 0;
|
||||
String tempCaller = null;
|
||||
int tempTotal = 0;
|
||||
|
||||
for (String curCaller : _coinQueue.get(player).keySet())
|
||||
{
|
||||
caller = curCaller;
|
||||
total += _coinQueue.get(player).get(curCaller);
|
||||
tempCaller = curCaller;
|
||||
tempTotal += _coinQueue.get(player).get(curCaller);
|
||||
}
|
||||
|
||||
final int total = tempTotal;
|
||||
final String caller = tempCaller;
|
||||
|
||||
if (caller == null)
|
||||
continue;
|
||||
|
||||
//Actually Add Gems
|
||||
RewardCoins(null, caller, player.getName(), ClientManager.Get(player).getAccountId(), total, false);
|
||||
if (player.isOnline() && player.isValid())
|
||||
RewardCoins(null, caller, player.getName(), ClientManager.Get(player).getAccountId(), total, false);
|
||||
else
|
||||
{
|
||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
RewardCoins(null, caller, player.getName(), ClientManager.getCachedClientAccountId(player.getUniqueId()), total, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
System.out.println("Queue Added [" + player + "] with Coins [" + total + "] for [" + caller + "]");
|
||||
|
||||
|
@ -16,6 +16,7 @@ import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.database.DBPool;
|
||||
import mineplex.core.database.RepositoryBase;
|
||||
import mineplex.core.database.ResultSetCallable;
|
||||
import mineplex.core.database.column.ColumnInt;
|
||||
import mineplex.core.database.column.ColumnVarChar;
|
||||
import mineplex.core.friend.FriendStatusType;
|
||||
import mineplex.serverdata.Region;
|
||||
@ -26,11 +27,8 @@ import mineplex.serverdata.servers.ServerManager;
|
||||
|
||||
public class FriendRepository extends RepositoryBase
|
||||
{
|
||||
private static String CREATE_FRIEND_TABLE = "CREATE TABLE IF NOT EXISTS accountFriend (id INT NOT NULL AUTO_INCREMENT, uuidSource VARCHAR(100), uuidTarget VARCHAR(100), status VARCHAR(100), PRIMARY KEY (id), UNIQUE INDEX uuidIndex (uuidSource, uuidTarget));";
|
||||
private static String RETRIEVE_MULTIPLE_FRIEND_RECORDS = "SELECT uuidSource, tA.Name, status, tA.lastLogin, now() FROM accountFriend INNER Join accounts AS fA ON fA.uuid = uuidSource INNER JOIN accounts AS tA ON tA.uuid = uuidTarget WHERE uuidSource IN ";
|
||||
private static String ADD_FRIEND_RECORD = "INSERT INTO accountFriend (uuidSource, uuidTarget, status, created) SELECT fA.uuid AS uuidSource, tA.uuid AS uuidTarget, ?, now() FROM accounts as fA LEFT JOIN accounts AS tA ON tA.name = ? WHERE fA.name = ?;";
|
||||
private static String UPDATE_MUTUAL_RECORD = "UPDATE accountFriend AS aF INNER JOIN accounts as fA ON aF.uuidSource = fA.uuid INNER JOIN accounts AS tA ON aF.uuidTarget = tA.uuid SET aF.status = ? WHERE tA.name = ? AND fA.name = ?;";
|
||||
private static String DELETE_FRIEND_RECORD = "DELETE aF FROM accountFriend AS aF INNER JOIN accounts as fA ON aF.uuidSource = fA.uuid INNER JOIN accounts AS tA ON aF.uuidTarget = tA.uuid WHERE fA.name = ? AND tA.name = ?;";
|
||||
private static String ADD_FRIEND_RECORD = "INSERT INTO accountFriend (sourceId, targetId) VALUES(?, ?);";
|
||||
private static String DELETE_FRIEND_RECORD = "DELETE FROM accountFriend WHERE id = ?;";
|
||||
|
||||
// Repository holding active PlayerStatus data.
|
||||
private DataRepository<PlayerStatus> _repository;
|
||||
@ -54,29 +52,14 @@ public class FriendRepository extends RepositoryBase
|
||||
{
|
||||
}
|
||||
|
||||
public boolean addFriend(final Player caller, String name)
|
||||
public boolean addFriend(int sourceAccountId, int targetAccountId)
|
||||
{
|
||||
int rowsAffected = executeUpdate(ADD_FRIEND_RECORD, new ColumnVarChar("status", 100, "Sent"), new ColumnVarChar("name", 100, name), new ColumnVarChar("name", 100, caller.getName()));
|
||||
|
||||
if (rowsAffected > 0)
|
||||
return executeUpdate(ADD_FRIEND_RECORD, new ColumnVarChar("status", 100, "Pending"), new ColumnVarChar("name", 100, caller.getName()), new ColumnVarChar("uuid", 100, name)) > 0;
|
||||
|
||||
return false;
|
||||
return executeUpdate(ADD_FRIEND_RECORD, new ColumnInt("sourceId", sourceAccountId), new ColumnInt("targetId", targetAccountId)) > 0;
|
||||
}
|
||||
|
||||
public boolean updateFriend(String caller, String name, String status)
|
||||
{
|
||||
return executeUpdate(UPDATE_MUTUAL_RECORD, new ColumnVarChar("status", 100, status), new ColumnVarChar("uuid", 100, name), new ColumnVarChar("name", 100, caller)) > 0;
|
||||
}
|
||||
|
||||
public boolean removeFriend(String caller, String name)
|
||||
public boolean removeFriendRecord(int recordId)
|
||||
{
|
||||
int rowsAffected = executeUpdate(DELETE_FRIEND_RECORD, new ColumnVarChar("name", 100, name), new ColumnVarChar("name", 100, caller));
|
||||
|
||||
if (rowsAffected > 0)
|
||||
return executeUpdate(DELETE_FRIEND_RECORD, new ColumnVarChar("name", 100, caller), new ColumnVarChar("uuid", 100, name)) > 0;
|
||||
|
||||
return false;
|
||||
return executeUpdate(DELETE_FRIEND_RECORD, new ColumnInt("id", recordId)) > 0;
|
||||
}
|
||||
|
||||
public NautHashMap<String, FriendData> getFriendsForAll(Player...players)
|
||||
@ -84,7 +67,7 @@ public class FriendRepository extends RepositoryBase
|
||||
final NautHashMap<String, FriendData> friends = new NautHashMap<String, FriendData>();
|
||||
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append(RETRIEVE_MULTIPLE_FRIEND_RECORDS + "(");
|
||||
//stringBuilder.append(RETRIEVE_MULTIPLE_FRIEND_RECORDS + "(");
|
||||
|
||||
for (Player player : players)
|
||||
{
|
||||
|
@ -119,6 +119,7 @@ public class GadgetManager extends MiniPlugin
|
||||
addGadget(new MorphBlaze(this));
|
||||
//addGadget(new MorphGeno(this));
|
||||
addGadget(new MorphWither(this));
|
||||
addGadget(new MorphBunny(this));
|
||||
|
||||
// Particles
|
||||
addGadget(new ParticleFoot(this));
|
||||
|
@ -46,7 +46,7 @@ public class ItemFleshHook extends ItemGadget implements IThrown
|
||||
1.6, false, 0, 0.2, 10, false);
|
||||
|
||||
Manager.getProjectileManager().AddThrow(item, player, this, -1, true, true, true,
|
||||
Sound.FIRE_IGNITE, 1.4f, 0.8f, ParticleType.CRIT, null, 0, UpdateType.TICK, 2d);
|
||||
Sound.FIRE_IGNITE, 1.4f, 0.8f, ParticleType.CRIT, null, 0, UpdateType.TICK, 0.5f);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
|
||||
|
@ -58,7 +58,7 @@ public class ItemMelonLauncher extends ItemGadget implements IThrown
|
||||
1, false, 0, 0.2, 10, false);
|
||||
|
||||
Manager.getProjectileManager().AddThrow(item, player, this, -1, true, true, true,
|
||||
null, 1f, 1f, null, null, 0, UpdateType.TICK, 2d);
|
||||
null, 1f, 1f, null, null, 0, UpdateType.TICK, 0.5f);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
|
||||
|
@ -115,7 +115,7 @@ public class MorphBat extends MorphGadget implements IThrown
|
||||
0.01, true, -0.3, 0, 10, false);
|
||||
|
||||
Manager.getProjectileManager().AddThrow(item, player, this, -1, true, true, true,
|
||||
null, 1f, 1f, null, null, 0, UpdateType.TICK, 3d);
|
||||
null, 1f, 1f, null, null, 0, UpdateType.TICK, 0.5f);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill("Poop") + "."));
|
||||
|
@ -0,0 +1,253 @@
|
||||
package mineplex.core.gadget.gadgets;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.ItemDespawnEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import mineplex.core.common.CurrencyType;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.disguise.disguises.DisguiseRabbit;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.types.MorphGadget;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class MorphBunny extends MorphGadget
|
||||
{
|
||||
private HashSet<Player> _jumpCharge = new HashSet<Player>();
|
||||
private HashMap<Item, String> _eggs = new HashMap<Item, String>();
|
||||
|
||||
public MorphBunny(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Easter Bunny Morph", new String[]
|
||||
{
|
||||
C.cWhite + "Happy Easter!",
|
||||
" ",
|
||||
C.cYellow + "Charge Crouch" + C.cGray + " to use " + C.cGreen + "Super Jump",
|
||||
C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Hide Easter Egg",
|
||||
" ",
|
||||
C.cRed +C.Bold + "WARNING: " + ChatColor.RESET + "Hide Easter Egg uses 500 Coins" ,
|
||||
" ",
|
||||
C.cPurple + "Special Limited Time Morph",
|
||||
C.cPurple + "Purchase at www.mineplex.com/shop",
|
||||
},
|
||||
-1,
|
||||
Material.MONSTER_EGG, (byte)98);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void EnableCustom(final Player player)
|
||||
{
|
||||
this.ApplyArmor(player);
|
||||
|
||||
DisguiseRabbit disguise = new DisguiseRabbit(player);
|
||||
disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank());
|
||||
disguise.setCustomNameVisible(true);
|
||||
Manager.getDisguiseManager().disguise(disguise);
|
||||
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 999999999, 1));
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 999999999, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void DisableCustom(Player player)
|
||||
{
|
||||
_jumpCharge.remove(player);
|
||||
this.RemoveArmor(player);
|
||||
Manager.getDisguiseManager().undisguise(player);
|
||||
|
||||
player.removePotionEffect(PotionEffectType.SPEED);
|
||||
player.removePotionEffect(PotionEffectType.JUMP);
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void jumpTrigger(PlayerToggleSneakEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!IsActive(player))
|
||||
return;
|
||||
|
||||
//Start
|
||||
if (!event.getPlayer().isSneaking())
|
||||
{
|
||||
if (UtilEnt.isGrounded(event.getPlayer()))
|
||||
_jumpCharge.add(event.getPlayer());
|
||||
}
|
||||
//Jump
|
||||
else if (_jumpCharge.remove(event.getPlayer()))
|
||||
{
|
||||
float power = player.getExp();
|
||||
player.setExp(0f);
|
||||
|
||||
UtilAction.velocity(player, power * 4, 0.4, 4, true);
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.CAT_HIT, 0.75f, 2f);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void jumpBoost(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
Iterator<Player> jumpIter = _jumpCharge.iterator();
|
||||
|
||||
while (jumpIter.hasNext())
|
||||
{
|
||||
Player player = jumpIter.next();
|
||||
|
||||
if (!player.isValid() || !player.isOnline() || !player.isSneaking())
|
||||
{
|
||||
jumpIter.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
player.setExp(Math.min(0.9999f, player.getExp() + 0.03f));
|
||||
|
||||
player.playSound(player.getLocation(), Sound.FIZZ, 0.25f + player.getExp() * 0.5f, 0.5f + player.getExp());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void eggHide(PlayerInteractEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!IsActive(player))
|
||||
return;
|
||||
|
||||
if (!UtilEvent.isAction(event, ActionType.L))
|
||||
return;
|
||||
|
||||
if (Manager.getDonationManager().Get(player.getName()).GetBalance(CurrencyType.Coins) < 500)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Gadget", "You do not have enough Coins."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Recharge.Instance.use(player, "Hide Egg", 30000, true, false))
|
||||
return;
|
||||
|
||||
//Color
|
||||
|
||||
|
||||
//Item
|
||||
ItemStack eggStack = ItemStackFactory.Instance.CreateStack(Material.MONSTER_EGG, (byte)0, 1, "Hidden Egg" + System.currentTimeMillis());
|
||||
eggStack.setDurability((short) 98);
|
||||
|
||||
Item egg = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), eggStack);
|
||||
UtilAction.velocity(egg, player.getLocation().getDirection(), 0.2, false, 0, 0.2, 1, false);
|
||||
|
||||
|
||||
Manager.getDonationManager().RewardCoinsLater(this.GetName() + " Egg Hide", player, -500);
|
||||
|
||||
egg.setPickupDelay(40);
|
||||
|
||||
_eggs.put(egg, player.getName());
|
||||
|
||||
//Announce
|
||||
Bukkit.broadcastMessage(C.cYellow + C.Bold + player.getName() +
|
||||
ChatColor.RESET + C.Bold + " hid an " +
|
||||
C.cYellow + C.Bold + "Easter Egg" +
|
||||
ChatColor.RESET + C.Bold + " worth " +
|
||||
C.cYellow + C.Bold + "450 Coins");
|
||||
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
other.playSound(other.getLocation(), Sound.CAT_HIT, 1.5f, 1.5f);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void eggPickup(PlayerPickupItemEvent event)
|
||||
{
|
||||
if (_eggs.containsKey(event.getItem()) && !_eggs.get(event.getItem()).equals(event.getPlayer().getName()))
|
||||
{
|
||||
_eggs.remove(event.getItem());
|
||||
|
||||
event.setCancelled(true);
|
||||
event.getItem().remove();
|
||||
|
||||
Manager.getDonationManager().RewardCoinsLater(GetName() + " Egg Pickup", event.getPlayer(), 450);
|
||||
|
||||
event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1.5f, 0.75f);
|
||||
event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1.5f, 1.25f);
|
||||
|
||||
UtilFirework.playFirework(event.getItem().getLocation(), Type.BURST, Color.YELLOW, true, true);
|
||||
|
||||
//Announce
|
||||
Bukkit.broadcastMessage(C.cGold + C.Bold + event.getPlayer().getName() +
|
||||
ChatColor.RESET + C.Bold + " found an " +
|
||||
C.cGold + C.Bold + "Easter Egg" +
|
||||
ChatColor.RESET + C.Bold + "! " + _eggs.size() + " Eggs left!");
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void eggClean(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
Iterator<Item> eggIter = _eggs.keySet().iterator();
|
||||
|
||||
while (eggIter.hasNext())
|
||||
{
|
||||
Item egg = eggIter.next();
|
||||
|
||||
if (!egg.isValid() || egg.getTicksLived() > 24000)
|
||||
{
|
||||
egg.remove();
|
||||
eggIter.remove();
|
||||
|
||||
//Announce
|
||||
Bukkit.broadcastMessage(
|
||||
ChatColor.RESET + C.Bold + "No one found an " +
|
||||
C.cGold + C.Bold + "Easter Egg" +
|
||||
ChatColor.RESET + C.Bold + "! " + _eggs.size() + " Eggs left!");
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilParticle.PlayParticle(ParticleType.SPELL, egg.getLocation().add(0, 0.1, 0), 0.1f, 0.1f, 0.1f, 0, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void eggDespawnCancel(ItemDespawnEvent event)
|
||||
{
|
||||
if (_eggs.containsKey(event.getEntity()))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
@ -98,7 +98,7 @@ public class MorphVillager extends MorphGadget implements IThrown
|
||||
|
||||
//Throw
|
||||
Manager.getProjectileManager().AddThrow(gem, player, this, -1, true, true, true,
|
||||
null, 1.4f, 0.8f, null, null, 0, UpdateType.TICK, 2d);
|
||||
null, 1.4f, 0.8f, null, null, 0, UpdateType.TICK, 0.5f);
|
||||
|
||||
Manager.getDonationManager().RewardGems(null, this.GetName() + " Throw", player.getName(), player.getUniqueId(), -20);
|
||||
|
||||
|
@ -34,7 +34,7 @@ public class ParticleBlizzard extends ParticleGadget
|
||||
C.cWhite + "Your double jumps and arrows",
|
||||
C.cWhite + "are enchanted with snow powers.",
|
||||
" ",
|
||||
C.cPurple + "Purchased at www.mineplex.com/shop",
|
||||
C.cPurple + "No longer available",
|
||||
},
|
||||
-1,
|
||||
Material.SNOW_BALL, (byte)0);
|
||||
|
@ -31,42 +31,42 @@ public class ProjectileManager extends MiniPlugin
|
||||
}
|
||||
|
||||
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
|
||||
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, double hitboxMult)
|
||||
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, float hitboxGrow)
|
||||
{
|
||||
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
|
||||
expireTime, hitPlayer, hitBlock, idle, false,
|
||||
null, 1f, 1f, null, 0, null, null, hitboxMult));
|
||||
null, 1f, 1f, null, 0, null, null, hitboxGrow));
|
||||
}
|
||||
|
||||
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
|
||||
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, boolean pickup, double hitboxMult)
|
||||
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, boolean pickup, float hitboxGrow)
|
||||
{
|
||||
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
|
||||
expireTime, hitPlayer, hitBlock, idle, pickup,
|
||||
null, 1f, 1f, null, 0, null, null, hitboxMult));
|
||||
null, 1f, 1f, null, 0, null, null, hitboxGrow));
|
||||
}
|
||||
|
||||
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
|
||||
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle,
|
||||
Sound sound, float soundVolume, float soundPitch, Effect effect, int effectData, UpdateType effectRate , double hitboxMult)
|
||||
Sound sound, float soundVolume, float soundPitch, Effect effect, int effectData, UpdateType effectRate , float hitboxGrow)
|
||||
{
|
||||
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
|
||||
expireTime, hitPlayer, hitBlock, idle, false,
|
||||
sound, soundVolume, soundPitch, effect, effectData, effectRate, null, hitboxMult));
|
||||
sound, soundVolume, soundPitch, effect, effectData, effectRate, null, hitboxGrow));
|
||||
}
|
||||
|
||||
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
|
||||
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle,
|
||||
Sound sound, float soundVolume, float soundPitch, ParticleType particle, Effect effect, int effectData, UpdateType effectRate, double hitboxMult)
|
||||
Sound sound, float soundVolume, float soundPitch, ParticleType particle, Effect effect, int effectData, UpdateType effectRate, float hitboxGrow)
|
||||
{
|
||||
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
|
||||
expireTime, hitPlayer, hitBlock, idle, false,
|
||||
sound, soundVolume, soundPitch, effect, effectData, effectRate, particle, hitboxMult));
|
||||
sound, soundVolume, soundPitch, effect, effectData, effectRate, particle, hitboxGrow));
|
||||
}
|
||||
|
||||
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
|
||||
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle,
|
||||
Sound sound, float soundVolume, float soundPitch, ParticleType particle, UpdateType effectRate, double hitboxMult)
|
||||
Sound sound, float soundVolume, float soundPitch, ParticleType particle, UpdateType effectRate, float hitboxMult)
|
||||
{
|
||||
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
|
||||
expireTime, hitPlayer, hitBlock, idle, false,
|
||||
|
@ -206,7 +206,7 @@ public class StackerManager extends MiniPlugin implements IThrown
|
||||
|
||||
UtilAction.velocity(throwee, thrower.getLocation().getDirection(), 1.8, false, 0, 0.3, 2, false);
|
||||
|
||||
_projectileManager.AddThrow(throwee, thrower, this, -1, true, false, true, false, 2.4d);
|
||||
_projectileManager.AddThrow(throwee, thrower, this, -1, true, false, true, false, 0.5f);
|
||||
|
||||
//Portal Delay
|
||||
Manager.SetPortalDelay(thrower);
|
||||
|
@ -209,6 +209,9 @@ public class WorldManager extends MiniPlugin
|
||||
if (!(ent instanceof Item))
|
||||
continue;
|
||||
|
||||
if (((Item)ent).getItemStack().getType() == Material.MONSTER_EGG)
|
||||
continue;
|
||||
|
||||
if (ent.getTicksLived() > 1200)
|
||||
ent.remove();
|
||||
}
|
||||
|
@ -34,6 +34,9 @@ public class ListCommand extends BaseCommand
|
||||
|
||||
for (GameType gameType : GameType.values())
|
||||
{
|
||||
if (gameType == GameType.InProgress)
|
||||
continue;
|
||||
|
||||
if (listMaps(player, gameType, colorSwitch))
|
||||
colorSwitch = !colorSwitch;
|
||||
}
|
||||
@ -41,16 +44,22 @@ public class ListCommand extends BaseCommand
|
||||
else if (args.length == 1)
|
||||
{
|
||||
GameType gameType = null;
|
||||
try
|
||||
if (args[0].equalsIgnoreCase("p"))
|
||||
{
|
||||
gameType = GameType.valueOf(args[0]);
|
||||
gameType = GameType.InProgress;
|
||||
}
|
||||
catch (Exception e)
|
||||
else
|
||||
{
|
||||
getPlugin().sendValidGameTypes(player);
|
||||
try
|
||||
{
|
||||
gameType = GameType.valueOf(args[0]);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
getPlugin().sendValidGameTypes(player);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
UtilPlayer.message(player, F.main("Parser", "Listing Maps for gametype " + F.elem(gameType.GetName())));
|
||||
listMaps(player, gameType, false);
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.core.disguise.disguises.DisguisePig;
|
||||
import mineplex.core.disguise.disguises.DisguisePlayer;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillActive;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||
@ -120,14 +121,10 @@ public class Illusion extends SkillActive
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
if (UtilMath.offset2d(skel, other) < 70)
|
||||
inRange.add(other);
|
||||
|
||||
Player[] disguiseList = new Player[inRange.size()];
|
||||
for (int i=0 ; i<inRange.size() ; i++)
|
||||
disguiseList[i] = inRange.get(i);
|
||||
|
||||
|
||||
//Disguise
|
||||
DisguisePlayer disguise = new DisguisePlayer(skel, ((CraftPlayer)player).getHandle().getProfile());
|
||||
Factory.Disguise().disguise(disguise, disguiseList);
|
||||
Factory.Disguise().disguise(disguise, inRange.toArray(new Player[inRange.size()]));
|
||||
|
||||
//Invis
|
||||
Factory.Condition().Factory().Cloak(GetName(), player, player, 2 + 1*level, false, true);
|
||||
|
@ -98,20 +98,11 @@ public class BlockToss extends SkillCharge implements IThrown
|
||||
}
|
||||
|
||||
Block grab = event.getClickedBlock();
|
||||
|
||||
if (!UtilBlock.solid(grab) || grab.getType() == Material.BEDROCK)
|
||||
return;
|
||||
|
||||
//Recharge
|
||||
if (!Recharge.Instance.use(player, GetName(), 1000, false, false))
|
||||
return;
|
||||
|
||||
if (grab.getRelative(BlockFace.UP).getType() != Material.AIR)
|
||||
{
|
||||
UtilPlayer.message(player, F.main(GetName(), "You cannot grab this block."));
|
||||
return;
|
||||
}
|
||||
|
||||
//Door
|
||||
if (grab.getRelative(BlockFace.UP).getTypeId() == 64 || grab.getRelative(BlockFace.UP).getTypeId() == 71)
|
||||
{
|
||||
@ -139,7 +130,6 @@ public class BlockToss extends SkillCharge implements IThrown
|
||||
|
||||
//Block to Item
|
||||
FallingBlock block = player.getWorld().spawnFallingBlock(player.getEyeLocation(), event.getClickedBlock().getType(), (byte)0);
|
||||
Factory.BlockRestore().Add(event.getClickedBlock(), 0, (byte)0, 10000);
|
||||
|
||||
//Action
|
||||
player.eject();
|
||||
@ -207,7 +197,7 @@ public class BlockToss extends SkillCharge implements IThrown
|
||||
//Action
|
||||
UtilAction.velocity(block, cur.getLocation().getDirection(), mult, false, 0, 0, 1, true);
|
||||
Factory.Projectile().AddThrow(block, cur, this, -1, true, true, true,
|
||||
null, 0, 0, null, 0, UpdateType.FASTEST, 2.5d);
|
||||
null, 0, 0, null, 0, UpdateType.FASTEST, 1.2f);
|
||||
|
||||
//Event
|
||||
UtilServer.getServer().getPluginManager().callEvent(new SkillEvent(cur, GetName(), ClassType.Brute));
|
||||
@ -287,15 +277,7 @@ public class BlockToss extends SkillCharge implements IThrown
|
||||
_falling.remove(cur);
|
||||
Block block = cur.getLocation().getBlock();
|
||||
|
||||
int id = block.getTypeId();
|
||||
if (
|
||||
id != 1 &&
|
||||
id != 2 &&
|
||||
id != 3 &&
|
||||
id != 4 &&
|
||||
id != 12 &&
|
||||
id != 13 &&
|
||||
id != 80)
|
||||
if (block.getType() != cur.getMaterial())
|
||||
continue;
|
||||
|
||||
block.setTypeIdAndData(0, (byte)0, false);
|
||||
|
@ -108,7 +108,7 @@ public class FleshHook extends SkillActiveCharge implements IThrown
|
||||
1 + charge , false, 0, 0.2, 20, false);
|
||||
|
||||
Factory.Projectile().AddThrow(item, cur, this, -1, true, true, true,
|
||||
Sound.FIRE_IGNITE, 1.4f, 0.8f, ParticleType.CRIT, UpdateType.TICK, 1.5d);
|
||||
Sound.FIRE_IGNITE, 1.4f, 0.8f, ParticleType.CRIT, UpdateType.TICK, 1.2f);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(cur, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + "."));
|
||||
|
@ -90,7 +90,7 @@ public class AxeThrow extends SkillActive implements IThrown
|
||||
player.setItemInHand(null);
|
||||
|
||||
//Projectile
|
||||
Factory.Projectile().AddThrow(item, player, this, -1, true, true, true, false, 2.5d);
|
||||
Factory.Projectile().AddThrow(item, player, this, -1, true, true, true, false, 0.6f);
|
||||
|
||||
//Store
|
||||
_thrown.put(item, player);
|
||||
|
@ -70,7 +70,7 @@ public class FreezingBlast extends SkillActive implements IThrown
|
||||
Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(79));
|
||||
item.setVelocity(player.getLocation().getDirection());
|
||||
Factory.Projectile().AddThrow(item, player, this, -1, true, true, true,
|
||||
Sound.FIZZ, 0.6f, 1.6f, null, 0, UpdateType.FASTEST, 2d);
|
||||
Sound.FIZZ, 0.6f, 1.6f, null, 0, UpdateType.FASTEST, 1f);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + "."));
|
||||
|
@ -7,8 +7,10 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
|
||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
@ -25,6 +27,8 @@ import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||
|
||||
public class GlacialBlade extends SkillActive implements IThrown
|
||||
{
|
||||
private float radius = 1.5f;
|
||||
|
||||
public GlacialBlade(SkillFactory skills, String name, ClassType classType, SkillType skillType,
|
||||
int cost, int levels,
|
||||
int energy, int energyMod,
|
||||
@ -71,7 +75,7 @@ public class GlacialBlade extends SkillActive implements IThrown
|
||||
Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()).subtract(0, 0.2, 0), ItemStackFactory.Instance.CreateStack(370));
|
||||
UtilAction.velocity(item, player.getLocation().getDirection(), 1.6, false, 0, 0.2, 10, false);
|
||||
Factory.Projectile().AddThrow(item, player, this, -1, true, true, true,
|
||||
null, 0, 0, ParticleType.SNOW_SHOVEL, UpdateType.TICK, 1.5d);
|
||||
null, 0, 0, ParticleType.SNOW_SHOVEL, UpdateType.TICK, radius);
|
||||
|
||||
//Effect
|
||||
item.getWorld().playSound(item.getLocation(), Sound.ORB_PICKUP, 1f, 2f);
|
||||
@ -120,4 +124,21 @@ public class GlacialBlade extends SkillActive implements IThrown
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void radiusSet(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
if (event.getMessage().startsWith("/gbr "))
|
||||
{
|
||||
try
|
||||
{
|
||||
radius = Float.parseFloat(event.getMessage().split(" ")[1]);
|
||||
event.getPlayer().sendMessage("Radius: " + radius);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
event.getPlayer().sendMessage("Radius FAIL: " + radius);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ public class IcePrison extends SkillActive implements IThrown
|
||||
{
|
||||
"Launch an icy orb. When it collides,",
|
||||
"it creates a hollow sphere of ice",
|
||||
"thats lasts for #2#1.5 seconds.",
|
||||
"thats lasts for #1#1.5 seconds.",
|
||||
});
|
||||
}
|
||||
|
||||
@ -70,8 +70,8 @@ public class IcePrison extends SkillActive implements IThrown
|
||||
//Action
|
||||
Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(79));
|
||||
item.setVelocity(player.getLocation().getDirection());
|
||||
Factory.Projectile().AddThrow(item, player, this, System.currentTimeMillis() + 2000, true, false, false,
|
||||
Sound.FIZZ, 0.6f, 1.6f, ParticleType.SNOW_SHOVEL, UpdateType.TICK, 1.5d);
|
||||
Factory.Projectile().AddThrow(item, player, this, -1, true, true, true,
|
||||
Sound.FIZZ, 0.6f, 1.6f, ParticleType.SNOW_SHOVEL, UpdateType.TICK, 1.5f);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + "."));
|
||||
@ -148,7 +148,7 @@ public class IcePrison extends SkillActive implements IThrown
|
||||
if (!UtilBlock.airFoliage(freeze))
|
||||
return;
|
||||
|
||||
long time = 4000 + (1500 * level);
|
||||
long time = 2500 + (1500 * level);
|
||||
|
||||
int yDiff = freeze.getY() - mid.getY();
|
||||
|
||||
|
@ -102,7 +102,7 @@ public class LightningOrb extends SkillActive implements IThrown
|
||||
Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(57));
|
||||
item.setVelocity(player.getLocation().getDirection());
|
||||
Factory.Projectile().AddThrow(item, player, this, System.currentTimeMillis() + 5000 - (400 * level), true, false, false,
|
||||
Sound.FIZZ, 0.6f, 1.6f, ParticleType.FIREWORKS_SPARK, UpdateType.TICK, 2d);
|
||||
Sound.FIZZ, 0.6f, 1.6f, ParticleType.FIREWORKS_SPARK, UpdateType.TICK, 1f);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + "."));
|
||||
|
@ -160,7 +160,7 @@ public abstract class ItemUsable extends Item implements IThrown
|
||||
|
||||
org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(GetType()));
|
||||
UtilAction.velocity(ent, player.getLocation().getDirection(), _throwPower, false, 0, 0.2, 10, false);
|
||||
Factory.Throw().AddThrow(ent, player, this, expire, _throwPlayer, _throwBlock, _throwIdle, _throwPickup, 1d);
|
||||
Factory.Throw().AddThrow(ent, player, this, expire, _throwPlayer, _throwBlock, _throwIdle, _throwPickup, 0.5f);
|
||||
|
||||
ThrowCustom(event, ent);
|
||||
}
|
||||
|
@ -230,6 +230,9 @@ public class ServerMonitor
|
||||
|
||||
for (MinecraftServer minecraftServer : _serverStatuses)
|
||||
{
|
||||
if (minecraftServer.getGroup().equalsIgnoreCase("Testing"))
|
||||
continue;
|
||||
|
||||
onlineServers.add(minecraftServer.getName());
|
||||
|
||||
if (minecraftServer.getTps() <= 17)
|
||||
@ -369,7 +372,7 @@ public class ServerMonitor
|
||||
_deadServers.clear();
|
||||
for (MinecraftServer deadServer : _repository.getDeadServers())
|
||||
{
|
||||
if (deadServer.getUptime() <= 10)
|
||||
if (deadServer.getUptime() <= 10 || deadServer.getGroup().equalsIgnoreCase("Testing"))
|
||||
continue;
|
||||
|
||||
if (_count == 0 || deadServers.contains(deadServer.getName()))
|
||||
@ -427,6 +430,7 @@ public class ServerMonitor
|
||||
if (availableSlots < 1500)
|
||||
{
|
||||
serversToAdd = Math.max(1, (1500 - availableSlots) / serverGroup.getMaxPlayers());
|
||||
serversToAdd = Math.min(250 - totalServers, serversToAdd);
|
||||
serversToKill = 0;
|
||||
}
|
||||
else if (serversToKill > 0)
|
||||
@ -439,6 +443,8 @@ public class ServerMonitor
|
||||
if (serversToRestart <= 5)
|
||||
serversToRestart = 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if (serverGroup.getName().equalsIgnoreCase("Halloween"))
|
||||
{
|
||||
|
@ -16,6 +16,7 @@ import mineplex.staffServer.salespackage.salespackages.AncientChest;
|
||||
import mineplex.staffServer.salespackage.salespackages.ApplyKits;
|
||||
import mineplex.staffServer.salespackage.salespackages.Coins;
|
||||
import mineplex.staffServer.salespackage.salespackages.DefaultRank;
|
||||
import mineplex.staffServer.salespackage.salespackages.EasterBunny;
|
||||
import mineplex.staffServer.salespackage.salespackages.FrostLord;
|
||||
import mineplex.staffServer.salespackage.salespackages.GemHunter;
|
||||
import mineplex.staffServer.salespackage.salespackages.LifetimeHero;
|
||||
@ -61,6 +62,7 @@ public class SalesPackageManager extends MiniPlugin
|
||||
AddSalesPackage(new AncientChest(this));
|
||||
AddSalesPackage(new MythicalChest(this));
|
||||
AddSalesPackage(new FrostLord(this));
|
||||
AddSalesPackage(new EasterBunny(this));
|
||||
}
|
||||
|
||||
private void AddSalesPackage(SalesPackageBase salesPackage)
|
||||
|
@ -0,0 +1,20 @@
|
||||
package mineplex.staffServer.salespackage.salespackages;
|
||||
|
||||
import mineplex.staffServer.salespackage.SalesPackageManager;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class EasterBunny extends SalesPackageBase
|
||||
{
|
||||
public EasterBunny(SalesPackageManager manager)
|
||||
{
|
||||
super(manager, "Easter Bunny Morph");
|
||||
}
|
||||
|
||||
public void displayToAgent(Player agent, String playerName)
|
||||
{
|
||||
addButton(agent, "/sales item " + playerName + " 1 Easter Bunny Morph", "Give Easter Bunny Morph.");
|
||||
agent.sendMessage(" ");
|
||||
addBackButton(agent, playerName);
|
||||
}
|
||||
}
|
@ -109,13 +109,14 @@ import nautilus.game.arcade.managers.GameSpectatorManager;
|
||||
import nautilus.game.arcade.managers.GameStatManager;
|
||||
import nautilus.game.arcade.managers.GameTournamentManager;
|
||||
import nautilus.game.arcade.managers.GameWorldManager;
|
||||
import nautilus.game.arcade.managers.HolidayManager;
|
||||
import nautilus.game.arcade.managers.IdleManager;
|
||||
import nautilus.game.arcade.managers.MiscManager;
|
||||
import nautilus.game.arcade.shop.ArcadeShop;
|
||||
|
||||
public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
{
|
||||
// Modules
|
||||
// Modules
|
||||
private BlockRestore _blockRestore;
|
||||
private Blood _blood;
|
||||
private Chat _chat;
|
||||
@ -264,7 +265,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
new MiscManager(this);
|
||||
_hologramManager = hologramManager;
|
||||
_idleManager = new IdleManager(this);
|
||||
//new HalloweenManager(this);
|
||||
new HolidayManager(this);
|
||||
|
||||
// Game Addons
|
||||
new CompassAddon(plugin, this);
|
||||
|
@ -189,7 +189,7 @@ public class Runner extends SoloGame implements IThrown
|
||||
byte data = block.getData();
|
||||
MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR);
|
||||
FallingBlock ent = block.getWorld().spawnFallingBlock(block.getLocation(), id, data);
|
||||
Manager.GetProjectile().AddThrow(ent, null, this, -1, true, false, false, false, 1d);
|
||||
Manager.GetProjectile().AddThrow(ent, null, this, -1, true, false, false, false, 1f);
|
||||
|
||||
blockIterator.remove();
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ public class Stacker extends SoloGame implements IThrown
|
||||
|
||||
UtilAction.velocity(throwee, thrower.getLocation().getDirection(), 1.8, false, 0, 0.3, 2, false);
|
||||
|
||||
Manager.GetProjectile().AddThrow(throwee, thrower, this, -1, true, false, true, false, 2.4d);
|
||||
Manager.GetProjectile().AddThrow(throwee, thrower, this, -1, true, false, true, false, 1f);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -170,7 +170,7 @@ public class Stacker extends SoloGame implements IThrown
|
||||
//Hit Own Stack > Rethrow
|
||||
if (hit.equals(data.GetThrower()))
|
||||
{
|
||||
Manager.GetProjectile().AddThrow(data.GetThrown(), data.GetThrower(), this, -1, true, false, true, false, 2.4d);
|
||||
Manager.GetProjectile().AddThrow(data.GetThrown(), data.GetThrower(), this, -1, true, false, true, false, 1f);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1495,6 +1495,9 @@ public class SurvivalGames extends SoloGame
|
||||
@EventHandler
|
||||
public void borderBlockDamage(ProjectileHitEvent event)
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (!(event.getEntity() instanceof Fireball))
|
||||
return;
|
||||
|
||||
|
@ -85,7 +85,7 @@ public class PerkApple extends Perk implements IThrown
|
||||
|
||||
org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.APPLE));
|
||||
UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, false);
|
||||
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 1d);
|
||||
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 0.5f);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -57,7 +57,7 @@ public class PerkAxeThrower extends Perk implements IThrown
|
||||
|
||||
org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(player.getItemInHand().getType()));
|
||||
UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, false);
|
||||
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 2.5d);
|
||||
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 0.6f);
|
||||
|
||||
//Remove Axe
|
||||
player.setItemInHand(null);
|
||||
|
@ -72,7 +72,7 @@ public class PerkBaconBlast extends Perk implements IThrown
|
||||
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true,
|
||||
null, 1f, 1f,
|
||||
null, 1, UpdateType.SLOW,
|
||||
2d);
|
||||
0.5f);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
|
||||
|
@ -60,7 +60,7 @@ public class PerkBlockRestorer extends Perk implements IThrown
|
||||
|
||||
org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.COMMAND));
|
||||
UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, false);
|
||||
Manager.GetProjectile().AddThrow(ent, player, this, -1, false, false, true, false, 2d);
|
||||
Manager.GetProjectile().AddThrow(ent, player, this, -1, false, false, true, false, 0.5f);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -144,7 +144,7 @@ public class PerkBlockToss extends SmashPerk implements IThrown
|
||||
//Action
|
||||
UtilAction.velocity(block, cur.getLocation().getDirection(), mult, false, 0.2, 0, 1, true);
|
||||
Manager.GetProjectile().AddThrow(block, cur, this, -1, true, true, true,
|
||||
null, 0, 0, null, 0, UpdateType.FASTEST, 2d);
|
||||
null, 0, 0, null, 0, UpdateType.FASTEST, 1.5f);
|
||||
|
||||
//Event
|
||||
PerkBlockThrowEvent blockEvent = new PerkBlockThrowEvent(cur);
|
||||
|
@ -123,7 +123,7 @@ public class PerkBoneRush extends SmashPerk implements IThrown
|
||||
{
|
||||
Item bone = player.getWorld().dropItem(player.getLocation().add(Math.random()*5 - 2.5, Math.random()*3, Math.random()*5 - 2.5), new ItemStack(Material.BONE));
|
||||
UtilAction.velocity(bone, dir, 0.6 + 0.3 * Math.random(), false, 0, 0.1 + Math.random() * 0.05, 0.3, false);
|
||||
Manager.GetProjectile().AddThrow(bone, player, this, -1, true, true, true, false, 1d);
|
||||
Manager.GetProjectile().AddThrow(bone, player, this, -1, true, true, true, false, 0.5f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ public class PerkCowBomb extends Perk implements IThrown
|
||||
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true,
|
||||
null, 1f, 1f,
|
||||
null, 1, UpdateType.SLOW,
|
||||
2d);
|
||||
0.5f);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
|
||||
|
@ -79,7 +79,7 @@ public class PerkCreeperSulphurBomb extends SmashPerk implements IThrown
|
||||
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true,
|
||||
null, 1f, 1f,
|
||||
null, 1, UpdateType.SLOW,
|
||||
2.5d);
|
||||
0.5f);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
|
||||
|
@ -79,7 +79,7 @@ public class PerkHammerThrow extends Perk implements IThrown
|
||||
UtilAction.velocity(item, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, true);
|
||||
|
||||
//Projectile
|
||||
Manager.GetProjectile().AddThrow(item, player, this, -1, true, true, true, false, 2.5d);
|
||||
Manager.GetProjectile().AddThrow(item, player, this, -1, true, true, true, false, 0.6f);
|
||||
|
||||
//Store
|
||||
_thrown.put(item, player);
|
||||
|
@ -87,7 +87,7 @@ public class PerkInkBlast extends SmashPerk implements IThrown
|
||||
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true,
|
||||
null, 1f, 1f,
|
||||
Effect.SMOKE, 4, UpdateType.TICK,
|
||||
2d);
|
||||
0.5f);
|
||||
}
|
||||
|
||||
//Inform
|
||||
|
@ -64,7 +64,7 @@ public class PerkIronHook extends Perk implements IThrown
|
||||
1.8, false, 0, 0.2, 10, false);
|
||||
|
||||
Manager.GetProjectile().AddThrow(item, player, this, -1, true, true, true,
|
||||
Sound.FIRE_IGNITE, 1.4f, 0.8f, ParticleType.CRIT, null, 0, UpdateType.TICK, 2d);
|
||||
Sound.FIRE_IGNITE, 1.4f, 0.8f, ParticleType.CRIT, null, 0, UpdateType.TICK, 1f);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
|
||||
|
@ -89,7 +89,7 @@ public class PerkPigBaconBounce extends SmashPerk implements IThrown
|
||||
//Launch
|
||||
Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.PORK));
|
||||
UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, false);
|
||||
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 1d);
|
||||
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 1f);
|
||||
ent.setPickupDelay(9999);
|
||||
|
||||
//Sound
|
||||
|
@ -99,7 +99,7 @@ public class PerkRevealer extends Perk implements IThrown
|
||||
|
||||
Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.DIAMOND));
|
||||
UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, false);
|
||||
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 1d);
|
||||
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 0.5f);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -194,7 +194,7 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown
|
||||
UtilAction.velocity(slime, player.getLocation().getDirection(), 1 + charge/2d, false, 0, 0.2, 10, true);
|
||||
|
||||
Manager.GetProjectile().AddThrow(slime, player, this, -1, true, true, true,
|
||||
null, 0, 0, null, 0, UpdateType.FASTEST, 2d);
|
||||
null, 0, 0, null, 0, UpdateType.FASTEST, 1f);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -69,7 +69,7 @@ public class PerkThrower extends Perk implements IThrown
|
||||
|
||||
//Throw
|
||||
UtilAction.velocity(throwee, thrower.getLocation().getDirection(), 1.4, false, 0, 0.3, 0.8, true);
|
||||
Manager.GetProjectile().AddThrow(throwee, thrower, this, -1, true, false, true, false, 2d);
|
||||
Manager.GetProjectile().AddThrow(throwee, thrower, this, -1, true, false, true, false, 1f);
|
||||
|
||||
//Audio
|
||||
thrower.getWorld().playSound(thrower.getLocation(), Sound.SHEEP_IDLE, 2f, 3f);
|
||||
|
@ -97,7 +97,7 @@ public class PerkWeb extends Perk implements IThrown
|
||||
|
||||
org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.WEB));
|
||||
UtilAction.velocity(ent, player.getLocation().getDirection(), 0.8, false, 0, 0.2, 10, false);
|
||||
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 1d);
|
||||
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 0.5f);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -76,7 +76,7 @@ public class PerkWebShot extends SmashPerk implements IThrown
|
||||
random.multiply(0.2);
|
||||
|
||||
UtilAction.velocity(ent, player.getLocation().getDirection().multiply(-1).add(random), 1 + Math.random() * 0.4, false, 0, 0.2, 10, false);
|
||||
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 2d);
|
||||
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 0.5f);
|
||||
}
|
||||
|
||||
//Inform
|
||||
|
@ -72,7 +72,7 @@ public class PerkWitherWeb extends Perk implements IThrown
|
||||
random.multiply(0.25);
|
||||
|
||||
UtilAction.velocity(ent, player.getLocation().getDirection().add(random), 1 + Math.random() * 0.4, false, 0, 0.2, 10, false);
|
||||
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 2d);
|
||||
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 0.5f);
|
||||
}
|
||||
|
||||
//Inform
|
||||
|
@ -108,7 +108,7 @@ public class PerkWoolBomb extends Perk implements IThrown
|
||||
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true,
|
||||
null, 1f, 1f,
|
||||
null, 1, UpdateType.SLOW,
|
||||
2d);
|
||||
0.5f);
|
||||
|
||||
_thrown.put(player, ent);
|
||||
|
||||
|
@ -100,7 +100,7 @@ public class PerkZombieBile extends SmashPerk implements IThrown
|
||||
|
||||
org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()).subtract(0, 0.5, 0), ItemStackFactory.Instance.CreateStack(Material.ROTTEN_FLESH));
|
||||
UtilAction.velocity(ent, player.getLocation().getDirection().add(rand), 0.8, false, 0, 0.2, 10, false);
|
||||
Manager.GetProjectile().AddThrow(ent, player, this, System.currentTimeMillis() + 2000, true, true, true, false, 1.5d);
|
||||
Manager.GetProjectile().AddThrow(ent, player, this, System.currentTimeMillis() + 2000, true, true, true, false, 0.5f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public class GameGemManager implements Listener
|
||||
{
|
||||
ArcadeManager Manager;
|
||||
|
||||
boolean DoubleGem = false;
|
||||
boolean DoubleGem = true;
|
||||
|
||||
public GameGemManager(ArcadeManager manager)
|
||||
{
|
||||
@ -174,7 +174,7 @@ public class GameGemManager implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
if (DoubleGem && game.GemDoubleEnabled)
|
||||
if (DoubleGem && game.GemDoubleEnabled && UtilPlayer.is1_8(player))
|
||||
total += earned;
|
||||
|
||||
Manager.GetDonation().RewardGems(null, "Earned " + game.GetName(), player.getName(), player.getUniqueId(), total);
|
||||
@ -245,7 +245,7 @@ public class GameGemManager implements Listener
|
||||
}
|
||||
|
||||
//Double Gem
|
||||
if (DoubleGem && game.GemDoubleEnabled)
|
||||
if (DoubleGem && game.GemDoubleEnabled && UtilPlayer.is1_8(player))
|
||||
{
|
||||
UtilPlayer.message(player, F.elem(C.cGreen + "+" + (earnedGems) + " Gems") + " for " + F.elem(C.cDGreen + "Double Gem Weekend"));
|
||||
|
||||
|
@ -4,40 +4,89 @@ import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutBlockAction;
|
||||
import net.minecraft.server.v1_7_R4.TileEntity;
|
||||
import net.minecraft.server.v1_7_R4.TileEntityEnderChest;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.util.CraftMagicNumbers;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockDamageEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class HolidayManager implements Listener
|
||||
{
|
||||
public enum HolidayType
|
||||
{
|
||||
Christmas(Material.CHEST, "Present", Sound.LEVEL_UP),
|
||||
Halloween(Material.PUMPKIN, "Pumpkin", Sound.ZOMBIE_REMEDY),
|
||||
Easter(Material.CHEST, "Egg Basket", Sound.CAT_MEOW);
|
||||
|
||||
private Material _blockType;
|
||||
private String _blockName;
|
||||
private Sound _blockBreakSound;
|
||||
|
||||
HolidayType(Material blockType, String blockName, Sound blockBreakSound)
|
||||
{
|
||||
_blockType = blockType;
|
||||
_blockName = blockName;
|
||||
_blockBreakSound = blockBreakSound;
|
||||
}
|
||||
|
||||
public String getBlockName()
|
||||
{
|
||||
return _blockName;
|
||||
}
|
||||
|
||||
public Sound getBlockSound()
|
||||
{
|
||||
return _blockBreakSound;
|
||||
}
|
||||
|
||||
public Material getBlockType()
|
||||
{
|
||||
return _blockType;
|
||||
}
|
||||
}
|
||||
|
||||
private HolidayType type = HolidayType.Easter;
|
||||
|
||||
ArcadeManager Manager;
|
||||
|
||||
|
||||
public HashSet<Block> _active = new HashSet<Block>();
|
||||
|
||||
|
||||
private HashSet<Item> _eggs = new HashSet<Item>();
|
||||
|
||||
private HashSet<Item> _coins = new HashSet<Item>();
|
||||
|
||||
|
||||
public long _lastSpawn = System.currentTimeMillis();
|
||||
|
||||
public HolidayManager(ArcadeManager manager)
|
||||
@ -46,70 +95,96 @@ public class HolidayManager implements Listener
|
||||
|
||||
Manager.getPluginManager().registerEvents(this, Manager.getPlugin());
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void reset(GameStateChangeEvent event)
|
||||
{
|
||||
_active.clear();
|
||||
|
||||
|
||||
_lastSpawn = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void pumpkinEffect(UpdateEvent event)
|
||||
public void blockEffect(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() == UpdateType.TICK)
|
||||
return;
|
||||
|
||||
|
||||
Iterator<Block> blockIterator = _active.iterator();
|
||||
|
||||
|
||||
while (blockIterator.hasNext())
|
||||
{
|
||||
Block block = blockIterator.next();
|
||||
|
||||
if (block.getType() != Material.PUMPKIN && block.getType() != Material.JACK_O_LANTERN)
|
||||
|
||||
//Break
|
||||
if (block.getType() != Material.PUMPKIN &&
|
||||
block.getType() != Material.JACK_O_LANTERN &&
|
||||
block.getType() != Material.CHEST)
|
||||
{
|
||||
pumpkinBreak(block);
|
||||
specialBlockBreak(block);
|
||||
blockIterator.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
UtilParticle.PlayParticle(ParticleType.FLAME, block.getLocation().add(0.5, 0.5, 0.5), 0, 0, 0, 0.06f, 4);
|
||||
if (Math.random() > 0.90)
|
||||
|
||||
if (type == HolidayType.Halloween)
|
||||
{
|
||||
if (block.getType() == Material.PUMPKIN)
|
||||
UtilParticle.PlayParticle(ParticleType.FLAME, block.getLocation().add(0.5, 0.5, 0.5), 0, 0, 0, 0.06f, 4);
|
||||
if (Math.random() > 0.90)
|
||||
{
|
||||
block.setType(Material.JACK_O_LANTERN);
|
||||
if (block.getType() == Material.PUMPKIN)
|
||||
{
|
||||
block.setType(Material.JACK_O_LANTERN);
|
||||
}
|
||||
else
|
||||
{
|
||||
block.setType(Material.PUMPKIN);
|
||||
}
|
||||
}
|
||||
else
|
||||
}
|
||||
else if (type == HolidayType.Easter)
|
||||
{
|
||||
UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, block.getLocation().add(0.5, 0.2, 0.5), 0.3f, 0.2f, 0.3f, 0, 1);
|
||||
|
||||
if (Math.random() > 0.90)
|
||||
{
|
||||
block.setType(Material.PUMPKIN);
|
||||
Item egg = block.getWorld().dropItem(block.getLocation().add(0.5, 0.8, 0.5),
|
||||
ItemStackFactory.Instance.CreateStack(Material.EGG, (byte)0, 1, System.currentTimeMillis() + "Egg"));
|
||||
egg.setVelocity(new Vector((Math.random()-0.5)*0.3, Math.random()-0.4, (Math.random()-0.5)*0.3));
|
||||
|
||||
_eggs.add(egg);
|
||||
|
||||
block.getWorld().playSound(block.getLocation(), Sound.CHICKEN_EGG_POP, 0.25f + (float)Math.random() * 0.75f, 0.75f + (float)Math.random() * 0.5f);
|
||||
}
|
||||
|
||||
if (Math.random() > 0.95)
|
||||
{
|
||||
sendChestPackets(block);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void spawnPumpkinUpdate(UpdateEvent event)
|
||||
public void spawnSpecialBlockUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
return;
|
||||
|
||||
|
||||
if (Manager.GetGame() == null)
|
||||
return;
|
||||
|
||||
Game game = Manager.GetGame();
|
||||
|
||||
int requirement = (int)((double)Manager.GetPlayerFull() * 0.75d);
|
||||
int requirement = (int)((double)Manager.GetPlayerFull() * 0.5d);
|
||||
if (UtilServer.getPlayers().length < requirement)
|
||||
return;
|
||||
|
||||
|
||||
if (game.GetState() != GameState.Live)
|
||||
return;
|
||||
|
||||
if (!UtilTime.elapsed(_lastSpawn, 120000))
|
||||
if (!UtilTime.elapsed(_lastSpawn, 90000))
|
||||
return;
|
||||
|
||||
|
||||
if (Math.random() > 0.01)
|
||||
return;
|
||||
|
||||
@ -117,129 +192,200 @@ public class HolidayManager implements Listener
|
||||
for (int i=0 ; i< toDrop ; i++)
|
||||
{
|
||||
double interval = 1 / (double)(toDrop);
|
||||
|
||||
|
||||
if (Math.random() >= (i * interval)) // Diminishing per growth
|
||||
{
|
||||
spawnPumpkin(getPumpkinBlock(game));
|
||||
spawnSpecialBlock(findSpecialBlockLocation(game));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
_lastSpawn = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
private void spawnPumpkin(Block block)
|
||||
private void spawnSpecialBlock(Block block)
|
||||
{
|
||||
if (block == null)
|
||||
{
|
||||
System.out.println("Pumpkin: Could Not Find Suitable Block");
|
||||
System.out.println("Holiday Block: Could Not Find Suitable Block");
|
||||
return;
|
||||
}
|
||||
|
||||
block.setType(Material.PUMPKIN);
|
||||
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, Material.PUMPKIN);
|
||||
|
||||
block.setType(type.getBlockType());
|
||||
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, type.getBlockType());
|
||||
|
||||
if (type.getBlockType() == Material.CHEST)
|
||||
{
|
||||
sendChestPackets(block);
|
||||
}
|
||||
|
||||
_active.add(block);
|
||||
|
||||
System.out.println("Spawned Pumpkin: " + UtilWorld.locToStrClean(block.getLocation()));
|
||||
|
||||
System.out.println("Spawned Holiday Block: " + UtilWorld.locToStrClean(block.getLocation()));
|
||||
}
|
||||
|
||||
private void sendChestPackets(Block block)
|
||||
{
|
||||
PacketPlayOutBlockAction packet = new PacketPlayOutBlockAction(block.getX(), block.getY(), block.getZ(),
|
||||
CraftMagicNumbers.getBlock(block), 1, 1);
|
||||
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
((CraftPlayer) other).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
|
||||
private Block getPumpkinBlock(Game game)
|
||||
private Block findSpecialBlockLocation(Game game)
|
||||
{
|
||||
Block block = null;
|
||||
int attempts = 2000;
|
||||
while (attempts > 0)
|
||||
{
|
||||
attempts--;
|
||||
|
||||
|
||||
int x = game.WorldData.MinX + UtilMath.r(Math.abs(game.WorldData.MaxX - game.WorldData.MinX));
|
||||
int z = game.WorldData.MinZ + UtilMath.r(Math.abs(game.WorldData.MaxZ - game.WorldData.MinZ));
|
||||
|
||||
|
||||
block = UtilBlock.getHighest(game.WorldData.World, x, z, null);
|
||||
|
||||
|
||||
if (block.getLocation().getY() <= 2 || block.getLocation().getY() < game.WorldData.MinY || block.getLocation().getY() > game.WorldData.MaxY)
|
||||
continue;
|
||||
|
||||
|
||||
if (block.getRelative(BlockFace.DOWN).isLiquid())
|
||||
continue;
|
||||
|
||||
|
||||
if (!UtilBlock.airFoliage(block) || !UtilBlock.airFoliage(block.getRelative(BlockFace.UP)))
|
||||
continue;
|
||||
|
||||
|
||||
if (!UtilBlock.solid(block.getRelative(BlockFace.DOWN)))
|
||||
continue;
|
||||
|
||||
|
||||
boolean nextToChest = false;
|
||||
for (Block other : UtilBlock.getSurrounding(block, false))
|
||||
{
|
||||
if (other.getType() == Material.CHEST)
|
||||
nextToChest = true;
|
||||
}
|
||||
if (nextToChest)
|
||||
continue;
|
||||
|
||||
return block;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void pumpkinDamage(BlockDamageEvent event)
|
||||
public void specialBlockInteract(PlayerInteractEvent event)
|
||||
{
|
||||
if (_active.contains(event.getBlock()))
|
||||
{
|
||||
Manager.GetGame().AddStat(event.getPlayer(), "Pumpkins Smashed", 1, false, true);
|
||||
pumpkinBreak(event.getBlock());
|
||||
}
|
||||
if (UtilPlayer.isSpectator(event.getPlayer()))
|
||||
return;
|
||||
|
||||
if (!UtilEvent.isAction(event, ActionType.R_BLOCK))
|
||||
return;
|
||||
|
||||
if (event.getClickedBlock() == null)
|
||||
return;
|
||||
|
||||
if (event.getClickedBlock().getType() != Material.CHEST)
|
||||
return;
|
||||
|
||||
if (!_active.contains(event.getClickedBlock()))
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
specialBlockBreak(event.getClickedBlock());
|
||||
}
|
||||
|
||||
private void pumpkinBreak(Block block)
|
||||
@EventHandler
|
||||
public void specialBlockDamage(BlockDamageEvent event)
|
||||
{
|
||||
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, Material.PUMPKIN);
|
||||
block.setType(Material.AIR);
|
||||
if (UtilPlayer.isSpectator(event.getPlayer()))
|
||||
return;
|
||||
|
||||
if (!_active.contains(event.getBlock()))
|
||||
return;
|
||||
|
||||
specialBlockBreak(event.getBlock());
|
||||
}
|
||||
|
||||
private void specialBlockBreak(Block block)
|
||||
{
|
||||
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, type.getBlockType());
|
||||
block.setType(Material.AIR);
|
||||
|
||||
//Coins
|
||||
for (int i=0 ; i < 4 + Math.random()*16 ; i++)
|
||||
{
|
||||
Item coin = block.getWorld().dropItem(block.getLocation().add(0.5, 1, 0.5), new ItemStack(Material.getMaterial(175)));
|
||||
|
||||
Item coin = block.getWorld().dropItem(block.getLocation().add(0.5, 1, 0.5),
|
||||
ItemStackFactory.Instance.CreateStack(175, (byte)0, 1, UtilMath.r(999999) + "Coin"));
|
||||
|
||||
Vector vel = new Vector(
|
||||
(Math.random() - 0.5) * 0.5,
|
||||
0.1 + Math.random() * 0.3,
|
||||
(Math.random() - 0.5) * 0.5);
|
||||
|
||||
|
||||
coin.setVelocity(vel);
|
||||
|
||||
|
||||
coin.setPickupDelay(20);
|
||||
|
||||
|
||||
_coins.add(coin);
|
||||
}
|
||||
|
||||
|
||||
//Effect
|
||||
block.getWorld().playSound(block.getLocation(), Sound.ZOMBIE_REMEDY, 1f, 1f);
|
||||
block.getWorld().playSound(block.getLocation(), type.getBlockSound(), 1f, 1f);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void coinPickup(PlayerPickupItemEvent event)
|
||||
{
|
||||
if (_coins.contains(event.getItem()))
|
||||
if (UtilPlayer.isSpectator(event.getPlayer()))
|
||||
return;
|
||||
|
||||
if (_coins.contains(event.getItem()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
event.getItem().remove();
|
||||
|
||||
Manager.GetDonation().RewardCoins(null, "Halloween Pumpkin", event.getPlayer().getName(), Manager.GetClients().Get(event.getPlayer()).getAccountId(), 4 * event.getItem().getItemStack().getAmount());
|
||||
|
||||
|
||||
Manager.GetDonation().RewardCoins(null, type + " Coins", event.getPlayer().getName(), Manager.GetClients().Get(event.getPlayer()).getAccountId(), 4 * event.getItem().getItemStack().getAmount());
|
||||
|
||||
event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1f, 2f);
|
||||
}
|
||||
|
||||
else if (_eggs.contains(event.getItem()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void coinClean(UpdateEvent event)
|
||||
public void itemClean(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
|
||||
Iterator<Item> coinIterator = _coins.iterator();
|
||||
|
||||
|
||||
while (coinIterator.hasNext())
|
||||
{
|
||||
Item coin = coinIterator.next();
|
||||
|
||||
|
||||
if (!coin.isValid() || coin.getTicksLived() > 1200)
|
||||
{
|
||||
coin.remove();
|
||||
coinIterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
Iterator<Item> eggIterator = _eggs.iterator();
|
||||
|
||||
while (eggIterator.hasNext())
|
||||
{
|
||||
Item egg = eggIterator.next();
|
||||
|
||||
if (!egg.isValid() || egg.getTicksLived() > 40)
|
||||
{
|
||||
egg.remove();
|
||||
eggIterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user