Doing research on overflow crashes and stuff
This commit is contained in:
parent
16d647ddf6
commit
ac10e997c0
5 changed files with 138 additions and 31 deletions
|
@ -3,14 +3,20 @@ package buttondevteam.presents.components.research;
|
|||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import buttondevteam.presents.architecture.Component;
|
||||
import buttondevteam.presents.components.research.questions.PluginFilePath;
|
||||
import buttondevteam.presents.components.research.questions.OverflowCrash;
|
||||
import buttondevteam.presents.components.research.questions.OverwhelmCrash;
|
||||
import buttondevteam.presents.components.research.questions.PluginDataFolderInfo;
|
||||
import buttondevteam.presents.components.research.questions.PluginConfigInfo;
|
||||
|
||||
public class ResearchComponent extends Component {
|
||||
|
||||
@Override
|
||||
public void register(JavaPlugin plugin) {
|
||||
// TODO Auto-generated method stub
|
||||
this.registerCommand(plugin, new PluginFilePath());
|
||||
this.registerCommand(plugin, new PluginConfigInfo());
|
||||
this.registerCommand(plugin, new PluginDataFolderInfo());
|
||||
this.registerCommand(plugin, new OverwhelmCrash());
|
||||
this.registerCommand(plugin, new OverflowCrash());
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
package buttondevteam.presents.components.research.questions;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import buttondevteam.lib.chat.CommandClass;
|
||||
import buttondevteam.presents.components.research.Question;
|
||||
|
||||
@CommandClass(path="research crash overflow")
|
||||
public class OverflowCrash extends Question {
|
||||
|
||||
@Override
|
||||
public String question() {
|
||||
// TODO Auto-generated method stub
|
||||
return "Will sending a message over 7000 characters long, to a player, crash their game?";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String answer() {
|
||||
// TODO Auto-generated method stub
|
||||
return "No.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||
// TODO Auto-generated method stub
|
||||
player.sendMessage(question());
|
||||
String overflowMessage = "";
|
||||
for (int i = 0; i < 10; i++){
|
||||
overflowMessage += "Did you ever hear the tragedy of Darth Plagueis The Wise? I thought not. It’s not a story the Jedi would tell you. It’s a Sith legend. Darth Plagueis was a Dark Lord of the Sith, so powerful and so wise he could use the Force to influence the midichlorians to create life… He had such a knowledge of the dark side that he could even keep the ones he cared about from dying. The dark side of the Force is a pathway to many abilities some consider to be unnatural. He became so powerful… the only thing he was afraid of was losing his power, which eventually, of course, he did. Unfortunately, he taught his apprentice everything he knew, then his apprentice killed him in his sleep. Ironic. He could save others from death, but not himself.";
|
||||
}
|
||||
player.sendMessage(overflowMessage);
|
||||
player.sendMessage(answer());
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package buttondevteam.presents.components.research.questions;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import buttondevteam.lib.chat.CommandClass;
|
||||
import buttondevteam.presents.components.research.Question;
|
||||
|
||||
@CommandClass(path="research crash overwhelm")
|
||||
public class OverwhelmCrash extends Question {
|
||||
|
||||
@Override
|
||||
public String question() {
|
||||
// TODO Auto-generated method stub
|
||||
return "Will sending 100 short messages to a player instantly crash their game?";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String answer() {
|
||||
// TODO Auto-generated method stub
|
||||
return "No.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||
// TODO Auto-generated method stub
|
||||
player.sendMessage(question());
|
||||
for (int x = 0; x < 100; x++){
|
||||
player.sendMessage("Hello World Motherfucker!");
|
||||
}
|
||||
player.sendMessage(answer());
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package buttondevteam.presents.components.research.questions;
|
||||
|
||||
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 info pluginconfig")
|
||||
public class PluginConfigInfo 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]:" + question());
|
||||
|
||||
player.sendMessage("---Plugin's Config Information---");
|
||||
FileConfiguration config = this.getPlugin().getConfig();
|
||||
|
||||
player.sendMessage("Name:");
|
||||
player.sendMessage(" - " + config.getName());
|
||||
|
||||
player.sendMessage("Current Path:");
|
||||
player.sendMessage(" - " + 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;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -3,26 +3,26 @@ 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 {
|
||||
@CommandClass(path="research info datafolder")
|
||||
public class PluginDataFolderInfo extends Question {
|
||||
|
||||
@Override
|
||||
public String question() {
|
||||
return "What is the filepath for the plugin " + this.getPlugin().getName() + "?";
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String answer() {
|
||||
return this.answer;
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||
player.sendMessage("[Q]:" + this.question());
|
||||
|
@ -51,27 +51,8 @@ public class PluginFilePath extends Question {
|
|||
}
|
||||
}
|
||||
|
||||
player.sendMessage("---Plugin's Config Information---");
|
||||
FileConfiguration config = this.getPlugin().getConfig();
|
||||
|
||||
player.sendMessage("Name:");
|
||||
player.sendMessage(" - " + config.getName());
|
||||
|
||||
player.sendMessage("Current Path:");
|
||||
player.sendMessage(" - " + 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;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in a new issue