public static void setGamemode(EntityPlayerMP player, int mode) { if (mode < 0 || mode >= NEIActions.gameModes.length || NEIActions.nameActionMap.containsKey(NEIActions.gameModes[mode]) && !NEIServerConfig.canPlayerPerformAction( player.getName(), NEIActions.gameModes[mode])) { return; } // creative+ NEIServerConfig.forPlayer(player.getName()).enableAction("creative+", mode == 2); if (mode == 2 && !(player.openContainer instanceof ContainerCreativeInv)) // open the container immediately for the client { NEISPH.processCreativeInv(player, true); } // change it on the server player.theItemInWorldManager.setGameType(getGameType(mode)); // tell the client to change it new PacketCustom(NEISPH.channel, 14).writeByte(mode).sendToPlayer(player); player.addChatMessage(new ChatComponentTranslation("nei.chat.gamemode." + mode)); }
public static void disableAction(int dim, String name, boolean disable) { getDimCompound(dim).setBoolean("disabled" + name, disable); NEISPH.sendActionDisabled(dim, name, disable); saveWorldCompound(); }