So as ive said multiple times im new to coding and would like some help on getting a basic config setup and was wondering the best way to implement one into my code.
https://www.spigotmc.org/wiki/config-files/#reading-and-writing-to-multiple-filesSo as ive said multiple times im new to coding and would like some help on getting a basic config setup and was wondering the best way to implement one into my code.
Thanks but i dont get how to set it up with my gui.
What do you mean set it up in your GUI?Thanks but i dont get how to set it up with my gui.
That makes no sense, please elaborate.Thanks but i dont get how to set it up with my gui.
Sorry for the late reply, Ive got my config working but i cant seem to get my config to save when its been loaded onto the server and the config has been edited it just reverts to the old one.That makes no sense, please elaborate.
In the onDisable do "saveConfig()"Sorry for the late reply, Ive got my config working but i cant seem to get my config to save when its been loaded onto the server and the config has been edited it just reverts to the old one.
Thank you![DOUBLEPOST=1503316344][/DOUBLEPOST]In the onDisable do "saveConfig()"
Also what is the best way to add an overall ChatColor &In the onDisable do "saveConfig()"
Use ChatColor.translatelternatecolorcodes('&', msg)Thank you![DOUBLEPOST=1503316344][/DOUBLEPOST]
Also what is the best way to add an overall ChatColor &
Thanks, also im new to if statments and things so how would i -Use ChatColor.translatelternatecolorcodes('&', msg)
wat.Thanks, also im new to if statments and things so how would i -
main.clicked = e.getCurrentItem().getItemMeta().getDisplayName();
main.frozen = main.clicked.
Player frozen = Bukkit.getPlayer(main.clicked);
player.sendMessage(freezeMessage.replace("%frozen%", e.getCurrentItem().getItemMeta().getDisplayName()));
frozen.sendMessage(frozenMessage.replace("%player%", player.getName()));
player.closeInventory();
Make main.frozen revert main.clicked to a normal player and not a frozen player? If that makes sense![]()
Ok, so ive got this code:wat.
main.clicked = e.getCurrentItem().getItemMeta().getDisplayName();
main.frozen = main.clicked.
Player frozen = Bukkit.getPlayer(main.clicked);
player.sendMessage(freezeMessage.replace("%frozen%", e.getCurrentItem().getItemMeta().getDisplayName()));
frozen.sendMessage(frozenMessage.replace("%player%", player.getName()));
player.closeInventory();
main.frozen = main.clicked.
main.clicked = e.getCurrentItem().getItemMeta().getDisplayName();
I'm genuinely confused about what you're trying to do.Ok, so ive got this code:
I want it so when main.frozen:Code:main.clicked = e.getCurrentItem().getItemMeta().getDisplayName(); main.frozen = main.clicked. Player frozen = Bukkit.getPlayer(main.clicked); player.sendMessage(freezeMessage.replace("%frozen%", e.getCurrentItem().getItemMeta().getDisplayName())); frozen.sendMessage(frozenMessage.replace("%player%", player.getName())); player.closeInventory();is executed it reverts the main.clicked:Code:main.frozen = main.clicked.player go back to a normal player and not execute the freeze code.Code:main.clicked = e.getCurrentItem().getItemMeta().getDisplayName();
main.clicked = e.getCurrentItem().getItemMeta().getDisplayName();
main.frozen = main.clicked;
FrozenGUI frgui = new FrozenGUI(Bukkit.getPlayer(main.clicked));
Player unfreeze = Bukkit.getPlayer(main.frozen);
Player frozen = Bukkit.getPlayer(main.clicked);
player.sendMessage(freezeMessage.replace("%frozen%", e.getCurrentItem().getItemMeta().getDisplayName()));
frozen.sendMessage(frozenMessage.replace("%player%", player.getName()));
frozen.openInventory(frgui.finv);
player.closeInventory();
@EventHandler
public void onMove(PlayerMoveEvent e) {
Player frozen = Bukkit.getPlayer(main.clicked);
frozen.teleport(frozen);
}
God, that is a terrible idea. What if there is like 900 players on a server. You're going to just look through all of them until you get lucky?[DOUBLEPOST=1503321412][/DOUBLEPOST]Also, Wtf is main.freeze? Is it a variable?Ok, i am making a freeze player plugin. And when you type /freeze it opens a gui with all of the players on the server at that time, once you click a player its executes this code
And the player that is marked as frozen via main.clicked cannot move from this code:Code:main.clicked = e.getCurrentItem().getItemMeta().getDisplayName(); main.frozen = main.clicked; FrozenGUI frgui = new FrozenGUI(Bukkit.getPlayer(main.clicked)); Player unfreeze = Bukkit.getPlayer(main.frozen); Player frozen = Bukkit.getPlayer(main.clicked); player.sendMessage(freezeMessage.replace("%frozen%", e.getCurrentItem().getItemMeta().getDisplayName())); frozen.sendMessage(frozenMessage.replace("%player%", player.getName())); frozen.openInventory(frgui.finv); player.closeInventory();
Code:@EventHandler public void onMove(PlayerMoveEvent e) { Player frozen = Bukkit.getPlayer(main.clicked); frozen.teleport(frozen); }
I want it so when someone types /unfreeze it uses the main.frozen and it makes the frozen player revert back to a nromal player that isnt main.clicked.
Okay so this isn't a good way to do it, you'll want to store frozen player uuids in an ArrayList (so the plugin can support multiple frozen players at once).Ok, i am making a freeze player plugin. And when you type /freeze it opens a gui with all of the players on the server at that time, once you click a player its executes this code
And the player that is marked as frozen via main.clicked cannot move from this code:Code:main.clicked = e.getCurrentItem().getItemMeta().getDisplayName(); main.frozen = main.clicked; FrozenGUI frgui = new FrozenGUI(Bukkit.getPlayer(main.clicked)); Player unfreeze = Bukkit.getPlayer(main.frozen); Player frozen = Bukkit.getPlayer(main.clicked); player.sendMessage(freezeMessage.replace("%frozen%", e.getCurrentItem().getItemMeta().getDisplayName())); frozen.sendMessage(frozenMessage.replace("%player%", player.getName())); frozen.openInventory(frgui.finv); player.closeInventory();
Code:@EventHandler public void onMove(PlayerMoveEvent e) { Player frozen = Bukkit.getPlayer(main.clicked); frozen.teleport(frozen); }
I want it so when someone types /unfreeze it uses the main.frozen and it makes the frozen player revert back to a nromal player that isnt main.clicked.
Okay so this isn't a good way to do it, you'll want to store frozen player uuids in an ArrayList (so the plugin can support multiple frozen players at once).
When you click on the player's head you'll want to save their UUID into the list, then when they try and move instead of doing frozen.teleport(frozen), you'll need to check if the player's uuid is in the arraylist, if it is then do event.setTo(e.getFrom())
Let me know how it goes.
