From 9a474fc6eabc51fb646a285769410a0a2bc8aac6 Mon Sep 17 00:00:00 2001 From: ProfMobius Date: Sun, 10 Nov 2013 19:02:11 +0100 Subject: [PATCH] Solved issue #1 Might have solved issue #2 --- mcp/mobius/opis/commands/CommandChunkList.java | 2 ++ mcp/mobius/opis/commands/CommandFrequency.java | 2 ++ mcp/mobius/opis/commands/CommandStart.java | 2 ++ mcp/mobius/opis/commands/CommandStop.java | 2 ++ mcp/mobius/opis/commands/CommandTileEntitiesList.java | 2 ++ mcp/mobius/opis/network/OpisPacketHandler.java | 4 +++- mcp/mobius/opis/network/Packets.java | 2 -- 7 files changed, 13 insertions(+), 3 deletions(-) diff --git a/mcp/mobius/opis/commands/CommandChunkList.java b/mcp/mobius/opis/commands/CommandChunkList.java index 0928db8..b6b68b6 100644 --- a/mcp/mobius/opis/commands/CommandChunkList.java +++ b/mcp/mobius/opis/commands/CommandChunkList.java @@ -9,6 +9,7 @@ import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; +import net.minecraft.server.dedicated.DedicatedServer; public class CommandChunkList extends CommandBase { @@ -53,6 +54,7 @@ public class CommandChunkList extends CommandBase { @Override public boolean canCommandSenderUseCommand(ICommandSender sender) { + if (sender instanceof DedicatedServer) return false; return MinecraftServer.getServer().getConfigurationManager().isPlayerOpped(((EntityPlayerMP)sender).username); } diff --git a/mcp/mobius/opis/commands/CommandFrequency.java b/mcp/mobius/opis/commands/CommandFrequency.java index 112ec2a..48d5f95 100644 --- a/mcp/mobius/opis/commands/CommandFrequency.java +++ b/mcp/mobius/opis/commands/CommandFrequency.java @@ -5,6 +5,7 @@ import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; +import net.minecraft.server.dedicated.DedicatedServer; public class CommandFrequency extends CommandBase { @@ -36,6 +37,7 @@ public class CommandFrequency extends CommandBase { @Override public boolean canCommandSenderUseCommand(ICommandSender sender) { + if (sender instanceof DedicatedServer) return true; return MinecraftServer.getServer().getConfigurationManager().isPlayerOpped(((EntityPlayerMP)sender).username); } diff --git a/mcp/mobius/opis/commands/CommandStart.java b/mcp/mobius/opis/commands/CommandStart.java index 431eb2b..57af6b2 100644 --- a/mcp/mobius/opis/commands/CommandStart.java +++ b/mcp/mobius/opis/commands/CommandStart.java @@ -5,6 +5,7 @@ import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; +import net.minecraft.server.dedicated.DedicatedServer; public class CommandStart extends CommandBase { @@ -33,6 +34,7 @@ public class CommandStart extends CommandBase { @Override public boolean canCommandSenderUseCommand(ICommandSender sender) { + if (sender instanceof DedicatedServer) return true; return MinecraftServer.getServer().getConfigurationManager().isPlayerOpped(((EntityPlayerMP)sender).username); } diff --git a/mcp/mobius/opis/commands/CommandStop.java b/mcp/mobius/opis/commands/CommandStop.java index e7ed81a..4e31b00 100644 --- a/mcp/mobius/opis/commands/CommandStop.java +++ b/mcp/mobius/opis/commands/CommandStop.java @@ -5,6 +5,7 @@ import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; +import net.minecraft.server.dedicated.DedicatedServer; public class CommandStop extends CommandBase { @@ -33,6 +34,7 @@ public class CommandStop extends CommandBase { @Override public boolean canCommandSenderUseCommand(ICommandSender sender) { + if (sender instanceof DedicatedServer) return true; return MinecraftServer.getServer().getConfigurationManager().isPlayerOpped(((EntityPlayerMP)sender).username); } diff --git a/mcp/mobius/opis/commands/CommandTileEntitiesList.java b/mcp/mobius/opis/commands/CommandTileEntitiesList.java index e88a87b..dafbe06 100644 --- a/mcp/mobius/opis/commands/CommandTileEntitiesList.java +++ b/mcp/mobius/opis/commands/CommandTileEntitiesList.java @@ -9,6 +9,7 @@ import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; +import net.minecraft.server.dedicated.DedicatedServer; public class CommandTileEntitiesList extends CommandBase { @@ -47,6 +48,7 @@ public class CommandTileEntitiesList extends CommandBase { @Override public boolean canCommandSenderUseCommand(ICommandSender sender) { + if (sender instanceof DedicatedServer) return false; return MinecraftServer.getServer().getConfigurationManager().isPlayerOpped(((EntityPlayerMP)sender).username); } diff --git a/mcp/mobius/opis/network/OpisPacketHandler.java b/mcp/mobius/opis/network/OpisPacketHandler.java index 22e9e0a..f7b3683 100644 --- a/mcp/mobius/opis/network/OpisPacketHandler.java +++ b/mcp/mobius/opis/network/OpisPacketHandler.java @@ -50,6 +50,8 @@ public class OpisPacketHandler implements IPacketHandler { if (packet.channel.equals("Opis")) { byte header = this.getHeader(packet); + if (header == -1) return; + if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) this.onPacketToClient(manager, packet, player, header); @@ -163,8 +165,8 @@ public class OpisPacketHandler implements IPacketHandler { public byte getHeader(Packet250CustomPayload packet){ - DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data)); try{ + DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data)); return inputStream.readByte(); } catch (IOException e){ return -1; diff --git a/mcp/mobius/opis/network/Packets.java b/mcp/mobius/opis/network/Packets.java index 05a0973..e667934 100644 --- a/mcp/mobius/opis/network/Packets.java +++ b/mcp/mobius/opis/network/Packets.java @@ -20,6 +20,4 @@ public class Packets { public static byte TILEENTITIES_TOPLIST = 0x22; // S => C public static byte REQ_TELEPORT = 0x30; // C => S - - }