#help-development

1 messages · Page 859 of 1

quaint mantle
#

thanks!

shadow night
#

Then if you have a config variable with the FileConfiguration don't forget to set it

sterile token
#

if your settings value into config don't you have to save it and then reload? Maybe i have done it all time wrongly

tender shard
#

if you want to load a changed file, then saving what you have in memory is pointless because you'd only load what you have just saved.

shadow night
#

What if I made an implementation of configuration or whatever you implement that uses nbt

tender shard
#

you NEVER want to load a file that you have just saved half a second ago

#

it never makes any sense

kindred sentinel
#

Is there a way to turn off the light of redstone?

shadow night
#

Isn't light client sided

young knoll
#

No

kindred sentinel
sterile token
shadow night
#

It isn't? Damn

young knoll
#

Only certain components emit light

#

Like repeaters

tender shard
kindred sentinel
tender shard
#

if you first save and then load it again, then why do you load it at all? if you just saved it anyway, you already have all the data you need

kindred sentinel
young knoll
#

You’d have to do some crazy stuff with internals me thinks

kindred sentinel
tulip phoenix
#

Algum brasileiro aqui pode me ajudar ?

tender shard
kindred sentinel
#

I think

tulip phoenix
# tender shard what?

I need some help, when I try to add one of my plugins inside my external library and try to call some method of that plugin that I added, it ends up causing this error: package com.yorkans.factions does not exist

#

I dont understand so much english xD

tender shard
tulip phoenix
#

maven

tender shard
#

did you add the other plugin as <dependency> to your pom?

tulip phoenix
#

that plugin is one that i created, and i cannot do a dependency, or i dont know how

tender shard
#

Imagine this is your first plugin: group de.jeff_media, artifactId Drop2InventoryPlus.

Now you run mvn install on that project in the maven tab. Now, you can add it as dependency to your other project:

<dependency>
  <groupId>de.jeff_media</groupId>
  <artifactId>Drop2InventoryPlus</groupid>
  <version>4.0.0</version>
  <scope>provided</scope>
</dependency>
#

mvn install basically just makes your project available to other projects

tulip phoenix
#

really ?

tender shard
#

yes

tulip phoenix
#

i'll try

kindred sentinel
tender shard
#

lol

#

it's not april 1st yet

#

@full ridge are you using maven or gradle?

full ridge
#

Hi, I'm very new to learning to make plugins (even tho I have a bit of experience with Java) and tried for quite some time now to create a simple 'Hello World' Plugin for a Bukkit server (I know this here is a Spigot Discord, but I couldn't find a bukkit Discord and really have no clue to solve my issue). This is the Code:

import org.bukkit.plugin.java.JavaPlugin;

public class HalloWeltPlugin extends JavaPlugin {
public void onEnable() {
this.getLogger().info("Hallo Welt");
}

public void onDisable() {
}

}

According to the Compiler there are Symbols he can't decipher in line 1 (It points at the dot between java.JavaPlugin), in line 3 (there it points at the J in JavaPlugin) and in line 5 (there it points at the dot between this.getLogger() ). I tried a bunch of stuff but I just can't figure out how to solve it. I hoped someone here could give me a hint in the right direction.

tender shard
#

are oyu using maven or gradle?

full ridge
#

I think maven, at least there are maven jars in my servers library, and no gradle jars

tender shard
#

ok do you have a pom.xml file?

#

if yes, paste it please:

#

?paste

undone axleBOT
kindred sentinel
#

😂

dry hazel
#

sout is bad because it doesn't identify your plugin

full ridge
quiet ice
tender shard
full ridge
#

Thank you : )

quiet ice
tender shard
# full ridge Thank you : )

np! if you follow that step by step, you should basically end up with a working hello world plugin, then you can just expand that.

kindred sentinel
dry hazel
#

using IJ's build system will just hinder you when you need anything more than building a jar

tender shard
#

for example it adds the shade plugin in a totally outdated version, and even sets createDependencyReducedPom to false, why?

#

imho it's better to copy/paste my example plugin and read all the comments to understand what those options do

quiet ice
#

createDependencyReducedPom is only really useful for APIs that have the shaded jar uploaded as a separate artifact

tender shard
#

ofc once one knows those options, sure the IJ plugin is quicker. but to get started I'd rather write it from scratch once

solid cargo
#

back to the eclipse days

tender shard
#

it's just an additional setting that might cause problems later and doesnt give any advantage now

quiet ice
#

Actually there is in this very specific case

#

Outside of the specific case that I just mentioned, there is no real use

tender shard
#

what's the advantage of disabling it?

quiet ice
tender shard
#

why wouldnt it compile with dependency reduced enabled?

quiet ice
tender shard
#

It only removes dependencied that are included in the artifact. Why would someone need them twice?

quiet ice
#

So either you depend on the shaded artifact (which would make a great time for version conflicts) or depend on all the transitive deps manually - not great either.

tender shard
#

Exactly. The dependenc reduced pom also only is for the shaded artifact. If you upload both, the normal pom is still there for the unshaded artifact

quiet ice
#

There is only really a single pom regardless of the classifier of the shaded artifact

#

You seem to be confused with what an artifact is in maven - frankly, it can be anything. In this case the shaded artifact is just a file and shouldn't be confused with being a separate addressable project. The shaded classifier is identical to the sources or javadoc jars (in function from the eyes of a maven resolver).

#

Also the dependency-reduced pom is much more than a simple file. For as long as it is uploaded it will be an additional file (for whatever reason), but once installed on a maven repository it will replace the original pom

tulip phoenix
tender shard
tender shard
quiet ice
#

uh I'll look it up in a sec but I don't actually think that it will

cursive kite
#

How do I check if a "MOVE_TO_OTHER_INVENTORY" moved the item or if the inventory was full and no action happened

young knoll
#

You’d probably have to check if the other inventory can accept it

tender shard
young knoll
#

Via looking for matching stacks that are not full or empty slots

cursive kite
#

Dang it

tender shard
quiet ice
#

I'll test it in a bit, don't worry. I have botched a few releases lately I just realized so there is a good reason to reupload jars regardless :)

tender shard
#

i always thought that when deploying both the shaded and unshaded artifact, there'd be the reduced pom for the shaded artifact and the original pom for the unshaded artifact, but it seems like the reduced pom isn't deployed at all, so I really wonder what it's purpose is supposed to be then

#

from what I just found out though, the deployed pom is always the original pom, no matter whether dependencyReduced is enabled or not

quiet ice
tender shard
#

huh

#

?paste

undone axleBOT
tender shard
#

this is m ypom

#

and it's exactly what ended up in the repo

#

very weird

split lichen
#

Does anyone have a recommendation for an NPC api/library which supports 1.20.4?

tender shard
#

citizens

wet breach
# shadow night Isn't light client sided

depends which light. The redstone itself changing is client side as that is just a change in the state of the redstone itself. As for the light it illuminates however that is server sided

quiet ice
tender shard
#

maybe, i added that so that it deploys both .jars

#

without that it'd only upload the shaded .jar

#

oh wait

#

yours

quiet ice
#

Yeah we both have the attached thingy

tender shard
#

I also used a shadedClassifierName before (i used with-dependencies) and it was the same result

#

really weird lol

quiet ice
#

