Fixes: Origins

This commit is contained in:
Norbi Peti 2018-11-22 00:46:52 +01:00
parent 652cdfc131
commit f8a850df76
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56
6 changed files with 10 additions and 41 deletions

View file

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: com.github.TBMCPlugins.ButtonCore:Towny:master-v1.0-g8d3b6b6-296">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/github/TBMCPlugins/ButtonCore/Towny/master-v1.0-g8d3b6b6-296/Towny-master-v1.0-g8d3b6b6-296.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/github/TBMCPlugins/ButtonCore/Towny/master-v1.0-g8d3b6b6-296/Towny-master-v1.0-g8d3b6b6-296-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/github/TBMCPlugins/ButtonCore/Towny/master-v1.0-g8d3b6b6-296/Towny-master-v1.0-g8d3b6b6-296-sources.jar!/" />
</SOURCES>
</library>
</component>

View file

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: com.github.milkbowl:VaultAPI:master-c8cb88f27a-1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/github/milkbowl/VaultAPI/master-c8cb88f27a-1/VaultAPI-master-c8cb88f27a-1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/github/milkbowl/VaultAPI/master-c8cb88f27a-1/VaultAPI-master-c8cb88f27a-1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/github/milkbowl/VaultAPI/master-c8cb88f27a-1/VaultAPI-master-c8cb88f27a-1-sources.jar!/" />
</SOURCES>
</library>
</component>

View file

@ -16,20 +16,13 @@ import javax.annotation.Nullable;
*/ */
@Getter @Getter
public class TBMCChatEvent extends TBMCChatEventBase { public class TBMCChatEvent extends TBMCChatEventBase {
public TBMCChatEvent(CommandSender sender, ChromaGamerBase user, Channel channel, String message, int score, boolean fromcmd, String groupid) { public TBMCChatEvent(CommandSender sender, ChromaGamerBase user, Channel channel, String message, int score, boolean fromcmd, String groupid, boolean ignoreSenderPermissions, String origin) {
super(channel, message, score, groupid);
this.sender = sender;
this.fromcmd = fromcmd;
this.ignoreSenderPermissions = false;
this.user = user;
}
public TBMCChatEvent(CommandSender sender, ChromaGamerBase user, Channel channel, String message, int score, boolean fromcmd, String groupid, boolean ignoreSenderPermissions) {
super(channel, message, score, groupid); super(channel, message, score, groupid);
this.sender = sender; this.sender = sender;
this.user = user; this.user = user;
this.fromcmd = fromcmd; this.fromcmd = fromcmd;
this.ignoreSenderPermissions = ignoreSenderPermissions; this.ignoreSenderPermissions = ignoreSenderPermissions;
this.origin = origin;
} }
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
@ -37,7 +30,8 @@ public class TBMCChatEvent extends TBMCChatEventBase {
private final CommandSender sender; private final CommandSender sender;
private final boolean fromcmd; private final boolean fromcmd;
private final boolean ignoreSenderPermissions; private final boolean ignoreSenderPermissions;
private final ChromaGamerBase user; private final ChromaGamerBase user;
private final String origin;
// TODO: Message object with data? // TODO: Message object with data?
/** /**

View file

@ -30,7 +30,8 @@ public class ChatMessage {
*/ */
private CommandSender permCheck; private CommandSender permCheck;
/** /**
* The origin of the message, "minecraft" or "discord" for example. * The origin of the message, "Minecraft" or "Discord" for example. May be displayed to the user.<br>
* <b>This is the user class capitalized folder name.</b>
*/ */
private final String origin; private final String origin;
@ -39,7 +40,7 @@ public class ChatMessage {
} }
@NonNull @NonNull
public static ChatMessageBuilder builder(Channel channel, CommandSender sender, ChromaGamerBase user, String message) { public static ChatMessageBuilder builder(CommandSender sender, ChromaGamerBase user, String message) {
return builder().sender(sender).user(user).message(message); return builder().sender(sender).user(user).message(message).origin(user.getFolder().substring(0, 1).toUpperCase() + user.getFolder().substring(1));
} }
} }

View file

@ -238,7 +238,7 @@ public class TBMCChatAPI {
if (eventPre.isCancelled()) if (eventPre.isCancelled())
return true; return true;
TBMCChatEvent event; TBMCChatEvent event;
event = new TBMCChatEvent(cm.getSender(), cm.getUser(), channel, eventPre.getMessage(), score, cm.isFromCommand(), rtr.groupID, permcheck != cm.getSender()); event = new TBMCChatEvent(cm.getSender(), cm.getUser(), channel, eventPre.getMessage(), score, cm.isFromCommand(), rtr.groupID, permcheck != cm.getSender(), cm.getOrigin());
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
return event.isCancelled(); return event.isCancelled();
} }

View file

@ -13,7 +13,7 @@ import java.lang.annotation.*;
@Inherited @Inherited
public @interface UserClass { public @interface UserClass {
/** /**
* Indicates which folder should the player files be saved in. * Indicates which folder should the player files be saved in. Must be lowercase.
*/ */
String foldername(); String foldername();
} }