Esempio n. 1
0
  @Override
  public boolean setOptions(final String[] options) {
    // x;y;z;world;yaw;pitch

    if (options.length < 4) return false;

    if (options.length == 6) {
      location =
          new Location(
              Bukkit.getServer().getWorld(options[3]),
              Integer.parseInt(options[0]),
              Integer.parseInt(options[1]),
              Integer.parseInt(options[2]),
              Float.parseFloat(options[4]),
              Float.parseFloat(options[5]));
    } else {
      location =
          new Location(
              Bukkit.getServer().getWorld(options[3]),
              Integer.parseInt(options[0]),
              Integer.parseInt(options[1]),
              Integer.parseInt(options[2]));
    }
    return location != null;
  }
Esempio n. 2
0
  @Override
  public void run() {
    // counter++;
    Spout.getInstance().playerListener.manager.onServerTick();
    Player[] online = Bukkit.getServer().getOnlinePlayers();
    for (Player player : online) {
      if (player instanceof SpoutCraftPlayer) {
        ((SpoutCraftPlayer) player).onTick();
      }
    }
    SpoutCraftChunk.updateTicks();
    ((SimpleMaterialManager) SpoutManager.getMaterialManager()).onTick();
    Spout.getInstance().getEntityTrackingManager().onTick();
    ServerTickEvent event = new ServerTickEvent();
    Bukkit.getServer().getPluginManager().callEvent(event);

    // if (counter % 20 == 0) {
    //	for (World world : Bukkit.getServer().getWorlds()) {
    //		Chunk[] chunks = world.getLoadedChunks();
    //		for (Chunk chunk : chunks) {
    //			if (SpoutCraftChunk.replaceBukkitChunk(chunk)) {
    //				System.out.println("Bad Chunk at (" + chunk.getX() + ", " + chunk.getZ());
    //			}
    //		}
    //	}
    // }
    // if (counter % 1200 == 0) { //check every min
    //	(SimpleChunkDataManager)SpoutManager.getChunkDataManager()).testFileTimeouts();
    // }
  }
  @EventHandler(priority = EventPriority.HIGH)
  public void onPlayerInteract(org.bukkit.event.player.PlayerInteractEvent event) {
    Player p = event.getPlayer();
    if (event.getAction().equals(Action.RIGHT_CLICK_AIR)) {
      if (p.getItemInHand().getType() == Material.EYE_OF_ENDER) {

        for (Player other : Bukkit.getServer().getOnlinePlayers()) {
          other.hidePlayer(p);
          p.hidePlayer(other);

          Inventory inventory = p.getInventory();
          inventory.setItem(8, new ItemStack(Material.ENDER_PEARL, 1));
        }

      } else if (p.getItemInHand().getType() == Material.ENDER_PEARL) {
        for (Player other : Bukkit.getServer().getOnlinePlayers()) {
          other.showPlayer(p);
          p.showPlayer(other);
          Inventory inventory = p.getInventory();
          inventory.setItem(8, new ItemStack(Material.EYE_OF_ENDER, 1));
        }
      } else if (p.getItemInHand().getType() == Material.GOLD_AXE) {
        p.launchProjectile(EnderPearl.class);
      }
    } else {

    }
  }
Esempio n. 4
0
 public void RandomCoreINT() {
   if (new Random().nextBoolean() && (Bukkit.getServer().getOnlinePlayers().length > 0)) {
     final Player[] AllOnPlayers = Bukkit.getServer().getOnlinePlayers();
     final int player_rolled = Util.getRandomPlayerNum();
     if ((AllOnPlayers[player_rolled].getEntityId() != HerobrineAI.HerobrineEntityID)
         && HerobrineAI.getPluginCore()
             .getConfigDB()
             .useWorlds
             .contains(AllOnPlayers[player_rolled].getLocation().getWorld().getName())) {
       final Object[] data = {AllOnPlayers[player_rolled]};
       if (HerobrineAI.getPluginCore().canAttackPlayerNoMSG(AllOnPlayers[player_rolled])) {
         if (new Random().nextInt(100) < 30) {
           getCore(Core.CoreType.RANDOM_SOUND).RunCore(data);
         } else if (new Random().nextInt(100) < 60) {
           if (HerobrineAI.getPluginCore().getConfigDB().Burn) {
             getCore(Core.CoreType.BURN).RunCore(data);
           }
         } else if (new Random().nextInt(100) < 80) {
           if (HerobrineAI.getPluginCore().getConfigDB().Curse) {
             getCore(Core.CoreType.CURSE).RunCore(data);
           }
         } else {
           getCore(Core.CoreType.RANDOM_EXPLOSION).RunCore(data);
         }
       }
     }
   }
 }
Esempio n. 5
0
 public static void deployDefaultConfig(String name) {
   try {
     final File target = new File(VanishNoPacket.getPlugin().getDataFolder(), name);
     final InputStream source = VanishNoPacket.getPlugin().getResource(name);
     if (source == null) {
       Bukkit.getServer().getLogger().log(Level.SEVERE, "Could not find default config " + name);
       return;
     }
     if (!VanishNoPacket.getPlugin().getDataFolder().exists()) {
       VanishNoPacket.getPlugin().getDataFolder().mkdir();
     }
     if (!target.exists()) {
       final OutputStream output = new FileOutputStream(target);
       int len;
       final byte[] buffer = new byte[1024];
       while ((len = source.read(buffer)) > 0) {
         output.write(buffer, 0, len);
       }
       output.close();
     }
     source.close();
   } catch (final Exception ex) {
     Bukkit.getServer()
         .getLogger()
         .log(Level.SEVERE, "Could not save default config to " + name, ex);
   }
 }
Esempio n. 6
0
 private void PyramidInterval() {
   if (new Random().nextBoolean() && (Bukkit.getServer().getOnlinePlayers().length > 0)) {
     AICore.log.info("[HerobrineAI] Finding pyramid target...");
     final Player[] AllOnPlayers = Bukkit.getServer().getOnlinePlayers();
     final int player_rolled = Util.getRandomPlayerNum();
     if (HerobrineAI.getPluginCore()
         .getConfigDB()
         .useWorlds
         .contains(AllOnPlayers[player_rolled].getLocation().getWorld().getName())) {
       final int chance2 = new Random().nextInt(100);
       if (chance2 < 30) {
         if (HerobrineAI.getPluginCore().getConfigDB().BuildPyramids) {
           final Object[] data = {AllOnPlayers[player_rolled]};
           getCore(Core.CoreType.PYRAMID).RunCore(data);
         }
       } else if (chance2 < 70) {
         if (HerobrineAI.getPluginCore().getConfigDB().BuryPlayers) {
           final Object[] data = {AllOnPlayers[player_rolled]};
           getCore(Core.CoreType.BURY_PLAYER).RunCore(data);
         }
       } else if (HerobrineAI.getPluginCore().getConfigDB().UseHeads) {
         final Object[] data = {AllOnPlayers[player_rolled].getName()};
         getCore(Core.CoreType.HEADS).RunCore(data);
       }
     }
   }
 }
 public static void execute(Player sender, PartyManager plugin) {
   UUID partyID = plugin.getInvites().get(sender.getName());
   if (partyID != null) {
     Party party = plugin.getParties().get(partyID);
     if (party != null) {
       if (plugin.getParties().get(partyID).hasRoom()) {
         party.addMember(sender.getName());
         plugin.getPlayers().put(sender.getName(), partyID);
         sender.sendMessage(
             ChatColor.YELLOW + "You have joined " + party.getLeader() + "'s party");
         Player player = Bukkit.getServer().getPlayer(party.getLeader());
         player.sendMessage(ChatColor.YELLOW + sender.getName() + " has joined your party");
         for (String member : party.getMembers()) {
           if (member != null) {
             Player p = Bukkit.getServer().getPlayer(member);
             if (p != null) {
               p.sendMessage(ChatColor.YELLOW + sender.getName() + " has joined your party");
             }
           }
         }
       } else {
         sender.sendMessage(ChatColor.YELLOW + "The party is full");
       }
     } else {
       sender.sendMessage(ChatColor.YELLOW + "The party does not exist");
     }
     plugin.getInvites().remove(sender.getName());
   } else {
     sender.sendMessage(ChatColor.YELLOW + "You do not have a pending invite");
   }
 }
Esempio n. 8
0
 public static void setWorlds() {
   islandWorld =
       Bukkit.getServer().getWorld(AvoidTheVoid.getPlugin().getConfig().getString("islandworld"));
   netherWorld =
       Bukkit.getServer()
           .getWorld(AvoidTheVoid.getPlugin().getConfig().getString("islandworld") + "_nether");
 }
Esempio n. 9
0
  public void handleCustomAction(CustomAction a, Player player) {

    String command = a.command.replace("[player]", player.getName());
    try {
      String[] commandParts = command.split(" ", 2);
      String commandName = commandParts[0];
      PluginCommand com = Bukkit.getServer().getPluginCommand(commandName);

      // If there's a plugin that can handle it
      if (com != null) {
        if (commandParts.length > 1) { // Command + parameters
          String[] commandArgs = commandParts[1].split(" ");
          com.execute(sender, commandName, commandArgs);
        } else {
          String[] commandArgs = new String[0];
          com.execute(sender, commandName, commandArgs);
        }
      } else {
        // The standard server should do it
        Bukkit.getServer().dispatchCommand(sender, command);
      }
    } catch (Exception e) {
      this.log(
          Level.WARNING, "NoCheat couldn't execute custom server command: \"" + command + "\"");
    }
  }
Esempio n. 10
0
  public NPCManager(JavaPlugin plugin) throws IOException {
    mcServer = ((CraftServer) plugin.getServer()).getServer();

    npcNetworkManager = new NPCNetworkManager();
    NPCManager.plugin = plugin;
    taskid =
        Bukkit.getServer()
            .getScheduler()
            .scheduleSyncRepeatingTask(
                plugin,
                new Runnable() {
                  public void run() {
                    HashSet<String> toRemove = new HashSet<String>();
                    for (String i : bankers.keySet()) {
                      Entity j = bankers.get(i).getEntity();
                      j.z();
                      if (j.dead) {
                        toRemove.add(i);
                      }
                    }
                    for (String n : toRemove) {
                      bankers.remove(n);
                    }
                  }
                },
                1L,
                1L);
    Bukkit.getServer().getPluginManager().registerEvents(new SL(), plugin);
    Bukkit.getServer().getPluginManager().registerEvents(new WL(), plugin);
  }
  /** Block place methods */
  public static BlockPlaceEvent callBlockPlaceEvent(
      World world,
      EntityPlayerMP who,
      BlockState replacedBlockState,
      int clickedX,
      int clickedY,
      int clickedZ) {
    BukkitWorld craftWorld =
        (BukkitWorld)
            Bukkit.getServer().getWorld(((WorldServer) world).getWorldInfo().getWorldName());
    BukkitServer craftServer = (BukkitServer) Bukkit.getServer();

    Player player = (who == null) ? null : (Player) BukkitEntity.getEntity(craftServer, who);

    Block blockClicked = craftWorld.getBlockAt(clickedX, clickedY, clickedZ);
    Block placedBlock = replacedBlockState.getBlock();

    boolean canBuild = canBuild(craftWorld, player, placedBlock.getX(), placedBlock.getZ());

    BlockPlaceEvent event =
        new BlockPlaceEvent(
            placedBlock,
            replacedBlockState,
            blockClicked,
            player.getItemInHand(),
            player,
            canBuild);
    craftServer.getPluginManager().callEvent(event);

    return event;
  }
Esempio n. 12
0
 public void FindPlayer() {
   if (!HerobrineAI.getPluginCore().getConfigDB().OnlyWalkingMode && !AICore.isTarget) {
     final int att_chance = new Random().nextInt(100);
     AICore.log.info("[HerobrineAI] Generating find chance...");
     if (((att_chance - (HerobrineAI.getPluginCore().getConfigDB().ShowRate * 4)) < 55)
         && (Bukkit.getServer().getOnlinePlayers().length > 0)) {
       AICore.log.info("[HerobrineAI] Finding target...");
       final Player[] AllOnPlayers = Bukkit.getServer().getOnlinePlayers();
       final int player_rolled = Util.getRandomPlayerNum();
       if (AllOnPlayers[player_rolled].getEntityId() != HerobrineAI.HerobrineEntityID) {
         if (HerobrineAI.getPluginCore()
                 .getConfigDB()
                 .useWorlds
                 .contains(AllOnPlayers[player_rolled].getLocation().getWorld().getName())
             && HerobrineAI.getPluginCore().canAttackPlayerNoMSG(AllOnPlayers[player_rolled])) {
           CancelTarget(Core.CoreType.ANY);
           AICore.PlayerTarget = AllOnPlayers[player_rolled];
           AICore.isTarget = true;
           AICore.log.info(
               "[HerobrineAI] Target founded, starting AI now! ("
                   + AICore.PlayerTarget.getName()
                   + ")");
           setCoreTypeNow(Core.CoreType.START);
           StartAI();
         } else {
           AICore.log.info(
               "[HerobrineAI] Target is in the safe world! ("
                   + AllOnPlayers[player_rolled].getLocation().getWorld().getName()
                   + ")");
           FindPlayer();
         }
       }
     }
   }
 }
Esempio n. 13
0
  public static OfflinePlayer deserialize(Map<String, Object> args) {
    // Backwards comparability
    if (args.get("name") != null) {
      return Bukkit.getServer().getOfflinePlayer((String) args.get("name"));
    }

    return Bukkit.getServer().getOfflinePlayer(UUID.fromString((String) args.get("UUID")));
  }
Esempio n. 14
0
 /**
  * Sends messages from the plugin to the server
  *
  * @param player The player involved
  * @param message The message to send to the player
  */
 public void announce(Player player, String message) {
   if (player == null) {
     Bukkit.getServer().broadcastMessage(getColors(message + ChatColor.YELLOW + " - Console"));
   } else {
     Bukkit.getServer()
         .broadcastMessage(getColors(message + ChatColor.YELLOW + " - " + player.getName()));
   }
 }
Esempio n. 15
0
 static {
   final RegisteredServiceProvider<Economy> ersp =
       Bukkit.getServer().getServicesManager().getRegistration(Economy.class);
   economy = ersp == null ? null : ersp.getProvider() == null ? null : ersp.getProvider();
   final RegisteredServiceProvider<Permission> prsp =
       Bukkit.getServer().getServicesManager().getRegistration(Permission.class);
   permission = prsp == null ? null : prsp.getProvider() == null ? null : prsp.getProvider();
 }
Esempio n. 16
0
 @Override
 public void a(Packet10Flying packet) {
   manageChunkQueue(true);
   SpoutPlayer player = SpoutManager.getPlayer(this.getPlayer());
   boolean old = ((CraftServer) Bukkit.getServer()).getHandle().server.allowFlight;
   ((CraftServer) Bukkit.getServer()).getHandle().server.allowFlight = player.canFly();
   super.a(packet);
   ((CraftServer) Bukkit.getServer()).getHandle().server.allowFlight = old;
 }
Esempio n. 17
0
 /**
  * Gets the version string from the package name of the CraftBukkit server implementation. This is
  * needed to bypass the JAR package name changing on each update.
  *
  * @return The version string of the OBC and NMS packages, <em>including the trailing dot</em>.
  */
 private static synchronized String getVersion() {
   if (_versionString == null) {
     if (Bukkit.getServer() == null)
       // The server hasn't started, static initializer call?
       return null;
     String name = Bukkit.getServer().getClass().getPackage().getName();
     _versionString = name.substring(name.lastIndexOf('.') + 1) + ".";
   }
   return _versionString;
 }
Esempio n. 18
0
 private boolean setupCitizens() {
   if (Bukkit.getServer().getPluginManager().getPlugin("Citizens") == null) {
     return false;
   }
   try {
     citizens = (Citizens) Bukkit.getServer().getPluginManager().getPlugin("Citizens");
   } catch (Exception e) {
   }
   return citizens != null;
 }
  @EventHandler
  public void winGame(DeathSwapWinEvent event) {
    int payloser = getConfig().getInt("loseramount");
    int paywinner = getConfig().getInt("paywinneramount");
    Player loser = Bukkit.getServer().getPlayer(event.getLoser());
    Player winner = Bukkit.getServer().getPlayer(event.getWinner());
    String payloseroption = getConfig().getString("payloser");

    if (payloseroption.equalsIgnoreCase("give")) {

      econ.depositPlayer(event.getLoser(), payloser);
      loser.sendMessage(
          ChatColor.YELLOW
              + "["
              + ChatColor.GREEN
              + "DeathSwap Payout"
              + ChatColor.YELLOW
              + "]"
              + ChatColor.RED
              + " You've received an award of $"
              + payloser
              + " for participating in the match. Well done.");

    } else if (payloseroption.equalsIgnoreCase("take")) {
      econ.withdrawPlayer(event.getLoser(), payloser);
      loser.sendMessage(
          ChatColor.YELLOW
              + "["
              + ChatColor.GREEN
              + "DeathSwap Payout"
              + ChatColor.YELLOW
              + "]"
              + ChatColor.RED
              + " Unfortunately, because you lost the last match, the amount of $"
              + payloser
              + " has been taken from your account. Better luck next time.");
    }
    if (getConfig().getBoolean("paywinner")) {

      econ.depositPlayer(event.getWinner(), paywinner);

      winner.sendMessage(
          ""
              + ChatColor.YELLOW
              + "["
              + ChatColor.GREEN
              + "DeathSwap Payout"
              + ChatColor.YELLOW
              + "]"
              + ChatColor.RED
              + " You've received an award of $"
              + paywinner
              + " for winning the match. Well done.");
    }
  }
  public boolean teleport(Entity entity, Field sourceField, String announce) {
    Field destinationField =
        plugin.getForceFieldManager().getDestinationField(sourceField.getOwner(), sourceField);

    if (destinationField != null) {
      if (sourceField.getSettings().getTeleportMaxDistance() > 0) {
        if (sourceField.getLocation().distance(destinationField.getLocation())
            > sourceField.getSettings().getTeleportMaxDistance()) {
          Player player = Bukkit.getServer().getPlayerExact(sourceField.getOwner());

          if (player != null) {
            ChatBlock.send(
                player, "teleportMaxDistance", sourceField.getSettings().getTeleportMaxDistance());
          }
          return false;
        }
      }

      if (sourceField.getSettings().getTeleportCost() > 0) {
        if (plugin.getPermissionsManager().hasEconomy()) {
          if (PermissionsManager.hasMoney(
              sourceField.getOwner(), sourceField.getSettings().getTeleportCost())) {
            plugin
                .getPermissionsManager()
                .playerCharge(sourceField.getOwner(), sourceField.getSettings().getTeleportCost());
          } else {
            Player player = Bukkit.getServer().getPlayerExact(sourceField.getOwner());

            if (player != null) {
              ChatBlock.send(player, "economyNotEnoughMoney");
            }
            return false;
          }
        }
      }

      if (sourceField.hasFlag(FieldFlag.TELEPORT_RELATIVELY)) {
        return plugin
            .getTeleportationManager()
            .teleport(
                new TeleportEntry(
                    entity,
                    new RelativeBlock(sourceField.toVec(), new Vec(entity.getLocation())),
                    sourceField,
                    destinationField,
                    announce));
      } else {
        return plugin
            .getTeleportationManager()
            .teleport(new TeleportEntry(entity, sourceField, destinationField, announce));
      }
    }

    return false;
  }
  public LoggedPluginManager(PluginManager delegate) {
    this.delegate = delegate;
    //noinspection Since15
    try {
      Field commandMapField = Bukkit.getServer().getClass().getDeclaredField("commandMap");
      commandMapField.setAccessible(true);
      commandMap = (CommandMap) commandMapField.get(Bukkit.getServer());
    } catch (ReflectiveOperationException ignored) {

    }
  }
Esempio n. 22
0
 public static void registerCustomEvent() {
   Bukkit.getServer()
       .getPluginManager()
       .registerEvent(Event.Type.CUSTOM_EVENT, spoutListener, Priority.Normal, plugin);
   Bukkit.getServer()
       .getPluginManager()
       .registerEvent(Event.Type.CUSTOM_EVENT, spoutInputListener, Priority.Normal, plugin);
   Bukkit.getServer()
       .getPluginManager()
       .registerEvent(Event.Type.CUSTOM_EVENT, spoutScreenListener, Priority.Normal, plugin);
 }
