Is there anything like Sub Routines for a java plugin, e.g Create a subroutine and then i call like checkScore() it will run that code?
Code: //Inventory sorter public void inventory(){ for(Player player: getServer().getOnlinePlayers()) { //------------------------ //Set players inventory up //------------------------ //Set armour ItemStack chestplate = new ItemStack(Material.LEATHER_CHESTPLATE); player.getInventory().setChestplate(chestplate); ItemStack boots = new ItemStack(Material.GOLD_BOOTS); player.getInventory().setBoots(boots); ItemStack hat = new ItemStack(Material.SKULL_ITEM); player.getInventory().setHelmet(hat); //------------------------ ItemStack woodSword = new ItemStack(Material.WOOD_SWORD); player.getInventory().setItem(0, woodSword); ItemStack infiniBow = new ItemStack(Material.BOW); player.getInventory().setItem(1, infiniBow); } } This works here, is there any way i could add an envhantment to the item stacks?
ok, thanks. So i dont have to create a new post is there a way to create a variable that includes their name e.g. String score + player.getName() = "500"; then i can change their score by doing like score + player.getName() =+ 10; so i can set a player to have a individual score?
@JooshYT Mmmmm your question is hard to understand, but if it is what I think you may want to take a look at Maps
i dont know what i should look for in there. I need like it to store players scores on the server but its only emp so im not storing to a config. And as the variable to keep their score number in i want the variable to be "scoreTheirName" as a string.
@JooshYT A String it's expensive if you want to modify it Use a Map<UUID, Integer>, store the UUID of the player (or you can even store their name, since you're going to use it and you say it's only temporal) and the score as the Integer
Im not sure how i would set that as a variable. would it be like int scoreMap<p.getName(), Integer> = 500;
I will agree with @timtower, before you start bukkit API that is based on java, learn java! Or at least the basics! What you are asking here is a java 101 basic, one of the first things you learn, So spend some time N effort to learn java, it will make things much easier to understand and process. Cheers!