Some prep for 1.14

This commit is contained in:
Norbi Peti 2019-06-09 23:32:49 +02:00
parent b1ea027d1c
commit db8dfa79bc
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56
5 changed files with 86 additions and 67 deletions

View file

@ -19,6 +19,7 @@
<orderEntry type="module" module-name="ButtonCore (1) (com.github.TBMCPlugins.ButtonCore)" /> <orderEntry type="module" module-name="ButtonCore (1) (com.github.TBMCPlugins.ButtonCore)" />
<orderEntry type="module" module-name="ButtonCore (1) (com.github.TBMCPlugins.ButtonCore)" /> <orderEntry type="module" module-name="ButtonCore (1) (com.github.TBMCPlugins.ButtonCore)" />
<orderEntry type="module" module-name="ButtonCore (1) (com.github.TBMCPlugins.ButtonCore)" /> <orderEntry type="module" module-name="ButtonCore (1) (com.github.TBMCPlugins.ButtonCore)" />
<orderEntry type="module" module-name="ButtonCore (1) (com.github.TBMCPlugins.ButtonCore)" />
<orderEntry type="library" name="Maven: org.reflections:reflections:0.9.10" level="project" /> <orderEntry type="library" name="Maven: org.reflections:reflections:0.9.10" level="project" />
<orderEntry type="library" name="Maven: com.google.code.findbugs:annotations:2.0.1" level="project" /> <orderEntry type="library" name="Maven: com.google.code.findbugs:annotations:2.0.1" level="project" />
<orderEntry type="library" name="Maven: org.javassist:javassist:3.20.0-GA" level="project" /> <orderEntry type="library" name="Maven: org.javassist:javassist:3.20.0-GA" level="project" />

View file

@ -3,7 +3,6 @@ package buttondevteam.lib;
import buttondevteam.core.component.channel.Channel; import buttondevteam.core.component.channel.Channel;
import lombok.Getter; import lombok.Getter;
import lombok.NonNull; import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter; import lombok.Setter;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
@ -12,7 +11,6 @@ import org.bukkit.event.Event;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@Getter @Getter
@RequiredArgsConstructor
public abstract class TBMCChatEventBase extends Event implements Cancellable { public abstract class TBMCChatEventBase extends Event implements Cancellable {
private final Channel channel; private final Channel channel;
private @NonNull String message; private @NonNull String message;
@ -26,6 +24,15 @@ public abstract class TBMCChatEventBase extends Event implements Cancellable {
*/ */
private final String groupID; private final String groupID;
@java.beans.ConstructorProperties({"channel", "message", "score", "groupID"})
public TBMCChatEventBase(Channel channel, String message, int score, String groupID) {
super(true);
this.channel = channel;
this.message = message;
this.score = score;
this.groupID = groupID;
}
/** /**
* Note: Errors are sent to the sender automatically * Note: Errors are sent to the sender automatically
*/ */

View file

@ -27,6 +27,7 @@ public class TBMCChatPreprocessEvent extends Event implements Cancellable {
private boolean cancelled; private boolean cancelled;
public TBMCChatPreprocessEvent(CommandSender sender, Channel channel, String message) { public TBMCChatPreprocessEvent(CommandSender sender, Channel channel, String message) {
super(true);
this.sender = sender; this.sender = sender;
this.channel = channel; this.channel = channel;
this.message = message; // TODO: Message object with data? this.message = message; // TODO: Message object with data?

View file

@ -82,6 +82,7 @@ public class TBMCCoreAPI {
} }
public static void SendException(String sourcemsg, Throwable e, boolean debugPotato) { public static void SendException(String sourcemsg, Throwable e, boolean debugPotato) {
try {
SendUnsentExceptions(); SendUnsentExceptions();
TBMCExceptionEvent event = new TBMCExceptionEvent(sourcemsg, e); TBMCExceptionEvent event = new TBMCExceptionEvent(sourcemsg, e);
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
@ -113,6 +114,10 @@ public class TBMCCoreAPI {
} }
} }
} }
} catch (Exception ee) {
System.err.println("Failed to send exception!");
ee.printStackTrace();
}
} }
public static void sendDebugMessage(String debugMessage) { public static void sendDebugMessage(String debugMessage) {

View file

@ -1,7 +1,6 @@
package buttondevteam.lib; package buttondevteam.lib;
import lombok.Getter; import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
@ -14,7 +13,6 @@ import org.bukkit.event.HandlerList;
* *
*/ */
@Getter @Getter
@RequiredArgsConstructor
public class TBMCExceptionEvent extends Event { public class TBMCExceptionEvent extends Event {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
@ -22,6 +20,13 @@ public class TBMCExceptionEvent extends Event {
private final Throwable exception; private final Throwable exception;
private boolean handled; private boolean handled;
@java.beans.ConstructorProperties({"sourceMessage", "exception"})
public TBMCExceptionEvent(String sourceMessage, Throwable exception) {
super(true);
this.sourceMessage = sourceMessage;
this.exception = exception;
}
public void setHandled() { public void setHandled() {
handled = true; handled = true;
} }