#help-development
1 messages · Page 1561 of 1
idk
Unfortunately, this feature is only on bedrock. you do have to use bungeecord to do this on java
thanks bud
okay
You're welcome
BungeeMessaging, 100% possible
one sec
the channels
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
there you go
so up the threshhold? idk i dont get kicked
and is it in spigot or in bungeecord?
Spigot you can do it in
spigot
ok
Register an outgoing channel to bungee, then send the connect message
works with the bungeecord api, that is included in spigot-api
wait rlly
and the plugin has to be on both servers?
so, no learning of bungeecord needed
no
just on the one, you wanna join FROM
one sec, i can even give you smt instantly
wait yeah i do
yep
told u
that wat i trying to do
set fly to on when u take off
and when land set it to false
you need to use this one to connect to a server. player is the player you wanna connect, server is the name defined in your bungeecord config.yml.
public void connect(Player player, String server) {
ByteArrayDataOutput output = ByteStreams.newDataOutput();
output.writeUTF("Connect");
output.writeUTF(server);
player.sendPluginMessage(Main.getPlugin(), "BungeeCord", output.toByteArray());
}```
and in your onEnable, put this
```java
this.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");```
that's it
?
and this should be a spigot or a bungeecord plugin?
spigot
spigot
okay and nothing else needed?
if u wanted u can make an api to put in all ur other servers to check if its online or not]
with your 2/more servers
and how do i teleport the player to this server?
with the method i sent
just call it
and you teleport the given player to the given server, easy peazy
so the method automaticly does that?
just set allow flight to true?
thats what i use in my /hub command:
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (sender instanceof Player) {
if (args.length == 0) {
Main.getPlugin().getMessenger().connect((Player) sender, "lobby");
sender.sendMessage("§aYou are now connected to Lobby.");
}
}
return false;
}
im making it public
just call it, and you'll sent to the server. except you're not allowed to. but that's shown in chat in most cases
not everyonw will do tht
ok well try and find a way to do it programmatically
not possible then
omg
nms 🦆
i'm out, joke
im good
his issue is, if he's making it public, other people will have issues when they don'T set flying in their properties
but idc no more
i know
i understand
well, just cancel the kick event if it is for flying ig
well, that's actually an anticheat-breaker i guess?
that is craftbukkit i think...
idk
well do it how i did it the first time
i have to make a getPlugin method for this right? In the mein
or just like pass the plugin instance thru the constructor
Main.getPlugin(Main.class) iirc
butts
but what
yeah okay
u will have to do it like this then @quaint mantle
but i'd suggest creating those
private static Main plugin;
public static Main getPlugin() {
return plugin;
}```
i literally dont understand you
at least thats what i do everytime
you dont want to do it the best way, because you have to include some nms code
dont we all???
but it is sometimes necessary
funny right?
no
:(
not really
sad
:[
what is .getMessenger?
the getter for the class where the method is in
if you like static abuse, just make the method static :/
yes its the "getter"
i'm just trying to get away from that static abuse
so i'm making a getter/constructor for like everything
maybe even worse than before lol
stay in english
people dont like that
german is a cringe lang
but english is cringer
AYO
^^
yeah
am a native english speaker who learnt german. a lot of the words just seem... odd
yea true tho
like... Lastkraftwagen... i mean, people just say Auto, but still... why does that words even exists
nvm
I'd suggest using composition over a static reference when possible
lastkraftwagen is a truck lol
go to #general for that kind of stuff, don't flood this channel
sorry :/ got ya
accessing a static reference via getter doesn't change the fact that it's static
korbsti
is there any way
to edit the sounds
of villagers
when they have seggs
lol
i think u know wat i mean
yea
is it possible?
Hi!
do they even make sounds in that event? lol
Whats the problem?
idk
What does .getmessenger() do?
Uh never worked withit

#help-server and make sure you are connecting to the bungeecord and not the server
@last temple ^
is there any tutorial on how to implement vault perms? all I find is for economy
They have examples on their github page for it, right?
I think they do, I'll check
so
player.performCommand();
makes the player do a command??
and if so do I need to do the /
player.performCommand("/heal");
or
player.performCommand("heal");
ok
hi
A bungeecord server is the proxy server, like how you join Hypixel and from there you can connect to other smaller servers. A proxy server is a bungeecord server where all of the connections are held allowing you to hop around non-proxy servers while not having to change IPs
if you want a tutorial on how to setup the bungeecord, I used this one https://www.bisecthosting.com/clients/knowledgebase/29/How-to-setup-BungeeCord.html and it gives you a video and some steps on how to set everything up
Why when I add 2 or more aliases to a command they don't work at all, but when I have only 1 alias it works
I set the list of aliases like this [alias1,alias2]
if i run .toString() on a uuid, does it give me the uuid with or without the dash thingies
With
is there a simple way to add more files to the plugins folder?
If you want without, just do String#replaceAll(“-“, “”);
with
Just create a file?
new File(getDataFolder(), "cool file");
^ from memory may or may not work
i meant do i neeed to write all this twice
no
you dont even need to write that once
declaration: package: org.bukkit.plugin.java, class: JavaPlugin
Not sure why you recreated the method
how do I fake a User has left the game!
I know how to do command and all that.
but for example if I do /leave in game
I want it to look like I left the game for everyone else
just broadcast it
and make the player invisible/hide him from other players
yeah I was thinking that would be the way
How would I compare 2 custom items? I know that comparing them via display name isn’t the best option because players can rename items.
ItemStack.equals()?
.equals() only returns true if they’re the same ItemStack object which is not what I want
isSimilar compares everything bar stack size
well what comparison do you want to do exactly
Cool. I’ll try that out.
equals is overridden to compare the properties
so it is valid for your use case if the amounts are the same as well
CompletableFuture<Boolean> serverConnectionFuture = new CompletableFuture<>();
player.connect(serverInfo, (status, throwable) -> {
if (throwable != null) {
serverConnectionFuture.completeExceptionally(throwable);
} else {
serverConnectionFuture.complete(status);
}
});
boolean connectionStatus = serverConnectionFuture.get();```
whats wrong with the code here? the callback never returns
How would I check to see what properties it actually checks?
you can look at the source code and see the implementation yourself
but it’s just everything about the item i’m pretty sure
uhh
Should I use ClientboundSetTitleTextPacket or PacketPlayOutChatPacket for 1.17 title packet sendings? (Yes NMS..)
I ask this because both of them have a something in common that is to send a title packet, but I don't know which one of them actually does the trick...
or if both do.,
get the item meta
I recommend NBTAPI, since it allows you to add a custom tag that cannot be replicated.. unless the player replicates the item or smth like that, ya know
in what version?
1.17
I’m not adding keys to PDC. I’m making a sacks plugin. The plugin owner defines what items are eligible to be put in a sack via GUI.
These items can be custom items. I just needed a way to compare them
Yea it does
good, wasn't sure since the javadocs doesn't show me the PDC
ah, thanks. i am just dumb. i looked for itemstack, not for itemmeta
you can use PDC for that, right?
sack plugin? is it like a backpack? for what do you need the comparison here
No
Yes it’s like a backpack that holds only specific items that it’s allowed
yes pdc then
I need to check to see if the item them are trying to place into the sack, matches the eligible items that can be placed in the sack
How would I use pdc
I know how to use pdc I just don’t think I explained it correctly.
If I’m trying to compare if an item from a random plugin like ItemsAdder is eligible to be put in the sack, then I wouldn’t check it’s PDC because it’s ItemsAdder’s item. I haven’t added any keys to it.
then either add a key to it or you have to maintain your own list of allowable items
Make a list of all items that are added (by cloning them) and compare?
Edit: didnt mean to respond to that, lol
I have this piece of code here```java
@SuppressWarnings("unlikely-arg-type")
@EventHandler
public void onDeath(PlayerDeathEvent e) {
if(e.getDrops().equals(Material.COMPASS)) {
} else {
return;
}
}``` how can I clear a specific drop from the player?
loop and remove it from the drops
e.getDrops().removeIf(i -> i.getType() == x);
^
They have an API, so it's possible maybe
what does ->?
what should be i and x?
here let me try something
and I will show
that loops over every item i and the tests Predicates if it is to be removed
a Predicate is basically a boolean test
so if i.getType() == x (you provide X) it will be removed
ie (i -> i.getType() == Material.STONE);
removes all stone from drops
yiou mean I have to provide a material which is x and i is the variable from the for loop?
Precisely
How do I make my permission nodes show up when I use for example luckperms plugin?
However if you used a normal foreach loop I think it would cause a ConcurrentModificationException?
ok so like this? ```java
for(i -> i.getType() == Material.COMPASS) {
}```
.
o.O That's one heck of an attempt at a for loop
No for requires you to create the variable.
for(ItemStack i : e.getDrops())
removeIf is a function that takes a Predicate for each item in the original list. So i -> i.getType() == x checks if the type of each drop is equal to x. Essentially the same as:
for (var drop : e.getDrops()) {
if (drop.getType() == x) {
// remove the drop (doesn't actually work), which is why we use removeIf()
}
}
Material x = Material.COMPASS;
if(e.getDrops().equals(Material.COMPASS)) {
e.getDrops().removeIf(i -> i.getType() == x);
}``` ????
literally e.getDrops().removeIf(i -> i.getType() == Material.COMPASS);
I am going to get rid of that if
get rid of it all
getDrops is a List of everything it will drop. Why would you want to compare it to a Material?
you use teh exact code I just showed you and nothing else
this? e.getDrops().removeIf(i -> i.getType() == Material.COMPASS);
🎉
removeIf iterates over every item in the Collection
@EventHandler
public void onDeath(PlayerDeathEvent e) {
e.getDrops().removeIf(i -> i.getType() == Material.COMPASS);
}
k thx
is there a way to find how many fileconfigurations your plugin has?
Is it possible to create permissions at run time?
yes
How?
depends on your use case
ok
What are you trying to do?
Working on a private chest command I use /open (chest_name) to open it and I can add or remove them
and people with ranks will have access to more chests depending on how the owner sets it up
I don;t see that you have to create any permissions
you just test if (player.hasPermission("chest." + chestname.toLowerCase()))
does anyone here know 1.7 NMS?
You will have to make sure the name is only a-z and convert spaces to _
I have been trying to figure out how you would add custom skulls to the game for like say a head that looks likes fries that replenishes hunger. I just am not sure how u create that skull in the plugin itself
ok that shouldn't be hard to implement then
@dusk flicker I could care less if you don't care at all
Will the permission appear on permission plugins if I do it this way? my permissions for other commands didn't appear until I added them in my plugin.yml
Whenever I use worldcreator to create a world, it keeps making the spawn point 0 0 for some reason
nvm its a glitch with spigot on certain minecraft versions
no, as they are dynamic permission
Then how will others know how to add them if they don't appear
wtf
Your plugin doesn;t create permissions, teh server owner/admins add the relevant perms to their permission plugin
Ok, I understand
You can register them to yoru plugin though
Ok
Bukkit.getPluginManager().addPermission(new Permission("your.permission"));
Thanks!
Then they would show up in the LP UI thing
I ask that because of a variable I cannot understand in 1.7 NMS.
Since I am mapping NMS..
what does plugin.getConfig() returns when there are multiple config files?
ah
@eternal oxide I made a test command and it works great! now all I need is to add the permissions again whenever I start the plugin.
Just remember to remove them if you need to
Right
Hi to everyone.
I got a problem with p.spigot().sendMessage. When I do txtComponent + txtComponent in the sendMessage it leaves to me a "log/description" of the textComponent
(Others txtComponents works! Only yes and no do that)
---------------------------------------------------------------------------
Code regarding the creation of yesTextComponent e noTextComponent: https://paste.md-5.net/didogiputi.coffeescript
SendMessage Line: https://paste.md-5.net/ebehegawel.css
Image of the result: https://i.imgur.com/QGRu4DS.png
Text components are not concatenated using the '+' operator
You usually either want to add them to a component builder one after another or simply compile them all into a single array
Thanks
surprised textcomponent's tostring isn't implemented so
Kinda agree, that would be syntactically nice
Seems pretty impossible concerning in the end a single component with a bunch of children has to be sent
Spigot would have to invent some useless format and parsee for stringified components
Which seen resource intense af
Lmao yeah
https://ibb.co/fk1TWRv
why do i get an error in the override i just created a new porject,
i created another project too but i still get the error
clear your cache
how can i do that
ok
wow
thank you it fixed it
:)
i there a way to compile projects dictly without using maven like in eclipse in intellij
right hand side maven menu, lifecycles
I believe you can other ways but no clue as I use Eclipse
This is probably a potato brain question, but how do I interface with a BungeeCord plugin from a Spigot server
As a plugin
Plugin Messaging Channels
As I thought
Obviously has the issue that your server needs a player on it
i tried eclipse today but gave up cuz i know less code lol i didnt knew how much intellij was helping me i had to google search for everything in intellij one thing i liked is the genaration of har files is very fast whereas in intellij takes more than a minute
you mean compile without using maven?
he means single button click
In Eclipse you just click the run configuration for the project and it builds.
if (player.isOnline() && player.hasPlayedBefore()) {
player.getPlayer().kickPlayer("You have been banned");
}``` why is this an error
you don;t need to player.getPlayer() but also just read the error. It tells you whats wrong
thats an async catcher
then you can;t kick them
on this one
means you cant run that async
if they are offline you can NOT getPlayer() and you can;t kick them
ok, makes more sense
anyway, don;t kick Async
how do i kick them
why is player.getPlayer() a thing?
His player is actually an OfflinePlayer
yea
maven is great
why do i have to do it everytime i build my jar file its pretty irritating
You shouldn't
i have a potato pc and its slow i dont hate it
What lifecycle are you using to build? or are you making the mistake of using Artifacts in Intelij?
https://ibb.co/qB6mZNT
i use this
why does intelliJ have such a cool discord game status but not vscode
how can i run a clean one like this?
https://ibb.co/tbWKb1S
You actually have a bridge build which is clean/package under your configuration
in your maven window
yes
https://ibb.co/D8GfnYn
still not fixed
is there a function to check if all arguments in a boolean[] are true then return true?
Afraid no clue then, you cache is messing up, but I don't use InteliJ so can;t advise
ohh
what do i do now
fresh install intellij
try File -> synchronize
Should the plugin channel I listen to be BungeeCord or something else?
I'm creating a pluginchannel listener on the proxy
Is there any way to set the message in AsyncPlayerChatEvent to a text component?
no i dont think so
I am trying to set the message to a hoverable message, but it does not work because you need to use textcomponents for that to work'
So I am trying to figure out a solution
Is there something that will tell you what version of the game someone is using?
Cancel the event and send the message using player.spigot().sendMessage()
loop thru every player and send messaghe
Hm yeah that could work
ViaVersion API
ok so turns out that i was using jdk 1.8
took lot of troubleshooting lol
Hey does anyone know how to call an ItemStack from another class while making a custom recipe this is the code https://paste.md-5.net/robojinamu.cpp and it has an error undernearth it https://gyazo.com/a677955f4ad55e66515460e88bdb32f5
Also, I want to replace a string in the message with the text components, how would I go about doing that?
its just like player.spigot().sendMessage("string")
right?
?java
?java
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
?
No it is only basecomponents that can be used
You will need to use RecipeChoice.ExactChoice(ItemStack) rather than just ItemStack
Okay tyvm
bump
How would I go about changing the version that appears in the top right of the server when you're in your server list?
prob in the server list ping event
e.getChunk().getEntities() seems to always be empty on ChunkLoadEvent. Any ideas on how to get around this?
Well, as far as I can tell, there's nothing about versions in there
Are plugin messages between the proxy and the backend server secure?
event.getResponse().setVersion(new ServerPing.Protocol(Chat.colour("&4Maintenance"), 0));
Oh
Maybe wait 1 tick as it could be getting called before it loads
0 being the version I think
bump
What are you trying to do?
I'm trying to replace a string in the message returned from AsyncPlayerChatEvent to TextComponent
So if someone sends a message instead of being, String. You want it to be String, TextComponent, String?
Correct.
You just split the string up where ever you need. Then for each section of the split string you can turn it into a textcomponent. Then use getServer().spigot().sendMessage(TextComponent...); and send all of the textcomponents in order. A textcomponent extends BaseComponent.
Thank you.
No problem 🙂
ItemStack.isSimilar(ItemStack), you can't compare itemstack object instances as im pretty sure they get copied and pasted meaning they don't have the same objectID as the one you created.
Is there any way to fix an anvil removing "illegal" enchantments?
if I add permission in the plugin.yml do I still need to check when the command executes if the player has the permission?
yessir
My custom enchant gets removed from an item if you use it in an anvil to add another enchant
so im trying to improve how i delete things in config files, normally i would have something like https://paste.md-5.net/casuvamahu.bash
but i want to delete "2" for example
i have a way to do this wich is take each value from the next id and move it to the current id, when the next one is null i delete the last one
can you edit the player class?
why do you want to edit the player class?
that is not a good idea
adding some methods
why not?
methods like?
you gotta really know what you are doing
like player.getOrigin();
which will return an origin from the Origin class
what is an origin class?
you cant really edit the player class without editing the server
a class i made
then make your own player class and wrap it
wdym wrap it
like "implements Player"?
no, you create your own class, say User. It has a UUID and all the methods you want. add a getPlayer method so you can get a Player from it
You can't just implement player, if you want to make your own player you'd need to extend from the original NMS class wich is EntityPlayer
What you can do with this is very limited btw
But I don't see any other solution if you want to actually edit the player class
Unless you build your own server
some1 know how to check which gui opened and if the item clicked is in the gui?
InventoryClickEvent
event.getClickedInventory();
I have that
if(e.getClickedInventory().getTitle().equalsIgnoreCase(ChatColor.BOLD + "" + ChatColor.RED +"Teleport GUI")){
but there is an error at .getTitle()
don;t compare titles. But title moved to getView().getTitile()
so what compare?
I also tried that if(e.getInventory().equals(gui)){
but when I click on items that in my inventory and in the gui the command happens
oh, Thanks!
also getClickedInventory() can be null so reverse it, if (gui.equals(e.getClickedInventory())
https://hastebin.com/axafohibuc.swift
I created the plugin part in my code and it gave me an error..
If someone can tell me what wrong or if you need more info let me know
it says "One related problem"
ok so when i click on it.. it takes me to my main class and says there is an error with "
getServer().getPluginManager().registerEvents(new BoomBallEvents(), this);"
You have to do new BoomBallEvents(this), this);
Yeah
ah
how do you send titles to players in the 1.8.8 spigot api? the sendTitle() and resetTitle() methods are deprecated
use the methods that require more than just String
sendTitle("title", "subTitle", -1, -1, -1);
player.sendTitle(ChatColor.GREEN + "Game starts in " + i, -1, -1, -1);
this is my code
deprecated according to https://helpch.at/docs/1.8.8/
oh okay it's still deprecated but i'm gonna use it anyway
That's the 1.17 API, he was talking about the 1.8 api
Hello,
Does anyone know how to get a constructor in reflection that has a "int..." argument in it?
<class>.getConstructor(int.class)
```works well for a Constructor(int arg) but I'm searching for the Constructor(int... args).
Will the int[] works?
yes
varargs are represented as arrays in bytecode
^^
Didn't know the name, thanks for it
np
If I were to be using WorldEdit on a plugin I am developing, would I put a worldedit jar into my external libraries?
Same with Vault
Yes unless you're using maven or gradle
I see, thanks
hey whats the best way for me to keep a database for per player stuff like points or money?
Best way?
generally I see JSON
Depends
For fetching small data in periodic times like once in a while you would probably choose a database or such
Usually just have a dao which loads the dto on join and then unloads it on leave and also some sync timer
For constant operations, then use like JSON or YAML because you load all the elements into the memory
And fast access speed for a lot of constant operations
I have this clickable chat message ```java
TextComponent msg = new TextComponent(Utils.formatMsg("&n&oClick to join " + player.getDisplayName() + "'s party."));
msg.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + player.getDisplayName()));
Don't have a 1000 player's data file loaded in memory tho
Use a database
Obviously yeah
Nope
Scale also matters
damn
very dumb
Not really
is that the same way essentials does it?
Presumably
I'm kinda looking for something like that
they should've made ClickEvent inheritable so you could do something like ```java
msg.setClickEvent(newClickEvent() {
foo
});
or a lambda
That wouldn’t work
Sadly this isn’t swing
The click is sorta client sided
Well blame Mojang for that
Its not a huge problem, I just need to set up a permissions system
I mean
Have not figured out how to do that yet lol I think I need Vault or something
Daddy
You're trying to execute code in the machine of the client?
why is this whitelisting null
/whitelist add null
UUID uuid;
try {
uuid = UUID.fromString(ctx.pathParam("uuid"));
}
catch (IllegalArgumentException e1) {
ctx.json("No player found");
return;
}
//uuid to player
OfflinePlayer player = (OfflinePlayer) Bukkit.getOfflinePlayer(uuid);
player.setWhitelisted(true);
ctx.json("whitelisted " + player.getName());```
hey man I don't need know HOW they do it just CAN they lmao
Are you making a permission plugin or just using permissions
RMI 😌
Just using permissions
You don't really need Vault then
I'm still not sure what do you mean
Just read a bit up
A good permissions plugin will handle bukkit permission requests
yeah but a permission plugin would be overkill for my scenario
And how you can’t run a method directly
why isn't it whitelisting the player
You can just wrap your method in a command and execute set the click event on run command
I mean this isn't for a massive server, just a minigame a couple of my friends will play, I could always just make a hash map in memory to do the permissions
Vault is a compatability layer you still need a permissions plugin with it
Need_Not why not share some more code
i did
I said more...
You are using ==
app.get("/whitelist/add/:uuid", ctx -> {
UUID uuid;
try {
uuid = UUID.fromString(ctx.pathParam("uuid"));
}
catch (IllegalArgumentException e1) {
ctx.json("No player found");
return;
}
//uuid to player
OfflinePlayer player = (OfflinePlayer) Bukkit.getOfflinePlayer(uuid);
player.setWhitelisted(true);
ctx.json("whitelisted " + player.getName());
});``` this is it sir
That is comparing references
Is that supposed to be .isSimilar or .equals
Depending on your needs
But anyways the player name might be null
Well Inventory isn't a list of items either
ive tried with myself and my friends, it only works if the player is online
Yeah
but normally you can't be online without whitelisted
Server#getOfflinePlayer(UUID) will have the name null if no name is cached
Why are you remaking the whitelist command?
Yeah lol
*dont
Oh no 👀
This is better
for a discord bot
You know the bot can use vanilla commands
how do i run commands as console with the plugin
Use Bukkit instead of server if you need easier access
😫
Myeah
Static with static
I’m used to pass the server. I did work for a fac server which had like 2 server instances
2 server instances in the same jvm?
🤡
Myeah,
I mean, I can see many reasons why you'd like to do that
Yeah they had their reasons to
🥲
Hey, can I get the name of an offline player ?
Uh depends
I mean if you used the getOfflinePlayer(name) method then yes
Else not guaranteed
isnt that deprecated ?
uuid is the way now
yes but theres no other way atm
It’s cause it’s blocking and makes a request to mojang shit
Paper got getOfflinePlayerIfCached(name) but it doesn’t replace the deprecated one
also with uuid it gets from java
?
Ok, but why can I get a skull from offline uuid but not name ?
Skull textures are mapped by uuids
ok nvm,
Nope sry
The stupid docs are complaining that JS is disabled when it's enabled lol
rip
Is there any way to automatically "translate" protocols to Minecraft versions?
wdym?
Version protocols... ?
No, just automatically get the Minecraft version the protocol is for
Without something stupid like an if for every protocol number
I was thinking maybe the ViaVersion API does
It should be noted that following 1.16.5, two versions might share a protocol id
Maybe you'd like to use ProtocolLib?
1.16.4 and 1.16.5 have the same ID
that is what I said
Send the packet and afaik ViaVersion should translate it 4 u
he does not want to translate packets though
lol who needs a permissions plugin ```java
public class PermissionManager {
private static final HashMap<Player, List<Permission>> activePerms = new HashMap<>();
public static boolean hasPermission(Player player, Permission permission) {
return activePerms.containsKey(player) && activePerms.get(player).contains(permission);
}
public enum Permission {
JOIN_PARTY, ALL_PARTY_COMMANDS;
}
}
Only a protocol id -> minecraft version lookup
😢
ItemBuilder.skull().owner(teamPlayer).asGuiItem().getItemStack().getItemMeta().getDisplayName() lol this should work
not totally a dumb way of getting a playername from uuid at all
You might want to ask #mcdevs, they should be aware of something that does that
@tiny wolfI was getting a Player object from an item displayname earlier
not scuffed even remotely
Alright, thanks
its literally only to get a player name from uuid
in order to remove an enchant from an item in a players inventory would it be..
player.getInventory().getItemInMainHand().removeEnchant(Enchantmend.LUCK)
or do u have to get the itemMeta as well
seriously? you can't do like Bukkit.getServer().getPlayer(uuid)??
I'm pretty sure you can do this lol
they are offline
ah
getOfflinePlayer()
doesnt work
Would return offline though
Uh, where is that channel?
that's pretty funny then
it returns CraftOffline...
like an object?
even inside getName
oh
ye..
dumb
irc://irc.libera.chat:6697/mcdevs (https://wiki.vg/MCDevs)
see lol
Don't be so confident
Name needs to be fetched out someway, bcs bukkit doesn't store the name of each uuid and viceversa
If it's not fetched, or fetched async, then might return null
Or no, since you're just creating the skull and setting the owner, the display name must not change
it will always get the skull owner therefor it will always get the name.
Don't show object
wdym
use .getName()
ye so I figured out just now when I try to just do OfflinePlayer.getName() wont work but, Bukkit.getOfflinePlayer(UUID).getName will
so yay ig
That method can either block or return null if the player has never joined the server
I don't recall
nope, according to the javadocs it returns a player no matter if they have ever joined
Then can block the thread
@shadow gazelle https://gitlab.bixilon.de/bixilon/minosoft/-/blob/master/src/main/resources/assets/mapping/versions.json works until 21w03a - and that barely with a few issues
Only getOfflinePlayer(String name) makes a request to mojang thus must be invoked carefully.
what can go wrong ?
Server freezes
wouldnt that be the same issue for getting skulls ?
Still thinking that the method might not work as expected because the server doesn't cache all the player uuids and the respective name
its getting it from mojang so it doesnt matter
^
try call getOfflinePlayer(String name) 50 times with random valid names vs getOfflinePlayer(UUID) on the server thread
should demonstrate some difference
what the fuck is this https://www.spigotmc.org/resources/register-login.91401/
login page
logins ?
pretty dumbfounding I agree
Cracked Server
Workin
U use this in cracked Servers to give Users some Kind of protection
Will a player be able to in any way see a command that is ran for them?
Does NBTCompound#toString() return JSON? (NMS)
Better use AuthMe, lol
Nah. ITs kind of authme
U have to set a password first join
i wasn't talking about that
And then every other time enter that password
hmm I think so
U were not?
not too sure
How would you turn the nbt of an item into a json string then?
Better yet dont do cracked lol
well, ye
Better yet: Kill the guy who made it into existence
What method?
I think you can figure out by just looking at their signatures
are the passwords hashed tho 😳
No clue
Haven't looked at src
Look at the src
actually sysdm, for NBTTagCompound to String just #toString it
it will give u a valid json object
yeah
Is there a way to force close an inventory for players that are using it?
humanentity has closeInventory()
Then I think I can use inventory.getViewers() and then close it for everyone
I just updated my IDE and it seems Java is just fucking gone despite it being in the project structure
Material#getKey iirc
does anyone know how to fix this?
Screenshot?
What IDE?
Oh lol
Invalidate and restart caches
go to project structure and select you jdk if you didn't
Weird
Also u got the latest version of IntelliJ?
Yeah
hey i have villagers (npcs) which i spawn in during the onEnable event of my plugin, and remove by their uuid on the onDisable event. now there's a problem where after a while there are duplicates of the villagers (only one is real and the others become normal villagers) so i think there's something happening where the plugin's onDisable doen't run, but onEnable does. has anyone experienced something like it or know a good fix for that?
Just updated it today
anyone know why my gradle cant replace Version tag properly:
processResources {
from(sourceSets.main.resources.srcDirs) {
filter ReplaceTokens, tokens: [version: version]
}
}``` its quite annoying
why Replace tokens
That’s not where you select ur jdk version
Did you select from project?
what else
expand shmezi
processResources.expand 'something': 'lol'
then in plugin.yml you’d declare ${something}
Thanks ❤️

Invalidate Caches and Restart didn't work?
I should really learn all the stuff for gradle lol
Nope
Yeah it’s quite handy
I just have a plugin in intelij that sets up my mc projects
Oh that one
thats the only reason I had that
My gradle setups usually differ a lot so I just rewrite every time
that has happened to me many times
How'd you fix it?
haha ye me too, but Its simple import shadow jar stuff
invalidate caches and restart always did the trick for me lol
Then ur project structure is setup bad
Might wanna try reinstall IntelliJ like worst case scenario
What is the permissions.yml from spigot server?
I don't know how it is, it's literally unchanged
I just updated the IDE version
Ooh, fixed it
Just changed my jdk version to 16
intellij loves to have seizures randomly
That should not have stopped Java 11 from working but oh well, I'm writing plugins for latest anyways
never too consistent to be angry at though lol
Does anyone know how to use SHOW_ITEM in the hover event?
ye use adventure, its pretty poggers
Alright
Is there an event in spigot for when a server on the network shutsdown ?
No need to use adventure if you’re not using something like paper
Nope
Or like there is sort of
... whats the sort of
in the proxy smh
Haven't read the question prob. Sowy
wouldnt work for crashes
Myeah exactly
If it crashed the event wouldn't get fired either
BungeeCord is the way to go here
if its on the onDisable it usually would wouldnt it ?
wdym, this is a bungee question ?
It might just be a reload
How do you do a hover event with that?
hoverEvent(What do I put here?)
Think so
reload command is always a bad idea
Adventure
HoverEvent.showItem
Ahaa
I guess Ill try using bungee messaging onDisable
https://hastebin.com/jizutitidi.properties
I am trying to remove an enchant but it will not work. It works to add the enchant, but cant remove it.
But it wants a HoverEventSource
Probably HovereventSource.smth
Nope
?paste
https://paste.md-5.net/uyocewuyik.cs can someone explain this error?
Nvm just wrong imports
U looping over a list and removing / adding smth
If u want to remove while iterating use an iterator
I have a for loop inside a for loop, the main for loop removes
ok
Ay yo. A loop in a loop
@ivory sleet So this would work? https://gyazo.com/94e7055295833ea07ec3c374fc793675
Try and see
Compile and see
Suppress warnings all 😬
if you need to suppress all warnings I don't think it will 😂
Hello how i can get name of offline player with args?
code:
Player player = (Player) sender;
if(args.length == 1) {
Player target = Bukkit.getPlayer(args[0]);
player.sendMessage(target.getName());
}
its return me error
why do that when you can just give them args[0]
If it works then the lord is comin
because i want to check if the player offline return message...
What error??
its long 300+
Send it
?paste
Please
Do I have to register shaped recipes every time the server starts up or if I register them once they'll always be there?
Everytime
So if I wanted a recipe to be persistent i'd have to find a way to serialize it and save it to file?
and then load it back up later.
Uh yeah
Smth is null
Probbaly the player
i am the player
Stats.java:18
44: nothing
32: getStats(player, target);
18: player.sendMessage(ChatColor.YELLOW + target.getName() + "'s K/D Stats");
target i snull then
public void getStats(Player player, Player target) {
player.sendMessage("");
player.sendMessage(ChatColor.YELLOW + target.getName() + "'s K/D Stats");
player.sendMessage(ChatColor.GRAY + "Kills: " + ChatColor.GREEN + "0");
player.sendMessage(ChatColor.GRAY + "Deaths: " + ChatColor.RED + "0");
player.sendMessage(ChatColor.GRAY + "KDR: " + ChatColor.GREEN + "0/" + ChatColor.RED + "0 " + ChatColor.GRAY + "= " + ChatColor.GOLD + "0");
player.sendMessage(ChatColor.GRAY + "Leaderboard: " + ChatColor.DARK_AQUA + "Not on leaderboard.");
player.sendMessage("");
}
how null?
you are passing null
Null != Good
just because you define it as a player doesn;t not mean its not null
Show me how do you call this method.
show your onCommand method
package pvp.pvp.commands;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.logging.Logger;
public class Stats implements CommandExecutor {
Logger console = Bukkit.getServer().getLogger();
public void getStats(Player player, Player target) {
player.sendMessage("");
player.sendMessage(ChatColor.YELLOW + target.getName() + "'s K/D Stats");
player.sendMessage(ChatColor.GRAY + "Kills: " + ChatColor.GREEN + "0");
player.sendMessage(ChatColor.GRAY + "Deaths: " + ChatColor.RED + "0");
player.sendMessage(ChatColor.GRAY + "KDR: " + ChatColor.GREEN + "0/" + ChatColor.RED + "0 " + ChatColor.GRAY + "= " + ChatColor.GOLD + "0");
player.sendMessage(ChatColor.GRAY + "Leaderboard: " + ChatColor.DARK_AQUA + "Not on leaderboard.");
player.sendMessage("");
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) {
Player player = (Player) sender;
if(args.length == 1) {
Player target = Bukkit.getPlayer(args[0]);
getStats(player, target);
} else getStats(player, player);
} else console.info("Command works only for players!");
return true;
}
}
Player target = Bukkit.getPlayer(args[0]); is returning null
so how i need to do that? so it will not return null?
how i getting offline player stats
you need to test if its null. If its null the player you tried to get was not online/is invalid
and all their stats in file
getPlayer will only return a player IF they are actually online and not dead
but how i get his uuid from arg -_-
Black1_TV:
kills: 16
deaths: 2
U have the target / plaer
you don't need that
.getUUID xd
save players name
no he doesn't
I know
players name is so unsafe
Just said it can be stored alternative way
it's for offline servers - Safer then uuids
as every offline server can use different uuid version
so names are more safe then uuids
for offline servers
i cant do fetch to mojang api of username to uuid like in javascript or something?
so wait,
if i am using bungeecord server and on my pvp server have my plugin
so i need save it by names?
I had problems when I was saving UUIDs
because I had multiple servers on one bungeecord
and one server uses different uuid version
I did use the same server version
so username are safty?
I meant online servers and mzsql databases but yeah sure :D
50% servers are offline and 50% online so it's hard to choose
I do store both in database
uuid and name
when player joins the severs for the first time
what the heck did I stumble upon
never save any data based on name, ever
Spigot has a bungee setting that allows to sync UUIDs iirc
Didn't know that thanks
Also why it's turn off by default?
because most server owners that do not know about the setting are running without a proxy
if you are using offline then you generate teh UUID from the name
Can you show me where I can find this setting?
its like
if you save perms by username and give to someone all access
with bungee ppls can hack your server by this
i am using bungee server
proxy server: online
other: offline
