#help-development

1 messages · Page 1426 of 1

sharp bough
#
  • cries in 1.12 client*
wraith rapids
#

1.12 is the most useless version anyway

#

at least the 1.8 people have an excuse

paper viper
#

the only reason to use 1.12 is cause of modded

#

otherwise

#

nope

#

1.7.10 and 1.12.2 were one of the popular modded versions. idk the next ones so far

eternal night
#

looking at prototcol specs, shouldn't you send a 1 instead of a 0 for reason 4 ?

wraith rapids
#

real men play modded on 1.7

paper viper
#

lmao

eternal night
#

💪

paper viper
#

💪

sharp bough
#

1.7?

#

1.6.5

paper viper
#

no no no

#

1.6.5 is ew

#

1.7.10 is good

#

for modded

sharp bough
#

when i was like 10-12 i used to play 1.6.5

paper viper
#

1.7 was when most mod developers thrived

eternal night
#

like @plain quest

paper viper
#

like witchery

eternal night
#

you are sending 0

plain quest
#

i want to see if what i want works with the regular respawn and if it doesn't i'll use the end screen

eternal night
#

ah gl hf

plain quest
#

but this isn't the problem at all

wraith rapids
#

where did you bite the ender dragon

plain quest
#

in the end

wraith rapids
#

you bit it in the ass? sounds kinda gay

plain quest
#

the dragon is female

eternal night
#

😉

#

so your goal is to just roll credits ?

plain quest
#

basically perform any short of dimension change so players can see their new skin

#

i think that's the easier

#

cause i don't have to give them their items and stuff

#

(something that i would do if i were to kill them)

silk mirage
#

hi

maiden briar
#

If I have for example an file sample.txt into my Maven resources folder, and I want to read the data, what do I need to do? I can't find anything on Google

silk mirage
#

what may be possible going wrong?

plain quest
silk mirage
#

thanks

chilly compass
#

hi. Sorry for asking stuipid questions if I do.

But I could not find a tutorial how I can overwrite the default Minecraft "/kick" command with my own BungeeCord "/kick" command
If I try to run it it will always use the one of Minecraft. I tried to deactivate the command using the commands.yml but there it didnt do anything when I was using /kick

maiden briar
#

CommandPreprocessEvent I think

#

Or something like that

chilly compass
chilly compass
maiden briar
#

Yes

#

Bungee also has something like that

chilly compass
#

damn. I hoped if there was a way without coding an extra Spigot plugin

maiden briar
#

You can also cancel on Bungee, because it will be called because a command is a command

chilly compass
#

hm okay. I will try that. Thanks

maiden briar
#

Ok np

wraith rapids
#

cum core

paper viper
#

does anyone know if stuff like List.of and the new methods that are available in Java 11 immutable?

wraith rapids
#

ctrl-click or mmb the method

#

and you'll see its implementation

chilly compass
#

do you actually know the preCommand event name in bungeecord?
Edit: Okay actually there is none

quaint mantle
#

hey how can i clear cache without restarting server in plugin?

eternal oxide
#

what cache?

quaint mantle
#

like playerdata world every

paper viper
#

i havent checked but i will

wraith rapids
#
/**
     * Returns an unmodifiable list containing three elements.
     *
     * See <a href="#unmodifiable">Unmodifiable Lists</a> for details.
     *
     * @param <E> the {@code List}'s element type
     * @param e1 the first element
     * @param e2 the second element
     * @param e3 the third element
     * @return a {@code List} containing the specified elements
     * @throws NullPointerException if an element is {@code null}
     *
     * @since 9
     */
    static <E> List<E> of(E e1, E e2, E e3) {
        return new ImmutableCollections.ListN<>(e1, e2, e3);
    }
eternal oxide
quaint mantle
#

no

#

like to free some usage

eternal oxide
#

Then why would you need to clear any cached playerdata?

wraith rapids
#

that is dum

quaint mantle
#

idk

wraith rapids
#

caches are almost always soft referenced

paper viper
#

oh nvm

#

it doesnt use native

#

i thought it did cause of the number of arguments

#

lmao

wraith rapids
#

lol

vast quest
#

how can I set health of a entity

#

on a event

#

setHealth doesnt seem to be athing

quaint mantle
#

show code

vast quest
#
            event.getEntity().setHealth(100);
        }```
#

EntitySpawnEvent

#

oh nvm I had to cast it as a entity

young knoll
#

Use CreatureSpawnEvent

vast quest
#

Nah I just needed to use

#

if(event.getEntityType() == EntityType.BLAZE) {
Blaze blaze = (Blaze) event.getEntity();
blaze.setHealth(100);
}

wraith rapids
#

not every LivingEntity is Damageable

young knoll
#

Still

wraith rapids
#

instanceof and cast to Damageable

young knoll
#

You don't need to be listening to all entity spawns if you only care about living entities

wraith rapids
#

myeah

wraith rapids
#

strange

pearl glade
#

I would like to know if it is possible to update only one section of a chunk?

wraith rapids
#

my IDE says there's no extends relationship there

flint elk
#

Can anyone tell me how to do a gradient?

wraith rapids
#

by splitting every character into its own chat component and then applying a incrementally shifted color value to each subsequent chat component

#

or just use adventure, i think it has gradients built in

glass sparrow
#

or use IridiumColorAPI by @radiant aspen

flint elk
#

Okay

flint elk
glass sparrow
#

idk if they actually made it I just know they contributed

somber hull
#

what would an event be for when a player gets an item in their inventory

wraith rapids
#

lol

#

sounds like a pretty redpilled host

somber hull
#

Someone sent some html code and had that in it so i looked it up

wraith rapids
#

you'll need to listen to item pickup and inventory click and inventory drag events

young knoll
#

Minecraft has a predicate for that

#

Wonder how it's called

wispy monolith
#

did anyone in here use JDA before?

sage swift
#

no none of us have unfortunately

severe folio
wispy monolith
#

yup

severe folio
#

Yea what's up

wraith rapids
#

what's that, is that like a STD

wispy monolith
quaint mantle
mortal hare
#

is there any method to get material type's default locale name?

wraith rapids
#

materials do not have localized names

#

itemstacks do

severe folio
mortal hare
wraith rapids
#

on paper, ItemStack::getI18DisplayName

#

on spigot, you're fucked

mortal hare
#

😦

#

im using purpur

#

eh

wispy monolith
#

and just run it in the normal way in the main class?

mortal hare
#

it should work

wraith rapids
#

yeah, purpur is downstream from paper

wispy monolith
#

inside the on start method?

severe folio
mortal hare
#

wait

#

nvm

severe folio
wraith rapids
#

that's just how the game works basically

radiant aspen
wraith rapids
#

materials don't really even exist on mojang's side

wispy monolith
#

so I can send messages?

severe folio
#

wdym

wraith rapids
#

as you would pass anything to another object

#

you don't pass things "to another class"

#

this is OOP, you pass things to another object

wispy monolith
#

Like I have an event that is from spigot and in this event I want to send a message on the discord server how?

mortal hare
#

if that weird method returns the name of the item

wraith rapids
#

yeah but they split them to item and block types iirc

mortal hare
#

what does .getLocalizedName() do then

severe folio
#

and have a getter method?

wispy monolith
wraith rapids
#

where are you even seeing that method on

mortal hare
#

in ItemMeta

severe folio
mortal hare
#

it seems that its responsible for serverside translations

wraith rapids
#

let me check

mortal hare
#

since wiki.vg states that server gets information about player's locale

wispy monolith
mortal hare
#

so it should be that this thing controls translations which server specifies

mortal hare
#

you need probably to shade it in

#

idk

#

yep

chrome beacon
#

Yeah shade it

mortal hare
#

its not the plugin

chrome beacon
#

^^

flint elk
wraith rapids
#

the server may get information about the client's locale

#

but it can't do anything with that information

#

only the I18 localization is bundled in the server jar

chrome beacon
wraith rapids
#

it can't translate anything to anything other than it

severe folio
sharp bough
#

is there a better way of replacing values in a config file with the next one in the list than

                Main.get().getConfig().set("respawnLocations." + i + ".X" , Main.get().getConfig().get("respawnLocations." + (i+1) + ".X"));
                Main.get().getConfig().set("respawnLocations." + i + ".Y" , Main.get().getConfig().get("respawnLocations." + (i+1) + ".Y"));
                Main.get().getConfig().set("respawnLocations." + i + ".Z" , Main.get().getConfig().get("respawnLocations." + (i+1) + ".Z"));```
wraith rapids
#

as for the difference between localizedname and i18 i'm not sure; localizedname might be the language mapping key

mortal hare
wraith rapids
#

server can't rename the itemstacks

#

server can't translate things to anything other than I18

#

because it doesn't have any other localizations bundled in

flint elk
#

I use maven

mortal hare
#

i know

mortal hare
#

but maybe these methods will provide a way for the developer to translate itemstacks

paper viper
#

and also wtf dont name your method get() at least man if you are going to use a singleton

mortal hare
#

and server would manage the packet handling for translated itemstacks

severe folio
wraith rapids
#

kind of doubtful

paper viper
#

plus, also you can simplify that code a ton

#

lol

chrome beacon
paper viper
#

bad method name

sharp bough
#

its just a way to call the config file

mortal hare
#

eh you don't need to even shade it. its not that big

sharp bough
#

it gets the config file

mortal hare
#

just copy the classes into your jar file

sharp bough
#

and its short

paper viper
#

absolutely bad method name

#

use getConfig

sharp bough
#

how would you call it

#

broo

mortal hare
#

but its better to shade it

paper viper
#

rename the method to getConfig...

sharp bough
#

Main.get.getconfig

#

lmao

paper viper
#

No

#

smh

#

thats what i meant

stiff topaz
#

Hey. I have a list of Args in a command. Is it possible to remove an argument from a list of args?

sharp bough
#

im not gonna rename that in 2000 lines of codes

mortal hare
#

since you would need to handle updates of the classes manually if you don't shade it

paper viper
#

and the ide does it for you

young knoll
#

If only IDEs had a feature to rename things

flint elk
#

IridiumColorAPI has the Error

#

._.

mortal hare
#

i guess near the immutablemap

paper viper
mortal hare
#

i don't see a dot there

paper viper
#

i think eclipse can also do it too?

young knoll
#

So can eclipse

#

That was the joke

paper viper
#

Yeah

mortal hare
#

netbeans too

paper viper
#

Oh lmao

wraith rapids
#

netbeans more like bakedbeans

paper viper
#

no but in all honesty that code looks horrfic lol. I can send a list of whats wrong

sharp bough
# paper viper and the ide does it for you

next time you complain about one of my methods names im gonna replace all classes with lowercase, change main to NonImportant, make all methods start with upper case and spam that in your dm with bots, vpn, and spammers

wraith rapids
#

are we shitting on something

sharp bough
#

24 7

wraith rapids
#

what are we shitting on

paper viper
#

lmao

quaint mantle
#

how can i remove all bossbars player see?

paper viper
#

when we tell you to do something

#

we dont force u to do it

#

we're just telling you for your own good

#

¯_(ツ)_/¯

sharp bough
#

it is until you read NonImportant.teleport.TeleportPlayer

young knoll
#

Your loss on that one

paper viper
#

idek what that means lmao

young knoll
#

I don't have to read it

paper viper
#

lol

sharp bough
#

lmao

paper viper
sharp bough
#

anyways

quaint mantle
#

how can i remove all bossbars player see?

wraith rapids
#

your mom

glass sparrow
paper viper
stiff topaz
#

Can I remove an argument from a list of arguments

for(String arg : args) {
    if (arg.contains("-p")) {
        Prefix = arg;
        // Remove "arg" from "args"
    }
}
quaint mantle
#

do replace

stiff topaz
#

I have -pdfghdfghdfg I want to remove the argument starting with -p

paper viper
#

use String#substring

wraith rapids
#

build a new array with only the elements that do not get removed

mortal hare
#

i would pay someone for converting clientside translation files into java classes

severe folio
rotund pond
#

🤷‍♂️

severe folio
#

1, its an array

wraith rapids
#

really though if you're using -params, you should split on \s-\w rather than space

eternal oxide
#

use an iterator

severe folio
#

2, ConcurrentModificationException

rotund pond
#

Okok

young knoll
#

Make it a list and use an iterator :p

wraith rapids
#

build a new array/list with just the elements you don't remove

young knoll
#

Probably the better idea ^

wraith rapids
#

or merge the entire args array into a string and split it properly

#

using -params and splitting by space is dum

wispy monolith
wraith rapids
#

as you would store any other object

quaint mantle
modern fox
#
piece.getItem().isSimilar(e.getNewArmorPiece())

Why doesn't this work?

quaint mantle
sage swift
#

what the hell is piece, Hergon?

modern fox
#

It is a custom object

lunar folio
#

hello, somebody knows if Player#performCommand fires PlayerCommandPreprocessEvent?

sage swift
#

yes it calls all the command stuff

lunar folio
#

thank you

quaint mantle
lofty junco
#

Hello, I have one question how can i start a countdown if a player execute a specific command my problem is just with the countdown

mortal hare
#

there's no built in coundown timer as far i know inside bukkit runnables

#

but you can implement it yourself easily

wraith rapids
#

people usually use bukkitrunnables for countdowns

mortal hare
#

there's plenty of cooldown timers online which you can use

#

which utilise bukkit runnables

wispy monolith
wraith rapids
#

implementing one yourself might be a worthwhile excercise in how to work with schedulers, though

mortal hare
#

if you want TPS-indepedant countdowns you would need to use threads or thread pools with runnables

wraith rapids
#

or bukkit async tasks 👀

quaint mantle
#

its right there @wispy monolith

mortal hare
wispy monolith
#

yeah

wraith rapids
#

0-50ms delay yeah

wispy monolith
#

But I have the bot built in the Main class

wraith rapids
#

as in, they will run at the start of the first available tick

#

if you schedule them just at the end of a tick they will run basically immediately

mortal hare
#

just use bukkit runnables

#

no one will notice 50ms delay, average human eye reaction is like 250ms anyways

quaint mantle
wispy monolith
#
@Override
    public void onEnable() {
        getConfig().options().copyDefaults();
        saveDefaultConfig();
        getServer().getConsoleSender().sendMessage(ChatColor.GREEN + "[<Plugin name>]: Plugin is enabled");
        String token = getConfig().getString("token");
        if (!(token == "")) {
            try {
                JDA jda = JDABuilder.createDefault(token).build();
                jda.getPresence().setStatus(OnlineStatus.ONLINE);
            } catch (LoginException e) {
                e.printStackTrace();
            }
        }
    }
wraith rapids
#

don't send messages to consolesender

#

use your plugin's logger

#

getLogger().info()

wispy monolith
#

it does the same thing

wraith rapids
#

it does not

#

and because the console sender is not a logger

wispy monolith
#

I just want to say to the user that the plugin is enabled

wraith rapids
#

yes

#

your plugin logger is your own, unique logger and you should use it for all of the messages you want to log

wispy monolith
wispy monolith
wraith rapids
#

but you are

#

it gets logged in the server log, but it can't be associated with your plugin

young knoll
#

Spigot already has enabled messages for plugins

wispy monolith
#

don't worry about it this is irrelevant now

wraith rapids
#

you doing shit wrong is not irrelevant

severe folio
severe folio
#

this. probably isnt needed but yknow

quaint mantle
wispy monolith
#

and what should I do in the other class

quaint mantle
#

if i want the code to look better, or if the code is confusing i always use "this." or "super."

severe folio
severe folio
#

i tend to only use it on some plugins, my brain does weird shit

young knoll
#

MyMain.getPlugin(MyMain.class).getJDA(); I would advise against that

quaint mantle
#

ye

severe folio
#

yea its an example (be it a bad one)

young knoll
#

Use a singleton, or even better, dependency injection

maiden briar
#

java.lang.NoSuchMethodException: JavaPlugin.<init>(PluginLoader), the constructor: protected JavaPlugin(PluginLoader pluginLoader)

usage:

Constructor<?> javaPluginConstructor = pluginClass.getSuperclass().getConstructor(PluginLoader.class);
javaPluginConstructor.setAccessible(true);
this.plugin = (JavaPlugin) javaPluginConstructor.newInstance(this);
severe folio
#

or am I smooth brain

wraith rapids
#

what

#

why are you reflectively instantiating javaplugin

maiden briar
#

It's my own class

wraith rapids
#

why are you doing it reflectively

#

and why are you instantiating it

maiden briar
#

Because the constructor must be private so people can't create instances with PluginLoader, and I want to create a new instance with PluginLoader

wraith rapids
#

bukkit already enforces the singleton principle for javaplugins

maiden briar
#

*protected

#

Yes I know, but I am making my custom classes

wraith rapids
#

bukkit will also be unable to load your plugin if it can't instantiate your main class

maiden briar
#

If I now make the constructor public and init, everything works

#

But I can't use with reflection

lofty junco
#

Does anyone how to put thescheduleSyncRepeatingTask into a map

wraith rapids
#

map.put

lofty junco
#

private Map<String, Object> countdownMap = new HashMap<>();

private void test(Player player) {
    countdownMap.put(player.getUniqueId(), Bukkit.getScheduler().get);
    taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(Main.getInstance());
}
#

this doesent work

wraith rapids
#

👀

maiden briar
#

Got an idea: I make the constructor public, and add a boolean so I can see it is instanced

wraith rapids
#

that is literally what bukkit does already

maiden briar
#

And if true throw an Exception

lofty junco
maiden briar
lofty junco
#

idea

severe folio
maiden briar
#

I want them to use the public constructor without arguments

severe folio
#

on a JavaPlugin?

maiden briar
#

My own class

#

Not Bukkit's

severe folio
#

they can get around that with reflection, no?

maiden briar
#

Yes, but I don't mind reflection for now

#

I just throw an exception if they try to create an instance, that always works

wraith rapids
#

declare a no-arg constructor in the class that extends javaplugin

maiden briar
#

And a boolean so it works the first time, and then they can't create more instances

wraith rapids
#

and then force these other classes to extend that class instead of javaplugin directly

wraith rapids
#

then that is all you need

#

no-one can call the protected javaplugin constructor then

maiden briar
#

But I must get the constructor from the superclass, because otherwise reflection won't work

indigo fern
#

im sorry if this sounds confusing but i have made a file system. I am generating random String and ints. Does anyone know how i can save the String and ints for InventoryClickEvent?

wraith rapids
#

i am so fucking lost on what you are even trying to do

lofty junco
#

Bukkit.getScheduler().scheduleSyncRepeatingTask(Main.getInstance()); can someone tell me how i can get from this the task id i know it need a runnable

wraith rapids
#

why are you instantiating it with reflection again?

maiden briar
#

Ok I will explain again

#
public class JavaPlugin
{
  public JavaPlugin() {}

  public JavaPlugin(PluginLoader pluginLoader) ...
}

//From outside (in the API):
new JavaPlugin(PluginLoader);

//Class outside API which extends JavaPlugin must use the no-args constructor
public class Extender extends JavaPlugin
{
}
quaint mantle
#

what

wraith rapids
#

why are you manually instantiating your javaplugin

maiden briar
#

Because I got the class from the plugin.yml (I added an custom value)

wraith rapids
#

???

maiden briar
#

Yes it is a bit complicated

#

The users which use my API must apply an annotation onto their JavaPlugin (from me). I force Bukkit to set the main to a custom class called BukkitPluginLoader (extends JavaPlugin), I also add an value to the plugin.yml which I will get later. In the onEnable of the BukkitPluginLoader I get the value (The actual annotated class), and there I want to create an new instance.

wraith rapids
#

so the user of your api ends up with two classes extending javaplugin

maiden briar
#

No they only need to extend my own JavaPlugin

#

Because I force set the main into the plugin.yml to my own loader

#

And add the value of their main which I later get

wraith rapids
#

and how does this differ from them just extending a class written by you that extends JavaPlugin

maiden briar
#

Because I make my API partly compatible with bungee and bukkit

#

Because for the most things they use the same system

#

But now an answer to my problem?

wraith rapids
#

that sounds so haram

maiden briar
#

I will just make the constructor public from my JavaPlugin, and check with a boolean if the PluginLoader is already into the class

#

I don't know how Bukkit can make it with values

eternal night
#

whats your issue ? cannot access protected constructor ?

wraith rapids
#

the end user has to extend JavaPlugin on Bukkit and whatever else on Bungee anyway

#

what is the point

maiden briar
#

I am creating a class like Bukkit's JavaPlugin, but I have to parse some values to the class

wraith rapids
#

simply split your implementation specific code into two implementation specific classes

maiden briar
#

And I want a no-args constructor for the user

wraith rapids
#

and group your common implementation into a common class

#

and then have your end users extend the implementation specific classes

maiden briar
wraith rapids
#

you do not need reflection

maiden briar
#

Ok show the example then into code

wraith rapids
#

you do not need to instantiate the javaplugin class yourself

eternal night
#

if you want to use reflection, use Class#getDeclaredConstructor to access protected constructors

maiden briar
#

Oh I never knew that, thanks

lofty junco
#

Is this okay?

maiden briar
#

Now I get InstantiationException

#
Constructor<?> javaPluginConstructor = pluginClass.getSuperclass().getDeclaredConstructor(PluginLoader.class);
javaPluginConstructor.setAccessible(true);
this.plugin = (JavaPlugin) javaPluginConstructor.newInstance(this); //This
random epoch
lofty junco
#

My bad sry

wraith rapids
#

the uuid var is of type String

mortal hare
#

why tf doesnt spigot implement methods which can get nms base values of modifiers

#

like

#

the NMS classes already store these attribute values

#

now i need to use compat classes

#

just to access those

#

thanks spigot

eternal night
#

feel free to PR them ^

#

spigot is always happy about contributions

wraith rapids
#

and paper was originally born from the spigot contribution process being too covered in red tape

eternal night
#

idk, contributing to spigot isn't too much effort imho

wraith rapids
#

i don't really contribute to anything ever so dunno

#

but supposedly they originally split off and forked it because it was too annoying to get any changes in

eternal night
#

Nothing wrong with that xD But like complaining about missing API on an open project

young knoll
#

Yeah making a PR isn't too hard

#

But having it merged is another thing

eternal night
#

paper has a different goal than spigot tbh

wraith rapids
#

i think aikar and his disagreement with the skipping ticks thing was a large part

eternal night
#

paper does a lot of things on improved performance and own custom logic on the server

#

spigot really just wants to represent the minecraft server in an API

wraith rapids
#

spigot is fine being where it is

#

paper wants to go forwards

eternal night
#

I think spigot is doing a good job in the ecosystem ¯_(ツ)_/¯

mortal hare
#

that's ok, because NMS store these values anyways the only thing they need is to implement the methods to access the values

wraith rapids
#

good job at slowly dying out

pulsar path
mortal hare
#

check your dependencies

#

wait

#

no

#

are you running right version of java

#

its missing classes for some reason

eternal night
#

Yeah I mean, being a a straight up representation of a code base developed by a weird swede in 2 days isn't really the best business model xD

wraith rapids
#

i still can't figure out what that one guy was trying to achieve

pulsar path
mortal hare
#

JRE 1.8 is deprecated

#

use JRE 11+

wraith rapids
#

like, where is he even going to read the plugin description file and do all of that shit

eternal night
#

I guess he is wrapping plugin logic to act as a middleware between server and plugin

wraith rapids
#

bukkit's not going to call his classes first, they'll be targeting the javaplugin the end user extended

eternal night
#

idk xD ¯_(ツ)_/¯

wraith rapids
#

meaning the constructor of the end user is already happening way before any of his code is even spinning

eternal night
#

let people do dumb things I guess

wraith rapids
#

absolutely incomprehensible

minor garnet
#

how i can check if entity is burning ?

eternal night
#

get the fire ticks and compare them to 0

quaint mantle
#

how can i make actionbar stay longer? all.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(announceMessages.get(messageFromList)));

eternal night
#

I don't think you do

#

it is just a chat message

#

no duration is send to the client

quaint mantle
#

oh rip

eternal night
#

just send it multiple times or smth

quaint mantle
#

okay

#

like 20x?

eternal night
#

I don't think you need to send it every tick xD

#

if that is what you are asking

quaint mantle
#

just want to make it stay for 50 seconds

eternal night
#

probably start an async timer that runs every second

#

and have it send 50 times

#

tho that duration is a wild guess

quaint mantle
#

why is async deprecated?

eternal night
#

huh ?

#

don't think it is

quaint mantle
eternal night
#

oh

young knoll
#

Don't use those ones

eternal night
#

those have been dead forever

young knoll
#

use runTaskTimerAsynchronously

quaint mantle
#

oh okaay

alpine urchin
#

with the consumer

eternal night
#

yeah

#

runnable is for noobs

alpine urchin
#

the one with bukkitrunnable is deprecated

#

@eternal night spigot-test is for noobs

#

pfft

eternal night
#

woah there

#

no need to attack me like that

#

😭

quaint mantle
#

shouldnt i use runTaskTimerAsynchronously?

eternal night
#

Yes

quaint mantle
#

okay

#

doesnt work?

#

ill just use api

eternal night
#
getServer().getScheduler().runTaskTimerAsynchronously(this, task -> {
            
}, 0, 20);
#

?

quaint mantle
#
instance.getServer().getScheduler().runTaskTimerAsynchronously(instance, new Runnable() {
                                @Override
                                public void run() {
                                    for (Player all : instance.getServer().getOnlinePlayers()) {
                                        all.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(announceMessages.get(messageFromList)));
                                    }
                                }
                            }, 0L, 20L);
young knoll
#

You can skip the task part if you don't need it

eternal night
#

concerning he wants to cancel it xD

#

he probably needs it

young knoll
#

ah

quaint mantle
#

yeah

eternal night
#

what is not working with that code tho xD

quaint mantle
#

it appears but doesnt stay

#

like it doesnt repeat

eternal night
#

o.O O.o

#

weird

quaint mantle
#

yea

eternal night
#

are you sure this is what you are actually running xD

#

the method is definitely correct

#

timers execute repeatedly till cancelled

quaint mantle
#

yes it is

modern fox
#
e.getNewArmorPiece().equals(piece.getItem())
``` Why doesn't this work
quaint mantle
#

otherwise it wouldnt send

eternal night
#

idk I cannot reproduce it pavlyi

#

my timer runs just fine

mortal hare
#

any ideas why base value of attribute returns 6.0 as attack damage while in lore section of item it states its 7.0?

#

it doesn't have any modifiers

eternal oxide
#

probably rounding

mortal hare
#

its even stranger for attack speed

#

it states its -2.4 lol

quaint mantle
eternal night
#

ah nice 👌

#

what item are you looking at xD

mortal hare
#

diamond sword

#

eh fuck it

#

i'll just make my own enum class

quaint mantle
wraith rapids
#

the base attributes might be modifiers on the player's base attributes

#

the base damage attribute of the player is 1 so 1+6=7 makes some sort of sense

#

not sure about the attack speed

quaint mantle
#

didnt you just do that?

#

Entity#getHealth()

eternal night
#

attack speed wise, I think the default attack speed is 4.0 xD

#

so -2.4 gets it down to the 1.6

mortal hare
#

you guys are right

#

i added the attributes

eternal night
#

and yea, 6 adds to the one from player

mortal hare
#

and now it provides correct results

#

thanks 🙂

eternal night
#

lit

young knoll
#

I thought weapons all said + x attack damage

#

I was under the impression that + x added to the base of 1

wraith rapids
#

iirc the client displays it as x attack damage instead of +x

#

it's also in a different color than a regular attribute modifier

sharp bough
#

is there a way to add an invisile id to an item, i have a list of items, and i want to give the player the clicked item if he right clicks, and delete this item fron the gui if he presses left click, and delete this from the config file, my only idea was to add a number like 0:itemname and on inv click event take the item name, slip it by : and get the first arg and delete the item from the config file where the id is the same as the first arg in the item name

#

item type, name, lore, enchant, amount, etc can change

#

and damage

wraith rapids
#

use the pdc

lofty junco
#

Does anyone know why my countdown doesent count -1

sharp token
#

guys i need help

#

pls

dusk flicker
#

?ask

queen dragonBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.

wraith rapids
#

you don't need a map there

#

each instance of this TestCountdown has its own set of fields

#

you can store the countdown directly in an int field

#

as for why it doesn't count -1, dunno

sharp token
#

?ask i am kinda new to skripting so i dont know much about it but i want to make it that when you /spawn you need to be out of combat and not moving or be hit for 5 seconds so yea (the combat thingy i have combatX plugin)

dusk flicker
#

are you using skript

eternal night
#

your compute call does not mutate the value given

dusk flicker
#

or java

sharp token
#

skript

wraith rapids
#

die

dusk flicker
#

then leave

lofty junco
chrome beacon
wraith rapids
#

like i just said, dunno

dusk flicker
#

they have a discord for it

#

skript is bad

eternal night
#

your map#compute call

sharp token
#

......

eternal night
#

no ?

sharp token
#

alright guess i go ask bukket

dusk flicker
#

no

#

ask in the skript discord

#

or whatever shit they have

radiant aspen
#

no

#

Just learn Java

sharp token
#

...........

dusk flicker
#

^ that too

lofty junco
sharp token
#

i have started my server on skript already

#

am not switching 190

chrome beacon
radiant aspen
#

Skript is way slower compared to java, any plugin that does something other than send a few messages you should use java

chrome beacon
#

Yes

sharp token
#

...

#

lmfao

#

how

wraith rapids
#

you want to switch now before it's even harder to switch

#

eventually it becomes impossible to switch and then you're truly fucked

chrome beacon
#

?

quaint mantle
#

EssentialsX is disgusting is my opinion.

sharp token
#

bruh

#

get out

chrome beacon
#

Why?

lofty junco
wraith rapids
#

would you rather prefer that

#

uh

#

what was that one plugin called

chrome beacon
#

CMI

#

?

wraith rapids
#

the essentials but bloat and gay one

#

yeah

#

would you rather prefer CMI

sharp token
#

just tell me how to use essentialX to do it

wraith rapids
#

go ask the essentials people

quaint mantle
#

I prefer to code my own

wraith rapids
#

ah yes, the "i didn't write it so I won't use it"

glass sparrow
#

i love cmi

#

content management interface

sharp token
wraith rapids
#

you're not a developer

#

you don't belong here

#

shoo

chrome beacon
sharp token
#

alright

#

bye

modern fox
eternal night
#

👀

quaint mantle
#

damn you guys are pushing him out

sharp token
chrome beacon
#

command for what?

quaint mantle
mortal hare
#

did anyone worked with attributes knows wtf is going on

#

it only happens whenever i switch from sword to sword

#

it doesn't happen if i switch it to some other item

#

like AIR

#
double attackDamage = Math.round((attributes.get(GenericAttributes.ATTACK_DAMAGE).iterator().next().getAmount() + event.getPlayer().getAttribute(Attribute.GENERIC_ATTACK_DAMAGE).getValue()) * 100) / 100d;
double attackSpeed = Math.round((attributes.get(GenericAttributes.ATTACK_SPEED).iterator().next().getAmount() + event.getPlayer().getAttribute(Attribute.GENERIC_ATTACK_SPEED).getValue()) * 100) / 100d;
#

forgive me for this spaghetti mess

quaint mantle
#

kinda hard to read that

mortal hare
#

math.round shits round number to the 2nd decimal

#

attributes gets the attack damage and speed from multimap

#

and event's player attribute instance get the value of player attribute

wraith rapids
#

multimaps are gay

mortal hare
#

i don't use them

#

NMS do

#

NMS is gay then

wraith rapids
#

regrettably

mortal hare
#

event.getPlayer().getAttribute(Attribute.GENERIC_ATTACK_DAMAGE).getValue()

#

that's the cause of glitch

#

i debugged it

#

but still can't seem to think why

#

when switching items this being set to currently held items attribute value

#

shouldn't it be updated

#

whenever i switch the item

#

because it seems the event is called before it happens

#

weird

wraith rapids
#

most events are

eternal night
#

concerning you get to cancel it, pretty sure you gotta do it this way xD

mortal hare
#

that's not what im achieving

#

im trying to get whole value of current players attribute

#

while changing held item

wraith rapids
#

point is that since the event is cancellable it probably happens before any changes are made

mortal hare
#

yea

#

probs

wraith rapids
#

i'm not really sure if there is a good way around that

mortal hare
#

need to find a way how to get past that

wraith rapids
#

might just need to schedule a task

mortal hare
#

but interestingly

#

it works whenever i switch to air

#

it resets it

#

while instantly selecting another sword for example, doesnt

#

fixed it

#

.getValue() -> .getBaseValue()

#

base value method ensures to get value before any calculations are being done with the item attributes

#

neat

sharp bough
#

not working tho

#

i cant cast the event.getcurrentitem to an itemstack

outer crane
#

System.out.println 👀

sharp bough
#

wat

outer crane
#

you should be using a proper logger

eternal oxide
vital ridge
#

can someone help me to understand a bit how people rly find dupes? Not like im trynna create smthing, it just interests me

#

I mean you gotta be rly creative

#

But like

outer crane
#

mess around

vital ridge
#

But you gotta know certain things right

sharp bough
vital ridge
#

If you trynna use clients to make stuff work etc

outer crane
#

the basics ig ¯_(ツ)_/¯

severe folio
eternal oxide
#

He ment deserialize

severe folio
#

oh right

#

well then yea what you sent lol

#

my bad

sharp bough
#

yea

#

i have this

#

            int totalItems = new GetAllItems().getItems();

            System.out.println("test1 " + totalItems);
            System.out.println("test2 " + currentItem);

            for(int items = 0; items < totalItems; items++){
                ItemStack itemDes = ItemStack.deserialize(Main.get().getConfig().getConfigurationSection("items." + items).getValues(true));

                System.out.println("test3 " + itemDes);
                if(currentItem == itemDes){
                    System.out.println("here" + currentItem + itemDes);
                }else{
                    System.out.println("not here " + items);
                }
            }
#

but the if is not working

#

cant see why

sage swift
#

new GetAllItems()

#

what

eternal oxide
#

do NOT use ItemStack.deserialize

sharp bough
#
[18:15:00 INFO]: test2 ItemStack{GOLDEN_APPLE x 64, UNSPECIFIC_META:{meta-type=U
NSPECIFIC, display-name=ºrtest}}
[18:15:00 INFO]: test3 ItemStack{GOLDEN_APPLE x 64, UNSPECIFIC_META:{meta-type=U
NSPECIFIC, display-name=ºrtest}}
[18:15:00 INFO]: not here 0
[18:15:00 INFO]: test3 ItemStack{STAINED_GLASS_PANE x 64}
[18:15:00 INFO]: not here 1
[18:15:00 INFO]: test3 ItemStack{STAINED_GLASS_PANE x 64}
[18:15:00 INFO]: not here 2
[18:15:00 INFO]: test3 ItemStack{STAINED_GLASS_PANE x 64}
[18:15:00 INFO]: not here 3
[18:15:00 INFO]: test3 ItemStack{STAINED_GLASS_PANE x 64}
[18:15:00 INFO]: not here 4
[18:15:00 INFO]: test3 ItemStack{WOOL x 64, UNSPECIFIC_META:{meta-type=UNSPECIFI
C, display-name=ºrwhite}}
[18:15:00 INFO]: not here 5
[18:15:00 INFO]: test3 ItemStack{WOOL x 64, UNSPECIFIC_META:{meta-type=UNSPECIFI
C, display-name=ºrorange}}
[18:15:00 INFO]: not here 6
[18:15:00 INFO]: test3 ItemStack{WOOL x 64, UNSPECIFIC_META:{meta-type=UNSPECIFI
C, display-name=ºrº4magenta}}
[18:15:00 INFO]: not here 7
[18:15:00 INFO]: test3 ItemStack{WOOL x 64, UNSPECIFIC_META:{meta-type=UNSPECIFI
C, display-name=ºrº6light blue}}
[18:15:00 INFO]: not here 8
[18:15:00 INFO]: test3 ItemStack{WOOL x 1}
[18:15:00 INFO]: not here 9
[18:15:00 INFO]: test3 ItemStack{WOOL x 32, UNSPECIFIC_META:{meta-type=UNSPECIFI
C, display-name=ºrº6light blue, lore=[ºrºrº4test]}}
[18:15:00 INFO]: not here 10
[18:15:00 INFO]: test3 ItemStack{WOOL x 32, UNSPECIFIC_META:{meta-type=UNSPECIFI
C, display-name=ºrº6light blue, lore=[ºrºrº4test], enchants={LURE=0}, ItemFlags=
[HIDE_ENCHANTS]}}
[18:15:00 INFO]: not here 11
>```
sharp bough
sharp bough
#

whats wrong with that lmao

eternal oxide
sage swift
#

ConfigurationSection#getItemStack()

severe folio
paper viper
severe folio
#

myConfig.getItemStack("path.to.item.stack");

eternal oxide
#

and to put it in, myConfig.set("path", itemStack);

severe folio
#

^

paper viper
#

and also pretty sure == is wrong here

upper mica
#

== should be ItemStack#equals because its not the same instance

paper viper
#

Yep

#

or .similar if you want to ignore the count

sharp bough
#

thank you everyone, once again you solved my problem and gave me the friendly reminder that i still dont know shit

#

haha

severe folio
#

is Lombok any good or should I avoid it

eternal oxide
#

It makes you lazy

severe folio
#

so... bad?

eternal oxide
#

It has its uses, if your project is MASSIVE

severe folio
#

yea i suppose so

ivory sleet
#

lombok is arguably useless

eternal oxide
#

I used it for a while in some projects. Then I found I was forgetting how to do the most basic things.

ivory sleet
#

unlike any other library for instance guava, caffeine or whatever you like lombok doesn't provide any meaningful value imo

ivory sleet
#

Why do you want to use lombok btw

#

or like what's your motive

severe folio
#

not really sure tbh, it was just a random question

ivory sleet
#

I would say this, try it out at least

eternal oxide
#

Its fun to experiment with if you have never used it

ivory sleet
#

get your own opinion on it

eternal oxide
#

I find everyone has an opinion, but mine is always right 🙂

severe folio
#

fair enough lol

graceful turret
#

how to get config insttance in other classes?

ivory sleet
#

probably want to pass the instance

sullen marlin
ivory sleet
#

You can generate setters and getters with almost any modern IDE. toString is also something you can generate with IDE and implementing it without lombok can arguably be advantageous since the implementation becomes more visible, same thing with hashCode and equals. Those can also be generated with an IDE and by not using lombok you can very easily change the implementation as I presume the annotations have some sort of default implementation.

desert crag
#

i LOVE lombok 😌

wraith rapids
#

not worth the headache imo

#

takes longer to write the annotation than to alt-ins and generate the methods

sullen marlin
ivory sleet
#

Garbage code?

sullen marlin
#

Waste of space

ivory sleet
#

I mean its a compiler hack so the method will still be there

north ridge
#

Thats not a reason to resort to compiler hacks

wraith rapids
#

if only we could like, collapse sections of code, or something

eternal night
#

impossible nny

sullen marlin
#

The compiler literally has an annotation processing api

north ridge
dusk flicker
#

@jade perch you still got your lombok.txt?

eternal oxide
#

Not sure I can remember the last time I made a change to a toString, equals or hashcode. Getters and setters I can agree are somewhat useful.

north ridge
#

I can bring in an lombok.txt

desert crag
#

?plsnolombok

sullen marlin
#

Implementation details of lombok /=/ the features I described

jade perch
dusk flicker
#

read that.

sullen marlin
#

I would fully support a less hacky version of lombok that does only the things I listed

north ridge
#

Also

#

Images are disabled here?

sullen marlin
#

I disagree either of those is a better option

north ridge
#

Are imgur links allowed?

dusk flicker
#

Verify yourself

wraith rapids
#

you disagree with many things

naive gorge
#

can someone help me? there is a file called delete in my minecraft server files!!! and its deleting protocol lib, i dont want protocol lib to be deleted!!!!

north ridge
#

Too much of a hassle, sad

wraith rapids
#

what

#

lmao

dusk flicker
#

lmao

#

thats a new one

north ridge
wispy fossil
#

new covid strain deleted protocol lib

naive gorge
#

😄 but serious tho

north ridge
#

Also, since I cant post images,

Why is Lombok bad?
- It's a compiler hack - the Java compiler isn't designed to modify code, so it can cause difficult to debug errors, or worse
- It requires an IDE plugin, so unless you've properly configured Maven, Gradle and your IDE, you'll get hundreds of compilation errors. This process takes time too, it's not easy
- Lombok'd code won't show in Javadocs
- The code generation is often unpredictable and difficult to debug, and often you'll have to do it "the hard way" anyway
- Java is supposed to be explicit, Lombok hides a lot of key functionality into a subtle annotation which can be easy to miss
- While IDEs support it with a plugin, it's usually more difficult to find specific things, like usages of a getter because they don't exist in the source code
- Finally, Lombok'd bytecode doesn't match the source code, so it causes a pretty annoying warning in IntelliJ
wraith rapids
#

make sure to wear a mask so your system doesn't get infected

jade perch
#

you have failed

sullen marlin
#

I’ve discussed the method reasons above, and moving languages is a silly solution that doesn’t solve the problem

north ridge
#

Where is your copy pasta?

sullen marlin
#

And lombok does show in javadocs

sullen marlin
#

See bungeecord docs

north ridge
onyx shale
ivory sleet
#

Saying that the hashCode, toString and equals have to be updated all the time isn't true. It very much depends on how the class looks. Then of course if you just want everything to be as short as possible java isn't probably the suited language and like nny said we can easily generate fresh hashCode, toString and equals methods which are not garbage. Then we have records which abstracts away hashCode, getters, setters, toString and equals which makes all of your listed annots quite useless.

north ridge
onyx shale
#

like we know it has bad things,but our fully researched profesionally trained olimpic programmers are making it the best

north ridge
#

This txt file was already heavy debated and reasoned against on helpchat

jade perch
#

lombok flamewars are fun

north ridge
#

😌

sullen marlin
#

Netbeans doesn’t need an ide for lombok either

#

Literally none of those points apply to me

north ridge
wraith rapids
#

few things apply to you

onyx shale
dusk flicker
north ridge
#

xD

dusk flicker
#

yes... he uses netbeans

north ridge
#

Alright, fair enough then

desert crag
#

my man is stuck in 2001

jade perch
#

@ivory sleet have you used taskchain before?

ivory sleet
#

still records will make lombok annots like @Getter and @HashCode pretty much useless

assume you only want to create a basic pojo

#

yeah

eternal night
#

I haven't found a lombok plugin for windows notpad tbh

jade perch
#

It's my new favorite

sullen marlin
#

Records fill a different niche with some overlap

#

They’d replace maybe half of lombok usage for me

ivory sleet
#

yeah

north ridge
#

Id still say lombok is still a cheap attempt at what something else solves in a much better and concise way.

#

lmao what?

eternal night
#

👀

desert crag
#

why so

onyx shale
#

ikr thats why i use java 11

desert crag
#

lol

north ridge
#

lol

eternal night
#

kekw

desert crag
#

they are extremely useful

#

modernising java

onyx shale
#

idk what was added in java 9

jade perch
#

Java 16 when

wraith rapids
#

someone deleted my message smh

eternal night
#

reflection ban hammer was added in 9

wispy fossil
#

1984

onyx shale
#

i dont bother checking the patchlogs i just code shit

north ridge
wraith rapids
#

i fundamentally disagree with reflection getting cucked in 9

desert crag
north ridge
#

Reflection is just limited

#

You can still expose whatever you want exposed

wraith rapids
#

not really

north ridge
#

modules provide settings for that

#

open, exports

eternal night
#

Yeah but now you have to expose

north ridge
#

You could even open to specific other modules

wraith rapids
#

can't f.e reflect into the fields of propietary classes from the java standard libraries

north ridge
#

You can choose to stay in the unnamed modules part

wraith rapids
#

the closest to that I've seen is some methodhandles hack

eternal night
#

Well then you are just not using jigsaw xD

north ridge
#

Jigsaw isnt forced to be used

wraith rapids
#

but it was convoluted and pretty annoying to set up

sullen marlin
#

complaining about how lombok uses hacks

sullen marlin
#

complaining can’t use hacks

north ridge
wraith rapids
#

can't and will not are different things

#

the point is that I can choose not to use hacks

north ridge
sullen marlin
#

You can also choose not to use lombok?

north ridge
#

It modifies bytecode

sullen marlin
#

What logic is this

wraith rapids
#

yes

ivory sleet
#

I have nothing against the compiler hack as some depict lombok just think it's not meaningful 🤷

wraith rapids
#

which is why I'm fundamentally fine with lombok's existence

north ridge
#

Choose not to use it

wraith rapids
#

it is your choice to use it

#

you can use whatever you see fit

north ridge
#

🥲

eternal oxide
#

So we decide which IDE is best next? 😛

wraith rapids
#

groupmanager is bad

eternal night
#

nah nah, do python vs java or something xD

ivory sleet
#

pex is good then?

desert crag
#

ever heard of haskell?

wraith rapids
#

yes

eternal night
#

or kotlin

wraith rapids
#

i unironically use pex on prod

sullen marlin
#

Haskell is for plebs

ivory sleet
#

@sturdy venture

desert crag
#

why so

sullen marlin
#

Prolog or bust

desert crag
#

FP good

eternal night
#

👀

#

if it isn't all recursion I don't want it

sturdy venture
#

OH MY

#

OH MY LORD

#

NO NO NO

desert crag
#

it absolutely is

north ridge
sturdy venture
#

NO NO N ONON ON ON

sullen marlin
north ridge
#

WHATTT

#

HOWW

#

DARE

wispy fossil
desert crag
#

haskell 🥰

north ridge
#

YOU

quaint mantle
#

whats happening

sturdy venture
#

oh there's a caps filter

ivory sleet
#

lol

north ridge
#

there is?

#

xD

sturdy venture
#

please confirm

#

please

desert crag
#

LOL

north ridge
#

Haskell good

wraith rapids
#

cringe

north ridge
sturdy venture
eternal night
#

if you don't use haskell in prod are you even a developer

wraith rapids
#

i'm more verified than you are

north ridge
#

Lynx knows whats up

sturdy venture
wispy fossil
#

Were switch cases only implemented in Java 12?

sturdy venture
#

yes indeed

#

many people didn't realise that java didn't actually have variables until java 5

sullen marlin
#

Uh

paper viper
#

md_5 how many times you use google

#

on a daily basis

desert crag
paper viper
#

the lambdas

#

kinda

#

with the arrows

ivory sleet
#

var x = switch (y) {
case 1 -> { yield 2; };
};

#

Or smtng

wispy fossil
#

oh I misread

paper viper
#

@ivory sleet

#

is my lib bad

#

lmao

ivory sleet
#

No it’s good

wispy fossil
#

no your lib is precious

sturdy venture
ivory sleet
#

Just that I happened to see that your api implemented itself

#

Sorta

sturdy venture
#

and thus, the java serialization api was created

ivory sleet
#

I think

sturdy venture
#

to make this easier

paper viper
#

like the nms?

ivory sleet
#

Uh the api I think

paper viper
#

o

ivory sleet
#

Do you have a common module btw?

paper viper
#

No

#

this is only spigot right now

#

i need to make common, nukkit

#

and stuff like that

ivory sleet
#

That will be essential if you wanna make it multi platform

#

Yeah

paper viper
#

Mhm

#

im going to count how many classes in my lib use the spigot import

#

and then i just need to create impl for those

sturdy venture
ivory sleet
#

Yeah just abstract the shit out of it

quaint mantle
#

is there a way to get the command in TabCompleteEvent

paper viper
#

so bukkit and spigot imports right

sturdy venture
#

wtf why do you have the same pfp

#

I thought you were the same person

ivory sleet
#

Yeah we can have a closer oloook tmrw need to study now heh

paper viper
#

k lmao

ivory sleet
#

Lol

quaint mantle
#

i dont want the last part

#
if (event.getCompletions().equals(tabCompletions)) {
#

its not guarenteed to be my command

sullen marlin
#

why you need the event??

#

but you shouldnt need the event

quaint mantle
sturdy venture
#

Fer·nan·do Pó·ov

daring sierra
wispy fossil
wraith rapids
#

goes in the bucketmc

#

comes from the spigotmc

subtle vector
#

how do i check if the player if holding a certain sword that i made.

wraith rapids
#

get the held item and compare

subtle vector
wraith rapids
#

it does

#

you're just doing it wrong

subtle vector
daring sierra
wraith rapids
#

for equals to be true, the items must be exactly identical

#

but equals is not the only way to compere two items

#

like I answered yesterday when you asked the same question, look into this