mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Commands
This commit is contained in:
parent
101d0212a7
commit
55c4e9635a
@ -60,6 +60,9 @@ public class CommandIris extends MortarCommand {
|
|||||||
@Command
|
@Command
|
||||||
private CommandIrisUpdateWorld updateWorld;
|
private CommandIrisUpdateWorld updateWorld;
|
||||||
|
|
||||||
|
@Command
|
||||||
|
private CommandIrisBitwise bitwise;
|
||||||
|
|
||||||
@Command
|
@Command
|
||||||
private CommandIrisWhat what;
|
private CommandIrisWhat what;
|
||||||
|
|
||||||
|
@ -0,0 +1,110 @@
|
|||||||
|
/*
|
||||||
|
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||||
|
* Copyright (c) 2021 Arcane Arts (Volmit Software)
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.volmit.iris.core.command;
|
||||||
|
|
||||||
|
import com.volmit.iris.Iris;
|
||||||
|
import com.volmit.iris.util.collection.KList;
|
||||||
|
import com.volmit.iris.util.format.C;
|
||||||
|
import com.volmit.iris.util.plugin.MortarCommand;
|
||||||
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
|
import com.volmit.iris.util.scheduling.J;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
public class CommandIrisBitwise extends MortarCommand {
|
||||||
|
public CommandIrisBitwise() {
|
||||||
|
super("bitwise", "bits", "bw");
|
||||||
|
requiresPermission(Iris.perm.studio);
|
||||||
|
setDescription("Run bitwise calculations");
|
||||||
|
setCategory("Studio");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handle(VolmitSender sender, String[] args) {
|
||||||
|
if(args.length != 3)
|
||||||
|
{
|
||||||
|
sender.sendMessage("/iris bw " + getArgsUsage());
|
||||||
|
}
|
||||||
|
|
||||||
|
if(args[0].contains(","))
|
||||||
|
{
|
||||||
|
KList<Integer> r = new KList<>();
|
||||||
|
|
||||||
|
for(String i : args[0].split("\\Q,\\E"))
|
||||||
|
{
|
||||||
|
int a = Integer.valueOf(i);
|
||||||
|
String op = args[1];
|
||||||
|
int b = Integer.valueOf(args[2]);
|
||||||
|
int v = 0;
|
||||||
|
|
||||||
|
switch(op)
|
||||||
|
{
|
||||||
|
case "|": v = a | b;
|
||||||
|
case "&": v = a & b;
|
||||||
|
case "^": v = a ^ b;
|
||||||
|
case "%": v = a ^ b;
|
||||||
|
case ">>": v = a >> b;
|
||||||
|
case "<<": v = a << b;
|
||||||
|
default: {
|
||||||
|
sender.sendMessage("Error Invalid operation");
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
r.add(v);
|
||||||
|
sender.sendMessage("Result: " + r.toString(","));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int a = Integer.valueOf(args[0]);
|
||||||
|
String op = args[1];
|
||||||
|
int b = Integer.valueOf(args[2]);
|
||||||
|
int v = 0;
|
||||||
|
|
||||||
|
switch(op)
|
||||||
|
{
|
||||||
|
case "|": v = a | b;
|
||||||
|
case "&": v = a & b;
|
||||||
|
case "^": v = a ^ b;
|
||||||
|
case "%": v = a ^ b;
|
||||||
|
case ">>": v = a >> b;
|
||||||
|
case "<<": v = a << b;
|
||||||
|
default: {
|
||||||
|
sender.sendMessage("Error Invalid operation");
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
sender.sendMessage("Result: " + v);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getArgsUsage() {
|
||||||
|
return "<number> [|,&,^,>>,<<,%] <other>";
|
||||||
|
}
|
||||||
|
}
|
@ -78,6 +78,11 @@ public class CommandIrisVerify extends MortarCommand {
|
|||||||
{
|
{
|
||||||
sender.sendMessage("Found Missing Chunk " + i.getName() + ", chunk #" + j + "," + k + " (see " + (((rx << 5)<<4)+(j<<4)) + "," + (((rz << 5)<<4)+(k<<4)));
|
sender.sendMessage("Found Missing Chunk " + i.getName() + ", chunk #" + j + "," + k + " (see " + (((rx << 5)<<4)+(j<<4)) + "," + (((rz << 5)<<4)+(k<<4)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(c.sectionCount() == 0)
|
||||||
|
{
|
||||||
|
sender.sendMessage("Found Missing Chunk (valid, but 0 sections) " + i.getName() + ", chunk #" + j + "," + k + " (see " + (((rx << 5)<<4)+(j<<4)) + "," + (((rz << 5)<<4)+(k<<4)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException ioException) {
|
} catch (IOException ioException) {
|
||||||
|
@ -681,4 +681,8 @@ public class Chunk {
|
|||||||
level.put("Sections", sections);
|
level.put("Sections", sections);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int sectionCount() {
|
||||||
|
return sections.length;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user