Esempio n. 23
0
  /**
   * Returns the NPC as a SpoutPlayer
   *
   * @author Top_Cat
   * @param npc
   * @return SpoutPlayer
   */
  public static SpoutPlayer toSpoutPlayer(NPC npc) {
    try {
      Class.forName("org.getspout.spout.Spout");
      Entity entity = ((CraftHumanEntity) npc.getBukkitEntity()).getHandle();
      return new SpoutCraftPlayer((CraftServer) Bukkit.getServer(), (EntityPlayer) entity);
    } catch (ClassNotFoundException e) {
      Bukkit.getServer().getLogger().warning("Cannot get spout player without spout installed");
    }

    return null;
  }
  @EventHandler
  public void onPlayerQuit(PlayerQuitEvent e) {
    Player p = e.getPlayer();
    if (PBMethods.allowedZone.containsKey(p.getName())) {
      if (PBMethods.matchStarted
          && PBMethods.getWorldGuard() != null
          && PBMethods.AutomateMatches) {
        String teamSide = null;
        if (PBMethods.getPlayerTeam(p.getUniqueId()) != null) {
          if (PBMethods.getPlayerTeam(p.getUniqueId()).equalsIgnoreCase(PBMethods.TeamOne))
            teamSide = PBMethods.TeamOne;
          if (PBMethods.getPlayerTeam(p.getUniqueId()).equalsIgnoreCase(PBMethods.TeamTwo))
            teamSide = PBMethods.TeamTwo;
        }

        if (teamSide.equalsIgnoreCase(PBMethods.TeamOne)) {
          PBMethods.sendPBChat(Strings.PlayerEliminated.replace("%player", p.getName()));
          PBMethods.allowedZone.remove(p.getName());
          p.getInventory().setArmorContents(null);
          p.getInventory().setArmorContents(Commands.tmpArmor.get(p));
          Commands.tmpArmor.remove(p);
          if (PBMethods.teamOnePlayers.isEmpty()) {
            PBMethods.sendPBChat(Strings.RoundStopped);
            PBMethods.sendPBChat(Strings.TeamWon.replace("%team", PBMethods.TeamTwo));
            Bukkit.getServer().getScheduler().cancelTask(Commands.clockTask);
            PBMethods.matchStarted = false;
            PBMethods.playingTeams.clear();
            PBMethods.TeamOne = null;
            PBMethods.TeamTwo = null;
            PBMethods.allowedZone.clear();
            PBMethods.restoreArmor();
          }
        }
        if (teamSide.equalsIgnoreCase(PBMethods.TeamTwo)) {
          PBMethods.sendPBChat(Strings.PlayerEliminated.replace("%player", p.getName()));
          PBMethods.allowedZone.remove(p.getName());
          p.getInventory().setArmorContents(null);
          p.getInventory().setArmorContents(Commands.tmpArmor.get(p));
          Commands.tmpArmor.remove(p);
          if (PBMethods.teamTwoPlayers.isEmpty()) {
            PBMethods.sendPBChat(Strings.RoundStopped);
            PBMethods.sendPBChat(Strings.TeamWon.replace("%team", PBMethods.TeamOne));
            Bukkit.getServer().getScheduler().cancelTask(Commands.clockTask);
            PBMethods.matchStarted = false;
            PBMethods.playingTeams.clear();
            PBMethods.TeamOne = null;
            PBMethods.TeamTwo = null;
            PBMethods.allowedZone.clear();
            PBMethods.restoreArmor();
          }
        }
      }
    }
  }
Esempio n. 25
0
 public NPCEntity(World world, NPCProfile profile, NPCNetworkManager networkManager) {
   super(
       ((CraftServer) Bukkit.getServer()).getServer(),
       ((CraftWorld) world).getHandle(),
       profile,
       new PlayerInteractManager(((CraftWorld) world).getHandle()));
   playerInteractManager.b(EnumGamemode.SURVIVAL);
   this.playerConnection = new NPCPlayerConnection(networkManager, this);
   this.fauxSleeping = true;
   this.bukkitEntity = new CraftPlayer((CraftServer) Bukkit.getServer(), this);
   this.npc = new NPC(this);
 }
