Cleaned some old stuff and did #47
This commit is contained in:
parent
a173cdefb2
commit
60d35d8eae
3 changed files with 15 additions and 31 deletions
5
pom.xml
5
pom.xml
|
@ -169,6 +169,11 @@
|
||||||
<artifactId>javassist</artifactId>
|
<artifactId>javassist</artifactId>
|
||||||
<version>3.20.0-GA</version>
|
<version>3.20.0-GA</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.TBMCPlugins</groupId>
|
||||||
|
<artifactId>DiscordPlugin</artifactId>
|
||||||
|
<version>master-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<artifactId>ButtonChat</artifactId>
|
<artifactId>ButtonChat</artifactId>
|
||||||
<organization>
|
<organization>
|
||||||
|
|
|
@ -64,39 +64,13 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
Instance = this;
|
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);
|
getServer().getPluginManager().registerEvents(new PlayerListener(), this);
|
||||||
CommandCaller.RegisterChatCommands(this);
|
CommandCaller.RegisterChatCommands(this);
|
||||||
Console = this.getServer().getConsoleSender();
|
Console = this.getServer().getConsoleSender();
|
||||||
LoadFiles(false);
|
LoadFiles(false);
|
||||||
|
|
||||||
SB = PluginMain.Instance.getServer().getScoreboardManager().getMainScoreboard(); // Main
|
SB = PluginMain.Instance.getServer().getScoreboardManager().getMainScoreboard(); // Main can be detected with @a[score_...]
|
||||||
// can
|
|
||||||
// be
|
|
||||||
// detected
|
|
||||||
// with
|
|
||||||
// @a[score_...]
|
|
||||||
if (SB.getObjective("town") == null)
|
if (SB.getObjective("town") == null)
|
||||||
SB.registerNewObjective("town", "dummy");
|
SB.registerNewObjective("town", "dummy");
|
||||||
if (SB.getObjective("nation") == null)
|
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
|
// Fired when plugin is disabled
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
SaveFiles(); // 2015.08.09.
|
SaveFiles();
|
||||||
stop = true;
|
stop = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ import org.reflections.util.ClasspathHelper;
|
||||||
import org.reflections.util.ConfigurationBuilder;
|
import org.reflections.util.ConfigurationBuilder;
|
||||||
|
|
||||||
import buttondevteam.chat.PluginMain;
|
import buttondevteam.chat.PluginMain;
|
||||||
|
import buttondevteam.discordplugin.TBMCDiscordAPI;
|
||||||
|
|
||||||
public class CommandCaller implements CommandExecutor {
|
public class CommandCaller implements CommandExecutor {
|
||||||
|
|
||||||
|
@ -94,9 +95,13 @@ public class CommandCaller implements CommandExecutor {
|
||||||
sender.sendMessage("§cOnly ingame players can use this command.");
|
sender.sendMessage("§cOnly ingame players can use this command.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
if (!cmd.OnCommand(sender, alias,
|
if (!cmd.OnCommand(sender, alias,
|
||||||
(args.length > 0 ? Arrays.copyOfRange(args, args.length - argc, args.length) : args)))
|
(args.length > 0 ? Arrays.copyOfRange(args, args.length - argc, args.length) : args)))
|
||||||
sender.sendMessage(cmd.GetHelpText(alias));
|
sender.sendMessage(cmd.GetHelpText(alias));
|
||||||
|
} catch (Exception e) {
|
||||||
|
TBMCDiscordAPI.SendException(e, "Failed to execute command " + cmd.GetCommandPath() + " with arguments ");
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue