#help-development

1 messages ยท Page 301 of 1

tall dragon
#

for example

dataclass {
  
static list<dataclass> bla

int data1, data2

}

is what i consider a good use

terse ore
#

is it better to name my variables

#

player, p
inventory, i
entity, e

#

long term or short term

#

nono

#

like

#

Player (player or p)

#

okok

#

thx

tall dragon
#

if u want to make ur own life easier in the long term. indeed use the full word

terse ore
#

Can you cancel opening of an inventory or is it client-sided?

chrome beacon
#

The player inventory is client sided

terse ore
#

if I want to "cancel" opening I close it 1 tick after?

chrome beacon
#

The server doesn't know when it's open

terse ore
#

I know when

chrome beacon
#

?

#

How?

supple walrus
#

hello somebody have this plugin ?

terse ore
#

I have an event where it detects if the entity clicked was a villager

#

if it clicked a villager I close it

chrome beacon
#

If you're not talking about the player inventory you can just cancel the interact event

terse ore
#

hmm

#

let me try

#

it worked

#

This one is a recommendation, I am making a villager view inventory plugin, should I make tht you can remove the items inside a villager inv or notยฟ

opal juniper
chrome beacon
#

Great idea!

idle loom
#

Is there any way to get the item that a player is offhanding from a
PlayerSwapHandItemsEvent event

onyx fjord
#

player.getInventory().getItemInOffHand()
@idle loom ?

idle loom
hardy pollen
onyx fjord
#

try and see

idle loom
#

Alright

idle loom
#

Okay, I've figured out my issue now
The event doesn't fire when someone does it in a GUI

#

I have it cancel the inventory click event for the GUI, but you can still offhand items

#

Despite the inventory click event still firing

#

And also the event still fires if the person's offhand slot is empty, so the solution above doesn't apply here

#

I need to stop an item from an inventory from being offhanded

dry yacht
#

I'd use something along the lines of this: https://paste.md-5.net/nizisuwode.java

Instantiate this class once when your plugin loads and then reuse it, to avoid having to iterate all recipes in order to find furnace-type entries and generating the map over and over again.

hollow peak
#

Hey, I need some help. Ill just say that Im really new to this and I will probably ask dumb questions

#

I want to make a plugin that makes it so on death you drop only lets say 50% of your inventory

#

@EventHandler
public void onPlayerDeath(PlayerDeathEvent e){
e.getDrops()
}

sterile breach
#

hi, i want, when a commande is runed with an external plugin, change player amount in ping ( - 1) its possible with spigot api?

hollow peak
#

I got this far :')

tardy delta
#

and what 50%

#

like half of the stacks or half of the slots or smth

hollow peak
#

Half of the slots probably

#

and the rest gets kept in your inventory

tardy delta
#

i hope this image is correct, but you should loop over those slots

hollow peak
#

Okay...

tardy delta
#

and then calling player.getInventory().clear(slotNumber)

hollow peak
#

does clear make the items drop or does it delete them?

#

I dont want to delete them, I want half to drop, half to just get kept in the inventory

#

Can you do that?

tardy delta
#

it just removes all items in that slot

#

ah dropping them

hollow peak
#

ye

tardy delta
#

just call getItem() with the slot, remove item and drop it

hollow peak
#

Okay Ill try to figure it out

#

thanks a lot

tardy delta
#

you can always check the docs

hollow peak
#

alr

#

thank you

idle loom
#

For some reason the PlayerSwapHandItemsEvent doesn't seem to fire while in GUIs, or at least in my case.
Players are able to take items out of the GUI by offhanding it

#

Is there a different offhand event?

hearty latch
#

how to fix ?

#

[13:49:08 ERROR]: Could not load 'plugins/BlockCubeFly.jar' in folder 'plugins': uses the space-character (0x20) in its name

idle loom
#

you used a space somewhere where a space should not have been used

tardy delta
#

show plugin.yml

#

its probably the name entry that doesnt allow a space

hearty latch
#

o its works

digital plinth
#

will .getIntegerList work on this

#

it supposed to be array i think

tardy delta
#

a list is like

  • 1
  • 2
    i believe
digital plinth
#

so it is a list?

#

ok so array okok

#

i just need to cast it

#

oki thx

chrome beacon
idle loom
#

Even in survival

hollow peak
#

can you somehow randomize that number? the slotnumber for the inventory

#

@tardy delta

tardy delta
#

use a Random yes

digital plinth
#

why did toArray return object

chrome beacon
tardy delta
#

toArray(new int[0])

#

kinda stupid that you cant do int[]::new

idle loom
tardy delta
#

primitives in generics when

digital plinth
hollow peak
#

when ever it says "cannot resolve symbol" I should just alt shift enter it right?

chrome beacon
#

Depends on the reason why

#

Which I hope you know

idle loom
#

Maybe it's the way I'm doing it, lemme test something

tardy delta
#

new int[0] should work

tardy delta
#

i believe the internal impl just creates a new array cuz that one is too small

#

anyways impls are always weird

chrome beacon
#

Looks like it's part of the InventoryClickEvent like I said

#

If it doesn't work you need to show your code

#

?paste

undone axleBOT
idle loom
chrome beacon
#

also make sure you're in survival mode

digital plinth
#

didnt i cast the pre-existing list to array?

chrome beacon
#

Probably won't work in creative

idle loom
tardy delta
#

why are you doing an integer list to an array?

digital plinth
#

oh wait

#

i did .getIntegerList on the yml

#

does that even retrieve data

#

since it is in array format

quaint mantle
#

so im browsing through NMS and there were some mentions of com.mojang items, and when i do control + P in intellij, it brings me to a decompiled .class file, is there any way i can modify the source code of those class files and will that be included when i recompile the server jar from buildtools

digital plinth
#

.get on the yml?

chrome beacon
#

yaml doesn't care if it's a:

  • list
  • like
  • this

or
[list, like, this]

#

It has to do with the fact that yaml is a superset of json

#

Which means valid json is valid yaml

idle loom
digital plinth
#

hmm

idle loom
#

It might be the inventory lib I'm using

idle loom
chrome beacon
chrome beacon
#

Fork time

idle loom
#

