mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 10:12:53 +00:00
Iris What
This commit is contained in:
parent
1440453640
commit
85fbaa2b97
@ -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.");
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user