23:52:37 [INFO] Installing /var/lib/jenkins/workspace/launcher-micromixin/dependency-reduced-pom.xml to /var/lib/jenkins/.m2/repository/org/stianloader/launcher-micromixin/4.0.0/launcher-micromixin-4.0.0.pom

The maven-install-plugin deploys the dependency-reduced-pom for me (see https://stianloader.org/jenkins/job/launcher-micromixin/13/console)

tender shard
#

that also happens when you set a shaded classifier name?

quiet ice
tender shard
#

for me it installs the normal pom???

#

this is so weird lol

quiet ice
#

Yeah I was about to say - what even is the point of the dependency-reduced pom if it doesn't show up in your repo?

tender shard
#

yeah that's what I'm also wondering

#

let me check sth quickly

quiet ice
#

Hm, I use maven-install-plugin 2.4 which is like age-old. Could be the issue? I'll see if I can update it

tender shard
#

but then, yeah, what's the point of that file if it's neither installed nor deployed

#

i'm using the default maven-install-plugin, 3.1.1 as of my mvn version

quiet ice
#

Me too, but I'd assume fedora is a bit outdated

#

Or well for some reason my CI server uses maven 3.8.6 which comes with version 2.4 while my system uses maven 3.9.1 which comes wtih version 3.1.0

#

Ah, that is because my CI server is on fedora 38 for whatever reason. Time to look how to update that.

#

well that starts of great

tender shard
#

🥲

quiet ice
#

Well for some reason I both have Adoptium and Zulu as installed repositories. I guess I'll just ditch the former (which I don't even remember having downloaded).

tender shard
#

since debian finally added adopt 17 in the official repo, I didnt have to mess with any repos for java anymore

quiet ice
#

I believe I have the azul zulu repo for Java 6

inner mulch
#

Hey I'm currently trying to track a whether a player is afk or not, that works fine so far, but when a player is afk and another player moves the player via pushing him, the playermoveevent triggers and tells the server the player isnt afk anymore, any suggestions?

tender shard
young knoll
#

You could mess with disabling pushing for the afk player

kindred sentinel
#

Is there a boat move event?

young knoll
#

Or look for camera movement to consider them not afk

quiet ice
#

Yeah, for whatever ungodly reason people wanted a Java 6 port for one of my projects. Later on they wanted Java 5 but I said no until they can provide me an adequate JDK for that

kindred sentinel
#

Oh thanks

inner mulch
#

is there a specific event?

young knoll
#

The move event

#

Compare the pitch/yaw of the from and to locations

inner mulch
#

okay

#

thanks

tender shard
inner mulch
young knoll
#

Yes

young knoll
#

Please tell me the project is from 10 years ago

quiet ice
#

Well guess twice: It's the legacy modding community

sullen marlin
#

Pretty sure you can get literally anything to run java 8

tender shard
sullen marlin
#

Java 9 is where the issues start

young knoll
#

And people weren’t requesting java 6 support in modern times

inner mulch
quiet ice
tender shard
inner mulch
#

okay

quiet ice
#

It's my wonderful micromixin library

tender shard
young knoll
#

Project from 2022, java version from 2006

quiet ice
#

At least I was born at that point in time

#

Also don't worry, it uses MRJ to make use of newer Java features where appropriate (why the hell did Java 6 not have Throwable#addSuppressed?)

robust helm
#

Regenerating griefed chunks after specific period of time

sullen marlin
#

Cause it is used from try with resources which java 6 didn't have

quiet ice
#

Ah, makes sense though

#

In the end I made my own very horrifying version of addSuppressed

sullen marlin
#

It's really just cosmetic ain't it?

quiet ice
#

Yeah, thankfully

sullen marlin
#

You could just throw the original exception without it?

quiet ice
#

It also includes a line telling the user to update their java - twice for good measure

young knoll
#

Man why doesn’t the Bukkit api work with java 6

quiet ice
#

I could also do a netty and say No further information. Update your java lol

young knoll
#

Encounter an unexpected error: It is not 2006

tender shard
young knoll
#

Ikr

quiet ice
#

@tender shard yep, same thing even with an updated version of maven. Wonders of technology - you don't even understand them

#

I'd hesitate a guess that it isn't me, it's you somehow.

tender shard
remote swallow
#

that would be hilarious if it uses a different file for linux andm ac

tender shard
sullen marlin
#

That's why bukkit also has dependency reduced pom false now

#

It uses the dependency reduced pom for the main artifact, which makes no sense given the main artifact isn't shaded

young knoll
#

Should have used gradle

remote swallow
#

alex will convert to gradle

sullen marlin
#

I assume it's a bug but I'm not sure

tender shard
#

how can the maven version itself even have sth to do with this, it's the shade plugin that's solely reponsible for it, isnt it?

quiet ice
#

It isn't a bug from what I'd say

sullen marlin
quiet ice
#

But it is behaviour that isn't great

sullen marlin
#

I think it is a bug cause it makes no sense otherwise

remote swallow
#

md if i were to learn gradle plugins properly would you make a special source plugin remapper offical

quiet ice
#

It has something to do with how default settings are set up under maven's XML ast

remote swallow
#

thats what i mean

#

if i made it would you make it offical

tender shard
sullen marlin
#

Sure

quiet ice
#

No conditional setting defaults exist under maven that I am aware of

young knoll
#

No pom means no issues with pom

#

Big brain

quiet ice
tender shard
#

gradle's publish-maven plugin sets all dependencies that it decides to include in the pom to runtime scope iirc

quiet ice
tender shard
quiet ice
#

Well it uses compile for everything

inner mulch
#

im using protocollib and i'm listening to for a packet, depending on the packet call a custom event. Why do i get an error saying that i may only call my custom event synchronously even tho im not explicitly calling it async? Does calling an event in a packetlistener make it async or something?

sullen marlin
#

Probably

young knoll
#

Yes

quiet ice
#

However it does make sense once you know how a maven resolver works and these are the correct scopes

remote swallow
tender shard
sullen marlin
#

You need to make your event Async (true to super constructor)

young knoll
#

By default packet listeners are async

tender shard
quiet ice
inner mulch
quiet ice
#

Maven 3X sadly doesn't have a whole lot of scopes - but thankfully maven 4 will change that

tender shard
remote swallow
#

?nms for me

tender shard
#

and if I use api shouldn't it be provided?

quiet ice
#

oh yeah, it doesn't know about dependency-reduced poms or stuff

quiet ice
tender shard
tender shard
#

on the other hand, gradle changes with every version, so I guess it might be different between gradle 8.3 and 9 and 7.X

#

i dont remember on which version I tested it but probably 9.0 or 8.3

quiet ice
#

Yeah - I have to agree that it isn't great, but I cannot really blame gradle for that as it just uses the best equivalent it can find

tender shard
#

yeah there's probably a gradle plugin that lets one specify what it should use for the pom for each dependency

wet breach
#

ultimately dependencies only need to be in the manifest

#

pom is handy I suppose if you want transitive dependencies

tender shard
#

anyway, i guess the proper way to get a working dependency-reduced pom for the shaded artifact, and a proper original pom for the unshaded artifact, is to set shadedArtifactId in the shade plugin instead of using a classifier

#

then one'd just have one artifact for the shaded version and one for the original one with their respective poms

inner mulch
tender shard
#

the name on wiki.vg is Set Player Position

inner mulch
#

okay

#

i will look for it

tender shard
#

