#help-development

1 messages · Page 166 of 1

quartz basalt
#

how can i set the speed of a particle using
spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY, double offsetZ, double extra, T data, boolean force)

mellow pebble
#

so what part should i remove

fossil lily
#

You need to have a messaging system between the proxy and the server for queuing, I would recommend looking into redis

vague kite
#

how do you mean run it on the proxy?

quiet ice
mellow pebble
#

done

fossil lily
vague kite
#

how exactly is a proxy set up? Like I said very new to this so if there is some kind of basic resource somewhere that could help

fossil lily
quiet ice
#

Do note that PMC does not work if no player is online

fossil lily
#

^^^^ didn’t know that because i don’t use it

vague kite
#

To store data can I use .yml files and different servers can access it

vocal cloud
#

Use a database

vague kite
#

or would it have to be a database

fossil lily
untold jewel
#

If you are going to have a server network

#

use databse

#

database

quiet ice
#

Well you can, but that'd be an absolute pain in the ass to manage

vague kite
#

why?

fossil lily
#

is redis the only good option here?

quiet ice
fossil lily
#

mongo to store player info and redis for real time

untold jewel
#

why?

#

why?

#

so you dont accidentally delete a file

#

or the server crashes or something

#

and everything is gone

#

thats why

#

its also just much better in general

quiet ice
#

Eh, those are weak reasons

fossil lily
#

and it’s s l o w

untold jewel
#

@quiet ice

quiet ice
#

Even worse reason

fossil lily
#

and jank

#

well you have to constantly check for changes with the file

vague kite
#

I normally use .yml files to store data in my spigot/paper plugins and it works fine, but they are just very large files

quiet ice
#

Compared to the reason that it is insanely hard to share files across processes - all those reasons are minisicule

vague kite
#

have to ctrl+f to find what you're looking for

fossil lily
#

so much better

#

like

#

SO MUCH

vocal cloud
#

Or SQL as it's much lighter

quiet ice
#

Or use DataOutputStream...

#

Simple, neat and tidy

fossil lily
#

SQL is pain from when I tried to learn

molten hearth
#

sql is ez

vocal cloud
#

SQL is worth learning

molten hearth
#

insert, select, update, remove, create and thats all you need

vague kite
#

Would I use the db to store data like players in a queue? and what kit they have selected?

vocal cloud
#

No?

fossil lily
#

I tried when I was nooby, I’m sure I would be fine with it now.

molten hearth
#

not even remove its delete idk I use it once a year

quiet ice
vague kite
#

right

river oracle
molten hearth
fossil lily
quiet ice
vague kite
#

Do I need to create a plugin for the game servers and a different one for the lobby server?

fossil lily
quartz basalt
#

            @Override
            public void run() {
                for (int d = 0; d <= 90; d += 1) {
                    Location particleLoc = new Location(location.getWorld(), location.getX(), location.getY(), location.getZ());
                    particleLoc.setX(location.getX() + Math.cos(d) * size);
                    particleLoc.setZ(location.getZ() + Math.sin(d) * size);

                    if (color != null) {
                        particleLoc.getWorld().spawnParticle(particle, location, particlecount, new Particle.DustOptions(color, particlesize));
                    } else {
                        particleLoc.getWorld().spawnParticle(particle, location, particlecount, 0, 0, 0, 0);
                    }
                }

            }
        }.runTaskTimer(instance, 0, delay);``` why doesnt this spawn a circle of particles it just spawns 1 particle
fossil lily
#

Probably a better idea

fossil lily
#

But you will need a separate for the proxy

fossil lily
#

why…

quiet ice
#

Actually no

#

Forgot that the lobby does not run on bungee itself

fossil lily
#

yea

vague kite
#

Okay I'm going to do some more research on proxy and revisit this, thanks for the help

quiet ice
#

Though you'd want to use Minestom for lobbies

vague kite
fossil lily
quiet ice
# vague kite how do you mean?

Bungee is just a proxy, where are the lobby itself will run on spigot or a fork of it (or if you are adventurous - minestom)

fossil lily
#

minestom for game and lobby servers 👍 (joke but it’s what I do)

#

or for fun put it all on 1 server and watch how little resources it uses!

molten hearth
fossil lily
#

slightly buggy

vague kite
molten hearth
#

MeleeAttackGoal is ehm

#

a bit weird looking

fossil lily
vague kite
#

redis?

quiet ice
vague kite
#

oh sorry I see

fossil lily
fossil lily
molten hearth
#

why is bro strafing smh

fossil lily
#

yes it’s funny until I ripped my eyes out

#

it was so frustrating

tardy delta
#

minestom compatibe with spigot or smth?

fossil lily
#

I legit didn’t even fix it I just cancel the death now and do my own

fossil lily
molten hearth
#

nah but the api is sorta similar

#

(but better)

tardy delta
#

wondering why people talking bout minestom

fossil lily
#

because it’s best

#

I still love you spigot <3

molten hearth
#

because ✨ lightweight ✨

tardy delta
#

kinda unfamiliar with it

molten hearth
#

makes sense if you use it you gotta do practically everything yourself

tardy delta
#

it has an impl?

#

well playable game lets say

quiet ice
molten hearth
#

uh I think there's a test server

quiet ice
#

Minestom itself is just a framework

molten hearth
tardy delta
#

:o

quiet ice
#

Imagine spigot but without any world generator, entity spawning logic and all that stuff

molten hearth
#

I never joined it I just find the API nice and its quite lightweight so I use it

molten hearth
tardy delta
#

college be like

#

db2 😢

molten hearth
#

rip

fluid river
#

C++ and Py

quiet ice
#

None of those are DBs

molten hearth
#

at Uni I need to use Py and JS so far lol

tardy delta
#

c# is a very good db

molten hearth
#

average key/value store enjoyer

fluid river
#

java is bigger

quiet ice
#

I prefer using sun.misc.Unsafe for DBs 😎

tardy delta
#

ill probably do c++ as my 2nd programming lang

#

*2nd thing that i take serious *lol

quiet ice
rough drift
#

maven tries to find my local artifact in the spigotmc repo rather than my .m2 folder

quiet ice
#

Maven will use the maven local repo over any other repository ... are you sure you pushed it correctly?

tardy delta
#

tmrw is going to be a long day :(

fluid river
quiet ice
#

And are you sure that you didn't change the directory of your maven local repository (unlikely, but possible)?

fluid river
#

you instantiate new location every loop step

quiet ice
#

Oh wow, 90 allocs is the end of the world

fluid river
#

take your particleLoc declaration out of loop

quiet ice
#

Vanilla gets away with hundreds of thousands of allocs

fossil lily
fluid river
#

PE

tardy delta
#

mafs?

fluid river
#

some small Java

fossil lily
#

Because there are practically no rules

fluid river
fossil lily
#

And you can customize features you normally can’t

tardy delta
#

ah my problem solving is basically math

molten hearth
#

I only got maths tomorrow lol

#

Maths, Maths, Maths and Maths

tardy delta
#

networking boring asf

fluid river
#

Math + Java + English + notRelatedAtAll

tardy delta
#

and systemmanagement is probably breaking another pc

vocal cloud
#

English is the language of the internet

molten hearth
#

oh wait I have python lmao

tardy delta
#

bae

fluid river
#

well actually gonna have 2 more computer-related courses next symmester

tardy delta
#

i have html/css aaaaa

hazy parrot
fluid river
#

one for linux

tardy delta
#

and js in 2nd semester

#

mye have linux next semester too

#

basics

molten hearth
#

Discrete Maths (1h30) Python (1h30), Analysis (maths) (2h30), Linear Algebra (1h30)

fluid river
#

oh shit i misread the code

#

still

fluid river
#

Or just create it once

#

and in loop just change x and y

quartz basalt
#

is it possible to change the particle's speed? rn they go flying everywhere when they spawn

fluid river
#

you can't modify it directly

#

but

#

that's all you can modify

quartz basalt
#

i meant change it in the spawn method this is what i have rn particleLoc.getWorld().spawnParticle(particle, particleLoc, particlecount, 0, 0, 0);

#

you can change the speed using /particle (the vanilla command)

quartz basalt
#

and i checked the docs i didnt see anywhere saying speed

fluid river
#

well then no

#

except packet paricles

#

never worked with them

quartz basalt
#

ah well thats rly anoying...

quiet ice
#

what kind of particles are you working with?

quartz basalt
#

flame

quartz basalt
#

o ok ill try it ty

river oracle
#

anyone have some reliable code on getting the spigot version at run time

#

I found this online

        final String packageName = Bukkit.getServer().getClass().getPackage().getName();
        return packageName.substring(packageName.lastIndexOf('.') + 1);
#

but for some reason I feel like this isn't going to work properly

ivory sleet
#

spigot version or you mean nms?

river oracle
#

I neeed server versions so I can load the correct NMS module

ivory sleet
#

well I use regex on the package name

#

but thats the only diff

river oracle
ivory sleet
#

org.bukkit.craftbukkit

#

sth

#

idr exactly

#

havent touched spigot in a while, youll have to excuse me

river oracle
#

yk what I'll just check it with an onenable thingy

eternal oxide
#

thsi is what I use java private static final String NMS_VERSION = Bukkit.getServer().getClass().getPackage().getName().substring(23); private static final Method DEDICATED_SERVER = getMethod("org.bukkit.craftbukkit." + NMS_VERSION + ".CraftServer", "getServer"); private static final Method SERVER_LEVEL = getMethod("org.bukkit.craftbukkit." + NMS_VERSION + ".CraftWorld", "getHandle"); private static final Method SERVER_PLAYER = getMethod("org.bukkit.craftbukkit." + NMS_VERSION + ".entity.CraftPlayer", "getHandle");

eternal oxide
#

get method being ```java
/**
* Obtain a Method via reflection.
*
* @param clazz a Class to access.
* @param method a Method to find.
* @return Method the Method, or null if not found.
*/
@Nullable
private static Method getMethod(@NotNull String clazz, @NotNull String method) {

    try {
        return Class.forName(clazz).getMethod(method);

    } catch (NoSuchMethodException | SecurityException | ClassNotFoundException e) {
        e.printStackTrace();
    }
    return null;
}```
river oracle
eternal oxide
#

This is what I use to remove the need for version specific imports

river oracle
#

I have interfaces set up like this

public interface NMSInventoryHandle```
river oracle
glossy venture
#

what version are you on

eternal oxide
#

?paste

undone axleBOT
eternal oxide
tardy delta
river oracle
#

imo it is already pretty useless

tardy delta
#

better than nullchecking every time

grim ice
#

fourteen is pretty much right

river oracle
#

unfortunate that null checking is so much faster

quiet ice
#

You are all fools

tardy delta
#

aint talking about speed?

quiet ice
#

You want for it to crash if it can't resolve the method

grim ice
#

I feel like you're a person that relies on null for every problem they encounter

quiet ice
#

And there is no way to recover from it

tardy delta
#

Unsafe::putAdress

#

basically

zealous osprey
river oracle
grim ice
quiet ice
#

Optional only makes sense if it is reasonably expectable for it to be null and it is reasonably expected for developers to be able to work around it

quiet ice
#

In this very specific case, it is not possible to react nicely if it is null

river oracle
quiet ice
#

(unless you are using NMS "for performance")

dense crow
#

hey, someone know how i can get the uuid of players who never been on the server before

#

?

river oracle
tardy delta
#

Bukkit.getOfflinePlayer().getUniqueId()

#

by name or uuid

tardy delta
#

if not running offline mode

#

so it does a web request

grim ice
#

but at the very least, don't spam null on every method

river oracle
tardy delta
#

spamming null lol

river oracle
#

I just think optionals are un-needed in java

grim ice
#

What.

#

no

quiet ice
#

At least in the java of the future

dense crow
tardy delta
#

Optional::map is nice

grim ice
#

null makes no sense in oop

#

literally, 0 sense

tardy delta
quiet ice
#

null makes sense

grim ice
#

it does not

tardy delta
#

why wouldnt it

eternal oxide
#

I like null

quiet ice
#

Being a non-fatal error or being an uninitialized value

grim ice
#

here's an example

river oracle
dense crow
#

yeah, i got it like he did wrote it down, but it wont pull a web request i guess

grim ice
#

imagine you have a method getEmployee(id), and you want to return null if there is no employee found with that id

#

how does an employee being null make any sense

quiet ice
#

Because there is no value?

opal juniper
#

where is the plugin.yml version displayed?

river oracle
#

null = no value so you know there is no employee with that name

grim ice
#

I'm pretty sure an employee isnt supposed to be a value

molten hearth
#

lol nice @fossil lily top result for now

quiet ice
#

Do note that throwing exceptions is INSANELY resource intensive

grim ice
quiet ice
#

especially unchecked exceptions

grim ice
fossil lily
#

but why

grim ice
#

or return null objects

fossil lily
#

tf

molten hearth
#

I was searching usage of EntityAttackEvent ¯_(ツ)_/¯

grim ice
#

e.g Employee.NOBODY

molten hearth
#

because for player -> entity damage I use FinalAttackEvent but it doesnt work with entity -> player

quiet ice
#

You for sure aren't going to use Unsafe#allocateInstance for that value

tardy delta
#

smh this chat

grim ice
#

No

tardy delta
#

whats Unsafe#allocateInstance doin? allocating memory for a new object?

molten hearth
grim ice
#

the whole point of avoiding null

#

is to avoid NPEs and polluting your code with checks everywhere

molten hearth
#

actually all of these are useless except setBaseDamage

quiet ice
# grim ice e.g Employee.NOBODY

Counter point: Assume Employee has a field called name of type String. What are you going to populate it with? String.UNDEFINED?

grim ice
#

this isnt IPP

#

im pretty sure we're on oop terms here

river oracle
# grim ice No

whats the difference between

if(object == null){
 // actions
}

and
 
