mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Revert "Move decreeSystem into decreeCommand"
This reverts commit 3d68caed6b578bca43848e2f95ce2102dacd25cc.
This commit is contained in:
parent
f476f1447c
commit
b0677bb66d
@ -18,26 +18,5 @@
|
|||||||
|
|
||||||
package com.volmit.iris.util.decree;
|
package com.volmit.iris.util.decree;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
|
|
||||||
public class DecreeCommand {
|
public class DecreeCommand {
|
||||||
private static final KList<DecreeParameterHandler<?>> handlers = Iris.initialize("com.volmit.iris.util.decree.handlers", null).convert((i) -> (DecreeParameterHandler<?>) i);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the handler for the specified type
|
|
||||||
* @param type The type to handle
|
|
||||||
* @return The corresponding {@link DecreeParameterHandler}, or null
|
|
||||||
*/
|
|
||||||
public static DecreeParameterHandler<?> getHandler(Class<?> type)
|
|
||||||
{
|
|
||||||
for(DecreeParameterHandler<?> i : handlers)
|
|
||||||
{
|
|
||||||
if(i.supports(type))
|
|
||||||
{
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ public class DecreeParameter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public DecreeParameterHandler<?> getHandler() {
|
public DecreeParameterHandler<?> getHandler() {
|
||||||
return DecreeCommand.getHandler(getType());
|
return DecreeSystem.getHandler(getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Class<?> getType() {
|
public Class<?> getType() {
|
||||||
|
43
src/main/java/com/volmit/iris/util/decree/DecreeSystem.java
Normal file
43
src/main/java/com/volmit/iris/util/decree/DecreeSystem.java
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
import com.volmit.iris.Iris;
|
||||||
|
import com.volmit.iris.util.collection.KList;
|
||||||
|
|
||||||
|
public class DecreeSystem {
|
||||||
|
private static final KList<DecreeParameterHandler<?>> handlers = Iris.initialize("com.volmit.iris.util.decree.handlers", null).convert((i) -> (DecreeParameterHandler<?>) i);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the handler for the specified type
|
||||||
|
* @param type The type to handle
|
||||||
|
* @return The corresponding {@link DecreeParameterHandler}, or null
|
||||||
|
*/
|
||||||
|
public static DecreeParameterHandler<?> getHandler(Class<?> type)
|
||||||
|
{
|
||||||
|
for(DecreeParameterHandler<?> i : handlers)
|
||||||
|
{
|
||||||
|
if(i.supports(type))
|
||||||
|
{
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user