#help-development

1 messages Β· Page 2098 of 1

red sedge
#

or do i need to keep track of that myself

upper crater
#

how can i access i in the scope i need it in (underlined by orange)

red sedge
#

persistentancy?

red sedge
#

Oh

#

right... so like

#

ill give a data to a block right?

#

blocks chunk?

#

not the block?

#

Can I ask why?

#

I see

#

would it be efficient tho? to like have a pdc for every block in a chunk

#

i mean

#

i can probably just store the true values

#

and delete them if they are false

#

that would be more efficient

#

okay! thanks!

earnest forum
#

yes they do

#

I don't know if regular blocks have them but blocks that have entities do

#

it does

#

I guess not for the block then

sand vector
#

bump

vocal tundra
#

true runnable only needed if you want to be able to cancel and keep track of the task

upper crater
vocal tundra
#

that will compile, maybe not the result you wanted but it'll compile

lavish robin
#

is their anything wrong with this syntax. the second command won't load ```
commands:
test:
description: TestCommand
usage: /test
permission: 2
mark:
description: Marks Loot
usage: /mark <x> <y> <z>
permission: 2

#
this.getCommand("mark").setExecutor(new MarkLoot());```
dusk flicker
#

look at the differences

#

the mark one has usage and permission on an extra tab, while the first one are all inline. Remove the extra tab on the usage and permission of mark and give it a shot

lavish robin
#

oh thanks

sand vector
#

what is the best way to check how long it has been since a player left?

vocal tundra
#

config file or database I'd say

sand vector
#

thats the thing. Basically I have a cache and after like 5 minutes after the player leaves I want to save their data from the cache to the database. So do I use a hashmap and store the uuid and the time left and create a timer that checks to see if the player is online?

upper crater
#

thanks

sand vector
#

So that if the player rejoins within 5 minutes it means that it can just get the concurrent data from cache rather than from the database.

#

trying to relief stress off the database and keep it on the cache

vocal tundra
#

Fair, your hashmap idea would work well, but instead of 5 minutes for each player, I'd say just flush the entire offline cache every 5 minutes instead of keeping track of that for each player

sand vector
#

so have two caches one for online and one offline and every 5 minutes flush the offline?

quaint mantle
#

I've never coded a spigot plugin before, is there any where I can be directed to start?

vocal tundra
#

You shouldn't need to store anything for the online players, if they're on the server you just assume they've been offline for 0

sand vector
#

Ok cheers for the help

sand vector
proud basin
#

Anyone know if XSeries is worth going into?

summer scroll
proud basin
#

Does it just help with version compatibility?

summer scroll
#

yeah, it's mainly for cross version compability

#

What's the best way to create a leaderboard system with mysql database? I want it to be updated and sync across multiple servers, basically I want to have a highest killstreak leaderboard.

vast plinth
#

is there a way to make custom items

#

with custom icons

vocal tundra
#

resource pack

#

or player heads

vast plinth
#

its possiable

vocal tundra
#

Give an example

worldly ingot
#

You can't add custom textures without a resource pack

muted sand
#

transfer packets in bedrock transfer clients between ips. how does this help cross regional players?
uk players would get bad ping with a typical proxy
but if there was a server in the uk region, and someone from us wanted to play on it, wouldnt that get higher ping aswell?

#

okay nevermindi understand it more after using the discord search function ✨

nova grove
#

How can I check for if a player has killed an entity such as a pig or cow. When looking online I can only see other players.

quaint mantle
#

EntityDeathEvent

#

i think

quaint mantle
#

Player player = event.getEntity().getKiller();

#

if (player == null) // no killer

wide pagoda
#

Does Location.getBlock() return an air when there is no block at the location?

quaint mantle
#

yup

nova grove
#

ty

wide pagoda
#

and there would be no reason that Location.getBlock().setType(...) would error in that case I assume

quaint mantle
#

right

wide pagoda
#

alr thanks

sharp bough
#
 int freeSlotsOnPlayerInv = 0;

        for (ItemStack itemStack : p.getInventory().getContents()){
            if (itemStack == null || itemStack.getType().isAir()) continue;
            freeSlotsOnPlayerInv++;
        }

how is that returning the amount of slots used instead of the empty slots?

#

27 in this case

#

wait no

#

tf

#

wait no ignore that

nova grove
#

Anyone know if there is a reliable way for me to switch between Java 8 and Java 16?

vocal tundra
noble lantern
#

theres a WAY simpler way of doing this if you do

sharp bough
noble lantern
stuck swift
#

does anyone know why the 1.18.2 spigot.jar file is not recognizing anything such as when i import something its only org.bukkit.craftbukkit and cant do anything else (its hard to explain)

noble lantern
#

if greater than -1 player has space

sharp bough
#

but i dont need 1 slot

#

i need X slots

#

depending on how big the list is

#

you mean a while

#

and adding while firstEmpty != -1?

noble lantern
#

Well your just adding a List of ItemStack's correct

#

and thats it?

sharp bough
#

yea thats it

noble lantern
#

use a for loop

#

and use that statement at the start of your for loop

#

if the returned value is -1 return out of the loop

sharp bough
#

yea but i kinda want to add them only of the player has enough space for all of them

noble lantern
#

you can always remove every ItemStack you add to the player's inventory from your list

If the list isnt empty at the end of it, you can drop those items at the players feet

vocal tundra
#

why not just drop them all then? isn't that what /give does anyway

noble lantern
#

/give adds directly to the inventory

#

and stops if theyres anything left (Ie if you add 50000 of an item, it will only fill the inventory)

eternal oxide
#

addItem returns a HashMap of all items that did not fit

noble lantern
#

ohh forgot that

#

^ thats a better solution

vocal tundra
#

But under the hood it's basically dropping them on you with 0 pickup time I'm pretty sure, since when you cancel pickup item event /give breaks and gives you 2 items instead of 1

sharp bough
noble lantern
#

interesting i thought they changed the code to that years ago

vocal tundra
#

1.8/1.12 are my main versions so you might be right

noble lantern
#

ahh that might make sense

#

plus

#

essentials/cmi overrides that command (should at least)

vocal tundra
#

yeah cuz it breaks easy

noble lantern
#

kind of like this plugin that im writing will when i finally test it

vocal tundra
#

lmao

#

the struggles

noble lantern
#

i kind of underestimated how much code this would require ngl

vocal tundra
#

are you talking about your custom enchants

noble lantern
#

Nah random item plugin

#

I wanted a system similar to how EliteMobs items work

vocal tundra
#

oh yeah random enchants and nbt I mean

noble lantern
#

in a sense yes

#

360 lines and all it does is generate a random name with values from config lmfao

vocal tundra
#

well configs are a pain

noble lantern
#

yeah they are, especially when i make them configurable to any needs

#

sec

#

?paste

undone axleBOT
noble lantern
#

enchantments one is gonna be aids

Configs inconsistent since im redoing it from top to bottom

vocal tundra
#

name, material and lore look good though from a user point of view good stuff

noble lantern
#

yeah was trying to make it usable for any 12 year olds who got a hold of the plugin

#

too lazy to do docs, so the docs will be yaml comments for now lmao

vocal tundra
#

You should add name alias tho like sharpness instead of damage all

noble lantern
#

yeah im gonna redo the entire enchantments

#

and make an option for all levels to have a chance as well

#

so eg 50% for sharp 1

#

which will break one class i use for loading ItemChances, might be able to make a work around though

#

damnit i just realized something, imm need to make a random based quality

stuck swift
#

why do i not get the option to import the bukkit thing even though i already added spigot 1.18.2 as an external archive

vocal tundra
#

as a library?

noble lantern
vocal tundra
#

sometimes you can do everything right and intelliJ will just do you dirty like that too

vocal cloud
#

That ain't intellij lmfao

stuck swift
vocal cloud
#

that's eclipse

vocal tundra
#

rip

noble lantern
#

looks like your trying to use buildtools/nms

stuck swift
#

idk what you're talking about lol cause i just started learning

noble lantern
summer scroll
#

he's using external jars

noble lantern
#

Yeah i think so as well

#

wait

#

yep he is i see the path lmao

summer scroll
#

i've done that too so long ago lmao

noble lantern
noble lantern
#

that was when i first started learning

stuck swift
summer scroll
#

and i do that because i follow youtube tutorials

noble lantern
stuck swift
#

yes

noble lantern
vocal tundra
#

server jar has to come with nms

stuck swift
#

i hope

vocal tundra
#

since it's the server itself

noble lantern
# stuck swift i hope

Here ill just link you with my base pom.xml, you might want to learn how to use maven/gradle as well as it makes doing all this a lot easier

#

?paste

undone axleBOT
stuck swift
#

kk

noble lantern
#

Idk how eclipse handling importing pom.xml's

#

youll have to google that

#

you can build with mvn clean package or just mvn package

the clean keywords just clears your /target folder when compiling, its not necesarily needed

#

you may also need to install maven, if eclipse doesnt do that already

stuck swift
#

ok thnx

noble lantern
still mantle
#

When I do /smp i am not redirected to other sever

waxen plinth
#

Good to know

quasi patrol
#

Is it possible to create custom recipes exclusive to certain players, or can it only be server wide?

thick estuary
#

Does anyone know of a plugin that allows you to split enchantment books that have multiple enchantments on them into multiple separate enchantment books with single enchantments?

crisp steeple
#

just set the output item to null if they shouldnt be able to craft it

vocal cloud
latent jungle
#

@vocal cloudOk but it's the developpement of my server 🀨

vocal cloud
latent jungle
#

No ok

#

(did u have a solution for me ?)

vocal cloud
proper pawn
#

anyone here with experience on creating npc’s with nms?

#

i really need some help

#

please ping me if you can help me

shut rose
#

what the best minecraft server enginre

earnest forum
#

I guess paper?

#

good performance

#

there's some modified variations which are better

shut rose
#

thx

restive tangle
opal juniper
#

bs

restive tangle
#

It's better than Paper, 9.384x faster

#

(real)

opal juniper
restive tangle
#

Made it using Scratch

onyx fjord
onyx fjord
restive tangle
#

It's facts.

onyx fjord
#

just stop

restive tangle
#

I stopped already lmao, shut up.

onyx fjord
#

if you think you are funny, you arent so stop trolling πŸ‘

restive tangle
#

Dude, I stopped trolling. You're stretching this out since you're denser than a neutron star.

summer scroll
#

Can someone help me creating cooldown feature? I'm trying to understand the basic concept.

noble lantern
summer scroll
noble lantern
#

ohh i read creating a crafting

#

mb

#

okay, in that case you should have each Reward class have a List of UUID's (aka players) that are on cooldown for that specific reward

summer scroll
#

Is that really necessary? I already have that check on User object.

noble lantern
#

actually no HashMap<UUID, Long> in the Reward class

noble lantern
#

but that way will get rather messy

summer scroll
#

I use rewards name

quaint mantle
#

Ive made a plugin that syncs player economy across servers but im not sure which way to go in to. Currently when player joins a server we add player into database and/or check their old balance to then wipe that balance and query the balance from the database. im not sure if this methode is actually decent to run on a production server.

summer scroll
#

So each player or User object will have a Map<String, Long>

noble lantern
#

i normally dont like using normal strings as keys/values for something like that though, just a personal preferance

summer scroll
#

Let's talk about how can we measure or decide If player is on cooldown

#

So everytime player claim a reward, you put the Long with System#currentTimeMillis right?

noble lantern
noble lantern
#

then subtract the current time from the cooldown time

#

if time <= 0 remove from map and return true

summer scroll
#
    public boolean isRewardOnCooldown(Reward reward){
        if (!this.cooldownMap.containsKey(reward.name())) {
            return false;
        }
        long timeLeftInMillis = System.currentTimeMillis() - this.cooldownMap.get(reward.name());
        long timeLeftInSeconds = TimeUnit.MILLISECONDS.toSeconds(timeLeftInMillis);

        return timeLeftInSeconds < reward.cooldown();
    }
quaint mantle
noble lantern
#

you could use AsyncPlayerJoinEvent

#

and thats fine if its blocking on there

#

It will also block until it completes and not let the player join said server until join

#

adding/removing balances is a little more complex

noble lantern
summer scroll
#

Okay, I put the cooldown configurable in config and the time is in seconds

noble lantern
#

And the value stored in the map is seconds or millis

summer scroll
#

So If the current time minus the player claim time and the result is below or equals to 0, that means the cooldown is completed?

noble lantern
noble lantern
#

tbf that toSeconds method isnt really needed either

#

cause if its 0, its over

#

more or less just a redundant call

#

oh wait

#

i see

#

reward.cooldown() is in seconds

#

mb

#

disreguard my last second

summer scroll
#

yeah it's in seconds

noble lantern
#

also check <= not < or else it will be off by one second

summer scroll
#

So, If timeLeft <= cooldown, that means the cooldown is completed?

noble lantern
#

cooldown is completed when timeLeft is 0

#

that method you linked would return true to my knowledge

#

Actually it wouldnt really work well tbh

#

If the player had 13 seconds left in cooldown, but the cooldown is 15

#

and your checking 13 <= 15 it would be false, but the player would still have 13 seconds of cooldown

#

its best to check <= 0

#

that method would essentially be isCooldownLessThenRewardCooldown rather than isInCooldown

summer scroll
#

How can I decide how long the cooldown is?

noble lantern
#

hold on, need to think about that one

#

i think it would be best to store a Long:

when player claims reward
finishedTime = current time + cooldowntime
then check later
finishedTime <= newCurrentTimeHere

summer scroll
noble lantern
#

basically store the time on when the cooldown would be completed

quaint mantle
# noble lantern you could use AsyncPlayerJoinEvent

Bukkit only got the AsyncPlayerPreLoginEvent (would be more pain to use since i need to change pretty much every methodes ive got :p) ill probs run that code on an async task which should be fine i guess

noble lantern
summer scroll
#

Alright, I'm just gonna test it right now.

#

Thanks for your help!

noble lantern
noble lantern
#

i try to do things using as less math as possible and sometimes it comes out as more confusing

glossy venture
#

you mean like to make minecraft recalculate light forcefully

#

or set the light on blocks manually

#

because if 2nd use i think it was LightAPI

noble lantern
#

couldnt you just force a block update without NMS to the client

#

not sure if it would work entirely

#

just use block data from the block your trying to update

glossy venture
#

theres probably a function in like chunk somewhere

noble lantern
glossy venture
#

i found something in net.minecraft.world.level.Level

#

theres a method getLightEngine()

#

i think you might be able to do something with that

#

you can get the Level as a ServerLevel from the CraftWorld.world field

#

(remapped with mojang mappings)

opal juniper
#

does starlight have an api

glossy venture
#

CraftWorld  world = null; // ...
ServerLevel level = world.getHandle();
level.getLightEngine().runUpdates(
        0, /* I (idk what this does) */
        true, /* calculate skylight */
        false /* propagate light or something */
);
opal juniper
glossy venture
#

should be the same thing

opal juniper
#

ah ok

#

just not remapped

glossy venture
#

i think its just mappings

#

im using mojang mappings with paperweight userdev 1.18.2

opal juniper
#

let me build it with bt

noble lantern
#

returns ServerLevel for me

opal juniper
#

yeah its gonna be the mappings

noble lantern
opal juniper
#

what is that background kek

noble lantern
#

you havent seen?

opal juniper
#

naw

noble lantern
#

sec i gotta find a file thats not cluttered with code

opal juniper
#

code leak

#

leak src for all advanced plugins

noble lantern
#

GC would kick my ass

#

dudes buff asf

opal juniper
#

looks weird lol

noble lantern
#

a lot of people say that, doesnt bother me though probably because im used to it by now

opal juniper
#

how do i get remapped into my m2?

noble lantern
#

Should add it by default when add --remapped into your bt command

Also using the plugin for remapped helps

opal juniper
noble lantern
#

i never touched anything with my m2 when setting up remapped

#

?paste

undone axleBOT
noble lantern
#

idk how to get remapped to work with gradle

#

sad boy hours

flat olive
#

Anybody know how to fix mongodb class or found exception, I looked everywhere, added the Apache shade thing and all sorts of shit

opal juniper
#

did you shade it

flat olive
#

My dependency jar even shows up it just never gets executed

noble lantern
#

and that ^

opal juniper
#

wait... jar

flat olive
#

Well I can’t send it currently but it says ClassNotFound

#

Yes I’m IntelliJ

#

in*

opal juniper
#

send your pom

#

?paste

undone axleBOT
flat olive
#

okay one sex

#

SECOND*

opal juniper
#

😳

noble lantern
#

mmm

flat olive
#

πŸ’€

noble lantern
#

god dayum

opal juniper
#

jumping ahead 😩

noble lantern
#

least buy us a drink first

#

maybe... i am the problem

opal juniper
#

yes

#

ok im seeing this commit

#

nothing small about it

#

ew you are a lombok lover

noble lantern
#

its just an initial commit tbf

#

that code is dogshit

#

pls dont judge i know its dogshit

#

but the configs needs to be so customizable

opal juniper
#

i was forced to use lomobk by @hybrid spoke but i was so very tempted to run it through delombok

noble lantern
#

i only use it cause i wanna rush this project

#

and i dont wanna type 300 lines of getters/setters

restive tangle
#

Lombok

noble lantern
#

havent even tested any of this either

restive tangle
#

Just use Kotlin troll

noble lantern
#

im gonna write the whole thing out, then run it and see what happens

opal juniper
flat olive
#

sec

#

this is pom

#

when I put in the plugin for the shade plugin

#

it never works

opal juniper
#

bruh how tf was it gonna shade

flat olive
#

it never worked cause plugin systax wasnt there

#

syntax*

#

wasn't*

#

or the syntax wasn't working

#

idk how to put it into pom

noble lantern
#

no shade plugin sadge

#

scope compile

#

<scope>compile</scope>

#

by default maven does provided

opal juniper
noble lantern
#

idk if it shades in though without a shade plugin

#

^

flat olive
#

thanks

#

I hope it works

opal juniper
#

actually you need to change the source to 17

#

in the plugin

flat olive
#

just source?

opal juniper
#

well and target

flat olive
#

didnt work

opal juniper
#

define didnt work

sacred mountain
#

hey im making a minigame, is it possible to completely prevent new water sources forming?

flat olive
sacred mountain
#

like an infinite water source

#

i dont want that to work.

opal juniper
flat olive
#

sure

opal juniper
chrome beacon
#

Oh no

sacred mountain
#

E

opal juniper
#

are you using intellij?

#

there is no META-INF

eternal night
#

nor is the shade plugin configured

eternal night
flat olive
#

I cant send images

eternal night
#

you need the maven shade plugin in order to shade your dependencies

opal juniper
#

@flat olive what happens when you run mvn in the command prompt

flat olive
#

'mvn' is not recognized as an internal or external command,
operable program or batch file.

opal juniper
#

ok so sort out your mvn variables and come back here

sacred mountain
#

hm

noble lantern
#

you can runwith or without clean

sacred mountain
noble lantern
#

clean just clears the target folder

faint harbor
sacred mountain
#

package to compile

flat olive
#

maven has its own terminal?

#

also]

#

I have no maven build path

sacred mountain
noble lantern
flat olive
#

so I cant setup env vaariables

noble lantern
#

intellij just, worked for me lol

flat olive
#

it worked

sacred mountain
sacred mountain
noble lantern
#

ofc i cant use gradle/maven outside of intellij

flat olive
#

well

#

I havent checked on server

noble lantern
#

but ill never rly need to do that

flat olive
#

but the mvn clean worked

sacred mountain
#

clean just

#

clears your target directly

#

bro

opal juniper
#

it doesnt do anything

noble lantern
#

mvn package

sacred mountain
#

target directory*

opal juniper
#

it just remove files

#

lol

sacred mountain
#

package actually compiles to your target

noble lantern
#

yes

#

which is fine, its normally how most compile

sacred mountain
#

thats what i use

#

never used anything else lol

opal juniper
#

pro command line gamers be like mvn clean package

sacred mountain
#

fr

noble lantern
#

using it without clean gives me heebejeebies

opal juniper
#

gui chumps be like

mvn clean

mvn package

noble lantern
#

i hope no one does that

opal juniper
#

i mean its not required

noble lantern
#

it feels better on my mind to clean package

#

than just overwrite the files with package

flat olive
sacred mountain
noble lantern
#

same with ctrl + s

I cant just do it once, i gotta spam it 20 times

flat olive
#

i gtg to school but im gonna try and fix this when I get home

#

i still have no idea how

sacred mountain
#

imagine school

noble lantern
#

i just spam it, i lost so many things before im paranoid

flat olive
#

IT WORKED

sacred mountain
#

i once lost everything i had previousoly done on my server for more than a year by deleting my ssh access key when clearing my disk space

flat olive
#

YES

#

I spent 7 hrs

#

trying to fix it

sacred mountain
#

bruh

flat olive
#

so I can use a change stream

#

to search for updates

#

looped

noble lantern
#

no way you spent 7 hours on that

flat olive
#

from db

#

finally

sacred mountain
#

bruh

flat olive
#

YES

#

I did

sacred mountain
#

stop spamming

#

gg u did it

flat olive
#

sorry

#

ok byee ty

latent jungle
#

Hi

#

How can I make enchanted glass please ?

#
            ItemMeta meta = glass.getItemMeta();
            meta.setDisplayName("Β§e");
            glass.setItemMeta(meta);

            inv.setItem(0, glass);
            inv.setItem(1, glass);
            inv.setItem(7, glass);
            inv.setItem(8, glass);
            inv.setItem(9, glass);
            inv.setItem(17, glass);
            inv.setItem(36, glass);
            inv.setItem(44, glass);
            inv.setItem(45, glass);
            inv.setItem(46, glass);
            inv.setItem(52, glass);
            inv.setItem(53, glass);```
sacred mountain
#

enchant with luck and hide attribute

noble lantern
#

^

#

also

sacred mountain
#

theyre doing certain slots

noble lantern
#

use ChatColor#translateAlternateColorCodes(char, string)

sacred mountain
#

but i guess an integer list

noble lantern
#

Its better to add all the items you want first

opal juniper
#

List.of(0,1,7....)

sacred mountain
noble lantern
#

then iterate over all slots, and only add the item where material == air

latent jungle
#

How please

#

Can u copy and paste :c ?

sacred mountain
#

ctrl c

#

ctrl v

latent jungle
#

Yes but can u help me ?

sacred mountain
#

wh

#

huh

#

what do you want me to do though

noble lantern
#

not to hard to add a ItemFlag and Enchantment to an ItemMeta

flat olive
#

I hope it worked I’ll check when I get home

latent jungle
flat olive
#

it didn’t show the error

#

So it should be working

sacred mountain
sacred mountain
flat olive
#

I just don’t know if my thread started

latent jungle
#

I'm not English I didn't understand anything... CAN YOU change my code and send it back to me?

#

Please

noble lantern
#

thats called spoon-feeding

If someone wants to they will, but you are better learning this stuff that way you arent asking again at a later date for the same thing

flat olive
mighty pier
#

how do i modify the server list on 1.8.8?

flat olive
#

so easy I hopped to Java from python and am coding so easily in it like it’s nothing

latent jungle
flat olive
#

just different syntax

latent jungle
flat olive
#

the only thing I don’t understand is maven

#

I need to learn more about maven

#

package manager

noble lantern
flat olive
#

yes indeed

#

I did

noble lantern
#

maintaining thats gonna be a bitch without it

flat olive
#

Lots of object oriented programming

#

It’s very easy

#

What’s mainly new to me though is

#

Casting an object

#

Player p = (Player) commandsender;

#

That’s the only new thing to me in oop

mighty pier
sacred mountain
# latent jungle ``` ItemStack glass = new ItemStack(Material.STAINED_GLASS_PANE, 1, (...
ItemStack glass = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 11);
        ItemMeta meta = glass.getItemMeta();
        meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&e"));

        meta.addEnchant(Enchantment.LUCK, 1, false);
        meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);

        glass.setItemMeta(meta);

        for (int i : List.of(0, 1, 2)) {
            inv.setItem(i, glass);
        }
#

never used list.of

#

so idk if thats right

noble lantern
#

it is

summer scroll
#

you can do that i guess

mighty pier
#

why would i come into help-development to just get linked to a plugin

latent jungle
#

@sacred mountainThx !! Why never use lsit.of ?

flat olive
#

But it makes sense, using child and main property to get access to the parent attributes by making a new instance

sacred mountain
noble lantern
#

you could look into the source code of one of those plugins

mighty pier
#

yes i tried using the OUT_SERVER_INFO packet but it doesnt work on 1.8.8

#

and i dont really understand other plugins

flat olive
#

is it better to do polling or use a rest api

noble lantern
#

not sure, havent touched 1.8 api in years

noble lantern
sacred mountain
#

i have been thiinking about this, and i don't know how to do it : how do i prevent water sources forming, like AT ALL?

#

im trying to prevent infinite water sources for a minigame

flat olive
#

Yesterday I made a change stream that grabs updates and loops over constantly with a thread, I believe this is a way to check for constant updates, especially as it worked for me just fine. I just don’t know if it’s a good way of polling or not. When it comes to using memory I try to use the least amount of it and not use multiple threads. But this stops the thread and starts a new one so only the main and other thread are always running https://github.com/AlexPurcell/MongoLiveUpdates

echo basalt
#

commonthreadpool or whatever

echo basalt
#

you can always decompile plugins to see what you want

sacred mountain
#

decompile moment

echo basalt
#

or find them on github if you're lucky

sacred mountain
#

ServerListMotd has it's source code on github if that helps you at all @mighty pier

echo basalt
#

I generally find all my information by decompiling spigot

#

:p

sacred mountain
#

you gotta do it yourself sometimes

#

make the mistakes

echo basalt
#

yes

sacred mountain
#

gain experience yk

echo basalt
#

but if you want to learn why a pathfinder no worky

noble lantern
#

its more or les to get a baseline of what you need to do

echo basalt
#

better to just decompile it

flat olive
#

My biggest step into making a HCF core is figuring out how to edit ender pearls the way I want, I don’t quite understand the concept of how allowing others to pearl through fence gets and blocks works

#

gates*

flat olive
#

so you’re getting rid of all water in the world

noble lantern
#

hes just trying to prevent infinite water sources, not water itself

flat olive
#

getWorld() and idk if there’s a remove material from world method

#

oh

sacred mountain
#

yeah

#

so i just want to

#

when the water is flowing, i dont want it to create any new sources

#

not remove sources that were already there

flat olive
#

if Material.WATER.isFlowing or something

#

no idea

sacred mountain
#

that is an enum

flat olive
#

yeah I have absolutely no idea

sacred mountain
#

well it doesnt have that attribute

flat olive
#

I found it

sacred mountain
flat olive
#

MATERIAL.STATIONARY_WATER

#

if it’s not that

#

Remove it from the world

sacred mountain
#

no i wanna remove it if it IS staionary

flat olive
#

oh?

#

I thought you said if it’s flowing

sacred mountain
#

i dont want new sources to form

flat olive
#

Well remove it if is that then

sacred mountain
#

yeah but what is the event

noble lantern
#

isnt there a Water state

flat olive
#

You just getWorld.getBlock() and grab the material

noble lantern
#

i think theres a method for detecting is a block is a full water block

flat olive
#

STATIONARY_WATER

sacred mountain
#

can you fork spigot easily and just remove that bit of code lol

sacred mountain
#

not that its a full block

flat olive
#

Yes

#

it’s not moving

noble lantern
sacred mountain
#

well yes but how do i detect the new block forming

#

is it BlockFromToEvent

flat olive
#

the issue is deleting all the water would literally get rid of non flowing all water in the world

sacred mountain
#

BlockPhysicsEvent?

noble lantern
#

BlockFromToEvent yes

flat olive
#

oh that event

sacred mountain
noble lantern
#

and check adjacent blocks

flat olive
flat olive
sacred mountain
noble lantern
#

he even linked his src code

sacred mountain
#

dayu

#
@EventHandler
    public void onBlockFromToEvent(BlockFromToEvent event)
    {
        Block block = event.getToBlock();
        int sources = getAdjancentSourceBlocks(block);
        if (sources >= 2) {
            if (block.getRelative(BlockFace.DOWN).getType() == Material.CAULDRON) {
                addSourceBlockToCheck(block);
            }
        }
    }```
#

ill have a go at some things

sacred mountain
#
@EventHandler
    public void onBlockFromToEvent(BlockFromToEvent event) {
        Block block = event.getBlock();
        if (getAdjancentSourceBlocks(block) >= 2) {
            event.setCancelled(true);
        }
    }```
#

so if a place a block and there is more than one source directly around it it will cancel? but infinite water can be created in tons of ways

atomic zodiac
prisma needle
#

Load player skulls without delay?

clear pike
#

it's open source paid plugins

#

pls teach me how to compile source code to a jar file

#

if you'd like to

sacred mountain
#

i jus want to disable the forming of new sources entirely

#

thats why im thinking, is it possible to modify the spigot jar to allow this

#

easily that is

proper pawn
#
npcs:
  jeff:
    texture: ewogICJ0aW1lc3R
    signature: ExylUXAG7JsBe
    location:
      ==: org.bukkit.Locatio
      world: world
      x: -17.5
      y: 166.0
      z: 71.5
      pitch: 0.0
      yaw: 0.0
  steven:
    texture....

How can i loop through npcs?
I have absolutly no idea how i would do it. i want to be able to get the texture from jeff and then the next item in the for loop it would get steven's texture. can someone please help me?

sacred mountain
#

just loop through the keys in 'npcs' and get the texture from each one

#

getKeys() and loop through that

proper pawn
#

getkeys!!! thank you! thats what i was looking for

red sedge
#

how can i have an attack speed as vanilla swords and stuff

#

if i add the attribute it is instant no matter what

sacred mountain
#

its a very small atrribute

#

maybe increment by like 0.01

#

i tried doing modification like speed and stuff and the differce was a lot

red sedge
#

i guess...

cursive loom
#

Hey do you know if the middle click fonction in Inventory has been removed for player in survival ?

red sedge
#

..????

manic delta
#

Database issue

worldly ingot
echo basalt
#

it might still send a packet tho

#

as there's InventoryClickEvent#isMiddleClick

red sedge
#

Is there any way to see if an items name has been changed by an anvil

worldly ingot
#

For Creative mode

echo basalt
#

events on creative mode are hella weird

#

as creative mode is its own little party

#

copying items copies the client version instead of the server version

cursive loom
#

Yeah in 1.16.2 thats work but in 1.18.2 that didn't work

#

Do you have a solution ?

brave goblet
#

I just thought about what if you use a constructer?

#
 Plugin pl;

    public ListenerClass (Plugin plugin){
        pl = plugin;
    }```
#

and in start up getServer().getPluginManager().registerEvents(new ListenerClass(this),this);

eternal night
#

Yes constructor DI is preferred

coarse finch
#

how can i take a multiple word argument

simple silo
#

How do I set text lines below and above the player name?

#

I saw this on other servers

quaint mantle
#

hi can i have a question would be that the KingdomsX plugin will print this when I insert it Could not pass event ChunkLoadEvent to KingdomsX
and therefore i can't use the plugin because if i type it in / k it will throw out the server can anyone help?

#

pls help

river oracle
#

Ask the plugin developer not us

#

Also don't ask in every damn channel jesus christ bro learn patience

quaint mantle
river oracle
#

It's a plugin issue not a spigot issue

river oracle
#

Am I supposed to have the source and knowledge of every plugin?

#

If you can't contact the dev find a replacement or have someone try to Recreate it for money

quaint mantle
#

oh

#

thanks XD

waxen plinth
#

hacker pfp

river oracle
#

Why...

quaint mantle
#

Hey guys! I'm looking to build a plugin utilising Towny, Vault and Economy APIs, does anyone have experience with any of these plugins previously?

small current
#

why i can't send png

river oracle
red sedge
river oracle
small current
#

no sign opens and no errors..
1.18.1

restive tangle
#

This is not linked to Spigot but I don't know where else to ask. I'm making a Java wrapper for a Minecraft server hosting API. Are there any design principles/tips I should follow while designing the wrapper?

midnight shore
#

Hi! How can i center a location i got from a block? Because if i use Block.getLocation(); i get a corner location. I actually want the center of the block.

quaint mantle
#

I’m a webdev, very new to Java documentation

ivory sleet
#

ye just ask away

quaint mantle
#

Looks like Java provides some sort of method documentation out of box for plugins

ivory sleet
#

I mean even tho we dont maintain 3rd party apis many of us are still knowledgeable in them

#

well u have javadocs

quaint mantle
#

Oooh, that’s very handy

ivory sleet
#

mye

quaint mantle
#

I like it

#

java is super cool

ivory sleet
#

basically turns comments on methods and fields into a set of html pages

quaint mantle
#

Idk, it’s so much of a refreshing way to code

ivory sleet
#

it is, altho a bit obsolete in comparison to more modern languages

quaint mantle
ivory sleet
#

ye

quaint mantle
#

True

midnight shore
#

Another question, how can i orientate a block?

ivory sleet
#

wym by orientate a block

midnight shore
#

like what you would do with a debug stick

ivory sleet
#

oh

midnight shore
ivory sleet
#

BlockData in principle

hasty prawn
#

Rotatable

#

oh wait

#

thats just for signs

glossy venture
#

what repository do i need to include to use paperweight userdev
i currently have this:

plugins {
    id 'java'
    id "com.github.johnrengelman.shadow" version "7.1.2"
    id "io.papermc.paperweight.userdev"  version "1.3.5"
}
``` with no buildscript repositories
this produces
hasty prawn
ivory sleet
#

ye probably Directional then

glossy venture
#

oh wait i should probably do this in paper discor

#

d

ivory sleet
#

orby

hasty prawn
#

Yes Directional is right catyes

ivory sleet
#

did u declare the repos in settings.gradle btw

#

cuz thats a must

glossy venture
#

oh

midnight shore
#

thank you

glossy venture
#

thanks

#

got it

ivory sleet
#

basically

//settings.gradle
pluginManagement {
    this.repositories {
        this.mavenCentral()
        this.gradlePluginPortal()
        this.maven("https://papermc.io/repo/repository/maven-public/")
    }
}
glossy venture
#

i think

bronze notch
#

It seems that some sql databases don't recognise the '-' (dash) as a character. In my case when storing an uuid as a varchar/string. What is the best solution to resolve this? Replace the character with something else, store an uuid as bytes or edit database settings (which is not preferred)?

glossy venture
#

how do i load an entity from an nbt tag with nms
i am using

nmsEntity.saveWithoutId(tag);
``` for serialization, but i cant find any methods in the `net.minecraft.world.level.Level, ServerLevel` or `MinecraftServer` classes that allow me to load back that entity from the nbt (without id, so its technically a different entity)
waxen plinth
#

It's just that sometimes UUIDs are formatted without the dash

glossy venture
#

i also dont expect the bukkit classes to be of any use, ive checked CraftServer regardless but as i expected still nothing

quasi patrol
#

Are you able to have NBT data for custom recipes input?

glossy venture
#

not through the bukkit api

#

you have to make your own system or use a third party one

#

i think

supple elk
#

Anyway I can get function and field names when working with nms?

glossy venture
#

you need to use remapping

#

with maven use buildtools and specialsource

#

with gradle i use paperweight userdev

supple elk
#

k ty

supple elk
#

that's my current pom

glossy venture
#

i dont know tbh

#

i dont use maven

supple elk
#

kk

glossy venture
#

mfnalex has a good post on it i think

#

on his blog

supple elk
#

do you have a link?

glossy venture
#

but i forgot the url lmfao

#

nah

#

sorry

supple elk
#

oof

#

it's aight

supple elk
#

ah thx

#

will give it a look

stuck flax
#

how do you make a book GUI

small current
#

Im trying to make a sign gui with packets

shut rose
#

anyone know how to set the effect of blindness on the nlogin plugin when logging in and registering?

brave goblet
#

How to spawn a trident?

#

with velocity

supple elk
#

anyone know what's going on here?

#

My java version in the java control panel is different from what's being displayed on control panel

waxen plinth
#

🀦

#

You need to wrap it in quotes because it's a string

supple elk
#

I'm guessing I have different JREs which aren't oracle official like openJDK?

bronze notch
#

But I never had issues with the way I used to do it

supple elk
waxen plinth
#

but it's a string

#

wrap it in quotes

#

and please, if you are executing queries in your code, please use prepared statements and not string appending

desert musk
#

Is there a way to make it so you don't lose speed when drawing back a bow?

waxen plinth
supple elk
brave goblet
#

Ah thanks

waxen plinth
#

You can also do Entity#launchProjectile

brave goblet
supple elk
brave goblet
#

sorry no i am also lost lol

brave goblet
#

Lol :/

waxen plinth
#

You have to cast to trident

#

spawnEntity returns an Entity

#
Trident trident = (Trident) world.spawnEntity(location, EntityType.TRIDENT);```
waxen plinth
#

you really didn't have to ping me for that

red sedge
#

how would i force aplayer to break a block?

waxen plinth
#

what do you mean force a player to break a block

#

you want plugins to respond to the block breaking as if a player broke it?

red sedge
#

yes

waxen plinth
#

you can fire a BlockBreakEvent yourself

red sedge
#

well also the server itself

waxen plinth
#

what do you mean the server itself

red sedge
#

i need it so like the drops and all that are as if the player broke that block

waxen plinth
#

also

red sedge
#

woith their tool

red sedge
waxen plinth
#

ok well read this method's javadocs because it does literally exactly that

red sedge
#

maybe i was thinking of the wrong thing

#

i knew that method existed but like i thought it just broke the block

waxen plinth
#

always good to read javadocs

prisma needle
#

Detecting when a player is no longer viewing an inventory?

fading lake
waxen plinth
crude estuary
#

I love that there is a Page for Everything that a User Does

fading lake
#

use path to create a second variable that points to the other jdk, so for example I have java pointing to java 8 and java16 pointing to java 18, if you open your env variables and copy/paste whats currently in java it should work

#

hopefully

#

environment and internal java stuff deserves spoonfeeding, its not the easiest thing to google sometimes

supple elk
#

πŸ€”

supple elk
#

I don't see a java

quasi patrol
brave goblet
#

How can i kill / remove entities by name? I look at

#

entity.setCustomName("name");

#

and outside my if statement i want to access it

supple elk
#

is there no way you can just keep a reference to the entity instead of searching for it by name?

brave goblet
supple elk
#

so?

brave goblet
#

wait that means i could use a set method ig

supple elk
#
Entity entity;

if () {
    entity = new Entity();
}
brave goblet
#

Or a list?

supple elk
#

or something like that?

brave goblet
supple elk
#

Can I see your specific example because there will definitely be a way around it

granite owl
#

whats the reason that the console does not display msg content packed in [] ?

#

ingame it does

#

but console not

brave goblet
# supple elk Can I see your specific example because there will definitely be a way around it
@EventHandler
    public void click(PlayerInteractEvent event) {
        if (event.getAction() == Action.RIGHT_CLICK_AIR) {
            if (event.getPlayer().getName().equals("RaiderRoss")) {
                            Trident trident = (Trident) event.getPlayer().getWorld().spawnEntity(
                                 event.getPlayer().getEyeLocation(), EntityType.TRIDENT);
                            trident.setVelocity(
                                event.getPlayer().getEyeLocation().getDirection().multiply(2));
                            trident.setGlowing(true);
                            trident.setCustomName("trident");
                            trident.setDamage(10.5);
                        }
                    }
         if(another action){
           -> kill tridents
          }
}
fading lake
fading lake
supple elk
#

slightly trickier example

#

is there only ever one trident per player?

#

or can a player have multiple tridents?

#

cause if it's just one trident per player or something like that then you can use a hashmap

#

linking a player to a trident

#

or even a player to a list of tridents

#

then pass in the player to the hashmap on the other action to get the tridents

brave goblet
#

only player can do it

granite owl
#

@fading lake this is the string thats getting sent to the sender java parser.appendLine("uuid_getUUID", new String[] {ChatColor.GREEN + "[Click here to copy] {uuid}"}); and this is the code used ```java
public static boolean execute(CommandSender sender, String[] args)
{
if (sender instanceof Player)
{
Player p = (Player) sender;
if (!p.isOp())
{
p.sendMessage(Utils.getStandardMsgByString("CMD_PERMISSION"));
return true;
}
}

    if (args.length == 1)
    {
        UUID uuid = NonReflectables.getPlayerUUID(args[0]);
        
        if (uuid != null)
        {
            String msg = ((Callbacks.defaultMsgs.containsKey("uuid_getUUID")) ? Callbacks.defaultMsgs.get("uuid_getUUID").replace("{uuid}", uuid.toString()) : Utils.getStandardMsgByString("CMD_ERROR"));
            
            if (sender instanceof Player)
            {
                TextComponent uuidMsg = new TextComponent(msg);
                uuidMsg.setClickEvent(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, uuid.toString()));
                ((Player)sender).spigot().sendMessage(uuidMsg);
            }
            else
            {
                sender.sendMessage(msg);
            }                
        }
        else
        {
            sender.sendMessage(Utils.getStandardMsgByString("NO_PLAYER"));
        }
        
        return true;
    }
    
    return false;
}
supple elk
brave goblet
supple elk
#

what are you trying to do here specifically?

brave goblet
#

and for lag reasons i would like to be able to kill those tridents

granite owl
#

@fading lake the console output is just the uuid the output ingame is [Click here to copy] + the uuid

brave goblet
#

oh i can do that

supple elk
#

when they fire another trident?

#

after a set period of time?

#

when they left click the item?

brave goblet
#

and sorry u had to guess all of those events :(

#

i had to help my dad with sum

supple elk
#

it's alright

#

and you want all the tridents to be destroyed?

#

or just the last trident they fired?

brave goblet
#

yes

#

all of them

supple elk
#

okay the you want a hash map

brave goblet
#

but i realised i can use a runable

fading lake
supple elk
#

how will a runnable help?

brave goblet
#

to kill them after a certain amount of time

fading lake
granite owl
supple elk
#

wait so do you want it to be based on time or left clicking?

brave goblet
#

because

#
                            trident.setDamage(10.5);
                            new BukkitRunnable(){

                                @Override
                                public void run() {
trident.kill

                                }
                            }.runTaskLater(this,10);
                        }
supple elk
#

yeah but left clicking is really ez too

tardy delta
#

sometimes im thinking that people dont know that && and || exist

brave goblet
#

and discord doesn't like the formatting :/

supple elk
#

so just pick which you'd prefer

tardy delta
#

:}

brave goblet
tardy delta
#

Bukkit.getScheduler().runTaskLater?

#

why is manually creating bukkitrunnables even possible :/

supple elk
#

wdym manually creating?

#

manually creating Bukkit runnables is great $_$

eternal night
#

πŸ‘€πŸ‘€

brave goblet
tardy delta
#

its a weird syntax too

#

new BukkitRunnable() {}.doSomething

supple elk
#

I love that syntaxx

supple elk
supple elk
#

that code there creates a pig launcher

#

fires a pig in a straight line which implodes upon impact πŸ˜„

tardy delta
#

yea thats useful on its own but the bukkitrunnable object requires you to immediatly calling a method on the newly constructed object

supple elk
#

that's still fine I think

brave goblet
#

right i see ur point now-

#

u can use it to run any task

#

:)

supple elk
#

it's lambda passing vs inner class

#

I prefer inner class

brave goblet
#

hm ye personal preference ig

supple elk
#

yeah

#

I find that using inner classes tends to allow for more flexibility

#

otherwise you end up having to pass in a bunch of lambdas for everything as parameters

#

in the case of the scheduler tho it doesn't matter too much

tardy delta
#

smh assigning the scheduler to a variable

glossy scroll
#

Its an anonymous class

tardy delta
#

if you do new BukkitRunnable() {void run()} it wont do anything i mean

glossy scroll
#

Right but that’s intended?

#

Like java can’t do something if you don’t tell it to

#

Well i guess you could make your own runnable class and add run() to the constructor

proper pawn
#

How do i rotate the body and head pitch for an NMS npc?

#

which packet do i need to use?

visual fulcrum
#

i dunno if i'm doing something wrong, but getHitblock on ExpBottleEvent seems to always return null

supple elk
#

was following that tutorial

#

copied the pom stuff in

#

no imports for NMS tho?

eternal night
#

Mojang mappings

#

WorldServer is spigot mappings iirc

supple elk
#

wdym?

red sedge
#

so its only spigot

supple elk
#

but still no nms mappings

crisp steeple
#

refresh maven?

supple elk
#

I did

crisp steeple
#

so they come up in intellisense but don’t actually work

tardy delta
#

tabnine kek

supple elk
#

if I use just spigot then I get imports with no mappings

red sedge
supple elk
#

any ideas?

granite owl
#

am i getting it right that PlayerInventory is not serializable?

ivory sleet
#

you're getting that right

#

or wel

#

it is, but not officially

granite owl
#

how to serialize it then

#

like

#

the most simple solution

#

put everything in wrappers?

#

store all data in primitives?

hasty prawn
#

ItemStack is Serializable

granite owl
#

i tried

#

it fails

#
Utils.serializeToFile(new ItemStack(Material.DIRT, 1), invDir.getPath() + '/' + p.getUniqueId().toString() + ".bin");

ItemStack invFile = (ItemStack) Utils.deserializeFromFile(invDir.getPath() + '/' + p.getUniqueId().toString() + ".bin");
``` ```txt
19.04 18:03:52 [Server] INFO Caused by: java.lang.ClassCastException: class java.io.WriteAbortedException cannot be cast to class org.bukkit.inventory.ItemStack (java.io.WriteAbortedException is in module java.base of loader 'bootstrap'; org.bukkit.inventory.ItemStack is in unnamed module of loader java.net.URLClassLoader @dcf3e99)
#

the serializer works just fine using a string

#

why tho because ive checked ItemStack is serializable

supple elk
tardy delta
#

why both spigot and spigot-api

supple elk
#

look at the tutorial I sent

#

I have them there cause that's what it tells me to do

#

I have no idea how these mappings work

#

any other tutorials on how I can get nms mappings?

#

It's kinda impossible to use it without

#

for the stuff I'm looking at anyway

crisp steeple
granite owl
#

@crisp steeple ```java
public static Object serializeToFile(Object obj, String str)
{
try
{
ObjectOutputStream s = new ObjectOutputStream(new FileOutputStream(str));
s.writeObject(obj);
s.flush();
s.close();

        return 0;
    }
    catch (Exception e)
    {
        return e;
    }       
}

public static Object deserializeFromFile(String str)
{
    try
    {
        ObjectInputStream s = new ObjectInputStream(new FileInputStream(str));
        Object ret = s.readObject();
        s.close();
        return ret;
    }
    catch (Exception e)
    {
        return e;
    }
}
tardy delta
#

try with resources brr

crisp steeple
#

should probably print the stack trace instead of returning it

granite owl
#

im doing the typecast

#

individually

ivory sleet
#

perhaps use getContents and setContents as thats just Array<ItemStack>

echo basalt
#

Array<ItemStack> is a weird way of describing ItemStack[]

crisp steeple
#

kotlin moment

ivory sleet
#

^

supple elk
#

Conclure

ivory sleet
#

ye

supple elk
#

hello πŸ‘‹

#

πŸ˜„

ivory sleet
#

hi there

tardy delta
#

😳

supple elk
#

you got any idea about nms mappings?

ivory sleet
#

mye