#help-development

1 messages · Page 822 of 1

blazing ocean
#

^^

proud badge
#

Ok

#

True I watched like a 2 hour java tutorial before starting plugins

river oracle
#

😨

blazing ocean
#

watching tutorials doesnt make you good at programming

#

if you want to use this without an instance, make it static

#

mate the error is not in there

proud badge
#

thx

blazing ocean
proud badge
#

time to not learn java

river oracle
#

no concurrent modification show your code

slender elbow
#

tbf the kotlin example is using val :^)

worldly ingot
#

Also, yeah, var. wtf

quaint mantle
rough drift
#

nope

#

that's final

river oracle
#

so is val :P

worldly ingot
#

The person that made that graphic went out of their way to make Java look way worse than it actually is

river oracle
#

I was making a joke mans

smoky oak
#

man i dont understand reflection

river oracle
#

its obvious its scewed lol

rotund ravine
#

Guy is getting back on kotlin hahers

rotund ravine
slender elbow
#

hahers

blazing ocean
#

hahers

dry hazel
#

emily

proud badge
#

How tf did my plugin go from 30 to 312 kb from 300 lines of code

dry hazel
#

dependencies

shadow night
#

code moment

blazing ocean
#

jars arent small either

smoky oak
river oracle
# quaint mantle my fault

Concurrent mod usually hapens when you edit something simlutaneously OR if you edit a collectionl while looping over it. I see neither of those things here? what specific line is erroring

worldly ingot
# quaint mantle my fault

Going to assume you're listening to a PlayerDeathEvent and removing players from your EventCore.Alive field. Player#setHealth() kills them in the loop, calls the death event, removes from the list, throws CME

smoky oak
#

bc if i do that its like 'unchecked cast'

dry hazel
#

it's unchecked cause you're casting a parameterized type

smoky oak
#

can i ignore that given it passes <capture of ? extends Effect>

dry hazel
#

or change the other end to Class<? extends Effect>

smoky oak
#

im just trying to prevent having to do the same batch of logic for EVERY kind of event

#

trying to find annotations on methods

dry hazel
#

just use Class<?>

worldly ingot
#

? extends Effect, even

#

Actually yeah in this case you don't even need the specification lol

smoky oak
#

i... couldve sworn it complained about that

#

weird

#

hm this is curious

#

its saying it needs Retention.RUNTIME but wouldnt Retention.CLASS be enough?

dry hazel
smoky oak
#

noted

dry hazel
#

it's described in the javadoc of retentionpolicy

smoky oak
#

hm it must not show in the abbreviated jd in the editor then cuz i didnt see it

#

maybe im blind

dry hazel
#

ctrl+click

smoky oak
#

qq if im understanding this correct: the line EffectHandler annotation = clazz.getAnnotation(EffectHandler.class); checks if the annotation is anywhere in the class, or if the class itself is annotated?

dry hazel
#

the class itself

blazing ocean
#

how can I teleport a boat with a player inside of it?

blazing ocean
smoky oak
blazing ocean
#

this is what im using atm:

private fun teleportPlayerWithBoat(player: EventTeamPlayer, location: Location) {
        val boat: Vehicle = player.iceBoat ?: return

        boat.teleport(location, PlayerTeleportEvent.TeleportCause.PLUGIN)
        player.player!!.teleport(location, PlayerTeleportEvent.TeleportCause.PLUGIN)
}```
smoky oak
#

uuuh

#

i can read java

#

not kotlin

blazing ocean
#

theres practically no diff

smoky oak
#

ngl my mental capacity is spent on reflection rn lol

#

how do i do instanceof on Class<?> it aint just doing instanceof, and isInstance doesnt work on Class<?> cuz it isnt the right kind of object

worldly ingot
#

isAssignableFrom iirc

#

isInstance() if you want to pass an object

smoky oak
#

no

#

im doing basically the same thing as the event api rn

#

checking method signatures

#

need it for the way im registering stuff

worldly ingot
#

That's fine, but the answer you're looking for is Class#isAssignableFrom() :p

smoky oak
#

do u know how to solve this one lol

#

im using the extends event here to constrain it properly but idk how to actually convert it

worldly ingot
#

Event.class.asSubclass(args[0])

smoky oak
worldly ingot
#

uh, no, sorry, other way around lol

#

args[0].asSubclass(Event.class)

smoky oak
#

ah that makes sense lol

#

side note, how fast is runtime reflection?

#

i might need to redo it cuz i probably have to run it on some really high frequency events

#

(read: PlayerMove)

worldly ingot
#

I mean it's not fast, but yeah. Cache things if you can. Get methods and fields only once, stuff like that

#

MethodHandles tend to be much quicker but it's also a little more involved

tender shard
#

does anyone know what net.minecraft.advancements.critereon.DeserializationContext (1.20.2 remapped) changed to in 1.20.3?

smoky oak
#

yea right now my idea is HashMap<Class<? extends Event>, HashSet<Effect>> callMap;
Each 'Effect' is supposed to only get instantiated once

U think this'd work? Map<<? extends Event>, HashSet<Method>>

#

the problem is that wouldnt bind the method to the Effect anymore

#

alright context might be helpful
the idea is to pass through events only to the classes that need them, hence me scanning for that annotation and building the set of Effects that want them
the problem im facing right now is... there's a lot of events

it's pretty simple to call the methods via reflection, but also pretty slow, but the only alternative im aware of is to make an empty method for every single event then ANOTHER method for every event that's like 'this event -> grab from the map the set of Effects, call that method passing through the evenet'

#

wouldnt be big an issue to do over reflection, were it not for the fact that some things tend to happen rather often

#

blockPhysics, entityDamage, playerMovement etc

river oracle
#

it can actually be as fast as normal calls now under certain conditions.

smoky oak
#

this the methodhandles thing choco mentioned?

river oracle
#

what are you trying to achieve here

smoky oak
#

i more or less require event passthrough because I'm making a lot of different classes/effects that need said events. I figured in the long run it would be saving me time doing it like this

the goal is to have, for each event, a loop that's like 'this is the list/set of class instances that want those events'

river oracle
#

I don't understand.

#

are you like reading this stuff from a package within the jar file and appendig the classes into a hashmap for registration?

smoky oak
#

no, its supposed to tell the handler library 'this is the list of instances, the events it needs are annotated', and the lib caches them

the problem i have is that both ways i tried to do this are kind of problematic - registering one handler class per effect per player get... large, rather fast, but caching player data in the handler instead is NOT easy either

my current way of doing this is a massive abstract class acting as an interface with empty methods for a bunch of events, and there's a bunch of classes implementing that class and overwriting the methods they need, and one instance of those classes is created per-player per-effect to handle it
so if an event happens it just iterates through literally every instance of that interface class calling the empty / maybe implemented method bodies
the problem with that is that i need to add each event manually, and I feel like it's kinda the wrong idea to be like 'one instance per effect and player' so im trying to use reflection to not have to do that part at least (the manual event addition) each time, and to not waste like 90% of method calls on empty methods

carmine mica
#

they aren't using gson for advancement serialization/deserialization anymore

#

its via codecs from dfu now

tender shard
#

sad, thx

slender elbow
#

more and more things are being codec-ified over time

tender shard
#

easy fix lel

river oracle
# smoky oak no, its supposed to tell the handler library 'this is the list of instances, the...

I mean their really is no "nice" way to just magically create events out of thin air unless you have a pre-processor. It may seem "annoying" but you're stuck making the events manually not much you can do about that.

I'd just have a

PlayerWalkListener.java

Then delegate all effect methods to run in that listener.

e.g.

public void onMove(PlayerMoveEvent event) {
  if (// some inverse resitriction logic) {
    return;
  }
  
  Effects.MY_COOL_EFFECT.event(event);
  Effects.MY_OTHER_COOL_EFFECT.event(event);
}

You could also just make an array and loop over that array

echo basalt
#

.

pliant topaz
#

Anyone? 🥲

river oracle
smoky oak
#

well one effect might require more than one event
so id either get stuck with instanceof or the same issue as before, empty method bodies in the superclass

#

man this is impossible to design lol

river oracle
#

think you need a redesign then

smoky oak
#

what do u think ive been doing the last 4 days lol

remote swallow
#

crying

smoky oak
#

ye close enough

#

also howd generics help here

#

are you saying to do something along the line of Effect <Set<T>> or smth?

dry hazel
#

I still don't understand what you're doing

remote swallow
deep herald
#

anyone know if i can remove cmds in the command map containing ":"

smoky oak
#

again one effect may require more than one event unfortunately

remote swallow
#

so allow for that method to happen multiple times

smoky oak
#

i guess the best way to put this in simple terms is that im trying to make a library that simplifies creating status effects

#

im not explaining this well

tender shard
# tender shard easy fix lel

anyone got an idea how to create advancements in 1.20.3 then without the server creating a file for it? e.g. a "temporary" advancement

eternal oxide
#

yes

deep herald
#

how?

deep herald
#

is it that simple?

eternal oxide
#

no

#

you'd have to loop the commands and remove any that contain :

tender shard
#

removeIf(command -> command.getName().contains(":"))

#

or sth like that

eternal oxide
#

event.getCommands().removeiF

deep herald
icy beacon
#

why the toString call on a string

deep herald
#

mb

#

will that work tho

icy beacon
#

lgtm

#

?tas

undone axleBOT
neat wolf
#

Hi,
I have a plugin with a structure that looks like this, I would like to obfuscate it with proguard but I have an error when proguard obfuscates my libraries which are generated by maven, my code is contained in the "ch" package how can I ensure that other library packages are not taken into account and correctly obfuscate my plugin?

That would help me a lot!

https://cdn.discordapp.com/attachments/581136754430705695/1183109562459488328/image.png

#

I can't exclude packages like "com.*"

#

and I have these kinds of errors during obfuscation

#
Note: the configuration keeps the entry point 'org.yaml.snakeyaml.constructor.Constructor$ConstructScalar { java.lang.Object construct(org.yaml.snakeyaml.nodes.Node); }', but not the descriptor class 'org.yaml.snakeyaml.nodes.Node'
Note: the configuration keeps the entry point 'org.yaml.snakeyaml.constructor.Constructor$ConstructScalar { java.lang.Object constructStandardJavaInstance(java.lang.Class,org.yaml.snakeyaml.nodes.ScalarNode); }', but not the descriptor class 'org.yaml.snakeyaml.nodes.ScalarNode'
Warning: there were 132251 unresolved references to classes or interfaces.
         You may need to add missing library jars or update their versions.
         If your code works fine without the missing classes, you can suppress
         the warnings with '-dontwarn' options.
         (https://www.guardsquare.com/proguard/manual/troubleshooting#unresolvedclass)
Warning: there were 756 unresolved references to program class members.
         Your input classes appear to be inconsistent.
         You may need to recompile the code.
         (https://www.guardsquare.com/proguard/manual/troubleshooting#unresolvedprogramclassmember)
Unexpected error
java.io.IOException: Please correct the above warnings first.
        at proguard.Initializer.execute(Initializer.java:526) ~[proguard.jar:7.4.1]
        at proguard.pass.PassRunner.run(PassRunner.java:24) ~[proguard.jar:7.4.1]
        at proguard.ProGuard.initialize(ProGuard.java:353) ~[proguard.jar:7.4.1]
        at proguard.ProGuard.execute(ProGuard.java:142) ~[proguard.jar:7.4.1]
        at proguard.ProGuard.main(ProGuard.java:648) ~[proguard.jar:7.4.1]
deep herald
icy beacon
#

do you think i have every spigot api call memorized in my head

deep herald
#

oh

icy beacon
#

test it

deep herald
#

hold on

cosmic quiver
#

How do I get a specific players head here? The getOwner() is in the docs but not defined here?

ItemStack playerHead = new ItemStack(Material.PLAYER_HEAD,1); ItemMeta headMeta = playerHead.getItemMeta(); headMeta.getOwner(): //????

river oracle
#
SkullMeta meta = (SkullMeta) playerHead.getItemMeta();
cosmic quiver
deep herald
#

anyone know why this wont work?

river oracle
deep herald
#

wdym

river oracle
#

guh nvm one second

#

?jd-s

undone axleBOT
river oracle
#

you need one of these

deep herald
#

im on 1.8.8

river oracle
#

in all reality though you really should just be using registerEvents 🥲

#

yeah so that doesn't change anything

deep herald
river oracle
river oracle
deep herald
neat wolf
#

You need to create a new instance of the event class

#

new PlayerCommandSendEvent() to call it

deep herald
icy beacon
#

why are you making it reflectively

#

wtf

neat wolf
#

what do you want to do?

deep herald
icy beacon
deep herald
#

i wanna remove the : in cmds

#

in the cmd map

neat wolf
#

just do new PlayerCommandSendEvent()

icy beacon
#

?learnjava

undone axleBOT
neat wolf
#

to create an object

eternal oxide
#

not really possible in 1.8

deep herald
#

im tyring to register the event

icy beacon
neat wolf
#

you don't need to register it

#

just call it

eternal oxide
#

if you asre on 1.8 the event does not exist

deep herald
neat wolf
#

yeah

#

you have arguments

#

so put in

#

it's a constructor

deep herald
#

there is no player in an on enable lmao

eternal oxide
#

wth? why are you creating a new PlayerCommandSendEvent

quiet ice
eternal oxide
#

that will not send the command map to the player

neat wolf
deep herald
#

IM REGISTERING THE EWVENT

neat wolf
#

you don't need

quiet ice
#

You already did, just get rid of that line

shadow night
quiet ice
#

Bukkit.getPluginManager().registerEvents(this, this); registers your event handler to bukkit

neat wolf
#

the method registerEvent it's not used for registering custom event

neat wolf
#

with this method you can create a callback with an event

neat wolf
deep herald
neat wolf
#

i know

#

so just call your event

#

you don't have to register it

quiet ice
#

Oh, PlayerCommandSendEvent is not a bukkit thing

neat wolf
river oracle
#

you don't use registerEvent to register a custom event you do what Spigot does and call PluginMangaer#callEvent

deep herald
icy beacon
#

is PlayerCommandPreprocessEvent not in 1.8

#

no way

deep herald
#

no

icy beacon
#

wtf

deep herald
river oracle
#

lol legacy moment

neat wolf
eternal oxide
#

You can NOT remove commands with : in 1.8 without a LOT of work and it will be buggy

neat wolf
#

bro just call your event

eternal oxide
#

he's on 1.8, his event will do nothing. Stop telling him to call the event

neat wolf
#

?

#

what's the difference in 1.8 with custom event

eternal oxide
#

he is trying to remove commands with : in therm

#

its NOT a custom event. It just does not exist in 1.8

#

its a Bukkit event but only in later APIs

river oracle
neat wolf
#

I don't understand he created the object on his project

eternal oxide
#

the only way he can do what he wants in 1.8 is to reflect the command map, remove all instances of commands with :, then teleport every player to another world and back again.

deep herald
#

????????????????

eternal oxide
#

yes, auto code completion by the IDE

neat wolf
#

of course it does not exist but nothing prevents him from recode it

eternal oxide
#

oh my

river oracle
#

they don't know

#

1.8 💀 has some scuff

eternal oxide
#

creating the event will not implement the feature

#

it will just be a cuistom event which does nothing

neat wolf
#

yeah i know but his issue was simply to call his event that he created

river oracle
#

and yeah sure he could call it but he's trying to prevent won't be prevented

remote swallow
eternal oxide
#

no thats not his issue

neat wolf
#

so I explained to him that he didn't need to register it

#

then he implements the event it as he wants

eternal oxide
#

his issue is he wants to remove commands with a :. creating a custom event will do nothing

neat wolf
#

ok well he didn't explain it to me

eternal oxide
#

You came late to the table 😉

quiet ice
#

How would the event even be implemented if there is no underlying bukkit API?

remote swallow
#

^^

river oracle
#

you'd have to fork the server

#

which imho pretty much every 1.8 user should be doing

#

if you're using something so old you need to just be using/making a fork

eternal oxide
#

his only way to do it on 1.8 is a nightmare and requires teleporting players to another world and back again to force a command map update on the client

quiet ice
#

Given it is in the onEnable that isn't needed though

eternal oxide
#

unless he reloads

quiet ice
#

ah yes

valid basin
#

Make the void static or use create an instance and use getter (lombok) to obtain class information to be able to use it in different classes

river oracle
#

getter my favorite lombok exclusive feature

neat wolf
#

Has anyone already used ProGuard here?

valid basin
#

I'm having an issue with maven on win 11. Anyone else has the same issue?

river oracle
#

I don't think most here really love the idea of obfucsating plugins

neat wolf
river oracle
#

yeah

#

I know

eternal oxide
#

Some have tried it but it has no real place in a plugin enviroment.

shadow night
#

I personally think all plugins should be open-source

river oracle
#

The only person I know active who uses an obfuscator is Alex, but he doesn't use it to prevent "stealing his code" just to stop lazy people from looking at how he does 1 thing

eternal oxide
#

in a premium plugin all you can do is obfuscate method names and that really does nothign to protect anything

neat wolf
icy beacon
#

"issue" what issue

river oracle
icy beacon
#

my maven works perfectly on win 11

river oracle
neat wolf
eternal oxide
#

Morals

river oracle
valid basin
# icy beacon you gave 0 information

Since I updated I'm having issue with some dependencies. Specifically, geysermc cumulus and item-nbt-api. Even tho I don't have them imported at all

eternal oxide
#

Citizens gets paid a decent amount

valid basin
#

It's like the repo is bugged out

shadow night
valid basin
#

it started to happen once I updated to win 11

eternal oxide
#

Product for free, pay for support

river oracle
#

Most developers also only offer support to people who have purchased their plugin yet aonther insentive to buy it

shadow night
#

most importantly, actually

neat wolf
#

I don't know if so many people want to support small developers

icy beacon
river oracle
icy beacon
#

what is the issue

shadow night
river oracle
#

Stop being paranoid. Here is what obfuscation gets you.
Leaked plugins filled with malware
People requesting help with those leaked plugins (and you may be unknowingly giving it to them without a proper support authorizaiton system)
And 0 more sales than if you just made it open source

shadow night
#

fr

neat wolf
#

So i will try 👀

river oracle
#

if someone isn't going to buy it they won't give a shit if its obfuscated or not

shadow night
#

fr

shadow night
#

and the only thing obfuscation gives you is wasted time on obfuscating your jar

river oracle
#

also leakers are very skilled. they have tooling to deob prey much everything if theirs demand

icy beacon
#

I'm loving it here

river oracle
neat wolf
#

You have convinced me

shadow night
eternal oxide
#

There is a feature for premium plugins (I saw) where it can inject an ID upon download

#

supposed to allow you to match a user to an ID.

shadow night
#

wtf

eternal oxide
#

I never looked into it as I don;t make anything premium

remote swallow
#

yeah thats how most plugins handle the alllowed licensing

shadow night
#

these closed-source people do be trying to protect shit hard

smoky oak
#

wait cant u just be like 'premium here but u can download it here for free'?

neat wolf
#

but you can easily modify the plugin to remove the check in a leaked version ? right?

eternal oxide
#

yes

icy beacon
#

Provide the source code and let them compile it

#

If they can

icy beacon
#

(dont give instructions xD)

#

And then do not give support to those who self-compile

#

Being open-source makes you more trustworthy

eternal oxide
#

even having the whole code base on GitHub you will still be accused of having back doors 😦

neat wolf
#

i think that at least 50 percent of spigot users may not know how to compile a plugin

remote swallow
#

which means they would buy it for the precompiled jar

eternal oxide
#

higher

remote swallow
#

or get malware and take a leak

smoky oak
#

i mea

#

github has a releases page

neat wolf
#

don't publish release

#

with jarfile

eternal oxide
#

It has to be a decent plugin for anyone to bother stealing it though

smoky oak
#

'stealing'?

#

fuck ur on about, if its open source?

eternal oxide
#

what?

#

open source does not mean it's free to take and do as you please

neat wolf
#

we are talking about premium resources that are open source

smoky oak
#

ah

#

we were talking past each other

eternal oxide
#

ah ok

neat wolf
#

anyone can compile it and have it for free

north nova
#

Open-source software (OSS) is computer software that is released under a license in which the copyright holder grants users the rights to use, study, change, and distribute the software and its source code to anyone and for any purpose.

smoky oak
#

i meant this along the line of 'premium resourcce on spigot but if youre broke you can get it for free'

icy beacon
#

Unless you enforce a license it kinda does

north nova
#

"the rights to use, study, change, and distribute the software and its source code to anyone and for any purpose."

north nova
#

so what are you saying

eternal oxide
#

not all OS licences are the same

inner mulch
#

im trying to stack invisible armor stands on top of each other by setting them as passengers (1.20.2). But for some reason they offset in one direction, any1 know why?

north nova
#

right so someone makes an open-source project but the license doesn't allow anyone to do anything with the code or

neat wolf
#

I do not see anything

north nova
#

lol

inner mulch
#

this didnt happen in 1.20.1 tho

#

i could stack them high without the offset backwards

eternal oxide
#

it didn't? I thought it was always over the shoulder

proud badge
#

k so chatgpt gave me this code but I assume it did something wrong since it shows up as red

neat wolf
#

...

proud badge
#

:Skull:

proud badge
#

No chatgpt gave me this

echo basalt
#

💀

eternal oxide
#

ChatGPT lot a few circuits

crimson scarab
#

how can i use better nms mappings

eternal oxide
#

?nms

neat wolf
proud badge
#

Rip

crimson scarab
#

thanks elgarl

neat wolf
proud badge
#

Which function should I use from getting a location from int x y z and worldName string

north nova
#

the... constructor.....

eternal oxide
#

new Location(...

shadow night
#

new Location(...) moment

proud badge
#

Ok thx

neat wolf
#

it's not like python with native fonction

echo basalt
#

?jd moment

undone axleBOT
icy beacon
#

Can I get a bit of help plz?

java.util.concurrent.CompletionException: java.lang.NoClassDefFoundError: org/mariadb/jdbc/type/LineString

Trying to asynchronously save data to the database onDisable and this is what's happening. full stacktrace if relevant
This is the culprit line:

public void updateAsync(final String query, final Object... params) {
    CompletableFuture.runAsync(() -> {
      try {
        update(query, params); // this line
      } catch (final SQLException ex) {
        ex.printStackTrace();
      }
    });
}

public void update(final String query, final Object... params) throws SQLException {
    connect();

    final PreparedStatement statement = connection.prepareStatement(query);
    for (int i = 0; i < params.length; i++) statement.setObject(i + 1, params[i]); // traces to this line
    statement.executeUpdate();
}
#

The class is in the jar, I've checked

remote swallow
#

call Class.forName("linestring path") probably

icy beacon
#

I already call it for the driver in onEnable

#

Is that not enough? 🤔

neat wolf
#

use mysql driver 🤓

icy beacon
#

I'm commissioned to work with mariadb

remote swallow
#

the mysql driver works with maria

icy beacon
#

Hmm

neat wolf
#

yeah

icy beacon
#

I'll try it too

#

One sec I'll just fresh compile tos ee

neat wolf
#

just i have a question

#

what's the difference between com.mysql.cj.jdbc.Driver" and com.mysql.jdbc.Driver"

icy beacon
#

¯_(ツ)_/¯

eternal oxide
#

old and new

remote swallow
#

same thing most likely just one is after a relocation

eternal oxide
#

cj is new

neat wolf
#

ok thank

eternal oxide
#

v4.0 I thin it changed to cj

neat wolf
#

it's been a long time 💀

eternal oxide
#

3 or 4, I don;t remember which

neat wolf
#

They still haven't deleted the other one?

eternal oxide
#

nope

#

still included

#

backward compatability for ClassforName

icy beacon
#

But why does mariadb have a separate driver then?

#

If I can just use mysql's

eternal oxide
#

specifric mariah functions

icy beacon
#

Hmm

#

Also very odd that it worked for a while and then it just stopped

#

I don't think I've changed anything

#

Welp, will go with the mysql driver than

#

Ty 🙂

proud badge
#

Whats the method for obtaining an inventory name? Can't find it on the docs

#

k nvm im reading the discord logs rn and everyone is saying "don't detect inventories by name"

tardy delta
#

look at InventoryView

pliant topaz
#

noone? :(

ruby flint
#

Hello!

#

I need help making a custom plugin that uses integration of luckperms api

#

server error link -> https://pastes.dev/sfOLWDnRIZ

EventTeams is not extending JavaPlugin btw, I'm just instantiating the LP API in its constructor and then calling that constructor in onEnable of EventTeamsPlugin class

event class and stuff :-


  private final EventTeamsPlugin instance;
  private LuckPerms luckPerms;

  public EventTeams(EventTeamsPlugin instance) {
    this.instance = instance;
    this.initLP();
  }

  private void initLP() {
//    RegisteredServiceProvider<LuckPerms> provider = this.instance.getServer().getServicesManager().getRegistration(LuckPerms.class);
//    if (provider != null) {
//      this.luckPerms = provider.getProvider();
    this.luckPerms = this.instance.getServer().getServicesManager().load(LuckPerms.class);
//    }
  }

  public LuckPerms getLuckPerms() {
    return this.luckPerms;
  }
}


public final class EventTeamsPlugin extends JavaPlugin {

  @Override
  public void onEnable() {
    new EventTeams(this);

  }

}```
#

