Use command channels and fix dependencies
This commit is contained in:
parent
45a1ba4fe1
commit
1b747ab99f
4 changed files with 10 additions and 30 deletions
20
pom.xml
20
pom.xml
|
@ -55,7 +55,7 @@
|
||||||
<excludes>
|
<excludes>
|
||||||
</excludes> <!-- http://stackoverflow.com/questions/28458058/maven-shade-plugin-exclude-a-dependency-and-all-its-transitive-dependencies -->
|
</excludes> <!-- http://stackoverflow.com/questions/28458058/maven-shade-plugin-exclude-a-dependency-and-all-its-transitive-dependencies -->
|
||||||
</artifactSet>
|
</artifactSet>
|
||||||
<minimizeJar>true</minimizeJar>
|
<!-- <minimizeJar>true</minimizeJar> Tried using filters but we need pretty much all of that 12 MB -->
|
||||||
<relocations>
|
<relocations>
|
||||||
<relocation>
|
<relocation>
|
||||||
<pattern>io.netty</pattern>
|
<pattern>io.netty</pattern>
|
||||||
|
@ -176,12 +176,6 @@
|
||||||
<version>1.14.4-R0.1-SNAPSHOT</version>
|
<version>1.14.4-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.spigotmc..</groupId>
|
|
||||||
<artifactId>spigot</artifactId>
|
|
||||||
<version>1.15.2-R0.1-SNAPSHOT</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<!-- https://mvnrepository.com/artifact/com.discord4j/Discord4J -->
|
<!-- https://mvnrepository.com/artifact/com.discord4j/Discord4J -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.discord4j</groupId>
|
<groupId>com.discord4j</groupId>
|
||||||
|
@ -225,13 +219,6 @@
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency> -->
|
</dependency> -->
|
||||||
<!-- https://mvnrepository.com/artifact/org.objenesis/objenesis -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.objenesis</groupId>
|
|
||||||
<artifactId>objenesis</artifactId>
|
|
||||||
<version>2.6</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.vdurmont</groupId>
|
<groupId>com.vdurmont</groupId>
|
||||||
<artifactId>emoji-java</artifactId>
|
<artifactId>emoji-java</artifactId>
|
||||||
|
@ -249,6 +236,11 @@
|
||||||
<version>v4.4</version>
|
<version>v4.4</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mockito</groupId>
|
||||||
|
<artifactId>mockito-core</artifactId>
|
||||||
|
<version>3.0.0</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<profiles>
|
<profiles>
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class PlayerListWatcher {
|
||||||
tpt = icbcl.getMethod("getString");
|
tpt = icbcl.getMethod("getString");
|
||||||
}
|
}
|
||||||
val toPlainText = tpt;
|
val toPlainText = tpt;
|
||||||
mock = Mockito.mock(dplc, new Answer() { // Cannot call super constructor
|
mock = Mockito.mock(dplc, Mockito.withSettings().defaultAnswer(new Answer<>() { // Cannot call super constructor
|
||||||
@Override
|
@Override
|
||||||
public Object answer(InvocationOnMock invocation) throws Throwable {
|
public Object answer(InvocationOnMock invocation) throws Throwable {
|
||||||
final Method method = invocation.getMethod();
|
final Method method = invocation.getMethod();
|
||||||
|
@ -140,7 +140,7 @@ public class PlayerListWatcher {
|
||||||
TBMCCoreAPI.SendException("Failed to broadcast message sent to all players - hacking failed.", e);
|
TBMCCoreAPI.SendException("Failed to broadcast message sent to all players - hacking failed.", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}).stubOnly());
|
||||||
plist = currentPL;
|
plist = currentPL;
|
||||||
for (var plc = dplc; plc != null; plc = plc.getSuperclass()) { //Set all fields
|
for (var plc = dplc; plc != null; plc = plc.getSuperclass()) { //Set all fields
|
||||||
for (var f : plc.getDeclaredFields()) {
|
for (var f : plc.getDeclaredFields()) {
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
package buttondevteam.discordplugin.listeners;
|
|
||||||
|
|
||||||
public interface DiscordListener {
|
|
||||||
}
|
|
|
@ -361,19 +361,13 @@ public class MCChatListener implements Listener {
|
||||||
+ "ou can access all of your regular commands (even offline) in private chat: DM me `mcchat`!");
|
+ "ou can access all of your regular commands (even offline) in private chat: DM me `mcchat`!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
val ev = new TBMCCommandPreprocessEvent(dsender, dmessage);
|
val channel = clmd == null ? user.channel().get() : clmd.mcchannel;
|
||||||
|
val ev = new TBMCCommandPreprocessEvent(dsender, channel, dmessage, clmd == null ? dsender : clmd.dcp);
|
||||||
Bukkit.getScheduler().runTask(DiscordPlugin.plugin, () -> Bukkit.getPluginManager().callEvent(ev));
|
Bukkit.getScheduler().runTask(DiscordPlugin.plugin, () -> Bukkit.getPluginManager().callEvent(ev));
|
||||||
if (ev.isCancelled())
|
if (ev.isCancelled())
|
||||||
return true;
|
return true;
|
||||||
int spi = cmdlowercased.indexOf(' ');
|
|
||||||
final String topcmd = spi == -1 ? cmdlowercased : cmdlowercased.substring(0, spi);
|
|
||||||
Bukkit.getScheduler().runTask(DiscordPlugin.plugin, //Commands need to be run sync
|
Bukkit.getScheduler().runTask(DiscordPlugin.plugin, //Commands need to be run sync
|
||||||
() -> {
|
() -> {
|
||||||
val channel = user.channel();
|
|
||||||
val chtmp = channel.get();
|
|
||||||
if (clmd != null) {
|
|
||||||
channel.set(clmd.mcchannel); //Hack to send command in the channel
|
|
||||||
} //TODO: Permcheck isn't implemented for commands
|
|
||||||
try {
|
try {
|
||||||
String mcpackage = Bukkit.getServer().getClass().getPackage().getName();
|
String mcpackage = Bukkit.getServer().getClass().getPackage().getName();
|
||||||
if (mcpackage.contains("1_12"))
|
if (mcpackage.contains("1_12"))
|
||||||
|
@ -386,8 +380,6 @@ public class MCChatListener implements Listener {
|
||||||
TBMCCoreAPI.SendException("A class is not found when trying to run command " + cmd + "!", e);
|
TBMCCoreAPI.SendException("A class is not found when trying to run command " + cmd + "!", e);
|
||||||
}
|
}
|
||||||
Bukkit.getLogger().info(dsender.getName() + " issued command from Discord: /" + cmd);
|
Bukkit.getLogger().info(dsender.getName() + " issued command from Discord: /" + cmd);
|
||||||
if (clmd != null)
|
|
||||||
channel.set(chtmp);
|
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue