From e109aaded6527b1cdad8db8d7c03def6a570c1f8 Mon Sep 17 00:00:00 2001 From: Aniket Joshi Date: Wed, 15 Mar 2023 13:46:11 +0530 Subject: [PATCH] docs: updated readme --- README.md | 135 +++++++++++++++++++++++++++++------------------------- 1 file changed, 72 insertions(+), 63 deletions(-) diff --git a/README.md b/README.md index de0ff9f..68b6583 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,9 @@ ## Dependancy information -[![LabAide version](https://repo.zorino.in/api/badge/latest/releases/in/arcadelabs/labaide/LabAide?color=40c14a&name=LabAide%20version)](https://github.com/arcadelabs/LabAide/releases/latest) -[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/arcadelabs/LabAIde/Publish%20LabAide%20to%20Maven%20repository/master?color=45b94e)](https://repo.zorino.in/#/releases/in/arcadelabs/labaide/LabAide) +# This project is undergoing a major refactor! please wait for proper documentation before using this in your projects. +[![LabAide version](https://repo.zorino.in/api/badge/latest/releases/in/arcadelabs/labaide/LabAide?color=40c14a&name=LabAide%20version)](https://github.com/arcadelabs/LabAide/releases/latest) +[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/arcadelabs/LabAIde/publish.yml?branch=master&color=45b94e)](https://repo.zorino.in/#/releases/in/arcadelabs/labaide/LabAide) ### Maven @@ -38,6 +39,7 @@ > ``` ## Utilities + ``` . └── in.arcadelabs.labaide @@ -69,91 +71,98 @@ ## Examples > Cooldown.java + ```java -int cooldown = 10; //Add cooldown peeriod in seconds - CooldownManager cooldownManager = new CooldownManager(cooldown); - MiniMessage miniMessage = MiniMessage.builder().build(); - - public void onCraftEvent(final CraftItemEvent event) { - if (!(Objects.equals(event.getRecipe().getResult(), new ItemStack(Material.NETHER_STAR)))) return; - Player player = (Player) event.getWhoClicked(); - if (!this.cooldownManager.isOnCooldown(player.getUniqueId())) { - event.getInventory().setResult(new ItemStack(Material.BEACON)); - if (this.cooldown >= 0) // int value -1 will disable this +int cooldown=10; //Add cooldown peeriod in seconds + CooldownManager cooldownManager=new CooldownManager(cooldown); + MiniMessage miniMessage=MiniMessage.builder().build(); + +public void onCraftEvent(final CraftItemEvent event){ + if(!(Objects.equals(event.getRecipe().getResult(),new ItemStack(Material.NETHER_STAR))))return; + Player player=(Player)event.getWhoClicked(); + if(!this.cooldownManager.isOnCooldown(player.getUniqueId())){ + event.getInventory().setResult(new ItemStack(Material.BEACON)); + if(this.cooldown>=0) // int value -1 will disable this this.cooldownManager.setCooldown(player.getUniqueId()); - } else { - player.sendMessage(this.miniMessage.deserialize("You can't craft beacon for another seconds.", - Placeholder.component("seconds", Component.text(this.cooldownManager.getRemainingTime(player.getUniqueId()))))); - event.setCancelled(true); - } - } + }else{ + player.sendMessage(this.miniMessage.deserialize("You can't craft beacon for another seconds.", + Placeholder.component("seconds",Component.text(this.cooldownManager.getRemainingTime(player.getUniqueId()))))); + event.setCancelled(true); + } + } ``` > ExperienceManager.java + ```java - public void saveXP(final Player player) { - player.getPersistentDataContainer().set(this.lifeSteal.getNamespacedKeyBuilder().getNewKey("player_xp"), - PersistentDataType.INTEGER, - ExperienceManager.getExp(player)); //Get precise amount of player XP - player.setExp(0); - player.setLevel(0); - } - - public void restoreXP(final Player player) { - if (!(player.getPersistentDataContainer().has(this.lifeSteal.getNamespacedKeyBuilder().getNewKey("player_xp")))) return; - ExperienceManager.changeExp(player, - player.getPersistentDataContainer().get(this.lifeSteal.getNamespacedKeyBuilder().getNewKey("player_xp"), - PersistentDataType.INTEGER)); - } + public void saveXP(final Player player){ + player.getPersistentDataContainer().set(this.lifeSteal.getNamespacedKeyBuilder().getNewKey("player_xp"), + PersistentDataType.INTEGER, + ExperienceManager.getExp(player)); //Get precise amount of player XP + player.setExp(0); + player.setLevel(0); + } + +public void restoreXP(final Player player){ + if(!(player.getPersistentDataContainer().has(this.lifeSteal.getNamespacedKeyBuilder().getNewKey("player_xp"))))return; + ExperienceManager.changeExp(player, + player.getPersistentDataContainer().get(this.lifeSteal.getNamespacedKeyBuilder().getNewKey("player_xp"), + PersistentDataType.INTEGER)); + } ``` > HeadBuilder.java & ItemBulder.java + ```java - Logger logger = new Logger("LifeSteal", null, null, null); - HeadBuilder headBuilder = new HeadBuilder(this.logger, Logger.Level.ERROR); - //https://minecraft-heads.com/custom-heads/search?searchword=heart - //Go down and check for 'value' fiels and copy paste that down below. - String skullTexture = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNmQzNmMzMjkxZmUwMmQxNDJjNGFmMjhkZjJmNTViYjAzOTdlMTk4NTU0ZTgzNDU5OTBkYmJjZDRjMTQwMzE2YiJ9fX0="; - ItemBuilder itemBuilder = new ItemBuilder(Material.PLAYER_HEAD, lifeSteal.getHeadBuilder().createSkullMap(skullTexture)) - .setName(Component.text("Heart <3")) - .setLore((List) Component.empty()) - .setModelData(389645) - .setPDCObject(this.lifeSteal.getNamespacedKeyBuilder().getNewKey("heart_item"), PersistentDataType.STRING, "No heart spoofing, dum dum.") - .setPDCObject(this.lifeSteal.getNamespacedKeyBuilder().getNewKey("heart_itemtype"), PersistentDataType.STRING, "Cursed") - .setPDCObject(this.lifeSteal.getNamespacedKeyBuilder().getNewKey("heart_itemindex"), PersistentDataType.STRING, "1") - .setPDCObject(this.lifeSteal.getNamespacedKeyBuilder().getNewKey("heart_healthpoints"), PersistentDataType.DOUBLE, "4") - .build(); - ItemStack heart = itemBuilder.getBuiltItem(); + Logger logger=new Logger("LifeSteal",null,null,null); + HeadBuilder headBuilder=new HeadBuilder(this.logger,Logger.Level.ERROR); + //https://minecraft-heads.com/custom-heads/search?searchword=heart + //Go down and check for 'value' fiels and copy paste that down below. + String skullTexture="eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNmQzNmMzMjkxZmUwMmQxNDJjNGFmMjhkZjJmNTViYjAzOTdlMTk4NTU0ZTgzNDU5OTBkYmJjZDRjMTQwMzE2YiJ9fX0="; + ItemBuilder itemBuilder=new ItemBuilder(Material.PLAYER_HEAD,lifeSteal.getHeadBuilder().createSkullMap(skullTexture)) + .setName(Component.text("Heart <3")) + .setLore((List)Component.empty()) + .setModelData(389645) + .setPDCObject(this.lifeSteal.getNamespacedKeyBuilder().getNewKey("heart_item"),PersistentDataType.STRING,"No heart spoofing, dum dum.") + .setPDCObject(this.lifeSteal.getNamespacedKeyBuilder().getNewKey("heart_itemtype"),PersistentDataType.STRING,"Cursed") + .setPDCObject(this.lifeSteal.getNamespacedKeyBuilder().getNewKey("heart_itemindex"),PersistentDataType.STRING,"1") + .setPDCObject(this.lifeSteal.getNamespacedKeyBuilder().getNewKey("heart_healthpoints"),PersistentDataType.DOUBLE,"4") + .build(); + ItemStack heart=itemBuilder.getBuiltItem(); ``` > Logger.java + ```java - Logger logger = new Logger("LifeSteal", null, null, null); - try { - somethingStupid(); - } catch (StupidException e) { - logger.log(Logger.Level.ERROR, Component.text(e.getMessage(), NamedTextColor.DARK_PURPLE), e.fillInStackTrace()); - } + Logger logger=new Logger("LifeSteal",null,null,null); + try{ + somethingStupid(); + }catch(StupidException e){ + logger.log(Logger.Level.ERROR,Component.text(e.getMessage(),NamedTextColor.DARK_PURPLE),e.fillInStackTrace()); + } ``` > Logger.java + ```java - BStats metrics = new BStats(this.instance, resourceID); + BStats metrics=new BStats(this.instance,resourceID); ``` > NamespacedKeyBuilder.java + ```java - NamespacedKeyBuilder namespacedKeyBuilder = new NamespacedKeyBuilder("lifesteal", this.instance); - NamespacedKey namespacedKey = namespacedKeyBuilder.getNewKey("heart_healthpoints"); + NamespacedKeyBuilder namespacedKeyBuilder=new NamespacedKeyBuilder("lifesteal",this.instance); + NamespacedKey namespacedKey=namespacedKeyBuilder.getNewKey("heart_healthpoints"); ``` > ProbabilityCollection.java + ```java - ProbabilityCollection randomChar = new ProbabilityCollection<>(); - randomChar.add('A', 10); - randomChar.add('B', 10); - randomChar.add('C', 10); - randomChar.add('D', 10); - - char letter = randomChar.get(); + ProbabilityCollection randomChar=new ProbabilityCollection<>(); + randomChar.add('A',10); + randomChar.add('B',10); + randomChar.add('C',10); + randomChar.add('D',10); + + char letter=randomChar.get(); ```