mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-11 11:49:12 +00:00
Compile against 1.13 preview.
Still a lot of work to do. One thing to note is that I used LEGACY materials in a few spots where I didn't know what the new ones are as I'm not very familiar with the 1.13 update and what it changes.
This commit is contained in:
parent
1a820ad9b7
commit
ace361af60
29 changed files with 159 additions and 258 deletions
|
@ -577,7 +577,7 @@ public class EssentialsPlayerListener implements Listener {
|
||||||
public void onPlayerInteract(final PlayerInteractEvent event) {
|
public void onPlayerInteract(final PlayerInteractEvent event) {
|
||||||
switch (event.getAction()) {
|
switch (event.getAction()) {
|
||||||
case RIGHT_CLICK_BLOCK:
|
case RIGHT_CLICK_BLOCK:
|
||||||
if (!event.isCancelled() && event.getClickedBlock().getType() == Material.BED_BLOCK && ess.getSettings().getUpdateBedAtDaytime()) {
|
if (!event.isCancelled() && event.getClickedBlock().getType() == Material.LEGACY_BED && ess.getSettings().getUpdateBedAtDaytime()) {
|
||||||
User player = ess.getUser(event.getPlayer());
|
User player = ess.getUser(event.getPlayer());
|
||||||
if (player.isAuthorized("essentials.sethome.bed")) {
|
if (player.isAuthorized("essentials.sethome.bed")) {
|
||||||
player.getBase().setBedSpawnLocation(event.getClickedBlock().getLocation());
|
player.getBase().setBedSpawnLocation(event.getClickedBlock().getLocation());
|
||||||
|
|
|
@ -191,7 +191,7 @@ public class ItemDb implements IConf, net.ess3.api.IItemDb {
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
throw new Exception("Can't spawn entity ID " + metaData + " from mob spawners.");
|
throw new Exception("Can't spawn entity ID " + metaData + " from mob spawners.");
|
||||||
}
|
}
|
||||||
} else if (mat == Material.MONSTER_EGG) {
|
} else if (mat == Material.LEGACY_MONSTER_EGG) {
|
||||||
EntityType type;
|
EntityType type;
|
||||||
try {
|
try {
|
||||||
type = EntityType.fromId(metaData);
|
type = EntityType.fromId(metaData);
|
||||||
|
@ -226,7 +226,7 @@ public class ItemDb implements IConf, net.ess3.api.IItemDb {
|
||||||
}
|
}
|
||||||
} else if (args[0].equalsIgnoreCase("blocks")) {
|
} else if (args[0].equalsIgnoreCase("blocks")) {
|
||||||
for (ItemStack stack : user.getBase().getInventory().getContents()) {
|
for (ItemStack stack : user.getBase().getInventory().getContents()) {
|
||||||
if (stack == null || stack.getTypeId() > 255 || stack.getType() == Material.AIR) {
|
if (stack == null || stack.getType() == Material.AIR) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
is.add(stack.clone());
|
is.add(stack.clone());
|
||||||
|
@ -332,7 +332,8 @@ public class ItemDb implements IConf, net.ess3.api.IItemDb {
|
||||||
sb.append(e.getName().toLowerCase()).append(":").append(enchantmentStorageMeta.getStoredEnchantLevel(e)).append(" ");
|
sb.append(e.getName().toLowerCase()).append(":").append(enchantmentStorageMeta.getStoredEnchantLevel(e)).append(" ");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FIREWORK:
|
case FIREWORK_ROCKET:
|
||||||
|
case FIREWORK_STAR:
|
||||||
// Everything from http://wiki.ess3.net/wiki/Item_Meta#Fireworks in that order.
|
// Everything from http://wiki.ess3.net/wiki/Item_Meta#Fireworks in that order.
|
||||||
FireworkMeta fireworkMeta = (FireworkMeta) is.getItemMeta();
|
FireworkMeta fireworkMeta = (FireworkMeta) is.getItemMeta();
|
||||||
if (fireworkMeta.hasEffects()) {
|
if (fireworkMeta.hasEffects()) {
|
||||||
|
@ -374,7 +375,8 @@ public class ItemDb implements IConf, net.ess3.api.IItemDb {
|
||||||
sb.append("splash:").append(potion.isSplash()).append(" ").append("effect:").append(e.getType().getName().toLowerCase()).append(" ").append("power:").append(e.getAmplifier()).append(" ").append("duration:").append(e.getDuration() / 20).append(" ");
|
sb.append("splash:").append(potion.isSplash()).append(" ").append("effect:").append(e.getType().getName().toLowerCase()).append(" ").append("power:").append(e.getAmplifier()).append(" ").append("duration:").append(e.getDuration() / 20).append(" ");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SKULL_ITEM:
|
case SKELETON_SKULL:
|
||||||
|
case WITHER_SKELETON_SKULL:
|
||||||
// item stack with meta
|
// item stack with meta
|
||||||
SkullMeta skullMeta = (SkullMeta) is.getItemMeta();
|
SkullMeta skullMeta = (SkullMeta) is.getItemMeta();
|
||||||
if (skullMeta != null && skullMeta.hasOwner()) {
|
if (skullMeta != null && skullMeta.hasOwner()) {
|
||||||
|
@ -389,7 +391,22 @@ public class ItemDb implements IConf, net.ess3.api.IItemDb {
|
||||||
int rgb = leatherArmorMeta.getColor().asRGB();
|
int rgb = leatherArmorMeta.getColor().asRGB();
|
||||||
sb.append("color:").append(rgb).append(" ");
|
sb.append("color:").append(rgb).append(" ");
|
||||||
break;
|
break;
|
||||||
case BANNER:
|
case BLACK_BANNER:
|
||||||
|
case BLUE_BANNER:
|
||||||
|
case BROWN_BANNER:
|
||||||
|
case CYAN_BANNER:
|
||||||
|
case GRAY_BANNER:
|
||||||
|
case GREEN_BANNER:
|
||||||
|
case LIGHT_BLUE_BANNER:
|
||||||
|
case LIGHT_GRAY_BANNER:
|
||||||
|
case LIME_BANNER:
|
||||||
|
case MAGENTA_BANNER:
|
||||||
|
case ORANGE_BANNER:
|
||||||
|
case PINK_BANNER:
|
||||||
|
case PURPLE_BANNER:
|
||||||
|
case RED_BANNER:
|
||||||
|
case WHITE_BANNER:
|
||||||
|
case YELLOW_BANNER:
|
||||||
BannerMeta bannerMeta = (BannerMeta) is.getItemMeta();
|
BannerMeta bannerMeta = (BannerMeta) is.getItemMeta();
|
||||||
if (bannerMeta != null) {
|
if (bannerMeta != null) {
|
||||||
int basecolor = bannerMeta.getBaseColor().getColor().asRGB();
|
int basecolor = bannerMeta.getBaseColor().getColor().asRGB();
|
||||||
|
|
|
@ -29,8 +29,9 @@ import static com.earth2me.essentials.I18n.tl;
|
||||||
|
|
||||||
|
|
||||||
public class MetaItemStack {
|
public class MetaItemStack {
|
||||||
private static final Map<String, DyeColor> colorMap = new HashMap<String, DyeColor>();
|
private static final Map<String, DyeColor> colorMap = new HashMap<>();
|
||||||
private static final Map<String, FireworkEffect.Type> fireworkShape = new HashMap<String, FireworkEffect.Type>();
|
private static final Map<String, FireworkEffect.Type> fireworkShape = new HashMap<>();
|
||||||
|
private static final Set<Material> banners = new HashSet<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
for (DyeColor color : DyeColor.values()) {
|
for (DyeColor color : DyeColor.values()) {
|
||||||
|
@ -39,6 +40,11 @@ public class MetaItemStack {
|
||||||
for (FireworkEffect.Type type : FireworkEffect.Type.values()) {
|
for (FireworkEffect.Type type : FireworkEffect.Type.values()) {
|
||||||
fireworkShape.put(type.name(), type);
|
fireworkShape.put(type.name(), type);
|
||||||
}
|
}
|
||||||
|
for (Material mat : Material.values()) {
|
||||||
|
if (mat.name().contains("BANNER")) {
|
||||||
|
banners.add(mat);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final transient Pattern splitPattern = Pattern.compile("[:+',;.]");
|
private final transient Pattern splitPattern = Pattern.compile("[:+',;.]");
|
||||||
|
@ -181,7 +187,7 @@ public class MetaItemStack {
|
||||||
} else if (split[0].equalsIgnoreCase("unbreakable") && hasMetaPermission(sender, "unbreakable", false, true, ess)) {
|
} else if (split[0].equalsIgnoreCase("unbreakable") && hasMetaPermission(sender, "unbreakable", false, true, ess)) {
|
||||||
boolean value = split.length > 1 ? Boolean.valueOf(split[1]) : true;
|
boolean value = split.length > 1 ? Boolean.valueOf(split[1]) : true;
|
||||||
setUnbreakable(stack, value);
|
setUnbreakable(stack, value);
|
||||||
} else if (split.length > 1 && (split[0].equalsIgnoreCase("player") || split[0].equalsIgnoreCase("owner")) && stack.getType() == Material.SKULL_ITEM && hasMetaPermission(sender, "head", false, true, ess)) {
|
} else if (split.length > 1 && (split[0].equalsIgnoreCase("player") || split[0].equalsIgnoreCase("owner")) && (stack.getType() == Material.SKELETON_SKULL || stack.getType() == Material.WITHER_SKELETON_SKULL) && hasMetaPermission(sender, "head", false, true, ess)) {
|
||||||
if (stack.getDurability() == 3) {
|
if (stack.getDurability() == 3) {
|
||||||
final String owner = split[1];
|
final String owner = split[1];
|
||||||
final SkullMeta meta = (SkullMeta) stack.getItemMeta();
|
final SkullMeta meta = (SkullMeta) stack.getItemMeta();
|
||||||
|
@ -208,12 +214,12 @@ public class MetaItemStack {
|
||||||
final BookMeta meta = (BookMeta) stack.getItemMeta();
|
final BookMeta meta = (BookMeta) stack.getItemMeta();
|
||||||
meta.setTitle(title);
|
meta.setTitle(title);
|
||||||
stack.setItemMeta(meta);
|
stack.setItemMeta(meta);
|
||||||
} else if (split.length > 1 && split[0].equalsIgnoreCase("power") && stack.getType() == Material.FIREWORK && hasMetaPermission(sender, "firework-power", false, true, ess)) {
|
} else if (split.length > 1 && split[0].equalsIgnoreCase("power") && (stack.getType() == Material.FIREWORK_ROCKET || stack.getType() == Material.FIREWORK_STAR)&& hasMetaPermission(sender, "firework-power", false, true, ess)) {
|
||||||
final int power = NumberUtil.isInt(split[1]) ? Integer.parseInt(split[1]) : 0;
|
final int power = NumberUtil.isInt(split[1]) ? Integer.parseInt(split[1]) : 0;
|
||||||
final FireworkMeta meta = (FireworkMeta) stack.getItemMeta();
|
final FireworkMeta meta = (FireworkMeta) stack.getItemMeta();
|
||||||
meta.setPower(power > 3 ? 4 : power);
|
meta.setPower(power > 3 ? 4 : power);
|
||||||
stack.setItemMeta(meta);
|
stack.setItemMeta(meta);
|
||||||
} else if (stack.getType() == Material.FIREWORK) {//WARNING - Meta for fireworks will be ignored after this point.
|
} else if (stack.getType() == Material.FIREWORK_ROCKET || stack.getType() == Material.FIREWORK_STAR) {//WARNING - Meta for fireworks will be ignored after this point.
|
||||||
addFireworkMeta(sender, false, string, ess);
|
addFireworkMeta(sender, false, string, ess);
|
||||||
} else if (isPotion(stack.getType())) { //WARNING - Meta for potions will be ignored after this point.
|
} else if (isPotion(stack.getType())) { //WARNING - Meta for potions will be ignored after this point.
|
||||||
addPotionMeta(sender, false, string, ess);
|
addPotionMeta(sender, false, string, ess);
|
||||||
|
@ -251,7 +257,7 @@ public class MetaItemStack {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addFireworkMeta(final CommandSource sender, final boolean allowShortName, final String string, final IEssentials ess) throws Exception {
|
public void addFireworkMeta(final CommandSource sender, final boolean allowShortName, final String string, final IEssentials ess) throws Exception {
|
||||||
if (stack.getType() == Material.FIREWORK) {
|
if (stack.getType() == Material.FIREWORK_ROCKET || stack.getType() == Material.FIREWORK_STAR) {
|
||||||
final String[] split = splitPattern.split(string, 2);
|
final String[] split = splitPattern.split(string, 2);
|
||||||
if (split.length < 2) {
|
if (split.length < 2) {
|
||||||
return;
|
return;
|
||||||
|
@ -444,7 +450,7 @@ public class MetaItemStack {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addBannerMeta(final CommandSource sender, final boolean allowShortName, final String string, final IEssentials ess) throws Exception {
|
public void addBannerMeta(final CommandSource sender, final boolean allowShortName, final String string, final IEssentials ess) throws Exception {
|
||||||
if (stack.getType() == Material.BANNER && string != null) {
|
if (banners.contains(stack.getType()) && string != null) {
|
||||||
final String[] split = splitPattern.split(string, 2);
|
final String[] split = splitPattern.split(string, 2);
|
||||||
|
|
||||||
if (split.length < 2) {
|
if (split.length < 2) {
|
||||||
|
|
|
@ -53,9 +53,9 @@ public enum MobData {
|
||||||
BAY_HORSE("bay", EntityType.HORSE, Horse.Color.BROWN, true),
|
BAY_HORSE("bay", EntityType.HORSE, Horse.Color.BROWN, true),
|
||||||
BROWN_HORSE("brown", EntityType.HORSE, Horse.Color.BROWN, false),
|
BROWN_HORSE("brown", EntityType.HORSE, Horse.Color.BROWN, false),
|
||||||
SADDLE_HORSE("saddle", EntityType.HORSE, Data.HORSESADDLE, true),
|
SADDLE_HORSE("saddle", EntityType.HORSE, Data.HORSESADDLE, true),
|
||||||
GOLD_ARMOR_HORSE("goldarmor", EntityType.HORSE, Material.GOLD_BARDING, true),
|
GOLD_ARMOR_HORSE("goldarmor", EntityType.HORSE, Material.GOLDEN_HORSE_ARMOR, true),
|
||||||
DIAMOND_ARMOR_HORSE("diamondarmor", EntityType.HORSE, Material.DIAMOND_BARDING, true),
|
DIAMOND_ARMOR_HORSE("diamondarmor", EntityType.HORSE, Material.DIAMOND_HORSE_ARMOR, true),
|
||||||
ARMOR_HORSE("armor", EntityType.HORSE, Material.IRON_BARDING, true),
|
ARMOR_HORSE("armor", EntityType.HORSE, Material.IRON_HORSE_ARMOR, true),
|
||||||
SIAMESE_CAT("siamese", EntityType.OCELOT, Ocelot.Type.SIAMESE_CAT, true),
|
SIAMESE_CAT("siamese", EntityType.OCELOT, Ocelot.Type.SIAMESE_CAT, true),
|
||||||
WHITE_CAT("white", EntityType.OCELOT, Ocelot.Type.SIAMESE_CAT, false),
|
WHITE_CAT("white", EntityType.OCELOT, Ocelot.Type.SIAMESE_CAT, false),
|
||||||
RED_CAT("red", EntityType.OCELOT, Ocelot.Type.RED_CAT, true),
|
RED_CAT("red", EntityType.OCELOT, Ocelot.Type.RED_CAT, true),
|
||||||
|
@ -66,12 +66,12 @@ public enum MobData {
|
||||||
BABY_ZOMBIE("baby", EntityType.ZOMBIE.getEntityClass(), Data.BABYZOMBIE, true),
|
BABY_ZOMBIE("baby", EntityType.ZOMBIE.getEntityClass(), Data.BABYZOMBIE, true),
|
||||||
ADULT_ZOMBIE("adult", EntityType.ZOMBIE.getEntityClass(), Data.ADULTZOMBIE, true),
|
ADULT_ZOMBIE("adult", EntityType.ZOMBIE.getEntityClass(), Data.ADULTZOMBIE, true),
|
||||||
DIAMOND_SWORD_ZOMBIE("diamondsword", EntityType.ZOMBIE.getEntityClass(), Material.DIAMOND_SWORD, true),
|
DIAMOND_SWORD_ZOMBIE("diamondsword", EntityType.ZOMBIE.getEntityClass(), Material.DIAMOND_SWORD, true),
|
||||||
GOLD_SWORD_ZOMBIE("goldsword", EntityType.ZOMBIE.getEntityClass(), Material.GOLD_SWORD, true),
|
GOLD_SWORD_ZOMBIE("goldsword", EntityType.ZOMBIE.getEntityClass(), Material.GOLDEN_SWORD, true),
|
||||||
IRON_SWORD_ZOMBIE("ironsword", EntityType.ZOMBIE.getEntityClass(), Material.IRON_SWORD, true),
|
IRON_SWORD_ZOMBIE("ironsword", EntityType.ZOMBIE.getEntityClass(), Material.IRON_SWORD, true),
|
||||||
STONE_SWORD_ZOMBIE("stonesword", EntityType.ZOMBIE.getEntityClass(), Material.STONE_SWORD, false),
|
STONE_SWORD_ZOMBIE("stonesword", EntityType.ZOMBIE.getEntityClass(), Material.STONE_SWORD, false),
|
||||||
SWORD_ZOMBIE("sword", EntityType.ZOMBIE.getEntityClass(), Material.STONE_SWORD, true),
|
SWORD_ZOMBIE("sword", EntityType.ZOMBIE.getEntityClass(), Material.STONE_SWORD, true),
|
||||||
DIAMOND_SWORD_SKELETON("diamondsword", EntityType.SKELETON, Material.DIAMOND_SWORD, true),
|
DIAMOND_SWORD_SKELETON("diamondsword", EntityType.SKELETON, Material.DIAMOND_SWORD, true),
|
||||||
GOLD_SWORD_SKELETON("goldsword", EntityType.SKELETON, Material.GOLD_SWORD, true),
|
GOLD_SWORD_SKELETON("goldsword", EntityType.SKELETON, Material.GOLDEN_SWORD, true),
|
||||||
IRON_SWORD_SKELETON("ironsword", EntityType.SKELETON, Material.IRON_SWORD, true),
|
IRON_SWORD_SKELETON("ironsword", EntityType.SKELETON, Material.IRON_SWORD, true),
|
||||||
STONE_SWORD_SKELETON("stonesword", EntityType.SKELETON, Material.STONE_SWORD, false),
|
STONE_SWORD_SKELETON("stonesword", EntityType.SKELETON, Material.STONE_SWORD, false),
|
||||||
SWORD_SKELETON("sword", EntityType.SKELETON, Material.STONE_SWORD, true),
|
SWORD_SKELETON("sword", EntityType.SKELETON, Material.STONE_SWORD, true),
|
||||||
|
|
|
@ -200,21 +200,11 @@ public class OfflinePlayer implements Player {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Block getTargetBlock(HashSet<Byte> hs, int i) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Block getTargetBlock(Set<Material> mat, int i) {
|
public Block getTargetBlock(Set<Material> mat, int i) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Block> getLastTwoTargetBlocks(HashSet<Byte> hs, int i) {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Block> getLastTwoTargetBlocks(Set<Material> mat, int i) {
|
public List<Block> getLastTwoTargetBlocks(Set<Material> mat, int i) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
|
@ -480,10 +470,6 @@ public class OfflinePlayer implements Player {
|
||||||
public void sendBlockChange(Location lctn, Material mtrl, byte b) {
|
public void sendBlockChange(Location lctn, Material mtrl, byte b) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendBlockChange(Location lctn, int i, byte b) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setLastDamageCause(EntityDamageEvent ede) {
|
public void setLastDamageCause(EntityDamageEvent ede) {
|
||||||
}
|
}
|
||||||
|
@ -742,10 +728,20 @@ public class OfflinePlayer implements Player {
|
||||||
public void hidePlayer(Player player) {
|
public void hidePlayer(Player player) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void hidePlayer(Plugin plugin, Player player) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showPlayer(Player player) {
|
public void showPlayer(Player player) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showPlayer(Plugin plugin, Player player) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canSee(Player player) {
|
public boolean canSee(Player player) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -11,8 +11,8 @@ import java.util.Set;
|
||||||
|
|
||||||
|
|
||||||
public class Potions {
|
public class Potions {
|
||||||
private static final Map<String, PotionEffectType> POTIONS = new HashMap<String, PotionEffectType>();
|
private static final Map<String, PotionEffectType> POTIONS = new HashMap<>();
|
||||||
private static final Map<String, PotionEffectType> ALIASPOTIONS = new HashMap<String, PotionEffectType>();
|
private static final Map<String, PotionEffectType> ALIASPOTIONS = new HashMap<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
||||||
|
|
|
@ -191,10 +191,10 @@ public class SpawnMob {
|
||||||
invent.setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE, 1));
|
invent.setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE, 1));
|
||||||
invent.setHelmet(new ItemStack(Material.DIAMOND_HELMET, 1));
|
invent.setHelmet(new ItemStack(Material.DIAMOND_HELMET, 1));
|
||||||
} else if (inputData.contains("gold")) {
|
} else if (inputData.contains("gold")) {
|
||||||
invent.setBoots(new ItemStack(Material.GOLD_BOOTS, 1));
|
invent.setBoots(new ItemStack(Material.GOLDEN_BOOTS, 1));
|
||||||
invent.setLeggings(new ItemStack(Material.GOLD_LEGGINGS, 1));
|
invent.setLeggings(new ItemStack(Material.GOLDEN_LEGGINGS, 1));
|
||||||
invent.setChestplate(new ItemStack(Material.GOLD_CHESTPLATE, 1));
|
invent.setChestplate(new ItemStack(Material.GOLDEN_CHESTPLATE, 1));
|
||||||
invent.setHelmet(new ItemStack(Material.GOLD_HELMET, 1));
|
invent.setHelmet(new ItemStack(Material.GOLDEN_HELMET, 1));
|
||||||
} else if (inputData.contains("leather")) {
|
} else if (inputData.contains("leather")) {
|
||||||
invent.setBoots(new ItemStack(Material.LEATHER_BOOTS, 1));
|
invent.setBoots(new ItemStack(Material.LEATHER_BOOTS, 1));
|
||||||
invent.setLeggings(new ItemStack(Material.LEATHER_LEGGINGS, 1));
|
invent.setLeggings(new ItemStack(Material.LEATHER_LEGGINGS, 1));
|
||||||
|
@ -228,7 +228,7 @@ public class SpawnMob {
|
||||||
InventoryWorkaround.setItemInMainHand(invent, new ItemStack(Material.BOW, 1));
|
InventoryWorkaround.setItemInMainHand(invent, new ItemStack(Material.BOW, 1));
|
||||||
InventoryWorkaround.setItemInMainHandDropChance(invent, 0.1f);
|
InventoryWorkaround.setItemInMainHandDropChance(invent, 0.1f);
|
||||||
|
|
||||||
invent.setBoots(new ItemStack(Material.GOLD_BOOTS, 1));
|
invent.setBoots(new ItemStack(Material.GOLDEN_BOOTS, 1));
|
||||||
invent.setBootsDropChance(0.0f);
|
invent.setBootsDropChance(0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,10 +237,10 @@ public class SpawnMob {
|
||||||
setVillager(zombie, false);
|
setVillager(zombie, false);
|
||||||
|
|
||||||
final EntityEquipment invent = zombie.getEquipment();
|
final EntityEquipment invent = zombie.getEquipment();
|
||||||
InventoryWorkaround.setItemInMainHand(invent, new ItemStack(Material.GOLD_SWORD, 1));
|
InventoryWorkaround.setItemInMainHand(invent, new ItemStack(Material.GOLDEN_SWORD, 1));
|
||||||
InventoryWorkaround.setItemInMainHandDropChance(invent, 0.1f);
|
InventoryWorkaround.setItemInMainHandDropChance(invent, 0.1f);
|
||||||
|
|
||||||
invent.setBoots(new ItemStack(Material.GOLD_BOOTS, 1));
|
invent.setBoots(new ItemStack(Material.GOLDEN_BOOTS, 1));
|
||||||
invent.setBootsDropChance(0.0f);
|
invent.setBootsDropChance(0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@ public class SpawnMob {
|
||||||
setVillager(zombie, false);
|
setVillager(zombie, false);
|
||||||
|
|
||||||
final EntityEquipment invent = zombie.getEquipment();
|
final EntityEquipment invent = zombie.getEquipment();
|
||||||
invent.setBoots(new ItemStack(Material.GOLD_BOOTS, 1));
|
invent.setBoots(new ItemStack(Material.GOLDEN_BOOTS, 1));
|
||||||
invent.setBootsDropChance(0.0f);
|
invent.setBootsDropChance(0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -178,7 +178,7 @@ public class Economy {
|
||||||
* Divides the balance of a user by a value
|
* Divides the balance of a user by a value
|
||||||
*
|
*
|
||||||
* @param name Name of the user
|
* @param name Name of the user
|
||||||
* @param value The balance is divided by this value
|
* @param amount The balance is divided by this value
|
||||||
*
|
*
|
||||||
* @throws UserDoesNotExistException If a user by that name does not exists
|
* @throws UserDoesNotExistException If a user by that name does not exists
|
||||||
* @throws NoLoanPermittedException If the user is not allowed to have a negative balance
|
* @throws NoLoanPermittedException If the user is not allowed to have a negative balance
|
||||||
|
@ -202,7 +202,7 @@ public class Economy {
|
||||||
* Multiplies the balance of a user by a value
|
* Multiplies the balance of a user by a value
|
||||||
*
|
*
|
||||||
* @param name Name of the user
|
* @param name Name of the user
|
||||||
* @param value The balance is multiplied by this value
|
* @param amount The balance is multiplied by this value
|
||||||
*
|
*
|
||||||
* @throws UserDoesNotExistException If a user by that name does not exists
|
* @throws UserDoesNotExistException If a user by that name does not exists
|
||||||
* @throws NoLoanPermittedException If the user is not allowed to have a negative balance
|
* @throws NoLoanPermittedException If the user is not allowed to have a negative balance
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class Commandbook extends EssentialsCommand {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isAuthor(bmeta, player) || user.isAuthorized("essentials.book.others")) {
|
if (isAuthor(bmeta, player) || user.isAuthorized("essentials.book.others")) {
|
||||||
ItemStack newItem = new ItemStack(Material.BOOK_AND_QUILL, item.getAmount());
|
ItemStack newItem = new ItemStack(Material.WRITABLE_BOOK, item.getAmount());
|
||||||
newItem.setItemMeta(bmeta);
|
newItem.setItemMeta(bmeta);
|
||||||
InventoryWorkaround.setItemInMainHand(user.getBase(), newItem);
|
InventoryWorkaround.setItemInMainHand(user.getBase(), newItem);
|
||||||
user.sendMessage(tl("editBookContents"));
|
user.sendMessage(tl("editBookContents"));
|
||||||
|
@ -53,7 +53,7 @@ public class Commandbook extends EssentialsCommand {
|
||||||
throw new Exception(tl("denyBookEdit"));
|
throw new Exception(tl("denyBookEdit"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (item.getType() == Material.BOOK_AND_QUILL) {
|
} else if (item.getType() == Material.WRITABLE_BOOK) {
|
||||||
BookMeta bmeta = (BookMeta) item.getItemMeta();
|
BookMeta bmeta = (BookMeta) item.getItemMeta();
|
||||||
if (!user.isAuthorized("essentials.book.author")) {
|
if (!user.isAuthorized("essentials.book.author")) {
|
||||||
bmeta.setAuthor(player);
|
bmeta.setAuthor(player);
|
||||||
|
|
|
@ -3,11 +3,13 @@ package com.earth2me.essentials.commands;
|
||||||
import static com.earth2me.essentials.I18n.tl;
|
import static com.earth2me.essentials.I18n.tl;
|
||||||
|
|
||||||
import com.earth2me.essentials.CommandSource;
|
import com.earth2me.essentials.CommandSource;
|
||||||
|
import com.earth2me.essentials.ItemDb;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
|
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
|
||||||
import com.earth2me.essentials.utils.NumberUtil;
|
import com.earth2me.essentials.utils.NumberUtil;
|
||||||
import com.earth2me.essentials.utils.StringUtil;
|
import com.earth2me.essentials.utils.StringUtil;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
@ -85,6 +87,7 @@ public class Commandclearinventory extends EssentialsCommand {
|
||||||
short data = -1;
|
short data = -1;
|
||||||
int type = -1;
|
int type = -1;
|
||||||
int amount = -1;
|
int amount = -1;
|
||||||
|
Material mat = null;
|
||||||
|
|
||||||
if (args.length > (offset + 1) && NumberUtil.isInt(args[(offset + 1)])) {
|
if (args.length > (offset + 1) && NumberUtil.isInt(args[(offset + 1)])) {
|
||||||
amount = Integer.parseInt(args[(offset + 1)]);
|
amount = Integer.parseInt(args[(offset + 1)]);
|
||||||
|
@ -95,7 +98,8 @@ public class Commandclearinventory extends EssentialsCommand {
|
||||||
} else if (!args[offset].equalsIgnoreCase("*")) {
|
} else if (!args[offset].equalsIgnoreCase("*")) {
|
||||||
final String[] split = args[offset].split(":");
|
final String[] split = args[offset].split(":");
|
||||||
final ItemStack item = ess.getItemDb().get(split[0]);
|
final ItemStack item = ess.getItemDb().get(split[0]);
|
||||||
type = item.getTypeId();
|
type = ess.getItemDb().getLegacyId(item.getType());
|
||||||
|
mat = item.getType();
|
||||||
|
|
||||||
if (split.length > 1 && NumberUtil.isInt(split[1])) {
|
if (split.length > 1 && NumberUtil.isInt(split[1])) {
|
||||||
data = Short.parseShort(split[1]);
|
data = Short.parseShort(split[1]);
|
||||||
|
@ -121,14 +125,14 @@ public class Commandclearinventory extends EssentialsCommand {
|
||||||
} else {
|
} else {
|
||||||
if (data == -1) // data -1 means that all subtypes will be cleared
|
if (data == -1) // data -1 means that all subtypes will be cleared
|
||||||
{
|
{
|
||||||
ItemStack stack = new ItemStack(type);
|
ItemStack stack = new ItemStack(mat);
|
||||||
if (showExtended) {
|
if (showExtended) {
|
||||||
sender.sendMessage(tl("inventoryClearingAllStack", stack.getType().toString().toLowerCase(Locale.ENGLISH), player.getDisplayName()));
|
sender.sendMessage(tl("inventoryClearingAllStack", stack.getType().toString().toLowerCase(Locale.ENGLISH), player.getDisplayName()));
|
||||||
}
|
}
|
||||||
player.getInventory().clear(type, data);
|
player.getInventory().remove(mat);
|
||||||
} else if (amount == -1) // amount -1 means all items will be cleared
|
} else if (amount == -1) // amount -1 means all items will be cleared
|
||||||
{
|
{
|
||||||
ItemStack stack = new ItemStack(type, BASE_AMOUNT, data);
|
ItemStack stack = new ItemStack(mat, BASE_AMOUNT, data);
|
||||||
ItemStack removedStack = player.getInventory().removeItem(stack).get(0);
|
ItemStack removedStack = player.getInventory().removeItem(stack).get(0);
|
||||||
final int removedAmount = (BASE_AMOUNT - removedStack.getAmount());
|
final int removedAmount = (BASE_AMOUNT - removedStack.getAmount());
|
||||||
if (removedAmount > 0 || showExtended) {
|
if (removedAmount > 0 || showExtended) {
|
||||||
|
@ -138,7 +142,7 @@ public class Commandclearinventory extends EssentialsCommand {
|
||||||
if (amount < 0) {
|
if (amount < 0) {
|
||||||
amount = 1;
|
amount = 1;
|
||||||
}
|
}
|
||||||
ItemStack stack = new ItemStack(type, amount, data);
|
ItemStack stack = new ItemStack(mat, amount, data);
|
||||||
if (player.getInventory().containsAtLeast(stack, amount)) {
|
if (player.getInventory().containsAtLeast(stack, amount)) {
|
||||||
sender.sendMessage(tl("inventoryClearingStack", amount, stack.getType().toString().toLowerCase(Locale.ENGLISH), player.getDisplayName()));
|
sender.sendMessage(tl("inventoryClearingStack", amount, stack.getType().toString().toLowerCase(Locale.ENGLISH), player.getDisplayName()));
|
||||||
player.getInventory().removeItem(stack);
|
player.getInventory().removeItem(stack);
|
||||||
|
|
|
@ -43,8 +43,8 @@ public class Commandfirework extends EssentialsCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception {
|
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception {
|
||||||
final ItemStack stack = user.getBase().getItemInHand();
|
final ItemStack stack = user.getBase().getInventory().getItemInMainHand();
|
||||||
if (stack.getType() == Material.FIREWORK) {
|
if (stack.getType() == Material.FIREWORK_ROCKET || stack.getType() == Material.FIREWORK_STAR) {
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
if (args[0].equalsIgnoreCase("clear")) {
|
if (args[0].equalsIgnoreCase("clear")) {
|
||||||
FireworkMeta fmeta = (FireworkMeta) stack.getItemMeta();
|
FireworkMeta fmeta = (FireworkMeta) stack.getItemMeta();
|
||||||
|
|
|
@ -33,8 +33,8 @@ public class Commandhat extends EssentialsCommand {
|
||||||
user.sendMessage(tl("hatRemoved"));
|
user.sendMessage(tl("hatRemoved"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (user.getBase().getItemInHand().getType() != Material.AIR) {
|
if (user.getBase().getInventory().getItemInMainHand().getType() != Material.AIR) {
|
||||||
final ItemStack hand = user.getBase().getItemInHand();
|
final ItemStack hand = user.getBase().getInventory().getItemInMainHand();
|
||||||
if (hand.getType().getMaxDurability() == 0) {
|
if (hand.getType().getMaxDurability() == 0) {
|
||||||
final PlayerInventory inv = user.getBase().getInventory();
|
final PlayerInventory inv = user.getBase().getInventory();
|
||||||
final ItemStack head = inv.getHelmet();
|
final ItemStack head = inv.getHelmet();
|
||||||
|
|
|
@ -64,11 +64,11 @@ public class Commandrecipe extends EssentialsCommand {
|
||||||
} else if (selectedRecipe instanceof ShapedRecipe) {
|
} else if (selectedRecipe instanceof ShapedRecipe) {
|
||||||
shapedRecipe(sender, (ShapedRecipe) selectedRecipe, sender.isPlayer());
|
shapedRecipe(sender, (ShapedRecipe) selectedRecipe, sender.isPlayer());
|
||||||
} else if (selectedRecipe instanceof ShapelessRecipe) {
|
} else if (selectedRecipe instanceof ShapelessRecipe) {
|
||||||
if (recipesOfType.size() == 1 && itemType.getType() == Material.FIREWORK) {
|
if (recipesOfType.size() == 1 && (itemType.getType() == Material.FIREWORK_ROCKET || itemType.getType() == Material.FIREWORK_STAR)) {
|
||||||
ShapelessRecipe shapelessRecipe = new ShapelessRecipe(itemType);
|
ShapelessRecipe shapelessRecipe = new ShapelessRecipe(itemType);
|
||||||
shapelessRecipe.addIngredient(Material.SULPHUR);
|
shapelessRecipe.addIngredient(Material.LEGACY_SULPHUR);
|
||||||
shapelessRecipe.addIngredient(Material.PAPER);
|
shapelessRecipe.addIngredient(Material.PAPER);
|
||||||
shapelessRecipe.addIngredient(Material.FIREWORK_CHARGE);
|
shapelessRecipe.addIngredient(Material.FIREWORK_ROCKET);
|
||||||
shapelessRecipe(sender, shapelessRecipe, sender.isPlayer());
|
shapelessRecipe(sender, shapelessRecipe, sender.isPlayer());
|
||||||
} else {
|
} else {
|
||||||
shapelessRecipe(sender, (ShapelessRecipe) selectedRecipe, sender.isPlayer());
|
shapelessRecipe(sender, (ShapelessRecipe) selectedRecipe, sender.isPlayer());
|
||||||
|
|
|
@ -31,14 +31,14 @@ public class Commandskull extends EssentialsCommand {
|
||||||
owner = user.getName();
|
owner = user.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack itemSkull = user.getBase().getItemInHand();
|
ItemStack itemSkull = user.getBase().getInventory().getItemInMainHand();
|
||||||
SkullMeta metaSkull = null;
|
SkullMeta metaSkull = null;
|
||||||
boolean spawn = false;
|
boolean spawn = false;
|
||||||
|
|
||||||
if (itemSkull != null && itemSkull.getType() == Material.SKULL_ITEM && itemSkull.getDurability() == 3) {
|
if (itemSkull != null && itemSkull.getType() == Material.LEGACY_SKULL_ITEM && itemSkull.getDurability() == 3) {
|
||||||
metaSkull = (SkullMeta) itemSkull.getItemMeta();
|
metaSkull = (SkullMeta) itemSkull.getItemMeta();
|
||||||
} else if (user.isAuthorized("essentials.skull.spawn")) {
|
} else if (user.isAuthorized("essentials.skull.spawn")) {
|
||||||
itemSkull = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3);
|
itemSkull = new ItemStack(Material.LEGACY_SKULL_ITEM, 1, (byte) 3);
|
||||||
metaSkull = (SkullMeta) itemSkull.getItemMeta();
|
metaSkull = (SkullMeta) itemSkull.getItemMeta();
|
||||||
spawn = true;
|
spawn = true;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class Commandunlimited extends EssentialsCommand {
|
||||||
stack.setAmount(Math.min(stack.getType().getMaxStackSize(), 2));
|
stack.setAmount(Math.min(stack.getType().getMaxStackSize(), 2));
|
||||||
|
|
||||||
final String itemname = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", "");
|
final String itemname = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", "");
|
||||||
if (ess.getSettings().permissionBasedItemSpawn() && (!user.isAuthorized("essentials.unlimited.item-all") && !user.isAuthorized("essentials.unlimited.item-" + itemname) && !user.isAuthorized("essentials.unlimited.item-" + stack.getTypeId()) && !((stack.getType() == Material.WATER_BUCKET || stack.getType() == Material.LAVA_BUCKET) && user.isAuthorized("essentials.unlimited.item-bucket")))) {
|
if (ess.getSettings().permissionBasedItemSpawn() && (!user.isAuthorized("essentials.unlimited.item-all") && !user.isAuthorized("essentials.unlimited.item-" + itemname) && !((stack.getType() == Material.WATER_BUCKET || stack.getType() == Material.LAVA_BUCKET) && user.isAuthorized("essentials.unlimited.item-bucket")))) {
|
||||||
throw new Exception(tl("unlimitedItemPermission", itemname));
|
throw new Exception(tl("unlimitedItemPermission", itemname));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class Commandwhois extends EssentialsCommand {
|
||||||
sender.sendMessage(tl("whoisHunger", user.getBase().getFoodLevel(), user.getBase().getSaturation()));
|
sender.sendMessage(tl("whoisHunger", user.getBase().getFoodLevel(), user.getBase().getSaturation()));
|
||||||
sender.sendMessage(tl("whoisExp", SetExpFix.getTotalExperience(user.getBase()), user.getBase().getLevel()));
|
sender.sendMessage(tl("whoisExp", SetExpFix.getTotalExperience(user.getBase()), user.getBase().getLevel()));
|
||||||
sender.sendMessage(tl("whoisLocation", user.getLocation().getWorld().getName(), user.getLocation().getBlockX(), user.getLocation().getBlockY(), user.getLocation().getBlockZ()));
|
sender.sendMessage(tl("whoisLocation", user.getLocation().getWorld().getName(), user.getLocation().getBlockX(), user.getLocation().getBlockY(), user.getLocation().getBlockZ()));
|
||||||
long playtimeMs = System.currentTimeMillis() - (user.getBase().getStatistic(Statistic.PLAY_ONE_TICK) * 50);
|
long playtimeMs = System.currentTimeMillis() - (user.getBase().getStatistic(Statistic.PLAY_ONE_MINUTE) * 60);
|
||||||
sender.sendMessage(tl("whoisPlaytime", DateUtil.formatDateDiff(playtimeMs)));
|
sender.sendMessage(tl("whoisPlaytime", DateUtil.formatDateDiff(playtimeMs)));
|
||||||
if (!ess.getSettings().isEcoDisabled()) {
|
if (!ess.getSettings().isEcoDisabled()) {
|
||||||
sender.sendMessage(tl("whoisMoney", NumberUtil.displayCurrency(user.getMoney(), ess)));
|
sender.sendMessage(tl("whoisMoney", NumberUtil.displayCurrency(user.getMoney(), ess)));
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.earth2me.essentials.craftbukkit;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.*;
|
||||||
import org.bukkit.generator.BlockPopulator;
|
import org.bukkit.generator.BlockPopulator;
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
|
@ -38,16 +39,6 @@ public class FakeWorld implements World {
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getBlockTypeIdAt(int i, int i1, int i2) {
|
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getBlockTypeIdAt(Location lctn) {
|
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getHighestBlockYAt(int i, int i1) {
|
public int getHighestBlockYAt(int i, int i1) {
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
@ -163,11 +154,6 @@ public class FakeWorld implements World {
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean generateTree(Location lctn, TreeType tt, BlockChangeDelegate bcd) {
|
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LightningStrike strikeLightning(Location lctn) {
|
public LightningStrike strikeLightning(Location lctn) {
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
@ -203,6 +189,11 @@ public class FakeWorld implements World {
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean setSpawnLocation(Location location) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setSpawnLocation(int i, int i1, int i2) {
|
public boolean setSpawnLocation(int i, int i1, int i2) {
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
@ -348,6 +339,11 @@ public class FakeWorld implements World {
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FallingBlock spawnFallingBlock(Location location, BlockData blockData) throws IllegalArgumentException {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChunkSnapshot getEmptyChunkSnapshot(int i, int i1, boolean bln, boolean bln1) {
|
public ChunkSnapshot getEmptyChunkSnapshot(int i, int i1, boolean bln, boolean bln1) {
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
@ -583,11 +579,6 @@ public class FakeWorld implements World {
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public FallingBlock spawnFallingBlock(Location location, int blockId, byte blockData) throws IllegalArgumentException {
|
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void playSound(Location arg0, Sound arg1, float arg2, float arg3) {
|
public void playSound(Location arg0, Sound arg1, float arg2, float arg3) {
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
|
|
@ -9,8 +9,7 @@ import org.bukkit.Location;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
@Data @EqualsAndHashCode(callSuper = false) public class Spawns implements StorageObject {
|
@Data @EqualsAndHashCode(callSuper = false) public class Spawns implements StorageObject {
|
||||||
@MapValueType(Location.class)
|
@MapValueType(Location.class)
|
||||||
private Map<String, Location> spawns = new HashMap<String, Location>();
|
private Map<String, Location> spawns = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,7 +213,7 @@ public class EssentialsSign {
|
||||||
|
|
||||||
protected static boolean checkIfBlockBreaksSigns(final Block block) {
|
protected static boolean checkIfBlockBreaksSigns(final Block block) {
|
||||||
final Block sign = block.getRelative(BlockFace.UP);
|
final Block sign = block.getRelative(BlockFace.UP);
|
||||||
if (sign.getType() == Material.SIGN_POST && isValidSign(new BlockSign(sign))) {
|
if (sign.getType() == Material.SIGN && isValidSign(new BlockSign(sign))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
final BlockFace[] directions = new BlockFace[]{BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST};
|
final BlockFace[] directions = new BlockFace[]{BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST};
|
||||||
|
|
|
@ -22,7 +22,7 @@ import java.util.logging.Logger;
|
||||||
public class SignBlockListener implements Listener {
|
public class SignBlockListener implements Listener {
|
||||||
private static final Logger LOGGER = Logger.getLogger("Essentials");
|
private static final Logger LOGGER = Logger.getLogger("Essentials");
|
||||||
private static final Material WALL_SIGN = Material.WALL_SIGN;
|
private static final Material WALL_SIGN = Material.WALL_SIGN;
|
||||||
private static final Material SIGN_POST = Material.SIGN_POST;
|
private static final Material SIGN_POST = Material.SIGN;
|
||||||
private final transient IEssentials ess;
|
private final transient IEssentials ess;
|
||||||
|
|
||||||
public SignBlockListener(IEssentials ess) {
|
public SignBlockListener(IEssentials ess) {
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class SignEntityListener implements Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Block block : event.blockList()) {
|
for (Block block : event.blockList()) {
|
||||||
if (((block.getType() == Material.WALL_SIGN || block.getType() == Material.SIGN_POST) && EssentialsSign.isValidSign(ess, new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) {
|
if (((block.getType() == Material.WALL_SIGN || block.getType() == Material.SIGN) && EssentialsSign.isValidSign(ess, new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ public class SignEntityListener implements Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
final Block block = event.getBlock();
|
final Block block = event.getBlock();
|
||||||
if (((block.getType() == Material.WALL_SIGN || block.getType() == Material.SIGN_POST) && EssentialsSign.isValidSign(ess, new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) {
|
if (((block.getType() == Material.WALL_SIGN || block.getType() == Material.SIGN) && EssentialsSign.isValidSign(ess, new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class SignPlayerListener implements Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
final Material mat = block.getType();
|
final Material mat = block.getType();
|
||||||
if (mat == Material.SIGN_POST || mat == Material.WALL_SIGN) {
|
if (mat == Material.SIGN || mat == Material.WALL_SIGN) {
|
||||||
final String csign = ((Sign) block.getState()).getLine(0);
|
final String csign = ((Sign) block.getState()).getLine(0);
|
||||||
for (EssentialsSign sign : ess.getSettings().enabledSigns()) {
|
for (EssentialsSign sign : ess.getSettings().enabledSigns()) {
|
||||||
if (csign.equalsIgnoreCase(sign.getSuccessName(ess))) {
|
if (csign.equalsIgnoreCase(sign.getSuccessName(ess))) {
|
||||||
|
|
|
@ -26,7 +26,6 @@ public class SignProtection extends EssentialsSign {
|
||||||
public SignProtection() {
|
public SignProtection() {
|
||||||
super("Protection");
|
super("Protection");
|
||||||
protectedBlocks.add(Material.CHEST);
|
protectedBlocks.add(Material.CHEST);
|
||||||
protectedBlocks.add(Material.BURNING_FURNACE);
|
|
||||||
protectedBlocks.add(Material.FURNACE);
|
protectedBlocks.add(Material.FURNACE);
|
||||||
protectedBlocks.add(Material.DISPENSER);
|
protectedBlocks.add(Material.DISPENSER);
|
||||||
}
|
}
|
||||||
|
@ -103,7 +102,7 @@ public class SignProtection extends EssentialsSign {
|
||||||
}
|
}
|
||||||
|
|
||||||
private SignProtectionState checkProtectionSign(final Block block, final User user, final String username) {
|
private SignProtectionState checkProtectionSign(final Block block, final User user, final String username) {
|
||||||
if (block.getType() == Material.SIGN_POST || block.getType() == Material.WALL_SIGN) {
|
if (block.getType() == Material.SIGN || block.getType() == Material.WALL_SIGN) {
|
||||||
final BlockSign sign = new BlockSign(block);
|
final BlockSign sign = new BlockSign(block);
|
||||||
if (sign.getLine(0).equals(this.getSuccessName())) { // TODO call getSuccessName(IEssentials)
|
if (sign.getLine(0).equals(this.getSuccessName())) { // TODO call getSuccessName(IEssentials)
|
||||||
return checkProtectionSign(sign, user, username);
|
return checkProtectionSign(sign, user, username);
|
||||||
|
@ -160,7 +159,7 @@ public class SignProtection extends EssentialsSign {
|
||||||
public boolean isBlockProtected(final Block block) {
|
public boolean isBlockProtected(final Block block) {
|
||||||
final Block[] faces = getAdjacentBlocks(block);
|
final Block[] faces = getAdjacentBlocks(block);
|
||||||
for (Block b : faces) {
|
for (Block b : faces) {
|
||||||
if (b.getType() == Material.SIGN_POST || b.getType() == Material.WALL_SIGN) {
|
if (b.getType() == Material.SIGN || b.getType() == Material.WALL_SIGN) {
|
||||||
final Sign sign = (Sign) b.getState();
|
final Sign sign = (Sign) b.getState();
|
||||||
if (sign.getLine(0).equalsIgnoreCase("§1[Protection]")) {
|
if (sign.getLine(0).equalsIgnoreCase("§1[Protection]")) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -170,7 +169,7 @@ public class SignProtection extends EssentialsSign {
|
||||||
final Block[] faceChest = getAdjacentBlocks(b);
|
final Block[] faceChest = getAdjacentBlocks(b);
|
||||||
|
|
||||||
for (Block a : faceChest) {
|
for (Block a : faceChest) {
|
||||||
if (a.getType() == Material.SIGN_POST || a.getType() == Material.WALL_SIGN) {
|
if (a.getType() == Material.SIGN || a.getType() == Material.WALL_SIGN) {
|
||||||
final Sign sign = (Sign) a.getState();
|
final Sign sign = (Sign) a.getState();
|
||||||
if (sign.getLine(0).equalsIgnoreCase("§1[Protection]")) {
|
if (sign.getLine(0).equalsIgnoreCase("§1[Protection]")) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.earth2me.essentials.utils;
|
package com.earth2me.essentials.utils;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.IEssentials;
|
||||||
import net.ess3.api.IUser;
|
import net.ess3.api.IUser;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
@ -13,9 +14,6 @@ import java.util.*;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n.tl;
|
import static com.earth2me.essentials.I18n.tl;
|
||||||
|
|
||||||
import com.earth2me.essentials.Essentials;
|
|
||||||
import com.earth2me.essentials.IEssentials;
|
|
||||||
|
|
||||||
|
|
||||||
public class LocationUtil {
|
public class LocationUtil {
|
||||||
// The player can stand inside these materials
|
// The player can stand inside these materials
|
||||||
|
@ -24,147 +22,22 @@ public class LocationUtil {
|
||||||
|
|
||||||
static {
|
static {
|
||||||
// Materials from Material.isTransparent()
|
// Materials from Material.isTransparent()
|
||||||
HOLLOW_MATERIALS.add(Material.AIR);
|
for (Material mat : Material.values()) {
|
||||||
HOLLOW_MATERIALS.add(Material.SAPLING);
|
if (mat.isTransparent()) {
|
||||||
HOLLOW_MATERIALS.add(Material.POWERED_RAIL);
|
HOLLOW_MATERIALS.add(mat);
|
||||||
HOLLOW_MATERIALS.add(Material.DETECTOR_RAIL);
|
}
|
||||||
HOLLOW_MATERIALS.add(Material.LONG_GRASS);
|
}
|
||||||
HOLLOW_MATERIALS.add(Material.DEAD_BUSH);
|
|
||||||
HOLLOW_MATERIALS.add(Material.YELLOW_FLOWER);
|
|
||||||
HOLLOW_MATERIALS.add(Material.RED_ROSE);
|
|
||||||
HOLLOW_MATERIALS.add(Material.BROWN_MUSHROOM);
|
|
||||||
HOLLOW_MATERIALS.add(Material.RED_MUSHROOM);
|
|
||||||
HOLLOW_MATERIALS.add(Material.TORCH);
|
|
||||||
HOLLOW_MATERIALS.add(Material.FIRE);
|
|
||||||
HOLLOW_MATERIALS.add(Material.REDSTONE_WIRE);
|
|
||||||
HOLLOW_MATERIALS.add(Material.CROPS);
|
|
||||||
HOLLOW_MATERIALS.add(Material.LADDER);
|
|
||||||
HOLLOW_MATERIALS.add(Material.RAILS);
|
|
||||||
HOLLOW_MATERIALS.add(Material.LEVER);
|
|
||||||
HOLLOW_MATERIALS.add(Material.REDSTONE_TORCH_OFF);
|
|
||||||
HOLLOW_MATERIALS.add(Material.REDSTONE_TORCH_ON);
|
|
||||||
HOLLOW_MATERIALS.add(Material.STONE_BUTTON);
|
|
||||||
HOLLOW_MATERIALS.add(Material.SNOW);
|
|
||||||
HOLLOW_MATERIALS.add(Material.SUGAR_CANE_BLOCK);
|
|
||||||
HOLLOW_MATERIALS.add(Material.PORTAL);
|
|
||||||
HOLLOW_MATERIALS.add(Material.DIODE_BLOCK_OFF);
|
|
||||||
HOLLOW_MATERIALS.add(Material.DIODE_BLOCK_ON);
|
|
||||||
HOLLOW_MATERIALS.add(Material.PUMPKIN_STEM);
|
|
||||||
HOLLOW_MATERIALS.add(Material.MELON_STEM);
|
|
||||||
HOLLOW_MATERIALS.add(Material.VINE);
|
|
||||||
HOLLOW_MATERIALS.add(Material.WATER_LILY);
|
|
||||||
HOLLOW_MATERIALS.add(Material.NETHER_WARTS);
|
|
||||||
HOLLOW_MATERIALS.add(Material.ENDER_PORTAL);
|
|
||||||
HOLLOW_MATERIALS.add(Material.COCOA);
|
|
||||||
HOLLOW_MATERIALS.add(Material.TRIPWIRE_HOOK);
|
|
||||||
HOLLOW_MATERIALS.add(Material.TRIPWIRE);
|
|
||||||
HOLLOW_MATERIALS.add(Material.FLOWER_POT);
|
|
||||||
HOLLOW_MATERIALS.add(Material.CARROT);
|
|
||||||
HOLLOW_MATERIALS.add(Material.POTATO);
|
|
||||||
HOLLOW_MATERIALS.add(Material.WOOD_BUTTON);
|
|
||||||
HOLLOW_MATERIALS.add(Material.SKULL);
|
|
||||||
HOLLOW_MATERIALS.add(Material.REDSTONE_COMPARATOR_OFF);
|
|
||||||
HOLLOW_MATERIALS.add(Material.REDSTONE_COMPARATOR_ON);
|
|
||||||
HOLLOW_MATERIALS.add(Material.ACTIVATOR_RAIL);
|
|
||||||
HOLLOW_MATERIALS.add(Material.CARPET);
|
|
||||||
HOLLOW_MATERIALS.add(Material.DOUBLE_PLANT);
|
|
||||||
|
|
||||||
// Additional Materials added in by Essentials
|
|
||||||
HOLLOW_MATERIALS.add(Material.SEEDS);
|
|
||||||
HOLLOW_MATERIALS.add(Material.SIGN_POST);
|
|
||||||
HOLLOW_MATERIALS.add(Material.WOODEN_DOOR);
|
|
||||||
HOLLOW_MATERIALS.add(Material.WALL_SIGN);
|
|
||||||
HOLLOW_MATERIALS.add(Material.STONE_PLATE);
|
|
||||||
HOLLOW_MATERIALS.add(Material.IRON_DOOR_BLOCK);
|
|
||||||
HOLLOW_MATERIALS.add(Material.WOOD_PLATE);
|
|
||||||
HOLLOW_MATERIALS.add(Material.FENCE_GATE);
|
|
||||||
|
|
||||||
TRANSPARENT_MATERIALS.addAll(HOLLOW_MATERIALS);
|
TRANSPARENT_MATERIALS.addAll(HOLLOW_MATERIALS);
|
||||||
TRANSPARENT_MATERIALS.add(Material.WATER);
|
TRANSPARENT_MATERIALS.add(Material.WATER);
|
||||||
TRANSPARENT_MATERIALS.add(Material.STATIONARY_WATER);
|
TRANSPARENT_MATERIALS.add(Material.FLOWING_WATER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final int RADIUS = 3;
|
public static final int RADIUS = 3;
|
||||||
public static final Vector3D[] VOLUME;
|
public static final Vector3D[] VOLUME;
|
||||||
|
|
||||||
public static ItemStack convertBlockToItem(final Block block) {
|
public static ItemStack convertBlockToItem(final Block block) {
|
||||||
final ItemStack is = new ItemStack(block.getType(), 1, (short) 0, block.getData());
|
return new ItemStack(block.getType(), 1);
|
||||||
switch (is.getType()) {
|
|
||||||
case WOODEN_DOOR:
|
|
||||||
is.setType(Material.WOOD_DOOR);
|
|
||||||
is.setDurability((short) 0);
|
|
||||||
break;
|
|
||||||
case IRON_DOOR_BLOCK:
|
|
||||||
is.setType(Material.IRON_DOOR);
|
|
||||||
is.setDurability((short) 0);
|
|
||||||
break;
|
|
||||||
case SIGN_POST:
|
|
||||||
case WALL_SIGN:
|
|
||||||
is.setType(Material.SIGN);
|
|
||||||
is.setDurability((short) 0);
|
|
||||||
break;
|
|
||||||
case CROPS:
|
|
||||||
is.setType(Material.SEEDS);
|
|
||||||
is.setDurability((short) 0);
|
|
||||||
break;
|
|
||||||
case CAKE_BLOCK:
|
|
||||||
is.setType(Material.CAKE);
|
|
||||||
is.setDurability((short) 0);
|
|
||||||
break;
|
|
||||||
case BED_BLOCK:
|
|
||||||
is.setType(Material.BED);
|
|
||||||
is.setDurability((short) 0);
|
|
||||||
break;
|
|
||||||
case REDSTONE_WIRE:
|
|
||||||
is.setType(Material.REDSTONE);
|
|
||||||
is.setDurability((short) 0);
|
|
||||||
break;
|
|
||||||
case REDSTONE_TORCH_OFF:
|
|
||||||
case REDSTONE_TORCH_ON:
|
|
||||||
is.setType(Material.REDSTONE_TORCH_ON);
|
|
||||||
is.setDurability((short) 0);
|
|
||||||
break;
|
|
||||||
case DIODE_BLOCK_OFF:
|
|
||||||
case DIODE_BLOCK_ON:
|
|
||||||
is.setType(Material.DIODE);
|
|
||||||
is.setDurability((short) 0);
|
|
||||||
break;
|
|
||||||
case DOUBLE_STEP:
|
|
||||||
is.setType(Material.STEP);
|
|
||||||
break;
|
|
||||||
case TORCH:
|
|
||||||
case RAILS:
|
|
||||||
case LADDER:
|
|
||||||
case WOOD_STAIRS:
|
|
||||||
case COBBLESTONE_STAIRS:
|
|
||||||
case LEVER:
|
|
||||||
case STONE_BUTTON:
|
|
||||||
case FURNACE:
|
|
||||||
case DISPENSER:
|
|
||||||
case PUMPKIN:
|
|
||||||
case JACK_O_LANTERN:
|
|
||||||
case WOOD_PLATE:
|
|
||||||
case STONE_PLATE:
|
|
||||||
case PISTON_STICKY_BASE:
|
|
||||||
case PISTON_BASE:
|
|
||||||
case IRON_FENCE:
|
|
||||||
case THIN_GLASS:
|
|
||||||
case TRAP_DOOR:
|
|
||||||
case FENCE:
|
|
||||||
case FENCE_GATE:
|
|
||||||
case NETHER_FENCE:
|
|
||||||
is.setDurability((short) 0);
|
|
||||||
break;
|
|
||||||
case FIRE:
|
|
||||||
return null;
|
|
||||||
case PUMPKIN_STEM:
|
|
||||||
is.setType(Material.PUMPKIN_SEEDS);
|
|
||||||
break;
|
|
||||||
case MELON_STEM:
|
|
||||||
is.setType(Material.MELON_SEEDS);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return is;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -200,15 +73,11 @@ public class LocationUtil {
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public static Location getTarget(final LivingEntity entity) throws Exception {
|
public static Location getTarget(final LivingEntity entity) throws Exception {
|
||||||
Block block;
|
Block block = null;
|
||||||
try {
|
try {
|
||||||
block = entity.getTargetBlock(TRANSPARENT_MATERIALS, 300);
|
block = entity.getTargetBlock(TRANSPARENT_MATERIALS, 300);
|
||||||
} catch (NoSuchMethodError e) {
|
} catch (NoSuchMethodError e) {
|
||||||
HashSet<Byte> legacyTransparent = new HashSet<>(); // Bukkit API prevents declaring as Set<Byte>
|
// failing now :(
|
||||||
for (Material m : TRANSPARENT_MATERIALS) {
|
|
||||||
legacyTransparent.add((byte) m.getId());
|
|
||||||
}
|
|
||||||
block = entity.getTargetBlock(legacyTransparent, 300);
|
|
||||||
}
|
}
|
||||||
if (block == null) {
|
if (block == null) {
|
||||||
throw new Exception("Not targeting a block");
|
throw new Exception("Not targeting a block");
|
||||||
|
@ -217,10 +86,7 @@ public class LocationUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean isBlockAboveAir(final World world, final int x, final int y, final int z) {
|
static boolean isBlockAboveAir(final World world, final int x, final int y, final int z) {
|
||||||
if (y > world.getMaxHeight()) {
|
return y > world.getMaxHeight() || HOLLOW_MATERIALS.contains(world.getBlockAt(x, y - 1, z).getType());
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return HOLLOW_MATERIALS.contains(world.getBlockAt(x, y - 1, z).getType());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isBlockUnsafeForUser(final IUser user, final World world, final int x, final int y, final int z) {
|
public static boolean isBlockUnsafeForUser(final IUser user, final World world, final int x, final int y, final int z) {
|
||||||
|
@ -235,26 +101,39 @@ public class LocationUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isBlockUnsafe(final World world, final int x, final int y, final int z) {
|
public static boolean isBlockUnsafe(final World world, final int x, final int y, final int z) {
|
||||||
if (isBlockDamaging(world, x, y, z)) {
|
return isBlockDamaging(world, x, y, z) || isBlockAboveAir(world, x, y, z);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return isBlockAboveAir(world, x, y, z);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isBlockDamaging(final World world, final int x, final int y, final int z) {
|
public static boolean isBlockDamaging(final World world, final int x, final int y, final int z) {
|
||||||
final Block below = world.getBlockAt(x, y - 1, z);
|
final Block below = world.getBlockAt(x, y - 1, z);
|
||||||
if (below.getType() == Material.LAVA || below.getType() == Material.STATIONARY_LAVA) {
|
|
||||||
return true;
|
switch (below.getType()) {
|
||||||
}
|
case LAVA:
|
||||||
if (below.getType() == Material.FIRE) {
|
case FLOWING_LAVA:
|
||||||
return true;
|
case FIRE:
|
||||||
}
|
case BLACK_BED:
|
||||||
if (below.getType() == Material.BED_BLOCK) {
|
case BLUE_BED:
|
||||||
|
case BROWN_BED:
|
||||||
|
case CYAN_BED:
|
||||||
|
case GRAY_BED:
|
||||||
|
case GREEN_BED:
|
||||||
|
case LIGHT_BLUE_BED:
|
||||||
|
case LIGHT_GRAY_BED:
|
||||||
|
case LIME_BED:
|
||||||
|
case MAGENTA_BED:
|
||||||
|
case ORANGE_BED:
|
||||||
|
case PINK_BED:
|
||||||
|
case PURPLE_BED:
|
||||||
|
case RED_BED:
|
||||||
|
case WHITE_BED:
|
||||||
|
case YELLOW_BED:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (world.getBlockAt(x, y, z).getType() == Material.PORTAL) {
|
if (world.getBlockAt(x, y, z).getType() == Material.PORTAL) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (!HOLLOW_MATERIALS.contains(world.getBlockAt(x, y, z).getType())) || (!HOLLOW_MATERIALS.contains(world.getBlockAt(x, y + 1, z).getType()));
|
return (!HOLLOW_MATERIALS.contains(world.getBlockAt(x, y, z).getType())) || (!HOLLOW_MATERIALS.contains(world.getBlockAt(x, y + 1, z).getType()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import org.bukkit.*;
|
||||||
import org.bukkit.Warning.WarningState;
|
import org.bukkit.Warning.WarningState;
|
||||||
import org.bukkit.World.Environment;
|
import org.bukkit.World.Environment;
|
||||||
import org.bukkit.advancement.Advancement;
|
import org.bukkit.advancement.Advancement;
|
||||||
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.boss.BarColor;
|
import org.bukkit.boss.BarColor;
|
||||||
import org.bukkit.boss.BarFlag;
|
import org.bukkit.boss.BarFlag;
|
||||||
import org.bukkit.boss.BarStyle;
|
import org.bukkit.boss.BarStyle;
|
||||||
|
@ -969,6 +970,16 @@ public class FakeServer implements Server {
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockData createData(Material material) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T extends Keyed> Tag<T> getTag(String s, NamespacedKey namespacedKey, Class<T> aClass) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
class FakePluginManager implements PluginManager {
|
class FakePluginManager implements PluginManager {
|
||||||
ArrayList<RegisteredListener> listeners = new ArrayList<RegisteredListener>();
|
ArrayList<RegisteredListener> listeners = new ArrayList<RegisteredListener>();
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,6 @@ public class EssentialsAntiBuildListener implements Listener {
|
||||||
public void onBlockPlace(final BlockPlaceEvent event) {
|
public void onBlockPlace(final BlockPlaceEvent event) {
|
||||||
final User user = ess.getUser(event.getPlayer());
|
final User user = ess.getUser(event.getPlayer());
|
||||||
final Block block = event.getBlockPlaced();
|
final Block block = event.getBlockPlaced();
|
||||||
final int typeId = block.getTypeId();
|
|
||||||
final Material type = block.getType();
|
final Material type = block.getType();
|
||||||
|
|
||||||
if (prot.getSettingBool(AntiBuildConfig.disable_build) && !user.canBuild() && !user.isAuthorized("essentials.build") && !metaPermCheck(user, "place", block)) {
|
if (prot.getSettingBool(AntiBuildConfig.disable_build) && !user.canBuild() && !user.isAuthorized("essentials.build") && !metaPermCheck(user, "place", block)) {
|
||||||
|
@ -95,7 +94,6 @@ public class EssentialsAntiBuildListener implements Listener {
|
||||||
public void onBlockBreak(final BlockBreakEvent event) {
|
public void onBlockBreak(final BlockBreakEvent event) {
|
||||||
final User user = ess.getUser(event.getPlayer());
|
final User user = ess.getUser(event.getPlayer());
|
||||||
final Block block = event.getBlock();
|
final Block block = event.getBlock();
|
||||||
final int typeId = block.getTypeId();
|
|
||||||
final Material type = block.getType();
|
final Material type = block.getType();
|
||||||
|
|
||||||
if (prot.getSettingBool(AntiBuildConfig.disable_build) && !user.canBuild() && !user.isAuthorized("essentials.build") && !metaPermCheck(user, "break", block)) {
|
if (prot.getSettingBool(AntiBuildConfig.disable_build) && !user.canBuild() && !user.isAuthorized("essentials.build") && !metaPermCheck(user, "break", block)) {
|
||||||
|
|
|
@ -57,12 +57,12 @@ public class EssentialsProtectBlockListener implements Listener {
|
||||||
public void onBlockFromTo(final BlockFromToEvent event) {
|
public void onBlockFromTo(final BlockFromToEvent event) {
|
||||||
final Block block = event.getBlock();
|
final Block block = event.getBlock();
|
||||||
|
|
||||||
if (block.getType() == Material.WATER || block.getType() == Material.STATIONARY_WATER) {
|
if (block.getType() == Material.WATER || block.getType() == Material.WATER) {
|
||||||
event.setCancelled(prot.getSettingBool(ProtectConfig.prevent_water_flow));
|
event.setCancelled(prot.getSettingBool(ProtectConfig.prevent_water_flow));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (block.getType() == Material.LAVA || block.getType() == Material.STATIONARY_LAVA) {
|
if (block.getType() == Material.LAVA || block.getType() == Material.LAVA) {
|
||||||
event.setCancelled(prot.getSettingBool(ProtectConfig.prevent_lava_flow));
|
event.setCancelled(prot.getSettingBool(ProtectConfig.prevent_lava_flow));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,8 @@ public class SpawnEggRefl {
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public ItemStack toItemStack(int amount) throws Exception {
|
public ItemStack toItemStack(int amount) throws Exception {
|
||||||
ItemStack item = new ItemStack(Material.MONSTER_EGG, amount);
|
// TODO: Get off of the deprecated LEGACY material.
|
||||||
|
ItemStack item = new ItemStack(Material.LEGACY_MONSTER_EGG, amount);
|
||||||
|
|
||||||
Class<?> craftItemStackClass = ReflUtil.getOBCClass("inventory.CraftItemStack");
|
Class<?> craftItemStackClass = ReflUtil.getOBCClass("inventory.CraftItemStack");
|
||||||
Method asNMSCopyMethod = ReflUtil.getMethodCached(craftItemStackClass, "asNMSCopy", ItemStack.class);
|
Method asNMSCopyMethod = ReflUtil.getMethodCached(craftItemStackClass, "asNMSCopy", ItemStack.class);
|
||||||
|
@ -122,7 +123,7 @@ public class SpawnEggRefl {
|
||||||
public static SpawnEggRefl fromItemStack(ItemStack item) throws Exception {
|
public static SpawnEggRefl fromItemStack(ItemStack item) throws Exception {
|
||||||
if (item == null)
|
if (item == null)
|
||||||
throw new IllegalArgumentException("Item cannot be null");
|
throw new IllegalArgumentException("Item cannot be null");
|
||||||
if (item.getType() != Material.MONSTER_EGG)
|
if (item.getType() != Material.LEGACY_MONSTER_EGG)
|
||||||
throw new IllegalArgumentException("Item is not a monster egg");
|
throw new IllegalArgumentException("Item is not a monster egg");
|
||||||
|
|
||||||
Class<?> NMSItemStackClass = ReflUtil.getNMSClass("ItemStack");
|
Class<?> NMSItemStackClass = ReflUtil.getNMSClass("ItemStack");
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -53,7 +53,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bukkit</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
<artifactId>bukkit</artifactId>
|
<artifactId>bukkit</artifactId>
|
||||||
<version>1.12-R0.1-SNAPSHOT</version>
|
<version>18w02a-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
Loading…
Reference in a new issue