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
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.ear
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
*.class
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.ear
# 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[] {
"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"
};
}
@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,32 +1,31 @@
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)){
if (plugin_config.contains("dungeons." + dungeonName)) {
player.sendMessage("There already exists a dungeon named " + dungeonName);
player.sendMessage("Type /dungeon info [dungeonname] to get more information");
return true;
}
DungeonConfig config = new DungeonConfig(plugin_config);
config.set(SETTING.NAME, true);
config.set(SETTING.OWNER, player.getName());
config.set(SETTING.SPAWN, player.getLocation().toString());
@ -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,32 +1,29 @@
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 UniversalCommand {
@CommandClass(path="dungeon delete")
public class DungeonDelete extends ModCommand{
@Command2.Subcommand
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();
if(!config.contains("dungeon." + dungeonName)){
if (!config.contains("dungeon." + dungeonName)) {
player.sendMessage("This dungeon does not exist!");
String output = "Valid dungeons are:";
for(String key : config.getConfigurationSection("dungeon").getKeys(false)){
for (String key : config.getConfigurationSection("dungeon").getKeys(false)) {
output += key;
output += ", ";
}
player.sendMessage(output);
}else{
for(String key : config.getConfigurationSection("dungeon." + dungeonName).getKeys(true)){
} else {
for (String key : config.getConfigurationSection("dungeon." + dungeonName).getKeys(true)) {
config.set("dungeon." + dungeonName + "." + key, null);
}
player.sendMessage("Dungeon " + dungeonName + " deleted.");
@ -35,5 +32,4 @@ public class DungeonDelete extends ModCommand{
return true;
}
}

View file

@ -1,61 +1,59 @@
package buttondevteam.presents.components.magic.tricks;
import org.bukkit.entity.Player;
import buttondevteam.presents.architecture.commands.ModCommand;
//HEHEHHEHEH EAASSSTER EGGS
public class BoomBowRule extends ModCommand{
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){
player.sendMessage("You must be alisolarflare to use this command");
return false;
}
if (args.length < 2){
player.sendMessage("Rules:");
player.sendMessage("boomDecay" + boomDecay);
player.sendMessage("healthReduction" + healthReduction);
player.sendMessage("endCrystal" + endCrystal);
player.sendMessage("localized" + localized);
return false;
}
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]){
case "boomDecay":
boomDecay = gameRule;
break;
case "healthReduction":
healthReduction = gameRule;
break;
case "endCrystal":
endCrystal = gameRule;
break;
case "localized":
localized = gameRule;
break;
default:
player.sendMessage("Error: "+args[0]+" 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"
};
}
}
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;
//HEHEHHEHEH EAASSSTER EGGS
@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;
@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 (name == null || value == null) {
player.sendMessage("Rules:");
player.sendMessage("boomDecay" + boomDecay);
player.sendMessage("healthReduction" + healthReduction);
player.sendMessage("endCrystal" + endCrystal);
player.sendMessage("localized" + localized);
return false;
}
/*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 (name) {
case "boomDecay":
boomDecay = value;
break;
case "healthReduction":
healthReduction = value;
break;
case "endCrystal":
endCrystal = value;
break;
case "localized":
localized = value;
break;
default:
player.sendMessage("Error: " + name + " not defined as a rule");
return false;
}
return true;
}
}

View file

@ -1,50 +1,51 @@
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 UniversalCommand {
@CommandClass(path="magic cannonbow settings")
public class CannonBowSettings extends ModCommand {
@Override
public boolean OnCommand(Player player, String alias, String[] args) {
if (args.length > 1 && args[0] == "display"){
switch(args[0].toLowerCase()){
case "force":
case "speedmultiplier":
CannonBowListener.setSpeedMultiplier(NumberUtils.toDouble(args[1], CannonBowListener.getSpeedMultiplier()));
break;
case "minimumforce":
case "minforce":
case "minimumdraw":
case "mindraw":
CannonBowListener.setMinforce(NumberUtils.toDouble(args[1], CannonBowListener.getMinforce()));
break;
case "fuse":
case "fusetick":
case "fuseticks":
CannonBowListener.setFuseticks(NumberUtils.toInt(args[1], CannonBowListener.getFuseticks()));
break;
case "recoil":
CannonBowListener.setRecoil(NumberUtils.toDouble((args[1]), CannonBowListener.getRecoil()));
break;
case "isDestructive":
CannonBowListener.setIsDestructive(args[1]);
case "display":
player.sendMessage("Speed Multiplier: "+CannonBowListener.getSpeedMultiplier());
player.sendMessage("Minimum Force: "+CannonBowListener.getMinforce());
player.sendMessage("Fuseticks: " + CannonBowListener.getFuseticks());
player.sendMessage("Recoil: " + CannonBowListener.getRecoil());
player.sendMessage("isDestructive: " + CannonBowListener.getIsDestructive());
break;
default:
player.sendMessage("That isn't a valid setting!");
player.sendMessage("Valid Settings are: speedmultiplier, minforce, fuseticks, recoil");
player.sendMessage("Use argument 'display' to disply current settings");
return false;
@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(value, CannonBowListener.getSpeedMultiplier()));
break;
case "minimumforce":
case "minforce":
case "minimumdraw":
case "mindraw":
CannonBowListener.setMinforce(NumberUtils.toDouble(value, CannonBowListener.getMinforce()));
break;
case "fuse":
case "fusetick":
case "fuseticks":
CannonBowListener.setFuseticks(NumberUtils.toInt(value, CannonBowListener.getFuseticks()));
break;
case "recoil":
CannonBowListener.setRecoil(NumberUtils.toDouble((value), CannonBowListener.getRecoil()));
break;
case "isDestructive":
CannonBowListener.setIsDestructive(value);
break;
case "display":
player.sendMessage("Speed Multiplier: " + CannonBowListener.getSpeedMultiplier());
player.sendMessage("Minimum Force: " + CannonBowListener.getMinforce());
player.sendMessage("Fuseticks: " + CannonBowListener.getFuseticks());
player.sendMessage("Recoil: " + CannonBowListener.getRecoil());
player.sendMessage("isDestructive: " + CannonBowListener.getIsDestructive());
break;
default:
player.sendMessage("That isn't a valid setting!");
player.sendMessage("Valid Settings are: speedmultiplier, minforce, fuseticks, recoil");
player.sendMessage("Use argument 'display' to disply current settings");
return false;
}
}
return true;

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,29 +1,29 @@
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 org.bukkit.entity.Player;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.presents.architecture.commands.ModCommand;
@CommandClass(modOnly = true, path = "dictionary json")
public class SendJSON extends UniversalCommand {
@CommandClass(modOnly = true, path="dictionary json")
public class SendJSON extends ModCommand{
@Command2.Subcommand
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()));
return true;
}
class output{
class output {
String ali = "pls";
String iie = "whaddap";
String norbipeti = "¯\\_(ツ)_/¯";
}
String iie = "whaddap";
String norbipeti = "¯\\_(ツ)_/¯";
}
}

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")
@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,24 +1,23 @@
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;
@CommandClass(modOnly = true, path = "dictionary load")
public class LoadConfig extends UniversalCommand {
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.presents.architecture.commands.ModCommand;
@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")){
@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");
for(String string : mylist){
for (String string : mylist) {
player.sendMessage(string);
}
return true;

View file

@ -1,24 +1,24 @@
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));
} else {
try {
this.getPlugin().getConfig().set("hellosave", Arrays.asList(message));
this.getPlugin().saveConfig();
sender.sendMessage("Message saved!");
}catch (Exception e){
} catch (Exception e) {
sender.sendMessage("Error when saving message:");
sender.sendMessage(e.toString());
}

View file

@ -1,31 +1,32 @@
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();
if(config.contains(path) && config.isLong(path)){
if (config.contains(path) && config.isLong(path)) {
sender.sendMessage("Last Time Incident: " + MillisToString(config.getLong(path)));
}else{
} else {
sender.sendMessage("Time Incident Occoured!");
sender.sendMessage("Setting...");
long time = System.currentTimeMillis();
config.set(path, time);
sender.sendMessage("Time set to" + MillisToString(time));
}
return true;

View file

@ -1,46 +1,25 @@
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 {
@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.getLocation(),
Sound.ENTITY_BLAZE_DEATH,
volume, //Volume
pitch); //Pitch
return true;
}
}

View file

@ -1,21 +1,21 @@
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 UniversalCommand {
@CommandClass(path = "dictionary block", modOnly=true)
public class SetBlock extends PlayerCommand {
@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);
return true;
}

View file

@ -1,19 +1,20 @@
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 {
@CommandClass(path = "dictionary cow", modOnly = true)
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
);
);
return true;
}
}

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 UniversalCommand {
@CommandClass(path = "dictionary item", modOnly=true)
public class SpawnItem extends ModCommand {
@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,26 +1,26 @@
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 {
@CommandClass(path = "dictionary magicpotato", modOnly = true)
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();
meta.addEnchant(Enchantment.DURABILITY, 10, true);
ArrayList<String> lore = new ArrayList<String>();
lore.add("Once upon a time");
lore.add("There was a beautiful potato");

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 UniversalCommand {
@CommandClass(path = "dictionary particle", modOnly=true)
public class SpawnParticle extends PlayerCommand {
@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,11 +20,11 @@ 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++){
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.";
}
player.sendMessage(overflowMessage);

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,10 +20,10 @@ 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++){
for (int x = 0; x < 500; x++) {
player.sendMessage("Hello World Motherfucker!");
}
player.sendMessage(question());

View file

@ -1,75 +1,70 @@
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() {
return "What is the filepath for the plugin " + this.getPlugin().getName() + "?";
}
public String answer() {
return this.answer;
}
@Override
public boolean OnCommand(Player player, String alias, String[] args) {
@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());
break;
case "path":
player.sendMessage("Current Path:");
player.sendMessage(" - " + config.getCurrentPath());
break;
case "root_name":
player.sendMessage("Name of Root:");
player.sendMessage(" - " + config.getRoot().getName());
break;
case "root_path":
player.sendMessage("Path of Root:");
player.sendMessage(" - " + config.getRoot().getCurrentPath());
break;
case "root_key":
case "root_keys":
player.sendMessage("Keys of Root (Deep = true)");
player.sendMessage(" - " + config.getRoot().getKeys(true).toString());
break;
case "answer":
player.sendMessage("[A]:" + this.answer());
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,19 +23,19 @@ 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---");
File dataFolder = this.getPlugin().getDataFolder();
if (dataFolder == null) player.sendMessage("Data Folder is null");
else if (!dataFolder.exists()) player.sendMessage("Data Folder does not exist");
else{
if (dataFolder == null) player.sendMessage("Data Folder is null");
else if (!dataFolder.exists()) player.sendMessage("Data Folder does not exist");
else {
player.sendMessage("Absolute path: ");
player.sendMessage(dataFolder.getAbsolutePath());
player.sendMessage("Canonical Path:");
try {
player.sendMessage(dataFolder.getCanonicalPath());

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 UniversalCommand {
@CommandClass(modOnly = true, path="spawn choosecolor")
public class ChooseColor extends PlayerCommand {
@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)){
@ -20,15 +20,15 @@ public class ChooseColor extends PlayerCommand {
// Server server = sender.getServer();
// server.broadcastMessage("Arg 0:" + args[0]);
// 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
player.sendMessage("Your new name: " +player.getName());
player.sendMessage("Your new name: " + player.getName());
return true;
}