update bukkit to 1.13-R0.1-SNAPSHOT.

This commit just fixes compilation errors.
This commit is contained in:
Ali Moghnieh 2018-07-29 17:39:32 +01:00
parent 03b25a0f06
commit 768b92749f
No known key found for this signature in database
GPG Key ID: 56A12671AC129C36
12 changed files with 121 additions and 36 deletions

View File

@ -1,6 +1,8 @@
package com.earth2me.essentials;
import com.earth2me.essentials.utils.NumberUtil;
import org.bukkit.NamespacedKey;
import org.bukkit.enchantments.Enchantment;
import java.util.HashMap;
@ -200,11 +202,9 @@ public class Enchantments {
}
public static Enchantment getByName(String name) {
Enchantment enchantment;
if (NumberUtil.isInt(name)) {
enchantment = Enchantment.getById(Integer.parseInt(name));
} else {
enchantment = Enchantment.getByName(name.toUpperCase(Locale.ENGLISH));
Enchantment enchantment = Enchantment.getByKey(NamespacedKey.minecraft(name.toLowerCase()));
if (enchantment == null) {
enchantment = Enchantment.getByName(name.toUpperCase());
}
if (enchantment == null) {
enchantment = ENCHANTMENTS.get(name.toLowerCase(Locale.ENGLISH));

View File

@ -31,8 +31,14 @@ public class EssentialsBlockListener implements Listener {
if (is == null) {
return;
}
Material MOB_SPAWNER;
try {
MOB_SPAWNER = Material.SPAWNER;
} catch (Exception e) {
MOB_SPAWNER = Material.valueOf("MOB_SPAWNER");
}
if (is.getType() == Material.MOB_SPAWNER && event.getItemInHand() != null && event.getPlayer() != null && event.getItemInHand().getType() == Material.MOB_SPAWNER) {
if (is.getType() == MOB_SPAWNER && event.getItemInHand() != null && event.getPlayer() != null && event.getItemInHand().getType() == MOB_SPAWNER) {
final BlockState blockState = event.getBlockPlaced().getState();
if (blockState instanceof CreatureSpawner) {
final CreatureSpawner spawner = (CreatureSpawner) blockState;

View File

@ -184,7 +184,13 @@ public class ItemDb implements IConf, net.ess3.api.IItemDb {
}
retval = ess.getServer().getUnsafe().modifyItemStack(retval, nbt);
}
if (mat == Material.MOB_SPAWNER) {
Material MOB_SPAWNER;
try {
MOB_SPAWNER = Material.SPAWNER;
} catch (Exception e) {
MOB_SPAWNER = Material.valueOf("MOB_SPAWNER");
}
if (mat == MOB_SPAWNER) {
if (metaData == 0) metaData = EntityType.PIG.getTypeId();
try {
retval = ess.getSpawnerProvider().setEntityType(retval, EntityType.fromId(metaData));

View File

@ -9,6 +9,7 @@ import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeInstance;
import org.bukkit.block.Block;
import org.bukkit.block.PistonMoveReaction;
import org.bukkit.block.data.BlockData;
import org.bukkit.conversations.Conversation;
import org.bukkit.conversations.ConversationAbandonedEvent;
import org.bukkit.entity.*;
@ -470,6 +471,11 @@ public class OfflinePlayer implements Player {
public void sendBlockChange(Location lctn, Material mtrl, byte b) {
}
@Override
public void sendBlockChange(Location loc, BlockData block) {
}
@Override
public void setLastDamageCause(EntityDamageEvent ede) {
}
@ -639,6 +645,31 @@ public class OfflinePlayer implements Player {
public void setPlayerListName(String name) {
}
@Override
public String getPlayerListHeader() {
return null;
}
@Override
public String getPlayerListFooter() {
return null;
}
@Override
public void setPlayerListHeader(String header) {
}
@Override
public void setPlayerListFooter(String footer) {
}
@Override
public void setPlayerListHeaderFooter(String header, String footer) {
}
@Override
public String getPlayerListName() {
return name;
@ -1191,6 +1222,16 @@ public class OfflinePlayer implements Player {
public void setGliding(boolean b) {
}
@Override
public boolean isSwimming() {
return false;
}
@Override
public void setSwimming(boolean swimming) {
}
@Override
public void setAI(boolean b) {
}

View File

@ -28,7 +28,13 @@ public class Commandspawner extends EssentialsCommand {
}
final Location target = LocationUtil.getTarget(user.getBase());
if (target == null || target.getBlock().getType() != Material.MOB_SPAWNER) {
Material MOB_SPAWNER;
try {
MOB_SPAWNER = Material.SPAWNER;
} catch (Exception e) {
MOB_SPAWNER = Material.valueOf("MOB_SPAWNER");
}
if (target == null || target.getBlock().getType() != MOB_SPAWNER) {
throw new Exception(tl("mobSpawnTarget"));
}

View File

@ -154,6 +154,11 @@ public class FakeWorld implements World {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate) {
return false;
}
@Override
public LightningStrike strikeLightning(Location lctn) {
throw new UnsupportedOperationException("Not supported yet.");
@ -703,4 +708,4 @@ public class FakeWorld implements World {
public List<Entity> getNearbyEntities(Location loc, double x, double y, double z) {
throw new UnsupportedOperationException("Not supported yet.");
}
}
}

View File

@ -1,9 +1,11 @@
package com.earth2me.essentials.storage;
import com.earth2me.essentials.Enchantments;
import com.earth2me.essentials.utils.NumberUtil;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.World;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
@ -94,13 +96,7 @@ public class BukkitConstructor extends CustomClassLoaderConstructor {
if (split3.length < 1) {
continue;
}
Enchantment enchantment;
if (NumberUtil.isInt(split3[0])) {
final int enchantId = Integer.parseInt(split3[0]);
enchantment = Enchantment.getById(enchantId);
} else {
enchantment = Enchantment.getByName(split3[0].toUpperCase(Locale.ENGLISH));
}
Enchantment enchantment = Enchantments.getByName(split3[0]);
if (enchantment == null) {
continue;
}
@ -128,13 +124,7 @@ public class BukkitConstructor extends CustomClassLoaderConstructor {
if (split.length == 0) {
return null;
}
Enchantment enchant;
if (NumberUtil.isInt(split[0])) {
final int typeId = Integer.parseInt(split[0]);
enchant = Enchantment.getById(typeId);
} else {
enchant = Enchantment.getByName(split[0].toUpperCase(Locale.ENGLISH));
}
Enchantment enchant = Enchantments.getByName(split[0]);
if (enchant == null) {
return null;
}

View File

@ -30,7 +30,10 @@ public class LocationUtil {
TRANSPARENT_MATERIALS.addAll(HOLLOW_MATERIALS);
TRANSPARENT_MATERIALS.add(Material.WATER);
TRANSPARENT_MATERIALS.add(Material.FLOWING_WATER);
try {
TRANSPARENT_MATERIALS.add(Material.valueOf("FLOWING_WATER"));
} catch (Exception ignored) { // 1.13 WATER uses Levelled
}
}
public static final int RADIUS = 3;
@ -109,7 +112,6 @@ public class LocationUtil {
switch (below.getType()) {
case LAVA:
case FLOWING_LAVA:
case FIRE:
case BLACK_BED:
case BLUE_BED:
@ -129,8 +131,19 @@ public class LocationUtil {
case YELLOW_BED:
return true;
}
if (world.getBlockAt(x, y, z).getType() == Material.PORTAL) {
try {
if (below.getType() == Material.valueOf("FLOWING_LAVA")) {
return true;
}
} catch (Exception ignored) { // 1.13 LAVA uses Levelled
}
Material PORTAL;
try {
PORTAL = Material.NETHER_PORTAL;
} catch (Exception ignored) {
PORTAL = Material.valueOf("PORTAL");
}
if (world.getBlockAt(x, y, z).getType() == PORTAL) {
return true;
}

View File

@ -7,6 +7,7 @@ website: http://tiny.cc/EssentialsCommands
description: Provides an essential, core set of commands for Bukkit.
softdepend: [Vault]
authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits, md_5, Iaccidentally, drtshock, vemacs, SupaHam, md678685]
api-version: 1.13
commands:
afk:
description: Marks you as away-from-keyboard.

View File

@ -45,6 +45,7 @@ import java.io.UnsupportedEncodingException;
import java.util.*;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import java.util.function.Consumer;
import java.util.logging.Logger;
@ -207,11 +208,6 @@ public class FakeServer implements Server {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void cancelAllTasks() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean isCurrentlyRunning(int i) {
throw new UnsupportedOperationException("Not supported yet.");
@ -971,8 +967,23 @@ public class FakeServer implements Server {
}
@Override
public BlockData createData(Material material) {
throw new UnsupportedOperationException("Not supported yet.");
public BlockData createBlockData(Material material) {
return null;
}
@Override
public BlockData createBlockData(Material material, Consumer<BlockData> consumer) {
return null;
}
@Override
public BlockData createBlockData(String data) throws IllegalArgumentException {
return null;
}
@Override
public BlockData createBlockData(Material material, String data) throws IllegalArgumentException {
return null;
}
@Override

View File

@ -31,7 +31,13 @@ public abstract class SpawnerProvider implements Provider {
public boolean tryProvider() {
try {
EntityType type = EntityType.CREEPER;
ItemStack is = setEntityType(new ItemStack(Material.MOB_SPAWNER), type);
Material MOB_SPAWNER;
try {
MOB_SPAWNER = Material.SPAWNER;
} catch (Exception e) {
MOB_SPAWNER = Material.valueOf("MOB_SPAWNER");
}
ItemStack is = setEntityType(new ItemStack(MOB_SPAWNER), type);
EntityType readType = getEntityType(is);
return type == readType;
} catch (Throwable t) {

View File

@ -53,7 +53,7 @@
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>18w02a-R0.1-SNAPSHOT</version>
<version>1.13-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>