I did, that's why I thought that might be the issue
It was not

hollow peak
#

e.getDrops().remove()
uhmm... So this works for items right? If I add NewItemStack.Material all that
Can I make it remove an inventory slot rather then the item stack or is that just not possible?

naive bolt
quaint mantle
# chrome beacon ?contribute

people keep saying contribute any time i mention files other than main nms but i find those links confusing as to which ones to click and how to set it up. that one to README.md literally talks about BuildTools, which is missing all the special files i want to change :/

naive bolt
#

its my plugin causing it

sacred mountain
#

lol

quiet ice
naive bolt
#

yes

sacred mountain
#

send. the config yml

#

in a paste

quiet ice
#

What is the content?

#

And I am talking about resources, not the plugin folder

naive bolt
#

oh. I did wth

#

did i fuking delete it on accident

#

hmm erorr still happens

chrome beacon
naive bolt
#

my plugin auto updates the config when a new version is available. this is the config

#

For some reason it always adds MemorySection[path='language', root='YamlConfiguration'] which breaks the plugin

#

And i have no idea where that MemorySection comes from

chrome beacon
#

How are you updating it

naive bolt
#

This is the code

tardy delta
#

very well hidden

naive bolt
#

thank you

tardy delta
#

alex smh

tall dragon
#

lmfao

spiral light
#

is there a way to tell the player he uses wrong arguments while tab complete ?

chrome beacon
#

You can use brigadier

#

or one of the command frameworks that wrap it

#

(1.13+)

spiral light
#

is brigadier spigot api ?

idle loom
#

oh god

chrome beacon
#

so part of nms

tardy delta
#

is brigadier that stuff that uses .then() and whatever for command constructing?

spiral light
#

hm ok well thats what i didnt want to touch xD lets try to figure it out and maybe create PR

tardy delta
#

brrr

spiral light
#

well i created something just like that but easier and raw .... but the tab complete api is kinda bad

quiet ice
tardy delta
#

looking at the comments, something what alex made

quiet ice
#

Gosh, he always overcomplicates all the stuff he does

#

?jd-s

undone axleBOT
quiet ice
#

?stash

undone axleBOT
tardy delta
#

imagine not typing that in your browser

quiet ice
#

It's faster

#

String value = main.getConfig().get(node).toString(); is the line causing your issue @naive bolt

#

How on earth someone thought that that wouldn't go wrong is beyond me

quiet ice
#

Yes, it has a bug however

#

As in it does not work with memory section

rough drift
#

Spigot uses brigadier for it's commands

#

but doesn't let the plugin use it directly

#

which is just bullshit

spiral light
#

and probably changing it to allow api use it will break versions :/

rough drift
#

yes

#

Why keep backwards compatibility to stuff like beta is beyond me

#

or whenever the first version was made

chrome beacon
#

Might as well make mods then

rough drift
#

Breaking changes should happen once in a while

#

like announced a week before or something

quiet ice
chrome beacon
#

so like modding

quiet ice
#

They should be announced a year before, not a week

rough drift
#

what? you'd rather be stuck with the same spigot API for however long spigot lives for

spiral light
quiet ice
#

With pre-release APIs being given out in advance

rough drift
#

won't happen again

#

I guess yeah geol

#

that's a good way

quiet ice
#

Additions are generally never breaking

rough drift
#

Rewrites are

#

and I want at least one chonk update

#

where they just rewrite the shit that is the api

#

or at least improve it

spiral light
quiet ice
#

Yeah, and a rewrite should have a warning multiple months prior to it's release

rough drift
#

(ex tabComplete method returning things like TabCompletionElement which also has tooltips and stuff)

#

that would be nice

quiet ice
#

And a beta API release multiple months prior too

#

Which is the main thing why I don't like the material refractor. I have 0 clue what it looks like and 0 chances to adapt to it correctly before it hits production

rough drift
#

They are refactoring materials?

#

We win these

quiet ice
#

Oh god.

rough drift
#

tbh I just want a command refactor, even a tiny one

quiet ice
#

Some things never change, like noone having an idea that that refractor is on the horizon and will hit prod in a few years

rough drift
#

I did know

#

Forgor

#

pog

#

ofc

#

tab completion is actually pretty good

#

it's just missing some things

#

like tooltips

quiet ice
#

I mean the thing with command handling in bukkit is that it is really the minimum complexity one can afford for such a system

hearty latch
last bolt
#

Is it possible to programmatically get a list of all Event classes?

echo basalt
#

probably

echo basalt
#

you can

#

it's not that hard, surprisingly

#

I mean

#

it is hard if you do it through the bukkit api

last bolt
# chrome beacon Why?

I'm trying to register listeners based on the events specified in a config.yml and I'm struggling to devise a way of doing so without mapping all of the possible events to strings that might appear in my config.

echo basalt
#

uhh

#

you can just listen to all events

#

and filter?

quiet ice
#

You can do that?

echo basalt
#

yes

#

ever wondered what that registerEvent method did

#

on the plugin manager

#

that has like 5 params

last bolt
#

That's a really inefficient thing to do though surely, 'PlayerMoveEvent' must fire thousands of times a second, for instance.

echo basalt
#

and you always think it's a typo

quiet ice
#

Nah, I know that

echo basalt
#

you can use it to listen to all events

quiet ice
#

I just thought it accepted a Class<? extends Event> too

echo basalt
#

you can also do some fancy code

#

Class.forname

#

do some checks

#

and make those specific listeners

#

then use a lil clever class to get the player (for example) present in those events

#

that just does some checks

#

like

#

instanceOf PlayerEvent -> PlayerEvent#getPlayer

#

etc

quiet ice
#

Oh yeah, then that is what I had in mind

#

However you'll have a hard time enumerating absolutely all event classes unless you know a piece of wizardy I suspect could be possible

last bolt
#

Hmm.

echo basalt
#

you don't need to enumerate

#

config#getString -> Class#forName -> registerEvent

#

lil reflection with some caching

last bolt
#

I'm just processing what you've said.

#

What's this 'forName' business?

echo basalt
#

gets a Class<?> from a class name

#

example: Class.forName("org.bukkit.Bukkit");

