OT-Main

Jul 16, 2017
OT-Main
  • OT-Main API

    Code (Text):
    # This is my OT-Back Main for example:

    package de.MineClan.OT.Back;

    import java.util.HashMap;

    import org.bukkit.Bukkit;
    import org.bukkit.plugin.java.JavaPlugin;

    import de.MineClan.OT.API.ConfigAPI;
    import de.MineClan.OT.API.OTPlugin;
    import net.md_5.bungee.api.ChatColor;

    public class BackMain extends JavaPlugin {
     
        public static OTPlugin OTPlugin;
     
        public void onEnable(){
         
            //Check if install OT-Main
            if(checkIfMainEnable("Back") == false){
                return;
            }
         
            //Create new OT-Plugin
            OTPlugin OTP = new OTPlugin("Back", "1.1");
         
            //Set author
            OTP.setAuthor("Kurfat");
         
            //Set your website
            OTP.setWebsite("https://www.spigotmc.org/resources/ot-back-addon.39571/");
         
            //Set you help message
            HashMap<String, String> Help = new HashMap<String, String>();
            Help.put("&6Back: &7/back", "/back");
            OTP.setHelp(Help);
         
            //Set your main class
            OTP.setPlugin(this);
         
            //Activate
            OTP.activate();
         
            //You stuff
            BackMain.OTPlugin = OTP;
            ConfigAPI.LoadPluginDefaultFiles(OTP.getPlugin(), OTP.getPath(), "config.yml");
            this.getCommand("back").setExecutor(new Command_Back());
            Bukkit.getPluginManager().registerEvents(new DeathStorage(), OTP.getPlugin());
        }
        public void onDisable(){
            if(checkIfMainEnable("Back") == false){
                return;
            }
            BackMain.OTPlugin.deactivate();
        }
        private Boolean checkIfMainEnable(String AddonName){
            if(Bukkit.getPluginManager().isPluginEnabled("OT-Main") == false){
                Bukkit.getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&', "&4##############################################################################"));
                Bukkit.getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&', "&4# &7[&6OT-Main&7] &4Please install &aOT-Main &4to use &a" + AddonName));
                Bukkit.getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&', "&4# Link: https://www.spigotmc.org/resources/ot-main-only-this-plugin.39280/"));
                Bukkit.getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&', "&4##############################################################################"));
                return false;
            }
            return true;
        }
    }
    This method uses my chat plugin, if it is activated. If the CSender is a player and it is present in the PlayerDataAPI, its data will be replaced. Example: %uuid_name% more -> config.yml
    Code (Text):
    OTAPI.sendMessage(CommandSender CSender, String Message, ChatColor ChatColor)
    OTAPI.sendMessage(String Message, ChatColor ChatColor)
    Obtain basic data from the main config,yml
    Code (Text):
    OTAPI.getAll();
    OTAPI.getPlayer();
    OTAPI.getEnable();
    OTAPI.getDisable();
    OTAPI.getCreative();
    OTAPI.getSurvival();
    OTAPI.getAdventure();
    OTAPI.getSpectator();
    OTAPI.getDay();
    OTAPI.getNight();
    OTAPI.getSun();
    OTAPI.getRain();
    OTAPI.getThunder();
    OTAPI.getOwner();
    OTAPI.getMinutes();
    OTAPI.getHours();
    OTAPI.getDays();
    OTAPI.getWeeks();
    OTAPI.getMonths();
    OTAPI.getPermanent();
    Obtain the level number from the player.
    Example:
    Op: 100
    Admin: 90
    Default: 1
    Code (Text):
    OTAPI.getRankLevel(CommandSender Sender)
    Code (Text):
    OTAPI.NoPermission(CommandSender sender, String permission)
    OTAPI.NoConsole(CommandSender sender)
    OTAPI.FailPlayer(CommandSender sender)
    OTAPI.FailCommand(CommandSender sender, String Syntax)
    OTAPI.FailWorld(CommandSender sender)
    OTAPI.FailRankLevel(CommandSender sender, int sendercount, int argcount)
    OTAPI.NoSpamCommand(CommandSender sender)
    OTAPI.void ArgIsSender(CommandSender sender)
    This is my offline player database. If a player was already on the server, you can read his data.
    Code (Text):
    PlayerDataAPI PDA = new PlayerDataAPI(UUID);
    PDA.<LOOK>();
     
    Code (Text):
    PlayerDataAPI.AllPlayers() # Get all saved uuids
    PlayerDataAPI.getUUID("PlayerName") # Get uuid from playername (player must be saved)
    PlayerDataAPI.save(Player) # Save current playerdata
    The ReplaceAPI works with my PlayerDataAPI. Placeholder you will find in the main config.yml
    Code (Text):
    ReplaceAPI.runWithID(UUID ID, String Text)
    ReplaceAPI.runWithOutID(String Text)
    Code (Text):
    ConfigAPI.getConfig(String Path, String FileName)
    ConfigAPI.saveConfig(YamlConfiguration Yaml, String Path, String FileName) throws IOException
    ConfigAPI.LoadPluginDefaultFiles(Plugin Plugin, String Path, String FileName)
  • Loading...
  • Loading...