mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-30 04:29:05 +00:00
Oh the commands
This commit is contained in:
@@ -10,6 +10,15 @@ public class CommandIris extends MortarCommand
|
||||
@Command
|
||||
private CommandIrisStudio studio;
|
||||
|
||||
@Command
|
||||
private CommandIrisWorld world;
|
||||
|
||||
@Command
|
||||
private CommandIrisWhat what;
|
||||
|
||||
@Command
|
||||
private CommandIrisObject object;
|
||||
|
||||
public CommandIris()
|
||||
{
|
||||
super("iris", "ir", "irs");
|
||||
|
||||
135
src/main/java/com/volmit/iris/command/CommandIrisGoto.java
Normal file
135
src/main/java/com/volmit/iris/command/CommandIrisGoto.java
Normal file
@@ -0,0 +1,135 @@
|
||||
package com.volmit.iris.command;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.generator.IrisChunkGenerator;
|
||||
import com.volmit.iris.object.IrisBiome;
|
||||
import com.volmit.iris.util.RNG;
|
||||
|
||||
public class CommandIrisGoto extends MortarCommand
|
||||
{
|
||||
public CommandIrisGoto()
|
||||
{
|
||||
super("goto", "find");
|
||||
setDescription("Find any biome or a biome border");
|
||||
requiresPermission(Iris.perm.studio);
|
||||
setCategory("World");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(MortarSender sender, String[] args)
|
||||
{
|
||||
if(args.length <= 1)
|
||||
{
|
||||
sender.sendMessage("/iris world goto " + getArgsUsage());
|
||||
return true;
|
||||
}
|
||||
|
||||
if(sender.isPlayer())
|
||||
{
|
||||
Player p = sender.player();
|
||||
World world = p.getWorld();
|
||||
|
||||
if(!(world.getGenerator() instanceof IrisChunkGenerator))
|
||||
{
|
||||
sender.sendMessage("You must be in an iris world.");
|
||||
return true;
|
||||
}
|
||||
|
||||
IrisChunkGenerator g = (IrisChunkGenerator) world.getGenerator();
|
||||
int tries = 10000;
|
||||
boolean cave = false;
|
||||
IrisBiome biome2 = null;
|
||||
if(args.length > 2)
|
||||
{
|
||||
if(args[2].equalsIgnoreCase("-cave"))
|
||||
{
|
||||
cave = true;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
biome2 = Iris.data.getBiomeLoader().load(args[2]);
|
||||
|
||||
if(biome2 == null)
|
||||
{
|
||||
sender.sendMessage(args[2] + " is not a biome. Use the file name (without extension)");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(String i : args)
|
||||
{
|
||||
if(i.equalsIgnoreCase("-cave"))
|
||||
{
|
||||
cave = true;
|
||||
}
|
||||
}
|
||||
|
||||
IrisBiome biome = Iris.data.getBiomeLoader().load(args[1]);
|
||||
|
||||
if(biome == null)
|
||||
{
|
||||
sender.sendMessage(args[1] + " is not a biome. Use the file name (without extension)");
|
||||
return true;
|
||||
}
|
||||
|
||||
while(tries > 0)
|
||||
{
|
||||
tries--;
|
||||
|
||||
int xx = (int) (RNG.r.i(-29999970, 29999970));
|
||||
int zz = (int) (RNG.r.i(-29999970, 29999970));
|
||||
if((cave ? g.sampleCaveBiome(xx, zz) : g.sampleTrueBiome(xx, zz)).getBiome().getLoadKey().equals(biome.getLoadKey()))
|
||||
{
|
||||
if(biome2 != null)
|
||||
{
|
||||
for(int i = 0; i < 64; i++)
|
||||
{
|
||||
int ax = xx + RNG.r.i(-64, 32);
|
||||
int az = zz + RNG.r.i(-64, 32);
|
||||
|
||||
if((cave ? g.sampleCaveBiome(ax, az) : g.sampleTrueBiome(ax, az)).getBiome().getLoadKey().equals(biome2.getLoadKey()))
|
||||
{
|
||||
tries--;
|
||||
p.teleport(new Location(world, xx, world.getHighestBlockYAt(xx, zz), zz));
|
||||
sender.sendMessage("Found border in " + (10000 - tries) + " tries!");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
p.teleport(new Location(world, xx, world.getHighestBlockYAt(xx, zz), zz));
|
||||
sender.sendMessage("Found in " + (10000 - tries) + " tries!");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sender.sendMessage("Tried to find " + biome.getName() + " looked in 10,000 places no dice.");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
sender.sendMessage("Players only.");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getArgsUsage()
|
||||
{
|
||||
return "[biome] [otherbiome] [-cave]";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.volmit.iris.command;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.IrisMetrics;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.generator.IrisChunkGenerator;
|
||||
import com.volmit.iris.util.Form;
|
||||
|
||||
public class CommandIrisMetrics extends MortarCommand
|
||||
{
|
||||
public CommandIrisMetrics()
|
||||
{
|
||||
super("metrics", "stats", "mt");
|
||||
setDescription("Get timings for this world");
|
||||
requiresPermission(Iris.perm.studio);
|
||||
setCategory("Metrics");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(MortarSender sender, String[] args)
|
||||
{
|
||||
if(sender.isPlayer())
|
||||
{
|
||||
Player p = (Player) sender;
|
||||
World world = p.getWorld();
|
||||
IrisChunkGenerator g = (IrisChunkGenerator) world.getGenerator();
|
||||
IrisMetrics m = g.getMetrics();
|
||||
sender.sendMessage("Thread Count: " + ChatColor.BOLD + "" + ChatColor.WHITE + g.getThreads());
|
||||
sender.sendMessage("Total : " + ChatColor.BOLD + "" + ChatColor.WHITE + Form.duration(m.getTotal().getAverage(), 2));
|
||||
sender.sendMessage(" Terrain : " + ChatColor.BOLD + "" + ChatColor.WHITE + Form.duration(m.getTerrain().getAverage(), 2));
|
||||
sender.sendMessage(" Parallax: " + ChatColor.BOLD + "" + ChatColor.WHITE + Form.duration(m.getParallax().getAverage(), 2));
|
||||
sender.sendMessage(" Post : " + ChatColor.BOLD + "" + ChatColor.WHITE + Form.duration(m.getPost().getAverage(), 2));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
sender.sendMessage("Players only.");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getArgsUsage()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
61
src/main/java/com/volmit/iris/command/CommandIrisObject.java
Normal file
61
src/main/java/com/volmit/iris/command/CommandIrisObject.java
Normal file
@@ -0,0 +1,61 @@
|
||||
package com.volmit.iris.command;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.command.util.Command;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
|
||||
public class CommandIrisObject extends MortarCommand
|
||||
{
|
||||
@Command
|
||||
private CommandIrisObjectWand wand;
|
||||
|
||||
@Command
|
||||
private CommandIrisObjectXPY xpy;
|
||||
|
||||
@Command
|
||||
private CommandIrisObjectXAY xay;
|
||||
|
||||
@Command
|
||||
private CommandIrisObjectShift shift;
|
||||
|
||||
@Command
|
||||
private CommandIrisObjectExpand expand;
|
||||
|
||||
@Command
|
||||
private CommandIrisObjectContract contract;
|
||||
|
||||
@Command
|
||||
private CommandIrisObjectP1 p1;
|
||||
|
||||
@Command
|
||||
private CommandIrisObjectP2 p2;
|
||||
|
||||
@Command
|
||||
private CommandIrisObjectSave save;
|
||||
|
||||
@Command
|
||||
private CommandIrisObjectPaste paste;
|
||||
|
||||
public CommandIrisObject()
|
||||
{
|
||||
super("object", "iob", "o");
|
||||
requiresPermission(Iris.perm);
|
||||
setCategory("Object");
|
||||
setDescription("Object Commands");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(MortarSender sender, String[] args)
|
||||
{
|
||||
sender.sendMessage("Iris Object Commands");
|
||||
printHelp(sender);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getArgsUsage()
|
||||
{
|
||||
return "[subcommand]";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.volmit.iris.command;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.util.Cuboid;
|
||||
import com.volmit.iris.util.Direction;
|
||||
import com.volmit.iris.wand.WandController;
|
||||
|
||||
public class CommandIrisObjectContract extends MortarCommand
|
||||
{
|
||||
public CommandIrisObjectContract()
|
||||
{
|
||||
super("-");
|
||||
requiresPermission(Iris.perm);
|
||||
setCategory("Object");
|
||||
setDescription("Contract a selection based on your lookign direction");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(MortarSender sender, String[] args)
|
||||
{
|
||||
if(!sender.isPlayer())
|
||||
{
|
||||
sender.sendMessage("You don't have a wand");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player p = sender.player();
|
||||
|
||||
if(!WandController.isWand(p))
|
||||
{
|
||||
sender.sendMessage("Ready your Wand.");
|
||||
return true;
|
||||
}
|
||||
|
||||
int amt = Integer.valueOf(args[2]);
|
||||
Location[] b = WandController.getCuboid(p.getInventory().getItemInMainHand());
|
||||
Location a1 = b[0].clone();
|
||||
Location a2 = b[1].clone();
|
||||
Cuboid cursor = new Cuboid(a1, a2);
|
||||
Direction d = Direction.closest(p.getLocation().getDirection()).reverse();
|
||||
cursor = cursor.expand(d, -amt);
|
||||
b[0] = cursor.getLowerNE();
|
||||
b[1] = cursor.getUpperSW();
|
||||
p.getInventory().setItemInMainHand(WandController.createWand(b[0], b[1]));
|
||||
p.updateInventory();
|
||||
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_FRAME_ROTATE_ITEM, 1f, 0.55f);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getArgsUsage()
|
||||
{
|
||||
return "[amt]";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.volmit.iris.command;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.util.Cuboid;
|
||||
import com.volmit.iris.util.Direction;
|
||||
import com.volmit.iris.wand.WandController;
|
||||
|
||||
public class CommandIrisObjectExpand extends MortarCommand
|
||||
{
|
||||
public CommandIrisObjectExpand()
|
||||
{
|
||||
super("+");
|
||||
requiresPermission(Iris.perm);
|
||||
setCategory("Object");
|
||||
setDescription("Expand based on looking direction");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(MortarSender sender, String[] args)
|
||||
{
|
||||
if(!sender.isPlayer())
|
||||
{
|
||||
sender.sendMessage("You don't have a wand");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player p = sender.player();
|
||||
|
||||
if(!WandController.isWand(p))
|
||||
{
|
||||
sender.sendMessage("Ready your Wand.");
|
||||
return true;
|
||||
}
|
||||
|
||||
int amt = Integer.valueOf(args[2]);
|
||||
Location[] b = WandController.getCuboid(p.getInventory().getItemInMainHand());
|
||||
Location a1 = b[0].clone();
|
||||
Location a2 = b[1].clone();
|
||||
Cuboid cursor = new Cuboid(a1, a2);
|
||||
Direction d = Direction.closest(p.getLocation().getDirection()).reverse();
|
||||
cursor = cursor.expand(d, amt);
|
||||
b[0] = cursor.getLowerNE();
|
||||
b[1] = cursor.getUpperSW();
|
||||
p.getInventory().setItemInMainHand(WandController.createWand(b[0], b[1]));
|
||||
p.updateInventory();
|
||||
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_FRAME_ROTATE_ITEM, 1f, 0.55f);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getArgsUsage()
|
||||
{
|
||||
return "[amt]";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.volmit.iris.command;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.wand.WandController;
|
||||
|
||||
public class CommandIrisObjectP1 extends MortarCommand
|
||||
{
|
||||
public CommandIrisObjectP1()
|
||||
{
|
||||
super("p1");
|
||||
requiresPermission(Iris.perm);
|
||||
setCategory("Object");
|
||||
setDescription("Set point 1 to pos (or look)");
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public boolean handle(MortarSender sender, String[] args)
|
||||
{
|
||||
if(!sender.isPlayer())
|
||||
{
|
||||
sender.sendMessage("You don't have a wand");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player p = sender.player();
|
||||
|
||||
if(!WandController.isWand(p))
|
||||
{
|
||||
sender.sendMessage("Ready your Wand.");
|
||||
return true;
|
||||
}
|
||||
|
||||
ItemStack wand = p.getInventory().getItemInMainHand();
|
||||
|
||||
if(WandController.isWand(wand))
|
||||
{
|
||||
Location[] g = WandController.getCuboid(wand);
|
||||
g[0] = p.getLocation().getBlock().getLocation().clone().add(0, -1, 0);
|
||||
|
||||
if(args.length == 1 && args[0].equals("-l"))
|
||||
{
|
||||
g[0] = p.getTargetBlock((Set<Material>) null, 256).getLocation().clone();
|
||||
}
|
||||
|
||||
p.setItemInHand(WandController.createWand(g[0], g[1]));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getArgsUsage()
|
||||
{
|
||||
return "[-l]";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.volmit.iris.command;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.wand.WandController;
|
||||
|
||||
public class CommandIrisObjectP2 extends MortarCommand
|
||||
{
|
||||
public CommandIrisObjectP2()
|
||||
{
|
||||
super("p2");
|
||||
requiresPermission(Iris.perm);
|
||||
setCategory("Object");
|
||||
setDescription("Set point 1 to pos (or look)");
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public boolean handle(MortarSender sender, String[] args)
|
||||
{
|
||||
if(!sender.isPlayer())
|
||||
{
|
||||
sender.sendMessage("You don't have a wand");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player p = sender.player();
|
||||
|
||||
if(!WandController.isWand(p))
|
||||
{
|
||||
sender.sendMessage("Ready your Wand.");
|
||||
return true;
|
||||
}
|
||||
|
||||
ItemStack wand = p.getInventory().getItemInMainHand();
|
||||
|
||||
if(WandController.isWand(wand))
|
||||
{
|
||||
Location[] g = WandController.getCuboid(wand);
|
||||
g[1] = p.getLocation().getBlock().getLocation().clone().add(0, -1, 0);
|
||||
|
||||
if(args.length == 1 && args[0].equals("-l"))
|
||||
{
|
||||
g[1] = p.getTargetBlock((Set<Material>) null, 256).getLocation().clone();
|
||||
}
|
||||
|
||||
p.setItemInHand(WandController.createWand(g[0], g[1]));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getArgsUsage()
|
||||
{
|
||||
return "[-l]";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.volmit.iris.command;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.object.IrisObject;
|
||||
import com.volmit.iris.wand.WandController;
|
||||
|
||||
public class CommandIrisObjectPaste extends MortarCommand
|
||||
{
|
||||
public CommandIrisObjectPaste()
|
||||
{
|
||||
super("paste", "pasta");
|
||||
requiresPermission(Iris.perm);
|
||||
setCategory("Object");
|
||||
setDescription("Paste an object");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(MortarSender sender, String[] args)
|
||||
{
|
||||
if(!sender.isPlayer())
|
||||
{
|
||||
sender.sendMessage("You don't have a wand");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player p = sender.player();
|
||||
File file = new File(Iris.instance.getDataFolder(), "objects/" + args[1] + ".iob");
|
||||
boolean intoWand = false;
|
||||
|
||||
for(String i : args)
|
||||
{
|
||||
if(i.equalsIgnoreCase("-edit"))
|
||||
{
|
||||
intoWand = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!file.exists())
|
||||
{
|
||||
sender.sendMessage("Can't find " + "objects/" + args[1] + ".iob");
|
||||
}
|
||||
|
||||
ItemStack wand = ((Player) sender).getInventory().getItemInMainHand();
|
||||
IrisObject o = new IrisObject(0, 0, 0);
|
||||
|
||||
try
|
||||
{
|
||||
o.read(new File(Iris.instance.getDataFolder(), "objects/" + args[1] + ".iob"));
|
||||
sender.sendMessage("Loaded " + "objects/" + args[1] + ".iob");
|
||||
|
||||
((Player) sender).getWorld().playSound(((Player) sender).getLocation(), Sound.BLOCK_ENCHANTMENT_TABLE_USE, 1f, 1.5f);
|
||||
Location block = ((Player) sender).getTargetBlock((Set<Material>) null, 256).getLocation().clone().add(0, 1, 0);
|
||||
|
||||
if(intoWand && WandController.isWand(wand))
|
||||
{
|
||||
wand = WandController.createWand(block.clone().subtract(o.getCenter()).add(o.getW() - 1, o.getH(), o.getD() - 1), block.clone().subtract(o.getCenter()));
|
||||
p.getInventory().setItemInMainHand(wand);
|
||||
sender.sendMessage("Updated wand for " + "objects/" + args[1] + ".iob");
|
||||
}
|
||||
|
||||
WandController.pasteSchematic(o, block);
|
||||
sender.sendMessage("Placed " + "objects/" + args[1] + ".iob");
|
||||
}
|
||||
|
||||
catch(IOException e)
|
||||
{
|
||||
sender.sendMessage("Failed to load " + "objects/" + args[1] + ".iob");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getArgsUsage()
|
||||
{
|
||||
return "[name] [-edit]";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.volmit.iris.command;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.object.IrisObject;
|
||||
import com.volmit.iris.wand.WandController;
|
||||
|
||||
public class CommandIrisObjectSave extends MortarCommand
|
||||
{
|
||||
public CommandIrisObjectSave()
|
||||
{
|
||||
super("save");
|
||||
requiresPermission(Iris.perm);
|
||||
setCategory("Object");
|
||||
setDescription("Save an object");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(MortarSender sender, String[] args)
|
||||
{
|
||||
if(!sender.isPlayer())
|
||||
{
|
||||
sender.sendMessage("You don't have a wand");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player p = sender.player();
|
||||
ItemStack wand = p.getInventory().getItemInMainHand();
|
||||
IrisObject o = WandController.createSchematic(wand);
|
||||
|
||||
try
|
||||
{
|
||||
o.write(new File(Iris.instance.getDataFolder(), "objects/" + args[1] + ".iob"));
|
||||
sender.sendMessage("Saved " + "objects/" + args[1] + ".iob");
|
||||
p.getWorld().playSound(p.getLocation(), Sound.BLOCK_ENCHANTMENT_TABLE_USE, 1f, 1.5f);
|
||||
}
|
||||
|
||||
catch(IOException e)
|
||||
{
|
||||
sender.sendMessage("Failed to save " + "objects/" + args[1] + ".iob. Are you holding your wand?");
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getArgsUsage()
|
||||
{
|
||||
return "[name]";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.volmit.iris.command;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.util.Cuboid;
|
||||
import com.volmit.iris.util.Direction;
|
||||
import com.volmit.iris.wand.WandController;
|
||||
|
||||
public class CommandIrisObjectShift extends MortarCommand
|
||||
{
|
||||
public CommandIrisObjectShift()
|
||||
{
|
||||
super(">");
|
||||
requiresPermission(Iris.perm);
|
||||
setCategory("Object");
|
||||
setDescription("Shift selection based on direction");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(MortarSender sender, String[] args)
|
||||
{
|
||||
if(!sender.isPlayer())
|
||||
{
|
||||
sender.sendMessage("You don't have a wand");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player p = sender.player();
|
||||
|
||||
if(!WandController.isWand(p))
|
||||
{
|
||||
sender.sendMessage("Ready your Wand.");
|
||||
return true;
|
||||
}
|
||||
|
||||
int amt = Integer.valueOf(args[2]);
|
||||
Location[] b = WandController.getCuboid(p.getInventory().getItemInMainHand());
|
||||
Location a1 = b[0].clone();
|
||||
Location a2 = b[1].clone();
|
||||
Direction d = Direction.closest(p.getLocation().getDirection()).reverse();
|
||||
a1.add(d.toVector().multiply(amt));
|
||||
a2.add(d.toVector().multiply(amt));
|
||||
Cuboid cursor = new Cuboid(a1, a2);
|
||||
b[0] = cursor.getLowerNE();
|
||||
b[1] = cursor.getUpperSW();
|
||||
p.getInventory().setItemInMainHand(WandController.createWand(b[0], b[1]));
|
||||
p.updateInventory();
|
||||
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_FRAME_ROTATE_ITEM, 1f, 0.55f);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getArgsUsage()
|
||||
{
|
||||
return "[amt]";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.volmit.iris.command;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.wand.WandController;
|
||||
|
||||
public class CommandIrisObjectWand extends MortarCommand
|
||||
{
|
||||
public CommandIrisObjectWand()
|
||||
{
|
||||
super("wand", "w");
|
||||
requiresPermission(Iris.perm);
|
||||
setCategory("Object");
|
||||
setDescription("Get an Iris Wand for selecting objects");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(MortarSender sender, String[] args)
|
||||
{
|
||||
if(!sender.isPlayer())
|
||||
{
|
||||
sender.sendMessage("You don't have an inventory");
|
||||
return true;
|
||||
}
|
||||
|
||||
sender.player().getInventory().addItem(WandController.createWand());
|
||||
sender.player().playSound(sender.player().getLocation(), Sound.ITEM_ARMOR_EQUIP_NETHERITE, 1f, 1.5f);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getArgsUsage()
|
||||
{
|
||||
return "[subcommand]";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.volmit.iris.command;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.util.Cuboid;
|
||||
import com.volmit.iris.util.Cuboid.CuboidDirection;
|
||||
import com.volmit.iris.wand.WandController;
|
||||
|
||||
public class CommandIrisObjectXAY extends MortarCommand
|
||||
{
|
||||
public CommandIrisObjectXAY()
|
||||
{
|
||||
super("x&y");
|
||||
requiresPermission(Iris.perm);
|
||||
setCategory("Object");
|
||||
setDescription("Auto select up, down and out");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(MortarSender sender, String[] args)
|
||||
{
|
||||
if(!sender.isPlayer())
|
||||
{
|
||||
sender.sendMessage("You don't have a wand");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player p = sender.player();
|
||||
|
||||
if(!WandController.isWand(p))
|
||||
{
|
||||
sender.sendMessage("Ready your Wand.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Location[] b = WandController.getCuboid(p.getInventory().getItemInMainHand());
|
||||
Location a1 = b[0].clone();
|
||||
Location a2 = b[1].clone();
|
||||
Location a1x = b[0].clone();
|
||||
Location a2x = b[1].clone();
|
||||
Cuboid cursor = new Cuboid(a1, a2);
|
||||
Cuboid cursorx = new Cuboid(a1, a2);
|
||||
|
||||
while(!cursor.containsOnly(Material.AIR))
|
||||
{
|
||||
a1.add(new Vector(0, 1, 0));
|
||||
a2.add(new Vector(0, 1, 0));
|
||||
cursor = new Cuboid(a1, a2);
|
||||
}
|
||||
|
||||
a1.add(new Vector(0, -1, 0));
|
||||
a2.add(new Vector(0, -1, 0));
|
||||
|
||||
while(!cursorx.containsOnly(Material.AIR))
|
||||
{
|
||||
a1x.add(new Vector(0, -1, 0));
|
||||
a2x.add(new Vector(0, -1, 0));
|
||||
cursorx = new Cuboid(a1x, a2x);
|
||||
}
|
||||
|
||||
a1x.add(new Vector(0, 1, 0));
|
||||
a2x.add(new Vector(0, 1, 0));
|
||||
b[0] = a1;
|
||||
b[1] = a2x;
|
||||
cursor = new Cuboid(b[0], b[1]);
|
||||
cursor = cursor.contract(CuboidDirection.North);
|
||||
cursor = cursor.contract(CuboidDirection.South);
|
||||
cursor = cursor.contract(CuboidDirection.East);
|
||||
cursor = cursor.contract(CuboidDirection.West);
|
||||
b[0] = cursor.getLowerNE();
|
||||
b[1] = cursor.getUpperSW();
|
||||
p.getInventory().setItemInMainHand(WandController.createWand(b[0], b[1]));
|
||||
p.updateInventory();
|
||||
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_FRAME_ROTATE_ITEM, 1f, 0.55f);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getArgsUsage()
|
||||
{
|
||||
return "[subcommand]";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.volmit.iris.command;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.util.Cuboid;
|
||||
import com.volmit.iris.util.Cuboid.CuboidDirection;
|
||||
import com.volmit.iris.wand.WandController;
|
||||
|
||||
public class CommandIrisObjectXPY extends MortarCommand
|
||||
{
|
||||
public CommandIrisObjectXPY()
|
||||
{
|
||||
super("x+y");
|
||||
requiresPermission(Iris.perm);
|
||||
setCategory("Object");
|
||||
setDescription("Auto select up and out");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(MortarSender sender, String[] args)
|
||||
{
|
||||
if(!sender.isPlayer())
|
||||
{
|
||||
sender.sendMessage("You don't have a wand");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player p = sender.player();
|
||||
|
||||
if(!WandController.isWand(p))
|
||||
{
|
||||
sender.sendMessage("Ready your Wand.");
|
||||
return true;
|
||||
}
|
||||
Location[] b = WandController.getCuboid(p.getInventory().getItemInMainHand());
|
||||
b[0].add(new Vector(0, 1, 0));
|
||||
b[1].add(new Vector(0, 1, 0));
|
||||
Location a1 = b[0].clone();
|
||||
Location a2 = b[1].clone();
|
||||
Cuboid cursor = new Cuboid(a1, a2);
|
||||
|
||||
while(!cursor.containsOnly(Material.AIR))
|
||||
{
|
||||
a1.add(new Vector(0, 1, 0));
|
||||
a2.add(new Vector(0, 1, 0));
|
||||
cursor = new Cuboid(a1, a2);
|
||||
}
|
||||
|
||||
a1.add(new Vector(0, -1, 0));
|
||||
a2.add(new Vector(0, -1, 0));
|
||||
b[0] = a1;
|
||||
a2 = b[1];
|
||||
cursor = new Cuboid(a1, a2);
|
||||
cursor = cursor.contract(CuboidDirection.North);
|
||||
cursor = cursor.contract(CuboidDirection.South);
|
||||
cursor = cursor.contract(CuboidDirection.East);
|
||||
cursor = cursor.contract(CuboidDirection.West);
|
||||
b[0] = cursor.getLowerNE();
|
||||
b[1] = cursor.getUpperSW();
|
||||
p.getInventory().setItemInMainHand(WandController.createWand(b[0], b[1]));
|
||||
p.updateInventory();
|
||||
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_FRAME_ROTATE_ITEM, 1f, 0.55f);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getArgsUsage()
|
||||
{
|
||||
return "[subcommand]";
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,9 @@ public class CommandIrisStudio extends MortarCommand
|
||||
@Command
|
||||
private CommandIrisStudioClose close;
|
||||
|
||||
@Command
|
||||
private CommandIrisStudioPackage pkg;
|
||||
|
||||
@Command
|
||||
private CommandIrisStudioList list;
|
||||
|
||||
@@ -23,6 +26,7 @@ public class CommandIrisStudio extends MortarCommand
|
||||
{
|
||||
super("studio", "std");
|
||||
requiresPermission(Iris.perm.studio);
|
||||
setCategory("Studio");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,6 +15,7 @@ public class CommandIrisStudioClose extends MortarCommand
|
||||
super("close", "x");
|
||||
requiresPermission(Iris.perm.studio);
|
||||
setDescription("Close the existing dimension");
|
||||
setCategory("Studio");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -27,6 +27,7 @@ public class CommandIrisStudioCreate extends MortarCommand
|
||||
super("create", "new");
|
||||
requiresPermission(Iris.perm.studio);
|
||||
setDescription("Create a new project & open it.");
|
||||
setCategory("Studio");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -14,6 +14,7 @@ public class CommandIrisStudioList extends MortarCommand
|
||||
super("list", "l");
|
||||
requiresPermission(Iris.perm.studio);
|
||||
setDescription("List projects that can be opened.");
|
||||
setCategory("Studio");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,6 +11,7 @@ public class CommandIrisStudioOpen extends MortarCommand
|
||||
super("open", "o");
|
||||
requiresPermission(Iris.perm.studio);
|
||||
setDescription("Create a new temporary world to design a dimension.");
|
||||
setCategory("Studio");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
package com.volmit.iris.command;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.zeroturnaround.zip.ZipUtil;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.object.IrisBiome;
|
||||
import com.volmit.iris.object.IrisDimension;
|
||||
import com.volmit.iris.object.IrisGenerator;
|
||||
import com.volmit.iris.object.IrisObjectPlacement;
|
||||
import com.volmit.iris.object.IrisRegion;
|
||||
import com.volmit.iris.util.IO;
|
||||
import com.volmit.iris.util.J;
|
||||
import com.volmit.iris.util.JSONObject;
|
||||
import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.KMap;
|
||||
import com.volmit.iris.util.KSet;
|
||||
|
||||
public class CommandIrisStudioPackage extends MortarCommand
|
||||
{
|
||||
public CommandIrisStudioPackage()
|
||||
{
|
||||
super("package", "pkg");
|
||||
requiresPermission(Iris.perm.studio);
|
||||
setDescription("Package your dimension into a compressed format.");
|
||||
setCategory("Studio");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(MortarSender sender, String[] args)
|
||||
{
|
||||
|
||||
J.a(() ->
|
||||
{
|
||||
String dim = "overworld";
|
||||
|
||||
if(args.length > 1)
|
||||
{
|
||||
dim = args[1];
|
||||
}
|
||||
|
||||
String dimm = dim;
|
||||
IrisDimension dimension = Iris.data.getDimensionLoader().load(dimm);
|
||||
File folder = new File(Iris.instance.getDataFolder(), "exports/" + dimension.getLoadKey());
|
||||
folder.mkdirs();
|
||||
Iris.info("Packaging Dimension " + dimension.getName());
|
||||
KSet<IrisRegion> regions = new KSet<>();
|
||||
KSet<IrisBiome> biomes = new KSet<>();
|
||||
KSet<IrisGenerator> generators = new KSet<>();
|
||||
dimension.getRegions().forEach((i) -> regions.add(Iris.data.getRegionLoader().load(i)));
|
||||
regions.forEach((i) -> biomes.addAll(i.getAllBiomes()));
|
||||
biomes.forEach((i) -> i.getGenerators().forEach((j) -> generators.add(j.getCachedGenerator())));
|
||||
KMap<String, String> renameObjects = new KMap<>();
|
||||
|
||||
for(IrisBiome i : biomes)
|
||||
{
|
||||
for(IrisObjectPlacement j : i.getObjects())
|
||||
{
|
||||
KList<String> newNames = new KList<>();
|
||||
|
||||
for(String k : j.getPlace())
|
||||
{
|
||||
if(renameObjects.containsKey(k))
|
||||
{
|
||||
newNames.add(renameObjects.get(k));
|
||||
continue;
|
||||
}
|
||||
|
||||
String name = UUID.randomUUID().toString().replaceAll("-", "");
|
||||
newNames.add(name);
|
||||
renameObjects.put(k, name);
|
||||
}
|
||||
|
||||
j.setPlace(newNames);
|
||||
}
|
||||
}
|
||||
|
||||
KMap<String, KList<String>> lookupObjects = renameObjects.flip();
|
||||
|
||||
biomes.forEach((i) -> i.getObjects().forEach((j) -> j.getPlace().forEach((k) ->
|
||||
{
|
||||
try
|
||||
{
|
||||
Iris.info("- " + k + " (Object)");
|
||||
IO.copyFile(Iris.data.getObjectLoader().findFile(lookupObjects.get(k).get(0)), new File(folder, "objects/" + k + ".iob"));
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
{
|
||||
|
||||
}
|
||||
})));
|
||||
|
||||
try
|
||||
{
|
||||
IO.writeAll(new File(folder, "dimensions/" + dimension.getLoadKey() + ".json"), new JSONObject(new Gson().toJson(dimension)).toString(0));
|
||||
|
||||
for(IrisGenerator i : generators)
|
||||
{
|
||||
Iris.info("- " + i.getLoadKey() + " (Generator)");
|
||||
IO.writeAll(new File(folder, "generators/" + i.getLoadKey() + ".json"), new JSONObject(new Gson().toJson(i)).toString(0));
|
||||
}
|
||||
|
||||
for(IrisRegion i : regions)
|
||||
{
|
||||
Iris.info("- " + i.getName() + " (Region)");
|
||||
IO.writeAll(new File(folder, "regions/" + i.getLoadKey() + ".json"), new JSONObject(new Gson().toJson(i)).toString(0));
|
||||
}
|
||||
|
||||
for(IrisBiome i : biomes)
|
||||
{
|
||||
Iris.info("- " + i.getName() + " (Biome)");
|
||||
IO.writeAll(new File(folder, "biomes/" + i.getLoadKey() + ".json"), new JSONObject(new Gson().toJson(i)).toString(0));
|
||||
}
|
||||
|
||||
ZipUtil.pack(folder, new File(Iris.instance.getDataFolder(), "exports/" + dimension.getLoadKey() + ".iris"), 9);
|
||||
IO.delete(folder);
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
sender.sendMessage("Done!");
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getArgsUsage()
|
||||
{
|
||||
return "[dimension] [-o]";
|
||||
}
|
||||
}
|
||||
63
src/main/java/com/volmit/iris/command/CommandIrisWhat.java
Normal file
63
src/main/java/com/volmit/iris/command/CommandIrisWhat.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.volmit.iris.command;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.IrisMetrics;
|
||||
import com.volmit.iris.command.util.Command;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
import com.volmit.iris.generator.IrisChunkGenerator;
|
||||
import com.volmit.iris.util.Form;
|
||||
|
||||
public class CommandIrisWhat extends MortarCommand
|
||||
{
|
||||
@Command
|
||||
private CommandIrisWhatBlock block;
|
||||
|
||||
@Command
|
||||
private CommandIrisWhatHand hand;
|
||||
|
||||
public CommandIrisWhat()
|
||||
{
|
||||
super("what", "w", "?");
|
||||
setDescription("Get timings for this world");
|
||||
requiresPermission(Iris.perm.studio);
|
||||
setCategory("Wut");
|
||||
setDescription("Figure out what stuff is");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(MortarSender sender, String[] args)
|
||||
{
|
||||
if(sender.isPlayer())
|
||||
{
|
||||
Player p = (Player) sender;
|
||||
World world = p.getWorld();
|
||||
IrisChunkGenerator g = (IrisChunkGenerator) world.getGenerator();
|
||||
IrisMetrics m = g.getMetrics();
|
||||
sender.sendMessage("Thread Count: " + ChatColor.BOLD + "" + ChatColor.WHITE + g.getThreads());
|
||||
sender.sendMessage("Total : " + ChatColor.BOLD + "" + ChatColor.WHITE + Form.duration(m.getTotal().getAverage(), 2));
|
||||
sender.sendMessage(" Terrain : " + ChatColor.BOLD + "" + ChatColor.WHITE + Form.duration(m.getTerrain().getAverage(), 2));
|
||||
sender.sendMessage(" Parallax: " + ChatColor.BOLD + "" + ChatColor.WHITE + Form.duration(m.getParallax().getAverage(), 2));
|
||||
sender.sendMessage(" Post : " + ChatColor.BOLD + "" + ChatColor.WHITE + Form.duration(m.getPost().getAverage(), 2));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
sender.sendMessage("Players only.");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getArgsUsage()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.volmit.iris.command;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.FluidCollisionMode;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
|
||||
public class CommandIrisWhatBlock extends MortarCommand
|
||||
{
|
||||
public CommandIrisWhatBlock()
|
||||
{
|
||||
super("block", "b");
|
||||
setDescription("Get the block data for looking.");
|
||||
requiresPermission(Iris.perm.studio);
|
||||
setCategory("Wut");
|
||||
setDescription("WAILA,WAWLA etc");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(MortarSender sender, String[] args)
|
||||
{
|
||||
if(sender.isPlayer())
|
||||
{
|
||||
BlockData bd = ((Player) sender).getTargetBlockExact(128, FluidCollisionMode.NEVER).getBlockData();
|
||||
sender.sendMessage("Material: " + ChatColor.GREEN + bd.getMaterial().name());
|
||||
sender.sendMessage("Full: " + ChatColor.WHITE + bd.getAsString(true));
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
sender.sendMessage("Players only.");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getArgsUsage()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.volmit.iris.command;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.FluidCollisionMode;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
|
||||
public class CommandIrisWhatHand extends MortarCommand
|
||||
{
|
||||
public CommandIrisWhatHand()
|
||||
{
|
||||
super("hand", "h");
|
||||
setDescription("Get the block data for holding.");
|
||||
requiresPermission(Iris.perm.studio);
|
||||
setCategory("Wut");
|
||||
setDescription("What block holding");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(MortarSender sender, String[] args)
|
||||
{
|
||||
if(sender.isPlayer())
|
||||
{
|
||||
BlockData bd = ((Player) sender).getTargetBlockExact(128, FluidCollisionMode.NEVER).getBlockData();
|
||||
sender.sendMessage("Material: " + ChatColor.GREEN + bd.getMaterial().name());
|
||||
sender.sendMessage("Full: " + ChatColor.WHITE + bd.getAsString(true));
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
sender.sendMessage("Players only.");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getArgsUsage()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
39
src/main/java/com/volmit/iris/command/CommandIrisWorld.java
Normal file
39
src/main/java/com/volmit/iris/command/CommandIrisWorld.java
Normal file
@@ -0,0 +1,39 @@
|
||||
package com.volmit.iris.command;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.command.util.Command;
|
||||
import com.volmit.iris.command.util.MortarCommand;
|
||||
import com.volmit.iris.command.util.MortarSender;
|
||||
|
||||
public class CommandIrisWorld extends MortarCommand
|
||||
{
|
||||
@Command
|
||||
private CommandIrisGoto got0;
|
||||
|
||||
@Command
|
||||
private CommandIrisMetrics metrics;
|
||||
|
||||
public CommandIrisWorld()
|
||||
{
|
||||
super("world", "wrld");
|
||||
setDescription("Commands while in an iris world.");
|
||||
requiresPermission(Iris.perm.studio);
|
||||
setCategory("World");
|
||||
setDescription("Worldly commands");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(MortarSender sender, String[] args)
|
||||
{
|
||||
sender.sendMessage("Iris In-World Commands");
|
||||
printHelp(sender);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getArgsUsage()
|
||||
{
|
||||
return "[biome] [otherbiome] [-cave]";
|
||||
}
|
||||
}
|
||||
@@ -55,7 +55,7 @@ public abstract class MortarCommand implements ICommand
|
||||
}
|
||||
}
|
||||
b = true;
|
||||
sender.sendMessage("/" + ChatColor.GREEN + i.getAllNodes().toString(",") + " " + ChatColor.WHITE + getArgsUsage() + ChatColor.GRAY + " - " + getDescription());
|
||||
sender.sendMessage(ChatColor.GREEN + i.getNode() + " " + ChatColor.WHITE + i.getArgsUsage() + ChatColor.GRAY + " - " + i.getDescription());
|
||||
}
|
||||
|
||||
if(!b)
|
||||
|
||||
Reference in New Issue
Block a user