Merge branches 'develop' and 'feature/party-v2' of https://github.com/Mineplex-LLC/Minecraft-PC into feature/party-v2
This commit is contained in:
commit
2b8930eee8
@ -811,6 +811,11 @@ public class ItemStackFactory extends MiniPlugin
|
|||||||
return CreateStack(id, data, amount, damage, name, lore, owner, unbreakable, 0, null);
|
return CreateStack(id, data, amount, damage, name, lore, owner, unbreakable, 0, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ItemStack CreateStack(Material type, Integer enchLevel, Enchantment... enchantments)
|
||||||
|
{
|
||||||
|
return CreateStack(type.getId(), (byte)0, 1, (short)0, null, ArrayToList(new String[] {}), null, true, enchLevel, enchantments);
|
||||||
|
}
|
||||||
|
|
||||||
//XXX Owner Variant End
|
//XXX Owner Variant End
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@ -886,7 +891,7 @@ public class ItemStackFactory extends MiniPlugin
|
|||||||
{
|
{
|
||||||
for(Enchantment enchantment : enchantments)
|
for(Enchantment enchantment : enchantments)
|
||||||
{
|
{
|
||||||
stack.addEnchantment(enchantment, enchLevel);
|
stack.addUnsafeEnchantment(enchantment, enchLevel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,14 +2,7 @@ package mineplex.core.npc;
|
|||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
@ -87,6 +80,7 @@ public class NpcManager extends MiniPlugin
|
|||||||
|
|
||||||
private final Creature _creature;
|
private final Creature _creature;
|
||||||
private final List<Npc> _npcs = new ArrayList<>();
|
private final List<Npc> _npcs = new ArrayList<>();
|
||||||
|
private final Queue<NpcsRecord> _queuedNpcs = new LinkedList<>();
|
||||||
final Map<UUID, Npc> _npcMap = new HashMap<>();
|
final Map<UUID, Npc> _npcMap = new HashMap<>();
|
||||||
private final Set<UUID> _npcDeletingPlayers = new HashSet<>();
|
private final Set<UUID> _npcDeletingPlayers = new HashSet<>();
|
||||||
|
|
||||||
@ -504,14 +498,22 @@ public class NpcManager extends MiniPlugin
|
|||||||
{
|
{
|
||||||
record.detach();
|
record.detach();
|
||||||
|
|
||||||
|
if (Bukkit.getWorld(record.getWorld()) == null)
|
||||||
|
{
|
||||||
|
// World isnt loaded yet, add to queue
|
||||||
|
_queuedNpcs.add(record);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
Npc npc = new Npc(this, record);
|
Npc npc = new Npc(this, record);
|
||||||
_npcs.add(npc);
|
_npcs.add(npc);
|
||||||
|
|
||||||
if (npc.getChunk().isLoaded())
|
if (npc.getChunk() != null && npc.getChunk().isLoaded())
|
||||||
spawnNpc(npc);
|
spawnNpc(npc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void clearNpcs(boolean deleteFromDatabase) throws SQLException
|
public void clearNpcs(boolean deleteFromDatabase) throws SQLException
|
||||||
{
|
{
|
||||||
@ -561,11 +563,34 @@ public class NpcManager extends MiniPlugin
|
|||||||
|
|
||||||
for (Npc npc : _npcs)
|
for (Npc npc : _npcs)
|
||||||
{
|
{
|
||||||
if (npc.getEntity() != null && !npc.getEntity().isValid() && npc.getChunk().isLoaded())
|
if (npc.getEntity() != null && !npc.getEntity().isValid() && npc.getChunk() != null && npc.getChunk().isLoaded())
|
||||||
spawnNpc(npc);
|
spawnNpc(npc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void processNpcQueue(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() != UpdateType.SEC_05)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Iterator<NpcsRecord> iterator = _queuedNpcs.iterator();
|
||||||
|
while (iterator.hasNext())
|
||||||
|
{
|
||||||
|
NpcsRecord record = iterator.next();
|
||||||
|
if (Bukkit.getWorld(record.getWorld()) != null)
|
||||||
|
{
|
||||||
|
Npc npc = new Npc(this, record);
|
||||||
|
_npcs.add(npc);
|
||||||
|
iterator.remove();
|
||||||
|
|
||||||
|
if (npc.getChunk() != null && npc.getChunk().isLoaded())
|
||||||
|
spawnNpc(npc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onChunkLoad(ChunkLoadEvent event)
|
public void onChunkLoad(ChunkLoadEvent event)
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
package nautilus.game.arcade.game.games.micro.modes.kits;
|
package nautilus.game.arcade.game.games.micro.modes.kits;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.UtilItem;
|
||||||
import mineplex.core.itemstack.ItemStackFactory;
|
import mineplex.core.itemstack.ItemStackFactory;
|
||||||
import nautilus.game.arcade.ArcadeManager;
|
import nautilus.game.arcade.ArcadeManager;
|
||||||
import nautilus.game.arcade.kit.KitAvailability;
|
import nautilus.game.arcade.kit.KitAvailability;
|
||||||
@ -19,15 +21,16 @@ public class KitOverlord extends ProgressingKit
|
|||||||
};
|
};
|
||||||
|
|
||||||
private static final Perk[] PERKS = {
|
private static final Perk[] PERKS = {
|
||||||
new PerkFletcher(3, 16, true)
|
new PerkFletcher(7, 4, true)
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final ItemStack IN_HAND = new ItemStack(Material.GOLDEN_APPLE);
|
private static final ItemStack IN_HAND = new ItemStack(Material.GOLDEN_APPLE);
|
||||||
|
|
||||||
private static final ItemStack[] PLAYER_ITEMS = {
|
private static final ItemStack[] PLAYER_ITEMS = {
|
||||||
ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD),
|
ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD, 4, Enchantment.DAMAGE_ALL),
|
||||||
ItemStackFactory.Instance.CreateStack(Material.DIAMOND_PICKAXE),
|
ItemStackFactory.Instance.CreateStack(Material.DIAMOND_PICKAXE),
|
||||||
ItemStackFactory.Instance.CreateStack(Material.BOW),
|
ItemStackFactory.Instance.CreateStack(Material.BOW, 25, Enchantment.ARROW_DAMAGE),
|
||||||
|
ItemStackFactory.Instance.CreateStack(Material.COOKED_BEEF, 64),
|
||||||
ItemStackFactory.Instance.CreateStack(Material.GOLDEN_APPLE, 5)
|
ItemStackFactory.Instance.CreateStack(Material.GOLDEN_APPLE, 5)
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -41,9 +44,9 @@ public class KitOverlord extends ProgressingKit
|
|||||||
{
|
{
|
||||||
player.getInventory().addItem(PLAYER_ITEMS);
|
player.getInventory().addItem(PLAYER_ITEMS);
|
||||||
|
|
||||||
player.getInventory().setHelmet(new ItemStack(Material.DIAMOND_HELMET));
|
player.getInventory().setHelmet(UtilItem.makeUnbreakable(new ItemStack(Material.DIAMOND_HELMET)));
|
||||||
player.getInventory().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE));
|
player.getInventory().setChestplate(UtilItem.makeUnbreakable(new ItemStack(Material.DIAMOND_CHESTPLATE)));
|
||||||
player.getInventory().setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS));
|
player.getInventory().setLeggings(UtilItem.makeUnbreakable(new ItemStack(Material.DIAMOND_LEGGINGS)));
|
||||||
player.getInventory().setBoots(new ItemStack(Material.DIAMOND_BOOTS));
|
player.getInventory().setBoots(UtilItem.makeUnbreakable(new ItemStack(Material.DIAMOND_BOOTS)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user