#help-development

1 messages · Page 828 of 1

charred blaze
#

how can i configure that

worthy yarrow
#

So is the point to reduce the mute duration??

lost matrix
#

So if you got muted by litebans, you can unmute yourself by spamming messages in chat?

charred blaze
knotty aspen
#

I feel like "player tries to bypass mute with book" would be an easy tempban lol

lost matrix
#

That is the most utter rubbish i have heard in a while...

charred blaze
#

im also checking swearing/advertising in books, signs

knotty aspen
#

Why bother with trying to prevent that, just yeet the player

worthy yarrow
charred blaze
#

well my english is not perfect

lost matrix
worthy yarrow
charred blaze
#

or i explained it wrong

#

hm

worthy yarrow
#

eek

#

litebans overwrites the current mute time?

charred blaze
#

as i know

worthy yarrow
#

So you're trying to prevent the fact that it will reduce the time muted yes?

charred blaze
#

yeah

lost matrix
#

Ah i understand what you mean now.
So your code should be something like this:

if(!litebanAPI.isMuted(player)) {
  litebanAPI.mute(player);
}

(Pseudocode)

worthy yarrow
charred blaze
#

or maybe i will just check if litebans has setting not to override mute durations xd

steel swan
#

Little question, would you guys know how to generate a world with no big patches of water?
I already put the world sos that it only generates dark forest biomes but i still have big patches of water

twin venture
#

how would i handle transfering data bettwen :

  • Game server
  • Lobby server

i have an idea but not sure if its correct :
in game server , when a player kill someone for example or win a game .. etc , it will increase the [local stats for the SWUser instane] by 1 , and when a game end before sending the users of the game to the lobby server , the game moudle plugin will save the data to the global stats in mysql server and when a player is loaded in the lobby server moudle plugin , it will load the data with the new kills

lost matrix
charred blaze
#

what about this idea

worthy yarrow
lost matrix
charred blaze
worthy yarrow
#

they should be removed from muted.yml when the mute duration is over

#

not when they send a message and they are allowed because the mute is over, it should be directly correlated with the mute duration instead

lost matrix
charred blaze
minor junco
worthy yarrow
charred blaze
#

will it break something? hm

charred blaze
twin venture
worthy yarrow
#

I think you should just rely on the litebans api to handle muting durations and what not, theres no point to make extra work storing/handling mutes/bans/etc when litebans already does that for you

minor junco
#

@charred blaze just store the player id with the Unix timestamp of when they finish their punishment. Have a Bukkit task constantly checking against online players (or even better have it tested when a player chats or a player runs a command for whether a certain player is muted or not)

#

It's a very simple overall thing to do, but maybe I misunderstand what the issue is

charred blaze
#

yeah that could work, but why is my idea bad

minor junco
#

Can you quote your idea?

worthy yarrow
charred blaze
#

yeah

minor junco
#

well ain't an issue, you just check if the player is already in the map of muted players. If true -> add the input duration to the already existing Unix timestamp

charred blaze
worthy yarrow
minor junco
#

Small Lifehack: use Duration from java util time

#

With this you can easily add and translate Unix timestamps

worthy yarrow
#

^ and really simple implementation as well... I'd think it should be at most 20 lines

charred blaze
lost matrix
#

Listening to the chat event > scheduling

minor junco
minor junco
charred blaze
minor junco
#

That's what I meant

lost matrix
#

Storing player names is never good 🙂

minor junco
#

But make a centralized method for removing a player from the muted map, so you can easily test on multiple events

charred blaze
#

centralized method? wdym

minor junco
#

As in don't put your remove and caching logic in the listener, but outside in a sperate utility / handler

minor junco
#

So you don't have code duplication?

charred blaze
#

so will my idea basically work?

minor junco
#

Easy access, easy debugging and every benefit that comes from no code duplication

charred blaze
#

what else is there to think

#

that could break that system

worthy yarrow
#

A method accessible to your plugin... one that will follow something like:


MutedMap = litebans mutedmap;