protocollib will be Play.Client.Something

#

Play.Client.POSITION

#

and Play.Client.POSITION_LOOK

#

POSITION is actually moving around and POSITION_LOOK is moving the head

#

@inner mulch

wet breach
#

Alex must be in a good mood

#

should consider yourself lucky 🙂

tender shard
#

why can't protocollib just use the mojang package names 🥲

inner mulch
young knoll
#

Yeah plib has weird names

tender shard
#

and wiki.vg also uses some made up names

young knoll
#

Probably because they are super old

tender shard
#

guess I'll have to create a list that maps mojang, wiki.vg and plib names

young knoll
#

I guess before mojmap you just had to make it up

tender shard
#

yeah true

#

but I wonder why there's no page that links all those names together

#

Set Player Position vs Play.Client.POSITION vs ServerboundPlayerInputPacket

#

totally different

inner mulch
#

im currently listening to Play.Client.POSITION and it is fired without the player moving?

rare rover
#

is this a good way to handle nms packet (to improve readability with your project):

#

i feel like its really nice

#

literally just this to send a hologram:

dawn plover
#

Hey everyone. I am trying to create a library with some cool functions so i dont have to copy them over everytime i am creating a new plugin
I currently did everything, (but then how i normally create a library) but it gives big time errors
So i was wondering. is there anyone here who created a library themselvs or knows of a library which i can see the source code of just so i can see how the gradle stuff is done for it
That would greatly help me if that was possible :)

inner mulch
#
                new PacketAdapter(CityBuildCore.getInstance(), ListenerPriority.NORMAL, PacketType.Play.Client.POSITION) {
                    @Override
                    public void onPacketReceiving(PacketEvent event) {
                        if (event.getPacketType() == PacketType.Play.Client.POSITION) {
                            //code
                        }
                    }
                }
        );```
tender shard
inner mulch
#

oh thats smart

tender shard
#

you could e.g. listen to PlayerMoveEvent and print "player moved", then also print out all incoming packet class names, then check your log which packets appear shortly before "player moved"

#

and that should be the correct one

#

might also be that the POSITION packet is sent from time to time without them moving, in those cases the xxA and zzA fields probably both will be 0

inner mulch
#

i guess i would need to check for changes too

tender shard
#

seems like both packets use the absolute coords and not just the moved distance

inner mulch
#

im currently checking and it seems like the POSITION packet is called every now and then

tender shard
#

yeah probably. you can probably just check whether the packet's X and Z (should always be getDoubles().get(0) and .get(2)) are the same as the player#s current X and Z, if yes they didnt move

inner mulch
#

if will try that

tender shard
#

although I'm only guessing all of this, I have no idea if any of this is true lol

inner mulch
#

its okay, i guess its time to find out

#

(for me)

alpine urchin
#

in this case the data types have to align with the protocollib ones

#

but wiki vg is based on the data type in the actual buffer

#

so in some cases wiki vg might claim something to be a byte whilst minecraft inside nms represents it with an int

#

so sometimes people run into issues and get confused, just know wiki vg isn’t exactly documenting NMS

limber mantle
#

hi, i have kinda a complex problem with packets. idk where else to turn to. i run a server with a magic plugin that creates a good amount of particles. this used to be manageable, but at some point they got unmanageable at higher player counts. the type of lag i see is not one that spark can easily track; the tps doesn't go down and the server thread seems to be in good health (see example). instead what happens is the ping gets very high, people start 'teleporting' around, and eventually some of them are kicked due to timeout (but not all) and the server never crashes, but other plugins like discordsrv get bogged down and miss their scheduled tasks that are on different threads. someone called this network overload, and after some testing, i confirmed it is worsened by more of these particles. however this wasn't always a problem, and the magic plugin hasn't changed. i think another plugin is duplicating/copying packets or something and overloading the network, but i'm at a loss for how to track these particle packets to find the source of the problem. i was wondering if there's a way to track them. i have protocollib and i figured another plugin is messing with that, but when i debugged all the packet listeners, none of them had to do with particles. any help would be appreciated

alpine urchin
#

tldr

#

since it has packets ill give it a look XD

limber mantle
#

is there a good way to track all packets

#

specifically worldparticles packets

#

bc i think there's a plugin doing weird shit with them and overloading my network

alpine urchin
#

yeah im not reading ur wssay

#

i dont want to self advertise

#

so

#

but there’s alternatives to protoxollib

#

just so you know

limber mantle
#

the 'essay' is there so ppl would respond with things i didn't already know, no offense

alpine urchin
#

you were talkijg about load

#

and etc

#

so i said there’s alternatives

limber mantle
alpine urchin
#

yes

#

do you mean in protocollib specifically?

limber mantle
#

in general

alpine urchin
#

yes? theres libraries that do that

limber mantle
#

such as?

alpine urchin
#

can’t say

#

or else its self advertising

remote swallow
#

anyone know any decent jda modal util thing

hazy parrot
#

jda ktx only

#

but its kotlin

#

everything other is outdated afaik

limber mantle
#

like if a plugin were somehow manipulating packets

#

would i be able to determine which

tender shard
hazy parrot
#

yeah those are modals

remote swallow
tender shard
#

what's wrong with JDA's builtin stuff?

remote swallow
#

its long

#

i have 15 lines for a 4 entry modal

#

and thats with it going through a small util method

tender shard
#

hm idk I always only use JDA 5

remote swallow
#

im also using jda 5

tender shard
#

the example in their javadocs doesn't look too bad though?

alpine urchin
remote swallow
limber mantle
#

it was in the 'essay' you didn't want to read

alpine urchin
limber mantle
#

the reason i want to track packets is bc i think a plugin is manipulating them and causing overload

alpine urchin
#

find out

#

which plugin itnis

#

and then we can move on and look intobwhy

#

thats the best approach

#

this is kind of an

#

?xy

undone axleBOT
limber mantle
#

it's kinda more complicated than that

#

anyway

#

ty for the help

#

not rly tho

alpine urchin
#

if you find out which packet plugin

#

is causing this load

#

we can look intonit

#

and move on

#

but if you want to do it your own way go ahead

quiet ice
#

@aztl in the worst case you could use ignite and mixin into the relevant packet classes and see if there is suspicious activity from there. Injecting into the netty pipeline would be another way to go about this. Regardless this is a rather complicated problem as you stated earlier and I suppose I am of not much better help (especially given that such diagnostics will probably take a while), but those would be the ideas I'd have from the first go.

#

Ah bruh they seriously left

#

Well - their loss

river oracle
#

So right now I have a map that does something and uses a class as a key. However I ran into a bit of an issue. Because the craft classes aren't in this map all of the keys will return null. e.g. org.bukkit.craftbukkit.v1_20_R3.inventory.CraftShapedRecipe inherits, but isn't org.bukkit.inventory.ShapedRecipe

kind hatch
#

Isn't that where generics can come in?

river oracle
#

is there any way to get around this or should I just make my own data structure for this

river oracle
#

it's the key so how would I express that type in the key

#
        this.functions = new HashMap<>();
        functions.put(ShapedRecipe.class, new ShapedUncrafter());
        functions.put(ShapelessRecipe.class, new ShapelessUncrafter());
young knoll
#

It’s possible to extract the Bukkit interface from the impl class

river oracle
#

guh that's annoying my own data structure it is ig I wonder if I can actually get O(1) probably not huh

young knoll
#

¯_(ツ)_/¯

river oracle
#

prolly just an ArrayList with a loop then of Class#isAssignable

quiet ice
#

You might get away getting the interfaces that a class implements but that is hacky his grandfather (as some Germans would say 😉)

young knoll
#

You don’t want to use Class.getInterfaces?

river oracle
#

but then I have to loop over every interface anyway

#

isAssignable is probably just as effective here

young knoll
#

There shouldn’t be many

#

But yeah

quiet ice
#

Or just assume it is the length of 1

river oracle
#

that's dangerous with CB

quiet ice
#

Pft

young knoll
#

Me omw to add more interfaces to the recipe impls

quiet ice
#

But why?

young knoll
#

Fun

tender shard
river oracle
young knoll
#

Yes but that isn’t the impl

#

CraftShapedRecipe or whatever should only implement ShapedRecipe

quiet ice
tender shard
#

oh wait, I thought ShapedRecipe and CraftingRecipe would be interfaces

#

they're not

river oracle
#

well not every recipe is guarenteed to be Craft though

#

that's the thing

#

so either way its to map calls ig

young knoll
#

Oh wait

#

Is it like itemstack

river oracle
#

I could actually cheat here

#

and insert them into the map

#

after one run

tender shard
quiet ice
#

"X sein Großvater" - never heard that?

young knoll
#

Ugh it is kinda like ItemStack

#

Where there is a Bukkit and CraftBukkit version

#

Blah

tender shard
quiet ice
#

Well now you did

tender shard
#

thanks!

quiet ice
#

Probably is an Odenwald thing then

river oracle
#

@young knoll I've decided I'm kinda gonna use your idea. On the first run I'm going to iterate and find it's bukkit type and then cheat and add it to the map after it's run once so it never has to do a calculation for that type again

young knoll
#

Fair

#

Or you could add the Bukkit types manually :p

quiet ice
#

Anyways use my genius "ClassWrapper" API to cache isAssignableFrom on the fly for maximum performance!

Well probably a bit overkill since you don't want to compute the frames of classes

young knoll
#

Ah wait you do do that

#

Yeah I see

sturdy heron
#

Convert Pitch and Yaw to Quaternion

tribal quarry
#

Sorry, I might be wrong, but I haven't found weakhashset that acts like queues, but there might be some weak queues or weak arraylists in java or other utils.

hoary light
#

Oh tysm! It work!

sterile token
#

Suppose you are planning the design of a command framework system. And you have to think about how to structure the classes taking into account that there may be commands that have no arguments and commands that contain sub-commands. But arriving at a final result where you would have to be able to support commands in tree format, how would you design it?

quaint mantle
#

Make it so we could create an instance of a VeranoCommand (or whatever name you wish), then we could call getArg(String arg)

sterile token
# quaint mantle Similar to bukkit's ConfigurationSection

oh allright, something like a Command class with common things and 2 implementations, one for commands which dont have any direct association like a health command and compose one, like /faction which has many arguments and sub commands as childs

#

Like how a n tree works

quaint mantle
#

Inside getArg, it would check if String[] args length is enough

#

If not, it returns null

sterile token
quaint mantle
#

Else it would return a CommandSection (or whatever you wish to name)

sterile token
#

Are you current free? Maybe i can ask specific questions

quaint mantle
#

That CommandSection would also track the length of String[] args in case the dev wishes to do getArg(String arg) again

quaint mantle
undone moon
#

HI
how to send data from plugin to plugin

tame wolf
#

?xy

undone axleBOT
mighty crane
#

Hello!
Is there a way to 'convert' a set of commands into plugin code?
(I want to 'convert' these for example: /summon armor_stand -227.50 74.00 -15.50 {Silent:1b,Small:1b,Invisible:1b,NoBasePlate:1b,Motion:[-4.5,2.0,0.15],Tags:["travel"]} and after that /ride {player} mount {the armor stand})

minor junco
#

No idea what you mean with converting commands to plugin code

wet breach
undone moon
#

ok how

wet breach
#

from the intuitive to the very archaic of ways

lost matrix
# undone moon HI how to send data from plugin to plugin

There is not really a special way of "sending data from plugin to plugin" because all plugins
are loaded by the same classloader in the same jvm, meaning you have access to all the data of all plugins.
However, if you want to notify other plugins about special functionality being executed, then you can simply
implement a new Event and fire it. Other plugins can subscribe to them.

shadow night
#

I've recently tried using javalin in a spigot plugin and I had some error, I found out from a gh issue it's due to the modified classloader or whatever. Can somebody explain what that means and why that could possibly break a library

minor junco
#

💀

lost matrix
minor junco
# undone moon ok how

Have your receiver be the dependency of the sender and interact with a common interface

wet breach
#

so something in one classloader doesn't automatically mean it is discoverable by another

#

unless its a parent or a child then most times it is

shadow night
#

Hmm

wet breach
#

the only thing that is important is as long as the JVM can find it, not that other things in the JVM can find it

#

there are methods however to find something in another classloader, its just not automatic is all

lost matrix
shadow night
wet breach
#

are you shading it?

shadow night
#

Yeah

#

Or more like shadowing it because for some reason I decided to go with gradle

wet breach
#

then there is a dependency it needs access to that for whatever reason isn't being accessible from the plugin loader

wet breach
dry hazel
#

it just seems that javalin/jetty uses the current thread's context class loader to search for something and that doesn't have the dep, so you temporarily have to swap it with your plugin's one for instantiation

shadow night
wet breach
#

it doesn't show the error

#

not sure how you are expect me to know what java.lang.run refers to when its not complete

shadow night
#

I don't remember if I had the exact same error, but I think yes

[ERROR] java.lang.RuntimeException: javax.servlet.ServletException: java.lang.RuntimeException: Unable to load org.eclipse.jetty.websocket.server.WebSocketServerFactory
        ...
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.websocket.server.WebSocketServerFactory```
wet breach
upper hazel
#

what is the best event option to choose to impose an effect on a player if there is a certain item in his main hand?

shadow night
shadow night
dry hazel
#

not sure why it uses the context class loader in the first place though

wet breach
#

which also makes sense

#

the easy solution if its a JVM lib, is to see if said lib can just be included as well 🙂

#

sometimes jvm libs have alternative libs to be used in projects instead

#

since you can't guarantee the JVM environment your application will run in

shadow night
wet breach
#

well at least with java its just that not all JDK's are equal

shadow night
#

Luckily

wet breach
#

even if they are, not everyone sets up their environments the same

shadow night
dry hazel
#

to me it seems like it's just searching for implementations of a class using ServiceLoader or something similar

wet breach
#

you can exclude JVM libs arbitrarily

#

or you can add

#

just because there is default ones doesn't mean these are concrete

#

There is System Libs and User libs too

#

system libs are included in the JVM regardless of the user, where as user ones depends which user invoked java

shadow night
#

I love java for not forcing me to make three different implementations of the same function because of os differences

wet breach
#

lol

#

anyways, probably worth though figuring out what is its trying to find

#

seems a bit short sighted on the developers part that they make use of the class loader to do some kind of searching

#

knowing its error prone

shadow night
wet breach
#

oh that could be

dry hazel
#

well searching for services is common for example, but it's on them or one of their dependencies that it uses the context class loader for whatever reason

