Changed every command to the new system

Started on feb 16
This commit is contained in:
Norbi Peti 2020-03-07 18:46:10 +01:00
parent eb894dc79f
commit c49ab63e25
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56
37 changed files with 332 additions and 645 deletions

26
.gitignore vendored
View file

@ -1,13 +1,15 @@
*.class *.class
# Mobile Tools for Java (J2ME) # Mobile Tools for Java (J2ME)
.mtj.tmp/ .mtj.tmp/
# Package Files # # Package Files #
*.jar *.jar
*.war *.war
*.ear *.ear
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid* hs_err_pid*
/target/ /target/
.idea

2
.idea/.gitignore vendored
View file

@ -1,2 +0,0 @@
# Default ignored files
/workspace.xml

View file

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.5" level="project" />
<orderEntry type="library" name="Maven: org.spigotmc:spigot:1.12.2-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: com.github.TBMCPlugins.ButtonCore:ButtonCore:master-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: com.github.tbmcplugins:ButtonWebsiteModule:master-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: com.massivecraft:Factions:3.2.2" level="project" />
<orderEntry type="library" name="Maven: com.massivecraft:MassiveCore:3.2.2" level="project" />
<orderEntry type="library" name="Maven: com.github.TBMCPlugins.ButtonCore:Towny:master-317b5a3bda-1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:3.8.1" level="project" />
</component>
</module>

View file

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="ButtonPresents" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel>
<module name="ButtonPresents" target="1.8" />
</bytecodeTargetLevel>
</component>
</project>

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$" charset="UTF-8" />
</component>
</project>

View file

@ -1,11 +0,0 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="WeakerAccess" enabled="true" level="WARNING" enabled_by_default="true">
<option name="SUGGEST_PACKAGE_LOCAL_FOR_MEMBERS" value="false" />
<option name="SUGGEST_PACKAGE_LOCAL_FOR_TOP_CLASSES" value="false" />
<option name="SUGGEST_PRIVATE_FOR_INNERS" value="false" />
<disabledExtension id="moduleInfo" />
</inspection_tool>
</profile>
</component>

View file

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<list size="1">
<item index="0" class="java.lang.String" itemvalue="org.bukkit.event.EventHandler" />
</list>
</component>
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
</project>

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/ButtonPresents.iml" filepath="$PROJECT_DIR$/.idea/ButtonPresents.iml" />
</modules>
</component>
</project>

View file

@ -1,124 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View file

@ -71,8 +71,8 @@
<version>1.12.2-R0.1-SNAPSHOT</version> <version>1.12.2-R0.1-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.github.TBMCPlugins.ButtonCore</groupId> <groupId>com.github.TBMCPlugins.ChromaCore</groupId>
<artifactId>ButtonCore</artifactId> <artifactId>Chroma-Core</artifactId>
<version>master-SNAPSHOT</version> <version>master-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
@ -91,9 +91,10 @@
<version>3.2.2</version> <version>3.2.2</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.github.TBMCPlugins.ButtonCore</groupId> <groupId>com.palmergames.bukkit.towny</groupId>
<artifactId>Towny</artifactId> <artifactId>Towny</artifactId>
<version>master-SNAPSHOT</version> <version>0.95.2.0</version>
<scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>

View file

@ -1,24 +0,0 @@
package buttondevteam.presents.architecture.commands;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.lib.chat.TBMCCommandBase;
@CommandClass(excludeFromPath=true)
public abstract class BaseCommand extends TBMCCommandBase implements CommandExecutor{
/**replaces CommandExecutor functionality**/
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
return OnCommand(sender, label, args);
}
@Override
public String[] GetHelpText(String alias){
return new String[] {
"This command doesn't have help text ask a dev to write one",
"If you're a dev, write the help text you lazy bastard. -Ali"
};
}
}

View file

@ -1,15 +0,0 @@
package buttondevteam.presents.architecture.commands;
import buttondevteam.lib.chat.CommandClass;
@CommandClass(modOnly = true, excludeFromPath=true)
public abstract class ModCommand extends PlayerCommand{
@Override
public String[] GetHelpText(String alias){
return new String[] {
"This command doesn't have help text, ask a dev to add one",
"If you're a dev, write the help text you lazy bastard. -Ali"
};
}
}

View file

@ -1,23 +0,0 @@
package buttondevteam.presents.architecture.commands;
import org.bukkit.entity.Player;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.lib.chat.PlayerCommandBase;
@CommandClass(modOnly = false, excludeFromPath=true)
public abstract class PlayerCommand extends PlayerCommandBase{
public abstract boolean OnCommand(Player player, String alias, String[] args);
@Override
public String[] GetHelpText(String alias){
return new String[] {
"This command doesn't have help text. ",
"If you're a player, ask a mod to write one",
"If you're a mod, ask a dev to write one",
"If you're a dev, write the help text you lazy bastard. -Ali"
};
}
}

View file

