GUI & Tasking utils

This commit is contained in:
Daniel Mills
2020-08-24 08:03:05 -04:00
parent e9544bb610
commit 273f7c7a73
50 changed files with 3937 additions and 55 deletions

View File

@@ -18,6 +18,9 @@ public class CommandIris extends MortarCommand
@Command
private CommandIrisObject object;
@Command
private CommandIrisStructure structure;
@Command
private CommandIrisCreate create;

View File

@@ -5,7 +5,7 @@ import org.bukkit.Sound;
import org.bukkit.entity.Player;
import com.volmit.iris.Iris;
import com.volmit.iris.WandController;
import com.volmit.iris.WandManager;
import com.volmit.iris.util.Cuboid;
import com.volmit.iris.util.Direction;
import com.volmit.iris.util.MortarCommand;
@@ -32,14 +32,14 @@ public class CommandIrisObjectContract extends MortarCommand
Player p = sender.player();
if(!WandController.isWand(p))
if(!WandManager.isWand(p))
{
sender.sendMessage("Ready your Wand.");
return true;
}
int amt = Integer.valueOf(args[0]);
Location[] b = WandController.getCuboid(p.getInventory().getItemInMainHand());
Location[] b = WandManager.getCuboid(p.getInventory().getItemInMainHand());
Location a1 = b[0].clone();
Location a2 = b[1].clone();
Cuboid cursor = new Cuboid(a1, a2);
@@ -47,7 +47,7 @@ public class CommandIrisObjectContract extends MortarCommand
cursor = cursor.expand(d, -amt);
b[0] = cursor.getLowerNE();
b[1] = cursor.getUpperSW();
p.getInventory().setItemInMainHand(WandController.createWand(b[0], b[1]));
p.getInventory().setItemInMainHand(WandManager.createWand(b[0], b[1]));
p.updateInventory();
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_FRAME_ROTATE_ITEM, 1f, 0.55f);

View File

@@ -5,7 +5,7 @@ import org.bukkit.Sound;
import org.bukkit.entity.Player;
import com.volmit.iris.Iris;
import com.volmit.iris.WandController;
import com.volmit.iris.WandManager;
import com.volmit.iris.util.Cuboid;
import com.volmit.iris.util.Direction;
import com.volmit.iris.util.MortarCommand;
@@ -32,14 +32,14 @@ public class CommandIrisObjectExpand extends MortarCommand
Player p = sender.player();
if(!WandController.isWand(p))
if(!WandManager.isWand(p))
{
sender.sendMessage("Ready your Wand.");
return true;
}
int amt = Integer.valueOf(args[0]);
Location[] b = WandController.getCuboid(p.getInventory().getItemInMainHand());
Location[] b = WandManager.getCuboid(p.getInventory().getItemInMainHand());
Location a1 = b[0].clone();
Location a2 = b[1].clone();
Cuboid cursor = new Cuboid(a1, a2);
@@ -47,7 +47,7 @@ public class CommandIrisObjectExpand extends MortarCommand
cursor = cursor.expand(d, amt);
b[0] = cursor.getLowerNE();
b[1] = cursor.getUpperSW();
p.getInventory().setItemInMainHand(WandController.createWand(b[0], b[1]));
p.getInventory().setItemInMainHand(WandManager.createWand(b[0], b[1]));
p.updateInventory();
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_FRAME_ROTATE_ITEM, 1f, 0.55f);

View File

@@ -8,7 +8,7 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import com.volmit.iris.Iris;
import com.volmit.iris.WandController;
import com.volmit.iris.WandManager;
import com.volmit.iris.util.MortarCommand;
import com.volmit.iris.util.MortarSender;
@@ -34,7 +34,7 @@ public class CommandIrisObjectP1 extends MortarCommand
Player p = sender.player();
if(!WandController.isWand(p))
if(!WandManager.isWand(p))
{
sender.sendMessage("Ready your Wand.");
return true;
@@ -42,9 +42,9 @@ public class CommandIrisObjectP1 extends MortarCommand
ItemStack wand = p.getInventory().getItemInMainHand();
if(WandController.isWand(wand))
if(WandManager.isWand(wand))
{
Location[] g = WandController.getCuboid(wand);
Location[] g = WandManager.getCuboid(wand);
g[0] = p.getLocation().getBlock().getLocation().clone().add(0, -1, 0);
if(args.length == 1 && args[0].equals("-l"))
@@ -52,7 +52,7 @@ public class CommandIrisObjectP1 extends MortarCommand
g[0] = p.getTargetBlock((Set<Material>) null, 256).getLocation().clone();
}
p.setItemInHand(WandController.createWand(g[0], g[1]));
p.setItemInHand(WandManager.createWand(g[0], g[1]));
}
return true;

View File

@@ -8,7 +8,7 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import com.volmit.iris.Iris;
import com.volmit.iris.WandController;
import com.volmit.iris.WandManager;
import com.volmit.iris.util.MortarCommand;
import com.volmit.iris.util.MortarSender;
@@ -34,7 +34,7 @@ public class CommandIrisObjectP2 extends MortarCommand
Player p = sender.player();
if(!WandController.isWand(p))
if(!WandManager.isWand(p))
{
sender.sendMessage("Ready your Wand.");
return true;
@@ -42,9 +42,9 @@ public class CommandIrisObjectP2 extends MortarCommand
ItemStack wand = p.getInventory().getItemInMainHand();
if(WandController.isWand(wand))
if(WandManager.isWand(wand))
{
Location[] g = WandController.getCuboid(wand);
Location[] g = WandManager.getCuboid(wand);
g[1] = p.getLocation().getBlock().getLocation().clone().add(0, -1, 0);
if(args.length == 1 && args[0].equals("-l"))
@@ -52,7 +52,7 @@ public class CommandIrisObjectP2 extends MortarCommand
g[1] = p.getTargetBlock((Set<Material>) null, 256).getLocation().clone();
}
p.setItemInHand(WandController.createWand(g[0], g[1]));
p.setItemInHand(WandManager.createWand(g[0], g[1]));
}
return true;

View File

@@ -10,7 +10,7 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import com.volmit.iris.Iris;
import com.volmit.iris.WandController;
import com.volmit.iris.WandManager;
import com.volmit.iris.object.IrisObject;
import com.volmit.iris.util.MortarCommand;
import com.volmit.iris.util.MortarSender;
@@ -64,14 +64,14 @@ public class CommandIrisObjectPaste extends MortarCommand
sender.player().getWorld().playSound(sender.player().getLocation(), Sound.BLOCK_ENCHANTMENT_TABLE_USE, 1f, 1.5f);
Location block = sender.player().getTargetBlock((Set<Material>) null, 256).getLocation().clone().add(0, 1, 0);
if(intoWand && WandController.isWand(wand))
if(intoWand && WandManager.isWand(wand))
{
wand = WandController.createWand(block.clone().subtract(o.getCenter()).add(o.getW() - 1, o.getH(), o.getD() - 1), block.clone().subtract(o.getCenter()));
wand = WandManager.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[0] + ".iob");
}
WandController.pasteSchematic(o, block);
WandManager.pasteSchematic(o, block);
sender.sendMessage("Placed " + "objects/" + args[0] + ".iob");
return true;

View File

@@ -7,7 +7,7 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import com.volmit.iris.Iris;
import com.volmit.iris.WandController;
import com.volmit.iris.WandManager;
import com.volmit.iris.object.IrisObject;
import com.volmit.iris.util.MortarCommand;
import com.volmit.iris.util.MortarSender;
@@ -52,7 +52,7 @@ public class CommandIrisObjectSave extends MortarCommand
Player p = sender.player();
ItemStack wand = p.getInventory().getItemInMainHand();
IrisObject o = WandController.createSchematic(wand);
IrisObject o = WandManager.createSchematic(wand);
File file = Iris.instance.getDataFile("packs", args[0], "objects", args[1] + ".iob");
if(file.exists())

View File

@@ -5,7 +5,7 @@ import org.bukkit.Sound;
import org.bukkit.entity.Player;
import com.volmit.iris.Iris;
import com.volmit.iris.WandController;
import com.volmit.iris.WandManager;
import com.volmit.iris.util.Cuboid;
import com.volmit.iris.util.Direction;
import com.volmit.iris.util.MortarCommand;
@@ -32,14 +32,14 @@ public class CommandIrisObjectShift extends MortarCommand
Player p = sender.player();
if(!WandController.isWand(p))
if(!WandManager.isWand(p))
{
sender.sendMessage("Ready your Wand.");
return true;
}
int amt = Integer.valueOf(args[0]);
Location[] b = WandController.getCuboid(p.getInventory().getItemInMainHand());
Location[] b = WandManager.getCuboid(p.getInventory().getItemInMainHand());
Location a1 = b[0].clone();
Location a2 = b[1].clone();
Direction d = Direction.closest(p.getLocation().getDirection()).reverse();
@@ -48,7 +48,7 @@ public class CommandIrisObjectShift extends MortarCommand
Cuboid cursor = new Cuboid(a1, a2);
b[0] = cursor.getLowerNE();
b[1] = cursor.getUpperSW();
p.getInventory().setItemInMainHand(WandController.createWand(b[0], b[1]));
p.getInventory().setItemInMainHand(WandManager.createWand(b[0], b[1]));
p.updateInventory();
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_FRAME_ROTATE_ITEM, 1f, 0.55f);

View File

@@ -3,7 +3,7 @@ package com.volmit.iris.command;
import org.bukkit.Sound;
import com.volmit.iris.Iris;
import com.volmit.iris.WandController;
import com.volmit.iris.WandManager;
import com.volmit.iris.util.MortarCommand;
import com.volmit.iris.util.MortarSender;
@@ -26,7 +26,7 @@ public class CommandIrisObjectWand extends MortarCommand
return true;
}
sender.player().getInventory().addItem(WandController.createWand());
sender.player().getInventory().addItem(WandManager.createWand());
sender.player().playSound(sender.player().getLocation(), Sound.ITEM_ARMOR_EQUIP_NETHERITE, 1f, 1.5f);
return true;

View File

@@ -7,7 +7,7 @@ import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import com.volmit.iris.Iris;
import com.volmit.iris.WandController;
import com.volmit.iris.WandManager;
import com.volmit.iris.util.Cuboid;
import com.volmit.iris.util.MortarCommand;
import com.volmit.iris.util.MortarSender;
@@ -34,13 +34,13 @@ public class CommandIrisObjectXAY extends MortarCommand
Player p = sender.player();
if(!WandController.isWand(p))
if(!WandManager.isWand(p))
{
sender.sendMessage("Ready your Wand.");
return true;
}
Location[] b = WandController.getCuboid(p.getInventory().getItemInMainHand());
Location[] b = WandManager.getCuboid(p.getInventory().getItemInMainHand());
Location a1 = b[0].clone();
Location a2 = b[1].clone();
Location a1x = b[0].clone();
@@ -76,7 +76,7 @@ public class CommandIrisObjectXAY extends MortarCommand
cursor = cursor.contract(CuboidDirection.West);
b[0] = cursor.getLowerNE();
b[1] = cursor.getUpperSW();
p.getInventory().setItemInMainHand(WandController.createWand(b[0], b[1]));
p.getInventory().setItemInMainHand(WandManager.createWand(b[0], b[1]));
p.updateInventory();
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_FRAME_ROTATE_ITEM, 1f, 0.55f);

View File

@@ -7,7 +7,7 @@ import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import com.volmit.iris.Iris;
import com.volmit.iris.WandController;
import com.volmit.iris.WandManager;
import com.volmit.iris.util.Cuboid;
import com.volmit.iris.util.MortarCommand;
import com.volmit.iris.util.MortarSender;
@@ -34,12 +34,12 @@ public class CommandIrisObjectXPY extends MortarCommand
Player p = sender.player();
if(!WandController.isWand(p))
if(!WandManager.isWand(p))
{
sender.sendMessage("Ready your Wand.");
return true;
}
Location[] b = WandController.getCuboid(p.getInventory().getItemInMainHand());
Location[] b = WandManager.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();
@@ -64,7 +64,7 @@ public class CommandIrisObjectXPY extends MortarCommand
cursor = cursor.contract(CuboidDirection.West);
b[0] = cursor.getLowerNE();
b[1] = cursor.getUpperSW();
p.getInventory().setItemInMainHand(WandController.createWand(b[0], b[1]));
p.getInventory().setItemInMainHand(WandManager.createWand(b[0], b[1]));
p.updateInventory();
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_FRAME_ROTATE_ITEM, 1f, 0.55f);

View File

@@ -0,0 +1,46 @@
package com.volmit.iris.command;
import com.volmit.iris.Iris;
import com.volmit.iris.util.Command;
import com.volmit.iris.util.MortarCommand;
import com.volmit.iris.util.MortarSender;
public class CommandIrisStructure extends MortarCommand
{
@Command
private CommandIrisStructureCreate create;
@Command
private CommandIrisStructureSave save;
@Command
private CommandIrisStructureMore more;
@Command
private CommandIrisStructureExpand expand;
@Command
private CommandIrisStructureClose close;
public CommandIrisStructure()
{
super("structure", "struct", "str");
requiresPermission(Iris.perm);
setCategory("Structure");
setDescription("Structure Commands");
}
@Override
public boolean handle(MortarSender sender, String[] args)
{
sender.sendMessage("Iris Structure Commands");
printHelp(sender);
return true;
}
@Override
protected String getArgsUsage()
{
return "[subcommand]";
}
}

View File

@@ -0,0 +1,49 @@
package com.volmit.iris.command;
import org.bukkit.entity.Player;
import com.volmit.iris.Iris;
import com.volmit.iris.util.MortarCommand;
import com.volmit.iris.util.MortarSender;
import com.volmit.iris.util.StructureTemplate;
public class CommandIrisStructureClose extends MortarCommand
{
public CommandIrisStructureClose()
{
super("close", "x");
requiresPermission(Iris.perm);
setCategory("Structure");
setDescription("Close a structure");
}
@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();
StructureTemplate m = Iris.struct.get(p);
if(m == null)
{
sender.sendMessage("You do not have an open structure");
return true;
}
m.close();
sender.sendMessage("Saved & Closed!");
return true;
}
@Override
protected String getArgsUsage()
{
return "";
}
}

View File

@@ -0,0 +1,52 @@
package com.volmit.iris.command;
import org.bukkit.entity.Player;
import com.volmit.iris.Iris;
import com.volmit.iris.util.MortarCommand;
import com.volmit.iris.util.MortarSender;
import com.volmit.iris.util.StructureTemplate;
public class CommandIrisStructureCreate extends MortarCommand
{
public CommandIrisStructureCreate()
{
super("new", "create", "+");
requiresPermission(Iris.perm);
setCategory("Structure");
setDescription("Create a structure");
}
@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();
boolean d3 = false;
for(String i : args)
{
if(i.equalsIgnoreCase("-3d"))
{
d3 = true;
}
}
sender.sendMessage("Creating new Structure");
new StructureTemplate(args[0], args[1], p, p.getLocation(), 5, Integer.valueOf(args[2]), Integer.valueOf(args[3]), d3);
return true;
}
@Override
protected String getArgsUsage()
{
return "<name> <dimension> <tile-width> <tile-height> [-3d]";
}
}

View File

@@ -0,0 +1,49 @@
package com.volmit.iris.command;
import org.bukkit.entity.Player;
import com.volmit.iris.Iris;
import com.volmit.iris.util.MortarCommand;
import com.volmit.iris.util.MortarSender;
import com.volmit.iris.util.StructureTemplate;
public class CommandIrisStructureExpand extends MortarCommand
{
public CommandIrisStructureExpand()
{
super("expand", "+++");
requiresPermission(Iris.perm);
setCategory("Structure");
setDescription("Expand out more of the structure");
}
@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();
StructureTemplate m = Iris.struct.get(p);
if(m == null)
{
sender.sendMessage("You do not have an open structure");
return true;
}
m.expand();
sender.sendMessage("Loading More!");
return true;
}
@Override
protected String getArgsUsage()
{
return "";
}
}

View File

@@ -0,0 +1,49 @@
package com.volmit.iris.command;
import org.bukkit.entity.Player;
import com.volmit.iris.Iris;
import com.volmit.iris.util.MortarCommand;
import com.volmit.iris.util.MortarSender;
import com.volmit.iris.util.StructureTemplate;
public class CommandIrisStructureMore extends MortarCommand
{
public CommandIrisStructureMore()
{
super("more", "++");
requiresPermission(Iris.perm);
setCategory("Structure");
setDescription("Load more of the structure");
}
@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();
StructureTemplate m = Iris.struct.get(p);
if(m == null)
{
sender.sendMessage("You do not have an open structure");
return true;
}
m.more();
sender.sendMessage("Loading More!");
return true;
}
@Override
protected String getArgsUsage()
{
return "";
}
}

View File

@@ -0,0 +1,49 @@
package com.volmit.iris.command;
import org.bukkit.entity.Player;
import com.volmit.iris.Iris;
import com.volmit.iris.util.MortarCommand;
import com.volmit.iris.util.MortarSender;
import com.volmit.iris.util.StructureTemplate;
public class CommandIrisStructureSave extends MortarCommand
{
public CommandIrisStructureSave()
{
super("save", "s");
requiresPermission(Iris.perm);
setCategory("Structure");
setDescription("Save a structure");
}
@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();
StructureTemplate m = Iris.struct.get(p);
if(m == null)
{
sender.sendMessage("You do not have an open structure");
return true;
}
m.saveStructure();
sender.sendMessage("Saved!");
return true;
}
@Override
protected String getArgsUsage()
{
return "";
}
}

View File

@@ -5,7 +5,8 @@ import com.volmit.iris.util.Command;
import com.volmit.iris.util.MortarCommand;
import com.volmit.iris.util.MortarSender;
public class CommandIrisStudio extends MortarCommand {
public class CommandIrisStudio extends MortarCommand
{
@Command
private CommandIrisStudioCreate create;
@@ -23,28 +24,31 @@ public class CommandIrisStudio extends MortarCommand {
@Command
private CommandIrisStudioUpdate update;
@Command
private CommandIrisMap map;
@Command
private CommandIrisStudioList list;
public CommandIrisStudio() {
public CommandIrisStudio()
{
super("studio", "std");
requiresPermission(Iris.perm.studio);
setCategory("Studio");
}
@Override
public boolean handle(MortarSender sender, String[] args) {
public boolean handle(MortarSender sender, String[] args)
{
sender.sendMessage("Iris Studio Commands");
printHelp(sender);
return true;
}
@Override
protected String getArgsUsage() {
protected String getArgsUsage()
{
return "[subcommand]";
}
}