Bug fixes

This commit is contained in:
Sam 2017-08-31 16:08:53 +01:00
parent 9f24a0ecb9
commit 316ad132b4
12 changed files with 386 additions and 105 deletions

View File

@ -0,0 +1,5 @@
package mineplex.core.achievement.profile;
public class ProfileMainPage
{
}

View File

@ -0,0 +1,257 @@
package mineplex.core.achievement.profile;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import com.mojang.authlib.GameProfile;
import mineplex.core.MiniPlugin;
import mineplex.core.ReflectivelyCreateMiniPlugin;
import mineplex.core.account.CoreClient;
import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.Achievement;
import mineplex.core.achievement.AchievementManager;
import mineplex.core.achievement.leveling.LevelingManager;
import mineplex.core.achievement.leveling.rewards.LevelReward;
import mineplex.core.common.Rank;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.skin.SkinData;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilTime;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.disguise.disguises.DisguisePlayer;
import mineplex.core.donation.DonationManager;
import mineplex.core.donation.Donor;
import mineplex.core.friend.FriendManager;
import mineplex.core.friend.data.FriendStatus;
import mineplex.core.hologram.Hologram;
import mineplex.core.hologram.Hologram.HologramTarget;
import mineplex.core.newnpc.NPC;
import mineplex.core.newnpc.NewNPCManager;
import mineplex.core.quests.Quest;
import mineplex.core.quests.QuestClientData;
import mineplex.core.quests.QuestManager;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.utils.UtilGameProfile;
@ReflectivelyCreateMiniPlugin
public class ProfileManager extends MiniPlugin
{
private static final String NPC_METADATA = "PROFILE";
private final AchievementManager _achievementManager;
private final CoreClientManager _clientManager;
private final DisguiseManager _disguiseManager;
private final DonationManager _donationManager;
private final FriendManager _friendManager;
private final LevelingManager _levelingManager;
private final NewNPCManager _npcManager;
private final QuestManager _questManager;
private final Map<Player, Hologram> _hologramMap;
private final List<Function<Player, String>> _rotationLines;
private int _lineIndex;
private NPC _profileNPC;
private ProfileManager()
{
super("Profile");
_achievementManager = require(AchievementManager.class);
_clientManager = require(CoreClientManager.class);
_disguiseManager = require(DisguiseManager.class);
_donationManager = require(DonationManager.class);
_friendManager = require(FriendManager.class);
_levelingManager = require(LevelingManager.class);
_npcManager = require(NewNPCManager.class);
_questManager = require(QuestManager.class);
_hologramMap = new HashMap<>();
_rotationLines = Arrays.asList(
// Achievements
player ->
{
int completed = 0;
for (Achievement achievement : Achievement.values())
{
if (_achievementManager.get(player, achievement).getLevel() >= achievement.getMaxLevel())
{
completed++;
}
}
return "Achievements: " + C.cYellow + completed + C.cGray + "/" + C.cGreen + Achievement.values().length;
},
// Friends
player ->
{
int online = 0;
int total = 0;
for (FriendStatus status : _friendManager.Get(player).getFriends())
{
if (status.Online)
{
online++;
}
total++;
}
return "Friends: " + C.cYellow + online + C.cGray + "/" + C.cGreen + total;
},
// Missions
player ->
{
QuestClientData data = _questManager.Get(player);
int available = 5;
long questExpire = TimeUnit.DAYS.toMillis(1);
for (int id : _questManager.getCurrentQuests())
{
if (data.getQuestFromAll(id) == null)
{
continue;
}
Quest quest = data.getQuestFromAll(id);
if (quest.isActive())
{
available--;
}
if (!UtilTime.elapsed(quest.getLastCompleted(), questExpire))
{
available--;
}
}
return "Missions: " + C.cYellow + available + C.cGreen + " Available";
},
// Level Rewards
player ->
{
int available = 0;
for (Entry<Integer, LevelReward> entry : _levelingManager.getLevelRewards())
{
if (_levelingManager.canClaim(player, entry.getKey()) && !_levelingManager.hasClaimed(player, entry.getKey()))
{
available++;
}
}
return "Level Rewards: " + C.cYellow + available + C.cGreen + " Available";
}
);
spawnNPC();
}
private void spawnNPC()
{
_npcManager.spawnNPCs(NPC_METADATA, npc -> _profileNPC = npc);
}
@EventHandler
public void playerJoin(PlayerJoinEvent event)
{
if (_profileNPC == null)
{
return;
}
runSyncLater(() ->
{
Player player = event.getPlayer();
GameProfile profile = UtilGameProfile.getGameProfile(player);
try
{
UtilGameProfile.changeId(profile, UUID.randomUUID());
UtilGameProfile.changeName(profile, SkinData.getUnusedSkullName());
}
catch (ReflectiveOperationException e)
{
e.printStackTrace();
return;
}
DisguisePlayer playerDisguise = new DisguisePlayer(_profileNPC.getEntity(), profile);
playerDisguise.getHologram()
.setHologramTarget(HologramTarget.WHITELIST)
.addPlayer(player);
_hologramMap.put(player, playerDisguise.getHologram());
updateHologram(player, playerDisguise.getHologram());
_disguiseManager.disguise(playerDisguise, viewer -> viewer.equals(player));
}, 20);
}
@EventHandler
public void playerQuit(PlayerQuitEvent event)
{
_hologramMap.remove(event.getPlayer()).stop();
}
@EventHandler
public void updateHologram(UpdateEvent event)
{
if (event.getType() != UpdateType.SLOW || _profileNPC == null)
{
return;
}
World world = _profileNPC.getEntity().getWorld();
_hologramMap.forEach((player, hologram) ->
{
if (!player.getWorld().equals(world))
{
return;
}
updateHologram(player, hologram);
});
if (++_lineIndex == _rotationLines.size())
{
_lineIndex = 0;
}
}
private void updateHologram(Player player, Hologram hologram)
{
CoreClient client = _clientManager.Get(player);
Donor donor = _donationManager.Get(player);
Function<Player, String> line = _rotationLines.get(_lineIndex);
hologram.setText(
C.cGoldB + "MY PROFILE",
"Rank: " + client.GetRank(true).getTag(true, true),
"Gems: " + C.cGreen + donor.getBalance(GlobalCurrency.GEM),
"Shards: " + C.cAqua + donor.getBalance(GlobalCurrency.TREASURE_SHARD),
"Level: " + Achievement.getExperienceString(_achievementManager.getMineplexLevelNumber(player, Rank.ALL)),
line.apply(player)
);
}
}

