#help-development

1 messages · Page 178 of 1

wary topaz
#

if (args.length >= 3) {
new ArrayList();
return null;

    }
hasty prawn
#

I want you to think long and hard about why that doesn't work

wary topaz
#

yeah I figured it out im just waiting for you to hate on me

worldly ingot
torn shuttle
#

I am pioneering a new type of debugging

#

threat-based debugging

wary topaz
#

😮

torn shuttle
#

if at first it doesn't work threaten people until it works

wary topaz
#

Anyone know how to make this work better without that black box on top of the zero

#

if (args.length >= 3) {
List<String> returnnull = newArrayList();
returnnull.add("");
return returnnull;

    }
hasty prawn
#

Don't add ""

#

Just return the list

wary topaz
#

Cannot resolve method 'add()'

#

oh wait

#

remove returnnull.add

#

thanks its fixed

tardy delta
#

might just return Collections.emptyList()

opal juniper
#

as long as you dont need it to be mutable

tardy delta
#

that

#

love your pfp lol

torn shuttle
opal juniper
#

idk who they were talking to lul

torn shuttle
#

me

#

who else

opal juniper
#

but yes, magma guy very cool pfp

torn shuttle
#

yeah that's a handsome young man for sure

opal juniper
#

did you have to change your forums username to get that

torn shuttle
#

I'd shake his hand

#

no, I bullied choco into giving it back to me

tardy delta
#

hmm

torn shuttle
#

all best things in life come from bullying

tardy delta
#

(^-^) is kinda cute too

#

did the blue color change tho

wary topaz
opal juniper
#

what error

wary topaz
#

idk

opal juniper
#

chat ingame is giving me a error

wary topaz
rough drift
#

If I have an Attribute which is Attribute.GENERIC_MAX_HEALTH, how would I convert its name to Max Health, or for Speed, Attack Strength, etc?

#

do I just hard code that?

opal juniper
#

yep

#

check unsafe, but id imagine

torn shuttle
#

there's not that many attributes anyhow

rough drift
#

I can just make it auto generate

#

because why not

torn shuttle
#

generic is annoying, I'd parse it out

rough drift
#

Yeah

#

I just use skip

#

or

#

.replace("GENERIC_", "")

torn shuttle
#

mind you attribute math isn't that straightforward

torn shuttle
#

the modifiers for attributes are whacky

rough drift
#

yeah yeah

#

I am familiar with attributes

brave goblet
#

Say I have a method that creates an object how long will that object be in memory for?

rough drift
#

For as long as it is referenced

#

example

#
public Object makeObject() {
  return new Object();
}

// MAIN METHOD
Object myObject = makeObject();
// Do stuff

// Here is the end of the main method, myObject will be freed up
halcyon mica
#

So if setCursor is deprecated in inventory click event now, how am I supposed to change the stack on the cursor?

brave goblet
#

so i wouldn't have problems with it filling up memory?

torn shuttle
#

as long as you don't keep references to it

rough drift
#

Use deprecated methods

brave goblet
#

Ok got it ty

brave goblet
halcyon mica
#

That doesn't sound ideal

rough drift
#

It does

#

a lot of deprecated methods have no replacement

#

so yeah

halcyon mica
#

Espicially because the cursor doesn't actually update

rough drift
#

Use deprecated methods

brave goblet
rough drift
#

Well shit

halcyon mica
#

It nulls the stack on the cursor, but clicking on any other slot updates it back to what it used to be

arctic moth
#

i am trying to make an explosion of transition particles, but they don't appear to be directional. how would i make them move?

torn shuttle
#

particle constructors are a nightmare

arctic moth
#

ikr

#

like why are some particles directional and some not? there should be a system where you can just implement a vector or something

#

and it works on every particle

torn shuttle
#

pretty sure it's deeply tied to how minecraft implements it in the first place

#

there's several different standalone systems for coloring particles too

torn shuttle
#

might be impossible to do then

arctic moth
#

btw another thing i am trying to find out is how to check if the velocity is going to make something hit a wall or not

#

how would i approach that

torn shuttle
#

the particle?

arctic moth
#

no

#

separate thing

rough drift
#

or you can go the hard route like I did and simulate projectile physics

arctic moth
fading spindle
#

Hey guys so i just got into making plugins for 1.19 and I tried getting the spigot file for 1.19 and when i put it in eclipse it doesn't import the JavaPlugin libaray, does anyone have a link or correct spigot file for 1.19

arctic moth
#

doesnt that defeat the purpose of using an arrow?

arctic moth
arctic moth
#

use maven or gradle to import it

fading spindle
#

how

arctic moth
#

?maven

undone axleBOT
rough drift
#

you'd be excluding an arrow's dropoff and stuff

arctic moth
rough drift
#

yes

arctic moth
#

the velocity physically cannot change

rough drift
#

Oh

#

then yes

#

Its easy then

arctic moth
#

weird

#

i tried player.getLocation().add(vec).getBlock().getType().isSolid() but it doesnt work most of the time

rough drift
#
Vector vel = ...;
Vector pos = ...;

for(int i = 0; i < max; i++) {
  pos.add(vel);
  // test pos
}
#

you might want to

#
Vector vel = ...;
Vector pos = ...;

for(int i = 0; i < max; i++) {
  Vector old = pos.clone();
  pos.add(vel);

  // Iterate between "old" and "pos" and check each block
}
#

You might want to do 2nd in case the velocity is really high (>1 b/s)

arctic moth
#

the max velocity is 10

#

for the thing im doing

#

it only can set the vector if the player is within 10 blocks of the target

rough drift
#

10 is a high velocity

#

it's higher than 1 b/s

#

it's 10 b/s

arctic moth
rough drift
#

hm?

arctic moth
#

most of the time it throws something like 1 block

rough drift
#

THEN IT'S NOT CONSTANT

#

If you are applying this to a player it is not a constant velocity

arctic moth
#

(ignore the particle stuff)

#

works like 50/50

#

omg obs is garbage never actually captures the audio

#

whatever

arctic moth
rough drift
arctic moth
rough drift
#

try using entity

arctic moth
#

right after it is just entity.setVelocity(vec) if you wanted to know

rough drift
#

right now it's only at the player's location

arctic moth
rough drift
#

you might want to check the entity location

arctic moth
#

oh

rough drift
#

if(player.getLocation().add(vec).getBlock().getType().isSolid()) {

arctic moth
#

thats why

#

im dumb

rough drift
#

I want to see it work now though

arctic moth
midnight shore
arctic moth
#

its for materials

midnight shore
#

Thank you

arctic moth
#

sucks with custom items though bc it makes a cooldown for everything that is of the same material as the item you want to have cooldown

worldly ingot
#

Yeah. That's just the way Minecraft does it though. It's item type based

#

Can't put a cooldown on a specific stack

warm token
#

I can't understand of all the constructors in the AttributeModifiers class

#

I just need to add more some armor points to an itemstack

patent fox
#

does somebody know how to nether world is called? i forgot

worldly ingot
#

world_nether usually

#

Can always change though if a world is generated with, say, Multiverse

patent fox
#

and the end?

mental sorrel
#

An other short question,
I have an inventory, i inventory.add the items (from the start, to fill it up) and use inventory.setitem to fill the last item slot with instructions.
But the items i added with i.add don't show in the inventory.
Can't they be used together?

arctic moth
#

i was just walking by on my test server and found this

#

wtf

trim lake
#

Is there way how to delay block breaking?

#

I just want to set custom drop after in onBlockDropEvent

river oracle
#

Otherwise just clear the drops and spawn an item entity

trim lake
#

I need to get current drop and multiple that only in some case. So I cannot get drop from block in BlockBreakEvent. Thats the problem

river oracle
#

I think unless something's changed most people cancel the event than delete the block manually than drop their item

trim lake
#

Ye, I can do that. But I need to get current drop from block and then multiple that. I can´t get what is drop in BlockBreakeEvent

#

Im gona try cancel event and uncancel after delay

river oracle
#

Hmmm not sure but this thread may be useful to you

trim lake
#

Is not breaking that block

river oracle
#

The thread should solve your issue

#

I read through it more seems very relevant

mental sorrel
tender shard
trim lake
#

Sadly that told me, I need made my own drop system xD Nice. I canceld the event and than after delay I use event.getBlock().breakNaturally(); but, in this case event
onBlockDrop is not called. I need onBlockDrop event to get current drop from block.

tender shard
#

if you want to get the drops of a block, you'll have a very bad time

#

otherwise my D2I plugin wouldnt be selling that well

river oracle
#

Exactly what he's doing xD

tender shard
#

I see

#

do actually know "what block break triggered what drops", you will want to keep some kind of "tracking system"

trim lake
tender shard
#

e.g. "block X was broken now, let's check out what drops spawn in a similar location in the next... let's say, 20 ticks"

#

20 ticks might not even be enough for certain things, it's really very complicated

#

e.g. a huge "end tree" thing (i forgot the name) might need way more than 20 ticks

tender shard
trim lake
#

oh shit.. that will be pain... nwm, I will just let player brake the block and freeze him for some time, than BlockBrakeEvent will be called. xD This sound easier than your solutions.

river oracle
#

Sounds like an awful solution

trim lake
#

Sadly 😦 Why I cant get drops from block in BlockBrakeEvent thats stupid 😦

tender shard
#

just a quick showcase on how D2I works

trim lake
tender shard
#

the DropOwnerManager keeps track of "who did something that MIGHT cause item spawns" (e.g. interact witha b lock or entity) and where was this? and those entries get removed after a certain amount of ticks, depending on what happened

tender shard
trim lake
#

I guess there should be some ezy way to doit... Looks like there is no way xD So I will just stop make BlockBrakeEvent cancel and let player brake a block to make BlockDropItemEvent be executed

tender shard
#

there is none

trim lake
#

I just try cancle evnent and uncancel after time. Result was not breaked block. So thats not a way

tender shard
#

wdym

#

ofc you cannot "uncancel" an event one tick later

trim lake
#
                new BukkitRunnable() {
                    public void run() {
                        event.getBlock().breakNaturally();
                        frozenPlayer.remove(player);
                        cancel();
                    }
                }.runTaskLater(Main.getPlugin(Main.class), 3*20);
            }```
#

I have this

tender shard
#

and what is that supposed to do?

trim lake
#

Delay the block braking. I cancel the event and after 60 ticks I brake block naturally

#

But I need BlockDropItemEvent to be called, but there is not.

tender shard
#

are you sure?

river oracle
#

That's for dispensers and stuff prob

tender shard
#

breakNaturally() definitely calls a BlockBreakEvent

#

I thought that it would also call the BlockDropItemEvent after BlockBreakEvent ran

#

unless you cancelled that, ofc

#

ughm wait

trim lake
#

I need this BlockDropItemEvent not BlockBrakeEvent

tender shard
#

I meant Block#breakBlock, NOT Block#breakNaturally

river oracle
tender shard
#

you have to keep track of that yourself

#

you will have to listen to ALL block breaking events, then keep those blocks in a list or set or any other collection

#

then listen to the BlockDropItemEvent too, and check whether your list contains it

#

since this stuff always happens in the same tick, you can link it via location

trim lake
#

thats sound like painful solution, fml

tender shard
#

it is painful

river oracle
#

Thus the state of life

tender shard
#

there is no other way

#

painful solutions pay my rent 🥲

trim lake
#

Eeeeh.. I think there will be way... nwm

#

anyway thanks for help.

tender shard
#

there really is no other way

slow oyster
#

What do you guys use for databases in your plugins? I was considering trying to use SpringBoot and make use of DI too but it's such a pain in the ass to setup inside a spigot plugin and was probably a terrible idea anyway. Any lightweight frameworks to look at?

tender shard
#

what MC version?

tender shard
#

I don't see any reason to use mysql / mongodb / similar unless you wanna store huge amounts of data

#

wdym "how to get nms"?

#

do you use maven?

trim lake
#

btw. I kinda solved that think. I just dont delay block brake. I just freez player for that time. Is enough for me. I just did like this frozenPlayer.add(player); new BukkitRunnable() { public void run() { frozenPlayer.remove(player); cancel(); } }.runTaskLater(Main.getPlugin(Main.class), 3*20);

slow oyster
tender shard
#

np

#

no idea how it works in gradle, probably sth way more complicated lol

wary topaz
#

FINALLY

#

wait how do I remove the "?" after the hi?

#

ik its mojang but me no like it

remote swallow
#

i think theres a mod for it

jaunty crag
#

does anyone know how hypixel did their random dungeon generator

remote swallow
#

judging that none of work for hypixel (iirc) i dont think anyone will

waxen plinth
jaunty crag
#

not exactly hypixels just any random dungeon algorithm

waxen plinth
#

look into maze generation algorithms

jaunty crag
waxen plinth
#

once you have a shape of a maze you can scale it up and use larger cell sizes

jaunty crag
#

i just dont want big rooms to bleed in eachother

waxen plinth
#

replacing cells with prebuilt structures

jaunty crag
#

or completely block off a path entirely

drowsy helm
#

if all rooms are the same size or a multiple of the same size, it will be easy

jaunty crag
#

could i just make the cells massive

#

and then make the rooms smaller than the cells

drowsy helm
#

yeah you could

quaint mantle
#

would a treemap be the best way to sort doubles and get the "owner" aka player?

drowsy helm
#

but entrances/exits would have to be in the same spot

drowsy helm
quaint mantle
#

yeah its Map<Player, Double>

#

just convert that to a treemap

drowsy helm
#

yeah it would be better

#

and use UUID

#

not Player

quaint mantle
#

eh, alr

#

fine

drowsy helm
#

you'll get a memory leak eventually

#

just saving you the headache

quaint mantle
#

oh, i thought it didn't really matter

#

damn, alr

#

i'll do that rn

knotty meteor
#

Someone have docs of PacketPlayInSteerVehicle for 1.19.2

eternal night
#

docs ?

#

What do you mean, docs ? its an internal class (in spigot mappings, ew ew)

quaint mantle
#

is there a way to sort the value instead of the key in a treemap

knotty meteor
#

I mean a guide how to use it, because it is completely diffrent with 1.12.2 and i now need a 1.19.2 one

drowsy helm
#

if you want support for nms, use moj mappings

quaint mantle
#

or would i have to switch them

drowsy helm
#

switching them wouldnt work

#

you could just use a stream on a regular map

#

if its just for players it wont be inefficient

eternal night
#

and has ```java
private final float xxa;
private final float zza;
private final boolean isJumping;
private final boolean isShiftKeyDown;

