Test config option upd.

And indentation fixes apparently
This commit is contained in:
Norbi Peti 2019-06-01 02:25:33 +02:00
parent 5872117d28
commit cc3ed7cf52
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56
4 changed files with 69 additions and 75 deletions

View file

@ -1,5 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<list size="1">
<item index="0" class="java.lang.String" itemvalue="org.bukkit.event.EventHandler" />
</list>
</component>
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>

View file

@ -16,6 +16,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="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" />

View file

@ -46,7 +46,6 @@ import java.util.logging.Logger;
public class MainPlugin extends ButtonPlugin {
public static MainPlugin Instance;
public static Permission permission;
public static boolean Test;
public static Essentials ess;
private Logger logger;
@ -69,11 +68,8 @@ public class MainPlugin extends ButtonPlugin {
"{channel}] <{name}> {message}");
}
/**
* The permission group for users that aren't online on the server. Currently this can happen for people using commands from Discord.
*/
public ConfigData<String> unconnPermGroup() {
return getIConfig().getData("unconnPermGroup", "unconnected");
public ConfigData<Boolean> test() {
return getIConfig().getData("test", true);
}
@Override
@ -86,7 +82,6 @@ public class MainPlugin extends ButtonPlugin {
throw new NullPointerException("No permission plugin found!");
if (!setupEconomy()) //Though Essentials always provides economy so this shouldn't happen
getLogger().warning("No economy plugin found! Components using economy will not be registered.");
Test = getConfig().getBoolean("test", true);
saveConfig();
Component.registerComponent(this, new PluginUpdaterComponent());
Component.registerComponent(this, new RestartComponent());
@ -127,7 +122,7 @@ public class MainPlugin extends ButtonPlugin {
}
}
ess = Essentials.getPlugin(Essentials.class);
logger.info(pdf.getName() + " has been Enabled (V." + pdf.getVersion() + ") Test: " + Test + ".");
logger.info(pdf.getName() + " has been Enabled (V." + pdf.getVersion() + ") Test: " + test().get() + ".");
}
@Override

View file

@ -24,6 +24,7 @@ import java.util.Map.Entry;
public class TBMCCoreAPI {
static final List<String> coders = new ArrayList<String>() {
private static final long serialVersionUID = -4462159250738367334L;
{
add("Alisolarflare");
add("NorbiPeti");
@ -36,10 +37,8 @@ public class TBMCCoreAPI {
/**
* Updates or installs the specified plugin. The plugin must use Maven.
*
* @param name
* The plugin's repository name.
* @param sender
* The command sender (if not console, messages will be printed to console as well).
* @param name The plugin's repository name.
* @param sender The command sender (if not console, messages will be printed to console as well).
*/
public static void UpdatePlugin(String name, CommandSender sender) {
UpdatePlugin(name, sender, "master");
@ -48,12 +47,9 @@ public class TBMCCoreAPI {
/**
* Updates or installs the specified plugin from the specified branch. The plugin must use Maven.
*
* @param name
* The plugin's repository name.
* @param sender
* The command sender (if not console, messages will be printed to console as well).
* @param branch
* The branch to download the plugin from.
* @param name The plugin's repository name.
* @param sender The command sender (if not console, messages will be printed to console as well).
* @param branch The branch to download the plugin from.
* @return Success or not
*/
public static boolean UpdatePlugin(String name, CommandSender sender, String branch) {
@ -78,10 +74,8 @@ public class TBMCCoreAPI {
/**
* Send exception to the {@link TBMCExceptionEvent}.
*
* @param sourcemsg
* A message that is shown at the top of the exception (before the exception's message)
* @param e
* The exception to send
* @param sourcemsg A message that is shown at the top of the exception (before the exception's message)
* @param e The exception to send
*/
public static void SendException(String sourcemsg, Throwable e) {
SendException(sourcemsg, e, false);
@ -98,7 +92,7 @@ public class TBMCCoreAPI {
Bukkit.getLogger().warning(sourcemsg);
e.printStackTrace();
if (debugPotato) {
List<Player> devsOnline = new ArrayList<Player>();
List<Player> devsOnline = new ArrayList<>();
for (Player player : Bukkit.getOnlinePlayers()) {
if (coders.contains(player.getName())) {
devsOnline.add(player);
@ -106,10 +100,10 @@ public class TBMCCoreAPI {
}
if (!devsOnline.isEmpty()) {
DebugPotato potato = new DebugPotato()
.setMessage(new String[] { //
.setMessage(new String[]{ //
"§b§o" + e.getClass().getSimpleName(), //
"§c§o" + sourcemsg, //
"§a§oFind a dev to fix this issue" })
"§a§oFind a dev to fix this issue"})
.setType(e instanceof IOException ? "Throwable Potato"
: e instanceof ClassCastException ? "Squished Potato"
: e instanceof NullPointerException ? "Plain Potato"
@ -134,10 +128,8 @@ public class TBMCCoreAPI {
/**
* Registers Bukkit events, handling the exceptions occurring in those events
*
* @param listener
* The class that handles the events
* @param plugin
* The plugin which the listener belongs to
* @param listener The class that handles the events
* @param plugin The plugin which the listener belongs to
*/
public static void RegisterEventsForExceptions(Listener listener, Plugin plugin) {
EventExceptionHandler.registerEvents(listener, plugin, new EventExceptionCoreHandler());
@ -183,6 +175,7 @@ public class TBMCCoreAPI {
}
public static boolean IsTestServer() {
return MainPlugin.Test;
if (MainPlugin.Instance == null) return true;
return MainPlugin.Instance.test().get();
}
}