#help-development

1 messages Β· Page 121 of 1

quiet ice
#

It probably means that this is not the case

agile anvil
#

I didn't block you, you even left me on unseen 😒

odd wedge
#

Are you talking about JavaPlugin#getPlugin(Class)?

rare flicker
#

if you wanna access your own, either pass it to your classes or have a static instance of it

rare flicker
#

otherwise look at the answer above

rare flicker
cobalt thorn
dusk flicker
#

Show us the error

cobalt thorn
#

and everytime i restart i am in the last location before typing it

dusk flicker
#

If it's crashing there's going to be something in the log

cobalt thorn
#

let me check rn

#

again

chrome beacon
#

at it.zerotwo.fastparticles.LegacyParticleType.spawn(LegacyParticleType.java:120)

#

Going to need that method

chrome beacon
#

Just use the spigot api πŸ™ƒ

cobalt thorn
cobalt thorn
chrome beacon
#

It's colored dust

#

COLOURED_DUST *

cobalt thorn
chrome beacon
#

No idea

#

That was 7 years ago

cobalt thorn
#

7 years woah make me feel old

chrome beacon
#

Time to move on

green prism
#

Excuse me a question guys, I have a main class that contains public methods along with public variables that are used in other classes. I created my APIManager class precisely for APIs and wondered how I could hide, for those who access the API through the main class, all the other methods and variables and leave a getinstance method or something similar to that to reach the APIs instead.

wet breach
green prism
agile anvil
#

Your plugin implements these interfaces to run something

#

And the other plugins can interact with the interface

green prism
#

hm, so you’re telling me I shouldn’t do a separate class for APIs and then access it via the mainclazz?

wet breach
#

people forget there is differing classifications of API's

kindred valley
#

Stop mentioning you blocked me all your sentences, damn i just asked if you know c++

wet breach
cobalt thorn
# cobalt thorn Hi my server crash when i try my plugin this is the code for the summoning https...

from this im getting

[17:36:18 WARN]: Exception in thread "Craft Scheduler Thread - 258"
[17:36:18 WARN]: org.apache.commons.lang.UnhandledException: Plugin NextBot v1.0-Beta generated an exception while executing task 46
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:56)
at org.github.paperspigot.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:23)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException
at java.lang.Class.isAssignableFrom(Native Method)
at org.bukkit.craftbukkit.v1_8_R3.CraftWorld.playEffect(CraftWorld.java:864)
at org.bukkit.craftbukkit.v1_8_R3.CraftWorld.playEffect(CraftWorld.java:859)
at it.zerotwo.nextbot.commands.MainCommands$1.run(MainCommands.java:71)
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftTask.run(CraftTask.java:59)
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:53)
... 4 more

agile anvil
#

And a NPE too

#

At MainCommands.java line 71

cobalt thorn
agile anvil
agile anvil
#

End of life

cobalt thorn
#

Oh

agile anvil
#

1.8 is outdated

#

Well, maybe some rare 1.8 devs could help you here

cobalt thorn
#

i used method new on java and some method for 1.19

green prism
#

no more public things

grim ice
#

coding in notepad is awesome

#

just me writing a few thousand lines of code in notepad

trim creek
#
PreparedStatement ps2 = connection().prepareStatement("INSERT IGNORE INTO `cuud` (NAME, UUID, RANK, GEMS, XP, KILLS, DEATHS, GEMBOOSTER, XPBOOSTER) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)");

What is the problem of this, that cause this?
java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'RANK, GEMS, XP, KILLS, DEATHS, GEMBOOSTER, XPBOOSTER) VALUES ('NeonOwlGery', 'bd' at line 1

hazy parrot
#

Try to put rank in ''

#

I think it's sql function

trim creek
#

this is weird

#

why is this one plugin struggling with MySQL, while others of mine are working fine?

#

wtf is wrong with Java novadays?

tall dragon
#

usually not java's doing man

trim creek
#

gets the same error

hazy parrot
#

because im pretty sure its throwing because RANK() is sql function

trim creek
#

should not be

#

other plugins works fine

hazy parrot
#

Β―_(ツ)_/Β―

trim creek
#

using the SAME MySQL lib

#

btw putting it in '' returns the same error

cobalt thorn
#

hi im getting https://sourceb.in/lhPwVF0LOj an error data should be class org.bukkit.Particle$DustOptions got class org.bukkit.Color and i provided the color (1.19)

tall dragon
green prism
# tall dragon yea you're right

help?
org.bukkit.plugin.InvalidPluginException: java.lang.ClassCastException: class it.myke.identity.Identity cannot be cast to class it.myke.identity.Identity (it.myke.identity.Identity is in unnamed module of loader 'Identity-1.3.3-shaded.jar' @652160af; it.myke.identity.Identity is in unnamed module of loader 'APITester-1.0-SNAPSHOT-shaded.jar' @47c75a4d)

I simply installed via maven inside my plug-in, the Jar of my other plug-in to test its bees. I made the shade and this is the result

chrome beacon
trim creek
#
java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''RANK', GEMS, XP, KILLS, DEATHS, GEMBOOSTER, XPBOOSTER) VALUES ('NeonOwlGery', '' at line 1
cobalt thorn
trim creek
#
PreparedStatement ps2 = connection().prepareStatement("INSERT IGNORE INTO `cuud` (NAME, UUID, 'RANK', GEMS, XP, KILLS, DEATHS, GEMBOOSTER, XPBOOSTER) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)");
agile anvil
trim creek
hazy parrot
#

?

green prism
# tall dragon show ur main class
package it.myke.apitester;

import it.myke.identity.Identity;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public final class APITester extends JavaPlugin {
    private final Identity identity = (Identity) Bukkit.getPluginManager().getPlugin("Identity");


    @Override
    public void onEnable() {
        System.out.println("Drago903 Identity's has been found! " + identity.getAPI().getUserIdentity("Drago903"));
    }

    @Override
    public void onDisable() {
        // Plugin shutdown logic
    }
}
agile anvil
cobalt thorn
#

the code in base works fine the but the error is on the color but not sure

trim creek
#

you mean like \"RANk"?

chrome beacon
trim creek
#

then \"RANK\"

hazy parrot
#

yes

cobalt thorn
chrome beacon
#

You're giving it color directly

#

Give it dust options instead

agile anvil
trim creek
#

cause ppl said

#

btw it still returns the same rror

#

except rank in "

chrome beacon
trim creek
#

so its not the error

#

obviouusly

cobalt thorn
hazy parrot
trim creek
#

still weird

#

you know why?

trim creek
#

Cause some other of my plugins uses RANK as a column name, and they don't get flagged

#

but then lets rename it to RANG

#

Β―_(ツ)_/Β―

tall dragon
#

RANC πŸ˜„

green prism
agile anvil
tall dragon
#

lets hope so

hazy parrot
#

i mean it should be able to wirk with ", not sure why it doesn't tho

trim creek
#

howeveristillneedtorealizehowicanrenameacolumn

trim creek
green prism
#

oh

#

wait

agile anvil
#

And you should depend on it in the plugin yml to be sure it is loaded after Identity

green prism
# agile anvil And you should depend on it in the plugin yml to be sure it is loaded after Iden...

java.lang.ClassCastException: class it.myke.identity.Identity cannot be cast to class it.myke.identity.Identity (it.myke.identity.Identity is in unnamed module of loader 'Identity-1.3.3-shaded.jar' @13890a8f; it.myke.identity.Identity is in unnamed module of loader 'APITester-1.0-SNAPSHOT-shaded.jar' @4639cd2f) at it.myke.apitester.APITester.onEnable(APITester.java:12) ~[APITester-1.0-SNAPSHOT-shaded.jar:?] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:542) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?] at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugin(CraftServer.java:565) ~[paper-1.19.2.jar:git-Paper-132] at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugins(CraftServer.java:479) ~[paper-1.19.2.jar:git-Paper-132]

agile anvil
agile anvil
#

That's why

tall dragon
#

huh lol

agile anvil
#

You need to access the loaded Identity plugin, not include the code in yours

tall dragon
#

ur tryna get a plugin thats not actually in the server

green prism
#

ouch

#

so, should I put compile as scope?

tall dragon
#

no

agile anvil
#

Just use it as dependency, not compile it

tall dragon
#

put provided

boreal seal
#

guys a question less about plugins

#

in general models json

#

what are difference between 1.9 + and older versions?

#

why older version wont be able to display the texture correctly

green prism
#

Thank you @agile anvil !!

#

works

#

idk how but

#

works

#

thank you everyone

fading lake
#

for wildcard permissions to work in permissions plugins, do the permissions inheritance need to be defined in plugin.yml or is it something you can compute in another way? (assume I have code control over both the perms plugin and the cor plugin)

agile anvil
tall dragon
trim creek
#

my issue is fixed, however now I have to deal with a DC attack 🀣

boreal seal
#

that work with json files

fading lake
#

ah, any idea how they do it or should I just delve into their src?

boreal seal
#

ill go for trial and error

tall dragon
fading lake
#

alright, I assume they iterate over the commandmap, grab the perms and authorise all manually that go under the wildcard, I'll have a look for it, thanks!

agile anvil
boreal seal
#

thanks gonna find out the answer today

#

since i'm not gonna update all my models from 1.8 to 1.9 manually

agile anvil
#

I bet there are some tools around to do it

boreal seal
#

yeah there are tools to steal even a model just from inspect in game lmao

#

so ;D

#

btw _Rolyn

#

wait ill send a picture tell me what do you see

#

its a model i might today

#

like what does it look alike?

cobalt thorn
#

And im using an image of a ps4 controller for testing

tardy delta
#

a floating bible

green prism
boreal seal
#

it meant to be an explosive ;/ not a nokia

#

for my terrorist role play server

#

where you have to do different mission so i was making some new explosive models today

#

i want players have a bigger choice of explosives so thats pretty cool

#

balance and pricing u know

boreal seal
#

sick c unt πŸ˜„

#

only now i noticed

green prism
#

lmao

boreal seal
#

fking sick c unt

#

❀️

#

now adays all are ... u know

onyx fjord
#

1.19.2 remapped mojang seems to have a lot smaller size (15mb) am i doing anything wrong?

eternal night
#

the server ?

chrome beacon
#

Who ghost pinged me :c

chrome beacon
#

It just doesn't include all dependencies

#

(they are in the pom instead)

onyx fjord
#

hwo do i get all th crap

chrome beacon
#

Why do you need it?

onyx fjord
#

well

chrome beacon
#

What are you trying to do

onyx fjord
#

im updating a plugin i use

#

author seems to dissapeared

chrome beacon
#

Maven will take care of what you need

onyx fjord
#

i dont use maven

chrome beacon
#

Gradle?

onyx fjord
#

ye

#

groovy

chrome beacon
#

Gradle will handle it for you as well

onyx fjord
#

uhh

#

ima show u in a min

#

870 queue size i wanna die

chrome beacon
#

?

#

What queue

onyx fjord
eternal night
#

wynn

onyx fjord
#

real shit bra

chrome beacon
#

Never been in a queue on wynn

onyx fjord
#

cuz they released 2.0 update

#

biggest ever iirc

chrome beacon
#

πŸ‘€

onyx fjord
#

350 new abilities

#

15 archetypes

chrome beacon
#

Maybe it's time to start playing again

onyx fjord
#

init brav

#

i can boost you up if you know what i mean

#

you wouldnt mind some LE for sure

chrome beacon
#

I have more than I need on my main account

zealous osprey
onyx fjord
#

wynn has incredible loadbalancing and shit

#

you can see players from different nodes etc

#

they love packets, for sure

#

if Spigot-1_17_R1 is for 1.17, what is the name for 1.19.2

zealous osprey
#

first time I saw those "fake" players, or rather the ones on the other nodes, I was blown away

onyx fjord
#

1_19_2_R1 ?

chrome beacon
#

Sounds like they didn't use remapped

#

If you want I can update the plugin for you

#

I'm bored

torn shuttle
#

I am going to lose my mind with this utf-8 encoding

wet breach
onyx fjord
torn shuttle
#

guys I think we need to nuke all of asia

#

that way I don't need to support this character set

chrome beacon
wet breach
onyx fjord
torn shuttle
onyx fjord
torn shuttle
#

the question mark is not an innovative new character

wet breach
#

usually spaces or the sorts

#

but it could be a character that is outside of the utf8 set

agile anvil
torn shuttle
#

that's also utf8 and it is taken from the file I am trying to clone

onyx fjord
#

ooo i think they adding new nodes

#

it jumped from pos 800 to 700

torn shuttle
#

I have a translation file inside of the resources folder, it gets displayed just fine in utf8

onyx fjord
#

now 588

torn shuttle
#

once I try to copy it to a directory suddenly I am dropping characters

wet breach
torn shuttle
#

I need to check if compiling it might be changing the characters

onyx fjord
#

pos 400 lets goo

wet breach
onyx fjord
#

i get a lot of this crap

chrome beacon
#

You're going to have to find the new names

onyx fjord
#

how do i check

#

if its mapped or nah

torn shuttle
#

oh god damn it

#

compiling it is causing the issue

#

no wonder it was always doing this

#

well... how do I fix that

chrome beacon
#

Set the encoding in your pom or build.gradle

torn shuttle
#

thing is it is set up

#

that's why I thought this wouldn't be the issue

#
//Fixes issues related to special characters being used
compileJava.options.encoding = "UTF-8"
compileTestJava.options.encoding = "UTF-8"
#

is there one that I missed?

onyx fjord
#

1.19 "apparently mapped"

wet breach
torn shuttle
#

how does that work?

onyx fjord
#

bt/Spigot/Spigot-Server/target/
i got it from there ^

chrome beacon
#

Kacper my offer still stands want me to help you update it?

pulsar parcel
#

Hi, I'm making a plugin that counts the number of team members in the scoreboard. So far I've made this code https://pastebin.com/Ks5VcC77 (more precisely it's related to onScoreboard() you don't need to notice the rest), but for some reason it duplicates the line every time I join a team. Does anyone know how to fix this?

onyx fjord
#

at one point 1.20 will exist

chrome beacon
#

Remapped removes a lot of the work between updates

torn shuttle
chrome beacon
#

If something does not exist you will need to dig around in the source to find what you want

wet breach
#

I don't know what your setup looks like and why the compiler is processing yml files

torn shuttle
#

I have the translations in the resources folder of the plugin, under a folder called translations

#

though I don't know why it would mess with it when I already have it set to utf 8 for the compilation encoding

echo basalt
#

You can set encoding on your build management tool

wet breach
#

this should stop the compiler from filtering your yml files

chrome beacon
#

They're using gradle

torn shuttle
#

I hate everything

#

man do I really have to switch back to maven

echo basalt
#

I'll be home in a bit

torn shuttle
#

I am getting real tired of the uphill battle of doing stuff in gradle

echo basalt
#

I'm a gradle main

torn shuttle
#

I love the compile speed but boy the time I've spent trying to get gradle to behave has far exceeded any time I would spend waiting for my programs to compile

wet breach
ornate mantle
#

bruh

torn shuttle
#

it's slow is my issue

#

well, was

#

back when I was using it

wet breach
ornate mantle
#

can't wait for the old white guys in my neighbourhood to go crazy over the queen's death

wet breach
#

by default maven uses conservative resources

#

you have to tell it that it is ok to use more resources

onyx fjord
#

very objective, better period

#

but does maven have groovy syntax, i dont tihnk so bro

echo basalt
#

@torn shuttle show gradle file

#

im idito

onyx fjord
#

???

torn shuttle
#

?paste

undone axleBOT
wet breach
#

unless they do have one and just weren't using it

onyx fjord
#

cant find anywhere

wet breach
echo basalt
#

my best guess

#

just copypaste the mc-development script

#
processResources {
    def props = [version: version]
    inputs.properties props
    filteringCharset 'UTF-8'
    filesMatching('plugin.yml') {
        expand props
    }
}
#

this part in specific

sage patio
#

I'm kicking player on join event (whitelist plugin) and setting join message to null, but server sends join message again (using essentialsx for handling that), any ideas?

wet breach
#

when the compiler puts resources into the jar, its not a straight forward copy and paste type thing

sage patio
#

hmm

wet breach
#

what I had posted as the fix for maven, is basically telling the compiler to copy the file with that extension as is

onyx fjord
wet breach
#

and not attempt to do any kind of filtering

odd wedge
wet breach
# onyx fjord maven groovy syntax

it allows using groovy scripts, so technically it doesn't make maven use groovy syntax but you could just put everything into your groovy script instead lol

torn shuttle
#

filesMatching probably wouldn't work if that's not my filename right

#

because that's not my filename

onyx fjord
echo basalt
#

just talking about the filteringCharset part

wet breach
onyx fjord
#

gradle has also less weird dir names

#

like build for build

#

not target?

torn shuttle
#

it's not one file is the problem

#

it's a lot of files

echo basalt
#

pretty sure this applies to all of them

wet breach
#

the reason maven uses target is because you can compile for multiple architectures

onyx fjord
#

im talking about defautls

wet breach
#

I know and I told you why maven has it named that way

#

just most people are not compiling for multiple architectures or require different binaries for such

#

well those in the MC scene that is

onyx fjord
#

also "package" instead of "build"

wet breach
#

because putting files into a zip file isn't really building

#

you can toss files into a jar without compiling

torn shuttle
#

uh

onyx fjord
#

what

torn shuttle
#

hm

onyx fjord
#

but build literally compiles everything

torn shuttle
#

welll... it works?

#

I just don't know why it works now

onyx fjord
#

how else would it work

wet breach
echo basalt
#

updated file?

onyx fjord
#

my jars have .class files in them not .java

wet breach
#

by default if you didn't put any other options yes it would compile

#

but what do you think a sources jar is?

#

also, there is different types of archives too

torn shuttle
#

yeah it works... weird

queen apex
#

Possible to move a player minecraft??

onyx fjord
#

isnt mavne literally the only one that calls it not build

iron glade
wet breach
queen apex
torn shuttle
queen apex
onyx fjord
#

we could argue all day, at the end of the day you will use maven and i will use gradle

iron glade
echo basalt
#

I am hackerman

onyx fjord
#

i can argue why chromium worse than firefox all day too

#

or windows worse than gnu/linux

onyx fjord
#

optic will just tell me Meh. dab

onyx fjord
#

also

#

gradle has a wrapper

#

afaik maven doesnt

wet breach
#

what do you mean?

#

not sure how a wrapper relates to being better in terms of compiling

eternal night
#

maven has a wrapper tho

wet breach
#

if you want to be technical, maven doesn't actually compile

eternal night
#

just that no one uses it

wet breach
#

maven calls java compiler and puts in the options to compile the way you told maven you wanted it

wet breach
eternal night
#

technically gradle is nothing more than a wrapper

wet breach
#

indeed

eternal night
#

technically java is also just a wrapper πŸ€”

wet breach
#

but I just don't understand what bringing up that gradle has a wrapper though

eternal night
#

yea idk

wet breach
#

has to do with anything

onyx fjord
eternal night
#

yea no one uses it

#

because maven is just

#

maven

#

nothing changes

wet breach
#

everyone uses it

onyx fjord
#

but all gradle projects i see have gradlew

wet breach
#

just the IDE calls the maven wrapper automatically. You could pull up a console and invoke maven yourself too

eternal night
#

Well on gradle it is a lot more important as the general DSL changes a lot more

eternal night
onyx fjord
#

mavenw

#

lolo

wet breach
#

the maven binary is nothing more then a proxy to the java compiler

onyx fjord
#

average user has to install maven to compile something

#

but with gradle you just run gradlew

eternal night
#

that is not what kacper was talking about tho

wet breach
#

you don't install maven

#

there is nothing to install

onyx fjord
#

????

#

what

#

look, before on my pc i didnt have mvn

#

i had to install a package

#

same for windows

odd wedge
wet breach
#

you just extract the maven archive and you use it right there or if you want it part of the global shell go modify the environment variables

iron glade
#

Hello this is india tech support, we hav speciol offer for you, Sir. Download now more RAM for only $24.99 Doller

wet breach
onyx fjord
#

well

#

you gotta download the binary lol

wet breach
#

no different then having to download gradle

odd wedge
wet breach
#

its not a requirement

onyx fjord
eternal night
#
❯ tree .
.
β”œβ”€β”€ mvnw
β”œβ”€β”€ mvnw.cmd
β”œβ”€β”€ pom.xml
└── src
    β”œβ”€β”€ main
    β”‚Β Β  └── java
    β”‚Β Β      └── dev
    β”‚Β Β          └── lynxplay
    β”‚Β Β              └── App.java
    └── test
        └── java
            └── dev
                └── lynxplay
                    └── AppTest.java

9 directories, 5 files
wet breach
#

other stuff such as what?

onyx fjord
#

its very very small

eternal night
#

this btw is the maven wrapper kacper

#

if you wondered

onyx fjord
#

lol

eternal night
#

or how it looks

onyx fjord
#

yea first time seeing it in my life

#

if you never saw it in gradle project, thats matrix at this point

odd wedge
#

Guys, when having a timer for something. Would it be smarter to compare the systems local time or have an AtomicInteger that handles it

#

I'm thinking when it lags it's not going to be accurate

wet breach
odd wedge
wet breach
eternal night
wet breach
eternal night
#

I forgot the -a

#

pretty much exact layout of gradle

#

Well you don't really need it for maven

#

because like, when does the layout of the standard ever change

onyx fjord
#

making the directory a dot directory isnt a good idea imo

eternal night
#

yea

onyx fjord
#

you wanna ship the wrapper

odd wedge
wet breach
#

soon kacper will learn that maven can build projects simultaneously and use multiple threads

onyx fjord
#

idk why you wouldnt

#

ik it can

#

lemme guess, not by default

eternal night
#

I mean, just because it is a dot dir doesn't mean it won't be tracked

#

but yea

#

I feel your point

onyx fjord
#

generally . is reserved for hidden folders

#

(file explorers hide . folders too)

desert frigate
#
if(location.getX() >= Math.min(location1.getX(), location2.getX()) && location.getY() >= Math.min(location1.getY(),location2.getY()) && location.getZ() >= Math.min(location1.getZ(), location2.getZ())) {
            if(location.getX() <= Math.max(location2.getX(),location1.getX()) && location.getY() <= Math.max(location2.getY(), location2.getY()) && location.getZ() <= Math.max(location2.getZ(), location2.getZ())) {
                return true;
            }
        }
        return false;``` 
ive written like 30 different codes and none of them work. pls someone explain ive been doing this for the past week
onyx fjord
#

yikes

#

thats some complexity

desert frigate
#

i trying to see if a player is in a area

odd wedge
#

Why make it so complicated

desert frigate
#

ive tried every design bro

onyx fjord
#

add some indentaion or whatever bro

desert frigate
#

even bounding box

iron glade
#

can't be > and then <

desert frigate
#

location1 and location2

wet breach
# onyx fjord lemme guess, not by default

you keep forgetting that maven is designed to be conservative because it was aimed at being used where you either can't or just don't want to give it dedicated resources. IE something like a CI where it can takes its time. Gradle aims to cater to those that want everything set to high settings, where as maven aims to cater to those that want everything set to low settings and only set certain things or everything to high settings at their choosing

iron glade
#

ah just saw

#

What's the code supposed to do though?

odd wedge
#

Just check if Coord 1 X/Y/Z > Player < COORD 2 X/Y/X

desert frigate
#

bruih i did Math.max(location2.getZ(), location2.getZ())

onyx fjord
#

or basically anything else other than XML

#

compared to groovy xml looks like unreadable crap

iron glade
desert frigate
iron glade
#

what's your new code?

desert frigate
#
if(location.getX() >= Math.min(location1.getX(), location2.getX()) && location.getY() >= Math.min(location1.getY(),location2.getY()) && location.getZ() >= Math.min(location1.getZ(), location2.getZ())) {
            if(location.getX() <= Math.max(location2.getX(),location1.getX()) && location.getY() <= Math.max(location2.getY(), location1.getY()) && location.getZ() <= Math.max(location2.getZ(), location1.getZ())) {
                return true;
            }
        }
        return false;```
onyx fjord
#

debug one by one

desert frigate
onyx fjord
#

thats what i usually do

#

and check where it stops

desert frigate
#

they all return false

#

so

#

idfk

onyx fjord
#

print values or something

#

primitive debugging

#

Β―_(ツ)_/Β―

desert frigate
#

i did broo

iron glade
#

yeah cause still doesn't make sense i guess

desert frigate
#

how does world guard do it

#

i wanna copy their code

odd wedge
#

Maybe you do

#

Please use good variable names

onyx fjord
desert frigate
# odd wedge You never check for the player
public static boolean isLocationInArea(Location location, Location location1, Location location2) {
        if(location.getX() >= Math.min(location1.getX(), location2.getX()) && location.getY() >= Math.min(location1.getY(),location2.getY()) && location.getZ() >= Math.min(location1.getZ(), location2.getZ())) {
            if(location.getX() <= Math.max(location2.getX(),location1.getX()) && location.getY() <= Math.max(location2.getY(), location1.getY()) && location.getZ() <= Math.max(location2.getZ(), location1.getZ())) {
                return true;
            }
        }
        return false;
        
    }```
#

full code

onyx fjord
#

it has no proper usable api

#

cant tell me im wrong

odd wedge
#

What is Location, Location1, Location 2

#

How would I know

desert frigate
desert frigate
onyx fjord
desert frigate
#

all same

#

ffor test

desert frigate
#

i check docs

odd wedge
#

Are all of your locations the same

desert frigate
#

yes

#

for testing

onyx fjord
#

yeah you wanna rather not ask them

#

a small warning from me

desert frigate
#

they mean asf

onyx fjord
#

they can at this point close support section

odd wedge
#

Why are you using Math.min

desert frigate
#

or wtv

odd wedge
#

So use spigots api for that

#

Location#getBlockX/Y/X

desert frigate
#

doesnt work

#

i tried that

#

it does same thing

odd wedge
#

Something wrong with you math then

desert frigate
#

πŸ˜€

odd wedge
#

if (loc1 > loc2 && loc1 < loc3)

#

That's what you gotta do

#

Do it for X/Y/Z values

queen apex
iron glade
#

Create your own plugin then and play around with velocities

desert frigate
#

That makes no sense

odd wedge
boreal seal
#

rip uk queen

#

lol

odd wedge
#

Let's say you have an area with these two X values

#

2 and 69

#

Math.min will return 2

#

Lets say you are in the X-coordinate 105

#

Your shit will return true

torpid sapphire
#

is there a way to something like InventoryClickEvent#setCursor in a non deprecated way?

young knoll
#

InventoryView#setCursor iirc

torpid sapphire
#

id assume that to be the same thing but aparrently thats not deprecated

#

ill try and see if that works

desert frigate
#
int locX = (int) location.getX();
        int locY = (int)location.getY();
        int locZ = (int)location.getZ();
        int minX = (int)Math.min(location1.getX(), location2.getX());
        int maxX = (int)Math.max(location1.getX(), location2.getX());
        int minY = (int)Math.min(location1.getY(), location2.getY());
        int maxY =(int)Math.max(location1.getY(), location2.getY());
        int minZ = (int)Math.min(location1.getZ(), location2.getZ());
        int maxZ =(int) Math.max(location1.getZ(), location2.getZ());
        if(locX >= minX && locX <= maxX) {
            if (locY >= minY && locY <= maxY) {
                if (locZ >= minZ && locZ <= maxZ){
                    return true;
                }
            }
        }
        return false;```
pulsar parcel
#

Hi, I'm making a plugin that counts the number of team members in the scoreboard. So far I've made this code https://pastebin.com/Ks5VcC77 (more precisely it's related to onScoreboard() you don't need to notice the rest), but for some reason it duplicates the line every time I join a team. Does anyone know how to fix this?

desert frigate
toxic plaza
#

hello, im attempting to update my plugin from 1.17 to 1.19, can anyone point me in the direction of a tutorial as ive never done this before :3

iron glade
#

change dependency if using maven or gradle or add the new jar

toxic plaza
#

ah see ive tried adding the new jar, it erm, makes everything go red n i panicked XD

#

not sure what to do after adding it so thought it best to ask for a tutorial

odd wedge
#

idk if youre trolling or not

desert frigate
iron glade
desert frigate
#

ive been making this for the past week

toxic plaza
#

yea, was i not meant to

desert frigate
#

and if u dont trust me then u can look at my past messages

#

lol

iron glade
#

what's it saying when hovering over red stuff?

toxic plaza
#

mostly cannot be resolved to type

#

its acts the same as if there was no jar...

iron glade
#

can you show the window you added your jar?

toxic plaza
#

sure

eternal oxide
#

?bootstrap

undone axleBOT
#

Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.

Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163

toxic plaza
#

Ohhh yeap that would make sense thank you

#

yeap that fixed it thanks so much πŸ™‚

green prism
#

How can I convert a MiniMessage component to a colorful string?

fluid river
#

@ebon ether where are homing arrows

onyx fjord
#

@chrome beacon i forgor what i did

#

did i tell you do update it?

onyx fjord
odd wedge
#

who ghost pinged me

sterile token
#

Where are intellij jar plugins keep?

quasi flint
#

what?

#

If u build it

#

Under /build/libs

sterile token
quasi flint
#

U

sterile token
#

I mean

#

Im wondering to find intellij plugins folder

#

Not the projects folder

#

I mean the folder where intellij locate the IDE plugins

sterile token
quasi flint
#

Oh dunno about that

onyx fjord
quasi flint
#

But it's prob somewhere in the intellij forum

sterile token
#

?

#

Hmn i dont think im expaning myself

quasi flint
#

Windows or mac

#

/ linux

onyx fjord
#

or gnu/linux

sterile token
#

I need to get a pecific intellij plugin jar

onyx fjord
#

good boy

sterile token
#

Im using windows atm

#

Just because i broken up my linux

#

😑

onyx fjord
#

you want btrfs

sterile token
onyx fjord
#

btrfs

quasi flint
#

This is for pycharm, but should be the same for intellij

#

C:\Users%USER%.PyCharm%VERSION%\config\plugins

onyx fjord
#

file system that has snapshots

#

you can rollback if you fuck up

sterile token
#

I dont understand you kacper

#

Sorry

#

I mean you are talking about diff things

desert frigate
#

ikik but it only works this way

quasi flint
#

Why not just use

#

The variable type

#

Get position returns you

sterile token
onyx fjord
quasi flint
onyx fjord
#

so if you fuck something up

#

you can rollback

#

not as powerful as backups tho

sterile token
quasi flint
#

Nothing for u

#

To worry about atm

sterile token
#

ohhh shi

#

It thoguht he was talking to me

#

Player can u help me?

onyx fjord
#

i am

sterile token
#

I cannot find that folder

quasi flint
#

Well he was

#

But not about the plugin help

onyx fjord
#

verano...

quasi flint
#

Isn't there

sterile token
quasi flint
#

A user folder for u

#

And an intelli folder in there

onyx fjord
#

im saying it because you said you messed up your linux install

sterile token
#

Ohh

#

Na dont orry about that

#

I know how to fix it

#

I just brokened up kgp packages

#

I mean its not really difficult Intellij should have a directory where he store the jar plugins you install

chrome beacon
#

You want me to?

sterile token
onyx fjord
#

yeah if you have time

chrome beacon
#

DM me the plugin

onyx fjord
#

verano πŸ’€

sterile token
sterile token
quasi flint
#

So if u know where it is located

#

Why do u need to know where it is located

sterile token
onyx fjord
sterile token
#

Lmao

#

People here makes a disastes haha

#

Because all talks about diff things together

sterile token
# chrome beacon DM me the plugin

Olivo my bae do you use intellij right? Do you know where the heck intellij store the downloaded plugins? i need to find where he stores the jars of the plugins

chrome beacon
#

They are in the plugins folder

onyx fjord
#

pr here if you can

#

thers a low chance original repo author will see PR

sterile token
onyx fjord
#

might as well get rid of those spigot jars too lol

sterile token
#

The one in app doesnt contain any jar one

chrome beacon
#

ah right there are two of them

#

One in the install that contains the bundled plugins

#

and the other plugins folder

sterile token
#

hmn

#

Which one so?

#

I need to modify a bit the discord sync plugin

#

that why haha

chrome beacon
#

I have it installed with Toolbox so I have no idea where it is normally

rough drift
#

if you have #distance, and you check if the value is smaller than 7 blocks, #distanceSquares you should check if the value is smaller than 7*7, right?

#

I have not failed maths right?

agile anvil
#

wait

#

you have distance

#

why putting it to square ?

#

but yeah, 7^2 = 7*7

fluid river
#

Never use #distance() method in Bukkit to compare distances

#

It uses slow square root operaion

#

If you need to compare, compare two distanceSquared() values

fluid river
#

you better do distanceSquared() < 7 * 7

#

not distance < 7

#

mafs

hazy parrot
#

Have you saved config afterwards?

echo basalt
#

or in 3d space it's a little more complex

#

c^2 = a^2 + b^2

#

the math gives a squared number

#

Calling the regular distance number, just grabs distanceSquared and sqrt's it

#

Multiplying a number by itself is quicker in terms of clock cycles, than finding a root

#

because you're not saving the config

#

also saving to config on held item

#

yucky

faint frost
#

he probably has his reasons

echo basalt
#

no he really doesn't

faint frost
#

k

echo basalt
#

It's as bad as doing HTTP requests onPlayerMove :)

faint frost
#

i mean i can see why thats stupid

echo basalt
#

doing IO on the main thread is stupid overall

faint frost
#

im assuming this is place holder code right? also yeah dont use static if you can help it

#

also instead of throwing ioexception on the main thread like imillusion said, use try catch

#

thats what i thought at first, but in actuality its bad practice

#

yeah, id recommend looking into di as well

undone axleBOT
faint frost
#

?di

undone axleBOT
faint frost
#

it will help a lot with static methods

#

meaning you dont need to use hardly any static

#

yeah i used to do that, not fun

#

headaches for days

fluid river
#

since java has import static

#

statics feel nice sometimes

#

Like you make a small Painter class which wraps Bukkit's translateAlternateColorCodes() method with name "paint" or something similar

#

then u can make static import of the method and use it

#

I mean about saving time

#

and having less code

#

by static imports

#

Cuz in class where you have like 20 messages, call method from class 20 times is kinda cringe

#

well it's kinda nice for me now

#

import static me.nukerfall.example.utils.Painter.paint;

#

and in code just use paint() everytime

#

instead of Painter.paint()

#

Well having method in each class is kinda sussy

#

But having a static import is one line

#

And auto-suggested sometimes

#

Basically LWJGL page says that they made all of their examples with import static

#

So if some code is not working you probably need a class name, or a static import

#

That was a headache for me in the beginning

#

But now i'm more into LWJGL

vocal cloud
#

Your coding style is whatever your boss wants it to be

fluid river
#

Haha true

#

That's why i have no boss rn

#

Tryina make some projects first

#

one with LWGJL

#

one with Spring

#

one MongoDB, one Hibernate

#

And then try to apply with all my knowledge

vocal cloud
#

Spring is so heavy KEKLEO

fluid river
#

Well probably gonna start with Spring Boot

#

After that some other parts of spring

#

Every company wants you to know Spring so...

young knoll
#

What is spring anyway

vocal cloud
#

Well Spring Boot is for microservices and APIs/general backends. Spring in and of itself is also a collection of libraries.

fluid river
#

connecton

#

.executeQuery("TRUNCATE JoeMama")

worldly ingot
#

That operation took far too long sadge

fluid river
#

u get sqlexception if something bad happened

#

catch print stack trace

vocal cloud
fluid river
#

if table does not exist execute a creation command

#

CREATE TABLE JoeMama

#

and so on

floral drum
#

uwu

#

hi mr chocolate ❀️

vocal cloud
#

Use Pastebin

floral drum
#

?paste

undone axleBOT
floral drum
#

: D

fluid river
#

runTaskTimer

#

check if still in main hand

#

if not then byebye

undone axleBOT
fluid river
#

idk

#

depends on your needs

vocal cloud
#

You'd want 1 thread rather than 1 for every player.

#

PlayerItemHeldEvent would only cover the player changing the active slot. I assume you'd also need to watch inventory events as well

fluid river
#

1 timer with getOnlinePlayers().forEach();

floral drum
fluid river
#

it's anyways better than stopping main thread lol

floral drum
#

?

vocal cloud
#

If you can getOnlinePlayers async you can run whatever you want on the main thread using sync threads when needed.

#

Still think you can do this without threads

floral drum
#

What's buggy about it?

vocal cloud
#

You can check

#

Are you also checking inventory events?

#

Yes you can.

#

test connect method?

#

Less a test and moreso a setup

#

make it nice. Name it setupTable() or something pretty uwu

sterile token
vocal cloud
#

no idea

sterile token
#

Hmn okk

vocal cloud
#

Unless you mean plugin as in spigot plugin

sterile token
#

Nop

#

Im saying intellij plugins folder

vocal cloud
#

First result on google

sterile token
#

I need to locate it so then I can modify a specific plugin

#

But i need the ja rones

#

The jar ones, not the configuration

#

Like

#

I need the one that contains the jar not their config

#

But thanks for trying help atleast

vocal cloud
#

No idea where what you want would be

hazy parrot
#

not sure that idea plugins are jar files

sterile token
#

i think they are jars

hazy parrot
#

my bad

#

and here is path

mighty aurora
#

Quick question. If I add one incorrectly made line(that doesn't prevent compilation or throw an error). Would it stop my plugin from doing anything. As in it doesn't do anything its supposed to.

grim ice
#
shortToLong(short a, short b, short c, short d) {
   return ((long)((a << 16) | (b & 0xFFFF)) << 32) | (((c << 16) | (d & 0xFFFF)) & 0xFFFFFFFFL);
 }```
#

so uh

lost matrix
#

Why tho?

grim ice
#

yeah do u guys have an idea of what this does

lost matrix
#

short is so specific...

#

A bunch of bit shifting so you can convert 4 16bit numbers to 1 64bit number

grim ice
#

well the bit shifting process is what im asking about

#

What does << do for each case here?
What does & do for each case here?
What does | do for each case here
Why are the hexadecimals different than each other? Why does this work

mighty aurora
#

If I wanted help troubleshooting my plugin would the best way to do that be to just send all the code here and ask for help? Reason I am asking is because I recently added a segment of code to my plugin(it was working before and after the addition). Then I proceeded to modify that piece of code a little bit and it was still working. Upon further addition to limit when things would run(one if statement in one class) my plugin stopped doing anything other than loading and disabling. None of the listeners are being called and their are no errors anywhere(in the IDE or server console)

lost matrix
# grim ice well the bit shifting process is what im asking about

<< shifts a number. & is binary and. | is binary or.

Example with 4 bit numbers.

Bit shifting

0001 << 1 = 0010
0001 << 2 = 0100
0001 << 5 = 0000
0001 >> 1 = 0000

Binary and

0010 & 0011 = 0010
0101 & 1111 = 0101
0011 & 0110 = 0010
1001 & 0110 = 0000

Binary or

0010 | 0011 = 0011
0101 | 1111 = 1111
0011 | 0110 = 0111
1001 | 0110 = 1111
lost matrix
mighty aurora
#

Their isn't any errors

#

and the listeners are listening

lost matrix
#

"None of the listeners are being called" what does this mean then?

mighty aurora
#

Its my best description of what is happening

#

because it literally does nothing

#

and i have loggers setup after each listener and if statement

#

and none of them ever get used

lost matrix
#

Sow me one example listener

#

Also: Why do you have if statements in your listener?

mighty aurora
#

I don't know exactly how to explain things

lost matrix
#

One or max two are fine. More is a sign of unclean code.

mighty aurora
#

if (event.getPacketType() == PacketType.Play.Server.ENTITY_EQUIPMENT && (p.getScoreboardTags().contains("shadowhuntactive") || p.getScoreboardTags().contains("shadowsneakactive"))) is my packet listener

#

or it was then I removed the && and everything after(within the parentheses) to see if it would work without

#

and it still wasn't working

lost matrix
#

Add a sysout before you do any logic

mighty aurora
#

that will print to the console?

lost matrix
#

just a debugging message to see if the listeners work

mighty aurora
#

It's a packet listener

#

which means every packet send will print something

lost matrix
#

Is it a ProtocolLib adapter?

mighty aurora
#

I couldn't get ProtocolLib to work so I had someone help me setup and use PacketEvents

lost matrix
#

There is no such thing as a PacketEvent. Neither in spigot nor in nms.

mighty aurora
#

The plugin/library called PacketEvents

#

I know it soft-depends on ProtocolLib

lost matrix
#

Ugh

#

My best guess would be that the scoreboard tag is missing.
log every of your conditions to see which one is false

mighty aurora
#

Except that wouldn't stop my other classes and such from working. correct?

lost matrix
#

If they all make use of this scoreboard tag then it does

mighty aurora
#

The only other reference to the scoreboard tag is 4ish lines in another class where that tag is added and removed

#

but to get their it has to first pass a bunch of other checks.

lost matrix
#

Just sit down and debug. We dont have enough information so all we can do is throw guesses at you.
Start with one part that isnt working and find out why its not working.

mighty aurora
#

And I have loggers at each of the if statements(only one I don't/didn't is the packetone)

#

none of it is working...

#

its not even detecting right click events

lost matrix
#

Then pick one at random

lost matrix
#

Keep in mind that the client does not send any click packets when he has an empty hand

grim ice
#

this is where the operator && originates from right?

#

and ||

lost matrix
#

Yeah. 2 4 bit number to 1 8 bit number:

0010 | (0000_1001 << 4) = 1001_0010

And back:

(4bitcast) 1001_0010 = 0010
(4bitcast) (1001_0010 >> 4) = 1001
mighty aurora
#

Also 7smile7 is their any reason that lines of code from plugin.yml wouldn't be compiling with the rest of the plugin?

sterile token
grim ice
lost matrix
vocal cloud
lost matrix
sterile token
#

I was looking for that folder for ages

mighty aurora
lost matrix
mighty aurora
#

As in maven and gradle?(I use maven)

lost matrix
#

How do you compile?

mighty aurora
#

And uh how would that matter as the dependencies are plugins

#

I use the maven package button under lifecycle

lost matrix
#

Ok

mighty aurora
#

and I've tried clean installing maven

#

many times

lost matrix
#

Where is your plugin.yml located inside your project?

mighty aurora
#

with my classes

lost matrix
#

Doesnt belong there

mighty aurora
vocal cloud
#

Oh well

#

lol

lost matrix
mighty aurora
#

then how does it still compile it with the rest of the stuff correctly done?

lost matrix
#

chars

mighty aurora
#

ok then...

#

nvm

#

thanks

lost matrix
#

I think it was 1 or 2 GB

#

Its 2 gigs

grim ice
lost matrix
#

0010 >> 4 is always 0

#

0000

#

So you first cast 0010 and 1001 to 8bit
-> 0000_0010 and 0000_1001
Then you shift one of them
0000_0010 << 4 = 0010_0000
Then you or them together

  0010_0000
| 0000_1001
____________
  0010_1001
#

For signed values you need to & them with 1111 (= 0xF)

#

PS: You only need to & with the bits which will be on the left most side (msb)

#

Just make it a singleton

#

No. Singleton is an actual design pattern.

#

Making all methods static would lead to static abuse at some point.

#
public class SomeManager {

  private static SomeManager instance;

  public static SomeManager getInstance() {
    return instance == null ? instance = new SomeManager() : instance;
  }

  // Dont forget to make the constructor private
  private SomeManager() {}

  public void someMethod() {
    
  }
  
}
#

This is a template for the singleton pattern

#

lazily initialized

#

If you use static as a shortcut for object oriented problems then you are abusing it.
The biggest indicator for static abuse are states.
A mutable static field or an immutable static field with a mutable object in it is 100% static abuse.

#

Example:

#
  // Not ok
  public static String SOME_PREFIX = "CoolPlugin";

  // Ok
  public static final String SOME_PREFIX = "CoolPlugin";
  
  // Not ok
  public static final List<String> SOME_DATA = new ArrayList<>();

  // Ok
  public static final List<String> SOME_DATA = ImmutableList.of("A", "B", "C");
#

Static should be stateless
This means there is no state that could change. No variables
can be reassigned, no collections can be modified etc.
Everything has to be immutable and final.

#

They probably rely on a state like data from a config file

faint frost
#

also whats a good example of static use?

kind hatch
#

Utility classes.

lost matrix
faint frost
#

i got some reading to do...

#

ok that makes sense

opal frigate
#

Hello, I'm trying to spawn an item for a specific player through packets and ProtocolLibrary

            ItemStack item = new ItemStack(Material.BEDROCK);

            int x = player.getLocation().getBlockX();
            int y = player.getLocation().getBlockY();
            int z = player.getLocation().getBlockZ();

            EntityItem displayItem = new EntityItem(((CraftWorld) player.getWorld()).getHandle(), x, y, z, CraftItemStack.asNMSCopy(item));

            Entity entity = displayItem.getBukkitEntity();

            player.sendMessage("spawned");

            PacketContainer packet1 = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SPAWN_ENTITY);

            packet1.getIntegers().write(0, entity.getEntityId());
            packet1.getUUIDs().write(0, entity.getUniqueId());
            packet1.getEntityTypeModifier().write(0, EntityType.DROPPED_ITEM);

            packet1.getDoubles().write(0, (double) x);
            packet1.getDoubles().write(1, (double) y);
            packet1.getDoubles().write(2, (double) z);

            PacketContainer packet2 = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.ENTITY_METADATA);

            packet2.getIntegers().write(0, entity.getEntityId());

            WrappedDataWatcher watcher = new WrappedDataWatcher();
            watcher.setEntity(entity);
            packet2.getWatchableCollectionModifier().write(0, watcher.getWatchableObjects());

            try {
                ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet1);
                ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet2);
            } catch (InvocationTargetException e) {
                e.printStackTrace();
            }

This is what I currently have, and I can't figure out why it's not working. Whenever this code is ran nothing happens; no spawn, nothing. Can anyone help? Thanks.

opal frigate
#

1.19

lost matrix
#

Then you are using the wrong ProtocolLib version

#

You need 5.0.0-SNAPSHOT

#

Makes your code more robust. This way nobody will ever be able to create an instance of you singleton class.
Strongly enforces the pattern.

opal frigate
# lost matrix You need 5.0.0-SNAPSHOT

Thanks for responding so fast.

I've updated to 5.0.0-SNAPSHOT in my pom.xml and updated to the latest dev build of ProtocolLib on my server, however, it is still not spawning the item.

lost matrix
#

The only way to ever get an instance is through the getter.

lost matrix
lost matrix
#

Then you fetch them through your other singletons.

snow lava
#

it's possible to put a block that has a custom model data in the head of an armor stand using nms?

lost matrix
snow lava
#

but helmet only accepts string: helmet.setString("id", "minecraft:structure_block");

lost matrix
opal frigate
#

I was using EntityItem to get the entity's ID & UUID, is there a different / better way?

lost matrix
#

And this wont work either:
watcher.setEntity(entity);

opal frigate
#

Gotcha

lost matrix
#

You need to dig through here in order to modify the data watcher to your needs

lost matrix
# opal frigate Gotcha

Here. Try sending those two packets after another:

  private PacketContainer createDroppedItemMetaPacket(int entityID, ItemStack itemStack) {
    PacketContainer metaPacket = new PacketContainer(PacketType.Play.Server.ENTITY_METADATA);
    metaPacket.getIntegers().write(0, entityID);

    WrappedDataWatcher dataWatcher = new WrappedDataWatcher();

    // ItemStack property
    dataWatcher.setObject(8, WrappedDataWatcher.Registry.get(ItemStack.class), itemStack);

    metaPacket.getWatchableCollectionModifier().write(0, dataWatcher.getWatchableObjects());

    return metaPacket;
  }
  
  private PacketContainer createItemSpawnPacket(int entityID, UUID entityUID, Location loc) {
    PacketContainer spawnPacket = new PacketContainer(PacketType.Play.Server.SPAWN_ENTITY);
    StructureModifier<Integer> intMod = spawnPacket.getIntegers();
    intMod.write(0, entityID);
    StructureModifier<UUID> uidMod = spawnPacket.getUUIDs();
    uidMod.write(0, entityUID);

    // Set type
    spawnPacket.getEntityTypeModifier().write(0, EntityType.DROPPED_ITEM);

    // Set position
    StructureModifier<Double> doubleMod = spawnPacket.getDoubles();
    doubleMod.write(0, loc.getX());
    doubleMod.write(1, loc.getY());
    doubleMod.write(2, loc.getZ());

    return spawnPacket;
  }
#

The only problem could be the registry...

opal frigate
#

Thanks.

I am getting this though

No serializer found for class org.bukkit.inventory.ItemStack
lost matrix
#

Yeah there is no serializer for ItemStack. We need to find another way

faint frost
#

i need someone to test out a feature im working on. anyone up for it?

lost matrix
opal frigate
#

Thanks so much for your help.

Am I some how messing up?

            PacketContainer p1 = createDroppedItemMetaPacket(200, new ItemStack(Material.BEDROCK));
            PacketContainer p2 = createItemSpawnPacket(200, UUID.randomUUID(), player.getLocation());

            ProtocolLibrary.getProtocolManager().sendServerPacket(player, p1);
            ProtocolLibrary.getProtocolManager().sendServerPacket(player, p2);
lost matrix
#
  public void showFakeDroppedItem(Player player, ItemStack itemStack, Location location) {
    int id = ThreadLocalRandom.current().nextInt();
    UUID uuid = UUID.randomUUID();
    PacketContainer spawn = createItemSpawnPacket(id, uuid, location);
    PacketContainer meta = createDroppedItemMetaPacket(id, itemStack);

    ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();
    protocolManager.sendServerPacket(player, spawn);
    protocolManager.sendServerPacket(player, meta);
  }

There you go. Fake items.

opal frigate
#

Ah, I was sending them in the wrong order πŸ™‚

lost matrix
opal frigate
#

Thank you so much, I've been trying to figure this out for a long time.

tawdry python
#

I want to make a plugin where when a cactus breaks in the plot, it goes to a "virtual storage", I'm thinking of using a hashmap, but on second thought, if I put it in the hashmap whenever the cactus breaks, it will generate a lot of lag, which best way to do it?

lost matrix
#

Why would this create lag?

#

Just have a List<Inventory> and add your stuff there. If the last inventory is full then you simply create a new one and add it to the list.

tawdry python
lost matrix
#

You can also use a Map or Set for this.

lost matrix
#

The cacti will lag the server ages before a map becomes a problem

#

So just use a Map<ItemStack, Integer>

tawdry python
lost matrix
#

It would be so little that you couldnt even detect it.

#

Maybe 0.001% of your tick

#

maximum

#

A hashmap doesnt get slower with more elements. Thats the whole idea of hash tables.

quaint mantle
#

anyway to improve this?

#

i want the best performance

#
            Bukkit.getScheduler().runTaskTimer(TimeAPI.TimerPlugin, task -> {
                long timeleft = timer1.getTimeLeft() + time;
                timer.setTime(timeleft);
                if (timeleft <= 0) {
                    Bukkit.getPluginManager().callEvent(new TimerFinishEvent(timer1));
                    timer.delete();
                    list.remove(timer1);
                    timerMap.remove(timer1);
                    Timer.timerMap.remove(timer1.getID());

                    task.cancel();
                    return;
                }
                Bukkit.getPluginManager().callEvent(new TimerUpdateEvent(plr, timer1, update_timer));
            }, update_interval, update_interval);```
lost matrix
#

Very confusing naming... And dont use lists if you do contains() or remove() often

#

And this is static abuse:

TimeAPI.TimerPlugin
quaint mantle
#

wdym by static abuse

#

but yeah naming is weird

#

and remove() shouldn't happen that often

#

if you dont mind explaining, why is it an issue to do that? (static abuse)

lost matrix
#

Timers and cooldowns should always be done by timestamps.
Manually adding time like this is very unnecessary and inefficient.

quaint mantle
#

πŸ‘

lost matrix
#

We had a whole discussion about that 2h ago...
But here is the short form:
Makes the code fragile. Its unclean to read. Abusing static leads
to problems like circular dependencies.

#

Having a public static non-final variable is always a bad idea. No exceptions.