#help-development

1 messages · Page 1371 of 1

cinder thistle
#

I use it on shutdown

ivory sleet
#

I use it for parallelism

cinder thistle
#

added a shutdown hook to save recorded data as csv

#

filters out everything I don't want

#

it's great

ivory sleet
#

pog

graceful oak
#

Hey guys this might be a stupid question but I genuinely am not sure. I have heard the term server core being tossed around when talking about servers and plugins what exactly is the core? Is it just one big plugin with the main parts of the server? Like would I create the main functionality of the server in one big plugin or should I stick to separate jar files for each part?

opal sluice
#

It's better to have multiple little plugins, than a massive one that does everything (imo)

ivory sleet
#

woopsie

#

I mean if you're given the chance to only use one plugin that could be somewhat more optimized. (Negligible)

#

However it comes with a cost

graceful oak
ivory sleet
#

When you wanna update, you'd have to update the entire jar each time

#

which comes with other drawbacks

opal sluice
silent vigil
#

hey is there any way to make a plugin loader? as in you have a config.yml and in it you say true to a line and on startup it downloads that plugin

opal sluice
ivory sleet
#

If you split it up, you could easily swap smaller modules allowing you to work efficiently even with multiple devs concurrently

#

But it may be cumbersome to switch project window assuming you're working on many modules in a short period of time (For IntelliJ this is a problem I've experienced)

opal sluice
#

So annoying to deal with it on Intellij

ivory sleet
#

yeah I actually use Eclipse sometimes for that very reason

solemn shoal
#

is this just a decompilation artifact or is the code just written like that?

sullen marlin
#

looks fine to me>

solemn shoal
#

looks like a mess to me lol

young knoll
#

Yep that’s what it looks like

silent vigil
#

hey is there any way to make a plugin loader? if yes is there anyone that could show/tell me how?

sullen marlin
#

yeah

#

just implement PluginLoader and call registerInterface or whatever

young knoll
#

You can load and enable any plugin you want with the methods in PluginManager

silent vigil
#

i meant download a plugin from lets say a web page

sullen marlin
#

oh

silent vigil
#

yea

#

any ideas?

lost matrix
# silent vigil any ideas?

Sure. You have a full blown programming language and spigots plugin loader. You can just download a plugin from the web and enable it.
You can even download dependencies of your own plugin on runtime.

silent vigil
sullen marlin
#

can you explain more what you want

#

@lost matrix I dont think hes talking about coding a spigot plugin at all

silent vigil
#

Im trying to make a plugin that downloads one of my plugins from a website. Im thinking to have a config.yml with option of which plugins you can enable, in onEnable have a if statment to check which ones are enabled. Each one has a link (option) and it downloads from that

stone sinew
silent vigil
#

ok

#

ty

stone sinew
#

np

lost matrix
#

Apache commons probably has something for that too actually...

silent vigil
#

2nd question, how would I download it to the plugins folder?

lost matrix
#

You can just open an InputStream from any URL that points to the target file and download it.

stone sinew
silent vigil
stone sinew
karmic grove
#

ok this may sound VERY odd but is there a plugin that when someone types a certain command it dupes ther whole inv i want to run like a 2b2t practice anarchy server so people dont have to worry about losing armour and such any help would be appreciated in finding or even making one

#

ping me

arctic summit
#

how would i spawn lightning that doesnt harm a player at a location?

sullen marlin
#

World.strikeLightningEffect​

arctic summit
#

ty

#

does it do damage?

#

@sullen marlin

cloud berry
#

guys is it safe to read from a treemap async? like from 2 threads at once (assuming no writing)

#

im pretty sure it is but i could f*** stuff up if im wrong LOL

sullen marlin
#

@arctic summit read the doc splease

#

"Strikes lightning at the given Location without doing damage"

arctic summit
#

ok sorry

quaint mantle
#

how can I convert a string into a PermissionAttachment?

solemn shoal
#

hm

#

how can i get a creeper's fuse time?

solemn shoal
#

just iterate over their inventory and drop them as items

#

wait i think i have code for that

rugged topaz
#

anyone know what the best way to store data inside mysql for a server? since there's a table then there's values, and it would be easy to create an element of a player's uuid as the primary key each time, what would be the way to store server data such as the most amount of ppl on at a time, spawn location, etc.?

cloud berry
rugged topaz
#

not talking about that but why?

cloud berry
#

its slow, im using ints

rugged topaz
#

#1 source, #2 how do you track coorelate ints to uuids?

#

or even players

karmic grove
solemn shoal
#

@karmic grove here's some code

for(ItemStack is : p.getInventory().getStorageContents()){
    Item i = w.spawn(ploc, Item.class);
    i.setItemStack(is);
}```
karmic grove
#

idk ow to make plugins 0.0

#

how*

solemn shoal
#

just ask here lol

cloud berry
#

#1 just think about it lol, long strings take longer to compare than simple ints
#2 i keep a local cache of database id's mapped to uuid's (and vice versa)

solemn shoal
#

most likely theres some command with a guide here

sullen marlin
solemn shoal
#

well im looking at the intellisense, nothing there

karmic grove
solemn shoal
karmic grove
#

also can it be a command like /dupe

young knoll
rugged topaz
solemn shoal
#

that drops the items as items on the ground @karmic grove

#

if they have space, it goes into their inventory

rugged topaz
#

there's nothing wrong with keeping a cache, if anything ima try to create a cache of data instead of constantly accessing the database

karmic grove
cloud berry
rugged topaz
#

lmao yea i feel u but ig it's up to the person

cloud berry
#

i cant tell u how much faster doe, maybe i'll run some tests at some point now im curious lol

sullen marlin
#

@solemn shoal weird, open a feature reuqest

rugged topaz
#

i sorta have some bad code causing memory usage to build up and blah

karmic grove
rugged topaz
solemn shoal
#

where can i open feature requests?

rugged topaz
#

or, any sort of programming because "saving as a java file" just ain't it

solemn shoal
#

nvm the jira exists

karmic grove
#

i just wanted to know if a plugin existed lol

young knoll
#

python intensifies

cloud berry
#

i mean yea u need at least a decent foundation in programming, not necessarily java

#

oh LOL

solemn shoal
#

also @sullen marlin is it possible to change my name on the spigot site?

young knoll
#

Yes

#

You need to donate

cloud berry
#

pony up

solemn shoal
#

aight how much

cloud berry
#

$350 i dm u bitcoin addy to send to

solemn shoal
#

aight

cloud berry
#

damn ;-; if i knew itd be taht ez id actually hav a btc account ready LOL

#

i could ahv tree fiddy rn fml

solemn shoal
#

lmao

#

i knew you were kidding

cloud berry
#

xxxDDDDDDD

solemn shoal
#

wait, under what project would i put it?

#

Spigot or SpigotPlugins?

cloud berry
#

:I

solemn shoal
#

nvm spigotplugins is plugin support

deft sedge
#

is there a way for me to set an entire row to a certain item when making a gui?

solemn shoal
#

iterate over all the slots

deft sedge
#

?

solemn shoal
#

aka, not in an API way

#

you can loop over slots though, and set them individually

deft sedge
#

ok

#

?jk

#

?jd

deft sedge
#

Is there a simpler way to do that?

young knoll
#

A loop is fairly simple

#

Could make a method for it too

rugged topaz
#
        for (int slot = 0; slot < gui.getSize(); slot++) {
            if (i < 9) {
                gui.setItem(slot, ItemStack);
            }
        }
deft sedge
#

ok

rugged topaz
#

that sets 0-8, the first row to ItemStack

#

which you'll need to define

#

make sense?

deft sedge
#

ye athanks

solemn shoal
#

but where is i defined? @rugged topaz

rugged topaz
#

slot*

deft sedge
#

i think it should be slot

#

yea

rugged topaz
#

i'm pretty sure you could realize that yourself

deft sedge
#

yea i did lol

rugged topaz
#

spacedash

#

and u ig lmao

solemn shoal
#

also wouldnt it be better to do java for (int slot = 0; slot < 9; slot++) { gui.setItem(slot,ItemStack); }

#

well yes i knew but i thought id point it out

rugged topaz
#

sure, less of a loop, but if he wants to set multiple rows

#
        for (int slot = 0; slot < gui.getSize(); slot++) {
            if (i < 9) {
                gui.setItem(slot, ItemStack);
            }

            if (i > 17 && i < 26) {
                gui.setItem(slot, ItemStack);
            }
        }
solemn shoal
#

youd need to and then

#

yeah

rugged topaz
#

and so on

deft sedge
rugged topaz
#

1st and 3rd

deft sedge
#

k thx

solemn shoal
#

if you changed the 9 to 10 and the 17 to 16 itd fill the left and right in the middle row too

rugged topaz
#

idek what that means

minor vapor
#

If you wanna make it easier, use slot % 9 to get the column (vertically) and slot / 9 to get the row (horizontally)

rugged topaz
#

tfw math

minor vapor
#

lol

deft sedge
rugged topaz
#

% means modulo

deft sedge
#

o

rugged topaz
#

meaning

#

yeah.

#

5 mod 4 = 1

#

1 mod 2 = 1

deft sedge
#

yea

#

i think we mean the same thing

rugged topaz
#

never had to use modulo

#

so i dunno even how to explain

deft sedge
#

i used it once to detect for even numbers

minor vapor
rugged topaz
#

don't tell me you got ur rank from mineplex

deft sedge
#

Because the mod will be 0 if u devide even number by 2

rugged topaz
#

divide* but yes

deft sedge
#

i didn't pass englis either

solemn shoal
#

time to see if my plugin compiles

#

yoo it worked

rugged topaz
#

i mean

#

it'll literally compile if you have no ide errors lmao

solemn shoal
#

yeah but i havent been able to compile in idk

#

a week?

rugged topaz
#

y

solemn shoal
#

because i moved to gradle

rugged topaz
#

o

solemn shoal
#

anyways, now to make a jar...

#

well i found one way to make a jar..

#

zip up bin folder

digital plinth
#

is there such an event that gets called when a compass points at somewhere?

#

theres compass.setLoc

solemn shoal
#

yes but thats for setting location

#

thats not an event

#

?jd

digital plinth
#

ik

solemn shoal
#

nope theres no event

#

nah i needed a link to the javadocs lol

digital plinth
#

yes i didnt find anything either

#

rip

solemn shoal
#

usually compasses point to spawn lol

#

unless set by a lodestone, or a plugin

dusty herald
#

Runnable is your best bet

#

if you want to change it periodically

#

or just have a runnable until it points in a direction

solemn shoal
#

this seems.. off lol

rugged topaz
#

yo @dusty herald

#

question

dusty herald
#

yeshi

rugged topaz
#

i'm placing an armorstand above a player as a "status" with a custom name, and it moves per tick (also tried playermoveevent) but, it's off, either delayed (or too early?) ik there's no way to perfect things faster than a tick but i've seen many servers pull off perfect and accurate movement, any idea?

#

it's just like a second nametag

digital plinth
dusty herald
#

I'm not too sure, I usually use hologram API for something like this not exactly but it was flush

solemn shoal
#

hm

rugged topaz
#

holographic displays?

dusty herald
#

yes

#

I suggest giving it a shot

solemn shoal
#

time for pain

rugged topaz
#

doubt they have some advanced technology

#

just an invisible named armor stand

dusty herald
#

I'll see if I can find some of my old code but I'm on mobile rn

upper vale
#

my armor stands lag behind a shit ton as well lol

rugged topaz
#

hypixel does it

upper vale
#

idk if thats just the nature of armor stands or smth

rugged topaz
#

if anyone's seen that here

solemn shoal
#

time for pain

rugged topaz
#

idk if it's with the use of packets

#

not that i think it'd change anything

quaint mantle
solemn shoal
#

had to fix this

#

because im too lazy for string concaternation

rugged topaz
#
Bukkit.getScheduler().scheduleAsyncRepeatingTask(instance, () -> {
      status.teleport(p.getLocation().add(0, 2.35, 0));
}, 1, 1);
``` 🤷
dusty herald
#

try it without async

rugged topaz
#

tried both

dusty herald
#

dang

rugged topaz
#

tried repeatingtask, tried event

#

tried spamming several instances of both

#

repeating tasks, and events

solemn shoal
rugged topaz
#

^ it was closer with that lamo but

solemn shoal
#

something seems odd here

rugged topaz
#

lmao

#

but that's inefficient asf

solemn shoal
#

anyone here have gradle experience?

#

minecraft has a really dumb method of storing its tick times imo

#

its just an array of long's

upper vale
#

:bruh:

solemn shoal
#

and it overwrites one value accorrding to a modulo

#

ticks is private btw so i cant even get it without reflection

deft sedge
#

what is the material type for a water bottle

solemn shoal
#

looking better

#

could use some smoothing

quaint mantle
solemn shoal
#

hm?

deft sedge
#

@quaint mantle do you know the material type for a water bottle

solemn shoal
#

how do you mean

candid galleon
#

Water bottle? GLASS_BOTTLE ?

deft sedge
#

ik

candid galleon
#

There are no water bottles in MC

deft sedge
#

but how do I check if there is water in the bottle

solemn shoal
#

isnt a water bottle a potion?

#

isnt it like POTION:0 (in old mc terms)

deft sedge
#

idk

solemn shoal
#

its drinkable, so are potions

deft sedge
#

ok but then how do i check if that potion is water

candid galleon
#

Get it’s effects

#

If there are none then it’s water

quaint mantle
#

getEffects() == null

#

or

deft sedge
#

ok, and this might sound stupid but how would I check for an awquard potion

candid galleon
#

Ok

#

Listen here you little shit

#

Those are good questions

#

Thank you

solemn shoal
#

lol

quaint mantle
#

lol

deft sedge
#

ok

solemn shoal
#

i think uh

#

i need a better workflow

quaint mantle
#

i am not your dad

solemn shoal
#

this is how i test my plugin no joke

candid galleon
#

@solemn shoal you know what they say

#

If Iooks stupid but it works, it ain’t stupid

solemn shoal
#

lol

#

i mean i made the jar manually

candid galleon
#

I still have to actually learn maven

solemn shoal
#

zipped up the net folder, added plugin.yml

deft sedge
solemn shoal
#

renamed to .jar

candid galleon
#

renamed to jar

deft sedge
#

what's to learn about maven? you just choose it in intelij setup and then double clik on package

candid galleon
#

You poor soul

deft sedge
#

well

#

i guess

#

probably are other aspects

candid galleon
#

I’ve probably wasted 5 hours by just avoiding the problem and copy pasting rather than properly learning it

solemn shoal
#

i mean

#

my gradle file is shit too

#

the jar task doesnt even make a jar

candid galleon
#

Noice

#

For stuff that doesn’t require maven dependencies I use IJ’s system too

solemn shoal
#

i migrated from apache ant a few days ago

#

well a few days

#

last week

#

only got it biulding today

young knoll
#

I have extremely simple build files most of the time

#

Works great

solemn shoal
#

i have a 65 line gradle file

young knoll
#

20 lines

solemn shoal
#

running shadowJar gives me a 261 byte file

young knoll
#

Probably isn’t ideal but it works

solemn shoal
#

i might just make it download 7z and build the jar thru cli commands

#

there we go

#

smooth as butter

deft sedge
#

How do i get the potion type from an item Stack

#

.getpotiontype isn't a thing

young knoll
#

PotionMeta I believe

deft sedge
#

ok

#

and then from the meta get the type

#

not working (bottleVal is the item stack)

#

oh

#

nvm hold on

#

.get potion meta isn't a thing either

young knoll
#

Cast it

deft sedge
#

k

#

Thx it worked

sullen dome
#

says ```Condition '!damageMap.containsKey(event.getItem())' is always 'true'


don't get it
am i too dumb rn?
or just have to ignore it
#

its like paradox lol

#

nvm i'm dumb i guess

#

yeah forget about it, figured it out lol

rugged topaz
#

curious

#

themed intellij?

sullen dome
#

intellij with material theme, yeah

deft sedge
#

How do i set a potion type?

sullen dome
#

player.setPotionEffect(new PotionEffectType(effect, duration, amount))

#

or smt like

deft sedge
#

k

solemn shoal
#

cant potions have multiple potion effects tho?

sullen dome
#

idk

#

this is just adding an effect to a player

deft sedge
#

no a potion like item

young knoll
#

Cough cough javadocs

sullen dome
#

^
he has a dog on his pfp, so he's always right

deft sedge
#

ik

solemn shoal
#

i wish i could change my name on spigot lol

sullen dome
#

is that a dog? to small to see instantly

solemn shoal
#

i havent used this name in YEARS

fading lake
sullen dome
#

figured it out already lol. everytime on event-call i created that new hashmap

fading lake
#

oh yeah that'll be it lol

deft sedge
sullen dome
#

so obv it's always false

solemn shoal
#

adCustomEffect

solemn shoal
young knoll
#

setBasePotionData sets the main effect iirc

sullen dome
deft sedge
#

ok

sullen dome
#

and it's definitely worth it

solemn shoal
#

are there like, actual docs on this? lol

sullen dome
#

on what

#

spigot? sure

solemn shoal
#

changing your spigot username lol

sullen dome
#

well they say you have to donate to change it...

solemn shoal
#

oh wait

#

its right there

deft sedge
#

Probably being dumb but...

sullen dome
#

lol

solemn shoal
#

also its 10$

sullen dome
#

it just takes the data...

#

not a potionType

deft sedge
#

ok

solemn shoal
#

its not that i dont want to donate but yknow

#

money

deft sedge
#

so then how do I set the type?

sullen dome
#

money doesnt grow on trees, yeah

#

ik

#

i have to live to end of month with like 60€

#

i feel you my man xd

solemn shoal
#

yikes

#

i wouldnt even be able to

sullen dome
#

well i'd say lets see how it goes

deft sedge
sullen dome
#

if i die, it happened lol

sullen dome
solemn shoal
#

i get 150-200/month

deft sedge
#

i'm probably being stupid but how would I set the potion type

solemn shoal
#

keep in mind that includes food, netflix for the family etc

sullen dome
#

well i'm alone here

#

saaad

solemn shoal
#

like, i dont have spare lol

deft sedge
solemn shoal
#

well i dont have school now because vacation so food doesnt count

deft sedge
#

what vacation?

sullen dome
#
meta.setBasePotionData(new PotionData(PotionType.AWKWARD));```
deft sedge
#

personal or is it a big holdiay

solemn shoal
#

big holiday

deft sedge
#

oh

#

where do u live (country)

solemn shoal
#

well "vacation" thats what we call it here

#

Belgium

deft sedge
#

oh

#

im in murica

solemn shoal
#

ah

sullen dome
#

ohh hello my neighbor :)

solemn shoal
#

where do u live, Rivex?

sullen dome
#

germany lol

solemn shoal
#

ah lol

#

nice

sullen dome
#

country with almost worst internet

solemn shoal
#

been there once

deft sedge
#

i get 250 down and like 10 up

sullen dome
#

on paper, or really? xd

deft sedge
#

but that's on cable line

solemn shoal
#

i get 140 down 7 up on cable

deft sedge
#

deecent

sullen dome
#

on paper it's 100down and 10up

#

in real, its like 150 down, but 2 up

deft sedge
#

onece we ditched stupid at&t it was much better

sullen dome
#

and i need my fucking upload

solemn shoal
#

i mean, at least its stable

deft sedge
sullen dome
#

i upload files

#

much files

solemn shoal
#

my internet is so unstable, cant even host discord bots properly

sullen dome
#

big files

solemn shoal
#

ah f

sullen dome
#

i can watch 4k videos

solemn shoal
#

i used to host mc servers on my home connection

sullen dome
#

but can't play mc without lags

#

thats vodafone my boys

deft sedge
#

i do that rn

quaint mantle
#

How can I set the animation state of a Double-Chest to closed? I've got a PlayerInteractEvent that opens its inventory, but it stays open perpetually. trying to close() both chests doesn't help.
Single chests work as expected.

//If that block is a Chest
if(Attached.getState() instanceof Chest) {
    //Open the inventory
    Chest c = (Chest)Attached.getState();
    Inventory i = c.getInventory();
    p.openInventory(i); 
    if(i instanceof DoubleChestInventory) {
        DoubleChestInventory dci = (DoubleChestInventory)i; 
        ((Chest)dci.getHolder().getLeftSide()).close();
        ((Chest)dci.getHolder().getRightSide()).close();
    }
    c.close();
    c.update(true);
} 
sullen dome
#

double-chests are dumb to work with

solemn shoal
sullen dome
#

i guess my internet is enough for vc, thats it

solemn shoal
#

now my server is hosted in the US and sometimes my ping jumps to 7000+ ms

sullen dome
#

1080p discord-live is lagging like hell

deft sedge
#

oof

#

Y do u host in Us?

solemn shoal
#

because company server

deft sedge
#

oh

solemn shoal
#

well "company"

sullen dome
#

he's a big guy lol

solemn shoal
#

lol

#

had free resources lying around so why not

sullen dome
#

wait you're the owner of arcane?

#

lol

solemn shoal
#

no?

deft sedge
#

How do u need 32 gigs

sullen dome
#

then nvm

deft sedge
#

is that a mc server

solemn shoal
#

yes thats an mc server @deft sedge

deft sedge
#

Why does it need 32 gigs

solemn shoal
sullen dome
solemn shoal
#

not me lol

young knoll
#

Large amounts of RAM may actually slow down GC

sullen dome
#

then my mistake, looked like it

deft sedge
#

oh so u have like a big server

solemn shoal
#

im using aikar's flags

young knoll
#

But I imagine java has been optimized better for that now

solemn shoal
#

"big server"

sullen dome
#

xd

solemn shoal
#

currently 2 players online

#

its a mc server for my school lol

deft sedge
#

No dip u have a minecraft server ur in spigot debug 🤦‍♂️

#

yea I have one for my friends too

#

they are pains

sullen dome
#

still wondering that 2 players can lag my server to hell, just with chunk loading

solemn shoal
#

lol

#

my only issue so far has been disk space @sullen dome

sullen dome
#

idk what my issue is tho

#

it just lags

deft sedge
#

I host for free and then they're always like CHANGE THE WORLD

solemn shoal
#

huh

#

i cant type in console

sullen dome
#

ryzen 9 3900, 8gb of ram, 2 players lag the server to hell

#

love it

deft sedge
#

ummm

solemn shoal
#

did remote viewer break?

deft sedge
solemn shoal
#

ssd or hdd?

sullen dome
#

nvme ssd

solemn shoal
#

huh..

#

how much ram allocated to mc tho

sullen dome
#

i mean, its probably a shared one, but still wtf

#

all of the 8gb

solemn shoal
#

oh its offsite hosting

#

not like, self hosted lol

young knoll
#

That’s a decent deal though

sullen dome
#

yeah, its offsite

deft sedge
#

y do u need a ryzen 9 for mc?

sullen dome
#

idk

#

for 16€ why not

solemn shoal
deft sedge
#

Lol u want rams not cpus

solemn shoal
#

check cpu usage

young knoll
#

The problem I’ve had with shared hosting is moving files around to change mods/version/etc

sullen dome
#

for 2 players? please

young knoll
#

That and my terrible upload speed

deft sedge
solemn shoal
#

it isnt

#

its open source lol

deft sedge
#

lol jk

solemn shoal
#

regardless, it has a command (/stats)

sullen dome
#

i guess 8gb of ram should be far more than enough for 2-5 players

solemn shoal
sullen dome
#

5 at really maximum

solemn shoal
#

obviously, shows stats lol

deft sedge
solemn shoal
#

i mean, its fine for me

deft sedge
#

oh nvm

solemn shoal
#

considering i play with gui scale set to 2

deft sedge
#

eww

solemn shoal
#

at 1080p lol

young knoll
#

It’s be useful with a toggle

#

Visualization is good

solemn shoal
#

i mean

sullen dome
#

i have mine at 3

solemn shoal
#

it IS a toggle

deft sedge
#

this is mine

sullen dome
#

guess thats auto? so maximum

solemn shoal
young knoll
#

Then yeah it’s probably useful

deft sedge
#

idk I get used to it

solemn shoal
#

i mean it doesnt show when you initially join

sullen dome
#

you have a 4k or just very small gui

solemn shoal
#

i have 1080p

sullen dome
#

lol

#

then thats fucking small

solemn shoal
deft sedge
#

1 pixel per item

solemn shoal
#

no?

deft sedge
#

im kidding

solemn shoal
#

lols

sullen dome
#

dafuq

solemn shoal
#

hm?

sullen dome
#

just small

solemn shoal
#

meh

#

its what im used to

#

its the same size as auto on default screen size

sullen dome
#

i send you mine, gimme a sec

solemn shoal
#

thats at the default window size for mc btw

sullen dome
#

thats mine

solemn shoal
#

yeah ok

#

thats a bit bigger then mine

sullen dome
#

a bit

#

yeah

solemn shoal
#

lol

deft sedge
solemn shoal
#

regardless

sullen dome
#

F

deft sedge
#

gottem

solemn shoal
#

use my plugin if u wanna check cpu

deft sedge
#

lol

solemn shoal
#

or find another one that does the same thing, if it exists

#

lol

shut mango
#

can any1 recommend me a staff plugin?

solemn shoal
#

how do you mean a staff plugin

shut mango
#

Just something i can use to manage bans and that kinda thing, maybe staff chat too

solemn shoal
#

manage bans: vanilla mc

#

staff chat: i think theres a plugin for that?

shut mango
#

Thank you!

solemn shoal
#

i mean, managing bans isnt that hard with vanilla commands

#

tho idk if it does timed bans, if you need that i'd say get essentials

young knoll
#

Vanilla does not

solemn shoal
#

however that comes with a lot of other stuff such as /home, /warp, /vanish etc

#

ree i have to rewrite my fast xp pickup thing to support mending

olive lance
#

whats the best way to make a custom item work with say a kits plugin?

sullen dome
#

wdym with custom item?

olive lance
#

like a stick with name/lore that would do something special

sullen dome
#

should work like a normal item lol

olive lance
#

i guess just have the put the name/lore in manually

sullen dome
#

why that? dont know exactly what you wanna do lol.

your custom item has the same base as a vanilla material.

so it uses your custom name/lore/whatever

#

except youre doing some weird stuff

olive lance
#

Yeah I know my question was bad i don't even have a custom item

#

just was thinking about this

sullen dome
#

well i would say then, use an item builder to create and set that item, so it has the same lore and name as every other one

olive lance
#

sorry that question was dumb heres a better one unrelated

#

is there a way to add a non visible identifier to an item

quaint mantle
#

so does this no longer work in 1.16? specifically the getTitle

if(event.getClickedInventory().getTitle().equalsIgnoreCase());

Edit: nvm figured it out.

young knoll
shut mango
#

should i get rid of EssentialsAntiBuild if I have CoreProtect

#

?

deft sedge
#

Anyone know what this could mean? It happens every time I refil a water bottel

young knoll
#

Something is null at that line

deft sedge
#

does it say the line?

#

My plugin doesn't do anything when it comes to refilling water bottles

young knoll
#

Yes it does

cloud berry
deft sedge
#

yea

cloud berry
#

if so check ur playerinteractevent handler

young knoll
#

Read the bit directly below nullpointerexception: null

deft sedge
#

?paste

queen dragonBOT
young knoll
#

event.getClickedBlock is nullable

deft sedge
#

ohhh

#

so should I detect if it's null

young knoll
#

Mhm

cloud berry
#

bingoe

young knoll
#

Or check if the action is RIGHT_CLICK_BLOCK

#

Or left click I suppose

deft sedge
#

ok

#

but it happens even if i'm not clicking on the brewing stand

cloud berry
#

also instead of (!(a==b)) u can do (a!=b)

cloud berry
deft sedge
#

so that

#

should fix...

cloud berry
deft sedge
#

ok thx

cloud berry
#

gl gl

deft sedge
#

is detecting if a player drank something the same as player consume event?

young knoll
#

Yes

deft sedge
#

ok

quaint mantle
#

For banning-muting players would you rather save them on a separate yml or use "Bukkit.getBanList"? Etc

#

banList

#

use SQL if possible for muting

dusty herald
#

I suggest using the Bukkit method for compatibility and in a worst case scenario backup if your plugin decides to take a swan dive

#

I wish LiteBans had a feature where it would sync with the local banlist

#

idk if that exists

summer scroll
#

I mean doesn't run the subCommands.get(i).perform(sender, args);.

young knoll
#

Return exits the method at that point

#

So yes

weary geyser
quaint mantle
#

can i change the default message of some commands? (like /gamemode).

sullen dome
opaque grove
#

I need help: I use schedulesyncrepeatingtask to create a countdown if a player dies. I save the taskid and cancel the task when the countdown = 0. But when two player die, the saved taskid gets overritten and only one task gets cancelld. Any better way to create a display?

sullen dome
#

a task isn't player-specific, except you do them for(online-players) or save them in a hashmap

opaque grove
#

i know, thats the roblem i have, is there something like a player specific scheduler

sullen dome
#

i think even in for(players) they're not for specific players

opaque grove
#

yeah i tried it

sullen dome
#

not directly i think

opaque grove
#

maybe i try to save player uuid and taskid in a hashmap

sullen dome
#

i would say, you use a hashmap<UUID,Integer> and count down that player-specific integer

#

thats what i use for cooldowns

opaque grove
#

ok ill try, thanks

sullen dome
#

maybe take a look at this, this is how i put kit's on cooldowns, maybe it helps

   @Override
    public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, @NotNull String[] args) {
        if (sender instanceof Player) {
            Player p = (Player) sender;
            if (cooldown.containsKey(p.getUniqueId())) {
                //still on cooldown
            } else {
                
                //execute your command
                
                cooldown.put(p.getUniqueId(), 15); // 15 means 15 seconds cooldown
                task = Bukkit.getScheduler().runTaskTimer(Main.getPlugin(), () -> {
                    if (cooldown.get(p.getUniqueId()) > 0) {
                        cooldown.put(p.getUniqueId(), (cooldown.get(p.getUniqueId())) - 1);
                    } else {
                        cooldown.remove(p.getUniqueId());
                        //cooldown removed.
                        task.cancel();
                    }
                }, 0L, 20L);
            }
        }
        return false;
    }```
#

or whatever, i gave that another user here

dusty herald
#

I usualy use expiringmaps

weary geyser
#

Does anyone know how to calculate the remaining XP to a level with the XP increasing exponentially? (Not MC XP)

quaint mantle
#

you should have some type of formula

#

then pre-calculate the xp for each level and cache it

#

then check how much is needed until next level

quiet ice
#

Basically, you need to add some Math#pow spice

quaint mantle
#

Anyone have co.aikar.commands in JAR?

dusty herald
quaint mantle
#

What si Action it needs to be defined?

#

this too

rugged topaz
#

how do i use player#teleport without playing the landing sound?

alpine radish
#

do you mean "fall on land" sound?

worldly ingot
#

Could probably try some hackery with Player#teleport(), then Player#setFallDistance() or whatever that method is... set it to 0

#

Not sure if that would fix it but PES_SadShrug

quaint mantle
#

How can I get exact coordinates?

#

getLocation doesnt do that I think

eternal oxide
#

what do you mean by "exact coordinates"?

quaint mantle
eternal oxide
#

um, that is literally the Location

quaint mantle
#

I needed it as coordinates

eternal oxide
#

ok

quaint mantle
#

Anyways, how can I get the item in the mainhand of the player?

eternal oxide
#

getItem()

#

Returns the item in hand represented by this event

quaint mantle
#

so player.getItem()

eternal oxide
#

no event

quaint mantle
#

Why event

#

I need to get the item from the player

quaint mantle
#

I dont orientate in javadoc

#

I was already there

eternal oxide
#

Then you need to read it.

quaint mantle
#

I did

eternal oxide
#

the method is in there and it tells you exactly what it does

quaint mantle
#

I cant understand what its trying to tell me, I dont see the syntax

#

I need an example

#

this is just some sort if method list

eternal oxide
#

You just need to learn to read javadocs. they have all the information you need

eternal oxide
#

just look at teh method summary section

odd gulch
#
player.getInventory().getItemInMainHand()```
eternal oxide
#

no

#

he's in an event

#

he needs to get the item that was used to interact

quaint mantle
#

I need to to get the item from the player, because I later have to delete after the event ends

eternal oxide
#

Which is a method of that event

#

You do not get it from the player, you get it from the event.

odd gulch
#

Ah. Didn't read into the context other than getting the item in the main hand. Then do as ElgarL mentioned.

eternal oxide
#

if you want to delete it just set its stack size to zero

quaint mantle
#

if(e.getItem().equals(Material.SHEARS) && e.getItem().getItemMeta().getLore().equals(protectorlore)){
int coordinatex = e.getClickedBlock().getLocation().getBlockX();
int coordinatey = e.getClickedBlock().getLocation().getBlockY();
int coordinatez = e.getClickedBlock().getLocation().getBlockZ();
}

#

So this should be correct?

eternal oxide
#

getLore.equals is going to instance check the returned array

quaint mantle
#

huh?

#

ArrayList<String> protectorlore = new ArrayList<>();
protectorlore.add(ChatColor.RED + "" + ChatColor.BOLD + "Vyvolá gigantického golema, který bude chránit tvé okolí!");
protectorlore.add(ChatColor.GOLD + "" + ChatColor.BOLD + "MYTHIC");

eternal oxide
#

equals will not pass just because the contents are the same

quaint mantle
#

So what do I do then?

eternal oxide
#

you need to check the contents manually, or create a method to do it. if you just use equals it will fail as the two arrays are different objects.

odd gulch
#

Also getItem() is not a Material. You would have to getType() and check using ==

quaint mantle
#

e.getItem().getType() == Material.SHEARS

quaint mantle
#

But that would suck

eternal oxide
#

getLore() returns an array

quaint mantle
#

Ok, so if I cant use equals. what do I use?

eternal oxide
#

one sec

#

checkign the equals

#

OK, you can use equals, with Lists it only checks the contents not an instance

eternal oxide
#

You have to be really careful with .equals as usually it also compare teh object instance.

#

yes

quaint mantle
#

Thank you

eternal oxide
#

Is there a reason you needed the precise coords?

quaint mantle
#

Yes beacuse I need to dispatch a command with coordinates, I'm spawning a custom entity using MythicMobs

eternal oxide
#

does MM not accept a Location?

#

Would be very odd if it doesn't

quaint mantle
#

I dont know, but I dont think getLocation prints out the exact coordinates

eternal oxide
#

it does. You are rounding it with getBlockX

#

you're actually throwing away precision.

quaint mantle
#

Oh

#

Location location = e.getClickedBlock().getLocation();

#

now its better

#

ty

#

And now I forgot, how do u dispatch command as a console?

eternal oxide
#

You try to avoid it if at all possible.

quaint mantle
#

Nope

#

not possible

quaint mantle
eternal oxide
#

Thats what APIs are for

quaint mantle
#

Well I dont know how to program one for MythicMobs

chrome beacon
quaint mantle
#

Well, fuck...

eternal oxide
#

it has a full API

chrome beacon
quaint mantle
#

I have no idea what to do

eternal oxide
#

what command do you need to issue?

quaint mantle
#

"mm m spawn golemfinal " + location

#

btw
Location location = e.getClickedBlock().getLocation();

summer scroll
#

Pretty sure you can spawn MythicMobs mobs using their API.

quaint mantle
chrome beacon
#

Use the BukkitAPIHelper class

quaint mantle
#

Whats that?

quaint mantle
#

Ok this looks usable

#

but I need to somehow import mythicmobs classes/methods etc idk

eternal oxide
#

you add MM as a dependency in your pom

quaint mantle
#

whats that

eternal oxide
quaint mantle
#

Hello, spigot! I made a custom recipe (with ItemStack). And I tried to set the amount of items needed, but I can't. Code example I tried:

ItemMeta meta = sickFlesh.getItemMeta();
        sickFlesh.setDisplayName("Flesh");
        sickFlesh.setItemMeta(meta);
        sickFlesh.setAmount(4); // **this part**
        ItemStack damager = new ItemStack(Material.AIR); // Material for craft
        ... (setting meta)
        ItemStack lightningAxe = new ItemStack(Material.AIR); // Item made in craft
         ... (setting meta)
        NamespacedKey key = new NamespacedKey(plugin, "LightningAxe");
        ShapedRecipe recipe = new ShapedRecipe(key, lightningAxe);

        recipe.shape("%% ", "%$ ", " $ ");
        recipe.setIngredient('$', new RecipeChoice.ExactChoice(damager));
        recipe.setIngredient('%', new RecipeChoice.ExactChoice(sickFlesh));```
chrome beacon
#

Amount has to be 1 in recipies iirc

quaint mantle
young knoll
#

Recipes don’t support custom amounts for ingredients

eternal oxide
#

Are you using Maven to build?

quaint mantle
eternal oxide
#

If I Remember Correctly

chrome beacon
#

^^

quaint mantle
#

ahh

#

ok thanks, So is there any way to control this amount?

chrome beacon
#

Yes but don't it will just be confusing for users

young knoll
#

If you want to use more than one you’ll have to do some stuff with the PrepareItemCraftEvent

chrome beacon
#

^^

quaint mantle
#

Then do I have to throw away all the codes I've done so far?

chrome beacon
#

Well it's up to you how you design it

#

You can probably reuse some of it

stray halo
#

Hello, are there any "started breaking block" and "stopped breaking block" events?

eternal oxide
#

no

#

Theres no event for stopped

chrome beacon
#

You will have to use Protocollib

#

Or listen to the packets on your own

sour sand
#

is there a way to fill blocks like with the fill command

#

but in the code

chrome beacon
#

Yeah loops through all the blocks and set the type manually

#

You'll need 3 for loops

sour sand
#

right ok

#

how do you set the block

drowsy helm
#

get location, get block then set Type

sour sand
#

ok thanks

cold tusk
#

Hello, how to replace a default Minecraft command (E.g. msg) with a custom command?

fading palm
#

i believe the default commands will always exist, but you can just make another command with the same name and set the event priority to highest (?)

eternal oxide
#

commands have no priority.

fading palm
eternal oxide
#

You shoudl be able to just make a command and override it

sand vector
stone sinew
#

org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: me/kian/SpigotPlugin/Main has been compiled by a more recent version of the Java Runtime (class file version 59.0), this version of the Java Runtime only recognizes class file versions up to 52.0

chrome beacon
#

You compiled your plugin with a newer Java version than the server is running

#

Set the target compile version to Java 8

quaint mantle
burnt totem
#

reload maven

quaint mantle
#

i have done that

#

10 times

eternal oxide
#

does your Main class extend JavaPlugin or java?

quaint mantle
chrome beacon
#

Is that Sync database code 👀

quaint mantle
#

i just grabbed it from a tutorial

chrome ferry
#

bruh-

quaint mantle
#

it's my first time coding with databases in java

eternal oxide
#

Remove the Bukkit dependency from yoru maven

quaint mantle
#

i will try

eternal oxide
#

if you need NMS you depend on spigot. if you don;t need NMS you depend on spigot-api

chrome ferry
#

^^

quaint mantle
#

same error

#

& i dont use NMS

eternal oxide
#

lastly, stop using artifacts to build

quaint mantle
#

how am i then supossed to do it?

eternal oxide
#

very right hand side you need to open teh Maven tab and use the lifecycles section

#

package

chrome beacon
#

Please don't name your main class Main ;/

chrome ferry
#

and also that

quaint mantle
#

ok

chrome ferry
#

this is my main class 😎 pretty swag for my plugin PlayerWarps

ivory sleet
#

Nice but why is that boolean field static?

tacit goblet
#

Don’t make something static unless it absolutely needs to be ^

stone sinew
tacit goblet
#

Isn’t it better to create a new object and access the variable that way rather than doing static variables?

tacit goblet
#

I know it’s easier, but all people who’ve taught me in the past call that a band aid solution

#

I just wanna get more opinions lol

#

Is there any reason beyond ease of use?

stone sinew
#

Most people here will complain its "abusing static" but in reality its not. Its opinion based.

eternal oxide
#

private static with a getter would be the proper method

tacit goblet
#

Makes sense, thanks 🙂

ivory sleet
minor fox
#

Does anyone know which field in NMS is displayed in the tab list?

stone sinew
eternal oxide
#

the point of getters is to control the access from external sources

ivory sleet
#

This is probably because your projects are small

#

Getters and setters are good because it protects you from yourself and gives you more control over your fields. It’s also nice if you for instance wanna change the logic internally.

stone sinew
#

Doesn't use static because of fear of outside sources changing variable... Uses public getters/setters anyways

eternal oxide
#

If you make a field public static you are then exposing that whole field. If you use a static getter/setter you only expose teh result. the field you can change however you like without breaking your API

#

the event fires before damage is applied

#

which is why its cancellable

sand vector
eternal oxide
#

you simply get teh health - final damage

#

event. and look at the provided options

#

String.format

#

or whatever you choose to display

stone sinew
#

Math.floor(damage)

ivory sleet
#

It floors it, not rounds afaik

chrome ferry
ivory sleet
#

Wat

#

You can change that field even without static

chrome ferry
#

yeah i know by using the plugin instance

ivory sleet
#

Assume you have a non static field

#

So there’s really no point

chrome ferry
#

i mean its just easier so i dont have to get the plugin instance all the time just for that little boolean

ivory sleet
#

I can’t change your opinion so I guess

chrome ferry
#

i think theres only 4 static variables in the entire of 7k lines of code 😂

ivory sleet
#

But if you just prioritize to code with minimal lines and not caring about the actual project structure/design then just use kotlin or something that would remove all unnecessary boilerplate and verbosity.

stone sinew
ivory sleet
#

Not really my point

#

But it may the case that another language is better suited then

stone sinew
ivory sleet
#

Elaborate

chrome ferry
#

i never said that i wanted minimal lines, and i also never said i dont like the project structure of design because i do, i literally make my own object for everything. i love how all of this is over one static variable lmfao

ivory sleet
#

With “easier” I assume you meant less lines or did I assume wrong?

chrome ferry
#

no i did not mean less lines

ivory sleet
#

So what did you define easier?

chrome ferry
#

so you dont have to store the plugin instance in classes that really do not need it, i'm just saying i ain't going to add the plugin instance to every class i have 😂

eternal night
#

Can't blame a man for static usage when spigot/Bukkit itself is very static reliant

chrome ferry
#

you think thats bad with one variable as static oh boy you wanna look at grief prevention 😂

ivory sleet
#

Well it’s sort of an api context provider lynx

eternal night
#

So ? XD

chrome ferry
#

i've seen a lot of OOP apis/libs tbh

ivory sleet
#

Usually when it comes to api modules you’re fine to have a class using static as entry point

eternal night
#

No lol 😂

ivory sleet
#

Yep

eternal night
#

Have you tried unit testing Bukkit ?

ivory sleet
#

I mean MockBukkut

eternal night
#

What a mess that is ?

#

Yeah

ivory sleet
#

But yes even that is cumbersome

eternal night
#

An entire project is needed just to unit test it

#

There are plenty of well designed APIs out there that do not rely on static as much as Bukkit does

#

Java itself provides the service loader which could have been used to get your initial instance of Bukkit. Sponge used injection to get you your game instance etc

ivory sleet
#

Relying on static may the wrong word but providing the api with static rather. Take a look at LuckPerms for instance. To get its api you can either use their static singleton or I think services manager. But even so if we exclude the services manager it wouldn’t make sense to create a new object that doesn’t have a state, but purely is made of providing the api.

eternal night
#

Hmm I mean yes, Bukkit doesn't just do that tho

ivory sleet
eternal night
#

There are a lot of places in bukkits API where they themselves call on the Bukkit singleton

#

Which is the problematic part

ivory sleet
#

Yeah

#

Unit testing isn’t really possible because of that sadly

eternal night
#

😪😪 yus

quaint mantle
#

Hey
I created a custom enchantment that i can give me using a command

How can I "add" this enchantment to a books? I mean when I go to creative, I go to book and I can see my enchantment in a book

outer crane
#

how did you create the enchantment?

quaint mantle
#

Uh random tutorial on YouTube

But using something like this:

public class EnchantmentWrapper extends Enchantment {
    
    private final String name;
    private final int maxLvl;
    

    public EnchantmentWrapper(String namespace, String name, int lvl) {
        super(NamespacedKey.minecraft(namespace));
        this.name = name;
        this.maxLvl = lvl;
    }
#
public class CustomEnchants {
    public static final Enchantment SAVE = new EnchantmentWrapper("save", "Save", 1);
    
    public static void register()
    {
        boolean registered = Arrays.stream(Enchantment.values()).collect(Collectors.toList()).contains(SAVE);
        
        if (!registered)
        {
            registerEnchantment(SAVE);
        }
    }
    
    public static void registerEnchantment(Enchantment enchantment)
    {
        boolean registered = true;
        try 
        {
            Field f = Enchantment.class.getDeclaredField("acceptingNew");
            f.setAccessible(true);
            f.set(null,  true);
            Enchantment.registerEnchantment(enchantment);
        }
        catch(Exception e)
        {
            registered = false;
            e.printStackTrace();
        }
        if (registered) 
        {
            
        }
    }
}
quaint mantle
quaint mantle
#

umm

#

okay

#

i've just started today so i can't really do this

#

is there any easier way

#

I suppose you could add the enchant names to the lore of the book

#

Then check if the book has the enchant's name when you are going to apply it

covert urchin
#
Enchantment MyCustomEnchantment = new blah.blah.blah.MyCustomEnchantment();
ItemStack newBook = new ItemStack(Material.ENCHANTED_BOOK);
newBook.addEnchantment(MyCustomEnchantment, 1);
#

¯_(ツ)_/¯

quaint mantle
grave kite
#

Hi, I have a lag exploit involving PacketPlayInAutoRecipe in 1.12.2. Is there a way to disable it?

covert urchin
#

@quaint mantle so what's the issue? isn't that what they want?

quaint mantle
#

So if you add fire aspect or something you could slap people with a fire aspect book

#

Not really

eternal oxide
covert urchin
#

o.O

quaint mantle
#

Adding enchants to the book and storing enchants in the book are not the same thing

covert urchin
#

@quaint mantle but you use anvil event listeners to apply the enchantment from the book to eligible items. and skip your enchantment code when it does not apply to the item it's on.

covert urchin
#

and then it would be fine.

eternal oxide
#

one sec

quaint mantle
covert urchin
#

it's what I wound up doing anyway for one of my enchantment plugins, idr where my headache was but I remember most of the actual enchantment stuff seemed fine. I think one of the headaches though was that when you enchant you have to also have your plugin add the lore to the item being enchanted.

#

not so much a headache really

#

just didn't know that when I was messing with it

eternal oxide
quaint mantle
#

@quaint mantle But using his method i'm going to be able to get the book in creative mode ?

#

You mean with commands? Or purely creative?

#

purely creative

#

like

#

/gamemode creative

#

you open inventory

#

and you found it

#

No

#

I guess I need to add the enchanted book to the creative mode ?

#

in onEnable

#

You can't add items to the creative inventory with a plugin, you would have to get the custom enchanted book with a command

#

frl?

#

i through we were able to add any items to creative inventory

#

Only with mods

grave kite
quaint mantle
#

what's the difference between mods and plugin

quiet ice
#

none

quaint mantle
#

then?

quiet ice
#

Though bukkit is only serverside, which is the only limitation

quaint mantle
#

ah yes

quiet ice
#

Creative list is clientside

quaint mantle
#

Mods are mainly clientside

#

is there are clientside

#

like

#

we can make

quiet ice
#

Mods are usually both sides

#

Forge and Fabric are the biggest

eternal oxide
quiet ice
#

But as you may know, the client needs to download it manually

quaint mantle
#

and I guess we cant' make something like when someone connects to the server (with any client), it "gave" the mod

#

yes

quaint mantle
#

can we make it with Forge ?

quiet ice
#

Probably not as easily, but it would be possible

quaint mantle
#

Caused by: java.lang.IllegalArgumentException: Specified enchantment cannot be applied to this itemstack
I'm getting this

#

is it because it's an Custom Enchant?

quiet ice
#

Applying CEs with this is not really intended by the bukkit API

#

The issue is that registries are intialized at startup and you would get the modifications at mid-runtime, which means that client either needs to refire the registry init or do some hackery to force-change the registries