A few fixes
This commit is contained in:
parent
a39fd083be
commit
773277cb27
8 changed files with 65 additions and 134 deletions
|
@ -1,13 +0,0 @@
|
|||
<component name="libraryTable">
|
||||
<library name="Maven: net.bytebuddy:byte-buddy:1.6.11">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/bytebuddy/byte-buddy/1.6.11/byte-buddy-1.6.11.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/bytebuddy/byte-buddy/1.6.11/byte-buddy-1.6.11-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/bytebuddy/byte-buddy/1.6.11/byte-buddy-1.6.11-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
|
@ -1,13 +0,0 @@
|
|||
<component name="libraryTable">
|
||||
<library name="Maven: net.bytebuddy:byte-buddy-agent:1.6.11">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/bytebuddy/byte-buddy-agent/1.6.11/byte-buddy-agent-1.6.11.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/bytebuddy/byte-buddy-agent/1.6.11/byte-buddy-agent-1.6.11-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/bytebuddy/byte-buddy-agent/1.6.11/byte-buddy-agent-1.6.11-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
|
@ -1,13 +0,0 @@
|
|||
<component name="libraryTable">
|
||||
<library name="Maven: org.mockito:mockito-core:2.7.20">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/mockito/mockito-core/2.7.20/mockito-core-2.7.20.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/mockito/mockito-core/2.7.20/mockito-core-2.7.20-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/mockito/mockito-core/2.7.20/mockito-core-2.7.20-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
|
@ -1,13 +0,0 @@
|
|||
<component name="libraryTable">
|
||||
<library name="Maven: org.objenesis:objenesis:2.5">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/objenesis/objenesis/2.5/objenesis-2.5.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/objenesis/objenesis/2.5/objenesis-2.5-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/objenesis/objenesis/2.5/objenesis-2.5-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
|
@ -12,23 +12,13 @@
|
|||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<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="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: 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.mockito:mockito-core:2.7.20" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: net.bytebuddy:byte-buddy:1.6.11" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: net.bytebuddy:byte-buddy-agent:1.6.11" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: org.objenesis:objenesis:2.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mockito:mockito-core:3.0.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.bytebuddy:byte-buddy:1.9.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.bytebuddy:byte-buddy-agent:1.9.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.objenesis:objenesis:2.6" level="project" />
|
||||
<orderEntry type="module" module-name="ButtonProcessor" />
|
||||
<orderEntry type="library" name="Maven: org.spigotmc:spigot-api:1.12.2-R0.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.6" level="project" />
|
||||
|
|
|
@ -160,7 +160,7 @@
|
|||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<version>2.7.20</version>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
|
||||
<dependency>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package buttondevteam.lib.chat;
|
||||
|
||||
import buttondevteam.core.MainPlugin;
|
||||
import lombok.experimental.var;
|
||||
import lombok.val;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
@ -127,7 +126,7 @@ public class Command2MC extends Command2<ICommand2MC, Command2MCSender> implemen
|
|||
//System.out.println("tab");
|
||||
for (int i = commandline.length(); i != -1; i = commandline.lastIndexOf(' ', i - 1)) {
|
||||
String subcommand = commandline.substring(0, i).toLowerCase();
|
||||
if (subcommand.charAt(0) != '/') subcommand = '/' + subcommand; //Console
|
||||
if (subcommand.length() == 0 || subcommand.charAt(0) != '/') subcommand = '/' + subcommand; //Console
|
||||
//System.out.println("Subcommand: " + subcommand);
|
||||
SubcommandData<ICommand2MC> sd = subcommands.get(subcommand); //O(1)
|
||||
if (sd == null) continue;
|
||||
|
@ -183,7 +182,7 @@ public class Command2MC extends Command2<ICommand2MC, Command2MCSender> implemen
|
|||
}
|
||||
}
|
||||
if (paramArr[i1].isVarArgs()) {
|
||||
params.add(commandline.substring(j + 1).split(" +"));
|
||||
par0ams.add(commandline.substring(j + 1).split(" +"));
|
||||
continue;
|
||||
}
|
||||
j = commandline.indexOf(' ', j + 1); //End index
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.util.HashMap;
|
|||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class TBMCChatAPI {
|
||||
|
||||
|
@ -38,10 +39,8 @@ public class TBMCChatAPI {
|
|||
/**
|
||||
* Returns messages formatted for Minecraft chat listing the subcommands of the command.
|
||||
*
|
||||
* @param command
|
||||
* The command which we want the subcommands of
|
||||
* @param sender
|
||||
* The sender for permissions
|
||||
* @param command The command which we want the subcommands of
|
||||
* @param sender The sender for permissions
|
||||
* @return The subcommands
|
||||
*/
|
||||
public static String[] GetSubCommands(TBMCCommandBase command, CommandSender sender) {
|
||||
|
@ -52,10 +51,8 @@ public class TBMCChatAPI {
|
|||
* Returns messages formatted for Minecraft chat listing the subcommands of the command.<br>
|
||||
* Returns a header if subcommands were found, otherwise returns an empty array.
|
||||
*
|
||||
* @param command
|
||||
* The command which we want the subcommands of
|
||||
* @param sender
|
||||
* The sender for permissions
|
||||
* @param command The command which we want the subcommands of
|
||||
* @param sender The sender for permissions
|
||||
* @return The subcommands
|
||||
*/
|
||||
public static String[] GetSubCommands(String command, CommandSender sender) {
|
||||
|
@ -97,10 +94,8 @@ public class TBMCChatAPI {
|
|||
* <i>Using this method after the server is done loading will have no effect.</i>
|
||||
* </p>
|
||||
*
|
||||
* @param plugin
|
||||
* The caller plugin
|
||||
* @param acmdclass
|
||||
* A command's class to get the package name for commands. The provided class's package and subpackages are scanned for commands.
|
||||
* @param plugin The caller plugin
|
||||
* @param acmdclass A command's class to get the package name for commands. The provided class's package and subpackages are scanned for commands.
|
||||
*/
|
||||
public static synchronized void AddCommands(JavaPlugin plugin, Class<? extends TBMCCommandBase> acmdclass) {
|
||||
plugin.getLogger().info("Registering commands from " + acmdclass.getPackage().getName());
|
||||
|
@ -140,10 +135,8 @@ public class TBMCChatAPI {
|
|||
* <i>Using this method after the server is done loading will have no effect.</i>
|
||||
* </p>
|
||||
*
|
||||
* @param plugin
|
||||
* The caller plugin
|
||||
* @param thecmdclass
|
||||
* The command's class to create it (because why let you create the command class)
|
||||
* @param plugin The caller plugin
|
||||
* @param thecmdclass The command's class to create it (because why let you create the command class)
|
||||
*/
|
||||
public static void AddCommand(JavaPlugin plugin, Class<? extends TBMCCommandBase> thecmdclass, Object... params) {
|
||||
// plugin.getLogger().info("Registering command " + thecmdclass.getSimpleName() + " for " + plugin.getName());
|
||||
|
@ -173,10 +166,8 @@ public class TBMCChatAPI {
|
|||
* <i>Using this method after the server is done loading will have no effect.</i>
|
||||
* </p>
|
||||
*
|
||||
* @param plugin
|
||||
* The caller plugin
|
||||
* @param cmd
|
||||
* The command to add
|
||||
* @param plugin The caller plugin
|
||||
* @param cmd The command to add
|
||||
*/
|
||||
public static void AddCommand(JavaPlugin plugin, TBMCCommandBase cmd) {
|
||||
try {
|
||||
|
@ -283,6 +274,7 @@ public class TBMCChatAPI {
|
|||
cm.getSender().sendMessage("§cThe channel '" + channel.DisplayName().get() + "' is disabled!");
|
||||
return true; //Cancel sending if channel is disabled
|
||||
}
|
||||
Supplier<Boolean> task = () -> {
|
||||
val permcheck = cm.getPermCheck();
|
||||
RecipientTestResult rtr = getScoreOrSendError(channel, permcheck);
|
||||
int score = rtr.score;
|
||||
|
@ -297,17 +289,20 @@ public class TBMCChatAPI {
|
|||
event = new TBMCChatEvent(channel, cm, rtr);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
return event.isCancelled();
|
||||
};
|
||||
if (Bukkit.isPrimaryThread())
|
||||
Bukkit.getScheduler().runTaskAsynchronously(MainPlugin.Instance, task::get);
|
||||
else
|
||||
return task.get();
|
||||
return false; //Not cancelled if async
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a regular message to Minecraft. Make sure that the channel is registered with {@link #RegisterChatChannel(Channel)}.
|
||||
*
|
||||
* @param channel
|
||||
* The channel to send to
|
||||
* @param rtr
|
||||
* The score&group to use to find the group - use {@link RecipientTestResult#ALL} if the channel doesn't have scores
|
||||
* @param message
|
||||
* The message to send
|
||||
* @param channel The channel to send to
|
||||
* @param rtr The score&group to use to find the group - use {@link RecipientTestResult#ALL} if the channel doesn't have scores
|
||||
* @param message The message to send
|
||||
* @param exceptions Platforms where this message shouldn't be sent (same as {@link ChatMessage#getOrigin()}
|
||||
* @return The event cancelled state
|
||||
*/
|
||||
|
@ -333,8 +328,7 @@ public class TBMCChatAPI {
|
|||
/**
|
||||
* Register a chat channel. See {@link Channel#Channel(String, Color, String, java.util.function.Function)} for details.
|
||||
*
|
||||
* @param channel
|
||||
* A new {@link Channel} to register
|
||||
* @param channel A new {@link Channel} to register
|
||||
*/
|
||||
public static void RegisterChatChannel(Channel channel) {
|
||||
Channel.RegisterChannel(channel);
|
||||
|
|
Loading…
Reference in a new issue