Class MiscUtils

java.lang.Object
com.bencodez.advancedcore.api.misc.MiscUtils

public class MiscUtils extends Object
Miscellaneous utility methods.
  • Method Details

    • getInstance

      public static MiscUtils getInstance()
    • addSeconds

      public Date addSeconds(Date date, int seconds)
      Adds seconds to a date.
      Parameters:
      date - the date to add to
      seconds - the number of seconds to add
      Returns:
      the new date
    • broadcast

      public void broadcast(String broadcastMsg)
      Broadcast.
      Parameters:
      broadcastMsg - the broadcast msg
    • broadcast

      public void broadcast(String broadcastMsg, Collection<? extends org.bukkit.entity.Player> players)
      Broadcasts a message to specific players.
      Parameters:
      broadcastMsg - the message to broadcast
      players - the players to broadcast to
    • checkChance

      public boolean checkChance(double chance, double outOf)
    • convertUsers

      public AdvancedCoreUser[] convertUsers(ArrayList<AdvancedCoreUser> array)
      Convert.
      Parameters:
      array - the array
      Returns:
      the user[]
    • convertUsers

      public ArrayList<AdvancedCoreUser> convertUsers(Set<AdvancedCoreUser> set)
      Convert set.
      Parameters:
      set - the set
      Returns:
      the array list
    • executeConsoleCommands

      public void executeConsoleCommands(ArrayList<String> cmds, HashMap<String,String> placeholders, boolean stagger)
    • executeConsoleCommands

      public void executeConsoleCommands(org.bukkit.entity.Player player, ArrayList<String> cmds, HashMap<String,String> placeholders, boolean stagger)
    • executeConsoleCommands

      public void executeConsoleCommands(org.bukkit.entity.Player player, String command, HashMap<String,String> placeholders)
    • executeConsoleCommands

      public void executeConsoleCommands(String playerName, ArrayList<String> cmds, HashMap<String,String> placeholders, boolean stagger)
    • executeConsoleCommands

      public void executeConsoleCommands(String playerName, String command, HashMap<String,String> placeholders)
    • getBlockMeta

      public Object getBlockMeta(org.bukkit.block.Block block, String str)
    • getConnection

      Gets the connection.
      Parameters:
      player - the player
      Returns:
      the connection
      Throws:
      SecurityException - the security exception
      NoSuchMethodException - the no such method exception
      NoSuchFieldException - the no such field exception
      IllegalArgumentException - the illegal argument exception
      IllegalAccessException - the illegal access exception
      InvocationTargetException - the invocation target exception
    • getDayFromMili

      public int getDayFromMili(long time)
      Gets the day from mili.
      Parameters:
      time - the time
      Returns:
      the day from mili
    • getEnchant

      public org.bukkit.enchantments.Enchantment getEnchant(String enchant, String enchant2)
    • getEntityMeta

      public Object getEntityMeta(org.bukkit.entity.Entity entity, String str)
    • getEntityType

      public org.bukkit.entity.EntityType getEntityType(String entity, String entity2)
    • getHourFromMili

      public int getHourFromMili(long time)
      Gets the hour from mili.
      Parameters:
      time - the time
      Returns:
      the hour from mili
    • getMinutesFromMili

      public int getMinutesFromMili(long time)
      Gets the minutes from mili.
      Parameters:
      time - the time
      Returns:
      the minutes from mili
    • getMonthFromMili

      public int getMonthFromMili(long time)
      Gets the month from mili.
      Parameters:
      time - the time
      Returns:
      the month from mili
    • getMonthString

      public String getMonthString(int month)
      Gets the month string.
      Parameters:
      month - the month
      Returns:
      the month string
    • getPotionType

      public org.bukkit.potion.PotionEffectType getPotionType(String potion, String potion2)
    • getProgressBar

      public String getProgressBar(int current, int max, int totalBars, String symbol, String completedColor, String notCompletedColor)
    • getRegionBlocks

      public List<org.bukkit.block.Block> getRegionBlocks(org.bukkit.World world, org.bukkit.Location loc1, org.bukkit.Location loc2)
      Gets the region blocks.
      Parameters:
      world - the world
      loc1 - the loc 1
      loc2 - the loc 2
      Returns:
      the region blocks
    • getTime

      public LocalDateTime getTime(long mills)
    • getWorldNames

      public ArrayList<String> getWorldNames()
    • getYearFromMili

      public int getYearFromMili(long time)
      Gets the year from mili.
      Parameters:
      time - the time
      Returns:
      the year from mili
    • setBlockMeta

      public void setBlockMeta(org.bukkit.block.Block block, String str, Object value)
    • setEntityMeta

      public void setEntityMeta(org.bukkit.entity.Entity entity, String str, Object value)
    • setSkullOwner

      public org.bukkit.inventory.ItemStack setSkullOwner(org.bukkit.OfflinePlayer player)
    • setSkullOwner

      @Deprecated public org.bukkit.inventory.ItemStack setSkullOwner(String playerName)
      Deprecated.
      Sets the skull owner.
      Parameters:
      playerName - the player name
      Returns:
      the item stack
    • sortByKeys

      public LinkedHashMap<Double,String> sortByKeys(LinkedHashMap<Double,String> topVoterAllTime, boolean order)
    • sortByValues

      public HashMap<AdvancedCoreUser,Integer> sortByValues(HashMap<AdvancedCoreUser,Integer> unsortMap, boolean order)
      Sort by values.
      Parameters:
      unsortMap - the unsort map
      order - the order
      Returns:
      the hash map
    • sortByValuesLong

      public HashMap<AdvancedCoreUser,Long> sortByValuesLong(HashMap<AdvancedCoreUser,Long> unsortMap, boolean order)