kindly ping me when replying

eternal oxide
#

you don;t have LP on your server

#

add it as a depend in your plugin.yml

ruby flint
#

there is

#

let me show you the exact version too

river oracle
#

add it as a depend in your plugin.yml

frigid forge
#

Is there a way to reduce animal spawns, make them very rare and to reduce group sizes without spigot or bukkit yml configs?

ruby flint
#

Server and LP version:
ver [05:47:11 INFO]: Checking version, please wait... [05:47:11 INFO]: Current: git-Purpur-1985 (MC: 1.19.4)* You are running the latest version lp version [05:47:13 INFO]: [LP] Running LuckPerms v5.4.111.

#

see

river oracle
ruby flint
#

it is

eternal oxide
#

?paste your plugin.yml

undone axleBOT
ruby flint
eternal oxide
#

?fork

undone axleBOT
#

SpigotMC maintains the Spigot server. If you are using a fork of Spigot (such as Paper, Airplane, Purpur, or other derivative works), you should seek support in the appropriate Discord servers.

ruby flint
#

purpur

river oracle
eternal oxide
#

add it as a depend in your plugin.yml not your paper-plugin.yml

#

and delete your paper yml

#

as paper/purpur will still use the spigot plugin.yml

river oracle
eternal oxide
#

I'm going to bet it's a case of purpur not reading the paper yml

#

shoudl be using plugin.yml

ruby flint
#

oh

river oracle
ruby flint
#

wait wait

#

it's not a purpur issue afaik

#

ig so

river oracle
#

this is still not paper

eternal night
#

if you are running purpur, any issue is a purpur issue pretty much

#

no one but purpur pretty much knows all the ins and out as to what they change

ruby flint
#

lol

topaz kestrel
#

I want to migrate my plugin from 1.8.8 to 1.20.4. What are major API changes and how to do it? (already updated the libraries)

eternal night
#

should be mostly fine ? Material has some changes

#

given items were flattened in 1.13

topaz kestrel
#

what else?

river oracle
#

not much

#

lots added

#

a few methods removed

#

if you use Inventory#getTitle irresponsibly that is now gone

topaz kestrel
#

hmm

#

what else has been changed?

river oracle
#

an infinite list of things

#

best bet is to go thrugh every update release since 1.8.8 and look at API changes

#

and that doesn't even cover everything

eternal night
#

or just

#

update the dependency

#

see what breaks

#

find replacement

river oracle
#

that'd be too easy

topaz kestrel
#

I don't want to know every single changes though. I'm just remaking my plugin and I would like to know the major changes

eternal night
#

just try it

ocean hollow
#

what's the best way to format the turret logic? Will I have to create a scheduler for the turret? Or are there better ways?

topaz kestrel
eternal night
#

I mean, no one has a complete list lol

#

?1.8

undone axleBOT
eternal night
#

that shit was 8 years ago

#

like

river oracle
#

legit idfk should be the answer

#

stuffz and things

young knoll
#

Go through the spigot changelog

#

Might take a while

river oracle
eternal night
topaz kestrel
#

I really like 1.8 though but it was getting so annoying when I see people use a simple method in Bukkit which is not available on 1.8, and you'd have to use a lot of NMS code to create it.

inner mulch
#

does somebody know which mob creates the perfect height in between 2 armorstands to create a hologram?

#

i've tried many but they dont seem to work

topaz kestrel
eternal night
#

java 17 is minimum

topaz kestrel
#

is there a summery or something for change log?

topaz kestrel
eternal night
#

I mean, if you write a plugin for other people and want to publish it

#

probably 17

#

if you only code it for yourself, get that 21

river oracle
eternal night
#

we deserve string templates

#

gimme java 22 or whenever that is out of preview

topaz kestrel
eternal night
#

Yea recent java versions are fucking great

atomic swift
#

im trying to set the durability for an item but setDurability is deprecated and afaik your suppose to use ItemMeta#setDamage but that doesnt exist

eternal night
#

you have to cast the item meta to damagable

#
var itemstack = ...;
ItemMeta meta = itemstack.getItemMeta();
if (meta instanceOf Damageable d) d.setDamage(damage);
itemstack.setItemMeta(meta);
topaz kestrel
eternal night
#

hm ?

#

22 should be out like, early 2024

#

they do ~6 month schedules these days

topaz kestrel
#

I don't even know, man.

river oracle
eternal night
#

Same NODDERS

river oracle
#

only hate them because funking minecraft won't update

#

so we are stuck without pattern matching and our beautiful string templates

eternal night
#

dw dw, we will force that 😉

topaz kestrel
river oracle
eternal night
#

honestly tho, they might bump on 1.21

river oracle
#

I hope they do pattern matching is great

#

oh and like virtual threads and stuff but like who tf cares about that shit

eternal night
#

Yeaaa, who cares about virtual threads Kappa

river oracle
#

its finally ready lynx my next great PR

#

Sync chat

#

no more weird async chat 👎 All synced now

#

I also moved the netty threads onto the main thread I figured we didn't need those anyways

paper viper
#

Lag the server 👍
Async server chat 👎

topaz kestrel
#

Why Player is still sync?

paper viper
topaz kestrel
#

Player object should be Async though, to not lag the server.

#

or am I wrong?

eternal night
#

I personally offload my 1+1 calculations off main thread too

#

no lag server

eternal night
topaz kestrel
paper viper
#

when most people refer to "async" they actually mean parallel computing

#

is that what you mean?

#

they are different

eternal night
#

I mean, you cannot have a player "async"

#

at least not in vanilla

quiet ice
#

Which I really don't like.

paper viper
#

also parallel computing is a big thing on its own, not to mention trying to make sure all the tasks sync up at the end

quiet ice
#

Because people, especially newer devs will think "async" means "concurrent", which can be true but does not always mean that

topaz kestrel
eternal night
#

bedrock is a complete redesign

#

it breaks enough shit to make it a near different game

quiet ice
#

Minestom could do it too

river oracle
eternal night
#

minestom is a fancy protocollib version kekwhyper

#

like sure

#

you can implement it then

quiet ice
#

