Merge remote-tracking branch 'refs/remotes/origin/develop' into update/hub-makeover
This commit is contained in:
commit
153d5bdc63
@ -0,0 +1,12 @@
|
||||
package mineplex.core.disguise.disguises;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
public class DisguiseGhast extends DisguiseCreature
|
||||
{
|
||||
public DisguiseGhast(Entity entity)
|
||||
{
|
||||
super(EntityType.GHAST, entity);
|
||||
}
|
||||
}
|
@ -149,6 +149,7 @@ import mineplex.core.gadget.gadgets.morph.MorphCreeper;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphDinnerbone;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphEnderman;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphFreedomFighter;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphGhast;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphGoldPot;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphGrimReaper;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphLoveDoctor;
|
||||
@ -568,6 +569,7 @@ public class GadgetManager extends MiniPlugin
|
||||
addGadget(new MorphLarissa(this));
|
||||
addGadget(new MorphBiff(this));
|
||||
addGadget(new MorphIvy(this));
|
||||
addGadget(new MorphGhast(this));
|
||||
|
||||
// Mounts
|
||||
addGadget(new MountUndead(this));
|
||||
|
@ -0,0 +1,159 @@
|
||||
package mineplex.core.gadget.gadgets.morph;
|
||||
|
||||
import java.time.Month;
|
||||
import java.time.YearMonth;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.LargeFireball;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.LineFormat;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
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.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.disguise.disguises.DisguiseGhast;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
||||
import mineplex.core.gadget.types.MorphGadget;
|
||||
import mineplex.core.gadget.util.CostConstants;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class MorphGhast extends MorphGadget
|
||||
{
|
||||
|
||||
private static final Vector UP = new Vector(0, 1.5, 0);
|
||||
|
||||
private final Set<LargeFireball> _fireballs = new HashSet<>();
|
||||
|
||||
public MorphGhast(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Ghast Morph", UtilText.splitLinesToArray(new String[]{
|
||||
C.cGray + "A never before seen morph, the very spooky Ghast!",
|
||||
"",
|
||||
C.cGreen + "Left Click" + C.cWhite + " to shoot a fireball",
|
||||
}, LineFormat.LORE), CostConstants.POWERPLAY_BONUS, Material.GLASS, (byte) 0);
|
||||
|
||||
setPPCYearMonth(YearMonth.of(2017, Month.OCTOBER));
|
||||
setDisplayItem(new ItemBuilder(Material.SKULL_ITEM, (byte) 3)
|
||||
.setPlayerHead("MHF_Ghast")
|
||||
.build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableCustom(Player player, boolean message)
|
||||
{
|
||||
applyArmor(player, message);
|
||||
|
||||
UtilMorph.disguise(player, new DisguiseGhast(player), Manager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCustom(Player player, boolean message)
|
||||
{
|
||||
removeArmor(player);
|
||||
|
||||
player.setAllowFlight(false);
|
||||
player.setFlying(false);
|
||||
|
||||
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void interact(PlayerInteractEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!UtilEvent.isAction(event, ActionType.L) || !isActive(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
if (!Recharge.Instance.use(player, "Fireball", 4000, true, true, "Cosmetics"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Sound sound;
|
||||
int random = UtilMath.r(3);
|
||||
|
||||
if (random == 0)
|
||||
{
|
||||
sound = Sound.GHAST_SCREAM;
|
||||
}
|
||||
else if (random == 1)
|
||||
{
|
||||
sound = Sound.GHAST_SCREAM2;
|
||||
}
|
||||
else
|
||||
{
|
||||
sound = Sound.GHAST_FIREBALL;
|
||||
}
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), sound, 1, (float) (0.7 + Math.random() / 2));
|
||||
|
||||
LargeFireball fireball = player.launchProjectile(LargeFireball.class);
|
||||
_fireballs.add(fireball);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void flight(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (Player player : getActive())
|
||||
{
|
||||
if (UtilPlayer.isSpectator(player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
player.setAllowFlight(true);
|
||||
player.setFlying(true);
|
||||
|
||||
if (UtilEnt.isGrounded(player))
|
||||
{
|
||||
UtilAction.velocity(player, UP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void projectileHit(ProjectileHitEvent event)
|
||||
{
|
||||
if (!_fireballs.contains(event.getEntity()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (Player player : UtilPlayer.getNearby(event.getEntity().getLocation(), 5))
|
||||
{
|
||||
player.setVelocity(UP);
|
||||
}
|
||||
|
||||
UtilParticle.PlayParticleToAll(ParticleType.LAVA, event.getEntity().getLocation().add(0, 0.8, 0), 0.5F, 0.5F, 0.5F, 0.01F, 6, ViewDist.NORMAL);
|
||||
event.getEntity().remove();
|
||||
}
|
||||
}
|
@ -42,6 +42,7 @@ public class PowerPlayClubRewards
|
||||
.put(YearMonth.of(2017, Month.JULY), new UnknownSalesPackageItem("Freedom Fighter"))
|
||||
.put(YearMonth.of(2017, Month.AUGUST), new UnknownSalesPackageItem("Melonhead Morph"))
|
||||
.put(YearMonth.of(2017, Month.SEPTEMBER), new UnknownSalesPackageItem("Tornado"))
|
||||
.put(YearMonth.of(2017, Month.OCTOBER), new UnknownSalesPackageItem("Ghast Morph"))
|
||||
.build();
|
||||
|
||||
public interface PowerPlayClubItem
|
||||
|
@ -1333,6 +1333,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
||||
_restartManager.onDisable();
|
||||
_observerManager.onDisable();
|
||||
Managers.get(MountManager.class).onDisable();
|
||||
Managers.get(SupplyDropManager.class).onDisable();
|
||||
ServerOfflineMessage message = new ServerOfflineMessage();
|
||||
message.ServerName = UtilServer.getServerName();
|
||||
ClansQueueMessenger.getMessenger(UtilServer.getServerName()).transmitMessage(message, QueueConstant.SERVICE_MESSENGER_IDENTIFIER);
|
||||
|
@ -116,7 +116,6 @@ public class SupplyDrop
|
||||
private void placeChest()
|
||||
{
|
||||
_block.setType(Material.CHEST);
|
||||
|
||||
ClansManager.getInstance().runSyncLater(() ->
|
||||
{
|
||||
Chest chest = (Chest) _block.getState();
|
||||
@ -128,7 +127,8 @@ public class SupplyDrop
|
||||
{
|
||||
inventory.setItem(i++, item);
|
||||
}
|
||||
_block.setMetadata(SUPPLY_DROP_FILLED_METADATA, new FixedMetadataValue(UtilServer.getPlugin(), true));
|
||||
chest.update(true);
|
||||
chest.setMetadata(SUPPLY_DROP_FILLED_METADATA, new FixedMetadataValue(UtilServer.getPlugin(), true));
|
||||
}, 5);
|
||||
}
|
||||
|
||||
@ -213,7 +213,7 @@ public class SupplyDrop
|
||||
|
||||
if (getTicks() >= REMOVE_TICKS)
|
||||
{
|
||||
finish();
|
||||
finish(false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -221,7 +221,7 @@ public class SupplyDrop
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void finish()
|
||||
public void finish(boolean onDisable)
|
||||
{
|
||||
_ended = true;
|
||||
_hologram.stop();
|
||||
@ -229,6 +229,14 @@ public class SupplyDrop
|
||||
{
|
||||
_below[i].setTypeIdAndData(_oldBelow[i].getLeft().getId(), _oldBelow[i].getRight(), false);
|
||||
}
|
||||
_block.breakNaturally();
|
||||
_block.removeMetadata(SUPPLY_DROP_FILLED_METADATA, UtilServer.getPlugin());
|
||||
if (onDisable)
|
||||
{
|
||||
_block.setType(Material.AIR);
|
||||
}
|
||||
else
|
||||
{
|
||||
_block.breakNaturally();
|
||||
}
|
||||
}
|
||||
}
|
@ -60,6 +60,15 @@ public class SupplyDropManager extends MiniPlugin
|
||||
_shop = new SupplyDropShop(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disable()
|
||||
{
|
||||
if (_active != null)
|
||||
{
|
||||
_active.finish(true);
|
||||
}
|
||||
}
|
||||
|
||||
public SupplyDropShop getShop()
|
||||
{
|
||||
return _shop;
|
||||
@ -99,6 +108,7 @@ public class SupplyDropManager extends MiniPlugin
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (new BlockPosition(event.getClickedBlock()).equals(_active.getPosition()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
@ -114,7 +124,7 @@ public class SupplyDropManager extends MiniPlugin
|
||||
{
|
||||
return;
|
||||
}
|
||||
_active.finish();
|
||||
_active.finish(false);
|
||||
_active = null;
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ import com.mineplex.clansqueue.common.ClansQueueMessenger;
|
||||
import com.mineplex.clansqueue.common.QueueConstant;
|
||||
import com.mineplex.clansqueue.common.messages.ServerOfflineMessage;
|
||||
|
||||
import mineplex.core.Managers;
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.permissions.Permission;
|
||||
import mineplex.core.account.permissions.PermissionGroup;
|
||||
@ -36,6 +37,7 @@ import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.RestartServerEvent;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.clans.supplydrop.SupplyDropManager;
|
||||
import mineplex.game.clans.gameplay.safelog.npc.NPCManager;
|
||||
import net.minecraft.server.v1_8_R3.MinecraftServer;
|
||||
|
||||
@ -120,6 +122,10 @@ public class RestartManager extends MiniPlugin
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (Managers.get(SupplyDropManager.class).hasActiveSupplyDrop())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user