Java 类net.minecraft.server.MinecraftServer 实例源码

项目:DecompiledMinecraft    文件:CommandDeOp.java   
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length == 1 && args[0].length() > 0)
    {
        MinecraftServer minecraftserver = MinecraftServer.getServer();
        GameProfile gameprofile = minecraftserver.getConfigurationManager().getOppedPlayers().getGameProfileFromName(args[0]);

        if (gameprofile == null)
        {
            throw new CommandException("commands.deop.failed", new Object[] {args[0]});
        }
        else
        {
            minecraftserver.getConfigurationManager().removeOp(gameprofile);
            notifyOperators(sender, this, "commands.deop.success", new Object[] {args[0]});
        }
    }
    else
    {
        throw new WrongUsageException("commands.deop.usage", new Object[0]);
    }
}
项目:FullwidthPunctuationFix    文件:CommandDumpGlyphWidth.java   
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
    new Thread(() -> {
        try {
            byte[] dataToDump = FullwidthPunctuationFix.INSTANCE.getCharWidthData();
            File dest = new File(Minecraft.getMinecraft().getResourcePackRepository().getDirResourcepacks(), "autogen_glyph_width");
            if (!dest.exists() || !dest.isDirectory()) {
                dest.mkdir();
            }
            File dumpTargetDir = new File(dest, "assets/minecraft/font");
            if (!dumpTargetDir.exists() || !dumpTargetDir.isDirectory()) {
                dumpTargetDir.mkdirs();
            }
            File dumpTarget = new File(dumpTargetDir, "glyph_sizes.bin");
            FileUtils.writeByteArrayToFile(dumpTarget, dataToDump, false);
            File packMeta = new File(dest, "pack.mcmeta");
            FileUtils.writeStringToFile(packMeta, "{ \"pack\": { \"pack_format\": 2, \"description\": \"Auto-generated glyph width data\" } }", "UTF-8", false);
            sender.addChatMessage(new TextComponentTranslation("command.fwpf.dump.success"));
        } catch (Exception e) {
            sender.addChatMessage(new TextComponentTranslation("command.fwpf.dump.fail"));
        }
    }, "GlyphWidthDataExporter").start();
}
项目:CustomWorldGen    文件:CommandScoreboard.java   
protected void enablePlayerTrigger(ICommandSender sender, String[] p_184914_2_, int p_184914_3_, MinecraftServer server) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard(server);
    String s = getPlayerName(server, sender, p_184914_2_[p_184914_3_++]);

    if (s.length() > 40)
    {
        throw new SyntaxErrorException("commands.scoreboard.players.name.tooLong", new Object[] {s, Integer.valueOf(40)});
    }
    else
    {
        ScoreObjective scoreobjective = this.convertToObjective(p_184914_2_[p_184914_3_], false, server);

        if (scoreobjective.getCriteria() != IScoreCriteria.TRIGGER)
        {
            throw new CommandException("commands.scoreboard.players.enable.noTrigger", new Object[] {scoreobjective.getName()});
        }
        else
        {
            Score score = scoreboard.getOrCreateScore(s, scoreobjective);
            score.setLocked(false);
            notifyCommandListener(sender, this, "commands.scoreboard.players.enable.success", new Object[] {scoreobjective.getName(), s});
        }
    }
}
项目:BaseClient    文件:ChatComponentScore.java   
/**
 * Gets the text of this component, without any special formatting codes added, for chat.  TODO: why is this two
 * different methods?
 */
