mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-02-16 10:30:42 +00:00
fix TerraAddon -> BaseAddon
This commit is contained in:
@@ -18,6 +18,6 @@ public class AddonsCommand implements CommandTemplate {
|
||||
public void execute(CommandSender sender) {
|
||||
sender.sendMessage("Installed Addons:");
|
||||
platform.getAddons().forEach(
|
||||
addon -> sender.sendMessage(" - " + addon.getName() + " v" + addon.getVersion() + " by " + addon.getAuthor()));
|
||||
addon -> sender.sendMessage(" - " + addon.getID()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.dfsek.terra.event;
|
||||
|
||||
import com.dfsek.terra.api.addon.BaseAddon;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
@@ -16,14 +18,14 @@ import com.dfsek.terra.api.util.reflection.ReflectionUtil;
|
||||
|
||||
public class EventContextImpl<T extends Event> implements EventContext<T>, Comparable<EventContextImpl<?>> {
|
||||
private final List<Consumer<T>> actions = new ArrayList<>();
|
||||
private final TerraAddon addon;
|
||||
private final BaseAddon addon;
|
||||
private final Type eventType;
|
||||
private final FunctionalEventHandlerImpl parent;
|
||||
private int priority;
|
||||
private boolean failThrough = false;
|
||||
private boolean global = false;
|
||||
|
||||
public EventContextImpl(TerraAddon addon, Type eventType, FunctionalEventHandlerImpl parent) {
|
||||
public EventContextImpl(BaseAddon addon, Type eventType, FunctionalEventHandlerImpl parent) {
|
||||
this.addon = addon;
|
||||
this.eventType = eventType;
|
||||
this.parent = parent;
|
||||
@@ -75,7 +77,7 @@ public class EventContextImpl<T extends Event> implements EventContext<T>, Compa
|
||||
return priority;
|
||||
}
|
||||
|
||||
public TerraAddon getAddon() {
|
||||
public BaseAddon getAddon() {
|
||||
return addon;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.dfsek.terra.api.Platform;
|
||||
import com.dfsek.terra.api.addon.BaseAddon;
|
||||
import com.dfsek.terra.api.addon.TerraAddon;
|
||||
import com.dfsek.terra.api.event.events.Event;
|
||||
import com.dfsek.terra.api.event.events.FailThroughEvent;
|
||||
@@ -48,20 +49,20 @@ public class FunctionalEventHandlerImpl implements FunctionalEventHandler {
|
||||
platform.logger().warning("Exception occurred during event handling:");
|
||||
platform.logger().warning(writer.toString());
|
||||
platform.logger().warning(
|
||||
"Report this to the maintainers of " + context.getAddon().getName() + ", " + context.getAddon().getAuthor());
|
||||
"Report this to the maintainers of " + context.getAddon().getID());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Event> EventContext<T> register(TerraAddon addon, Class<T> clazz) {
|
||||
public <T extends Event> EventContext<T> register(BaseAddon addon, Class<T> clazz) {
|
||||
EventContextImpl<T> eventContext = new EventContextImpl<>(addon, clazz, this);
|
||||
contextMap.computeIfAbsent(clazz, c -> new ArrayList<>()).add(eventContext);
|
||||
return eventContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Event> EventContext<T> register(TerraAddon addon, TypeKey<T> clazz) {
|
||||
public <T extends Event> EventContext<T> register(BaseAddon addon, TypeKey<T> clazz) {
|
||||
EventContextImpl<T> eventContext = new EventContextImpl<>(addon, clazz.getType(), this);
|
||||
contextMap.computeIfAbsent(clazz.getType(), c -> new ArrayList<>()).add(eventContext);
|
||||
return eventContext;
|
||||
|
||||
@@ -112,10 +112,6 @@ public class PlatformImpl extends AbstractPlatform {
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Optional<TerraAddon> getPlatformAddon() {
|
||||
return Optional.of(new FabricAddon(this));
|
||||
}
|
||||
|
||||
private ProtoBiome parseBiome(String id) throws LoadException {
|
||||
Identifier identifier = Identifier.tryParse(id);
|
||||
|
||||
Reference in New Issue
Block a user