changed chat message to only send client side

This commit is contained in:
MachineMuse 2013-01-26 01:29:36 -07:00
parent 884d703398
commit c32e56efdd
2 changed files with 5 additions and 3 deletions

View file

@ -15,7 +15,9 @@ import net.minecraft.client.settings.KeyBinding;
import org.lwjgl.input.Keyboard; import org.lwjgl.input.Keyboard;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.Player; import cpw.mods.fml.common.network.Player;
import cpw.mods.fml.relauncher.Side;
public class ClickableKeybinding extends ClickableButton { public class ClickableKeybinding extends ClickableButton {
protected List<ClickableModule> boundModules; protected List<ClickableModule> boundModules;
@ -52,7 +54,9 @@ public class ClickableKeybinding extends ClickableButton {
} }
for (ClickableModule module : boundModules) { for (ClickableModule module : boundModules) {
String valstring = toggleval ? " on" : " off"; String valstring = toggleval ? " on" : " off";
player.sendChatToPlayer("Toggled " + module.getModule().getName() + valstring); if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
player.sendChatToPlayer("Toggled " + module.getModule().getName() + valstring);
}
ItemUtils.toggleModuleForPlayer(player, module.getModule().getName(), toggleval); ItemUtils.toggleModuleForPlayer(player, module.getModule().getName(), toggleval);
MusePacketToggleRequest toggleRequest = new MusePacketToggleRequest((Player) player, module.getModule().getName(), toggleval); MusePacketToggleRequest toggleRequest = new MusePacketToggleRequest((Player) player, module.getModule().getName(), toggleval);
player.sendQueue.addToSendQueue(toggleRequest.getPacket250()); player.sendQueue.addToSendQueue(toggleRequest.getPacket250());

View file

@ -7,7 +7,6 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import net.machinemuse.general.MuseMathUtils; import net.machinemuse.general.MuseMathUtils;
import net.machinemuse.powersuits.common.MuseLogger;
import net.machinemuse.powersuits.powermodule.ModuleManager; import net.machinemuse.powersuits.powermodule.ModuleManager;
import net.machinemuse.powersuits.powermodule.PowerModule; import net.machinemuse.powersuits.powermodule.PowerModule;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@ -53,7 +52,6 @@ public class ItemUtils {
public static void toggleModule(NBTTagCompound itemTag, String name, boolean toggleval) { public static void toggleModule(NBTTagCompound itemTag, String name, boolean toggleval) {
if (ItemUtils.tagHasModule(itemTag, name)) { if (ItemUtils.tagHasModule(itemTag, name)) {
MuseLogger.logDebug("Toggling " + name + ": " + toggleval);
NBTTagCompound moduleTag = itemTag.getCompoundTag(name); NBTTagCompound moduleTag = itemTag.getCompoundTag(name);
moduleTag.setBoolean(ACTIVE, toggleval); moduleTag.setBoolean(ACTIVE, toggleval);
} }