2018-11-04 00:33:37 +01:00
|
|
|
package com.songoda.ultimatetimber;
|
2018-11-03 21:49:10 +01:00
|
|
|
|
2019-03-25 20:40:56 +01:00
|
|
|
import com.songoda.ultimatetimber.adapter.VersionAdapter;
|
|
|
|
import com.songoda.ultimatetimber.adapter.current.CurrentAdapter;
|
|
|
|
import com.songoda.ultimatetimber.adapter.legacy.LegacyAdapter;
|
2019-03-28 01:56:39 +01:00
|
|
|
import com.songoda.ultimatetimber.manager.*;
|
|
|
|
import com.songoda.ultimatetimber.utils.Methods;
|
2019-03-06 05:06:38 +01:00
|
|
|
import com.songoda.ultimatetimber.utils.Metrics;
|
2019-03-25 20:40:56 +01:00
|
|
|
import com.songoda.ultimatetimber.utils.NMSUtil;
|
2018-11-03 21:49:10 +01:00
|
|
|
import org.bukkit.Bukkit;
|
2018-11-05 23:41:25 +01:00
|
|
|
import org.bukkit.command.CommandSender;
|
2018-11-03 21:49:10 +01:00
|
|
|
import org.bukkit.plugin.java.JavaPlugin;
|
|
|
|
|
2018-11-04 00:33:37 +01:00
|
|
|
public class UltimateTimber extends JavaPlugin {
|
2019-03-25 20:40:56 +01:00
|
|
|
|
|
|
|
private static final CommandSender console = Bukkit.getConsoleSender();
|
2018-11-05 23:41:25 +01:00
|
|
|
private static UltimateTimber INSTANCE;
|
2019-03-06 05:31:14 +01:00
|
|
|
|
2019-03-28 01:56:39 +01:00
|
|
|
private VersionAdapter versionAdapter;
|
|
|
|
private ConfigurationManager configurationManager;
|
|
|
|
private DisabledWorldManager disabledWorldManager;
|
|
|
|
private HookManager hookManager;
|
|
|
|
private MessageManager messageManager;
|
|
|
|
private SettingsManager settingsManager;
|
|
|
|
private TreeAnimationManager treeAnimationManager;
|
|
|
|
private TreeDefinitionManager treeDefinitionManager;
|
|
|
|
private TreeFallManager treeFallManager;
|
2018-11-03 21:49:10 +01:00
|
|
|
|
2018-12-19 18:58:05 +01:00
|
|
|
public static UltimateTimber getInstance() {
|
|
|
|
return INSTANCE;
|
|
|
|
}
|
|
|
|
|
2018-11-03 21:49:10 +01:00
|
|
|
@Override
|
|
|
|
public void onEnable() {
|
2018-11-05 23:41:25 +01:00
|
|
|
INSTANCE = this;
|
2018-12-18 15:12:26 +01:00
|
|
|
|
2018-11-05 23:41:25 +01:00
|
|
|
console.sendMessage(Methods.formatText("&a============================="));
|
2019-02-06 07:38:37 +01:00
|
|
|
console.sendMessage(Methods.formatText("&7" + this.getDescription().getName() + " " + this.getDescription().getVersion() + " by &5Songoda <3&7!"));
|
2018-11-05 23:41:25 +01:00
|
|
|
console.sendMessage(Methods.formatText("&7Action: &aEnabling&7..."));
|
2019-03-25 20:40:56 +01:00
|
|
|
|
2019-03-28 01:56:39 +01:00
|
|
|
this.configurationManager = new ConfigurationManager(this);
|
|
|
|
this.disabledWorldManager = new DisabledWorldManager(this);
|
|
|
|
this.hookManager = new HookManager(this);
|
|
|
|
this.messageManager = new MessageManager(this);
|
|
|
|
this.settingsManager = new SettingsManager(this);
|
|
|
|
this.treeAnimationManager = new TreeAnimationManager(this);
|
|
|
|
this.treeDefinitionManager = new TreeDefinitionManager(this);
|
|
|
|
this.treeFallManager = new TreeFallManager(this);
|
|
|
|
|
|
|
|
this.setupVersionAdapter();
|
|
|
|
this.reload();
|
|
|
|
|
2019-03-06 05:06:38 +01:00
|
|
|
new Metrics(this);
|
|
|
|
|
2018-11-05 23:41:25 +01:00
|
|
|
console.sendMessage(Methods.formatText("&a============================="));
|
2018-11-03 21:49:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onDisable() {
|
2019-02-07 04:37:16 +01:00
|
|
|
console.sendMessage(Methods.formatText("&a============================="));
|
|
|
|
console.sendMessage(Methods.formatText("&7" + this.getDescription().getName() + " " + this.getDescription().getVersion() + " by &5Songoda <3&7!"));
|
|
|
|
console.sendMessage(Methods.formatText("&7Action: &cDisabling&7..."));
|
|
|
|
|
2019-03-28 01:56:39 +01:00
|
|
|
|
2019-02-07 04:37:16 +01:00
|
|
|
|
|
|
|
console.sendMessage(Methods.formatText("&a============================="));
|
|
|
|
}
|
2018-11-05 23:41:25 +01:00
|
|
|
|
2019-03-28 01:56:39 +01:00
|
|
|
/**
|
|
|
|
* Reloads the plugin's settings
|
|
|
|
*/
|
|
|
|
public void reload() {
|
2018-11-03 21:49:10 +01:00
|
|
|
|
2018-11-05 23:41:25 +01:00
|
|
|
}
|
2018-12-19 18:58:05 +01:00
|
|
|
|
2019-03-28 01:56:39 +01:00
|
|
|
/**
|
|
|
|
* Sets up the version adapter
|
|
|
|
*/
|
|
|
|
private void setupVersionAdapter() {
|
2019-03-25 20:40:56 +01:00
|
|
|
if (NMSUtil.getVersionNumber() > 12) {
|
2019-03-28 01:56:39 +01:00
|
|
|
this.versionAdapter = new CurrentAdapter();
|
2019-03-25 20:40:56 +01:00
|
|
|
} else {
|
2019-03-28 01:56:39 +01:00
|
|
|
this.versionAdapter = new LegacyAdapter();
|
2018-12-18 15:12:26 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-28 01:56:39 +01:00
|
|
|
public VersionAdapter getVersionAdapter() {
|
|
|
|
return this.versionAdapter;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the configuration manager
|
|
|
|
*
|
|
|
|
* @return The ConfigurationManager instance
|
|
|
|
*/
|
|
|
|
public ConfigurationManager getConfigurationManager() {
|
|
|
|
return configurationManager;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the disabled world manager
|
|
|
|
*
|
|
|
|
* @return The DisabledWorldManager instance
|
|
|
|
*/
|
|
|
|
public DisabledWorldManager getDisabledWorldManager() {
|
|
|
|
return disabledWorldManager;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the hook manager
|
|
|
|
*
|
|
|
|
* @return The HookManager instance
|
|
|
|
*/
|
|
|
|
public HookManager getHookManager() {
|
|
|
|
return hookManager;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the configuration manager
|
|
|
|
*
|
|
|
|
* @return The ConfigurationManager instance
|
|
|
|
*/
|
|
|
|
public MessageManager getMessageManager() {
|
|
|
|
return messageManager;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the settings manager
|
|
|
|
*
|
|
|
|
* @return The SettingsManager instance
|
|
|
|
*/
|
|
|
|
public SettingsManager getSettingsManager() {
|
|
|
|
return settingsManager;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the tree animation manager
|
|
|
|
*
|
|
|
|
* @return The TreeAnimationManager instance
|
|
|
|
*/
|
|
|
|
public TreeAnimationManager getTreeAnimationManager() {
|
|
|
|
return treeAnimationManager;
|
2019-02-06 07:38:37 +01:00
|
|
|
}
|
|
|
|
|
2019-03-28 01:56:39 +01:00
|
|
|
/**
|
|
|
|
* Gets the tree definition manager
|
|
|
|
*
|
|
|
|
* @return The TreeDefinitionManager instance
|
|
|
|
*/
|
|
|
|
public TreeDefinitionManager getTreeDefinitionManager() {
|
|
|
|
return treeDefinitionManager;
|
2019-02-06 07:38:37 +01:00
|
|
|
}
|
|
|
|
|
2019-03-28 01:56:39 +01:00
|
|
|
/**
|
|
|
|
* Gets the tree fall manager
|
|
|
|
*
|
|
|
|
* @return The TreeFallManager instance
|
|
|
|
*/
|
|
|
|
public TreeFallManager getTreeFallManager() {
|
|
|
|
return treeFallManager;
|
2019-03-25 20:40:56 +01:00
|
|
|
}
|
|
|
|
|
2018-11-03 21:49:10 +01:00
|
|
|
}
|