mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 22:56:45 +01:00
Tweaks
This commit is contained in:
parent
c5282b29b2
commit
d49de5297b
@ -33,17 +33,17 @@ import java.util.UUID;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* PlotSquared API.
|
* PlotSquared API.
|
||||||
* <br>
|
*
|
||||||
* <br>
|
* <p>Useful classes:</p>
|
||||||
* Useful classes:<br>
|
* <ul>
|
||||||
* @see BukkitUtil
|
* <li>{@link BukkitUtil}</li>
|
||||||
* @see PlotPlayer
|
* <li>{@link PlotPlayer}</li>
|
||||||
* @see Plot
|
* <li>{@link Plot}</li>
|
||||||
* @see com.intellectualcrafters.plot.object.Location
|
* <li>{@link com.intellectualcrafters.plot.object.Location}</li>
|
||||||
* @see PlotArea
|
* <li>{@link PlotArea}</li>
|
||||||
* @see PS
|
* <li>{@link PS}</li>
|
||||||
|
* </ul>
|
||||||
* @version 3.3.3
|
* @version 3.3.3
|
||||||
>>>>>>> origin/master
|
|
||||||
*/
|
*/
|
||||||
public class PlotAPI {
|
public class PlotAPI {
|
||||||
|
|
||||||
|
@ -22,7 +22,6 @@ import com.intellectualcrafters.plot.util.RegExUtil;
|
|||||||
import com.intellectualcrafters.plot.util.StringMan;
|
import com.intellectualcrafters.plot.util.StringMan;
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||||
import com.plotsquared.bukkit.BukkitMain;
|
|
||||||
import com.plotsquared.bukkit.object.BukkitLazyBlock;
|
import com.plotsquared.bukkit.object.BukkitLazyBlock;
|
||||||
import com.plotsquared.bukkit.object.BukkitPlayer;
|
import com.plotsquared.bukkit.object.BukkitPlayer;
|
||||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
@ -738,7 +737,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
plotExit(pp, plot);
|
plotExit(pp, plot);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BukkitMain.worldEdit != null && PS.get().worldedit != null) {
|
if (true && PS.get().worldedit != null) {
|
||||||
if (!Permissions.hasPermission(pp, C.PERMISSION_WORLDEDIT_BYPASS)) {
|
if (!Permissions.hasPermission(pp, C.PERMISSION_WORLDEDIT_BYPASS)) {
|
||||||
if (pp.getAttribute("worldedit")) {
|
if (pp.getAttribute("worldedit")) {
|
||||||
pp.removeAttribute("worldedit");
|
pp.removeAttribute("worldedit");
|
||||||
|
@ -9,6 +9,8 @@ import org.bukkit.World;
|
|||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.entity.Ageable;
|
import org.bukkit.entity.Ageable;
|
||||||
import org.bukkit.entity.ArmorStand;
|
import org.bukkit.entity.ArmorStand;
|
||||||
|
import org.bukkit.entity.Bat;
|
||||||
|
import org.bukkit.entity.EnderDragon;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Guardian;
|
import org.bukkit.entity.Guardian;
|
||||||
@ -16,6 +18,7 @@ import org.bukkit.entity.Horse;
|
|||||||
import org.bukkit.entity.Horse.Color;
|
import org.bukkit.entity.Horse.Color;
|
||||||
import org.bukkit.entity.Horse.Style;
|
import org.bukkit.entity.Horse.Style;
|
||||||
import org.bukkit.entity.Horse.Variant;
|
import org.bukkit.entity.Horse.Variant;
|
||||||
|
import org.bukkit.entity.IronGolem;
|
||||||
import org.bukkit.entity.Item;
|
import org.bukkit.entity.Item;
|
||||||
import org.bukkit.entity.ItemFrame;
|
import org.bukkit.entity.ItemFrame;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
@ -25,6 +28,7 @@ import org.bukkit.entity.Rabbit.Type;
|
|||||||
import org.bukkit.entity.Sheep;
|
import org.bukkit.entity.Sheep;
|
||||||
import org.bukkit.entity.Skeleton;
|
import org.bukkit.entity.Skeleton;
|
||||||
import org.bukkit.entity.Skeleton.SkeletonType;
|
import org.bukkit.entity.Skeleton.SkeletonType;
|
||||||
|
import org.bukkit.entity.Slime;
|
||||||
import org.bukkit.entity.Tameable;
|
import org.bukkit.entity.Tameable;
|
||||||
import org.bukkit.inventory.EntityEquipment;
|
import org.bukkit.inventory.EntityEquipment;
|
||||||
import org.bukkit.inventory.InventoryHolder;
|
import org.bukkit.inventory.InventoryHolder;
|
||||||
@ -39,10 +43,10 @@ public class EntityWrapper {
|
|||||||
public final float pitch;
|
public final float pitch;
|
||||||
public final short depth;
|
public final short depth;
|
||||||
private final int hash;
|
private final int hash;
|
||||||
|
private final EntityBaseStats base = new EntityBaseStats();
|
||||||
public double x;
|
public double x;
|
||||||
public double y;
|
public double y;
|
||||||
public double z;
|
public double z;
|
||||||
public EntityBaseStats base = null;
|
|
||||||
// Extended
|
// Extended
|
||||||
public ItemStack stack;
|
public ItemStack stack;
|
||||||
public ItemStack[] inventory;
|
public ItemStack[] inventory;
|
||||||
@ -52,10 +56,9 @@ public class EntityWrapper {
|
|||||||
public LivingEntityStats lived;
|
public LivingEntityStats lived;
|
||||||
public AgeableStats aged;
|
public AgeableStats aged;
|
||||||
public TameableStats tamed;
|
public TameableStats tamed;
|
||||||
|
ArmorStandStats stand;
|
||||||
private HorseStats horse;
|
private HorseStats horse;
|
||||||
private ArmorStandStats stand;
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public EntityWrapper(Entity entity, short depth) {
|
public EntityWrapper(Entity entity, short depth) {
|
||||||
this.hash = entity.getEntityId();
|
this.hash = entity.getEntityId();
|
||||||
this.depth = depth;
|
this.depth = depth;
|
||||||
@ -69,10 +72,9 @@ public class EntityWrapper {
|
|||||||
if (depth == 0) {
|
if (depth == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.base = new EntityBaseStats();
|
Entity passenger = entity.getPassenger();
|
||||||
Entity p = entity.getPassenger();
|
if (passenger != null) {
|
||||||
if (p != null) {
|
this.base.passenger = new EntityWrapper(passenger, depth);
|
||||||
this.base.passenger = new EntityWrapper(p, depth);
|
|
||||||
}
|
}
|
||||||
this.base.fall = entity.getFallDistance();
|
this.base.fall = entity.getFallDistance();
|
||||||
this.base.fire = (short) entity.getFireTicks();
|
this.base.fire = (short) entity.getFireTicks();
|
||||||
@ -168,10 +170,10 @@ public class EntityWrapper {
|
|||||||
this.horse.variant = getOrdinal(Variant.values(), horse.getVariant());
|
this.horse.variant = getOrdinal(Variant.values(), horse.getVariant());
|
||||||
this.horse.style = getOrdinal(Style.values(), horse.getStyle());
|
this.horse.style = getOrdinal(Style.values(), horse.getStyle());
|
||||||
this.horse.color = getOrdinal(Color.values(), horse.getColor());
|
this.horse.color = getOrdinal(Color.values(), horse.getColor());
|
||||||
storeTameable((Tameable) entity);
|
storeTameable(horse);
|
||||||
storeAgeable((Ageable) entity);
|
storeAgeable(horse);
|
||||||
storeLiving((LivingEntity) entity);
|
storeLiving(horse);
|
||||||
storeInventory((InventoryHolder) entity);
|
storeInventory(horse);
|
||||||
return;
|
return;
|
||||||
// END INVENTORY HOLDER //
|
// END INVENTORY HOLDER //
|
||||||
case WOLF:
|
case WOLF:
|
||||||
@ -185,8 +187,8 @@ public class EntityWrapper {
|
|||||||
Sheep sheep = (Sheep) entity;
|
Sheep sheep = (Sheep) entity;
|
||||||
this.dataByte = (byte) (sheep.isSheared() ? 1 : 0);
|
this.dataByte = (byte) (sheep.isSheared() ? 1 : 0);
|
||||||
this.dataByte2 = sheep.getColor().getDyeData();
|
this.dataByte2 = sheep.getColor().getDyeData();
|
||||||
storeAgeable((Ageable) entity);
|
storeAgeable(sheep);
|
||||||
storeLiving((LivingEntity) entity);
|
storeLiving(sheep);
|
||||||
return;
|
return;
|
||||||
case VILLAGER:
|
case VILLAGER:
|
||||||
case CHICKEN:
|
case CHICKEN:
|
||||||
@ -196,26 +198,25 @@ public class EntityWrapper {
|
|||||||
storeAgeable((Ageable) entity);
|
storeAgeable((Ageable) entity);
|
||||||
storeLiving((LivingEntity) entity);
|
storeLiving((LivingEntity) entity);
|
||||||
return;
|
return;
|
||||||
case RABBIT: // NEW
|
case RABBIT:
|
||||||
this.dataByte = getOrdinal(Type.values(), ((Rabbit) entity).getRabbitType());
|
this.dataByte = getOrdinal(Type.values(), ((Rabbit) entity).getRabbitType());
|
||||||
storeAgeable((Ageable) entity);
|
storeAgeable((Ageable) entity);
|
||||||
storeLiving((LivingEntity) entity);
|
storeLiving((LivingEntity) entity);
|
||||||
return;
|
return;
|
||||||
// END AGEABLE //
|
// END AGEABLE //
|
||||||
case GUARDIAN: // NEW
|
case GUARDIAN:
|
||||||
this.dataByte = (byte) (((Guardian) entity).isElder() ? 1 : 0);
|
this.dataByte = (byte) (((Guardian) entity).isElder() ? 1 : 0);
|
||||||
storeLiving((LivingEntity) entity);
|
storeLiving((LivingEntity) entity);
|
||||||
return;
|
return;
|
||||||
case SKELETON: // NEW
|
case SKELETON:
|
||||||
this.dataByte = (byte) ((Skeleton) entity).getSkeletonType().getId();
|
this.dataByte = (byte) ((Skeleton) entity).getSkeletonType().getId();
|
||||||
storeLiving((LivingEntity) entity);
|
storeLiving((LivingEntity) entity);
|
||||||
return;
|
return;
|
||||||
case ARMOR_STAND: // NEW
|
case ARMOR_STAND:
|
||||||
// CHECK positions
|
|
||||||
ArmorStand stand = (ArmorStand) entity;
|
ArmorStand stand = (ArmorStand) entity;
|
||||||
this.inventory = new ItemStack[]{stand.getItemInHand().clone(), stand.getHelmet().clone(), stand.getChestplate().clone(),
|
this.inventory = new ItemStack[]{stand.getItemInHand().clone(), stand.getHelmet().clone(), stand.getChestplate().clone(),
|
||||||
stand.getLeggings().clone(), stand.getBoots().clone()};
|
stand.getLeggings().clone(), stand.getBoots().clone()};
|
||||||
storeLiving((LivingEntity) entity);
|
storeLiving(stand);
|
||||||
this.stand = new ArmorStandStats();
|
this.stand = new ArmorStandStats();
|
||||||
|
|
||||||
EulerAngle head = stand.getHeadPose();
|
EulerAngle head = stand.getHeadPose();
|
||||||
@ -264,9 +265,19 @@ public class EntityWrapper {
|
|||||||
this.stand.small = true;
|
this.stand.small = true;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case ENDERMITE: // NEW
|
case ENDERMITE:
|
||||||
|
return;
|
||||||
case BAT:
|
case BAT:
|
||||||
|
if (((Bat) entity).isAwake()) {
|
||||||
|
this.dataByte = (byte) 1;
|
||||||
|
} else {
|
||||||
|
this.dataByte = (byte) 0;
|
||||||
|
}
|
||||||
|
return;
|
||||||
case ENDER_DRAGON:
|
case ENDER_DRAGON:
|
||||||
|
EnderDragon entity1 = (EnderDragon) entity;
|
||||||
|
this.dataByte = (byte) entity1.getPhase().ordinal();
|
||||||
|
return;
|
||||||
case GHAST:
|
case GHAST:
|
||||||
case MAGMA_CUBE:
|
case MAGMA_CUBE:
|
||||||
case SQUID:
|
case SQUID:
|
||||||
@ -283,8 +294,16 @@ public class EntityWrapper {
|
|||||||
case BLAZE:
|
case BLAZE:
|
||||||
case SHULKER:
|
case SHULKER:
|
||||||
case SNOWMAN:
|
case SNOWMAN:
|
||||||
case IRON_GOLEM:
|
|
||||||
storeLiving((LivingEntity) entity);
|
storeLiving((LivingEntity) entity);
|
||||||
|
return;
|
||||||
|
case IRON_GOLEM:
|
||||||
|
if (((IronGolem) entity).isPlayerCreated()) {
|
||||||
|
this.dataByte = (byte) 1;
|
||||||
|
} else {
|
||||||
|
this.dataByte = (byte) 0;
|
||||||
|
}
|
||||||
|
storeLiving((LivingEntity) entity);
|
||||||
|
return;
|
||||||
// END LIVING //
|
// END LIVING //
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -303,7 +322,7 @@ public class EntityWrapper {
|
|||||||
this.inventory = held.getInventory().getContents().clone();
|
this.inventory = held.getInventory().getContents().clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void restoreLiving(LivingEntity entity) {
|
void restoreLiving(LivingEntity entity) {
|
||||||
entity.setCanPickupItems(this.lived.loot);
|
entity.setCanPickupItems(this.lived.loot);
|
||||||
if (this.lived.name != null) {
|
if (this.lived.name != null) {
|
||||||
entity.setCustomName(this.lived.name);
|
entity.setCustomName(this.lived.name);
|
||||||
@ -315,12 +334,7 @@ public class EntityWrapper {
|
|||||||
entity.setRemainingAir(this.lived.air);
|
entity.setRemainingAir(this.lived.air);
|
||||||
entity.setRemoveWhenFarAway(this.lived.persistent);
|
entity.setRemoveWhenFarAway(this.lived.persistent);
|
||||||
if (this.lived.equipped) {
|
if (this.lived.equipped) {
|
||||||
EntityEquipment equipment = entity.getEquipment();
|
this.restoreEquipment(entity);
|
||||||
equipment.setItemInHand(this.lived.hands);
|
|
||||||
equipment.setHelmet(this.lived.helmet);
|
|
||||||
equipment.setChestplate(this.lived.chestplate);
|
|
||||||
equipment.setLeggings(this.lived.leggings);
|
|
||||||
equipment.setBoots(this.lived.boots);
|
|
||||||
}
|
}
|
||||||
if (this.lived.leashed) {
|
if (this.lived.leashed) {
|
||||||
// TODO leashes
|
// TODO leashes
|
||||||
@ -331,6 +345,20 @@ public class EntityWrapper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void restoreEquipment(LivingEntity entity) {
|
||||||
|
EntityEquipment equipment = entity.getEquipment();
|
||||||
|
if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), 1, 9, 0)) {
|
||||||
|
equipment.setItemInMainHand(this.lived.mainHand);
|
||||||
|
equipment.setItemInOffHand(this.lived.offHand);
|
||||||
|
} else {
|
||||||
|
equipment.setItemInHand(this.lived.mainHand);
|
||||||
|
}
|
||||||
|
equipment.setHelmet(this.lived.helmet);
|
||||||
|
equipment.setChestplate(this.lived.chestplate);
|
||||||
|
equipment.setLeggings(this.lived.leggings);
|
||||||
|
equipment.setBoots(this.lived.boots);
|
||||||
|
}
|
||||||
|
|
||||||
private void restoreInventory(InventoryHolder entity) {
|
private void restoreInventory(InventoryHolder entity) {
|
||||||
entity.getInventory().setContents(this.inventory);
|
entity.getInventory().setContents(this.inventory);
|
||||||
}
|
}
|
||||||
@ -354,14 +382,24 @@ public class EntityWrapper {
|
|||||||
EntityEquipment equipment = lived.getEquipment();
|
EntityEquipment equipment = lived.getEquipment();
|
||||||
this.lived.equipped = equipment != null;
|
this.lived.equipped = equipment != null;
|
||||||
if (this.lived.equipped) {
|
if (this.lived.equipped) {
|
||||||
this.lived.hands = equipment.getItemInHand().clone();
|
storeEquipment(equipment);
|
||||||
this.lived.boots = equipment.getBoots().clone();
|
|
||||||
this.lived.leggings = equipment.getLeggings().clone();
|
|
||||||
this.lived.chestplate = equipment.getChestplate().clone();
|
|
||||||
this.lived.helmet = equipment.getHelmet().clone();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void storeEquipment(EntityEquipment equipment) {
|
||||||
|
if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), 1, 9, 0)) {
|
||||||
|
this.lived.mainHand = equipment.getItemInMainHand().clone();
|
||||||
|
this.lived.offHand = equipment.getItemInOffHand().clone();
|
||||||
|
} else {
|
||||||
|
this.lived.mainHand = equipment.getItemInHand().clone();
|
||||||
|
this.lived.offHand = null;
|
||||||
|
}
|
||||||
|
this.lived.boots = equipment.getBoots().clone();
|
||||||
|
this.lived.leggings = equipment.getLeggings().clone();
|
||||||
|
this.lived.chestplate = equipment.getChestplate().clone();
|
||||||
|
this.lived.helmet = equipment.getHelmet().clone();
|
||||||
|
}
|
||||||
|
|
||||||
private void restoreTameable(Tameable entity) {
|
private void restoreTameable(Tameable entity) {
|
||||||
if (this.tamed.tamed) {
|
if (this.tamed.tamed) {
|
||||||
if (this.tamed.owner != null) {
|
if (this.tamed.owner != null) {
|
||||||
@ -394,7 +432,6 @@ public class EntityWrapper {
|
|||||||
this.tamed.tamed = tamed.isTamed();
|
this.tamed.tamed = tamed.isTamed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public Entity spawn(World world, int x_offset, int z_offset) {
|
public Entity spawn(World world, int x_offset, int z_offset) {
|
||||||
Location loc = new Location(world, this.x + x_offset, this.y, this.z + z_offset);
|
Location loc = new Location(world, this.x + x_offset, this.y, this.z + z_offset);
|
||||||
loc.setYaw(this.yaw);
|
loc.setYaw(this.yaw);
|
||||||
@ -449,6 +486,7 @@ public class EntityWrapper {
|
|||||||
case ENDER_CRYSTAL:
|
case ENDER_CRYSTAL:
|
||||||
case ENDER_PEARL:
|
case ENDER_PEARL:
|
||||||
case ENDER_SIGNAL:
|
case ENDER_SIGNAL:
|
||||||
|
case DROPPED_ITEM:
|
||||||
case EXPERIENCE_ORB:
|
case EXPERIENCE_ORB:
|
||||||
case FALLING_BLOCK:
|
case FALLING_BLOCK:
|
||||||
case FIREBALL:
|
case FIREBALL:
|
||||||
@ -463,11 +501,19 @@ public class EntityWrapper {
|
|||||||
case PLAYER:
|
case PLAYER:
|
||||||
case PRIMED_TNT:
|
case PRIMED_TNT:
|
||||||
case SLIME:
|
case SLIME:
|
||||||
|
((Slime) entity).setSize(this.dataByte);
|
||||||
|
return entity;
|
||||||
case SMALL_FIREBALL:
|
case SMALL_FIREBALL:
|
||||||
case SNOWBALL:
|
case SNOWBALL:
|
||||||
case SPLASH_POTION:
|
case SPLASH_POTION:
|
||||||
case THROWN_EXP_BOTTLE:
|
case THROWN_EXP_BOTTLE:
|
||||||
case WEATHER:
|
case WEATHER:
|
||||||
|
case TIPPED_ARROW:
|
||||||
|
case SPECTRAL_ARROW:
|
||||||
|
case SHULKER_BULLET:
|
||||||
|
case LINGERING_POTION:
|
||||||
|
case AREA_EFFECT_CLOUD:
|
||||||
|
case DRAGON_FIREBALL:
|
||||||
case WITHER_SKULL:
|
case WITHER_SKULL:
|
||||||
case MINECART_FURNACE:
|
case MINECART_FURNACE:
|
||||||
case UNKNOWN:
|
case UNKNOWN:
|
||||||
@ -503,10 +549,10 @@ public class EntityWrapper {
|
|||||||
horse.setVariant(Variant.values()[this.horse.variant]);
|
horse.setVariant(Variant.values()[this.horse.variant]);
|
||||||
horse.setStyle(Style.values()[this.horse.style]);
|
horse.setStyle(Style.values()[this.horse.style]);
|
||||||
horse.setColor(Color.values()[this.horse.color]);
|
horse.setColor(Color.values()[this.horse.color]);
|
||||||
restoreTameable((Tameable) entity);
|
restoreTameable(horse);
|
||||||
restoreAgeable((Ageable) entity);
|
restoreAgeable(horse);
|
||||||
restoreLiving((LivingEntity) entity);
|
restoreLiving(horse);
|
||||||
restoreInventory((InventoryHolder) entity);
|
restoreInventory(horse);
|
||||||
return entity;
|
return entity;
|
||||||
// END INVENTORY HOLDER //
|
// END INVENTORY HOLDER //
|
||||||
case WOLF:
|
case WOLF:
|
||||||
@ -524,9 +570,9 @@ public class EntityWrapper {
|
|||||||
if (this.dataByte2 != 0) {
|
if (this.dataByte2 != 0) {
|
||||||
sheep.setColor(DyeColor.getByDyeData(this.dataByte2));
|
sheep.setColor(DyeColor.getByDyeData(this.dataByte2));
|
||||||
}
|
}
|
||||||
restoreAgeable((Ageable) entity);
|
restoreAgeable(sheep);
|
||||||
restoreLiving((LivingEntity) entity);
|
restoreLiving(sheep);
|
||||||
return entity;
|
return sheep;
|
||||||
case VILLAGER:
|
case VILLAGER:
|
||||||
case CHICKEN:
|
case CHICKEN:
|
||||||
case COW:
|
case COW:
|
||||||
@ -536,26 +582,26 @@ public class EntityWrapper {
|
|||||||
restoreLiving((LivingEntity) entity);
|
restoreLiving((LivingEntity) entity);
|
||||||
return entity;
|
return entity;
|
||||||
// END AGEABLE //
|
// END AGEABLE //
|
||||||
case RABBIT: // NEW
|
case RABBIT:
|
||||||
if (this.dataByte != 0) {
|
if (this.dataByte != 0) {
|
||||||
((Rabbit) entity).setRabbitType(Type.values()[this.dataByte]);
|
((Rabbit) entity).setRabbitType(Type.values()[this.dataByte]);
|
||||||
}
|
}
|
||||||
restoreAgeable((Ageable) entity);
|
restoreAgeable((Ageable) entity);
|
||||||
restoreLiving((LivingEntity) entity);
|
restoreLiving((LivingEntity) entity);
|
||||||
return entity;
|
return entity;
|
||||||
case GUARDIAN: // NEW
|
case GUARDIAN:
|
||||||
if (this.dataByte != 0) {
|
if (this.dataByte != 0) {
|
||||||
((Guardian) entity).setElder(true);
|
((Guardian) entity).setElder(true);
|
||||||
}
|
}
|
||||||
restoreLiving((LivingEntity) entity);
|
restoreLiving((LivingEntity) entity);
|
||||||
return entity;
|
return entity;
|
||||||
case SKELETON: // NEW
|
case SKELETON:
|
||||||
if (this.dataByte != 0) {
|
if (this.dataByte != 0) {
|
||||||
((Skeleton) entity).setSkeletonType(SkeletonType.values()[this.dataByte]);
|
((Skeleton) entity).setSkeletonType(SkeletonType.values()[this.dataByte]);
|
||||||
}
|
}
|
||||||
storeLiving((LivingEntity) entity);
|
storeLiving((LivingEntity) entity);
|
||||||
return entity;
|
return entity;
|
||||||
case ARMOR_STAND: // NEW
|
case ARMOR_STAND:
|
||||||
// CHECK positions
|
// CHECK positions
|
||||||
ArmorStand stand = (ArmorStand) entity;
|
ArmorStand stand = (ArmorStand) entity;
|
||||||
if (this.inventory[0] != null) {
|
if (this.inventory[0] != null) {
|
||||||
@ -612,11 +658,21 @@ public class EntityWrapper {
|
|||||||
if (this.stand.small) {
|
if (this.stand.small) {
|
||||||
stand.setSmall(true);
|
stand.setSmall(true);
|
||||||
}
|
}
|
||||||
|
restoreLiving(stand);
|
||||||
|
return stand;
|
||||||
|
case BAT:
|
||||||
|
if (this.dataByte != 0) {
|
||||||
|
((Bat) entity).setAwake(true);
|
||||||
|
}
|
||||||
restoreLiving((LivingEntity) entity);
|
restoreLiving((LivingEntity) entity);
|
||||||
return entity;
|
return entity;
|
||||||
case ENDERMITE: // NEW
|
|
||||||
case BAT:
|
|
||||||
case ENDER_DRAGON:
|
case ENDER_DRAGON:
|
||||||
|
if (this.dataByte != 0) {
|
||||||
|
((EnderDragon) entity).setPhase(EnderDragon.Phase.values()[this.dataByte]);
|
||||||
|
}
|
||||||
|
restoreLiving((LivingEntity) entity);
|
||||||
|
return entity;
|
||||||
|
case ENDERMITE:
|
||||||
case GHAST:
|
case GHAST:
|
||||||
case MAGMA_CUBE:
|
case MAGMA_CUBE:
|
||||||
case SQUID:
|
case SQUID:
|
||||||
@ -632,7 +688,13 @@ public class EntityWrapper {
|
|||||||
case CREEPER:
|
case CREEPER:
|
||||||
case BLAZE:
|
case BLAZE:
|
||||||
case SNOWMAN:
|
case SNOWMAN:
|
||||||
|
case SHULKER:
|
||||||
|
restoreLiving((LivingEntity) entity);
|
||||||
|
return entity;
|
||||||
case IRON_GOLEM:
|
case IRON_GOLEM:
|
||||||
|
if (this.dataByte != 0) {
|
||||||
|
((IronGolem) entity).setPlayerCreated(true);
|
||||||
|
}
|
||||||
restoreLiving((LivingEntity) entity);
|
restoreLiving((LivingEntity) entity);
|
||||||
return entity;
|
return entity;
|
||||||
// END LIVING //
|
// END LIVING //
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package com.plotsquared.bukkit.object.entity;
|
package com.plotsquared.bukkit.object.entity;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
public class LivingEntityStats {
|
public class LivingEntityStats {
|
||||||
public boolean loot;
|
public boolean loot;
|
||||||
public String name;
|
public String name;
|
||||||
@ -17,10 +17,11 @@ public class LivingEntityStats {
|
|||||||
public short leash_y;
|
public short leash_y;
|
||||||
public short leash_z;
|
public short leash_z;
|
||||||
public boolean equipped;
|
public boolean equipped;
|
||||||
public ItemStack hands;
|
public ItemStack mainHand;
|
||||||
public ItemStack helmet;
|
public ItemStack helmet;
|
||||||
public ItemStack boots;
|
public ItemStack boots;
|
||||||
public ItemStack leggings;
|
public ItemStack leggings;
|
||||||
public ItemStack chestplate;
|
public ItemStack chestplate;
|
||||||
public Collection<PotionEffect> potions;
|
public Collection<PotionEffect> potions;
|
||||||
|
public ItemStack offHand;
|
||||||
}
|
}
|
||||||
|
@ -854,25 +854,20 @@ public class BukkitChunkManager extends ChunkManager {
|
|||||||
BlockState state = block.getState();
|
BlockState state = block.getState();
|
||||||
if (state instanceof Skull) {
|
if (state instanceof Skull) {
|
||||||
Object[] data = blockLocEntry.getValue();
|
Object[] data = blockLocEntry.getValue();
|
||||||
if (data[0] != null) {
|
if ((Boolean) data[0]) {
|
||||||
((Skull) state).setOwner((String) data[0]);
|
((Skull) state).setOwner((String) data[1]);
|
||||||
}
|
|
||||||
if ((Integer) data[1] != 0) {
|
|
||||||
((Skull) state).setRotation(BlockFace.values()[(int) data[1]]);
|
|
||||||
}
|
|
||||||
if ((Integer) data[2] != 0) {
|
|
||||||
((Skull) state).setSkullType(SkullType.values()[(int) data[2]]);
|
|
||||||
}
|
}
|
||||||
|
((Skull) state).setRotation((BlockFace) data[2]);
|
||||||
|
((Skull) state).setSkullType((SkullType) data[3]);
|
||||||
state.update(true);
|
state.update(true);
|
||||||
} else {
|
} else {
|
||||||
PS.debug("&c[WARN] Plot clear failed to restore skull: " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
|
PS.debug("&c[WARN] Plot clear failed to restore skull: " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
|
||||||
.getKey().y
|
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
|
||||||
+ "," + (
|
|
||||||
blockLocEntry.getKey().z + zOffset));
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
PS.debug("&c[WARN] Plot clear failed to regenerate skull (e): " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
|
PS.debug("&c[WARN] Plot clear failed to regenerate skull (e): " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
|
||||||
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
|
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Entry<BlockLoc, ItemStack[]> blockLocEntry : this.hopperContents.entrySet()) {
|
for (Entry<BlockLoc, ItemStack[]> blockLocEntry : this.hopperContents.entrySet()) {
|
||||||
@ -989,10 +984,7 @@ public class BukkitChunkManager extends ChunkManager {
|
|||||||
}
|
}
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
PS.debug("&c[WARN] Plot clear failed to regenerate brewing stand (e): " + (blockLocEntry.getKey().x + xOffset) + ","
|
PS.debug("&c[WARN] Plot clear failed to regenerate brewing stand (e): " + (blockLocEntry.getKey().x + xOffset) + ","
|
||||||
+ blockLocEntry
|
+ blockLocEntry.getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
|
||||||
.getKey().y + "," + (
|
|
||||||
blockLocEntry.getKey().z
|
|
||||||
+ zOffset));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Entry<BlockLoc, Short[]> blockLocEntry : this.furnaceTime.entrySet()) {
|
for (Entry<BlockLoc, Short[]> blockLocEntry : this.furnaceTime.entrySet()) {
|
||||||
@ -1007,14 +999,12 @@ public class BukkitChunkManager extends ChunkManager {
|
|||||||
} else {
|
} else {
|
||||||
PS.debug(
|
PS.debug(
|
||||||
"&c[WARN] Plot clear failed to restore furnace cooking: " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
|
"&c[WARN] Plot clear failed to restore furnace cooking: " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
|
||||||
.getKey().y + "," + (
|
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
|
||||||
blockLocEntry.getKey().z + zOffset));
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
PS.debug(
|
PS.debug(
|
||||||
"&c[WARN] Plot clear failed to restore furnace cooking (e): " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
|
"&c[WARN] Plot clear failed to restore furnace cooking (e): " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
|
||||||
.getKey().y + "," + (
|
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
|
||||||
blockLocEntry.getKey().z + zOffset));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Entry<BlockLoc, ItemStack[]> blockLocEntry : this.furnaceContents.entrySet()) {
|
for (Entry<BlockLoc, ItemStack[]> blockLocEntry : this.furnaceContents.entrySet()) {
|
||||||
@ -1048,15 +1038,11 @@ public class BukkitChunkManager extends ChunkManager {
|
|||||||
state.update(true);
|
state.update(true);
|
||||||
} else {
|
} else {
|
||||||
PS.debug("&c[WARN] Plot clear failed to regenerate banner: " + (blockLocByteEntry.getKey().x + xOffset) + ","
|
PS.debug("&c[WARN] Plot clear failed to regenerate banner: " + (blockLocByteEntry.getKey().x + xOffset) + ","
|
||||||
+ blockLocByteEntry
|
+ blockLocByteEntry.getKey().y + "," + (blockLocByteEntry.getKey().z + zOffset));
|
||||||
.getKey().y + "," + (
|
|
||||||
blockLocByteEntry.getKey().z + zOffset));
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
PS.debug("&c[WARN] Plot clear failed to regenerate banner (e): " + (blockLocByteEntry.getKey().x + xOffset) + ","
|
PS.debug("&c[WARN] Plot clear failed to regenerate banner (e): " + (blockLocByteEntry.getKey().x + xOffset) + ","
|
||||||
+ blockLocByteEntry
|
+ blockLocByteEntry.getKey().y + "," + (blockLocByteEntry.getKey().z + zOffset));
|
||||||
.getKey().y + "," + (
|
|
||||||
blockLocByteEntry.getKey().z + zOffset));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1134,11 +1120,7 @@ public class BukkitChunkManager extends ChunkManager {
|
|||||||
}
|
}
|
||||||
} else if (block.getState() instanceof Skull) {
|
} else if (block.getState() instanceof Skull) {
|
||||||
Skull skull = (Skull) block.getState();
|
Skull skull = (Skull) block.getState();
|
||||||
String o = skull.getOwner();
|
this.skullData.put(bl, new Object[]{skull.hasOwner(), skull.getOwner(), skull.getRotation(), skull.getSkullType()});
|
||||||
byte skullType = getOrdinal(SkullType.values(), skull.getSkullType());
|
|
||||||
skull.getRotation();
|
|
||||||
short rot = getOrdinal(BlockFace.values(), skull.getRotation());
|
|
||||||
this.skullData.put(bl, new Object[]{o, rot, skullType});
|
|
||||||
} else if (block.getState() instanceof Banner) {
|
} else if (block.getState() instanceof Banner) {
|
||||||
Banner banner = (Banner) block.getState();
|
Banner banner = (Banner) block.getState();
|
||||||
DyeColor base = banner.getBaseColor();
|
DyeColor base = banner.getBaseColor();
|
||||||
|
@ -74,14 +74,14 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
|||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
HashBiMap<StringWrapper, UUID> toAdd = HashBiMap.create(new HashMap<StringWrapper, UUID>());
|
HashBiMap<StringWrapper, UUID> toAdd = HashBiMap.create(new HashMap<StringWrapper, UUID>());
|
||||||
PreparedStatement statement = getConnection().prepareStatement("SELECT `uuid`, `username` FROM `usercache`");
|
try (PreparedStatement statement = getConnection().prepareStatement("SELECT `uuid`, `username` FROM `usercache`");
|
||||||
ResultSet resultSet = statement.executeQuery();
|
ResultSet resultSet = statement.executeQuery()) {
|
||||||
while (resultSet.next()) {
|
while (resultSet.next()) {
|
||||||
StringWrapper username = new StringWrapper(resultSet.getString("username"));
|
StringWrapper username = new StringWrapper(resultSet.getString("username"));
|
||||||
UUID uuid = UUID.fromString(resultSet.getString("uuid"));
|
UUID uuid = UUID.fromString(resultSet.getString("uuid"));
|
||||||
toAdd.put(new StringWrapper(username.value), uuid);
|
toAdd.put(new StringWrapper(username.value), uuid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
statement.close();
|
|
||||||
add(toAdd);
|
add(toAdd);
|
||||||
add(new StringWrapper("*"), DBFunc.everyone);
|
add(new StringWrapper("*"), DBFunc.everyone);
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ public class Area extends SubCommand {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (hasConfirmation(player)) {
|
if (hasConfirmation(player)) {
|
||||||
CmdConfirm.addPending(player, "/plot area create pos2 (Creates world)", run);
|
CmdConfirm.addPending(player, getCommandString() + " create pos2 (Creates world)", run);
|
||||||
} else {
|
} else {
|
||||||
run.run();
|
run.run();
|
||||||
}
|
}
|
||||||
@ -172,7 +172,7 @@ public class Area extends SubCommand {
|
|||||||
for (int i = 2; i < args.length; i++) {
|
for (int i = 2; i < args.length; i++) {
|
||||||
String[] pair = args[i].split("=");
|
String[] pair = args[i].split("=");
|
||||||
if (pair.length != 2) {
|
if (pair.length != 2) {
|
||||||
C.COMMAND_SYNTAX.send(player, "/plot area create [world[:id]] [<modifier>=<value>]...");
|
C.COMMAND_SYNTAX.send(player, getCommandString() + " create [world[:id]] [<modifier>=<value>]...");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
switch (pair[0].toLowerCase()) {
|
switch (pair[0].toLowerCase()) {
|
||||||
@ -218,7 +218,7 @@ public class Area extends SubCommand {
|
|||||||
object.type = pa.TYPE;
|
object.type = pa.TYPE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
C.COMMAND_SYNTAX.send(player, "/plot area create [world[:id]] [<modifier>=<value>]...");
|
C.COMMAND_SYNTAX.send(player, getCommandString() + " create [world[:id]] [<modifier>=<value>]...");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -254,14 +254,14 @@ public class Area extends SubCommand {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (hasConfirmation(player)) {
|
if (hasConfirmation(player)) {
|
||||||
CmdConfirm.addPending(player, "/plot area " + StringMan.join(args, " "), run);
|
CmdConfirm.addPending(player, getCommandString() + " " + StringMan.join(args, " "), run);
|
||||||
} else {
|
} else {
|
||||||
run.run();
|
run.run();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (pa.id == null) {
|
if (pa.id == null) {
|
||||||
C.COMMAND_SYNTAX.send(player, "/plot area create [world[:id]] [<modifier>=<value>]...");
|
C.COMMAND_SYNTAX.send(player, getCommandString() + " create [world[:id]] [<modifier>=<value>]...");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (WorldUtil.IMP.isWorld(pa.worldname)) {
|
if (WorldUtil.IMP.isWorld(pa.worldname)) {
|
||||||
@ -275,7 +275,7 @@ public class Area extends SubCommand {
|
|||||||
player.teleport(WorldUtil.IMP.getSpawn(pa.worldname));
|
player.teleport(WorldUtil.IMP.getSpawn(pa.worldname));
|
||||||
}
|
}
|
||||||
player.setMeta("area_create_area", pa);
|
player.setMeta("area_create_area", pa);
|
||||||
MainUtil.sendMessage(player, "$1Go to the first corner and use: $2/plot area create pos1");
|
MainUtil.sendMessage(player, "$1Go to the first corner and use: $2 " + getCommandString() + " create pos1");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -294,7 +294,7 @@ public class Area extends SubCommand {
|
|||||||
area = PS.get().getPlotAreaByString(args[1]);
|
area = PS.get().getPlotAreaByString(args[1]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
C.COMMAND_SYNTAX.send(player, "/plot area info [area]");
|
C.COMMAND_SYNTAX.send(player, getCommandString() + " info [area]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
@ -351,7 +351,7 @@ public class Area extends SubCommand {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
C.COMMAND_SYNTAX.send(player, "/plot area list [#]");
|
C.COMMAND_SYNTAX.send(player, getCommandString() + " list [#]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ArrayList<PlotArea> areas = new ArrayList<>(PS.get().getPlotAreas());
|
ArrayList<PlotArea> areas = new ArrayList<>(PS.get().getPlotAreas());
|
||||||
@ -388,7 +388,8 @@ public class Area extends SubCommand {
|
|||||||
message.text("[").color("$3")
|
message.text("[").color("$3")
|
||||||
.text(i + "").command(visit).tooltip(visit).color("$1")
|
.text(i + "").command(visit).tooltip(visit).color("$1")
|
||||||
.text("]").color("$3")
|
.text("]").color("$3")
|
||||||
.text(" " + name).tooltip(tooltip).command("/plot area info " + area).color("$1").text(" - ").color("$2")
|
.text(" " + name).tooltip(tooltip).command(getCommandString() + " info " + area).color("$1").text(" - ")
|
||||||
|
.color("$2")
|
||||||
.text(area.TYPE + ":" + area.TERRAIN).color("$3");
|
.text(area.TYPE + ":" + area.TERRAIN).color("$3");
|
||||||
}
|
}
|
||||||
}, "/plot area list", C.AREA_LIST_HEADER_PAGED.s());
|
}, "/plot area list", C.AREA_LIST_HEADER_PAGED.s());
|
||||||
|
@ -60,7 +60,7 @@ public class Delete extends SubCommand {
|
|||||||
sendMessage(plr, C.ADDED_BALANCE, value + "");
|
sendMessage(plr, C.ADDED_BALANCE, value + "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(plr, C.CLEARING_DONE, "" + (System.currentTimeMillis() - start));
|
MainUtil.sendMessage(plr, C.CLEARING_DONE, System.currentTimeMillis() - start);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (result) {
|
if (result) {
|
||||||
@ -71,7 +71,7 @@ public class Delete extends SubCommand {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (hasConfirmation(plr)) {
|
if (hasConfirmation(plr)) {
|
||||||
CmdConfirm.addPending(plr, "/plot delete " + plot.getId(), run);
|
CmdConfirm.addPending(plr, getCommandString() + ' ' + plot.getId(), run);
|
||||||
} else {
|
} else {
|
||||||
TaskManager.runTask(run);
|
TaskManager.runTask(run);
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ public abstract class UUIDHandlerImplementation {
|
|||||||
|
|
||||||
public final ConcurrentHashMap<String, PlotPlayer> players;
|
public final ConcurrentHashMap<String, PlotPlayer> players;
|
||||||
public final HashSet<UUID> unknown = new HashSet<>();
|
public final HashSet<UUID> unknown = new HashSet<>();
|
||||||
public UUIDWrapper uuidWrapper = null;
|
public UUIDWrapper uuidWrapper;
|
||||||
private boolean cached = false;
|
private boolean cached = false;
|
||||||
private BiMap<StringWrapper, UUID> uuidMap = HashBiMap.create(new HashMap<StringWrapper, UUID>());
|
private BiMap<StringWrapper, UUID> uuidMap = HashBiMap.create(new HashMap<StringWrapper, UUID>());
|
||||||
|
|
||||||
@ -181,7 +181,6 @@ public abstract class UUIDHandlerImplementation {
|
|||||||
public void handleShutdown() {
|
public void handleShutdown() {
|
||||||
this.players.clear();
|
this.players.clear();
|
||||||
this.uuidMap.clear();
|
this.uuidMap.clear();
|
||||||
this.uuidWrapper = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName(UUID uuid) {
|
public String getName(UUID uuid) {
|
||||||
|
@ -12,22 +12,22 @@ import org.spongepowered.api.profile.GameProfile;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class SpongeUUIDHandler extends UUIDHandlerImplementation {
|
public class SpongeUUIDHandler extends UUIDHandlerImplementation {
|
||||||
|
|
||||||
public SpongeUUIDHandler(final UUIDWrapper wrapper) {
|
public SpongeUUIDHandler(UUIDWrapper wrapper) {
|
||||||
super(wrapper);
|
super(wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean startCaching(final Runnable whenDone) {
|
public boolean startCaching(Runnable whenDone) {
|
||||||
if (!super.startCaching(whenDone)) {
|
if (!super.startCaching(whenDone)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return cache(whenDone);
|
return cache(whenDone);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean cache(final Runnable whenDone) {
|
public boolean cache(Runnable whenDone) {
|
||||||
add(new StringWrapper("*"), DBFunc.everyone);
|
add(new StringWrapper("*"), DBFunc.everyone);
|
||||||
for (final GameProfile profile : SpongeMain.THIS.getResolver().getCachedProfiles()) {
|
for (GameProfile profile : SpongeMain.THIS.getServer().getGameProfileManager().getCache().getProfiles()) {
|
||||||
String name = profile.getName().orElse(null);
|
String name = profile.getName().orElse(null);
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
add(new StringWrapper(name), profile.getUniqueId());
|
add(new StringWrapper(name), profile.getUniqueId());
|
||||||
@ -37,11 +37,11 @@ public class SpongeUUIDHandler extends UUIDHandlerImplementation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fetchUUID(final String name, final RunnableVal<UUID> ifFetch) {
|
public void fetchUUID(String name, RunnableVal<UUID> ifFetch) {
|
||||||
TaskManager.runTaskAsync(new Runnable() {
|
TaskManager.runTaskAsync(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
ifFetch.value = uuidWrapper.getUUID(name);
|
ifFetch.value = SpongeUUIDHandler.this.uuidWrapper.getUUID(name);
|
||||||
TaskManager.runTask(ifFetch);
|
TaskManager.runTask(ifFetch);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user