Bukkit Coding Config

Status
This thread has been locked.

HuskyGG

Banned
Feedback score
3
Posts
79
Reactions
16
Resources
0
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.
 
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

HuskyGG

Banned
Feedback score
3
Posts
79
Reactions
16
Resources
0
That makes no sense, please elaborate.
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.
 
Banned forever. Reason: Scamming (https://builtbybit.com/threads/huskygg-scam-report.282658/)

Eric

Software Engineer
Supreme
Feedback score
14
Posts
1,760
Reactions
1,648
Resources
1
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.
In the onDisable do "saveConfig()"
 

HuskyGG

Banned
Feedback score
3
Posts
79
Reactions
16
Resources
0
Last edited:
Banned forever. Reason: Scamming (https://builtbybit.com/threads/huskygg-scam-report.282658/)

Eric

Software Engineer
Supreme
Feedback score
14
Posts
1,760
Reactions
1,648
Resources
1
Thank you![DOUBLEPOST=1503316344][/DOUBLEPOST]
Also what is the best way to add an overall ChatColor &
Use ChatColor.translatelternatecolorcodes('&', msg)
 

HuskyGG

Banned
Feedback score
3
Posts
79
Reactions
16
Resources
0
Use ChatColor.translatelternatecolorcodes('&', msg)
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 :p
 
Banned forever. Reason: Scamming (https://builtbybit.com/threads/huskygg-scam-report.282658/)

Eric

Software Engineer
Supreme
Feedback score
14
Posts
1,760
Reactions
1,648
Resources
1
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 :p
wat.
 

HuskyGG

Banned
Feedback score
3
Posts
79
Reactions
16
Resources
0
Ok, so ive got this code:
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();
I want it so when main.frozen:
Code:
 main.frozen = main.clicked.
is executed it reverts the main.clicked:
Code:
main.clicked = e.getCurrentItem().getItemMeta().getDisplayName();
player go back to a normal player and not execute the freeze code.
 
Banned forever. Reason: Scamming (https://builtbybit.com/threads/huskygg-scam-report.282658/)

Eric

Software Engineer
Supreme
Feedback score
14
Posts
1,760
Reactions
1,648
Resources
1
Ok, so ive got this code:
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();
I want it so when main.frozen:
Code:
 main.frozen = main.clicked.
is executed it reverts the main.clicked:
Code:
main.clicked = e.getCurrentItem().getItemMeta().getDisplayName();
player go back to a normal player and not execute the freeze code.
I'm genuinely confused about what you're trying to do.

Is this inside an event, command..? None of this code makes sense.
 

HuskyGG

Banned
Feedback score
3
Posts
79
Reactions
16
Resources
0
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
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();
And the player that is marked as frozen via main.clicked cannot move from this code:

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.
 
Banned forever. Reason: Scamming (https://builtbybit.com/threads/huskygg-scam-report.282658/)

Irantwomiles

Check my signature for a new Practice plugin
Premium
Feedback score
3
Posts
1,263
Reactions
570
Resources
0
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
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();
And the player that is marked as frozen via main.clicked cannot move from this code:

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.
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?
 
Last edited:

Eric

Software Engineer
Supreme
Feedback score
14
Posts
1,760
Reactions
1,648
Resources
1
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
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();
And the player that is marked as frozen via main.clicked cannot move from this code:

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.
 

HuskyGG

Banned
Feedback score
3
Posts
79
Reactions
16
Resources
0
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.

Thank you i shall try that now.
 
Banned forever. Reason: Scamming (https://builtbybit.com/threads/huskygg-scam-report.282658/)
Status
This thread has been locked.
Top