Remove name = where not needed

This commit is contained in:
CocoTheOwner 2021-08-16 22:17:54 +02:00
parent 2ac2cc2ebf
commit 92ba038af7
3 changed files with 87 additions and 86 deletions

View File

@ -41,11 +41,11 @@ public class DecIris implements DecreeExecutor
@Decree(description = "Create a new world", aliases = "+") @Decree(description = "Create a new world", aliases = "+")
public void create( public void create(
@Param(name = "name", aliases = "world-name", description = "The name of the world to create", defaultValue = "IrisWorld") @Param(aliases = "world-name", description = "The name of the world to create", defaultValue = "IrisWorld")
String name, String name,
@Param(name = "type", aliases = "dimension", description = "The dimension type to create the world with", defaultValue = "overworld") @Param(aliases = "dimension", description = "The dimension type to create the world with", defaultValue = "overworld")
IrisDimension type, IrisDimension type,
@Param(name = "seed", description = "The seed to generate the world with", defaultValue = "1337") @Param(description = "The seed to generate the world with", defaultValue = "1337")
long seed long seed
){ ){
if (name.equals("iris")) { if (name.equals("iris")) {
@ -84,11 +84,11 @@ public class DecIris implements DecreeExecutor
@Decree(description = "Set aura spins") @Decree(description = "Set aura spins")
public void aura( public void aura(
@Param(name = "h", description = "The h color value") @Param(description = "The h color value")
int h, int h,
@Param(name = "s", description = "The s color value") @Param(description = "The s color value")
int s, int s,
@Param(name = "b", description = "The b color value") @Param(description = "The b color value")
int b int b
) { ) {
IrisSettings.get().getGeneral().setSpinh(h); IrisSettings.get().getGeneral().setSpinh(h);
@ -100,27 +100,27 @@ public class DecIris implements DecreeExecutor
@Decree(description = "Bitwise calculations") @Decree(description = "Bitwise calculations")
public void bitwise( public void bitwise(
@Param(name = "value1", description = "The first value to run calculations on") @Param(description = "The first value to run calculations on")
int val1, int value1,
@Param(name = "operator", description = "The operator: | & ^ >> << %") @Param(description = "The operator: | & ^ >> << %")
String operator, String operator,
@Param(name = "value2", description = "The second value to run calculations on") @Param(description = "The second value to run calculations on")
int val2 int value2
) { ) {
Integer v = null; Integer v = null;
switch(operator) { switch(operator) {
case "|" -> v = val1 | val2; case "|" -> v = value1 | value2;
case "&" -> v = val1 & val2; case "&" -> v = value1 & value2;
case "^" -> v = val1 ^ val2; case "^" -> v = value1 ^ value2;
case "%" -> v = val1 % val2; case "%" -> v = value1 % value2;
case ">>" -> v = val1 >> val2; case ">>" -> v = value1 >> value2;
case "<<" -> v = val1 << val2; case "<<" -> v = value1 << value2;
}; };
if (v == null){ if (v == null){
sender().sendMessage(C.RED + "The operator you entered: (" + operator + ") is invalid!"); sender().sendMessage(C.RED + "The operator you entered: (" + operator + ") is invalid!");
return; return;
} }
sender().sendMessage(C.GREEN + "" + val1 + " " + operator + " " + val2 + " => " + v); sender().sendMessage(C.GREEN + "" + value1 + " " + operator + " " + value2 + " => " + v);
} }
@Decree(description = "Toggle debug") @Decree(description = "Toggle debug")

View File

@ -17,11 +17,11 @@ import org.bukkit.util.Vector;
public class DecPregen implements DecreeExecutor { public class DecPregen implements DecreeExecutor {
@Decree(description = "Pregenerate a world") @Decree(description = "Pregenerate a world")
public void start( public void start(
@Param(name = "world", description = "The world to pregen", contextual = true) @Param(description = "The world to pregen", contextual = true)
World world, World world,
@Param(name = "radius", description = "The radius of the pregen in blocks", aliases = "size") @Param(description = "The radius of the pregen in blocks", aliases = "size")
int radius, int radius,
@Param(name = "center", aliases = "middle", description = "The center location of the pregen. Use \"me\" for your current location", defaultValue = "0,0") @Param(aliases = "middle", description = "The center location of the pregen. Use \"me\" for your current location", defaultValue = "0,0")
Vector center Vector center
) { ) {
try { try {

View File

@ -79,9 +79,9 @@ import java.util.function.Supplier;
public class DecStudio implements DecreeExecutor { public class DecStudio implements DecreeExecutor {
@Decree(description = "Open a new studio world", aliases = "o", sync = true) @Decree(description = "Open a new studio world", aliases = "o", sync = true)
public void open( public void open(
@Param(name = "dimension", defaultValue = "overworld", description = "The dimension to open a studio for", aliases = "dim") @Param(defaultValue = "overworld", description = "The dimension to open a studio for", aliases = "dim")
IrisDimension dimension, IrisDimension dimension,
@Param(name = "seed", defaultValue = "1337", description = "The seed to generate the studio with", aliases = "s") @Param(defaultValue = "1337", description = "The seed to generate the studio with", aliases = "s")
long seed) { long seed) {
sender().sendMessage(C.GREEN + "Opening studio for the \"" + dimension.getName() + "\" pack (seed: " + seed + ")"); sender().sendMessage(C.GREEN + "Opening studio for the \"" + dimension.getName() + "\" pack (seed: " + seed + ")");
Iris.proj.open(sender(), seed, dimension.getLoadKey()); Iris.proj.open(sender(), seed, dimension.getLoadKey());
@ -100,9 +100,9 @@ public class DecStudio implements DecreeExecutor {
@Decree(description = "Create a new studio project", aliases = "+", sync = true) @Decree(description = "Create a new studio project", aliases = "+", sync = true)
public void create( public void create(
@Param(name = "name", description = "The name of this new Iris Project.") @Param(description = "The name of this new Iris Project.")
String name, String name,
@Param(name = "template", description = "Copy the contents of an existing project in your packs folder and use it as a template in this new project.", contextual = true) @Param(description = "Copy the contents of an existing project in your packs folder and use it as a template in this new project.", contextual = true)
IrisDimension template) IrisDimension template)
{ {
if (template != null) { if (template != null) {
@ -114,10 +114,10 @@ public class DecStudio implements DecreeExecutor {
@Decree(description = "Clean an Iris Project, optionally beautifying JSON & fixing block ids with missing keys. Also rebuilds the vscode schemas. ") @Decree(description = "Clean an Iris Project, optionally beautifying JSON & fixing block ids with missing keys. Also rebuilds the vscode schemas. ")
public void clean( public void clean(
@Param(name = "project", description = "The project to update", contextual = true) @Param(description = "The project to update", contextual = true)
IrisDimension project, IrisDimension project,
@Param(name = "beautify", defaultValue = "true", description = "Filters all valid JSON files with a beautifier (indentation: 4)") @Param(defaultValue = "true", description = "Filters all valid JSON files with a beautifier (indentation: 4)")
boolean beautify, boolean beautify,
@Param(name = "fix-ids", defaultValue = "true", description = "Fixes any block ids used such as \"dirt\" will be converted to \"minecraft:dirt\"") @Param(name = "fix-ids", defaultValue = "true", description = "Fixes any block ids used such as \"dirt\" will be converted to \"minecraft:dirt\"")
@ -241,53 +241,9 @@ public class DecStudio implements DecreeExecutor {
new JobCollection("Cleaning", jobs).execute(sender()); new JobCollection("Cleaning", jobs).execute(sender());
} }
public void files(File clean, KList<File> files)
{
if (clean.isDirectory()) {
for (File i : clean.listFiles()) {
files(i, files);
}
} else if (clean.getName().endsWith(".json")) {
try {
files.add(clean);
} catch (Throwable e) {
Iris.reportError(e);
Iris.error("Failed to beautify " + clean.getAbsolutePath() + " You may have errors in your json!");
}
}
}
private void fixBlocks(JSONObject obj) {
for (String i : obj.keySet()) {
Object o = obj.get(i);
if (i.equals("block") && o instanceof String && !o.toString().trim().isEmpty() && !o.toString().contains(":")) {
obj.put(i, "minecraft:" + o);
}
if (o instanceof JSONObject) {
fixBlocks((JSONObject) o);
} else if (o instanceof JSONArray) {
fixBlocks((JSONArray) o);
}
}
}
private void fixBlocks(JSONArray obj) {
for (int i = 0; i < obj.length(); i++) {
Object o = obj.get(i);
if (o instanceof JSONObject) {
fixBlocks((JSONObject) o);
} else if (o instanceof JSONArray) {
fixBlocks((JSONArray) o);
}
}
}
@Decree(description = "Get the version of a pack") @Decree(description = "Get the version of a pack")
public void version( public void version(
@Param(name = "dimension", defaultValue = "overworld", description = "The dimension get the version of", aliases = "dim", contextual = true) @Param(defaultValue = "overworld", description = "The dimension get the version of", aliases = "dim", contextual = true)
IrisDimension dimension IrisDimension dimension
) { ) {
sender().sendMessage(C.GREEN + "The \"" + dimension.getName() + "\" pack has version: " + dimension.getVersion()); sender().sendMessage(C.GREEN + "The \"" + dimension.getName() + "\" pack has version: " + dimension.getVersion());
@ -299,9 +255,9 @@ public class DecStudio implements DecreeExecutor {
} }
@Decree(description = "Edit the biome you're currently in", aliases = {"ebiome", "eb"}, origin = DecreeOrigin.PLAYER) @Decree(description = "Edit the biome you are currently in", aliases = {"ebiome", "eb"}, origin = DecreeOrigin.PLAYER)
public void editbiome( public void editbiome(
@Param(name = "biome", contextual = true, description = "The biome to edit") @Param(contextual = true, description = "The biome to edit")
IrisBiome biome IrisBiome biome
) { ) {
if (noStudio()) return; if (noStudio()) return;
@ -316,7 +272,7 @@ public class DecStudio implements DecreeExecutor {
@Decree(description = "Execute a script", aliases = "run", origin = DecreeOrigin.PLAYER) @Decree(description = "Execute a script", aliases = "run", origin = DecreeOrigin.PLAYER)
public void execute( public void execute(
@Param(name = "script", description = "The script to run") @Param(description = "The script to run")
IrisScript script IrisScript script
) { ) {
engine().getExecution().execute(script.getLoadKey()); engine().getExecution().execute(script.getLoadKey());
@ -336,9 +292,9 @@ public class DecStudio implements DecreeExecutor {
@Decree(description = "Preview noise gens (External GUI)", aliases = {"generator", "gen"}) @Decree(description = "Preview noise gens (External GUI)", aliases = {"generator", "gen"})
public void explore( public void explore(
@Param(name = "generator", description = "The generator to explore", contextual = true) @Param(description = "The generator to explore", contextual = true)
IrisGenerator generator, IrisGenerator generator,
@Param(name = "seed", description = "The seed to generate with", defaultValue = "12345") @Param(description = "The seed to generate with", defaultValue = "12345")
long seed long seed
){ ){
if (noGUI()) return; if (noGUI()) return;
@ -357,9 +313,9 @@ public class DecStudio implements DecreeExecutor {
@Decree(description = "Find any biome or region", aliases = {"goto", "g"}, origin = DecreeOrigin.PLAYER) @Decree(description = "Find any biome or region", aliases = {"goto", "g"}, origin = DecreeOrigin.PLAYER)
public void find( public void find(
@Param(name = "biome", description = "The biome to find") @Param(description = "The biome to find")
IrisBiome biome, IrisBiome biome,
@Param(name = "region", description = "The region to find") @Param(description = "The region to find")
IrisRegion region IrisRegion region
){ ){
if (!IrisToolbelt.isIrisWorld(world())){ if (!IrisToolbelt.isIrisWorld(world())){
@ -409,9 +365,9 @@ public class DecStudio implements DecreeExecutor {
@Decree(description = "Show loot if a chest were right here", origin = DecreeOrigin.PLAYER, sync = true) @Decree(description = "Show loot if a chest were right here", origin = DecreeOrigin.PLAYER, sync = true)
public void loot( public void loot(
@Param(name = "fast", aliases = "f", description = "Fast insertion of items in virtual inventory (may cause performance drop)", defaultValue = "false") @Param(description = "Fast insertion of items in virtual inventory (may cause performance drop)", defaultValue = "false")
boolean fast, boolean fast,
@Param(name = "add", aliases = "a", description = "Whether or not to append to the inventory currently open (if false, clears opened inventory)", defaultValue = "true") @Param(description = "Whether or not to append to the inventory currently open (if false, clears opened inventory)", defaultValue = "true")
boolean add boolean add
) { ) {
if (noStudio()) return; if (noStudio()) return;
@ -473,9 +429,9 @@ public class DecStudio implements DecreeExecutor {
Iris.proj.compilePackage(sender(), dimension.getLoadKey(), obfuscate, minify); Iris.proj.compilePackage(sender(), dimension.getLoadKey(), obfuscate, minify);
} }
@Decree(description = "Profiles a dimension's performance", origin = DecreeOrigin.PLAYER) @Decree(description = "Profiles the performance of a dimension", origin = DecreeOrigin.PLAYER)
public void profile( public void profile(
@Param(name = "dimension", description = "The dimension to profile", contextual = true) @Param(description = "The dimension to profile", contextual = true)
IrisDimension dimension IrisDimension dimension
){ ){
File pack = dimension.getLoadFile().getParentFile().getParentFile(); File pack = dimension.getLoadFile().getParentFile().getParentFile();
@ -663,7 +619,7 @@ public class DecStudio implements DecreeExecutor {
@Decree(description = "Summon an Iris Entity", origin = DecreeOrigin.PLAYER) @Decree(description = "Summon an Iris Entity", origin = DecreeOrigin.PLAYER)
public void summon( public void summon(
@Param(description = "The Iris Entity to spawn", name = "entity") @Param(description = "The Iris Entity to spawn")
IrisEntity entity IrisEntity entity
) { ) {
if (!sender().isPlayer()){ if (!sender().isPlayer()){
@ -697,7 +653,7 @@ public class DecStudio implements DecreeExecutor {
@Decree(description = "Update your dimension project") @Decree(description = "Update your dimension project")
public void update( public void update(
@Param(name = "dimension", description = "The dimension to update the workspace of", contextual = true) @Param(description = "The dimension to update the workspace of", contextual = true)
IrisDimension dimension IrisDimension dimension
){ ){
if (new IrisProject(dimension.getLoadFile().getParentFile().getParentFile()).updateWorkspace()) { if (new IrisProject(dimension.getLoadFile().getParentFile().getParentFile()).updateWorkspace()) {
@ -707,7 +663,6 @@ public class DecStudio implements DecreeExecutor {
} }
} }
/** /**
* @return true if server GUIs are not enabled * @return true if server GUIs are not enabled
*/ */
@ -737,4 +692,50 @@ public class DecStudio implements DecreeExecutor {
} }
return false; return false;
} }
public void files(File clean, KList<File> files)
{
if (clean.isDirectory()) {
for (File i : clean.listFiles()) {
files(i, files);
}
} else if (clean.getName().endsWith(".json")) {
try {
files.add(clean);
} catch (Throwable e) {
Iris.reportError(e);
Iris.error("Failed to beautify " + clean.getAbsolutePath() + " You may have errors in your json!");
}
}
}
private void fixBlocks(JSONObject obj) {
for (String i : obj.keySet()) {
Object o = obj.get(i);
if (i.equals("block") && o instanceof String && !o.toString().trim().isEmpty() && !o.toString().contains(":")) {
obj.put(i, "minecraft:" + o);
}
if (o instanceof JSONObject) {
fixBlocks((JSONObject) o);
} else if (o instanceof JSONArray) {
fixBlocks((JSONArray) o);
}
}
}
private void fixBlocks(JSONArray obj) {
for (int i = 0; i < obj.length(); i++) {
Object o = obj.get(i);
if (o instanceof JSONObject) {
fixBlocks((JSONObject) o);
} else if (o instanceof JSONArray) {
fixBlocks((JSONArray) o);
}
}
}
} }