mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Merge remote-tracking branch 'upstream/master' into DecreeCommands
This commit is contained in:
commit
3866c740e9
@ -38,8 +38,6 @@ import com.volmit.iris.engine.object.dimensional.IrisDimension;
|
||||
import com.volmit.iris.engine.platform.BukkitChunkGenerator;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.collection.KSet;
|
||||
import com.volmit.iris.util.decree.DecreeCommand;
|
||||
import com.volmit.iris.util.decree.DecreeSystem;
|
||||
import com.volmit.iris.util.format.C;
|
||||
import com.volmit.iris.util.format.Form;
|
||||
import com.volmit.iris.util.function.NastyRunnable;
|
||||
@ -87,7 +85,7 @@ public class Iris extends VolmitPlugin implements Listener {
|
||||
public static ConversionManager convert;
|
||||
public static WandManager wand;
|
||||
public static EditManager edit;
|
||||
public static BoardManager board;
|
||||
public static CoreBoardManager board;
|
||||
public static MultiverseCoreLink linkMultiverseCore;
|
||||
public static OraxenLink linkOraxen;
|
||||
public static MythicMobsLink linkMythicMobs;
|
||||
@ -124,7 +122,7 @@ public class Iris extends VolmitPlugin implements Listener {
|
||||
proj = new ProjectManager();
|
||||
convert = new ConversionManager();
|
||||
wand = new WandManager();
|
||||
board = new BoardManager();
|
||||
board = new CoreBoardManager();
|
||||
linkMultiverseCore = new MultiverseCoreLink();
|
||||
linkOraxen = new OraxenLink();
|
||||
linkMythicMobs = new MythicMobsLink();
|
||||
@ -457,6 +455,10 @@ public class Iris extends VolmitPlugin implements Listener {
|
||||
if (d == null) {
|
||||
Iris.warn("Unable to find dimension type " + id + " Looking for online packs...");
|
||||
d = IrisData.loadAnyDimension(dimension);
|
||||
if (dimension == null) {
|
||||
Iris.warn("Unable to find dimension type \"" + dimensionName + "\". Looking for online packs...");
|
||||
Iris.proj.downloadSearch(new VolmitSender(Bukkit.getConsoleSender()), dimensionName, true);
|
||||
dimension = IrisData.loadAnyDimension(dimensionName);
|
||||
|
||||
if (d == null) {
|
||||
throw new RuntimeException("Can't find dimension " + dimension + "!");
|
||||
@ -480,7 +482,7 @@ public class Iris extends VolmitPlugin implements Listener {
|
||||
public static void msg(String string) {
|
||||
try {
|
||||
sender.sendMessage(string);
|
||||
} catch (Throwable ignored) {
|
||||
} catch (Throwable e) {
|
||||
try {
|
||||
System.out.println(string);
|
||||
} catch (Throwable ignored1) {
|
||||
|
@ -43,7 +43,7 @@ import org.bukkit.event.player.PlayerChangedWorldEvent;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BoardManager implements BoardProvider, Listener {
|
||||
public class CoreBoardManager implements BoardProvider, Listener {
|
||||
|
||||
private final BossBar energyBar;
|
||||
private final com.volmit.iris.util.board.BoardManager manager;
|
||||
@ -53,7 +53,7 @@ public class BoardManager implements BoardProvider, Listener {
|
||||
private final ChronoLatch cl = new ChronoLatch(1000);
|
||||
private final ChronoLatch ecl = new ChronoLatch(50);
|
||||
|
||||
public BoardManager() {
|
||||
public CoreBoardManager() {
|
||||
Iris.instance.registerListener(this);
|
||||
//@builder
|
||||
manager = new com.volmit.iris.util.board.BoardManager(Iris.instance, BoardSettings.builder()
|
@ -1,23 +0,0 @@
|
||||
/*
|
||||
* 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.util.decree;
|
||||
|
||||
|
||||
public interface DecreeCommand {
|
||||
}
|
@ -18,7 +18,6 @@
|
||||
|
||||
package com.volmit.iris.util.decree;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.util.collection.KMap;
|
||||
import com.volmit.iris.util.plugin.VolmitSender;
|
||||
import com.volmit.iris.util.scheduling.ChronoLatch;
|
||||
|
@ -21,7 +21,10 @@ package com.volmit.iris.util.decree;
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
||||
<<<<<<< HEAD
|
||||
import com.volmit.iris.util.format.C;
|
||||
=======
|
||||
>>>>>>> master
|
||||
import com.volmit.iris.util.plugin.VolmitSender;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -62,9 +65,12 @@ public interface DecreeExecutor {
|
||||
|
||||
default Engine engine()
|
||||
{
|
||||
if(sender().isPlayer())
|
||||
if(sender().isPlayer() && IrisToolbelt.access(sender().player().getWorld()) != null)
|
||||
{
|
||||
return IrisToolbelt.access(sender().player().getWorld()).getEngine();
|
||||
PlatformChunkGenerator gen = IrisToolbelt.access(sender().player().getWorld());
|
||||
if (gen != null){
|
||||
return gen.getEngine();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -37,6 +37,11 @@ public interface DecreeParameterHandler<T> {
|
||||
*/
|
||||
String toString(T t);
|
||||
|
||||
/**
|
||||
* Forces conversion to the designated type before converting to a string using {@link #toString(T t)}
|
||||
* @param t The object to convert to string (that should be of this type)
|
||||
* @return The resulting string.
|
||||
*/
|
||||
default String toStringForce(Object t)
|
||||
{
|
||||
return toString((T)t);
|
||||
|
@ -36,6 +36,10 @@ import java.util.List;
|
||||
public interface DecreeSystem extends CommandExecutor, TabCompleter {
|
||||
KList<DecreeParameterHandler<?>> handlers = Iris.initialize("com.volmit.iris.util.decree.handlers", null).convert((i) -> (DecreeParameterHandler<?>) i);
|
||||
|
||||
/**
|
||||
* The root class to start command searching from
|
||||
* @return
|
||||
*/
|
||||
VirtualDecreeCommand getRoot();
|
||||
|
||||
default boolean call(VolmitSender sender, String[] args)
|
||||
|
@ -1,12 +0,0 @@
|
||||
package com.volmit.iris.util.decree;
|
||||
|
||||
import com.volmit.iris.util.decree.annotations.Decree;
|
||||
|
||||
@Decree(name = "boop", aliases = {"b", "bp"}, description = "Sub example with another name!")
|
||||
// the boop command in here can be called with (/super) boop beep, b beep and bp beep
|
||||
public class SubExample implements DecreeCommand {
|
||||
@Decree(name = "beep", description = "Boops the sender") // Origin is not defined so both console & player senders can run this command (Default)
|
||||
public void boop() { // Called with "beep" because name = "beep", "boop" will not work in the command
|
||||
DecreeContext.get().sendMessage("Boop");
|
||||
}
|
||||
}
|
@ -265,7 +265,7 @@ public class Violator {
|
||||
T f = c.getDeclaredAnnotation(a);
|
||||
p(id(f, c), f);
|
||||
|
||||
System.out.println("Set as " + id(f, c) + " as " + ("@" + a.getCanonicalName() + "[" + id(c, null) + "]"));
|
||||
Iris.debug("Set as " + id(f, c) + " as " + ("@" + a.getCanonicalName() + "[" + id(c, null) + "]"));
|
||||
}
|
||||
|
||||
return (T) g("@" + a.getCanonicalName() + "[" + id(c, null) + "]");
|
||||
|
@ -65,7 +65,7 @@ public class J {
|
||||
a.run();
|
||||
} catch (Throwable e) {
|
||||
Iris.reportError(e);
|
||||
System.out.println("Failed to run async task");
|
||||
Iris.error("Failed to run async task");
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
@ -77,7 +77,7 @@ public class J {
|
||||
a.run();
|
||||
} catch (Throwable e) {
|
||||
Iris.reportError(e);
|
||||
System.out.println("Failed to run async task");
|
||||
Iris.error("Failed to run async task");
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user