View File

@ -0,0 +1,24 @@
package mineplex.core.achievement.profile;
import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.AchievementManager;
import mineplex.core.donation.DonationManager;
import mineplex.core.shop.ShopBase;
import mineplex.core.shop.page.ShopPageBase;
public class ProfileShop extends ShopBase<AchievementManager>
{
public ProfileShop(AchievementManager plugin, CoreClientManager clientManager, DonationManager donationManager, String name)
{
super(plugin, clientManager, donationManager, name);
}
@Override
protected ShopPageBase<AchievementManager, ? extends ShopBase<AchievementManager>> buildPagesFor(Player player)
{
return null;
}
}

View File

@ -366,7 +366,7 @@ public class Hologram {
if (_hideBoundingBox) if (_hideBoundingBox)
{ {
DataWatcher watcher = packet.l; DataWatcher watcher = packet.l;
packet.d = (int) ((getLocation().getY() + ((double) textRow * 0.285)) * 32); packet.d = (int) ((getLocation().getY() + ((double) textRow * 0.31)) * 32);
watcher.a(10, (byte) 16, EntityArmorStand.META_ARMOR_OPTION, (byte) 16); watcher.a(10, (byte) 16, EntityArmorStand.META_ARMOR_OPTION, (byte) 16);
} }
@ -384,7 +384,7 @@ public class Hologram {
packet.a = entityId; packet.a = entityId;
packet.b = 30; packet.b = 30;
packet.c = (int) (getLocation().getX() * 32); packet.c = (int) (getLocation().getX() * 32);
packet.d = (int) ((getLocation().getY() - 2.1 + ((double) textRow * 0.285)) * 32); packet.d = (int) ((getLocation().getY() - 2.1 + ((double) textRow * 0.31)) * 32);
packet.e = (int) (getLocation().getZ() * 32); packet.e = (int) (getLocation().getZ() * 32);
packet.l = watcher; packet.l = watcher;
packet.uuid = UUID.randomUUID(); packet.uuid = UUID.randomUUID();
@ -537,7 +537,7 @@ public class Hologram {
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(); PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport();
teleportPacket.a = entityId; teleportPacket.a = entityId;
teleportPacket.b = x; teleportPacket.b = x;
teleportPacket.c = (int) Math.floor((oldLocation.getY() + (-2.1) + ((double) i * 0.285)) * 32); teleportPacket.c = (int) Math.floor((oldLocation.getY() + (-2.1) + ((double) i * 0.31)) * 32);
teleportPacket.d = z; teleportPacket.d = z;
packets1_9[i] = teleportPacket; packets1_9[i] = teleportPacket;

View File

@ -1,12 +1,15 @@
package mineplex.core.imagemap; package mineplex.core.imagemap;
import mineplex.core.MiniPlugin; import javax.imageio.ImageIO;
import mineplex.core.ReflectivelyCreateMiniPlugin; import java.awt.image.BufferedImage;
import mineplex.core.common.util.UtilBlock; import java.io.File;
import mineplex.core.imagemap.objects.PlayerMapBoard; import java.io.IOException;
import mineplex.core.imagemap.objects.PlayerMapImage; import java.net.URL;
import mineplex.core.updater.UpdateType; import java.util.ArrayList;
import mineplex.core.updater.event.UpdateEvent; import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -18,15 +21,14 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import javax.imageio.ImageIO; import mineplex.core.MiniPlugin;
import java.awt.image.BufferedImage; import mineplex.core.ReflectivelyCreateMiniPlugin;
import java.io.File; import mineplex.core.common.util.UtilBlock;
import java.io.IOException; import mineplex.core.imagemap.objects.MapImage;
import java.net.URL; import mineplex.core.imagemap.objects.PlayerMapBoard;
import java.util.ArrayList; import mineplex.core.imagemap.objects.PlayerMapImage;
import java.util.HashMap; import mineplex.core.updater.UpdateType;
import java.util.List; import mineplex.core.updater.event.UpdateEvent;
import java.util.Map;
@ReflectivelyCreateMiniPlugin @ReflectivelyCreateMiniPlugin
public class ImageMapManager extends MiniPlugin public class ImageMapManager extends MiniPlugin
@ -82,6 +84,33 @@ public class ImageMapManager extends MiniPlugin
_boards.forEach(PlayerMapBoard::onRefresh); _boards.forEach(PlayerMapBoard::onRefresh);
} }
public MapImage createBoard(Location topLeft, BlockFace direction, int width, int height, String image)
{
BufferedImage bufferedImage = getImage(new File(IMAGE_DIR + File.separator + image));
return createBoard(topLeft, direction, width, height, bufferedImage);
}
public MapImage createBoard(Location topLeft, BlockFace direction, int width, int height, File image)
{
BufferedImage bufferedImage = getImage(image);
return createBoard(topLeft, direction, width, height, bufferedImage);
}
public MapImage createBoard(Location topLeft, BlockFace direction, int width, int height, URL image)
{
BufferedImage bufferedImage = getImage(image);
return createBoard(topLeft, direction, width, height, bufferedImage);
}
public MapImage createBoard(Location topLeft, BlockFace direction, int width, int height, BufferedImage image)
{
List<ItemFrame> itemFrames = createItemFrames(topLeft, direction, width, height);
MapImage mapImage = new MapImage(image, itemFrames, width, height);
mapImage.create();
return mapImage;
}
public PlayerMapBoard createPlayerBoard(Location topLeft, BlockFace direction, int width, int height, String... images) public PlayerMapBoard createPlayerBoard(Location topLeft, BlockFace direction, int width, int height, String... images)
{ {
BufferedImage[] bufferedImages = new BufferedImage[images.length]; BufferedImage[] bufferedImages = new BufferedImage[images.length];

View File

@ -1,15 +1,16 @@
package mineplex.core.imagemap.objects; package mineplex.core.imagemap.objects;
import mineplex.core.common.util.UtilServer; import java.awt.image.BufferedImage;
import mineplex.core.imagemap.CustomItemFrames; import java.util.ArrayList;
import java.util.List;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.ItemFrame; import org.bukkit.entity.ItemFrame;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import java.awt.image.BufferedImage; import mineplex.core.common.util.UtilServer;
import java.util.ArrayList; import mineplex.core.imagemap.CustomItemFrames;
import java.util.List;
public class PlayerMapImage extends MapImage public class PlayerMapImage extends MapImage
{ {

View File

@ -11,9 +11,7 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.inventory.EntityEquipment; import org.bukkit.inventory.EntityEquipment;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilServer;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.newnpc.event.NPCSpawnEvent;
import mineplex.serverdata.database.column.Column; import mineplex.serverdata.database.column.Column;
import mineplex.serverdata.database.column.ColumnDouble; import mineplex.serverdata.database.column.ColumnDouble;
import mineplex.serverdata.database.column.ColumnInt; import mineplex.serverdata.database.column.ColumnInt;
@ -51,11 +49,13 @@ public class NPC
public LivingEntity spawnEntity() public LivingEntity spawnEntity()
{ {
_spawn.getChunk().load(true);
LivingEntity entity = (LivingEntity) _spawn.getWorld().spawnEntity(_spawn, _entityType); LivingEntity entity = (LivingEntity) _spawn.getWorld().spawnEntity(_spawn, _entityType);
entity.setCanPickupItems(false);
entity.setRemoveWhenFarAway(false); entity.setRemoveWhenFarAway(false);
entity.setCustomName(ChatColor.translateAlternateColorCodes('&', _name)); entity.setCustomName(ChatColor.translateAlternateColorCodes('&', _name));
entity.setCustomNameVisible(true); entity.setCustomNameVisible(!_name.equals("NULL"));
EntityEquipment equipment = entity.getEquipment(); EntityEquipment equipment = entity.getEquipment();
@ -84,17 +84,9 @@ public class NPC
UtilEnt.setFakeHead(entity, true); UtilEnt.setFakeHead(entity, true);
UtilEnt.CreatureLook(entity, _spawn.getPitch(), _spawn.getYaw()); UtilEnt.CreatureLook(entity, _spawn.getPitch(), _spawn.getYaw());
UtilEnt.ghost(entity, true, false); UtilEnt.ghost(entity, true, false);
UtilEnt.silence(entity, true);
_entity = entity; _entity = entity;
NPCSpawnEvent spawnEvent = new NPCSpawnEvent(this);
UtilServer.CallEvent(spawnEvent);
if (spawnEvent.isCancelled())
{
entity.remove();
return null;
}
return entity; return entity;
} }
@ -135,8 +127,8 @@ public class NPC
new ColumnVarChar("leggings", 32, _leggings == null ? "NULL" : _leggings.name()), new ColumnVarChar("leggings", 32, _leggings == null ? "NULL" : _leggings.name()),
new ColumnVarChar("boots", 32, _boots == null ? "NULL" : _boots.name()), new ColumnVarChar("boots", 32, _boots == null ? "NULL" : _boots.name()),
new ColumnVarChar("metadata", 32, _metadata), new ColumnVarChar("metadata", 32, _metadata),
new ColumnVarChar("skinValue", 300, "NULL"), new ColumnVarChar("skinValue", 400, "NULL"),
new ColumnVarChar("skinSignature", 300, "NULL") new ColumnVarChar("skinSignature", 700, "NULL")
); );
} }
} }

