Hot Summer Deals are Here!
Celebrate with up to 99% off on 18,000 resources
00
Days
02
Hours
52
Mins
00
Secs

How to get a command arg from another class?

Status
This thread has been locked.

Rainy

Premium
Feedback score
4
Posts
963
Reactions
140
Resources
0
How do i get a command argument from another class? such as /command firstarg

so i currently have this

Player target = Bukkit.getServer().getPlayer(args[0]);

how do i access the target from the other class? ive been reading a few books etc but still cant get my head around how to do this?
 
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

Rainy

Premium
Feedback score
4
Posts
963
Reactions
140
Resources
0
What are you ultimately trying to achieve?
so basically im making a punish gui plugin and so far i have all the items etc and gui setup but i have the eventhandler in its own class so when someone clicks on the item in the gui lets say it says ban player i need to get the name they typed before the gui opened. so a staff would do /punish playername and it would open the gui but i got the when the user clicks in another class so i need to get the name from /punish playername to the eventsclass so i perform the command "ban playername reason]

if that makes sense ?

basically i need the first argument the playername that they typed /punish [playername] and get it to the event class so i can perform the command with there name.
 

kampai

Feedback score
8
Posts
361
Reactions
187
Resources
0
Store the names in a hashmap everytime a staff member executes the command. Store the staff player's name then the player u want to punish's name
 

kampai

Feedback score
8
Posts
361
Reactions
187
Resources
0
I am learning i just wanted to test my knowledge so far.
That's good. Mainly, experience is all you need. Once you have enough experience or gain new knowledge about java you'll never experience that problem again. After a while everything kind of just comes to you naturally like you speaking the english language.
 

Rainy

Premium
Feedback score
4
Posts
963
Reactions
140
Resources
0
That's good. Mainly, experience is all you need. Once you have enough experience or gain new knowledge about java you'll never experience that problem again. After a while everything kind of just comes to you naturally like you speaking the english language.
Yeh im starting to get the hang of things. just still trying to understand hashmaps etc.
 

kampai

Feedback score
8
Posts
361
Reactions
187
Resources
0
PHP:
HashMap<String, String> map = new HashMap<String, String>();

if(map.contains(player.getName()) {
}
map.put(player.getName(), target.getName());
^^ the jist of everything
 
Status
This thread has been locked.
Top