wet breach
#

can always learn something new 🙂

shadow night
dry hazel
#

never read a timings report if you're asking that

wet breach
#

if you had paid attention to the conversation or just scroll up, the solution(s) should be fairly obvious

proper cosmos
#

Hello, guys. I have this code for getting EntityType from String. java EntityType mob = Arrays.stream(EntityType.values()) .filter(EntityType::isSpawnable) .filter(e -> e.name().equalsIgnoreCase(item.getMessage().replaceAll(" ", "_"))).findAny().orElse(null);

#

And I only want to get passive mobs

sullen marlin
#

Probably then filter EntityType#getEntityClass isAssignableFrom(Mob.class)?

#

Or Creature.class

proper cosmos
tribal valve
#

i want to make so that the player can't destroy map blocks, and idk if i should like get all of the blocks on start and check if desteoyed block is inside a list of map blocks or if i should make a list at the start of the game that contains all of the blocks player placed

proper cosmos
#

or adding nbt data to block

tribal valve
#

im just wondering about performace, if like 8/16 players would just crash the server by placing blocks so much and destroying them real fast, the list would probably store about 2k blocks

#

so yea im just wondering about performace

proper cosmos
#

ye that's the problem

#

so you can add nbt data/ persistant data (depends if you want to remeber blocks after restart)

shadow night
#

hmm

tribal valve
proper cosmos
#

wdym

tribal valve
proper cosmos
#

so setting metaData to block would be good

#

or just check how other popular bedwars plugins do it

tribal valve
#

okay ill check thanks

upper hazel
#

What is the best way to save hash data to a file when the plugin is turned off or immediately ?

#

or do autosave

proper cosmos
#

but if you want to save on normal stop

shadow night
upper hazel
#

what is the safest option

proper cosmos
#

just saveConfig onDisable

proper cosmos
upper hazel
shadow night
#

what

proper cosmos
upper hazel
#

I was told to put it in a file.

proper cosmos
#

but as RaydanOMG said you should use database

upper hazel
#

ok

#

i gess autosave this best option

proper cosmos
#

Just use Integer

shadow night
#

or in case your economy is a bit fucked a long

upper hazel
upper hazel
amber dawn
#

Hi, i need help registering the kills and the deaths of a player in a virtual inventory that i created but this seems to not function... any help? https://pastebin.com/Mp368U8n the problem with this is that the itemmeta doesnt show up

#

also im a beginner at spigot development so I'm sorry for the mess

chrome beacon
#

That code is going to cause problems

#

They way you've written it means it only works for one person at a time

amber dawn
#

can you fix it please? i'm desperate

chrome beacon
#

If you want someone to write it for you;

#

?services

undone axleBOT
fair breach
#

hi, I would like to add a store system to my plugin (with inventories) with submenus for individual categories ecc. What would be my options to implement this, or is there a library that can help me?

chrome beacon
#

There are plenty of inventory libraries to choose from

#

IF, InventoryGui and InvUI just to name a few

hazy parrot
proud badge
#

if I have some objects with strings that should be empty/not exist, would it be better to use "" or just null?

next plume
#

Empty and not exist are two different things.
In general, use "" for empty and null for non-existent.

wet breach
#

statistics track this

#

just pull the info from there

#

or I at least I am pretty sure it does

tender shard
ornate heart
#

This has probably been asked a lot but does World#hasStorm guarantee that it's raining if it returns true?

#

and if not, how could I figure out if it's raining?

agile hollow
#

if i want make a public method for an item how i have to do it?

tender shard
#

whether it's raining or not depends on the biome

agile hollow
# tender shard ?

i want to get an item everytime with the same name etc and for that i put it in a method but what method?

tender shard
#
public ItemStack getMyItem() {
  return myItemStack;
}

??

agile hollow
shadow night
#

If I get an instance of an itemstack and put it in two different inventories, will it still be considered the same itemstack and be linked like using an update suppressor or does bukkit do something against

tender shard
shadow night
#

Sounds like a java skill issue to me

tender shard
undone axleBOT
agile hollow
light surge
tender shard
light surge
#

But that is'nt the width and height right?

tender shard
#

what are you trying to achieve by changing the leftRotation?

#

if you want to rotate it, change the location's pitch/yaw and teleport it

light surge
#

Now i see, thanks for your help for clearing things up!

minor ivy
#

Hello, quick question, I want to create a plugin on minecraft in java, and I ask myself the following question, how to communicate with my database?
Is there an ORM like EF in C#?
Should I do my sql queries manually and convert them to java obj?
Is there a lib that allows me to map my SQL requests directly to my objs?

What do you advice me ?

upper hazel
#

multimap work with "for" correct?

tender shard
minor ivy
upper hazel
#

so this will not work?

eternal night
#

forEach != for-each loop

tender shard
upper hazel
eternal night
#

yes

#

.forEach will work as you'd expect

#

for(Entry<String, String> entry : multiMap) will not compile

upper hazel
#

in 1 step

eternal night
#

Performs the given action for all key-value pairs contained in this multimap. If an ordering is specified by the Multimap implementation, actions will be performed in the order of iteration of entries(). Exceptions thrown by the action are relayed to the caller.
To loop over all keys and their associated value collections, write Multimaps.asMap(multimap).forEach((key, valueCollection) -> action()).#

agile hollow
#

i done smth like that


    public static ItemStack getFreezeItem() {
        return freezeItem;
    }

    private static ItemStack createFreezeItem() {
        return getItem(new ItemStack(Material.ICE), "&aFreeze", "&aQuesto Item ti permettera' di freezare la persona su cui farai tasto destro!");
    }```
but i'm getting nothing when i do smth like that:
```            if(player.getInventory().contains(Inventories.getFreezeItem())) {
                player.getInventory().remove(Inventories.getFreezeItem());
               
            }```
shadow night
#

I think you don't need to check contains when removing stuff

agile hollow
shadow night
#

remove should check that, atleast that's what ij always tells me

ornate heart
elder harness
#

Is it a known issue that from time to time plugins throw a "NoSuchMethodException" on some types? A reload "fixes" the issue, but I have never known what is causing it to happen

eternal night
#

don't replace your jar at runtime. Reloads are a pretty nasty concept.

elder harness
#

Thank you. That is probably it :p

elder harness
eternal night
#

you can look into hot-swapping

shadow night
#

I just run older versions cuz they load fast 💀

elder harness
#

Hot swapping, meaning only building files with detected changes?

#

That wouldn't make much sense when you build a .jar that is a single file on itself

shadow night
#

Hot swapping is when you replace class files afaik

eternal night
#

lemme see if I can find you the article

elder harness
#

Ah right. Thx

eternal night
shadow night
#

There's still a chance it'll break

eternal night
#

Yea for sure ^ in which case, you'd need to restart

shadow night
#

So, if you ever have issues you can't fix or even find, restart

eternal night
#

but for like small changes where you just end up changing a couple numbers of if statements

#

it should work well

wary harness
#

Hey I got this problem

#

from some reason my config can't be loaded on 1.8

#

and it is strange it worked before

#

works on latest version

#

I used those yaml validators files is fine

#

but this error is sayign there is special charact at 9387 position

#

and nothing is there

tender shard
#

send your config

wary harness
#

this is code which is loading that file

minor junco
#

Oh Lord, you have a manual configuration for all the commands

echo basalt
#

it's probably juyst the diamond symbol

wary harness
#

so any one can translate how they want

echo basalt
#

I pray they aren't all on the same class

wary harness
#

and it is not diamond

#

I tried use BoosteYaml and it load it with not problem

wary harness
#

here xd

echo basalt
#

oh yeah I remember forking your stuff

#

not fun at all iirc

wary harness
#

he he

young knoll
#

oof

wary harness
#

I need one hour first to figure it out where is what 🤣

hushed spindle
#

?paste

undone axleBOT
wary harness
#

this just looks beautiful

hushed spindle
#

so i often get an exception like this
https://paste.md-5.net/ajonoxejil.bash
which happens in a consistent but strange way. i have custom guis in my plugin and the error occurs when i join a server, open a gui, leave and rejoin the server, and then open up a gui again
as far as I can tell CancelledPacketHandleException occurs when a packet is sent to the player asynchronously, but as far as i know i'm not doing that. a couple guis are building items asynchronously and then inserting them into the menu with a callback, but it happens to any gui and not just those
any idea how i could go about finding out where i'm apparently sending a packet async?

minor junco
# wary harness so any one can translate how they want

You could also just create placeholder line(s) that automatically are aggregated and populated with each descriptive command node there is. And additionally (programmatically) create key / value pairs in your configuration being the description of each command

#

That makes things a lot better but so do you

inner mulch
#

is a base64 decoder the best for saving inventory contents in a db, or is there another approach?

eternal night
#

I mean, most DBs should just support plain binary ?

inner mulch
#

so i should convert the inventory into binary?

eternal night
#

Well depends on how you serialise your inventory

inner mulch
#

im currently not really doing anything with the inventory

echo basalt
#

The popular approach is to just use the bkkit object output stream

minor junco
#

you can serialize it to an object output stream and push that to the database no? If your database doesn't support that you could add some kind of adapter that handles the underlying conversion / queries

echo basalt
#

Which is nice in my case because I just wrote a system to convert between multiple inventory sync projects

inner mulch
echo basalt
inner mulch
#

thanks

inner mulch
wary harness
echo basalt
inner mulch
echo basalt
#

nop

#

just store it as TEXT

inner mulch
#

okay

#

no varchar?

echo basalt
#

no

inner mulch
#

okay

spare hazel
#

how can i change a magma cube's size

chrome beacon
#

You call setSize on it

spare hazel
chrome beacon
#

That's not how you cast and call a method on one line

spare hazel
#

oh i fixed it

plucky skiff
#

I have this code:

    @EventHandler
    public void onItemSwap(PlayerItemHeldEvent event) {

        Player player = event.getPlayer();

        if (!isActivated.contains(player.getUniqueId())) return;

        event.setCancelled(true);

        for(Player onlinePlayer : Bukkit.getOnlinePlayers()) {

            if (onlinePlayer.getUniqueId() == player.getUniqueId()) continue;
            onlinePlayer.sendEquipmentChange(player, EquipmentSlot.HAND, event.getPlayer().getInventory().getItemInMainHand());

        }

        player.getInventory().setHeldItemSlot(event.getNewSlot());

        for(Player onlinePlayer : Bukkit.getOnlinePlayers()) {

            if (onlinePlayer.getUniqueId() == player.getUniqueId()) continue;
            onlinePlayer.sendEquipmentChange(player, EquipmentSlot.HAND, new ItemStack(Material.AIR))

        }
}

And it's supposed to make the item invisible on item swap if it is activate. But for some reason, it does activate, it does get the players, but it doesn't send the equipment change packet...
I cancel the event because I need to make that happen after the slot has been changed, so I change it myself, since the PlayerItemHeldEvent happens before you switch an item.

Does anyone know why it doesn't work?

spare hazel
#
public void onEntityDamage(EntityDamageByEntityEvent e) {
        ArmorStand fire = (ArmorStand) e.getDamager().getWorld().spawnEntity(e.getEntity().getLocation(), EntityType.ARMOR_STAND);

        fire.setInvulnerable(true);
        fire.setArms(false);
        fire.setVisible(false);
        fire.setHelmet(new ItemStack(Material.GOLD_BLOCK));
        fire.setVelocity(new Vector(5, 0, 5));
        Bukkit.getScheduler().runTaskLater(IranSkyEntities.getInstance(), () -> {
            fire.setHealth(-1);
        }, 10L);
    }

am i doing this right? i want it to be an effect that moves and then dies

chrome beacon
#

If you want to modify a spawned entity used the spawn method that accepts a consumer

#

That way it can be spawned with the settings you want instead of spawned and then modified

spare hazel
#

how can i kill an entity

chrome beacon
#

Call remove on it

chrome beacon
lost matrix
spare hazel
#

alr thanks

#

how can i check to see if the entity is removed or not

chrome beacon
#

Try isDead or isValid

spare hazel
#

i spawned a magmacube with 10K health but it spawns with 50 health

#

why

echo basalt
#

Attribute modifiers or something idk I'm not a magma cube

hushed spindle
spare hazel
#

hmmm

#

how

hushed spindle
#

setting max health to 10k doesnt set current health to 10k

#

LivingEntity#setHealth() lol

spare hazel
#
public void setEntityStats(LivingEntity entity){
        entity.getAttribute(Attribute.GENERIC_ARMOR).setBaseValue(sDefense);
        entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(sHealth);
        entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(sHealth);
        entity.setHealth(sHealth);
        try{entity.getAttribute(Attribute.GENERIC_ATTACK_DAMAGE).setBaseValue(sDamage);}catch(Exception ignore){}
        entity.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(sSpeed);
    }
#

heres what i did

hushed spindle
#

why are you setting generic max health twice

spare hazel
#

before a hit

echo basalt
#

yet another hypixel skyblock copy

eternal night
hushed spindle
#

classic

#

and what are you using to display their health like that

echo basalt
#

setDisplayName

hushed spindle
#

ok no shit lol

#

what about their health

#

are you doing getHealth or their health attribute

#

and are you updating it after it takes damage

mighty crane
#

Is it possible to execute a piece of code when a player enters a defined space?

#

if yes, how?

eternal night
#

Well, if you have stuff like world guard, there are events for that

#

if you don't you end up basically having to check either on PlayerMove or every tick if a player is in the area you defined

mighty crane
#

oh rip

hushed spindle
#

seems overkill

eternal night
#

is that the entire stacktrace ?

hushed spindle
#

yup

#

theres no reference to my code

#

hence why its hard to find

#

it specifically happens with custom inventories if that matters

eternal night
#

Well I expected it to at least have some context on where the "CancelledPacketHandleException" is thrown but rip

gritty lake
#

Hi

How can i reforward command from bungee to server? for 1.19+ clients?
Like sc.unsafe().sendPacket((DefinedPacket) new Chat(e.getMessage())); no longer work it kicks the player but works fine for below 1.19

So now i tried
sc.unsafe().sendPacket( new SystemChat(e.getMessage(), ChatMessageType.SYSTEM.ordinal() ) ); but that does not work either :S i see bungeecord use systemchat

hushed spindle
#

ive been pondering this bug for a week now lol

eternal night
#

Well I mean, ValhallaMMO seems closed source so I guess not much to look at ?

hushed spindle
#

its open

eternal night
#

link pls

hushed spindle
eternal night
#

not linked on their spigot page

#

merci

hushed spindle
#

oh i didnt? fuck

plucky skiff
mighty crane
hushed spindle
#

also my apologies in advance for the horror you will face in this repo

eternal night
#

is this replicable ?

#

like, can I replicate that by just downloading the plugin and running /skills

#

the stacktrace indeed does not give much

hushed spindle
#

its very replicable, though the version on spigot isnt whats on github

#

its a rewrite

eternal night
#

oh

#

well kekwhyper

hushed spindle
#

but it specifically only happens when someone joins, opens a gui, leaves and joins, and opens a gui again

#

which is like ???????????

#

so you're basically not allowed to relog

#

thought that maybe its because some guis build their items asynchronously and populate the menu with a callback but making it all sync again didnt resolve it

eternal night
#

👀

hushed spindle
#

thought that it might also be with some packet listening which is also async, but removing that also didnt work

quaint mantle
#

so I am very new but am just trying to make a simple plugin that will send me to my hub server, I have a test command which works but I am just confused on why my server is saying that i am using a legacy plugin.
[09:34:26 WARN]: [org.bukkit.craftbukkit.v1_20_R1.legacy.CraftLegacy] Initializing Legacy Material Support. Unless you have legacy plugins and/or data this is a bug!
[09:34:27 WARN]: Legacy plugin first_plugin v0.0.6 does not specify an api-version.
it says I do not specify a api-version but I do https://pastebin.com/7unzGrW8 any ideas on the stupid mistake I made?

echo basalt
#

gui population can be done async iirc

hushed spindle
#

could it be because im using InventoryHolder for the custom guis

#

because i know thats a sin lol

echo basalt
#

ew

#

I looked into it

#

Basically all vanilla inventories copy the entire holder when you call getHolder

#

And that in turn copies the entire inv

#

There is no problem when the check passes, it's when it fails that's the problem

hushed spindle
#

i understand why its a sin but its like a relic of the past when i didnt know any better and i just havent gotten around to improving that

#

still shouldnt be throwing CancelledPacketHandleException though right

eternal night
#

I mean, probably easiest for you would be to just attach a debugger and go for it

hushed spindle
#

debug how

eternal night
#

like, intellij debugger

hushed spindle
#

ive already checked if the gui is being opened async and its not

quaint mantle
eternal night
#

throw a breakpoint

hushed spindle
#

wait you can do that with plugins?

eternal night
#

yea ?

#

o.O

hushed spindle
#

how do you do that, you cant run plugins just like that can you

eternal night
#

the thing that is basically fucking you is PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel())

#

well you start the server with the flags

#

that IJ provides

#

and then you just attach

#

like, you add -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005 to the start script

#

and then you can do a normal remote jvm debug configuration

#

¯_(ツ)_/¯

hushed spindle
#

oh shit

#

how's nobody told me that in 4 years

eternal night
#

issue is, server mappings will fuck you

quaint mantle
#

woah

eternal night
#

so like, you cannot jump into the server code to see what happens

#

if you want a tutorial to forllow

#

additionally, add -Ddisable.watchdog to your startup to disable the watchdog

#

otherwise your server will kill itself after like 10 seconds of the main thread being stuck at your break point

hushed spindle
#

thats rad

#

now the question is where the hell do i put my break point lol

#

my code wasnt referenced at all

quaint mantle
eternal night
#

I'd just smack it on top of your skills command and then step over

hushed spindle
#

ill see if that does anything

eternal night
iron cave
#

You don't need the extra 0

quaint mantle
spare hazel
mighty crane
# eternal night if you don't you end up basically having to check either on PlayerMove or every...

I'm guessing this will create a lot of lag?

public class PlayerMoveEventListener implements Listener {

    @EventHandler
    public void onPlayerMoveEvent(PlayerMoveEvent event) {
        if (event.hasChangedBlock()) {
            Player player = event.getPlayer();
            Location to = event.getTo();
            if (to.getBlockX() >= -225 && to.getBlockX() <= -223 && to.getBlockY() >= 73 && to.getBlockY() <= 77 && to.getBlockZ() >= -16 && to.getBlockZ() <= -14) {
                //code
            }
        }
    }
}
lunar wigeon
#

no

mighty crane
#

oh ok

hushed spindle
# eternal night

it literally jumps straight to the error the moment it gets to the menu creation part, like it doesnt even step through the gui constructor or the open() method

#

do you know what i can do with that lol

#

straight to this

minor junco
shadow night
#

Isn't gonna do a lot

hushed spindle
#

ah actually i just had to put break points in those methods too, didnt realize that

#

exception is thrown at Player#openInventory() it seems

#

which i guess would be the packet thats apparently sent async

mighty crane
minor junco
#

I mean on a nanosecond scale (maybe even millisecond) it will definitely have a performance "impact", but that just counts to premature optimization

#

Build the thing first and test your performance after with whatever you're doing there

mighty crane
#

oh alr

plucky skiff
#

I have this code (not full):

    @EventHandler
    public void onItemInteract(PlayerInteractEvent event) {
    
        Player player = event.getPlayer();

        ProtocolLibrary.getProtocolManager()
            .addPacketListener(new PacketAdapter(ShardPlugin.getPlugin(), PacketType.Play.Server.ENTITY_EQUIPMENT) {
                @Override
                public void onPacketSending(PacketEvent event) {
                    if (!isActivated.contains(player.getUniqueId())) return;

                    for(Player onlinePlayer : Bukkit.getOnlinePlayers()) {

                        if (onlinePlayer.getUniqueId() == player.getUniqueId()) continue;
                        onlinePlayer.sendEquipmentChange(player, EquipmentSlot.HAND, new ItemStack(Material.AIR));
                        onlinePlayer.sendEquipmentChange(player, EquipmentSlot.HEAD, new ItemStack(Material.AIR));
                        onlinePlayer.sendEquipmentChange(player, EquipmentSlot.CHEST, new ItemStack(Material.AIR));
                        onlinePlayer.sendEquipmentChange(player, EquipmentSlot.LEGS, new ItemStack(Material.AIR));
                        onlinePlayer.sendEquipmentChange(player, EquipmentSlot.FEET, new ItemStack(Material.AIR));

                    }
                }
            });

    }

And that creates a java.lang.StackOverflowError.

onlinePlayer.sendEquipmentChange(player, EquipmentSlot.HAND, new ItemStack(Material.AIR));
And it get's generated in this line ↑

Any idea why?

mighty crane
#

please add java after ```

#

(makes it easier to read)

plucky skiff
#

ah ok

minor junco
#

Erm you shouldn't add packet listeners in (such) an event to begin with

plucky skiff
#

yeah though that, but where should I put it then

minor junco
#

Do it on plugin load up

hushed spindle
#

you only want to register one of those listeners

plucky skiff
#

and create a method to get the isActivated method?

hushed spindle
#

doing it on every interact event is gonna blow that the fuck up

minor junco
#

is activated doesn't seem to be a method

plucky skiff
#

I mean variable

#

private List<UUID> isActivated = new ArrayList<>();

minor junco
#

I guess so, if you want to stick to this desigm

plucky skiff
#

what other options are there then?

minor junco
#

Use a set please, instead of a list unless you allow duplicates. Your lookup will be O(n) in worst case whereas a hash set has constant lookup

#

But you have other issues with sets so

minor junco
#

But you can do it like that yeah, if you want to stick to this make it static or use a static getter or whatever, but I recommend anything else but that

plucky skiff
#

ah ok

hoary light
#

How I'm can use 5 size like hopper? But minimal it 9.
Someone know how do it?

Inventory inventory = ((Hopper) block.getState()).getInventory();
Inventory ui = Bukkit.createInventory(null, 9, UIname);
ui.setContents(inventory.getContents());
echo basalt
#

InventoryType.HOPPER

plucky skiff
#

does anyone have an idea here ↑

hoary light
minor junco
#

I mean what is happening is that you receive the entity equipment packet and then send another one, triggering this method to be executed again

#

you could fix this by putting every player that you send it to in a Set (for example your isActivated) and do not send any more equipment changes when a player is within that set

#

@plucky skiff

plucky skiff
# minor junco <@948998445807570974>

well what I want is to make the player items invis if it is activated, now I'm actually getting this weird error for some reason: java.lang.NullPointerException: plugin cannot be NULL. which doesn't make sense since it shouldn't be null

minor junco
#

well debug when your plugin is null and when it is updated

#

whereever this exception is thrown

plucky skiff
#

can I send my code?

#

65 lines

chrome beacon
#

?paste

undone axleBOT
plucky skiff
#

oke ty

#

forgot about that lol

#

it happens on line 24

#

which, in the decompiled code is import org.bukkit.plugin.java.JavaPlugin;

#

oh wait

chrome beacon
#

You're setting plugin after that

plucky skiff
#

no

minor junco
#

you assign plugin = this after

chrome beacon
#

??

minor junco
#

?learnjava

undone axleBOT
plucky skiff
#

I'm so dumb

plucky skiff
#

that was just an really dumb oopsie...

spare hazel
#

how can i change glow color

chrome beacon
#

You need teams

#

and set the team color

true anvil
#

?learnkotlin

hushed spindle
#

step 1: dont

halcyon hemlock
#

rate my new phone

glad prawn
#

6

tender shard
tender shard
#

it is

#

so is the file saved as UTF8?

#

and did you set the compiler options?

tender shard
agile hollow
#

how can i disable the pick up from the groun?

#

ground*

tender shard
#

EntityPickupItemEvent

agile hollow
#

thx ❤️

wary harness
tender shard
#

you need to set project.build.sourceEncoding to UTF-8

wary harness
tender shard
#

idk, I always set it in every pom to be sure

#
<properties>
  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>```
wary harness
#

👍

tender shard
#

and then check if the file is actually saved as UTF8 in your IDE too

#

after that run mvn clean on the parent pom, then try again

wary harness
#

ok thanks

agile hollow
#

in 1.8 how can i get the material of a dye?

chrome beacon
#

It would be a magic damage value

tender shard
#

or some other bullshit

chrome beacon
#

Yeah it is

#

with magic damage value

tender shard
#

fancy 1.8

#

"ah bone meal? yeah, that's an ink sac"

chrome beacon
#

lapis? That's an ink sac

steel swan
#

Hey, i have installed git on my pc , but when i try to upload my code to git, i get an error saying its not installed, any idea?

chrome beacon
#

How are you trying to upload

tender shard
shadow night
# tender shard

what you say, lapis? Never heard of that. ohh, you mean ink sac!

#

Integer ids and data values were funny

quiet ice
steel swan
chrome beacon
#

You need to commit your code

steel swan
chrome beacon
#

using the commit button

tender shard
chrome beacon
#

or the commit command

steel swan
chrome beacon
#

Probably need to add the files you want

tender shard
#

i thought it said "git not installed"?

steel swan
steel swan
chrome beacon
#

No

tender shard
#

show a screenshot of your project structure

chrome beacon
#

I use the cli so I have no idea how to do that in Intellij

steel swan
#

(and a lot of other files)

chrome beacon
#

?conventions ;/

tender shard
#

I'd just remove the .git folder, then create a new git repo with with Git -> Create Git Repo (or however it's called) and then try again

tender shard
#

but just for fun, you could try right-clicking the src folder and check if you see Git -> Add

tender shard
#

.git is a folder

#

probably IJ hides it

steel swan
steel swan
tender shard
#

if you now go the git tab again, do you now see some files you can commit?

tender shard
#

yes

steel swan
#

stil nothing

tender shard
#

open your project in file explorer and remove the .git directory, then run git init manually (or use Git -> Create repo in IJ)

steel swan
#

where is the .git file

chrome beacon
#

It's a folder in the root of your project

#

Windows will hide it by default, you need to enable hidden folders

steel swan
#

and how do i do that

tender shard
#

google

#

"<name of my operating system> show hidden files"

steel swan
#

Ok ill try that if other things dont work, but why cant i commit my files tho?

full laurel
quiet ice
#

I assume you do not have git installed on your PATH

quiet ice
full laurel
tender shard
quiet ice
full laurel
#

hahaha

tender shard
#

why is everyone speaking baguette now

kindred sentinel
#

Is there a way to check all entities in 30 blocks of other entity without checking all entities on the server?

full laurel
quiet ice
#

Whatever, my french isn't that great. Despite it being my native language on paper

full laurel
shadow night
quiet ice
#

My german is better, but meh

full laurel
shadow night
full laurel
shadow night
full laurel
shadow night
#

I really like it with chocolate

full laurel
#

Classic

tender shard
kindred sentinel
steel swan
#

Oh well, i managed to get it to work (i just reinstalled bit and restarted my pc)

steel swan
full laurel
shadow night
#

Le pain language intensifies

full laurel
#

All good

kindred sentinel
#

How to break boat entity?

#

Like not remove

#

break with loot

quiet ice
#

Damage it?

kindred sentinel
#

Yeah

#

Boat doesn't have damage method

#

So I don't know

chrome beacon
#

The only way I'm aware of is nms ;/

kindred sentinel
#

😭

quiet ice
#

You might set the fire ticks, but that is beyond hacky

kindred sentinel
quiet ice
#

not sure if that would drop anything though. And might not be what you want visually

kindred sentinel
#

it would just drop

#

even with 1 tick

quiet ice
#

Ah then it is a decent method

full laurel
#

Use VehicleDestroyEvent, check if the vehicle is a boat, if yes then create the item stack for the boat, & drop it naturally in the location where the boat was "broken"

quiet ice
full laurel
quiet ice
#

ye

full laurel
#

I see

wooden frost
#

help, why does packet listener say that "java.lang.NoClassDefFoundError: com/comphenix/protocol/events/PacketListener".

(i am very bad at coding, and am activey trying to figure out how packets work)

ProtocolManager manager = ProtocolLibrary.getProtocolManager();
        manager.addPacketListener(new PacketAdapter(plugin, ListenerPriority.HIGH, PacketType.Play.Client.PICK_ITEM) {
            @Override
            public void onPacketReceiving(PacketEvent event) {
                Player player = event.getPlayer();
                PacketContainer packet = event.getPacket();
                ItemMeta handMeta =player.getInventory().getItemInMainHand().getItemMeta();
                if (handMeta.hasCustomModelData()&&player.getInventory().getItemInMainHand().getType()==Material.SCUTE) if(handMeta.getCustomModelData()==2){
                    event.setCancelled(true);
                }
            }
        });
full laurel
#

Are you on maven?

wooden frost
#

yup

chrome beacon