Cleaned some old stuff and did #47

This commit is contained in:
Norbi Peti 2016-10-04 22:12:24 +02:00
parent a173cdefb2
commit 60d35d8eae
3 changed files with 15 additions and 31 deletions

View file

@ -169,6 +169,11 @@
<artifactId>javassist</artifactId>
<version>3.20.0-GA</version>
</dependency>
<dependency>
<groupId>com.github.TBMCPlugins</groupId>
<artifactId>DiscordPlugin</artifactId>
<version>master-SNAPSHOT</version>
</dependency>
</dependencies>
<artifactId>ButtonChat</artifactId>
<organization>

View file

@ -64,39 +64,13 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
@Override
public void onEnable() {
Instance = this;
/*try {
PluginMain.Instance.getLogger().info("Extracting necessary libraries...");
final File[] libs = new File[] { new File(getDataFolder(), "htmlcleaner-2.16.jar"),
new File(getDataFolder(), "reflections-0.9.10.jar"),
new File(getDataFolder(), "javassist-3.19.0-GA.jar") };
for (final File lib : libs) {
if (!lib.exists()) {
JarUtils.extractFromJar(lib.getName(), lib.getAbsolutePath());
}
}
for (final File lib : libs) {
if (!lib.exists()) {
getLogger().warning("Failed to load plugin! Could not find lib: " + lib.getName());
Bukkit.getServer().getPluginManager().disablePlugin(this);
return;
}
addClassPath(JarUtils.getJarUrl(lib));
}
} catch (final Exception e) {
e.printStackTrace();
}*/
getServer().getPluginManager().registerEvents(new PlayerListener(), this);
CommandCaller.RegisterChatCommands(this);
Console = this.getServer().getConsoleSender();
LoadFiles(false);
SB = PluginMain.Instance.getServer().getScoreboardManager().getMainScoreboard(); // Main
// can
// be
// detected
// with
// @a[score_...]
SB = PluginMain.Instance.getServer().getScoreboardManager().getMainScoreboard(); // Main can be detected with @a[score_...]
if (SB.getObjective("town") == null)
SB.registerNewObjective("town", "dummy");
if (SB.getObjective("nation") == null)
@ -134,7 +108,7 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
// Fired when plugin is disabled
@Override
public void onDisable() {
SaveFiles(); // 2015.08.09.
SaveFiles();
stop = true;
}

View file

@ -19,6 +19,7 @@ import org.reflections.util.ClasspathHelper;
import org.reflections.util.ConfigurationBuilder;
import buttondevteam.chat.PluginMain;
import buttondevteam.discordplugin.TBMCDiscordAPI;
public class CommandCaller implements CommandExecutor {
@ -94,9 +95,13 @@ public class CommandCaller implements CommandExecutor {
sender.sendMessage("§cOnly ingame players can use this command.");
return true;
}
if (!cmd.OnCommand(sender, alias,
(args.length > 0 ? Arrays.copyOfRange(args, args.length - argc, args.length) : args)))
sender.sendMessage(cmd.GetHelpText(alias));
try {
if (!cmd.OnCommand(sender, alias,
(args.length > 0 ? Arrays.copyOfRange(args, args.length - argc, args.length) : args)))
sender.sendMessage(cmd.GetHelpText(alias));
} catch (Exception e) {
TBMCDiscordAPI.SendException(e, "Failed to execute command " + cmd.GetCommandPath() + " with arguments ");
}
return true;
}