View File

@ -8,7 +8,6 @@ import java.util.Map;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
@ -67,8 +66,9 @@ public class NewNPCManager extends MiniPlugin
private void loadNPCs() private void loadNPCs()
{ {
runAsync(() -> _repository.getNPCs(npcs -> runSync(() -> _repository.getNPCs(npcs ->
_npcs.forEach(npc -> {
npcs.forEach(npc ->
{ {
if (_npcs.contains(npc)) if (_npcs.contains(npc))
{ {
@ -76,8 +76,8 @@ public class NewNPCManager extends MiniPlugin
} }
_npcs.add(npc); _npcs.add(npc);
}) });
))); });
} }
public void spawnNPCs(String metadata, Consumer<NPC> after) public void spawnNPCs(String metadata, Consumer<NPC> after)
@ -245,12 +245,12 @@ public class NewNPCManager extends MiniPlugin
player.sendMessage(F.main(_moduleName, "Creating your NPC...")); player.sendMessage(F.main(_moduleName, "Creating your NPC..."));
runSync(() -> builder.build(player, this)); runSync(() -> builder.build(player, this));
player.sendMessage(F.main(_moduleName, "Created your NPC!")); player.sendMessage(F.main(_moduleName, "Created your NPC!"));
_builders.remove(player);
} }
@EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.LOWEST)
public void npcInteract(NPCInteractEvent event) public void npcInteract(NPCInteractEvent event)
{ {
Bukkit.broadcastMessage(event.getEventName());
Player player = event.getPlayer(); Player player = event.getPlayer();
if (Recharge.Instance.usable(player, NPCDeleteCommand.RECHARGE_KEY)) if (Recharge.Instance.usable(player, NPCDeleteCommand.RECHARGE_KEY))
@ -315,6 +315,7 @@ public class NewNPCManager extends MiniPlugin
if (npc != null) if (npc != null)
{ {
event.setCancelled(true);
callInteractEvent(event.getPlayer(), npc, false); callInteractEvent(event.getPlayer(), npc, false);
} }
} }
@ -333,8 +334,7 @@ public class NewNPCManager extends MiniPlugin
private List<NPC> getUnloadedNPCs(String metadata) private List<NPC> getUnloadedNPCs(String metadata)
{ {
return _npcs.stream() return _npcs.stream()
.filter(npc -> !npc.getMetadata().equals(metadata)) .filter(npc -> npc.getMetadata().equals(metadata) && npc.getEntity() == null)
.filter(npc -> npc.getEntity() == null)
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
@ -342,7 +342,7 @@ public class NewNPCManager extends MiniPlugin
{ {
for (NPC npc : _npcs) for (NPC npc : _npcs)
{ {
if (npc.getEntity().equals(entity)) if (npc.getEntity() != null && npc.getEntity().equals(entity))
{ {
return npc; return npc;
} }

View File

@ -40,9 +40,9 @@ class NewNPCRepository extends RepositoryBase
EntityType entityType = EntityType.valueOf(resultSet.getString("entity_type")); EntityType entityType = EntityType.valueOf(resultSet.getString("entity_type"));
String name = resultSet.getString("name"); String name = resultSet.getString("name");
String worldName = resultSet.getString("world"); String worldName = resultSet.getString("world");
int x = resultSet.getInt("x"); double x = resultSet.getDouble("x");
int y = resultSet.getInt("y"); double y = resultSet.getDouble("y");
int z = resultSet.getInt("z"); double z = resultSet.getDouble("z");
int yaw = resultSet.getInt("yaw"); int yaw = resultSet.getInt("yaw");
int pitch = resultSet.getInt("pitch"); int pitch = resultSet.getInt("pitch");
Material inHand = parseMaterial(resultSet.getString("in_hand")); Material inHand = parseMaterial(resultSet.getString("in_hand"));

View File

@ -26,6 +26,8 @@ public class PlayerNPC extends NPC
private final SkinData _skinData; private final SkinData _skinData;
private DisguisePlayer _disguise;
public PlayerNPC(int id, EntityType entityType, String name, Location spawn, Material inHand, Material helmet, Material chestplate, Material leggings, Material boots, String metadata, String skinValue, String skinSignature) public PlayerNPC(int id, EntityType entityType, String name, Location spawn, Material inHand, Material helmet, Material chestplate, Material leggings, Material boots, String metadata, String skinValue, String skinSignature)
{ {
super(id, entityType, name, spawn, inHand, helmet, chestplate, leggings, boots, metadata); super(id, entityType, name, spawn, inHand, helmet, chestplate, leggings, boots, metadata);
@ -56,6 +58,8 @@ public class PlayerNPC extends NPC
player.setLeggings(equipment.getLeggings()); player.setLeggings(equipment.getLeggings());
player.setBoots(equipment.getBoots()); player.setBoots(equipment.getBoots());
_disguise = player;
// Ensure the entity is loaded before disguising // Ensure the entity is loaded before disguising
MANAGER.runSyncLater(() -> MANAGER.disguise(player), 20); MANAGER.runSyncLater(() -> MANAGER.disguise(player), 20);
return entity; return entity;
@ -66,9 +70,14 @@ public class PlayerNPC extends NPC
{ {
List<Column<?>> columns = new ArrayList<>(super.toDatabaseQuery()); List<Column<?>> columns = new ArrayList<>(super.toDatabaseQuery());
columns.set(14, new ColumnVarChar("skinValue", 300, _skinData.getProperty().getValue())); columns.set(14, new ColumnVarChar("skinValue", 400, _skinData.getProperty().getValue()));
columns.set(15, new ColumnVarChar("skinSignature", 700, _skinData.getProperty().getSignature())); columns.set(15, new ColumnVarChar("skinSignature", 700, _skinData.getProperty().getSignature()));
return columns; return columns;
} }
public DisguisePlayer getDisguise()
{
return _disguise;
}
} }

View File

@ -1,49 +0,0 @@
package mineplex.core.newnpc.event;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import mineplex.core.newnpc.NPC;
public class NPCSpawnEvent extends Event implements Cancellable
{
private static final HandlerList _handlers = new HandlerList();
private final NPC _npc;
private boolean _cancel;
public NPCSpawnEvent(NPC npc)
{
_npc = npc;
}
public NPC getNpc()
{
return _npc;
}
public void setCancelled(boolean cancel)
{
_cancel = cancel;
}
public boolean isCancelled()
{
return _cancel;
}
public static HandlerList getHandlerList()
{
return _handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
}

View File

@ -16,6 +16,7 @@ import org.bukkit.ChatColor;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.entity.Egg; import org.bukkit.entity.Egg;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
@ -46,6 +47,7 @@ import mineplex.core.MiniClientPlugin;
import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClient;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.AchievementManager; import mineplex.core.achievement.AchievementManager;
import mineplex.core.achievement.profile.ProfileManager;
import mineplex.core.antispam.AntiSpamManager; import mineplex.core.antispam.AntiSpamManager;
import mineplex.core.benefit.BenefitManager; import mineplex.core.benefit.BenefitManager;
import mineplex.core.blockrestore.BlockRestore; import mineplex.core.blockrestore.BlockRestore;
@ -77,6 +79,7 @@ import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.event.GadgetCollideEntityEvent; import mineplex.core.gadget.event.GadgetCollideEntityEvent;
import mineplex.core.gadget.gadgets.particle.king.CastleManager; import mineplex.core.gadget.gadgets.particle.king.CastleManager;
import mineplex.core.hologram.HologramManager; import mineplex.core.hologram.HologramManager;
import mineplex.core.imagemap.ImageMapManager;
import mineplex.core.incognito.IncognitoManager; import mineplex.core.incognito.IncognitoManager;
import mineplex.core.incognito.events.IncognitoHidePlayerEvent; import mineplex.core.incognito.events.IncognitoHidePlayerEvent;
import mineplex.core.interactions.NewInteractionsManager; import mineplex.core.interactions.NewInteractionsManager;
@ -411,6 +414,7 @@ public class HubManager extends MiniClientPlugin<HubClient> implements IChatMess
Managers.put(scoreboardManager, ScoreboardManager.class); Managers.put(scoreboardManager, ScoreboardManager.class);
require(NewNPCManager.class); require(NewNPCManager.class);
require(ProfileManager.class);
} }
@Override @Override
@ -513,6 +517,8 @@ public class HubManager extends MiniClientPlugin<HubClient> implements IChatMess
event.allow(); event.allow();
} }
private boolean _made;
@EventHandler(priority = EventPriority.LOW) @EventHandler(priority = EventPriority.LOW)
public void AdminOP(PlayerJoinEvent event) public void AdminOP(PlayerJoinEvent event)
{ {
@ -527,6 +533,13 @@ public class HubManager extends MiniClientPlugin<HubClient> implements IChatMess
event.getPlayer().setOp(true); event.getPlayer().setOp(true);
else else
event.getPlayer().setOp(false); event.getPlayer().setOp(false);
if (!_made)
{
_made = true;
require(ImageMapManager.class)
.createBoard(new Location(Bukkit.getWorld("world"), 4, 34, 2), BlockFace.NORTH, 9, 6, "BLESSED.png");
}
} }
@EventHandler @EventHandler