Started research on plugin filepaths
This commit is contained in:
parent
1c1e308375
commit
3b937667de
4 changed files with 87 additions and 0 deletions
|
@ -7,6 +7,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import buttondevteam.presents.components.dictionary.DictionaryComponent;
|
import buttondevteam.presents.components.dictionary.DictionaryComponent;
|
||||||
import buttondevteam.presents.components.magic.MagicComponent;
|
import buttondevteam.presents.components.magic.MagicComponent;
|
||||||
|
import buttondevteam.presents.components.research.ResearchComponent;
|
||||||
import buttondevteam.presents.components.spawn.SpawnComponent;
|
import buttondevteam.presents.components.spawn.SpawnComponent;
|
||||||
|
|
||||||
public class Main extends JavaPlugin{
|
public class Main extends JavaPlugin{
|
||||||
|
@ -19,6 +20,7 @@ public class Main extends JavaPlugin{
|
||||||
new DictionaryComponent().register(this);
|
new DictionaryComponent().register(this);
|
||||||
new SpawnComponent().register(this);
|
new SpawnComponent().register(this);
|
||||||
new MagicComponent().register(this);
|
new MagicComponent().register(this);
|
||||||
|
new ResearchComponent().register(this);
|
||||||
|
|
||||||
logger.info(pdfFile.getName() + " has fully registered (V." + pdfFile.getVersion()+ ").");
|
logger.info(pdfFile.getName() + " has fully registered (V." + pdfFile.getVersion()+ ").");
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
package buttondevteam.presents.components.research;
|
||||||
|
|
||||||
|
import buttondevteam.presents.architecture.commands.ModCommand;
|
||||||
|
|
||||||
|
public abstract class Question extends ModCommand {
|
||||||
|
public abstract String question();
|
||||||
|
public abstract String answer();
|
||||||
|
protected String answer = "Undetermined";
|
||||||
|
|
||||||
|
}
|
|
@ -3,12 +3,14 @@ package buttondevteam.presents.components.research;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import buttondevteam.presents.architecture.Component;
|
import buttondevteam.presents.architecture.Component;
|
||||||
|
import buttondevteam.presents.components.research.questions.PluginFilePath;
|
||||||
|
|
||||||
public class ResearchComponent extends Component {
|
public class ResearchComponent extends Component {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void register(JavaPlugin plugin) {
|
public void register(JavaPlugin plugin) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
this.registerCommand(plugin, new PluginFilePath());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,73 @@
|
||||||
|
package buttondevteam.presents.components.research.questions;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import buttondevteam.lib.chat.CommandClass;
|
||||||
|
import buttondevteam.presents.components.research.Question;
|
||||||
|
|
||||||
|
@CommandClass(path="research pluginfilepath")
|
||||||
|
public class PluginFilePath extends Question {
|
||||||
|
@Override
|
||||||
|
public String question() {
|
||||||
|
return "What is the filepath for the plugin " + this.getPlugin().getName() + "?";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String answer() {
|
||||||
|
return this.answer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||||
|
player.sendMessage("[Q]:" + this.question());
|
||||||
|
|
||||||
|
player.sendMessage("---Plugin's Data Folder Information---");
|
||||||
|
File dataFolder = this.getPlugin().getDataFolder();
|
||||||
|
|
||||||
|
if (dataFolder.exists()){
|
||||||
|
player.sendMessage("Absolute path: ");
|
||||||
|
player.sendMessage(dataFolder.getAbsolutePath());
|
||||||
|
|
||||||
|
player.sendMessage("Canonical Path:");
|
||||||
|
try {
|
||||||
|
player.sendMessage(dataFolder.getCanonicalPath());
|
||||||
|
} catch (IOException e) {
|
||||||
|
player.sendMessage("I/O Exception!");
|
||||||
|
player.sendMessage(e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
|
||||||
|
}
|
||||||
|
}else{ //!dataFolder.exists()
|
||||||
|
player.sendMessage("Data Folder does not exist");
|
||||||
|
}
|
||||||
|
|
||||||
|
player.sendMessage("---Plugin's Config Information---");
|
||||||
|
FileConfiguration config = this.getPlugin().getConfig();
|
||||||
|
|
||||||
|
player.sendMessage("Name:");
|
||||||
|
player.sendMessage(config.getName());
|
||||||
|
|
||||||
|
player.sendMessage("Current Path:");
|
||||||
|
config.getCurrentPath();
|
||||||
|
|
||||||
|
player.sendMessage("Name of Root:");
|
||||||
|
player.sendMessage(config.getRoot().getName());
|
||||||
|
|
||||||
|
player.sendMessage("Path of Root:");
|
||||||
|
player.sendMessage(config.getRoot().getCurrentPath());
|
||||||
|
|
||||||
|
player.sendMessage("Keys of Root (Deep = true)");
|
||||||
|
player.sendMessage(config.getRoot().getKeys(true).toString());
|
||||||
|
|
||||||
|
player.sendMessage("[A]:" + this.answer());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue