Skip to content

Commit

Permalink
try again
Browse files Browse the repository at this point in the history
  • Loading branch information
Pilzinsel64 committed Jan 12, 2025
1 parent bf91c3e commit c1c369d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 7 additions & 3 deletions src/main/java/codechicken/chunkloader/ChunkLoaderSPH.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;

import codechicken.core.ServerUtils;
import codechicken.lib.packet.PacketCustom;
import codechicken.lib.packet.PacketCustom.IServerPacketHandler;

Expand All @@ -23,7 +24,7 @@ public void handlePacket(PacketCustom packet, EntityPlayerMP sender, INetHandler
handleChunkLoaderChangePacket(sender.worldObj, packet);
break;
case 3:
handleChunkLoaderOwnerPackage(sender.worldObj, packet);
handleChunkLoaderOwnerPackage(sender, packet);
break;
}
}
Expand All @@ -36,8 +37,11 @@ private void handleChunkLoaderChangePacket(World world, PacketCustom packet) {
}
}

private void handleChunkLoaderOwnerPackage(World world, PacketCustom packet) {
TileEntity tile = world.getTileEntity(packet.readInt(), packet.readInt(), packet.readInt());
private void handleChunkLoaderOwnerPackage(EntityPlayerMP sender, PacketCustom packet) {
if (ChunkLoaderManager.opInteract() && !ServerUtils.isPlayerOP(sender.getCommandSenderName())) {
return; // Ignore, op can change owner only, if op-interact is enabled
}
TileEntity tile = sender.worldObj.getTileEntity(packet.readInt(), packet.readInt(), packet.readInt());
if (tile instanceof TileChunkLoader) {
TileChunkLoader ctile = (TileChunkLoader) tile;
ctile.setOwner(packet.readString());
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/codechicken/chunkloader/GuiChunkLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import org.lwjgl.opengl.GL11;

import codechicken.core.ServerUtils;
import codechicken.lib.render.CCRenderState;
import codechicken.lib.util.LangProxy;

Expand Down Expand Up @@ -126,8 +125,7 @@ private void drawContainerBackground() {
}

private boolean enableOwner() {
return ChunkLoaderManager.allowOwnerChange()
&& (!ChunkLoaderManager.opInteract() || ServerUtils.isPlayerOP(this.tile.owner));
return ChunkLoaderManager.allowOwnerChange();
}

public boolean doesGuiPauseGame() {
Expand Down

0 comments on commit c1c369d

Please sign in to comment.