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