Rays Core

Nov 5, 2016
Rays Core
  • Welcome to the Documentation / Wiki of Ray's Core. This Documentation is under Construction!

    First of all what is Ray's Core?
    Ray's Core is a big Library / API with many simple Methods to make a Developers life much easier. The Ressource is developed by Raytex and you can find the Ressource here.

    This Features are included | Open Spoiler to see the Documentation:
    • Code (Text):
      ActionBar bar = new ActionBar(); //Constructor without Message
      bar = new ActionBar(String message); //Constructor with Message

      bar.setMessage(String message); //Set the Message
      bar.send(Player p); //Send to Player
      bar.send(); //Send to all Player
      bar.send(Player p, int duration); //Send to Player for duration on Seconds (Every 2 Seconds resend)
      bar.send(int duration); //Send to all Players for duration on Seconds (Every 2 Seconds resend)

      ActionBar.sendActionBar(Player p, String message); //Fast (static) Method to send ActionBar to Player
    • Code (Text):
      Title title = new Title(); //Constructor without Timings and Titles
      title = new Title(String title, String subtitle); //Constructor without Timings
      title = new Title(String title, String subtitle, int fadeIn, int stay, int fadeOut); //Main Constructor

      title.setTimings(int fadeIn, int stay, int fadeOut); //Set Timings in Ticks
      title.setTitle(String title); //Set Title
      title.setSubtitle(String subtitle); //Set Subtitle
      title.send(Player p); //Send Title to Player
      title.send(); //Send Title to all Players

      Title.sendTitle(Player p, String title, String subtitle, int fadeIn, int stay, int fadeOut); // Fast (static) Method to send Title to Player
    • Code (Text):
      Tablist tab = new Tablist(); //Constructor withour header & footer
      tab = new Tablist(String header, String footer); //Constructor with header and footer
      tab = new Tablist(List<String> header, List<String> footer); //Constructor with header and footer as List

      tab.setHeader(String header); //Set header
      tab.setHeader(List<String> header); //Set header from List
      tab.setFooter(String footer); //Set footer
      tab.setFooter(List<String> footer); //Set footer from List
      tab.send(Player p); //Send Tablist to Player
      tab.send(); //Send Tablist to all Players

      Tablist.send(Player p, String header, String footer); //Fast (static) Method to send Tablist to Player
    • Code (Text):
      //ArenaManager
      ArenaManager.createArena(String name, World world, Cuboid region); //Create Cuboid Arena
      ArenaManager.createArena(String name, World world, Sphere region); //Create Sphere Arena
      ArenaManager.createArena(String name, World world, Cylinder region); //Create Cylinder Arena

      ArenaManager.getPlayerArenas(); //returns HashMap<String,String> (Player UUID, ArenaName)
      ArenaManager.getArenas(); //returns Collection<Arena> (all registered Arenas)
      ArenaManager.getArenasMap(); //returns HashMap<String,Arena> all Arenas (ArenaName, Arena)
      ArenaManager.getArenasName(); //returns ArrayList<String> all Arenanames
      ArenaManager.getArenaByName(String name); //returns Arena from Name
      ArenaManager.getPlayerArena(Player p); //returns the Arena the Player is in
      ArenaManager.setPlayerArena(Player p, Arena arena); //Set Arena of Player (Player is in)
      ArenaManager.removePlayer(Player p); //Remove Player from PlayerArena list
      ArenaManager.hide(Player p); //Hide / show the Player p to all Arenas he is not in

      //ArenaStates: NOSTATE, LOBBY, INGAME, STARTING, DEATHMATCH, ENDING

      //Arena
      Arena arena = new Arena(String name, World world, Location a, Location b); //Constructor for Cuboid Arena
      arena = new Arena(String name, World world, Location center, int radius); //Constructor for Sphere Arena
      arena = new Arena(String name, World world, Location center, int radius, int hight); //Constructor for Cylinder Arena

      arena.getLocationA(); //returns Location A
      arena.getLocationB(); //returns Location B
      arena.getGameState(); //returns ArenaState
      arena.setGameState(ArenaState state); //set GameState / ArenaState
      arena.getBounds(); //returns Region
      arena.getChangedBlocks(); //returns ArrayList<Block> all changed Blocks
      arena.addChangedBlock(Block b); //add a Block to ChangedBlocks
      arena.isPart(Location loc); //returns boolean (true if loc is Part of Arena)
      arena.getWorld(); //returns World
      arena.getName(); //returns ArenaName
      arena.addPlayer(Player p); //add Player to Arena (Save Loc, Inventory, etc.)
      arena.removePlayer(Player p); //remove Player from Arena
      arena.getPlayers(); //returns ArrayList<Player> with all Players of the Arena
      arena.reset(); //Reset all changed Blocks
      arena.sendMessage(String msg); //Send message to all Players of the Arena
    • Code (Text):
      PlayerArmorEquipEvent e = new PlayerArmorEquipEvent(Player p, ItemStack stack); //Constructor - stack = Armor equiped
      e.getPlayer(); //returns Player
      e.getItemStack(); //return Armor ItemStack

      PlayerArmorUnequipEvent e = new PlayerArmorUnequipEvent(Player p, ItemStack stack); //Constructor - stack = Armor unequiped
      e.getPlayer(); //returns Player
      e.getItemStack(); //return Armor ItemStack
    • Code (Text):
      RBlock block = new RBlock(Block b); //Constructor with block
      block = new RBlock(BlockState state); //Constructor with blockstate

      block.isBlock(Block b); //returns boolean (true if b same Type and ID like block)
      block.setBlock(Block b); //set Block with Physics
      block.setBlockNoPhysics(Block b); //set Block with NoPhysics
      block.toString(); //returns String (id:data)
    • Code (Text):
      BossbarAPI.sendBossbar(Player p, String text, double barprogress, BarColor color, BarStyle style, BarFlag flag);
    • Code (Text):
      ConnectServer.connect(Player p, String server); //Connect to BungeeCord Server
    • Code (Text):
      ColorChanger cc = new ColorChanger(); //Constructor with Position 0
      cc = new ColorChanger(int pos); //Constructor with Position pos

      cc.reset(); //Reset ColorChanger(Position, etc.)
      cc.nextColor(); //returns Color for next Position
      cc.getColor(); //returns Color for current Position
    • Code (Text):
      //RCommand Example class:
      package de.raytex.core;

      import java.util.List;

      import org.bukkit.command.Command;
      import org.bukkit.command.CommandSender;

      import de.raytex.core.command.RCommand;

      public class TestCommand extends RCommand {

          public TestCommand(String command) {
              super(command);
          }

          @Override
          public boolean onCommand(CommandSender cs, Command cmd, String label, String[] args) {
              // TODO Auto-generated method stub
              return false;
          }

          @Override
          public List<String> onTabComplete(CommandSender cs, Command cmd, String label, String[] args) {
              // TODO Auto-generated method stub
              return null;
          }

      }

      //AdvancedRCommand Example:
      public TestCommand(String command) {
              super(command);
              this.addPart(new TestCommandPart("help"));
          }

          @Override
          public boolean needsPermission() {
              return false;
          }

          @Override
          public String getPermission() {
              return null;
          }

          @Override
          public boolean onCommandPart(CommandSender cs, Command cmd, String label, String[] args) {
              cs.sendMessage("TEST");
              return false;
          }

          @Override
          public void sendPermissionMessage(CommandSender cs) {
              cs.sendMessage("No Permission");
          }

          @Override
          public void sendUnknownMessage(CommandSender cs) {
              cs.sendMessage("Unknow Part");
          }

      //AdvancedRCommandPart Example:
      package de.raytex.core;

      import java.util.Arrays;
      import java.util.List;

      import org.bukkit.command.Command;
      import org.bukkit.command.CommandSender;

      import de.raytex.core.command.advanced.AdvancedRCommandPart;

      public class TestCommandPart extends AdvancedRCommandPart {

          public TestCommandPart(String help) {
              super(help);
          }

          @Override
          public boolean needsPermission() {
              return false;
          }

          @Override
          public String getPermission() {
              return null;
          }

          @Override
          public boolean onCommandPart(CommandSender cs, Command cmd, String label, String[] args) {
              cs.sendMessage(this.getArgument());
              return true;
          }

          @Override
          public List<String> onTabCompletePart(CommandSender cs, Command cmd, String label, String[] args) {
              //Starting at args[1] = subcommand
              return Arrays.asList("test", "help2");
          }

      }
    • Code (Text):
      Cooldown cd = new Cooldown(long seconds); //Create Cooldown in seconds
      cd = new Cooldown(long days, long hours, long minutes, long seconds); //Create Cooldown with Days, Hours, Minutes & Seconds

      cd.addPlayer(UUID uuid); //Start Cooldown of Player
      cd.removePlayer(UUID uuid); //Remove Cooldown from Player
      cd.check(UUID uuid); //returns boolean (true if Player is not Ready)
      cd.isReady(UUID uuid); //returns boolean (true if Player is Ready)
      cd.getSecondsLeft(UUID uuid); //returns double with Seconds left of Player
      cd.getMinutesLeft(UUID uuid); //returns double with Minutes left of Player
      cd.getHoursLeft(UUID uuid); //returns double with Hours left of Player
      cd.getDaysLeft(UUID uuid); //returns double with Days left of Player
      cd.clear(); //Remove all Players from Cooldown
      cd.getCooldownTime(); //returns long CooldownTime in Seconds
      cd.setCooldownTime(long seconds); //set CooldownTime in seconds
    • Code (Text):
      //Countdown
      Countdown cd = new Countdown(CountdownTask task); //Create a Countdown

      cd.start(int seconds); //Start Countdown for seconds Seconds
      cd.stop(boolean taskStop); //Stop Countdown (if taskStop it will run stop from CountdownTask)
      cd.sleep(int seconds); //Sleep for Seconds - run sleep from CountdownTask
      cd.isSleeping(); //returns boolean (true if Countdown is sleeping)
      cd.setTime(int seconds); //set the current Countdown time in seconds Seconds
      cd.getTime(); //returns int Current Countdown Time

      //CountdownTask
      CountdownTask task = new CountdownTask(){
        start(); //Run if Countdown starts;
        stop(); //Run if Countdown stops;
        second(int time); //Run every Seconds if timer is not Sleeping - time = Seconds left
        sleep(); //Run if Countdown starts to sleep
      }

      //LevelBar
      LevelBar.countdown(Player p, int startTime, int timeLeft); //Update Levelbar Timer for Player
      LevelBar.countdown(int startTime, int timeLeft); //Update Levelbar Timer for all Players
    • Code (Text):
      //MySQL
      MySQL sql = new MySQL(String name); //Create new MySQL with the Name name

      sql.connect(String host, int port, String database, String user, String password); //Connect to Database
      sql.disconnect(); //Disconnect from Database
      sql.countRows(String table); //returns int with amount of Rows in the Table table
      sql.update(String update); //Run Statements
      sql.query(String query); //returns ResultSet of query

      //SQLite
      SQLite sql = new SQLite(String name); //Create new SQLite with the Name name

      sql.connect(String databasePath); //Connect to Database
      sql.disconnect(); //Disconnect from Database
      sql.countRows(String table); //returns int with amount of Rows in the Table table
      sql.update(String update); //Run Statements
      sql.query(String query); //returns ResultSet of query
    • Code (Text):
      EconomyAPI.getBalance(String playerName); //returns double (Balance of Player)
      EconomyAPI.withdraw(String playerName, double amount); //returns boolean (true if withdraw was success)
      EconomyAPI.deposit(String playerName, double amount); //returns boolean (true if deposit was success)
    • Code (Text):
      //EncryptionTypes: BCrypt, MD5, PBKDF2, SHA1, SHA256, SHA384, SHA512

      EncryptionAPI.encrypt(EncryptionType type, String plaintext); //returns encrypted String from plaintext
      EncryptionAPI.check(EncryptionType type, String plaintext, String realEncrypted); //returns boolean (true if realEncrypted equals plaintext(encrypted))
    • Code (Text):
      MetadataManager.setMetadata(Entity en, String data); //Set Metadata to data
      MetadataManager.hasMetadata(Entity en, String data); //returns boolean (true if Entity en has Metadata data)
      MetadataManager.removeMetadata(Entity en, String data); //Removes data from Entity en
    • Code (Text):
      RFile file = new RFile(String path); //Create RFile without Default FileConfiguration
      file = new RFile(String path, InputStream defaul); //Create RFile with default FileConfiguration

      file.load(); //load the config
      file.reload(); //reload the config
      file.save(); //save the config
      file.getConfig(); //returns FileConfiguration config
      file.getFile(); //returns File fileOfConfig
      file.delete(); //delete the File

      //Static Methods
      RFile.exists(String path); //returns boolean (true if path exists)
      RFile.getFiles(File folder); //returns List<File> of Files in the Folder
      RFile.deleteFolder(File folder); //delete the Folder
      RFile.copyFolder(File source, File target, List<String> ignoreFiles); //copy Folder source to Folder target and ignore Files in List ignoreFiles
      RFile.unzipFileIntoDirectory(ZipFile zip, File extractPath); //unzip the zip File to the folder extractPath
      RFile.readWebFile(String url); //returns List<String> with the website content
      RFile.readPastebinFile(String id); //returns List<String> with the paste(id) content
      RFile.containsWebFile(String url, String search, boolean ignoreCase); //returns true when a line of the webcontent equals or equalsIgnoreCase search
      RFile.containsPastebinFile(String id, String search, boolean ignoreCase); //returns true when a line of the paste content equals or equalsIgnoreCase search
    • Code (Text):
      FireworkAPI.spawnRandomFirework(Location loc, boolean rgb); //if rgb true the Firework will have a random RGB Color else it will have a random Dye Color
      FireworkAPI.getRandomItemStack(boolean rgb); //returns Bukkit ItemStack (Random Firework ItemStack)
      FireworkAPI.getRandomItemMeta(boolean rgb); //returns Bukkit ItemMeta (Random Firework ItemMeta)
      FireworkAPI.getRandomFireworkEffect(boolean rgb); //returns Bukkit FireworkEffect (random Firework Effect)

      FireworkAPI.spawnRandomFirework(Location loc, FireworkEffect.Type type, boolean rgb); //if rgb true the Firework will have a random RGB Color else it will have a random Dye Color
      FireworkAPI.getRandomItemStack(FireworkEffect.Type type, boolean rgb); //returns Bukkit ItemStack (Random Firework ItemStack)
      FireworkAPI.getRandomItemMeta(FireworkEffect.Type type, boolean rgb); //returns Bukkit ItemMeta (Random Firework ItemMeta)
      FireworkAPI.getRandomFireworkEffect(FireworkEffect.Type type, boolean rgb); //returns Bukkit FireworkEffect (random Firework Effect)
    • Code (Text):
      Hologram holo = new Hologram(Location loc, boolean autoplay, String... lines); //Create Hologram
      //autoplay ~ replay = Play Hologram on join if player is added to it
      holo = new Hologram(Location loc, boolean autoplayer, List<String> lines); //Create Hologram

      holo.addPlayer(Player p); //Spawn Hologram for Player and add him to autoplay list
      holo.removePlayer(Player p); //Despawn Hologram for Player and remove him from autoplay list
      holo.containsPlayer(Player p); //returns true if the Player is in the autoplay list
      holo.getPlayers(); //returns List<UUID> of autoplay Players
      holo.removePlayer(); //remove all Players from autoplay list
      holo.getAutoPlayer(); //returns true if autoplay is enabled
      holo.getLocation(); //returns Location of Hologram

      //Don't care about the HologramManager. Its for Autoplay and things like that
    • Code (Text):
      //InventoryFrame
      InventoryFrame frame = new InventoryFrame(); //Create Inv. Frame
      frame = new InventoryFrame(HashMap<Integer,ItemStack> items); //Create Inv. Frame with Preset Items (Slot, ItemStack)

      frame.getClickHandlers(); //returns HashMap<Integer,InventoryClickHandler> all ClickHandlers (Slot, ClickHandler)
      frame.addClickHandler(int slot, InventoryClickHandler handler);
      frame.removeClickHandler(int slot);
      frame.callClickHandler(int slot, Player p, Inventory inv); //Its for the AnimatedInventory to call a Handler
      frame.containsClickHandler(int slot); //returns true if the slot have already a ClickHandler
      frame.addItem(int slot, ItemStack item);
      frame.removeItem(int slot);
      frame.containsItem(int slot); //returns true if the slot have already a ItemStack
      frame.getItems(); //returns HashMap<Integer,ItemStack> all Items (Slot, ItemStack)
      frame.apply(Player p, Inventory inv); //Its for the Animated Inventory
      frame.open(Player p); //Open the Frame without any Animations

      //AnimatedInventory | Period in Ticks | repeat = Repeat Animation
      AnimatedInventory inv = new AnimatedInventory(String title, int rows, int period, List<InventoryFrame> frames); //Create AnimatedInventory
      inv = new AnimatedInventory(String title, int rows, int period, boolean repeat, List<InventoryFrame> frames)
      inv = new AnimatedInventory(String title, int rows, int period, boolean repeat)
      inv = new AnimatedInventory(String title, int rows, int period)

      inv.getTitle(); //returns String Title
      inv.getPeriod(); //returns int Period
      inv.isRepeating(); //returns true if repeat
      inv.getSize(); //returns int Inventory Size
      inv.getMaxFrameID(); //returns int the Last Frame ID
      inv.getFrames(); //returns List<InventoryFrame> Frames
      inv.setFrames(List<InventoryFrame> frames);
      inv.addFrame(InventoryFrame frame);
      inv.addFrames(List<InventoryFrame> frames);
      inv.removeFrame(int id);
      inv.removeFrame(InventoryFrame frame);
      inv.containsFrame(InventoryFrame frame); //returns true if contains Frame
      inv.getFrameOfPlayer(UUID uuid); //returns InventoryFrame that the Player has currently opened
      inv.getFrameIDOfPlayer(UUID uuid); //returns int of InventroyFrame that the Player has currently opened;
      inv.hasOpenedInventory(UUID uuid); //returns true if the Player has opened the AnimatedInventory
      inv.containsPlayer(UUID uuid); //returns true if the Player has opened the AnimatedInventory
      inv.addPlayer(UUID uuid, int frameid); //Add a Player to the list with the frameid -> Only for System
      inv.removePlayer(UUID uuid); //remove a Player from the list -> Only for System
      inv.getOpenSound(); //returns RSound OpenSound
      inv.setOpenSound(RSound sound);
      inv.playOpenSound(Player p);
      inv.getCloseSound(); //returns RSound CloseSound
      inv.setCloseSound(RSound sound);
      inv.playCloseSound(Player p);
      inv.getFrameSound(); //returns RSound FrameSound
      inv.setFrameSound(RSound sound);
      inv.playFrameSound(Player p);

      inv.open(Player p); //Open AnimatedInventory for Player
    • Code (Text):
      //Example
      @EventHandler
      public void onClick(AnimatedInventoryClickEvent e){
          Player p = e.getPlayer();
          AnimatedInventory ainv = e.getAnimatedInventory();
          InventoryFrame frame = e.getInventoryFrame();
          Inventory inv = e.getInventory();
          int slot = e.getSlot();
          ItemStack clicked = e.getCurrentStack();
      }
    • ItemFactory (ItemStack & NBTItem)
    • PlayerItemUse- & PlayerItemUseOnEvent (perfect for CustomEnchantments)
    • KeyGenerator (SerialKey, etc.)
    • Logger (RLogger)
    • Map Manager (Unzip Maps, perfect for Minigames)
    • MapLoadStart-, MapLoadProgress-, MapLoadDoneEvent
    • FatLetters (for Messages)
    • PlayerHeads (for Messages/Chat)
    • Message Presets (Prefix, CorePrefix, CenteredMessage, MessageFormater)
    • Translator (Placeholder Replacer, '&' Replacer)
    • JsonMessage & JsonMessageBuilder
    • Message Types (Loader, Rainbow, Scroller)
    • MiniBlock API (Armorstand blocks in Hand)
    • NickAPI
    • NPC API
    • PacketInjector & PacketHandler
    • PacketReciever- & PacketSendEvent
    • ParticleEffect API
    • Pictures on Maps API (MapAPI)
    • Placeholder API (RPlaceholder & RPlaceholders)
    • Player API (RPlayer, PlayerGlowAPI)
    • WorldGuardRegion API (WorldGuard RegionAPI)
    • RegionTypes & API (Cuboid, Cylinder, Sphere)
    • Respawn API (Instant Respawn)
    • Runtime API (RAM, Java Version, etc.)
    • Scoreboard API (RScoreboard)
    • ScoreboardTeam API (Set ScoreboardTeams with Packets)
    • Server Ping API (PingAPI)
    • SkullAPI
    • SpigotUpdater
    • RUpdater
    • Downloader (FileDownloader)
    • UUIDFetcher
    • VotingManager (Voting)
    • WorldBackup
    • GameProfileBuilder
    • Many Utils (MathUtils, GeoUtils, NumberUtils, StringUtils, MessageUtils, NMSUtils, NMSVersion, NMSEntitys, AccessUtils, CollectionUtils, FacingUtils, SkinUtils, RSound)
    API Usage:
  • Loading...
  • Loading...