From 85fbaa2b976dc267ef888e19f91bbb61cab3b8cc Mon Sep 17 00:00:00 2001 From: CocoTheOwner Date: Mon, 16 Aug 2021 23:17:17 +0200 Subject: [PATCH 1/5] Iris What --- .../command/what/CommandIrisWhatBlock.java | 29 ------ .../volmit/iris/core/decrees/DecStudio.java | 91 +++++++++++++++++++ .../com/volmit/iris/core/decrees/DecWhat.java | 59 ------------ 3 files changed, 91 insertions(+), 88 deletions(-) delete mode 100644 src/main/java/com/volmit/iris/core/decrees/DecWhat.java diff --git a/src/main/java/com/volmit/iris/core/command/what/CommandIrisWhatBlock.java b/src/main/java/com/volmit/iris/core/command/what/CommandIrisWhatBlock.java index 818d1ecb3..703356f31 100644 --- a/src/main/java/com/volmit/iris/core/command/what/CommandIrisWhatBlock.java +++ b/src/main/java/com/volmit/iris/core/command/what/CommandIrisWhatBlock.java @@ -55,36 +55,7 @@ public class CommandIrisWhatBlock extends MortarCommand { } if (bd != null) { - sender.sendMessage("Material: " + C.GREEN + bd.getMaterial().name()); - sender.sendMessage("Full: " + C.WHITE + bd.getAsString(true)); - if (B.isStorage(bd)) { - sender.sendMessage(C.YELLOW + "* Storage Block (Loot Capable)"); - } - - if (B.isLit(bd)) { - sender.sendMessage(C.YELLOW + "* Lit Block (Light Capable)"); - } - - if (B.isFoliage(bd)) { - sender.sendMessage(C.YELLOW + "* Foliage Block"); - } - - if (B.isDecorant(bd)) { - sender.sendMessage(C.YELLOW + "* Decorant Block"); - } - - if (B.isFluid(bd)) { - sender.sendMessage(C.YELLOW + "* Fluid Block"); - } - - if (B.isFoliagePlantable(bd)) { - sender.sendMessage(C.YELLOW + "* Plantable Foliage Block"); - } - - if (B.isSolid(bd)) { - sender.sendMessage(C.YELLOW + "* Solid Block"); - } } } else { sender.sendMessage("Players only."); diff --git a/src/main/java/com/volmit/iris/core/decrees/DecStudio.java b/src/main/java/com/volmit/iris/core/decrees/DecStudio.java index b53006d20..aa326ea9e 100644 --- a/src/main/java/com/volmit/iris/core/decrees/DecStudio.java +++ b/src/main/java/com/volmit/iris/core/decrees/DecStudio.java @@ -41,6 +41,7 @@ import com.volmit.iris.engine.object.objects.IrisObject; import com.volmit.iris.engine.object.regional.IrisRegion; import com.volmit.iris.util.collection.KList; import com.volmit.iris.util.collection.KMap; +import com.volmit.iris.util.data.B; import com.volmit.iris.util.decree.DecreeExecutor; import com.volmit.iris.util.decree.DecreeOrigin; import com.volmit.iris.util.decree.annotations.Decree; @@ -64,7 +65,11 @@ import com.volmit.iris.util.scheduling.jobs.JobCollection; import com.volmit.iris.util.scheduling.jobs.QueueJob; import com.volmit.iris.util.scheduling.jobs.SingleJob; import org.bukkit.Bukkit; +import org.bukkit.FluidCollisionMode; import org.bukkit.GameMode; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.data.BlockData; import org.bukkit.event.inventory.InventoryType; import org.bukkit.inventory.Inventory; @@ -663,6 +668,92 @@ public class DecStudio implements DecreeExecutor { } } + @Decree(description = "Get information about the world around you", origin = DecreeOrigin.PLAYER) + public void what( + @Param(description = "Whether or not to show dimension information", defaultValue = "true") + boolean dimension, + @Param(description = "Whether or not to show region information", defaultValue = "true") + boolean region, + @Param(description = "Whether or not to show biome information", defaultValue = "true") + boolean biome, + @Param(description = "Whether or not to show information about the block you are looking at", defaultValue = "true") + boolean look, + @Param(description = "Whether or not to show information about the block you are holding", defaultValue = "true") + boolean hand + ){ + // Data + BlockData handHeld = player().getInventory().getItemInMainHand().getType().createBlockData(); + Block targetBlock = player().getTargetBlockExact(128, FluidCollisionMode.NEVER); + BlockData targetBlockData; + if (targetBlock == null) { + targetBlockData = null; + } else { + targetBlockData = targetBlock.getBlockData(); + } + IrisBiome currentBiome = engine().getBiome(player().getLocation()); + IrisRegion currentRegion = engine().getRegion(player().getLocation()); + IrisDimension currentDimension = engine().getDimension(); + + // Biome, region & dimension + if (dimension) { + sender().sendMessage(C.GREEN + "" + C.BOLD + "Current dimension:" + C.RESET + "" + C.WHITE + currentDimension.getName()); + } + if (region) { + sender().sendMessage(C.GREEN + "" + C.BOLD + "Current region:" + C.RESET + "" + C.WHITE + currentRegion.getName()); + } + if (biome) { + sender().sendMessage(C.GREEN + "" + C.BOLD + "Current biome:" + C.RESET + "" + C.WHITE + currentBiome.getName()); + } + + // Target + if (targetBlockData == null){ + sender().sendMessage(C.RED + "Not looking at any block"); + } else if (look) { + sender().sendMessage(C.GREEN + "" + C.BOLD + "Looked-at block information"); + + sender().sendMessage("Material: " + C.GREEN + targetBlockData.getMaterial().name()); + sender().sendMessage("Full: " + C.WHITE + targetBlockData.getAsString(true)); + + if (B.isStorage(targetBlockData)) { + sender().sendMessage(C.YELLOW + "* Storage Block (Loot Capable)"); + } + + if (B.isLit(targetBlockData)) { + sender().sendMessage(C.YELLOW + "* Lit Block (Light Capable)"); + } + + if (B.isFoliage(targetBlockData)) { + sender().sendMessage(C.YELLOW + "* Foliage Block"); + } + + if (B.isDecorant(targetBlockData)) { + sender().sendMessage(C.YELLOW + "* Decorant Block"); + } + + if (B.isFluid(targetBlockData)) { + sender().sendMessage(C.YELLOW + "* Fluid Block"); + } + + if (B.isFoliagePlantable(targetBlockData)) { + sender().sendMessage(C.YELLOW + "* Plantable Foliage Block"); + } + + if (B.isSolid(targetBlockData)) { + sender().sendMessage(C.YELLOW + "* Solid Block"); + } + } + + // Hand-held + if (!handHeld.getMaterial().equals(Material.AIR)) { + sender().sendMessage(C.YELLOW + "No block held"); + } else if (hand) { + sender().sendMessage(C.GREEN + "" + C.BOLD + "Hand-held block information"); + + sender().sendMessage("Material: " + C.GREEN + handHeld.getMaterial().name()); + sender().sendMessage("Full: " + C.WHITE + handHeld.getAsString(true)); + } + } + /** * @return true if server GUIs are not enabled */ diff --git a/src/main/java/com/volmit/iris/core/decrees/DecWhat.java b/src/main/java/com/volmit/iris/core/decrees/DecWhat.java deleted file mode 100644 index 50e5815e8..000000000 --- a/src/main/java/com/volmit/iris/core/decrees/DecWhat.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.volmit.iris.core.decrees; - -import com.volmit.iris.Iris; -import com.volmit.iris.util.data.B; -import com.volmit.iris.util.decree.DecreeExecutor; -import com.volmit.iris.util.decree.DecreeOrigin; -import com.volmit.iris.util.decree.annotations.Decree; -import com.volmit.iris.util.format.C; -import org.bukkit.FluidCollisionMode; -import org.bukkit.block.Block; -import org.bukkit.block.data.BlockData; - -@Decree(name = "what", aliases = "?", description = "Get information about the world around you", origin = DecreeOrigin.PLAYER) -public class DecWhat implements DecreeExecutor { - - @Decree(description = "Get information about the block you're looking at") - public void block(){ - - Block b = player().getTargetBlockExact(128, FluidCollisionMode.NEVER); - - if (b == null) { - sender().sendMessage("Please look at any block, not at the sky"); - return; - } - - BlockData bd = b.getBlockData(); - - sender().sendMessage("Material: " + C.GREEN + bd.getMaterial().name()); - sender().sendMessage("Full: " + C.WHITE + bd.getAsString(true)); - - if (B.isStorage(bd)) { - sender().sendMessage(C.YELLOW + "* Storage Block (Loot Capable)"); - } - - if (B.isLit(bd)) { - sender().sendMessage(C.YELLOW + "* Lit Block (Light Capable)"); - } - - if (B.isFoliage(bd)) { - sender().sendMessage(C.YELLOW + "* Foliage Block"); - } - - if (B.isDecorant(bd)) { - sender().sendMessage(C.YELLOW + "* Decorant Block"); - } - - if (B.isFluid(bd)) { - sender().sendMessage(C.YELLOW + "* Fluid Block"); - } - - if (B.isFoliagePlantable(bd)) { - sender().sendMessage(C.YELLOW + "* Plantable Foliage Block"); - } - - if (B.isSolid(bd)) { - sender().sendMessage(C.YELLOW + "* Solid Block"); - } - } -} From fb50b4fa784c265484c9d50e7bc9d574c7e370c9 Mon Sep 17 00:00:00 2001 From: CocoTheOwner Date: Mon, 16 Aug 2021 23:17:41 +0200 Subject: [PATCH 2/5] oops --- .../command/what/CommandIrisWhatBlock.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/main/java/com/volmit/iris/core/command/what/CommandIrisWhatBlock.java b/src/main/java/com/volmit/iris/core/command/what/CommandIrisWhatBlock.java index 703356f31..818d1ecb3 100644 --- a/src/main/java/com/volmit/iris/core/command/what/CommandIrisWhatBlock.java +++ b/src/main/java/com/volmit/iris/core/command/what/CommandIrisWhatBlock.java @@ -55,7 +55,36 @@ public class CommandIrisWhatBlock extends MortarCommand { } if (bd != null) { + sender.sendMessage("Material: " + C.GREEN + bd.getMaterial().name()); + sender.sendMessage("Full: " + C.WHITE + bd.getAsString(true)); + if (B.isStorage(bd)) { + sender.sendMessage(C.YELLOW + "* Storage Block (Loot Capable)"); + } + + if (B.isLit(bd)) { + sender.sendMessage(C.YELLOW + "* Lit Block (Light Capable)"); + } + + if (B.isFoliage(bd)) { + sender.sendMessage(C.YELLOW + "* Foliage Block"); + } + + if (B.isDecorant(bd)) { + sender.sendMessage(C.YELLOW + "* Decorant Block"); + } + + if (B.isFluid(bd)) { + sender.sendMessage(C.YELLOW + "* Fluid Block"); + } + + if (B.isFoliagePlantable(bd)) { + sender.sendMessage(C.YELLOW + "* Plantable Foliage Block"); + } + + if (B.isSolid(bd)) { + sender.sendMessage(C.YELLOW + "* Solid Block"); + } } } else { sender.sendMessage("Players only."); From 6d363235a579482daf016667e0ccce45de7396e5 Mon Sep 17 00:00:00 2001 From: CocoTheOwner Date: Mon, 16 Aug 2021 23:17:51 +0200 Subject: [PATCH 3/5] oops 2 --- src/main/java/com/volmit/iris/core/decrees/DecIris.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/com/volmit/iris/core/decrees/DecIris.java b/src/main/java/com/volmit/iris/core/decrees/DecIris.java index 2820c75bb..7ef069ddf 100644 --- a/src/main/java/com/volmit/iris/core/decrees/DecIris.java +++ b/src/main/java/com/volmit/iris/core/decrees/DecIris.java @@ -37,8 +37,6 @@ public class DecIris implements DecreeExecutor private DecPregen pregen; - private DecWhat what; - @Decree(description = "Create a new world", aliases = "+") public void create( @Param(aliases = "world-name", description = "The name of the world to create", defaultValue = "IrisWorld") From e3948eb4ba71d12bae960b98defa584fb743b3af Mon Sep 17 00:00:00 2001 From: CocoTheOwner Date: Mon, 16 Aug 2021 23:47:29 +0200 Subject: [PATCH 4/5] bunch of defaults --- .../java/com/volmit/iris/core/decrees/DecIris.java | 8 ++++---- .../java/com/volmit/iris/core/decrees/DecStudio.java | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/volmit/iris/core/decrees/DecIris.java b/src/main/java/com/volmit/iris/core/decrees/DecIris.java index 7ef069ddf..e147490d9 100644 --- a/src/main/java/com/volmit/iris/core/decrees/DecIris.java +++ b/src/main/java/com/volmit/iris/core/decrees/DecIris.java @@ -82,11 +82,11 @@ public class DecIris implements DecreeExecutor @Decree(description = "Set aura spins") public void aura( - @Param(description = "The h color value") + @Param(description = "The h color value", defaultValue = "-20") int h, - @Param(description = "The s color value") + @Param(description = "The s color value", defaultValue = "7") int s, - @Param(description = "The b color value") + @Param(description = "The b color value", defaultValue = "8") int b ) { IrisSettings.get().getGeneral().setSpinh(h); @@ -135,7 +135,7 @@ public class DecIris implements DecreeExecutor String pack, @Param(name = "branch", description = "The branch to download from", defaultValue = "master") String branch, - @Param(name = "trim", description = "Whether or not to download a trimmed version (do not enable when you're going to edit)") + @Param(name = "trim", description = "Whether or not to download a trimmed version (do not enable when editing)", defaultValue = "false") boolean trim, @Param(name = "overwrite", description = "Whether or not to overwrite the pack with the downloaded one", aliases = "force", defaultValue = "false") boolean overwrite diff --git a/src/main/java/com/volmit/iris/core/decrees/DecStudio.java b/src/main/java/com/volmit/iris/core/decrees/DecStudio.java index aa326ea9e..4682ae5e1 100644 --- a/src/main/java/com/volmit/iris/core/decrees/DecStudio.java +++ b/src/main/java/com/volmit/iris/core/decrees/DecStudio.java @@ -318,9 +318,9 @@ public class DecStudio implements DecreeExecutor { @Decree(description = "Find any biome or region", aliases = {"goto", "g"}, origin = DecreeOrigin.PLAYER) public void find( - @Param(description = "The biome to find") + @Param(description = "The biome to find", contextual = true) IrisBiome biome, - @Param(description = "The region to find") + @Param(description = "The region to find", contextual = true) IrisRegion region ){ if (!IrisToolbelt.isIrisWorld(world())){ @@ -424,7 +424,7 @@ public class DecStudio implements DecreeExecutor { @Decree(description = "Package a dimension into a compressed format", aliases = "package") public void pkg( - @Param(name = "dimension", description = "The dimension pack to compress", contextual = true) + @Param(name = "dimension", description = "The dimension pack to compress", contextual = true, defaultValue = "overworld") IrisDimension dimension, @Param(name = "obfuscate", description = "Whether or not to obfuscate the pack", defaultValue = "false") boolean obfuscate, @@ -436,7 +436,7 @@ public class DecStudio implements DecreeExecutor { @Decree(description = "Profiles the performance of a dimension", origin = DecreeOrigin.PLAYER) public void profile( - @Param(description = "The dimension to profile", contextual = true) + @Param(description = "The dimension to profile", contextual = true, defaultValue = "overworld") IrisDimension dimension ){ File pack = dimension.getLoadFile().getParentFile().getParentFile(); @@ -658,7 +658,7 @@ public class DecStudio implements DecreeExecutor { @Decree(description = "Update your dimension project") public void update( - @Param(description = "The dimension to update the workspace of", contextual = true) + @Param(description = "The dimension to update the workspace of", contextual = true, defaultValue = "overworld") IrisDimension dimension ){ if (new IrisProject(dimension.getLoadFile().getParentFile().getParentFile()).updateWorkspace()) { From 89e372c229c4625f4fd529092b1593ae34a6937a Mon Sep 17 00:00:00 2001 From: CocoTheOwner Date: Mon, 16 Aug 2021 23:54:11 +0200 Subject: [PATCH 5/5] More info for decree --- src/main/java/com/volmit/iris/util/plugin/VolmitSender.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/volmit/iris/util/plugin/VolmitSender.java b/src/main/java/com/volmit/iris/util/plugin/VolmitSender.java index 9fb389ac9..5d98877db 100644 --- a/src/main/java/com/volmit/iris/util/plugin/VolmitSender.java +++ b/src/main/java/com/volmit/iris/util/plugin/VolmitSender.java @@ -459,7 +459,9 @@ public class VolmitSender implements CommandSender { ? "<#db4321>⚠ <#faa796>This parameter is required." : (f.hasDefault() ? "<#2181db>✔ <#78dcf0>Defaults to \""+f.getParam().defaultValue()+"\" if undefined." - : "<#a73abd>✔ <#78dcf0>This parameter is optional.")) + : "<#a73abd>✔ <#78dcf0>This parameter is optional.")) + "\n" + + (f.isContextual() ? "<#ff9900>➱ <#ffcc00>The value may be derived from environment context \n" : "") + + "<#cc00ff>✢ <#ff33cc>This parameter is of type " + f.getType().getSimpleName() + "\n" + "'>" + (f.isRequired() ? "[" : "") + "" + f.getName()