#

Returns a Class<?>

#

You can then use it to do stuff like

#

getMethod, getDeclaredMethod, getConstructor etc

quiet ice
#

If you go that route yeah

#

If you want to abbreviate - you'll have issues

last bolt
#

The event names are reasonably short and logical so I don't think I need to abbreviate.

quiet ice
#

Getting all classes loaded by plugins and spigot is easy enough. But anonymous classes loaded via the sun Unsafe are harder to trace

quiet ice
#

I.e. with the package

last bolt
#

Yeah but they're all org.bukkit.event prefixes so that'll be easy to substitute in.

quiet ice
#

Issue would be collision handling and so forth if you drop the package, but I guess one could use the package in that rare case

#

Ah well if you just want to listen for bukkit events, then yeah

last bolt
#

Yeah, sorry, I didn't specify did I?

echo basalt
#

just make people pass in the bukkit name

#

if you're making something that "modular" then your target audience must be technical already

quiet ice
last bolt
#

Well it's not something I'd considered.

quiet ice
#

You severely underestimate the stupidity of the average user

chrome beacon
#

95% of my support requests can be solved by reading

last bolt
#

I spend more than half my dev time coding to make stuff break cleanly when the user messes up.

chrome beacon
#

Yeah

last bolt
#

Well thanks for the pointers, I'll see if I can figure it out from the info given.

last bolt
tardy delta
#

pass in the Class.forName(config value) as first param ig

#

if im understanding your question correctly

last bolt
#

Oh, so I should be registering my own event, rather than registering a listener to the existing events..

chrome beacon
#

That's registering a listener

last bolt
#

Ahh, I see...

hearty latch
#

My brother gave this code and he said to make plugin from this code

#

import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerMoveEvent;

public class AntiCheat implements Listener {

@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
    // Check if the player has moved more than 5 blocks in a single tick
    if (event.getFrom().distance(event.getTo()) > 5) {
        // If so, cancel the event and kick the player
        event.setCancelled(true);
        event.getPlayer().kickPlayer("Cheating is not allowed!");
    }
}

}

#

this is code

chrome beacon
#

That won't work well

river oracle
#

Lol this seems like the worst anti cheat ever just use something like grim

hearty latch
#

i k

#

but

#

he tell to make from this

#

dm me if you know

last bolt
river oracle
#

Oh he is trolling

last bolt
#

public void PlayerJoined(DynamicEvent e) {}

chrome beacon
#

instead of annotated method

formal bear
#

Any possible way to set multiple values in spigot api Config?

chrome beacon
#

?configs

undone axleBOT
river oracle
#

?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!

river oracle
#

Also be quiet If you aren't going to ask a question dude

formal bear
chrome beacon
#

Yeah that's one way to do it

chrome beacon
undone axleBOT
chrome beacon
#

Hire someone

formal bear
tardy delta
#

๐Ÿ’€

quaint mantle
#

Whats the best way of handling checks per level? So I need to check if player has x amount of essence, and to also set essence requirements for 500 levels...

last bolt
tardy delta
#

you see that you have to pass in a listener

last bolt
#

Yup

quaint mantle
#

I could use like level * x for the requirements tbf

tardy delta
#

actually never used that method, ig you put to put your event handling method in there

#

dunno actually

#

ig it assumes that you will write a listener for that event class ๐Ÿค”

chrome beacon
#

Time for ASM kekw

last bolt
#

Hmm.

chrome beacon
#

Probably not

#

but that is one way to do it

tardy delta
#
Listener listener = new Listener() {
  @EventHandler
  void onJoin(PlayerJoinEvent event) {
    event.setJoinMessage("boo");
  }
};

