#help-development
1 messages · Page 577 of 1
okay good.. cuz I wanna workload distro these copy pastes..
Show code, you probably have some wild ray size
It's server -> client
Location eye = player.getEyeLocation().add(player.getLocation().getDirection());
Predicate<Entity> filter = entity -> !entity.getUniqueId().equals(player.getUniqueId());
RayTraceResult result = player.getWorld().rayTrace(player.getEyeLocation(), eye.getDirection(), range, FluidCollisionMode.NEVER, false, 0, filter);
So this packet then
I can call Material.getCreativeCategory(), but for some reason some items have multiple creative categories
how can I get all of them?
this is wrongplayer.getEyeLocation().add(player.getLocation().getDirection());
you are offsetting your ray by the direction your body is facing
For this you're setting:
- The vehicle id (Entity#getEntityId)
- The arraylist of passenger ids (single element array of a player's entity id, for example)
Entity vehicle = ...;
Collection<Entity> passengers = ...;
int vehicleId = vehicle.getEntityId();
int[] passengerIds = passengers.toArray(new int[0]{}); // or just loop through the collection and populate the array
PacketContainer packet = new PacketContainer(MOUNT);
packet.getIntegers().write(0, vehicleId);
packet.getIntegerArrays().write(0, passengerIds);
// send the packet
Gotta dip now
Thanks for the help, trying this now, have a good workout!

What should I change then?
Your filter accounts for the origin player so just remove that add
Okay... soooo
after imports:
You can assign that session in the try-with-resources
no need for it elsewhere
Paper has Ghast#setExplosionPower, otherwise you gotta do some tricky event stuff
but the clipboard is outside of scope..
I still can't find the answer
You can create the clipboard outside
Then yeah listen to events
or use nms
The explosion power is usually tied to the fireball
well
The fireball's explosion power is set by the ghast
You can change ExplosionPrimeEvent's radius to something like a 10
by just checking if the projectile's shooter is your ghast
HI,
How can i make my imports works ? I try to import WorldEdit : import com.sk89q.worldedit
that's not a valid class name
did you even add worldedit to your classpath? are you using maven?
I add worldedit plugin jar file in my classpath project and yes i'm using maven
so you added worldedit as <dependency> to your pom.xml?
the proper import for worldedit's "main" is com.sk89q.worldedit.WorldEdit
I think I did something wrong because the error is displayed on the sk89q word
no
no
why don't you just check the javadocs
there is however Explosive#setYield which changes the explosion radius
https://paste.md-5.net/ajofuhoqok.rb and I dont know were is pom.xml
you are obviously using gradle and not maven
and you commented out the worldedit dependency
I removed the add but the issue still persists. This is what my code looks like
https://paste.md-5.net/pipodipazu.cs
yes because if I uncomment it I get this error on build : ```Execution failed for task ':compileJava'.
Could not resolve all files for configuration ':compileClasspath'.
Could not find com.sk89q.worldedit:worldedit-bukkit:.
Required by:
project :```
you didn't specify a version for worldedit
how can I know the version ?
@tender shard you are just my god ty, that was just that, I've don't specified the version, I've used my actual worldedit version and it work than you so much
np!
HI, It's me again if someone know how worldedit library work, can he/she explain me why this code run without error but don't paste block : ```World monde = Bukkit.getWorld("Hub");
File file = new File("plugins/WorldEdit/schematics/test.schem");
if(!file.exists()){
System.out.println("FICHIER ABSCENT");
return false;
}
Clipboard clipboard;
ClipboardFormat cbf = ClipboardFormats.findByFile(file);
try{
ClipboardReader cpr = cbf.getReader(new FileInputStream(file));
clipboard = cpr.read();
EditSession editSession = WorldEdit.getInstance().newEditSession(new BukkitWorld(monde));
Operation operation = new ClipboardHolder(clipboard)
.createPaste(editSession)
.to(BlockVector3.at(0, 0, 0))
// configure here
.build();
Operations.complete(operation);
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
} catch (IOException e) {
throw new RuntimeException(e);
} catch (WorldEditException e) {
throw new RuntimeException(e);
}```
am i using mongodb's updateMany correctly?
do you really wanna paste it at 0,0,0?
yse I use a void world
btw where does this new BukkitWorld(...) come from?
You are usually supposed to use the bukkit adapter
it's just a snippet on a thread
what is that ?
World worldEditWorld = BukkitAdapter.adapt(myBukkitWorld);
(although tbh that usually does the same, so that's not the issue)
can you paste that schematic manually using worldedit?
yes I used //schem load and then //paste
pls show the whole method
- //schem load test
It say "test loaded, paste with //paste - //paste
and the schem appear in my world
Anyone?
Hey does anyone have any idea why I'm getting maven compilation failures?
I've tried setting the project Java version to 17 but it hasn't solved it
Remove the --enable-preview flag
where's that?
There is almost never a reason to have it
Uh, is this issue in IJ or maven? I'd say the former, in which case I have no idea
IJ using maven
It's likely an error somewhere in your IJ configuration
At worst nuke the IJ project files and reimport the project into your IDE
show your pom.xml
?paste
I removed the flag but now I'm getting this
which flag did you remove?
enable preview
if you set source to 8, you also need to set target to 8
<target>8</target> needs to be added too
Yep
alright cool, thanks!
usually you either wanna use 8 or 17. if you want to support spigot 1.16 and older, you should use 8
otherwise 17
Or later if you really fancy that but keeping them the same is best practice
Can someone please help?
why are you still using your own COnfig class instead of the FileConfiguration provided by JavaPlugin?
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/plugin/java/JavaPlugin.html#getConfig() your main class has a method getConfig() that returns a FileConfiguration
declaration: package: org.bukkit.plugin.java, class: JavaPlugin
Does it?
public void onEnable() {
System.out.println("[" + " " + "Exon" + "MC" + " " + "]" + " " + "Pluginnet er nu startet");
getCommand("eat").setExecutor(new EatCommand());
//Setup config
getConfig().addDefault("Permission", "Exon.eat");
getConfig().addDefault("Cooldown", 5);
this.getConfig().options().copyDefaults(true);
saveConfig();
getConfig().options().copyDefaults(true);
saveConfig();
you can just do getConfig().getInt("Cooldown")
if you need the config in another class, there's three ways:
- dependency injection or 2. static getter, both explained here: https://blog.jeff-media.com/getting-your-main-classes-instance-in-another-class/
or 3. using the plugin manager or JavaPlugin#getPlugin(Class)
Why dont i have a selection called getConfig?
As you has? main.getConfig().getString
probably because you didn't follow the blog post entirely
what is "main"?
show where/how you declare it
public class EatCommand implements CommandExecutor {
private final EatCommand main;
public OtherClass(EatCommand main) {
this.main=main;
}
main should be an instance of your main plugin class, not the current class...
that makes absolutely no sense
he did not read anything and just copied it
also how can your constructor be caleld OtherClass? That wouldnt even compile
he's doing that for 3 days now
...
Sounds like #help-development 1o1
yes theyre entities so just set them invisible
im pretty sure you're blocking the main server thread everytime a new player joins
whats the problem
any errors?
In a relatively minor way, but yes
?notworking @quaint mantle
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
Explain what’s happening and what you expect to happen
that is a very useful command applaud to whoever added that
could be worse
50x50 area
but, at least you are at 10-10.5 seconds so far
from top to bottom
Have you verified your code is running in the right place
hey so I'm able to spawn a regular fireball entity but I'm just wondering, how would I adjust things like explosion power or velocity?
what do you mean
So you added debug statements already?
can you explain further
how does it not work
does it not save to the file?
or is the nickname not being applied
spawnEntity should return the fireball, you can modify it
oh right
get rid of the savePluginConfig method
in the onEnable call saveDefaultConfig on the first line
????
and in the onDisable use plugin.saveConfig()
@quaint mantle that’s not right
pretty sure im right
@quaint mantle in your listener add some debug output lines to see which parts of the code are being run
I suspect your hasPlayedBefore check isn’t working properly
your ways of saving the config.yml look pretty weird tho still
what r u looking for
workload distribution
?workdistro
ahh thx
gotcha, what method would I use to adjust explosion yield? I can't find anything on the docs
declaration: package: org.bukkit.entity, interface: Explosive
Fireball extends Explosive, which has setYield
ah thanks!
i promise to only do sensible things with this knowledge https://cdn.discordapp.com/emojis/1092911276310671490.webp?size=48&name=Troll&quality=lossless
Is this enough to calculate if the victim is going to die, but to not make it actually die?
public class EntityDamageListener implements Listener {
private final ArenaManager arenaManager;
public EntityDamageListener(ArenaManager arenaManager) {
this.arenaManager = arenaManager;
}
@EventHandler
public void onEntityDamage(EntityDamageEvent entityDamageEvent) {
if(!(entityDamageEvent.getEntity() instanceof Player) )return;
Player victim = (Player) entityDamageEvent.getEntity();
if( arenaManager.isPlayerOnArena(victim) ) {
ArenaModel arenaModel = arenaManager.getPlayerArena(victim);
if( arenaModel.getArenaState() != ArenaState.ARENA_STATE_FIGHTING ) {
entityDamageEvent.setCancelled(true);
}
else if( entityDamageEvent.getFinalDamage() >= victim.getHealth() ) {
entityDamageEvent.setCancelled(true);
ArenaDeathEvent arenaDeathEvent = new ArenaDeathEvent(arenaModel,victim);
arenaDeathEvent.callEvent();
}
}
}
}
Thank you for your attention 🙂
well if ur tryna calculate if the player will die from that hit. that aint gonna work
yeah that's what I'm trying to
Maybe get player helath - final damage > 0 ?
im stupid that would probablyt work like that
yea that what i was thinking but this is essentially hte same
should work i think
:<>
?tas
based.
Hi, I have problem with loading world - when I create world and i try to teleport to it server crashes
it's void world
public void generateWorld(Island island) {
Bukkit.getScheduler().runTaskAsynchronously(SkyblockPlugin.getPlugin(SkyblockPlugin.class), () -> {
WorldCreator worldCreator = new WorldCreator("is-" + island.getOwnerUser());
worldCreator.generator(new EmptyChunkGenerator());
worldCreator.generateStructures(false);
Bukkit.createWorld(worldCreator);
});
}
you can't create a world asynchronous
but it will block main thread I think
Most things of the spigot api aren't usable off the main thread. Like changing blocks, editing inventories, teleporting etc
Ideally you avoid making worlds at runtime
yup, can't prevent that
Or at least try to make them at startup
Actually I did think of a way to prevent it by generating the world on another server and transfering it via http but you would still have to load the world which then again would be blocking
Can't imagine an empty world is very slow to generate
i highly doubt you want to give every player their own world
yes
you should use per player world boarders
declaration: package: org.bukkit.entity, interface: Player
first i thought to make squares on one world 2000x2000
yup that's why using another server to generate is not a perfect solution either, sadly. Also it will obviously take longer than generating it on the same server
and then make algorithm to claim it or something like this
you'd wanna do it per chunk so its somewhat easier to math
It would definitly be better to use one world as opposed to ticking 40 different worlds at a time when 40 players are online
chunk is 16x16 but i need ~200x200 islands per player
go to the nearest chunk
You can map a location to a player
And then treat everything within X blocks of that location as also belonging to them
im storing center of island so that sounds good
so either take 192x192 or 208x208
okey i think its no problem
then it should work on one world and make "islands" on it for every player
Yes. Give them some space in between if you don't want them to meet each other at the border
You can then also use the pet player border api to give them nice visible borders
That are also impassable
i also want to make borders
declaration: package: org.bukkit.entity, interface: Player
I think he meant custom borders though
okey but if one island is on 0,0 then second has to be on 213,0
islands=208x208 and space between 5
Add more space between to keep it chunk aligned
take a full chunk (or more) as space between
if i have 3 values, what could i call the third if i have key and value
when you have 3 values and those are key and value then how does the third one even match them?
idk
Is it part of them? Or is it some random other value?
3 different values
So you have a key, a value, and then some third thing
yeah
How does the third thing relate to the key and value
Do you just wanna show code or do we have to keep guessing? How shall I name something I know nothing about
first second and third
F S T as the generics
You can also just do A B C
no
Yes why not
I mean generally you should avoid such objects in favour of actual descriptive data objects
well he can create a class that extends TriValue and then use that and it's descriptive again
Kek
I'm just trying to fix the design choice lol
tbh its quite useful
avoids me having to make/return a map for anything that has 2 different values
Yeah maybe pair is
I believe Mojang has one of those they use a bit
But they don’t go beyond that
oh coll
do you know how i can not replace base attribute modifiers on tems
items
bc for some reason adding an extra damage modifer removes the base damage
Correct
The base attributes are weird and don’t really exist
Get the base attributes and then edit them
how
Material#getDefaultAttributeModifiers
smh
Whats the simplest way to cancel knockback taking place in an EntityDamageByEntity event
One tick later set their velocity to 0
doesnt exist
This would be bad if their velocity wasn't already zero tho
oi coll
can I apply the red damage taking visual effect even if I cancel the vent
what class is UnsafeValues in cb
CraftMagicNumbers
Yes
Yes
can Player#stopSound be ignored by the client sometimes?
naw wtf
something aint right
even if i play the sound a tick later
the client will just ignore the stopSound sometimes?
what type of inconsistent bs is this
Seems like raytrace result doesn’t detect entities at a short range (less than 4 blocks). Don’t know what’s wrong. This is what my code looks like
https://paste.md-5.net/pipodipazu.cs
Hey any help over there?
Console logs this error when victim is going to DIE.
[00:23:43 ERROR]: Could not pass event EntityDamageByEntityEvent to SimpleSpigotPlugin v1.0-SNAPSHOT
java.lang.NullPointerException: Cannot invoke "org.bukkit.event.HandlerList.getRegisteredListeners()" because "handlers" is null
public class EntityDamageListener implements Listener {
private final ArenaManager arenaManager;
public EntityDamageListener(ArenaManager arenaManager) {
this.arenaManager = arenaManager;
}
@EventHandler
public void onEntityDamage(EntityDamageEvent entityDamageEvent) {
if(!(entityDamageEvent.getEntity() instanceof Player) )return;
Player victim = (Player) entityDamageEvent.getEntity();
if( arenaManager.isPlayerOnArena(victim) ) {
ArenaModel arenaModel = arenaManager.getPlayerArena(victim);
if( arenaModel.getArenaState() != ArenaState.ARENA_STATE_FIGHTING ) {
entityDamageEvent.setCancelled(true);
}
else if( entityDamageEvent.getFinalDamage() >= victim.getHealth() ) {
//right here the error fires
entityDamageEvent.setCancelled(true);
ArenaDeathEvent arenaDeathEvent = new ArenaDeathEvent(arenaModel,victim);
arenaDeathEvent.callEvent();
}
}
}
}
Thanks for the attention!
how do you register the listener?
are you sure you're registering it right?
//custom events
getServer().getPluginManager().registerEvents(new ArenaStateChangeListener(arenaManager),this);
getServer().getPluginManager().registerEvents(new ArenaJoinQuitListener(),this);
getServer().getPluginManager().registerEvents(new ArenaFightStartListener(),this);
getServer().getPluginManager().registerEvents(new ArenaDeathListener(),this);
wonder if this categories just broken hm
Your arena death event is likely missing the handler methods
also looks like a custom event, make sure ur constructing it right :v cant help there though since i just use bukkit provided ones
Your custom event classes need both a static and non static getHandlers method
public class ArenaDeathEvent extends Event {
private static final HandlerList HANDLERS = new HandlerList();
private final ArenaModel arena;
private final Player victim;
public ArenaDeathEvent(ArenaModel arena, Player victim) {
this.arena = arena;
this.victim = victim;
}
public ArenaModel getArena() {
return arena;
}
public Player getVictim() {
return victim;
}
public static HandlerList getHandlerList() {
return HANDLERS;
}
@Override
public @NotNull HandlerList getHandlers() {
return null;
}
}
oh
return null
mb lmao
mojank weird
why do I only get these stuff when I copy paste the code
they have no way to loop over the 1.17 Items class
i have to use reflection probably
Common outdated versions L
If you're making minigames there's a much slicker way to do this
why do i hate this
I spent 1 week on IntelliJ and I'm back to vscode
fair
Open spigot with it enabled
Bukkit, CraftBukkit, and Spigot destroy my sonar lint
I turn it off usually
I'll have like 1000+ warnings
it stops keeping track after 999
so I don't know how many their truly are
how can i cache values in a map, like the stuff with computeIfAbsent
like i would cache the return value of a util method
seems the client wants a multi second cooldown in between stopping and playing sounds
Mojang rly needs to fix theyre client this is straight up horrid LMFAO
are you able to show an example of this or explain a lil more?
cache the result of Utils.getDefaultModifiers(Attribute.GENERIC_ATTACK_DAMAGE, type, EquipmentSlot.HAND) so im not going and screaming at nms everytime i use it
returns a Collection
why couldn't you shove the collection returned into the map?
bc it would be different for each item
like for the equipment slots?
idk what the correct formatting for the computeifabsent is
ahh for that type i see
okay what the fuck??
why tf is the client ignoring stopSound wtf
private List<AttributeModifier> getDefaultModifier(Material material) {
return defaultMaterialModifiers.computeIfAbsent(material, type -> Utils.getDefaultModifiers(Attribute.GENERIC_ATTACK_DAMAGE, type, EquipmentSlot.HAND).stream().toList())
}
all the jank
it needs you to listen
wym?
like even stopping the direct sound using the key for it doesnt stop it 50% of the time
I guess that went over your head
it did im kinda seeing red rn
absolutely ridiculous mojang fucks theyre clientup so damn often
are you sure it isn't just your client?
client doesnt think so
It’s meant to stop sounds that are already playing
it just straight up ignored it 50% of the time
i get like 20 songs playing at once
yes, but why are they feeding another sound with it?
I don't recall it taking a parameter like that lol
now I have to go look at it
They are passing a category
What about stopAllSounds
i was gonna do that but wouldnt it interfere in some way?
not sure lemme try
are you sure the category of sound is even playing?
also you need to wait a tick between playing and stopping
also some sounds can't be stopped in the middle of their playing as well
totalling 4-6 seconds in between each songs
nope lmao
!verify
Usage: !verify <forums username>
I am going to say its probably just your client
have you had someone else test it?
yes but not the new version
old version it did it, and its doing it on the new one so i assume its gonna do it to other ppl too
Whats that
its like mojang just cant get theyre shit together
Myeah why not try with armor stands
I won't ever understnad display entties.
I mean its just an entity
That displays sth
For example a block
The only complex part is transformations
WAIT YALL
Witchcraft I say!
You’re trolling lol
imma cry now

god damnit ofc course it works now, i take back everything i said mojang im sorry
tasks are annoying asf i swear
Lol
Tasks.later(60, () -> { }) superior
it gets the plugin automatically
is that some bukkit thing or your own custom wrapper for em
i just made a wrapper around the methods needing plugin instances and made em static lmfao
JavaPlugin.getProvidingPlugin(ClassUtils.getCurrentClass(1));
?paste
https://paste.md-5.net/elozicalid.java
Could be better made but works for me for now :p
first it tries JavaPlugin#getProvidingPlugin, and if that fails, it does evil stuff https://github.com/JEFF-Media-GbR/JeffLib/blob/master/core/src/main/java/com/jeff_media/jefflib/JeffLib.java#L149
Evillllll!
no
no
you could use a falling block or block display and move that 0.5 blocks down
although IIRC block displays are a tad smaller than a normal block
You can just scale em then
ah ok
nah just use a blockdisplay with a custom transformation
declaration: package: org.bukkit.entity, interface: BlockDisplay
declaration: package: org.bukkit.entity, interface: Display
here's half an ice block
Hehe he flat
Did ya just hack MC? xd
just spawn a blockdisplay, set the block to ice, create a transformation object with a vec3f 1, 0.5, 1 as scale, and then set it to the display
don't forgot to set all these things in the consumer, not after spawning the entity
Should work
Just add the consumer
Are you depending on the right api version
Depends
what version
sth like this should do
public static void spawnHalfIceBlock(Location loc) {
loc.getWorld().spawn(loc, BlockDisplay.class, display -> {
display.setBlock(Material.ICE.createBlockData());
Transformation transformation = display.getTransformation();
display.setTransformation(new Transformation(transformation.getTranslation(), transformation.getLeftRotation(), new Vector3f(0, 0.5f, 0), transformation.getRightRotation()));
});
}
haven't tested
if ur server runs 1.19.4 yea
And if your server still runs 1.19.3
update
yeah just bump api version
block displays are fun
I agree
just change the .3 to .4
Idk go ask purpur
<repositories>
<!-- This adds the Spigot Maven repository to the build -->
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<!--This adds the Spigot API artifact to the build -->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.19.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
dude with displays one can finally build literally anything
Yep
that's a frog light with 0.1x4x0.1
It’s a shame they are entities tho
well more like 7 frog lights
This is two children trying to play with something that they only have one of, and they are literally fighting for it and the item becomes this wide.
Wideing Table.
I wish the block displays had transparency. would work great for me
aint nobody gonna trip over this hook
Damn I some how crashed intelliJ when editing a Lua script lol
oh god the block display users are coming out
hide your children
i needa loko into those one day though they look badass
try ctrl + clicking the material enum
:>
Lul
Oh thats fine for me
then again the current project I am doing is 1.8
so not as much but ive done it in 1.19
oh intellij finally auto collpases them now so it doesnt shit the bed rendering them all
ahh
Lol
i thought that was some intellij thing lmao
Yes
itll make it .3 less tall, since you lower it on the y axis
change the vector in the transformation
oh is the block height an array alr then
smol ice
oh
thats odd, but kinda makes sense
so it only works in increments of 2 i take it?
No?
You can shove 0.2746372 in there if you want
I do think the game rounds it at some point, but it’s fine enough that you won’t notice
gonna make my ice 2 px smaller
someone should make 2x minecraft with block displays
would be a lot of work but would be hilarious
I doubt the game would handle that many block displays
yes
my best guess is you would tie a couple block displays together to make them act like one
anyone know if there is an event or something i can use for archaeology?
how would i create a coustom use event in my plugin
?event-api
no is there an event for right clicking an item
PlayerInteractEvent
Using a spigot plugin how do I send a player to another server within bungee?
?pmc
I believe that covers it
it does thanks
So if I want to get a hashmap within another class from which it was created, how would I?
make a getter
dependency injection with a getter of the hashmap
you need some library for block bench stuff
Can you explain what a getter is please?
essentially a getter is a method that gets something
So for ex Bukkit.getPlayer(UUID) is a getter, and getters typically return some form of value (IE they are not a void)
You would make a getValueFromMap say if your map holds player with a key of material you would make a getter of YourClass.getPlayer(Material material); and it would return a value from your hashmap using the key provided from the argument
Okay. So if I wanted to create this "global" hashmap where would I put it. Could it be in any class or does it have to be it's own class?
WHats the hashmap for?
Normally you have Manager/Handler/Whatever classes that manage your maps and lists to make things easier on yourself, and you would make getters to those classes in your main class so when you use dependency injection you have access to all those classes
So basically the idea is. In ProjectileLaunchEvent I want to set a hashmap to (Entity, Boolean) so when I shoot an arrow it'll say (Arrow, False). The boolean would be if the arrow has landed. So then in a ProjectileHitEvent it would change the arrow's boolean to true since it have "hit" something... (sorry if this is all over)
There is a plugin called mine x farm it used to support 1.12 to 1.19 before but from it's last update it supports 1.20 but from 1.17 so anyone has a old version copy of it?
I want it for my 1.16.5 server
idk if that's the plugin but the site has version history on resources
so just find what u want
Ok ty
I will add for @timber prawn that a "getter" is typically referred to as a method inside of a class with no parameters and simply returns a protected or private field inside of the class.
public class Player {
private String name; // You can not player.name because it's private,
public String getName() {
return name; // so instead of player.name you use player.getName(), which also prevents you from changing the name.
}
Where can I put this though?
wdym
Yeah typically they do have no parameters but some things like map value getters might need one ;P (Which is what he needs i think?)
I read context and it's literally the difference between renaming "name" to "map" or whatever and changing hte type from String to Map
see this
ah I see
well I mean
you'd literally put a map inside of ProjectileLaunchEvent
and use this code to do that
So I create it inside the class that the Projectile Launch Event is in?
correct
and I can call it to the ProjectileHitEvent?
correct
though honestly
I don't know that it belongs inside of the listener, but it can
you'd just need to pass the instance of your ProjectileLaunchEvent listener from the main class
Where else would I put it? Inside it's own class?
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
ProjectileLaunchEventListener projectileLaunchEvent = new ProjectileLaunchEventListener();
ProjectileHitEventListener projectileHitEvent = new ProjectileHitEventListener(projectileLaunchEvent);
getPluginManager().registerEvents(projectileLaunchEvent, this);
getPluginManager().registerEvents(projectileHitEvent, this);
}
}
public class ProjectileLaunchEventListener implements Listener {
private List<UUID> launchedEntities = new ArrayList<>();
@EventHandler
...
public boolean isLaunchedEntity(Entity entity) {
return launchedEntities.contains(entity.getUniqueId());
}
public void removeLaunchedEntity(Entity entity) {
launchedEntities.remove(entity.getUniqueId());
}
}
that's all the spoon feeding for today
also I changed it from a Map to a List because I genuinely don't see why it needs to be a map, though tbh I didnt fully read your message
any time you have a Map<?, Boolean> typically the presence of the entry in the list can be subsituted for the value in the map
i.e. List#contains = Map#get
@timber prawn ^
You mean a set
literally doesn't matter
it kinda does
I refuse to code a Set anymore because every damn time I use one I end up refactoring it to an indexed iterable because I need .get(0) for etc'
I wasn't asking for spoon feeding, but I appreciate it. Thank you!
That's... just a lack of understanding the right structure
excuse me?
Sets have their use-cases
stfu I'm not going to debate whether he wants a List or Set
Lists also have their use-cases
arrays? i just hard code a bunch of variables ill think i need
make sure to have some placeholders as well if its off by one
public class ArrayLengthTwo {
public Object objectOne;
public Object objectTwo;
}
public class ArrayLengthThree {
public Object objectOne;
public Object objectTwo;
public Object objectThree;
}
// TODO implement arrays with longer lengths
generate them at runtime
ofc, the real reasonable solution
True
Should getLogger().warning() be this.getLogger().warning()? Or does it not matter
Both will most likely work the same
Should I be creating a new instance of my main class whenever I want to access something such as the config, or should I use a getInstance method?
Never create another instance of the plugins main class
(Sidenote, I hope your main is not called "Main")
is there any way to permanently force load a chunk, including any block changes (ie crop growth, spawners etc)?
Thanks, and no 😆.
you can do chunk.setForceLoaded()
But crop growth and spawners need a presence of a player
Is there any better way other than creating a getInstance method?
Thats what i've done, but I want to load crop growth and spawners without a player
I do not believe spigot will provide a way to do this, you'd have to implement this yourself
?di
Maybe, probably, idk
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
Have you tried reading the error
Invalid plugin.yml
24th line
is it possible to fake the presence of a player instead?
is it?
in any case, I see purpur and paper so ask for help in their servers ig
also
purpur
this is a spigot
send it
?paste ur plugin.yml
?whereami YES I GET TO USE IT FOR ONCE
did you switch dev from purpur plugin to spigot plugin ?
Is that what you mean ?
🤦♂️
so ur testing ur Spigot plugin on Purpur

not that an incompatibity should exist, but
it might
just ?paste ur plugin.yml so we can see
or well, use the link from
?paste
dont actually paste ur yml in here
dude, your sense of time is fucked
does anyone know how I could fake a player presence in a specified chunk
Depends on what you mean with presence?
They want to have spawners active & random ticks to happen
That just forces the chunk to stay loaded, says nothing about random ticking
Now I am not 100% sure if you need a player but I think you do
Yeah, random ticks work only when a player is nearby
Force loaded chunks random tick
From the wiki:
chunks only tick when a player is at most 128 blocks horizontal distance from the chunk's center
I want everything in the chunk to work as if a player was currently there, such as plant growth, spawners, redstone etc
oh sorry didnt see the messages above
Yeah spawners and plant growth might require nms then
You do know spawners have 16 blocks range
declaration: package: org.bukkit.block, interface: CreatureSpawner
That could be set and rest on load/unload
Crops are the main problem then ig
can you not manually tick the chunk somehow ?
Like "emulate" the presense of a player ?
Might require NMS tho
i think nms is most commonly used for plugins like this
pretty sure wild loaders used nms
Either use nms to force a random tick or just fake a random tick on your own
How fun I sent that message before your messages appeared
Anyone know why PlayerInteractEvent doesn't get called when left/right clicking in air? I'm on 1.19.4
it doesn;t fire with an empty hand
I held netherite sword and it still doesn't fired.
then you are not running spigot
I have ignoreCancelled = true on the event handler, on the javadocs it says that the event will be cancelled if player just punching air no matter what item that you're holding with, that's probably why.
it does
oh and yeah it does get called in cancelled state when clicking air with a sword, that's correct
jdbc:mysql://user:passw@node1.game-servers.faithnode.host/host
how can I set connection to this
do I need to do this?
btw, why don't you just do return connection != null;?
also check connection.isClosed()?
How do I set the age of an plant?
declaration: package: org.bukkit.block.data, interface: Ageable
kek
no idk what you trying to do :D
top 1 reason why we should have slash commands for all of them
fw?
ye
? ? ?
It's not that hard lol
so where lies the problem
does the entity actually spawn ?
Check with F3+B at the location, should show a blue line pointing south?
also, try, instead of using the default transformation just constructing new one from scratch.
The website should tell you what values what has.
wdym how
yes
but also the vectors and quaterions
oh ok
wait a sec
this one is sadly really limited, I think I remember a different one tho
wait more sec
The command shows the tranformation matrix
You can prob just copy paste that into code
omg spigot transformation does not support from matrix...
Ye
Then use the misode one to get the rotations and put those in
@quaint mantle I don't provide help in DMs unless I say so....
what!
My solvedmoves.yml file has 3 keys (default move settings, smash, and basic attack) however it is reading the first key as "default move" instead of "default move settings" as it's written in the config. Any idea why?
for (String moveKey : movesSection.getKeys(false)) {
Bukkit.getLogger().info("Loading data for the move: " + moveKey);
}```__**moves.yml**__
```yaml
moves:
default move settings:
test: test
smash:
test: test
basic attack:
test: test```
do you know how to make a single entity invisible for only one player?
declaration: package: org.bukkit.entity, interface: Player
it look like comphoenix work
Why use Protocollib when you can use api
cuz i don't know how to use api (i didn't knew there were api)
.
i'm not in 1.20, im in 1.18.2
declaration: package: org.bukkit.entity, interface: Player
api is just the spigot library (spigot-api)
api just refers to the fact that the library is based on a set of interfaces rather concrete classes
and the actual classes are present in the server classpath
this pretty much allows for cross compatibility and some other things
ok thx
Probably has something to do with the ConfigurationSerializable api
Check stash
?stash
You should use the spawn method that takes a consumer
I believe you already did that earlier
How about you try to spawn them without the transformation ?
Does that work ?
||are you calling the method?||
Bro... I just looked at the documentation
Transformation(Vector3f translation, Quaternionf leftRotation, Vector3f scale, Quaternionf rightRotation)
You really setting scale to 0 and then wondering why it doesn't show up
How did you even mix those two
what in the fuck
I didn't look at first since I had assumed you would read the variable names at least...
If you want to output stuff like itemstacks then yes
anyone know how i can fix this?
Unsupported class file major version 64
nvm i fixed it by changing the jvm to 17
I hate how intellij doesnt just suggest how to fix these errors i somehow always get them
Any other way of getting the world type? .getWorldType() is deprecated
It’s not
It’s not
its deprecated on paper
nerd
any alternative methods for that?
No
If it’s not stored in vanilla worlds then you can’t get it
What are you trying to do
Can i retrieve it from WorldInfo?
What are you try
ok...
you beat me to it :D
Identify if its a flat or amplified or any other type of world
now.. why ?
do I need to answer that? 😶
You don't have to
But we might come up with a solution where you don't need that info
Its nothing important, just to specify the world type while listing worlds in a GUI for the player
Hello, I have a problem creating a plugin, I'd like to use this : PacketPlayOutScoreboardTeam but on version 1.19.0 I don't know what to put in the constructor when instantiating a new PacketPlayOutScoreboardTeam. If anyone can help me, thank you in advance
now.. why do you need packets ?
I believe there is Teams api now...
But ProtocolLib + wiki.vg is probably your best bet if you need packets
Mannn I'd just use FastBoard if your making scoreboards
how do I get the motd of the bungeecord server through code?
I know I could use it, but I'd like to try developing my own plugins.
Please, don't try to re-invent the wheel
Trust me, I know what I am saying :D
It is perfectly fine to work with libraries to make stuff faster/easier for you
okay
in essence
u use the static factory methods
ofc u could just use the friendlybytebuf constructor (And u create a bytebuf with Unpooled.buffer())
Trying to use
((CraftPlayer) player).getHandle().b.a(new PacketPlayOutBlockBreakAnimation(-player.getEntityId(), blockPosition, intdamage));
for 1.20.1
but .b now returns "'b' has private access in 'net.minecraft.server.level.EntityPlayer'"
There's an api for that now
why can’t minecraft just be foss 
I mean it sorta is
Like you can easily get the sourcecode in roughly the way it actually looks like
wtf
huh
Does that annotate the methods as well then ?
PacketPlayOutPlayerInfo
What is the 1.20 equivalent to this? Can't find anything similar
huh not what I expected tbh
?
Is that for 1.20 too?
are your eyes not working ?
Can you not check that yourself ?
That website proposes a better alternative now by the way, https://mappings.cephx.dev
version: 1.20.1, hash: d07b560e45
It's a hell of a lot faster than screamingsandals
Looks like garbage on mobile
yeah thx, I'll use that
Concerning developping and testing players-to-players interactions features, how do you usually test them?
I only own one account so and my friends usually aren't online when I am doing tests... Do you get a "cracked version" of the launcher for temporary alt account, OR is there a simpler way to do it (which also wont put me at risk)? 🤔
i got 5 alt accounts or sth lol. mockbukkit can also help for certain things
this is the right use for offline mode
Offline mode
I know about offline mode for servers, but that would still requierds me to get like a second account though, which what Im actually wondering..
Cause I dont wanna risk getting weird things with cracked launchers
Imma look that up
Theres a lot of legit launchers which support offline mode. Example multimc
Alright, thanks
mock bukkit is one way
and sometimes u can also unit test w/o mock bukkit
My server jus tcrashed randomly, I have no idea why or wheter it has something to do with the plugin I am developing. This is the console error
https://paste.md-5.net/vudixigore.cs
Is there a way to stop the arm swing animation when a player clicks on something like a note block?
if I want to change plugin version, I need to change only here?
you would also need to wrap 1.20 in apostrophes, blame snakeyaml
api-version: '1.20'
it thinks its just 1.2 otherwise right?
yeah
why blame snakeyaml that makes sense
Is there a way to detect when a player stops holding right click on a block?
Lol no
abort event
Do you mean the BlockDamageAbortEvent? I need one for using not mining
then as imillusion said, no
https://ibb.co/KN78nHJ
Does anyone know how I get this list is in the 1.20.1? and yes I know I am not using any particular PacketWrapper.
you gotta get the data watcher and get all the contents
yes and what is the name of the method am not yet familiar with the 1.20
If you were using mappings it'd be much simpler, sec
entity.aj().c()
if c() doesn't work, then b()
thank you I test it
?nms
in the 1.20.1, as far as I know, this does not work yet
declaration: package: org.bukkit, interface: Server
Is this method case sensitive?
.b() works thank you

if (stringTime.endsWith("h")) {
stringTime = stringTime.replace("h", "");
seconds = convert(stringTime) * 3600;
} else if (stringTime.endsWith("d")) {
stringTime = stringTime.replace("d", "");
seconds = convert(stringTime) * 3600 * 24;
} else if (stringTime.endsWith("m")) {
stringTime = stringTime.replace("m", "");
seconds = convert(stringTime) * 3600 * 24 * 30;
} else if (stringTime.endsWith("y")) {
stringTime = stringTime.replace("y", "");
seconds = convert(stringTime) * 3600 * 24 * 30 * 12;
}``` asv0od8979g
Also Duration has ofMinutes, ofHours, ofDays etc
How can I save a player's inventory and then give it to them back later?
for a minigame
I dont feel like importing MVinventories just for this
could you send me maybe the website of it, because I now also need to know how to change the blockface of the itemframe
nvm I came up with this
leavingPlayer.getInventory().setContents(previousInventoryList.get(leavingPlayer).getContents());
leavingPlayer.updateInventory();
version: 1.20.1, hash: 2d06cf77ba
that's not needed
It is
oh for 1.20, yeah that might be true
i didnt think about 1.20 being different than 1.19 etc
https://ibb.co/BLnDQr4
I can supposedly make the direction from the itemframe to the north with the method entityItemFrame.a(EnumDirection.c); but it doesn't change do I still have to send some packet or what am I doing wrong
yeah well there's a setting to disable that
but like
that would require pr
We discussed it
We PR'd it too
Stuck in limbo is all. No conclusion
Ah I thought it was decided against
Nah. Only MachineMaker had issues with it but I don't think they were really valid
Fair
Why not just make spigot accept 1.2 for 1.20 lol
It wouldnt cause issues until we‘re at 1.130 anyway
My server just crashes randomly, I have no idea why or wheter it has something to do with the plugin I am developing. This is the console error
https://paste.md-5.net/vudixigore.cs
I assume this would be the case with ConfigurationSection#getString also then in the future?
No
Unaffected. Only the reading of the plugin.yml in PluginDescriptionFile is affected
ah alr alr
Hi i have barely used gradle before, how would i solve this issue:
I have cloned 2 repositories locally (KyoriPowered/adventure) and (KyoriPowered/adventure-platform). I then imported them into IntelliJ, if i edit code in adventure (module = adventure-api) and try to import that edited code into adventure-platform (module = adventure-platform-facet), I get a cant resolve error.
How do i get the adventure-api dependency to pull my local changes
Ehhh, you'd have to install to maven local like you would with maven as well
but im using gradle
gradle has support for maven local
oh
How can i get all the files in a folder from the resources folder?
you mean save to a folder from the plugin?
Yes
Plugin#saveResource
well that would be if you want to write them to the plugin directory right?
wouldn't you just get the class and get the Resource from that
but i want to get all the files in a folder, for example i have the folder test in the resources folder and i want to get every file in it
you can save anywhere
what do you wanna do with the files save them somewhere? or what if you wanna save them do what ElgarL is saying
saveResource preserves the file structure
How can I get MariaDB connection?
Is there any thing to download additionally like maria db driver?
Learn various ways to install Connector/J. Download Connector/J with MariaDB here and learn how to intall.
Use teh libraries feature of Plugin.yml to add a Maria dependency
^ Oh yeah don't forget to follow the guide though
you'd just choose a provided scope instead of implementation / compile
I have this folder in the resources and i want to get all the files in it
you can just do
plugin.saveResource("types/BikeType.yml");
// and so on
Isn't there some way to get the files using a for loop maybe?
not easily
at that point you'd have to go to the java classloader i believe
I found this on stack overflow https://stackoverflow.com/questions/3923129/get-a-list-of-resources-from-classpath-directory
I already tried to do the same thing but it isn't getting anything
My server just crashes randomly, I have no idea why or wheter it has something to do with the plugin I am developing. This is the console error
https://paste.md-5.net/vudixigore.cs
so.. do I have to add MariaDB jar to my plugins folder?
no use the libraries feature of the plugin.yml
and add the dependency to Maven / Gradle whichever you use
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
reminder if you use library loading DO NOT shade the dependency
if i have a link thats like
mysql://some_stuff
do i just add jdbc: before mysql?
Can I find the shape of BlockData? I am trying to find the theoretical bounding box of a block at a location, but without actually changing the block
Block#getBoundingBox()
So like this?
oh lordie
repositories {
mavenLocal()
}
please consider looking at gradle docs
ok i will
sql link question
entityPlayer.getBukkitEntity().teleport(location)
This is returning false. Does anyone know anything abt that?
Guys
How make plugin? https://youtu.be/xt_hx4ItrnA
In this video, you can see how shifts my hunger and thirst bars by 1pix when my plugin starts to display the bleeding HUD.
Video published for GitHub issue: %link%
Using the symbol and resourcepack
Healt indicator
Do you know java already?
then do you not know how to start making that?
when is the pluginenableevent called?
like you register the event listener in the onenable in the main class, so will the pluginenableevent be called as soon as the listener is registered or what
(im confused because when the plugin is enabled the listener isnt registered yet)
Thirst from the race. When less than 50, there will be a slowdown, when 0 - 5 damage every 3 seconds
I don’t know how to make thirst
thirst looks like the XP bar
yo Ntdi, know anything about this? It's using NMS
cuz I have created an NPC and I need to set its location
no
I need to have it move and shit
with packets
it's just the teleporting that isn't working
Is there an event for when a player lets go of left click?
if mining it's an abort event
Is there a way to tell what block would be placed if a certain item was used? I can use Material.createBlockData() for most blocks but it doesn't work for stuff like crops, which have a different material as a block to an item
jree
I'm trying to add JGit to my plugin, but when trying to use the shadow compiled fat jar, I get this exception, stating the resource is missing:
org.eclipse.jgit.errors.TranslationBundleLoadingException: Loading of translation bundle failed for [org.eclipse.jgit.internal.JGitText, en_US]
at org.eclipse.jgit.nls.TranslationBundle.load(TranslationBundle.java:141) ~[MineCICD-1.0-SNAPSHOT-all.jar:?]
at org.eclipse.jgit.nls.GlobalBundleCache.lookupBundle(GlobalBundleCache.java:64) ~[MineCICD-1.0-SNAPSHOT-all.jar:?]
at org.eclipse.jgit.nls.NLS.get(NLS.java:125) ~[MineCICD-1.0-SNAPSHOT-all.jar:?]
at org.eclipse.jgit.nls.NLS.getBundleFor(NLS.java:101) ~[MineCICD-1.0-SNAPSHOT-all.jar:?]
at org.eclipse.jgit.internal.JGitText.get(JGitText.java:28) ~[MineCICD-1.0-SNAPSHOT-all.jar:?]
at org.eclipse.jgit.errors.RepositoryNotFoundException.message(RepositoryNotFoundException.java:69) ~[MineCICD-1.0-SNAPSHOT-all.jar:?]
at org.eclipse.jgit.errors.RepositoryNotFoundException.<init>(RepositoryNotFoundException.java:53) ~[MineCICD-1.0-SNAPSHOT-all.jar:?]
at org.eclipse.jgit.errors.RepositoryNotFoundException.<init>(RepositoryNotFoundException.java:31) ~[MineCICD-1.0-SNAPSHOT-all.jar:?]
at org.eclipse.jgit.lib.BaseRepositoryBuilder.build(BaseRepositoryBuilder.java:627) ~[MineCICD-1.0-SNAPSHOT-all.jar:?]
at org.eclipse.jgit.api.Git.open(Git.java:93) ~[MineCICD-1.0-SNAPSHOT-all.jar:?]
at org.eclipse.jgit.api.Git.open(Git.java:73) ~[MineCICD-1.0-SNAPSHOT-all.jar:?]
How could I fix that?
what's "the other one" then? What do you want it to snap to?
oooh, that's a display block, I thaught the ice in the water was... well ice
So you are spawning 3 display blocks per ice shard thingy?
Why not just use this model instead of the ice block in a resourcepack?
https://paste.md-5.net/aloxotisel.md
This happens when I try to teleport an EntityPlayer that's from NMS using the following code:
entityPlayer.teleportTo(worldServer, new Position(location.getX(), location.getY(), location.getZ()))
Someone said that this was because the chunk hasn't been loaded, but I made sure to load it first.
ah, kk. But it might jitter when teleporting 3 armour stands
illegal entity means it doesn;t exist on the server
It does though, I can view it
Hmm, guys. I need to make a gui with a lot of text and if possible, for it to be always visible. What's the best way to do that?
just because you can see it on a client doesn;t mean it exists on the server
sorry, I usually make stuff pre 1.19, so I'm not used to this fancy tech yet XD
packet based Players do not have Bukkit entities
@eternal oxide It spawns all of them at 0 0 0
does yoru code ever call add to world on teh NPC?
Yes, lots of lots of text. I could use a inventory with a pages system and just renamed signs but it's weird. Imagine something like a terminal inside minecraft
No, the only thing I'm doing with the world is when I create the NPC: this.entityPlayer = new EntityPlayer(minecraftServer, worldServer, this.gameProfile);
if you never call nmsWorld.addNewPlayer(npc) your NPC doesn;t exist on the server
I think making a big black square and putting text on it just using blocks would be okay too but idk how to do that
@eternal oxide
((CraftWorld) location.getWorld()).addEntity(this.entityPlayer, CreatureSpawnEvent.SpawnReason.CUSTOM);
This does the trick right?
I have an idea, I'm trying it out currently, but why not try to make one block display ride the other, then it should have smoother interpolation and automatic rotation aligning
you need to decide if you are goign all packets or adding to world
I'll add to world yes
if you are goign all packets you can;t use things like entity teleport. You have to do everythign using packets
ye
if you add to world there are more hoops you must jump through
well I think it's called passanger
you have to attach a null manager to prevent sending any packets to the NPC
a interactManager?
search back about a day ago. I posted a zip for Fake player
teh code no longer works out teh box, but it shows you how to wrap the ServerPlayer
nvm, scratch that, for some reason passangers don't rotate with the origin
btw, I'd recommend doing this with commands atm, cause this might take very long trying to get it to work with recompiling, restarting and then testing.
Here's a neat website for summoning stuff:
https://mcstacker.net/
I have a location which is 500 blocks away from my location. now , I want to split target coordinate into small coordinates which has a distance of 10 blocks from each other.
is this a correct implementation ?
public static List<Vector> multiplyUntilLocation(Location loc1, Location loc2) {
Vector direction = loc2.toVector().subtract(loc1.toVector());
direction.normalize();
List<Vector> multipliedVectors = new ArrayList<>();
Vector currentVector = direction.clone();
while (currentVector.length() <= direction.length()) {
multipliedVectors.add(currentVector.clone());
currentVector.multiply(10);
}
return multipliedVectors;
}```
@eternal oxide Is that using mojang mappings?
yes
I'm not sure (I have never worked with them yet), but maybe it'd be a good idea to add the two display entities at the side as a passanger to the one to the middle. By this, you would only have to move the on in the middle and each the other two get moved at the same time as well. This could remove possible jiggle for players with a greater ping
player#sendBlockDamage
https://mlakuss.github.io/minecraft-display-entities-generator/
This site is also very useful for visualizing tranformations
Generate /summon commands for display entities for Minecraft (Java 1.19.4+) with preview of the result


