Fixed pets and mounts not having any message when they are inside castle, fixed item despawning, stopped players from placing jukeboxes inside castle
This commit is contained in:
parent
e3521c06fd
commit
a37cf3b1c5
@ -13,7 +13,6 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.EntitySpawnEvent;
|
||||
import org.bukkit.event.entity.ItemDespawnEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
@ -36,6 +35,9 @@ import mineplex.core.gadget.gadgets.particle.king.types.King;
|
||||
import mineplex.core.gadget.gadgets.particle.king.types.Peasant;
|
||||
import mineplex.core.hologram.Hologram;
|
||||
import mineplex.core.hologram.HologramManager;
|
||||
import mineplex.core.mount.event.MountActivateEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
/**
|
||||
* Manages the castle in the main lobbies
|
||||
@ -644,17 +646,38 @@ public class CastleManager extends MiniPlugin
|
||||
* @param event
|
||||
*/
|
||||
@EventHandler
|
||||
public void onItemDespawn(ItemDespawnEvent event)
|
||||
public void onItemDespawn(UpdateEvent event)
|
||||
{
|
||||
if (_item != null)
|
||||
if (!isHub())
|
||||
return;
|
||||
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
if (_item == null)
|
||||
return;
|
||||
|
||||
if (!_item.isValid())
|
||||
{
|
||||
if (event.getEntity().equals(_item))
|
||||
{
|
||||
if (_item.getPassenger() != null)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
Location loc = _throneLocations[0].clone().add(0.5, 1, 0.5);
|
||||
loc.setYaw(90);
|
||||
loc.setPitch(0);
|
||||
Item item = loc.getWorld().dropItem(loc, new ItemStack(Material.WOOL, 1, (byte) 14));
|
||||
item.setPickupDelay(Integer.MAX_VALUE);
|
||||
item.setVelocity(new Vector(0, 0, 0));
|
||||
item.teleport(loc);
|
||||
item.setPassenger(_king.getKing());
|
||||
_item = item;
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onMount(MountActivateEvent event)
|
||||
{
|
||||
if (!isHub())
|
||||
return;
|
||||
|
||||
if (isInsideCastle(event.getPlayer().getLocation()))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,14 @@ public class MusicGadget extends Gadget
|
||||
UtilPlayer.message(player, F.main("Music", "There is already a song playing."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Inside castle
|
||||
if (Manager.getCastleManager().isInsideCastle(player.getLocation()))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Music", "Cannot play songs near Portals."));
|
||||
return;
|
||||
}
|
||||
|
||||
//Near Portal
|
||||
for (Block block : UtilBlock.getInRadius(player.getLocation(), 3).keySet())
|
||||
{
|
||||
|
@ -70,6 +70,7 @@ import mineplex.core.disguise.disguises.DisguiseVillager;
|
||||
import mineplex.core.disguise.disguises.DisguiseWither;
|
||||
import mineplex.core.disguise.disguises.DisguiseZombie;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.gadget.gadgets.particle.king.CastleManager;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.pet.repository.PetRepository;
|
||||
@ -96,6 +97,7 @@ public class PetManager extends MiniClientPlugin<PetClient>
|
||||
private DonationManager _donationManager;
|
||||
private CoreClientManager _clientManager;
|
||||
private InventoryManager _inventoryManager;
|
||||
private CastleManager _castleManager;
|
||||
|
||||
private Map<Entity, FlyingPetManager> _flyingPets = new HashMap<>();
|
||||
private Map<Entity, TrueLoveData> _trueLovePets = new HashMap<>();
|
||||
@ -108,7 +110,8 @@ public class PetManager extends MiniClientPlugin<PetClient>
|
||||
private ShapeWings _cupidWingsEdge = new ShapeWings(UtilParticle.ParticleType.RED_DUST.particleName, new Vector(0, 0, 0), 1, 0, true, ShapeWings.DEFAULT_ROTATION, ShapeWings.SMALL_HEART_WING_PATTERN);
|
||||
|
||||
public PetManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager
|
||||
, InventoryManager inventoryManager, DisguiseManager disguiseManager, mineplex.core.creature.Creature creatureModule, BlockRestore restore)
|
||||
, InventoryManager inventoryManager, DisguiseManager disguiseManager, mineplex.core.creature.Creature creatureModule, BlockRestore restore,
|
||||
CastleManager castleManager)
|
||||
{
|
||||
super("Pet Manager", plugin);
|
||||
|
||||
@ -213,6 +216,12 @@ public class PetManager extends MiniClientPlugin<PetClient>
|
||||
return;
|
||||
}
|
||||
|
||||
if (_castleManager.isInsideCastle(location))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Pets", "You cannot spawn a pet inside the castle!"));
|
||||
return;
|
||||
}
|
||||
|
||||
Entity pet;
|
||||
EntityType entityType = petType.getEntityType();
|
||||
|
||||
|
@ -23,6 +23,7 @@ import mineplex.core.disguise.DisguiseManager;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.elo.EloManager;
|
||||
import mineplex.core.friend.FriendManager;
|
||||
import mineplex.core.gadget.gadgets.particle.king.CastleManager;
|
||||
import mineplex.core.give.Give;
|
||||
import mineplex.core.globalpacket.GlobalPacketManager;
|
||||
import mineplex.core.hologram.HologramManager;
|
||||
@ -120,7 +121,9 @@ public class ClansHub extends JavaPlugin
|
||||
Creature creature = new Creature(this);
|
||||
NpcManager npcManager = new NpcManager(this, creature);
|
||||
InventoryManager inventoryManager = new InventoryManager(this, clientManager);
|
||||
PetManager petManager = new PetManager(this, clientManager, donationManager, inventoryManager, disguiseManager, creature, blockRestore);
|
||||
HologramManager hologramManager = new HologramManager(this, packetHandler);
|
||||
CastleManager castleManager = new CastleManager(this, clientManager, hologramManager, false);
|
||||
PetManager petManager = new PetManager(this, clientManager, donationManager, inventoryManager, disguiseManager, creature, blockRestore, castleManager);
|
||||
PollManager pollManager = new PollManager(this, clientManager, donationManager);
|
||||
|
||||
//Main Modules
|
||||
@ -153,8 +156,6 @@ public class ClansHub extends JavaPlugin
|
||||
BoosterManager boosterManager = new BoosterManager(this, "", clientManager, donationManager, inventoryManager, thankManager);
|
||||
HubManager hubManager = new HubManager(this, blockRestore, clientManager, incognito, donationManager, inventoryManager, condition, disguiseManager, new TaskManager(this, clientManager), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, new HologramManager(this, packetHandler), npcManager, packetHandler, punish, serverStatusManager, customDataManager, thankManager, boosterManager);
|
||||
|
||||
HologramManager hologramManager = new HologramManager(this, packetHandler);
|
||||
|
||||
ClansTransferManager serverManager = new ClansTransferManager(this, clientManager, donationManager, partyManager, portal, hubManager);
|
||||
|
||||
Chat chat = new Chat(this, incognito, clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName());
|
||||
|
@ -31,6 +31,7 @@ import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.elo.EloManager;
|
||||
import mineplex.core.energy.Energy;
|
||||
import mineplex.core.friend.FriendManager;
|
||||
import mineplex.core.gadget.gadgets.particle.king.CastleManager;
|
||||
import mineplex.core.give.Give;
|
||||
import mineplex.core.globalpacket.GlobalPacketManager;
|
||||
import mineplex.core.hologram.HologramManager;
|
||||
@ -138,12 +139,15 @@ public class Hub extends JavaPlugin implements IRelation
|
||||
|
||||
incognito.setPreferencesManager(preferenceManager);
|
||||
|
||||
HologramManager hologramManager = new HologramManager(this, packetHandler);
|
||||
|
||||
preferenceManager.GiveItem = true;
|
||||
Creature creature = new Creature(this);
|
||||
NpcManager npcManager = new NpcManager(this, creature);
|
||||
_npcManager = npcManager;
|
||||
InventoryManager inventoryManager = new InventoryManager(this, clientManager);
|
||||
PetManager petManager = new PetManager(this, clientManager, donationManager, inventoryManager, disguiseManager, creature, blockRestore);
|
||||
CastleManager castleManager = new CastleManager(this, clientManager, hologramManager, false);
|
||||
PetManager petManager = new PetManager(this, clientManager, donationManager, inventoryManager, disguiseManager, creature, blockRestore, castleManager);
|
||||
PollManager pollManager = new PollManager(this, clientManager, donationManager);
|
||||
//new TournamentManager(this, clientManager, donationManager);
|
||||
|
||||
@ -181,7 +185,6 @@ public class Hub extends JavaPlugin implements IRelation
|
||||
ThankManager thankManager = new ThankManager(this, clientManager, donationManager);
|
||||
BoosterManager boosterManager = new BoosterManager(this, boosterGroup, clientManager, donationManager, inventoryManager, thankManager);
|
||||
HubManager hubManager = new HubManager(this, blockRestore, clientManager, incognito, donationManager, inventoryManager, conditionManager, disguiseManager, new TaskManager(this, clientManager), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, new HologramManager(this, packetHandler), npcManager, personalServerManager, packetHandler, punish, serverStatusManager, customDataManager, thankManager, boosterManager);
|
||||
HologramManager hologramManager = new HologramManager(this, packetHandler);
|
||||
|
||||
QueueManager queueManager = new QueueManager(this, clientManager, donationManager, eloManager, partyManager);
|
||||
ServerManager serverManager = new ServerManager(this, clientManager, donationManager, portal, partyManager, serverStatusManager, hubManager, queueManager, boosterManager);
|
||||
|
@ -201,9 +201,9 @@ public class Arcade extends JavaPlugin
|
||||
|
||||
//Inventory
|
||||
InventoryManager inventoryManager = new InventoryManager(this, _clientManager);
|
||||
PetManager petManager = new PetManager(this, _clientManager, _donationManager, inventoryManager, disguiseManager, creature, blockRestore);
|
||||
MountManager mountManager = new MountManager(this, _clientManager, _donationManager, blockRestore, disguiseManager);
|
||||
CastleManager castleManager = new CastleManager(this, _clientManager, hologramManager, false);
|
||||
PetManager petManager = new PetManager(this, _clientManager, _donationManager, inventoryManager, disguiseManager, creature, blockRestore, castleManager);
|
||||
MountManager mountManager = new MountManager(this, _clientManager, _donationManager, blockRestore, disguiseManager);
|
||||
GadgetManager gadgetManager = new GadgetManager(this, _clientManager, _donationManager, inventoryManager, mountManager, petManager, preferenceManager, disguiseManager, blockRestore, projectileManager, achievementManager, packetHandler, hologramManager, incognito, castleManager);
|
||||
ThankManager thankManager = new ThankManager(this, _clientManager, _donationManager);
|
||||
BoosterManager boosterManager = new BoosterManager(this, _serverConfiguration.getServerGroup().getBoosterGroup(), _clientManager, _donationManager, inventoryManager, thankManager);
|
||||
|
@ -127,10 +127,10 @@ public class Hub extends JavaPlugin
|
||||
ServerConfiguration serverConfiguration = new ServerConfiguration(this, _clientManager);
|
||||
|
||||
// Inventory
|
||||
InventoryManager inventoryManager = new InventoryManager(this, _clientManager);
|
||||
PetManager petManager = new PetManager(this, _clientManager, _donationManager, inventoryManager, disguiseManager, creature, blockRestore);
|
||||
MountManager mountManager = new MountManager(this, _clientManager, _donationManager, blockRestore, disguiseManager);
|
||||
CastleManager castleManager = new CastleManager(this, _clientManager, hologramManager, false);
|
||||
InventoryManager inventoryManager = new InventoryManager(this, _clientManager);
|
||||
PetManager petManager = new PetManager(this, _clientManager, _donationManager, inventoryManager, disguiseManager, creature, blockRestore, castleManager);
|
||||
MountManager mountManager = new MountManager(this, _clientManager, _donationManager, blockRestore, disguiseManager);
|
||||
GadgetManager gadgetManager = new GadgetManager(this, _clientManager, _donationManager, inventoryManager, mountManager, petManager,
|
||||
preferenceManager, disguiseManager, blockRestore, projectileManager, achievementManager, packetHandler, hologramManager, incognito, castleManager);
|
||||
ThankManager thankManager = new ThankManager(this, _clientManager, _donationManager);
|
||||
|
@ -250,10 +250,10 @@ public class GemHunters extends JavaPlugin
|
||||
|
||||
// Gadgets, used for mounts, lots of managers for something really small
|
||||
// :(
|
||||
MountManager mountManager = new MountManager(this, clientManager, donationManager, blockRestore, disguiseManager);
|
||||
PetManager petManager = new PetManager(this, clientManager, donationManager, inventoryManager, disguiseManager, creature, blockRestore);
|
||||
ProjectileManager projectileManager = new ProjectileManager(this);
|
||||
CastleManager castleManager = new CastleManager(this, clientManager, hologramManager, false);
|
||||
MountManager mountManager = new MountManager(this, clientManager, donationManager, blockRestore, disguiseManager);
|
||||
PetManager petManager = new PetManager(this, clientManager, donationManager, inventoryManager, disguiseManager, creature, blockRestore, castleManager);
|
||||
ProjectileManager projectileManager = new ProjectileManager(this);
|
||||
GadgetManager gadgetManager = new GadgetManager(this, clientManager, donationManager, inventoryManager, mountManager, petManager, preferenceManager, disguiseManager, blockRestore, projectileManager, achievementManager, packetHandler, hologramManager, incognito, castleManager);
|
||||
ThankManager thankManager = new ThankManager(this, clientManager, donationManager);
|
||||
BoosterManager boosterManager = new BoosterManager(this, null, clientManager, donationManager, inventoryManager, thankManager);
|
||||
|
Loading…
Reference in New Issue
Block a user