尝试ASM失败,还是反射简单...

This commit is contained in:
坏黑 2018-05-11 01:02:30 +08:00
parent 863dc35e56
commit 4cc3ce4fc8
12 changed files with 230 additions and 279 deletions

View File

@ -10,6 +10,15 @@
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/libs/ProtocolLib.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.1.0" level="project" /> <orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.1.0" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" /> <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
<orderEntry type="library" name="Maven: org.javalite:activejdbc:2.0" level="project" /> <orderEntry type="library" name="Maven: org.javalite:activejdbc:2.0" level="project" />
@ -21,6 +30,7 @@
<orderEntry type="library" name="Maven: com.h2database:h2:1.4.197" level="project" /> <orderEntry type="library" name="Maven: com.h2database:h2:1.4.197" level="project" />
<orderEntry type="library" name="Maven: com.ilummc.eagletdl:EagletCore:1.1.2" level="project" /> <orderEntry type="library" name="Maven: com.ilummc.eagletdl:EagletCore:1.1.2" level="project" />
<orderEntry type="library" name="Maven: org.ow2.asm:asm:6.1.1" level="project" /> <orderEntry type="library" name="Maven: org.ow2.asm:asm:6.1.1" level="project" />
<orderEntry type="library" name="Maven: me.clip:placeholderapi:2.8.4" level="project" />
<orderEntry type="module-library"> <orderEntry type="module-library">
<library name="Maven: bukkit:bukkit1_12:1"> <library name="Maven: bukkit:bukkit1_12:1">
<CLASSES> <CLASSES>
@ -30,17 +40,6 @@
<SOURCES /> <SOURCES />
</library> </library>
</orderEntry> </orderEntry>
<orderEntry type="library" name="Maven: net.milkbowl.vault:VaultAPI:1.6" level="project" />
<orderEntry type="library" name="Maven: org.bukkit:bukkit:1.9-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.6" level="project" />
<orderEntry type="library" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
<orderEntry type="library" name="Maven: junit:junit:4.10" level="project" />
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:guava:17.0" level="project" />
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.2.4" level="project" />
<orderEntry type="library" name="Maven: org.avaje:ebean:2.8.1" level="project" />
<orderEntry type="library" name="Maven: javax.persistence:persistence-api:1.0" level="project" />
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.15" level="project" />
<orderEntry type="module-library"> <orderEntry type="module-library">
<library name="Maven: bukkit:bukkit1_8:1"> <library name="Maven: bukkit:bukkit1_8:1">
<CLASSES> <CLASSES>
@ -50,33 +49,6 @@
<SOURCES /> <SOURCES />
</library> </library>
</orderEntry> </orderEntry>
<orderEntry type="module-library">
<library name="Maven: bukkit:bukkit1_9:1">
<CLASSES>
<root url="jar://$MODULE_DIR$/libs/1_9_R3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="Maven: bukkit:bukkit1_10:1">
<CLASSES>
<root url="jar://$MODULE_DIR$/libs/1_10_R1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="Maven: bukkit:bukkit1_11:1">
<CLASSES>
<root url="jar://$MODULE_DIR$/libs/1_11_R1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library"> <orderEntry type="module-library">
<library name="Maven: com.sun.tools:jshell:1"> <library name="Maven: com.sun.tools:jshell:1">
<CLASSES> <CLASSES>
@ -87,9 +59,18 @@
</library> </library>
</orderEntry> </orderEntry>
<orderEntry type="module-library"> <orderEntry type="module-library">
<library name="Maven: placeholder:placeholder:1"> <library name="Maven: taboocode:taboocode:1">
<CLASSES> <CLASSES>
<root url="jar://$MODULE_DIR$/libs/PlaceholderAPI.jar!/" /> <root url="jar://$MODULE_DIR$/libs/TabooCode5.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="Maven: yum:yum:1">
<CLASSES>
<root url="jar://$MODULE_DIR$/libs/Yum.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES /> <SOURCES />
@ -104,24 +85,6 @@
<SOURCES /> <SOURCES />
</library> </library>
</orderEntry> </orderEntry>
<orderEntry type="module-library">
<library name="Maven: sk:sk:1">
<CLASSES>
<root url="jar://$MODULE_DIR$/libs/Skript.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="Maven: taboocode:taboocode:1">
<CLASSES>
<root url="jar://$MODULE_DIR$/libs/TabooCode5.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library"> <orderEntry type="module-library">
<library name="Maven: wg:wg:1"> <library name="Maven: wg:wg:1">
<CLASSES> <CLASSES>
@ -132,9 +95,18 @@
</library> </library>
</orderEntry> </orderEntry>
<orderEntry type="module-library"> <orderEntry type="module-library">
<library name="Maven: yum:yum:1"> <library name="Maven: sk:sk:1">
<CLASSES> <CLASSES>
<root url="jar://$MODULE_DIR$/libs/Yum.jar!/" /> <root url="jar://$MODULE_DIR$/libs/Skript.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="Maven: vault:vault:1">
<CLASSES>
<root url="jar://$MODULE_DIR$/libs/Vault.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES /> <SOURCES />

