Command annotations added instead of methods, improved channels #31

Merged
NorbiPeti merged 9 commits from dev into master 2017-05-15 00:33:22 +00:00
6 changed files with 0 additions and 18 deletions
Showing only changes of commit 36b3c1895d - Show all commits

View file

@ -36,13 +36,11 @@ public class CommandCaller implements CommandExecutor {
+ cmd.getPlugin().getName());
else
pc.setExecutor(instance);
System.out.println("Executor set");
}
}
@Override
public boolean onCommand(CommandSender sender, Command command, String alias, String[] args) {
System.out.println("onCommand called");
String path = command.getName().toLowerCase();
for (String arg : args)
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,
BarFlag.DARKEN_SKY);
restartbar.setProgress(1);
// System.out.println("Progress: " + restartbar.getProgress());
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);
ScheduledServerRestartEvent e = new ScheduledServerRestartEvent(ticks);
Bukkit.getPluginManager().callEvent(e);
@ -52,9 +48,6 @@ public class ScheduledRestartCommand extends TBMCCommandBase {
Bukkit.broadcastMessage("§c-- The server is restarting in " + restartcounter / 20 + " seconds!");
restartbar.setProgress(restartcounter / (double) restarttime);
restartbar.setTitle(String.format("Server restart in %f.2", restartcounter / 20f));
/*
* if (restartcounter % 20 == 0) System.out.println("Progress: " + restartbar.getProgress());
*/
restartcounter--;
}, 1, 1);
return true;

View file

@ -21,8 +21,6 @@ public class TestPrepare {
@Override
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))
return "test";
if (returns(invocation, Logger.class))

View file

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

View file

@ -47,7 +47,6 @@ public abstract class TBMCCommandBase {
.replace("command", "");
String path = getClass().getAnnotation(CommandClass.class).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
&& !cl.getPackage().getName().equals(TBMCCommandBase.class.getPackage().getName()); cl = cl
.getSuperclass()) { //
@ -61,9 +60,7 @@ public abstract class TBMCCommandBase {
newpath = getFromClass.apply(cl);
}
path = (prevpath = newpath) + " " + path;
// System.out.println("Path: " + (path.length() == 0 ? getFromClass.apply(cl) : path));
}
//System.out.println("Path: " + 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) {
if (playermap.containsKey(uuid + "-" + cl.getSimpleName()))
return (T) playermap.get(uuid + "-" + cl.getSimpleName());
// System.out.println("A");
try {
T player;
if (playermap.containsKey(uuid + "-" + TBMCPlayer.class.getSimpleName())) {
// System.out.println("B"); - Don't program when tired
player = cl.newInstance();
player.plugindata = playermap.get(uuid + "-" + TBMCPlayer.class.getSimpleName()).plugindata;
playermap.put(uuid + "-" + cl.getSimpleName(), player); // It will get removed on player quit
} else
player = ChromaGamerBase.getUser(uuid.toString(), cl);
// System.out.println("C");
player.uuid = uuid;
return player;
} catch (Exception e) {