if(object.isEmpty()){

}```
tardy delta
#

lol

#

why should smth null have a state?

quiet ice
eternal oxide
#

avoiding nulls is pointless though. You still have to error check any alternative, like an Optional. You are simply adding a greater overhead than checking for null.

tardy delta
#

rust not having null but having Option<T>

#

i mean you cant really avoid unpresent values

grim ice
fossil lily
#

and use 1 as default

ivory sleet
molten hearth
#

yeah I saw that

#

I think ima just

tardy delta
#

tell me

river oracle
eternal oxide
grim ice
#

Everyone does

#

but it has agreeable parts

#

which are at least, worth to take note of

eternal oxide
#

For example, the point about ambiguous semantics. Only relevant if you are not using annotations.

fossil lily
tardy delta
#

lets go Employee.NOBODY

eternal oxide
#

as for throwing exceptions rather than return null, arguable

fossil lily
#

Employee.LOUDBOOK == Employee.NOBODY

ivory sleet
#

I mean the issue with null is that it cant really be expressed at type level, the higher ordered objects aka types yk imho

molten hearth
tardy delta
#

i mean catching exceptions is slow

ivory sleet
#

(unless Mono, Option, Optional etc)

eternal oxide
#

Which means we should push the use of annotations 🙂

fossil lily
ivory sleet
#

null and exceptions have different usecases to some degree

molten hearth
#

ty I'll need it

eternal oxide
#

Exceptions catching is not that slow these days

fossil lily
#

a lot

eternal oxide
#

slower than checkign for null, but not that slow

molten hearth
#

tru

fossil lily
#

are you running it on like 10 servers for each island?

#

or instances on 1

quiet ice
#

Also, assume you have a method called LineReader#readLine() - are you really going to throw an exception if there is no line - this will just cause needless

String lastLine = "";
boolean hasIterated = false;
while (true) { 
  try {
    lastLine = reader.readLine();
    hasIterated = true;
  } catch (IOException e) {
    if (e instanceof EOFException) {
      break;
    } else {
      throw new RuntimeException(e);
    }
  }
}
if (hasIterated) {
    return lastLine;
} else {
    throw new EOFException();
}

instead of

String line = null;
String lastLine = null;
try {
  while ((line = reader.readLine()) != null) {
     lastLine = line;
  }
} catch (IOException e) {
    throw new RuntimeException(e);
}
if (lastLine == null) {
    throw new EOFException(e);
}
return lastLine;
molten hearth
#

gonna be 1 per island

grim ice
river oracle
#

yea you shouldn't even read files

molten hearth
#

ima see how heavy it'll be

grim ice
#

lemme send you another link

molten hearth
#

if its lightweight enough I'll keep it

grim ice
ivory sleet
#

in the view of elegant objects its seen upon as something less attractable

quiet ice
ivory sleet
#

as we treat all objects as living organisms

tardy delta
#

looks bloat asf

quiet ice
river oracle
#

you can have empty strings in a file

#

its a possible thing you will come across

grim ice
#

then null is supposed to be more secure?

fossil lily
quiet ice
#

Yes, because null means "not initialized", by design - where as "" means "a string of length 0"

grim ice
river oracle
quiet ice
#

It does open up security vulnerabilities in some contexts

ivory sleet
#

returning null is a bit problematic, but lets say you have some function where "" and null would represent different results

#

then null might be needed

quiet ice
#

Especially strings of size 0 are problematic given that they fuck up many hashing algos

fossil lily
#

nms is pain might as well use minestom

#

im like a walking minestom ad

ivory sleet
#

not necessarily

river oracle
tardy delta
#

what if the result was "" 👀

river oracle
#

also are they even finished yet

grim ice
#

if your method expects you to understand the result based off "" vs null

#

then that makes 0 sense

ivory sleet
#

if you facade between modules of different levels of abstraction then that might be necessary 2hex

quiet ice
#

An empty file vs no file

fossil lily
river oracle
quiet ice
#

Although in my example for the sake of fairness it will never return null at all

fossil lily
river oracle
#

but if its less popular and I will make less moeny from it no need to use it

fossil lily
#

NOT STORM

#

people hate it when people say storm

quiet ice
#

It's only within the method (and the methods it calls) that null is used

fossil lily
#

Minestom

quiet ice
#

Returns the same either way though

grim ice
#

though less common

ivory sleet
quiet ice
river oracle
molten hearth
fossil lily
#

i mean its always getting updates but

grim ice
river oracle
quiet ice
#

Removing the builder pattern also contradicts the no-nulls theory unless you love insanely long constructors

fossil lily
quiet ice
fossil lily
#

but use latest

molten hearth
grim ice
fossil lily
#

and dont even argue you need 1.8.9 becusee server performance is amazing on 1.18 with minestom

molten hearth
#

yikes

grim ice
#

but how does it contradict to the "no-nulls theory"

molten hearth
#

I think you need to respawn the player

fossil lily
#

but I dont wanna :(

#

but good idea

molten hearth
#

yeaahh I think that was the issue

quiet ice
grim ice
quiet ice
#

With empty I mean no args

grim ice
#

args are okay, according to yegor

quiet ice
#

If args are allowed there is still a saving grace - but that means having either extremely complex/dense OOP or very long ctor calls (both boil down to the same thing) for very complex models

grim ice
#

🤷🏻‍♂️

quiet ice
#

Either way I'll still use null due to it's fail-fast properties

ivory sleet
#

but I understand what you mean

hollow pelican
#

Does anyone know how to send a message to a player and then clear it a few seconds later?

#

ex. Wynncraft's dialogue system

tardy delta
#

chat api maybe? or whatever its called

#

conversation

fossil lily
quiet ice
molten hearth
clever mist
#

Hi! how can I prevent players to place items in a custom inventory by using maintained right click with a stack of item ? The event doesn't seem even detected

quiet ice
#

But they extend -er

clever mist
#

yep it isn't detected with it

fossil lily
quiet ice
#

oh yeah - them too

#

Should be using lambdas anyways

fossil lily
fossil lily
molten hearth
#

in b4 you get told to use github discussions

quiet ice
#

Yeah ofc

molten hearth
#

man I hate that place

fossil lily
#

been told

molten hearth
#

😂

fossil lily
#

bad

molten hearth
#

we're meant to evolve not devolve goddamn it

quiet ice
fossil lily
#

:(

clever mist
#
public class InventoryEvents implements Listener {

    @EventHandler
    public void onClick(InventoryClickEvent e) {
        if (e.getClickedInventory() == null) {
            return;
        }
        Player player = (Player) e.getWhoClicked();

        player.sendMessage(e.getClick().toString());

    }
}
quiet ice
#

2000 loc is a weak number anyways

#

Consumer ends in -er too my friend

#

Weak.

#

Just rename Consumer into Supplied and Supplier into Consumed

#

Will totally not consume confuse anyone at all

clever mist
#

it sends the type of click detected but when i'm using in a maintained right click to distribute equitably the items in multiple stacks into the custom UI, nothing is detected and nothing is cancelled

#

yep the rest is correctly working

#

i mean, all other click types are detected and cancelled normally

hoary quartz
#

can someone help me? I am trying to make this plugin work without needing to be an operator in the server but it only work if the player has the op

remote swallow
#

check for permissions

#

in plugin.yml and permissions set to default: true

#

that too

hoary quartz
#

the code it's to long, I am trying to "break" it

remote swallow
#

?paste

undone axleBOT
hoary quartz
#

it's basically this

undone axleBOT
hoary quartz
clever mist
#

I think there is 2 problems but I don't know how to patch them. The first is that when I shift click from my inventory the inventory selected isn't the custom one but the inventory of the player, so the event isn't cancelled and the second is that drag clicking items isn't just detected. So how can I just prevent the player of touching his inventory when he is in the custom inventory ?

hoary quartz
#

Thanks

undone axleBOT
hoary quartz
#

Before it I've put the hasPermission

#

The function only work with op players

#

But I wanted to work with everyone

molten hearth
#

well dont use hasPermission lmao

hoary quartz
#

Yeah

clever mist
#

yep but dunno how x) it's why i'm asking because at my knowledge I can get the inventory from where the player clicked but not when the player is clicking in his own inventory

hoary quartz
#

It's used in other function, but it's not related to that one

undone axleBOT
remote swallow
#

messy 🍝

hoary quartz
#

Well, I am new with programming, sorry

#

what I tried to do it's that the player can walk behind another one, if it's crouching it can "steal" the other one

#

And it worked, but only with Op players

#

For some reason

clever mist
#

ooh okay thanks so much I couldn't find it

hollow pelican
hoary quartz
#

Yourself

#

Only thing that I wanted to only op player do its the command and that checks

quiet ice
clever mist
#

uh okay but my FactionSelection implements an InventoryHolder not an InventoryView so how can i check if they are corresponding 🤔

arctic moth
#

how does this work

#

like what do you need to do to get that

#

oh

#

dying irl

quiet ice
#

that would count as fall damage

#

void damage counts as suicide too iirc

#

hm

#

Bukkit being bukkit ig

quiet ice
#

You need to buffer the chat and resend it to clear the chat

#

With the new 1.19 update it gets even harder

#

Or well - at least it gets harder if you want to do it right

hollow pelican
#

I want to clear a specific message from the chat after a certain amount of time

#

Not the whole chat.

hoary quartz
#

guys, no to be boring, but because I am starting with coding, what are good plugins to try making it to develop my programming skills?

quiet ice
hollow pelican
#

So basically save the entire chat log and clear the chat and then resend it with that message removed? Or just resend the chat with the message removed?

quiet ice
#

If you were to clear the whole chat it would be easy - just spam a lot of empty messages

hollow pelican
#

If I'm not mistaken, there's actually a Clientbound Packet for deleting chat messages.

hoary quartz
#

good ideia, I will try

quiet ice
#

Nah there isn't

hoary quartz
#

thanks bro

quiet ice
#

Unless you are not talking about the same chat I am talking about

hollow pelican
#

How difficult would it be to log the current chat that can be seen and clear a specific message then?

quiet ice
#

Because with the action bar and title bar it is a lot easier

quiet ice
hollow pelican
#

I am using NMS currently in my plugin anyways.

echo basalt
#

that's what venturechat does

#

you just gotta make a fixed-size deque

#

let's say 200 elements

#

where you log the chat packets

#

actually not a deque, just a list

hollow pelican
#

I'd need to log that player's current chat log then delete that specific message and resend it then? (How would I log the chat that the player is able to see? Is there a packet or something for it?)

clever mist
#

thanks all is working perfectly now; i'm pretty new with the Spigot API 🙃

echo basalt
#

I guess deque would be useful

hollow pelican
#

Right.

clever mist
#

yep but sometimes i'm a bit lost and don't find what i wants like today

hollow pelican
#

That doesn't sound too difficult. Thanks everyone! 🙂

#

The only problem would be logging private messages so those don't get nuked in the resend process.

cloud falcon
#

Hey im having an error when I run build tools

#
Cloning into 'Spigot-API'...
fatal: invalid branch name: init.defaultBranch =
applyPatches.sh: line 16: cd: /d/BuildTools/Spigot/Spigot-API: No such file or directory
Resetting Spigot-API to Bukkit...
HEAD is now at 0958895a SPIGOT-6274: Reloading configuration does not clear previous values
  Applying patches to Spigot-API...
fatal: could not open '../Bukkit-Patches/*.patch' for reading: No such file or directory
  Something did not apply cleanly to Spigot-API.
  Please review above details and finish the apply then
  save the changes with rebuildPatches.sh
Error compiling Spigot. Please check the wiki for FAQs.
If this does not resolve your issue then please pastebin the entire BuildTools.log.txt file when seeking support.
java.lang.RuntimeException: Error running command, return status !=0: [C:\WINDOWS\system32\cmd.exe, /D, /C, sh, applyPatches.sh]
        at org.spigotmc.builder.Builder.runProcess0(Builder.java:973)
        at org.spigotmc.builder.Builder.runProcess(Builder.java:904)
        at org.spigotmc.builder.Builder.main(Builder.java:703)
        at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:27)```
hollow pelican
# sterile token ?

I want to add a /msg command but I'd need to make sure that those messages don't get destroyed when chat has been resent to clear a specific chat message.

sterile token
arctic moth
#

does playerinteractevent right click air just not work or smth?

quiet hearth
#

is it fine to send packets async

arctic moth
eternal oxide
arctic moth
#

i havent tested any other items

hollow pelican
#

How would I log the current chat history that the player has currently since that's what I'd need to resend?

sterile token
arctic moth
#

it has those

#

but its just not triggering

#

for some reason

sterile token
#

weird, do oyu have any other plugin running?

arctic moth
#

well

#

a lot

#

but shouldnt affect it

sterile token
#

what are u trying to do atm?

arctic moth
#

detect right click and do stuff from that

sterile token
#

ok

#

Try adding priority HIGHEST and test it

arctic moth
arctic moth
arctic moth
#

anyways

#

@sterile token settings highest priority didnt change anything

sterile token
#

ok

arctic moth
#

nope

sterile token
# cloud falcon any ideas?

If you want to get assisted please must be patient or open a thread with the issue waiting patientlly for getting answered - Thanks, Alex

cloud falcon
#

tryna make sure it doesnt get drowned out 💀

arctic moth
#

unless you mean dynmap trying to summon a stackoverflow demon but thats a different story

sterile token
cloud falcon
sterile token
#

?paste

undone axleBOT
arctic moth
arctic moth
#

only thing i changed since then was priority

#

no difference

#

aside from cooldown check working bc i reloaded it to check priority

#

so rn it only works when i right click a block

#

nothing else

#

dead chat 💀

#

ok so with debug, its nothing with my code

#

its simply just not being triggered

sterile token
#

Weird

#

try it with no other plugins

arctic moth
#

its registered

#

only triggers when i hit a block

mental moon
#

Anyone know if there's a way to put Glowing on non LivingEntities?
Was hoping to put it on an Item entity in the world but it appears effects are gated to LivingEntities and above only.

sleek moon
#

You mean Glow like outline glow or glow like enchant?

mental moon
#

Glow outline

sleek moon
#

try using a library. I'm not really sure if it's possible using the minecraft API

mental moon
#

Ty. I'm going to see if I can do some packet magic but if not I'll look for a library

tender shard
#

can't you just do Entity#setGlowing(true) ?

fluid river
#

boilerplate

tender shard
#

i'd use a consumer instead of anonymous classes

fluid river
#

yeah

tender shard
#
new MenuItem(arenaItem, "&7Multiplier", 13, pl, event -> {
  Player player = (Player) event.getWhoClicked();
  // ...
  event.setCancelled(true);
});
fluid river
#

basically you write the exact same thing a lot, which is extremely uncool, you can think of better solution

#

the only change is name of itemstack and QueueType

ivory sleet
#

yeah use lambdas and functional interfaces (giving you some terminology to work with just, but alex and nuker told ya alr)

fluid river
#

i'm sure you can shorten this a lot

tender shard
#

MenuItem class might look like this then

public class MenuItem {
  private Consumer<InventoryClickEvent> consumer;

  public MenuItem(ItemStack item, /* ... */ Consumer<InventoryClickEvent> consumer) {
    this.consumer = consumer;
  }

  public void onClick(InventoryClickEvent event) {
    consumer.accept(event);
  }
}
fluid river
#

would like to see your MenuItem realization tho, cuz other way there's nothing more we can suggest

river oracle
fluid river
#

what's so good about Object.equals

#

over ItemStack#equals(ItemStack);

#

Oh i see

#

that's where Object.requireNonNull comes from

young knoll
#

I assume Objects.equals is null safe

ivory sleet
#

^

#

rnn still throws npe

#

but it is by definition of its contract fail fast

fluid river
#

well, that's not a problem to define a null check in your equals() realization

#

depends on developer tho

#

need to look through ItemStack sources

ivory sleet
#

well equals() still is not symmetric

#

since for instance

Object o = null;
sout(o.equals(other));

throws

(which is why Objects::equals can be used as it first checks a == b before a.equals(b))

fluid river
#

maybe intellij is so smart that checks sources or smth

#
@Override
public boolean equals(Object o) {
    if (o == null) return false;
    // code
}```
#

done

ivory sleet
#

yes but thats not the same

#

if the variable you invoke equals on points to null then you get an npe

fluid river
#

oh true

ivory sleet
#

but apart from that yeah

fluid river
#

well, basically if you have an NPE here, that's your fault and you have to fix it anyway

ivory sleet
#

true

fluid river
#

JetBrains go brrt

#

happy i use eclipse

#

with no weird suggestions

#

and underlines

ivory sleet
#

ah well Eclipse's ui is what turns me down for most part

fluid river
#

the only underline i hate is scanner.close()

#

when you only have main method

#

when you run eclipse debug and method comes to the end, scanner closes automatically

ivory sleet
#

hmm yeah prob

fluid river
#

but it still gives underline

ivory sleet
#

tho try-with-resources is the superior here afaik

fluid river
#

yea

#

i just switched to it

#

but now i have one more } in the end

#

and all code 4 spaces to the right

ivory sleet
#

myeah, could refactor the contents of the try statement into a separate method

#

but it outa be fine right

fluid river
#

my university teachers won't understand

#

so nah

ivory sleet
#

sadly uni doesn't care much about enterprise in my experience

#

like how its done at the job

fluid river
#

well i'm on enterprise faculty

#

guys should at least know the language they teach

ivory sleet
#

hmm, then you learn about design patterns and clean code, no?

#

lol yeah

fluid river
#

we learn gui and sorting on java rn

ivory sleet
#

oo

fluid river
#

and i'm the only one in the group who actually knows java

ivory sleet
#

💀

fluid river
#

so yeah i can't even ask to send me some code

#

which i'm too lazy to write

#

i really don't wanna touch gui after my first java game

#

wanna try btw?

ivory sleet
#

ugh sure

fluid river
#

what's ur java version

#

8 or 17-18

ivory sleet
#

I have 8-19

fluid river
#

alr i'll send j17 version

ivory sleet
#

oo alr

#

im excited now lol

ivory sleet
fluid river
#

yeah

#

do you store player objects in queue

#

?

#

or uuids

#

if you store uuids, you don't need to cast entity to player in this code

terse ore
#

how can I get item at index 0 from arguments of command?

hazy parrot
#

args[0] ?

terse ore
#

oops

#

mb

#

I didn't type the () in the if

#

srry

hoary quartz
#

It's there a way to detect to see when the player get online in the server?
I wanted to delete a certain item because when the player get to the server, the item kinda mess up with the login plugin, so I wanted to check if the player it's holding that item (when he enters the server) to delete it from its inventory

remote swallow
#

PlayerJoinEvent

fresh timber
#

Hey, I have a plugin (on a bungeecord server) and I'm making a command to join a survival server easier. Instead of using the bungeecord's /server survival I want the player to be able to just use /survival. When I run the command /survival it says it is unknown. I know that it is talking about the command I put in the plugin to run after the player runs the other command however, because it shows it as a command when I hit tab in game. Here is my /survival command class:

public class Survival implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

        if (!(sender instanceof Player)) {
            return true;
        }

        Player player = (Player) sender;

        player.performCommand("server survival");

        return true;
    }
}

When I use /server survival in game, it works, though.

hazy parrot
fresh timber
#

yes

#

I have it registered in my main class

hoary quartz
fresh timber
#

and in plugin.yml I have it listed

remote swallow
#

just sudo them

hazy parrot
fresh timber
#

yep hold on

#

my ide is literally crashing ;-;

remote swallow
#

player.chat("/server survival);

fresh timber
#

why does player.performCommand not work?

#
    @Override
    public void onEnable() {

        new Damage(this);
        new Break(this);

        getCommand("spawn").setExecutor(new Spawn());
        getCommand("survival").setExecutor(new Survival());

    }
hazy parrot
fresh timber
#

lemme check

#

nope it loads fine

#

in console no errors

echo basalt
#

show full code it might just be a OOP thing

rapid vigil
#

Hello, I have a quick question right here
What's the difference between running a task Asynchronously and running it normally?

ivory sleet
#

well its relative if you look at it more objectively

#

but in short, async means some code x runs on some thread that is not the server thread

#

and a thread is like a seperate process/queue that can execute independently, such that it doesnt have to wait for other threads to run some given code

fluid river
#

most of the things are on the main thread so put your plugin's maths async

rapid vigil
#

So is running a task Asyncly better than normal?

ivory sleet
#

^and io bound tasks also usually

#

na

ivory sleet
#

Async has some problems

fluid river
#

only put maths and java-related things to async

#

not spigot-related

#

like list operations

ivory sleet
#
  • Memory visibility
  • Thread allocations (the resource management)
  • Update tasks (set a new value based on old value)
fluid river
#

?learnInventory

ivory sleet
#

these are specific to Java tho

fluid river
#

xD

next plume
#

Maths? It probably takes longer to spin up a new thread than it takes to just do your maths on the main thread.

ivory sleet
#

Sometimes, maybe if you do extremely long and big computations

fluid river
ivory sleet
#

then you could use a pool like fjp common pool to decrease the overall latency of the computation (which is eagerly initiated)

fluid river
#

not everything is a + b

#

or Math.sqrt(number)

next plume
#

It's just that some people think everything should be on an async thread, and it actually takes longer.

ivory sleet
#

yeah its a trap

fluid river
#

true

#

never use sqrt() tho

#

unless really needed

next plume
#

What, sqrt might take 500 nsec?

sterile token
#

I really miss you

#

We used to talk a lot 💔

ivory sleet
#

@rapid vigil anyway in addition, we use it to either increase throughput (for instance the amount of users a service can deal with at the same time)
or we use it to decrease latency of a task

#

yeah im good, hope you're doing well ntl

fluid river
#

that's just generally faster to use pow(2) instead of sqrt

fluid river
#

so like use distanceSquared() > distance() when searching for closest of two objects

rapid vigil
sterile token
sterile token
#

I mean enum class (arguments...)

fossil lily
#

well kotlin

#

does it like that

sterile token
#

Oh yeah i suppouse it wanst vanilla java

#

In fact that way looks much cleanear

fluid river
#

switch to records then

sterile token
#

Java 8 != lastest java

#

😂

fluid river
#

alr

#

switch to objects

#

with fields

#

easy solution

fossil lily
#

i learned that records existed like 2 days ago

fluid river
#

cool

sterile token
#

But java classes arent more recursive than enums in terms of resources?

ivory sleet
#

recursive`?

fluid river
#

recursion

ivory sleet
#

enums are java classes

fluid river
#
int i(int b) {
    i(b);
}```
sterile token
#

recursive isnt it that consumes a lot?

ivory sleet
#

depends

sterile token
#

that why i hate fucked english because if you dont explain a context doesnt make sense

fluid river
#

sorry for my bed england

ivory sleet
#

resource intensive maybe you meant

fluid river
#

i selled my wife for internet connection

ivory sleet
#

recursive means that a function calls itself within its definition

fluid river
#

to play counter strik

sterile token
fluid river
#

well

#

gtg sleep

remote swallow
fluid river
#

good night

ivory sleet
#

well functions specifically

#

values cant really call themselves

#

im being very nitpicky now

sterile token
sterile token
ivory sleet
#

yes

#

not values though

sterile token
#

i know

rapid vigil
#

Is there a way to download a coding app and code spigot plugins on phone?

ivory sleet
#

sorta

rapid vigil
#

Wait really which where

sterile token
#

So my final question, are enums mutables or not?

ivory sleet
#

Ive seen someone deploy a vsc web service

rapid vigil
#

vsc web service?

#

What's that

fluid river
#

nevermind

ivory sleet
#

and then through the web work on a project using the vsc web interface to work on a project

fluid river
#

i have a bottle of beer to drink

#

still not empty

remote swallow
ivory sleet
#

this is the closest to what Ive seen

#

which is actually nice to work with

ivory sleet
rapid vigil
#

Oh alright I'll check it out, thanks

fluid river
#

not paid: Chetster's Cherry 5.0% is awesome

#

now it's time to sleep

#

gn again

ivory sleet
#

gn

sterile token
#

I would use a cuboid region

ivory sleet
#

use a BoundingBox

sterile token
#

I would create another class just managing the cuboid region and include it in the game object

sterile token
#

yeah you have BoundingBox too

#

But really eird the name

ivory sleet
#

yea

sterile token
#

I would defintly put a good name

#

I would a keep a ref in the Game obj

#

Because if not i will looks really mix to understand

#

Please dont be trolling

#

Im being serious

ivory sleet
#

na

#
class Dodo{
  private final boolean x;
  private final int y;
  public Dodo(boolean x, int y) {
    this.x = x;
    this.y = y;
  }
}```
#

effectively the same

#

Given any class X, for all instance variables of X, then there exists a constructor for X that takes all instance variables of X.

#

id say its useless

#

or well, meaningless to be precise

#

yeah, tho its more inflexible

#

like what if you want your constructor params named differently than the fields

#

or want to add/remove fields or params

fossil lily
#

How can I create a new NameSpaceKey for my custom enchantment?

eternal oxide
#

learn java looping arrays

worldly ingot
#

I mean this is more of a modulo question

#

Yes, you can do a roundabout through an array with the modulo operator. System.out.println(foods[i % foods.length]);

eternal oxide
#

Not really he's just trying to print the elements and doesn't understand arrays.

#

oh I see. you are correct

worldly ingot
#

Maybe I missed earlier conversation then

eternal oxide
#

I missunderstood the question

hoary quartz
#

Is there a way to prevent a mob from spawning?

#

I wanted the warden to not spawn at all

#

And also the wither, but since it's a "ritual" só spawn idk if it's possible

vocal cloud
#

Entity spawn event should handle all entity spawns

worldly ingot
#

It should still be caught by CreatureSpawnEvent

vocal cloud
#

Looks like it from the docs

hoary quartz
#

I will try both, thanks

vocal cloud
#

Don't try both use creature spawn

#

Definitely the best option

atomic swift
#

does Enchantment#getByName(String); still work

remote swallow
#

?tas

undone axleBOT
echo magnet
#

Bind Webserver and Mc server to the same port

dapper veldt
#

when is onDisable() called? is it called at the beginning of the plugin disable sequence or at the end of it?

quaint mantle
#

at the start

fossil lily
atomic swift
#

how can i get a player from their usernaem

fossil lily
atomic swift
#

do cmd args start from 0

fossil lily
#

its not attribute

#

i know that

atomic swift
#

you must have ItemMeta#addItemFlags(ItemFlag.HIDE_ENCHANTS);

glad prawn
#

🤔?

warm light
#

is it possible to get PersistentData of a player from PlayerQuitEvent

pearl zephyr
#

I'm spawning in a a boat with world.spawnEntity(grid_pos_1, EntityType.BOAT);, how would I get an instance of that boat

kindred valley
#

What

pearl zephyr
kindred valley
#

I didnt get what you mean

fossil lily
#

it’s not an object

pearl zephyr
#

idk if thats the right word

#

im kinda new to plugin development

#

i want to put a player in the boat

#

boat.addPassenger(player);

kindred valley
#

Yeah whats the problem

fossil lily
#

does world.getEntity not exist?

pearl zephyr
#

i dont think so

fossil lily
#

If not just loop through and find the one you want

pearl zephyr
fossil lily
#

yea but I could be very wrong

pearl zephyr
#

yea ok

#

thanks

hybrid spoke
#

you just have to cast it to a boat

pearl zephyr
hybrid spoke
pearl zephyr
#

yea lol

#

actually i got it

#

thanks

hybrid spoke
#

👍

warm light
#

If a player have open inv and he got kicked. will the invclose event get force called? or the inv will dismiss?

hybrid spoke
tender shard
#

is there a better way then to return a Future<Void> in the saveAsync method?

    /**
     * Saves the data to the player's file. This will overwrite any changes made to the original file that happened after
     * creating this instance.
     */
    public void save() {
        try {
            JeffLib.getNMSHandler().updatePdcInDatFile(this);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    /**
     * Saves the data to the player's file. This will overwrite any changes made to the original file that happened after
     * creating this instance.
     */
    public CompletableFuture<Void> saveAsync() {
        return CompletableFuture.runAsync(this::save);
    }
#

but people should be able to check when it's finished

#

or force it to complete now

noble lantern
#

Have it as a bukkit event to be able to be controlled, canceled, modified, etc

hybrid spoke
#

what do you imagine?

tender shard
#

wdym?

hybrid spoke
#

funny, they still wouldnt know

tender shard
#

how should I return a boolean without blocking?

hybrid spoke
#

callback is probably the best choice to make

noble lantern
#

Async bukkit event

hybrid spoke
#

otherwise some sort of binding or whatever

hybrid spoke
#

nvm, looks like it is

noble lantern
#

:p

#

thats why i suggested it xD

#

even if its forge nms can still do same thing

#

but outside mc yah callbacks; thats my practice at least

#

Anything event/callback realted honestly

hybrid spoke
#

thats the same as returning the CF

noble lantern
#

events just allow for remote control; call backs are more direct ie you need that exact instance to receive said callback

#

Object.wait and Object.notify

#

no need for all this exessive runnable stuff

#

events; or callback

#

lightweight; no strain

#

unless you dont know how Object.wait works; then uh

hybrid spoke
#

isnt that basically a callback?

noble lantern
#

that would just be something his end users could do currently

#

idk if he wanted something more

#

like, configured/laid out or not

#

eg with FunctionalInterfaces or just using that method

hybrid spoke
#

he could also return an object with a state

noble lantern
#

could but now that objects gonna take up space in memory while its being waited upon (Multiple calls might happen at the same time, idk how his saving methods work), not much ofc unless he has like 50k calls a second lmao

#

honestly

#

bunch of ways to set it up

#

just depends what your looking for

warm mica
noble lantern
#

i should pr a fix for that

#

ngl yes

#

that simple

#

its modded ofc tho

#

but tile entities get ticked per tick

#

so the mc renderer sees that value changed and just swaps its color based on the color set

#

yeah that part will be annoying

#

have to get colors from in game

#

god

#

"colour"

#

so gross

#

why colour

#

z_aCRYYY noo

#

wait

#

i just noticed that

#

the fuck?

#

imma just use reflection then

hybrid spoke
#

wait, is there an armour?

noble lantern
#

yep

#

sadly

mint barn
#

Hello, does anyone know how to put spigot mapped on a server?

tender shard
#

the server is always "spigot mapped"

torn oyster
#

is there a way to give a mob a health bar

tender shard
#

wdym with health bar?

#

like, hearts above their name?

#

or a bossbar?

torn oyster
#

hearts above their name

#

oh wait

#

i can set a custom name

#

haha i'm stupid

#

💀

tender shard
#

yeah but you can only use one line, so you can show either the name, or only the hearts, or have both in one line

torn oyster
#

oh wait

tender shard
#

but you cannot use a custom name to show two lines

torn oyster
#

yeah

#

actually

#

that'd be better

#

how would I do that?

#

make an armor stand inside of it or something?

noble lantern
#

armour stands

tender shard
#

for two lines, you need to entities, e.g. an invisible armor stand

noble lantern
#

shit im britishifying

tender shard
#

although I'd use Area Effect Clouds instead

torn oyster
#

idk why I used "armor" because we use "armour"

torn oyster
tender shard
#

area effect clouds have no hitbox, and they cause way less client lags

#

if you have hundreds of armor stands, the client might get huge TPS drops. hundreds of area effect clouds are no problem though

torn oyster
#

would i make it teleport to the mob every tick or something?

tender shard
#

only downside is: area effect clouds are only visible up to 48 blocks, while armor stands work up to 64 blocks or so

tender shard
#

I'm not sure if setting it as passsenger would work, from what I remember this wouldnt work as you won'T be able to see both custom names then

#

so yeah, you gotta teleport it I think

torn oyster
#

idk

#

also is it normal to make a new class per new type of listener

#

and how would i create a progress bar

#

with a min and a max

#

and it outputs a string

#

actually

#

nevermindf

warm light
#

on server shutdown, player get kicked first or plugins disable first?

#

umm, I think plugin first