Thought I changed the DiscordPlugin too - AW

Cleaned code a bit
YEEHAW
This commit is contained in:
Norbi Peti 2017-05-14 01:24:30 +02:00
parent 4a5479b027
commit 36b3c1895d
6 changed files with 0 additions and 18 deletions

View file

@ -36,13 +36,11 @@ public class CommandCaller implements CommandExecutor {
+ cmd.getPlugin().getName()); + cmd.getPlugin().getName());
else else
pc.setExecutor(instance); pc.setExecutor(instance);
System.out.println("Executor set");
} }
} }
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String alias, String[] args) { public boolean onCommand(CommandSender sender, Command command, String alias, String[] args) {
System.out.println("onCommand called");
String path = command.getName().toLowerCase(); String path = command.getName().toLowerCase();
for (String arg : args) for (String arg : args)
path += " " + arg; path += " " + arg;

View file

@ -34,11 +34,7 @@ public class ScheduledRestartCommand extends TBMCCommandBase {
restartbar = Bukkit.createBossBar("Server restart in " + ticks / 20f, BarColor.RED, BarStyle.SOLID, restartbar = Bukkit.createBossBar("Server restart in " + ticks / 20f, BarColor.RED, BarStyle.SOLID,
BarFlag.DARKEN_SKY); BarFlag.DARKEN_SKY);
restartbar.setProgress(1); restartbar.setProgress(1);
// System.out.println("Progress: " + restartbar.getProgress());
Bukkit.getOnlinePlayers().stream().forEach(p -> restartbar.addPlayer(p)); Bukkit.getOnlinePlayers().stream().forEach(p -> restartbar.addPlayer(p));
/*
* System.out.println( "Players: " + restartbar.getPlayers().stream().map(p -> p.getName()).collect(Collectors.joining(", ")));
*/
sender.sendMessage("Scheduled restart in " + ticks / 20f); sender.sendMessage("Scheduled restart in " + ticks / 20f);
ScheduledServerRestartEvent e = new ScheduledServerRestartEvent(ticks); ScheduledServerRestartEvent e = new ScheduledServerRestartEvent(ticks);
Bukkit.getPluginManager().callEvent(e); Bukkit.getPluginManager().callEvent(e);
@ -52,9 +48,6 @@ public class ScheduledRestartCommand extends TBMCCommandBase {
Bukkit.broadcastMessage("§c-- The server is restarting in " + restartcounter / 20 + " seconds!"); Bukkit.broadcastMessage("§c-- The server is restarting in " + restartcounter / 20 + " seconds!");
restartbar.setProgress(restartcounter / (double) restarttime); restartbar.setProgress(restartcounter / (double) restarttime);
restartbar.setTitle(String.format("Server restart in %f.2", restartcounter / 20f)); restartbar.setTitle(String.format("Server restart in %f.2", restartcounter / 20f));
/*
* if (restartcounter % 20 == 0) System.out.println("Progress: " + restartbar.getProgress());
*/
restartcounter--; restartcounter--;
}, 1, 1); }, 1, 1);
return true; return true;

View file

@ -21,8 +21,6 @@ public class TestPrepare {
@Override @Override
public Object answer(InvocationOnMock invocation) throws Throwable { public Object answer(InvocationOnMock invocation) throws Throwable {
// System.out.println("Return type: " + invocation.getMethod().getReturnType());
// System.out.println(String.class.isAssignableFrom(invocation.getMethod().getReturnType()));
if (returns(invocation, String.class)) if (returns(invocation, String.class))
return "test"; return "test";
if (returns(invocation, Logger.class)) if (returns(invocation, Logger.class))

View file

@ -115,7 +115,6 @@ public class TBMCChatAPI {
try { try {
if (!cmd.getPackage().getName().startsWith(acmdclass.getPackage().getName())) if (!cmd.getPackage().getName().startsWith(acmdclass.getPackage().getName()))
continue; // It keeps including the commands from here continue; // It keeps including the commands from here
//System.out.println("Class found: " + cmd.getName());
if (Modifier.isAbstract(cmd.getModifiers())) if (Modifier.isAbstract(cmd.getModifiers()))
continue; continue;
TBMCCommandBase c = cmd.newInstance(); TBMCCommandBase c = cmd.newInstance();

View file

@ -47,7 +47,6 @@ public abstract class TBMCCommandBase {
.replace("command", ""); .replace("command", "");
String path = getClass().getAnnotation(CommandClass.class).path(), String path = getClass().getAnnotation(CommandClass.class).path(),
prevpath = path = path.length() == 0 ? getFromClass.apply(getClass()) : path; prevpath = path = path.length() == 0 ? getFromClass.apply(getClass()) : path;
// System.out.println("Path: " + (path.length() == 0 ? getFromClass.apply(getClass()) : path))
for (Class<?> cl = getClass().getSuperclass(); cl != null for (Class<?> cl = getClass().getSuperclass(); cl != null
&& !cl.getPackage().getName().equals(TBMCCommandBase.class.getPackage().getName()); cl = cl && !cl.getPackage().getName().equals(TBMCCommandBase.class.getPackage().getName()); cl = cl
.getSuperclass()) { // .getSuperclass()) { //
@ -61,9 +60,7 @@ public abstract class TBMCCommandBase {
newpath = getFromClass.apply(cl); newpath = getFromClass.apply(cl);
} }
path = (prevpath = newpath) + " " + path; path = (prevpath = newpath) + " " + path;
// System.out.println("Path: " + (path.length() == 0 ? getFromClass.apply(cl) : path));
} }
//System.out.println("Path: " + path);
return path; return path;
} }

View file

@ -74,17 +74,14 @@ public abstract class TBMCPlayerBase extends ChromaGamerBase {
public static <T extends TBMCPlayerBase> T getPlayer(UUID uuid, Class<T> cl) { public static <T extends TBMCPlayerBase> T getPlayer(UUID uuid, Class<T> cl) {
if (playermap.containsKey(uuid + "-" + cl.getSimpleName())) if (playermap.containsKey(uuid + "-" + cl.getSimpleName()))
return (T) playermap.get(uuid + "-" + cl.getSimpleName()); return (T) playermap.get(uuid + "-" + cl.getSimpleName());
// System.out.println("A");
try { try {
T player; T player;
if (playermap.containsKey(uuid + "-" + TBMCPlayer.class.getSimpleName())) { if (playermap.containsKey(uuid + "-" + TBMCPlayer.class.getSimpleName())) {
// System.out.println("B"); - Don't program when tired
player = cl.newInstance(); player = cl.newInstance();
player.plugindata = playermap.get(uuid + "-" + TBMCPlayer.class.getSimpleName()).plugindata; player.plugindata = playermap.get(uuid + "-" + TBMCPlayer.class.getSimpleName()).plugindata;
playermap.put(uuid + "-" + cl.getSimpleName(), player); // It will get removed on player quit playermap.put(uuid + "-" + cl.getSimpleName(), player); // It will get removed on player quit
} else } else
player = ChromaGamerBase.getUser(uuid.toString(), cl); player = ChromaGamerBase.getUser(uuid.toString(), cl);
// System.out.println("C");
player.uuid = uuid; player.uuid = uuid;
return player; return player;
} catch (Exception e) { } catch (Exception e) {