[Idea]: Folia support for OpenInv #196
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2011-2022 lishid. All rights reserved.
|
* Copyright (C) 2011-2023 lishid. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -37,7 +37,7 @@ public class OpenPlayer extends CraftPlayer {
|
|||||||
// See CraftPlayer#loadData
|
// See CraftPlayer#loadData
|
||||||
CompoundTag loaded = this.server.getHandle().playerIo.load(this.getHandle());
|
CompoundTag loaded = this.server.getHandle().playerIo.load(this.getHandle());
|
||||||
if (loaded != null) {
|
if (loaded != null) {
|
||||||
readExtraData(loaded);
|
getHandle().readAdditionalSaveData(loaded);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,7 +49,6 @@ public class OpenPlayer extends CraftPlayer {
|
|||||||
PlayerDataStorage worldNBTStorage = player.server.getPlayerList().playerIo;
|
PlayerDataStorage worldNBTStorage = player.server.getPlayerList().playerIo;
|
||||||
|
|
||||||
CompoundTag playerData = player.saveWithoutId(new CompoundTag());
|
CompoundTag playerData = player.saveWithoutId(new CompoundTag());
|
||||||
setExtraData(playerData);
|
|
||||||
|
|
||||||
if (!isOnline()) {
|
if (!isOnline()) {
|
||||||
// Special case: save old vehicle data
|
// Special case: save old vehicle data
|
||||||
@@ -67,7 +66,7 @@ public class OpenPlayer extends CraftPlayer {
|
|||||||
File file2 = new File(worldNBTStorage.getPlayerDir(), player.getStringUUID() + ".dat_old");
|
File file2 = new File(worldNBTStorage.getPlayerDir(), player.getStringUUID() + ".dat_old");
|
||||||
Util.safeReplaceFile(file1, file, file2);
|
Util.safeReplaceFile(file1, file, file2);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogManager.getLogger().warn("Failed to save player data for {}: {}", player.getName().getString(), e.getMessage());
|
LogManager.getLogger().warn("Failed to save player data for {}: {}", player.getScoreboardName(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2011-2022 lishid. All rights reserved.
|
* Copyright (C) 2011-2023 lishid. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -23,6 +23,7 @@ import com.lishid.openinv.internal.OpenInventoryView;
|
|||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.network.chat.TextComponent;
|
import net.minecraft.network.chat.TextComponent;
|
||||||
import net.minecraft.network.protocol.game.ClientboundOpenScreenPacket;
|
import net.minecraft.network.protocol.game.ClientboundOpenScreenPacket;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
@@ -108,14 +109,25 @@ public class PlayerDataManager implements IPlayerDataManager {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the bukkit entity
|
// Load data. This also reads basic data into the player.
|
||||||
Player target = entity.getBukkitEntity();
|
// See CraftPlayer#loadData
|
||||||
if (target != null) {
|
CompoundTag loadedData = server.getPlayerList().playerIo.load(entity);
|
||||||
// Load data
|
|
||||||
target.loadData();
|
if (loadedData == null) {
|
||||||
|
// Exceptions with loading are logged by Mojang.
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
// Return the entity
|
|
||||||
return target;
|
// Also read "extra" data.
|
||||||
|
entity.readAdditionalSaveData(loadedData);
|
||||||
|
|
||||||
|
if (entity.level == null) {
|
||||||
|
// Paper: Move player to spawn
|
||||||
|
entity.spawnIn(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the Bukkit entity.
|
||||||
|
return entity.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
void injectPlayer(ServerPlayer player) throws IllegalAccessException {
|
void injectPlayer(ServerPlayer player) throws IllegalAccessException {
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2011-2022 lishid. All rights reserved.
|
* Copyright (C) 2011-2023 lishid. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -37,7 +37,7 @@ public class OpenPlayer extends CraftPlayer {
|
|||||||
// See CraftPlayer#loadData
|
// See CraftPlayer#loadData
|
||||||
CompoundTag loaded = this.server.getHandle().playerIo.load(this.getHandle());
|
CompoundTag loaded = this.server.getHandle().playerIo.load(this.getHandle());
|
||||||
if (loaded != null) {
|
if (loaded != null) {
|
||||||
readExtraData(loaded);
|
getHandle().readAdditionalSaveData(loaded);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2011-2022 lishid. All rights reserved.
|
* Copyright (C) 2011-2023 lishid. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -23,6 +23,7 @@ import com.lishid.openinv.internal.OpenInventoryView;
|
|||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.protocol.game.ClientboundOpenScreenPacket;
|
import net.minecraft.network.protocol.game.ClientboundOpenScreenPacket;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
@@ -100,20 +101,34 @@ public class PlayerDataManager implements IPlayerDataManager {
|
|||||||
|
|
||||||
ServerPlayer entity = new ServerPlayer(server, worldServer, profile);
|
ServerPlayer entity = new ServerPlayer(server, worldServer, profile);
|
||||||
|
|
||||||
|
// Stop listening for advancement progression - if this is not cleaned up, loading causes a memory leak.
|
||||||
|
entity.getAdvancements().stopListening();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
injectPlayer(entity);
|
injectPlayer(entity);
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the bukkit entity
|
// Load data. This also reads basic data into the player.
|
||||||
Player target = entity.getBukkitEntity();
|
// See CraftPlayer#loadData
|
||||||
if (target != null) {
|
CompoundTag loadedData = server.getPlayerList().playerIo.load(entity);
|
||||||
// Load data
|
|
||||||
target.loadData();
|
if (loadedData == null) {
|
||||||
|
// Exceptions with loading are logged by Mojang.
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
// Return the entity
|
|
||||||
return target;
|
// Also read "extra" data.
|
||||||
|
entity.readAdditionalSaveData(loadedData);
|
||||||
|
|
||||||
|
if (entity.level == null) {
|
||||||
|
// Paper: Move player to spawn
|
||||||
|
entity.spawnIn(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the Bukkit entity.
|
||||||
|
return entity.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
void injectPlayer(ServerPlayer player) throws IllegalAccessException {
|
void injectPlayer(ServerPlayer player) throws IllegalAccessException {
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright (C) 2011-2022 lishid. All rights reserved.
|
~ Copyright (C) 2011-2023 lishid. All rights reserved.
|
||||||
~
|
~
|
||||||
~ This program is free software: you can redistribute it and/or modify
|
~ 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
|
~ it under the terms of the GNU General Public License as published by
|
||||||
@@ -26,13 +26,13 @@
|
|||||||
<version>4.3.0-SNAPSHOT</version>
|
<version>4.3.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>openinvadapter1_19_R1</artifactId>
|
<artifactId>openinvadapter1_19_R3</artifactId>
|
||||||
<name>OpenInvAdapter1_19_R1</name>
|
<name>OpenInvAdapter1_19_R3</name>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>17</maven.compiler.source>
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
<maven.compiler.target>17</maven.compiler.target>
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
<spigot.version>1.19.1-R0.1-SNAPSHOT</spigot.version>
|
<spigot.version>1.19.4-R0.1-SNAPSHOT</spigot.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
@@ -14,7 +14,7 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.lishid.openinv.internal.v1_19_R1;
|
package com.lishid.openinv.internal.v1_19_R3;
|
||||||
|
|
||||||
import com.lishid.openinv.OpenInv;
|
import com.lishid.openinv.OpenInv;
|
||||||
import com.lishid.openinv.internal.IAnySilentContainer;
|
import com.lishid.openinv.internal.IAnySilentContainer;
|
||||||
@@ -54,7 +54,7 @@ import org.bukkit.GameMode;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Statistic;
|
import org.bukkit.Statistic;
|
||||||
import org.bukkit.block.ShulkerBox;
|
import org.bukkit.block.ShulkerBox;
|
||||||
import org.bukkit.craftbukkit.v1_19_R1.CraftWorld;
|
import org.bukkit.craftbukkit.v1_19_R3.CraftWorld;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -66,8 +66,6 @@ public class AnySilentContainer implements IAnySilentContainer {
|
|||||||
public AnySilentContainer() {
|
public AnySilentContainer() {
|
||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
// IDE warns about field not existing, but SpecialSource does not remap strings used in reflection.
|
|
||||||
// The warning is not suppressed as a reminder that it must manually be checked on updates.
|
|
||||||
this.serverPlayerGameModeGameType = ServerPlayerGameMode.class.getDeclaredField("b");
|
this.serverPlayerGameModeGameType = ServerPlayerGameMode.class.getDeclaredField("b");
|
||||||
this.serverPlayerGameModeGameType.setAccessible(true);
|
this.serverPlayerGameModeGameType.setAccessible(true);
|
||||||
} catch (NoSuchFieldException e) {
|
} catch (NoSuchFieldException e) {
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2011-2022 lishid. All rights reserved.
|
* Copyright (C) 2011-2023 lishid. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.lishid.openinv.internal.v1_19_R1;
|
package com.lishid.openinv.internal.v1_19_R3;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import net.minecraft.Util;
|
import net.minecraft.Util;
|
||||||
@@ -23,8 +23,8 @@ import net.minecraft.nbt.NbtIo;
|
|||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.level.storage.PlayerDataStorage;
|
import net.minecraft.world.level.storage.PlayerDataStorage;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.bukkit.craftbukkit.v1_19_R1.CraftServer;
|
import org.bukkit.craftbukkit.v1_19_R3.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_19_R3.entity.CraftPlayer;
|
||||||
|
|
||||||
public class OpenPlayer extends CraftPlayer {
|
public class OpenPlayer extends CraftPlayer {
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ public class OpenPlayer extends CraftPlayer {
|
|||||||
// See CraftPlayer#loadData
|
// See CraftPlayer#loadData
|
||||||
CompoundTag loaded = this.server.getHandle().playerIo.load(this.getHandle());
|
CompoundTag loaded = this.server.getHandle().playerIo.load(this.getHandle());
|
||||||
if (loaded != null) {
|
if (loaded != null) {
|
||||||
readExtraData(loaded);
|
getHandle().readAdditionalSaveData(loaded);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ public class OpenPlayer extends CraftPlayer {
|
|||||||
File file2 = new File(worldNBTStorage.getPlayerDir(), player.getStringUUID() + ".dat_old");
|
File file2 = new File(worldNBTStorage.getPlayerDir(), player.getStringUUID() + ".dat_old");
|
||||||
Util.safeReplaceFile(file1, file, file2);
|
Util.safeReplaceFile(file1, file, file2);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogManager.getLogger().warn("Failed to save player data for {}: {}", player.getName().getString(), e.getMessage());
|
LogManager.getLogger().warn("Failed to save player data for {}: {}", player.getScoreboardName(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2011-2022 lishid. All rights reserved.
|
* Copyright (C) 2011-2023 lishid. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.lishid.openinv.internal.v1_19_R1;
|
package com.lishid.openinv.internal.v1_19_R3;
|
||||||
|
|
||||||
import com.lishid.openinv.OpenInv;
|
import com.lishid.openinv.OpenInv;
|
||||||
import com.lishid.openinv.internal.IPlayerDataManager;
|
import com.lishid.openinv.internal.IPlayerDataManager;
|
||||||
@@ -23,6 +23,7 @@ import com.lishid.openinv.internal.OpenInventoryView;
|
|||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.protocol.game.ClientboundOpenScreenPacket;
|
import net.minecraft.network.protocol.game.ClientboundOpenScreenPacket;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
@@ -35,10 +36,10 @@ import net.minecraft.world.level.Level;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.craftbukkit.v1_19_R1.CraftServer;
|
import org.bukkit.craftbukkit.v1_19_R3.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_19_R3.entity.CraftPlayer;
|
||||||
import org.bukkit.craftbukkit.v1_19_R1.event.CraftEventFactory;
|
import org.bukkit.craftbukkit.v1_19_R3.event.CraftEventFactory;
|
||||||
import org.bukkit.craftbukkit.v1_19_R1.inventory.CraftContainer;
|
import org.bukkit.craftbukkit.v1_19_R3.inventory.CraftContainer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.InventoryView;
|
import org.bukkit.inventory.InventoryView;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -98,7 +99,7 @@ public class PlayerDataManager implements IPlayerDataManager {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerPlayer entity = new ServerPlayer(server, worldServer, profile, null);
|
ServerPlayer entity = new ServerPlayer(server, worldServer, profile);
|
||||||
|
|
||||||
// Stop listening for advancement progression - if this is not cleaned up, loading causes a memory leak.
|
// Stop listening for advancement progression - if this is not cleaned up, loading causes a memory leak.
|
||||||
entity.getAdvancements().stopListening();
|
entity.getAdvancements().stopListening();
|
||||||
@@ -109,14 +110,25 @@ public class PlayerDataManager implements IPlayerDataManager {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the bukkit entity
|
// Load data. This also reads basic data into the player.
|
||||||
Player target = entity.getBukkitEntity();
|
// See CraftPlayer#loadData
|
||||||
if (target != null) {
|
CompoundTag loadedData = server.getPlayerList().playerIo.load(entity);
|
||||||
// Load data
|
|
||||||
target.loadData();
|
if (loadedData == null) {
|
||||||
|
// Exceptions with loading are logged by Mojang.
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
// Return the entity
|
|
||||||
return target;
|
// Also read "extra" data.
|
||||||
|
entity.readAdditionalSaveData(loadedData);
|
||||||
|
|
||||||
|
if (entity.level == null) {
|
||||||
|
// Paper: Move player to spawn
|
||||||
|
entity.spawnIn(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the Bukkit entity.
|
||||||
|
return entity.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
void injectPlayer(ServerPlayer player) throws IllegalAccessException {
|
void injectPlayer(ServerPlayer player) throws IllegalAccessException {
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2011-2022 lishid. All rights reserved.
|
* Copyright (C) 2011-2023 lishid. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.lishid.openinv.internal.v1_19_R1;
|
package com.lishid.openinv.internal.v1_19_R3;
|
||||||
|
|
||||||
import com.lishid.openinv.internal.ISpecialEnderChest;
|
import com.lishid.openinv.internal.ISpecialEnderChest;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -33,8 +33,8 @@ import net.minecraft.world.item.Item;
|
|||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.block.entity.EnderChestBlockEntity;
|
import net.minecraft.world.level.block.entity.EnderChestBlockEntity;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftHumanEntity;
|
import org.bukkit.craftbukkit.v1_19_R3.entity.CraftHumanEntity;
|
||||||
import org.bukkit.craftbukkit.v1_19_R1.inventory.CraftInventory;
|
import org.bukkit.craftbukkit.v1_19_R3.inventory.CraftInventory;
|
||||||
import org.bukkit.entity.HumanEntity;
|
import org.bukkit.entity.HumanEntity;
|
||||||
import org.bukkit.inventory.InventoryHolder;
|
import org.bukkit.inventory.InventoryHolder;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2011-2022 lishid. All rights reserved.
|
* Copyright (C) 2011-2023 lishid. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.lishid.openinv.internal.v1_19_R1;
|
package com.lishid.openinv.internal.v1_19_R3;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.lishid.openinv.internal.ISpecialPlayerInventory;
|
import com.lishid.openinv.internal.ISpecialPlayerInventory;
|
||||||
@@ -33,6 +33,7 @@ import net.minecraft.nbt.ListTag;
|
|||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket;
|
import net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
import net.minecraft.tags.DamageTypeTags;
|
||||||
import net.minecraft.tags.TagKey;
|
import net.minecraft.tags.TagKey;
|
||||||
import net.minecraft.world.Container;
|
import net.minecraft.world.Container;
|
||||||
import net.minecraft.world.ContainerHelper;
|
import net.minecraft.world.ContainerHelper;
|
||||||
@@ -46,8 +47,8 @@ import net.minecraft.world.item.Item;
|
|||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftHumanEntity;
|
import org.bukkit.craftbukkit.v1_19_R3.entity.CraftHumanEntity;
|
||||||
import org.bukkit.craftbukkit.v1_19_R1.inventory.CraftInventory;
|
import org.bukkit.craftbukkit.v1_19_R3.inventory.CraftInventory;
|
||||||
import org.bukkit.entity.HumanEntity;
|
import org.bukkit.entity.HumanEntity;
|
||||||
import org.bukkit.inventory.InventoryHolder;
|
import org.bukkit.inventory.InventoryHolder;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -719,7 +720,7 @@ public class SpecialPlayerInventory extends Inventory implements ISpecialPlayerI
|
|||||||
|
|
||||||
for (int index : armorIndices) {
|
for (int index : armorIndices) {
|
||||||
ItemStack itemstack = this.armor.get(index);
|
ItemStack itemstack = this.armor.get(index);
|
||||||
if ((!damagesource.isFire() || !itemstack.getItem().isFireResistant()) && itemstack.getItem() instanceof ArmorItem) {
|
if ((!damagesource.is(DamageTypeTags.IS_FIRE) || !itemstack.getItem().isFireResistant()) && itemstack.getItem() instanceof ArmorItem) {
|
||||||
itemstack.hurtAndBreak((int) damage, this.player, localPlayer -> localPlayer.broadcastBreakEvent(EquipmentSlot.byTypeAndIndex(EquipmentSlot.Type.ARMOR, index)));
|
itemstack.hurtAndBreak((int) damage, this.player, localPlayer -> localPlayer.broadcastBreakEvent(EquipmentSlot.byTypeAndIndex(EquipmentSlot.Type.ARMOR, index)));
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2011-2022 lishid. All rights reserved.
|
* Copyright (C) 2011-2023 lishid. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -64,6 +64,7 @@ class InternalAccessor {
|
|||||||
case "v1_8_R3", "v1_15_R1", "v1_16_R2" -> "https://github.com/lishid/OpenInv/releases/tag/4.1.5";
|
case "v1_8_R3", "v1_15_R1", "v1_16_R2" -> "https://github.com/lishid/OpenInv/releases/tag/4.1.5";
|
||||||
case "v1_16_R3" -> "https://github.com/Jikoo/OpenInv/releases/tag/4.1.8";
|
case "v1_16_R3" -> "https://github.com/Jikoo/OpenInv/releases/tag/4.1.8";
|
||||||
case "v1_17_R1", "v1_18_R1" -> "https://github.com/Jikoo/OpenInv/releases/tag/4.1.10";
|
case "v1_17_R1", "v1_18_R1" -> "https://github.com/Jikoo/OpenInv/releases/tag/4.1.10";
|
||||||
|
case "v1_19_R1" -> "https://github.com/Jikoo/OpenInv/releases/tag/4.2.2";
|
||||||
default -> "https://github.com/Jikoo/OpenInv/releases";
|
default -> "https://github.com/Jikoo/OpenInv/releases";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
4
pom.xml
4
pom.xml
@@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
~ Copyright (C) 2011-2022 lishid. All rights reserved.
|
~ Copyright (C) 2011-2023 lishid. All rights reserved.
|
||||||
~
|
~
|
||||||
~ This program is free software: you can redistribute it and/or modify
|
~ 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
|
~ it under the terms of the GNU General Public License as published by
|
||||||
@@ -40,8 +40,8 @@
|
|||||||
<module>api</module>
|
<module>api</module>
|
||||||
<module>plugin</module>
|
<module>plugin</module>
|
||||||
<module>internal/v1_18_R2</module>
|
<module>internal/v1_18_R2</module>
|
||||||
<module>internal/v1_19_R1</module>
|
|
||||||
<module>internal/v1_19_R2</module>
|
<module>internal/v1_19_R2</module>
|
||||||
|
<module>internal/v1_19_R3</module>
|
||||||
<module>assembly</module>
|
<module>assembly</module>
|
||||||
</modules>
|
</modules>
|
||||||
</profile>
|
</profile>
|
||||||
|
Reference in New Issue
Block a user