PortalsPlugin class
Пакет: com.hypixel.hytale.builtin.portals
Файл: com/hypixel/hytale/builtin/portals/PortalsPlugin.java
extends: JavaPlugin
Поля (5)
| Модификаторы | Тип | Имя |
|---|---|---|
static |
PortalsPlugin |
instance |
|
|
instance |
|
Map |
var1 |
|
int |
var2 |
|
PortalGameplayConfig |
var5 |
Методы (9)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
public |
int |
countActiveFragmentsint countActiveFragments() |
static |
PortalsPlugin |
getInstancePortalsPlugin getInstance() |
public |
ComponentType<ChunkStore, PortalDevice> |
getPortalDeviceComponentTypeComponentType<ChunkStore, PortalDevice> getPortalDeviceComponentType() |
public |
ResourceType<EntityStore, PortalWorld> |
getPortalResourceTypeResourceType<EntityStore, PortalWorld> getPortalResourceType() |
public |
ComponentType<EntityStore, VoidEvent> |
getVoidEventComponentTypeComponentType<EntityStore, VoidEvent> getVoidEventComponentType() |
public |
ComponentType<EntityStore, VoidSpawner> |
getVoidPortalComponentTypeComponentType<EntityStore, VoidSpawner> getVoidPortalComponentType() |
|
|
if if(var5 != null) |
abstract |
|
super super(var1) |
private |
void |
turnOffPortalWhenWorldRemovedvoid turnOffPortalWhenWorldRemoved(@Nonnull RemoveWorldEvent var1) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.builtin.portals;
class="kw">import com.hypixel.hytale.builtin.adventure.worldevents.WorldEventsPlugin;
class="kw">import com.hypixel.hytale.builtin.instances.removal.RemovalCondition;
class="kw">import com.hypixel.hytale.builtin.portals.commands.FragmentCommands;
class="kw">import com.hypixel.hytale.builtin.portals.commands.player.LeaveCommand;
class="kw">import com.hypixel.hytale.builtin.portals.commands.utils.CursedHeldItemCommand;
class="kw">import com.hypixel.hytale.builtin.portals.commands.voidevent.VoidEventCommands;
class="kw">import com.hypixel.hytale.builtin.portals.components.PortalDevice;
class="kw">import com.hypixel.hytale.builtin.portals.components.voidevent.VoidEvent;
class="kw">import com.hypixel.hytale.builtin.portals.components.voidevent.VoidSpawner;
class="kw">import com.hypixel.hytale.builtin.portals.integrations.EnterPortalCondition;
class="kw">import com.hypixel.hytale.builtin.portals.integrations.FragmentOriginGameplayConfig;
class="kw">import com.hypixel.hytale.builtin.portals.integrations.PortalGameplayConfig;
class="kw">import com.hypixel.hytale.builtin.portals.integrations.PortalMarkerProvider;
class="kw">import com.hypixel.hytale.builtin.portals.integrations.PortalRemovalCondition;
class="kw">import com.hypixel.hytale.builtin.portals.interactions.EnterPortalInteraction;
class="kw">import com.hypixel.hytale.builtin.portals.interactions.ReturnPortalInteraction;
class="kw">import com.hypixel.hytale.builtin.portals.npc.builders.BuilderActionAdjustPortalTimer;
class="kw">import com.hypixel.hytale.builtin.portals.resources.PortalWorld;
class="kw">import com.hypixel.hytale.builtin.portals.systems.CloseWorldWhenBreakingDeviceSystems;
class="kw">import com.hypixel.hytale.builtin.portals.systems.PortalInvalidDestinationSystem;
class="kw">import com.hypixel.hytale.builtin.portals.systems.PortalTrackerSystems;
class="kw">import com.hypixel.hytale.builtin.portals.systems.curse.CurseItemDropsSystem;
class="kw">import com.hypixel.hytale.builtin.portals.systems.curse.DeleteCursedItemsOnSpawnSystem;
class="kw">import com.hypixel.hytale.builtin.portals.systems.curse.DiedInPortalSystem;
class="kw">import com.hypixel.hytale.builtin.portals.systems.voidevent.StartVoidEventInFragmentSystem;
class="kw">import com.hypixel.hytale.builtin.portals.systems.voidevent.VoidEventPlayerJoinSystem;
class="kw">import com.hypixel.hytale.builtin.portals.systems.voidevent.VoidEventRefSystem;
class="kw">import com.hypixel.hytale.builtin.portals.systems.voidevent.VoidEventStagesSystem;
class="kw">import com.hypixel.hytale.builtin.portals.systems.voidevent.VoidInvasionPortalsSpawnSystem;
class="kw">import com.hypixel.hytale.builtin.portals.systems.voidevent.VoidSpawnerSystems;
class="kw">import com.hypixel.hytale.builtin.portals.ui.PortalDevicePageSupplier;
class="kw">import com.hypixel.hytale.component.ComponentType;
class="kw">import com.hypixel.hytale.component.ResourceType;
class="kw">import com.hypixel.hytale.server.core.asset.type.gameplay.GameplayConfig;
class="kw">import com.hypixel.hytale.server.core.modules.interaction.interaction.config.Interaction;
class="kw">import com.hypixel.hytale.server.core.modules.interaction.interaction.config.server.OpenCustomUIInteraction;
class="kw">import com.hypixel.hytale.server.core.plugin.JavaPlugin;
class="kw">import com.hypixel.hytale.server.core.plugin.JavaPluginInit;
class="kw">import com.hypixel.hytale.server.core.universe.PlayerRef;
class="kw">import com.hypixel.hytale.server.core.universe.Universe;
class="kw">import com.hypixel.hytale.server.core.universe.world.World;
class="kw">import com.hypixel.hytale.server.core.universe.world.events.AddWorldEvent;
class="kw">import com.hypixel.hytale.server.core.universe.world.events.RemoveWorldEvent;
class="kw">import com.hypixel.hytale.server.core.universe.world.events.StartWorldEvent;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.ChunkStore;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import com.hypixel.hytale.server.npc.NPCPlugin;
class="kw">import java.util.Map;
class="kw">import javax.annotation.Nonnull;
class="kw">public class PortalsPlugin class="kw">extends JavaPlugin {
class="kw">private class="kw">static PortalsPlugin instance;
class="kw">private ResourceType<EntityStore, PortalWorld> portalResourceType;
class="kw">private ComponentType<ChunkStore, PortalDevice> portalDeviceComponentType;
class="kw">private ComponentType<EntityStore, VoidEvent> voidEventComponentType;
class="kw">private ComponentType<EntityStore, VoidSpawner> voidPortalComponentType;
class="kw">public class="kw">static PortalsPlugin getInstance() {
class="kw">return instance;
}
class="kw">public PortalsPlugin(@Nonnull JavaPluginInit var1) {
super(var1);
}
@Override
class="kw">protected void setup() {
instance = this;
this.portalResourceType = this.getEntityStoreRegistry().registerResource(PortalWorld.class, PortalWorld::new);
this.portalDeviceComponentType = this.getChunkStoreRegistry().registerComponent(PortalDevice.class, "Portal", PortalDevice.CODEC);
this.voidEventComponentType = this.getEntityStoreRegistry().registerComponent(VoidEvent.class, VoidEvent::new);
this.voidPortalComponentType = this.getEntityStoreRegistry().registerComponent(VoidSpawner.class, VoidSpawner::new);
this.getCodecRegistry(OpenCustomUIInteraction.PAGE_CODEC).register("PortalDevice", PortalDevicePageSupplier.class, PortalDevicePageSupplier.CODEC);
this.getCodecRegistry(Interaction.CODEC)
.register("Portal", EnterPortalInteraction.class, EnterPortalInteraction.CODEC)
.register("PortalReturn", ReturnPortalInteraction.class, ReturnPortalInteraction.CODEC);
this.getEventRegistry().registerGlobal(RemoveWorldEvent.class, this::turnOffPortalWhenWorldRemoved);
this.getEventRegistry()
.registerGlobal(AddWorldEvent.class, var0 -> var0.getWorld().getWorldMapManager().addMarkerProvider("portals", PortalMarkerProvider.INSTANCE));
this.getEventRegistry().registerGlobal(StartWorldEvent.class, var0 -> PortalInstanceRelinker.relinkAll(var0.getWorld()));
this.getChunkStoreRegistry().registerSystem(new PortalInvalidDestinationSystem());
this.getChunkStoreRegistry().registerSystem(new CloseWorldWhenBreakingDeviceSystems.ComponentRemoved());
this.getChunkStoreRegistry().registerSystem(new CloseWorldWhenBreakingDeviceSystems.EntityRemoved());
this.getEntityStoreRegistry().registerSystem(new PortalTrackerSystems.TrackerSystem());
this.getEntityStoreRegistry().registerSystem(new PortalTrackerSystems.UiTickingSystem());
this.getEntityStoreRegistry().registerSystem(new DiedInPortalSystem());
this.getEntityStoreRegistry().registerSystem(new CurseItemDropsSystem());
this.getEntityStoreRegistry().registerSystem(new DeleteCursedItemsOnSpawnSystem());
this.getEntityStoreRegistry().registerSystem(new VoidEventRefSystem());
this.getEntityStoreRegistry().registerSystem(new VoidEventPlayerJoinSystem(PlayerRef.getComponentType()));
this.getEntityStoreRegistry().registerSystem(new VoidInvasionPortalsSpawnSystem());
this.getEntityStoreRegistry().registerSystem(new VoidSpawnerSystems.Instantiate());
this.getEntityStoreRegistry().registerSystem(new StartVoidEventInFragmentSystem());
this.getEntityStoreRegistry().registerSystem(new VoidEventStagesSystem());
this.getCommandRegistry().registerCommand(new LeaveCommand());
this.getCommandRegistry().registerCommand(new CursedHeldItemCommand());
this.getCommandRegistry().registerCommand(new VoidEventCommands());
this.getCommandRegistry().registerCommand(new FragmentCommands());
this.getCodecRegistry(RemovalCondition.CODEC).register("Portal", PortalRemovalCondition.class, PortalRemovalCondition.CODEC);
this.getCodecRegistry(GameplayConfig.PLUGIN_CODEC)
.register(PortalGameplayConfig.class, "Portal", PortalGameplayConfig.CODEC)
.register(FragmentOriginGameplayConfig.class, "PortalOrigin", FragmentOriginGameplayConfig.CODEC);
WorldEventsPlugin.registerChunkStoreEventCondition(
this, EnterPortalCondition.TYPE, EnterPortalCondition.CODEC, EnterPortalCondition.Config.CODEC, new EnterPortalCondition.Handler()
);
NPCPlugin.get().registerCoreComponentType("AdjustPortalTimer", BuilderActionAdjustPortalTimer::new);
}
class="kw">private void turnOffPortalWhenWorldRemoved(@Nonnull RemoveWorldEvent var1) {
PortalInstanceLinks.forgetDestination(var1.getWorld().getWorldConfig().getUuid());
for (World var4 : Universe.get().getWorlds().values()) {
if (!var4.equals(var1.getWorld())) {
var4.execute(() -> PortalInvalidDestinationSystem.turnOffPortalsInWorld(var4, var1.getWorld()));
}
}
}
class="kw">public int countActiveFragments() {
Map var1 = Universe.get().getWorlds();
int var2 = 0;
for (World var4 : var1.values()) {
PortalGameplayConfig var5 = var4.getGameplayConfig().getPluginConfig().get(PortalGameplayConfig.class);
if (var5 != null) {
var2++;
}
}
class="kw">return var2;
}
class="kw">public ResourceType<EntityStore, PortalWorld> getPortalResourceType() {
class="kw">return this.portalResourceType;
}
class="kw">public ComponentType<ChunkStore, PortalDevice> getPortalDeviceComponentType() {
class="kw">return this.portalDeviceComponentType;
}
class="kw">public ComponentType<EntityStore, VoidEvent> getVoidEventComponentType() {
class="kw">return this.voidEventComponentType;
}
class="kw">public ComponentType<EntityStore, VoidSpawner> getVoidPortalComponentType() {
class="kw">return this.voidPortalComponentType;
}
}