85
pom.xml
View File

@ -6,7 +6,7 @@
<groupId>me.skymc</groupId> <groupId>me.skymc</groupId>
<artifactId>TabooLib</artifactId> <artifactId>TabooLib</artifactId>
<version>3.832</version> <version>4.0</version>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@ -57,8 +57,8 @@
</build> </build>
<repositories> <repositories>
<repository> <repository>
<id>vault</id> <id>placeholderapi</id>
<url>http://nexus.hc.to/content/repositories/pub_releases</url> <url>http://repo.extendedclip.com/content/repositories/placeholderapi/</url>
</repository> </repository>
</repositories> </repositories>
<dependencies> <dependencies>
@ -93,6 +93,11 @@
<artifactId>asm</artifactId> <artifactId>asm</artifactId>
<version>6.1.1</version> <version>6.1.1</version>
</dependency> </dependency>
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.8.4</version>
</dependency>
<dependency> <dependency>
<groupId>bukkit</groupId> <groupId>bukkit</groupId>
<artifactId>bukkit1_12</artifactId> <artifactId>bukkit1_12</artifactId>
@ -100,11 +105,6 @@
<scope>system</scope> <scope>system</scope>
<systemPath>${basedir}/libs/1_12_R1.jar</systemPath> <systemPath>${basedir}/libs/1_12_R1.jar</systemPath>
</dependency> </dependency>
<dependency>
<groupId>net.milkbowl.vault</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.6</version>
</dependency>
<dependency> <dependency>
<groupId>bukkit</groupId> <groupId>bukkit</groupId>
<artifactId>bukkit1_8</artifactId> <artifactId>bukkit1_8</artifactId>
@ -112,27 +112,6 @@
<scope>system</scope> <scope>system</scope>
<systemPath>${basedir}/libs/1_8_R3.jar</systemPath> <systemPath>${basedir}/libs/1_8_R3.jar</systemPath>
</dependency> </dependency>
<dependency>
<groupId>bukkit</groupId>
<artifactId>bukkit1_9</artifactId>
<version>1</version>
<scope>system</scope>
<systemPath>${basedir}/libs/1_9_R3.jar</systemPath>
</dependency>
<dependency>
<groupId>bukkit</groupId>
<artifactId>bukkit1_10</artifactId>
<version>1</version>
<scope>system</scope>
<systemPath>${basedir}/libs/1_10_R1.jar</systemPath>
</dependency>
<dependency>
<groupId>bukkit</groupId>
<artifactId>bukkit1_11</artifactId>
<scope>system</scope>
<version>1</version>
<systemPath>${basedir}/libs/1_11_R1.jar</systemPath>
</dependency>
<dependency> <dependency>
<groupId>com.sun.tools</groupId> <groupId>com.sun.tools</groupId>
<artifactId>jshell</artifactId> <artifactId>jshell</artifactId>
@ -140,27 +119,6 @@
<scope>system</scope> <scope>system</scope>
<systemPath>${basedir}/libs/com.sun.tools.jar</systemPath> <systemPath>${basedir}/libs/com.sun.tools.jar</systemPath>
</dependency> </dependency>
<dependency>
<groupId>placeholder</groupId>
<artifactId>placeholder</artifactId>
<version>1</version>
<scope>system</scope>
<systemPath>${basedir}/libs/PlaceholderAPI.jar</systemPath>
</dependency>
<dependency>
<groupId>plib</groupId>
<artifactId>plib</artifactId>
<version>1</version>
<scope>system</scope>
<systemPath>${basedir}/libs/ProtocolLib.jar</systemPath>
</dependency>
<dependency>
<groupId>sk</groupId>
<artifactId>sk</artifactId>
<version>1</version>
<scope>system</scope>
<systemPath>${basedir}/libs/Skript.jar</systemPath>
</dependency>
<dependency> <dependency>
<groupId>taboocode</groupId> <groupId>taboocode</groupId>
<artifactId>taboocode</artifactId> <artifactId>taboocode</artifactId>
@ -168,6 +126,20 @@
<scope>system</scope> <scope>system</scope>
<systemPath>${basedir}/libs/TabooCode5.jar</systemPath> <systemPath>${basedir}/libs/TabooCode5.jar</systemPath>
</dependency> </dependency>
<dependency>
<groupId>yum</groupId>
<artifactId>yum</artifactId>
<version>1</version>
<scope>system</scope>
<systemPath>${basedir}/libs/Yum.jar</systemPath>
</dependency>
<dependency>
<groupId>plib</groupId>
<artifactId>plib</artifactId>
<version>1</version>
<scope>system</scope>
<systemPath>${basedir}/libs/ProtocolLib.jar</systemPath>
</dependency>
<dependency> <dependency>
<groupId>wg</groupId> <groupId>wg</groupId>
<artifactId>wg</artifactId> <artifactId>wg</artifactId>
@ -176,11 +148,18 @@
<systemPath>${basedir}/libs/WorldGuard.jar</systemPath> <systemPath>${basedir}/libs/WorldGuard.jar</systemPath>
</dependency> </dependency>
<dependency> <dependency>
<groupId>yum</groupId> <groupId>sk</groupId>
<artifactId>yum</artifactId> <artifactId>sk</artifactId>
<version>1</version> <version>1</version>
<scope>system</scope> <scope>system</scope>
<systemPath>${basedir}/libs/Yum.jar</systemPath> <systemPath>${basedir}/libs/Skript.jar</systemPath>
</dependency>
<dependency>
<groupId>vault</groupId>
<artifactId>vault</artifactId>
<version>1</version>
<scope>system</scope>
<systemPath>${basedir}/libs/Vault.jar</systemPath>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -72,7 +72,7 @@ public class TLocaleLoader {
*/ */
public static void load(Plugin plugin, boolean isCover) { public static void load(Plugin plugin, boolean isCover) {
try { try {
if ((isCover || !isLocaleLoaded(plugin)) && (plugin.equals(Main.getInst()) || isDependWithTabooLib(plugin))) { if (isLoadLocale(plugin, isCover)) {
// 获取文件 // 获取文件
File localeFile = getLocaleFile(plugin); File localeFile = getLocaleFile(plugin);
if (localeFile == null) { if (localeFile == null) {
@ -99,6 +99,10 @@ public class TLocaleLoader {
} }
} }
private static boolean isLoadLocale(Plugin plugin, boolean isCover) {
return (isCover || !isLocaleLoaded(plugin)) && (plugin.equals(Main.getInst()) || isDependWithTabooLib(plugin));
}
private static void infoLogger(String path, String... args) { private static void infoLogger(String path, String... args) {
TLogger.getGlobalLogger().info(Strings.replaceWithOrder(TLib.getInternalLanguage().getString(path), args)); TLogger.getGlobalLogger().info(Strings.replaceWithOrder(TLib.getInternalLanguage().getString(path), args));
} }

View File

@ -38,7 +38,6 @@ import me.skymc.taboolib.update.UpdateTask;
import me.skymc.tlm.TLM; import me.skymc.tlm.TLM;
import me.skymc.tlm.command.TLMCommands; import me.skymc.tlm.command.TLMCommands;
import me.skymc.tlm.module.TabooLibraryModule; import me.skymc.tlm.module.TabooLibraryModule;
import net.milkbowl.vault.economy.Economy;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
@ -49,12 +48,14 @@ import org.bukkit.scheduler.BukkitRunnable;
import java.io.File; import java.io.File;
import java.util.Random; import java.util.Random;
@SuppressWarnings("deprecation") /**
* @author sky
*/
public class Main extends JavaPlugin implements Listener { public class Main extends JavaPlugin implements Listener {
private static Plugin inst; private static Plugin inst;
private static Economy Economy; private static net.milkbowl.vault.economy.Economy Economy;
private static File playerDataFolder; private static File playerDataFolder;

View File

@ -0,0 +1,80 @@
package me.skymc.taboolib.anvil;
import com.ilummc.tlib.util.asm.AsmClassTransformer;
import me.skymc.taboolib.nms.NMSUtils;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
/**
* @author sky
*/
public class AnvilContainer {
// private static IAnvilContainer instance;
private static Class<?> ChatMessage = NMSUtils.getNMSClass("ChatMessage");
private static Class<?> PacketPlayOutOpenWindow = NMSUtils.getNMSClass("PacketPlayOutOpenWindow");
private static Class<?> IChatBaseComponent = NMSUtils.getNMSClass("IChatBaseComponent");
private static Class<?> Packet = NMSUtils.getNMSClass("Packet");
// public static IAnvilContainer getInstance() {
// return instance;
// }
//
// static {
// /*
// * 玩不懂玩不懂... 似乎不会更改父类的包名?
// */
// instance = (IAnvilContainer) AsmClassTransformer.builder()
// .from(AnvilContainerImpl.class)
// .fromVersion("v1_12_R1")
// .toVersion(Bukkit.getServer().getClass().getName().split("\\.")[3])
// .build()
// .transform();
// }
public static void openAnvil(Player p) {
try {
Object player = p.getClass().getMethod("getHandle").invoke(p);
int c = (int) player.getClass().getMethod("nextContainerCounter").invoke(player);
Object chatMessage = ChatMessage.getConstructor(String.class, Object[].class).newInstance("Repairing", new Object[0]);
Object packetPlayOutOpenWindow = PacketPlayOutOpenWindow.getConstructor(Integer.TYPE, String.class, IChatBaseComponent, Integer.TYPE).newInstance(c, "minecraft:anvil", chatMessage, 0);
Object playerConnection = player.getClass().getDeclaredField("playerConnection").get(player);
playerConnection.getClass().getMethod("sendPacket", Packet).invoke(playerConnection, packetPlayOutOpenWindow);
} catch (Exception ignored) {
}
}
}
//interface IAnvilContainer {
//
// /**
// * 打开铁砧界面
// *
// * @param player 玩家
// */
// void openAnvil(Player player);
//}
//
//class AnvilContainerImpl extends net.minecraft.server.v1_12_R1.ContainerAnvil implements IAnvilContainer {
//
// public AnvilContainerImpl(net.minecraft.server.v1_12_R1.EntityHuman player) {
// super(player.inventory, player.world, new net.minecraft.server.v1_12_R1.BlockPosition(0, 0, 0), player);
// }
//
// @Override
// public void openAnvil(Player p) {
// net.minecraft.server.v1_12_R1.EntityPlayer player = ((org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer) p).getHandle();
// AnvilContainerImpl container = new AnvilContainerImpl(player);
// int c = player.nextContainerCounter();
// player.playerConnection.sendPacket(new net.minecraft.server.v1_12_R1.PacketPlayOutOpenWindow(c, "minecraft:anvil", new net.minecraft.server.v1_12_R1.ChatMessage("Repairing"), 0));
// player.activeContainer = container;
// player.activeContainer.windowId = c;
// player.activeContainer.addSlotListener(player);
// }
//
// @Override
// public boolean a(net.minecraft.server.v1_12_R1.EntityHuman player) {
// return true;
// }
//}

View File

@ -1,6 +1,6 @@
package me.skymc.taboolib.anvil; package me.skymc.taboolib.anvil;
import me.skymc.taboolib.anvil.versions.AnvilContainer_V1_9_4; import com.ilummc.tlib.resources.TLocale;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
@ -19,6 +19,9 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
/**
* @author sky
*/
public class AnvilContainerAPI implements Listener { public class AnvilContainerAPI implements Listener {
public static List<String> list = new ArrayList<>(); public static List<String> list = new ArrayList<>();
@ -29,14 +32,12 @@ public class AnvilContainerAPI implements Listener {
public static void send(Player p, String type, String str, List<String> lorelist) { public static void send(Player p, String type, String str, List<String> lorelist) {
isOpen.put(p.getName(), type); isOpen.put(p.getName(), type);
AnvilContainer_V1_9_4.openAnvil(p); AnvilContainer.openAnvil(p);
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
list.clear(); list.clear();
if (lorelist == null) { if (lorelist == null) {
list.add(""); list.addAll(TLocale.asStringList("ANVIL-CONTAINER.LORE-NORMAL"));
list.add("§7在上方文本框内输入信息");
list.add("§7随后点击右侧输出物品");
} else { } else {
list = lorelist; list = lorelist;
} }
@ -91,7 +92,7 @@ public class AnvilContainerAPI implements Listener {
if ("/anvilexample".equals(e.getMessage())) { if ("/anvilexample".equals(e.getMessage())) {
if (e.getPlayer().hasPermission("taboolib.admin")) { if (e.getPlayer().hasPermission("taboolib.admin")) {
e.setCancelled(true); e.setCancelled(true);
AnvilContainerAPI.send(e.getPlayer(), "EXAMPLE", "在这里输入文本", null); AnvilContainerAPI.send(e.getPlayer(), "EXAMPLE", TLocale.asString("ANVIL-CONTAINER.NAME-EXAMPLE"), null);
} }
} }
} }

View File

@ -1,32 +0,0 @@
package me.skymc.taboolib.anvil.versions;
import net.minecraft.server.v1_11_R1.*;
import org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
public class AnvilContainer_V1_11_R1 extends ContainerAnvil {
public AnvilContainer_V1_11_R1(EntityHuman player) {
super(player.inventory, player.world, new BlockPosition(0, 0, 0), player);
}
/**
* @deprecated 方法已过期已有新的方法
*/
@Deprecated
public static void openAnvil(Player p) {
EntityPlayer player = ((CraftPlayer) p).getHandle();
AnvilContainer_V1_11_R1 container = new AnvilContainer_V1_11_R1(player);
int c = player.nextContainerCounter();
player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(c, "minecraft:anvil", new ChatMessage("Repairing"), 0));
player.activeContainer = container;
player.activeContainer.windowId = c;
player.activeContainer.addSlotListener(player);
}
@Override
public boolean a(EntityHuman player) {
return true;
}
}

View File

@ -1,32 +0,0 @@
package me.skymc.taboolib.anvil.versions;
import net.minecraft.server.v1_8_R3.*;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Player;
public class AnvilContainer_V1_8_R3 extends ContainerAnvil {
public AnvilContainer_V1_8_R3(EntityHuman player) {
super(player.inventory, player.world, new BlockPosition(0, 0, 0), player);
}
/**
* @deprecated 方法已过期已有新的方法
*/
@Deprecated
public static void openAnvil(Player p) {
EntityPlayer player = ((CraftPlayer) p).getHandle();
AnvilContainer_V1_8_R3 container = new AnvilContainer_V1_8_R3(player);
int c = player.nextContainerCounter();
player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(c, "minecraft:anvil", new ChatMessage("Repairing"), 0));
player.activeContainer = container;
player.activeContainer.windowId = c;
player.activeContainer.addSlotListener(player);
}
@Override
public boolean a(EntityHuman player) {
return true;
}
}

View File

@ -1,32 +0,0 @@
package me.skymc.taboolib.anvil.versions;
import net.minecraft.server.v1_9_R2.*;
import org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer;
import org.bukkit.entity.Player;
public class AnvilContainer_V1_9_4 extends ContainerAnvil {
public AnvilContainer_V1_9_4(EntityHuman player) {
super(player.inventory, player.world, new BlockPosition(0, 0, 0), player);
}
/**
* @deprecated 方法已过期已有新的方法
*/
@Deprecated
public static void openAnvil(Player p) {
EntityPlayer player = ((CraftPlayer) p).getHandle();
AnvilContainer_V1_9_4 container = new AnvilContainer_V1_9_4(player);
int c = player.nextContainerCounter();
player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(c, "minecraft:anvil", new ChatMessage("Repairing"), 0));
player.activeContainer = container;
player.activeContainer.windowId = c;
player.activeContainer.addSlotListener(player);
}
@Override
public boolean a(EntityHuman player) {
return true;
}
}

View File

@ -8,6 +8,9 @@ import me.skymc.tlm.module.sub.ModuleKits;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
/**
* @author sky
*/
public class SupportPlaceholder extends EZPlaceholderHook { public class SupportPlaceholder extends EZPlaceholderHook {
public SupportPlaceholder(Plugin plugin, String identifier) { public SupportPlaceholder(Plugin plugin, String identifier) {

View File

@ -132,7 +132,7 @@ public class TagAPI implements Listener {
builtUUID.append(sent.getId()); builtUUID.append(sent.getId());
} }
AsyncPlayerReceiveNameTagEvent newEvent = new AsyncPlayerReceiveNameTagEvent(destinationPlayer, namedPlayer, oldEvent.getTag(), UUID.fromString(builtUUID.toString())); AsyncPlayerReceiveNameTagEvent newEvent = new AsyncPlayerReceiveNameTagEvent(destinationPlayer, namedPlayer, getPlayerDisplayName(namedPlayer), UUID.fromString(builtUUID.toString()));
Bukkit.getServer().getPluginManager().callEvent(newEvent); Bukkit.getServer().getPluginManager().callEvent(newEvent);
return new WrappedGameProfile(newEvent.getUUID(), newEvent.getTag().substring(0, Math.min(newEvent.getTag().length(), 16))); return new WrappedGameProfile(newEvent.getUUID(), newEvent.getTag().substring(0, Math.min(newEvent.getTag().length(), 16)));

View File

@ -77,7 +77,14 @@ LANGUAGE2:
FALL-NOTFOUND-FILE: '语言文件 {0} 不存在' FALL-NOTFOUND-FILE: '语言文件 {0} 不存在'
TIMECYCLE: TIMECYCLE:
FALL-CYCLE-EXISTS: '注册周期管理器 §8{0}§c 失败, 原因: &4名称重复' FALL-CYCLE-EXISTS: '注册周期管理器 &8{0}&c 失败, 原因: &4名称重复'
ANVIL-CONTAINER:
NAME-EXAMPLE: '在这里输入文本'
LORE-NORMAL:
- ''
- '&7在上方文本框内输入信息'
- '&7随后点击右侧输出物品'
UPDATETASK: UPDATETASK:
VERSION-LATEST: '插件已是最新版, 无需更新!' VERSION-LATEST: '插件已是最新版, 无需更新!'
@ -110,17 +117,17 @@ COMMANDS:
ONLY-PLAYER: '&8[&3&lTabooLib&8] &4控制台无法这么做' ONLY-PLAYER: '&8[&3&lTabooLib&8] &4控制台无法这么做'
ONLY-STORAGE-SQL: '&8[&3&lTabooLib&8] &4只有启用数据库储存时才能这么做' ONLY-STORAGE-SQL: '&8[&3&lTabooLib&8] &4只有启用数据库储存时才能这么做'
INTERNAL: INTERNAL:
ONLY-PLAYER: '&8[&3&lTabooLib&8] §7指令 §f{0} §7只能由 §f{1} §7执行' ONLY-PLAYER: '&8[&3&lTabooLib&8] &7指令 &f{0} &7只能由 &f{1} &7执行'
TYPE-PLAYER: 玩家 TYPE-PLAYER: 玩家
TYPE-CONSOLE: 控制台 TYPE-CONSOLE: 控制台
ERROR-USAGE: ERROR-USAGE:
- '&8[&3&lTabooLib&8] §7指令 §f{0} §7参数不足' - '&8[&3&lTabooLib&8] &7指令 &f{0} &7参数不足'
- '&8[&3&lTabooLib&8] §7正确用法:' - '&8[&3&lTabooLib&8] &7正确用法:'
- '&8[&3&lTabooLib&8] §7{1}' - '&8[&3&lTabooLib&8] &7{1}'
ERROR-COMMAND: ERROR-COMMAND:
- '&8[&3&lTabooLib&8] §7指令 §f{0} §7不存在' - '&8[&3&lTabooLib&8] &7指令 &f{0} &7不存在'
- '&8[&3&lTabooLib&8] §7你可能想要:' - '&8[&3&lTabooLib&8] &7你可能想要:'
- '&8[&3&lTabooLib&8] §7{1}' - '&8[&3&lTabooLib&8] &7{1}'
COMMAND-REGISTER: '&7自动为插件 &f{0} &7的命令 &f{1} &7注册 &f{2} &7条子命令' COMMAND-REGISTER: '&7自动为插件 &f{0} &7的命令 &f{1} &7注册 &f{2} &7条子命令'
PARAMETER: PARAMETER:
UNKNOWN: '&8[&3&lTabooLib&8] &4指令错误' UNKNOWN: '&8[&3&lTabooLib&8] &4指令错误'
@ -130,7 +137,7 @@ COMMANDS:
SUCCESS-NORMAL: '&8[&3&lTabooLib&8] &7重载成功' SUCCESS-NORMAL: '&8[&3&lTabooLib&8] &7重载成功'
SUCCESS-ELAPSED-TIME: '&8[&3&lTabooLib&8] &7重载成功, 耗时: &f{0} ms' SUCCESS-ELAPSED-TIME: '&8[&3&lTabooLib&8] &7重载成功, 耗时: &f{0} ms'
TABOOLIB: TABOOLIB:
COMMAND-TITLE: '§b§l----- §3§lTabooLib Commands §b§l-----' COMMAND-TITLE: '&b&l----- &3&lTabooLib Commands &b&l-----'
SAVE: SAVE:
DESCRIPTION: '载入插件' DESCRIPTION: '载入插件'
ARGUMENTS: ARGUMENTS:
@ -174,7 +181,7 @@ COMMANDS:
READ-RESULT: '&8[&3&lTabooLib&8] &7变量 &f{0} &7的值为: &f{1}' READ-RESULT: '&8[&3&lTabooLib&8] &7变量 &f{0} &7的值为: &f{1}'
READ-SUCCESS: '&8[&3&lTabooLib&8] &7写入完成, 耗时: &f{0} &7(ms)' READ-SUCCESS: '&8[&3&lTabooLib&8] &7写入完成, 耗时: &f{0} &7(ms)'
IMPORTDATA: IMPORTDATA:
DESCRIPTION: '§4向数据库导入本地数据 §8(该操作将会清空数据库)' DESCRIPTION: '&4向数据库导入本地数据 &8(该操作将会清空数据库)'
CLEARING: '&8[&3&lTabooLib&8] &7正在清空数据库...' CLEARING: '&8[&3&lTabooLib&8] &7正在清空数据库...'
EMPTYDATA: '&8[&3&lTabooLib&8] &4没有玩家数据可以导入' EMPTYDATA: '&8[&3&lTabooLib&8] &4没有玩家数据可以导入'
IMPORTING-START: '&8[&3&lTabooLib&8] &7开始导入 &f{0} &7项玩家数据' IMPORTING-START: '&8[&3&lTabooLib&8] &7开始导入 &f{0} &7项玩家数据'
@ -223,22 +230,22 @@ COMMANDS:
- ==: JSON - ==: JSON
text: text:
- '' - ''
- '§b§l----- §3§lItemStack Info §b§l-----' - '&b&l----- &3&lItemStack Info &b&l-----'
- '' - ''
- '§7 - 物品材质: §f<{0}@type>' - '&7 - 物品材质: &f<{0}@type>'
- '§7 - 物品名称: §f<{1}@name>' - '&7 - 物品名称: &f<{1}@name>'
- '§7 - 物品序号: §f<{2}@id>' - '&7 - 物品序号: &f<{2}@id>'
- '§7 - 物品数据: §f<NBT@nbt>' - '&7 - 物品数据: &f<NBT@nbt>'
- '' - ''
args: args:
type: type:
hover: '§f点击复制' hover: '&f点击复制'
suggest: '{0}' suggest: '{0}'
name: name:
hover: '§f点击复制' hover: '&f点击复制'
suggest: '{1}' suggest: '{1}'
id: id:
hover: '§f点击复制' hover: '&f点击复制'
suggest: '{2}' suggest: '{2}'
nbt: nbt:
hover: '{3}' hover: '{3}'
@ -246,27 +253,27 @@ COMMANDS:
DESCRIPTION: '查看所有物品' DESCRIPTION: '查看所有物品'
MENU: MENU:
TITLE: '物品库 {0}' TITLE: '物品库 {0}'
NEXT: '§f上一页' NEXT: '&f上一页'
BACK: '§f下一页' BACK: '&f下一页'
LORE: LORE:
- '' - ''
- '§f§m ' - '&f&m '
- '§f序列号: §8{0}' - '&f序列号: &8{0}'
SOUNDS: SOUNDS:
DESCRIPTION: '查看所有音效' DESCRIPTION: '查看所有音效'
MENU: MENU:
TITLE: '音效库 {0}' TITLE: '音效库 {0}'
NEXT: '§f上一页' NEXT: '&f上一页'
BACK: '§f下一页' BACK: '&f下一页'
LORE: LORE:
- '' - ''
- '§f左键: §71 音调' - '&f左键: &71 音调'
- '§f右键: §72 音调' - '&f右键: &72 音调'
- '§f中键: §7复制名称' - '&f中键: &7复制名称'
RESULT: RESULT:
SEARCH: SEARCH:
- '§7查询名称: §f{0}' - '&7查询名称: &f{0}'
- '§7查询结果: §f{1}' - '&7查询结果: &f{1}'
COPY: COPY:
- ==: JSON - ==: JSON
text: '&7点击复制: <&f&n{0}@sound>' text: '&7点击复制: <&f&n{0}@sound>'
@ -292,23 +299,23 @@ COMMANDS:
CYCLE-RESET: '&8[&3&lTabooLib&8] &7检查器 &f{0} &7初始化完成' CYCLE-RESET: '&8[&3&lTabooLib&8] &7检查器 &f{0} &7初始化完成'
CYCLE-INFO: CYCLE-INFO:
- '' - ''
- '§b§l----- §3§lTimeCycle Info §b§l-----' - '&b&l----- &3&lTimeCycle Info &b&l-----'
- '' - ''
- ' §f- §7注册周期: §f{0}' - ' &f- &7注册周期: &f{0}'
- ' §f- §7注册插件: §f{1}' - ' &f- &7注册插件: &f{1}'
- ' §f- §7上次刷新时间: §f{2}' - ' &f- &7上次刷新时间: &f{2}'
- ' §f- §7下次刷新时间: §f{3}' - ' &f- &7下次刷新时间: &f{3}'
LIST: LIST:
HEAD: HEAD:
- '' - ''
- '§b§l----- §3§lTimeCycle List §b§l-----' - '&b&l----- &3&lTimeCycle List &b&l-----'
- '' - ''
BODY: BODY:
- ==: JSON - ==: JSON
text: ' §7- §f{0} <&8(点击复制)@copy>' text: ' &7- &f{0} <&8(点击复制)@copy>'
args: args:
copy: copy:
hover: '§f点击复制' hover: '&f点击复制'
suggest: '{0}' suggest: '{0}'
FOOT: FOOT:
- '' - ''
@ -316,14 +323,14 @@ COMMANDS:
DESCRIPTION: '查看所有属性' DESCRIPTION: '查看所有属性'
HEAD: HEAD:
- '' - ''
- '§b§l----- §3§lItemStack Attributes §b§l-----' - '&b&l----- &3&lItemStack Attributes &b&l-----'
- '' - ''
BODY: BODY:
- ==: JSON - ==: JSON
text: ' §7- §f{0} <&8(点击复制)@copy>' text: ' &7- &f{0} <&8(点击复制)@copy>'
args: args:
copy: copy:
hover: '§f点击复制' hover: '&f点击复制'
suggest: '{0}' suggest: '{0}'
FOOT: FOOT:
- '' - ''
@ -331,14 +338,14 @@ COMMANDS:
DESCRIPTION: '查看所有附魔' DESCRIPTION: '查看所有附魔'
HEAD: HEAD:
- '' - ''
- '§b§l----- §3§lItemStack Enchantments §b§l-----' - '&b&l----- &3&lItemStack Enchantments &b&l-----'
- '' - ''
BODY: BODY:
- ==: JSON - ==: JSON
text: ' §7- §f{0}. {1} <&8(点击复制)@copy>' text: ' &7- &f{0}. {1} <&8(点击复制)@copy>'
args: args:
copy: copy:
hover: '§f点击复制' hover: '&f点击复制'
suggest: '{1}' suggest: '{1}'
FOOT: FOOT:
- '' - ''
@ -346,14 +353,14 @@ COMMANDS:
DESCRIPTION: '查看所有药水' DESCRIPTION: '查看所有药水'
HEAD: HEAD:
- '' - ''
- '§b§l----- §3§lItemStack PotionEffects §b§l-----' - '&b&l----- &3&lItemStack PotionEffects &b&l-----'
- '' - ''
BODY: BODY:
- ==: JSON - ==: JSON
text: ' §7- §f{0}. {1} <&8(点击复制)@copy>' text: ' &7- &f{0}. {1} <&8(点击复制)@copy>'
args: args:
copy: copy:
hover: '§f点击复制' hover: '&f点击复制'
suggest: '{1}' suggest: '{1}'
FOOT: FOOT:
- '' - ''
@ -361,14 +368,14 @@ COMMANDS:
DESCRIPTION: '查看所有标签' DESCRIPTION: '查看所有标签'
HEAD: HEAD:
- '' - ''
- '§b§l----- §3§lItemStack Flags §b§l-----' - '&b&l----- &3&lItemStack Flags &b&l-----'
- '' - ''
BODY: BODY:
- ==: JSON - ==: JSON
text: ' §7- §f{0} <&8(点击复制)@copy>' text: ' &7- &f{0} <&8(点击复制)@copy>'
args: args:
copy: copy:
hover: '§f点击复制' hover: '&f点击复制'
suggest: '{0}' suggest: '{0}'
FOOT: FOOT:
- '' - ''
@ -376,14 +383,14 @@ COMMANDS:
DESCRIPTION: '查看所有部位' DESCRIPTION: '查看所有部位'
HEAD: HEAD:
- '' - ''
- '§b§l----- §3§lItemStack Slots §b§l-----' - '&b&l----- &3&lItemStack Slots &b&l-----'
- '' - ''
BODY: BODY:
- ==: JSON - ==: JSON
text: ' §7- §f{0} <&8(点击复制)@copy>' text: ' &7- &f{0} <&8(点击复制)@copy>'
args: args:
copy: copy:
hover: '§f点击复制' hover: '&f点击复制'
suggest: '{0}' suggest: '{0}'
FOOT: FOOT:
- '' - ''
@ -392,10 +399,10 @@ COMMANDS:
SUCCESS-SEND: '&8[&3&lTabooLib&8] &7信息已发送, 耗时&f: {0}' SUCCESS-SEND: '&8[&3&lTabooLib&8] &7信息已发送, 耗时&f: {0}'
HELP: HELP:
- '' - ''
- '§b§l----- §3§lLanguage2 Commands §b§l-----' - '&b&l----- &3&lLanguage2 Commands &b&l-----'
- '' - ''
- '§f /{0} send §8[§7玩家/ALL§8] §8[§7语言§8] §8<§7变量§8> §6- §e发送语言提示' - '&f /{0} send &8[&7玩家/ALL&8] &8[&7语言&8] &8<&7变量&8> &6- &e发送语言提示'
- '§f /{0} reload §6- §e重载语言库' - '&f /{0} reload &6- &e重载语言库'
- '' - ''
TLOCALE: TLOCALE:
INVALID-PLAYER: '&8[&3&lTabooLib&8] &4玩家 &c{0} &4不在线' INVALID-PLAYER: '&8[&3&lTabooLib&8] &4玩家 &c{0} &4不在线'
@ -403,13 +410,13 @@ COMMANDS:
SUCCESS-SEND: '&8[&3&lTabooLib&8] &7信息已发送, 耗时&f: {0}' SUCCESS-SEND: '&8[&3&lTabooLib&8] &7信息已发送, 耗时&f: {0}'
HELP: HELP:
- '' - ''
- '§b§l----- §3§lTabooLibLoacle Commands §b§l-----' - '&b&l----- &3&lTabooLibLoacle Commands &b&l-----'
- '' - ''
- '§f /{0} send §8[§7玩家/ALL§8] §8[§7语言§8] §8<§7变量§8> §6- §e发送语言提示' - '&f /{0} send &8[&7玩家/ALL&8] &8[&7语言&8] &8<&7变量&8> &6- &e发送语言提示'
- '§f /{0} reload §6- §e重载语言库' - '&f /{0} reload &6- &e重载语言库'
- '' - ''
TPLUGIN: TPLUGIN:
COMMAND-TITLE: '§e§l----- §6§lTabooLibPlugin Commands §b§l-----' COMMAND-TITLE: '&e&l----- &6&lTabooLibPlugin Commands &b&l-----'
LIST: LIST:
DESCRIPTION: '列出插件' DESCRIPTION: '列出插件'
LIST-PLUGIN: LIST-PLUGIN: