9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-30 12:29:20 +00:00
This commit is contained in:
Daniel Mills
2020-08-17 00:26:21 -04:00
parent af22751210
commit 8a7bc3c17d
8 changed files with 103 additions and 75 deletions

View File

@@ -0,0 +1,55 @@
package com.volmit.iris.command;
import org.bukkit.World;
import org.bukkit.entity.Player;
import com.volmit.iris.Iris;
import com.volmit.iris.gen.IrisChunkGenerator;
import com.volmit.iris.util.MortarCommand;
import com.volmit.iris.util.MortarSender;
public class CommandIrisTC extends MortarCommand
{
public CommandIrisTC()
{
super("ctc");
setDescription("Change generator thread count");
requiresPermission(Iris.perm.studio);
setCategory("World");
}
@Override
public boolean handle(MortarSender sender, String[] args)
{
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 m = Math.min(Math.max(Integer.valueOf(args[0]), 2), 256);
g.changeThreadCount(m);
sender.sendMessage("Thread count changed to " + m);
return true;
}
else
{
sender.sendMessage("Players only.");
}
return true;
}
@Override
protected String getArgsUsage()
{
return "[thread-count]";
}
}

View File

@@ -22,6 +22,9 @@ public class CommandIrisWorld extends MortarCommand
@Command
private CommandIrisHotload hotload;
@Command
private CommandIrisTC tc;
public CommandIrisWorld()
{
super("world", "wrld", "w");