That is why you use minestom-ce to have it be even fancier

#

Although I think minestom-ce got killed; not sure what the current hottest minestom fork is right now

paper viper
#

The state in which Minecraft exists today makes it extremely difficult to parallelize the main server thread without a complete re-architecture of the game's code, which would be agonizingly painful from a mod's perspective. I'm not considering this in Lithium and quite frankly if I was to ever attempt it, I'd just make my own game rather than try to re-build another company's product.

lethal coral
topaz kestrel
lethal coral
#

but once it's up to par it'll be merged to main minestom

#

and it'll be archived

quiet ice
bitter rune
#

Put the server files to read only

#

No idea never tried it but it's essentially what you do when you don't want things over written like config files

#

If you have it set to read only nothing should save

molten hearth
#

alright

#

i have a

#

slight dilemma

#

why does the server like blow up if i getState().update(true, false) on a lectern

#

is there some lectern lore im unaware of

sullen marlin
#

Can you be more specific

molten hearth
#

yeah well i get hit with the ```
09.12 16:06:37 [Server] [ERROR] Too many chained neighbor updates. Skipping the rest. First skipped position: 8159, 66, 7796
09.12 16:06:42 [Server] [ERROR] Too many chained neighbor updates. Skipping the rest. First skipped position: 8159, 66, 7796

#

and the server crashes

#

1 sec

#
@EventHandler
    public void onBlockPhysics(BlockPhysicsEvent event) {
        // Whenever this is ran on a lectern, kaboom
        block.getState().update(true, false);
    }```
rough blaze
#

where would I run this command to add it as a dependency?

mvn install:install-file -Dfile=worldguard-bukkit-7.0.9-dist.jar -DgroupId=com.github.enginehub -DartifactId=worldguard -Dversion=7.0.9 -Dpackaging=jar

chrome beacon
#

In your cmd/terminal

#

Where cwd is the folder with the jar

rough blaze
#

keeps giving me mvn : The term 'mvn' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1

chrome beacon
#

Sounds like it doesn't know where maven is installed

#

If you're on windows add it to your environmental variables

#

Also WorldGuard should have a proper maven repo

#

Not sure why you want to install the jar directly

ruby flint
rough blaze
#

couldnt find any releases

chrome beacon
rough blaze
#

thanks dawg

crimson scarab
#

Failed to register events for class dev.tapwatero.renderer.Renderer because net/minecraft/server/level/ServerLevel does not exist.

river oracle
quaint mantle
#

minestom ce is still operating...

#

upstream isn't being maintained (as far as I know)

#

I think matt is the main maintainer atm

brazen badge
#

anyone knows a link or a video that teach how to make a region manager (cuboid)?

minor garnet
#

how i detect if oak log is facing up?

sullen marlin
#

BlockData -> Orientable -> axis

proud badge
#
        if (command.getName().equalsIgnoreCase("setchatcolour")) {
            if (sender.hasPermission("heeseutils.setchatcolour")) {
                if (sender instanceof Player) {
                    if(args.length == 1) {
                        Player player = (Player) sender;
                        NamespacedKey key = new NamespacedKey(pluginInstance, "player-getter");
                        PersistentDataContainer dataContainer = player.getPersistentDataContainer();
                        dataContainer.set(key, PersistentDataType.STRING, args[0]);
                        sender.sendMessage(ChatColor.YELLOW+"Chat colour updated.");
                    }else{
                        sender.sendMessage(ChatColor.RED+"Too few or too many arguments (must be 1).");
                    }
                }
            }
        }
        return true;
    }```
Any way to make it so it will only accept colour codes for example /setchatcolour &c and people won't be able to do /setchatcolour bum
dry hazel
#

ChatColor probably has methods for lookups

#

you can use those; ensure it could be looked up, fail if it couldn't

primal ermine
#

What has changed with HoverEvent on ChatComponent? This one stopped working since 1.20.2, and now even kicks players using 1.20.4:

cb.event(new HoverEvent(HoverEvent.Action.SHOW_ITEM, new Item(item.getType().getKey().toString(), 1, ItemTag.ofNbt(item.getItemMeta().getAsString()))));
paper viper
#

use adventure

river oracle
#

or report an issue if their is one so we can fix it instead :P

sullen marlin
sullen marlin
river oracle
#

not sure how we are supposed to fix bugs if they're never reported ^

worldly ingot
#

I mean in theory nothing changed. All the unit tests still pass. I don't think I touched hover events either

sullen marlin
#

probably what json/nbt the client accepts changed

worldly ingot
#

That's likely the situation, yeah

#

Also worth noting that it looks like you're using legacy text in your component builder

#

Which is always a bad sign

primal ermine
#

I'm not using bungee. I also noted in 1.20.3 notes that:

color
clickEvent
hoverEvent
hoverEvent[action=show_entity].contents.name
hoverEvent[action=show_item].contents.tag```
#

so that should be the reason for kicking in 1.20.4

worldly ingot
#

Bungee Chat is just the name of the component library that spigot uses. If you have a ComponentBuilder, you're using bungee chat :p

sullen marlin
worldly ingot
#

oic

primal ermine
#

It seems to give totally valid json, but hover is still not happening

#

here's full method (i've changed legacy text):

ItemStack item = p.getInventory().getItemInMainHand();
ComponentBuilder cb = new ComponentBuilder(Util.colors(prefix + p.getName() +  "&7: ") + messageColor);
for (String arg : message) {
    if(arg.toLowerCase().contains("[item]")) {
        String qty = "";
        if(item.getAmount() > 1) qty = " §7x" + item.getAmount();
        ItemMeta itemMeta = item.getItemMeta();
        cb.append(Util.colors("&7"), ComponentBuilder.FormatRetention.FORMATTING);
        Bukkit.broadcastMessage(item.getType().getKey().toString());
        Bukkit.broadcastMessage(item.getItemMeta().getAsString());
        ItemTag tag = ItemTag.ofNbt(itemMeta.getAsString());
        cb.event(new HoverEvent(HoverEvent.Action.SHOW_ITEM, new Item(item.getType().getKey().toString(), 1, tag)));
        if (itemMeta != null && itemMeta.hasDisplayName()) {
            cb.append("§8[§7" + itemMeta.getDisplayName() + qty + "§8]" + messageColor, ComponentBuilder.FormatRetention.FORMATTING);
        } else {
            cb.append("§8[§7", ComponentBuilder.FormatRetention.FORMATTING);
            cb.append(new TranslatableComponent(item.getTranslationKey()));
            cb.append(qty + "§8]" + messageColor, ComponentBuilder.FormatRetention.FORMATTING);
        }
        cb.append(Util.colors(" ") + messageColor, ComponentBuilder.FormatRetention.FORMATTING);
    }
    else {
        cb.append(Util.colors(arg) + " ", ComponentBuilder.FormatRetention.FORMATTING);
    }
}

