#help-development
1 messages · Page 1827 of 1
Np
I can't send screenshot of the error can i show you mp ?
Im writing a minecraft parkour plugin. With the help of a command I can set the checkpoints location earlier. But when i'm checking if the player is at the location i need to have the variable from the commands class to the eventhandler. How do I do that?
Im going to sleep mb
Ok good night
Thx
What variable
A location varible
How are you storing checkpoint locations
Jesus
Why would you call getRelative(BlockFace.SELF)
And why are you getting all those values from the location just to construct an identical one
Just get their location
And those variables will be deleted as soon as the command is finished being run
?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.
I think you need to learn Java basics before attempting to write something like this
okey
Don’t be mean guys
Is it possible to create an event that is triggered when there is an entity inside the BoundingBox?
me too lmao
how would I go about making a player swim faster, other than obviously checking for the player swimming
I assume you'd do something with collisions. There may or may not be an event for that but I don't think it would be that hard to create
ik that itll have to do with setVelocity but not sure how to apply it
Wdym?
yeah that didnt make sense, did it lol
ive tried getting the player's velocity and setting a new velocity to that, but obviously that will cause issues, and i tried getDirection but it was way too fast
i hope that explains it better
Hmm? What exactly do you mean when you say setting the velocity will cause issues?
so i did something like player.setVelocity(player.getVelocity().multiply(1.5)), but that results in a recursive increase in speed, which launches me across the world lol
Ohh, haha
Guessing bc the event calls each time the player is detected for being in the water so it repeatedly calls your method.
Why not just give them dolphin's grace
heelllll no
Or depth strider boots
.-.
it does this weird slippery sht
...sure with vanilla
Mmm, I suppose you could keep using your swim event but use a var to see if you've run it and set a cool-down if so
i was thinking of using an armorstand and teleporting the player to it instead but that would be janky
idk how well this would work
You could just cap the velocity
thats a fair point
That would work too
Though they would still get propelled endlessly once they started moving
yuea
the issue is that i want the player to have their velocity set in the direction they are swiming
Okay
What about speed effects? Do those work in the water?
Need help deciding. I have an extension classes for Spigot's file API which contain functional equivalent of the getters (return an Optional). What do you think the methods should be called like?
public double getDouble(String route); // Main method
public Optional<Double> ?(String route) // Functional equivalent
The name could be getOptDouble, getOptionalDouble, getDoubleOpt, getDoubleOptional... or something else. Could you help me decide what's the best? Thx :))
🤔
Isn't there an OptionalDouble class
Assuming there are about 25 of those methods even for custom types, that isn't an option :((
can someone pls link me something on updating plugins to 1.18
Why
Yes, but there are also custom getters, where class like this doesn't exist. Therefore, I just sticked with Optional.
Plugins should work on 1.18 without any changes unless they're doing something funky
Ok well getDoubleOpt is what I would do
Thx ❤️
i swapped out the spigot jar and all of the imports broke
any other opinons?
i probably did something wrong dw
I recommend using Maven instead of directly importing jars
ok thank u i will look into that
Directly importing the 1.18 jar won't work very well
it will “work”™️
Gradle
Not really the 1.18 is a bootstrap jar
true dat
i haven’t had time to look inside it tho
so i’m not familiar with the format
It's 4 classes and a bunch of jars
anyone tell me wtf im doing wrong here, trying to grab the spigot.yml but comes back empty https://paste.gg/p/anonymous/77b63947af9d45d391941ea0368825af
it packages actual jars? thought normally they just included teh classes
seems weird
thanks man i appreciate you taking the time
Yeah
It's jars this time
You're welcome!
Check that the absolute path is pointing where you expect
it is, or should be since the spigot yml is in the same folder as the server.jar
never mind Bukkit.spigot.getconf, it didnt really pop up in any of my google searches
Do you think that if I name a class Path in a widely used API, it would be a problem to differentiate it from already built-in Java class Path (NIO package)? Path will be used for the same purpose as string paths in Spigot configuration API. Should I use other name, so it isn't confusing - e.g. Route?
i would name it ConfigurationPath or whatever
isn't it too long? ConfigPath is too I would say
too long for what?
I mean, assuming the class would be used often by devs, wouldn't it make the code much longer than needed?
nah it shouldnt be a problem with me, who do every code on one line
That's why I thought about Route at first
public void setMessage(String message) { this.getConnection.getPlayer.getStates.changeMessage(message); his.getConnection.getPlayer.getStates.updateMessages(); }
too long would be something like SpigotFileConfigurationConfigurationSectionPath since you could split it down and it would have the same meaning
Passing my main class to a class with an eventhandler... can I just have a constructor in that class with the eventhandler?
Basically I have a class with an eventhandler and I want to access my config from it
ignore the image I sent it was not meant for this chat.
if a create a variable in the constructor to use as paramater in lambda, when is it gc'ed?
understand, though configurationpath might not be the most descriptive. What do you think, would clashing with Path from Java be a problem?
for those who want to give their own opinion
Route is not that descriptive when representing path isn't it
Depends, I mean it sounds pretty high level
Well, Spigot uses string keys. Per YAML spec, any object is allowed as key, which I would like to make accessible for devs. So I need a class that will carry an array containing the individual keys (instances of Object). That's what I need it for :)) Does "Route" sound good for this job now?
bcs I really like it but I don't know if it's good and need other opinions yk :))
Yeah I know yaml specs is kinda baboony
yeah... but on the other hand Spigot API supports strings only to allow "unification" with JSON through configuration interfaces and stuff
so I think it would be great to make an extension for that
Yeah, but I mean spigot and any other stuff really has to narrow down the amount of yaml specs you’d support
Because yaml specs is just too diverse
Couldn't agree more. I will use YAML 1.2 which allows safe JSON parsing... decided it's the best
Yeah, the worst part is probably the whole anything can be a key and comments are not node attached
Agree. I'm only going to support it bcs not a lot of work is needed and might help someone who needs it... Regarding the comments, thats what my lib is going to solve (not only that); comments will be supported everywhere.
and actually are, just finishing documentation :))
Thank you ❤️
With the presumption that it’s put into the according package
Sure, ask away
?paste
would you be interested in being part of the project in form of reviewing the beta documentation when it's ready?
Yeah, why not (:
Sent you a friend request :))
🙌
yaml has comments
YAML has comments, but mostly no one implements them
Comments don't get saved in the yaml spec
that's why I made my own lib, which will support them everywhere :)) available soon
Not true
Newer versions of snake yaml support it
However the specs say that the comments are not bound to any particular node as they’re mainly there to explain/clarify the structure (or other things)
so im tryna build (with buildtools) a 1.18 jar, how do i select my java 17 JDK cuz it defaults to using java 8
windows 10
"(java17 installation folder)\java.exe" -jar BuildTools.jar --rev 1.18
thanks
What's the best way to check if blocks are naturally generated when a player breaks them?
Is there an easy way to do it or would I actually have to store player-placed blocks or something like that? (I want to track ores specifically)
Yes you would have to store them
Is there an existing plugin you know of that makes this easier for me? 😅
Not that I know of
Would you happen to know how much strain it would put on a server to do this? I'd assume I would have to use BlockPlaceEvent, then check if it's an oreblock, and if that condition is met add the block to a map/collection?
Error: [14:06:52 ERROR]: [MythicMobs] [SCHEDULER] Exception thrown whilst executing task [14:06:52 WARN]: java.lang.IllegalStateException: Asynchronous getNearbyEntities! [14:06:52 WARN]: at org.spigotmc.AsyncCatcher.catchOp(AsyncCatcher.java:16) [14:06:52 WARN]: at org.bukkit.craftbukkit.v1_17_R1.entity.CraftEntity.getNearbyEntities(CraftEntity.java:600) [14:06:52 WARN]: at AureliumMythicMobs-1.0.jar//me.often.aureliummobs.mythicmobs.SetNameMechanicExtension.castAtEntity(SetNameMechanicExtension.java:45) [14:06:52 WARN]: at MythicMobs-4.13.1.jar//io.lumine.xikage.mythicmobs.skills.SkillMechanic.lambda$executeTargetedEntitySkill$5(SkillMechanic.java:453) [14:06:52 WARN]: at java.base/java.lang.Iterable.forEach(Iterable.java:75) [14:06:52 WARN]: at MythicMobs-4.13.1.jar//io.lumine.xikage.mythicmobs.skills.SkillMechanic.executeTargetedEntitySkill(SkillMechanic.java:449) [14:06:52 WARN]: at MythicMobs-4.13.1.jar//io.lumine.xikage.mythicmobs.skills.SkillMechanic.lambda$executeSkills$1(SkillMechanic.java:406) [14:06:52 WARN]: at MythicMobs-4.13.1.jar//io.lumine.xikage.mythicmobs.skills.SkillMechanic.runMechanic(SkillMechanic.java:444) [14:06:52 WARN]: at MythicMobs-4.13.1.jar//io.lumine.xikage.mythicmobs.skills.SkillMechanic.executeSkills(SkillMechanic.java:406) [14:06:52 WARN]: at MythicMobs-4.13.1.jar//io.lumine.xikage.mythicmobs.skills.SkillMechanic.execute(SkillMechanic.java:324) [14:06:52 WARN]: at MythicMobs-4.13.1.jar//io.lumine.xikage.mythicmobs.mobs.MythicMob.lambda$executeSkills$2(MythicMob.java:1066) [14:06:52 WARN]: at MythicMobs-4.13.1.jar//io.lumine.xikage.mythicmobs.utils.Delegates$RunnableToSupplier.get(Delegates.java:121) [14:06:52 WARN]: at MythicMobs-4.13.1.jar//io.lumine.xikage.mythicmobs.utils.promise.LuminePromise$SupplyRunnable.run(LuminePromise.java:654)
List<Entity> players = monster.getNearbyEntities(radius, radius, radius).stream().filter(entity -> entity instanceof Player).toList();
How do I fix this?
Use sync not async
I can't. It is not my code, which uses the Async task
bug the mythic mobs developer
No. I coded it myself
Bruh? LMAO
This is just my code
Ahahha
Call it sync
Then how do I do it?
So:
^
No async
Asynchronous getNearbyEntities!!!
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.
This is my code
But the method I call there from MythicMobs is async
odd that Mythicmobs runs it async
How do I avoid that?
you can't without a lot of work
Yeah!
BukkitScheduler::runTask
you could make it run sync next tick
Exactly
Best of luck
Ok. It fixed the error. Thanks.
Hey, I just followed a tutorial, and I'm a little confused. Where do I access all the items from in the API?
if(player.getInventory().getItemInOffHand().isSimilar()){
I have this thing, and I just dont know where to pull the items for the isSimilar() for
I tried Material, but pretty sure that's blocks..
Material works for items as well
declaration: package: org.bukkit, enum: Material
sorry, and thank you
👍 np
wait how do i get the itemstack out of the material?
that method compares two item stacks
if you just want to check if an item is a specific material (ie shield) you can do item.getType() == Material.SHIELD
👍
So far, this API seems to be very clean though, I love it!
https://www.spigotmc.org/threads/shield-delay-effectiveness.214370/
Damn, I'm trying to remove the shield delay following one of the replies on this thread, but has player.setBlocking been removed sometime since 1.9?
setCooldown? You mean delay after Axe hit?
No, I mean the 5 tick delay after right clicking with a shield out before it actually blocks
i always thought it was instant
:^)
I started really feeling it on hard difficulty against skeletons
the added server delay just made it 2x worse
You'd probably have to look at the packets
What's that?
Basically you'd want to use ProtocolLib and listen to the packets being sent from the client
no guarantee that would work
Christ
yeah
maybe i could make the player manually deflect arrows for 5 ticks after they start blocking?
How to remove snowball that snowman shoot?
I just found ProjectileLaunchEvent to Trigger this working, but I have no idea what should i do next :(
declaration: package: org.bukkit.event.entity, class: ProjectileLaunchEvent
look at the javadocs for that event and see if there's a way to fetch the entity
Entities have a remove method
if i use getEntity Method, What should i get for return?
I have no idea it is Snowman or Snowball
well the event is called ProjectileLaunchEvent
hmm
getEntity returns the projectile
if you wanted to get the thrower / shooter you'd have to cast it to a projectile
Forgive my poor english :d
javadoc always makes me confusing like this
Or just delete them ig
Thanks for your answer :D
Could I try to find player's EntityDamageEvents and then interrupt them for a few ticks?
Okay that's fair
you don't want to create a new itemstack just to check materials
not even close
🤦
?learnjava just in case, ya know, it still impress me everyday even tho i read it for like more than 10 times lol
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.
nohow
i mean
you could query the mojang API whenever a player joins
as long as you cache the results and don't have that many players joining could work in theory
Fr tho
every time on join you'd have to check if it was cached
invalidating/updating a cache would be trivial
but yes, you would still have to query the API if you didn't have it cached
ok god damn it's working
i cant believe i managed it first try
just gotta make the shield take damage now
you can do item.getType() == Material.VILLAGER_SPAWN_EGG
the code you have wouldn't work, as a Material cannot Equal an ItemStack
Is there some sort of event that i could call for an item taking durability damage? i dont want to have to calculate Unbreaking enchantments in my own code...
damn
looks like unbreaking is a simple 1 / (level + 1) check
I don't think Spigot has the functionality you're looking for, it wouldn't be that difficult to implement it yourself
How do I check if any painting is attached to any side of a block? I'm currently using getNearbyEntities but the problem is that you can't know how the painting is positioned (depending on the size of the painting) to see if a particular block is one of the blocks that's holding the painting.
My final goal was to just prevent a painting from falling without block support, but I don't think that's possible so I'm looking for a way to not remove blocks that are supporting a hanging entity.
I think blockphysicsevent might be what updates paintings
If not, you can get the direction that a painting is facing with https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/material/Directional.html#getFacing()
declaration: package: org.bukkit.material, interface: Directional
A Painting implements Directional so you can get the Facing(), then check if there's a block at the OPPOSITE of that facing IIRC
and Painting has a getArt (Art) which supports getWidth/Height
I have a small utility class to get the opposite of a blockface, I don't remember if you actually need it here though: https://github.com/JEFF-Media-GbR/JeffLib/blob/master/core/src/main/java/de/jeff_media/jefflib/BlockFaceUtils.java
e.g. IIRC, if the painting has a direction of WEST, you'll have to check the block at EAST
Imagine this as the wall (0 = block, x = painting, L = entity position)
00000
0xxx0
0xxL0
00000
Now
00000
0xxx0
0Lxx0
00000
How am I supposed to tell if getWidth is the first case or the second case?
trial and error
most likely the painting is at a consistent place
whether that be lowest x / z
Is it tho? If not that doesn't make sense
Yes. I wasted my time. lol
somehow I didn't find it back when I needed it
or something was wrong with that method. I think it only worked for the default blockfaces, but not for SOUTH_SOUTH_EAST or something? i dont remember
Hey guys, a bit of a followup to my question from yesterday. So I have created a custom item, defined a recipe for it, set its meta to be "unique" and put an enchant on it with the "hide enchantments" tag, to make it appear unique. I have also put a value of custom model data on it, so when a player is using the resource pack I have made, they see a custom texture for the item. However, I was wondering if there was a way to have the item appear enchanted if they do NOT have the resource pack, but to make it appear unenchanted if they DO have the resource pack. If they have a custom skin for the item, the enchantment effect seems somewhat redundant (and makes the art harder to see). Thanks in advance for any help =]
Hi. Has anyone created a plugin with ORM handling the database (preferably Hibernate)?
you could customize the enchantment glint in the resource pack to be transparent
I figured that was the case =] I will prob just have it always appear enchanted then
but then no items would appear enchanted
That was my intuition, thanks a bunch =]
@keen lake Samples on the example page. This one is for mysql but same idea.
https://www.spigotmc.org/wiki/plugin-snippets/
https://www.spigotmc.org/wiki/connecting-to-databases-mysql/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
oops tagged wrong guy sorry
Sounds like overkill
Ok one other question 😉
So I want to have some configuration options in my config. Two of which are the name of the item, and the message shown when somebody isnt allowed to use it (not permission based, separate logic). In the message, I want people to be able to make references to the name of the item, so they could do something like "You cannot use {itemName} yet.. Is there a convention for string replacements in spigot plugins? What "indicators" are usually used to say this is a string replacement? Somebody might want to put { or } in their message. Hmmmm.
I assume my mod page would list out available "replacement strings" -n = item name, d = item description
Ohhh yeah thats not a bad idea
I personally use native string formatting %s
I think that is what I shall do, thanks a lot 😄
my java is a bit rusty haha
So in that case, you use native string formatting, how do you tell it what to replace WITH? what does %s equal? Are you doing this in the context of config files or just in the code
I suspect in my case I will need to define pre-existing possible values, like %n would string replace the name in?
but yeah it depends on order
It will specifically be looking for like ItemName in my yaml
String#format is not idea lfor configurations
something that is nice however is adventure + minimessage
in minimessage you have templates, which you can replace during the parsing
<red><item_name></red> e.g.
Ohhhh interesting, looking at their documentation now
yup I was prob overthinking it, this suits my needs just fine 😉
gameModeChangeMessage: 'Sets game mode to %s'
String message = getConfig().getString("gameModeChangeMessage");
String messageFormatted = message.contains("%s") ? String.format(message, gameMode)
(example from stack overflow, not my situation)
What's a good NPC lib without need for installing in plugins folder?
Can someone explain why it cant find .setDamage? from what i've seen this is the general way to do it
setDamage takes a parameter right?
does someone know whether in spigot.yml, the "world-settings.<worldname>" settings are case sensitive for the world name?
what does your IDE say when you hover over the red?
it cant find it at all
one way to find out 👀
where's ind argument
int*
setDamage(int damage)
declaration: package: org.bukkit.inventory.meta, interface: Damageable
why cast
can you put and send screenshot again?
what spigot version you're using?
Probably the wrong Damageable import
Nope, double checked
what damageable import are you importing?
bukkit
org.bukkit.inventory.meta
org.bukkit.inventory.meta.Damageable
someone has an idea for a better version of this? I need to get the "world-settings.<worldname>.hopper-amount" for all worlds, but since I need to do it in every InventoryMoveItemEvent, maybe there's a better / faster version?
private final HashMap<String,Integer> maxHopperMoveAmounts = new HashMap<>();
private final int maxHopperMoveAmountDefault;
{
maxHopperMoveAmountDefault = Bukkit.spigot().getConfig().getInt("world-settings.default.hopper-amount",1);
if(Bukkit.spigot().getConfig().isConfigurationSection("world-settings")) {
for (String worldname : Bukkit.spigot().getConfig().getConfigurationSection("world-settings").getKeys(false)) {
maxHopperMoveAmounts.put(worldname, Bukkit.spigot().getConfig().getInt("world-settings." + worldname + ".hopper-amount", maxHopperMoveAmountDefault));
}
}
}
// This gets called once in EVERY InventoryMoveItemEvent
private int getHopperMoveAmount(String worldName) {
return maxHopperMoveAmounts.getOrDefault(worldName,maxHopperMoveAmountDefault);
}
this one's on me, sorry for the fuss xdd
that's really shit, couldn't bukkit developers add some prefix like MetaDamagable or ItemDamageable?
there is, its in the import package
you're free to contribute that
massive thanks though
but it's confusing, you can easily misimport it or if you use both you will end up with long, less-readable statement like "((org.bukkit.inventory.meta.Damageable) damageable).setDamage(10)" instead of "((MetaDamageable) damageable).setDamage(10)"
true
yeah or you just check what you're importing. After all you could easily import the wrong Listener class, etc, but we don't call it "BukkitListener" because of that too
this is one of those problems that occur once, and then you will always remember it and it'll never happen again lol
and we still have "BukkitRunnable" instead of "Runnable"
It’s weird they didn’t name it to smtng like Durable instead of Damageable
That’s just due to the name of Runnable
i know, that what i said, they named it so to not confuse with other things
yeah that would make more sense IMHO
Hey, how do I send packet in 1.18 java.lang.NoSuchMethodError: 'void net.minecraft.server.network.PlayerConnection.sendPacket(net.minecraft.network.protocol.Packet)', Thanks
I get this error
For what do you need send packets?
For something not include in the API
The handle in craftplayer has a method for sendpackey or send not sure the name
Then only need create the class for the packet... Works same since... Not sure
org.bukkit.block.Dispenser & org.bukkit.block.data.type.Dispenser
would like to know your location
I have ((org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer)player).getHandle().b.sendPacket(packet));
it works with packets
and you know that because it works?
so are you trying to copy a plugin?
that is indeed how you send packets
but use remapped nms
the pain of looking everything up is not worth it
The spigot jar
I will see and will tell you what i found++
ty
does it have to be shaded?
pretty sure citizens is your best bet but iirc thats just a plugin api
technically
yes shade the whole plugin
shade, relocate and just invoke its onEnable and onDisable
...
won't that be heavy?
heavy as?
I mean your jar will certainly become fat
yeah, i know that option, i was asking about already implemented variants
simple npcs + no need to depend + 1.14.4+
developing a fully pvp-based server, it won't have high specs so should i use 1.8.8 jar or just latest
I mean I always encourage newer versions
but since certain people tend to play 1.8 still, Ig?
altho you'll have to live with outdated api, possible memory leaks and vulnerabilities
is there a way to get all available EntityTypes that can get from the creative tab?
Ok.... one more question about custom items lol. To check if a given item is mine in the right click event, I am comparing the metas. However, now if I change the meta like the name of the item or something in an update and restart the server, my event.getItem().getItemMeta().equals(item.getItemMeta()) will no longer match and the old item wont be treated the same anymore. Is there a way to just set like a custom tag on an item, so that I can keep that the same between version changes and do checks on that instead of the whole meta object?
?pdc
Get all materials that contain monster egg then strip the names?
oh yes the material
awesome, this is exactly what I needed =]
How can I get all entities in a chunk when loading it? I tried to use
public void load(ChunkLoadEvent e) {
Bukkit.getLogger().info("Chunk loaded");
for(Entity entity : e.getChunk().getEntities()) {
Bukkit.getLogger().info("Entity Found");
}
}```
what it says
wait a tick
Sorry for cross-post, but i wonder, it is okay to abuse sql transaction like that?
PreparedBatch batch = handle.prepareBatch("INSERT OR IGNORE INTO members (clan_tag, uuid, role) VALUES (<tag>, <uuid>, <role>)");
for(ClanMember member : clan.getMembers()) {
batch.bind("tag", clan.getTag())
.bind("uuid", member.getUniqueId())
.bind("role", member.getRole().getName())
.add();
}
updates = Arrays.stream(batch.execute()).sum();
if(updates != clan.getMembers().size()) { // some members weren't added; those are already in another clans;
handle.rollback();
}
and check
If I remember correctly there is an entities loaded event now
declaration: package: org.bukkit.event.world, class: EntitiesLoadEvent
if i call entity.damage(damage, player), the EntityDamageByEntityEvent wil lbe called?
Probably
yes
im trying to kill an entity with entity.damage(entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue(), player);
this is in the PlayerInteractAtEntityEvent and im needing to interact with the entity 2 time to it kill the entity
If you want to kill it eithet set hp to 0 directly or do a larger amount of damage
Float.MAX_VALUE 🤡
and what if i set it to -1?
will this unalive him?
How could i intercept a chat message? in bungeecoord
Question to memory consumers and savers
Are instances prefered?
What
static vs getInstance
getInstance basically always is a static method
Just pass you plugin in constructor like any other depenency 😗
Ig
hey guys, is there a way to make getConfig() serialize to a java object for simple access instead of having to do getObject(String id) each time? I think i'm close with extending from Config class perhaps?
do you want to get a custom object from your config, or want to serialize the whole config itself? o0
ConfigurationSerializable perhaps
I would like to serialize the entire config file into a java object
Bukkit config api starts sucking at this point
But it already is a java object: FileCOnfiguration
Or if this is stupid, how do you guys approach this?
what are you actually trying to do?
I want to just have a simple object I can reference its members instead of querying the config for a value each time in my event handler
cache it once when the server loads up
I use object relational mapping 😛
the config already is nothing else on the inside than a Map<String,Object> IIRC
or just object mapping 😛
wait
a minute
as variant, you can manually parse your config, or, use a library like Configurate or DazzleConf
yeah I think you are right its just a map anyway, so it shouldn't be any less efficient
Which does Object mapping for you based on annotations
I was thinking it was reading from the file each time
public class Config extends YamlConfiguration {
//load your config somewhere
public Map<String, Object> getMap() {
return map;
}
}```
No for sure
gg
lol
ohhh interesting
no ^^ in that case, you would never need the Plugin#reloadConfig or YamlConfiguration#load methods
ok so i create a class that extends this, but how do i reference it on the main plugin class? (sorry the ping)
what r u actually trying to do
huh? No, you just create a class that implements Listener
sth like this
package de.jeff_media.bungeecore.bungee.listeners;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.event.ChatEvent;
import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.event.EventHandler;
public class ChatListener implements Listener {
@EventHandler
public void onChat(ChatEvent event) {
if(event.getMessage().contains("bad word")) {
event.setCancelled(true);
event.getSender().disconnect(TextComponent.fromLegacyText("Stop saying bad words lmao"));
}
}
}
and in your main class' onEnable, register the listener, like
@Override
public void onEnable() {
getProxy().getPluginManager().registerListener(this, new ChatListener());
}
basically it works exactly the same as in bukkit
So I am back and found that you send packet like that in 1.18 : ((org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer)player).getHandle().b.a(Packet packet); in need
only if you don't use Mojang Mappings, which you definitely should
idk how
in mojang mappings you have proper names
package de.jeff_media.jefflib.internal.nms.v1_18_R1;
import lombok.experimental.UtilityClass;
import net.minecraft.network.Connection;
import net.minecraft.network.protocol.Packet;
import org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
@UtilityClass
public class NMSPacketUtils {
private static Connection getPlayerConnection(final Player player) {
return ((CraftPlayer)player).getHandle().connection.connection;
}
public static void sendPacket(final Player player, final Object packet) {
if(!(packet instanceof Packet<?>)) {
throw new IllegalArgumentException(packet + " is not instanceof " + Packet.class.getName());
}
getPlayerConnection(player).send((Packet<?>) packet);
}
}
how do i measure the impact of my plugin on server's performance?
so why did mojang release mappings and not just not obfuscate them
interesting
so that we can stop using stinky smelly mcp mappings
and whatever the fukc fabrics mappings are
yarn names are so strange
I’ve heard the opposite
when ur switching from mcp to fabric its a real smack in the face @young knoll
u go to type Minecraft.getMinecraft() and its actually like MinecraftClient.getInstance()
i had plans to do an mcp thing that used mojangs mappings but ended up forgetting
Does forge support mojang mappings
Yes
thanks! 🙂
That’s all they use now
Great
Hello there, can anybody help me with NMS on 1.17(+)?
I already installed BuildTools but the dependency does not work (it does not add the NMS-classes).
(I added both the 'SHADED' and non-shaded)
read the spigot post linked in #announcements
Well, I cannot send any screenshots...
You need to be verified
Whats the flag to get remapped jar from buildtools
--remapped
I have read the thing, worked on it the past hour. I added the thing as dependency inside the pom.xml and tried without. It just doesn't work for me 😭
@rapid sable you need mapped jars i think
I need to add a mapped jar to the server or add it as dependency?
if you're using maven
So... Where do I add it inside the pom.xml?
I tried to put it outside of the '<project>...</project>', create other brackets to put it in.
hi can someone help me i did compile a plugin and i want it to work on 1.18 but its so many things that are wrong pls help me if you can tag me
?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!
post code
here's an example pom: https://github.com/JEFF-Media-GbR/JeffLib/blob/master/spigot_1_18_R1/pom.xml
It is possible to support 1.17 nms code and 1.18 nms code? How could I support 1.17 and 1.18 if they are both same named packages and names?
yes, use maven modules. check out my lib (although the 1.17 version istn't using remapped mappings): https://github.com/JEFF-Media-GbR/JeffLib
Make multiple modules
how much of it is supposed to be remapped?
well, everything from NMS basically. maven can do it automatically for you
So I have to do this twice: once for 1.18 and once for 1.18.1 when I want to use both versions?
1.18 and 1.18.1 have the same mappings, at least for 99.9% of the code
both are 1_18_R1, one module is enough
also I doubt anyone uses 1.18 instead of 1.18.1
I'd say more
Am i supposed to be able to see these remappings when i decompile the jar from builtools that i used --remapped on
ok... i have to move to maven now
1.18.1 has no server code changes
you dont HAVE to but you'll be very thankful for doing it now
yes
you will see fields being called "connection" instead of "b" etc
Once you have remapping setup it's literally a godsend
exactly
i still see a ton of obfuscated classes and methods
Hi
You didn't do it right then probably
I don't think I see any obfuscated names like "b" or "a" anymore
for example?
@DontObfuscate
public static void main(OptionSet optionset) {
SharedConstants.a();
try {
DataPackResources datapackresources;
CrashReport.h();
if (optionset.has("jfrProfile"))
JvmProfiler.e.a(Environment.b);
DispenserRegistry.a();
DispenserRegistry.c();
SystemUtils.m();```
wtf is that
NMS.Main
net.minecraft.server.Main
yes
didnt work for me
i got a lot of stuff that said profile 'remapped' couldnt be found
i noticed
So... It does not work for some reason..
"Cannot resolve org.spigotmc: spigot:1.18-R0.1-SNAPSHOT
if you copy pasted that from my blog post, you obviously want to replace all "1.18" with "1.18.1" if you compiled 1.18.1
I copied it from the github ;?
please just follow my blog post @rapid sable and @olive lance https://blog.jeff-media.com/nms-use-mojang-mappings-for-your-spigot-plugins/
Oh well.. It was referring to a different part...
and don't forget to use "1.18.1" instead of "1.18" everywhere
Yeah i read that all the way through. Do i need to specify a version maybe?
How do I go about getting a list of a list of strings from the FileConfiguration? This is the closest I can get, forcing a cast to avoid List<capture of ?> returned from getList(), but it seems to always be null.
public List<List<String>> recipeKeys;
recipeKeys = (List<List<String>>) config.getList("recipe.key", recipeKeys);
I already use 1.18.1 everywhere 🙂
It was referring to a failed attempt of mine that I did not delete yet.
My only difference between what you did was i just used latest version
you are indeed using maven and your IDE also uses maven to get the dependencies, right?
getStringList?
Oh
But I am still not allowed to use the NMS.
did you let your IDE reload your pom.xml changes?
I havent got there yet
List<List<String>> list = (List<List<String>>) config.get("recipe.key");
should work
I thought i could just decompile what buildtools gave?
of course you can but you'll have to decompile the remapped jar then
Reloading maven right now.
Ohhhh thanks mfnalex lemme give that a shot
And so the remapped jar does not come from buildtools is what youre saying?
check your maven folder, e.g. C:\Users\mfnal.m2\repository\org\spigotmc\spigot\1.18.1-R0.1-SNAPSHOT
there should be a jar called spigot-1.18.1-R0.1-SNAPSHOT-remapped-mojang
Now it does work. Thank you!
So I have to run the remapped on the server too, right?
nooo
Ok so
any ideas?
I cannot just decompile what buildtools gives to view
on your server you run the normal .jar. the "special-sauce" inside your pom.xml translates the mapped mappings you are using back to the obfuscated ones
that seems to have done it, thanks a bunch @tender shard
Ok i see now thank you
Then I have some bad news... My burger ain't working!
java.lang.ClassNotFoundException: net.minecraft.server.v1_18_R1.
yeah, it's now just net.minecraft.server
of course almost all classes have different names now
because you are now using the original names mojang used in 1.17+ and not the old ones
If I am correct, I am checking for both 'net.minecraft.server' and 'org.bukkit.craftbukkit'
e.g. what used to be EntityPlayer inside net.minecraft.server.v1_16_R3.entity is now net.minecraft.server.level.ServerPlayer
so im using player.discoverRecipe(recipe) to add the recipe to the recipe book of the player, but when i open the recipe book with the items for the recipe, it shows that i dont have enough items
the middle item is another one than what you have
benchmarks?
you have some gray jar but the item from your recipe is red colored
what is wrong with this line of code (its not my plugin)
just make some timing reports or manually measure the execution time of certain parts
what's the error message
what class is CONTAINER?
that class simpy doesn't have any method called getOptional
breh
So then how do I summon an EntityPlayer?
I can get the MinecraftServer but not the WorldServer...
You have to forget about the old names
here's how I'm creating NMS entities (armorstands and area effect clouds) and show them to players in 1.18 remapped: https://github.com/JEFF-Media-GbR/JeffLib/blob/master/spigot_1_18_R1/src/main/java/de/jeff_media/jefflib/internal/nms/v1_18_R1/NMSHandler.java
as sad, EntityPlayer does not exist. It was the name spigot used, in mojang mappings that never existed. And WorldServer also does not exist, it's called ServerLevel
no my friend
ah its just the overlay?
yes
what's your spigot version?
I remember a bug that was fixed in 2019 regarding exact choice + recipe book
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/3697519ba51140de215c65de680de25fde06a2fe Found this but that's been fixed
Why not pdc
I just checked, and custom PDC tags in the recipe book work fine for me
hello can someone say me how to display the real life time in the chat, but before a message, and it should update after every minute
because i have that the time will displayed but it will not updated
with packages?
once the message was sent, it's sent
you can't tell the client to update a message after that
i know but when a new message will be send that the new real life time will be displayed
because actually only when i make a server reload the time will be updatet
I also wonder how that would be useful - what's the purpose in prefixing a message with the current time instead of the time when the message was sent
right
to see the real life time
just use a title, bossbar or action bar
or resend the message every minute
as said you cannot update already sent messages
i dont want to update sent messages
i will display the time on a message when the player has send the message
Hmm, idk, but maybe score components can update in the Chat?
then just use the AsyncPlayerChatEvent, use setFormat and add the current time
the time will be displayed, but after to or three minuets the same time is displayed after a server reload the newst time is displayed again
then your code doesn't generate a new string for every message
they just want something like
[0.01 am] player1: hi
[0.02 am] player2: hi too!
right
so just create a new string in every message instead of generating that strng once
show your current code pls
Date now = new Date(System.currentTimeMillis());
SimpleDateFormat format = new SimpleDateFormat("HH:mm");
Bukkit.broadcastMessage("§7[" + format.format(now) + "]§f " + player.getName() + "§7 > §f" + msg);
cheap example:
in AsyncPlayerChatEvent, use SetFormat(System.currentTimeMillis() + " %s: %s")
it will show the current milliseconds + playername + message
where do you execute that from? that should work normally
update: when using material choice it works
any reason why you're using NBT instead of PDC`?
wlib
wlib?
wlib!
public void onChat(AsyncPlayerChatEvent event) {
Player player = event.getPlayer();
String msg = event.getMessage();
event.setCancelled(true);
if (commands.livers.contains(player.getName())) {
event.setCancelled(true);
Bukkit.broadcastMessage("§f[§9LIVE§f] " + player.getName() + "§8 > §7" + msg);
} else if (commands.aufnehmer.contains(player.getName())) {
event.setCancelled(true);
Bukkit.broadcastMessage("§f[§cREC§f] " + player.getName() + "§8 > §7" + msg);
} else if (commands.redstoner.contains(player.getName())) {
event.setCancelled(true);
Bukkit.broadcastMessage("§f[§4REDSTONE§f] " + player.getName() + "§8 > §7" + msg);
} else if (commands.afks.contains(player.getName())) {
event.setCancelled(true);
Bukkit.broadcastMessage("§f[§7AFK§f] " + player.getName() + "§8 > §7" + msg);
} else if (commands.miners.contains(player.getName())) {
event.setCancelled(true);
Bukkit.broadcastMessage("§f[§bMINING§f] " + player.getName() + "§8 > §7" + msg);
} else if (commands.rper.contains(player.getName())) {
event.setCancelled(true);
Bukkit.broadcastMessage("§f[§dRP§f] " + player.getName() + "§8 > §7" + msg);
} else {
event.setCancelled(true);
Bukkit.broadcastMessage("§7[" + format.format(now) + "]§f " + player.getName() + "§7 > §f" + msg);
}
}
}
again: wlib?
NBT isn't part of the API so I wouldn't expect it to work with the Recipe API. PDC however will work fine
again: wlib!
i guess another noname common lib
you can say wlib as often as you want, noone knows what you're trying to say
as you can see, you never set "now" in that method
so it will never update
better make an implementation that uses pdc if possible
i am new to java so where i have to add the now?
it is working
add Date now = new Date(System.currentTimeMillis()); inside your event
so why are you asking why it doesnt work?
np^^
Um new Date() will return the current date
you have to learn basic java, your problem was as I said - you never updated your "now" variable
you probably set it once when creating the class instance instead of everytime someone chatted
Btw use new time api
i'm tryna use this code to create a circle
public static Vector getSphericalVector(double radius, double yaw, double pitch){
double yawCos = Math.cos(Math.toRadians(yaw));
double yawSin = Math.sin(Math.toRadians(yaw));
double pitchCos = Math.cos(Math.toRadians(pitch));
double pitchSin = Math.sin(Math.toRadians(pitch));
double x = yawCos * pitchCos * radius;
double y = pitchSin * radius;
double z = yawSin * pitchCos * radius;
return new Vector(x, y, z);
}
but i'm not sure why it has these strange gaps
for(int i = 0; i < 360; i++){
Vector vec = VectorUtils.getSphericalVector(4, i, 0);
new ParticleBuilder(ParticleEffect.REDSTONE)
.setLocation(player.getLocation().add(vec))
.setParticleData(new RegularColor(Color.RED))
.setSpeed(0)
.setAmount(1)
.display();
}
the ParticleBuilder is part of the api i use to play particles
So assuming I change some values in the config for my plugin which changes the meta for my custom item, I need to iterate through all players on startup and make sure any items tagged with the persistent data for my item who had an old version are updated. Is the most efficient way to do this to iterate through JavaPlugin.getServer().getOnlinePlayers() and .getOfflinePlayers() doing a check on their inventory? Would it be more efficient to do it on a player connect do you think, instead of all players once on startup? The first would only need to happen once, when the server starts to check the config. so that seems better to me.
you cannot get offline players inv
remember players could also store them in chests
Oh shit ur right..... Can you iterate through all containers? That seems silly....
well you COULD, in onChunkLoad and then getting the tileentities
is there any reason you have to update PDC data?
there's probably some cleaner way
cuz like I want part of the config of the plugin to be able to name the item
and part of the item creation is reading that config value and storing it in the meta
I'd probably just tell server admins that the new name will only apply to new items 😄
otherwise you will have a looot of work for a pretty minor feature imho
well
That is probably true, but it is slightly annoying haha
you could check inventory open event and onconnect
and, if you really care that much, also entitypickupitemevent
Hmmm thats not a bad idea
yeah for entities sitting on the ground leftover in a chunk
performance impact should be next to nothing
Thats whats up 😄 I think I'll do exactly that
will give me some more experience too
yeah that one will probably rarely happen
only if t hey like dropped it while flying over a chunk and came back
basically only if a player drops an item, then server restarts with new config, and then player picks it up again
ohh yeah or that
How can I bump guava version of paper 1.8.8 ?
compile paper yourself
this isn't paper
or shade the required lib version into your plugin
aaaand this^
Spigot if you want but it's the same problem x)
as said, either compile it manually, adjusting the pom or just shade what you need yourself
I got this exception when using the last version of guice :
java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V
Are Exit Conditions a good practice in plugin development ?
Yes but i've already dit it
wdym?
@ivory sleet
how can I make the value on, off when executing a command? Persistent Data Container
?
what?
you also need to relocate it if you use class names already laoded by spigot itself
you want to toggle a PDC value?
are you using boolean or byte as datatype in the PDC?
I don't understand x)
yes
String
I mean, the guava version I want to target is already shaded in my plugin, but it seems like the server is still using the wrong version
just set the new value to ```java
oldValue.equals("on") ? "off" : "on"
but you should rather use BYTE or BOOLEAN as datatype instead when it's just a true/false thing
okay, give example please
pdc.set(yourKey, PersistentDataType.STRING, pdc.get(yourKey, PersistentDataType.STRING).equals("on") ? "off" : "on");
or use my lib and directly switch to DataType.BOOLEAN instead of using strings for this: https://github.com/JEFF-Media-GbR/MorePersistentDataTypes/
thank you, i will try
google "maven shade relocate dependency"
I'm using gradle
well then replace maven with gradle and google it anyway 😄
"gradle shadow relocate depenency"
basically just
shadowJar {
relocate 'junit.framework', 'your.package.junit.framework'
}
``` (from what I found on google)
Ok thanks you, what should I write for the destination ?
<your.package.name>.whateveryoulike
e.g. my plugins have the packagename de.jeff_media.pluginname so I shade libs to de.jeff_media.pluginname.libs
I wrote :
relocate("com.google.guava", "me.choukas.dodgecreeper.libs.com.google.guava")
But it doesn't work x)
plugins {
id("dodgecreeper.java-conventions")
id("fr.il_totore.manadrop") version "0.4.1-SNAPSHOT"
id("com.github.johnrengelman.shadow") version "7.1.0"
}
repositories {
// Repos
}
dependencies {
// API
implementation(project(":api"))
// SmartInvs
implementation(group = "fr.minuskube.inv", name = "smart-invs", version = "1.2.7")
// BungeeChannelAPI
implementation(group = "io.github.leonardosnt", name = "bungeechannelapi", version = "1.0.0-SNAPSHOT")
// Guice
implementation(group = "com.google.inject", name = "guice", version = "5.0.1")
implementation(group = "com.google.inject.extensions", name = "guice-throwingproviders", version = "5.0.1")
//implementation("com.google.inject.extensions:guice-multibindings:3.0")
// TODO DEBUG
/*implementation("com.google.guava:guava:31.0.1-jre")
implementation("org.apache.httpcomponents:httpcore:4.4.15")*/
// Adventure API
implementation(group = "net.kyori", name = "adventure-platform-bukkit", version = "4.0.1")
// Jupiter
testImplementation(group = "org.junit.jupiter", name = "junit-jupiter-api", version = "5.8.2")
testImplementation(group = "org.junit.jupiter", name = "junit-jupiter-engine", version = "5.8.2")
// MockBukkit
testImplementation(group = "com.github.seeseemelk", name = "MockBukkit", version = "v1.8-spigot-SNAPSHOT")
}
spigot {
desc {
named(project.properties["plugin-name"].toString())
authors("Choukas")
main("me.choukas.dodgecreeper.core.DodgeCreeperPlugin")
}
}
tasks.processResources {
finalizedBy("spigotPlugin")
}
tasks.shadowJar {
relocate("com.google.guava", "me.choukas.dodgecreeper.libs.com.google.guava")
archiveFileName.set("${project.properties["plugin-name"].toString()}.jar")
destinationDirectory.set(file(System.getenv("SERVER_PLUGINS_FOLDER")))
}
tasks.test {
useJUnitPlatform()
}
you dont declare guava as dependency
there's nothing to relocate
you commented guava out
Oh
although I have no idea about gradle. I don't know if "implementation" is enough to actually "shade" it at all
in maven you'd declare that dependency to be "<scope>compile</scope>"
then it would be added to your .jar and you can relocate it
bumpp
Nop, but the shadow plugin do
no idea, someone with gradle knowledge will have to help you then, I only know maven^^
Doesn't work either
?pdc
which is the relative to NBTTagList in the pdc?
PersistentDataType.TAG_CONTAINER
thanks
it's basically a PDC inside a PDC
did you check out my lib for additional data types? might save you some time when you have objects to save that are NOT just byte arrays or strings or integer arrays
wdym
it adds a ton of new datatypes
e.g. so you can easily save ItemStacks inside a PDC and other stuff
there's a table on that github page in the readme
can someone explain to me which blocks do not have bouding box?
I'd say mine is easier and more powerful 😛 and it existed first 😄
I think all where you can walk through
Imagine if paper or spigot just decided to add all of those 🤡
that would be nice
hmm
well you have docs at least
i have efficient collection data type implementation
no, you, kinda, have readme
hi, manya
privet
what can be an uncollidable block?
flowers
nihuya ne ponyal
mne nuzhno komandy dlya on, off
Can your library do
PersistentDataType<?, ImmutableList<ItemStack>> ITEM_LIST = DataTypes.collection(ImmutableList.toImmutableList(), DataTypes.ITEM_STACK);? 😼
no, I never needed that^^
PersistentDataContainer container = p.getPersistentDataContainer();
NamespacedKey key = new NamespacedKey(Main.getInstance(), "test-plugin");
and how could i store a map and a list using the pdc?
if (cmd.getName().equalsIgnoreCase("cmd")) {
would i need to create new data types?
yes
*i dont want libs, im making*
ok
well, if your map has strings as keys, you can just save it as TAG_CONTAINER
p.sendMessage("On"); and p.sendMessage("Off");
seriously?
@quaint mantle whom are you replying to all the time?
so i would need only for the list
manya
how?
but the message you are answering to has nothing to do with your messages
how to do it? the command that will switch
switch what?
.
you keep replying to the same message
I've never seen this before
?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.
I googled yesterday, I didn't find it today either
so you want a method that returns "on" when you pass "off" to it, and vice versa, right?
if so, I already gave you that
public String getOpposite(String input) {
return input.equals("on") ? "off" : "on";
}
if I entered the /test command, set the value to true. If I entered the /test command again, set the value to false
and what exactly is the problem where you're stuck with?
how can I name a key?
and remove
NamespacedKeys have a constructor: NamespacedKey(Plugin, String) where String is the name of your key
how replace?
how replace what
alright I don't care if this is spoonfeeding. So you have an ItemStack, right? And you want it to save "on" or "off" inside. And switch it when entering /test right?
yes
@tender shard so i would need to create a custom data type only for the List, right?
it depends on what your map contains
list
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
NamespacedKey key = new NamespacedKey(this, "nameOfTheKey");
Player player = (Player) sender;
ItemStack item = player.getInventory().getItemInMainHand();
ItemMeta meta = item.getItemMeta();
String oldValue = meta.getPersistentDataContainer().getOrDefault(key, PersistentDataType.STRING,"off");
String newValue = oldValue.equals("on") ? "off" : "on";
meta.getPersistentDataContainer().set(key, PersistentDataType.STRING, newValue);
item.setItemMeta(meta);
return true;
}
obviously this isn't perfect ^
Hey there, is there any way to get all spigot api mappings with documentations?
thank you
it's all undocumented tbh
or wait
are you talking about Spigot API, or NMS?
because Spigot API doesn't have any "mappings", and NMS is not documented because it's not part of the API
spigot api, the one we use for writing plugins
I meant Spigot API itself, not the mappings for mojang
javadocs for spigot?
javadocs yea
?jd
yea I do have the website, I just wanted to use it for my bot, so I can search it easily
BuildTools can generate the docs for you too so you have them locally
if that's what you're looking for, idk
do you know which folder is javadocs for spigot api?
Spigot-API I guess?
buildtools\Spigot\Spigot-API\target\apidocs
as said you need to run buildtools with --generate-docs
gotcha, thanks!
np
you can also download them off nexus
running buildtools is cooler though
paperclip is cooler
I just wanted index of all methods/Enums/etc with docs, which for anyone who may also want, it's here
https://hub.spigotmc.org/javadocs/bukkit/index-all.html
I find a "bug" in fromLegacyText method. All formats return " " (perhaps intended behaviour????).
TextComponent#fromLegacyText?
yes
What
It still add the colours on the text, but if you look inside the return BaseComponent [TextComponent{text=test, BaseComponent(color=, font=null, bold=null, italic=null, underlined=null, strikethrough=null, obfuscated=null, insertion=null, extra=null, clickEvent=null, hoverEvent=null)}, TextComponent{text= text, BaseComponent(color=, font=null, bold=null, italic=null, underlined=null, strikethrough=null, obfuscated=null, insertion=null, extra=null, clickEvent=null, hoverEvent=null)}] color= is blank.
Is really odd behaviour.
is it okay to change the price of a premium resource?
sure, why not?
but it has to be under 20€/USD or sth IIRC
yea maybe it goes back into an approval stage
no
yes certainly
you can change it anytime
I'm planning on lowering the price
i dont understand the issue
TextComponent#fromLegacyText
format = ChatColor.getByChar(c);```
format always return blank = no value.
even if return value have color (but is empty).
why is InventoryDragEvent so weird
whenever i drag one item
and the event is cancelled it returns the cursor as null
but whenever i drag 2+ items in the event, while it is cancelled it returns the uncalculated cursor value (2+ cursor items, instead of amount it should've calculated)
you have both new and old cursor
ik
in that event
lemme explain it:
event.getCursor()
event.setCancelled(true)
1 item dragged - event.getCursor() == null
3 items dragged - event.getCursor() == {ItemStack x 3}
event.getOldCursor()
i don't need it
the event is cancelled
why it returns calculated value
whenver dragged item is 1
that makes no sense, it should return {ItemStack x 1} instead
since the event is cancelled
but somehow it returns the calculated value if dragged item amount is 1
is this a bug
this weird calculation handling seems like a bug for me
if the event is cancelled it should always return the oldcursor
instead i get some sort of mix
how can i make it so when i do /start a timer counts up from 0 above your hotbar
how do you add it above the hotbar
np
declaration: package: org.bukkit.entity, interface: Player, class: Spigot
When I make a command with custom tab completion, do I make two classes for the command and the tab completion? Or do I replace the normal one with the tab one?
somePlayerObject.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("your message"));
for the stopwatch, i do this:
runTaskTimer(this, new Runnable(){}, ??)
wat should the last parameter be
your commadnexecutor can just also implement TabCompleter
or yeah just create a new class, however you like
the delay
👍 also would you recommend using a command handler? Or is the basic bukkit API one fine
If so, what one?
