public static boolean isPlayerInList( String playername, HashSet<String> list, boolean allowCards) { if (playername.equals("CONSOLE")) return list.contains(playername); playername = playername.toLowerCase(); if (allowCards) { if (list.contains("ALL")) return true; if ((ServerUtils.isPlayerOP(playername) || ServerUtils.isPlayerOwner(playername)) && list.contains("OP")) return true; } return list.contains(playername); }
public static void setHourForward(World world, int hour, boolean notify) { long day = (getTime(world) / 24000L) * 24000L; long newTime = day + 24000L + hour * 1000; setTime(newTime, world); if (notify) { ServerUtils.sendChatToAll( new ChatComponentTranslation("nei.chat.time", getTime(world) / 24000L, hour)); } }
public static void toggleRaining(World world, boolean notify) { boolean raining = !world.isRaining(); if (!raining) // turn off { ((WorldServer) world).provider.resetRainAndThunder(); } else { world.getWorldInfo().setRaining(!isRaining(world)); } if (notify) { ServerUtils.sendChatToAll( new ChatComponentTranslation("nei.chat.rain." + (raining ? "on" : "off"))); } }
public static void sendNotice(ICommandSender sender, IChatComponent msg, String permission) { ChatComponentTranslation notice = new ChatComponentTranslation("chat.type.admin", sender.getName(), msg.createCopy()); notice.getChatStyle().setColor(EnumChatFormatting.GRAY).setItalic(true); if (NEIServerConfig.canPlayerPerformAction("CONSOLE", permission)) { MinecraftServer.getServer().addChatMessage(notice); } for (EntityPlayer p : ServerUtils.getPlayers()) { if (p == sender) { p.addChatComponentMessage(msg); } else if (NEIServerConfig.canPlayerPerformAction(p.getName(), permission)) { p.addChatComponentMessage(notice); } } }