#help-development

1 messages · Page 432 of 1

young knoll
#

It's an enum smooth brain

#

All uppercase values

remote swallow
#

smooth brain too smooth

bold vessel
#

?1.8

undone axleBOT
opal juniper
#

😎

remote swallow
#

Bukkit.broadcastMessage()

#

your using paper then

#

wrong place

indigo frost
#

Hi so im getting an entity using Bukkit.getWorld("world").getEntities().get(l) and I want to be able to kill this entity. How do I do that?

#

i did

#

didn't work

#

l is the variable in a for loop, it goes through all entities

late hinge
#

it works

pure dagger
#

what is PersistentDataType.TAG_CONTAINER ?

pseudo hazel
#

i think thats for chests and stuff

young knoll
#

No

#

It's a container of tags

pseudo hazel
#

nvm i read it wrong

young knoll
#

Essentially you can put a persistent data container inside another persistent data container

pure dagger
#

uhm ok

late hinge
#

@remote swallow when i made exactly as you sent to me but when i made this conditional

#

isn't works

#

@remote swallow

 @EventHandler
    public void onCommand(PlayerCommandPreprocessEvent event) {
        switch (event.getMessage()) {
            case "/gm":
                event.setCancelled(true);
                if (event.getPlayer().getGameMode() == GameMode.CREATIVE) {
                    event.getPlayer().setGameMode(GameMode.SURVIVAL);
                    event.getPlayer().sendMessage("§aYou're in survival!");
                }else{
                    event.getPlayer().setGameMode(GameMode.CREATIVE);
                    event.getPlayer().sendMessage("§aYou're in creative!");
                }
                break;
remote swallow
#

because its checking just for /gm

pseudo hazel
remote swallow
#

if its /gm you want you dont need that

#

you only need that for /gamemode

#

alos that doesnt work because your syntax is wrong

pure dagger
#

can i store boolean?

remote swallow
#

?learnjava

undone axleBOT
pure dagger
remote swallow
pure dagger
#

how

young knoll
#

just use a byte

remote swallow
#

wait we dont have a bool?

pure dagger
#

uh

pseudo hazel
#

yes and cast it at both ends

young knoll
#

You don't even need to cast it

#

But yes you coukd

pseudo hazel
#

getbyte() == 0 ? false : true

pure dagger
#

yep

pseudo hazel
#

yeah not really casting but you get the point

pure dagger
#

yeah

#

there is 1b in minecraft i think

#

i mean

#

wait

#

yeah 0b

worldly ingot
pure dagger
#

oh yeah

pseudo hazel
#

oh yeah fair enough xD

#

intellij would probably point that out to me

pure dagger
#

i actually never used the ? false : true

#

what is it called

pseudo hazel
#

ternary

#

like an operator taking 3 values

pure dagger
#

3?

pseudo hazel
#

primary operator is like inverting something, i.e. !

pure dagger
pseudo hazel
#

secondary operator are most operators like + and - etc

#

and ternary is like the if statement

#

yeah thats good to use

#

you asked about what a ternary was so I explained it

pure dagger
#

yeah

thorn crypt
#

How can I know with what domain a player is joining a server ?

pseudo hazel
#

what do you mean by domain

thorn crypt
worldly ingot
#

You're thinking of unary and binary operators

#

Not primary and secondary

pseudo hazel
#

oh yes

pure dagger
#

ok

pseudo hazel
#

thanks for correcting me haha

young knoll
#

heh

#

urinary

remote swallow
worldly ingot
#

Unary, not urinary

#

Different operator

young knoll
#

Urinary.

worldly ingot
#

Sure, urinary

remote swallow
#

coll is so mature

young knoll
#

Of course

remote swallow
thorn crypt
remote swallow
#

just looking at messages, check what PlayerLoginEvent#getHostname() returns

pure dagger
#

I have another question
what is finally for?

remote swallow
#

finally?

pure dagger
#

in try catch

young knoll
#

It executes at the end of the statement

dire tapir
#

hello, I've been working on a plugin and I need to check if a block has gravity (so if it's sand, or gravel, or etc). Is there any quick way to check this, because I couldn't find anything in documentation. Would the best way be to check for all gravity blocks manually?

young knoll
#

Regardless of if it succeeds or catches an error

remote swallow
pure dagger
#

What's the difference between this
try {
//code a
} catch (Exception exception) {
//code b
} finally {
//code c
}

and this

try {
//code a
} catch (Exception exception) {
//code b
}
//code c

dire tapir
#

oh its the material check

#

I was looking at block oops

#

ty

pure dagger
#

because i dont understand

remote swallow
#

the latter will error out and not run it

lost matrix
thorn crypt
pure dagger
#

and in the second example code c isnt gonna run? what?

remote swallow
remote swallow
#

finally would run code c regardless of that

lost matrix
pure dagger
#

ooh

#

yeah

tawny remnant
#

I'm creating a Mana system. Everything works except I want to make players be able to expand their Mana Limit. Base is 100 and I'm wondering how I can do it?

winged anvil
#

i hate menus

#

so tedious

remote swallow
#

if by menus you mean me, ill join you

sinful kiln
#

Is there a way to clone a instance of CraftBlockState?

pure dagger
#

why byte doesnt work?

icy beacon
#

what's the error

sinful kiln
#

The value isn't a byte that's why, you need to cast the 1 to byte so like this: (byte) 1

pure dagger
#

really

#

why

icy beacon
#

why what

sinful kiln
#

Java has no literal way to write a byte as far as I know

icy beacon
#

yeah it only has longs and floats

sinful kiln
#

But I think byte x = 1; works without casting

icy beacon
#

and doubles

pure dagger
#

yeah

#

it works

#

and thats why im confused

#

ok

icy beacon
#

rule #38273 of programming: if it works, don't touch it, unless it falls apart

pure dagger
#

yeah

pearl seal
#

Hello. I registered event onInventoryDrag and my event doesn't work normally. I don't understand how it works but it doesn't called every times when I moving item in inventory. Event handler calling through time

young knoll
#

It's only called when you drag a stack over several slots

pearl seal
#

Over several only?

icy beacon
#

tbh just don't work with raw Bukkit Inventory API

#

it's a pain in the ass

#

use a library

pearl seal
#

Which?

icy beacon
#

I prefer triumph gui

#

but it's up to you

pearl seal
#

I just manipulating with item inside inventory. This is really bad that I should use some library instead of base api to make so simple thing...

icy beacon
#

well you can use base Bukkit API

pure dagger
#

is there faster way to do
if (boolean) {
a = 1;
} else {
a = 0;
}
?

icy beacon
#

but it's a pain

tawny remnant
sinful kiln
icy beacon
pure dagger
#

ooh

icy beacon
#

ternary operator

pure dagger
#

yeeeh

icy beacon
#

might need to put boolean ? 1 : 0 into parentheses

sinful kiln
icy beacon
#

oops

pure dagger
#

yes

icy beacon
#

yeah

pure dagger
#

== is in true or false

#

if you want to check

icy beacon
#

if you're into readability you can just do

if (boolean) a = 1;
else a = 0;
icy beacon
icy beacon
#

ternary operators are less readable imha

#

imho*

#

I barely ever use them

pure dagger
#

i like it

icy beacon
#

sure thing go for it then

pure dagger
#

wait i need to cast it to byte again? bruh

pearl seal
pure dagger
sinful kiln
#

yeah

pure dagger
#

im quitting this job

rough ibex
#

lmao

sinful kiln
#

You could use an int and cast it to an byte later

icy beacon
pearl seal
icy beacon
#

maybe you feel this way sure

#

one needs to write their code in a way that'll be readable to them particularly

#

I'd probably go for that instead of a ternary

#

but it's up to the coder to choose

rough ibex
#

I think simple ternarys are fine to read

#

but if they are multi-line complex, yeah no

icy beacon
#

I actually feel the opposite way haha

pearl seal
#

I'm agree. Ternary operator is good syntax sugar that has been added

sinful kiln
#

boolean1 ? (boolean2 ? (boolean3 ? a : b) : (boolean4 ? c : d)) : e
That's unreadable imo

icy beacon
#

I sometimes catch myself doing stuff like this

final ObjectType longName =
    longAssCondition ?
    valueOne :
    valueTwo;
pure dagger
#

oh

icy beacon
#

but barely ever do that for short ternarys

rough ibex
#

oh that's definitely unreadable

#

(laurii)

icy beacon
#

true

serene sigil
#

hi, ive intergraded my discord bot in a spigot plugin. everything works fine, but when i stop the server, it gets stuck at the disable part, do i have to add some code in the onDisable method to stop this from happening?

icy beacon
#

well the JDA bot should be stopped in onDisable afaik

serene sigil
#

where then?

icy beacon
#

?

sinful kiln
pearl seal
icy beacon
#

?nocode

undone axleBOT
#

It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.

pearl seal
#

Sorry

#
    @EventHandler
    public void onInventoryDrag(InventoryDragEvent ev)
    {
        ev.getWhoClicked().setHealth(0.1);

        if (!ev.getWhoClicked().getClass().isAssignableFrom(Player.class))
            return;

        if (ev.getCursor().getItemMeta().getAsString().toLowerCase() == "elytra")
            ev.getInventory().removeItem(ev.getCursor());
    }
#

setHealth added for debug

chrome beacon
#

Don't compare strings with ==

pearl seal
#

This is java...

#

Really

sinful kiln
#

So as far as I know getItemMeta().getAsString() doesn't return the item type as string

chrome beacon
#

That too

serene sigil
sinful kiln
#

You should use .getType().name().toLowerCase().equals("eyltra") instead

serene sigil
pearl seal
#

If I will compare string using == java will try to compare links or values?

sinful kiln
#

But if you're trying to compare the type then just compare the type enum

#

Which looks like this: .getType() == Material.ELYTRA

pearl seal
#

Understand. Thanks

#

But general problem is that my debug doesn't calling at any times when I'm drags item

sinful kiln
#

The inventory drag event is only called if you are dragging an ItemStack (that is in your cursor) over multiple slots in the inventory GUI

rough ibex
#

also, instead of doing if (!ev.getWhoClicked().getClass().isAssignableFrom(Player.class)) you can just do if (!ev.getWhoClicked() instanceof Player) I believe

chrome beacon
#

^

sinful kiln
#

So what you want is probably the InventoryClickEvent anyway

rough ibex
#

you can also cast it in the same line if it can be casted with if (ev.getWhoClicked() instanceof Player newPlayerVar)

chrome beacon
sinful kiln
sinful kiln
undone axleBOT
#

It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.

rough ibex
#

Ah, right

chrome beacon
#

Oops sorry for the ping ZBLL

pearl seal
serene sigil
chrome beacon
#

Show your code

rough ibex
#

@pearl seal remember that you will need 17 for that new cool syntax with the casted variable in the expression

pearl seal
#

17 version of java will run on spigot 1.19.3?

rough ibex
#

yes

sinful kiln
#

yeah

serene sigil
#

this is what i currently have:

rough ibex
#

and if you remove the while loop

#

I feel like that's causing the issue.

dire tapir
#

hello I need help with placing tall grass, it only places the lower half when I use getBlock().setType(Material.TALL_GRASS)

chrome beacon
#

Use showdown now

rough ibex
#

they are two blocks

dire tapir
#

when I do that it removes the whole thing

sinful kiln
#

But you need to use the BlockData object if I'm not mistaken and choose which side to set

chrome beacon
#

^ It won't work if you try to place two bottom halves

serene sigil
serene sigil
#

oh so remove everything and use shutdownnow?

chrome beacon
#

Yeah

serene sigil
#

kk

sinful kiln
#

@dire tapir
The blockdata for both looks like this
Lower half: minecraft:tall_grass[half=lower]
Uppwer half: minecraft:tall_grass[half=upper]
You can create a blockdata object with Bukkit.createBlockData(String)

young knoll
#

There's also Material.createBlockData

dire tapir
serene sigil
#

thx it works now

sinful kiln
#

Just don't update the blocks

serene sigil
#

@chrome beacon

sinful kiln
#

As an example

dire tapir
late hinge
#

some1 knows how change this default message? "Your game mode has been updated"

dire tapir
late hinge
atomic swift
#

how can i check if a plugin is being loaded through a /rl

dire tapir
dire tapir
late hinge
pure dagger
#

how to change player name above his head?

limpid nexus
#

Should be possible to do just loop all the online players in each server on the network

pure dagger
#

how to change player name above his head? AI is telling me weird things

#

so i have to ask human

tardy delta
#

wait wha

remote swallow
#

why

#

why did you author that

ancient plank
#

Wub dah zkah

full holly
#

does anyone know how I can listen to a economy update event (deposit/withdraw) in vault?

ivory sleet
#

Probably inject an economy proxy

#

Might have an event

#

Idr

full holly
indigo frost
#

hi, in my custom plugin, how do I send messages to the action bar?

young knoll
#

Player.spigot().sendMessage

#

ChatMessageType.ACTION_BAR

indigo frost
#

tried that

#

ChatMessageType isn't a thing I can import

young knoll
#

Are you depending on bukkit or spigot

#

Also what version

indigo frost
#

spigot 1.16

#

actually it might be paper

young knoll
#

ChatMessageType should 100% be in 1.16

#

How are you depending on it

indigo frost
#

k sry i was wrong it is spigot

#

so yeah idk

young knoll
rough drift
#

no need to use a fori w/ get

indigo frost
#

ooo i didnt know that ty

rough drift
#

np

#

also send your pom.xml

#

or if you're using gradle your build.gradle

young knoll
#

Looks like they depend on the jar

rough drift
#

ah

#

welp

indigo frost
#

where would I find my pom.xml

rough drift
#

oh you're not using maven?

indigo frost
#

ngl I have no idea what i'm using

#

im not familiar with intelliJ

#

when I learnt java I used NetBeans

rough drift
#

ah

#

you could've still used maven though

tardy delta
#

gradle 💀

#

after what ive seen

rough drift
#

frfr

tardy delta
#

if you dont believe it, ill sent you a file

#

about what horrific things you can do

rough drift
#

ikik

indigo frost
#

so yeah anyways

#

what do i do lol

bold vessel
eternal night
#

I mean, what are you getting ?

#

beyond that, early returns would really help the readability of your code

bold vessel
#

when i do /spawner near of a spawner it should drop it

versed canyon
# bold vessel nothings

I recommend adding some debug messages to see where the code is failing. For all the if statements, give them an else block that says something like

player.sendMessage("state instanceof CreatureSpawner failed");
#

But lynxplay is right about early returns, your statements are indented way too much.

amber vale
#

For some reason when detecting an ItemStack for it being of Material.[WOODTYPE]_PLANKS (for example, Material.OAK_PLANKS), oak planks don't return that

chrome beacon
#

Make sure the api version is set in your plugin.yml

late hinge
#

hey guys i want to make a permissions system how i make this??

amber vale
late hinge
#

like in my plugin there are some "haspermissions" that i did set if i just use permissionsEx this is gonna works everything running well?

amber vale
# late hinge like in my plugin there are some "haspermissions" that i did set if i just use p...

In this episode of the Spigot Tutorial series, I show you how to work with permissions. It is actually super simple and will allow your plugin to have some more functionality. With this feature you can limit players to have access to certain commands.

This episodes code: https://snippets.cacher.io/snippet/b1f557dd90cdd2502bf3

⭐ Kite is a free...

▶ Play video
late hinge
amber vale
# late hinge tysm

Pro tip: The internet exists; If you have a problem with knowledge google "[thing i dont know] tutorial"

late hinge
#

i wanna know

#

like

#

how i make the system to set roles

#

and give each role perm

#

yk?

amber vale
#

The internet still does exist

late hinge
pure dagger
#

how to change player name above his head?

#

i know how to change list name

torn shuttle
#

green text? Advanced coding? Oh no we have a hacker in our midst

regal scaffold
#

I have a pregunta:

I need to access a method in API section of completely different plugin. Specifically the method that you can see below. I added the plugin that has the method as a maven dependency and I can access all the files. But how can I actually use the method below?

package io.github.beefdev.police.api.handcuff.manager;

public interface HandcuffManager {

    boolean isHandcuffed(Player player);

I can't just do HandcuffManager.isHandcuffed cause the method is not static, so how do I get an instance or what's the correct approach to this?

pure dagger
#

hespañol

tawdry echo
#

it is slot or rawslot numeration?

#

i mean inventoryclickevent

young knoll
#

You can't make an instance of an interface

regal scaffold
young knoll
#

There is a class that implements it somewhere that you need an instance of

regal scaffold
#

But then

#

Why does this plugin that I need to use the method from have a API module and a plugin module?

#

What's the point

torn shuttle
#

because anything implementing that interface will have that method

regal scaffold
#

Ok yeah so the class is

#

BaseHandcuffManager

#

And indeed it implements the class that has the method that I need

#

Ok so I've reached the main file from the plugin that I need to get an instance from

torn shuttle
#

probably not where you want to be

regal scaffold
#

It has a #getAPI method

#

That paths all the way down to the instance of the class that implements what I need

#

So how do I get the instance of a running plugin that doesn't have a static method?

young knoll
#

PluginManager#getPlugin

regal scaffold
#

That's what it was

#

Ok

#

I assume it's safer to get the instance onLoad() instead of onEnable()

#

To ensure that it's loaded, right
?

young knoll
#

Enable is called after load

regal scaffold
#

tf

#

I always thought it was after

#

Ok so onenable it is

wicked iron
#

hi all is anyone able to help me ban items on a server?

winged anvil
wicked iron
#

does that realy work?

wicked iron
eternal oxide
#

?1.8 as we don;t have a ?1.7.10

undone axleBOT
wicked iron
tardy delta
#

site down?

young knoll
#

Gem armor is a mod

#

Which means you have some cursed hybrid server

indigo frost
#

Hi I really need some help. I'm trying to send a message to the action bar, but for some reason the ChatMessageType is just not available. Like it asks me to create a new variable or create a new class. I just can't use it. I have spigot API as a dependency and every other thing I use from spigot works. Here is my code:

#
for(Player player : players){
            player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent("§bhi"));
        }```
#

players is an arraylist of players

sullen marlin
#

?bootstrap

undone axleBOT
#

Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.

Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163

indigo frost
#

I currently have spiot-api-1.16.5.jar

sullen marlin
#

Where did you get it from

vocal cloud
#

Wait are you not using maven?

sullen marlin
#

You need the -shaded version if you're not using maven/gradle

indigo frost
#

how do i get that, or how do i switch my project to maven/gradle?

undone axleBOT
sullen marlin
#

Idk @tender shard probably has a good tutorial

indigo frost
#

aight I will try that file, ty!

#

It works now tysm!

regal scaffold
#

Is it possible to add a delay to an action?
Like PlayerInteractEvent by 0.3ms

#

So like, force a slight lag?

eternal night
#

smallest unit would be 50ms

terse ore
#

one question, am I the only one when looping with x y z loops y x z?

eternal oxide
#

inner loop goes first

terse ore
#

wdym

eternal oxide
#
for (x...
  for (y...
    for (z...```
loops z then y then x.
terse ore
#

for (y...
for (x...
for (z...

#

I always do it like that

#

idk why

lost matrix
eternal oxide
#

do it whatever order you want, but inner loop has to complete before the outer can run

terse ore
#

it's the only thing that makes sense in my head

eternal oxide
#

y,x,z makes sense in a 3d space

terse ore
#

yay

dusk wedge
#

How do I go about cancelling the client side block break animation? I can control server-side sending to player using "Set Block Destroy Stage", but the client side overlaps with this. The effect I'm looking for is similar to hypixel mining/cosmicprisons.

young knoll
#

They give the player client side mining fatigue

dusk wedge
tender shard
#

good morning everyone

sullen marlin
tender shard
#

I love writing docs lol

vernal oasis
#

Does anyone know how to add color w/ holographic displays?

tender shard
#

so, sure

young knoll
#

MD is gonna make your write all future javadocs for spigot

regal scaffold
winged anvil
#

?paste

undone axleBOT
sullen marlin
#

0.3ms is literally nothing

tender shard
sullen marlin
#

did you mean 0.3 seconds

terse ore
terse ore
regal scaffold
vernal oasis
#

I mean, it does but I'm making a plugin with it as an api so color just show up as text like &7Test instead of being grey

tender shard
#

throw your text through ChatColor.translateAlternateColorCodes

vernal oasis
#

I'm not sure if doing ChatColor would work on it, I doubt it

#

Alright lets see

tender shard
#

btw des HolographicDisplays use NMS area effect clouds, or at least NMS armorstands? Because if not, you are better of just using spigot API

#

especially now that Displays exist

vernal oasis
#

I honestly have no clue

#

I'm using 1.19.3

tender shard
#

oh ok displays were added in 1.19.4

vernal oasis
#

how does ChatColor.translateAlternateColorCodes work?

tender shard
#

example:

vernal oasis
#

also should I be using the bukkit one or md5's?

tender shard
#
String text = "&cThis is red";
String translatedText = ChatColor.translateAlternateColorCodes('&', text);
#

translatedText now is red + "this is red"

vernal oasis
#

ah got it?

#

so not like this? lol

#

or would that still work

#

yeah nvm that would still work

tender shard
#

that looks ok to me

#

what is "hologram"? A Component?

vernal oasis
#

part of the Holograms Display PAI

#

API*

tender shard
#

ah ok, then no clue

#

I don't know how HolographicDiscplays works

vernal oasis
#

lol

#

tbh, neither do I

#

🤣

terse ore
#

im just confused

#
        System.out.println(minLocation);
        System.out.println(maxLocation);
        minLocation.getBlock().setType(Material.DIAMOND_BLOCK);```
vernal oasis
#

Holy shit it actually worked lmao

terse ore
#

but another one gets set

#

I love this

vernal oasis
tender shard
#

ofc it worked 😄

vernal oasis
#

oh yeah so Bukkit vs MD5's ChatColor?

#

is md5's better or what's different

tender shard
#

you mean bukkit vs bungeecord

young knoll
#

Use the bungee one

vernal oasis
#

yea

#

is bungee one better optimized or?

young knoll
#

It supports hex color

tender shard
#

rule 1: do not care about "optimized" but use whatever works

vernal oasis
#

if both work, then look at optimization

tender shard
#

do you need hex colors?

winged anvil
#

I'm trying to save items out to a .json file after serializing them to use later. This is so I can make a in-game item editor to make viewing items easier and other reasons I have. When I call CustomItems#saveItem() from my onEnable in the ChunkWars class it works perfectly. But in the SaveItem (CommandExecutor) class it gives me this https://paste.md-5.net/himoqosuha.cs. Here is the source code https://paste.md-5.net/qujotijuli.java. I've been going nuts all day. I don't want to use yaml but I will if I have to?

young knoll
#

Back when the bungee chat color was added to spigot MD said to use that

#

So I just use that

vernal oasis
#

probably not, but idk maybe in the future they'll want the that like gradient thing people are doing now

#

and those like boxes around the ranks that's weird

tender shard
tender shard
vernal oasis
#

yml annoying

tender shard
#

spigot's builtin ConfigurationSerliazable will do everything you are looking for

tender shard
vernal oasis
#

I didn't say it was bad

#

I just said it was annoying lol

winged anvil
#

yeah p much

vernal oasis
#

the spacing can easily get fucked and ruin everything and you not even know

tender shard
#

well all the alternatives like json etc are way more annoying

winged anvil
#

yaml it is ig

vernal oasis
#

apparently tabbing and spacing, and whitespaces are all different

tender shard
#

obviously yaml is nicer for admins to edit, while json takes 0.000127 seconds less to parse

#

however you only parse the file once, so who cares whether it takes 0.0000127 seconds or 0.0002 seconds

young knoll
#

Muh CPU cycles

torn shuttle
#

I'm an egalitarian, I make the main thread wait for 3 seconds for every file I load

#

it's not nice to discriminate

young knoll
#

You can slowly lower that every update to make yourself look like a master of optimization

regal scaffold
#

How can I add 300ms delay to something like an InteractEvent

torn shuttle
#

I call those premium features

#

runs 800% faster!

young knoll
#

Every $1 you give me i'll remove 100ms from the thread.sleep

regal scaffold
#

I can’t pause the entire plug-in

#

I just want to add delay to an action

young knoll
#

Well you don't have control over what actually happens after your event listener code

#

So the only easy solution I can think of is to just sleep the entire server

#

Which is of course, not a good

regal scaffold
#

Yeah I don’t need to cancel it either, just need to have my event listener have a bit of lag

torn shuttle
#

lol

young knoll
#

Do you want your code to lag

#

Or the server code to lag

quaint mantle
torn shuttle
#

that's not how that works, that's not how any of this works

regal scaffold
#

Ok so

#

What I’m trying to do

torn shuttle
#

is dumb

regal scaffold
#

I’m trying to have action stacking

young knoll
#

Because you can delay your handler code with just a bukkit runnable

#

But you can't delay the server's code

remote swallow
terse ore
#

does Location#add return a new Location or it just modifies the current x y z of the Location?

regal scaffold
#

Like hit stacking

#

It’s for a game mechanic

torn shuttle
#

probably could just clone the event itself somehow

remote swallow
#

Might just be me, but xy

#

?xy

undone axleBOT
terse ore
regal scaffold
young knoll
#

Aww

torn shuttle
#

the clone wars have begun

terse ore
#

k restarting let me try

remote swallow
#

Them darn starwarts be cloning again

regal scaffold
#

I’m making a volleyball game. When you hit the ball the first time it goes up. And while it’s going up, you can hit it a second time to have more power straight

remote swallow
#

Maps?

regal scaffold
#

But currently with no delay, it’s really hard to do, so if I add some lag to the event listener

#

I can take advantage of action stacking

remote swallow
#

You might be better just adding there name or uuid to a set and checking if its their before doing stuff

regal scaffold
#

That’s not the problem

#

The problem is since there is no lag, actually doing both hits in game is too hard because it’s way too responsive

#

So by adding a delay to the hit, you can 300ms more to move your crosshair a bit further up to be able to hit it correctly. Something that you can’t do without lag

young knoll
#

So make the ball slow down?

#

Like a bullet time

#

But with ball

torn shuttle
#

have you taken the fact that people do not have ping towards your server into account?

mystic monolith
#

So I just started making plugins literally today, and i was trying to make a plugin just to learn where when you break a block, the block you broke turns into dirt. For some reason, the block just drops dirt as an item instead of replacing the block itself with dirt, here's my code:

@EventHandler
    public void onBlockBreak(BlockBreakEvent event) {
        Block block = event.getBlock();
        block.setType(Material.DIRT);
    }
}
young knoll
#

Cancel the event

#

You may also have to wait a tick before changing the block if you cancel the event

mystic monolith
young knoll
#

Because cancelling the event stops the block from breaking

mystic monolith
#

so after which line should i cancel it?

young knoll
#

Doesn't matter

mystic monolith
#

and what causes it to break in the first place?

young knoll
#

Because you are breaking it?

mystic monolith
#

ok it worked and yeah that makes sense because its in the same tick

#

thanks

regal scaffold
#

I used a gif compressor online

#

And it literally increased my gif file size by 14%

rough ibex
#

well GIF is an awful format

regal scaffold
#

Yeah but I just thought it was funny when I saw the -14% compression

lost matrix
regal scaffold
lost matrix
#

Why do you need to delay it anyways?

#

Best you can do: Always cancel the event and replicate the outcome 300ms later

regal scaffold
#

I’m trying to have action stacking. Like hit stacking, It’s for a game mechanic
I’m making a volleyball game. When you hit the ball the first time it goes up. And while it’s going up, you can hit it a second time to have more power straight
But currently with no delay, it’s really hard to do, so if I add some lag to the event listener
I can take advantage of action stacking

The problem is since there is no lag, actually doing both hits in game is too hard because it’s way too responsive
So by adding a delay to the hit, you can 300ms more to move your crosshair a bit further up to be able to hit it correctly. Something that you can’t do without lag

lost matrix
#

Well... then just keep the ball in the air for half a second and count every hit it takes in that time

regal scaffold
#

Yeah could be an alternative

#

Or make the ball start going up slightly slower

#

And speed up gradually

#

But I feel like those micro adjustments aren't that efficient for our lovely java

lost matrix
#

I dont understand that statement... we have a tick based timescale. 20tps is 20tps. Doesnt matter if its being scheduled on C or Python or Java.

#

Anyways i would do the following:
If you recieve the ball then the first hit slowly moves the ball up regardless of where its
hit and the second hit defines the final direction of the ball. Or even N hits after the first one
are counted together to a final vector

regal scaffold
#

Ok yeah that's great

#

Thanks for drawing that up

#

Will get that working

#

It's interesting

livid dove
#

Less help and more "Rate my code" :L

Lands / CoreProtect Addon with the purpose of checking if players have had (roughly) 90 minutes of playtime or more in the last 30 days.

Idea was to streamline the process for a server that has the 90 min per 30 days as a rule for if land claims are to be deleted (but didnt want it to automatic deletion for obvs reasons)

cinder karma
#

I'm having trouble getting a straight answer on this: custom Minecraft player heads. I know Spigot doesn't allow them through some easy-to-use method (though I'm unsure as to why), but I'm having trouble understanding exactly how it works in Minecraft. All custom heads were heads worn by players at some point, then changed to something else, but still linger in the Minecraft database? Is that how it works?

young knoll
#

Yep

#

Also spigot does have an API method for them now

compact haven
#

In the first three clicks I saw an upper camel case package (Commands) lower camel case package (subCommands) and an upper camel case method (GetSubCommand or something)

cinder karma
young knoll
#

PlayerProfile

#

SkullMeta has setOwnerProfile

#

I believe the skull block state has something similar

cinder karma
#

Doesn't that only allow current player skins? I want a custom skin from a url

worldly ingot
#

No, you can create arbitrary profiles

young knoll
#

And set the skin via a url

worldly ingot
#

You can make a profile with a random UUID, then designate textures via the base64-encoded URL

young knoll
#

I think if you keep using a different uuid they won’t stack properly

#

I derive the uuid from the url

worldly ingot
#

That's a good idea, yeah

cinder karma
#

Am I mistaken that custom player heads are pretty common on Paper servers? Why is it so hacky to get a custom player head?

#

Just has nobody in Spigot thought it was time to make some simple way to do it (aka CustomPlayerHead(String url) and it generates its own false UUID, etc)

young knoll
#

I mean

#

It’s like 3 lines now

worldly ingot
#

It's really not all that complicated ;p

cinder karma
#

Could somebody point me to an example? Like how are you deriving a UUID from the url? etc

#

And do you have to store the UUIDs for each custom head?

young knoll
#

Wow copying stuff on mobile GitHub sucks

#

I’ll just post the link

cinder karma
#

I appreciate it, thank you, all google searches on the topic point to WILDLY outdated information

worldly ingot
#

The profile stuff is relatively new

#

1.17 I want to say

young knoll
#

I thought it was 1.18

worldly ingot
#

Somewhere around there

cinder karma
#

The 3 tutorials I found were all from 2016, and half the methods came back as deprecated, lol

young knoll
#

As for the value you pass to the method, it’s the base64 encoded url for the skin

#

I just grab it from minecraft-heads

#

Good site

cinder karma
#

yeah, I'm going through the one you linked

#

thank you so so much, very helpful

livid dove
regal scaffold
#

How can I automatically upload a compiled jar to this section using maven?

indigo frost
#

hi, im not quite sure why my code isn't working here. It's purpose is to fin all the players within a certain region and if they do not have the permission or if they are not part of the list of players called players, they are teleported somewhere. I know the issue is in the if statement comparing the player to the player in the list as if I remove it, it works with the permission if statement. Here is the code

                    for (int j = y1; j <= y2; j++) {
                        for (int k = z1; k <= z2; k++) {
                            for(int l = 0; l < Bukkit.getWorld(world).getPlayers().size(); l++){
                                if(Bukkit.getWorld(world).getPlayers().get(l).getLocation().getBlockX() == i
                                        && Bukkit.getWorld(world).getPlayers().get(l).getLocation().getBlockY() == j
                                        && Bukkit.getWorld(world).getPlayers().get(l).getLocation().getBlockZ() == k){
                                    if(!(Bukkit.getWorld(world).getPlayers().get(l).hasPermission("OPSeeker.*") || Bukkit.getWorld(world).getPlayers().get(l).hasPermission("OPSeeker.dungeons"))){
                                       for(int m = 0; m < players.size(); m++){
                                           if(!(players.get(m).equals(Bukkit.getWorld(world).getPlayers().get(l)))){
                                               Bukkit.getWorld(world).getPlayers().get(l).teleport(spawn);
                                           }
                                       }
                                    }
                                }
                            }
                        }
                    }
                }```
young knoll
#

Oh my

#

That is a lot of loops

indigo frost
#

ik lol

young knoll
#

Just loop the players and check if their x y and z fall within the bounds of the region

indigo frost
#

going through the x, y and z position of the player then going through the list of players in the world and the players in the list of players

young knoll
#

Spigot even has a class to help with this, BoundingBox

worldly ingot
#

You also really, really need to look into making variables

indigo frost
#

yes I did that, what I want is for people not in the list of players called players to be teleported

young knoll
#

Loop all players, check if they are within the bounding box, if not yeet them

indigo frost
#

that's what the code does

#
for(int m = 0; m < players.size(); m++){
                                           if(!(players.get(m).equals(Bukkit.getWorld(world).getPlayers().get(l)))){
                                               Bukkit.getWorld(world).getPlayers().get(l).teleport(spawn);
                                           }
                                       }```
#

it's this that doesn't work

young knoll
#

The reason the code doesn’t work is because a players x y and z will rarely exactly match an integer

indigo frost
#

coll

#

ur not listening to me lol

#

that part works

#

its the part after the permission if statment that doesn't

#

if I remove after the permission id statement, if you have the permission it doesn't tp u, if u dont it does

worldly ingot
#

The point is that the way you've implemented it is wildly inefficient. You are

  1. Iterating every single block in your region
  2. Iterating over all online players to see if their coordinates match one of the blocks
  3. Iterating over all online players a second time to check if they equal the first player you're iterating over
indigo frost
#

for 3 I dont do it a second time

worldly ingot
#

but you do though

indigo frost
#

the players arraylist only has 1-4 players in it

worldly ingot
#

oic you have a players list

#

See this is why variables are important

young knoll
#

You still add them to the list and then loop over the list

indigo frost
#

players is a list of people who can enter the region, if a player is not in the list or if they dont have the specified permissions, they are teleported out

young knoll
#

It’s still widely inefficient

#

You only need a single loop to accomplish this

indigo frost
#

that's not the problem rn lol

#

I can clean up the code later

#

rn i want to know why the code I have isn't working

young knoll
#

You’ve check that the teleport line is being called I assume

#

By adding a sysout or something

vernal oasis
#

Why does it print out /points after I type a command?

young knoll
#

Return true instead of false

#

Returning false makes spigot print out the usage for the command

vernal oasis
#

thank

sacred wyvern
#

I've read you can spawn NPC Player entity's. Has anyone else done this yet? I'm wondering how they act, as if it's a Friendly mob or a Villager AI?

young knoll
#

They do nothing

#

You need to make your own ai for them

subtle kite
# regal scaffold Will get that working

idk what your doing , but Look at a game called Rocket league.

Or a Overwatch custom gamemode by
Genji Dodgeball- Mazawrath <- this is open source , I think.

sacred wyvern
plush pebble
#

What is the difference between a BlockState and BlockData?

desert frigate
#

Does anyone know why some of the items are going in a random direction? Some go towards the armor stand and some go to the opposite. it does eventually go back to the armor stand but its really weird.

// location = location of the armor stand
//item = each item
// speed is a number based on the distance of the item
item.setVelocity(location.subtract(item.getLocation()).toVector().normalize().multiply(speed));```
sacred wyvern
#

With minecraft server rental companies. I see that it allows you to upload Spigot plugins to the server for use, do you know if it allows for existing config files to be uploaded as well or do they have to be generated on the rental server?

rough ibex
#

Depends on the company.

#

I believe most do allow upload.

sacred wyvern
#

Cheer's I wanted to create a custom Java application that allows for creation of the config file as I have a lot of user commands.

sullen marlin
#

?xy

undone axleBOT
rapid topaz
#

?paste

undone axleBOT
sullen marlin
#

Idk look for a getter or something

warm mica
#

You should start first by thinking which format you want to use. Secondly whether there is already an included Java implementation (likely not). Include the required library to your program. And lastly read its docs or read through some examples

viral temple
#

do I have to get a player's Connection class with reflections in 1.19?

warm mica
indigo frost
#

How would I change the text value of a sign at a certain location?

viral temple
#

that sucks

sullen marlin
indigo frost
chrome beacon
#

He's telling you to cast the block state to a sign

#

Then use the sign object to set the line and then update it

indigo frost
#

i got that part

#

the #'s confuse me

chrome beacon
#

or :: are usually used to indicate methods

#

The reason for that (as far as I'm aware) is because # is used in javadoc links

warm mica
viral temple
#

or should I rebuild spigot again?

warm mica
#

ServerPlayer#connection

#

I am accessing it myself directly

chrome beacon
#

They are too

viral temple
#

guess i'll have to re-run buildtools again

chrome beacon
#

You already are accessing it fine

#

but you try to get the connection from the connection? For which there exists a getter (at least in 1.19.2.. where the field was still public)

indigo frost
#
        <sign>#setLine;
        <sign>#update();```
#

im so confused lol

chrome beacon
#
Sign sign = (Sign) World.getBlock(new Location(Bukkit.getWorld(world), -49, 64, -231)).getState();
sign.setLine(<stuff>);
sign.update();
sullen marlin
#

?learnjava

undone axleBOT
indigo frost
#
        int minutes = time / 60;
        int seconds =  time % 60;
        for(Player player : players){
            player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent("§cTime left: §b" + minutes + ":" + seconds));
        }
        Sign sign = (Sign) Bukkit.getWorld(world).getBlockAt(new Location(Bukkit.getWorld(world), -49, 64, -231)).getState();
        sign.setLine(1, "§cTime left:");
        sign.setLine(2, "§b" + minutes + ":" + seconds);
        sign.update();
    }```
#

it doesn't change the sign at all

viral temple
chrome beacon
#

You yourself showed that the field is accessible

viral temple
#

i'm trying to get the so called "NetworkManager"

#

so I can listen to packets

indigo frost
#

wait I fixed it omg

#

ty @chrome beacon u and md helped a lot

near crypt
#

how can i use the worldedit api?

#

because ive added the repositories and dependencys but its underlined red

chrome beacon
rough drift
#

What world does spigot place the players in if player data saving is off? The first world loaded?

chrome beacon
chrome beacon
rough drift
#

Default world?

chrome beacon
#

You specify a world name in the server properties. The default world would be the overworld

rough drift
#

ah

#

Well thanks

near crypt
eternal oxide
#

Mojang auth servers being a little bitch this morning?

chrome beacon
#

Had no issues

eternal oxide
#

must be a local issue then

viral temple
#

💀

chrome beacon
#

You can use screamingsandals to find the correct unmapped name or disable the mappings and check

viral temple
#

Too much technical for only one packet to listen to

chrome beacon
#

Could just use Protocollib or PacketEvents

tawny remnant
ocean hollow
#

Help please, I create an object and save it. But when I try to interact with it, nothing comes out.

#

I even checked manually, when comparing locations, the same values, but it still gives null

tardy delta
#

locations do not have reference equality

#

depends but try to use equals

ocean hollow
#

like that?

#

wow, thanks. I spent so much time on this

tardy delta
#

and probably want to use a map

viral temple
tender shard
#

IJ sucks more every day. E.g., why doesn't it tell me WHERE this thing is?

patent socket
#

So in my command I have this code: player.sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(this.word)); Player is an Entity variable so it can be @p or MyName. I get this error message for the code. How can I resolve it? no suitable method found for sendMessage(net.md_5.bungee.api.ChatMessageType,net.md_5.bungee.api.chat.TextComponent)

tardy delta
#

zero width space lol

tender shard
tardy delta
#

player.spigot().sendMessage()

pseudo hazel
terse ore
#

is it normal that when I set an ArrayList to a path it doesn't get indented?

tender shard
ivory sleet
#

That’s acceptable

terse ore
#

okok

patent socket
pseudo hazel
patent socket
quaint mantle
#

Why am I getting this args error?

tender shard
tender shard
#

args[0] = first, args[1] = second, args[2] = third, args[3] = fourth element

quaint mantle
#

args[0] is "mobsword" args[1] is "give" args[2] is the player and args[3] is amount

ivory sleet
#

/command args[0] args[1] args[2] … args[n-1]
n is argument amount

pseudo hazel
#

the command name itself is not an argument

quaint mantle
#

I didn't say it was

pseudo hazel
#

okay

quaint mantle
#

the base command is "grindaddons"

pseudo hazel
#

well are you sure you typed it correctly?

quaint mantle
#

Yep

pseudo hazel
#

okay, print args there and see what t says

quaint mantle
#

Yes there is

tender shard
#

no, there's not. you literally sent the error message 2 minutes ago

#

where it says that 3 is out of bounds

quaint mantle
#

How is there no args[3]

tender shard
#

because you entered less than 4 arguments

ivory sleet
#

vexx you access args[3] even though u never check that the argument length is 4

pseudo hazel
#

just print args and see what it says

tender shard
# patent socket So why doesn't it work?

I already told you, because you throw in a ChatMessageType and a BaseComponent into a method that has a different signature. Use the proper method from Player.Spigot

tender shard
pseudo hazel
#

yes but I think thats just their way of determining what command was used

ivory sleet
#

Doesnt make sense still

pseudo hazel
#

but like, atleast return then inside the if

#

so yeah the issue is probably that you tried the first command but you forgot to return after its done

ivory sleet
#

First command?

#

It looks like an error message function given incorrect usage

quaint mantle
#

Yeah it's usage, It's my args messed up

#

They blag my head sometimes

#

I'm now getting out of bounds for the args[1] but i'm checking for args with the if statement no?

ivory sleet
#

What u need is this

#

if (args.length > 4){
yellAtUser(sender)
return;
}

#

return terminates the function scope

quaint mantle
#

Yeah it was legit bcos I forgot to return the args check

pseudo hazel
#

yes

#

or else if

#

would also work in this case

quaint mantle
#

Yh

pseudo hazel
#

but return is more scalable

terse ore
#

how do I change nether portal direction?

ivory sleet
#

since you avoid nested logic

#

Scalability refers to sth else usually

tender shard
terse ore
#

this will explain better

#

I am setting the inside of a portal but

ivory sleet
#

Orientable iirc

#

Block data

terse ore
#

java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_19_R2.block.CraftBlock cannot be cast to class org.bukkit.block.data.Orientable

#

((Orientable) block).setAxis(Axis.Z);

#

is this wrong?

tardy delta
#

blokcstate probably

#

check docs

ivory sleet
#

BlockData

#

I said it already

#

(Hint: Orientable is from the org.bukkit.block.data package)

terse ore
#

ill keep trying then

ivory sleet
#

block is not blockdata

#

block is block

terse ore
#

oh

#

I got u now

ivory sleet
#

Pog :)

ocean hollow
#

Can I get the name of the block that was placed?

#

like BlockPlaceEvent, e.getBlockthatPlaced();

pseudo hazel
#

you mean the material?

ocean hollow
#

no

pseudo hazel
#

you mean a name you set on the item lore?

lost matrix
#

Blocks dont have a name

pseudo hazel
#

if so thats not possible

#

since all of that data is just lost when placing the block

ocean hollow
#

Let's say I have a quartz block called "Custom block". And put a custom block, not quartz

pseudo hazel
#

well yeah

#

the game will say fuck that and places a quartz block

lost matrix
#

Then after placing this block its a plain old quartz block

young knoll
#

Unless you use something like a database to store it

#

Or Alex’s block pdc lib

lost matrix
#

You need to store custom data for that location. Mfnalex has a resource for that.

rose trail
#

Help how to add the library to the plugin, because the server is starting, it throws an error: java.lang.NoClassDefFoundError: mc/obliviate/inventory/InventoryAPI

rose trail
#

Maven

lost matrix
#

You need to use the maven-shade-plugin for that

#

?paste

undone axleBOT
lost matrix
#

Here is an example pom

#

Dont forget the <provided> tag for spigot and every dependency you dont want to shade

terse ore
#

one question guys, is there any license that allows to do whatever you want with my code but need to give credit?

lost matrix
#

Does GPLv3 need the user to give tribute?

rose trail
terse ore
#

okok ty

quaint mantle
#

?paste

undone axleBOT
quaint mantle
#

https://paste.md-5.net/vuberegoni.cs & https://paste.md-5.net/epejopagun.cs <-- I'm trying to update an item inside an inventory on click. It's working but it's not updating when I'm in the inventory I have to close out and then open it again to see the change. Any way I can visually update on click? I've done it in the past but I've checked my old code and I literally use the same method i'm using now...

terse ore
#

I did it a couple months ago tho

ivory sleet
#

Sure

terse ore
ivory sleet
#

What kind of feedback do u want?

terse ore
ivory sleet
#

Ah alr, quality wise and relevance that is?

terse ore
#

yeah

ivory sleet
#

Alr alr sure

terse ore
#

I am trying to get better at OOP and Java in general

ivory sleet
#
  • Implicit else/guarded clauses over nested if statements if possible
  • Use this and super if possible to clarify instance method calls and instance field accesses
  • Personally would not use shortcut names and abbreviations like Inv (your main class as an example)
  • I’d add Listener to the names the two classes that implement Listener as to clarify their purpose on a high level.
  • Title inventory identification is not ideal, so avoid and use == to compare inventories directly, or use InventoryHolder.
  • loadEvents() can be a private method, as by a means of defending it from being called wrongly. But good method I like that you did it, many plus points.
  • I would use Plugin#getServer() and depend on Server over the Bukkit if possible. Since that leads to more unit testability and object orientation.
  • Color is a utility class, can be final.
terse ore
ivory sleet
#

Sure

tardy delta
ivory sleet
# sullen canyon I hope it is okay if I ask you to give a feedback for my code https://github.co...
  • int over Integer
  • Use this and super when accessing instance fields or invoking instance methods to clarify.
  • Avoid indirect injection, for instance when u inject data by a method call in the constructor as player.getUniqueId(). Since its less unit testable and your code hides what it actually depends on. If you want default values for your fields, or want to avoid long parameter constructors, use the builder pattern as suggested by effective java.
  • Some of your functions are quite huge and large, that makes them less readable and a bit messier, try to extract out smaller functions. This gives the reader the ability to exit early in an abstract sense a function must only do one single thing, which is defined when you cannot meaningfully extract out another function, take this rule with a pinch of salt tho.
  • PlayerData is a data transfer class I would re-design it such that creation logic is in another class (if its complicated). I would also put the storage save/load logic in another class as you currently break single responsibility principle.
  • try-with-resources can be used for PreparedStatement.
  • Looks like unnecessary reflection is being used.
  • Your comments there are redundant, instead you can do something like:
boolean isWinning = this.getStreak()>1;
if (isWinning){
   …
}```
#

(Speaking of readability, defining functions such as decrementStreak() and incrementStreak() might be nice as it adds fluency)

late hinge
#

yo guys i want to cancel the drop animation then i made this, but the item it's becoming in Material.STONE

   @EventHandler
    public void dropItem(PlayerDropItemEvent e){
        e.setCancelled(true);
        e.getItemDrop().setItemStack(new ItemStack(Material.AIR));
    }
sullen canyon
late hinge
lost matrix
late hinge
#

i meant i don't want to let the item dropped on the floor

#

yk

#

i just want to obliterate it

lost matrix
#
event.getItemDrop().remove();

Without cancelling the event

late hinge
#

lemme see

#

bro

#

I've been trying to do this for hours

#

thx

tardy delta
#

ah cmon

#

fields(table, type.params[i], i == 0 ? p1 : i == 1 ? p2 : i == 2 ? p3 : i == 3 ? p4 : p5, i == 0 ? v -> p1 = v : i == 1 ? v -> p2 = v : i == 2 ? v -> p3 = v : i == 3 ? v -> p4 = v : v -> p5 = v).width(100f);

rotund ravine
# tardy delta `fields(table, type.params[i], i == 0 ? p1 : i == 1 ? p2 : i == 2 ? p3 : i == 3 ...
Object parameter;
Consumer<Object> consumer;

if (i == 0) {
    parameter = p1;
    consumer = v -> p1 = v;
} else if (i == 1) {
    parameter = p2;
    consumer = v -> p2 = v;
} else if (i == 2) {
    parameter = p3;
    consumer = v -> p3 = v;
} else if (i == 3) {
    parameter = p4;
    consumer = v -> p4 = v;
} else {
    parameter = p5;
    consumer = v -> p5 = v;
}

fields(table, type.params[i], parameter, consumer).width(100f);
tardy delta
#

could even use a switch

lost matrix
#

A switch with integers can get compiled to a lut by the compiler.
So probably better to use a switch

hazy parrot
#

What is lut

lost matrix
#

look up table

tardy delta
#

probably

lost matrix
#

for small integer values its O(1) and for large its O(log(n))
Latter is done via binary search

hazy parrot
#

Oh cool

tardy delta
#

oh god this man generates his classes and my refactored things get overwritten

lost matrix
tardy delta
#

also need that id

lost matrix
tardy delta
#

hmm smart

#

that seq isnt even used lol

livid dove
#

Idiotic question but ive never mucked around with permissions before. By setting the permission within the plugin.yml is that all thats needed? No checks within the code or?

worldly ingot
#

Depends on what permission you're talking about

#

If you mean for a command, yes that's all you need

livid dove
#

Sweet

#

So this is guci?

worldly ingot
#
commands:
  foo:
    permission: plugin.command.foo # Automatically checked for before the command runs

permissions:
  some.other.permission: # Must be checked manually with permissible.hasPermission("some.other.permission")```
kind hatch
# livid dove

I'd make it lowercase to follow the standard, but yea.

worldly ingot
#

Permissions are generally lowercase, but yes, that is fine

#

It will also hide the command from tab completion of players that don't have the permission

patent socket
desert frigate
#

someone ghost ping?

worldly ingot
full holly
mellow pebble
#

does anyone know how can i add custom textures to my guis like shown in this preview

slate mortar
#

if it's gui's like inventories, i'd say server-resourcepacks

mellow pebble
#

but how do i implement it in my code

remote swallow
#

unicode chars

rough ibex
#

a custom font

slate mortar
#

if you just wanna change the font, you just use any unused (well, kind of unused) font schemes that are present in vanilla

#

you can then use these font characters to draw whatever you want

rough ibex
#

you texture some private use characters (\ue000 through \uf8ff)

#

never retexture random chinese characters

slate mortar
#

there arent just chinese characters

#

there are latin and shit, that are 99% never used lol

rough ibex
#

never retexture characters for your own purposes

#

if unicode already defines them

#

this is what the PUA is for

remote swallow
#

im pretty sure theres some un-used unicode chars in the game people can use

rough ibex
#

use negative spaces to adjust the horizontal metrics

#

and then 'ascent' for vertical.

slate mortar
rough ibex
#

because it's not right? you're not supposed to use some random icon in place of \u0234 ȴ

slate mortar
#

if its unused anyway, no one frickin cares

rough ibex
#

why are you against this

#

it's just asking them to use the characters already provided for this specific purpose

slate mortar
#

also i never said i'm against it
i am against people claiming "dont do X, because it's not how you are supposed to do it", but that may just be me ._.

rough ibex
#

consider the following

#

it's not how you're supposed to be doing it

slate mortar
#

i personally think "if it works, it works", i dont care about some random guy saying "dont do that, there are better ways"

#

again

#

may just be me

rough ibex
#

yeah except unicode is a standard meant to unify and avoid the problem of characters being different across machines

#

like, to avoid this exact thing

slate mortar
#

because to me it sounds like doing it would make your pc explode

rough ibex
#

because it's against the standard and a very bad idea

slate mortar
#

exactly what i said lol

rough ibex
#

just use \ue800-\uf8ff 😭

worldly ingot
#

Arbitrary UTF characters are seldom used, but they can be used. If you have an oversized texture and someone finds that latin char (which they can do by looking at your server's resource pack, not hard), your chat is suddenly filled with very, very large images

#

They should be under a different component font

kind hatch
#

If you re-texture chinese characters, people who use the chinese font as their default will not see their expected language but a random image instead.

slate mortar
rough ibex
#

isn't arguing fun

kind hatch
#

So use the empty characters provided by unicode.

slate mortar
#

let's be fucking honest

rough ibex
#

you are using it right now

slate mortar
#

i dont mean latin-de

#

or whatever exists

#

idk if it even is latin

kind hatch
slate mortar
#

its some weird one that isnt even a "language" as we know it, but idk which one it was

#

lemme see

rough ibex
#

U+0061 : LATIN SMALL LETTER A odd how that is

tender shard
#

"Dele" is wrong though