Package org.bukkit.craftbukkit.v1_6_R3.entity

Examples of org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer


  public SpoutCraftPlayer(CraftServer server, EntityPlayer entity) {
    super(server, entity);
    createInventory(null);
    if (entity.playerConnection != null) {
      CraftPlayer player = entity.playerConnection.getPlayer();
      perm = new SpoutPermissibleBase(player.addAttachment(Bukkit.getServer().getPluginManager().getPlugin("Spout")).getPermissible());
      perm.recalculatePermissions();

      hasPlayed = player.hasPlayedBefore();
      lastPlayed = player.getLastPlayed();
      firstPlayed = player.getFirstPlayed();
    } else {
      perm = new SpoutPermissibleBase(new PermissibleBase(this));
      perm.recalculatePermissions();
    }
    mainScreen = new InGameScreen(this.getEntityId());
View Full Code Here


                    }

                }
            }
        }
        PlayerInventory inv = new CraftInventoryPlayer(new net.minecraft.server.v1_6_R3.PlayerInventory(null));
        ItemStack[] stacks = inv.getContents();
        inv.setContents(array.toArray(stacks));
        return inv;
    }
View Full Code Here

        World world = interactLocation.getWorld();
        boolean currentState = (interactLocation.getBlock().getData() & 0x8) > 0;
        String state = switchState.toString();

        // Try for a linked player
        CraftPlayer craftPlayer = (CraftPlayer) player;
        if (craftPlayer == null && Bukkit.getOnlinePlayers().size() > 0) {
            // If there's none, link any player
            if (Bukkit.getOnlinePlayers().size() > 0) {
                craftPlayer = (CraftPlayer) Bukkit.getOnlinePlayers().toArray()[0];
            }
            else if (Depends.citizens != null) {
                // If there are no players, link any Human NPC
                for (NPC npc: CitizensAPI.getNPCRegistry()) {
                    if (npc.isSpawned() && npc.getEntity() instanceof Player) {
                        craftPlayer = (CraftPlayer) npc.getEntity();
                        break;
                    }
                }
                // TODO: backup if no human NPC available? (Fake EntityPlayer instance?)
            }
        }

        if ((state.equals("ON") && !currentState) ||
            (state.equals("OFF") && currentState) ||
             state.equals("TOGGLE")) {

            try {
                if (interactLocation.getBlock().getType() == Material.IRON_DOOR_BLOCK) {
                    Location block;
                    if (interactLocation.clone().add(0, -1, 0).getBlock().getType() == Material.IRON_DOOR_BLOCK)
                        block = interactLocation.clone().add(0, -1, 0);
                    else
                        block = interactLocation;
                    block.getBlock().setData((byte) (block.getBlock().getData() ^ 4));
                }
                else {

                    // TODO: Rewrite the below code to not use freakin' NMS!
                    Block.getById(interactLocation.getBlock().getType().getId())
                        .interact(((CraftWorld)world).getHandle(),
                                interactLocation.getBlockX(),
                                interactLocation.getBlockY(),
                                interactLocation.getBlockZ(),
                                craftPlayer != null ? craftPlayer.getHandle(): null, 0, 0f, 0f, 0f);
                }

                dB.echoDebug(scriptEntry, "Switched " + interactLocation.getBlock().getType().toString() + "! Current state now: " +
                        ((interactLocation.getBlock().getData() & 0x8) > 0 ? "ON" : "OFF"));
View Full Code Here

TOP

Related Classes of org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.