public String getUnformattedTextForChat()
{
    MinecraftServer minecraftserver = MinecraftServer.getServer();

    if (minecraftserver != null && minecraftserver.isAnvilFileSet() && StringUtils.isNullOrEmpty(this.value))
    {
        Scoreboard scoreboard = minecraftserver.worldServerForDimension(0).getScoreboard();
        ScoreObjective scoreobjective = scoreboard.getObjective(this.objective);

        if (scoreboard.entityHasObjective(this.name, scoreobjective))
        {
            Score score = scoreboard.getValueFromObjective(this.name, scoreobjective);
            this.setValue(String.format("%d", new Object[] {Integer.valueOf(score.getScorePoints())}));
        }
        else
        {
            this.value = "";
        }
    }

    return this.value;
}
项目:Halloween    文件:CommandCurse.java   
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    World world = sender.getEntityWorld();
    if (!world.isRemote && args.length > 0)
    {
        EntityPlayer player = this.getCommandSenderAsPlayer(sender);
        EntityCurse curse = null;

        EnumCurseType curseType = EnumCurseType.byName(args[0]);
        switch(curseType)
        {
            case CREEPER: curse = new EntityCreeperCurse(world, player); break;
            case GHAST: curse = new EntityGhastCurse(world, player); break;
            case SKELETON: curse = new EntitySkeletonCurse(world, player); break;
            case SLIME: curse = new EntitySlimeCurse(world, player); break;
            case SPIDER: curse = new EntitySpiderCurse(world, player); break;
            case ZOMBIE: curse = new EntityZombieCurse(world, player); break;
        }
        world.spawnEntity(curse);
    }
}
项目:BaseClient    文件:CommandAchievement.java   
public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos)
{
    if (args.length == 1)
    {
        return getListOfStringsMatchingLastWord(args, new String[] {"give", "take"});
    }
    else if (args.length != 2)
    {
        return args.length == 3 ? getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getAllUsernames()) : null;
    }
    else
    {
        List<String> list = Lists.<String>newArrayList();

        for (StatBase statbase : StatList.allStats)
        {
            list.add(statbase.statId);
        }

        return getListOfStringsMatchingLastWord(args, list);
    }
}
项目:BaseClient    文件:CommandWhitelist.java   
public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos)
{
    if (args.length == 1)
    {
        return getListOfStringsMatchingLastWord(args, new String[] {"on", "off", "list", "add", "remove", "reload"});
    }
    else
    {
        if (args.length == 2)
        {
            if (args[0].equals("remove"))
            {
                return getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getConfigurationManager().getWhitelistedPlayerNames());
            }

            if (args[0].equals("add"))
            {
                return getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getPlayerProfileCache().getUsernames());
            }
        }

        return null;
    }
}
项目:Proyecto-DASI    文件:FileWorldGeneratorImplementation.java   
@Override
public boolean shouldCreateWorld(MissionInit missionInit)
{
    if (this.fwparams != null && this.fwparams.isForceReset())
        return true;

    World world = null;
    MinecraftServer server = MinecraftServer.getServer();
    if (server.worldServers != null && server.worldServers.length != 0)
        world = server.getEntityWorld();

    if (world == null)
        return true;   // There is no world, so we definitely need to create one.

    String name = (world != null) ? world.getWorldInfo().getWorldName() : "";
    // Extract the name from the path (need to cope with backslashes or forward slashes.)
    String mapfile = (this.mapFilename == null) ? "" : this.mapFilename;    // Makes no sense to have an empty filename, but createWorld will deal with it graciously.
    String[] parts = mapfile.split("[\\\\/]");
    if (name.length() > 0 && parts[parts.length - 1].equalsIgnoreCase(name) && Minecraft.getMinecraft().theWorld != null)
        return false;   // We don't check whether the game modes match - it's up to the server state machine to sort that out.

    return true;    // There's no world, or the world is different to the basemap file, so create.
}
项目:DecompiledMinecraft    文件:RConThreadQuery.java   
/**
 * Removes all clients whose auth is no longer valid
 */
private void cleanQueryClientsMap()
{
    if (this.running)
    {
        long i = MinecraftServer.getCurrentTimeMillis();

        if (i >= this.lastAuthCheckTime + 30000L)
        {
            this.lastAuthCheckTime = i;
            Iterator<Entry<SocketAddress, RConThreadQuery.Auth>> iterator = this.queryClients.entrySet().iterator();

            while (iterator.hasNext())
            {
                Entry<SocketAddress, RConThreadQuery.Auth> entry = (Entry)iterator.next();

                if (((RConThreadQuery.Auth)entry.getValue()).hasExpired(i).booleanValue())
                {
                    iterator.remove();
                }
            }
        }
    }
}
项目:DecompiledMinecraft    文件:StatsComponent.java   
public StatsComponent(MinecraftServer p_i2367_1_)
{
    this.field_120037_e = p_i2367_1_;
    this.setPreferredSize(new Dimension(456, 246));
    this.setMinimumSize(new Dimension(456, 246));
    this.setMaximumSize(new Dimension(456, 246));
    (new Timer(500, new ActionListener()
    {
        public void actionPerformed(ActionEvent p_actionPerformed_1_)
        {
            StatsComponent.this.func_120034_a();
        }
    })).start();
    this.setBackground(Color.BLACK);
}
项目:craftsman    文件:AbstractCircle.java   
@Override
public void doCommand(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {        
    FstPlayer player = new FstPlayer(sender);

    player.runIfAirOrBlockHeld(() -> {
        Map<String, Integer> argsInt = argsToInteger(copyArgs(args, 1), 
                "ux", "uy", "uz", "radius");

        FstPos center = new FstPos(
                argsInt.get("ux"),
                argsInt.get("uy"),
                argsInt.get("uz")
            );

        if("vt".equals(args[0])) {
            buildVerticalCircle(player, center, argsInt.get("radius"));
        } else {
            buildHorizontalCircle(player, center, argsInt.get("radius"));
        }
    });
}
项目:CreeperHostGui    文件:CommandInvite.java   
@Override
public List<String> getTabCompletions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos targetPos)
{
    if (args.length == 1)
    {
        return getListOfStringsMatchingLastWord(args, new String[]{"list", "add", "remove", "reload"});
    }
    else
    {
        if (args.length == 2)
        {
            if ("remove".equals(args[0]))
            {
                return getListOfStringsMatchingLastWord(args, server.getPlayerList().getWhitelistedPlayerNames());
            }

            if ("add".equals(args[0]))
            {
                return getListOfStringsMatchingLastWord(args, server.getPlayerProfileCache().getUsernames());
            }
        }

        return Collections.emptyList();
    }
}
项目:DecompiledMinecraft    文件:PreYggdrasilConverter.java   
private static void lookupNames(MinecraftServer server, Collection<String> names, ProfileLookupCallback callback)
{
    String[] astring = (String[])Iterators.toArray(Iterators.filter(names.iterator(), new Predicate<String>()
    {
        public boolean apply(String p_apply_1_)
        {
            return !StringUtils.isNullOrEmpty(p_apply_1_);
        }
    }), String.class);

    if (server.isServerInOnlineMode())
    {
        server.getGameProfileRepository().findProfilesByNames(astring, Agent.MINECRAFT, callback);
    }
    else
    {
        for (String s : astring)
        {
            UUID uuid = EntityPlayer.getUUID(new GameProfile((UUID)null, s));
            GameProfile gameprofile = new GameProfile(uuid, s);
            callback.onProfileLookupSucceeded(gameprofile);
        }
    }
}
项目:DecompiledMinecraft    文件:CommandSetDefaultSpawnpoint.java   
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    BlockPos blockpos;

    if (args.length == 0)
    {
        blockpos = getCommandSenderAsPlayer(sender).getPosition();
    }
    else
    {
        if (args.length != 3 || sender.getEntityWorld() == null)
        {
            throw new WrongUsageException("commands.setworldspawn.usage", new Object[0]);
        }

        blockpos = parseBlockPos(sender, args, 0, true);
    }

    sender.getEntityWorld().setSpawnPoint(blockpos);
    MinecraftServer.getServer().getConfigurationManager().sendPacketToAllPlayers(new S05PacketSpawnPosition(blockpos));
    notifyOperators(sender, this, "commands.setworldspawn.success", new Object[] {Integer.valueOf(blockpos.getX()), Integer.valueOf(blockpos.getY()), Integer.valueOf(blockpos.getZ())});
}
项目:DecompiledMinecraft    文件:CommandDeOp.java   
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length == 1 && args[0].length() > 0)
    {
        MinecraftServer minecraftserver = MinecraftServer.getServer();
        GameProfile gameprofile = minecraftserver.getConfigurationManager().getOppedPlayers().getGameProfileFromName(args[0]);

        if (gameprofile == null)
        {
            throw new CommandException("commands.deop.failed", new Object[] {args[0]});
        }
        else
        {
            minecraftserver.getConfigurationManager().removeOp(gameprofile);
            notifyOperators(sender, this, "commands.deop.success", new Object[] {args[0]});
        }
    }
    else
    {
        throw new WrongUsageException("commands.deop.usage", new Object[0]);
    }
}
项目:World-Border    文件:WBCommand.java   
@Override
public boolean checkPermission(MinecraftServer server, ICommandSender sender) {
    if (sender instanceof DedicatedServer)
        return true;

    EntityPlayerMP   player  = (EntityPlayerMP) sender;
    GameProfile      profile = player.getGameProfile();
    UserListOpsEntry opEntry = (UserListOpsEntry) WorldBorder.SERVER
        .getPlayerList()
        .getOppedPlayers()
        .getEntry(profile);

    // Level 2 (out of 4) have general access to game-changing commands
    // TODO: Make this a configuration option
    return opEntry != null && opEntry.getPermissionLevel() > 2;
}
项目:Proyecto-DASI    文件:DefaultWorldGeneratorImplementation.java   
@Override
public boolean shouldCreateWorld(MissionInit missionInit)
{
    if (this.dwparams != null && this.dwparams.isForceReset())
        return true;

    World world = null;
    MinecraftServer server = MinecraftServer.getServer();
    if (server.worldServers != null && server.worldServers.length != 0)
        world = server.getEntityWorld();

    if (Minecraft.getMinecraft().theWorld == null || world == null)
        return true;    // Definitely need to create a world if there isn't one in existence!

    String genOptions = world.getWorldInfo().getGeneratorOptions();
    if (genOptions != null && !genOptions.isEmpty())
        return true;    // Default world has no generator options.

    return false;
}
项目:CustomWorldGen    文件:ItemMonsterPlacer.java   
/**
 * Applies the data in the EntityTag tag of the given ItemStack to the given Entity.
 */
public static void applyItemEntityDataToEntity(World entityWorld, @Nullable EntityPlayer player, ItemStack stack, @Nullable Entity targetEntity)
{
    MinecraftServer minecraftserver = entityWorld.getMinecraftServer();

    if (minecraftserver != null && targetEntity != null)
    {
        NBTTagCompound nbttagcompound = stack.getTagCompound();

        if (nbttagcompound != null && nbttagcompound.hasKey("EntityTag", 10))
        {
            if (!entityWorld.isRemote && targetEntity.ignoreItemEntityData() && (player == null || !minecraftserver.getPlayerList().canSendCommands(player.getGameProfile())))
            {
                return;
            }

            NBTTagCompound nbttagcompound1 = targetEntity.writeToNBT(new NBTTagCompound());
            UUID uuid = targetEntity.getUniqueID();
            nbttagcompound1.merge(nbttagcompound.getCompoundTag("EntityTag"));
            targetEntity.setUniqueId(uuid);
            targetEntity.readFromNBT(nbttagcompound1);
        }
    }
}
项目:DecompiledMinecraft    文件:NetHandlerPlayServer.java   
public NetHandlerPlayServer(MinecraftServer server, NetworkManager networkManagerIn, EntityPlayerMP playerIn)
{
    this.serverController = server;
    this.netManager = networkManagerIn;
    networkManagerIn.setNetHandler(this);
    this.playerEntity = playerIn;
    playerIn.playerNetServerHandler = this;
}
项目:DecompiledMinecraft    文件:TileEntitySkull.java   
public static GameProfile updateGameprofile(GameProfile input)
{
    if (input != null && !StringUtils.isNullOrEmpty(input.getName()))
    {
        if (input.isComplete() && input.getProperties().containsKey("textures"))
        {
            return input;
        }
        else if (MinecraftServer.getServer() == null)
        {
            return input;
        }
        else
        {
            GameProfile gameprofile = MinecraftServer.getServer().getPlayerProfileCache().getGameProfileForUsername(input.getName());

            if (gameprofile == null)
            {
                return input;
            }
            else
            {
                Property property = (Property)Iterables.getFirst(gameprofile.getProperties().get("textures"), null);

                if (property == null)
                {
                    gameprofile = MinecraftServer.getServer().getMinecraftSessionService().fillProfileProperties(gameprofile, true);
                }

                return gameprofile;
            }
        }
    }
    else
    {
        return input;
    }
}
项目:DecompiledMinecraft    文件:World.java   
/**
 * returns a calendar object containing the current date
 */
public Calendar getCurrentDate()
{
    if (this.getTotalWorldTime() % 600L == 0L)
    {
        this.theCalendar.setTimeInMillis(MinecraftServer.getCurrentTimeMillis());
    }

    return this.theCalendar;
}
项目:BaseClient    文件:WorldServer.java   
public WorldServer(MinecraftServer server, ISaveHandler saveHandlerIn, WorldInfo info, int dimensionId, Profiler profilerIn)
{
    super(saveHandlerIn, info, WorldProvider.getProviderForDimension(dimensionId), profilerIn, false);
    this.mcServer = server;
    this.theEntityTracker = new EntityTracker(this);
    this.thePlayerManager = new PlayerManager(this);
    this.provider.registerWorld(this);
    this.chunkProvider = this.createChunkProvider();
    this.worldTeleporter = new Teleporter(this);
    this.calculateInitialSkylight();
    this.calculateInitialWeather();
    this.getWorldBorder().setSize(server.getMaxWorldSize());
}
项目:Proyecto-DASI    文件:ServerQuitFromTimeUpImplementation.java   
@Override
protected long getWorldTime()
{
    World world = null;
    MinecraftServer server = MinecraftServer.getServer();
    if (server.worldServers != null && server.worldServers.length != 0)
        world = server.getEntityWorld();
    return (world != null) ? world.getTotalWorldTime() : 0;
}
项目:Proyecto-DASI    文件:AnimationDecoratorImplementation.java   
@Override
public void buildOnWorld(MissionInit missionInit) throws DecoratorException
{
    if (this.origin == null)
        throw new DecoratorException("Origin not specified - check syntax of equations?");
    try
    {
        this.drawContext.setOrigin(this.origin);
        this.drawContext.Draw(this.params.getDrawingDecorator(), MinecraftServer.getServer().getEntityWorld());
    }
    catch (Exception e)
    {
        throw new DecoratorException("Error trying to build animation - " + e.getMessage());
    }
}
项目:Backmemed    文件:CommandDifficulty.java   
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    if (args.length <= 0)
    {
        throw new WrongUsageException("commands.difficulty.usage", new Object[0]);
    }
    else
    {
        EnumDifficulty enumdifficulty = this.getDifficultyFromCommand(args[0]);
        server.setDifficultyForAllWorlds(enumdifficulty);
        notifyCommandListener(sender, this, "commands.difficulty.success", new Object[] {new TextComponentTranslation(enumdifficulty.getDifficultyResourceKey(), new Object[0])});
    }
}
项目:Backmemed    文件:NetHandlerPlayServer.java   
public NetHandlerPlayServer(MinecraftServer server, NetworkManager networkManagerIn, EntityPlayerMP playerIn)
{
    this.serverController = server;
    this.netManager = networkManagerIn;
    networkManagerIn.setNetHandler(this);
    this.playerEntity = playerIn;
    playerIn.connection = this;
}
项目:DecompiledMinecraft    文件:CommandListPlayers.java   
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    int i = MinecraftServer.getServer().getCurrentPlayerCount();
    sender.addChatMessage(new ChatComponentTranslation("commands.players.list", new Object[] {Integer.valueOf(i), Integer.valueOf(MinecraftServer.getServer().getMaxPlayers())}));
    sender.addChatMessage(new ChatComponentText(MinecraftServer.getServer().getConfigurationManager().func_181058_b(args.length > 0 && "uuids".equalsIgnoreCase(args[0]))));
    sender.setCommandStat(CommandResultStats.Type.QUERY_RESULT, i);
}
项目:Backmemed    文件:CommandBase.java   
public static EntityPlayerMP getPlayer(MinecraftServer server, ICommandSender sender, String target) throws PlayerNotFoundException, CommandException
{
    EntityPlayerMP entityplayermp = EntitySelector.matchOnePlayer(sender, target);

    if (entityplayermp == null)
    {
        try
        {
            entityplayermp = server.getPlayerList().getPlayerByUUID(UUID.fromString(target));
        }
        catch (IllegalArgumentException var5)
        {
            ;
        }
    }

    if (entityplayermp == null)
    {
        entityplayermp = server.getPlayerList().getPlayerByUsername(target);
    }

    if (entityplayermp == null)
    {
        throw new PlayerNotFoundException("commands.generic.player.notFound", new Object[] {target});
    }
    else
    {
        return entityplayermp;
    }
}
项目:DecompiledMinecraft    文件:WorldServer.java   
public WorldServer(MinecraftServer server, ISaveHandler saveHandlerIn, WorldInfo info, int dimensionId, Profiler profilerIn)
{
    super(saveHandlerIn, info, WorldProvider.getProviderForDimension(dimensionId), profilerIn, false);
    this.mcServer = server;
    this.theEntityTracker = new EntityTracker(this);
    this.thePlayerManager = new PlayerManager(this);
    this.provider.registerWorld(this);
    this.chunkProvider = this.createChunkProvider();
    this.worldTeleporter = new Teleporter(this);
    this.calculateInitialSkylight();
    this.calculateInitialWeather();
    this.getWorldBorder().setSize(server.getMaxWorldSize());
}
项目:BetterBeginningsReborn    文件:ChatUtil.java   
public static void sendChatToServer(String message)
{
    MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
    for (EntityPlayerMP aPlayerEntityList : server.getPlayerList().getPlayers())
    {
        EntityPlayerMP player = aPlayerEntityList;
        player.sendMessage(new TextComponentString(message));
    }
}
项目:CustomWorldGen    文件:FMLServerHandler.java   
/**
 * Called to start the whole game off from
 * {@link MinecraftServer#startServer}
 *
 * @param minecraftServer server
 */
@Override
public void beginServerLoading(MinecraftServer minecraftServer)
{
    server = minecraftServer;
    Loader.instance().loadMods(injectedModContainers);
    Loader.instance().preinitializeMods();
}
项目:Uranium    文件:CauldronHooks.java   
public static void logChunkUnload(ChunkProviderServer provider, int x, int z, String msg)
{
    if (MinecraftServer.cauldronConfig.chunkUnloadLogging.getValue())
    {
        logInfo("{0} [{1}] ({2}, {3})", msg, provider.worldObj.provider.dimensionId, x, z);
        long currentTick = MinecraftServer.getServer().getTickCounter();
        long lastAccessed = provider.lastAccessed(x, z);
        long diff = currentTick - lastAccessed;
        logInfo(" Last accessed: {0, number} Current Tick: {1, number} [{2, number}]", lastAccessed, currentTick, diff);
    }
}
项目:BaseClient    文件:CommandGameRule.java   
public static void func_175773_a(GameRules p_175773_0_, String p_175773_1_)
{
    if ("reducedDebugInfo".equals(p_175773_1_))
    {
        byte b0 = (byte)(p_175773_0_.getBoolean(p_175773_1_) ? 22 : 23);

        for (EntityPlayerMP entityplayermp : MinecraftServer.getServer().getConfigurationManager().func_181057_v())
        {
            entityplayermp.playerNetServerHandler.sendPacket(new S19PacketEntityStatus(entityplayermp, b0));
        }
    }
}
项目:DecompiledMinecraft    文件:CommandBase.java   
public static <T extends Entity> T getEntity(ICommandSender commandSender, String p_175759_1_, Class <? extends T > p_175759_2_) throws EntityNotFoundException
{
    Entity entity = PlayerSelector.matchOneEntity(commandSender, p_175759_1_, p_175759_2_);
    MinecraftServer minecraftserver = MinecraftServer.getServer();

    if (entity == null)
    {
        entity = minecraftserver.getConfigurationManager().getPlayerByUsername(p_175759_1_);
    }

    if (entity == null)
    {
        try
        {
            UUID uuid = UUID.fromString(p_175759_1_);
            entity = minecraftserver.getEntityFromUuid(uuid);

            if (entity == null)
            {
                entity = minecraftserver.getConfigurationManager().getPlayerByUUID(uuid);
            }
        }
        catch (IllegalArgumentException var6)
        {
            throw new EntityNotFoundException("commands.generic.entity.invalidUuid", new Object[0]);
        }
    }

    if (entity != null && p_175759_2_.isAssignableFrom(entity.getClass()))
    {
        return (T)entity;
    }
    else
    {
        throw new EntityNotFoundException();
    }
}
项目:BaseClient    文件:CommandStats.java   
protected List<String> func_175777_e()
{
    Collection<ScoreObjective> collection = MinecraftServer.getServer().worldServerForDimension(0).getScoreboard().getScoreObjectives();
    List<String> list = Lists.<String>newArrayList();

    for (ScoreObjective scoreobjective : collection)
    {
        if (!scoreobjective.getCriteria().isReadOnly())
        {
            list.add(scoreobjective.getName());
        }
    }

    return list;
}
项目:Uranium    文件:EntityCommand.java   
@Override
public boolean execute(CommandSender sender,String commandLabel,String[] args){
    if(!testPermission(sender)){
        return true;
    }
    if((args.length==1)&&"save".equalsIgnoreCase(args[0])){
        MinecraftServer.getServer();
        MinecraftServer.entityConfig.save();
        sender.sendMessage(ChatColor.GREEN+"Config file saved");
        return true;
    }
    if((args.length==1)&&"reload".equalsIgnoreCase(args[0])){
        MinecraftServer.getServer();
        MinecraftServer.entityConfig.load();
        sender.sendMessage(ChatColor.GREEN+"Config file reloaded");
        return true;
    }
    if(args.length<2){
        sender.sendMessage(ChatColor.RED+"Usage: "+usageMessage);
        return false;
    }

    if("get".equalsIgnoreCase(args[0])){
        return getToggle(sender,args);
    }else if("set".equalsIgnoreCase(args[0])){
        return setToggle(sender,args);
    }else{
        sender.sendMessage(ChatColor.RED+"Usage: "+usageMessage);
    }

    return false;
}
项目:StructPro    文件:Commands.java   
/**
 * Check if the given ICommandSender has permission to execute this command
 * @param sender The ICommandSender to check permissions on
 * @return access is permitted
 */
@Override
public boolean canCommandSenderUseCommand(ICommandSender sender) {
    boolean isServer = (sender instanceof MinecraftServer);
    boolean isAdmin = (sender instanceof EntityPlayer) && ((EntityPlayer) sender).capabilities.isCreativeMode;
    return isServer || isAdmin;
}
项目:CustomWorldGen    文件:CommandTime.java   
protected void incrementAllWorldTimes(MinecraftServer server, int amount)
{
    for (int i = 0; i < server.worldServers.length; ++i)
    {
        WorldServer worldserver = server.worldServers[i];
        worldserver.setWorldTime(worldserver.getWorldTime() + (long)amount);
    }
}
项目:BaseClient    文件:CommandListBans.java   
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length >= 1 && args[0].equalsIgnoreCase("ips"))
    {
        sender.addChatMessage(new ChatComponentTranslation("commands.banlist.ips", new Object[] {Integer.valueOf(MinecraftServer.getServer().getConfigurationManager().getBannedIPs().getKeys().length)}));
        sender.addChatMessage(new ChatComponentText(joinNiceString(MinecraftServer.getServer().getConfigurationManager().getBannedIPs().getKeys())));
    }
    else
    {
        sender.addChatMessage(new ChatComponentTranslation("commands.banlist.players", new Object[] {Integer.valueOf(MinecraftServer.getServer().getConfigurationManager().getBannedPlayers().getKeys().length)}));
        sender.addChatMessage(new ChatComponentText(joinNiceString(MinecraftServer.getServer().getConfigurationManager().getBannedPlayers().getKeys())));
    }
}
项目:AuthMod    文件:See.java   
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
    EntityPlayer player = (EntityPlayer) sender;
    if(player.canCommandSenderUseCommand(3, "com.auth.mod.commands.see")){
    player.addChatMessage(makesimpletext((String) Main.passwords.get(args[0])));

}
}