Test config option upd.
And indentation fixes apparently
This commit is contained in:
parent
5872117d28
commit
cc3ed7cf52
4 changed files with 69 additions and 75 deletions
|
@ -1,5 +1,10 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<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">
|
<component name="MavenProjectsManager">
|
||||||
<option name="originalFiles">
|
<option name="originalFiles">
|
||||||
<list>
|
<list>
|
||||||
|
|
|
@ -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="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: 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: 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.javassist:javassist:3.20.0-GA" level="project" />
|
||||||
|
|
|
@ -46,7 +46,6 @@ import java.util.logging.Logger;
|
||||||
public class MainPlugin extends ButtonPlugin {
|
public class MainPlugin extends ButtonPlugin {
|
||||||
public static MainPlugin Instance;
|
public static MainPlugin Instance;
|
||||||
public static Permission permission;
|
public static Permission permission;
|
||||||
public static boolean Test;
|
|
||||||
public static Essentials ess;
|
public static Essentials ess;
|
||||||
|
|
||||||
private Logger logger;
|
private Logger logger;
|
||||||
|
@ -69,11 +68,8 @@ public class MainPlugin extends ButtonPlugin {
|
||||||
"{channel}] <{name}> {message}");
|
"{channel}] <{name}> {message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public ConfigData<Boolean> test() {
|
||||||
* The permission group for users that aren't online on the server. Currently this can happen for people using commands from Discord.
|
return getIConfig().getData("test", true);
|
||||||
*/
|
|
||||||
public ConfigData<String> unconnPermGroup() {
|
|
||||||
return getIConfig().getData("unconnPermGroup", "unconnected");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -86,7 +82,6 @@ public class MainPlugin extends ButtonPlugin {
|
||||||
throw new NullPointerException("No permission plugin found!");
|
throw new NullPointerException("No permission plugin found!");
|
||||||
if (!setupEconomy()) //Though Essentials always provides economy so this shouldn't happen
|
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.");
|
getLogger().warning("No economy plugin found! Components using economy will not be registered.");
|
||||||
Test = getConfig().getBoolean("test", true);
|
|
||||||
saveConfig();
|
saveConfig();
|
||||||
Component.registerComponent(this, new PluginUpdaterComponent());
|
Component.registerComponent(this, new PluginUpdaterComponent());
|
||||||
Component.registerComponent(this, new RestartComponent());
|
Component.registerComponent(this, new RestartComponent());
|
||||||
|
@ -127,7 +122,7 @@ public class MainPlugin extends ButtonPlugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ess = Essentials.getPlugin(Essentials.class);
|
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
|
@Override
|
||||||
|
|
|
@ -24,6 +24,7 @@ import java.util.Map.Entry;
|
||||||
public class TBMCCoreAPI {
|
public class TBMCCoreAPI {
|
||||||
static final List<String> coders = new ArrayList<String>() {
|
static final List<String> coders = new ArrayList<String>() {
|
||||||
private static final long serialVersionUID = -4462159250738367334L;
|
private static final long serialVersionUID = -4462159250738367334L;
|
||||||
|
|
||||||
{
|
{
|
||||||
add("Alisolarflare");
|
add("Alisolarflare");
|
||||||
add("NorbiPeti");
|
add("NorbiPeti");
|
||||||
|
@ -36,10 +37,8 @@ public class TBMCCoreAPI {
|
||||||
/**
|
/**
|
||||||
* Updates or installs the specified plugin. The plugin must use Maven.
|
* Updates or installs the specified plugin. The plugin must use Maven.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name The plugin's repository name.
|
||||||
* The plugin's repository name.
|
* @param sender The command sender (if not console, messages will be printed to console as well).
|
||||||
* @param sender
|
|
||||||
* The command sender (if not console, messages will be printed to console as well).
|
|
||||||
*/
|
*/
|
||||||
public static void UpdatePlugin(String name, CommandSender sender) {
|
public static void UpdatePlugin(String name, CommandSender sender) {
|
||||||
UpdatePlugin(name, sender, "master");
|
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.
|
* Updates or installs the specified plugin from the specified branch. The plugin must use Maven.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name The plugin's repository name.
|
||||||
* The plugin's repository name.
|
* @param sender The command sender (if not console, messages will be printed to console as well).
|
||||||
* @param sender
|
* @param branch The branch to download the plugin from.
|
||||||
* 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
|
* @return Success or not
|
||||||
*/
|
*/
|
||||||
public static boolean UpdatePlugin(String name, CommandSender sender, String branch) {
|
public static boolean UpdatePlugin(String name, CommandSender sender, String branch) {
|
||||||
|
@ -78,10 +74,8 @@ public class TBMCCoreAPI {
|
||||||
/**
|
/**
|
||||||
* Send exception to the {@link TBMCExceptionEvent}.
|
* Send exception to the {@link TBMCExceptionEvent}.
|
||||||
*
|
*
|
||||||
* @param sourcemsg
|
* @param sourcemsg A message that is shown at the top of the exception (before the exception's message)
|
||||||
* A message that is shown at the top of the exception (before the exception's message)
|
* @param e The exception to send
|
||||||
* @param e
|
|
||||||
* The exception to send
|
|
||||||
*/
|
*/
|
||||||
public static void SendException(String sourcemsg, Throwable e) {
|
public static void SendException(String sourcemsg, Throwable e) {
|
||||||
SendException(sourcemsg, e, false);
|
SendException(sourcemsg, e, false);
|
||||||
|
@ -98,7 +92,7 @@ public class TBMCCoreAPI {
|
||||||
Bukkit.getLogger().warning(sourcemsg);
|
Bukkit.getLogger().warning(sourcemsg);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
if (debugPotato) {
|
if (debugPotato) {
|
||||||
List<Player> devsOnline = new ArrayList<Player>();
|
List<Player> devsOnline = new ArrayList<>();
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
if (coders.contains(player.getName())) {
|
if (coders.contains(player.getName())) {
|
||||||
devsOnline.add(player);
|
devsOnline.add(player);
|
||||||
|
@ -106,10 +100,10 @@ public class TBMCCoreAPI {
|
||||||
}
|
}
|
||||||
if (!devsOnline.isEmpty()) {
|
if (!devsOnline.isEmpty()) {
|
||||||
DebugPotato potato = new DebugPotato()
|
DebugPotato potato = new DebugPotato()
|
||||||
.setMessage(new String[] { //
|
.setMessage(new String[]{ //
|
||||||
"§b§o" + e.getClass().getSimpleName(), //
|
"§b§o" + e.getClass().getSimpleName(), //
|
||||||
"§c§o" + sourcemsg, //
|
"§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"
|
.setType(e instanceof IOException ? "Throwable Potato"
|
||||||
: e instanceof ClassCastException ? "Squished Potato"
|
: e instanceof ClassCastException ? "Squished Potato"
|
||||||
: e instanceof NullPointerException ? "Plain Potato"
|
: e instanceof NullPointerException ? "Plain Potato"
|
||||||
|
@ -134,10 +128,8 @@ public class TBMCCoreAPI {
|
||||||
/**
|
/**
|
||||||
* Registers Bukkit events, handling the exceptions occurring in those events
|
* Registers Bukkit events, handling the exceptions occurring in those events
|
||||||
*
|
*
|
||||||
* @param listener
|
* @param listener The class that handles the events
|
||||||
* The class that handles the events
|
* @param plugin The plugin which the listener belongs to
|
||||||
* @param plugin
|
|
||||||
* The plugin which the listener belongs to
|
|
||||||
*/
|
*/
|
||||||
public static void RegisterEventsForExceptions(Listener listener, Plugin plugin) {
|
public static void RegisterEventsForExceptions(Listener listener, Plugin plugin) {
|
||||||
EventExceptionHandler.registerEvents(listener, plugin, new EventExceptionCoreHandler());
|
EventExceptionHandler.registerEvents(listener, plugin, new EventExceptionCoreHandler());
|
||||||
|
@ -183,6 +175,7 @@ public class TBMCCoreAPI {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean IsTestServer() {
|
public static boolean IsTestServer() {
|
||||||
return MainPlugin.Test;
|
if (MainPlugin.Instance == null) return true;
|
||||||
|
return MainPlugin.Instance.test().get();
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue