#help-development

1 messages · Page 287 of 1

eternal oxide
#

yep, Custom data class would be cleaner

crystal palm
#

soon™️

river oracle
#

now rather than latter

#

🥳 take action seize the day

#
@Data
@AllArgsConstructor
public class PlayerData {
  private final String name;
  private final int numberData;
}
#

this is all you need if you use lombok

eternal oxide
#

if the data doesn;t change just use a Record

river oracle
#

god damn I forget about records -_-

eternal oxide
#
public record PlayerData {
  private final String name;
  private final int numberData;
}```
crystal palm
#

jdk 16. i sure hope everything doesnt shit itself

#

it should still work with 1.8 right

eternal oxide
#

records are perfect for data

#

so long as they host with a 16 java

river oracle
#
public record PlayerData(String name, int numberData){

}
#

is proper syntax

eternal oxide
#

yep

river oracle
#

here is oracle's official example

record Rectangle(float length, float width) { }
crystal palm
#

what happens within the {}

river oracle
#

nothing

#

records automatically have getters

vale ember
#

how can i create a persistent data container instance?

crystal palm
#

how would i put values into records and take them out?

river oracle
#

all of the data is immutable

crystal palm
#

did i say something silly

#

lmao

river oracle
#

Though I suppose you could look at PersistentDataHolder class

vale ember
#

it's interface

river oracle
#

Yea everything is

#

?stash

undone axleBOT
river oracle
#

Check bukkit impl

vale ember
#

k

#

ty

vale ember
#

you cant put, it's immutable, you just create it via constructor

crystal palm
#

ohh

vale ember
#

and it automatically creates getters for all fields

#

without get prefix tho

crystal palm
#

thanks

vale ember
#

np

crystal palm
#

this didnt work - same issue as the image

#

would still like to know how i can insert into nested maps :)

eternal oxide
#

Your map definition is wrong

#

Fix your Map definition and you shoudl use getOrDefault of computeIfAbsent

crystal palm
#

thank you!

vale ember
#

how do i get block's relative location to the chunk?

crystal palm
#

chunk.getBlock() also exists

vale ember
#

ty

tardy trellis
#

guys can any1 who has experience with resource packs and hosting them help me with smth

crystal palm
#

i have returned.. and i am now confused.

ok so.. im storing a UUID, String, Int and Double in a record. How would i get the Int and Double when checking against the UUID and String?

tardy trellis
dire marsh
#

you'd need some kind of web server on that dedicated server

#

there are also some plugins which can host a resource pack but they're usually plugins that generate their own pack

#

you should just use mcpacks if you don't have a web server already, it's much simpler

tardy trellis
dire marsh
vale ember
#

do i need to check if a pdc has a key before trying to remove it?

eternal oxide
#

no

vale ember
#

k ty

rough drift
#

?taskdistribution

#

?tasksplitting

#

?workdistribution

vale ember
#

is there a way to print all pdc keys and values?

#

there's getKeys, but to get values i also need types, is there a way to get them or do i have to know?

chrome beacon
#

I believe you have to know the type

vale ember
#

😔

chrome beacon
#

Why do you need to do that?

vale ember
#

i just wanna print out that info for debug purposes

chrome beacon
#

Just print the nbt then

vale ember
#

how? (i dont use nms)

chrome beacon
#

You can force the data command to be run

vale ember
#

oh thats a good idea ty

remote swallow
#

pdc gets shown on the nbt tree?

vale ember
#

yeah

#

PublicBukkitValues or something

remote swallow
#

oh damn

chrome beacon
#

Yeah PDC is stored as nbt

vale ember
#

btw in what file is chunk pdc stored?

chrome beacon
#

Probably in the chunk nbt

vale ember
#

yeah how can i read that?

remote swallow
chrome beacon
vale ember
#

i don't need to do that from code, i just wanna check if data is getting stored correctly

#

like via command or through file

glossy venture
#

can priority be any number -128 - 127 (byte) or does it have to be 0 - 5

#

oh wait

#

so i think i can use any number

vale ember
#

isnt it enum?

glossy venture
#

nah this is bungeecord

#

forgot to mention

vale ember
#

ohh

remote swallow
#

something i think would be cool is not having to type priority = EventPriority.LEVEL

#

just needing to type EventPriority.LEVEL would be cool

glossy venture
#

then it would have to be called value

quaint mantle
#
@NotNull
public BukkitTask runTaskTimerAsynchronously(@NotNull
Plugin plugin,
long delay,
long period)
throws IllegalArgumentException,
IllegalStateException
Asynchronous tasks should never access any API in Bukkit. Great care should be taken to assure the thread-safety of asynchronous tasks.
Schedules this to repeatedly run asynchronously until cancelled, starting after the specified number of server ticks.

Parameters:
plugin - the reference to the plugin scheduling task
delay - the ticks to wait before running the task for the first time
period - the ticks to wait between runs
Returns:
a BukkitTask that contains the id number
Throws:
IllegalArgumentException - if plugin is null
IllegalStateException - if this was already scheduled
See Also:
BukkitScheduler.runTaskTimerAsynchronously(Plugin, Runnable, long, long)```
#

how do i use this?

#

i got this from javadocs

#

also, how do i get access to the plugin from a completely different class?

remote swallow
#

?scheduling

undone axleBOT
quaint mantle
#

instead of passing it in as arguements

#

ok

remote swallow
quaint mantle
#

ok

#

i think i will set it to a static variable to access it outside of the class.

remote swallow
#

ah, must have been a method

#

set a private JavaPlugin var called instance to this on enable and write a getter

#

?di is better though

undone axleBOT
remote swallow
#
private JavaPlugin instance;

@Override
public void onEnable() {
    instance = this;
}

public JavaPlugin getInstance() {return instance;}
quaint mantle
#

oh ok

#
public static JavaPlugin thisPlugin;

    @Override
    public void onEnable() {
        thisPlugin = this;```
#

i am using this code

remote swallow
#

that should work

#

just need a getter for it

quaint mantle
#

its a static variable though

remote swallow
#

make it a not static variable also

quaint mantle
#

i should be able to do MainClass::thisPlugin to access it, right?

maiden thicket
remote swallow
#

my brain isnt working, wrong person to ask atm

maiden thicket
#

in order to access a non static variable u need the javaplugin object already

#

the javaplugin object means u dont need tbe variable xd

quaint mantle
#

also, how do i use the getInstance method?

#

where do i get the main class instance?

maiden thicket
#

make it private

remote swallow
#

the .getInstance is a getter int he main class

maiden thicket
#

and put a public static getter

quaint mantle
#

okay

#

getInstance is not static

#

therefore in order to call it

maiden thicket
#

make the variable static

quaint mantle
#

i need to do object.getInstance()

maiden thicket
#

private static variable
public static getter

quaint mantle
#

yeah

maiden thicket
#

then u can do Class.getInstance()

quaint mantle
#

that is what i am doing right now @maiden thicket

maiden thicket
#

u dont need the object

#

it is static

quaint mantle
#

i know

maiden thicket
#

o

#

ok

#

🙏🏽

quaint mantle
#
    public JavaPlugin getThisPlugin() {
        return thisPlugin;
    }```
remote swallow
#

make it static

quaint mantle
#

oh yeah

#
    public static JavaPlugin getThisPlugin() {
        return thisPlugin;
    }```
#

ok then

remote swallow
#

yeah

quaint mantle
#

also

#

do you access static variables with :: or .?

remote swallow
#

im pretty sure they do the same thing

quaint mantle
#

okay

vale ember
#

in block piston event, are #getBlocks() blocks already moved or not?

quaint mantle
#

WAIT

#
BukkitScheduler scheduler = Bukkit.getScheduler();
        scheduler.runTaskTimerAsynchronously();```
remote swallow
quaint mantle
#

runTaskTimerAsynchronously() takes an instance of Plugin not JavaPlugin

remote swallow
#

if you mean it saying plugin that is just a di var

quaint mantle
tardy flame
#

Plugin is an interface

#

And JavaPlugin is it's implementation

#

Iirc

quaint mantle
#

question

#

does it use redstone ticks or game ticks?

#

a game tick is supposed to be 1/20 of a second, right?

hazy parrot
#

Yes

quaint mantle
#

yeah probably game ticks nvm.

hybrid ledge
#

How do you guys sync data between bungee servers? E.g. so player on server1 can pay someone on server2 and monetary values gets synchronized across network? I'm using MySQL.

I can think of 3 solutions:

  1. When modifying data - flush them to SQL immediately - and when reading data - never cache data and always query DB for fresh data (possibly resource intensive, lot of queries for everything)
  2. Sync data in time intervals periodically - higher probability for some data collisions if the change occurs on both servers simultaneously
  3. When data changes, use Bungee Plugin Message protocol and inform other servers to update their values
hazy parrot
#

Probably 1

brave sparrow
#

Higher frequency data 3, lower frequency data 1

tardy flame
brave sparrow
#

Mysql is a perfectly acceptable database for that lmao

tardy flame
#

But something like redis instead

#

Based on the amount of queries

brave sparrow
#

You don’t need Redis for that

#

Redis would be a good alternative to bungeecord messaging for 3 though

tardy flame
hybrid ledge
#

I need to study what Redis is, I worked only with MySQL so far. From what I've heard its in-memory database

brave sparrow
#

MySQL databases are plenty performant enough to handle a high throughput of queries, and it stores that type of data very sensibly

brave sparrow
hybrid ledge
#

But it acts as separate server app, right? It doesn't mean its tightly coupled with one of the Minecraft server instances

brave sparrow
#

It’s a database server like mysql

#

It’s fast but it doesn’t necessarily represent structured data in as clean a manner as something like sql or mongo out of the box

#

It’s primarily a key-value store with pub sub

hybrid ledge
#

Cool, I will check both variants. I was thinking about utilizing ORM for my data model, but something less chunky and more performant may be viable option for very frequent syncs of data between servers

brave sparrow
#

Depends on what you mean by very frequent

#

If it’s less than hundreds of queries per second mysql will handle that just fine

#

No need to overengineer it

torn basalt
#

i maked a lobby plugin but when i use Main.plugin.saveConfig();

#

the spaces gone in config.yml

#

original:

#  ______              _           _____ _             _ _
# |  ____|            | |         / ____| |           | (_)
# | |__ ___  _   _  __| |_ __ ___| (___ | |_ _   _  __| |_  ___  ___
# |  __/ _ \| | | |/ _` | '__/ _ \\___ \| __| | | |/ _` | |/ _ \/ __|
# | | | (_) | |_| | (_| | | |  __/____) | |_| |_| | (_| | | (_) \__ \
# |_|  \___/ \__,_|\__,_|_|  \___|_____/ \__|\__,_|\__,_|_|\___/|___/

license: "yOuRaWeSoMeLiCeNsEkEy"

join:
  message: "&8[&a+&8] &e%player%"
  title: "Welcome,"
  subtitle: "%player%"

quit:
  message: "&8[&c-&8] &e%player%"

void-spawn:
  enabled: true
  y-level: 0

bungeecord-npc:
  skyblock:
    server: skyblock
  towny:
    server: towny

spawn: {}
#

reloaded:```yaml

______ _ _____ _ _ _

| ____| | | / ___| | | ()

| |__ ___ _ _ | | __ | ( | | _ _ _| | ___ ___

| __/ _ | | | |/ _ | '__/ _ \\___ \| __| | | |/ _ | |/ _ / __|

| | | () | || | (| | | | __/) | || || | (| | | () _ \

|| ___/ _,|_,|| _|/ _|_,|_,||_/|__/

license:
join:
message: '&8[&a+&8] &e%player%'
title: Welcome,
subtitle: '%player%'
quit:
message: '&8[&c-&8] &e%player%'
void-spawn:
enabled: true
y-level: 0
bungeecord-npc:
skyblock:
server: skyblock
towny:
server: towny
spawn:
world: world
x: 21.699398164988985
y: 4.0
z: 49.143611878006034
yaw: 103.1334
pitch: 8.976903

quaint mantle
#

this there something in spigot for getting the server mspt?

#

or is that even a thing in paper and spigot servers?

chrome beacon
#

Don't think Spigot API has a method for that

#

Paper has it though

torn basalt
#

someone can help

chrome beacon
#

Resaving will override the old config with the new values

#

That is normal

#

?main

chrome beacon
#

?di

undone axleBOT
chrome beacon
#

You should also take a look at the two links above

undone yarrow
#

This code worked yesterday, and now it suddenly doesn't anymore. It's supposed to break the blocks which the exp bottle hits. No errors.

public class XPBottleBreakListener implements Listener {

    @EventHandler
    public void onHit(ProjectileHitEvent e, ExpBottleEvent x) {
        // Breaks blocks hit by xpbottle
        if (!(e.getEntity() instanceof ThrownExpBottle)) return;
        Block block = e.getHitBlock();
        if (block == null) return;
        block.breakNaturally();
        //x.setShowEffect(false);
        //x.setExperience(100);

    }
    @Override
    public void onEnable() {
        // Plugin startup logic
        System.out.println("Starting up...");

        getServer().getPluginManager().registerEvents(this, this);
        getServer().getPluginManager().registerEvents(new XPBottleBreakListener(), this);
    }```
#

I rebuilt multiple times but no luck

#

The only change I made compared to yesterday was adding ExpBottleEvent x in onHit()

quaint mantle
#

[18:44:50 ERROR]: Thread Craft Scheduler Thread - 4 - FirstPlugin failed main thread check: block remove

undone yarrow
#

...

#

why not

quaint mantle
#

can i not change blocks asynchronously?

chrome beacon
chrome beacon
undone yarrow
quaint mantle
#

i am trying to change a lot of blocks

chrome beacon
#

You're not experienced enough to deal with async things. Keep your plugin sync

#

?workdistro

chrome beacon
#

^ Use that

quaint mantle
#

can i not do it without straining the main game thread?

#

and hurting the mspt?

torn basalt
chrome beacon
quaint mantle
#

okay.

chrome beacon
#

I have no idea what you're trying to say

#

Did you even read that page

torn basalt
#

Now my main class named Main i need rename my main class to <pluginName>Main?

chrome beacon
#

Generally it's <pluginName>Plugin

torn basalt
#

still spaces gone @chrome beacon

chrome beacon
#

Well yeah that's normal

#

Nothing you can do about that

torn basalt
chrome beacon
#

They don't save their config

#

All they do is create it if it doesn't exist

quaint mantle
#

@chrome beaconfrom what i read so far from that link, i assume it is still executing in the main game thread but it is executing a very small chunk of the task each tick instead of trying to do it all at the time.

chrome beacon
#

Yeah

quaint mantle
#

that would be kind of slow though.

chrome beacon
#

If you want it to be faster you can get a better CPU

quaint mantle
#

ok another question

#

is there a way to create more worlds in spigot?

chrome beacon
#

Yes

quaint mantle
#

like another overworld?

chrome beacon
#

Yeah use the WorldCreator

quaint mantle
#

in RAM of course.

#

i dont want it to be stored in storage.

#

does each world use its own cpu thread?

#

or run on the same thread?

chrome beacon
#

A bit of both

quaint mantle
#

what about mass changing blocks?

chrome beacon
#

Just use work distro

remote swallow
#

?workdistro

quaint mantle
#

i already read that and i got the idea.

#

i am just implementing a task scheduler.

final monolith
#

yes, the libraries is inside the builded .jar

chrome beacon
#

gson is already provided in Spigot 🤔

spice shoal
#

?start

#

?minecraft

#

?server

chrome beacon
#

?flags

undone axleBOT
spice shoal
#

Thanks

dry yacht
onyx fjord
#

how do u check if location is a slime chunk?

opal juniper
#

Chunk#isSlimeChunk

onyx fjord
#

great

final monolith
#

no errors

final monolith
vale ember
#

how do i know in a block/entity explode event if exploded block will drop an item?

vale ember
#

will BlockDropItemEvent be called if block is exploded by creeper or TNT?

tender shard
#

no

vale ember
#

i wanna make a specific block drop a specific item, how can i do that?

tender shard
#

you could manually drop it in the explode event if the blockList contains that block

vale ember
#

yeah but how do i know if that block was going to drop or not?

tender shard
#

you don't know that, it hasn'T been calculated yet

#

it depends on the yield float

chrome beacon
dry yacht
# final monolith

Well, I didn't mean build errors, but stacktraces. Post the full NoSuchMethodException stacktrace, and post the FULL pom.xml.

tender shard
vale ember
#

is there an event for when an anvil or sand or gravel falls?

remote swallow
#

gravity event

#

oh wait

#

thats not a thing

#

i thought that was

eternal oxide
#

starts or ends falling?

vale ember
#

doesnt really matter, but i want to know both initial and final location

eternal oxide
#

catch spawning of a FallingBlock

#

Thats an Entity

vale ember
#

EntitySpawnEvent>

#

?

eternal oxide
#

yes

vale ember
#

but how do i know it's final location?

tender shard
vale ember
#

when it lands

tender shard
#

EntityChangeBlockEvent ig

eternal oxide
#

probably BlockForm event

#

or one of its sub events

tender shard
#

nah

eternal oxide
#

could be change

tender shard
#

let's check, I still got craftbukkit open

eternal oxide
#

as there is an EntityBlockFormEvent I'd assume that

tender shard
eternal oxide
#

it could be any of the three so check them

tender shard
#

as said it's EntityChangeBLockEvent :3

eternal oxide
#

yep

#

had to be one of them

vale ember
#

but how can i know the initial location of the falling block (where the block started the fall) in the ENtityChanageBlockEvent?

eternal oxide
#

you have to track the FallingBlock

#

when it spawns

#

or if YOU are spawning the block add it's spawn location to it's PDC

vale ember
#

no im not

eternal oxide
#

Then you need to tell us what you are doing so we can tell you which is best

vale ember
#

i am storing block coordinates and i need to change them whenever a block is moved, and falling is a way to move so i need to track it

eternal oxide
#

then track ALL spawning FallingBlocks

#

You can read teh original location from your data when it lands

vale ember
#

maybe i can track all falling block spawns and write their initial coordinates into their pdc and read it on entitychangeblock event?

eternal oxide
#

just as I said to do

vale ember
#

yeah thank you very much

vale ember
#

why?

tender shard
#

well it makes no sense

eternal oxide
#

he can in the EntitySpawnEvent

tender shard
#

yes sure

#

but he asked specifically how he can get it from the other event

#

you gotta create a Map<UUID,Location>

eternal oxide
#

add it's initial Location to it's PDC. Then ALl FallingBlocks will have that entry upon landing

tender shard
#

in EntitySpawnEvent, add it to the map

#

PDC would ofc work too, yes

worldly ingot
#

Death is handled by the server, not the entity itself. It kind of just marks itself for death

#

That method is effectively raising a white flag

mental lion
#

does anybody know why this is happening: when creating a resource and adding imgur gifs, some work, some dont.
they show up correctly in the rich text editor but in preview & reality they just show up as [IMG].
i looked into it and it seems like the spigot proxy doesn't want to give out that image somewhy.
can anybody help?

vagrant stratus
#

Yea @buoyant viper I'm just gonna remove Base64 decoding support and leave it as a TODO comment lmao

worldly ingot
mental lion
#

i see

worldly ingot
#

If it's not 4.5, it's 4 for sure

balmy valve
#

does world#getAllLivingEntities() return all living entities or just those in loaded chunks. And If is the latter is there anyway to get all living entities

eternal oxide
#

only loaded

#

unloaded are assumed dead

#

You definitely don;t ever want ALL entities

#

would easily kill your server

balmy valve
#

Fair enough lol

#

In that case, how heavy is it to listen to a chunk load event?

#

If the logic itself is light inside of it

eternal oxide
#

depends what you are doing with it

#

Just listening is not heavy

humble tulip
mental lion
#

i tried that multiple times

#

it was the file size limit though, works now

tender shard
#

spigot's "kill" method or how it's called also just says "Marks this entity for removal" or sth and everyone's always like "ugh whut"

tender shard
worldly ingot
#

No not resources. GIFs

tender shard
#

ooh ok

tender shard
vague swallow
#

How can I extinguish players?

tender shard
#

set it to 0

worldly ingot
#

Or kill the player

#

That's the more fun way

#

Can't be on fire if you're dead

tender shard
#

then do respawn(), teleport them back and give them back their items and XP

#

that's definitely the cleanest solution, yeah

#

or spawn a water block under them for one tick

#

or teleport them into the next nearby ocean, then teleport them back next tick

#

just bi creative 🌈

vague swallow
worldly ingot
#

sadge I thought it was funny

remote swallow
#

poor choco

vague swallow
humble tulip
#

Kick them with a message to rejoin, delete their player data file

#

They won't be on firr anymore

#

Fire

quaint mantle
#

is there some sort of program that allows me to make custom models specificly the json part quicker? Im not tryna type that shit out

worldly ingot
#

Yeah definitely. BlockBench

rigid loom
#
if (args[0].equalsIgnoreCase("disband") && plugin.getKingdoms().containsKey(player.getUniqueId().toString()) && plugin.getKingdoms().containsValue(kingdom) && player.hasPermission(kingdom + ".disband")) {

                    for (Player p : Bukkit.getOnlinePlayers()) {
                        plugin.getKingdoms().remove(p.getUniqueId().toString());
                    }
                    
                    PermissionAttachment attachment = player.addAttachment(Kingdoms.getProvidingPlugin(Kingdoms.class));
                    attachment.unsetPermission(kingdom + ".disband");
                    player.sendMessage(ChatColor.WHITE.toString() + ChatColor.BOLD + kingdom + ChatColor.GREEN + ChatColor.BOLD + " disbanded");
                    return true;
                }```
im trying to remove players from a hashmap called `kingdoms` when the player does `/k disband` using a for loop. am i executing this correctly?
worldly ingot
#

Unless you mean actually creating like the <item>.json file to point to the model file, in which case no there's no program to do that automatically, but ideally it's just one extra line

worldly ingot
rigid loom
#

how would i make it remove just the people in that kingdom?

quaint mantle
remote swallow
clear sluice
#

When trying to get jedis values while running for loop pulling jedis values for something else, it throws me
[12:16:42 ERROR]: Could not pass event PlayerInteractEvent to Plugin v1.0-SNAPSHOT
java.lang.IllegalStateException: Please close pipeline or multi block before calling this method.

is there a way to handle it?

lapis belfry
#

EpicEbic

#

Today i tried that plugin

#

But it uses ProtocolLib so i installed it

#

Then randomly everyone getting kicked for Timed Out

#

When I see console it says plugin is made for older version

lapis belfry
#

U rem me?

#

Yesterday.

remote swallow
#

it either has stuff that is version specific or they have a version check

lapis belfry
#

1.8-1.16.5

remote swallow
#

check the main class and see if it has version checks

lapis belfry
#

And I'm using 1.18 because if i use older then worldguard won't work

remote swallow
#

iirc worldguard has a 1.16.5 version

lapis belfry
#

But it's not workin

remote swallow
#

in the plugin

lapis belfry
#

using Eclipse ?

remote swallow
#

any ide with a decompiler would work

lapis belfry
#

Or WinRar

#

ok

remote swallow
#

you pretty much just need a way to read the .class files

lapis belfry
#

I'll try it

#

.class

sterile token
#

Trying to survive on this project 💀

vale ember
#

hey can someone help i can't find the code responsible for calculating whether a block should survive an explosion based on yield

sterile token
#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

vale ember
#

i did

sterile token
#

What code you have so far?

vale ember
#
        event.blockList().removeIf(it -> {
            if (isNotCustomBlock(it)) {
                return false;
            }
            it.getWorld().dropItemNaturally(it.getLocation(), item.unwrap());
            return true;
        });

I have this code for checking whether a block is custom or not. It currently drops the item with 100% chance, but i want to do it based on yield the exact same way vanilla does

#

i was browsing craftbukkit sources, but i couldn't find the code responsible for it

river oracle
#

that is all NMS and its likely hard coded

vale ember
#

so i have to look inside minecraft server's sources?

river oracle
#

yea, but be honest with yourself here, do you reallllyy need NMS to do this

#

what is preventing you from making your own system

vale ember
#

no i don't wanna nms

river oracle
#

Random is fairly easy implement

vale ember
#

minecraft uses java's built-in Random?

river oracle
#

don't see why it wouldn't

#

no reason to go overboard with something so trivial

#

you can just seed SecureRandom or Random with the current time and call it a day

vale ember
#

k thanks, ill do it that way

river oracle
#

if you care about security use SecureRandom and make sure to make your seed somewhatunique

#

with something so trivial though seriously don't worry about it

vale ember
#

k

twilit pulsar
#

I have a problem that some of my plugins wont show up at /plugins its prob something i have forgot but please tell me

tender shard
tender shard
twilit pulsar
vale ember
tender shard
#

does it actually say "main: net.minecraft.server.Netstaffchat"?

twilit pulsar
#

Yea

#

OHH

#

IC

tender shard
#

and how is that class actually called?

twilit pulsar
#

I miss spelled the class

#

dank

#

danke

tender shard
#

np

twilit pulsar
#

meine frau

tender shard
#

I'm a dude

twilit pulsar
#

Mein mann

visual crypt
#

guys is it possible to create a custom event without the use of a command? (i wanna make an event where if a player reaches a certain coordinate point, they get teleported somewhere)

#

oh wait theres a player move event, i didnt even realize xD

#

tyty

round finch
#

🤨

sterile token
tender shard
tardy delta
#

why not using jda too?

#

wait is a webhook smth server specific?

remote swallow
#

webhooks are channel specific iirc

buoyant viper
#

try specifying Content-Type request header (application/json) with connection.setRequestProperty

#

also idr how javas io actually works but u might need to flush the output stream before trying to send the connection so connection.getOutputStream().flush(); before getInputstream(), but hopefully just Content-Type should fix

warm mica
#

Just use some proper libraries

buoyant viper
#

sometimes its more fun to suffer

warm mica
#

At least for json, that's horrific

hazy parrot
#

400 means usually that your json payload is bad

#

Also manually writing json is... Meh

tardy delta
#

ah i remember what a webhook is, thought it some that embed on a webpage

vale ember
#

how can i break a block without dropping it?

remote swallow
#

Set it to air

sterile token
sonic goblet
#

You dare question the great Verano?

manic furnace
#

I'd have a small question about log4j. Should I create an Own class which contains my logger or just throw it into an existing class?

ivory sleet
#

Usually you have a static variable in each class that points at a class corresponding logger

#

And then in case you unit test you append log filters yk

mellow edge
#

Hello, how can I get entities in unloaded chunks? Iterating through Entity array doesn't work!

tardy delta
#

would be fun if you could do a switch on an iterable

remote swallow
#

You would need to load the chunk first, if thr chunk is unloaded a mob is classed as dead so not in the entity array

tardy delta
#

like switch (functions.getRegisteredBeginLetters()) {}

twin venture
#

hi , i have a hard time understanding this :
iam using gson to save Prestieges to json file , but when i try to load it :
i get this error :
Unable to invoke no-args constructor for interface dev.skypvp.api.model.Prestige. Registering an InstanceCreator with Gson for this type may fix this problem.

i was able to fix it using :
this.gson = new GsonBuilder().setPrettyPrinting().registerTypeAdapter(Prestige.class,
new PrestigeInstanceCreator()).create();

my Question is , will this load all Prestieges , or no ?

tardy delta
#

what even is an instancecreator, why not just a jsondeserializer?

#

or typeadapter

glossy venture
#

if you deserialize the whole json file it should

glossy venture
#

but usually you dont process stuff in unloaded chunks because it has no point for the current players or server anyways

#

so what are you trying to do

mellow edge
#

I am trying to get all dropped items by a player in the overworld

fallow violet
#

queue them in a list

remote swallow
#

Wouldnt that mean the chunk is loaded

fallow violet
remote swallow
#

You could also perform your task on chunk load event

glossy venture
#

yeah that sounds like a better ideaa

mellow edge
#

I want to automate it

fallow violet
#

wait whats your plan?

#

you get the items and then?

mellow edge
#

check that list

fallow violet
#

for what

mellow edge
#

for persional use

fallow violet
#

wdym

mellow edge
#

I need it to find some items I lost a long time ago and I have no idea where they are

fallow violet
#
  1. They are 99% gone
#
  1. imposible
mellow edge
#

why would they be gone? those chunks haven't been loaded

fallow violet
#

check all chunks you have created for items

#

and teleport them back

#

or just cheat new items lol

glossy venture
#

you might be able to use some kind of external world tool

#

to scan all region files

mellow edge
#

but dealing with raw files is a problem

glossy venture
#

in that case, either read the region files or load each chunk on a running server

#

might be a library for reading anvil rg files

ocean hollow
#

How can null come out? How do I fix this?

glossy venture
remote swallow
#

Thats just intellij for you, you can ignore it

humble tulip
glossy venture
#

oh fr

#

does craftbukkit do that automatically

humble tulip
#

intellij doesnt know if event.getInventory().getItem() returns the same thing twice

#

we know it does but intellij doesnt

glossy venture
#

oh true

#

i didnt see there was a null check above

#

lol

humble tulip
#

also do item.getType() == Material.WRITTEN_BOOK

fallow violet
glossy venture
#

no looks worse

fallow violet
#

no?

humble tulip
#

um wat

#

not for enums??

fallow violet
#

you can use queals for everythin except int

#

and boolean

humble tulip
#

guess imma use .equals for longs

glossy venture
#

i hope the jvm optimizes that

fallow violet
#

you know what i mean

glossy venture
#

for you

fallow violet
#

damn

humble tulip
#

== is faster because .equals has the overhead of a method call

glossy venture
#

yeah

humble tulip
#

.equals does the same as == for enums

fallow violet
humble tulip
#

I said to compare enums

fallow violet
#

but where is the difference? i mean almost same

glossy venture
#

.equals is more verbose

humble tulip
glossy venture
#

and overhead but i bet javac or jvm optimizes that out

humble tulip
#

yeah probably optimized out

#

also == is safer when theres a possibility of null being returned

fallow violet
#

true

glossy venture
#

bruh what

#

file name too long?

#

oh wait

#

it may think that whole thing is the file lol

#

nvm what the fuck

#

oh wait

#

i need to split the args

#

bruh

rotund ravine
#

Lol

glossy venture
#

guys this does not work

#

dont do this

#

holy shit it actually registered the server

#

no way

ocean hollow
glossy venture
#

yeah sorry didnt see

#

ignore me

#

just ignore the error

#

intellij doesnt understand the logic

ocean hollow
#

but I cant ignore it

glossy venture
#

did you remove the null check

ocean hollow
#

no

#

as in the screenshot and still says null

glossy venture
#

maybe try to use one variable

ItemStack item = inv.getItem(10);
if (item != null) {
  item.getType()//...
}
glossy venture
#

line 85

ocean hollow
#

yes

#

i can send more

tardy delta
#

orbyfied i really wanna know what you're making \👀

tardy delta
#

i might've forgotten already

glossy venture
#

also coldlib

#

the container shit

tardy delta
#

like spigot related?

glossy venture
#

the server network is bungee and purpur
coldlib is general java shit but also some bukkit utils

tardy delta
#

ooh nice

glossy venture
#

but oracle is not forwarding my porxy port or something

#

proxy

#

wait could it have smth to do with this non existent server i declared

ocean hollow
#

so i made using var

tardy delta
#

use early returns man

#

that looks awful doesnt it

sterile token
#

java.lang.IllegalArgumentException: Invalid BSON field name uuid - Mongo being mongo

#

😡

#

Why mongo is so asshole some times 🤔

ocean hollow
#

Is it possible to block all slots except for certain ones?

glossy venture
#

bruh its listening on ipv6
why the fuck is it listening on ipv6

glossy venture
ocean hollow
#

thanks

humble tulip
#

@glossy venture did you register a string with spaces as a command?

glossy venture
#

what

#

no i dont think so

#

you mean a bungee command

humble tulip
glossy venture
#

why

humble tulip
#

wait nvm

glossy venture
#

oh nah i fixed that

ocean hollow
#

Did I understand correctly?

glossy venture
#

yeah

humble tulip
#

is it the top inventory @ocean hollow

#

?

#

you may wanna use getRawSlot i think

ocean hollow
#

yes

humble tulip
#

want nvm as long as you check that the clicked inv is the top inv

ocean hollow
#

so getRawSlot for top inventory, getSlot for down inventory?

glossy venture
#

getSlot gets the slot number in the clicked inventory

ocean hollow
#

thanks

worldly ingot
#

Because that statement will always be true

#
int slot = 11;
if (slot != 11 || slot != 47) { }
// Boils down to
if (false || true) { }```
sterile token
glossy venture
#

he was reacting to someone else

#

about smth completely different

sterile token
glossy venture
#

they

#

whatever

sterile token
#

Are you drunk? tho

glossy venture
#

no

#

?

sterile token
glossy venture
#

the person you were reacting to wasnt reacting to your mongodb message
or were you just asking if they had mongodb experience?

#

i assumed you thought they were reacting to your message

#

cause you reacted to their message

humble tulip
#

minion325 (he/him)

sterile token
humble tulip
#

What do you need with mongodb?

sterile token
#

Im either dumb or mongo is trolling

glossy venture
#

code?

sterile token
#

Because the uuid field exists on db, so he cannot tell me that

sterile token
gleaming grove
#

try profile.getUuid().toString()

sterile token
glossy venture
#

idk uuid might just be a reserved name?

sterile token
#

no, no i dont think so, i was using it before and was working perfect

gleaming grove
#

?

sterile token
#

Yeah

#

I have only 1 row atm

#

I will try with another account

glossy venture
#

if you want to replace the whole doc use replaceOne(..., new UpdateOptions().upsert(true))

sterile token
#

Wait im replacing it?

glossy venture
#

otherwise, findOneAndUpdate(Filters.eq("uuid", uuid), Updates.set("abc", 69))

glossy venture
sterile token
#

And what about i need to update the whole properties? I wont be able to use Updates.set()

glossy venture
#

so it looks at it but uuid is not a valid operation so it throws shit

glossy venture
sterile token
#

Or im wrong?

glossy venture
#

then you have to keep track of the modified fields and manually save each

#

i dont think mongodb can do that for you

#

but doing an upsert replace is faster than having mongo set each field

sterile token
#

So definitly must be that shity findOneAndUpdate() the issue

glossy venture
#

yeah

sterile token
#

Because im saving it like that, and no issues

glossy venture
#

yeah

#

is that a problem

#

this works right

sterile token
#

No no, i mean that using findOneAndReplace there is no issue with the field uuid

glossy venture
#

no it wasnt complaining about the Filters.eq, it was complaining about the update operation not being valid

#

findOneAndReplace just replaces the whole doc

sterile token
#

Ohhh ok

glossy venture
#

no need for an operation

sterile token
#

Oh i thought the issue was caused cuz of the wrong operation

glossy venture
#

yeah it was

#

but replace doesnt take an operation

#

it just takes the whole document

#

it wasnt because of the Filters.eq("uuid", ...) though

sterile token
#

oh ok

#

So i will need to use just findOneAndReplace()

glossy venture
#

yeah

sterile token
#

okay it weird

#

For some reason, when i leave before running async task to save the doc into the db and removing the profile from the Map, it putting a boolean to false, but when i rejoin the boolean is still true

#

Thanks, nothing i fixed it

glossy venture
#

this is a certified bruh moment

gleaming grove
#

How can I get color from Dye?

glossy venture
#

now the fun thing is that i cant see the exit message

sterile token
glossy venture
#

trying to start a server with ProcessBuilder

sterile token
gleaming grove
#

i guess but have no idea to what

#

not found any ColorMeta

sterile token
#

Check the dye object, it should implement/extend others objects

glossy venture
#

you can only use that on legacy materials i think]

sterile token
#

Isnt called DyeColor?

tardy delta
#

check jd for classes implementing itememeta

glossy venture
#

but getNewData checks if it is a legacy material first

#

maybe colorable?

gleaming grove
#

Colorable is only for blocks

vast shale
#

I'm trying to spawn a boat that the player cannot move. My thought was to spawn a boat with an entity inside, then place the player inside but the boat automatically places the player as the driver. Does anyone know a way around this? Perhaps an entity the boat wont automatically push to the back?

glossy venture
#

you could just try to get it from the material name

gleaming grove
#

well I think I just make big switch that check color based on Itemstack dye

gleaming grove
glossy venture
#

are you fucking kidding me

#

thats the whole point

#

you dont have to extract every single library twice

#

(its a sym link to a shared folder)

sterile token
#

Paper 💀

glossy venture
#

ok guys time to fork paperclip and fix this shit

tardy delta
#

already 2 january

eternal night
# glossy venture ok guys time to fork paperclip and fix this shit

Tests whether a file is a directory.
The options array may be used to indicate how symbolic links are handled for the case that the file is a symbolic link. By default, symbolic links are followed and the file attribute of the final target of the link is read. If the option NOFOLLOW_LINKS is present then symbolic links are not followed.

glossy venture
#

yeah paperclip doesnt do that though

eternal night
#

Files.isDirectory(...) returns false when called on a sym link on Unix or Linux systems

glossy venture
#

no options are provided in the source code

#

i looked at it

eternal night
#

By default, symbolic links are followed and the file attribute of the final target of the link is read.

glossy venture
#

shouldve maybe clarified

#

hm

#

wait i may be a little bit retraded

eternal night
glossy venture
#

lmao i gnore eveyrthgivn

eternal night
#

what was it xD

glossy venture
#

the symlink wasnt linking to the correct directory

#

it was linking to a non existent one LOL

eternal night
#

yea that would do it then huh

glossy venture
#

aight thanks for saving me like an hour of work

eternal night
#

no problem pepe_hand_heart

glossy venture
#

wait bruh it still doesnt work

#

but now i know there must be smth wrong with the symlink

eternal night
#

I haven't actually tested it, but at least judging from the javadocs, the code should be functional

glossy venture
#

i hope

#

maybe .. doesnt work in symlinks

#

what

#

im so confused

eternal night
glossy venture
#

bruh

#

libraries isnt even a symlink

#

its red

#

what the fuck

#

p is real

#

libraries is weird

#

ayy i fixed it

#

symlink had to be to absolute path

gleaming grove
#

wtf I've restarted IDE and this happen

chrome beacon
#

Is it indexing

fluid river
#

i slept like 20 hours

#

after this message i went to sleep

#

vodka + pivo

primal goblet
#

ClassNotFoundException: io.socket.client.IO

whats the issue with my pom.xml?
i made the plugin with mvn clean package.
and thats my dependencies in pom.xml

<dependencies> <dependency> <groupId>org.spigotmc</groupId> <artifactId>spigot</artifactId> <version>1.8.8-R0.1-SNAPSHOT</version> <scope>provided</scope> </dependency> <dependency> <groupId>io.socket</groupId> <artifactId>socket.io-client</artifactId> <version>2.1.0</version> </dependency> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>2.11.0</version> </dependency> </dependencies>

chrome beacon
#

you need to shade socket io with the maven shade plugin

primal goblet
primal goblet
glossy venture
#

bro what the fuck does this stupid thing mean

#

oh shit it might be an unused import

chrome beacon
fallow violet
#

yeah my bad

#

Listen on BrewEvent, get the block's state and cast to BrewingStand and then use #setBrewingTime

#

lmfao

eager yew
#

Is there a way to make a mushroom be plantable in 15 light level, or make the sky light level be 12?

glossy venture
fallow violet
#

same thing on PotionEffectType.CONFUSION => nausea

#

true

#

but still shit

glossy venture
#

fucking Enchantment.DAMAGE_ALL and shit though

#

spigot link to what

#

what the fuck exit code 130

eager yew
eager yew
#

but i dont call a event in a populator, i used limitedRegion.setType()

fallow violet
#

so you do following

#

maybe use BrewingStandFuelEvent

#

no wait

#

in BrewEvent you cast the block state to a BrewingStand and then use #setBrewingTime

tender shard
#

Brewing api sucks

#

I think we can all agree on that

fallow violet
sonic goblet
#

+1

fallow violet
#

use InventoryClickEvent in brewstand?

#

and try this on the InventoryHolder?

vague swallow
#

what is the best way to get the targeted entity of a player?

fallow violet
tender shard
#

raytrace

fallow violet
vague swallow
fallow violet
#

welcome to minecraft

#

my bad

#

spigot

#

but an inventory type? something like that?

#

wait

#

exist?

#

use that ig

#

have fun doin this mess lol c:

#

xd

#

do a debug thats easier

#

you need to change the item?

sullen marlin
#

?jd-s

undone axleBOT
fallow violet
#

get the inventory holder

#

cast to BrewingStand

sullen marlin
fallow violet
#

and do it

#

idk much about inventory holders tho

#

maybe its the brewing stand already?

#

maybe its useless

sullen marlin
#

holder like Knuffe said

fallow violet
#

+1

sullen marlin
#

block

fallow violet
#

and then u cast it to brewing stand

#

the state getState()

#

no wait

#

inventory.getHoler().getState()

#

blockstate

sullen marlin
#

no I think its correct

fallow violet
#

getBlockState?

fallow violet
sullen marlin
#

needs a brew.update at the end though

fallow violet
#

who created this api T^T

#

does it affect something? unless just ignore it ig xd

tall dragon
#

when you set the time left it will probably make the UI jump instead of making it go faster too

#

last time i did this i just ticked the brewing stand myself

fallow violet
#

damn spigot make better brewing api and then we can talk again xd

tall dragon
#

does use nms tho 😄

tall dragon
#

yea its pain

vague swallow
sullen marlin
#

I don't understand what you're saying needs improving

#

Can you be specific

#

?jira

undone axleBOT
fallow violet
#

PLEASE

sullen marlin
#

Feature requests linked above

#

Are there any other blocks that need a similar thing?

fallow violet
#

i think not

#

is there a campfire event?

#

alright campfire is needed too

sullen marlin
#

Aren't campfires instant

fallow violet
tall dragon
#

they do indeed

sullen marlin
#

Anyway, open a JIRA ticket or two please

fallow violet
#

i dont know how, @last temple do it xd

sullen marlin
#

different account

fallow violet
#

hf

#

can u cook on them?

#

oups

humble tulip
#

mc isnt mc anymore

#

that looks like a mod lmao

fallow violet
#

im fluffy now so that makes me extra fluffy :p

fallow violet
humble tulip
#

havent played properly since like 1.12-1.13

sullen marlin
#

like wtf is any of that

#

also nautilus isn't even a mob

humble tulip
#

😂

#

yeah new feature

#

I'd like to contribute to spigot but it feels like so much work

humble tulip
#

send ss

sullen marlin
#

just put whatever, not really relevant for features

fallow violet
#

daymn

#

campfire

#

lol

#

nice

sullen marlin
#

thanks

humble tulip
#

Great english

sonic goblet
#

Are you a cat?

hardy garnet
#

What does e.registerIntent do?

late sonnet
#

the what? xd

#

where is this? or mabe im a litle confuse about the "tag" thing

sullen marlin
late sonnet
#

@last temple yeah im sure not exists a thing like rank in forum or role here for contributors, you can check Stash and check last "merged" PR for the people how send things

hardy garnet
#

but dang, super powerful. Now I need to refactor all my code #fun

#

asynchronous my beloved

#

So does that mean I can registerIntent then interact with the event asynchronously?

orchid gazelle
#
      public List<Location> getHollowCube(Location corner1, Location corner2, double particleDistance) {
            List<Location> result = new ArrayList<Location>();
            World world = corner1.getWorld();
            double minX = Math.min(corner1.getX(), corner2.getX());
            double minY = Math.min(corner1.getY(), corner2.getY());
            double minZ = Math.min(corner1.getZ(), corner2.getZ());
            double maxX = Math.max(corner1.getX(), corner2.getX());
            double maxY = Math.max(corner1.getY(), corner2.getY());
            double maxZ = Math.max(corner1.getZ(), corner2.getZ());
         
            for (double x = minX; x <= maxX; x++) {
                for (double y = minY; y <= maxY; y++) {
                    for (double z = minZ; z <= maxZ; z++) {
                        int components = 0;
                        if (x == minX || x == maxX) components++;
                        if (y == minY || y == maxY) components++;
                        if (z == minZ || z == maxZ) components++;
                        if (components >= 2) {
                            result.add(new Location(world, x, y, z));
                        }
                    }
                }
            }
            
         
            return result;
        }

Heya^^ I would like to know why this only draws 3 faces of the cube(see in picture) and what I need to change to make it draw all 6.

vast shale
#

I'm trying to spawn a boat that the player cannot move. My thought was to spawn a boat with an entity inside, then place the player inside but the boat automatically places the player as the driver. Does anyone know a way around this? Perhaps an entity the boat wont automatically push to the back?

vague swallow
hardy garnet
#

is registerIntent only on BungeeCord? I can't find the method in spigot

orchid gazelle
vague swallow
# tender shard raytrace

Hey uhm, do you know why this throws out a NullPointerException?

RayTraceResult t = p.getWorld().rayTraceEntities(p.getLocation(),p.getLocation().getDirection(),distance(p));
if(t.getHitEntity() != null) {
    Entity e = t.getHitEntity();
    p.sendMessage("" + e.getName());
    e.teleport(p.getLocation());
}
undone axleBOT
vague swallow
#

no I looked at a pig

tall dragon
#

maybe out of range?

vague swallow
#

I am 100% sure that the hitbox was in the raytrace

#

I'll see if it was the distance

vague swallow
eternal oxide
#

is p a vector?

#

oh thats a ,distance(p)

#

it looked like a dot to me

vague swallow
vague swallow
eternal oxide
#

you are going to always get the same result. Its going to colide with the player as you are starting within th eplayers BoundingBox

vague swallow
#

so what should I do instead?

eternal oxide
#

use teh method that accepts a predicate

tall dragon
vague swallow
#

oh wait so

#

the strange thing is if I look into the air it happens what Elgar said

#

it returns me

eternal oxide
#

also, are you sure your pig is actually in the direction the player is facing?

vague swallow
#

but if I look at an entity I get the error

eternal oxide
#

yes it will always return you

vague swallow
#

if I look at an entity I get the error

eternal oxide
#

if you are using the players location not Eye location it's going to be looking in a flat plane in the direction the players model is facing, not the direction you are looking

vague swallow
eternal oxide
#

yes, start in front of teh player not at the players location

vague swallow
#

how can I do that?

eternal oxide
#

getEyeLocation().add(p.getEyeLocation().getDirection())

vague swallow
#

alright let's try this

eternal oxide
#

or predicate and exclude yourself

#

hit -> !p.equals(hit)

vague swallow
#

it's working!!!! Thanks very much

#

you helped me alot

vale veldt
#

Hello, I comment something guys to see if you can help me.
I am using the following:

event.getBlock().getDrops().iterator().next();```
#

In 1.19 it works without problem, but in 1.12 it gives me yaml Caused by: java.util.NoSuchElementException
happens with NETHER_WARTS
Why does it work with one version and not with another?

eternal oxide
#

Different return in 1.12?

vale veldt
eternal oxide
#

I just checked and it seems to return the same Collection<ItemStack>

#

do you have an api version in your plugin.yml?

vale veldt
eternal oxide
#

Well the error says you have no elements in your returned Collection

hardy garnet
#

Is there a list of tasks/methods that spigot can do asynchronously?

vale veldt
eternal oxide
#

So it doesn;t error every time?

#

then you have a block which has no drops in 1.12

#

so check first with .hasNext()

vale veldt
eternal oxide
#

test your iterator has elements before moving the pointer

vale veldt
eternal oxide
#

nah that can;t be it

vale veldt
#

Does it work for you with NETHER_WARTS without any problem? I do not understand

eternal oxide
#

I've not tested it, but then again I'd never assume an iterator has elements

#

You must be finding a situation when spigot returns no drops, so you must check your iterator first

vale veldt
#

I already checked it, but it is not a solution anyway, since it should drop drops, at least in 1.19 it does, in older versions like 1.12 it does not, I do not know if it is normal or something I am doing wrong, I did not play minecraft in those versions

eternal oxide
#

You are getting the error because you are not checking your iterator

orchid gazelle
eternal oxide
#

it wouldn;t, I was wrong

vale veldt
# eternal oxide You are getting the error because you are not checking your iterator

Yes, but I have already solved it, the question is why in 1.19 the nether wart drop drops according to the java code that I am doing and in 1.12 it doesn't? Do you understand me?

event.getBlock().getDrops()``` This code returns a collection of ItemStack in 1.19, but in 1.12 it tells me that it is empty, what is the reason? That's what I want to know
eternal oxide
#

No clue very few people touch 1.12 anymore

orchid gazelle
eternal oxide
#

I'd guess it's in your code for displaying the particles

orchid gazelle
#

Neh its just using the List in a for loop drawing all particles

#

The problem must be somewhere in the conditions

#

If I remove those completely, im getting the full cube and that even with all 6 faces

subtle folio
dusk flicker
#

did you reload?

subtle folio
#

shit I had two classes with similar names to my main class

#

my own oopsie

vague swallow
#

sorry

tender shard
#

I would call it „raytraceResult“ or sth

vague swallow
#

yeah okay

tender shard
vague swallow
#

yes I know

tender shard
#

t in your code is the raytraceresult