AssetEditorPacketHandler class
Пакет: com.hypixel.hytale.builtin.asseteditor
Файл: com/hypixel/hytale/builtin/asseteditor/AssetEditorPacketHandler.java
extends: GenericPacketHandler
Поля (13)
| Модификаторы | Тип | Имя |
|---|---|---|
final |
HytaleLogger |
LOGGER |
|
|
break |
|
StringBuilder |
var2 |
|
String |
var2 |
|
String |
var2 |
|
IEventDispatcher |
var2 |
|
String |
var2 |
|
PlayerRef |
var2 |
|
IEventDispatcher |
var2 |
|
String |
var3 |
|
String |
var3 |
|
String |
var3 |
|
List |
var8 |
Методы (45)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
|
|
for for(com.hypixel.hytale.protocol.packets.asseteditor.AssetPath var6 : var1.paths) |
|
|
for for(com.hypixel.hytale.protocol.packets.asseteditor.AssetPath var7 : var1.paths) |
public |
void |
handlevoid handle(@Nonnull AssetEditorSubscribeModifiedAssetsChanges var1) |
public |
void |
handlevoid handle(@Nonnull AssetEditorUndoChanges var1) |
public |
void |
handlevoid handle(@Nonnull AssetEditorRedoChanges var1) |
public |
void |
handlevoid handle(AssetEditorFetchLastModifiedAssets var1) |
public |
void |
handlevoid handle(@Nonnull AssetEditorExportAssets var1) |
public |
void |
handlevoid handle(@Nonnull AssetEditorCreateAsset var1) |
public |
void |
handlevoid handle(@Nonnull AssetEditorFetchAsset var1) |
public |
void |
handlevoid handle(@Nonnull AssetEditorFetchJsonAssetWithParents var1) |
public |
void |
handlevoid handle(@Nonnull AssetEditorRequestChildrenList var1) |
public |
void |
handlevoid handle(@Nonnull AssetEditorUpdateAsset var1) |
public |
void |
handlevoid handle(@Nonnull AssetEditorUpdateJsonAsset var1) |
public |
void |
handlevoid handle(@Nonnull AssetEditorFetchAutoCompleteData var1) |
public |
void |
handlevoid handle(@Nonnull AssetEditorRenameAsset var1) |
public |
void |
handlevoid handle(@Nonnull AssetEditorDeleteAsset var1) |
public |
void |
handlevoid handle(@Nonnull AssetEditorActivateButton var1) |
public |
void |
handlevoid handle(@Nonnull AssetEditorRequestDataset var1) |
public |
void |
handlevoid handle(@Nonnull AssetEditorSelectAsset var1) |
public |
void |
handlevoid handle(@Nonnull AssetEditorCreateDirectory var1) |
public |
void |
handlevoid handle(@Nonnull AssetEditorDeleteDirectory var1) |
public |
void |
handlevoid handle(@Nonnull AssetEditorRenameDirectory var1) |
public |
void |
handlevoid handle(@Nonnull UpdateLanguage var1) |
public |
void |
handlevoid handle(@Nonnull AssetEditorSetGameTime var1) |
public |
void |
handlevoid handle(@Nonnull AssetEditorUpdateWeatherPreviewLock var1) |
public |
void |
handlevoid handle(@Nonnull AssetEditorUpdateAssetPack var1) |
public |
void |
handlevoid handle(@Nonnull AssetEditorDeleteAssetPack var1) |
public |
void |
handlevoid handle(@Nonnull AssetEditorCreateAssetPack var1) |
public |
void |
handlevoid handle(@Nonnull AssetEditorRequestAssetInheritance var1) |
public |
void |
handlevoid handle(@Nonnull ClientDisconnect var1) |
|
|
if if(var1.subscribe) |
|
|
if if(var2 != null && var3 != null) |
|
|
if if(var2 != null && var3 != null) |
|
|
if if(var1.dataset == null) |
|
|
if if(var2 != null) |
|
|
if if(var1.assetPath != null && var1.assetPath.pack != null && var1.assetPath.path != null) |
private |
void |
initvoid init() |
private |
boolean |
lacksPermissionboolean lacksPermission(int var1) |
private |
boolean |
lacksPermissionboolean lacksPermission() |
private |
boolean |
lacksPermissionboolean lacksPermission(PermissionQuery var1) |
private |
boolean |
lacksPermissionboolean lacksPermission(int var1, PermissionQuery var2) |
public |
void |
registerHandlersvoid registerHandlers() |
abstract |
|
super super(var1, var2) |
|
|
switch switch(var1.type) |
abstract |
|
this this(var1, var2, var3, var4, var5, null, null) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.builtin.asseteditor;
class="kw">import com.hypixel.hytale.builtin.asseteditor.event.AssetEditorActivateButtonEvent;
class="kw">import com.hypixel.hytale.builtin.asseteditor.event.AssetEditorFetchAutoCompleteDataEvent;
class="kw">import com.hypixel.hytale.builtin.asseteditor.event.AssetEditorRequestDataSetEvent;
class="kw">import com.hypixel.hytale.builtin.asseteditor.event.AssetEditorUpdateWeatherPreviewLockEvent;
class="kw">import com.hypixel.hytale.common.util.CompletableFutureUtil;
class="kw">import com.hypixel.hytale.event.IEventDispatcher;
class="kw">import com.hypixel.hytale.logger.HytaleLogger;
class="kw">import com.hypixel.hytale.protocol.HostAddress;
class="kw">import com.hypixel.hytale.protocol.NetworkChannel;
class="kw">import com.hypixel.hytale.protocol.io.ChannelConnection;
class="kw">import com.hypixel.hytale.protocol.packets.asseteditor.AssetEditorActivateButton;
class="kw">import com.hypixel.hytale.protocol.packets.asseteditor.AssetEditorCreateAsset;
class="kw">import com.hypixel.hytale.protocol.packets.asseteditor.AssetEditorCreateAssetPack;
class="kw">import com.hypixel.hytale.protocol.packets.asseteditor.AssetEditorCreateDirectory;
class="kw">import com.hypixel.hytale.protocol.packets.asseteditor.AssetEditorDeleteAsset;
class="kw">import com.hypixel.hytale.protocol.packets.asseteditor.AssetEditorDeleteAssetPack;
class="kw">import com.hypixel.hytale.protocol.packets.asseteditor.AssetEditorDeleteDirectory;
class="kw">import com.hypixel.hytale.protocol.packets.asseteditor.AssetEditorExportAssets;
class="kw">import com.hypixel.hytale.protocol.packets.asseteditor.AssetEditorFetchAsset;
class="kw">import com.hypixel.hytale.protocol.packets.asseteditor.AssetEditorFetchAutoCompleteData;
class="kw">import com.hypixel.hytale.protocol.packets.asseteditor.AssetEditorFetchAutoCompleteDataReply;
class="kw">import com.hypixel.hytale.protocol.packets.asseteditor.AssetEditorFetchJsonAssetWithParents;
class="kw">import com.hypixel.hytale.protocol.packets.asseteditor.AssetEditorFetchLastModifiedAssets;
class="kw">import com.hypixel.hytale.protocol.packets.asseteditor.AssetEditorPopupNotificationType;
class="kw">import com.hypixel.hytale.protocol.packets.asseteditor.AssetEditorRedoChanges;
class="kw">import com.hypixel.hytale.protocol.packets.asseteditor.AssetEditorRenameAsset;
class="kw">import com.hypixel.hytale.protocol.packets.asseteditor.AssetEditorRenameDirectory;
class="kw">import com.hypixel.hytale.protocol.packets.asseteditor.AssetEditorRequestAssetInheritance;
class="kw">import com.hypixel.hytale.protocol.packets.asseteditor.AssetEditorRequestChildrenList;
class="kw">import com.hypixel.hytale.protocol.packets.asseteditor.AssetEditorRequestDataset;
class="kw">import com.hypixel.hytale.protocol.packets.asseteditor.AssetEditorRequestDatasetReply;
class="kw">import com.hypixel.hytale.protocol.packets.asseteditor.AssetEditorSelectAsset;
class="kw">import com.hypixel.hytale.protocol.packets.asseteditor.AssetEditorSetGameTime;
class="kw">import com.hypixel.hytale.protocol.packets.asseteditor.AssetEditorSubscribeModifiedAssetsChanges;
class="kw">import com.hypixel.hytale.protocol.packets.asseteditor.AssetEditorUndoChanges;
class="kw">import com.hypixel.hytale.protocol.packets.asseteditor.AssetEditorUpdateAsset;
class="kw">import com.hypixel.hytale.protocol.packets.asseteditor.AssetEditorUpdateAssetPack;
class="kw">import com.hypixel.hytale.protocol.packets.asseteditor.AssetEditorUpdateJsonAsset;
class="kw">import com.hypixel.hytale.protocol.packets.asseteditor.AssetEditorUpdateWeatherPreviewLock;
class="kw">import com.hypixel.hytale.protocol.packets.connection.ClientDisconnect;
class="kw">import com.hypixel.hytale.protocol.packets.connection.DisconnectType;
class="kw">import com.hypixel.hytale.protocol.packets.connection.Pong;
class="kw">import com.hypixel.hytale.protocol.packets.interface_.UpdateLanguage;
class="kw">import com.hypixel.hytale.protocol.packets.world.UpdateEditorTimeOverride;
class="kw">import com.hypixel.hytale.server.core.HytaleServer;
class="kw">import com.hypixel.hytale.server.core.auth.PlayerAuthentication;
class="kw">import com.hypixel.hytale.server.core.io.ProtocolVersion;
class="kw">import com.hypixel.hytale.server.core.io.handlers.GenericPacketHandler;
class="kw">import com.hypixel.hytale.server.core.modules.i18n.I18nModule;
class="kw">import com.hypixel.hytale.server.core.permissions.HytalePermissions;
class="kw">import com.hypixel.hytale.server.core.permissions.PermissionQuery;
class="kw">import com.hypixel.hytale.server.core.universe.PlayerRef;
class="kw">import it.unimi.dsi.fastutil.objects.ObjectArrayList;
class="kw">import java.nio.file.Path;
class="kw">import java.util.List;
class="kw">import java.util.UUID;
class="kw">import java.util.logging.Level;
class="kw">import javax.annotation.Nonnull;
class="kw">public class AssetEditorPacketHandler class="kw">extends GenericPacketHandler {
class="kw">private class="kw">static class="kw">final HytaleLogger LOGGER = HytaleLogger.forEnclosingClass();
@Nonnull
class="kw">private class="kw">final EditorClient editorClient;
class="kw">public AssetEditorPacketHandler(@Nonnull ChannelConnection var1, @Nonnull ProtocolVersion var2, String var3, @Nonnull PlayerAuthentication var4) {
super(var1, var2);
this.auth = var4;
this.editorClient = new EditorClient(var3, var4, this);
this.init();
}
class="kw">public AssetEditorPacketHandler(@Nonnull ChannelConnection var1, @Nonnull ProtocolVersion var2, String var3, UUID var4, String var5) {
this(var1, var2, var3, var4, var5, null, null);
}
class="kw">public AssetEditorPacketHandler(
@Nonnull ChannelConnection var1, @Nonnull ProtocolVersion var2, String var3, UUID var4, String var5, byte[] var6, HostAddress var7
) {
super(var1, var2);
this.auth = null;
this.editorClient = new EditorClient(var3, var4, var5, this);
this.init();
}
class="kw">private void init() {
this.registerHandlers();
AssetEditorPlugin.get().handleInitializeClient(this.editorClient);
}
@Nonnull
class="kw">public EditorClient getEditorClient() {
class="kw">return this.editorClient;
}
@Nonnull
@Override
class="kw">public String getIdentifier() {
class="kw">return "{Editor(" + this.getChannel().formatRemoteAddress() + "), " + this.editorClient.getUuid() + ", " + this.editorClient.getUsername() + "}";
}
@Override
class="kw">public void closed(NetworkChannel var1) {
AssetEditorPlugin.get().handleEditorClientDisconnected(this.editorClient, this.disconnectReason);
}
class="kw">public void registerHandlers() {
this.registerHandler(1, var1 -> this.handle((ClientDisconnect)var1));
this.registerHandler(4, var1 -> this.handlePong((Pong)var1));
this.registerHandler(321, var1 -> this.handle((AssetEditorRequestChildrenList)var1));
this.registerHandler(324, var1 -> this.handle((AssetEditorUpdateAsset)var1));
this.registerHandler(323, var1 -> this.handle((AssetEditorUpdateJsonAsset)var1));
this.registerHandler(336, var1 -> this.handle((AssetEditorSelectAsset)var1));
this.registerHandler(310, var1 -> this.handle((AssetEditorFetchAsset)var1));
this.registerHandler(311, var1 -> this.handle((AssetEditorFetchJsonAssetWithParents)var1));
this.registerHandler(327, var1 -> this.handle((AssetEditorCreateAsset)var1));
this.registerHandler(307, var1 -> this.handle((AssetEditorCreateDirectory)var1));
this.registerHandler(333, var1 -> this.handle((AssetEditorRequestDataset)var1));
this.registerHandler(331, var1 -> this.handle((AssetEditorFetchAutoCompleteData)var1));
this.registerHandler(335, var1 -> this.handle((AssetEditorActivateButton)var1));
this.registerHandler(329, var1 -> this.handle((AssetEditorDeleteAsset)var1));
this.registerHandler(328, var1 -> this.handle((AssetEditorRenameAsset)var1));
this.registerHandler(308, var1 -> this.handle((AssetEditorDeleteDirectory)var1));
this.registerHandler(309, var1 -> this.handle((AssetEditorRenameDirectory)var1));
this.registerHandler(342, var1 -> this.handle((AssetEditorExportAssets)var1));
this.registerHandler(338, var1 -> this.handle((AssetEditorFetchLastModifiedAssets)var1));
this.registerHandler(349, var1 -> this.handle((AssetEditorUndoChanges)var1));
this.registerHandler(350, var1 -> this.handle((AssetEditorRedoChanges)var1));
this.registerHandler(341, var1 -> this.handle((AssetEditorSubscribeModifiedAssetsChanges)var1));
this.registerHandler(352, var1 -> this.handle((AssetEditorSetGameTime)var1));
this.registerHandler(354, var1 -> this.handle((AssetEditorUpdateWeatherPreviewLock)var1));
this.registerHandler(316, var1 -> this.handle((AssetEditorCreateAssetPack)var1));
this.registerHandler(315, var1 -> this.handle((AssetEditorUpdateAssetPack)var1));
this.registerHandler(317, var1 -> this.handle((AssetEditorDeleteAssetPack)var1));
this.registerHandler(232, var1 -> this.handle((UpdateLanguage)var1));
this.registerHandler(357, var1 -> this.handle((AssetEditorRequestAssetInheritance)var1));
}
class="kw">public void handle(@Nonnull AssetEditorSubscribeModifiedAssetsChanges var1) {
if (!this.lacksPermission()) {
if (var1.subscribe) {
AssetEditorPlugin.get().handleSubscribeToModifiedAssetsChanges(this.editorClient);
} else {
AssetEditorPlugin.get().handleUnsubscribeFromModifiedAssetsChanges(this.editorClient);
}
}
}
class="kw">public void handle(@Nonnull AssetEditorUndoChanges var1) {
if (!this.lacksPermission(var1.token)) {
LOGGER.at(Level.INFO).log("%s undoing last change", this.editorClient.getUsername());
AssetEditorPlugin.get().handleUndo(this.editorClient, new AssetPath(var1.path.pack, Path.of(var1.path.path)), var1.token);
}
}
class="kw">public void handle(@Nonnull AssetEditorRedoChanges var1) {
if (!this.lacksPermission(var1.token)) {
LOGGER.at(Level.INFO).log("%s redoing last change", this.editorClient.getUsername());
AssetEditorPlugin.get().handleRedo(this.editorClient, new AssetPath(var1.path.pack, Path.of(var1.path.path)), var1.token);
}
}
class="kw">public void handle(AssetEditorFetchLastModifiedAssets var1) {
if (!this.lacksPermission()) {
AssetEditorPlugin.get().handleFetchLastModifiedAssets(this.editorClient);
}
}
class="kw">public void handle(@Nonnull AssetEditorExportAssets var1) {
if (!this.lacksPermission()) {
StringBuilder var2 = new StringBuilder();
for (com.hypixel.hytale.protocol.packets.asseteditor.AssetPath var6 : var1.paths) {
if (!var2.isEmpty()) {
var2.append(", ");
}
var2.append(var6.toString());
}
LOGGER.at(Level.INFO).log("%s is exporting: %s", this.editorClient.getUsername(), var2.toString());
List var8 = new ObjectArrayList();
for (com.hypixel.hytale.protocol.packets.asseteditor.AssetPath var7 : var1.paths) {
var8.add(new AssetPath(var7.pack, Path.of(var7.path)));
}
AssetEditorPlugin.get().handleExportAssets(this.editorClient, var8);
}
}
class="kw">public void handle(@Nonnull AssetEditorCreateAsset var1) {
if (!this.lacksPermission(var1.token)) {
LOGGER.at(Level.INFO).log("%s is creating asset %s", this.editorClient.getUsername(), var1.path);
AssetEditorPlugin.get()
.handleCreateAsset(
this.editorClient, new AssetPath(var1.path.pack, Path.of(var1.path.path)), var1.data, var1.rebuildCaches, var1.buttonId, var1.token
);
}
}
class="kw">public void handle(@Nonnull AssetEditorFetchAsset var1) {
if (!this.lacksPermission(var1.token)) {
String var2 = var1.path != null ? var1.path.pack : null;
String var3 = var1.path != null ? var1.path.path : null;
if (var2 != null && var3 != null) {
LOGGER.at(Level.INFO).log("%s is fetching asset %s:%s, from opened tab: %s", this.editorClient.getUsername(), var2, var3, var1.isFromOpenedTab);
AssetEditorPlugin.get().handleFetchAsset(this.editorClient, new AssetPath(var1.path.pack, Path.of(var1.path.path)), var1.token);
} else {
LOGGER.at(Level.SEVERE).log("%s is fetching json asset with null pack or path", this.editorClient.getUsername());
}
}
}
class="kw">public void handle(@Nonnull AssetEditorFetchJsonAssetWithParents var1) {
if (!this.lacksPermission(var1.token)) {
String var2 = var1.path != null ? var1.path.pack : null;
String var3 = var1.path != null ? var1.path.path : null;
if (var2 != null && var3 != null) {
LOGGER.at(Level.INFO)
.log("%s is fetching json asset %s:%s, from opened tab: %s", this.editorClient.getUsername(), var2, var3, var1.isFromOpenedTab);
AssetEditorPlugin.get()
.handleFetchJsonAssetWithParents(this.editorClient, new AssetPath(var1.path.pack, Path.of(var1.path.path)), var1.isFromOpenedTab, var1.token);
} else {
LOGGER.at(Level.SEVERE).log("%s is fetching json asset with null pack or path", this.editorClient.getUsername());
}
}
}
class="kw">public void handle(@Nonnull AssetEditorRequestChildrenList var1) {
if (!this.lacksPermission()) {
LOGGER.at(Level.INFO).log("%s is requesting child ids for %s", this.editorClient.getUsername(), var1.path);
AssetEditorPlugin.get().handleRequestChildIds(this.editorClient, new AssetPath(var1.path.pack, Path.of(var1.path.path)));
}
}
class="kw">public void handle(@Nonnull AssetEditorUpdateAsset var1) {
if (!this.lacksPermission(var1.token)) {
LOGGER.at(Level.INFO).log("%s updating asset at %s", this.editorClient.getUsername(), var1.path);
AssetEditorPlugin.get().handleAssetUpdate(this.editorClient, new AssetPath(var1.path.pack, Path.of(var1.path.path)), var1.data, var1.token);
}
}
class="kw">public void handle(@Nonnull AssetEditorUpdateJsonAsset var1) {
if (!this.lacksPermission(var1.token)) {
LOGGER.at(Level.INFO).log("%s updating json asset at %s", this.editorClient.getUsername(), var1.path);
AssetEditorPlugin.get()
.handleJsonAssetUpdate(
this.editorClient, new AssetPath(var1.path.pack, Path.of(var1.path.path)), var1.assetType, var1.assetIndex, var1.commands, var1.token
);
}
}
class="kw">public void handle(@Nonnull AssetEditorFetchAutoCompleteData var1) {
if (!this.lacksPermission(var1.token)) {
if (var1.dataset == null) {
LOGGER.at(Level.WARNING).log("Tried to request null autocomplete dataset for asset editor");
this.editorClient.sendFailureReply(var1.token, Messages.AUTOCOMPLETE_DATA_SET_FETCH_FAILED);
} else {
CompletableFutureUtil._catch(
HytaleServer.get()
.getEventBus()
.dispatchForAsync(AssetEditorFetchAutoCompleteDataEvent.class, var1.dataset)
.dispatch(new AssetEditorFetchAutoCompleteDataEvent(this.editorClient, var1.dataset, var1.query))
.thenAccept(var2 -> {
if (var2.getResults() == null) {
LOGGER.at(Level.WARNING).log("Tried to request unknown autocomplete dataset for asset editor: %s", var1.dataset);
this.editorClient.sendFailureReply(var1.token, Messages.AUTOCOMPLETE_DATA_SET_FETCH_FAILED);
} else {
this.editorClient.getPacketHandler().write(new AssetEditorFetchAutoCompleteDataReply(var1.token, var2.getResults()));
}
})
);
}
}
}
class="kw">public void handle(@Nonnull AssetEditorRenameAsset var1) {
if (!this.lacksPermission(var1.token)) {
LOGGER.at(Level.WARNING).log("%s is renaming %s to %s", this.editorClient.getUsername(), var1.path, var1.newPath);
AssetEditorPlugin.get().handleRenameAsset(this.editorClient, new AssetPath(var1.path), new AssetPath(var1.newPath), var1.token);
}
}
class="kw">public void handle(@Nonnull AssetEditorDeleteAsset var1) {
if (!this.lacksPermission(var1.token)) {
LOGGER.at(Level.INFO).log("%s is deleting asset %s", this.editorClient.getUsername(), var1.path);
AssetEditorPlugin.get().handleDeleteAsset(this.editorClient, new AssetPath(var1.path), var1.token);
}
}
class="kw">public void handle(@Nonnull AssetEditorActivateButton var1) {
if (!this.lacksPermission()) {
AssetEditorPlugin.get().getLogger().at(Level.INFO).log("%s is activating button %s", this.editorClient.getUsername(), var1.buttonId);
IEventDispatcher var2 = HytaleServer.get().getEventBus().dispatchFor(AssetEditorActivateButtonEvent.class, var1.buttonId);
if (var2.hasListener()) {
var2.dispatch(new AssetEditorActivateButtonEvent(this.editorClient, var1.buttonId));
}
}
}
class="kw">public void handle(@Nonnull AssetEditorRequestDataset var1) {
if (!this.lacksPermission()) {
CompletableFutureUtil._catch(
HytaleServer.get()
.getEventBus()
.dispatchForAsync(AssetEditorRequestDataSetEvent.class, var1.name)
.dispatch(new AssetEditorRequestDataSetEvent(this.editorClient, var1.name, null))
.thenAccept(var2 -> {
if (var2.getResults() == null) {
HytaleLogger.getLogger().at(Level.WARNING).log("Tried to request unknown dataset list for asset editor: %s", var1.name);
} else {
this.editorClient.getPacketHandler().write(new AssetEditorRequestDatasetReply(var1.name, var2.getResults()));
}
})
);
}
}
class="kw">public void handle(@Nonnull AssetEditorSelectAsset var1) {
if (!this.lacksPermission()) {
String var2 = var1.path != null ? var1.path.pack : null;
String var3 = var1.path != null ? var1.path.path : null;
LOGGER.at(Level.INFO).log("%s selecting %s/%s", this.editorClient.getUsername(), var2, var3);
AssetEditorPlugin.get().handleSelectAsset(this.editorClient, var1.path != null ? new AssetPath(var1.path) : null);
}
}
class="kw">public void handle(@Nonnull AssetEditorCreateDirectory var1) {
if (!this.lacksPermission(var1.token)) {
LOGGER.at(Level.INFO).log("%s is creating directory %s", this.editorClient.getUsername(), var1.path);
AssetEditorPlugin.get().handleCreateDirectory(this.editorClient, new AssetPath(var1.path), var1.token);
}
}
class="kw">public void handle(@Nonnull AssetEditorDeleteDirectory var1) {
if (!this.lacksPermission(var1.token)) {
LOGGER.at(Level.INFO).log("%s is deleting directory %s", this.editorClient.getUsername(), var1.path);
AssetEditorPlugin.get().handleDeleteDirectory(this.editorClient, new AssetPath(var1.path), var1.token);
}
}
class="kw">public void handle(@Nonnull AssetEditorRenameDirectory var1) {
if (!this.lacksPermission(var1.token)) {
LOGGER.at(Level.INFO).log("%s is renaming directory %s to %s", this.editorClient.getUsername(), var1.path, var1.newPath);
AssetEditorPlugin.get().handleRenameDirectory(this.editorClient, new AssetPath(var1.path), new AssetPath(var1.newPath), var1.token);
}
}
class="kw">public void handle(@Nonnull UpdateLanguage var1) {
if (!this.lacksPermission()) {
this.editorClient.setLanguage(var1.language);
I18nModule.get().sendTranslations(this.editorClient.getPacketHandler(), this.editorClient.getLanguage());
}
}
class="kw">public void handle(@Nonnull AssetEditorSetGameTime var1) {
if (!this.lacksPermission()) {
PlayerRef var2 = this.editorClient.tryGetPlayer();
if (var2 != null) {
var2.getPacketHandler().write(new UpdateEditorTimeOverride(var1.gameTime, var1.paused));
}
}
}
class="kw">public void handle(@Nonnull AssetEditorUpdateWeatherPreviewLock var1) {
if (!this.lacksPermission()) {
IEventDispatcher var2 = HytaleServer.get().getEventBus().dispatchFor(AssetEditorUpdateWeatherPreviewLockEvent.class);
if (var2.hasListener()) {
var2.dispatch(new AssetEditorUpdateWeatherPreviewLockEvent(this.editorClient, var1.locked));
}
}
}
class="kw">public void handle(@Nonnull AssetEditorUpdateAssetPack var1) {
if (!this.lacksPermission(HytalePermissions.ASSET_EDITOR_PACKS_EDIT)) {
LOGGER.at(Level.INFO).log("%s is updating the asset pack manifest for %s", this.editorClient.getUsername(), var1.id);
AssetEditorPlugin.get().handleUpdateAssetPack(this.editorClient, var1.id, var1.manifest);
}
}
class="kw">public void handle(@Nonnull AssetEditorDeleteAssetPack var1) {
if (!this.lacksPermission(HytalePermissions.ASSET_EDITOR_PACKS_DELETE)) {
LOGGER.at(Level.INFO).log("%s is deleting the asset pack %s", this.editorClient.getUsername(), var1.id);
AssetEditorPlugin.get().handleDeleteAssetPack(this.editorClient, var1.id);
}
}
class="kw">public void handle(@Nonnull AssetEditorCreateAssetPack var1) {
if (!this.lacksPermission(var1.token, HytalePermissions.ASSET_EDITOR_PACKS_CREATE)) {
LOGGER.at(Level.INFO)
.log(
"%s is creating a new asset pack: %s:%s (directory index: %d)",
this.editorClient.getUsername(),
var1.manifest.group,
var1.manifest.name,
var1.targetDirectoryIndex
);
AssetEditorPlugin.get().handleCreateAssetPack(this.editorClient, var1.manifest, var1.token, var1.targetDirectoryIndex);
}
}
class="kw">public void handle(@Nonnull AssetEditorRequestAssetInheritance var1) {
if (!this.lacksPermission(var1.token)) {
LOGGER.at(Level.INFO).log("%s is requesting inheritance context for %s", this.editorClient.getUsername(), var1.assetPath);
if (var1.assetPath != null && var1.assetPath.pack != null && var1.assetPath.path != null) {
AssetEditorPlugin.get()
.handleRequestAssetInheritance(this.editorClient, new AssetPath(var1.assetPath.pack, Path.of(var1.assetPath.path)), var1.token);
} else {
this.editorClient.sendFailureReply(var1.token, Messages.FETCH_ASSET_FAILED);
}
}
}
class="kw">public void handle(@Nonnull ClientDisconnect var1) {
class="kw">switch (var1.type) {
case Disconnect:
this.disconnectReason.setClientDisconnectType(DisconnectType.Disconnect);
break;
case Crash:
this.disconnectReason.setClientDisconnectType(DisconnectType.Crash);
}
LOGGER.at(Level.INFO)
.log(
"%s - %s at %s left with reason: %s - %s",
this.editorClient.getUuid(),
this.editorClient.getUsername(),
this.getChannel().formatRemoteAddress(),
var1.type.name(),
var1.reason.name()
);
this.getChannel().closeApplicationConnection();
}
class="kw">private boolean lacksPermission(int var1) {
if (!this.editorClient.hasPermission(HytalePermissions.ASSET_EDITOR)) {
this.editorClient.sendFailureReply(var1, Messages.USAGE_DENIED);
class="kw">return true;
} else {
class="kw">return false;
}
}
class="kw">private boolean lacksPermission() {
class="kw">return this.lacksPermission(HytalePermissions.ASSET_EDITOR);
}
class="kw">private boolean lacksPermission(PermissionQuery var1) {
if (!this.editorClient.hasPermission(var1)) {
this.editorClient.sendPopupNotification(AssetEditorPopupNotificationType.Error, Messages.USAGE_DENIED);
class="kw">return true;
} else {
class="kw">return false;
}
}
class="kw">private boolean lacksPermission(int var1, PermissionQuery var2) {
if (!this.editorClient.hasPermission(var2)) {
this.editorClient.sendFailureReply(var1, Messages.USAGE_DENIED);
class="kw">return true;
} else {
class="kw">return false;
}
}
}