return mutedMap
}```

I believe something like this would give you access to mutedmap.add/remove
charred blaze
#

uhh ok

worthy yarrow
#

I don't know how litebans api works though, although the mutedmap could just reference the way litebans handles muted players

charred blaze
#

what

#

im doing this to not use any of punishment plugin api

quaint mantle
#

Guys

worthy yarrow
#

therefore centralized method to handle player cases related to if they are muted or not

quaint mantle
#

I found a good way to mute chat

worthy yarrow
worthy yarrow
charred blaze
#

is there any method like .canWriteInChat?

quaint mantle
#

I mean you can also just cache

worthy yarrow
# charred blaze is there any method like .canWriteInChat?

you would use the asyncplayerchatmessage event I think and use check statements to determine if the player is muted or not and based on their chat you can also check for what their message is in order to implement antiswear logic then use the chat event to handle some player muting cases if you wanted to

charred blaze
#

can i like

#

force player to type message

#

and

#

check if its sent

worthy yarrow
#

You can force a player to send a message yes and then use the playerchat event to check if that string is the message you're looking for

charred blaze
#

hmm k

quaint mantle
#

Wait what are you even trying to do @charred blaze

chrome beacon
#

Trying to check if someone's muted

chrome beacon
#

without hooking an api

worthy yarrow
chrome beacon
#

Yeah

#

but they don't want to hook the API for some reason

worthy yarrow
#

And for some reason can't understand that without using litebans, you cant check for a player mute unless you write that logic out yourself D:

quaint mantle
#

Just use the api

#

lol

worthy yarrow
#

exactly D:

quaint mantle
#

worst case just access the db yourself ig

worthy yarrow
#

Thats why it was suggested to use a centralized method for returning the mutedmap or whatever litebans uses to handle mutes

minor junco
#

ye, always try and use the API first. Or just implement it by yourself

#

Mute system is really easy to do with enough knowledge

worthy yarrow
#

tbf mute logic is really simple

minor junco
quaint mantle
#

Nah fr

#

how I made my mute system was easy

minor junco
#

It's like 20 loc

worthy yarrow
quaint mantle
#

I stored my info in some random zombie's pdc

minor junco
#

Exactly

#

Lmao

quaint mantle
#

I got a zombie worth 80mb rn

minor junco
#

Why tho 😭

quaint mantle
#

good system

worthy yarrow
#

80mb zombie...

#

how do you even handle that

minor junco
#

What if the zombie is being deleted

worthy yarrow
#

yeah

#

how long would that take

minor junco
#

I would suggest using a database or config over a zombie 😭

#

That's like the last thing that would come to my mind

worthy yarrow
#

@minor junco using the basic p.haspermission should work with any perms plugin right?

minor junco
#

Ye

worthy yarrow
#

What's the point of adding specific support? for example luckperms

#

more accessibility related to permissions or what?

minor junco
#

I assume to access groups and parents and stuff

worthy yarrow
#

Is it really necessary then?

#

in my mind a perm node is already pretty secure...

minor junco
#

It's like luck perms is a wrapper around Bukkit permissions, so the core should work with default perms, but if you want to check on a higher level you'd need to access the api

worthy yarrow
#

Hmm I see

minor junco
#

That's just me assuming from my standpoint, I might be wrong but that would really surprise me

worthy yarrow
#

I mean I'd imagine there are only some rare cases where the permission needed to be accessed like that...

minor junco
#

yup

#

I assume you also get some perks and quality of life improvements by accessing luck perms API

#

As in code wise I mean

worthy yarrow
#

Perhaps adding permissions based on mechanics or something like that?

minor junco
#

yeah idk

worthy yarrow
#

Then you'd need to have a perms api I think

#

unless you do it yourself but like..... who does that anymore

minor junco
#

I mean I kinda just made a little wrapper for my plugin

minor junco
#

W/o adding or removing tho

worthy yarrow
#

Yeah that's fair it's always nice to have access

quaint mantle
#

that would be so funny tho

minor junco
#

Just lookup with array element asserted paths

quaint mantle
#

entire server gets unbanned because a zombie died LOL

minor junco
#

My assertions checks like against empty permission segments and what not, just a nice to have

worthy yarrow
#

.... you're using an 80mb zombie to handle player bans?? D:

quaint mantle
#

Nah I actually upgraded

#

now I made a separate world

#

it's a void world, but 1 cobble stone is a 0, and 1 stone is a 1

minor junco
#

ArrayPath is an implementation that is general use and has an internal array with a bunch of optimization

kindred sentinel
#

I have a string with Tag section, so how to get section of Tag using that String?

#

Like String a = "LOGS" i need to get Tag.LOGS

#

Tag it's interface btw

minor junco
#

But again, just lookup nothing too fancy

minor junco
kindred sentinel
#

No

#

It's interface of bukkit

minor junco
#

Then you can't do what you're trying to

#

Without bytecode manipulation

kindred sentinel
#

oh

minor junco
#

I assume what you're trying to do is create a static variable in Tag that references your LOGS Tag?

kindred sentinel
#

No

#

I have string like "LOGS"

#

and in Tag there is a Set in Tag.LOGS

#

I want to get this set

#

It's only theorically, the string is always different

minor junco
#

I can't help u with that, sorry

worldly ingot
#

don't use the constant names, use the tag's id

#

This API is expected to be deprecated some time in the future and have a better replacement, but it works still

#

Tag<Material> logs = Bukkit.getTag(Tag.REGISTRY_BLOCKS, NamespacedKey.minecraft("logs"), Material.class);

worthy yarrow
worldly ingot
lost matrix
#

The Tag

worldly ingot
#

Tag.LOGS. User wants runtime tag fetching though

lost matrix
#

Ah

clear elm
#

?learnjava

undone axleBOT
clear elm
#

how can i create normal java projekt?

lost matrix
#

*This is without maven btw

clear elm
#

what

lost matrix
#

Just type in a name and click create...

clear elm
#

bro in yt tutorial has this menu

lost matrix
#

Older version of IJ

clear elm
#

now he has this:

#

and i have this

lost matrix
#

He created a normal java project

clear elm
clear elm
lost matrix
# clear elm

You created a java project which has maven as its buildtool

clear elm
#

how can i create without maven

clear elm
#

i did

clear elm
#

u german?

lost matrix
# clear elm and i get this

Not possible. You probably had the Build system on Maven instead of IntelliJ
Try again and make sure you select the right Build system.

clear elm
#

okay

#

i selected inteliJ

lost matrix
#

Perfect. Now you have a vanilla java project.

clear elm
novel sigil
#

hi

clear elm
#

but why his looks different

clear elm
lost matrix
novel sigil
#

bro

minor junco
#

Typescript >>

lost matrix
clear elm
#

damn i saw ty for help!

novel sigil
#

the ui-utils mod allows me to dupe on my plugin, the de-sync thingy makes it not recieve slot clicked event, how can i avoid that happening

novel sigil
#

1.19.3

clear elm
#

@lost matrix u german?

#

bc of this : flogestankbratwurst

minor junco
#

Wild name

lost matrix
# novel sigil 1.19.3

Cancelling the InventoryClickEvent should prevent any clicking on the item, regardless of client synchronization.

novel sigil
#

yea

lost matrix
novel sigil
#

lemme send gif

clear elm
#

lol im german too

lost matrix
#

*Predicting a gif with creative mode

lost matrix
novel sigil
#

ah

#

i dont have media perms

lost matrix
#

Verify or upload somewhere

novel sigil
#

InventoryClickEvent using that event

#

de-sync literly closes the ui but keeps it open

lost matrix
#

Shouldnt matter. Item creation is completely server sided. If the event is always cancelled, then there is no chance for a client to do anything to this inventory.

novel sigil
#

oh

#

i can prove that it's not a ghostet item

#

i lterly logged out

#

and its still there

lost matrix
#

Are you in creative mode?

novel sigil
#

yea

lost matrix
#

...

slender elbow
#

creative inventory is entirely controlled by the client

novel sigil
#

ok

#

survival and it's still there

lost matrix
#

Creative mode is fked because it allows client authoritative item creation

lost matrix
novel sigil
#

ok

#

hmm

#

it gets removed

#

okay

#

so is there any other dupe i need to fix?

lost matrix
#

If you cancel the InventoryClickEvent, then there is no duping happening.

#

*Unless you introduce dupes with faulty code,

slender elbow
#

also drag event

#

that brings surprises every now and then :D

novel sigil
#

ok

#

lemme try using mouse drag tthingy

lost matrix
#

Myeah, it doesnt get fired if the click is cancelled.

novel sigil
#

nah it's fine

slender elbow
#

they are independent events afaik

novel sigil
#

yea

lost matrix
#

Sure, but if the click was cancelled, then the drag cant be fired.

novel sigil
#

for anti cheats, what mod would you recommend?

torpid blaze
#

Hey,
I want to unload a world when all players left it and this without saving it.
So I used Bukkit.unloadWorld(bukktiWorldObject, false);
But this returnes false. I also tried doing it inside a runTaskLater to run it 20 ticks after the last player left so they are realy gone, but still not working.

Anyone any Idea?

smoky oak
#

If B extends A and both have a {} pre constructor, which runs first?

#

and if it's A is there a way to make some code in A run after the initialization of B finished without specifically calling it?

glad prawn
#

not extends constructor yk

smoky oak
dry hazel
#

superclass constructors and initializer blocks always run before subclass ones

hazy parrot
#

Superclass is initialized first

smoky oak
#

figures lol

sterile token
#

Yoo, my code doesnt make sense because the same code works perfect on the other method. Whats actually happening?

smoky oak
#

cuz ur values in the 1st is the class attribute and in 2nd its the given Map<?,?>

sterile token
#

just realzied bruh the issue

river oracle
#

Why use Map<?, ?> instead of proper generic types

sterile token
#

its a messing issue around variables between values from memory section and Map<?, ?>

#

im too dumb haha

smoky oak
slender elbow
#

super() is called first, then the init block, then the rest of the ctor

smoky oak
#

ah i see

slender elbow
#

well, init blocks

#

you can have multiple :^)

smoky oak
#

on an entirely different topic, how do i make an anonymous class extending an abstract class inline again?

#

if i try 'new that' its not giving me the option to expand it

#

only saying 'make that not abstract'

slender elbow
#

new AbstractType(...) {}

#

it isn't limited to abstract types fwiw

smoky oak
#

eh thats the situation i found myself in

slender elbow
#

huh

smoky oak
#

like

#

the class doesnt have any abstract methods

#

thats just there that you realize 'making an instance of this class doesnt make sense'

#

side noet

river oracle
smoky oak
#

whats the access modifier for 'this class and classes extending it'

#

protected, right?

river oracle
smoky oak
#

a yes wouldve sufficed lol

river oracle
#

thought you might need a refresher on all of them 🤷‍♂️

smoky oak
#

nah, i remember the rest

#

its just that i never use that one

#

except right now i guess

#

its the method registering specific things that should REALLY be done in the class registering it, or the whole point of the class is gone

#

also prevents stuff from ending up where it shouldnt

#

on another unrelated side note, is the 'empty class' (like, the class that just contains a method) possible for main only, or for other classes as well? There's something that should REALLY be done in a different class, but is one giant method

clear elm
#

public class main {
public static void main(String[] args) {
double temperatur = 25.5;

    if (temperatur >20 ); {
        System.out.println("Angenähm");
    } else {
        System.out.println("Kalt");
    }
}

}

#

i get error java else without if

hazy parrot
#

;

#

You added ;

#

After >20)

clear elm
#

ohhh ty

glad prawn
smoky oak
hazy parrot
#

Tbh having class called Setup seems a little weird to me

smoky oak
#

well yea

#

im registering a bunch of things there, it initializes objects of another class and pools them

#

hence the question

#

there a way to just have one big method

#

as as separate file i mean

torn badge
hazy parrot
torn badge
smoky oak
#

java<some recent version> can do void main(){} as the only text in a file

hazy parrot
hazy parrot
#

As main goal of that jep is to make it easier for students

torn badge
smoky oak
#

well i dont care how its named?

#

its a single method class anyway

clear elm
#

Java makes fun :))

torn badge
#

I don’t know any way to have a method outside a class

inner mulch
#

if i have a kind of object, how do i get the constructor of this object's class and create a new instance of it?

dry hazel
#

you mean, like, reflection?

#

clazz.getConstructor(argTypes).newInstance(args)

inner mulch
#

thanks, i will try to

river oracle
#

before getting slapped in the face

twin venture
#

what do you think about making a mysql table with :

  • uuid , mode , kills ... etc

and each user will have 3 or 4 coulmns

  • uuid,solo,10,... etc
  • uuid,doubles,5,.... etc

and so on, is this good and is there better alternative?

rotund ravine
#

Rather than solo and doubles being a row

#

Make them a column and kills a row

twin venture
#

huh?

rotund ravine
#

Uuid (identifier), singles, doubles.

Uuid, 0, 10

twin venture
#

you mean , soloKills , soloWins ?

#

but isn't that goona be too much data ? and queries?

rotund ravine
#

It’s still be the same amount of querirs

#

Remember you can select the data u want in sql statements etc etc

twin venture
#

that's why i did it in the row insted of coulmns .. so i can just use smth like :

SELECT mode from ... WHERE mode = ?

#

isn't that better?

rotund ravine
#

Not really better or anything

twin venture
#

iam making it for a big plugin .. so i want it to be perfect as possible ..

torn badge
#

Just design it so uuid is the primary key

twin venture
#

its

twin venture
#

but if its a pk , it will not create new one xd? for each uuid , mode , stats . ?

#

its not sorry

torn badge
#

Your primary key must be (uuid, mode) then

twin venture
#

yes i do have that

torn badge
#

That works but it‘s kinda unnecessary

#

When you could just combine the data into a single row

twin venture
smoky oak
#

two questions - how much data was it again before the client crashes, and is it possible to check how much data currently is present in a player-data section, for example ender chest, inventory, or a specific item in those?

umbral ridge
#

how would i detect if someone is using world downloader on the server and is downloading the world?

torn badge
#

But a new row for 2 values is not necessary

smoky oak
river oracle
smoky oak
#

or that

river oracle
#

you're looking at a very invasive anti-cheat here. You're best off doing some ring 0 kernel anti cheat like valorant

umbral ridge
#

hmm

#

that sucks

river oracle
#

that way you know they can never be downloading your world if it loads before the OS 🧠

umbral ridge
smoky oak
#

probs with a packet for the mod?

river oracle
#

mods might provide utils

#

to servers

smoky oak
#

like it says 'server disabled'

umbral ridge
#

apparently also disables worldDownloader

river oracle
#

likely the case for worldDownloader to

umbral ridge
#

hmm

river oracle
#

however that's a botch solution seeing as one could simply use another mod and just not tell the server or declare itself

rotund ravine
#

All the information a client needs to copy a part of the world is already send when they load chuns

smoky oak
#

depending on your usecase what you want might just be custom worldgen

#

huh?

#

does PrepareInventoryResultEvent not have a way to get the items you put into it?

river oracle
#

Been thinking about making my own parser for chat stuff recently. And afaik using regex is kinda a naive solution in many cases. Essentially I would want something like
<green>this text is green
I've been running through ideas in my head and I'm not really sure where to start. I read a couple resources on parsing and I know for sure I need to do tokenizing.
So I make tokens essentially e.g. <green> is my token. However as I scale I'm not really sure how to deal with parsing the tokens themselves. I feel like re-parsing the tokens contents once I've already looped over them is kinda wasteful. But parsing the token's content as I read it at first is equally difficult seeing as I have no clue where to apply the stylized contents to. Kinda looking for maybe pointers or resources. Most of the stuff I've found is directly related to programming languages and I have kinda been cross referencing these resources for ideas of design.

chrome beacon
#

Could just use MiniMessage

smoky oak
# river oracle Been thinking about making my own parser for chat stuff recently. And afaik usin...

i mean, if you have a specific set of tokens, why not group the tokens into categories (color, shape, etc), then search and index for those tokens? if <> denotes a token, it cannot appear inside one without breaking the outside one, so you should get a String, and lists of all tokens and where they start?
The question is how you'd find them, but even if you scan for them naively i dont believe thats an issue

grim hound
#

How can i modify my plugin's plugin.yml file?

#

like replace it?

#

at runtime

neat mesa
#

why

umbral ridge
#

I don't think you can do it at a runtime because the plugin is compiled

chrome beacon
#

You can

#

but why

umbral ridge
#

for commands probably yeah

grim hound
chrome beacon
#

Use the commandMap

smoky oak
#

so i figured out my earlier issue, but... it doesnt mention if the inventory at that time already contains the result or not. I'm assuming no, can anyone verify?

grim hound
#

but I can't figure out on how I could prevent my commands from being registered

#

as of:

#

the commands are by default assigned to the JavaPlugin object

#

so it prevents like Essentials and stuff from overriding it

potent adder
#

can someone review this code?

package org.gargamel;

import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.jetbrains.annotations.NotNull;

public class permissionHandler implements Listener
{
    @EventHandler
    public void Handler(PlayerCommandPreprocessEvent e)
    {
        String message = e.getMessage();
        Player executer = e.getPlayer();
        String[] array = message.split(" ");
        if(((array[0].equalsIgnoreCase("/alert")) || (array[0].equalsIgnoreCase("/gsmp:alert"))) && (!executer.hasPermission("gsmp.alert")))
        {
            e.setCancelled(true);
            e.getPlayer().sendMessage(ChatColor.DARK_RED + "You do not have access to that command.");
        }
        if(((array[0].equalsIgnoreCase("/gsmp")) || (array[0].equalsIgnoreCase("/gsmp:gsmp"))) && (!executer.hasPermission("gsmp.get")))
        {
            e.setCancelled(true);
            e.getPlayer().sendMessage(ChatColor.DARK_RED + "You do not have access to that command.");
        }
        if(((array[0].equalsIgnoreCase("/rickroll")) || (array[0].equalsIgnoreCase("/gsmp:rickroll"))) && (!executer.hasPermission("gsmp.rickroll")))
        {
            e.setCancelled(true);
            e.getPlayer().sendMessage(ChatColor.DARK_RED + "You do not have access to that command.");
        }
        if(((array[0].equalsIgnoreCase("/song")) || (array[0].equalsIgnoreCase("/gsmp:song"))) && (!executer.hasPermission("gsmp.song")))
        {
            e.setCancelled(true);
            e.getPlayer().sendMessage(ChatColor.DARK_RED + "You do not have access to that command.");
        }
    }
}
grim hound
smoky oak
chrome beacon
#

It doesn't follow naming conventions

grim hound
#

and you should always have an Upper Letter

#

in the class name

chrome beacon
#

also why are you using the preproccess event

umbral ridge
#

and why not store array[0] in a variable so you're not repeating it all over again

grim hound
#

and maybe have just one if

smoky oak
#

tldr

grim hound
#

statement

smoky oak
#

just make one class per command

#

that way, the sorting and the permissions are both handled by spigot for you

potent adder
#

i want to make it work that if you dont have permisson its dosent tab completes the command (so i set up permmisons in plugin.yml) but if you type the command it will show no-permisson message and **will not show **"unknow command"

grim hound
umbral ridge
#

also I hate how by default event variable is called just "e". this is stupid. i always rename it to "event" because its more clear of what im even referring to

chrome beacon
grim hound
umbral ridge
smoky oak
#

playerChatTabCompleteEvent maybe?

umbral ridge
#

No

grim hound
umbral ridge
#

Its something called playercommandsend or something

#

it sends a list of server commands on player join

grim hound
umbral ridge
#

which can then be tabbed

chrome beacon
potent adder
smoky oak
#

well

#

people usually dont type commands in BIG

#

if you assume that you can just use a switch

grim hound
#

if it's just in the plugin.yml

smoky oak
#

ah wait a sec

chrome beacon
#

Yeah don't have it in your plugin.yml

smoky oak
#

String.toLowerCase(Locale.ENGLISH)

grim hound
#

unless I make only one command and make a delegating system for each of them

chrome beacon
#

just register it in to the command map if it's not disabled

smoky oak
#

just cast ur string to lowercase before checking it

smoky oak
#

means switch and less if-then chaining

grim hound
chrome beacon
#

Should work the same

#

if you set it up right

grim hound
#

wdym?

grim hound
chrome beacon
#

no

grim hound
#

oh

#

a custom Command class?

smoky oak
#

given that n entities are loaded currently, is there an approach faster than O(n) for checking on a movement event if a specific entity moved?

#

basically, can you bind events to entities in less-than-O(entitites_loaded)-time

#

⚙️

#

wait im dumb

clear elm
#

I made my first Java ,,Programm,, today I’m learning since some days

#

public class Party {
    public static void main (String[] args) {
        int guests;
        Scanner scan = new Scanner(System.in);
        boolean weiter = true;


        System.out.println("Anzahl der angemeldeten Gäste: ");
        guests = scan.nextInt();

        while (weiter) {
            System.out.println("Gast anmelden(1). abmelden (2), oder Programm beenden (3)");
            int value = scan.nextInt();
            if (value == 1) {
                System.out.println("Wie viele gäste möchtest du hinzufügen?");
                int guetsplus = scan.nextInt();
                guests = guests + guetsplus;
                System.out.println("plus gäste: " + guetsplus);

            }
            if (value == 2) {
                System.out.println("Wie viele gäste möchtest du löschen?");
                int guetsminus = scan.nextInt();
                guests = guests - guetsminus;
                System.out.println("gelöschte gäste: " + guetsminus);


            }
            if (value == 3) {
                weiter = false;
            }
        }
        System.out.println("Anzahl der Gäste: " + guests);
    }
}
mellow edge
#

if I set target to some entity (entity.setTarget(null), will that be passed to EntityTargetEvent

smoky oak
#

can you not block the crafting of specific recipes using PrepareItemCraftEvent? it doesnt have a setResult, nor a setCancelled method?

#

do i need to use the craft event itself? that seems kind of inconsistent with the anvil prepare event and enchant prepare events, which can be 'blocked' in some way

#

ah you have to change the result

#

wait wat you cant?

#

tf

#

ah result in the inventory. i wasnt aware the interface had that

knotty aspen
#

seems cleaner to just remove the recipe itself, but yeah

smoky oak
#

no

#

i need to block it based on the input item NBT

#

like, making you unable to craft enchanted stuff back into unenchantet for example

young knoll
#

Yeah you set result in the inv

smoky oak
#

on that topic

#

why do those not share a superevent

cacheConsumer(PrepareInventoryResultEvent.class, event -> {
                    for (ItemStack i : event.getInventory().getContents())
                        if (DataHandler.hasCommonFlag(i.getItemMeta(), CommonFlag.UNCRAFTABLE)) {
                            event.setResult(new ItemStack(Material.AIR));
                            return;
                        }
                });
                cacheConsumer(PrepareItemEnchantEvent.class, event -> {
                    for(ItemStack i : event.getInventory().getContents())
                        if(DataHandler.hasCommonFlag(i.getItemMeta(), CommonFlag.UNCRAFTABLE)){
                            event.setCancelled(true);
                            return;}
                });
                cacheConsumer(PrepareItemCraftEvent.class, event -> {
                    for(ItemStack i : event.getInventory().getContents())
                        if(DataHandler.hasCommonFlag(i.getItemMeta(), CommonFlag.UNCRAFTABLE)){
                            event.getInventory().setResult(new ItemStack(Material.AIR));
                            return;}
                });
#

it just seems a bit weird and i have triplicate code

#

*a useful superevent

young knoll
#

I mean

#

You can de duplicate a lot of that

smoky oak
#

i mean i can extracct the checking part

#

but does that help?

young knoll
#

Well you repeat the same loop thrice

smoky oak
#

tru

#

side noet

#

my IDE shows me the internals of the Enum i use to store those flags

#

(the powers of 2)

#

is there a way to make it not show the attributes of the enum value?

#

like the enum constant

quiet ice
#

huh?

smoky oak
#

like i didnt want to put a massive switch there and i also didnt want to add a case every time i do a new enum

#

my way to store it is to use a number, where each bit represents a enum value

#

but now its showing up internals that arent relevant outside the enum class

#

can i somehow mark the constant as internal

quiet ice
#

I still don't understand the issue?

lost matrix
smoky oak
#

le shrug

#

this is just annoying, you dont need to see this

quiet ice
#

Also can't you just use public int getEnumBitmask() { return 1 << this.ordinal(); }?

#

I mean you ought to know how to configure your IDE.

quaint mantle
#

is this a good or bad way to handle a piece of armor which permanently applies speed?

smoky oak
#

well yes, but that adds one more operation, doesnt it? It's limited by the amount of data you can fit into a number either way, so why should i do it like that

smoky oak
quaint mantle
#

i just dont know if this is safe

lost matrix
quaint mantle
#

what should i do

#

cause im lost

quiet ice
smoky oak
#

no

#

its about something else

#

but it doesnt accept my config soo...

#

i do not know how to config my ide

#

the settings are in fact not settings

lost matrix
# quaint mantle what should i do

Instead of stopping the task, you can simply start one task which has a collection of players (or their UUIDs) to tick.
This task is started once the server loads and never stops.

You simply add or remove players that should be ticked to this task.

quaint mantle
#

oh that's smart

quiet ice
#

Eclipse calls it "Code minings", though uh, I have that feature more than disabled

young knoll
#

You could also just give them the effect infinitely when they equip it

quaint mantle
#

💀 yeah I could

young knoll
#

And remove it when they unequip it

quaint mantle
#

nah

#

cause

#

what if they drink milk

young knoll
#

There’s an event for that

quiet ice
smoky oak
quaint mantle
smoky oak
quaint mantle
smoky oak
#

also howd you do that?

lost matrix
quiet ice
#

Like pretty much any other class?

smoky oak
#

oh yea im already doing that

young knoll
#

I mean if the armor event is coded well there shouldn’t be any what ifs

quiet ice
#
public enum MyEnum {
 ENUM_A, ENUM_B, ENUM_C;
 private final int ordinalMask = 1 << this.ordinal();
 @ApiStatus.Internal
 @Contract(pure = true)
 public int getOrdinalMask() { return this.enumMask; }
}
smoky oak
#

wait

lost matrix
# quaint mantle is Bukkit.getPlayer(UUID) o(1)?

Just for inspiration:

public class ApplicablePotionEffect {

  @Getter
  private final UUID playerId;
  private final PotionEffect potionEffect;

  public ApplicablePotionEffect(UUID playerId, PotionEffect potionEffect) {
    this.playerId = playerId;
    this.potionEffect = potionEffect;
  }

  public void apply() {
    Player player = Bukkit.getPlayer(this.playerId);
    if (player != null) {
      player.addPotionEffect(this.potionEffect);
    }
  }

}
public class PotionTask extends BukkitRunnable {

  private final Set<ApplicablePotionEffect> applicablePotionEffects;

  public PotionTask() {
    this.applicablePotionEffects = new HashSet<>();
  }

  public void addPotionEffect(Player player, PotionEffect effect) {
    ApplicablePotionEffect appEffect = new ApplicablePotionEffect(player.getUniqueId(), effect);
    this.applicablePotionEffects.add(appEffect);
  }

  public void removeEffect(UUID playerId) {
    this.applicablePotionEffects.removeIf(effect -> effect.getPlayerId().equals(playerId));
  }

  @Override
  public void run() {
    this.applicablePotionEffects.forEach(ApplicablePotionEffect::apply);
  }
}
#

Woops. A bit big.

quiet ice
smoky oak
#

like break if you add another enum value

quiet ice
#

Oh yeah, they ought not be used for anything like a savegame system

#

But if you just append new enums at the end of the list, nothing will break

young knoll
#

Just always add new constants to the end :p

smoky oak
#

that seems a bit volatile

quiet ice
#

You just cannot have more than 32 entries if using ints or 64 entries if using longs

smoky oak
#

if i accidentally add it elsewhere it bricks itself

quiet ice
#

Eclipse will warn you if you attempt to sort an enum

#

IJ probably isn't that stupid either

smoky oak
young knoll
#

8 entries

#

Take it or leave it

smoky oak
#

while guaranteeing the same inputs result in the same outputs even if the implementation changes in the meantime

quiet ice
#

Well I mean it is pretty hard to accidentally brick enum order.

smoky oak
#

i might insert a value between two others to keep it readable

lost matrix
#

I think an enum might not be the right choice for this.

quiet ice
#

If you really think you might mess it up still, add an note to future self. Otherwise, uh configure your IDE properly or explain your issue more clearly so I can hunt down the setting for you (why is it that IJ users always have configuration issues? Is eclipse extinct?)

young knoll
#

Someone get that bStats server software graph

#

But for java ides

quaint mantle
smoky oak
quiet ice
#

oh, you wish to supress the visibility of the automatically generated ordinal method?

lost matrix
# quaint mantle it's ok if I make a singleton for this right

Sure. The absolute proper way would be to use a manager singleton with a method to apply all effects, and
using the runnable purely as a heartbeat for this method. Adding and removing should be done by the manager.
This way the runnable doesnt need to be stored anywhere and the manager can be a singleton like usual.

smoky oak
#

no, reading out the value is required (EnumSet <-> int conversion). I want to block it showing the number after the enum because that is meant for internal use only

#

so it shouldnt show up in the javadoc for the enum

quaint mantle
grim hound
quaint mantle
#

ARE TICK METHODS OUT YET

lost matrix
#

?stash

undone axleBOT
quaint mantle
#

the stash is stinky

young knoll
#

Use the changelog viewer then

quaint mantle
#

what that

young knoll
lost matrix
# smoky oak while guaranteeing the same inputs result in the same outputs even if the implem...
public class ItemFlag {

  private static ItemFlag[] IDENTITIES = new ItemFlag[0];

  public static final ItemFlag HIDE_ENCHANTS = new ItemFlag(1);
  public static final ItemFlag HIDE_ATTRIBUTES = new ItemFlag(2);
  public static final ItemFlag UNBREAKABLE = new ItemFlag(3);

  private final int id;

  private ItemFlag(int id) {
    Preconditions.checkArgument(id >= 0 && id < 64, "ItemFlag ID must be element of [0-63]");
    Preconditions.checkArgument(Arrays.stream(IDENTITIES).noneMatch(flag -> flag.id == id), "ItemFlag ID must be unique");
    this.id = 1 << id;
    IDENTITIES = Arrays.copyOf(IDENTITIES, IDENTITIES.length + 1);
    IDENTITIES[IDENTITIES.length - 1] = this;
  }

  public int set(int flags) {
    return flags & this.id;
  }

  public boolean isSet(int flags) {
    return (flags & this.id) == this.id;
  }

  @Override
  public boolean equals(Object obj) {
    return obj instanceof ItemFlag other && other.id == this.id;
  }

  @Override
  public int hashCode() {
    return this.id;
  }

}

This would be a non-enum approach i thought about.
It never exposes the internal id.

smoky oak
#

oh interesting, i see what you're doing there. two questions tho

  • shouldn't it run on long though if the max is 64?
  • also, wouldnt it need to left and right shift it? where does that happen?
lost matrix
#

Wait

smoky oak
#

i meant for the store

lost matrix
#

Ah yeah true

smoky oak
#

i dont see how the ids for (1+2) do not conflict with 3

lost matrix
#

In the constructor this.id = 1 << id;

smoky oak
#

then its 0-63 then

lost matrix
#

Right, the constraints change in that case

smoky oak
#

eh ill look over it tomorrow

#

thanks for the idea

short pilot
#

What's the best way to add someone to a luckperms group in code? Should I use the API or just run the command like this

Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "lp user " + " group add .....");
echo basalt
#
Node node = InheritanceNode.builder("mygroup").value(true).build();
luckPerms.getUserManager().modifyUser(...)
#

something like that iirc

sullen marlin
#

definitely api lol

echo basalt
echo basalt
#

quality code

young knoll
#

What on earth is that

smoky oak
echo basalt
#

93k downloads

short pilot
#

so that's with the api then i see

#

is there a guide on setting it up with gradle do i need to add it as a dependency

#

once I add

    compileOnly 'net.luckperms:api:5.4'
}```

am I good to go
echo basalt
#

Try and se

short pilot
#

neat

#

unrelated but are completablefutures a good way to handle async things, and would I want permissions modifying to happen asynchrounsly?

#

i cant spell today

smoky oak
#

not sure if you can, I'd advise against it

worldly ingot
#

CFs are the bog standard means of doing things asynchronously if you want callback hooks or to return a result from an asynchronous function, but no, you can adjust permissions on the main thread

#

If you're updating a database, however, that should be done async

inner mulch
#

does somebody know which event is called when a player scrolls through his hotbar?

worldly ingot
#

You're looking for PlayerItemHeldEvent

smoky oak
#

ye that

#

side note

#

has a 2 tick delay

#

dont ask me why

worldly ingot
#

Can't check if it's a scroll vs a number though. Server doesn't distinguish between the two

smoky oak
#

like

worldly ingot
#

Best you can do is check if a - b = 1

#

¯_(ツ)_/¯

smoky oak
#

it takes 2 ticks to update the material for held item or smth

#

i dont recall how i queued it

worldly ingot
#

Oh. Well I think "item held" is a bit of a misnomer. It's better described as PlayerHotbarSlotChangedEvent imo. It's when the client says "alright, changing my selected slot to <slot>, pls update me, ktnx"

#

Probably not yet at the point where the item has actually updated

umbral ridge
#

hey

#

for what is onLoad usually used for?

#

it fires right after or before? the server has been loaded but when is that

slender elbow
#

when is right before worlds are loaded

#

although way after bootstrapping process

#

personally I use it for loading configs and other plugin data

umbral ridge
#

for loading configs? arent plugins loaded after the world loading. how does that work

slender elbow
#

plugins are loaded before worlds are loaded

#

some are enabled after worlds are loaded

umbral ridge
#

Yeah i see it now. why are some loaded before and some after tho

#

can you specify that

slender elbow
#

all plugins are loaded before worlds load

#

enabling comes after loading

#

some plugins enable after worlds load, but you can specify in plugin.yml that they enable before that

umbral ridge
#

so you enabled your plugin before world loading? I remember I actually tried to load configs onLoad and it gave me an exception of some sort and i didnt bother with it since then

#

I think it had to do something with classes not being initialized. hmmmmmm

slender elbow
#

onLoad -> worlds load -> onEnable

river oracle
#

test syntax is so weird like the method names I will never get over this xD

    @Test
    void test_Trie_Should_Contains_Call_Correctly() {
        final Trie trie = new Trie("one", "two", "three", "four", "five", "six", "seven", "eight", "nine");
        assertFalse(trie.containsPartial("en"));
        assertTrue(trie.containsPartial("e"));
        assertFalse(trie.contains("eight$"));
        assertTrue(trie.containsPartial("one"));
    }```
drowsy helm
#

Whats the time complexity of that method dang

#

O(logn)?

river oracle
#

well if it runs to completion its O(N) so yeah

#

its better than String#contains if you have like many inputs because O(N) is a much better complexity than O(N^2)

#

insertion time is O(N)
Contains check is O(N)
Which is great for mass string comparison

young knoll
#

What even is that

#

Trie

river oracle
#

In computer science, a trie (, ), also called digital tree or prefix tree, is a type of k-ary search tree, a tree data structure used for locating specific keys from within a set. These keys are most often strings, with links between nodes defined not by the entire key, but by individual characters. In order to access a key (to recover its value...

#

most common use is a syntax tree

#

its important to know though that with Trie's you shouldn't store things inside of the Nodes its a naive approach

young knoll
#

TIL it can be called a trie

candid galleon
#

String#contains is O(N^2) ?

ivory sleet
#

i think its O(N*M) no?

#

iirc used to be the case where there would be different contains impls depending on java impl

candid galleon
#

N*M ye

young knoll
#

That’s an Oof

sterile token
#

Is it possible to check at not compiled 1.20.3 server code? Im trying to check the configuration code to be specific

young knoll
#

What?

candid galleon
#

You want to check the default config files for 1.20.3 ?

#

What file(s)? spigot.yml ?

sterile token
#

I mean the java files which are the providers for config api. Mainly checking the spigot configuration api because i want to see how they manage the paths and nested paths from yaml files

#

Mainly internal spigot code, but the one which already contains the implenentations

young knoll
#

It’s all on stash

sterile token
#

what is stash? I havent worked with it just know about Github and some others, is it some sort of repository system

young knoll
#

?stash

undone axleBOT
sterile token
#

What you sent is for building spigot i dont need the compiled code

river oracle
#

I mean it could also be called a Syntax Tree but that's a specific implementation of a Trie

young knoll
#

Yeah I’ve only heard syntax tree

#

Or some other form of tree

#

Not Tree but with an I for some reason

quaint mantle
#

Binary tree

river oracle
#

my prof pronounces it try as to not confuse it with other trees lol

river oracle
#

because each parent node could have more than 2 child nodes. This violates a fundamental principle of a Binary Tree

quaint mantle
#

I just wanted to say binary tree for fun

#

chill out

river oracle
#

I'm not attacking you, I'm just poniting it out

young knoll
#

Trinary tree

#

Wait no that doesn’t work either

#

Nnary tree

short pilot
#

how can I make my database reads and writes asynchronous

#

to not run with the minecraft thread

#

I figure if it takes longer than the ticks it's going to freeze the server which isn't good

river oracle
#

CompletableFuture or Bukkit#runTaskAsynchronously

#

I usually opt for CompletableFuture as its just better imho

#

you get much more API to work with

minor junco
#

So go with runTaskAsynchronously & completable future's

#

@short pilot

short pilot
#

are there any pages on the docs for this?

#

would like to read up

minor junco
#

I don't remember the commands

#

If you've dealt with Promises in TS/JS before, completable futures are basically the same

ivory sleet
#

they are the same

#

or well the equivalent maybe is a better phrasing

minor junco
#

Yeah but I was thinking that the implementation and names are different, so I didn't use the phrase equivalent for that but yh in the end it is

short raptor
#

How can I best check if player is in water, even if they aren't moving?

#

Atm I've got a player move event, but I'm using it to apply potion effects that obviously expire after a time

#

And if they're standing still, it won't fire again to reapply the efects

halcyon hemlock
#

Just make a runnable that runs every few ticks

short raptor
#

Is that more efficient than a move event?

halcyon hemlock
#

Will solve your problem and will be more efficient

halcyon hemlock
short raptor
#

Ok ty

halcyon hemlock
#

Since it's only being triggered once a few ticks

#

The PlayerMoveEvent is triggered so many times each tick

#

Player rotation, Player move, and stuff

ivory sleet
minor junco
#

Yeah nah absolutely

slate tinsel
#

Hello! I use Intellij ultimate with plugins "Minecraft Development" Anyone know why these don't get "spigot" icon even though I created it as a minecraft plugin module

#

btw, now the whole project disappeared 💀

slate tinsel
halcyon hemlock
distant wave
#

does anyone has the cuboid class made by illusion

halcyon hemlock
distant wave
#

like checking if they intersect

#

etc.

halcyon hemlock
#

oh

slate tinsel
# halcyon hemlock I don't understand your situation

I have created 4 new Modules with the "Minecraft" template, but when I opened the project again, it is no longer a project that works correctly as it is not recognized by the plugin (The plugin in intellij) that I use

halcyon hemlock
halcyon hemlock
distant wave
#

i dont remember this

eternal oxide
#

its been there a long time

distant wave
#

bruh

slate tinsel
remote swallow
halcyon hemlock
#

^

slate tinsel
#

It has a correct pom.xml

#

Tried a bit quickly to just redo the HubTeleport-v1_20_R1 again and now it seems to work a bit unsure if it will stop working again like it did before

sullen marlin
#

Why the hell does a hub teleport plugin need nms

twin venture
#

is it good practice to always do try () catch for the prepareStatment?
for example :

#

so it auto close?

sullen marlin
#

Yes

distant wave
#

would this be a good way to check if player has moved into the region(in playermoveevent)

eternal oxide
#

it would work, but early return if xyz from == xyz of to

#

so you don;t need to mess with the boundingBox at all if they are just looking around

distant wave
halcyon hemlock
distant wave
#

so uh like this? (essentialy im checking if player either entered or left the area)

eternal oxide
#

create Vector variables for getFrom and getTo so you don;tr do it over and over

distant wave
#

but otherwise good?

eternal oxide
#

at teh very top, before teh for loop

#

then return if fromVector == toVector

#

you don;t need to do anything in that code if the player has not moved

distant wave
#

ohj i see

eternal oxide
#
Vector fromVector = event.getFrom().toVector();
Vector toVector = event.getTo().toVector();
if (fromVector == toVector) return;

for(...```
halcyon hemlock
#

