+ debug message
This commit is contained in:
parent
39f3eb3081
commit
0094bdf3b6
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>me.skymc</groupId>
|
||||
<artifactId>TabooLib</artifactId>
|
||||
<version>4.61</version>
|
||||
<version>4.62</version>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
@ -1,9 +1,9 @@
|
||||
package me.skymc.taboolib.common.function;
|
||||
|
||||
import com.ilummc.tlib.logger.TLogger;
|
||||
import me.skymc.taboolib.TabooLib;
|
||||
import me.skymc.taboolib.TabooLibLoader;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
@ -21,6 +21,7 @@ public class TFunctionLoader implements TabooLibLoader.Loader {
|
||||
Method method = pluginClass.getDeclaredMethod(function.enable());
|
||||
method.setAccessible(true);
|
||||
method.invoke(null);
|
||||
TabooLib.debug("Function " + pluginClass.getSimpleName() + " loaded. (" + plugin.getName() + ")");
|
||||
} catch (NoSuchMethodException ignore) {
|
||||
} catch (Exception e) {
|
||||
TLogger.getGlobalLogger().warn("TFunction load Failed: " + pluginClass.getName());
|
||||
@ -37,6 +38,7 @@ public class TFunctionLoader implements TabooLibLoader.Loader {
|
||||
Method method = pluginClass.getDeclaredMethod(function.disable());
|
||||
method.setAccessible(true);
|
||||
method.invoke(null);
|
||||
TabooLib.debug("Function " + pluginClass.getSimpleName() + " unloaded. (" + plugin.getName() + ")");
|
||||
} catch (NoSuchMethodException ignore) {
|
||||
} catch (Exception e) {
|
||||
TLogger.getGlobalLogger().warn("TFunction unload Failed: " + pluginClass.getName());
|
||||
|
@ -2,6 +2,7 @@ package me.skymc.taboolib.common.loader;
|
||||
|
||||
import com.ilummc.tlib.logger.TLogger;
|
||||
import com.ilummc.tlib.util.Ref;
|
||||
import me.skymc.taboolib.TabooLib;
|
||||
import me.skymc.taboolib.TabooLibLoader;
|
||||
import me.skymc.taboolib.listener.TListener;
|
||||
import me.skymc.taboolib.methods.ReflectionUtils;
|
||||
@ -59,6 +60,7 @@ public class InstantiableLoader implements Listener {
|
||||
Instantiable instantiable = (Instantiable) pluginClass.getAnnotation(Instantiable.class);
|
||||
try {
|
||||
instance.put(instantiable.value(), ReflectionUtils.instantiateObject(pluginClass));
|
||||
TabooLib.debug("Instantiable " + pluginClass.getSimpleName() + " instanced. (" + plugin.getName() + ")");
|
||||
} catch (Exception e) {
|
||||
TLogger.getGlobalLogger().warn("Instance Failed: " + pluginClass.getName());
|
||||
e.printStackTrace();
|
||||
|
@ -1,5 +1,7 @@
|
||||
package me.skymc.taboolib.common.nms;
|
||||
|
||||
import me.skymc.taboolib.TabooLib;
|
||||
import me.skymc.taboolib.commands.builder.SimpleCommandBuilder;
|
||||
import me.skymc.taboolib.common.function.TFunction;
|
||||
import me.skymc.taboolib.common.versioncontrol.SimpleVersionControl;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -19,6 +21,11 @@ public abstract class NMSHandler {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
SimpleCommandBuilder.create("title", TabooLib.instance())
|
||||
.execute((sender, args) -> {
|
||||
handler.sendTitle((Player) sender, "TabooLib", 10, 40, 10, "author Bkm016", 10, 40, 10);
|
||||
return true;
|
||||
}).build();
|
||||
}
|
||||
|
||||
abstract public void sendTitle(Player player, String title, int titleFadein, int titleStay, int titleFadeout, String subtitle, int subtitleFadein, int subtitleStay, int subtitleFadeout);
|
||||
|
@ -16,9 +16,7 @@ public class NMSHandlerImpl extends NMSHandler {
|
||||
|
||||
@Override
|
||||
public void sendTitle(Player player, String title, int titleFadein, int titleStay, int titleFadeout, String subtitle, int subtitleFadein, int subtitleStay, int subtitleFadeout) {
|
||||
TPacketHandler.sendPacket(player, new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.TIMES, new ChatComponentText(String.valueOf(title)), titleFadein, titleStay, titleFadeout));
|
||||
TPacketHandler.sendPacket(player, new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.TITLE, new ChatComponentText(String.valueOf(title))));
|
||||
TPacketHandler.sendPacket(player, new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.TIMES, new ChatComponentText(String.valueOf(subtitle)), subtitleFadein, subtitleStay, subtitleFadeout));
|
||||
TPacketHandler.sendPacket(player, new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.SUBTITLE, new ChatComponentText(String.valueOf(subtitle))));
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package me.skymc.taboolib.listener;
|
||||
|
||||
import com.ilummc.tlib.logger.TLogger;
|
||||
import com.ilummc.tlib.util.Strings;
|
||||
import me.skymc.taboolib.TabooLib;
|
||||
import me.skymc.taboolib.TabooLibLoader;
|
||||
@ -56,10 +57,15 @@ public class TListenerHandler implements Listener {
|
||||
}
|
||||
// 实例化监听器
|
||||
Listener listener = plugin.getClass().equals(pluginClass) ? (Listener) plugin : (Listener) ReflectionUtils.instantiateObject(pluginClass);
|
||||
try {
|
||||
listeners.computeIfAbsent(plugin.getName(), name -> new ArrayList<>()).add(listener);
|
||||
TabooLib.debug("Listener " + listener.getClass().getSimpleName() + " setup successfully. (" + plugin.getName() + ")");
|
||||
} catch (Exception e) {
|
||||
TabooLib.debug("Listener setup failed: " + e.toString());
|
||||
TLogger.getGlobalLogger().warn("TListener setup Failed: " + pluginClass.getName());
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
TabooLib.debug("Listener " + pluginClass.getSimpleName() + "(" + plugin.getName() + ")" + " setup failed: " + e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user