for (Player onlinePlayer : p.getServer().getOnlinePlayers()) {
    onlinePlayer.spigot().sendMessage(cb.create());
}```
river oracle
#

dangerous game to mix legacy and components

eternal oxide
#

you are calling create on cb multiple times

sullen marlin
#

suspect you should try a minimal example first, eg new ComponentBuilder("test").event(...).create()

primal ermine
#

yeah, that makes sense. but it just weird for me that it has stopped working on 1.20.2 and worked w/o any problems until update

river oracle
#

they started enforcing some things so that's probably it

primal ermine
#

Ok now i'm feeling dumb af because minimal variant works. I should have tried that long time ago....

#

Thanks everyone, gonna reconstruct all that mess now

sullen marlin
frosty relic
#

Any good library to use spigot nms deps without Obfuscation? 🤔

river oracle
#

don't use obfuscated mappings lol

#

that's like so

#

whenever 1.16.4 released

remote swallow
#

we got moj maps in 1.17

#

they released in 1.14

worldly ingot
#

If you find yourself needing to use server internals, consider perhaps if there's a way to make API for it and contribute it to Bukkit. We always appreciate more API

orchid gazelle
#

well, sometimes things are too hacky to get into the API

remote swallow
#

like brigadier

frosty relic
#

I didn't want to get complicated and just added obfuscated dependencies which was easy 🥲 but i have time now and i want to add it i think it will be much more maintainable in the future 😀

pine osprey
#

Hello! I have specific question. Anybody knows which part of the code is in charge of managing the order in the inventory? I'd like to know about the enchanments order trick (no alphabetical). Thanks in advance!!!

wide cipher
#

im using this to download a player's skin from the url, but it's showing an error? anyone know why? PlayerProfile profile = player.getSingle(e).getPlayerProfile(); URL url = profile.getTextures().getSkin(); File path = new File(Skonic.getInstance().getDataFolder(), "skins/" + player.getSingle(e).getName() + "/"); if (!path.exists()){ path.mkdir(); } File file = new File(path.getPath() + "skin_" + player.getSingle(e).getName() + fromDate(getDate()) + ".png"); if (!file.exists()) { file.getParentFile().mkdirs(); try { file.createNewFile(); } catch (IOException ex) { // no-op } } try { BufferedImage img = ImageIO.read(url); ImageIO.write(img, "png", file); } catch (IOException ex) { throw new RuntimeException(ex); } }

eternal oxide
#

You should probably ask in the Skript discord

subtle folio
#

I'm using the team API to configure the overhead and tablist name of my players, is it possible to use hex or bleed over from the prefix text?

#

afaik, team.setColor() only takes ChatColor

young knoll
#

Pretty sure there are only 16 team colors

subtle folio
#

damn, so I'd have to use packets to achieve what I want to do

worldly ingot
#

No, vanilla doesn't support anything beyond the standard 16 colours

#

They just don't exist :p

west prairie
#

Thanks you all for your help, you are the best ❤️

subtle folio
#

i found them in minecraft 2.0

sullen marlin
#

Don't think so

ashen quest
#

if i want to make something like the map thing (the plugin which makes a webapp with the map of the server, and u can chat and stuff from the browser)
what shall I do?
i plan to create a panel like thing but for

  • chatting
  • player actions (bans and stuff)
  • and other server management stuff
#

should i use swift? or javalin? i am afraid i will have to configure the server to let me access its adress or stuff?

weak meteor
#

If i declare the owner of an Inventory instead of giving a null value, anyone but the owner can edit that inv, right?

sullen marlin
#

Uh that doesn't sound right

round finch
#

do you mean the inventoryholder?

echo basalt
#

InventoryHolder shouldn't really be used

#

Fun fact: Tile Entities return a new copy of themselves every time you call getHolder

round finch
#

dammm

#

whos to blame?

wide cipher
#
        URL url = profile.getTextures().getSkin();
        File path = new File(Skonic.getInstance().getDataFolder(), "skins");
        if (!path.exists()){
            path.mkdir();
        }
        File file = new File(path.getPath(), "skin_" + player.getSingle(e).getName() + fromDate(getDate()) + ".jpg");
        if (!file.exists()) {
            file.getParentFile().mkdirs();
            try {
                file.createNewFile();
            } catch (IOException ex) {
                throw new RuntimeException(ex);
            }
        }
        try {
            BufferedImage img = ImageIO.read(url);
            ImageIO.write(img, "jpg", file);
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        }``` this doesn't have any errors but isn't creating the image file
round finch
#

@echo basalt i got a question for you because you seems to got some experiences?
any tip to make good structures or patterns in coding?

echo basalt
#

It really depends on what you expect

#

A few things I have in mind when I'm coding are like

#
  • Is this a point of failure?
  • If I were to expand this system (add a new feature), how hard would it be?
  • How easy is it to explain in simple terms what each part does?
  • What is this file responsible for?
wide cipher
echo basalt
#

So for example I'd never store a Map inside a listener class unless it's some sort of cache

#

Any data would have its own data class

round finch
#

So a good example how not to write code is to think of Notch's code 😂

echo basalt
#

And that data class would have its own manager

#

If I want to make a config parser or something, I make an interface rather than using a Function<String, Whatever>

#

So I can expand it later type deal

#

Here's an easy challenge

round finch
#

whats a parser?

echo basalt
#

Let's say you have different kinds of data, where each kind has a "type" string id, yet they all follow the same parent
An easy example would be minigame map files, every map object extends MinigameMap, yet each map will add onto the base class with its own logic, like a SkywarsMap class requiring a list of locations defined in the config

Here are 4 classes to work with, you can edit any of them:

public class MyMapRegistry {

  public MinigameMap createMap(String type, FileConfiguration config) {
    // TODO
  }
}
public abstract class MinigameMap {
  
  protected final Location spawnLocation;

  protected MinigameMap(Location spawnLocation) {
    this.spawnLocation = spawnLocation;
  }

  public Location getSpawnLocation() {
    return this.spawnLocation;
  }
}
public class BedwarsMap extends MinigameMap {

  private final Map<BedwarsColor, Location> bedLocations = new ConcurrentHashMap<>();

  // TODO
} 
public class SkywarsMap extends MinigameMap {

  private final Collection<Location> chests = new ArrayList<>();

  // TODO
}
#

And let's assume your config looks something like

games/skywars/map-one.yml

spawn-location: "world 0 128 0"
chests:
- "world 10 128 0"
- "world 20 128 0

games/bedwars/map-one.yml

spawn-location: "world2 0 128 0"
bed-locations:
  red: "world2 10 128 0"
  blue "world2 -10 128 0"
#

How would you do it?

#

Assume type is the name of the folder after games

round finch
#

how I would do it?... make some garbage realize it was trash and leave it to do better thats where i'm currently at

echo basalt
#

so bedwars and skywars for example

#

Well here's a solution idea

round finch
#

but you so right breaking it down and be clear what about what i'm trying to achieve would help alot 💚

echo basalt
#
  • Edit the MinigameMap constructor so you can pass a FileConfiguration and add your parseLocation methods on that class
  • Make a constructor on each map class that takes a FileConfiguration, passes it to its super class and fetches the data it needs from there
  • Make a MinigameMapProvider interface with a MinigameMap provide(FileConfiguration config) method
  • On your MyMapRegistry, make a Map<String, MinigameMapProvider> providers map, and register your providers such as register("skywars", SkywarsMap::new)
#

It'd look something like this

public interface MinigameMapProvider {
  MinigameMap provide(FileConfiguration config);
} 
public class MyMapRegistry {

  private final Map<String, MinigameMapProvider> providers = new ConcurrentHashMap<>();

  public MyMapRegistry() {
    registerDefaults();
  }

  public void registerProvider(String type, MinigameMapProvider provider) {
    this.providers.put(type, provider);
  }

  public MinigameMap createMap(String type, FileConfiguration config) {
    MinigameMapProvider provider = this.providers.get(type);

    if(provider == null) {
      return null;
    }

    return provider.provide(config);
  }

  private void registerDefaults() {
    registerProvider("skywars", SkywarsMap::new);
    registerProvider("bedwars", BedwarsMap::new);
  }
}
round finch
#

dam nice minigame core

echo basalt
#

And your map classes would look like

public abstract class MinigameMap {
  
  protected final Location spawnLocation;
  protected final FileConfiguration config;

  protected MinigameMap(FileConfiguration config) {
    this.config = config;

    this.spawnLocation = parseLocation("spawn-location");
  }

  public Location getSpawnLocation() {
    return this.spawnLocation;
  }

  protected Location parseLocation(String name) {
    return ...
  }
}
public class BedwarsMap extends MinigameMap {

  private final Map<BedwarsColor, Location> bedLocations = new ConcurrentHashMap<>();

  public BedwarsMap(FileConfiguration config) {
    super(config);
    
    // get the section n do stuff
  } 
} 
public class SkywarsMap extends MinigameMap {

  private final Collection<Location> chests = new ArrayList<>();

  public SkywarsMap(FileConfiguration config) {
    super(config);

    // get the location list n do stuff
  }
    
}
#

So yeah this Map<String, Interface> pattern is something I use quite a lot

round finch
#

lucky table?

#

if diamond certain lower chance for sharpness and even lower for higher
if iron.. etc

echo basalt
#

Like groups or somn?

round finch
#

i thought as a fun little rpg thing

#

where it generate qaulity loot

#

so diamonds would have lower chance to have higher enchants

#

and iron more then diamond

echo basalt
#

Ehh that's more math

#

You basically just generate a "rarity score"

#

And make an enchant score out of it

#

So if your rarity score is really high, it can be inversely proportional

round finch
#

not bad idea

#

(Material, rarity)

#

Thanks for everything @echo basalt 💚

chilly hearth
#

Bruh

smoky oak
#

given a class A, an instance of class A that may be a subclass called obj, and a subclass of A called B, how can i check that obj and B are the same class? (ie obj a direct instance of B) Instanceof only works one way

slate tinsel
#

Anyone know what this error means / how to solve it?

#

Is it that I am using an outdated version of NMS ex, the one I have now is 1.19.4 but the server is on 1.20.2

quaint mantle
#

Bro

#

Spigot uses obfuscated nms

#

You have to use md5's maven plugin

icy beacon
#

Why is library loading still considered a preview feature? It's been there for so long

sullen marlin
#

No one bothered to update the docs I guess

charred blaze
#

nice hat

slow light
#

Ɓruh what

icy beacon
wide cipher
#

how do you make the config.yml have like explanations rather than just thing: value like # This does that to thing

slow light
#

Intelliji just crashed after telling me to update the towny dependancy to a version that does not exist

slate tinsel
ocean hollow
#

how do I rotate an entity towards another entity?

quaint mantle
#

?nms

ocean hollow
#

nope, I mean just a method that is not local

#

well, like teleport (mathematics)

#

I need to rotate the item Display towards the entity

icy beacon
#

I'm not sure but try subtracting the target entity's direction vector from the entity's that you're trying to rotate

quaint mantle
# ocean hollow I need to rotate the item Display towards the entity

I saw code from php:

$xdiff = $player->x - $e->x;
            $zdiff = $player->z - $e->z;
            $angle = atan2($zdiff, $xdiff);
            $yaw = (($angle * 180) / M_PI) - 90;
            $ydiff = $player->y - $e->y;
            $v = new Vector2($e->x, $e->z);
            $dist = $v->distance($player->x, $player->z);
            $angle = atan2($dist, $ydiff);
            $pitch = (($angle * 180) / M_PI) - 90;
ocean hollow
#

0_0

shadow night
#

Ig you need the yaw and pitch to rotate or something

ocean hollow
#

I understand that I need them, but here’s how to calculate them

ocean hollow
quaint mantle
#

Ask chatgpt to break down the code and explain line to line.

icy beacon
#
// pseudocode
float xdiff = player.x - entity.x;
float zdiff = player.z - entity.z;
float angle = atan2(zdiff, xdiff);
float yaw = ((angle * 180) / PI) - 90;
float ydiff = player.y - entity.y;
Vector vector = new Vector2(entity.x, entity.z);
float dist = vector.distance(player.x, player.z);
float angle = atan2(dist, ydiff);
float pitch = ((angle * 180) / PI) - 90;
#

Somethinglike this

shadow night
#

pretty cool thing

minor junco
# wide cipher how do you make the config.yml have like explanations rather than just ```thing:...

You could use a library, like mine: https://github.com/aparx/bufig-library which makes configs generally more easy. You should also be able to set comments natively with spigot in newer versions

GitHub

Advanced Bukkit configuration wrapper. Advanced and easy way of creating configurations using reflection. Easily add custom behaviour, comments and much more due to the library's modularity...

icy beacon
#

Is there any way to store a primed tnt entity along with its primer?
TNTPrimeEvent does not provide the getPrimedEntity() so I cannot map its UUID to the primer UUID. EntityExplodeEvent does not provide any way to get the entity who primed the explosion either

scenic onyx
#

?paste

undone axleBOT
eternal oxide
scenic onyx
#
 private HikariDataSource hikari;

    public MySQLManager(String host, String database, String username, String password, int port) {
        this.hikari = new HikariDataSource();
        hikari.setDataSourceClassName("com.mysql.jdbc.jdbc2.optional.MysqlDataSource");
        hikari.addDataSourceProperty("serverName", host);
        hikari.addDataSourceProperty("port", port);
        hikari.addDataSourceProperty("databaseName", database);
        hikari.addDataSourceProperty("user", username);
        hikari.addDataSourceProperty("password", password);
    }
#

why get error?

scenic onyx
eternal oxide
#

as the event is cancellable it's not spawned yet

eternal oxide
scenic onyx
scenic onyx
eternal oxide
#

looks fine

#

do you use teh shade plugin?

scenic onyx
eternal oxide
#

you can;t build with artifacts when using maven

#

maven->scope->package

scenic onyx
eternal oxide
#

you DEFINATELY can;t build with artifacts when using maven and multi module

#

is it configured to run maven?

scenic onyx
eternal oxide
#

open your final jar and you will find there is no com/zaxxer folder

scenic onyx
eternal oxide
#

add the maven shade plugin

scenic onyx
#

this is an tutorial?

eternal oxide
#

in your pom```xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>

        <executions>
            <execution>
                <phase>package</phase>
                <goals>
                    <goal>shade</goal>
                </goals>
            </execution>
        </executions>

        <configuration>
            <createDependencyReducedPom>false</createDependencyReducedPom>
        </configuration>
    </plugin>```
#

version is probably old, but

scenic onyx
eternal oxide
#

I don;t know your setup so experiment

scenic onyx
eternal oxide
#

generally it would go in the pom which builds the jar

#

or uses the resource

scenic onyx
#

i try all

eternal oxide
#

put it in teh pom that has the resource

scenic onyx
#

@eternal oxide emmm

#

there is a little problem in the final target

#

hahahaha

blazing ocean
#

How can I disable boat collision?

clear elm
#

hey im tring to learn java rn and guy in yt tutorial say i have to press alt+einfg but i dont get an menu in inteli where i can paste event listeners

#

can some1 help me pls

#

i have minecrfat developemnt instaled

#

the plugin

rotund ravine
#

No

clear elm
#

:((

ocean hollow
#

what do you need to do?

#

create events?

clear elm
glossy venture
#

anyone know how to get a non terminal iterator on a stream

clear elm
#

I need this

ocean hollow
#

just write

clear elm
#

Idk who

shadow night
#

what

clear elm
#

This is the code he gets

#

If I write the import it don’t becomes orange

ocean hollow
#

just rewrite this

scenic onyx
#
[INFO] Scanning for projects...
[INFO] 
[INFO] --------------------< dev.scienziato1pazzo.it:Core >--------------------
[INFO] Building Core 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for dev.scienziato1pazzo.it:Lobby:jar:1.0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for dev.scienziato1pazzo.it:BedWars:jar:1.0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for dev.scienziato1pazzo.it:Utils:jar:1.0-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.124 s
[INFO] Finished at: 2023-12-10T11:46:57+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project Core: Could not resolve dependencies for project dev.scienziato1pazzo.it:Core:jar:1.0-SNAPSHOT: The following artifacts could not be resolved: dev.scienziato1pazzo.it:Lobby:jar:1.0-SNAPSHOT, dev.scienziato1pazzo.it:BedWars:jar:1.0-SNAPSHOT, dev.scienziato1pazzo.it:Utils:jar:1.0-SNAPSHOT: dev.scienziato1pazzo.it:Lobby:jar:1.0-SNAPSHOT was not found in https://hub.spigotmc.org/nexus/content/repositories/snapshots/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of spigotmc-repo has elapsed or updates are forced -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

Process finished with exit code 1
clear elm
#

Don’t work it don’t becomes orange

scenic onyx
#

what is this?

icy beacon
clear elm
#

How can I make that it be used

icy beacon
#

..use it

#

in your code

#

If you import EventHandler and do not use it anywhere in your code it's gray

scenic onyx
#

@clear elm send your code

clear elm
#

If I rewrite whole code should it work

clear elm
icy beacon
#

?learnjava moment i think

undone axleBOT
clear elm
#

I wanna get this but guy in tutorial pasted it from somewhere

#

I try write whole code

scenic onyx
clear elm
#

okay

scenic onyx
clear elm
#

what?

scenic onyx
#

It's useless

clear elm
#

okay

scenic onyx
#

@clear elm I recommend you learn OOP before making any plugins.

clear elm
#

what is OOP?

#

im watching an 40 videos tutorial on youtue where you learn all basics

scenic onyx
clear elm
#

okay

scenic onyx
clear elm
#

are there tutorials for OOP?

scenic onyx
#

it can help you for the basic

clear elm
#

umm buying ?

eternal oxide
#

never pay to learn java

clear elm
#

that means money?

#

90$ holy shit

eternal oxide
#

and do not buy teh MC plugin. Learn hwo to do it by hand first, then buy it if you want to be lazy later

scenic onyx
eternal oxide
#

learn first, then pay for shortcuts if you want

clear elm
eternal oxide
#

good

clear elm
#

how much time you think i need to code till i can make for example home plugin with gui without tutorial

eternal oxide
#

depends how much time you do it each day and how fast you learn

clear elm
#

7g?

scenic onyx
clear elm
#

so less

#

i tought 1 month or more

scenic onyx
clear elm
#

it works i copied code and now import is orange :))

#

NMS?

scenic onyx
clear elm
#

okay

#

i learned minecraft skript before :))

scenic onyx
# clear elm okay

Having been programming for 5 years, I still haven't fully figured it out.

scenic onyx
clear elm
#

you 14 yo?

scenic onyx
remote swallow
#

Nms is esay

scenic onyx
clear elm
#

first i learned configuration than skript and now im tring learn Java

eternal oxide
#

Java is not much harder than Skript

clear elm
#

ik

remote swallow
# scenic onyx no

For most stuff it is untill you get to registries and jank internals

clear elm
scenic onyx
#

@clear elm remember: "When you encounter a bug, it's not an error, but merely an unexpected feature trying to get noticed. Grab your cup of coffee, solve the mystery, and keep coding with determination!"

clear elm
#

sure for example how it should make custom rtp

#

with java OR Skript and skript is easy

scenic onyx
clear elm
#

okay

icy beacon
#

BUY THAT

clear elm
#

i wont

#

im brokie

icy beacon
#

I learnt from Kody Simpson. I knew 0 Java. Now, about 2 years later, I'm getting commissions

#

0$ spent

#

I just coded stuff and learnt from it

#

The very basics I got from Kody

clear elm
#

first thing i will buy is an server i have lokal host its shit xD

icy beacon
#

A server will help yeah

clear elm
icy beacon
#

Just look up Kody Simpson Spigot on youtube

clear elm
#

okay ty

#

i find him :))

icy beacon
#

Gl

#

Though first you really should learn the java basics

scenic onyx
icy beacon
#

?learnjava

undone axleBOT
icy beacon
#

At least the VERY basics

scenic onyx
undone axleBOT
clear elm
#

oh okay but i think i will watch my tutorial

#

it has 40 videos each 10-20 min

icy beacon
#

Tutorials are good, knowing how to do stuff yourselves is even betetr

scenic onyx
icy beacon
#

If you know the basics of Java, you already kinda can work with any API, including Spigot

clear elm
#

i joined

icy beacon
#

So start with that

clear elm
#

yea i wanna watch the tutorail till the end than i will start do smth by my own

icy beacon
#

Yeah

#

Do both at the same time

#

If you can find any exercises for yourself to practice Java that you just learned, that's even better

clear elm
#

okay ty have a good day !

icy beacon
#

You too

smoky oak
#

is a class signature with a variable number of generics possible?

icy beacon
#

I do not think so

#

?xy maybe?

undone axleBOT
eternal oxide
#

you can have a variable number of the same generic

smoky oak
#

ye, im thinking about what you suggested yesterday

#

the <T extends Event, Consumer<T> U> pair

#

bleh i do not know how to write that signature

eternal oxide
#

just ... after the arg

smoky oak
#

ive seen those before, they work in generics?

upper hazel
#

Is it a good idea when creating a large project to move all the repeating code into a separate class like "repetitionUtill"?

#

maybe 800 lines of code will come out

#

I wanted to do it temporarily until I understand the entire structure of the project

eternal oxide
#

yes, no point in repeating code. Just tidy up later

upper hazel
#

but it’s true that when creating a website, the entire basis of backand logic is processing the request?

#

i want try create site

hazy parrot
#

every logic that should not be accessible to user goes to backend

#

ie role managment, database calls, external api calls etc

upper hazel
#

button processing lol

hazy parrot
#

what

upper hazel
#

I just heard recently that backend is easy and all they do is handle requests when a user clicks on a button

smoky oak
#

its not

frigid forge
#

I made my first plugin yesterday, basically it should increase the dropped items realistically on animal death but the issue now is, i need to find the way to make animals harder to find. I did try the spigot and bukkit .yml configs but it didn't help much, is it possible to somehow achieve this in the code?

upper hazel
#

idk but I'm told that frotend is more difficult because of the obligation to adapt the site to different platforms

smoky oak
#

im doing this trying to understand generics rn but.....
isnt T restricted to be Event here?

upper hazel
#

did you reduce the amount of animal spawning?

#

the number of animal spawns per chunk ?

#

etc

frigid forge
upper hazel
frigid forge
#

I found on some forum post that i should increase the number of animals per tick, apparently increasing the default number of 400 i think, will lead in less animals

smoky oak
#

hey @eternal oxide u got a second?

remote swallow
#

Change the map to map<T, consumer<T>>

#

With correct capitals

smoky oak
#

its not about that

#

eh, ill deal with it later

rare rover
#

can you use string templates in mc?

#

cuz isn't the newest version java 19?

young knoll
#

No

#

It’s still 17

rare rover
#

oh, ouch

#

rip

#

alright

lost matrix
rare rover
#

i mean if you run your server on JDK 21 preview it should work

remote swallow
#

21 is fully released

rare rover
#

yes but string templates are a preview thing

remote swallow
#

No need for preview in 21iirc

rare rover
#

wtf intellij lying to me than

remote swallow
#

Oh i thought those got added in 21

rare rover
#

oh nvm

#

i'm just dumb

#

oh no they are preview

#

21 release notes

young knoll
#

Yeah latest should run on 21

#

It's still 17 internally tho

lost matrix
# smoky oak im doing this trying to understand generics rn but..... isnt T restricted to be ...

I think you want something like this:

public class SomeEventHandler {

  private final Map<Class<? extends Event>, List<Consumer<? extends Event>>> listeners = new HashMap<>();

  public <T extends Event> void registerListener(Class<T> eventClass, Consumer<T> listener) {
    listeners.computeIfAbsent(eventClass, k -> new ArrayList<>()).add(listener);
  }

  @SuppressWarnings("unchecked")
  public <T extends Event> void handleEvent(T event) {
    List<Consumer<? extends Event>> eventListeners = listeners.get(event.getClass());
    if (eventListeners != null) {
      eventListeners.forEach(listener -> ((Consumer<T>) listener).accept(event));
    }
  }

}
patent quarry
#

Hello everyone, I'm trying to send multiple resource packs to a player using player.setResourcePack. It seems not working for me, the first sent is replaced by the second.
Someone already succeed to send multiple resource packs to the client using Spigot?

smoky oak
#

i believe those were just fused

#

the api methods request the client to replace it

grim hound
#

when can I send the map packet after join for it to be visible?

#

are there any specific packets I could wait for?

lost matrix
eternal night
lost matrix
#

Right?

patent quarry
eternal night
#

yea

#

1.20.3 allows multiple packs to be applied