#help-development
1 messages · Page 35 of 1
me the whole day already 🥺
soo many errors
opened a 2nd project just to test stuff lol
would having a #tick method in that class, then calling the tick every tick from a runnable be a good idea, or is there something better I should do
implement Runnable
or BukkitRunnable
i had some related errors and i just choose another jdk and compiled with that and it worked fine
is it the first time you get this when compiling plugin?
isnt it extends?
idk
how to take a book without PlayerTakeLecternBookEvent?
i need smth like this:
player with custom item right click on lectern with book
after that book author changing and book drop
probably taking another sdk will resolve it
anyways, is there a real profit by choosing the right eventpriority for a listener?
bro what the fuck
what if you make it private?
lol
no bruh it broke
again
what the fuck is this now
NO WHAT THE FUCK
bruh i swear if invalidate caches doesnt fix it
clear cache
my ide is just using all my power lol
ij be like fourteen paid for the whole psu, imma use the whole psu
What a beast lmao
some power thing on my laptops cable lol
ye
i hope i wont be able to bake an egg on it like the prev one
use the maven shade plugin
doesnt alex has some guide on his website thing?
uh oh
you are clearly using Maven as you have maven dependencies. You should be using the pom/maven not exporting
anyone know what this means
your database connection isn't open
What does the BukkitObjectInputStream add over ObjectInputStream?
?jd-s
public void mySqlSetup() {
try {
File file = new File(getDataFolder(), "config.yml");
host = ConfigurationProvider.getProvider(YamlConfiguration.class).load(file).getString("database.host");
port = ConfigurationProvider.getProvider(YamlConfiguration.class).load(file).getInt("database.port");
database = ConfigurationProvider.getProvider(YamlConfiguration.class).load(file).getString("database.database");
username = ConfigurationProvider.getProvider(YamlConfiguration.class).load(file).getString("database.username");
password = ConfigurationProvider.getProvider(YamlConfiguration.class).load(file).getString("database.password");
}
catch (IOException e) {
e.printStackTrace();
}
try {
synchronized (this) {
if (getConnection() != null && !getConnection().isClosed()) {
return;
}
Class.forName("com.mysql.cj.jdbc.Driver");
setConnection(DriverManager.getConnection("jdbc:mysql://" + host + ":" + port + "/" + database, username, password));
getConnection().prepareStatement("CREATE TABLE IF NOT EXISTS villagerPark_players (UUID varchar(50), NAME varchar(100), ECO int, STREAK int, LastStreakGiven DATETIME").executeUpdate();
ProxyServer.getInstance().getConsole().sendMessage(new ComponentBuilder("Successfully connected to the MySQL database").create());
}
} catch (SQLException | ClassNotFoundException e) {
ProxyServer.getInstance().getConsole().sendMessage(new ComponentBuilder("Error connecting to the MySQL database").create());
e.printStackTrace();
}
}
what did I do wrong?
Thank you.
check your sql syntax with some online tool
shade it?
Can anyone help me with this? I have no idea what to do, I need both plugins and they worked fine before but now they dont
change the scope to compile and shade with maven shade plugin
all it says is that the issue is in LastSteakGiven DATETIME but I cant figure out how to fix it
tried Timestamp and TIMESTAMP too
i have issues when i try to join to the server and i have the console server open
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
@tender shard Small question, in your library, you seem to use Base64Coder#encodeLines preferentially (In the ItemSerializer) part. Why's that?
The documentation for that one says it splits the output into lines of 74 characters, but surely each item can't be 74 characters long?
someone can help me pls
1.8 :(
this bad practice? ```java
final boolean lostAllSheep = this.playerSheepCount.get(playerId) == 0;
if (lostAllSheep)
. (checked my syntax in a syntax checker but it says that its right)
well is it good practice or just neutral?
i have issues when i try to join to the server and i have the console server open
https://pastebin.com/aMJ75k6X
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
i think that was just for readability. i dont remember
the base64 decoder doesn't really care about newlines iirc
Ah, alright then.
do you already have code for your gameloop thing?
soon done refactoring
soon ~= 30 mins
why?
its a plugin or other thing
I have a fast dought paginated/paged menu/guis create a new inventory per page or just use the same inv but ordering the items?
if I pass an arraylist to a function and modify it, will it be changed in the other scope? Is the argument the same object?
the list will be changed yes
even for class privates?
com.comphenix.net.sf.cglib.proxy.Enhancer what can i do
class Test {
List<String> strings = Lists.newArrayList("one", "two", "three");
void something(List<String> strings) {
strings.add("four");
}
}``` strings will be changed yes
of course
if you mean smth like that
ask more specific questions
List.newArrayList :( 🔫
thanks
if I do entity.remove() will it also be removed as a passenger of another entity automatically?
does anyone happen to have a code snippet where they get the generic_attack_damage attribute from an itemstack? I think I have it right but my code looks like it's trying to summon Cthulhu
itemStack .getItemMeta() .getAttributeModifiers() .get(Attribute.GENERIC_ATTACK_DAMAGE) .stream() .findFirst() .get(). getAmount();
not sure about that stream
help me with this please https://pastebin.com/aMJ75k6X
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
i dont know how to repair it
well that will only get you the first attribute. You could have more than attribute modifier
are you actually coding your own plugin?
i'm gonna try
so the attack speed could have multiple attributes affecting it? Is there a way for me to just get the final result?
there is no final result. I mean, imagine you have two modifiers, both for EquipmentSlot.MAIN_HAND. One doubles the damage, the other adds 1.
There simply is no final "attribute modifier", it always depends on the "input". If the normal damage would be 5, then the result would now be 11 (5*2 + 1). If the input was 2, it would be 5 (2*2 + 1)
unless I misunderstood what attributes are
yeah, i will in a future
I'm trying to display a scoreboard to a player using packets. I have to send a ScoreboardObjective, but I cant cast Objective to CraftObjective
because its not public
I tried using reflection but it throws this
java.lang.RuntimeException: java.lang.NoSuchMethodException: org.bukkit.craftbukkit.v1_18_R2.scoreboard.CraftObjective.getHandle()
what's the input then? Surely there must be a way to calculate the cooldown for any give item, right?
but what should i do to fix it
this is from the CraftObjective class (this.objective is a ScoreboardObjective btw)
also Im using a paper jar for my server
ask the developers of protocollib
I mean, the API already has support for per-player scoreboards
why don't you just create an NMS objective if you don't wanna use the API?
it's pointless to create a bukkit objective if you don't wanna use bukkit to send it
but why doesnt my code work? does paper use a different craftbukkit
I could, but I want to know whats not working with my code
because it throws NoSuchMethodException when the method (in the BuildTools CraftBukkit jar) clearly exists
?paste your code pls
Mfalex did you ping me my mate?
not that I remember
Allr thanks dont worry
you are using getMethod on a non-public method, that cannot work. You need to use getDeclaredMethod to get private methods
like this
Oh I really having issue with páginated menus. Do they create a new inventory for each page or how does they work?
oh, mb
getMethod always only gets public methods (or the closest accessible one) because otherwise there'd be visibility problems if e.g. a class overrides a private method of any super class, etc whatever
this a bad idea? import org.bukkit.*;
I probably explained it badly but you get the idea
no
in bytecode, there are no imports anyway
ok so let me see if I am understanding this correctly, items have attribute modifiers but the attribute that gets modified is stored player-side?
because it looks like I can get a final attack speed attribute from a player
``` this is the line where i set custom player skulls, but i forgot where do i get those skins in this form
but doing import java.util.* is?
thats the base64 oif the json containing the url. btw in 1.18.1+ you don't need game profiles anymore https://blog.jeff-media.com/creating-custom-heads-in-spigot-1-18-1/
no, why would it be?
its about recompilation that would fuck it up
generally with any wildcard import
was a mistake to ever have those in the first place smh
recompilation? wdym?
CREATE TABLE IF NOT EXISTS villagerPark_players (UUID varchar(50), NAME varchar(100), ECO int, STREAK int, LastStreakGiven varchar(100);
can someone please tell me what the HECC is wrong with this sql syntax?
) at the end
any ideas of how the ADD_SCALAR operation for attribute modifiers works?
@EventHandler
public void craftItem(PrepareItemCraftEvent event) {
CraftingInventory craftingInventory = event.getInventory();
ItemStack[] list = craftingInventory.getMatrix();
if(list[0] != null && list[1] != null && list[0].getType() == Material.WRITTEN_BOOK && list[1].hasItemMeta() && list[1].getItemMeta().hasCustomModelData() && list[1].getItemMeta().getCustomModelData() == 1213){
ItemStack book_new = new ItemStack(Material.WRITTEN_BOOK);
BookMeta book1_meta = (BookMeta) list[0].getItemMeta().clone();
String str = list[1].getItemMeta().getLore().get(0);
ArrayList<String> lore = new ArrayList<String>();
lore.add(colorFormat("&d" + str));
book1_meta.setLore(lore);
book_new.setItemMeta(book1_meta);
event.getInventory().setResult(book_new);
}
}
public String colorFormat(String s) {
s = ChatColor.translateAlternateColorCodes('&',s);
return s;
}
i dont know why, but book lore is not colored
declaration: package: org.bukkit.attribute, class: AttributeModifier, enum: Operation
I see that Papple, I also don't know what adding a scalar amount looks like
imagine a sword has a damage value of 5. now you add a scalar of 0.5 for offhand. then it means it does 5*0.5 damage when in offhand
Add?
How do I change the text of a tag above a player?
I've tried mounting an invisible armor stand on the player, but the name tag ends up being too low and hard to see.
I've also tried rapidly teleporting the armor stand to the player, but then the player can see their own name tag.
Anyone have any ideas?
I mean why offhand in the first place?
that's called "MULTIPLY_SCALAR_1"
ADD_SCALAR with 0.5 with "halfen" the value
halved
ItemStack sword = new ItemStack(Material.NETHERITE_SWORD);
ItemMeta swordMeta = sword.getItemMeta() == null ? Bukkit.getItemFactory().getItemMeta(Material.NETHERITE_SWORD) : sword.getItemMeta();
AttributeModifier modifier = new AttributeModifier(UUID.randomUUID(), "test", 0.5, AttributeModifier.Operation.ADD_SCALAR, EquipmentSlot.OFF_HAND);
swordMeta.addAttributeModifier(Attribute.GENERIC_ATTACK_DAMAGE, modifier);
// "sword" will now deal only 50% of damage when in offhand. Unless I'm totally stupid right now
this is at least how I understood it
let me just try it quickly
this is pretty whacky
Are you sure it wouldn't be 5 + 0.5 in that case
if it would add one, then MULTIPLY_SCALAR_1 would be pointless. but I'll just test it quickly
Is there any way to set an attribute modifier to a specific value?
How do I rename players with packets?
I'm trying to modify the damage on EntityDamageEntityEvent. My idea is to make some sort of method that calculates a modified damage, although I'm horrible at math. Anyone know how I should approach this?
My idea was:
public double getModifiedDamage(double orgValue, double percentage) {
return (double)(value*(percentage/100.0f));
}
I'm not positive this would work, thoughts? For exampe if orgValue was 30 and the percentage was 20 than it should return 80% of the original value (24).
Hm. I tried doing this, but it seems like I can't cast CustomCraftInventory to PlayerInventory, even if it looks like I should be able to.
PlayerInventory playerInventory = (PlayerInventory) Bukkit.createInventory(null, InventoryType.PLAYER);
How would I create an instance of an empty PlayerInventory?
How would it be pointless
lol yeah you are right that 0.5 with ADD_SCALAR gives +50%
but now the weird thing comes:
using MULTIPLY_SCALAR_1 with 0.5 also gives +50%
ah of course
so uh
multiply scalar doesn't do what's documented then huh
multiply after adding 1
so something like damage += damage * 0.5?
yeah, add_scalar with 0.5 doesnt do x*0.5 but it does x+x*0.5
sick
to get -50%, one can use -0.5 for ADD_SCALAR
How do I tell if an entity is a mob or monster?
check if the entity is instanceof mob or monster
I want to exclude armor stands, minecarts, etc
Is every mob in the game classified as a mob or monster?
/**
* Gets the GENERIC_ATTACK_SPEED {@Attribute} from any item - for players assuming a default {@Player} attack speed!
*
* @param itemStack ItemStack to analyze
* @return Attack speed value
*/
public static double getAttackSpeed(@Nullable ItemStack itemStack) {
double defaultAttackSpeed = 4.0;
if (itemStack != null &&
itemStack.getItemMeta() != null &&
itemStack.getItemMeta().getAttributeModifiers() != null &&
itemStack.getItemMeta().getAttributeModifiers().containsKey(Attribute.GENERIC_ATTACK_SPEED)) {
for (AttributeModifier attributeModifier : itemStack
.getItemMeta()
.getAttributeModifiers()
.get(Attribute.GENERIC_ATTACK_SPEED)) {
switch (attributeModifier.getOperation()) {
case ADD_NUMBER:
defaultAttackSpeed += attributeModifier.getAmount();
break;
case MULTIPLY_SCALAR_1:
case ADD_SCALAR:
//Yes, these two do the same thing. No, they shouldn't.
defaultAttackSpeed += defaultAttackSpeed * attributeModifier.getAmount();
break;
}
}
}
return defaultAttackSpeed;
}
so am I on the right track then
monsters are always mobs too
yes
funnily enough
Which ones
Monster extends Creature extends Mob extends LivingEntity extends Damageable extends Entity
of course. armor stands. projectiles. etc
^
ok wait
mobs are basically all "living" entities that have at least basic AI
if your armorstands aren't moving you're just not trying hard enough
okay then
pretty sure minecarts aren't mobs
yeah, if your armor stands are standing still, you just need more shrooms
because they don't have pathfinding
also falling entities
everything that has pathfinding is a mob
its jsut weird
Location location =e.getClickedBlock().getLocation(); is this correct to get the location of a block i clicked on
because EntityDeathEvent only triggers on mob kills, plus armor stands for some reason
falling is a type of pathfinding, you're just jealous of how optimized it is
because ArmorStands are living entities because they can have equipment, etc
you can also "kill" them
though tbf the same can be said of ender crystals and those are not living
because boats can't have equipment etc, mojang didnt make them extend LivingEntity
hmm
How do I change the text of a tag above a player?
I've tried mounting an invisible armor stand on the player, but the name tag ends up being too low and hard to see.
I've also tried rapidly teleporting the armor stand to the player, but then the player can see their own name tag.
Anyone have any ideas?
just hide the armor stand to that player
or just directly use packets instead of real armor stands
How do I do that?
Player#hideEntity(theirOwnArmorStand)
damn okay
Will this have any side effects?
Will it affect join/death messages
and stuff
no
what else does it do then
you'll have to use NMS to send packets, or if you wanna do it the complicated way, use ProtocolLib
Is there really no way to get a PlayerInventory without a Player? It would let me avoid some more lines of code...
I've tried to figure out the NMS for such a long time but i couldn't 😔
i'll try again
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
PlayerInventory inventory = player.getInventory();```
For some reason mojang mapped doesn't deobfuscate the packet classes
without a
Player
is just use this Bukkit.getWorlds().get(0).playEffect(event.getPlayer().getLocation(), Effect.NOTE,1);
no lol in what scenario would you need to do that even
wdym? ofc it does
De-serializing a PlayerInventory from base64, without losing the armour slots.
But thanks.
just serialize the armor contents manually yourself as array or sth
Wanted to avoid that small part
It's pain.
you aren't using mojang mappings at all, are you?
I am
NO PACKET ever is named PacketPlayOutWhatever... they called ClientboundWhateverPacket
these are the proper packet names
looks like you added both remapped and spigot mappings to your pom.xml
for some reason i could view the PacketPlayOut stuff and ClientBount stuff
I'm assuming that the last four slots on a player.getInventory().getContents() are the armour slots, right?
does this look normal?
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.18.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.18.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<classifier>remapped-mojang</classifier>
</dependency>
no, this looks shitty lol
you added both remapped and not remapped
oh wait
first one is only the api
well funnily enough...
then it's fine
i copied this from your blog lmao
you probably added spigot.jar manually in intelliJ
yeah having the api and remapped is fine
I use vscode
dont argue
i like it
no idea but obviously it has problems with using only the remapped names
either way no I haven't added any reference jars
idk then
the spigot-api will definitely not cause problems, it does not contain ANY nms stuff
hmm ok
no idea why vscode still suggests you both class names
does it have something like "invalidate caches", like intelliJ has?
How can i send a message to my server tchat when a button is pressed on my website ?
there are a million ways. direct sockets, redis, your server could listen to some weird incoming messages on some open port itself, or query the webserver every x seconds, or whatever. for real there's like 50 different methods that'd come to my mind on how to do that
just pretend that its dutch
it isnt?
hire someone to check your server every few minutes and then type the messages in chat
some chinese dude
send an email via php, then make your server check via imap every minute
honestly, just a simple http request would work. WS seems a bit overkill
a simple http server on the server on a separate thread and then just sending POST requests from the webpage would work
how do i change the name of a player using packets
ive been on this for 2 days now
I don't have much experience with how they work
LOL
u actually can use it?
thats pretty cool
well even forgegradle has a runtask for vscode
so ig its possible
Can we develop plugins for 1.7.10 in JDK 9 or is it 8 only?
. . . maybe use google this time
it will give you an very clear answer instatly
idk i use 8 when i code plugins for 1.7-1.8
you can code your plugin in whatever java version you can run your server with
i have no idea what 1.7.10 uses
8
of course, if you use at least java 9 to start your extremely outdated server
My bad, was asking for it, lol.
In the sense that I asked something stupid, that I could've googled.
And was asking for the "maybe use google this time"
as said, as long as you use java9+ to actually run the server, then you can also compile your plugins for java 9
Thanks, I understand.
I'll just... do what I need in a more roundabout way, cause Java 8 is the standard in many places.
yeah well java 9 is dead since 20818
java 8 is still the standard ? maybe in legacy enterprise code bases o.O
For many, many places, yeah.
many people still use java 8 as it has by far the longest extended support
I mean, bstats I guess is not what you are getting your data from then
bump
the last column is "Extended Support Until", the second last is "End of Free Public Updates"
December 2030? Jesus christ.
so basically java 8 is dead 😛
outside of enterprise
well 2030 for paying customers
no, it has free public updates until december 2030 for non-commercial stuff
can you make a nogravity entity have a walking animation while mounted?
i wish they'd always only support the 2 latest LTS
and that an older LTS isnt longer supported than a newer one
because that makes no sense lol
ngl, with like 19, 20, 21 they will make so many huge additions, not using them is just shooting yourself in the foot
the way the attribute modifiers work make me want to punch an ostrich
How do I change a player's nametag with nms
i did
this question is like, the second most asked NMS question out there
It's all outdated though
private static final Pattern pattern = Pattern.compile("&#[a-fA-F0-9]{6}");
public static String hexColor(String message) {
Matcher matcher = pattern.matcher(message);
while (matcher.find()) {
String color = message.substring(matcher.start(), matcher.end());
message = message.replace(color, "" + ChatColor.of(color));
matcher = pattern.matcher(message);
}
return ChatColor.translateAlternateColorCodes('&', message);
}
Error log: https://hastebin.de/wurebubina.properties
Anyone know what's going on?
also is it just me or is the spigot website down
its back up
he just wants to copy and paste
hey guys i don't find how to use CustomModelData for superiorskyblock2 i already try this
not for me
Well that is too bad for them xD
everything that ive tried to do with spigot has been helped with by the internet when ive found it difficult
Is spigotmc down?
the core concpets always work
that's not a development question. you should ask that on that plugin's discord
Nope
c'est tellement dur de dire comment je peux l'utiliser sérieusement
il se casse pas le cul ici
english pls
go ask on the plugin's discord 😉
how do I send a packet to a player
gooooogleeee
get the player's connection (the field is called "connection"), then use the send(Packet<?>) method
like, I googled your "how to change player name over head" question for a single minute
and I already ran into the right solution
mostly because it has been the same 4 packets to send
for like, the past 5, 6 years maybe
this?
indeed
so learn
Then maybe learn about NMS and packets first
from where though
I've never used NMS in 4 years of Spigot dev, while I probably could have to save time it's not necessary for 99% of stuff imo
Well for this it is rather required
im trying to rename players
Oh, yea you need NMS 😂
i've also done pathfinding with nms before which is also required
or like, look for a library that does it for you
not sure why these arent part of the spigot api though
That's usually what I do, there are literally libs for everything
well, there is a server software out there that has all of that as API 😛
go to wiki.vg/Protocol everything is documented there
okay
you don;t even need that
it is the low level structure of packets
yeah i noticed
you ran buildtools remapped, you have all the source
^
wiki.vg is shitty if you just wanna send packets with NMS. it's showing like "how are the packets actually looking in data" but not like "how to simply construct and send them"
the way i learn is just decompiling spigot and looking through Mojang code
yes, that is basically how you do it
literally open teh relevant class and see what it takes
hold on why do I have 1.18 and 1.19 lmfao
I don't have the string "1.19" in my pom.xml
maybe just ?paste your complete pom
How do I change "+1 Armor" to something like +3, or just outright copy the stats of a netherite helmet?
I can feel myself balding over just calculating dps for minecraft items
probably one of your other dependencies has 1.19 as dependency and they fucked up their pom (broken transient dependencies, or however it's called)
anyone know what version it changed from being Bungeecord to bungeecord:main in the messaging channel
damn
I'm pretty sure it's lib's disguises
is there something I can do about it or no
just "mvn package" your thing. then look for something like this in your maven log (one sec, gotta compile sth myself to show you)
you can exclude a dependency
beyond that mvn dependency:tree
i acutally dont have that
please run the command i pointed out
yes lib disguises indeed does something dumb
google how to exclude transitive dependencies in maven
basically you need to add this to your libsdisguises dependency
<exclusions>
<exclusion>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
</exclusion>
oh okay
Ive been trying for a few mins to fix my messaging channel , im using bungeecord and ive tried both bungeecord:main and Bungeecord channels, i have players connected to both servers im trying to use and they are connected via bungeecord. any idea whats going wrong?
i followed the spigot guide
yup that worked
thanks
i wonder why libsdisguises isn't using remapped 🥲
lib-disguises is it public api?
yes
btw I wonder how they even made spigot 1.19 show up for people who just use their API
Ok lol
my dependency tree for jefflib is huge, but when including that in another project it doesn't show ANY transitive dependencies (as it should be)
what does one have to do to "break it"?
Oh gradle 🤢
what is a transitive dependency
bump
gradle?
also hey Alex!
hi
Dependencies that are include from another dependency
oh ok
Hahaha hi Pray
it's basically "dependencies of your dependencies"
Let say for example spigot transitive depends are Guava, Netty, etc
They are a lot hahaha
They use one of those fun and definitely very legal repos
i find it dumb that it imports it into my own project too though
ooh yikes
it is the lazy mans approach
I haven't checked yet but do bows use the generic attack speed attribute at all? Is that wired to be the drawing time or not at all?
does "PacketPlayOutPlayerInfo with action REMOVE_PLAYER" effectively mean
((CraftPlayer) player).getHandle().connection.send(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.REMOVE_PLAYER));
missing what
hilarious
well
guess damage makes sense anyway since arrow damage is a function of velocity
the one you want to rename
I'm assuming
ServerPlayer serverPlayer = ((CraftPlayer) player).getHandle();
serverPlayer.connection.send(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.REMOVE_PLAYER, serverPlayer));
then
well
not really
you have player A. The one you want to rename. And then you have every other player
the packet would take player A but would be sent to every other player
that would basically tell yourself that you left the server
the next step is "PacketPlayOutPlayerInfo with action ADD_PLAYER with a different name (perhaps through reflecting on the packet data)" though
havent done that yet
ah I see
so I need to send the packet to everyone except the player being renamed?
IIRC you just gotta do new ServerPlayer, then pass a custom GameProfile to that
I used set cancell to cancel a damage event but I want to show hit effect how do I do that
I think only way are packets
Which packet
Player playerToChangeName = (Player) sender;
ServerPlayer nmsPlayerToRemove = ((CraftPlayer) playerToChangeName).getHandle();
GameProfile newGameProfile = new GameProfile(playerToChangeName.getUniqueId(), "NewName");
ServerPlayer nmsPlayerToAdd = new ServerPlayer(nmsPlayerToRemove.server, (ServerLevel) nmsPlayerToRemove.level, newGameProfile);
for(Player otherPlayer : Bukkit.getOnlinePlayers()) {
ServerPlayer otherNMSPlayer = ((CraftPlayer) otherPlayer).getHandle();
otherNMSPlayer.connection.send(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.REMOVE_PLAYER, nmsPlayerToRemove));
otherNMSPlayer.connection.send(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, nmsPlayerToAdd));
}
This will basically tell all players "mfnalex has left", then tell them "NewName has joined"
might wanna adjust that a bit ofc. e.g. you don't need to send it to yourself, I guess
Does that make bungee server think that a player has been conencted?
of course not
it simply sends a packet to all online players
I suppouse haha just but want to check it
I wont stop thinking ideas for tricking bungeecord PMC
It must should be a way for tricking it
how could i teleport a specific player to cords?
by using Entity#teleport https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/Entity.html#teleport(org.bukkit.entity.Entity)
declaration: package: org.bukkit.entity, interface: Entity
For example?
for example
myPlayer.teleport(someLocation);
like this? player.teleport(1, 2, 3);
no. If you'd check the javadocs, you'd see that the teleport(...) method requires either a Location, or an entity as first parameter
or if you'd just use your IDE's auto completion
like Player#teleport(Location)
every IDE shows you the proper method signatures
I think it's pretty self explanatory
Agree with you mfalex
How can i keep the content of a sign if i use player#openSign(sign)
it does that automatically
this is what you mean right?
or do you want to prevent players from changing the opened sign?
public static void openNewSign(Player player) {
player.getWorld().getBlockAt(player.getLocation()).setType(Material.OAK_SIGN);
Sign sign = (Sign) player.getWorld().getBlockAt(player.getLocation()).getState();
sign.setLine(0, "Test1");
sign.setLine(1, "Test2");
sign.setLine(2, "Test3");
sign.setLine(3, " ");
sign.update();
player.openSign(sign);
}```
i got this but i want the text I put in the sign to be in the opened Sign,
idk how to explain
it just opens an empty sign
need help with pom, some EssentialsXDiscord dependencies arent working
https://paste.md-5.net/daratokewo.log
https://paste.md-5.net/zamudukagu.xml
ok so wdym
is that basically this approach?
im guessing im missing a line, just took stuff from essentialsx wiki
faq
whatever
ran clean package, didnt work
says the poms are missing, anyone know a way to make it work?
How can I make players not release specific enchanted items when they die
EntityDeathEvent (unless theres a PlayerDeathEvent cant remember)#getDrops and then loop through items, check if it has specific enchantment, and remove it from the list
anyways still waiting on a reply
the pl is 1.19
Hey, I need to stop a crafting if there is a certain item in it how would I do that?
it looks like its missing a repository for JDA and bstats but I might be wrong
what does that have to do with anything
mh
idk probably, but those are dependencies of EssentialsXDiscord, should download them from its pom, right?
yeah it probably should but it says that those 2 are missing
idk i never used EssentialsXDiscord
ig i can try adding them directly and seeing what happens
uhh what are the repos
weird, only see dependency imports on google but not repo
downloads anyways lol
ig it doesnt need repo
just dependency
worked
i have no idea why i just needed dependency
maybe its part of spigot-repo or smth
it looks like jda is from jcenter.bintray.com
hey guys I just saw someone writing if (sender instanceof Player player) and then use player is it something a Java version greater than 8 is allowing ?
saw it here https://www.spigotmc.org/threads/how-to-seperate-textcomponent-by-commas.567478/#post-4457515
Yes that's legal code
always used Java 8
Updating to the newest version is nice, lots of useful features like the instanceof one
Unsupported on newest MC anyways
My server is 1.12
So I can't use java 17 and spigot 1.12 together ?
Hi! How can I code potion stacker command?
no
stacking the potions isn't enough. you also have to listen to the consume event to make it not "glitch out". You can look at my StackResize plugin https://github.com/JEFF-Media-GbR/StackResize
thanks
well I know that 1.12.2 requires requires java 8 to java 10 to compile. not sure if you can run it with higher versions anyway, though
but probably not
I thought that with command example /stackpotions
don't ask me, there's a weird version check
well simply collect all potions from the inventory, add them one by one to a temp inventory. loop over the potions in the temp inventory, and if any of those "isSimilar", then +1 the stacksize. if not, use a new slot. then add those items back to the original inv
Thank you!
idk i just spinned up a 1.12 server with java 17
hm then it only requires these specific versions for compiling
yeah then you can of course also compile your plugin for 1.17
I thought that if buildtools requires java 8 - java 10, then the actual spigot.jar would require one of those versions too
weird
doesnt look like it
unless im using some weird version
?paste
for now eclipse doesn't allow me to write that recent java stuff and I don't think that's related to spigot yet
I changed the JRE home to /usr/lib/jvm/java-18-jdk
previously it was /usr/lib/jvm/java-8-openjdk
eclipse just says "delete token player" in if (sender instanceof Player player)
you also need to change the language level in the project settings
right click project in package explorer -> properties -> java compiler -> set it to 17
set this to 17
if you're using maven, you probably also wanna change your pom.xml, or build.gradle if using gradle
the maximum is 13 with my "Compiler compliance level"
and also in my Execution Environments the maximum is JavaSE-13
what does Help -> About Eclipse say?
Also did you install jdk 18 right?
as version
Oh eclipse 🤢
Not bullying you
I just remember how much work i used to have using that shity IDE
I cloned aur.archlinux.org/jdk.git
yes eclipse takes so much effort to just use it
then makepkg
U are on linux i suppouse
If you run: java -v
Does tell you running jdk-18?
or java -version
Really you installed eclipse? Hahaha
oh it still says 1.8
Okay good point
i also have netbeans and vscode installed
I accept that IDE's but eclipse...
Also how you mate? I forget to ask you!
One question, why dont u neither use Intellij community nor Netbeans?
then update or just directly switch to intelliJ
but intellij isn't free
ServerPlayer has a 3 arg constructor MinecraftServer minecraftserver, ServerLevel worldserver, GameProfile gameprofile, where do I get minecraftserver and worldserver from
from your existing NMS player object
okay I'll try intellij thanks
oh k
There are 3 versions from intellij, Community (free one), Ultimate (paid one)
@ornate patio
there is no student edition I think
being a student gives you the ultimate version
mfalex do u still selling your studen emails?
I think someone from this server offered me students email to get intellij ultimate
then why is this guy saying the last two steps
isn't there an EDU eddition or smth
Yes there 3 versions im really sure
they dont look necessary
yea iirc there is a custom build for jetbrains academy
👍
and this won't affect anything server-side correct?
player.getName() will still return the player username?
i never sold them lmao
No problem mate have a good day
i can create unlimited @wwu.de and @still fulcrum-muenster.de email addresses, but I never said that I sell them haha
i dont think that would be legal 😄
I know idk
But you know that "Whoever is afraid to die should not be born"
Not asking you for one, just mention it
@tender shard ?
okAy
You could easily test it
yeah of course
I have a map with a list in the config but it is returning null?
It looks like it is saving to the config properly
Send code and yaml file please
Use this url for sending the code and yaml
ok hold on one second
My dad just stole the computer right when I was about to send it
It’ll only be like 2 min
Allr have a good night
alrighty
1 sec
and the map is a map of the class so it is being saved to the config
I mean you are using the map for serialization
yeah
Allright can you send the full class?
ofc
I think its easy to help
the exception comes in a different place because when deserialize occurs all values in the list are null
so I use a function from the ItemClass on it and it gives nullpointerexception
"Cannot invoke <random function from the class> because the return value of "java.util.List.get(int)" is null"
the server completely fell apart lmao
accounts just get randomly kicked when other ones join
sure, sure
yeah but why are all the values from the list getting turned to null in the deserialize function
I'm currently running bungeecord on my network with luckperms bungee on my proxy and luckperms on my spigot/paper servers however the bungee commands for neither the default group or admin group are displaying that they don't have permission to execute. The permissions are set to the default group with the correct server permissions, so I'm really baffled as to what is preventing them from working. Any help would be appreciated.
Please use #help-server for server or plugins questions non related to programming
development of server?
Development of plugins
Here is more development in way of programming
ah this is java and c++ use
Yes mostly programming
👍
No problems mate have a good day
@stiff dock Just copy-paste the issue there and i try to help
What its better for registering a class and for calling some methods?
I know this is a hard to answer question but does anyone have any idea of how item plugins usually mess with damage reduction derived from protection in terms of customizing it? The math behind damage reduction is so insane I have a hard time believing there's plugins out there seriously messing with the toughness and protection attributes
anyone have any idea what the constructor argument for ClientboundRemoveEntitiesPacket is?
Have you checked in the jds?
nvm it turns out i dont even need to pass in a param
Because that why they are for sorry if sound rude
Yeah
it's an NMS class
Oh NMs doesnt have javadocs right?
yeah
As far as i know NMS is from minecraft and is obfuscated not from spigot right?
spigot is built on nms
and nms is a completely mess, you mainly have to reverse engineer everything
Yes because NMS is maninecraft server native code right?
yes
its fine
Also i think i know you from somewhere else
hm?
where
anyways
// player is the joining player
// name is the name i want to rename the player to
ServerPlayer nmsPlayer = ((CraftPlayer) player).getHandle();
ServerPlayer newNmsPlayer = new ServerPlayer(nmsPlayer.server, (ServerLevel) nmsPlayer.level, new GameProfile(player.getUniqueId(), name));
nmsPlayer.connection.send(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.REMOVE_PLAYER, nmsPlayer));
nmsPlayer.connection.send(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, newNmsPlayer));
// the code below doesn't even run yet because a single user gets kicked immediately from the lines above
for (Player otherPlayer : Bukkit.getOnlinePlayers()) {
if (otherPlayer.getUniqueId().equals(player.getUniqueId())) {
continue;
}
ServerPlayer otherNMSPlayer = ((CraftPlayer) otherPlayer).getHandle();
otherNMSPlayer.connection.send(new ClientboundRemoveEntitiesPacket());
otherNMSPlayer.connection.send(new ClientboundAddPlayerPacket(newNmsPlayer));
}
Does my code not reflect what this guy said to do?
The function is called when a player joins, but I get immediately disconnected:
Same issue happens with this code
(ping me if respond ty)
So let's say I'm making a plugin that uses mojang mappings... Am I allowed to put the source of that plugin on github?
That code kinda works
but yoru client will be kicked if you attempt to chat with the wrong profile
"Chat message validation failure"
Well it does work once portaled away and back
how do i get all entities in a specified radius of another entity
Entity#getNearbyEntities()
did not know that existed
i mean i cant even log in
You can also search on google that what you mention
You can;t send it in the login event as you are not fully logged in yet. The client is not ready to accept those packets at that stage
Oh so that is his issue
I think
@ornate patio try sending the packet on PlayerJoinEvent but with a delay of 30 seconds
Or something like that
should i schedule a task to send it 1 tick after playerjoinevent?
more than 1 tick
Client has to finish joining and notify the server it has
I've got it all working, including chatting, except for it updatign without having to portal away and back
You can change the skin using the GameProfile object if im not wrong
Yeah, I've got skin changing a while back
Wait how does player skin works?
Now i want to read how they works
In they way of rendering because i know that they have to be signed or something like that+
I have find that
OH ok
I have read and skin must be signed by mojang
In other words a user must have to upload it
And they yes you can get the signature and set it to players
yes i just realized
Okay try it
I never used it
I think it should works
Is there a way that I can detect if a player is being rode
rode?
like if someone is sitting on their head
Oh that have specific name
Check their passengers.
This is not so easy as sending a respawn packet to the client with a replaced GameProfile causes it to goto the world spawn as if it was killed.
Answering to?
Sorry still talking about changing player name
Oh ok
Thinking out loud
Maybe tell him to open a thread
thank you 😄
Have a good day/night
World#notifyAndUpdatePhysics``` anyone know how work flag in this method? 😅
Have you read the javadocs?
Bump
Because the javadocs are useful for reading about class methods its params, its param types, etc
NMS method 😅
Oh now makes sense
Nevermind I literally just found a thread reasoning that it's a development purpose 🤦♂️
I wont never mix with NMS because if that type of things are not consider by the api its becaue they are dangerous or can cause other issues
is there an event for when that happens
no
but what if some computers are slower than others than
You can;t do it at login/join
Isn't that the whole point of the PlayerJoinEvent? Is that it fires after they are done logging in?
Kinda, but teh client is not out of the login protocol phase yet
it fires before the client loads their world which is kinda meh
I'd rather wait for the first PlayerMoveEvent they fire
what if someone damages them and they knocked back while logging in
huh
you mean check if their head rotates?
ye
okay
Is it possible to fully modify the tablist like MCC?
well if mcc did it
thats what i meant
ah
I mean without like crazy modification
Well yes, you would require a resource pack for it to look that good without lines and such
of the server jar
Yeah Yeah
You shouldent have to modify the jar at all
oh really?
Should just be creating fake player objects that register in the tab list
basically everything is a fake player on that, so its just applying headers & footers to set the size of it, and just adding fake accounts *or similar to it, with custom names, some being blank resulting in that
Personally I know just a bit of the backend, but not enough to fully make it
I would recommend finding some plugins that do it, and looking at their source
you're nesting some if statements which could be removed
yay got name changing workign
Am I doing anything wrong or is my server too small? I have a smaller which 3 gb of ram.
It's using a custom plugin, in which it creates 6 worlds in onEnable.
new WorldCreator("community").createWorld();
new WorldCreator("community_nether").environment(Environment.NETHER).createWorld();
new WorldCreator("community_end").environment(Environment.THE_END).createWorld();
new WorldCreator("immersive").createWorld();
new WorldCreator("immersive_nether").environment(Environment.NETHER).createWorld();
new WorldCreator("immersive_end").environment(Environment.THE_END).createWorld();
The server's tps immediately tanks after start up, before anyone has even joined. The 'immersive' worlds are very small worlds. What am I doing wrong?
what version
You could try changing your plugin's yml startup flag to run ON_LOAD instead of STARTUP.
also, run a timings report and send it
1.19.1
What's that do??
I really want to but it seems to run out of memory almost immediately after it starts lol
then add more memory
But I don't see why I'd have to when it runs out before anyone is even on the server??
If the issue persists I could keep shovelling money into more memory but that doesn't fix my issue
Sorry, I was using the wrong variables. What you would want is the load variable and the variable to be STARTUP. It basically makes your plugin execute it's onEnable method before the worlds load.
more memory isnt always the best solution
i can remove the action one and just put an && in the first one right?
nah it is
Does that make a difference if I have
new WorldCreator("community").createWorld();
new WorldCreator("community_nether").environment(Environment.NETHER).createWorld();
new WorldCreator("community_end").environment(Environment.THE_END).createWorld();
new WorldCreator("immersive").createWorld();
new WorldCreator("immersive_nether").environment(Environment.NETHER).createWorld();
new WorldCreator("immersive_end").environment(Environment.THE_END).createWorld();
``` in my `onEnable`?
Then yes i am
Though the worlds have obvs already been generated
spigot or paper?
?whereami
allegedly they load async so i dont know why it would tank so much
oke
I have no clue either, especially because I have another server with the exact same plan
with more worlds
i want to tilt a 3x3 area with a hoe what is the best way to select the location of the 3x3 area?
and that rocks a steady 20 tps
as soon I as I comment out the world load on this one though, tps goes back to 20 so it must be that part
Anyway, I'll hop on over to the paper folks and ask those guys
BoundingBox
declaration: package: org.bukkit.util, class: BoundingBox
DOUBLE B
@ornate patio Was it you trying to do an animated skin the other day?
I remember workign with someone
no
i'm just trying to rename players
ok
I have renaming working if you want it.
However I don;t have renaming and changing skins working at teh same time yet
either/or
ok i see, is looping through the bounding box an okay way to tilt the blocks?
oh yeah mb
that'd be helpful 🙂
I'm just seeing if I can get it to preserve the skin changes with the name
yeah i understand
Almost there. It is keeping the skin now, just losing the second layer
thx its working now and its way easier than just manually adding the locations
?paste
@ornate patio https://paste.md-5.net/umelesubaj.java
it changes the name above their head and in tab
tysm 🙏
it does not change their name in chat
alright
@eternal oxide ran into an error
the method is called on move not player join
I'm on 1.18.2 btw if that makes any difference
well
stick it in a command
the change i made is this
to test
ServerPlayer nmsPlayerToAdd = new ServerPlayer(nmsPlayerToRemove.server, nmsLevel, newGameProfile);
just to be certain you are eliminating all possible causes
okay
yeah still errors
[18:11:48] [Server thread/INFO]: no_hom0 issued server command: /test
[18:11:48] [Netty Server IO #1/ERROR]: Error receiving packet 54
java.lang.NullPointerException: null
[18:11:48] [Server thread/INFO]: no_hom0 lost connection: Internal Exception: io.netty.handler.codec.EncoderException: java.lang.NullPointerException
[18:11:48] [Server thread/INFO]: no_hom0 left the game
no clue, you'll have to check each of the packets to see which is causing it
alright
doing that
oh my god wait
i think i figured it out
I was using Player#setPlayerListName right after
i guess that screws it up
although i would like to have a seperate player list name though
is that possible or no?
player list? you mean tab?
yeah
the connection.send(playerInfoAdd); sets both the name above their head and the name in tab
yeah but using Player#setPlayerListName after that causes a kick
is it possible to seperate the name above head and the name in tab?
um, you can remove them from Tab, not sure you can have both different without handling all teh tab list
well I mean spigot has a built in api method to do that
was that error in the server console or teh client?
You could try getting a fresh Player instance before setting the tab
this one was in server console
Well good luck. I've got to turn in for the night.
Is there an event that allows me to see if a player starts to mine a block, or do I have to work with packets.