these fields
knotty meteor
#

Oowh thanks i will take a look at that! :D

drowsy helm
#

check out this for moj mappings

quaint mantle
drowsy helm
#

either a VAlueComparator or entryset stream

quaint mantle
#
Map<UUID, Double> sorted = testing.entrySet().stream().sorted(Comparator.comparingDouble());```?
#

plus some other things

drowsy helm
#

something like that idk

quaint mantle
#

i'll test this

Map<UUID, Double> sorted = testing.entrySet().stream().sorted(Map.Entry.comparingByValue()).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (value1, value2) -> value1, LinkedHashMap::new));``` may work
#

awesome it works

quaint mantle
#

i got this but there's an error and i'm not 100% sure what to put there then

Map<UUID, Double> sorted = testing.entrySet().stream().sorted(Collections.reverseOrder().thenComparingDouble(Map.Entry::getValue)).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (value1, value2) -> value1, LinkedHashMap::new));```
rigid loom
#

?paste

undone axleBOT
quaint mantle
rigid loom
#

its for something im about to post

undone axleBOT
rigid loom
#

is it possible to do this.kc = new KingdomsConfig(); or does it have to have KingdomsConfig(this);?

wary topaz
#

For my clearchat command

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

quaint mantle
wary topaz
#

Yea.

quaint mantle
#

also use Bukkit.broadcastMessage();

#

dont loop every player

wary topaz
#

I dont want my console to receive the spam

worldly ingot
#

That loops players. Not the issue

#

You have a return statement in your for loop

quaint mantle
worldly ingot
#

That as well

quaint mantle
#

remove the second return method

#

@worldly ingot while your here

quaint mantle
#

what would i put there?

#

instead of Map.Entry::getValue

fossil lily
#

Is Hetzner Cloud just their name for VPSs?

wary topaz
#

Why does it say chat cleared by ethangarey 4 times?

#

[19:58:42 INFO]: Chat cleared by EthanGarey2
[19:58:42 INFO]: Chat cleared by EthanGarey2
[19:58:42 INFO]: Chat cleared by EthanGarey2
[19:58:42 INFO]: Chat cleared by EthanGarey2

fossil lily
#

So its something that I can ssh into?

wary topaz
fossil lily
#

okay thanks. I was a little confused why their prices are so low, but I see that they aren’t dedicated. still probably worth a try though.

wary topaz
#

like this?

quaint mantle
#

why are you doing instance of?

#

lmao

#

its useles

undone axleBOT
quaint mantle
#

its because you are looping every player then sending the message to console

#

put that after the loop

#

^

#

or just broadcast it after

#

instead of getting the console instance

wary topaz
#

this works perfectly fine

quaint mantle
#

fax

quaint mantle
#

yes

#

now instead of

#

^

worldly ingot
#

You don't need to instanceof check the Player so you can call getName(), because CommandSender has getName() anyways

fluid river
#

bro look at this code

wary topaz
#

ooo

fluid river
#

🙂

worldly ingot
#

Looks fine to me

fluid river
#

looks cringe

wary topaz
#

is console sender a catagory of broadcast message?

worldly ingot
#

Can just avoid the instanceof entirely because sender.getName() works fine in both cases

wary topaz
#

I removed the instanceof

fluid river
quaint mantle
wary topaz
#

alr ill remove the 2nd line

quaint mantle
#

just do this

#

String executor = sender instanceof Player ? ((Player) sender).getName() : "Console";

#

ez

fluid river
#

remove consoleSender sendmessage

quaint mantle
#

whoops

#

no one seen that

wary topaz
#

oo alr

fluid river
quaint mantle
#

then replace player.getName() to executor

worldly ingot
#

What I would honestly do is save your users some bandwidth. Instead of sending a player 100 chat packets, you can send one chat packet with 100 newlines.

String message = "\n".repeat(100) + "Chat was cleared by " + sender.getName();
Bukkit.getPlayers().forEach(player -> player.sendMessage(message));```
Your whole command just becomes that. That's it. You can optionally send a message to console as well
quaint mantle
#

choco

worldly ingot
#

Unless newlines have changed in modern Minecraft but I believe they still work

quaint mantle
#

hi

#

i need your assistance for one moment

worldly ingot
#

I have no clue what your goal is with that map

quaint mantle
#

im just sorting the value

#

but i need to reverse it

worldly ingot
#

Reverse what? Reversing something before you sort is a little redundant, no? Because it gets sorted after anyways?

quaint mantle
#

okay i was doing Map.Entry.comparingByValue()

#

but i need to reverse it before comparing by the value

#

aka this Collections.reverseOrder().thenComparingDouble(Map.Entry::getValue)

#

but

fossil lily
#

wtf is this

quaint mantle
#

oops

#

what would i put here?

eternal oxide
quaint mantle
#

but i need to reverse it

#

so the highest number is first

fluid river
#
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    String message = "\n".repeat(100) + "Chat was cleared by " + sender instanceof Player player? player.getName() : "Console";
    Bukkit.getOnlinePlayers().forEach(p -> p.sendMessage(message));
}```
fossil lily
#

w h y

fluid river
#

tho would sender.getName() return "Console"?

#

oh i see

eternal oxide
fossil lily
#

🤔 Hetzer is well trusted, I just think its dumb.

fluid river
wary topaz
#

Any suggestions?

#

(It works)

fluid river
fossil lily
fluid river
#
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    String message = "Chat was cleared by " + sender instanceof Player player? player.getName() : "Console";
    Bukkit.getOnlinePlayers().forEach(p -> {
        IntStream.range(0, 32).forEach(p.sendMessage(" "));
        p.sendMessage(message);
    });
}```
wary topaz
#

the \n didnt work

quaint mantle
#

^

worldly ingot
#

A little ugly, Fire, but

