1.14 supported
This commit is contained in:
parent
f66b32a2ac
commit
483bba8f0a
@ -5,7 +5,7 @@ plugins {
|
||||
id 'com.github.johnrengelman.shadow' version '4.0.4'
|
||||
}
|
||||
group = 'me.skymc'
|
||||
version = '4.84'
|
||||
version = '4.85'
|
||||
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
@ -27,6 +27,7 @@ dependencies {
|
||||
exclude(module: 'slf4j-log4j12')
|
||||
exclude(module: 'log4j')
|
||||
}
|
||||
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.8'
|
||||
shadow group: 'com.zaxxer', name: 'HikariCP', version: '3.1.0'
|
||||
shadow group: 'org.javalite', name: 'activejdbc', version: '2.0'
|
||||
compile group: 'org.ow2.asm', name: 'asm', version: '7.0-beta'
|
||||
|
Binary file not shown.
@ -1,6 +1,7 @@
|
||||
name: TabooLib
|
||||
main: me.skymc.taboolib.Main
|
||||
version: ${version}
|
||||
api-version: 1.14
|
||||
|
||||
authors:
|
||||
- 坏黑
|
||||
|
@ -87,7 +87,7 @@ public class TLib {
|
||||
|
||||
public static void injectPluginManager() {
|
||||
if (!tLib.isInjectEnabled() || tLib.isBlackListPluginExists()) {
|
||||
TLocale.Logger.fatal("TLIB.INJECTION-DISABLED");
|
||||
TLocale.Logger.warn("TLIB.INJECTION-DISABLED");
|
||||
Arrays.stream(Bukkit.getPluginManager().getPlugins()).filter(plugin -> plugin != Main.getInst()).forEach(plugin -> TDependencyInjector.inject(plugin, plugin));
|
||||
return;
|
||||
}
|
||||
|
83
src/main/scala/me/skymc/taboolib/common/io/IOUtils.java
Normal file
83
src/main/scala/me/skymc/taboolib/common/io/IOUtils.java
Normal file
@ -0,0 +1,83 @@
|
||||
package me.skymc.taboolib.common.io;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.net.URLConnection;
|
||||
import java.nio.channels.Selector;
|
||||
|
||||
/**
|
||||
* from org.apache.commons.io
|
||||
* support for 1.14
|
||||
*/
|
||||
public class IOUtils {
|
||||
|
||||
public static void close(URLConnection v) {
|
||||
if (v instanceof HttpURLConnection) {
|
||||
((HttpURLConnection)v).disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
public static void closeQuietly(Reader v) {
|
||||
closeQuietly((Closeable)v);
|
||||
}
|
||||
|
||||
public static void closeQuietly(Writer v) {
|
||||
closeQuietly((Closeable)v);
|
||||
}
|
||||
|
||||
public static void closeQuietly(InputStream v) {
|
||||
closeQuietly((Closeable)v);
|
||||
}
|
||||
|
||||
public static void closeQuietly(OutputStream v) {
|
||||
closeQuietly((Closeable)v);
|
||||
}
|
||||
|
||||
public static void closeQuietly(Closeable v) {
|
||||
try {
|
||||
if (v != null) {
|
||||
v.close();
|
||||
}
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
public static void closeQuietly(Closeable... v) {
|
||||
if (v != null) {
|
||||
int var2 = v.length;
|
||||
for (Closeable var4 : v) {
|
||||
closeQuietly(var4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void closeQuietly(Socket v) {
|
||||
if (v != null) {
|
||||
try {
|
||||
v.close();
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void closeQuietly(Selector v) {
|
||||
if (v != null) {
|
||||
try {
|
||||
v.close();
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void closeQuietly(ServerSocket v) {
|
||||
if (v != null) {
|
||||
try {
|
||||
v.close();
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -73,10 +73,16 @@ public class NMSHandlerImpl extends NMSHandler {
|
||||
name += ".effect." + ((net.minecraft.server.v1_8_R3.ItemStack) nmsItem).getTag().getString("Potion").replaceAll("minecraft:(strong_|long_)?", "");
|
||||
}
|
||||
return name;
|
||||
} else {
|
||||
} else if (TabooLib.getVersionNumber() >= 11100) {
|
||||
String name = ((net.minecraft.server.v1_12_R1.ItemStack) nmsItem).getItem().a((net.minecraft.server.v1_12_R1.ItemStack) nmsItem);
|
||||
if (itemStack.getItemMeta() instanceof PotionMeta) {
|
||||
return name.replace("item.", "") + ".effect." + ((net.minecraft.server.v1_8_R3.ItemStack) nmsItem).getTag().getString("Potion").replaceAll("minecraft:(strong_|long_)?", "");
|
||||
return name.replace("item.", "") + ".effect." + ((net.minecraft.server.v1_8_R3.ItemStack) nmsItem).getTag().getString("Potion").replaceAll("(minecraft:)?(strong_|long_)?", "");
|
||||
}
|
||||
return name + ".name";
|
||||
} else {
|
||||
String name = ((net.minecraft.server.v1_8_R3.ItemStack) nmsItem).getItem().getName();
|
||||
if (itemStack.getItemMeta() instanceof PotionMeta) {
|
||||
return name.replace("item.", "") + ".effect." + ((net.minecraft.server.v1_8_R3.ItemStack) nmsItem).getTag().getString("Potion").replaceAll("(minecraft:)?(strong_|long_)?", "");
|
||||
}
|
||||
return name + ".name";
|
||||
}
|
||||
|
@ -5,12 +5,14 @@ import me.skymc.taboolib.Main;
|
||||
import me.skymc.taboolib.TabooLib;
|
||||
import me.skymc.taboolib.common.function.TFunction;
|
||||
import me.skymc.taboolib.common.nms.NMSHandler;
|
||||
import me.skymc.taboolib.common.nms.nbt.NBTCompound;
|
||||
import me.skymc.taboolib.fileutils.ConfigUtils;
|
||||
import me.skymc.taboolib.fileutils.FileUtils;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.BookMeta;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.SpawnEggMeta;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
@ -62,8 +64,19 @@ public class SimpleI18n {
|
||||
if (item == null) {
|
||||
return "-";
|
||||
}
|
||||
if (TabooLib.getVersionNumber() < 11300) {
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
if (itemMeta instanceof BookMeta && ((BookMeta) itemMeta).getTitle() != null) {
|
||||
return ((BookMeta) itemMeta).getTitle();
|
||||
}
|
||||
if (TabooLib.getVersionNumber() < 11100) {
|
||||
if (item.getType().name().equals("MONSTER_EGG")) {
|
||||
NBTCompound nbtCompound = NMSHandler.getHandler().loadNBT(item);
|
||||
if (nbtCompound.containsKey("EntityTag")) {
|
||||
return lang.getString("item_monsterPlacer_name") + " " + lang.getString("entity_" + nbtCompound.get("EntityTag").asCompound().get("id").asString() + "_name");
|
||||
}
|
||||
return lang.getString("item_monsterPlacer_name");
|
||||
}
|
||||
} else if (TabooLib.getVersionNumber() < 11300) {
|
||||
if (itemMeta instanceof SpawnEggMeta) {
|
||||
String spawnEggType = lang.getString("entity_" + ((SpawnEggMeta) itemMeta).getSpawnedType().getEntityClass().getSimpleName().replace(".", "_") + "_name");
|
||||
if (spawnEggType != null) {
|
||||
|
@ -5,7 +5,7 @@ import com.ilummc.eagletdl.EagletTask;
|
||||
import com.ilummc.eagletdl.ProgressEvent;
|
||||
import com.ilummc.tlib.resources.TLocale;
|
||||
import me.skymc.taboolib.Main;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import me.skymc.taboolib.common.io.IOUtils;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.io.*;
|
||||
|
Loading…
Reference in New Issue
Block a user