@ -1,16 +1,13 @@
package buttondevteam.presents.architecture.commands; package buttondevteam.presents.architecture.commands;
import buttondevteam.lib.chat.CommandClass; import buttondevteam.lib.chat.CommandClass;
import buttondevteam.lib.chat.ICommand2MC;
@CommandClass(modOnly = false, excludeFromPath=true) @CommandClass(modOnly = false, excludeFromPath = true, helpText = {
public abstract class UniversalCommand extends BaseCommand{ "This command doesn't have help text. ",
@Override "If you're a player, ask a mod to write one",
public String[] GetHelpText(String alias){ "If you're a mod, ask a dev to write one",
return new String[] { "If you're a dev, write the help text you lazy bastard. -Ali"
"This command doesn't have help text. ", })
"If you're a player, ask a mod to write one", public abstract class UniversalCommand extends ICommand2MC {
"If you're a mod, ask a dev to write one",
"If you're a dev, write the help text you lazy bastard. -Ali"
};
}
} }

View file

@ -2,6 +2,7 @@ package buttondevteam.presents.components.chunkarchive;
import buttondevteam.lib.TBMCCoreAPI; import buttondevteam.lib.TBMCCoreAPI;
import buttondevteam.lib.architecture.Component; import buttondevteam.lib.architecture.Component;
import buttondevteam.lib.architecture.ComponentMetadata;
import buttondevteam.presents.ButtonPresents; import buttondevteam.presents.ButtonPresents;
import net.minecraft.server.v1_12_R1.ChunkRegionLoader; import net.minecraft.server.v1_12_R1.ChunkRegionLoader;
import net.minecraft.server.v1_12_R1.ExceptionWorldConflict; import net.minecraft.server.v1_12_R1.ExceptionWorldConflict;
@ -18,6 +19,7 @@ import java.io.IOException;
import java.util.logging.Logger; import java.util.logging.Logger;
// @formatter:off // @formatter:off
@ComponentMetadata(enabledByDefault = false)
public class ChunkArchiveComponent extends Component<ButtonPresents> implements Listener { public class ChunkArchiveComponent extends Component<ButtonPresents> implements Listener {
private final File dataFolder = new File("plugins", "ChunkArchive"); private final File dataFolder = new File("plugins", "ChunkArchive");
@Override @Override

View file

@ -1,32 +1,31 @@
package buttondevteam.presents.components.dungeon; package buttondevteam.presents.components.dungeon;
import buttondevteam.lib.chat.Command2;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.presents.architecture.commands.UniversalCommand;
import buttondevteam.presents.components.dungeon.DungeonConfig.SETTING;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import buttondevteam.lib.chat.CommandClass; @CommandClass(path = "dungeon create", modOnly = true, helpText = {
import buttondevteam.presents.architecture.commands.ModCommand; "instantiates a new dungeon, setting the dungeon spawn to the player location"
import buttondevteam.presents.components.dungeon.DungeonConfig.SETTING; })
public class DungeonCreate extends UniversalCommand {
@CommandClass(path="dungeon create") @Command2.Subcommand
public class DungeonCreate extends ModCommand{ public boolean def(Player player, String dungeonName) {
@Override
public boolean OnCommand(Player player, String alias, String[] args) {
//Creates a new dungeon //Creates a new dungeon
if(args.length < 1) return false;
String dungeonName = args[0];
FileConfiguration plugin_config = this.getPlugin().getConfig(); FileConfiguration plugin_config = this.getPlugin().getConfig();
if (plugin_config.contains("dungeons." + dungeonName)){ if (plugin_config.contains("dungeons." + dungeonName)) {
player.sendMessage("There already exists a dungeon named " + dungeonName); player.sendMessage("There already exists a dungeon named " + dungeonName);
player.sendMessage("Type /dungeon info [dungeonname] to get more information"); player.sendMessage("Type /dungeon info [dungeonname] to get more information");
return true; return true;
} }
DungeonConfig config = new DungeonConfig(plugin_config); DungeonConfig config = new DungeonConfig(plugin_config);
config.set(SETTING.NAME, true); config.set(SETTING.NAME, true);
config.set(SETTING.OWNER, player.getName()); config.set(SETTING.OWNER, player.getName());
config.set(SETTING.SPAWN, player.getLocation().toString()); config.set(SETTING.SPAWN, player.getLocation().toString());
@ -42,13 +41,4 @@ public class DungeonCreate extends ModCommand{
} }
return true; return true;
} }
@Override
public String[] GetHelpText(String alias){
return new String[] {
"/dungeon create [dungeonName]",
"instantiates a new dungeon, setting the dungeon spawn to the player location"
};
}
} }

View file

@ -1,32 +1,29 @@
package buttondevteam.presents.components.dungeon; package buttondevteam.presents.components.dungeon;
import buttondevteam.lib.chat.Command2;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.presents.architecture.commands.UniversalCommand;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import buttondevteam.lib.chat.CommandClass; @CommandClass(path = "dungeon delete")
import buttondevteam.presents.architecture.commands.ModCommand; public class DungeonDelete extends UniversalCommand {
@CommandClass(path="dungeon delete") @Command2.Subcommand
public class DungeonDelete extends ModCommand{ public boolean def(Player player, String dungeonName) {
@Override
public boolean OnCommand(Player player, String alias, String[] args) {
if (args.length < 1) return false;
String dungeonName = args[0];
FileConfiguration config = this.getPlugin().getConfig(); FileConfiguration config = this.getPlugin().getConfig();
if(!config.contains("dungeon." + dungeonName)){ if (!config.contains("dungeon." + dungeonName)) {
player.sendMessage("This dungeon does not exist!"); player.sendMessage("This dungeon does not exist!");
String output = "Valid dungeons are:"; String output = "Valid dungeons are:";
for(String key : config.getConfigurationSection("dungeon").getKeys(false)){ for (String key : config.getConfigurationSection("dungeon").getKeys(false)) {
output += key; output += key;
output += ", "; output += ", ";
} }
player.sendMessage(output); player.sendMessage(output);
}else{ } else {
for(String key : config.getConfigurationSection("dungeon." + dungeonName).getKeys(true)){ for (String key : config.getConfigurationSection("dungeon." + dungeonName).getKeys(true)) {
config.set("dungeon." + dungeonName + "." + key, null); config.set("dungeon." + dungeonName + "." + key, null);
} }
player.sendMessage("Dungeon " + dungeonName + " deleted."); player.sendMessage("Dungeon " + dungeonName + " deleted.");
@ -35,5 +32,4 @@ public class DungeonDelete extends ModCommand{
return true; return true;
} }
} }

View file

@ -1,61 +1,59 @@
package buttondevteam.presents.components.magic.tricks; package buttondevteam.presents.components.magic.tricks;
import org.bukkit.entity.Player; import buttondevteam.lib.chat.Command2;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.presents.architecture.commands.ModCommand; import buttondevteam.presents.architecture.commands.UniversalCommand;
import org.bukkit.entity.Player;
//HEHEHHEHEH EAASSSTER EGGS
public class BoomBowRule extends ModCommand{ //HEHEHHEHEH EAASSSTER EGGS
public static boolean boomDecay; @CommandClass(helpText = {
public static boolean healthReduction; "Rule settings: boomDecay, healthReduction, endCrystal, localized"
public static boolean endCrystal; })
public static boolean localized;; public class BoomBowRule extends UniversalCommand {
@Override public static boolean boomDecay;
public boolean OnCommand(Player player, String label, String[] args) { public static boolean healthReduction;
if (player.getName().equals("alisolarflare") == false){ public static boolean endCrystal;
player.sendMessage("You must be alisolarflare to use this command"); public static boolean localized;
return false;
} @Command2.Subcommand
if (args.length < 2){ public boolean def(Player player, @Command2.OptionalArg String name, @Command2.OptionalArg Boolean value) {
player.sendMessage("Rules:"); if (!player.getName().equals("alisolarflare")) {
player.sendMessage("boomDecay" + boomDecay); player.sendMessage("You must be alisolarflare to use this command");
player.sendMessage("healthReduction" + healthReduction); return false;
player.sendMessage("endCrystal" + endCrystal); }
player.sendMessage("localized" + localized); if (name == null || value == null) {
return false; player.sendMessage("Rules:");
} player.sendMessage("boomDecay" + boomDecay);
if(!(args[1].startsWith("t")|| args[1].startsWith("f"))){ player.sendMessage("healthReduction" + healthReduction);
return false; player.sendMessage("endCrystal" + endCrystal);
} player.sendMessage("localized" + localized);
boolean gameRule = false; return false;
if(args[1].startsWith("t") || args[1].startsWith("T")){ }
gameRule = true; /*if(!(args[1].startsWith("t")|| args[1].startsWith("f"))){
} return false;
switch(args[0]){ }
case "boomDecay": boolean gameRule = false;
boomDecay = gameRule; if(args[1].startsWith("t") || args[1].startsWith("T")){
break; gameRule = true;
case "healthReduction": }*/
healthReduction = gameRule; switch (name) {
break; case "boomDecay":
case "endCrystal": boomDecay = value;
endCrystal = gameRule; break;
break; case "healthReduction":
case "localized": healthReduction = value;
localized = gameRule; break;
break; case "endCrystal":
default: endCrystal = value;
player.sendMessage("Error: "+args[0]+" not defined as a rule"); break;
return false; case "localized":
} localized = value;
break;
return true; default:
} player.sendMessage("Error: " + name + " not defined as a rule");
@Override return false;
public String[] GetHelpText(String alias) { }
return new String[]{
"Usage: /boomBowRule [rulename] [true/false]", return true;
"Rule settings: boomDecay, healthReduction, endCrystal, localized" }
}; }
}
}

View file

@ -1,50 +1,51 @@
package buttondevteam.presents.components.magic.tricks; package buttondevteam.presents.components.magic.tricks;
import buttondevteam.lib.chat.Command2;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.presents.architecture.commands.UniversalCommand;
import org.apache.commons.lang3.math.NumberUtils; import org.apache.commons.lang3.math.NumberUtils;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import buttondevteam.lib.chat.CommandClass; @CommandClass(path = "magic cannonbow settings")
import buttondevteam.presents.architecture.commands.ModCommand; public class CannonBowSettings extends UniversalCommand {
@CommandClass(path="magic cannonbow settings") @Command2.Subcommand
public class CannonBowSettings extends ModCommand { public boolean def(Player player, String setting, @Command2.OptionalArg String value) {
if (value != null || setting.equalsIgnoreCase("display")) {
@Override switch (setting.toLowerCase()) {
public boolean OnCommand(Player player, String alias, String[] args) { case "force":
if (args.length > 1 && args[0] == "display"){ case "speedmultiplier":
switch(args[0].toLowerCase()){ CannonBowListener.setSpeedMultiplier(NumberUtils.toDouble(value, CannonBowListener.getSpeedMultiplier()));
case "force": break;
case "speedmultiplier": case "minimumforce":
CannonBowListener.setSpeedMultiplier(NumberUtils.toDouble(args[1], CannonBowListener.getSpeedMultiplier())); case "minforce":
break; case "minimumdraw":
case "minimumforce": case "mindraw":
case "minforce": CannonBowListener.setMinforce(NumberUtils.toDouble(value, CannonBowListener.getMinforce()));
case "minimumdraw": break;
case "mindraw": case "fuse":
CannonBowListener.setMinforce(NumberUtils.toDouble(args[1], CannonBowListener.getMinforce())); case "fusetick":
break; case "fuseticks":
case "fuse": CannonBowListener.setFuseticks(NumberUtils.toInt(value, CannonBowListener.getFuseticks()));
case "fusetick": break;
case "fuseticks": case "recoil":
CannonBowListener.setFuseticks(NumberUtils.toInt(args[1], CannonBowListener.getFuseticks())); CannonBowListener.setRecoil(NumberUtils.toDouble((value), CannonBowListener.getRecoil()));
break; break;
case "recoil": case "isDestructive":
CannonBowListener.setRecoil(NumberUtils.toDouble((args[1]), CannonBowListener.getRecoil())); CannonBowListener.setIsDestructive(value);
break; break;
case "isDestructive": case "display":
CannonBowListener.setIsDestructive(args[1]); player.sendMessage("Speed Multiplier: " + CannonBowListener.getSpeedMultiplier());
case "display": player.sendMessage("Minimum Force: " + CannonBowListener.getMinforce());
player.sendMessage("Speed Multiplier: "+CannonBowListener.getSpeedMultiplier()); player.sendMessage("Fuseticks: " + CannonBowListener.getFuseticks());
player.sendMessage("Minimum Force: "+CannonBowListener.getMinforce()); player.sendMessage("Recoil: " + CannonBowListener.getRecoil());
player.sendMessage("Fuseticks: " + CannonBowListener.getFuseticks()); player.sendMessage("isDestructive: " + CannonBowListener.getIsDestructive());
player.sendMessage("Recoil: " + CannonBowListener.getRecoil()); break;
player.sendMessage("isDestructive: " + CannonBowListener.getIsDestructive()); default:
break; player.sendMessage("That isn't a valid setting!");
default: player.sendMessage("Valid Settings are: speedmultiplier, minforce, fuseticks, recoil");
player.sendMessage("That isn't a valid setting!"); player.sendMessage("Use argument 'display' to disply current settings");
player.sendMessage("Valid Settings are: speedmultiplier, minforce, fuseticks, recoil"); return false;
player.sendMessage("Use argument 'display' to disply current settings");
return false;
} }
} }
return true; return true;

View file

@ -1,10 +1,11 @@
package buttondevteam.presents.components.research; package buttondevteam.presents.components.research;
import buttondevteam.presents.architecture.commands.ModCommand; import buttondevteam.presents.architecture.commands.UniversalCommand;
public abstract class Question extends ModCommand { public abstract class Question extends UniversalCommand {
public abstract String question(); public abstract String question();
public abstract String answer();
protected String answer = "Undetermined";
public abstract String answer();
protected String answer = "Undetermined";
} }

View file

@ -1,29 +1,29 @@
package buttondevteam.presents.components.research.dictionary.commands; package buttondevteam.presents.components.research.dictionary.commands;
import org.bukkit.entity.Player; import buttondevteam.lib.chat.Command2;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.presents.architecture.commands.UniversalCommand;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import org.bukkit.entity.Player;
import buttondevteam.lib.chat.CommandClass; @CommandClass(modOnly = true, path = "dictionary json")
import buttondevteam.presents.architecture.commands.ModCommand; public class SendJSON extends UniversalCommand {
@CommandClass(modOnly = true, path="dictionary json") @Command2.Subcommand
public class SendJSON extends ModCommand{ public boolean def(Player player) {
GsonBuilder builder = new GsonBuilder();
Gson gson = builder.create();
@Override
public boolean OnCommand(Player player, String alias, String[] args) {
GsonBuilder builder = new GsonBuilder();
Gson gson = builder.create();
player.sendMessage(gson.toJson(new output())); player.sendMessage(gson.toJson(new output()));
return true; return true;
} }
class output{
class output {
String ali = "pls"; String ali = "pls";
String iie = "whaddap"; String iie = "whaddap";
String norbipeti = "¯\\_(ツ)_/¯"; String norbipeti = "¯\\_(ツ)_/¯";
} }
} }

View file

@ -1,15 +1,15 @@
package buttondevteam.presents.components.research.dictionary.commands; package buttondevteam.presents.components.research.dictionary.commands;
import org.bukkit.command.CommandSender; import buttondevteam.lib.chat.Command2;
import buttondevteam.lib.chat.CommandClass; import buttondevteam.lib.chat.CommandClass;
import buttondevteam.presents.architecture.commands.UniversalCommand; import buttondevteam.presents.architecture.commands.UniversalCommand;
import org.bukkit.command.CommandSender;
@CommandClass(modOnly = false, path="dictionary command") @CommandClass(modOnly = false, path = "dictionary command")
public class SendMessage extends UniversalCommand { public class SendMessage extends UniversalCommand {
@Override @Command2.Subcommand
public boolean OnCommand(CommandSender sender, String alias, String[] args) { public boolean def(CommandSender sender) {
sender.sendMessage("Hello World!"); sender.sendMessage("Hello World!");
return true; return true;
} }

View file

@ -1,24 +1,23 @@
package buttondevteam.presents.components.research.dictionary.config; package buttondevteam.presents.components.research.dictionary.config;
import buttondevteam.lib.chat.Command2;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.presents.architecture.commands.UniversalCommand;
import org.bukkit.entity.Player;
import java.util.List; import java.util.List;
import org.bukkit.entity.Player; @CommandClass(modOnly = true, path = "dictionary load")
public class LoadConfig extends UniversalCommand {
import buttondevteam.lib.chat.CommandClass; @Command2.Subcommand
import buttondevteam.presents.architecture.commands.ModCommand; public boolean OnCommand(Player player, @Command2.OptionalArg String debug) {
if (debug != null && debug.toLowerCase().contains("debug")) {
@CommandClass(modOnly=true, path = "dictionary load")
public class LoadConfig extends ModCommand {
@Override
public boolean OnCommand(Player player, String alias, String[] args) {
if (args.length > 1 && args[0].toLowerCase().contains("debug")){
player.sendMessage("Data Type: " + this.getPlugin().getConfig().get("hellosave").getClass().toString()); player.sendMessage("Data Type: " + this.getPlugin().getConfig().get("hellosave").getClass().toString());
} }
List<String> mylist = this.getPlugin().getConfig().getStringList("hellosave"); List<String> mylist = this.getPlugin().getConfig().getStringList("hellosave");
for(String string : mylist){ for (String string : mylist) {
player.sendMessage(string); player.sendMessage(string);
} }
return true; return true;

View file

@ -1,24 +1,24 @@
package buttondevteam.presents.components.research.dictionary.config; package buttondevteam.presents.components.research.dictionary.config;
import buttondevteam.lib.chat.Command2;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.presents.architecture.commands.UniversalCommand;
import org.bukkit.command.CommandSender;
import java.util.Arrays; import java.util.Arrays;
import org.bukkit.command.CommandSender;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.presents.architecture.commands.UniversalCommand;
@CommandClass(path = "dictionary save") @CommandClass(path = "dictionary save")
public class SaveConfig extends UniversalCommand { public class SaveConfig extends UniversalCommand {
@Override @Command2.Subcommand
public boolean OnCommand(CommandSender sender, String alias, String[] args) { public boolean def(CommandSender sender, String... message) {
if (args.length < 1){ if (message.length < 1) {
sender.sendMessage("Can't save an empty string, Type /hellosave <message>"); sender.sendMessage("Can't save an empty string, Type /hellosave <message>");
}else{ } else {
try{ try {
this.getPlugin().getConfig().set("hellosave", Arrays.asList(args)); this.getPlugin().getConfig().set("hellosave", Arrays.asList(message));
this.getPlugin().saveConfig(); this.getPlugin().saveConfig();
sender.sendMessage("Message saved!"); sender.sendMessage("Message saved!");
}catch (Exception e){ } catch (Exception e) {
sender.sendMessage("Error when saving message:"); sender.sendMessage("Error when saving message:");
sender.sendMessage(e.toString()); sender.sendMessage(e.toString());
} }

View file

@ -1,31 +1,32 @@
package buttondevteam.presents.components.research.dictionary.config; package buttondevteam.presents.components.research.dictionary.config;
import buttondevteam.lib.chat.Command2;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.presents.architecture.commands.UniversalCommand;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.presents.architecture.commands.UniversalCommand;
@CommandClass(path = "dictionary time") @CommandClass(path = "dictionary time")
public class TimePersistence extends UniversalCommand { public class TimePersistence extends UniversalCommand {
final String path = "hellotime.lastincident"; final String path = "hellotime.lastincident";
@Override @Command2.Subcommand
public boolean OnCommand(CommandSender sender, String alias, String[] args) { public boolean def(CommandSender sender) {
FileConfiguration config = this.getPlugin().getConfig(); FileConfiguration config = this.getPlugin().getConfig();
if(config.contains(path) && config.isLong(path)){ if (config.contains(path) && config.isLong(path)) {
sender.sendMessage("Last Time Incident: " + MillisToString(config.getLong(path))); sender.sendMessage("Last Time Incident: " + MillisToString(config.getLong(path)));
}else{ } else {
sender.sendMessage("Time Incident Occoured!"); sender.sendMessage("Time Incident Occoured!");
sender.sendMessage("Setting..."); sender.sendMessage("Setting...");
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
config.set(path, time); config.set(path, time);
sender.sendMessage("Time set to" + MillisToString(time)); sender.sendMessage("Time set to" + MillisToString(time));
} }
return true; return true;

View file

@ -1,46 +1,25 @@
package buttondevteam.presents.components.research.dictionary.spawning; package buttondevteam.presents.components.research.dictionary.spawning;
import buttondevteam.lib.chat.Command2;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.presents.architecture.commands.UniversalCommand;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.presents.architecture.commands.PlayerCommand;
@CommandClass(path = "dictionary sound") @CommandClass(path = "dictionary sound")
public class PlaySound extends PlayerCommand{ public class PlaySound extends UniversalCommand {
@Command2.Subcommand
public boolean def(Player player, int volume, int pitch) {
@Override
public boolean OnCommand(Player player, String alias, String[] args) {
int volume = 0;
int pitch = 0;
//parse arguments
if (args.length >= 2){
try{
volume = Integer.parseInt(args[0]);
pitch = Integer.parseInt(args[1]);
}catch(NumberFormatException e){
volume = pitch = 0;
player.sendMessage("Incorrect input:");
player.sendMessage(args[0] + " must be an int.");
player.sendMessage(args[1] + " must be an int.");
}catch(Exception e){
player.sendMessage("Incorrect Input");
player.sendMessage(e.toString());
}
}
player.playSound( player.playSound(
player.getLocation(), player.getLocation(),
Sound.ENTITY_BLAZE_DEATH, Sound.ENTITY_BLAZE_DEATH,
volume, //Volume volume, //Volume
pitch); //Pitch pitch); //Pitch
return true; return true;
} }
} }

View file

@ -1,21 +1,21 @@
package buttondevteam.presents.components.research.dictionary.spawning; package buttondevteam.presents.components.research.dictionary.spawning;
import buttondevteam.lib.chat.Command2;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.presents.architecture.commands.UniversalCommand;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import buttondevteam.lib.chat.CommandClass; @CommandClass(path = "dictionary block", modOnly = true)
import buttondevteam.presents.architecture.commands.PlayerCommand; public class SetBlock extends UniversalCommand {
@CommandClass(path = "dictionary block", modOnly=true) @Command2.Subcommand
public class SetBlock extends PlayerCommand { public boolean def(Player player) {
@Override
public boolean OnCommand(Player player, String alias, String[] args) {
Block blockAtPlayer = player.getWorld().getBlockAt(player.getLocation()); Block blockAtPlayer = player.getWorld().getBlockAt(player.getLocation());
blockAtPlayer.setType(Material.CAKE_BLOCK); blockAtPlayer.setType(Material.CAKE_BLOCK);
return true; return true;
} }

View file

@ -1,19 +1,20 @@
package buttondevteam.presents.components.research.dictionary.spawning; package buttondevteam.presents.components.research.dictionary.spawning;
import buttondevteam.lib.chat.Command2;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.presents.architecture.commands.UniversalCommand;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import buttondevteam.lib.chat.CommandClass; @CommandClass(path = "dictionary cow", modOnly = true)
import buttondevteam.presents.architecture.commands.PlayerCommand; public class SpawnCow extends UniversalCommand {
@CommandClass(path = "dictionary cow", modOnly=true)
public class SpawnCow extends PlayerCommand {
@Override @Command2.Subcommand
public boolean OnCommand(Player player, String alias, String[] args) { public boolean def(Player player) {
player.getWorld().spawnEntity( player.getWorld().spawnEntity(
player.getLocation(), player.getLocation(),
EntityType.COW EntityType.COW
); );
return true; return true;
} }
} }

View file

@ -1,22 +1,19 @@
package buttondevteam.presents.components.research.dictionary.spawning; package buttondevteam.presents.components.research.dictionary.spawning;
import buttondevteam.lib.chat.Command2;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.presents.architecture.commands.UniversalCommand;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import buttondevteam.lib.chat.CommandClass; @CommandClass(path = "dictionary item", modOnly = true)
import buttondevteam.presents.architecture.commands.ModCommand; public class SpawnItem extends UniversalCommand {
@CommandClass(path = "dictionary item", modOnly=true) @Command2.Subcommand
public class SpawnItem extends ModCommand { public boolean def(Player player) {
@Override
public boolean OnCommand(Player player, String alias, String[] args) {
ItemStack potato = new ItemStack(Material.BAKED_POTATO); ItemStack potato = new ItemStack(Material.BAKED_POTATO);
player.getInventory().addItem(potato); player.getInventory().addItem(potato);
return true; return true;
} }
} }

View file

@ -1,26 +1,26 @@
package buttondevteam.presents.components.research.dictionary.spawning; package buttondevteam.presents.components.research.dictionary.spawning;
import java.util.ArrayList; import buttondevteam.lib.chat.Command2;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.presents.architecture.commands.UniversalCommand;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import buttondevteam.lib.chat.CommandClass; import java.util.ArrayList;
import buttondevteam.presents.architecture.commands.ModCommand;
@CommandClass(path = "dictionary magicpotato", modOnly=true) @CommandClass(path = "dictionary magicpotato", modOnly = true)
public class SpawnMagicPotato extends ModCommand { public class SpawnMagicPotato extends UniversalCommand {
@Override @Command2.Subcommand
public boolean OnCommand(Player player, String alias, String[] args) { public boolean def(Player player) {
ItemStack potato = new ItemStack(Material.BAKED_POTATO); ItemStack potato = new ItemStack(Material.BAKED_POTATO);
ItemMeta meta = potato.getItemMeta(); ItemMeta meta = potato.getItemMeta();
meta.addEnchant(Enchantment.DURABILITY, 10, true); meta.addEnchant(Enchantment.DURABILITY, 10, true);
ArrayList<String> lore = new ArrayList<String>(); ArrayList<String> lore = new ArrayList<String>();
lore.add("Once upon a time"); lore.add("Once upon a time");
lore.add("There was a beautiful potato"); lore.add("There was a beautiful potato");

View file

@ -1,16 +1,16 @@
package buttondevteam.presents.components.research.dictionary.spawning; package buttondevteam.presents.components.research.dictionary.spawning;
import buttondevteam.lib.chat.Command2;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.presents.architecture.commands.UniversalCommand;
import org.bukkit.Particle; import org.bukkit.Particle;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import buttondevteam.lib.chat.CommandClass; @CommandClass(path = "dictionary particle", modOnly = true)
import buttondevteam.presents.architecture.commands.PlayerCommand; public class SpawnParticle extends UniversalCommand {
@CommandClass(path = "dictionary particle", modOnly=true) @Command2.Subcommand
public class SpawnParticle extends PlayerCommand { public boolean def(Player player) {
@Override
public boolean OnCommand(Player player, String alias, String[] args) {
player.getWorld().spawnParticle(Particle.CLOUD, player.getLocation(), 10); player.getWorld().spawnParticle(Particle.CLOUD, player.getLocation(), 10);
return true; return true;
} }

View file

@ -1,11 +1,11 @@
package buttondevteam.presents.components.research.questions; package buttondevteam.presents.components.research.questions;
import org.bukkit.entity.Player; import buttondevteam.lib.chat.Command2;
import buttondevteam.lib.chat.CommandClass; import buttondevteam.lib.chat.CommandClass;
import buttondevteam.presents.components.research.Question; import buttondevteam.presents.components.research.Question;
import org.bukkit.entity.Player;
@CommandClass(path="research crash overflow") @CommandClass(path = "research crash overflow", modOnly = true)
public class OverflowCrash extends Question { public class OverflowCrash extends Question {
@Override @Override
@ -20,11 +20,11 @@ public class OverflowCrash extends Question {
return "No."; return "No.";
} }
@Override @Command2.Subcommand
public boolean OnCommand(Player player, String alias, String[] args) { public boolean def(Player player) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
String overflowMessage = ""; String overflowMessage = "";
for (int i = 0; i < 100; i++){ for (int i = 0; i < 100; i++) {
overflowMessage += "Did you ever hear the tragedy of Darth Plagueis The Wise? I thought not. Its not a story the Jedi would tell you. Its 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."; overflowMessage += "Did you ever hear the tragedy of Darth Plagueis The Wise? I thought not. Its not a story the Jedi would tell you. Its 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(overflowMessage);

View file

@ -1,11 +1,11 @@
package buttondevteam.presents.components.research.questions; package buttondevteam.presents.components.research.questions;
import org.bukkit.entity.Player; import buttondevteam.lib.chat.Command2;
import buttondevteam.lib.chat.CommandClass; import buttondevteam.lib.chat.CommandClass;
import buttondevteam.presents.components.research.Question; import buttondevteam.presents.components.research.Question;
import org.bukkit.entity.Player;
@CommandClass(path="research crash overwhelm") @CommandClass(path = "research crash overwhelm", modOnly = true)
public class OverwhelmCrash extends Question { public class OverwhelmCrash extends Question {
@Override @Override
@ -20,10 +20,10 @@ public class OverwhelmCrash extends Question {
return "No."; return "No.";
} }
@Override @Command2.Subcommand
public boolean OnCommand(Player player, String alias, String[] args) { public boolean def(Player player) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
for (int x = 0; x < 500; x++){ for (int x = 0; x < 500; x++) {
player.sendMessage("Hello World Motherfucker!"); player.sendMessage("Hello World Motherfucker!");
} }
player.sendMessage(question()); player.sendMessage(question());

View file

@ -1,75 +1,70 @@
package buttondevteam.presents.components.research.questions; package buttondevteam.presents.components.research.questions;
import buttondevteam.lib.chat.Command2;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.presents.components.research.Question;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import buttondevteam.lib.chat.CommandClass; @CommandClass(path = "research info pluginconfig", modOnly = true, helpText = {
import buttondevteam.presents.components.research.Question; "Subcommands = name, path, root_name, root_path, root_keys, answer"
})
@CommandClass(path="research info pluginconfig")
public class PluginConfigInfo extends Question { public class PluginConfigInfo extends Question {
@Override @Override
public String question() { public String question() {
return "What is the filepath for the plugin " + this.getPlugin().getName() + "?"; return "What is the filepath for the plugin " + this.getPlugin().getName() + "?";
} }
public String answer() { public String answer() {
return this.answer; return this.answer;
} }
@Command2.Subcommand
@Override public boolean def(Player player, String subcommand) {
public boolean OnCommand(Player player, String alias, String[] args) {
player.sendMessage("[Q]:" + question()); player.sendMessage("[Q]:" + question());
player.sendMessage("---Plugin's Config Information---"); player.sendMessage("---Plugin's Config Information---");
FileConfiguration config = this.getPlugin().getConfig(); FileConfiguration config = this.getPlugin().getConfig();
if (args.length >= 1){ switch (subcommand.toLowerCase()) {
switch(args[0].toLowerCase()){
case "name": case "name":
player.sendMessage("Name:"); player.sendMessage("Name:");
player.sendMessage(" - " + config.getName()); player.sendMessage(" - " + config.getName());
break; break;
case "path": case "path":
player.sendMessage("Current Path:"); player.sendMessage("Current Path:");
player.sendMessage(" - " + config.getCurrentPath()); player.sendMessage(" - " + config.getCurrentPath());
break; break;
case "root_name": case "root_name":
player.sendMessage("Name of Root:"); player.sendMessage("Name of Root:");
player.sendMessage(" - " + config.getRoot().getName()); player.sendMessage(" - " + config.getRoot().getName());
break; break;
case "root_path": case "root_path":
player.sendMessage("Path of Root:"); player.sendMessage("Path of Root:");
player.sendMessage(" - " + config.getRoot().getCurrentPath()); player.sendMessage(" - " + config.getRoot().getCurrentPath());
break; break;
case "root_key": case "root_key":
case "root_keys": case "root_keys":
player.sendMessage("Keys of Root (Deep = true)"); player.sendMessage("Keys of Root (Deep = true)");
player.sendMessage(" - " + config.getRoot().getKeys(true).toString()); player.sendMessage(" - " + config.getRoot().getKeys(true).toString());
break; break;
case "answer": case "answer":
player.sendMessage("[A]:" + this.answer()); player.sendMessage("[A]:" + this.answer());
break; break;
default: default:
player.sendMessage("Usage: " + this.GetCommandPath() + "<subcommand>"); return false;
player.sendMessage("Subcommands = name, path, root_name, root_path, root_keys, answer");
}
}else{ //args.length <= 0
player.sendMessage("Usage: " + this.GetCommandPath() + "<subcommand>");
player.sendMessage("Subcommands = name, path, root_name, root_path, root_keys, answer");
} }
return false; return false;
} }
} }

View file

@ -1,14 +1,14 @@
package buttondevteam.presents.components.research.questions; package buttondevteam.presents.components.research.questions;
import buttondevteam.lib.chat.Command2;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.presents.components.research.Question;
import org.bukkit.entity.Player;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import org.bukkit.entity.Player; @CommandClass(path = "research info datafolder", modOnly = true)
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.presents.components.research.Question;
@CommandClass(path="research info datafolder")
public class PluginDataFolderInfo extends Question { public class PluginDataFolderInfo extends Question {
@Override @Override
@ -23,19 +23,19 @@ public class PluginDataFolderInfo extends Question {
return this.answer; return this.answer;
} }
@Override @Command2.Subcommand
public boolean OnCommand(Player player, String alias, String[] args) { public boolean def(Player player) {
player.sendMessage("[Q]:" + this.question()); player.sendMessage("[Q]:" + this.question());
player.sendMessage("---Plugin's Data Folder Information---"); player.sendMessage("---Plugin's Data Folder Information---");
File dataFolder = this.getPlugin().getDataFolder(); File dataFolder = this.getPlugin().getDataFolder();
if (dataFolder == null) player.sendMessage("Data Folder is null"); if (dataFolder == null) player.sendMessage("Data Folder is null");
else if (!dataFolder.exists()) player.sendMessage("Data Folder does not exist"); else if (!dataFolder.exists()) player.sendMessage("Data Folder does not exist");
else{ else {
player.sendMessage("Absolute path: "); player.sendMessage("Absolute path: ");
player.sendMessage(dataFolder.getAbsolutePath()); player.sendMessage(dataFolder.getAbsolutePath());
player.sendMessage("Canonical Path:"); player.sendMessage("Canonical Path:");
try { try {
player.sendMessage(dataFolder.getCanonicalPath()); player.sendMessage(dataFolder.getCanonicalPath());

View file

@ -1,15 +1,15 @@
package buttondevteam.presents.components.spawn; package buttondevteam.presents.components.spawn;
import buttondevteam.lib.chat.Command2;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.presents.architecture.commands.UniversalCommand;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import buttondevteam.lib.chat.CommandClass; @CommandClass(modOnly = true, path = "spawn choosecolor")
import buttondevteam.presents.architecture.commands.PlayerCommand; public class ChooseColor extends UniversalCommand {
@CommandClass(modOnly = true, path="spawn choosecolor") @Command2.Subcommand
public class ChooseColor extends PlayerCommand { public boolean def(Player player, String color) {
@Override
public boolean OnCommand(Player player, String alias, String[] args) {
// //Code to make it so that command blocks can fire this command // //Code to make it so that command blocks can fire this command
// //
// if (!(sender instanceof BlockCommandSender)){ // if (!(sender instanceof BlockCommandSender)){
@ -20,15 +20,15 @@ public class ChooseColor extends PlayerCommand {
// Server server = sender.getServer(); // Server server = sender.getServer();
// server.broadcastMessage("Arg 0:" + args[0]); // server.broadcastMessage("Arg 0:" + args[0]);
// server.broadcastMessage("Arg 1:" + args[1]); // server.broadcastMessage("Arg 1:" + args[1]);
player.sendMessage("Attempting to change your name "+player.getName()+" to the color..."+args[1]); player.sendMessage("Attempting to change your name " + player.getName() + " to the color..." + color);
//TODO:INSERT NAME CHANGING CODE HERE //TODO:INSERT NAME CHANGING CODE HERE
player.sendMessage("Your new name: " +player.getName()); player.sendMessage("Your new name: " + player.getName());
return true; return true;
} }