Map<UUID, Double> sorted = testing.entrySet().stream()
    .sorted(Comparator.<Map.Entry<UUID, Double>>comparingDouble(Map.Entry::getValue).reversed())
    .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (value1, value2) -> value1, LinkedHashMap::new));```
fossil lily
#

Will they refund the $20?

worldly ingot
worldly ingot
#

It used to work way back in the day ;p

wary topaz
#

Inconvertible types; cannot cast 'java.lang.String' to 'org.bukkit.entity.Player'

undone axleBOT
#

Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.

fluid river
#

he asked for suggestion

#

his code works already

quaint mantle
fluid river
wary topaz
#

also im renaming the files after

#

as you asked

fluid river
#

oh i see

wary topaz
fluid river
#

add ()

#

String message = "Chat was cleared by " + (sender instanceof Player player? player.getName() : "Console");

worldly ingot
#

sender.getName() returns "Console" for the console command sender

#

The ternary is redundant

desert loom
#

is that ternary even needed? doesn't sender#getName() return "Console" assuming it's from the console

wary topaz
#

'forEach(java.util.function.IntConsumer)' in 'java.util.stream.IntStream' cannot be applied to '(void)'

fluid river
#

i juast asked

fluid river
#

ez i won

#

🙂

worldly ingot
#

I guess if you really care then yeah, you can ternary it I guess lol

wary topaz
fluid river
# wary topaz

IntStream.range(0, 32).forEach(i -> p.sendMessage(" "));

#

tho the cringest solution

wary topaz
#

bet ty\

fluid river
#

just shorter than for

worldly ingot
#

Using an IntStream for that is... a bit extreme...

#

Just use a for loop lol

fluid river
#

yeah ikr

fluid river
wary topaz
#

The final solution, any suggestions before I close up?

fluid river
#

i guess that's the shortest thing possible

wary topaz
#

(BTW it works)

#

Alr

#

time to fix my gamemode java

eternal night
#

Bukkit.getOnlinePlayers().forEach(p -> p.sendMessage("\n".repeat(32)));

#

😅

fluid river
#

gaymode kotlin

eternal night
#

wrap it in a component ?

#

is that on spigots side

#

or the client

fluid river
#

who knows

wary topaz
#

also my console is not giving me errors when I get a error in chat (ingame), anyone know a reason why?

fluid river
#

sounds kinda common here

wary topaz
fluid river
#

oh no

#

that was you who asked about it

#

days ago

wary topaz
#

Did it?

#

I*

fluid river
#

ye

wary topaz
#

I ask alot of stuff

#

Was there a solution?

fluid river
#

idk

#

check if you didn't disable debug mode with flag

#

and if it's enabled in spigot.yml

wary topaz
#

okie

fluid river
#

since when errors are components with HoverEvent tho

eternal night
#

it is a spigot thing kekw

fluid river
#

maybe paper doesn't want to print errors anymore

eternal night
#

obviously it is

wary topaz
#

debug is disabled

eternal night
#
final var clearingComponent = Component.text().append(Collections.nCopies(32, Component.newline())).build();
Bukkit.getOnlinePlayers().forEach(p -> p.sendMessage(clearingComponent));
#

works as expected

fluid river
#

well IntStream#range looks smaller

#

xD

wary topaz
#

Maybe choco knows

eternal night
fluid river
wary topaz
#

oo

#

alr ill try

fluid river
#

i'm sure

#

just a line of text

#

and the actual error was in console

eternal night
#

what ?

#

what about hoverable o.O

#

I thought we are just clearing chat

wary topaz
#

Ma errors are back!

fluid river
wary topaz
#

tysm

fluid river
#

ez

wary topaz
#

stupid debug mode lol

#

i dont remember disableing it though

#

weird

fluid river
#

i guess you talked to EthanGarey...

#

+optimize

#

okay ginga and

#

yes

#

+optimize

#

my hands finally came to changing code formatting in eclipse

#

one line if ❤️

stuck flax
#

How do I run some sync code once some async code has been executed?

eternal oxide
#

scheduler

stuck flax
#

doesn't answer my question

eternal oxide
#

yes it does

stuck flax
#

no it doesn't

#

im gonna need more than the word scheduler

eternal oxide
#

?scheduling

undone axleBOT
eternal oxide
#

There

stuck flax
#

ty

fluid river
#

CompleteableFuture

river oracle
wary topaz
#

[20:59:26 INFO]: [STDOUT] [org.spigotmc.RestartCommand] Startup script './start.bat' does not exist! Stopping server.
[20:59:26 INFO]: Stopping server

#

...

river oracle
#

"./start.bat" isn't a file name

#

idk what to say it says it there

wary topaz
#

It is ;-;

river oracle
#

no its not

#

is your file named "./start.bat"

wary topaz
#

yes!

river oracle
#

is it really

#

I don't think its named "./start.bat"

wary topaz
#

??

river oracle
#

so to start your server you run ././start.bat xD

#

exactly ./start.bat isn't the file naem

wary topaz
#

wdym?

river oracle
#

./ <--- runs binary files

#

not a file name

#

kinda crazy right

desert loom
#

there's a setItemStack method try that

wary topaz
#

Is there a way every time my plugin loads in it changes the config to add a 1 to the version?

eternal oxide
#

yes, but why?

wary topaz
#

Whats the method?

fluid river
#

getConfig().set("version", getConfig().getInt("vesion") +1);

eternal oxide
#

teh plugin version is in the plugin.yml. a config version is just a value, increment it easily

wary topaz
#

ty 😉

fluid river
#

he probably wants to know how many bad configs he need

#

to make something above shit level

#

🙂

eternal oxide
#

🙂

fluid river
#

:))))

#

guys Metro 2003 books is 10 times better than the game

#

the only sad thing is main character uses his weapon like 4 times

#

suggest reading

#

2034 cringe

#

2035 scary

wary topaz
#

How can I get the version and not set it?

fluid river
#

basically do that when work on my test server

wary topaz
#

To display in console

fluid river
#

getConfig().getInt("vesion")

#

getConfig().set("version", getConfig().getInt("vesion") +1);

wary topaz
#

ty

fluid river
#

?learnjava

undone axleBOT
fluid river
#

?learnspigot

#

pls

eternal oxide
#

we have one

#

?jd-s Learn Spigot

undone axleBOT
wary topaz
#

?jd-s

undone axleBOT
#

Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.

wary topaz
#

Could you teach me 😊

#

bet

eternal oxide
#

) in wrong place

wary topaz
#

this is what my config looks like

eternal oxide
#

config or plugin.yml?

wary topaz
#

config

eternal oxide
#

odd config

wary topaz
#

wdym

#

I'm using intellij

fluid river
#

why do you need author and version in config

eternal oxide
#

thats info for the plugin.yml

fluid river
#

you can do in plugin.yml

wary topaz
fluid river
#

and then in main class

wary topaz
#

Oh I can?

fluid river
#

getDescription().getVersion()

#

and getAuthor()

eternal oxide
#

plugin.yml is specifically for all that info

wary topaz
fluid river
#

bro remove

wary topaz
#

ill do that after this 🙂

eternal oxide
#

delete line 2

fluid river
#

version: should be lowercase

#

or at least replace in maven

eternal oxide
#

package names are all lower case

wary topaz
#

delete line 2? that removes my custom version thing

#

crep I frogot to do that

eternal oxide
#

line 3 IS your version

wary topaz
#

ill do that now

#

How do I access and modify it?

eternal oxide
#

you change it in your pom

wary topaz
#

How do I change it automatically?

eternal oxide
#

Your pom.xml shoudl be set to filter resources, It replaces the ${...} entries

wary topaz
#

ooo

wary topaz
#

So how can I access the pom for main?

eternal oxide
#

what?

wary topaz
#

How can I get a integer like ver, to give me the project (plugin)'s version

#

the version is in pom.xml

eternal oxide
#

you update your pom.xml version when you want to increment it

#

If you want it to auto increment you will need to use a CI system like Jenkins.

#

I don;t know of a maven way to do it

#

Looks like you can but it will be WAY beyond you. You need to learn Maven workflow and the Maven releases plugin

wary topaz
#

?jd_s

#

?jd-s

undone axleBOT
wary topaz
#

was trying to find the link

unique bronze
#

Any idea why this only gives me Pig Spawners:

public static ItemStack CreateSpawner(EntityType type) {
        ItemStack item = new ItemStack(Material.SPAWNER);
        BlockStateMeta meta = (BlockStateMeta) item.getItemMeta();
        ((CreatureSpawner) meta.getBlockState()).setSpawnedType(type);
        item.setItemMeta(meta);
        return item;
    }

Lot of the old threads were talking about old essentials things, but apparently EssentialsX fixes that? Please ping on reply, as I'm going to bed for the day, thanks for suggestions.

buoyant viper
#

?jd-s

undone axleBOT
buoyant viper
#

bukkit api loves working with copies of objects instead of the original (and probably some product of how craftbukkit hooks into mc)

#

a blessing and (sometimes) a headache at the same time

rugged topaz
#

is it expensive to perform getConfig() in a Runnable run()?

#

the runnable class is scheduled as a sync repeating task

eternal oxide
#

if yoru config is going to change so often that you need to check it every tick of a runnable you should not be using the config

rugged topaz
#

config will not change at all per server instance, but I am running this runnable per tick and using getConfig() to retrieve values to use inside run()

#

how about that?

eternal oxide
#

reading the config is not expensive though

rugged topaz
#

okay

#

was just wondering if i should assign all values to variables but thanks

eternal oxide
#

pass teh values to local variables inside the runnable

#

if its a repeating task

rugged topaz
#

when instantiating the runnable class and scheduling it, pass the config values as variables for the scope of the entire class to use inside run?

#

or keep it the way it is

opal juniper
chrome beacon
#

Github actions are very useful

harsh totem
#

How do I get the object "HeartRecipe"?

remote swallow
#

config#getConfigurationSection("path")

echo basalt
#

ConfigurationSection section = config.getConfigurationSection("HeartRecipe")

#

awful to write, gotta practice it

harsh totem
harsh totem
#

How do I get an itemstack of a player's head?

harsh totem
#

I don't understand

tall dragon
#

well do you know how to create a normal itemstack?

harsh totem
#

yes

tall dragon
#

well you use ItemMeta there

#

you can cast that to SkullMeta

#

i actually sent you the wrong link

#

this is the correct one

harsh totem
#

oh ok

#

thx

fickle mist
#

Hi all! I can not understand why the action bar is not displayed in the onJoin event(all code below)

package stam.stamina;

import org.bukkit.GameMode;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityToggleSwimEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerToggleFlightEvent;
import org.bukkit.event.player.PlayerToggleSprintEvent;
import org.bukkit.plugin.java.JavaPlugin;

public class Stamina extends JavaPlugin implements Listener {

    public static Stamina plugin;
    FileConfiguration config = this.getConfig();
        int stam;
        int wasterun = config.getInt("waste-of-stamina-run");
        int wasteswim = config.getInt("waste-of-stamina-swim");
        int wastefly = config.getInt("waste-of-stamina-fly");
        int efslow = config.getInt("when-effect-slow");
        int regen = config.getInt("regen-of-stamina");
        int maxstam = config.getInt("max-stamina");
        int sum;
    @Override
    public void onEnable() {
        plugin = this;
        this.getConfig().options().copyDefaults(true);
        this.saveDefaultConfig();
    }
    public void EfSlow(Player p){
        if (stam <= efslow) {
            p.setWalkSpeed(0.1f);
            p.setFlySpeed(0.05f);
        } else {
            p.setWalkSpeed(0.2f);
            p.setFlySpeed(0.1f);
        }
    }
    @EventHandler
    public void onJoin(PlayerJoinEvent e) {
        Player p = (Player) e;
        stam = maxstam;
        p.sendActionBar("Stamina: " + sum + " / " + maxstam);
    }


    @EventHandler
    public void onRun(PlayerToggleSprintEvent e) {
        Player p = (Player) e;
        if (p.isSprinting() && !p.getGameMode().equals(GameMode.CREATIVE) && !p.getGameMode().equals(GameMode.SPECTATOR)){
            sum = maxstam - wasterun;
        }
    }
    @EventHandler
    public void onSwim(EntityToggleSwimEvent e) {
        Player p = (Player) e;
        if (p.isSwimming() && !p.getGameMode().equals(GameMode.CREATIVE) && !p.getGameMode().equals(GameMode.SPECTATOR)) {
            sum = maxstam - wasteswim;
        }
    }
    @EventHandler
    public void onFly(PlayerToggleFlightEvent e) {
        Player p = (Player) e;
        if (p.isFlying() && !p.getGameMode().equals(GameMode.CREATIVE) && !p.getGameMode().equals(GameMode.SPECTATOR)) {
            sum = maxstam - wastefly;
        }
    }
    @Override
    public void onDisable() {

    }
}
remote swallow
#

is player#sendActionBar even a spigot method i cant find it anywhere on the spigot jds

patent fox
#

how do i save the config after server closes?

remote swallow
remote swallow
patent fox
patent fox
#

i always used presistant data

remote swallow
#

config.saveConfig()

patent fox
#

oh

fickle mist
remote swallow
#

wdym, im pointing out that the line Player p = (Player) e; will never work to do anything to the player. e is the event and not the player if you want to get played from the event it should be Player p = e.getPlayer();

remote swallow
#

.getPlayer()

#

not .player

fickle mist
remote swallow
#

oh wait thats an entity toggle swim its probably e.getEntity().getPlayer()

glad prawn
#

🤷

tardy delta
#

check instanceof and cast it

#

if theres no PlayerToggleSwimEvent atleast

remote swallow
#

the if statement wont work either it checks for creative and spectator at the same time

if (p.isSwimming() && !p.getGameMode().equals(GameMode.CREATIVE) &&/*here should be ||*/ !p.getGameMode().equals(GameMode.SPECTATOR)) {
            sum = maxstam - wasteswim;
        }
tardy delta
#

== on enums remember

remote swallow
#

that too

tardy delta
#

my database lib seems to look more and more like gson with typeadapters lol

remote swallow
#

lol

fickle mist
tardy delta
#

if (e.getEntity() instanceof Player) { Player player = (Player) e.getEntity() }

#

might aswell learn java

glad prawn
#

I wrote exactly the same lmao.

tardy delta
#

me creating rust classes in java smh

#

better than an Optional too

remote swallow
#

if the event has Player in the name Player p should be Player p = e.getPlayer()

tardy delta
#

just see if it extends PlayerEvent

remote swallow
#

thats also an option

#

but people dont want to read jds

tardy delta
#

then get lost ig

#

this doesnt look too good

#

gives me flashbacks to gson and that atleast uses reflections

#

dont look at my method names tho

#

dunno what i was doing yesterday

#

might aswell do this

#

i was thinking about that

#

im trying to implement queries as simple as possible

#

with like connector.pushQuery(Query.insert(Table.PLAYERS, dummyPlayer)) and where DummyPlayer.class is mapped to a context resolver

#

ill probably start with a builder pattern for creating tables

#

copilot doing all the work for me smh

patent fox
#

wdym?

#

for me it works

#

what mc version is your plugin?

fickle mist
tardy delta
#

wdym not released?

fickle mist
patent fox
#

check if your event is regirstered

tardy delta
#

example

#

might actually map that class to a table too

hybrid spoke
#

copilot is great

tardy delta
#

sometimes

hybrid spoke
#

always, has been

tardy delta
#

this stuff looks cursed tho

tardy delta
hybrid spoke
#

copilot learns from its user

#

just dont code shit then

onyx fjord
tardy delta
#

dont make it cry

onyx fjord
#

I need to try this tbh

#

Just a proof of concept

tardy delta
onyx fjord
#

Sheesh what's this

lament ferry
#

I am trying to spawn SCULK_CHARGE particles. The console returns an error that these particles need data. Does anyone know how I can create suitable data for the particles?

tardy delta
#

provide the method with an additional param

#

iirc

lament ferry
#

No Shit thanks xD

#

And what does he want? xD

lament ferry
#

Yes well with the vibration particles it says what I need, with SculkCharge not :/

fickle mist
#

Hello everyone again! I have a question is there an event for the player to just stand and is there an event for the player to just walk

tardy delta
#

theres a PlayerMoveEvent for a player that is moving

fickle mist
tardy delta
#

theres no event for that

fickle mist
fickle mist
tardy delta
#

compare the x y and z to the previous ones

#

might wanna use javadocs

fickle mist
tardy delta
#

if the event.getFrom().getX() != event.getTo().getX() you know that the player moved

#

might want to do that for x and y too

#

dunno if theres a better way

hybrid spoke
onyx fjord
#

I'm not gonna give them my actual code tho

hybrid spoke
#

they dont save it anyways

#

(if its not public on github)

molten hearth
#

poor Xi Qiu

hybrid spoke
molten hearth
#

LMAO

#

seen that before in my code

#

well fuck indeed

#

at the moment I ignore any error and break user experience because just get gud and relog

glossy venture
hybrid spoke
glossy venture
#

depends

#

on what date format

#

youre using

#

but this is inefficient anyways

#

just open an input stream

hybrid spoke
#

i do further below

glossy venture
#

this will rewrite the file every time smth is logged

hybrid spoke
#

anyways, it just creates a new file if there isnt already one for the day

glossy venture
#

if you recreate the input strean

hybrid spoke
#

and even then only if there is something to log

glossy venture
#

stream

hybrid spoke
#

á errors

#

i wont hold the stream open

quaint mantle
#

inefficient for fast logging

glossy venture
#

every time you open a stream

#

when you write to it

#

it clears the file

grim ice
#

just recurse again if u get an IOException

#

ez

glossy venture
#

basically

hybrid spoke
#

it doesnt

grim ice
#

have an infinite recursive loop

#

of errors

glossy venture
#

but this is slow as fuck anyways just open it at creation

hybrid spoke
#

just use a fileoutputstream and append to the already existing file content

brave goblet
glossy venture
#

right

#

also id do the IO async

hybrid spoke
#

it probably does it anyway somewhere, but thats native shit

hybrid spoke
glossy venture
#

ok but still just use one stream

#

and create it when the logger is opened

hybrid spoke
#

i could just use a regular logger and give it a handler but who needs that shit

glossy venture
#

use my logging api yes

hybrid spoke
#

nah

glossy venture
#

yes

#

good idea

remote swallow
hybrid spoke
#

i would rather use log4shit

brave goblet
glossy venture
#

its faster than sysout

#

idk but its better than it taking miliseconds

#

because you might log quite often

patent fox
#

how can i hide commands from players?

eternal oxide
#

permissions

hard socket
#

why is my config empty?

tardy delta
#

Cuz you don't load it?

hard socket
#

onEnable

hard socket
tardy delta
#

Why rzloading qfter saving

sterile token
#

Weird

#

Please dont abuse static

#

I dont know why people is obssess with static

#

Oh nothing

hard socket
#

that worked

sterile token
#

I messed up because he is not using the proper name conversions

#

Variables are always lower case

#

If the var contains 2 text like game mode should be named as gameMode

#

I mean its pretty important to follow then because then people dont understand your code

#

Im your case it should be named as:

config = new Config(this);

hasty prawn
round finch
#

what cases to use static or not?

#

🤔

hasty prawn
#

constants

round finch
#

i have static arraylists

echo basalt
#

ew

#

dependency injection go brr

hasty prawn
#

I only really use static if I need to store like a List of the object

round finch
#

what?

echo basalt
hasty prawn
#

I know there's better ways to do that I'm just lazy

hasty prawn
round finch
echo basalt
#

make a manager object

round finch
#

i just store it in memory

echo basalt
#

basically a list abstraction

hasty prawn
#

So much effort

echo basalt
#

Static has reasons to be actively used

#

Basically methods or fields that belong to the type, not to the instance

small current
#

anyway to check for the moon state?

echo basalt
#

They're permanently locked into memory

#

unless you set them to null manually

hasty prawn
#

Well but then whats the point lol

round finch
#

wait wait i'm trying to piece it together

#

what is the proper way?

echo basalt
#

something like this

#

for example

#

ignore my shitty if braces, still working on standardizing that

hasty prawn
#

WTF

echo basalt
#

Then I usually make a getter on the main

#

and pass my main object around

#

but ideally you pass your manager objects whenever needed

#

instead of passing the entire main

round finch
#

do that hold infomation in memory?

echo basalt
#

Yeah

#

It's the proper way to do it, each class has its own purpose (data object, managing data, using data, gathering data)

hasty prawn
echo basalt
#

It's like a database, you ask the DBMS system for the data, you mess for it and you push back

#

Except the DBMS saves to disk, while your system just stores it in memory

round finch
#

Maybe i did a bad thing

hasty prawn
#

why the underscores Sadge

round finch
#

is that bad?

#

OH yeah these _

hasty prawn
#

It's not standard naming conventions

round finch
#

what is better?

small current
#

thats why im asking here

round finch
hasty prawn
#

Uh sec

round finch
#

dpeek 👍

echo basalt
#

Storage can be RAM, a database, cache etc

#

The objective of the data manager is to provide a consistent layer of abstraction for handling the raw data

hybrid spoke
echo basalt
#

If you read the disk or managed all the objects in the project, on every class, it'd be hell

hybrid spoke
#

maybe even for primitive namings

hasty prawn
#

So Games -> games
Game_Number -> gameNumber

#

etc

echo basalt
hasty prawn
#

yes that ^

echo basalt
#

Just like databases, you either pick singular or plural and stick to it

upper vale
#

Underscore should only really be used in enums and constants

echo basalt
#

Plugin main classes should be named as either ProjectName or ProjectNamePlugin

echo basalt
upper vale
#

mhm

round finch
#

saving data is differently better then 1000s of elements in memory XD

hasty prawn
#

Who appends Plugin to their main class name wot

echo basalt
#

Sure they have their own constructor but they behave like constant objects

echo basalt
#

or have a StorageHandler class for that

echo basalt
#

ZombiesPlugin, UniversityPlugin etc

#

It helps

round finch
hasty prawn
#

Yeah I guess if your project name is boring like that it makes sense

echo basalt
#

What if University is a data class while UniversityPlugin is my main

upper vale
#

Especially if your plugin name is a generic noun appending Plugin avoids confusion

echo basalt
#

EatAnythingPlugin etc

#

Still useful to know it's the plugin class

#

and I have a module system (sub-plugins type deal), which end in Module too

#

CanvasModule, SchoolModule, SkinModule

#

it's consistent

hasty prawn
#

I can understand doing it if your plugin name is a generic noun, but tbh at that point your project name kinda sucks and you should be more creative 😛

echo basalt
#

I'm literally building a minecraft university wtf do you expect

hasty prawn
#

MinecraftUniversity? Idk KEKW

round finch
#

takeABreak();

hasty prawn
#

University is just weird to me for that to be the project name

upper vale
#

That does not help 💀

#

University is a cool name tbh

#

I like generic noun names

hasty prawn
#

I guess it's preference then

echo basalt
#

If I'm writing a fuckin zombies minigame imma call the project Zombies

round finch
#

changeOfFallingAsleepInClass();

upper vale
#

Apple

#

lol

echo basalt
#

you just gotta be organized

upper vale
#

God no

echo basalt
#

ew

round finch
#

🤣

echo basalt
#

watch me remember about ZSurvival in 6 years

round finch
#

cursed

echo basalt
#

I have more projects to worry about

#

simple names are easy to remember in 15 years

round finch
#

I believe I lack knowledge of the real fundentals of java and system

I learned by doing and watch cheap tutorials

i mean what i do works.. i guess

#

not sure what resources i need?

round finch
#
getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(3.0D);
warm token
#

Actually I just need to add some armor points to an itemstack

round finch
#

do you mean like this?

warm token
#

y

#

but with armor points

round finch
#

yes

warm token
#

Like +4 Armor Defense

round finch
#

of course just needed to figure out what you meant

fluid river
#

good afternoon, comrades

round finch
fluid river
#

where are newcomers

#

please show me

warm token
#

Actually it's a bit strange the constructor of the AttributeModifiers class

round finch
#

@fluid river #general

warm token
fluid river
warm token
round finch
fluid river
#

?

#

what's your question

warm token
fluid river
#

addAttributeModifier()

#

removeAttributeModifier()

#

done

round finch
#

addAttributeModifier yeah

#

if you check the doc

#

you see it

fluid river
#

if you learn how to read

warm token
fluid river
#

you read it

fluid river
#

you can't remove the attribute itself

#

only modify

warm token
#

That's not my question

fluid river
#

ask full question then

warm token
#

Okay Imma change it

warm token
#

So basically I can't change the actual attribute in the multimap

fluid river
#

umm?

#

Why do you even need multimap tho

#

and what does "can't change" mean

warm token
#

The method takes a multimap as parameter xd

fluid river
#

which method

#

what API