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

2
.gitignore vendored
View file

@ -11,3 +11,5 @@
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
/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>
</dependency>
<dependency>
<groupId>com.github.TBMCPlugins.ButtonCore</groupId>
<artifactId>ButtonCore</artifactId>
<groupId>com.github.TBMCPlugins.ChromaCore</groupId>
<artifactId>Chroma-Core</artifactId>
<version>master-SNAPSHOT</version>
</dependency>
<dependency>
@ -91,9 +91,10 @@
<version>3.2.2</version>
</dependency>
<dependency>
<groupId>com.github.TBMCPlugins.ButtonCore</groupId>
<groupId>com.palmergames.bukkit.towny</groupId>
<artifactId>Towny</artifactId>
<version>master-SNAPSHOT</version>
<version>0.95.2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<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;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.lib.chat.ICommand2MC;
@CommandClass(modOnly = false, excludeFromPath=true)
public abstract class UniversalCommand extends BaseCommand{
@Override
public String[] GetHelpText(String alias){
return new String[] {
@CommandClass(modOnly = false, excludeFromPath = true, helpText = {
"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"
};
}
})
public abstract class UniversalCommand extends ICommand2MC {
}

View file

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

View file

@ -1,22 +1,21 @@
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.entity.Player;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.presents.architecture.commands.ModCommand;
import buttondevteam.presents.components.dungeon.DungeonConfig.SETTING;
@CommandClass(path = "dungeon create", modOnly = true, helpText = {
"instantiates a new dungeon, setting the dungeon spawn to the player location"
})
public class DungeonCreate extends UniversalCommand {
@CommandClass(path="dungeon create")
public class DungeonCreate extends ModCommand{
@Override
public boolean OnCommand(Player player, String alias, String[] args) {
@Command2.Subcommand
public boolean def(Player player, String dungeonName) {
//Creates a new dungeon
if(args.length < 1) return false;
String dungeonName = args[0];
FileConfiguration plugin_config = this.getPlugin().getConfig();
if (plugin_config.contains("dungeons." + dungeonName)) {
@ -42,13 +41,4 @@ public class DungeonCreate extends ModCommand{
}
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,20 +1,17 @@
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.entity.Player;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.presents.architecture.commands.ModCommand;
@CommandClass(path = "dungeon delete")
public class DungeonDelete extends ModCommand{
public class DungeonDelete extends UniversalCommand {
@Override
public boolean OnCommand(Player player, String alias, String[] args) {
@Command2.Subcommand
public boolean def(Player player, String dungeonName) {
if (args.length < 1) return false;
String dungeonName = args[0];
FileConfiguration config = this.getPlugin().getConfig();
if (!config.contains("dungeon." + dungeonName)) {
@ -35,5 +32,4 @@ public class DungeonDelete extends ModCommand{
return true;
}
}

View file

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

View file

@ -1,38 +1,39 @@
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.bukkit.entity.Player;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.presents.architecture.commands.ModCommand;
@CommandClass(path = "magic cannonbow settings")
public class CannonBowSettings extends ModCommand {
public class CannonBowSettings extends UniversalCommand {
@Override
public boolean OnCommand(Player player, String alias, String[] args) {
if (args.length > 1 && args[0] == "display"){
switch(args[0].toLowerCase()){
@Command2.Subcommand
public boolean def(Player player, String setting, @Command2.OptionalArg String value) {
if (value != null || setting.equalsIgnoreCase("display")) {
switch (setting.toLowerCase()) {
case "force":
case "speedmultiplier":
CannonBowListener.setSpeedMultiplier(NumberUtils.toDouble(args[1], CannonBowListener.getSpeedMultiplier()));
CannonBowListener.setSpeedMultiplier(NumberUtils.toDouble(value, CannonBowListener.getSpeedMultiplier()));
break;
case "minimumforce":
case "minforce":
case "minimumdraw":
case "mindraw":
CannonBowListener.setMinforce(NumberUtils.toDouble(args[1], CannonBowListener.getMinforce()));
CannonBowListener.setMinforce(NumberUtils.toDouble(value, CannonBowListener.getMinforce()));
break;
case "fuse":
case "fusetick":
case "fuseticks":
CannonBowListener.setFuseticks(NumberUtils.toInt(args[1], CannonBowListener.getFuseticks()));
CannonBowListener.setFuseticks(NumberUtils.toInt(value, CannonBowListener.getFuseticks()));
break;
case "recoil":
CannonBowListener.setRecoil(NumberUtils.toDouble((args[1]), CannonBowListener.getRecoil()));
CannonBowListener.setRecoil(NumberUtils.toDouble((value), CannonBowListener.getRecoil()));
break;
case "isDestructive":
CannonBowListener.setIsDestructive(args[1]);
CannonBowListener.setIsDestructive(value);
break;
case "display":
player.sendMessage("Speed Multiplier: " + CannonBowListener.getSpeedMultiplier());
player.sendMessage("Minimum Force: " + CannonBowListener.getMinforce());

View file

@ -1,10 +1,11 @@
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 answer();
protected String answer = "Undetermined";
public abstract String answer();
protected String answer = "Undetermined";
}

View file

@ -1,25 +1,25 @@
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.GsonBuilder;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.presents.architecture.commands.ModCommand;
import org.bukkit.entity.Player;
@CommandClass(modOnly = true, path = "dictionary json")
public class SendJSON extends ModCommand{
public class SendJSON extends UniversalCommand {
@Override
public boolean OnCommand(Player player, String alias, String[] args) {
@Command2.Subcommand
public boolean def(Player player) {
GsonBuilder builder = new GsonBuilder();
Gson gson = builder.create();
player.sendMessage(gson.toJson(new output()));
return true;
}
class output {
String ali = "pls";
String iie = "whaddap";

View file

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

View file

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

View file

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

View file

@ -1,19 +1,20 @@
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.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")
public class TimePersistence extends UniversalCommand {
final String path = "hellotime.lastincident";
@Override
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
@Command2.Subcommand
public boolean def(CommandSender sender) {
FileConfiguration config = this.getPlugin().getConfig();

View file

@ -1,37 +1,16 @@
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.entity.Player;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.presents.architecture.commands.PlayerCommand;
@CommandClass(path = "dictionary sound")
public class PlaySound extends PlayerCommand{
public class PlaySound extends UniversalCommand {
@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());
}
}
@Command2.Subcommand
public boolean def(Player player, int volume, int pitch) {
player.playSound(
player.getLocation(),

View file

@ -1,17 +1,17 @@
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.block.Block;
import org.bukkit.entity.Player;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.presents.architecture.commands.PlayerCommand;
@CommandClass(path = "dictionary block", modOnly = true)
public class SetBlock extends PlayerCommand {
public class SetBlock extends UniversalCommand {
@Override
public boolean OnCommand(Player player, String alias, String[] args) {
@Command2.Subcommand
public boolean def(Player player) {
Block blockAtPlayer = player.getWorld().getBlockAt(player.getLocation());
blockAtPlayer.setType(Material.CAKE_BLOCK);

View file

@ -1,15 +1,16 @@
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.Player;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.presents.architecture.commands.PlayerCommand;
@CommandClass(path = "dictionary cow", modOnly = true)
public class SpawnCow extends PlayerCommand {
public class SpawnCow extends UniversalCommand {
@Override
public boolean OnCommand(Player player, String alias, String[] args) {
@Command2.Subcommand
public boolean def(Player player) {
player.getWorld().spawnEntity(
player.getLocation(),
EntityType.COW

View file

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

View file

@ -1,21 +1,21 @@
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.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.presents.architecture.commands.ModCommand;
import java.util.ArrayList;
@CommandClass(path = "dictionary magicpotato", modOnly = true)
public class SpawnMagicPotato extends ModCommand {
public class SpawnMagicPotato extends UniversalCommand {
@Override
public boolean OnCommand(Player player, String alias, String[] args) {
@Command2.Subcommand
public boolean def(Player player) {
ItemStack potato = new ItemStack(Material.BAKED_POTATO);
ItemMeta meta = potato.getItemMeta();

View file

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

View file

@ -1,11 +1,11 @@
package buttondevteam.presents.components.research.questions;
import org.bukkit.entity.Player;
import buttondevteam.lib.chat.Command2;
import buttondevteam.lib.chat.CommandClass;
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 {
@Override
@ -20,8 +20,8 @@ public class OverflowCrash extends Question {
return "No.";
}
@Override
public boolean OnCommand(Player player, String alias, String[] args) {
@Command2.Subcommand
public boolean def(Player player) {
// TODO Auto-generated method stub
String overflowMessage = "";
for (int i = 0; i < 100; i++) {

View file

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

View file

@ -1,12 +1,14 @@
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.entity.Player;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.presents.components.research.Question;
@CommandClass(path="research info pluginconfig")
@CommandClass(path = "research info pluginconfig", modOnly = true, helpText = {
"Subcommands = name, path, root_name, root_path, root_keys, answer"
})
public class PluginConfigInfo extends Question {
@Override
public String question() {
@ -19,16 +21,14 @@ public class PluginConfigInfo extends Question {
}
@Override
public boolean OnCommand(Player player, String alias, String[] args) {
@Command2.Subcommand
public boolean def(Player player, String subcommand) {
player.sendMessage("[Q]:" + question());
player.sendMessage("---Plugin's Config Information---");
FileConfiguration config = this.getPlugin().getConfig();
if (args.length >= 1){
switch(args[0].toLowerCase()){
switch (subcommand.toLowerCase()) {
case "name":
player.sendMessage("Name:");
player.sendMessage(" - " + config.getName());
@ -60,12 +60,7 @@ public class PluginConfigInfo extends Question {
break;
default:
player.sendMessage("Usage: " + this.GetCommandPath() + "<subcommand>");
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;
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.IOException;
import org.bukkit.entity.Player;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.presents.components.research.Question;
@CommandClass(path="research info datafolder")
@CommandClass(path = "research info datafolder", modOnly = true)
public class PluginDataFolderInfo extends Question {
@Override
@ -23,8 +23,8 @@ public class PluginDataFolderInfo extends Question {
return this.answer;
}
@Override
public boolean OnCommand(Player player, String alias, String[] args) {
@Command2.Subcommand
public boolean def(Player player) {
player.sendMessage("[Q]:" + this.question());
player.sendMessage("---Plugin's Data Folder Information---");

View file

@ -1,15 +1,15 @@
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 buttondevteam.lib.chat.CommandClass;
import buttondevteam.presents.architecture.commands.PlayerCommand;
@CommandClass(modOnly = true, path = "spawn choosecolor")
public class ChooseColor extends PlayerCommand {
public class ChooseColor extends UniversalCommand {
@Override
public boolean OnCommand(Player player, String alias, String[] args) {
@Command2.Subcommand
public boolean def(Player player, String color) {
// //Code to make it so that command blocks can fire this command
//
// if (!(sender instanceof BlockCommandSender)){
@ -22,7 +22,7 @@ public class ChooseColor extends PlayerCommand {
// 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