@eternal oxide Is it ok to use PlayerMoveEvent?

#

Aren't they triggered like hundreds of time per tick

eternal oxide
#

yes, so long as you early return when you don;t need it

#

yes

halcyon hemlock
#

I mean couldn't you run a BukkitRunnable that runs every tick or few ticks

#

Would save performance

distant wave
#

the plugin isnt for me so it doesnt matter

eternal oxide
#

you'd end up running more code in a runnable than early return in the move event

#

its also simpler just to early return

halcyon hemlock
#

And loop through them

halcyon hemlock
eternal oxide
#

you could use a runnable if you are competent with caching

eternal oxide
#

For his use though, just creating two vectors in the move event is not much

halcyon hemlock
#

Whatever is preferred I guess

eternal oxide
#

if his BB's were also bound to a full block I'd do the early return if getBlocK on to/from was teh same]

halcyon hemlock
distant wave
#

thats just minor thing

#

the important is it works

halcyon hemlock
#

Anything would work

#

You could nest 100 if statements and it would work

distant wave
#

as long as it doesnt put tps to 5

eternal oxide
#

maximum pay for minimal work 🙂

halcyon hemlock
distant wave
#

i havent done plugins since september

#

lol

halcyon hemlock
#

@eternal oxide If you do end up using tasks, couldn't you run it on another thread for better performance?

eternal oxide
#

yes you could, as you are not making world changes

halcyon hemlock
#

Aight

#

I think the best would be that then

eternal oxide
#

that would be ideal actually

halcyon hemlock
#

TPS won't drop either

distant wave
#

th

#

i literally have nitro why

remote swallow
#

you have to boost for emotes here

halcyon hemlock
#

Server doesn't allow

remote swallow
#

i can emote

#

bc i boosted

halcyon hemlock
remote swallow
slate crown
#

Guys ! Help please

    private void deleteUidDat(World world) {
        File uidDatFile = new File(world.getWorldFolder(), "uid.dat");
        if (uidDatFile.exists()) {
            uidDatFile.delete();
        }
    }

Can this affect the visibility of the players? In the sense that for some reason, when teleporting, they do not see each other, although after updating the region, they see each other

proud badge
#

How would I add a 2nd line to my chat hover ?

twin venture
#

hi i need small help with redis :
it only send this 3 times and then stop

#

ofc this is in the proxy server :

#

bungeecord

remote swallow
#

why are you subsribing every 2 seconds

twin venture
#

so i don't need to do that?

#

only register it once?

remote swallow
#

correct

twin venture
#

it does send the user to the Lobby server .
when the game end , it send the debug messages but nothing happens

remote swallow
#

code?

twin venture
remote swallow
#

and what debug messages are sent

twin venture
#

in proxy part :
server info is not null .. connecting the user to lobby...
and in the sendPlayerToHub method it send this mesaage :
sending players to lobby"

remote swallow
#

and no messages on the redis debug?

twin venture
#

let me debug it again and check

twin venture
#

so only this is being sent :

#

Did some changing on the proxy side :

#

but it still not sending me to lobby :p

remote swallow
#

add more debug statements, figure out exactly how the code is running and whats happening where

quaint mantle
#
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot</artifactId>
            <version>1.19.4-R0.1-SNAPSHOT</version>
            <classifier>remapped-mojang</classifier>
            <scope>provided</scope>
        </dependency>```
#
                <groupId>net.md-5</groupId>
                <artifactId>specialsource-maven-plugin</artifactId>
                <version>1.2.2</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>remap</goal>
                        </goals>
                        <id>remap-obf</id>
                        <configuration>
                            <srgIn>org.spigotmc:minecraft-server:1.19.4-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
                            <reverse>true</reverse>
                            <remappedDependencies>org.spigotmc:spigot:1.19.4-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
                            <remappedArtifactAttached>true</remappedArtifactAttached>
                            <remappedClassifierName>remapped-obf</remappedClassifierName>
                        </configuration>
                    </execution>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>remap</goal>
                        </goals>
                        <id>remap-spigot</id>
                        <configuration>
                            <inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
                            <srgIn>org.spigotmc:minecraft-server:1.19.4-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
                            <remappedDependencies>org.spigotmc:spigot:1.19.4-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
                        </configuration>
                    </execution>
                </executions>
            </plugin>```
#

how can i change the above dependency and plugin to 1.20.1?

#

i cant find it even if I check the repository

remote swallow
#

nms isnt on a repo you need to run buildtools

#

with --rev 1.20.1 and --remapped

proud badge
#

bru plz help why am I getting a NullPointerException where config is null

    private static FileConfiguration config;
    private final GriefAlert3 plugin;

    // Constructor that takes the main plugin instance as a parameter
    public ReloadCommand(GriefAlert3 plugin) {
        // Use the plugin instance to get the configuration
        this.plugin = plugin;
        this.config = plugin.getConfig();

        // Now you can use this.config to access the configuration
    }

    public static void reloadConfig() {
        List<String> materialList = config.getStringList("noAlertMaterials");

        // Convert the list of material names to an array of Material objects
        GriefAlert3.nonAlertBlocks = new Material[materialList.size()];
        for (int i = 0; i < materialList.size(); i++) {
            GriefAlert3.nonAlertBlocks[i] = Material.matchMaterial(materialList.get(i));
        }

        List<String> placementAlertMaterialList = config.getStringList("placementAlerts");

        // Convert the list of material names to an array of Material objects
        GriefAlert3.placementAlertBlocks = new Material[placementAlertMaterialList.size()];
        for (int i = 0; i < materialList.size(); i++) {
            GriefAlert3.placementAlertBlocks[i] = Material.matchMaterial(placementAlertMaterialList.get(i));
        }

    }
}```
remote swallow
#

and if you call the method before the constructor its going to be null

proud badge
remote swallow
#

you can

#

just remove the this.

proud badge
#

oh yeah that was the issue

#

I have it called in my onEnable

#

ok lemme try now I removed the this. from config in ReloadCommand

#

Ok fixed it epic

clear elm
#

How can i learn paper api?

#

just plugin make tutorial videos?

quaint mantle
#

Hello everyone! Listen, I have a question. Is it possible to set up a WhiteList so that when a player who is not on the whitelist tries to join the server, they receive an error prompting them to undergo verification on the website: https://[your_website] ? And how can I make it so that clicking on the error immediately redirects the player to that website?"

quiet ice
minor junco
quaint mantle
#

can i use nms without using a build tool like maven?

remote swallow
#

you can but its much harder

quaint mantle
#

I wish I knew how, and if it’s even possible, I don’t even understand

#

maybe or not I can't figure it out

#

Sorry if there are mistakes, I communicate through a translator

smoky oak
#

which intellij keymapping is for 'close currently open file'? The ones im finding are closing the project window

#

like the name of the input is what im looking for

eternal oxide
#

ALT+F4 😄

smoky oak
#

not the actual keybind

#

just the file u smartass lol

remote swallow
#

might be one of these

smoky oak
#

i made sure to click on the file too

#

welp

#

i apparantly did in fact not

#

tf

icy beacon
#

If not, you changed your keybinds at some point

smoky oak
#

nah i did not

#

its just that the cursor was blinking in the editor window

#

so i thought it had focus

#

it did in fact not have focus

icy beacon
#

Ah, I see

#

Yeah Intellij loves to bamboozle

smoky oak
#

eh

icy beacon
#

I often find myself typing stuff and somehow I'm typing in the project search field and not the file lmao

smoky oak
#

still better than light theme (geol cough)

icy beacon
#

xD

smoky oak
#

seriously what IDE ships with default light theme

#

no java ide that does that that i know of is any good

icy beacon
#

Eclipse iirc

smoky oak
#

theres also bluej, its similarly stupid

chrome beacon
#

Netbeans too

icy beacon
#

And maybe NetBeans but I have not opened that since 2019

smoky oak
#

has exactly 1 redeeming feature

icy beacon
#

Yeah

icy beacon
smoky oak
#

you can manipulate objects in a limited way without compiling and launching a programm

#

but the editor is shit

remote swallow
#

intellij can do that

icy beacon
# chrome beacon Netbeans too

For some reason light theme makes me feel like I'm working on Windows Vista when dark themes were not all the hype lmao

smoky oak
#

also i prefer to not burn out my eyes lol

icy beacon
#

And when an ide is shipped with default light theme it just feels like not a top notch quality product

#

A cognitive bias on my part lol

minor junco
#

I mean dark means more elegance so understandable

remote swallow
#

to hotswap files at runtime just requires jetbrains runtime as the jdk and some startup flags with a debug config

icy beacon
#

Yeah

smoky oak
#

like dis the bluej editor

#

soooooo

icy beacon
smoky oak
#

oh it gets worse

minor junco
#

What is this

smoky oak
#

those boxes have a maximum width

icy beacon
#

Huh

smoky oak
#

so if you extend to the right

#

the code goes through them

#

the boxes stay in place

icy beacon
#

LMFAO

minor junco
#

I don't even dislike that 💀

smoky oak
#

and you have like [print (Long log] message);

icy beacon
#

Surely this is pseudocode and not just an inability to code java

smoky oak
#

i just grabbed an example image from google search

icy beacon
#

Is it even java

smoky oak
#

image search still works lmfao

icy beacon
#

Why shouldn't it?

minor junco
#

I mean this ain't java can't be,

for each (var int I : 1 .. n - 1)

icy beacon
#

Yeah

smoky oak
icy beacon
#

And there's a lot of var type in that code

#

I hope it's not java

smoky oak
#

acutally

icy beacon
#

Damn, ty

smoky oak
#

i keep forgetting that isnt on this server lol

icy beacon
#

Ping Conclube until he either bans you or pins your message

#

xD

smoky oak
#

i mean its not really code relevant lol

icy beacon
#

Ehh..

smoky oak
#

whatever

#

if i get banned I'm blaming you

#

@ivory sleet would you mind illuminating us with your opinion on this topic?

eternal oxide
slate tinsel
#

If you make a single module for each version of NMS and you want to support sub versions eg 1.20.3. Do you have to make a separate module for these? And what do I do if 1.20.3 is not available? Likewise, paper users running 1.20.3 should not be able to use plugin or how to do it?

eternal oxide
#

no

#

only when the R increases

slate tinsel
#

Wait, what do you mean now?

eternal oxide
#

are we upto R3 or R4 for 1.20 now?

slate tinsel
#

yes?

eternal oxide
#

I can never remember as I don;t ever see teh CB part

viral temple
#

it's only R3

#

for now.

eternal oxide
#

no the .4 does not mean there is an R4

#

yep, R3 is current

viral temple
#

.3 and .4 shares the same R3 package

eternal oxide
#

R3 covers .3 and .4

slate tinsel
viral temple
#

it's only one critical bug fixed

eternal oxide
#

The R version does not correlate to the minor version of the release.

slate tinsel
#

But what should I do to support

  • 1.20
  • 1.20.1
  • 1.20.2
  • 1.20.3
  • 1.20.4

unless 1.20.3 doesn't exist or what do you mean?

#

And 1.20 does not exist

eternal oxide
#

we are currently on 1_20_R3 which covers 1.20.3 and 1.20.4

slate tinsel
#

Okey, but how do I download BuildTools for 1.20.3 if I'm going to be able to support that version with NMS?

river oracle
#

?nms

slate tinsel
river oracle
#

--Rev

river oracle
#

1.20.1 is 1.20

#

Likewise 1.20.3 is 1.20.4

#

You can nolonger obtain 1.20

late sonnet
slate tinsel
river oracle
#

it's one of those cases where 1.20 is pretty much identical to 1.20.1

river oracle
#

In 1.20s casw there are 3 released

#

1.20.R1 1.20.R2 and 1.20.R3

slate tinsel
#

Okay, but then it is enough if I support 1.20 - 1.20.4 to have

1.20.R1
1.20.R2
1.20.R4

river oracle
#

No R4 doesn't exist

#

It's R3

#

Unless mojank bumped protocol and I remembered wrong

slate tinsel
#

ok, but then I don't understand what they said that they had replaced 1.20.3 with 1.20.4 or something similar

late sonnet
slate tinsel
late sonnet
eternal oxide
#

sysout this to see what version you are using Bukkit.getServer().getClass().getPackage().getName().substring(23);

river oracle
#

It means 1.20.4 supersedes 1.20.3 the difference between the two versions is one line of code thus making 1.20.3 obsolete both updates are the same internally minus that one line

#

Protocol version wasn't bumped

minor junco
#

Minor updates shouldn't have a difference in their NMS so don't worry

river oracle
river oracle
chrome beacon