This commit is contained in:
okx-code
2025-05-19 22:23:44 +01:00
parent c83b85f819
commit 1d3c24cc18
4 changed files with 16 additions and 3 deletions

View File

@@ -489,7 +489,7 @@ hacks:
- " &5Bugs/Issues&r\n\nIf you've found a bug or have any other issues that require an admin.\nThen you can either raise a ticket on the discord or send a modmail via our reddit.\n\n &9R/CivMC&r"
- " &5Goodluck!&r\nThere are many things to do on CivMC. Let your ambitions run wild!\n\nLeave something behind people will remember for years to come.\n\nBe it your actions, your creations or your destruction..."
InvControl:
enabled: true
enabled: false
NewfriendAssist:
enabled: true
announce: '&f%Player% is brand new!'

Binary file not shown.

View File

@@ -7,7 +7,7 @@ settings:
enabled: true
minecraft: &default_minecraft
enabled: true
whitelist: false
whitelist: true
pvp_whitelist: false
pvp_hostname: 'pvp.civmc.net'
hostname: 'play.civmc.net'

View File

@@ -17,6 +17,7 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.craftbukkit.inventory.CraftInventoryPlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
@@ -85,7 +86,19 @@ public class InvControl extends SimpleHack<InvControlConfig> implements CommandE
// Fun NMS inventory reconstruction from file data.
net.minecraft.world.entity.player.Inventory nms_pl_inv = new net.minecraft.world.entity.player.Inventory(null);
ListTag inv = rawPlayer.getList("Inventory", rawPlayer.getId());
nms_pl_inv.load(inv); // We use this to bypass the Craft code which requires a player object, unlike NMS.
for(int i = 0; i < inv.size(); ++i) {
CompoundTag compound = inv.getCompound(i);
int i1 = compound.getByte("Slot") & 255;
net.minecraft.world.item.ItemStack itemStack = net.minecraft.world.item.ItemStack.parse((((CraftServer) Bukkit.getServer()).getServer().registryAccess()), compound).orElse(net.minecraft.world.item.ItemStack.EMPTY);
if (i1 >= 0 && i1 < nms_pl_inv.items.size()) {
nms_pl_inv.items.set(i1, itemStack);
} else if (i1 >= 100 && i1 < nms_pl_inv.armor.size() + 100) {
nms_pl_inv.armor.set(i1 - 100, itemStack);
} else if (i1 >= 150 && i1 < nms_pl_inv.offhand.size() + 150) {
nms_pl_inv.offhand.set(i1 - 150, itemStack);
}
}
PlayerInventory pl_inv = new CraftInventoryPlayer(nms_pl_inv);
invSee(sender, pl_inv, health, food, playername);