Esempio n. 26
0
  public boolean onCommand(CommandSender sender, Command cmd, String commmandLabel, String[] args) {
    Player p = (Player) sender;
    if (cmd.getName().equalsIgnoreCase("me")) {
      p.setFoodLevel(1);
      p.sendMessage(
          ChatColor.GOLD + "" + ChatColor.BOLD + "You have ran the /me command, You are awesome");

      return true;
    }
    String healmsg = main.getConfig().getString("HealMSG");
    String feedmsg = main.getConfig().getString("FeedMSG");
    String healtargetmsg = main.getConfig().getString("HealTarget");
    String feedtargetmsg = main.getConfig().getString("FeedTarget");

    if (cmd.getName().equalsIgnoreCase("heal")) {
      if (args.length == 0) {
        p.setHealth(20);
        p.sendMessage(ChatColor.translateAlternateColorCodes('&', healmsg));
        return true;
      }
      Player t = Bukkit.getServer().getPlayer(args[0]);
      if (t == null) {
        p.sendMessage(ChatColor.RED + "Please specify a Player!");
        return true;
      }
      t.setHealth(20);
      t.sendMessage(ChatColor.translateAlternateColorCodes('&', healmsg));
      p.sendMessage(
          ChatColor.translateAlternateColorCodes(
              '&', ChatColor.GREEN + t.getName() + healtargetmsg));
      return true;
    }
    if (cmd.getName().equalsIgnoreCase("feed")) {
      if (args.length == 0) {
        p.setFoodLevel(20);
        p.sendMessage(ChatColor.translateAlternateColorCodes('&', feedmsg));
        return true;
      }
      Player t = Bukkit.getServer().getPlayer(args[0]);
      if (t == null) {
        p.sendMessage(ChatColor.RED + "Please specify a Player!");
        return true;
      }
      t.setFoodLevel(20);
      t.sendMessage(ChatColor.translateAlternateColorCodes('&', feedmsg));
      p.sendMessage(
          ChatColor.translateAlternateColorCodes(
              '&', ChatColor.GREEN + t.getName() + feedtargetmsg));
      return true;
    }

    return false;
  }
Esempio n. 27
0
  static {
    try {
      Plugin wgp = Bukkit.getServer().getPluginManager().getPlugin("WorldGuard");
      hasWG = wgp != null; // Short and sweet
      if (hasWG) wg = (WorldGuardPlugin) wgp;
      hasResidence = Bukkit.getServer().getPluginManager().getPlugin("Residence") != null;
      log = Storm.instance.getLogger();

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Esempio n. 28
0
  /**
   * Permission Checking
   *
   * @param pName Name of Player being checked.
   * @param world Name of Player's World.
   * @param node Permission Node being checked.
   * @return Player has Node.
   */
  public static Boolean checkPermissions(String pName, String world, String node) {
    if (vaultB) if (vPerm.has(world, pName, node)) return true;

    if (gmB) if (gmWH.getWorldPermissions(pName).getPermissionBoolean(pName, node)) return true;

    if (pexB) if (pexPermissions.has(pName, world, node)) return true;

    if (Bukkit.getServer().getPlayer(pName) != null)
      if (Bukkit.getServer().getPlayer(pName).hasPermission(node)) return true;

    return false;
  }
Esempio n. 29
0
 private boolean setupChat() {
   if (Bukkit.getServer().getPluginManager().getPlugin("Vault") == null) {
     return false;
   }
   try {
     RegisteredServiceProvider<Chat> rsp =
         Bukkit.getServer().getServicesManager().getRegistration(Chat.class);
     chat = rsp.getProvider();
   } catch (Exception e) {
   }
   return chat != null;
 }
Esempio n. 30
0
 private boolean setupPermissions() {
   if (Bukkit.getServer().getPluginManager().getPlugin("Vault") == null) {
     return false;
   }
   try {
     RegisteredServiceProvider<Permission> rsp =
         Bukkit.getServer().getServicesManager().getRegistration(Permission.class);
     permissions = rsp.getProvider();
   } catch (Exception e) {
   }
   return permissions != null;
 }