Bukkit.getPluginManager().registerEvent(PlayerJoinEvent.class, listener, EventPriority.WHATEVER, (listener0, event) -> {
  if (event instanceof PlayerJoinEvent myEvent) {
    listener.onJoin(myEvent);
  }
});```
#

like wtf is an eventexecutor

quaint mantle
#

I need some advice off someone. I'm using one inventoryclickevent method and it's starting to get quite large... Should I make another one in a different class or?

tardy delta
#

ah maybe listener::onJoin

chrome beacon
#

Split things up in to methods

tardy delta
#

like handling all guis in one listener?

#

work with a Map<Integer, Consumer<InventoryClickEvent>> for handling input per inv

ivory sleet
# tardy delta

basically defines how to execute the event from the listener

#

by default it uses an event executor which reflects @EventHandler annotated methods yk

tardy delta
#

would event -> listener.onJoin((PlayerJoinEvent) event) work?

ivory sleet
#

mye

#

should work

tardy delta
#

weird syntax

quaint mantle
tardy delta
#

actually (listener, event)

quaint mantle
#

And yeah i've split a lot of my code into methods but still gets big with all the if statements etc

chrome beacon
#

Then it's split enough

quaint mantle
#

ahh i see

#

Is it bad to use the same event in two diff classes though?

ivory sleet
#

na

#

it can be reasoned about

last bolt
#

Perhaps I can use an annotated listener and use generic Event as the input, then figure what to do with it from there.

#

I'll test that and see if it works.

tardy delta
#

piece of shit

quaint mantle
#

@tardy delta that map you use, the "InventoryGUI" when you put the class inside the map does it refer to any inventories inside the class or? Like how does it work?

tardy delta
#

InventoryGUI is just an inventory wrapper

last bolt
#

Ah, so I need to use the Event Executor to handle the event.

quaint mantle
#

Yeah so it's just an inventory creation inside the class

tardy delta
#

and it holds functional interfaces that gets triggered when clicking on buttons

last bolt
#

I wonder what the point of the Listener is in this case, when we're passing in the event handling logic manually anyway.

#

Holy moly, it worked.

#

Many, many thanks for the help

tardy delta
#

๐Ÿ‘

digital plinth
#

is there a way to pull updated data from yml files from inside of a bukkit runnable

#

my list aint updating

last bolt
#

@tardy delta Any thoughts on what the Listener instance might be for? I've just created an empty GenericListener class with no methods to pass in and it seems to work just fine.

digital plinth
quaint mantle
digital plinth
#

ye i remember now thx

undone axleBOT
tardy delta
#

or paste it

#

id think to pass the event andling logic in there

last bolt
#

?pastebin

tardy delta
#

?paste

undone axleBOT
last bolt
#

Ta

tardy delta
#

idk id put the event handling logic in the event

#

if it seems to work idk then

last bolt
#

Yeah, it seems entirely redundant because the only method override in the listener would be the EventHandler, which would be the same logic as the EventExecutor is currently performing.

vast raven
#

Hi, I'm having some troubles using CorpseRebornAPI (a corpse plugin), basically there is a CorpseSpawnEvent, I need to get the entity that handles the corpse, and in the Corpse object you have a .getEntityId() method, I've made a .getEntityFromId() method but it didn't work. After some testes and debugs I've found that the problem was the id itself, for example the .getEntityId() method gave me 277, tho id of the entity was 279

tardy delta
vast raven
#

I've looked the src but the object doesn't have an entity field, so I can't use reflections

tardy delta
#

the entity that handles the corpse?

digital plinth
#

is there a way to break out of nested forloop but not the method containing it?

tardy delta
#

break?

last bolt
#

Hmm, I'll have a fiddle.

vast raven
digital plinth
tardy delta
#

show code

digital plinth
#

im pretty sure

vast raven
tardy delta
#

no

digital plinth
#

oh

tardy delta
#

๐Ÿ’€

digital plinth
#

its stupid code

#

ik

#

idk anyway to change it

#

and that thing sits in a method

#

with like 6 other nested forloops

worldly ingot
#

When Brush said "break?", they meant the keyword break

tardy delta
#

what triggers me is that youre calling get three time on a list, remember list lookup can be slow asf

worldly ingot
#

That's the keyword you're looking for lol

vast raven
quaint mantle
onyx fjord
#

no switch

#

its over

tardy delta
#

that looks like an exercice theyll ask me at the java exam in two days

tardy delta
digital plinth
onyx fjord
#

wdym i cant

vast raven
tardy delta
#

or have fun doing a case over a bunch of values

#

switch with fallthrough

digital plinth
#

hmmmm

quaint mantle
#

How can i get the gui to update automatically instead of having to close it and reopen for the level change?

tardy delta
#

update what?

#

setItem?

quaint mantle
#

The lore

vast raven
quaint mantle
#

It updates but I have to go in and out of inventory

tardy delta
#

setItem with the new item

quaint mantle
#

ahh kk

#

makes sense

last bolt
digital plinth
tardy delta
#

i dont even see a loop

digital plinth
tardy delta
#

you can always create a class instead of an anonymous one ๐Ÿ’€

#

just make a method

#

sec

#

try making a method that accept an event param and then instead of 'listener' in the registerEvent thing you give it, this::myMethod

#

no clue actually, dont have an ide

last bolt
#

Lol, I'll give it a try.

tardy delta
#

java moment

#

what i said wont work either, just make a class or smth

quaint mantle
#

Weird setting the item isn't updating for me

tardy delta
#

feels like c#

#

what about removing it and setting it back?

#

setItem only seems to do smth for updating the quantity

quaint mantle
#

ah okay ill try removing

humble tulip
#

I'm creating a redis-sql system so that I can communicate and sync data across servers better. Since redis has pub-sub, I'm using channels to send "packets" which are byte arrays across servers as well as using the redis to store cached data.

I just need ideas for how the packet system is gonna work

This is what I currently have

tardy delta
humble tulip
#

?

quaint mantle
tardy delta
#

dunno if Player#updateInv does anything

quaint mantle
#

hang on i had error

remote swallow
#

Isnt there an update inventory method

quaint mantle
#

and nah it doesnt

#

Doesn't do a thing

#

Hang on ill fix error it might work

humble tulip
#

@quaint mantle what's the problem?

tardy delta
#

very useful

humble tulip
#

You dont need to updateInventory

#

just get the itemstack, modify it and then set it to the slot

tardy delta
#

thats what i said

naive bolt
tardy delta
#

depends on what you need?

naive bolt
#

its baso a config updater to just update the config to newer versions

quaint mantle
#

?paste

undone axleBOT
naive bolt
#

do you have nested items?

quaint mantle
tardy delta
#

no

#

well ye

#

search for the lang.yml

#

got an enum with all the paths so not really actually, just iterating over all paths

naive bolt
#

ah yea, I want to update everything including comments yk

atomic swift
#

if i use this will it set the players max hp to 1 heart Player#getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(2);

remote swallow
atomic swift
remote swallow
#

yeah thats the part im confused about

atomic swift
#

is the version parsing

remote swallow
#

yeah

#

checked that

#

okay im more confused

#

ive just re-built the plugin even after building multiple times and now it work

#

what the

atomic swift
#

maybe you got a bad output the first time

quaint mantle
#

How to program an anti-ban listener

chrome beacon
#

I asked you last time...why?

quaint mantle
#

?

chrome beacon
#

Why do you need an anti ban listener

quaint mantle
chrome beacon
#

Because it sounds almost maliscious

atomic swift
#

isnt that just a hack client

#

or ban evading

chrome beacon
#

Anyways you got instructions last time

#

Use them

quaint mantle
#

Top help

molten hearth
#

it is, they're helping you at not being a bozo

misty current
#

can I somehow extend the time a player takes to connect and login by blocking the netty channel?

chrome beacon
#

thinking_blob why?

remote swallow
#

thinking blob

misty current
remote swallow
#

that should take what

#

1second

misty current
#

also is AsyncPlayerPreLoginEvent the correct event?

remote swallow
#

oh god

#

?scheduler

#

?scheduling

undone axleBOT
magic dome
#

Does anyone have any ideas how I can change the height at xz coordinate in the world using a ChunkGenerator, I want to keep the vanilla generation just change the height at which it goes to based on a 2d array that I have with height data

radiant cedar
#

What is the best way to have 10-15 maps, in a spigot server. Im making a prison server and have a world for each rank, how should I be running these maps in the server.

#

Im not hosting for many people, should I try combining all maps into one world?

remote swallow
#

having 10-15 different worlds is just a cause for lag

magic dome
#

having 10-15 worlds open at once is just not good

#

just have it all in one world

remote swallow
#

put them all in 1 world and just spread them apart a thousand blocks or so

radiant cedar
#

yes thats what I was thinking lmao but to put all these weird big spaces into one world

#

im gonna have to block them from walking out lmao

magic dome
#

plus world management is tricky I worked on a minigame a while ago where I was loading in and out different maps from folders and there is a lot of tricky stuff

#

use mv and fawe

#

put barriers around the area you dont want them to go

radiant cedar
#

i wouldnt have to do that if i combine in to one world right

#

mv^

magic dome
#

you would not

#

well to get them into one world

radiant cedar
#

i still have a world for hub/plot/pvp combined and 3 worlds for survival

remote swallow
#

fast async world corruption

magic dome
#

you would need to load each one and then world edit select it into the combined world

remote swallow
#

use worldguard and make regions they cant leave

magic dome
radiant cedar
remote swallow
#

fawe = fast async world exception/corruption

radiant cedar
#

so i would have few worlds, 1 for hub/plot/pvp combined, 1 for rank maps, 3 for survival. But they r gonna be running all the time so i dont wanna use mv + it just does some stuff about spawns i dont want it to

radiant cedar
remote swallow
#

corrupt worlds

#

never use fawe

chrome beacon
#

And then there's awe... worse than fawe, paid and breaks worldedit license

remote swallow
#

they have a free version

magic dome
remote swallow
#

that is identical to the paid version

magic dome
#

but the newer versions are kinda unstable

#

just use world edit

radiant cedar
magic dome
#

what version are you on?

radiant cedar
#

If im gonna copy pretty large spaces should i be using fastasync

radiant cedar
quaint mantle
radiant cedar
#

ye ik i might do that in future

#

but ym server is running just fine rn

magic dome
#

i know above 1.17 fawe gets very iffy... make backups

radiant cedar
#

oh aight i have backups so its fine

#

is it better for large spaces then

#

to use fawe

remote swallow
#

unless its over like 500k blocks you dont need fawe

radiant cedar
#

ok it might be

remote swallow
radiant cedar
#

can i use fawe with forge

#

no like singleplayer

#

not server

remote swallow
#

you can use normal worldedit on single player

#

but i only know of a fabric version

radiant cedar
#

will i get problems copying big worlds

#

big parts

remote swallow
#

would it be over 500k blocks

radiant cedar
#

maaaaybe

#

prolly some prts ig

remote swallow
#

if your copying them client side you might have issues

#

most servers can get up to like 750k blocks

#

maybe sometimes a million

winged cairn
#

Guys, I'm new to the subject and I wanted help on how I download a plug in and how I get it to run

limpid bloom
#

this is for developing plugins and making them, #help-server would prob be better,

glossy venture
#

how can i check if a ProxiedPlayer is already connecting to a server?

remote swallow
#

isnt a proxied player a player that would have to be connected

molten hearth
#

nah

#

events like PostLoginEvent can return a ProxiedPlayer even if they haven't been connected to a proxied server yet

sage patio
#

my plugin gives me a null error

#

in here

#

how is that possible

naive bolt
#

can i store this in a config file?

remote swallow
naive bolt
#

Because VanishData is a custom made thing

sage patio
sage patio
remote swallow
#

idk how you get an npe on a null check

remote swallow
naive bolt
#

wym

#

like gson?

remote swallow
#

?stash

undone axleBOT
remote swallow
#

look at bukkit

sage patio
#

lemme explain what i'm doin

#

I'm storing player inventory in a yml file, and then i restore it to him

#

it gives me the null error in here:

remote swallow
#

show the config

sage patio
#

in which time

#

and a note

#

when player has at least 1 item in hes inventory

#

this error does not happen

remote swallow
#

the one you get an npe on

sage patio
#

but when he do not have any item, and i store & restore it this happen

remote swallow
#

its not a config section

#

if (config.isSet("path")

sage patio
#

like this? if (Utils.getData().isSet(player.getName() + ".inventory")) return;

#

and ofc a !

remote swallow
#

yeah

sage patio
#

thanks, lemme test

remote swallow
#

oh also store players uuid notname

#

names can change

naive bolt
#

ah yeah mine defo doesnt work

sage patio
#

lemme change

#

and it works

#

thanks you

remote swallow
#

you would need a serialize and deserialize method

#

serialize to config, de returns the vanish data

naive bolt
#

and what would they do

#

if i have a ```yml
location:
==: org.bukkit.Location
world: world
x: -10.047613860387923
y: 80.50737205198925
z: -38.78100253597351
pitch: 11.169121
yaw: 72.890205

chrome beacon
#

getLocation

vale ember
#

hey, if i have two plugins which both shade the exact same dependency, will that cause any problems if i don't relocate them?

eternal oxide
#

it can

vale ember
#

k thanks

naive bolt
#

How do i use colors in console?

#

getLogger().info(ChatColor.GREEN +"[Staff-Spectate] Plugin Version: "+pluginVersion +" has been enabled!"); doesnt appear to work

#

actually colored console ugly

remote swallow
#

console colour ugly

tardy delta
#
  1. dont
eternal oxide
#
  1. See 1.
remote swallow
#

if i put something in a map and the key already exists would it overwrite the value there before what im putting

humble tulip
#

Yes

humble tulip
remote swallow
#

so if i were to add something to a string location map then get the key it would return 2 locations?

eternal oxide
#

unless it's a multimap

humble tulip
#

It removes the previous entry

#

Puts the new one

remote swallow
#

ah, perfect

humble tulip
#

And returns the previous entry

runic island
#

What does the strikethrough mean

acoustic widget
worldly ingot
#

It is. Use AsyncPlayerChatEvent instead

hazy parrot
#

why tf doesn't gson allow serialization of anonymous classes

tall citrus
#

Okay, i created 2 plugins, and they work fine, BUT, when i start the server with them together, it says: "org.bukkit.plugin.InvalidPluginException: java.lang.IllegalArgumentException: Plugin already initialized!"

#

But they individually work fine

remote swallow
#

they have the same name

tall citrus
#

no

rotund ravine
#

@tall citrus

#

?paste

undone axleBOT
rotund ravine
#

Full error and full code

remote swallow
#

look at the name in plugin.yml check if they are the same

tall citrus
rotund ravine
#

Well the error first

tall citrus
rotund ravine
#

@tall citrus Now bpth plugin.yml

tall citrus
#

k

rotund ravine
#

Same Main classname

#

Same main package

tall citrus
#

How can i safe change names?

eternal oxide
#

?main

rotund ravine
tall citrus
#

yes

rotund ravine
#

Itโ€™s called refactoring

tall citrus
tall citrus
eternal oxide
#

It is if you read it

tall citrus
#

Ty @rotund ravine <3

naive bolt
#

i've got a bit of a strange question. When people make thier plugins how do you check it on so many server versions to ensure it works

#

do you just change the server jar loads of times

remote swallow
#

if it doesnt have nms they test it on the lowest version

#

if it works there

#

it works on higher

rotund ravine
#

Depends

hard ether
#

how would one change the output directory of a JAR and then run a .command file using maven

eternal oxide
#

You test on all version you intend to support

hard ether
rotund ravine
#

You using IJ?

hard ether
#

yep

naive bolt
rotund ravine
#

Donโ€™t do it through maven and just do it through a run profile

eternal oxide
rotund ravine
#

The .command can also move the jar @hard ether

naive bolt
#

what about every update tho

eternal oxide
#

You test on every update, or you are a bad dev

rotund ravine
naive bolt
#

๐Ÿคฃ

rotund ravine
#

Usually we will be able to know what versions to support based on our api usage etc

hard ether
#

like

#

lemme look up commands

#

and jsut use a run comfig?

rotund ravine
#

Yeah

hard ether
#

this thing?

#

oh no embed perms :(

naive bolt
#

use .png on the end

rotund ravine
#

Go up to top right

#

Next to the start thing

#

Click the dropdown

#

And create new

remote swallow
naive bolt
#

oh lol

tall dragon
#

u need to link ur acc to spigot for that

woeful moon
#

What's the best way to send an HTTP request asynchronously using spigot? Completeablefuture or bukkit runnable?

tall dragon
woeful moon
#

Just wondering if there's an advantage to using spigot's built-in runnables

hard ether
quaint mantle
#

Help! GetServer not working in Plugin messaging channels!

rotund ravine
hard ether
#

im v confused

#

I don't see a dropdown at the top

remote swallow
#

you have to open the run configuration menu

#

or press the plus

hard ether
#

the fact that my username is now my 8-11 year old username ๐Ÿ˜ญ

upbeat wren
#

hi

hard ether
#

hi

remote swallow
#

yo

upbeat wren
#

anyone know why returns null?

remote swallow
#

?paste the erroor

undone axleBOT
upbeat wren
rotund ravine
#

Is spawn a valid world?

upbeat wren
#

yes

#

i in the world with the chest and the config save with the world name

#

but when try load give me error

quiet ice
#

And when it that world being loaded?

#

Also, plugin.yml

upbeat wren
#

wait, wierd

#

the plugin not detect spawn

#

this is because of multiverse core?

quiet ice
#

Yes, fix your plugin load order

#

Or just do shit only when absolutely needed

#

i.e. as late as possible

upbeat wren
#

sure

#

i put dependecy of multiverse and solved

#

๐Ÿ™‚

#

now a big problem xD, the config save x,y,z,world

this is on file
-3,63,-25,spawn:

this is game
-2.569,63,-24.518

#
    @Override
    public void onDisable() {
        // Save the chest and task information to a file
        File file = new File(getDataFolder(), "data.yml");
        YamlConfiguration config = new YamlConfiguration();
        for (Map.Entry<Chest, Integer> entry : chestTaskIds.entrySet()) {
            Chest chest = entry.getKey();
            int taskId = entry.getValue();
            String id = chest.getX() + "," + chest.getY() + "," + chest.getZ() + "," + chest.getWorld().getName();
            config.set(id + ".taskId", taskId);
        }
        try {
            config.save(file);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
hard ether
#

so I have a terminal file named start.command

the contents of said file is
Mv ~Desktop/Unexpected Development/Minecraft/Player Management/target/PlayerManagement-1.0-SNAPSHOT.jar ~Desktop/MC Server/plugins/PlayerManager.jar && java -jar spigot-1.19.2.jar

I get this error when trying to run it

me@2019-iMac-2 ~ % /Users/me/Desktop/start.command ; exit;
/Users/me/Desktop/start.command: line 1: {rtf1ansiansicpg1252cocoartf2639: command not found
/Users/me/Desktop/start.command: line 2: syntax error near unexpected token `}'
/Users/me/Desktop/start.command: line 2: `\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica;}'```
misty current
#

if I need an hashmap with multiple keys correlated to a single value and the multiple keys have to be of different types, can I just have a map like <Object, MyValue> instead of making 2 different maps?

upbeat wren
#

you say instead taskId and chest create only a 1 map?

misty current
#

i am asking a question, not replying to yours

#

what are you trying to do?

upbeat wren
#

oh

#

just pick the correct place of a block

misty current
#

save a location to a config file?

#

there's a method to do so

upbeat wren
#

it's saving

#

but incorrectly

misty current
#

what do you mean by incorrectly

misty current
#

i don't really get how are chests supposed to have decimals in their coordinates

#

they are blocks

formal bear
#

proper way to make bukkit runnable timer?``` Bukkit.getScheduler().runTaskTimer(instance, new BukkitRunnable() {

        private int time = 1;

        public void run() {

            if (time == pluginManager.getTimer()) {

                player.teleport(pluginManager.getSpawnLocation());

                messageManager.sendMessage(player, "spawn.success");

                cancel();

            }

            messageManager.sendMessage(player, "spawn.time", String.valueOf(time));

            time++;

        }

    }, 20, 20);```
misty current
#

and also don't save locations like that, use config.setLocation

ivory sleet
#

but ye

misty current
#

the spacing is ๐Ÿ’€

#

also yes add a return

#

the entire method executes even after you call cancel

upbeat wren
formal bear
hard ether
#
            private int time = 1;

            public void run() {
                if (time == pluginManager.getTimer()) {
                    player.teleport(pluginManager.getSpawnLocation());

                    messageManager.sendMessage(player, "spawn.success");
                    cancel();
                }

                messageManager.sendMessage(player, "spawn.time", String.valueOf(time));
                time++;
            }
        }, 20, 20);```
#

more readable

misty current
#

then use getLocation to get the location

fervent gale
#

How would I get a specific item stack in a recipe and cancel it if it contains that specifc itemstack

#

i wanna make sure no one uses my custom items in a recipe

hard ether
#

like remove the recipie?

#

or stop the player from crafting it

white root
#

Whats the difference between <BookMeta>.setTitle() and <BookMeta>.setDisplayName()

fervent gale
#

yes, and send a message and close inventry

hard ether
#

...

fervent gale
#

stop player

hard ether
#

ok

fervent gale
#

uh

hard ether
#
ItemStack bannedItem = null;

    @EventHandler
    public void onCraft(CraftItemEvent e) {
        ItemStack item = e.getRecipe().getResult();

        if (Bukkit.getRecipesFor(item).contains(bannedItem)) {
            e.setCancelled(true);

            e.getInventory().getViewers().get(0).closeInventory();
        }
    }```
#

should work

#

then you have to send them a message

fervent gale
#

will this work even with my custom item?

hard ether
#

uh lemme see

#

custom item is the banned item or the result item

fervent gale
#

i wanna make sure no one crafts with my economy moneys

hard ether
#

oh

fervent gale
#

banned

#

because it has custom lore

tardy delta
mighty aurora
hard ether
#
ItemStack bannedItem = getterForCustomItem();

    @EventHandler
    public void onCraft(PrepareItemCraftEvent e) {
        for (ItemStack item : e.getInventory()) {
            if (item.equals(bannedItem)) {
                Player p = (Player) e.getInventory().getViewers().get(0);
                p.closeInventory();
                p.sendMessage(ChatColor.RED + "You can't do that!");
            }
        }
    }```
hard ether
hard ether
#

btw

#

replace getterForCustomItem() with the method to fetch your custom item.

fervent gale
#

thx

hard ether
#

np

#

do u usderstand it

fervent gale
#

yes

hard ether
#

ok cool

#

btw all i did was google

fervent gale
#

it loops in the craft inv checks if it is the banned items closes the inv and sends msg

hard ether
#

to get the PrepareItemCraftEvent

hard ether
#

used this comment of a thread

#

I believe there is an event called PrepareItemCraftEvent or the like. You can use that to check the recipe and put your own item in the resultant item slot.

quaint mantle
#

I've set up a plugin message listener class so I can get the server the player is currently in.

    @Override
    public void onPluginMessageReceived(@NotNull String channel, @NotNull Player player, @NotNull byte[] message) {
        if (!channel.equals("BungeeCord")) return;
        ByteArrayDataInput input = ByteStreams.newDataInput(message);
        String subchannel = input.readUTF();

        if (subchannel.equals("GetServer")) {
            serverName = input.readUTF();
        }
    }

    public static String getServer(Player player) {
        ByteArrayDataOutput output = ByteStreams.newDataOutput();
        output.writeUTF("GetServer");
        player.sendPluginMessage(GameManagerPlugin.getInstance(), "BungeeCord", output.toByteArray());
        return serverName;
    }

This is so I can use getServer in if statements, if (getServer(p).equals("lobby")) {// do something}
I ran this in a command, but weirdly enough, 1st time the command runs, serverName is null, then the 2nd time it's the actual server name. What the hell is going on?? Please help

worldly ingot
#

You're returning serverName in your getServer() method but those plugin messages aren't instant. They're sending packets. They're going to take a while

#

So the first time you run it you send the packet but return what the value is currently (in this case, null), but the next time it returns what the message finally received a few ms later from the message listener

#

Basically your second call is returning the result of the message received from the first call

#

With that being said, the only possible way you're ever going to be able to call getServer(Player) is if the player is online... because that's an online player. So they're going to be on whatever server you call that method on ๐Ÿ˜›

grand sky
remote swallow
#

?paste it, i cant open or read files on phone

undone axleBOT
grand sky
remote swallow
#

Looks like an issue from running fabric +bukkit, also probably has something to do with skript uses spigot not bukkit so uses no existent methods to bukkit

buoyant viper
#

looks like an NMS issue lolz

remote swallow
#

Yes, it could also be version mismatch

boreal ocean
#

how do me & spending get spigot for the combat test snapshots to work, because the closest thing we can find is Bukkit4Fabric

idle loom
#

I have an issue where people can offhand items from a GUI
I have the inventory click event canceled in the GUI but they still can offhand it

The weird thing is, the item remains in the GUI but still ends up in the offhand, also the PlayerSwapHandsEvent or whatever isn't being fired while in the GUI

#

I'm using Triumph to format the GUI btw

remote swallow
#

?stash

undone axleBOT
river oracle
#

spigot doesn't do those you'd need to fork the server and make your own

sullen marlin
#

Lol combat test

#

Last version 2.5 years ago, released only on Reddit

hard ether
#

i'm trying to fork spigot.jar, is there any way to re-compile after decompile?

sullen marlin
#

?contributing

#

?contribute

hard ether
#

so I can find a recompiler there?

sullen marlin
#

What are you trying to do

hard ether
#

i'm trying to automatically add a list of plugins to the plugins folder

#

and i figured I could do that via the jar

sullen marlin
#

Or ya know your start script

hard ether
#

lmao didnt even think of that

tribal wraith
#

What's the NMS version string for 1.19.3? Is it the same as 1.19.2?

            <groupId>org.spigotmc</groupId>
            <artifactId>spigot</artifactId>
            <version>1.19.2-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>```
sullen marlin
#

No, the 2 is replaced with a 3

#

As expected

tribal wraith
#

Cannot resolve org.spigotmcspigot1.19.3-R0.1-SNAPSHOT
Works for 1.19.2 though

sullen marlin
#

Did your run buildtools for 1.19.3

tribal wraith
#

Im so sorry md5 im an idiot

#

Omg

worldly ingot
#

There's no emoji in the artifact, you silly goose!

tribal wraith
#

NOO!!!

tribal wraith
#
        WorldServer worldServer = ((CraftWorld) location.getWorld()).getHandle();
        GameProfile gameProfile = null;```
The first two imports work, but the gameProfile is not importable and is missing. I'm clueless on NMS
remote swallow
#

are you on 1.18.1 or higher

tribal wraith
#

Yea

remote swallow
#

also isnt it called player profile

tribal wraith
#

You might be right

#

Nope that's an interface

remote swallow
#

what you need the game profile for

tribal wraith
#

an EntityPlayer

remote swallow
#

isnt that just HumanEntity

tribal wraith
#

That's the spigot class I believe

remote swallow
#

yeah

#

im guessing it mght wrap EntityPlaye

tribal wraith
#

Nope this is from net minecraft server

river oracle
#

Bukkit has the PlayerProfile api

tribal wraith
#

Oh ok thx

hard ether
#

is the spigot jar opensource

river oracle
#

?stash

undone axleBOT
hard ether
#

do you see .class files?

#

are they there? am i jsut blind?

remote swallow
#

what are you looking for .class files for

hard ether
#

to modify the behavior of the server

#

why else

remote swallow
#

you want those files

river oracle
#

just make patches if you want to modify NMS

remote swallow
#

a .class file is a compiled java class

river oracle
#

i forget how to build spigot tbh

hard ether
#

yes ik

#

and then i'd decompile

remote swallow
#

why thouhg

river oracle
remote swallow
#

thats what spigot, craftbukkit, bukkit do

#

they all work together to give you the spigot.jar and an api

hard ether
#

ok

#

ill use those resources. ty'

tribal wraith
#

Looks like playerprofiles and gameprofiles are different

#

My NMS is missing the gameprofile import

remote swallow
#

what do you need the game profile to do

tribal wraith
#

I need one spawned

remote swallow
#

use NPC, HumanEntity?

#

you could probably even use entity

#

also citizens api is probably easier

tribal wraith
#

I have to spawn an entityplayer

remote swallow
#

what does this entity player need to do

tribal wraith
#

To spawn

remote swallow
#

so its an npc

#

use citizens api

tribal wraith
#

I can't

#

You sent me interfaces

remote swallow
#

look

#

at

#

citizens

#

api

tribal wraith
#

I can't use it, this is the solution I'm looking for

remote swallow
tribal wraith
#

Yea that's my entire problem, I can't import GameProfile like I stated above

remote swallow
#

you use player profile

tribal wraith
#

There's a difference

remote swallow
#

this is how i do playerprofile or game profile

tribal wraith
#

Yea, I can't import it

#

It's not coming with NMS in 1.19.3

remote swallow
#

because you are on a higher version that 1.18.1 i doubt it exists

#

look at how i use player profile

#

just look at the jds for the rest of the fields

tribal wraith
#

Found the import I was looking for if anyone else finds this

import com.mojang.authlib.GameProfile;

            <id>minecraft-repo</id>
            <url>https://libraries.minecraft.net/</url>
        </repository>```
```<dependency>
            <groupId>com.mojang</groupId>
            <artifactId>authlib</artifactId>
            <version>1.5.21</version>
            <scope>provided</scope>
        </dependency>```
dawn mirage
#

I'm getting an error message stating: org.bukkit.plugin.InvalidDescriptionException: libraries are of wrong type
I ran my plugins.yml through a yaml validator and nothing came up. I even tried the example provided on the wiki and didn't work as well. Is this a bug or am I missing something?

remote swallow
#

?paste plugin.yml

undone axleBOT
dawn mirage
remote swallow
#

is org.apache.commons:commons-math3:3.6.1 on maven central

dawn mirage
#

yes

remote swallow
#

paste the full error

dawn mirage
remote swallow
#

i dont get how that happens

#

thats not his code causing that

#

thats plugin.yml

dawn mirage
#

yea I tried the example from the wiki and that didn't even work

#

Should I report this as a bug?

remote swallow
#

?jira yeah

undone axleBOT
white root
#
fun ComponentBuilder.hoverText(text: String): ComponentBuilder {
    val hoverText = ComponentBuilder(text).create()
    val hoverEvent = HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverText)
    return this.event(hoverEvent)
}
```*(This is a kotlin extension function, allowing me to call `<ComponentBuilder>.hoverText("text here")`)*
How I am doing this in my plugin says that this HoverEvent constructor is deprecated, what proper/alternative/not deprecated way should I be doing it?
remote swallow
white root
#

On that page, they also seem be using the deprecated constructor
this is what they have:```java
TextComponent message = new TextComponent("Click me");
message.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://www.spigotmc.org"));
message.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Visit the Spigot website!").create()));

@๐•„๐•ฃ. ๐•„๐•”๐•๐•–๐•–๐•ฅ#9300
remote swallow
#

hm

#

are you using paper api

white root
#

No, I'm building against org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT

remote swallow
#

its not deprecated

#

oh wait it is

#

use it anyway

#

deprecation means nothing pretty much

#

it doesnt stop you from using or doing anything

tribal wraith
#

I'm using PacketWrapper & ProtocolLib to attempt to spawn an EntityPlayer
Whenever I try using the SpawnEntityLiving packet, it shoots this error out
Caused by: java.lang.IllegalArgumentException: Could not find packet for type SPAWN_ENTITY_LIVING
Am I using the wrong packet? Is it outdated?

remote swallow
#

im pretty sure it will be something like PacketType.Play.Server.SPAWN_ENTITY_LIVING

tribal wraith
#

Yea that's what I'm using

#
             * @deprecated Removed in 1.19
             */
            @Deprecated
            public static final PacketType SPAWN_ENTITY_LIVING = new PacketType(PROTOCOL, SENDER, 244, "SpawnEntityLiving", "SPacketSpawnMob");```
Look like it was removed, should I use SpawnEntity instead?
remote swallow
#

if your on 1.19 then yes

tribal wraith
#

Will it work for living entities

remote swallow
#

im not the protocol lib docs

#

?tas

undone axleBOT
tribal wraith
#

That's why I was asking, it's a packet related to mc, not protocol in general

buoyant viper
#

could always check the protocol docs