Plugin update on shutdown+fromcmd
Fromcmd: whether a message was sent by using a command Yesterday
This commit is contained in:
parent
eb9deb39b4
commit
bdf824e20e
106 changed files with 145 additions and 163 deletions
0
.idea/ButtonCore.iml
Normal file → Executable file
0
.idea/ButtonCore.iml
Normal file → Executable file
0
.idea/compiler.xml
Normal file → Executable file
0
.idea/compiler.xml
Normal file → Executable file
0
.idea/encodings.xml
Normal file → Executable file
0
.idea/encodings.xml
Normal file → Executable file
0
.idea/libraries/Maven__com_github_TBMCPlugins_ButtonCore_Towny_master_v1_0_gc1751b8_228.xml
Normal file → Executable file
0
.idea/libraries/Maven__com_github_TBMCPlugins_ButtonCore_Towny_master_v1_0_gc1751b8_228.xml
Normal file → Executable file
0
.idea/libraries/Maven__com_github_milkbowl_VaultAPI_master_8dc0859cba_1.xml
Normal file → Executable file
0
.idea/libraries/Maven__com_github_milkbowl_VaultAPI_master_8dc0859cba_1.xml
Normal file → Executable file
0
.idea/libraries/Maven__com_google_code_findbugs_annotations_2_0_1.xml
Normal file → Executable file
0
.idea/libraries/Maven__com_google_code_findbugs_annotations_2_0_1.xml
Normal file → Executable file
0
.idea/libraries/Maven__com_google_code_gson_gson_2_2_4.xml
Normal file → Executable file
0
.idea/libraries/Maven__com_google_code_gson_gson_2_2_4.xml
Normal file → Executable file
0
.idea/libraries/Maven__com_google_guava_guava_15_0.xml
Normal file → Executable file
0
.idea/libraries/Maven__com_google_guava_guava_15_0.xml
Normal file → Executable file
0
.idea/libraries/Maven__com_googlecode_json_simple_json_simple_1_1_1.xml
Normal file → Executable file
0
.idea/libraries/Maven__com_googlecode_json_simple_json_simple_1_1_1.xml
Normal file → Executable file
0
.idea/libraries/Maven__commons_io_commons_io_1_3_2.xml
Normal file → Executable file
0
.idea/libraries/Maven__commons_io_commons_io_1_3_2.xml
Normal file → Executable file
0
.idea/libraries/Maven__commons_lang_commons_lang_2_6.xml
Normal file → Executable file
0
.idea/libraries/Maven__commons_lang_commons_lang_2_6.xml
Normal file → Executable file
0
.idea/libraries/Maven__javax_persistence_persistence_api_1_0.xml
Normal file → Executable file
0
.idea/libraries/Maven__javax_persistence_persistence_api_1_0.xml
Normal file → Executable file
0
.idea/libraries/Maven__junit_junit_3_8_1.xml
Normal file → Executable file
0
.idea/libraries/Maven__junit_junit_3_8_1.xml
Normal file → Executable file
0
.idea/libraries/Maven__net_bytebuddy_byte_buddy_1_6_11.xml
Normal file → Executable file
0
.idea/libraries/Maven__net_bytebuddy_byte_buddy_1_6_11.xml
Normal file → Executable file
0
.idea/libraries/Maven__net_bytebuddy_byte_buddy_agent_1_6_11.xml
Normal file → Executable file
0
.idea/libraries/Maven__net_bytebuddy_byte_buddy_agent_1_6_11.xml
Normal file → Executable file
0
.idea/libraries/Maven__net_md_5_bungeecord_chat_1_9_SNAPSHOT.xml
Normal file → Executable file
0
.idea/libraries/Maven__net_md_5_bungeecord_chat_1_9_SNAPSHOT.xml
Normal file → Executable file
0
.idea/libraries/Maven__org_avaje_ebean_2_8_1.xml
Normal file → Executable file
0
.idea/libraries/Maven__org_avaje_ebean_2_8_1.xml
Normal file → Executable file
0
.idea/libraries/Maven__org_bukkit_bukkit_1_9_R0_1_SNAPSHOT.xml
Normal file → Executable file
0
.idea/libraries/Maven__org_bukkit_bukkit_1_9_R0_1_SNAPSHOT.xml
Normal file → Executable file
0
.idea/libraries/Maven__org_javassist_javassist_3_20_0_GA.xml
Normal file → Executable file
0
.idea/libraries/Maven__org_javassist_javassist_3_20_0_GA.xml
Normal file → Executable file
0
.idea/libraries/Maven__org_mockito_mockito_core_2_7_20.xml
Normal file → Executable file
0
.idea/libraries/Maven__org_mockito_mockito_core_2_7_20.xml
Normal file → Executable file
0
.idea/libraries/Maven__org_objenesis_objenesis_2_5.xml
Normal file → Executable file
0
.idea/libraries/Maven__org_objenesis_objenesis_2_5.xml
Normal file → Executable file
0
.idea/libraries/Maven__org_projectlombok_lombok_1_16_16.xml
Normal file → Executable file
0
.idea/libraries/Maven__org_projectlombok_lombok_1_16_16.xml
Normal file → Executable file
0
.idea/libraries/Maven__org_reflections_reflections_0_9_10.xml
Normal file → Executable file
0
.idea/libraries/Maven__org_reflections_reflections_0_9_10.xml
Normal file → Executable file
0
.idea/libraries/Maven__org_spigotmc_spigot_api_1_9_2_R0_1_SNAPSHOT.xml
Normal file → Executable file
0
.idea/libraries/Maven__org_spigotmc_spigot_api_1_9_2_R0_1_SNAPSHOT.xml
Normal file → Executable file
0
.idea/libraries/Maven__org_yaml_snakeyaml_1_15.xml
Normal file → Executable file
0
.idea/libraries/Maven__org_yaml_snakeyaml_1_15.xml
Normal file → Executable file
0
.idea/misc.xml
Normal file → Executable file
0
.idea/misc.xml
Normal file → Executable file
0
.idea/modules.xml
Normal file → Executable file
0
.idea/modules.xml
Normal file → Executable file
0
.idea/vcs.xml
Normal file → Executable file
0
.idea/vcs.xml
Normal file → Executable file
0
.project
Normal file → Executable file
0
.project
Normal file → Executable file
0
.settings/org.eclipse.m2e.core.prefs
Normal file → Executable file
0
.settings/org.eclipse.m2e.core.prefs
Normal file → Executable file
0
.travis.yml
Normal file → Executable file
0
.travis.yml
Normal file → Executable file
0
ButtonCore/.factorypath
Normal file → Executable file
0
ButtonCore/.factorypath
Normal file → Executable file
0
ButtonCore/.gitignore
vendored
Normal file → Executable file
0
ButtonCore/.gitignore
vendored
Normal file → Executable file
0
ButtonCore/.project
Normal file → Executable file
0
ButtonCore/.project
Normal file → Executable file
0
ButtonCore/.settings/org.eclipse.core.resources.prefs
Normal file → Executable file
0
ButtonCore/.settings/org.eclipse.core.resources.prefs
Normal file → Executable file
0
ButtonCore/.settings/org.eclipse.jdt.apt.core.prefs
Normal file → Executable file
0
ButtonCore/.settings/org.eclipse.jdt.apt.core.prefs
Normal file → Executable file
0
ButtonCore/.settings/org.eclipse.jdt.core.prefs
Normal file → Executable file
0
ButtonCore/.settings/org.eclipse.jdt.core.prefs
Normal file → Executable file
0
ButtonCore/.settings/org.eclipse.m2e.core.prefs
Normal file → Executable file
0
ButtonCore/.settings/org.eclipse.m2e.core.prefs
Normal file → Executable file
0
ButtonCore/License.md
Normal file → Executable file
0
ButtonCore/License.md
Normal file → Executable file
0
ButtonCore/README.md
Normal file → Executable file
0
ButtonCore/README.md
Normal file → Executable file
0
ButtonCore/pom.xml
Normal file → Executable file
0
ButtonCore/pom.xml
Normal file → Executable file
9
ButtonCore/src/main/java/buttondevteam/core/CommandCaller.java
Normal file → Executable file
9
ButtonCore/src/main/java/buttondevteam/core/CommandCaller.java
Normal file → Executable file
|
@ -1,14 +1,15 @@
|
||||||
package buttondevteam.core;
|
package buttondevteam.core;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import buttondevteam.lib.TBMCCoreAPI;
|
||||||
|
import buttondevteam.lib.chat.TBMCChatAPI;
|
||||||
|
import buttondevteam.lib.chat.TBMCCommandBase;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.PluginCommand;
|
import org.bukkit.command.PluginCommand;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import buttondevteam.lib.TBMCCoreAPI;
|
|
||||||
import buttondevteam.lib.chat.TBMCChatAPI;
|
import java.util.Arrays;
|
||||||
import buttondevteam.lib.chat.TBMCCommandBase;
|
|
||||||
|
|
||||||
public class CommandCaller implements CommandExecutor {
|
public class CommandCaller implements CommandExecutor {
|
||||||
|
|
||||||
|
|
0
ButtonCore/src/main/java/buttondevteam/core/MainPlugin.java
Normal file → Executable file
0
ButtonCore/src/main/java/buttondevteam/core/MainPlugin.java
Normal file → Executable file
0
ButtonCore/src/main/java/buttondevteam/core/PlayerListener.java
Normal file → Executable file
0
ButtonCore/src/main/java/buttondevteam/core/PlayerListener.java
Normal file → Executable file
7
ButtonCore/src/main/java/buttondevteam/core/ScheduledRestartCommand.java
Normal file → Executable file
7
ButtonCore/src/main/java/buttondevteam/core/ScheduledRestartCommand.java
Normal file → Executable file
|
@ -1,5 +1,8 @@
|
||||||
package buttondevteam.core;
|
package buttondevteam.core;
|
||||||
|
|
||||||
|
import buttondevteam.lib.ScheduledServerRestartEvent;
|
||||||
|
import buttondevteam.lib.chat.CommandClass;
|
||||||
|
import buttondevteam.lib.chat.TBMCCommandBase;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.boss.BarColor;
|
import org.bukkit.boss.BarColor;
|
||||||
import org.bukkit.boss.BarFlag;
|
import org.bukkit.boss.BarFlag;
|
||||||
|
@ -8,10 +11,6 @@ import org.bukkit.boss.BossBar;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
|
||||||
import buttondevteam.lib.ScheduledServerRestartEvent;
|
|
||||||
import buttondevteam.lib.chat.CommandClass;
|
|
||||||
import buttondevteam.lib.chat.TBMCCommandBase;
|
|
||||||
|
|
||||||
@CommandClass(modOnly = true, path = "schrestart")
|
@CommandClass(modOnly = true, path = "schrestart")
|
||||||
public class ScheduledRestartCommand extends TBMCCommandBase {
|
public class ScheduledRestartCommand extends TBMCCommandBase {
|
||||||
private static volatile int restartcounter;
|
private static volatile int restartcounter;
|
||||||
|
|
13
ButtonCore/src/main/java/buttondevteam/core/TestPrepare.java
Normal file → Executable file
13
ButtonCore/src/main/java/buttondevteam/core/TestPrepare.java
Normal file → Executable file
|
@ -1,9 +1,8 @@
|
||||||
package buttondevteam.core;
|
package buttondevteam.core;
|
||||||
|
|
||||||
import java.util.Collection;
|
import buttondevteam.lib.chat.Channel;
|
||||||
import java.util.Collections;
|
import buttondevteam.lib.chat.Color;
|
||||||
import java.util.logging.Logger;
|
import buttondevteam.lib.chat.TBMCChatAPI;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
|
@ -11,9 +10,9 @@ import org.mockito.Mockito;
|
||||||
import org.mockito.invocation.InvocationOnMock;
|
import org.mockito.invocation.InvocationOnMock;
|
||||||
import org.mockito.stubbing.Answer;
|
import org.mockito.stubbing.Answer;
|
||||||
|
|
||||||
import buttondevteam.lib.chat.Channel;
|
import java.util.Collection;
|
||||||
import buttondevteam.lib.chat.Color;
|
import java.util.Collections;
|
||||||
import buttondevteam.lib.chat.TBMCChatAPI;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
public class TestPrepare {
|
public class TestPrepare {
|
||||||
public static void PrepareServer() {
|
public static void PrepareServer() {
|
||||||
|
|
5
ButtonCore/src/main/java/buttondevteam/core/UpdatePluginCommand.java
Normal file → Executable file
5
ButtonCore/src/main/java/buttondevteam/core/UpdatePluginCommand.java
Normal file → Executable file
|
@ -1,12 +1,11 @@
|
||||||
package buttondevteam.core;
|
package buttondevteam.core;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
|
|
||||||
import buttondevteam.lib.PluginUpdater;
|
import buttondevteam.lib.PluginUpdater;
|
||||||
import buttondevteam.lib.TBMCCoreAPI;
|
import buttondevteam.lib.TBMCCoreAPI;
|
||||||
import buttondevteam.lib.chat.CommandClass;
|
import buttondevteam.lib.chat.CommandClass;
|
||||||
import buttondevteam.lib.chat.TBMCCommandBase;
|
import buttondevteam.lib.chat.TBMCCommandBase;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
@CommandClass(modOnly = true)
|
@CommandClass(modOnly = true)
|
||||||
public class UpdatePluginCommand extends TBMCCommandBase {
|
public class UpdatePluginCommand extends TBMCCommandBase {
|
||||||
|
|
0
ButtonCore/src/main/java/buttondevteam/lib/EventExceptionCoreHandler.java
Normal file → Executable file
0
ButtonCore/src/main/java/buttondevteam/lib/EventExceptionCoreHandler.java
Normal file → Executable file
21
ButtonCore/src/main/java/buttondevteam/lib/EventExceptionHandler.java
Normal file → Executable file
21
ButtonCore/src/main/java/buttondevteam/lib/EventExceptionHandler.java
Normal file → Executable file
|
@ -1,25 +1,20 @@
|
||||||
|
|
||||||
package buttondevteam.lib;
|
package buttondevteam.lib;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import org.apache.commons.lang.Validate;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.EventException;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.plugin.*;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.commons.lang.Validate;
|
|
||||||
import org.bukkit.event.Event;
|
|
||||||
import org.bukkit.event.EventException;
|
|
||||||
import org.bukkit.event.HandlerList;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.plugin.EventExecutor;
|
|
||||||
import org.bukkit.plugin.IllegalPluginAccessException;
|
|
||||||
import org.bukkit.plugin.Plugin;
|
|
||||||
import org.bukkit.plugin.PluginManager;
|
|
||||||
import org.bukkit.plugin.RegisteredListener;
|
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
|
|
||||||
abstract class EventExceptionHandler { // https://gist.github.com/aadnk/5430459
|
abstract class EventExceptionHandler { // https://gist.github.com/aadnk/5430459
|
||||||
// For wrapping a registered listener
|
// For wrapping a registered listener
|
||||||
private static class ExceptionRegisteredListener extends RegisteredListener {
|
private static class ExceptionRegisteredListener extends RegisteredListener {
|
||||||
|
|
35
ButtonCore/src/main/java/buttondevteam/lib/PluginUpdater.java
Normal file → Executable file
35
ButtonCore/src/main/java/buttondevteam/lib/PluginUpdater.java
Normal file → Executable file
|
@ -1,5 +1,15 @@
|
||||||
package buttondevteam.lib;
|
package buttondevteam.lib;
|
||||||
|
|
||||||
|
import com.google.gson.JsonArray;
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import com.google.gson.JsonParser;
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -9,21 +19,12 @@ import java.nio.file.StandardCopyOption;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import org.apache.commons.io.FileUtils;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.event.Event;
|
|
||||||
import org.bukkit.event.HandlerList;
|
|
||||||
|
|
||||||
import com.google.gson.JsonArray;
|
|
||||||
import com.google.gson.JsonElement;
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import com.google.gson.JsonParser;
|
|
||||||
|
|
||||||
public class PluginUpdater {
|
public class PluginUpdater {
|
||||||
private PluginUpdater() {
|
private PluginUpdater() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final File updatedir = new File("updateplugins");
|
||||||
/**
|
/**
|
||||||
* See {@link TBMCCoreAPI#UpdatePlugin(String, CommandSender, String)}
|
* See {@link TBMCCoreAPI#UpdatePlugin(String, CommandSender, String)}
|
||||||
*/
|
*/
|
||||||
|
@ -57,11 +58,11 @@ public class PluginUpdater {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
info(sender, "Updating TBMC plugin: " + correctname + " from " + correctbranch.get());
|
info(sender, "Updating TBMC plugin: " + correctname + " from " + correctbranch.get());
|
||||||
return updatePluginJitPack(sender, correctname, correctbranch);
|
return updatePluginJitPack(sender, correctname, correctbranch.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean updatePluginJitPack(CommandSender sender, String correctname,
|
private static boolean updatePluginJitPack(CommandSender sender, String correctname,
|
||||||
Optional<String> correctbranch) {
|
String correctbranch) {
|
||||||
URL url;
|
URL url;
|
||||||
final boolean isWindows = System.getProperty("os.name").contains("Windows");
|
final boolean isWindows = System.getProperty("os.name").contains("Windows");
|
||||||
File result = new File("plugins/" + correctname + (isWindows ? ".jar" : ".jar_tmp"));
|
File result = new File("plugins/" + correctname + (isWindows ? ".jar" : ".jar_tmp"));
|
||||||
|
@ -69,24 +70,24 @@ public class PluginUpdater {
|
||||||
try {
|
try {
|
||||||
url = new URL("https://jitpack.io/com/github/TBMCPlugins/"
|
url = new URL("https://jitpack.io/com/github/TBMCPlugins/"
|
||||||
+ (correctname.equals("ButtonCore") ? "ButtonCore/ButtonCore" : correctname) + "/"
|
+ (correctname.equals("ButtonCore") ? "ButtonCore/ButtonCore" : correctname) + "/"
|
||||||
+ correctbranch.get() + "-SNAPSHOT/" + correctname + "-" + correctbranch.get() + "-SNAPSHOT.jar"); // ButtonCore exception required since it hosts Towny as well
|
+ correctbranch + "-SNAPSHOT/" + correctname + "-" + correctbranch + "-SNAPSHOT.jar"); // ButtonCore exception required since it hosts Towny as well
|
||||||
FileUtils.copyURLToFile(url, result);
|
FileUtils.copyURLToFile(url, result);
|
||||||
if (!result.exists() || result.length() < 25) {
|
if (!result.exists() || result.length() < 25) {
|
||||||
result.delete();
|
result.delete();
|
||||||
error(sender, "The downloaded JAR for " + correctname + " from " + correctbranch.get()
|
error(sender, "The downloaded JAR for " + correctname + " from " + correctbranch
|
||||||
+ " is too small (smnaller than 25 bytes). Am I downloading from the right place?");
|
+ " is too small (smnaller than 25 bytes). Am I downloading from the right place?");
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
if (!isWindows)
|
if (!isWindows)
|
||||||
Files.move(result.toPath(), finalresult.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
Files.move(result.toPath(), finalresult.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||||
info(sender, "Updating plugin " + correctname + " from " + correctbranch.get() + " done!");
|
info(sender, "Updating plugin " + correctname + " from " + correctbranch + " done!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
error(sender,
|
error(sender,
|
||||||
"Can't find JAR for " + correctname + " from " + correctbranch.get()
|
"Can't find JAR for " + correctname + " from " + correctbranch
|
||||||
+ ", the build probably failed. Build log (scroll to bottom):" + "\n"
|
+ ", the build probably failed. Build log (scroll to bottom):" + "\n"
|
||||||
+ "https://jitpack.io/com/github/TBMCPlugins/" + correctname + "/" + correctbranch.get()
|
+ "https://jitpack.io/com/github/TBMCPlugins/" + correctname + "/" + correctbranch
|
||||||
+ "-SNAPSHOT/build.log\nIf you'd like to rebuild the same commit, go to:\nhttps://jitpack.io/#TBMCPlugins/"
|
+ "-SNAPSHOT/build.log\nIf you'd like to rebuild the same commit, go to:\nhttps://jitpack.io/#TBMCPlugins/"
|
||||||
+ correctname + "\nAnd delete the newest build.");
|
+ correctname + "\nAnd delete the newest build.");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
0
ButtonCore/src/main/java/buttondevteam/lib/ScheduledServerRestartEvent.java
Normal file → Executable file
0
ButtonCore/src/main/java/buttondevteam/lib/ScheduledServerRestartEvent.java
Normal file → Executable file
11
ButtonCore/src/main/java/buttondevteam/lib/TBMCChatEvent.java
Normal file → Executable file
11
ButtonCore/src/main/java/buttondevteam/lib/TBMCChatEvent.java
Normal file → Executable file
|
@ -1,27 +1,28 @@
|
||||||
package buttondevteam.lib;
|
package buttondevteam.lib;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.event.HandlerList;
|
|
||||||
|
|
||||||
import buttondevteam.lib.chat.Channel;
|
import buttondevteam.lib.chat.Channel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make sure to only send the message to users who {@link #shouldSendTo(CommandSender)} returns true.
|
* Make sure to only send the message to users where {@link #shouldSendTo(CommandSender)} returns true.
|
||||||
*
|
*
|
||||||
* @author NorbiPeti
|
* @author NorbiPeti
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
public class TBMCChatEvent extends TBMCChatEventBase {
|
public class TBMCChatEvent extends TBMCChatEventBase {
|
||||||
public TBMCChatEvent(CommandSender sender, Channel channel, String message, int score) {
|
public TBMCChatEvent(CommandSender sender, Channel channel, String message, int score, boolean fromcmd) {
|
||||||
super(channel, message, score);
|
super(channel, message, score);
|
||||||
this.sender = sender;
|
this.sender = sender;
|
||||||
|
this.fromcmd = fromcmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
|
||||||
private CommandSender sender;
|
private CommandSender sender;
|
||||||
|
private boolean fromcmd;
|
||||||
// TODO: Message object with data?
|
// TODO: Message object with data?
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
6
ButtonCore/src/main/java/buttondevteam/lib/TBMCChatEventBase.java
Normal file → Executable file
6
ButtonCore/src/main/java/buttondevteam/lib/TBMCChatEventBase.java
Normal file → Executable file
|
@ -1,14 +1,14 @@
|
||||||
package buttondevteam.lib;
|
package buttondevteam.lib;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.event.Cancellable;
|
|
||||||
import org.bukkit.event.Event;
|
|
||||||
import buttondevteam.lib.chat.Channel;
|
import buttondevteam.lib.chat.Channel;
|
||||||
import buttondevteam.lib.chat.Channel.RecipientTestResult;
|
import buttondevteam.lib.chat.Channel.RecipientTestResult;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
|
|
0
ButtonCore/src/main/java/buttondevteam/lib/TBMCChatPreprocessEvent.java
Normal file → Executable file
0
ButtonCore/src/main/java/buttondevteam/lib/TBMCChatPreprocessEvent.java
Normal file → Executable file
24
ButtonCore/src/main/java/buttondevteam/lib/TBMCCoreAPI.java
Normal file → Executable file
24
ButtonCore/src/main/java/buttondevteam/lib/TBMCCoreAPI.java
Normal file → Executable file
|
@ -1,10 +1,8 @@
|
||||||
package buttondevteam.lib;
|
package buttondevteam.lib;
|
||||||
|
|
||||||
import java.io.*;
|
import buttondevteam.core.MainPlugin;
|
||||||
import java.net.*;
|
import buttondevteam.lib.player.ChromaGamerBase;
|
||||||
import java.util.*;
|
import buttondevteam.lib.potato.DebugPotato;
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
@ -12,9 +10,15 @@ import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
import buttondevteam.core.MainPlugin;
|
import java.io.IOException;
|
||||||
import buttondevteam.lib.player.ChromaGamerBase;
|
import java.io.InputStream;
|
||||||
import buttondevteam.lib.potato.DebugPotato;
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.net.URLConnection;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
public class TBMCCoreAPI {
|
public class TBMCCoreAPI {
|
||||||
static List<String> coders = new ArrayList<String>() {
|
static List<String> coders = new ArrayList<String>() {
|
||||||
|
@ -67,8 +71,8 @@ public class TBMCCoreAPI {
|
||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static HashMap<String, Throwable> exceptionsToSend = new HashMap<>();
|
private static final HashMap<String, Throwable> exceptionsToSend = new HashMap<>();
|
||||||
private static List<String> debugMessagesToSend = new ArrayList<>();
|
private static final List<String> debugMessagesToSend = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send exception to the {@link TBMCExceptionEvent}.
|
* Send exception to the {@link TBMCExceptionEvent}.
|
||||||
|
|
0
ButtonCore/src/main/java/buttondevteam/lib/TBMCDebugMessageEvent.java
Normal file → Executable file
0
ButtonCore/src/main/java/buttondevteam/lib/TBMCDebugMessageEvent.java
Normal file → Executable file
5
ButtonCore/src/main/java/buttondevteam/lib/TBMCExceptionEvent.java
Normal file → Executable file
5
ButtonCore/src/main/java/buttondevteam/lib/TBMCExceptionEvent.java
Normal file → Executable file
|
@ -1,10 +1,9 @@
|
||||||
package buttondevteam.lib;
|
package buttondevteam.lib;
|
||||||
|
|
||||||
import org.bukkit.event.Event;
|
|
||||||
import org.bukkit.event.HandlerList;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
|
5
ButtonCore/src/main/java/buttondevteam/lib/TBMCSystemChatEvent.java
Normal file → Executable file
5
ButtonCore/src/main/java/buttondevteam/lib/TBMCSystemChatEvent.java
Normal file → Executable file
|
@ -1,10 +1,9 @@
|
||||||
package buttondevteam.lib;
|
package buttondevteam.lib;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.event.HandlerList;
|
|
||||||
|
|
||||||
import buttondevteam.lib.chat.Channel;
|
import buttondevteam.lib.chat.Channel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make sure to only send the message to users who {@link #shouldSendTo(CommandSender)} returns true.
|
* Make sure to only send the message to users who {@link #shouldSendTo(CommandSender)} returns true.
|
||||||
|
|
0
ButtonCore/src/main/java/buttondevteam/lib/chat/Channel.java
Normal file → Executable file
0
ButtonCore/src/main/java/buttondevteam/lib/chat/Channel.java
Normal file → Executable file
0
ButtonCore/src/main/java/buttondevteam/lib/chat/ChatChannelRegisterEvent.java
Normal file → Executable file
0
ButtonCore/src/main/java/buttondevteam/lib/chat/ChatChannelRegisterEvent.java
Normal file → Executable file
3
ButtonCore/src/main/java/buttondevteam/lib/chat/ChatRoom.java
Normal file → Executable file
3
ButtonCore/src/main/java/buttondevteam/lib/chat/ChatRoom.java
Normal file → Executable file
|
@ -1,8 +1,9 @@
|
||||||
package buttondevteam.lib.chat;
|
package buttondevteam.lib.chat;
|
||||||
|
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
|
|
||||||
public class ChatRoom extends Channel {
|
public class ChatRoom extends Channel {
|
||||||
private List<CommandSender> usersInRoom = new ArrayList<>();
|
private List<CommandSender> usersInRoom = new ArrayList<>();
|
||||||
|
|
0
ButtonCore/src/main/java/buttondevteam/lib/chat/Color.java
Normal file → Executable file
0
ButtonCore/src/main/java/buttondevteam/lib/chat/Color.java
Normal file → Executable file
6
ButtonCore/src/main/java/buttondevteam/lib/chat/CommandClass.java
Normal file → Executable file
6
ButtonCore/src/main/java/buttondevteam/lib/chat/CommandClass.java
Normal file → Executable file
|
@ -1,10 +1,6 @@
|
||||||
package buttondevteam.lib.chat;
|
package buttondevteam.lib.chat;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.*;
|
||||||
import java.lang.annotation.Inherited;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Abstract classes with no {@link CommandClass} annotations will be ignored.</b> Classes that are not abstract or have the annotation will be included in the command path unless
|
* <b>Abstract classes with no {@link CommandClass} annotations will be ignored.</b> Classes that are not abstract or have the annotation will be included in the command path unless
|
||||||
|
|
0
ButtonCore/src/main/java/buttondevteam/lib/chat/IDiscordSender.java
Normal file → Executable file
0
ButtonCore/src/main/java/buttondevteam/lib/chat/IDiscordSender.java
Normal file → Executable file
3
ButtonCore/src/main/java/buttondevteam/lib/chat/OptionallyPlayerCommandBase.java
Normal file → Executable file
3
ButtonCore/src/main/java/buttondevteam/lib/chat/OptionallyPlayerCommandBase.java
Normal file → Executable file
|
@ -1,10 +1,9 @@
|
||||||
package buttondevteam.lib.chat;
|
package buttondevteam.lib.chat;
|
||||||
|
|
||||||
|
import buttondevteam.lib.TBMCCoreAPI;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import buttondevteam.lib.TBMCCoreAPI;
|
|
||||||
|
|
||||||
public abstract class OptionallyPlayerCommandBase extends TBMCCommandBase {
|
public abstract class OptionallyPlayerCommandBase extends TBMCCommandBase {
|
||||||
public boolean OnCommand(Player player, String alias, String[] args) {
|
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||||
if (getClass().isAnnotationPresent(OptionallyPlayerCommandClass.class)
|
if (getClass().isAnnotationPresent(OptionallyPlayerCommandClass.class)
|
||||||
|
|
6
ButtonCore/src/main/java/buttondevteam/lib/chat/OptionallyPlayerCommandClass.java
Normal file → Executable file
6
ButtonCore/src/main/java/buttondevteam/lib/chat/OptionallyPlayerCommandClass.java
Normal file → Executable file
|
@ -1,10 +1,6 @@
|
||||||
package buttondevteam.lib.chat;
|
package buttondevteam.lib.chat;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.*;
|
||||||
import java.lang.annotation.Inherited;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only needed to use with {@link OptionallyPlayerCommandBase} command classes
|
* Only needed to use with {@link OptionallyPlayerCommandBase} command classes
|
||||||
|
|
0
ButtonCore/src/main/java/buttondevteam/lib/chat/PlayerCommandBase.java
Normal file → Executable file
0
ButtonCore/src/main/java/buttondevteam/lib/chat/PlayerCommandBase.java
Normal file → Executable file
0
ButtonCore/src/main/java/buttondevteam/lib/chat/Priority.java
Normal file → Executable file
0
ButtonCore/src/main/java/buttondevteam/lib/chat/Priority.java
Normal file → Executable file
60
ButtonCore/src/main/java/buttondevteam/lib/chat/TBMCChatAPI.java
Normal file → Executable file
60
ButtonCore/src/main/java/buttondevteam/lib/chat/TBMCChatAPI.java
Normal file → Executable file
|
@ -1,13 +1,12 @@
|
||||||
package buttondevteam.lib.chat;
|
package buttondevteam.lib.chat;
|
||||||
|
|
||||||
import java.lang.reflect.Modifier;
|
import buttondevteam.core.CommandCaller;
|
||||||
import java.util.ArrayList;
|
import buttondevteam.core.MainPlugin;
|
||||||
import java.util.Arrays;
|
import buttondevteam.lib.TBMCChatEvent;
|
||||||
import java.util.HashMap;
|
import buttondevteam.lib.TBMCChatPreprocessEvent;
|
||||||
import java.util.Map.Entry;
|
import buttondevteam.lib.TBMCCoreAPI;
|
||||||
import java.util.Set;
|
import buttondevteam.lib.TBMCSystemChatEvent;
|
||||||
import java.util.function.Consumer;
|
import buttondevteam.lib.chat.Channel.RecipientTestResult;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -17,13 +16,13 @@ import org.reflections.scanners.SubTypesScanner;
|
||||||
import org.reflections.util.ClasspathHelper;
|
import org.reflections.util.ClasspathHelper;
|
||||||
import org.reflections.util.ConfigurationBuilder;
|
import org.reflections.util.ConfigurationBuilder;
|
||||||
|
|
||||||
import buttondevteam.core.CommandCaller;
|
import java.lang.reflect.Modifier;
|
||||||
import buttondevteam.core.MainPlugin;
|
import java.util.ArrayList;
|
||||||
import buttondevteam.lib.TBMCChatEvent;
|
import java.util.Arrays;
|
||||||
import buttondevteam.lib.TBMCChatPreprocessEvent;
|
import java.util.HashMap;
|
||||||
import buttondevteam.lib.TBMCCoreAPI;
|
import java.util.Map.Entry;
|
||||||
import buttondevteam.lib.TBMCSystemChatEvent;
|
import java.util.Set;
|
||||||
import buttondevteam.lib.chat.Channel.RecipientTestResult;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
public class TBMCChatAPI {
|
public class TBMCChatAPI {
|
||||||
|
|
||||||
|
@ -119,7 +118,7 @@ public class TBMCChatAPI {
|
||||||
continue;
|
continue;
|
||||||
TBMCCommandBase c = cmd.newInstance();
|
TBMCCommandBase c = cmd.newInstance();
|
||||||
c.plugin = plugin;
|
c.plugin = plugin;
|
||||||
if (!CheckForNulls(plugin, c))
|
if (HasNulls(plugin, c))
|
||||||
continue;
|
continue;
|
||||||
commands.put(c.GetCommandPath(), c);
|
commands.put(c.GetCommandPath(), c);
|
||||||
CommandCaller.RegisterCommand(c);
|
CommandCaller.RegisterCommand(c);
|
||||||
|
@ -155,7 +154,7 @@ public class TBMCChatAPI {
|
||||||
else
|
else
|
||||||
c = thecmdclass.newInstance();
|
c = thecmdclass.newInstance();
|
||||||
c.plugin = plugin;
|
c.plugin = plugin;
|
||||||
if (!CheckForNulls(plugin, c))
|
if (HasNulls(plugin, c))
|
||||||
return;
|
return;
|
||||||
commands.put(c.GetCommandPath(), c);
|
commands.put(c.GetCommandPath(), c);
|
||||||
CommandCaller.RegisterCommand(c);
|
CommandCaller.RegisterCommand(c);
|
||||||
|
@ -181,7 +180,7 @@ public class TBMCChatAPI {
|
||||||
* The command to add
|
* The command to add
|
||||||
*/
|
*/
|
||||||
public static void AddCommand(JavaPlugin plugin, TBMCCommandBase cmd) {
|
public static void AddCommand(JavaPlugin plugin, TBMCCommandBase cmd) {
|
||||||
if (!CheckForNulls(plugin, cmd))
|
if (HasNulls(plugin, cmd))
|
||||||
return;
|
return;
|
||||||
// plugin.getLogger().info("Registering command /" + cmd.GetCommandPath() + " for " + plugin.getName());
|
// plugin.getLogger().info("Registering command /" + cmd.GetCommandPath() + " for " + plugin.getName());
|
||||||
try {
|
try {
|
||||||
|
@ -193,22 +192,22 @@ public class TBMCChatAPI {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean CheckForNulls(JavaPlugin plugin, TBMCCommandBase cmd) {
|
private static boolean HasNulls(JavaPlugin plugin, TBMCCommandBase cmd) {
|
||||||
if (cmd == null) {
|
if (cmd == null) {
|
||||||
TBMCCoreAPI.SendException("An error occured while registering a command for plugin " + plugin.getName(),
|
TBMCCoreAPI.SendException("An error occured while registering a command for plugin " + plugin.getName(),
|
||||||
new Exception("The command is null!"));
|
new Exception("The command is null!"));
|
||||||
return false;
|
return true;
|
||||||
} else if (cmd.GetCommandPath() == null) {
|
} else if (cmd.GetCommandPath() == null) {
|
||||||
TBMCCoreAPI.SendException("An error occured while registering command " + cmd.getClass().getSimpleName()
|
TBMCCoreAPI.SendException("An error occured while registering command " + cmd.getClass().getSimpleName()
|
||||||
+ " for plugin " + plugin.getName(), new Exception("The command path is null!"));
|
+ " for plugin " + plugin.getName(), new Exception("The command path is null!"));
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a chat message to Minecraft. Make sure that the channel is registered with {@link #RegisterChatChannel(Channel)}.
|
* Sends a chat message to Minecraft. Make sure that the channel is registered with {@link #RegisterChatChannel(Channel)}.
|
||||||
*
|
*
|
||||||
* @param channel
|
* @param channel
|
||||||
* The channel to send to
|
* The channel to send to
|
||||||
* @param sender
|
* @param sender
|
||||||
|
@ -218,6 +217,19 @@ public class TBMCChatAPI {
|
||||||
* @return The event cancelled state
|
* @return The event cancelled state
|
||||||
*/
|
*/
|
||||||
public static boolean SendChatMessage(Channel channel, CommandSender sender, String message) {
|
public static boolean SendChatMessage(Channel channel, CommandSender sender, String message) {
|
||||||
|
return SendChatMessage(channel, sender, message, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends a chat message to Minecraft. Make sure that the channel is registered with {@link #RegisterChatChannel(Channel)}.
|
||||||
|
*
|
||||||
|
* @param channel The channel to send to
|
||||||
|
* @param sender The sender to send from
|
||||||
|
* @param message The message to send
|
||||||
|
* @param fromcommand Whether this message comes from running a command, used to determine whether to delete Discord messages for example
|
||||||
|
* @return The event cancelled state
|
||||||
|
*/
|
||||||
|
public static boolean SendChatMessage(Channel channel, CommandSender sender, String message, boolean fromcommand) {
|
||||||
if (!Channel.getChannels().contains(channel))
|
if (!Channel.getChannels().contains(channel))
|
||||||
throw new RuntimeException("Channel " + channel.DisplayName + " not registered!");
|
throw new RuntimeException("Channel " + channel.DisplayName + " not registered!");
|
||||||
TBMCChatPreprocessEvent eventPre = new TBMCChatPreprocessEvent(sender, channel, message);
|
TBMCChatPreprocessEvent eventPre = new TBMCChatPreprocessEvent(sender, channel, message);
|
||||||
|
@ -227,7 +239,7 @@ public class TBMCChatAPI {
|
||||||
int score = getScoreOrSendError(channel, sender);
|
int score = getScoreOrSendError(channel, sender);
|
||||||
if (score == -1)
|
if (score == -1)
|
||||||
return true;
|
return true;
|
||||||
TBMCChatEvent event = new TBMCChatEvent(sender, channel, eventPre.getMessage(), score);
|
TBMCChatEvent event = new TBMCChatEvent(sender, channel, eventPre.getMessage(), score, fromcommand);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
return event.isCancelled();
|
return event.isCancelled();
|
||||||
}
|
}
|
||||||
|
|
5
ButtonCore/src/main/java/buttondevteam/lib/chat/TBMCCommandBase.java
Normal file → Executable file
5
ButtonCore/src/main/java/buttondevteam/lib/chat/TBMCCommandBase.java
Normal file → Executable file
|
@ -1,11 +1,10 @@
|
||||||
package buttondevteam.lib.chat;
|
package buttondevteam.lib.chat;
|
||||||
|
|
||||||
import java.util.function.Function;
|
import javassist.Modifier;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
import javassist.Modifier;
|
import java.util.function.Function;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extend this class to create new TBMCCommand and use {@link TBMCChatAPI#AddCommand(org.bukkit.plugin.java.JavaPlugin, TBMCCommandBase)} to add it. <u><b>Note:</b></u> The command path (command name
|
* Extend this class to create new TBMCCommand and use {@link TBMCChatAPI#AddCommand(org.bukkit.plugin.java.JavaPlugin, TBMCCommandBase)} to add it. <u><b>Note:</b></u> The command path (command name
|
||||||
|
|
0
ButtonCore/src/main/java/buttondevteam/lib/chat/TellrawSerializableEnum.java
Normal file → Executable file
0
ButtonCore/src/main/java/buttondevteam/lib/chat/TellrawSerializableEnum.java
Normal file → Executable file
6
ButtonCore/src/main/java/buttondevteam/lib/player/AbstractUserClass.java
Normal file → Executable file
6
ButtonCore/src/main/java/buttondevteam/lib/player/AbstractUserClass.java
Normal file → Executable file
|
@ -1,10 +1,6 @@
|
||||||
package buttondevteam.lib.player;
|
package buttondevteam.lib.player;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.*;
|
||||||
import java.lang.annotation.Inherited;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies a {@link ChromaGamerBase} direct subclass which's abstract. For Minecraft data, use {@link PlayerClass}
|
* Specifies a {@link ChromaGamerBase} direct subclass which's abstract. For Minecraft data, use {@link PlayerClass}
|
||||||
|
|
14
ButtonCore/src/main/java/buttondevteam/lib/player/ChromaGamerBase.java
Normal file → Executable file
14
ButtonCore/src/main/java/buttondevteam/lib/player/ChromaGamerBase.java
Normal file → Executable file
|
@ -1,17 +1,15 @@
|
||||||
package buttondevteam.lib.player;
|
package buttondevteam.lib.player;
|
||||||
|
|
||||||
|
import buttondevteam.lib.TBMCCoreAPI;
|
||||||
|
import com.google.common.collect.HashBiMap;
|
||||||
|
import lombok.val;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
|
||||||
|
|
||||||
import com.google.common.collect.HashBiMap;
|
|
||||||
|
|
||||||
import buttondevteam.lib.TBMCCoreAPI;
|
|
||||||
import lombok.val;
|
|
||||||
|
|
||||||
@ChromaGamerEnforcer
|
@ChromaGamerEnforcer
|
||||||
public abstract class ChromaGamerBase implements AutoCloseable {
|
public abstract class ChromaGamerBase implements AutoCloseable {
|
||||||
public static final String TBMC_PLAYERS_DIR = "TBMC/players/";
|
public static final String TBMC_PLAYERS_DIR = "TBMC/players/";
|
||||||
|
|
6
ButtonCore/src/main/java/buttondevteam/lib/player/ChromaGamerEnforcer.java
Normal file → Executable file
6
ButtonCore/src/main/java/buttondevteam/lib/player/ChromaGamerEnforcer.java
Normal file → Executable file
|
@ -1,10 +1,6 @@
|
||||||
package buttondevteam.lib.player;
|
package buttondevteam.lib.player;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.*;
|
||||||
import java.lang.annotation.Inherited;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
@Target(ElementType.TYPE)
|
@Target(ElementType.TYPE)
|
||||||
|
|
0
ButtonCore/src/main/java/buttondevteam/lib/player/EnumPlayerData.java
Normal file → Executable file
0
ButtonCore/src/main/java/buttondevteam/lib/player/EnumPlayerData.java
Normal file → Executable file
0
ButtonCore/src/main/java/buttondevteam/lib/player/PlayerClass.java
Normal file → Executable file
0
ButtonCore/src/main/java/buttondevteam/lib/player/PlayerClass.java
Normal file → Executable file
0
ButtonCore/src/main/java/buttondevteam/lib/player/PlayerData.java
Normal file → Executable file
0
ButtonCore/src/main/java/buttondevteam/lib/player/PlayerData.java
Normal file → Executable file
0
ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayer.java
Normal file → Executable file
0
ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayer.java
Normal file → Executable file
22
ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayerBase.java
Normal file → Executable file
22
ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayerBase.java
Normal file → Executable file
|
@ -1,23 +1,21 @@
|
||||||
package buttondevteam.lib.player;
|
package buttondevteam.lib.player;
|
||||||
|
|
||||||
|
import buttondevteam.lib.TBMCCoreAPI;
|
||||||
|
import com.palmergames.bukkit.towny.Towny;
|
||||||
|
import com.palmergames.bukkit.towny.exceptions.AlreadyRegisteredException;
|
||||||
|
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
|
||||||
|
import com.palmergames.bukkit.towny.object.Resident;
|
||||||
|
import com.palmergames.bukkit.towny.object.TownyUniverse;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.OfflinePlayer;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.OfflinePlayer;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import com.palmergames.bukkit.towny.Towny;
|
|
||||||
import com.palmergames.bukkit.towny.exceptions.AlreadyRegisteredException;
|
|
||||||
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
|
|
||||||
import com.palmergames.bukkit.towny.object.Resident;
|
|
||||||
import com.palmergames.bukkit.towny.object.TownyUniverse;
|
|
||||||
|
|
||||||
import buttondevteam.lib.TBMCCoreAPI;
|
|
||||||
|
|
||||||
@AbstractUserClass(foldername = "minecraft", prototype = TBMCPlayer.class)
|
@AbstractUserClass(foldername = "minecraft", prototype = TBMCPlayer.class)
|
||||||
public abstract class TBMCPlayerBase extends ChromaGamerBase {
|
public abstract class TBMCPlayerBase extends ChromaGamerBase {
|
||||||
protected UUID uuid;
|
protected UUID uuid;
|
||||||
|
|
9
ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayerGetInfoEvent.java
Normal file → Executable file
9
ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayerGetInfoEvent.java
Normal file → Executable file
|
@ -1,14 +1,13 @@
|
||||||
package buttondevteam.lib.player;
|
package buttondevteam.lib.player;
|
||||||
|
|
||||||
|
import buttondevteam.lib.player.ChromaGamerBase.InfoTarget;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.bukkit.event.Event;
|
|
||||||
import org.bukkit.event.HandlerList;
|
|
||||||
|
|
||||||
import buttondevteam.lib.player.ChromaGamerBase.InfoTarget;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* This event gets called when player information is requested. It can be used to give more per-plugin information about a player.
|
* This event gets called when player information is requested. It can be used to give more per-plugin information about a player.
|
||||||
|
|
0
ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayerJoinEvent.java
Normal file → Executable file
0
ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayerJoinEvent.java
Normal file → Executable file
0
ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayerLoadEvent.java
Normal file → Executable file
0
ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayerLoadEvent.java
Normal file → Executable file
0
ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayerQuitEvent.java
Normal file → Executable file
0
ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayerQuitEvent.java
Normal file → Executable file
0
ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayerSaveEvent.java
Normal file → Executable file
0
ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayerSaveEvent.java
Normal file → Executable file
0
ButtonCore/src/main/java/buttondevteam/lib/player/TBMCYEEHAWEvent.java
Normal file → Executable file
0
ButtonCore/src/main/java/buttondevteam/lib/player/TBMCYEEHAWEvent.java
Normal file → Executable file
6
ButtonCore/src/main/java/buttondevteam/lib/player/UserClass.java
Normal file → Executable file
6
ButtonCore/src/main/java/buttondevteam/lib/player/UserClass.java
Normal file → Executable file
|
@ -1,10 +1,6 @@
|
||||||
package buttondevteam.lib.player;
|
package buttondevteam.lib.player;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.*;
|
||||||
import java.lang.annotation.Inherited;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies a {@link ChromaGamerBase} direct subclass which can be instantiated. For Minecraft data, use {@link PlayerClass}
|
* Specifies a {@link ChromaGamerBase} direct subclass which can be instantiated. For Minecraft data, use {@link PlayerClass}
|
||||||
|
|
8
ButtonCore/src/main/java/buttondevteam/lib/potato/DebugPotato.java
Normal file → Executable file
8
ButtonCore/src/main/java/buttondevteam/lib/potato/DebugPotato.java
Normal file → Executable file
|
@ -1,15 +1,15 @@
|
||||||
package buttondevteam.lib.potato;
|
package buttondevteam.lib.potato;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class DebugPotato {
|
public class DebugPotato {
|
||||||
private List<String> message;
|
private List<String> message;
|
||||||
private String type;
|
private String type;
|
||||||
|
|
0
ButtonCore/src/main/java/buttondevteam/lib/potato/Gary.java
Normal file → Executable file
0
ButtonCore/src/main/java/buttondevteam/lib/potato/Gary.java
Normal file → Executable file
0
ButtonCore/src/main/resources/plugin.yml
Normal file → Executable file
0
ButtonCore/src/main/resources/plugin.yml
Normal file → Executable file
9
ButtonCore/src/test/java/buttondevteam/core/PlayerDataTest.java
Normal file → Executable file
9
ButtonCore/src/test/java/buttondevteam/core/PlayerDataTest.java
Normal file → Executable file
|
@ -1,16 +1,15 @@
|
||||||
package buttondevteam.core;
|
package buttondevteam.core;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
|
||||||
|
|
||||||
import buttondevteam.core.TestPlayerClass.TestEnum;
|
import buttondevteam.core.TestPlayerClass.TestEnum;
|
||||||
import buttondevteam.lib.player.ChromaGamerBase;
|
import buttondevteam.lib.player.ChromaGamerBase;
|
||||||
import buttondevteam.lib.player.TBMCPlayerBase;
|
import buttondevteam.lib.player.TBMCPlayerBase;
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
import junit.framework.TestSuite;
|
import junit.framework.TestSuite;
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class PlayerDataTest extends TestCase {
|
public class PlayerDataTest extends TestCase {
|
||||||
public PlayerDataTest() {
|
public PlayerDataTest() {
|
||||||
|
|
0
ButtonCore/src/test/java/buttondevteam/core/TestPlayerClass.java
Normal file → Executable file
0
ButtonCore/src/test/java/buttondevteam/core/TestPlayerClass.java
Normal file → Executable file
0
ButtonProcessor/.classpath
Normal file → Executable file
0
ButtonProcessor/.classpath
Normal file → Executable file
0
ButtonProcessor/.gitignore
vendored
Normal file → Executable file
0
ButtonProcessor/.gitignore
vendored
Normal file → Executable file
0
ButtonProcessor/.project
Normal file → Executable file
0
ButtonProcessor/.project
Normal file → Executable file
0
ButtonProcessor/.settings/org.eclipse.core.resources.prefs
Normal file → Executable file
0
ButtonProcessor/.settings/org.eclipse.core.resources.prefs
Normal file → Executable file
0
ButtonProcessor/.settings/org.eclipse.jdt.core.prefs
Normal file → Executable file
0
ButtonProcessor/.settings/org.eclipse.jdt.core.prefs
Normal file → Executable file
0
ButtonProcessor/.settings/org.eclipse.m2e.core.prefs
Normal file → Executable file
0
ButtonProcessor/.settings/org.eclipse.m2e.core.prefs
Normal file → Executable file
0
ButtonProcessor/ButtonProcessor.iml
Normal file → Executable file
0
ButtonProcessor/ButtonProcessor.iml
Normal file → Executable file
0
ButtonProcessor/License.md
Normal file → Executable file
0
ButtonProcessor/License.md
Normal file → Executable file
0
ButtonProcessor/pom.xml
Normal file → Executable file
0
ButtonProcessor/pom.xml
Normal file → Executable file
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue