#help-development

1 messages Β· Page 669 of 1

hybrid turret
#

you def can

#

i used it everywhere

#

and it works

icy beacon
#

fair enough

#

storing players in a map/list is a no-go anyway

#

you should store uuids

hybrid turret
#

yeah but then i'd have another instanceof check

icy beacon
#

?

hybrid turret
#

bc CommandSender doesn't have a uuid

#

only player does

icy beacon
#

ah

hybrid turret
#

that was my main problem with noobdog's code

icy beacon
#
private void handleDeathChange(final CommandSender sender) {
  GlobalBooleanUtils.setDeathEnabled(!isDeathEnabled);

  final String toggledState = !isDeathEnabled ? "&aactivated" : "&cdisabled";
  sender.sendMessage(formatColors(ServerSystem.getPluginPrefix() + "You successfully " + toggledState + " &3noDeath&7."));

  for (final Player onlinePlayer : Bukkit.getOnlinePlayers()) {
    if (onlinePlayer == sender) continue;
    
    final String executorName = (sender instanceof Player) ? ("&b" + sender.getName()) : "An &4administrator");
    onlinePlayer.sendMessage(formatColors(ServerSystem.getPluginPrefix() + (executorName + " &7has " + toggledState + " &3noDeath&7."));
  }
}

// somewhere else
public static String formatColors(final String argument) {
  return ChatColor.translateAlternateColorCodes('&', argument);
}

this is how i'd do it, not much difference but i think this code is a bit easier to read

hybrid turret
#

yeah ppl said that 100 times now

#

but yet again that would again be a whole refactor of my code

icy beacon
#

that's true, i was going to tell them to use a format convenience method but i was too lazy

hybrid turret
#

i know

#

not really lol

#

well depends on how much i still add tbh

#

which nested if

hybrid turret
#

oh ic

#

whoops

icy beacon
#

or in kotlin you could do

fun String.formatColors() = ChatColor.translateAlternateColorCodes('&', this)

but i'm not going to make you change a language just for that lol

#

use what you're comfortable with

hybrid turret
#

uhm

#

since i don't understand yet what translateAlternateColorCodes does, i'll wait with that

#

and i sadly don't have the time for that rn

icy beacon
#

that's a method that translates chatcolors in a string

#

i switched to kotlin from java without much trouble

#

typo

icy beacon
#

basically what you should use for chat colors

kindred sentinel
#

Could anyone please help me with an error?
Code

    public void onSignClick(PlayerInteractEvent event) {
        Player player = event.getPlayer();
        Block clickedBlock = event.getClickedBlock();
        Material blockMaterial = clickedBlock.getType();
        String blockName = blockMaterial.name();
        System.out.println(blockMaterial.name());
         if(blockName.contains("SIGN")) {
             Sign sign = (Sign) clickedBlock;
         }
    }

Error

Caused by: java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_19_R3.block.CraftBlock cannot be cast to class org.bukkit.block.Sign (org.bukkit.craftbukkit.v1_19_R3.block.CraftBlock and org.bukkit.block.Sign are in unnamed module 
icy beacon
#

i started by making some utils in kotlin for my project, and now i'm recoding the entire thing in kotlin xD

#

πŸ˜„

hybrid turret
#

can't i, at this point just use ChatColor.COLOR?

#

isn't that a thing?

icy beacon
kindred sentinel
#

Thanks!

languid urchin
hybrid turret
#

oh wia

#

wait

icy beacon
#

a lot of stuff is similar or identical. if you have intellij, you can make a java class and then convert it to kotlin with intellij (it'll probably break if the class is more or less complex lmao) and then you analyze what you see before yourself

hybrid turret
#

how is the format thing called then?

#

or when

icy beacon
#

it's literally in the code

hybrid turret
#

uhm

icy beacon
languid urchin
#

ChatColor.translateAlternateColorCodes

hybrid turret
#

then i was blind

#

oh

#

sorry lol

#

is it cleaner to import the class the formatting-method is in or the method from that class?

#

probably the latter no?

icy beacon
#

i say, make a utils class

hybrid turret
#

did

#

i did that

wheat flint
#

ProtolLib PacketType.Play.Server.PLAYER_INFO issues

icy beacon
#
private fun handleDeathChange(sender: CommandSender) {
  GlobalBooleanUtils.setDeathEnabled(!isDeathEnabled)

  val toggledState = !isDeathEnabled ? "&aactivated" : "&cdisabled"
  sender.sendMessage("${ServerSystem.pluginPrefix}You successfully $toggledState &3noDeath&7.".formatColors())

  for (onlinePlayer in Bukkit.getOnlinePlayers()) {
    if (onlinePlayer == sender) continue
    
    val executorName = if (sender instanceof Player) "&b${sender.getName()}" else "An &4administrator";
    onlinePlayer.sendMessage("${ServerSystem.pluginPrefix}$executorName &7has $toggledState &3noDeath&7.".formatColors())
  }
}

// somewhere else
fun String.formatColors() = ChatColor.translateAlternateColorCodes('&', this)

try to analyze this code and see what you can and cannot understand

#

(this was written without an IDE so it might be a bit clunky)

hybrid turret
#

yeah obviously. just if I should use

import package.UtilityClass;

UtilityClass.formatString();

or

import static package.UtilityClass.formatString;

formatString();
icy beacon
hybrid turret
#

ic

#

thanks

icy beacon
#

you can explicitly specify the type but it's often more convenient not to

#
val number: Int = 39
#

oh and there are no primitives

hybrid turret
#

alright final paste

#

this would be correct then?

icy beacon
#

Int, Double, Boolean, etc, they are all classes

hybrid turret
icy beacon
hybrid turret
#

well it's being set everytime the command is executed, so it doesnt matter, no?

icy beacon
#

this is a static variable

#

it's created as soon as the class is created

#

and it's final

#

it is never changed

hybrid turret
#

oh-

#

wait

#

damn

#

removed static

#

then it should be right(?)

icy beacon
#

this still should not work because you never change it

#

if you want to map it to a command call, make a map<uuid, boolean>

hybrid turret
#

well that is true indeed

#

why did i include that lmao

#

that's dumb

#

nah i just changed every use if isDeathEnabled to GlobalBooleanUtils.isDeathEnabled()

#

and removed it

#

huh?

icy beacon
#

didn't read the whole thing so idk

hybrid turret
#

wait i feel like i should know this but is continue just the opposite of return?

#

OHHHHHHHHHHH

#

that makes a lot more sense

#

lmao

#

whoops

icy beacon
#
for (int i = 0; i < 10; i++) {
  if (i == 5) continue;
  if (i == 7) return;
  System.out.println(i);
}

will print 0, 1, 2, 3, 4, 6

lilac dagger
#

nope

#

return breaks the loop

kindred sentinel
#

Another error

Caused by: java.lang.NoSuchMethodError: 'boolean org.bukkit.event.block.Action.isRightClick()'

Code

    public void onSignClick(PlayerInteractEvent event) {
        if(event.getAction().isRightClick()){
           System.out.println("ASD")
         }
    }
lilac dagger
#

the scope

eternal night
#

that is paper-api

kindred sentinel
#

idk

icy beacon
#

seven ate nine, so

hybrid turret
#

xd

kindred sentinel
#

oh

#

i got it

#

i accidentally created the paper plugin

#

πŸ’€πŸ’€πŸ’€

hybrid turret
#

why is that?

quaint mantle
#

I made a webhook system but no messages arent sent why is that? no errors are generated in console either

#

?paste

undone axleBOT
#

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

quaint mantle
#

yeah figured the nocode out sending it

hybrid turret
#

lack of time rn lol

#

i don't see why it would

icy beacon
# hybrid turret why is that?

if you never update the variable, but the method decides to return a different value, you'll never know that it does

#

because you're using the old value

hybrid turret
#

bc i change the accessed value with a getter and setter

hybrid turret
#

what

icy beacon
#

you assume that the value is updated every time you call the command

#

no

#

the command calls the method onCommand

#

not the class instantiation

#

the class is instantiated once

hybrid turret
#

oh

icy beacon
#

if you instantiate the value in the class instantiation you're gonna have that value all the time

hybrid turret
#

well that makes my work from the last week useless

#

changed about 60 files

#

nice

icy beacon
#

if you instantiate the value in onCommand it's gonna update every time you call a command

hybrid turret
#

but it makes sense. bc the commands are only instantiated onEnable()

hybrid turret
#

but if i use getters and setters, why does it still break stuff?

hybrid turret
#

yeah that's what i said lol

icy beacon
#
class MyClass implements CommandExecutor {
  private boolean something = Utils.someMethod(); // this is called when you create an instance of the class

  @Override
  public void onCommand(....) {
    // this is when you call a command
  }
}

new MyClass() // here you create an instance of the class

thus if you have a variable in the very class scope, you only create it once, and even if the method updates, your value will stay at what it was at the very beginning, when you initialized your class. if you want it to update every time you call a command, move it into onCommand:

  @Override
  public void onCommand(....) {
    private boolean something = Utils.someMethod();
  }
#

the second way is perfectly fine and should not break

#

the first one is bound to break if Utils.someMethod() does not constantly return the same value

// just for the sake of explanation:
// this returns the same value constantly
public static boolean someMethod() {
  return true;
}

// this does not return the same value constantly
public static boolean someMethod() {
  if (System.currentTimeMillis() % 5 == 2) return true;
  return false;
}
remote swallow
#

hes too used to kotlin smh

#

forgets about new

quaint mantle
#

epic

#

could u help?

icy beacon
#

fixed

remote swallow
quaint mantle
#

oh where am I better of asking?

remote swallow
#

here but later

wheat flint
flint coyote
#

Is it reasonable to use a "one-time-setter" (exception when called again) to set a variable inside an API-class that gets extended? In order to save every extending class to define a constructor and call the super constructor?

Or are there better ways?

This would be the usual way.

@AllArgsConstructor
public abstract class EventDefinition implements EngineDefinition {

    public final RegionEvent regionEvent;

That however does force every implementation to define a constructor.

public class InstantMine extends EventDefinition {

    public InstantMine(RegionEvent regionEvent) {
        super(regionEvent);
    }

I'm trying to avoid that the extending classes require the constructor.
I could set the value via reflection. Since it's called during runtime from time to time, that is probably not the best solution though.

flint coyote
#

Oh that's good to know. I was unsure if that's a bad pattern

#

Then I'll go with it

lilac dagger
#

that or you can make an addon system

flint coyote
#

As in?

lilac dagger
#

as in you force them to extend a class and inside that class have a package private init

flint coyote
#

well I'm trying to reduce the code for extending classes

#

That sounds like the constructor but different

lilac dagger
#

it's up to you how you approach it

flint coyote
#

I'll figure something out. Just had to know whether that pattern is reasonable or not

#

The package-private thing won't work since all relevant classes for the API are inside a seperate package.
I wish java had the "internal" modifier that kotlin got

lilac dagger
#

you can do what bukkit did

#

it's a resonable way

flint coyote
#

yup I'm doing that right now

lilac dagger
#

just throw an exception if the method is used again

#

and make sure you're the first to set it

kindred sentinel
#

How to get the click in PlayerInteractEvent? like was it right or left click?

flint coyote
#

I can't make sure I'm first since I'm using an abstract builder. However if they set it beforehand it will result in an error, that's fine.

kindred sentinel
#

.name?

tender shard
#

get what from the action?

wary topaz
#

intellij is not giving me a error

tender shard
#

not a development question

wary topaz
#

execute as

kindred sentinel
flint coyote
tender shard
kindred sentinel
north nova
#

what

remote swallow
#

no

north nova
#

why

#

event.getAction.equals(Action.RIGHT_CLICK)

remote swallow
#

event.getAction() == Action.RIGHT_CLICK_AIR

north nova
#

its an enum

kindred sentinel
#

oh i got it thanks

tender shard
#

why would you check the name

kindred sentinel
#

idk

north nova
tender shard
#
    public static boolean isRightClick(Action action) {
        return action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK;
    }
    
    public static boolean isLeftClick(Action action) {
        return action == Action.LEFT_CLICK_AIR || action == Action.LEFT_CLICK_BLOCK;
    }
kindred sentinel
#

Oh thanks!

north nova
#

event.getAction().name().toLowerCase().toUpperCase().equalsIgnoreCase("RiGhT_CliCk")

#

πŸ‘

timid hedge
#

Why does it say Cannot resolve constuctor ComponentBuilder()?
ComponentBuilder builder = new ComponentBuilder();

icy beacon
#

?nocode

undone axleBOT
#

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

timid hedge
#

?paste

undone axleBOT
tender shard
# north nova event.getAction().name().toLowerCase().toUpperCase().equalsIgnoreCase("RiGhT_Cli...
    private static final IntSet RIGHT_CLICK_ORDINALS = IntSet.of(Arrays.stream(Action.values()).filter(action -> action.name().contains("RIGHT_CLICK")).mapToInt(Enum::ordinal).toArray());
    private static final IntSet LEFT_CLICK_ORDINALS = IntSet.of(Arrays.stream(Action.values()).filter(action -> action.name().contains("LEFT_CLICK")).mapToInt(Enum::ordinal).toArray());

    public static boolean isRightClick(Action action) {
        return RIGHT_CLICK_ORDINALS.contains(action.ordinal());
    }

    public static boolean isLeftClick(Action action) {
        return LEFT_CLICK_ORDINALS.contains(action.ordinal());
    }
icy beacon
tender shard
#

then it would return !Logic.UNTRUE or sth though

icy beacon
#

fair enough

#

and it'd use a factory factory

timid hedge
opal carbon
#

untruelogicfactoryfactorybuilder

icy beacon
tender shard
icy beacon
#

oh mmy god this is an enum that is not an enum

#

how graceful

tender shard
gilded granite
#

?paste

undone axleBOT
opal carbon
#

tempted to make a plugin with really bad code sometime

#

then ask people to code review it

icy beacon
remote swallow
#

use javac directly too

tender shard
opal carbon
icy beacon
#

and overindustrialized

opal carbon
#

like that logic class that dpesnt need to exist

icy beacon
#

tf do you mean, yes it does

#

how else would you handle logic

remote swallow
#

make it all in 1 class too

#

and all static

opal carbon
#

oh god

icy beacon
#

code it in some jvm language that is not java or kotlin

remote swallow
#

scala

icy beacon
#

yeah

opal carbon
#

html

remote swallow
#

jphp

icy beacon
#

code it in delphi and write a converter to java

wary topaz
#

how do I use completeablefutures whencomplete?

timid hedge
wary topaz
#

Message.getMessage(player.getUniqueId()).whenComplete(language::player.sendMessage(language););

remote swallow
wary topaz
tender shard
# wary topaz Message.getMessage(player.getUniqueId()).whenComplete(language::player.sendMessa...

Lambdas and Method references can be used to make your code way shorter, and (sometimes) more readable by getting rid of anonymous classes. What are Anonymous Classes? Anonymous classes are like local classes without a name. Imagine you have the following code: We hereby declare and instantiate a class implementing java.lang.Runnable that just p...

remote swallow
icy beacon
tender shard
#

no

#

it's in spigot too

icy beacon
#

oh well

lilac dagger
#

that's just md's package

wary topaz
#

Message.getMessage(player.getUniqueId()).whenComplete((result, ex) -> player.sendMessage(result));
tysm

tender shard
#

i suggest to read the above blog post to understand what lambdas and method references actually are and how they work ^

wary topaz
#

im not getting any errors but its supposed to be sending me a message

remote swallow
#

you dont do anyhting

#

you should also have an ex.printStackTrace()

#

in the sendMesasge block

wary topaz
#

there is no exception

remote swallow
#
Message.getMessage(player.getUniqueId()).whenComplete((result, ex) -> {
ex.printStackTrace();
player.sendMessage(result);
});

timid hedge
#

Code:
https://paste.md-5.net/dayohofutu.cs

Imports:

import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.*;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDeathEvent;

import java.util.Arrays;

pom:
https://paste.md-5.net/sakihikuwe.xml

The error is that is dosent understand ComponentBuilder builder = new ComponentBuilder(); and .retain(ComponentBuilder.FormatRetention.NONE).append(Slag)

wary topaz
#

ohhh

remote swallow
wary topaz
#

i didnt know there was an ex

#

thanks lol

icy beacon
# timid hedge Code: https://paste.md-5.net/dayohofutu.cs Imports: ``` import net.md_5.bungee....

tbh it just could be that 1.8.8 does not have these particular classes, because who the fuck knows what is up with 1.8.8. try switching the version to something not so badly legacy, at least 1.17.1, and see if the error persists. if it doesn't, then the version 1.8.8 just does not have these classes. if it does, something else is the problem, try invalidating the caches and see if that helps

wary topaz
remote swallow
#

the sqlConnection in ur Message class is null

worldly ingot
wary topaz
#

but its not

icy beacon
remote swallow
#

but it is

remote swallow
icy beacon
#

got it

remote swallow
#

if you didnt have a whenComplete that would be better

worldly ingot
#

That throws an NPE if no error was thrown, Epic

#

The exception and result are exclusively nullable

remote swallow
#

oh true

icy beacon
#

actually why is it whenComplete and not thenAccept

worldly ingot
#

I mentioned a solution last night, didn't I?

wary topaz
#

I fell asleep

#

πŸ₯±

icy beacon
#

i do not remember using whenComplete a single time

worldly ingot
#

I did

remote swallow
worldly ingot
wary topaz
#

and that is why I am using whenComplete

remote swallow
#

use the rest of chocos code too

icy beacon
#

hm, is whenComplete just a shortcut for exceptionally.thenAccept?

remote swallow
#

thenAccept would run async too iirc

icy beacon
#

yeah i think so

wary topaz
#

if (cmd.getName().equals("set")) {
Message.setMessage(player.getUniqueId(), args[0]);
sender.sendMessage("confirm");

    }

is not giving me an error so it must not be null

worldly ingot
#

exceptionally() returns a value when an exception is thrown whereas whenComplete() does not

#

handle() however is closer to what you mentioned

#

You have 4 main methods
thenAccept(T) - Runs only if completed normally, returns no value
whenComplete(T, E) - Runs if completed normally or exceptionally, returns no value
exceptionally(E) - Runs if completed exceptionally, returns a new value
handle(T, E) - Runs if completed normally or exceptionally, returns a new value

#

You also have map(T) which is handy and will map the value if completed normally (much like thenAccept(), but it returns something)

#

CFs are great and very powerful πŸ™‚

tender shard
wary topaz
#

its for debug purposes to test the mysql

icy beacon
wary topaz
#

i put both commands in the same class

#

im going to remove them when this works out

icy beacon
#

please remove them right away

wary topaz
#

how would I test sql

opal carbon
#

wait how

#

how do you have two onCommands

wary topaz
#

I have one

remote swallow
icy beacon
tall dragon
opal carbon
#

but why then

tall dragon
#

Β―_(ツ)_/Β―

icy beacon
#

i have no fucking clue this is stupid

wary topaz
#

thats wh y ihave cmd.getName

#

to switch the two commands

#

canb someone just help me wit hthe thing

wary topaz
#
@Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        Player player = (Player) sender;
        if (cmd.getName().equals("set")) {
            Message.setMessage(player.getUniqueId(), args[0]);
            sender.sendMessage("confirm");

        }
        if (cmd.getName().equals("get")) {
            Message.getMessage(player.getUniqueId()).whenComplete((language, e) -> {
                if (e != null) {
                    e.printStackTrace();
                    return;
                }

                player.sendMessage(language);
            });
        }
        return true;
    }```
#

why is get null and set is not

remote swallow
#

show ur Message class

wary topaz
remote swallow
#

it is most literally null

icy beacon
#

why is this goddamn thing static

#

it literally does not have to be fucKING STATIC

wary topaz
#

where di i set that?

remote swallow
#

you currently dont

timid hedge
wary topaz
#

omg I set the real sqlCon in ,my main class

#

tysm lol

#

I messed up lol

#

PreparedStatement preparedStatement = LobbyManager.sqlCon.prepareStatement("SELECT language FROM PlayerData WHERE uuid = ?");

#

and that has to be static

tall dragon
#

why

wary topaz
#

main class

tall dragon
#

so?

wary topaz
#

im not giving that class access to it

icy beacon
#

no it does not

wary topaz
#

its just easier

remote swallow
#

✨ singleton pattern ✨

icy beacon
wary topaz
#

its just a pain in the butt\

icy beacon
#

dependency injection is, not in the slightest, a pain in the butt

wary topaz
#

I am not ?di'ing

icy beacon
#

i will do it for you

#

?di

undone axleBOT
icy beacon
#

there you go

wary topaz
#

ughh fine

icy beacon
#

good practices are worth your time

timid hedge
icy beacon
#

yeah create multiple components and add them together

sage patio
#

how i can get title of an inventory? iirc there was a getTitle() method but isn't now

tall dragon
#

getView

sage patio
#

thanks

wary topaz
tall dragon
#

which is valid

icy beacon
#

what the fuck is this

tall dragon
#

abusing static just is not smart

icy beacon
#

why is this variable static

wary topaz
#

cause the getMessage is static

icy beacon
#

and why is it static?

wary topaz
#

because I dont want to renew the class every time I want to use it

#

that would require me to put the plugin variable every time

#

im just using java's static reference

icy beacon
#

don't, instantiate one copy of Message in, for example, your main class, then pass your main class around

wary topaz
#

but than I would need to have the main class in every class

icy beacon
#

does that hurt?

wary topaz
#

kind of

icy beacon
#

no

#

in most of my projects, like 80% of the classes have an instance of the main class

#

it's called convenience

remote swallow
#

me

#

same

tall dragon
#

well thats how java works

#

well

#

thats how oop works

icy beacon
#

^

#

this is stage 1 "denial"

tall dragon
#

yea xD

timid hedge
wary topaz
#

so I can NEVER use static? ever?

remote swallow
#

you can

tall dragon
#

you can

icy beacon
remote swallow
#

just use it correctly

icy beacon
#

keep it to a minimum

wary topaz
#

"correctly"

icy beacon
#

constants for example

#

global utils maybe

wary topaz
#

this is a global util

remote swallow
#

read

hazy parrot
#

Statics can basically be anything that doesn't have any state

wary topaz
#

getMessage is for guis, messages, configs

icy beacon
icy beacon
#

because i need a database instance and a datamanager instance

#

both are powered by an adapter which runs together with bungeecord

#

which needs a plugin instance to receive the message

timid hedge
#

?img

undone axleBOT
#

Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.

Here's some screenshot utilities that can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org

icy beacon
#

just use di

wary topaz
#

finee

tall dragon
#

if u want to make those methods static

icy beacon
tall dragon
#

u would have to pass the plugin into it

#

but thats questionable

icy beacon
#

yeah and that's inconvenient

#

what's better, passing the plugin once for di or passing it every time you call a method

remote swallow
#

painful

icy beacon
#

mb

remote swallow
#

and wrong

#

every database interaction should get its own connection

wary topaz
#

wdym

remote swallow
#

you should save the mysql connection pool variable and then give sql stuff access to call getConnection

tall dragon
#

i can now connect to his database POGGERS

remote swallow
#

its a connection POOL

#

not just 1 connection

wary topaz
#

public Connection sqlCon;

remote swallow
#

no

wary topaz
#

its a private database xd

remote swallow
#

public MySQLConnectionPool connectionPool

wary topaz
#

alr

remote swallow
#

you then call connectionPool.getConnection() any time you need to connect

#

and you should use try-with-resources

wary topaz
#

try-with-resources?

tender shard
#
try(Connection connection = myPool.getConnection();
    PreparedStatement statement = connection.prepareStatement("...")
) {
  // do stuff
}
icy beacon
#

try (some autocloseable variable) {
} catch () {}

#

and my internet went out

#

nvm

tall dragon
tender shard
#

?

tall dragon
#

i cant figure out how thats formatted xD

#

something aint right

proper notch
#

U can do multiple instantiations in the same try

tall dragon
#

really

icy beacon
#

yeah

proper notch
#

Just separate with ;

remote swallow
#

yeah

tender shard
tall dragon
#

tf

proper notch
#

Kek

tall dragon
#

i did not know that

#

at all

icy beacon
#

the more you learn

remote swallow
#

have yo been doing multiple this entire time

tall dragon
#

umm

#

yes

#

lmfao

proper notch
#

Nesting lord

tall dragon
#

well thanks then, the more i know

wary topaz
remote swallow
#

as it should be

icy beacon
#

in terms of di this looks fine, in other terms it also looks fine but i'm not too much of an expert on cfs unfortunately

remote swallow
#

reminds me i have to rewrite most of my storage system in my plugin

wary topaz
#

btw does anyone have a gui creation class that uses yaml?

icy beacon
#

not by me but it looks really cool

remote swallow
wary topaz
#

tysm

pine forge
#

Hey im getting errors when loading the class in which i use the luckperms api. Luckperms is not installed because its just a soft depend. How can i get rid of this error?

north nova
#

wtf

#

is

#

this

tender shard
icy beacon
remote swallow
icy beacon
#

goddamit alex keeps sniping me

pine forge
#

Im not triggering the code with the function im calling

grizzled oasis
#

Hi im making a system to load automaticaly the config in a gui easy to modify but i need to check under the subsection for example

section:
  not: false
  or: true
  subsection:
    cat: true

and i know section exist and the other but i don't know if under subsection there's something to determine if is a subsection

icy beacon
#

then show your code

remote swallow
pine forge
#

its another method in that class

hazy parrot
#

show full stacktrace

pine forge
#

i dont have any luckperms imports

remote swallow
tender shard
timid hedge
#

?paste

undone axleBOT
pine forge
tender shard
icy beacon
remote swallow
#

only 100 megabit

#

so slow

timid hedge
icy beacon
#

i see this as an absolute win

tender shard
bitter rune
#

So I got blocks turning into bedrock once mined and then 15 minutes later changing back to their original block. Issue is when server restarts it doesn't turn it back to the original block, is there a way to force all bukkit delays to happen when the server stops

pine forge
icy beacon
hazy parrot
tender shard
pine forge
#

nothing with luckperms

#

its loading the Router class

#

in which i have a method which uses luckperms (only after a check)

tender shard
#

show your router class

pine forge
#
    public static JsonObject getConnectResponse() {
        try {
            JsonObject response = new JsonObject();
            response.addProperty("version", getServer().getBukkitVersion().split("-")[0]);
            response.addProperty("online", getServer().getOnlineMode());
            response.addProperty("worldPath", URLEncoder.encode(getWorldPath(), "utf-8"));
            response.addProperty("path", URLEncoder.encode(getServer().getWorldContainer().getCanonicalPath(), "utf-8"));
            response.addProperty("floodgatePrefix", getFloodgatePrefix());

            return response;
        }
        catch(IOException err) {
            return null;
        }
    }
tender shard
#

that's not the whole class

pine forge
#

i know its too big

#

and unrelated

tender shard
#

it's not unrelated

pine forge
#

this is the function im calling

tender shard
#

?paste the full class

undone axleBOT
grizzled oasis
icy beacon
#

ok flex on me

tender shard
#

?jd

tender shard
#

^

wary topaz
#

I deleted it cause it showed my nearest speed test thing

pine forge
#

ill give you the github repo

grizzled oasis
#

there's not an auto method?

pine forge
#

wait i didnt commit

tender shard
timid hedge
#

Isnt my onEntityDeathEvent correct?
Shopv1.0 attempted to register an invalid EventHandler method signature "public void my.Shop.events.PlayerDamagerEvent.onPlayerDeath(org.bukkit.event.entity.EntityDeathEvent,org.bukkit.entity.Player)" in class my.Shop.events.PlayerDamagerEvent

    @EventHandler
    public void onPlayerDeath(EntityDeathEvent e, Player player) {
pine forge
#

theres so much unrelated stuff i dont have to show right now

#

its not even getting called

#

why do you want to see the whole class

tender shard
#

a listener must have only one parameter, which is the event

tall dragon
tender shard
icy beacon
tender shard
#

I mean, I don#t want to see it, you can also try to find out yourself and I can continue playing rdr2

tall dragon
icy beacon
#

poof

hazy parrot
#

πŸ₯Ή

tall dragon
#

ooof

#

thats rough

pine forge
hazy parrot
#

idk whats so hard about sending class

pine forge
#

okay wait a sec

icy beacon
tender shard
#

I don't want to waste my time to explain to you why I need to see your code to be able to help, either send it or don#t send it

timid hedge
#

?img

undone axleBOT
#

Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.

Here's some screenshot utilities that can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org

remote swallow
#

at this point why dont you just verify

sage patio
#

how i can set a damage on an itemstack for showing different textures? (using a resourcepack)

tender shard
#

you don't, you just use the CustomModelData

remote swallow
#

cast meta to damageable

tender shard
#

ItemMeta#setCustomModelData

sage patio
#

thanks

timid hedge
#

Why does it send this? https://prnt.sc/hWSEuHv6Xe1g

    @EventHandler
    public void onPlayerDeath(EntityDeathEvent e) {
        Entity victim = e.getEntity();
        Entity attacker = e.getEntity().getKiller();
        if (e.getEntity().getLastDamageCause() == null) return;
        if (attacker.hasPermission("vagt")) {
            if (victim.hasPermission("vagt")) return;

            TextComponent grunde = new TextComponent("Β§8[ ");

            TextComponent S = new TextComponent("Β§aS");
            S.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("1").create()));
            S.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "broadcast 1"));

            TextComponent SV = new TextComponent("Β§aSV");
            SV.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("2").create()));
            SV.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "broadcast 2"));

            grunde.addExtra(S);
            grunde.addExtra(SV);
            grunde.addExtra(" Β§8]");


            attacker.sendMessage(You killed " + attacker + " " + grunde);
        }
    }
tender shard
#

because that's what you're sending

remote swallow
#

attacker.spigot().sendMesasage

icy beacon
#

attacker.spigot()

#

dude

remote swallow
#

i feel bad for you

tender shard
#

you are concatting random strings with a textcomponent

#

so it calls Arrays.toString(...)

opal juniper
#

please stop the thumbs up

tender shard
lilac dagger
#

alright haha

round finch
#

Imagine trying to code in java without understanding

timid hedge
#

I dont got an option called attacker.spigot.sendMessage

remote swallow
#

update

icy beacon
#

spigot()

tender shard
#

spigot() is a method on Player

icy beacon
timid hedge
#

That wont send a message

remote swallow
#

yes it will

tender shard
#

cast attacker to Player if it is one

icy beacon
#

spigot().sendMessage()

remote swallow
#

which you are trying to send

tender shard
#
((Player)attacker).spigot().sendMessage()
river oracle
remote swallow
tall dragon
timid hedge
tender shard
#

that's what the componentbuilder is for

timid hedge
#

Yeah and when i used that before it didnt work

tender shard
#

then you did it wrong

#

?notworking

undone axleBOT
#

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

river oracle
#

πŸ’€ what's going on

timid hedge
tender shard
sage patio
icy beacon
round finch
#

Random emoji spam

tender shard
icy beacon
#

this is not spam mind you, this is emotions

river oracle
#

Lol

tall dragon
#

such a good decision by discord instead of working against scam servers & such to work on super reactions

#

we were all waiting for super reactions!

round finch
#

How is white an emotion ?

icy beacon
tender shard
#

why do you always want to turn the components into a string

#

that's not how to do it

river oracle
#

The point of components is to not use strings

round finch
#

Bruh welp

#

Too much random emojis

timid hedge
#

Where is the problem where i am using toString?

river oracle
#

Not random they're planned

wary topaz
#

my mysql is working πŸ™‚ 😳

icy beacon
river oracle
icy beacon
timid hedge
icy beacon
#

can somebody take over with emoji spam expressing feelings via reactions, i have to continue working now

#

thx

wary topaz
remote swallow
#

no primary key

wary topaz
#

player_id is primary

#

I want it to replace it not add a new one

icy beacon
#

insert ignore?

wary topaz
#

INSERT INTO PlayerData (uuid, language) VALUES (?, ?) ON DUPLICATE KEY UPDATE language = ?

tender shard
#
        ComponentBuilder builder = new ComponentBuilder("You killed ");
        ComponentBuilder killer = new ComponentBuilder("victim");
        builder.append(killer.create());
        player.spigot().sendMessage(builder.create());
#

do it like this

wary topaz
#
UPDATE `PlayerData` SET `language` = 'a' WHERE `PlayerData`.`uuid` = ?```

only updates it but if it doesnt exist it ode nothing, I want it to do something even if it doesnt exist
icy beacon
wary topaz
#

no

remote swallow
#

theres why

tender shard
wary topaz
#

because the uuid is the players uuid

#

how do i make that primary?

tender shard
#

during the table creation

wary topaz
#

usually it auto increments

icy beacon
remote swallow
#

you dont really need anything auto incrementing on thiis

icy beacon
#

if you have uuid in the database why do you need an incrementable id

wary topaz
#

can I have 2 primary?

tender shard
#

yes

remote swallow
#

yeah

#

in your case you dont need it

tender shard
#

example to insert or update if primary key already exists

INSERT INTO table (id, name, age) VALUES(1, "A", 19) ON DUPLICATE KEY UPDATE name="A", age=19
wary topaz
remote swallow
#
PreparedStatement createPlayerDataTable = this.connectionPool.getConnection().prepareStatement("""
                        CREATE TABLE IF NOT EXISTS 'player_data' (
                        'uuid' CHAR(36),
                        'id' INTEGER,
                        'choice' CHAR(8),
                        PRIMARY KEY (uuid, id)
                        );""");
#

example

#

but you only need something like ```java
PreparedStatement createPlayerDataInfoTable = this.connectionPool.getConnection().prepareStatement("""
CREATE TABLE IF NOT EXISTS 'player_info' (
'uuid' CHAR(36) PRIMARY KEY,
'banned' BOOLEAN
);""");

timid hedge
tender shard
#

what's Slag?

icy beacon
#

probably not a thing in 1.8.8

tender shard
#

also wdym with "not working" again

#

you keep saying notworking

#

?notworking

undone axleBOT
#

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

remote swallow
wary topaz
tender shard
#

what's the uk meaning lol

icy beacon
remote swallow
timid hedge
# tender shard what's Slag?
            BaseComponent[] Slag = new ComponentBuilder("S")
                    .bold(false)
                    .color(ChatColor.GREEN)
                    .event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "broadcast 1"))
                    .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("1").create()))
                    .create();
icy beacon
tender shard
#

it should be called "slag" not "Slag"

timid hedge
tender shard
#

otherwise it looks like a class name or type parameter

remote swallow
tender shard
timid hedge
tender shard
#

have you even tried to understand why it says that?

#

it says that because a ComponentBUilder, as every builder, is just a builder to create the final thing you wanna have. a ComponentBuilder builds BaseComponents. So you gotta call create() on the builder to turn it into a component array

timid hedge
#

I am calling .create()

            BaseComponent[] slag = new ComponentBuilder("S")
                    .bold(false)
                    .color(ChatColor.GREEN)
                    .event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "broadcast 1"))
                    .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("1").create()))
                    .create();

            BaseComponent[] sv = new ComponentBuilder("SV")
                    .bold(false)
                    .color(ChatColor.GREEN)
                    .event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "broadcast 2"))
                    .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("2").create()))
                    .create();
tender shard
#

works fine

timid hedge
#

No its the builder..retain(ComponentBuilder.FormatRetention.NONE).append(slag) that dosent work

tender shard
#

but that method exists

remote swallow
#

what does retain return

tender shard
#

the builder

icy beacon
#

psa - none uses 1.8 so any help given here might be in vain if the 1.8 api does not have the aforementioned metohd

timid hedge
# tender shard but that method exists

I mean the place where i combine the componentbuilder

            start
                    .retain(ComponentBuilder.FormatRetention.NONE).append(slag)
                    .append("Β§7, ")
                    .retain(ComponentBuilder.FormatRetention.NONE).append(sv)
remote swallow
#

thats not a component you want to appened

#

what do you think will happen

timid hedge
#

The error is that i dont know how to combinde the components how i make so theyre in a line is if i send 1 2 3 4 to a player i can click on all the numbers 1-4 and it will run a command and have a hover

wicked vector
#

did anyone notice that the mojang api got nerfed

#

it went from 600 req a minute to 10 requests every 5 seconds ratelimit

remote swallow
#

you then send it with componentOne.append(componentTwo).appened(componentThree).appened(componentFour)

tender shard
#

it's also possible to append an array of basecomponents

timid hedge
#

I have tried that because when i use componentOne i dont got a option called .append after componentOne

spare hazel
#

im coding a custom mob plugin and i think my code wont be able to handle multiple custom mobs at once. am i right? how can i fix it?

//spawn mob code
HypixelCustomMobs plugin = HypixelCustomMobs.getPlugin();
            plugin.getMobManager().getMobData(args[0]).spawn(p.getUniqueId(), p.getLocation().add(0, 1, 0));

//spawn method
public void spawn(UUID spawner, Location location){
        this.spawner = spawner;

        this.mob = (LivingEntity) location.getWorld().spawn(location, type.getEntityClass(), false, (m) -> {
            m.getPersistentDataContainer().set(HypixelCustomMobs.getPlugin().getIsCustomKey(), PersistentDataType.INTEGER, 1);
            m.getPersistentDataContainer().set(HypixelCustomMobs.getPlugin().getUuid(), PersistentDataType.STRING, uuid.toString());

            m.setCustomName(name);
            m.setCustomNameVisible(true);
            ((LivingEntity) m).setMaxHealth(health);
            ((LivingEntity) m).setHealth(health);

            if(hasArmor) {
                ((LivingEntity) m).getEquipment().setBoots(boots);
                ((LivingEntity) m).getEquipment().setLeggings(leggings);
                ((LivingEntity) m).getEquipment().setChestplate(chestplate);
                ((LivingEntity) m).getEquipment().setHelmet(helmet);
                ((LivingEntity) m).getEquipment().setItemInMainHand(hand);
            }

            ((LivingEntity) m).getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(speed);
        });

        if(hasBossBar) {
            bossBar = Bukkit.createBossBar(name, BarColor.RED, BarStyle.SOLID);
            bossBar.setVisible(true);
            bossBar.setProgress(1.0);
            bossBar.addPlayer(Bukkit.getPlayer(spawner));
        }

        uuid = UUID.randomUUID();

        HypixelCustomMobs.getPlugin().getMobManager().addMob(uuid, this);
    }
icy beacon
#

use ?paste for text walls in the future PLEASE

remote swallow
#

new ComponentBuilder().appeneds().create

icy beacon
#

if i have to tell another person to use ?paste for very long code i'm going to fucking commit blanket

timid hedge
#

Yeah but the problem is that i want to send components and text and that my problem

spare hazel
#

?paste

undone axleBOT
tender shard
wicked vector
#

I've noticed this pattern on requests

remote swallow
wicked vector
#
requested delay 750
requested delay 750
requested delay 750
rate limited delay 750
requested delay 2500
rate limited delay 750
requested delay 2500
rate limited delay 750
requested delay 2500
rate limited delay 750
requested delay 2500
rate limited delay 750
requested delay 2500
rate limited delay 750
rate limited delay 2500
rate limited delay 2500
rate limited delay 2500
requested delay 2500
requested delay 750
ivory sleet
#

That’s interesting

tender shard
#

tbh I wouldn't know any use case where you'd have to do more than 10 requests in 5 seconds

ivory sleet
#

Well it used to be 600rq/10min

spare hazel
ivory sleet
#

so that is 60rq/min or 1rq/s, if you now have 10rq/5s that is 2rq/s, no? So its been buffed then

tender shard
timid hedge
ivory sleet
#

600 but per 10min

icy beacon
#

oh right

ivory sleet
#

Yeah, and if they now say its 10 per 5 sec then that’d be double the rate

#

@wicked vector no?

spare hazel
wicked vector
ivory sleet
#

That’s true

quaint mantle
#

getting an error for the packet which is strange since im pretty sure it matches the constructor?

        plyr.connection.send(new ClientboundRespawnPacket(
                plyr.getCommandSenderWorld().dimensionTypeId(),
                plyr.getCommandSenderWorld().dimension(),
                plyr.getCommandSenderWorld().getWorld().getSeed(),
                plyr.gameMode.getGameModeForPlayer(),
                plyr.gameMode.getPreviousGameModeForPlayer(),
                plyr.isReducedDebugInfo(),
                isFlat,
                (byte) 1,
                plyr.getLastDeathLocation()
        ));```
tender shard
spare hazel
#

you will understand

ivory sleet
#

I thought hypixel was given bypass to the rate limit

tender shard
quaint mantle
tender shard
icy beacon
#

what does your ide say? what constructors are available?

wicked vector
ivory sleet
#

Yeah that’s def extreme

remote swallow
#

you have to appened a component

#

go and learn java then come back

#

you continue to have very basic java issues that you can solve yourself if you know java

timid hedge
remote swallow
tender shard
#

and still using hardcdoed Β§ colors while using a component builder

trim lintel
#

Anyone have an idea how to block a TntPrimed entity from moving with another tntprimed's blast?

timid hedge
# remote swallow

Yeah but thats not what i am focussing on its the start.retain(ComponentBuilder.FormatRetention.NONE).append(slag) that is not working

quaint mantle
spare hazel
# tender shard I didn't

plugin.getMobManager().getMobData(args[0]).spawn(p.getUniqueId(), p.getLocation().add(0, 1, 0));
in here im using one of the registered custom mobs which is a CustomMob class and then spawning it. but then, im modifying the data of the registered entity that is used for spawning custom entities and not a new class for the new spawned entity

then, the bossbar will show the second spawned entity and not the first spawned

icy beacon
remote swallow
#

?mappings

undone axleBOT
remote swallow
#

fix that first

quaint mantle
icy beacon
#

np

tender shard
#

the new mappings browser still hasn't fixed the modifiers for interface methods

remote swallow
#

where

tender shard
#

open any interface class - i currently can't think of one

eternal night
#

interface method modifiers ? think

tender shard
#
interface MyInterface {
  void doSth();
}

doSth is public and abstract, the mappings browser shows it as non-abstract and package-private

spare hazel
timid hedge
eternal night
#

interfaces don't have the concept of package private methods.

#

nor of abstract methods

tender shard
#
        Method method = Class.forName("MyInterface").getDeclaredMethod("doSth");
        Modifier.isAbstract(method.getModifiers());
        Modifier.isPublic(method.getModifiers());
#

both should show true

eternal night
#

in reflection land

#

sure

tender shard
#

the method itself is public and abstract

eternal night
#

because any method is public by default in an interface

tender shard
#

and that's what the browser is supposed to show

eternal night
#

whats the point in displaying it as public lol

tender shard
#

how else would you differentiate between a default method and a non-default method if the browser doesn't show the "abstract" modifier

timid hedge
#

Why cant it apply slag the the component?

            start
                    .retain(ComponentBuilder.FormatRetention.NONE).append(slag)
                    .retain(ComponentBuilder.FormatRetention.NONE).append(slagvagt)
eternal night
#

I mean, I'd expect a default infront of default methods xD

#

lets see if it does that

tender shard
spare hazel
#

oh ppl are ignoring me
im just gonna go see how MythicMobs did it

eternal night
#

I mean, given that public is default, wouldn't it make more sense to mark private as private

#

tho I guess yea

#

that would break stuff, well not really break just not be consistent

tender shard
#

interfaces can have abstract methods, or default methods. they can have public methods and private methods.

The mappings browser should correctly show what it actually is

#

instead of just showing nothing and making people guess

eternal night
#

Yea but the default is public and "abstract"

tender shard
#

that means that the absence of the abstract modifier would mean different things when viewing an interface or a class, that makes little sense

#

also as said, if it does not show the abstrac tmodifier, you cannot differentiate abstract from default methods

#

because it also wouldn't show "default" for non-abstract methods

eternal night
#

I'd appreciate a default modifier a lot more lol

#

rather than a random "abstract" all over the place

tender shard
#

well if a method is abstract, it should show as abstract. the old mappings viewer does it correctly

#

doesn't matter that the keyword is not required in the java code itself - the method is abstract and Modifiers.isAbstract returns true and hence that method is abstract

#

there's actually little to discuss here lol

eternal night
#

there is ?

ivory sleet
#

Default interface methods are like kotlin extension functions *runs*

tender shard
eternal night
#

what java reflection returns does not equal what a mappings viewer that wants to effectively communicate information should show

tender shard
eternal night
#

Yea

wary topaz
#

if (language.isEmpty()) {
plugin.message.setLang(player.getUniqueId(), "en");
}

can mysql strings be empty?

eternal night
#

you know

#

That is the thing to discuss

eternal night
#

or I guess not really, not much point in smacking two opinions against each other

wary topaz
#

cause its not printing my debug message

#

if its empty

#

how do I detect if it doesnt exist?

tender shard
tacit thistle
#

I also want all interfaces to include the abstract modifier, and al records to include the final modifier

tender shard
# tender shard

how is one supposed to know that one of those methods has an implementation while the other is abstract, if both show up without ANY information

eternal night
#

I agreed long ago, a default is missing

tender shard
#

yeah but that's kinda the wrong way around

tacit thistle
#

no it's not

#

there is no other place where implicit modifiers are present

#

also classfile modifiers != java modifiers

tender shard
#

ok imagine you see this: Is this method abstract or not?

tacit thistle
#

depends on its context

tender shard
#

exactly

#

isn't that stupid?

eternal night
#

a DeFaUlT mOdFiEr iS miSsIng

tacit thistle
#

why would it be stupid?

#

I'd say it works pretty well in Java?

tender shard
#

if you'd see the same thing, literally exactly the same screenshot, but it was taken in another class, then it'd mean that this method is package-private and has an implemtation.

if looking at an interafce, it means it's public and may or may not have an implementaiton

slender elbow
#

it's not specific to the mappings viewer

#

if anything, the viewer should align with the javadoc layout

eternal night
#

I mean, better create a method for package private stuff too then

#

because, I always only look at a single thing, context is something I agressively avoid

tender shard
slender elbow
#

no public, no abstract

#

yet it's both

tender shard
#

the javadocs are weird, it does show up in "abstract methods" but without the modifier

#

imho the javadocs should also show the abstract modifier

#

but yeah either way, the new mappings browser is definitely doing it wrong right now

eternal night
#

it is missing a default

#

Β―_(ツ)_/Β―

#

nothing that cannot be fixed

tender shard
#

i wonder why they changed the site in the first place, the old browser was working totally fine D:

eternal night
#

It's a successor to NMSMapper with many new features, such as support to view generics or parameter names, but mainly, it has much better performance than NMSMapper will ever have, so we have decided to deprecate this project in favor of takenaka.

tender shard
#

I doubt that the frontend has anything to do with the performance of generating the mappings

#

I'm just talking about the HTML stuff

eternal night
#

Have not looked into the old NMSMapper code, the new one is a single gradle project

#

the html pages are generated in kotlin

river oracle
ivory sleet
near mason
river oracle
#

so player friendliness is kinda ignored

#

I finally get to not use AnviLGUI which is such a weird thing to use xD

tender shard
#

Also if you think abstract shouldnt be shown, then enums also shouldnt show the final keywoard but show up in a separate enum constants list

ivory sleet
#

One thing that came directly to mind is that a default method becomes a concrete method for a concrete type, so already there would you use an β€œinstance” modifier then or just remove it for its subtype?

eternal night
#

Might be nice to fix then

#

its not like the project is perfect lol, it is open source and work on it is still ongoing

wooden hedge
#

how can i make a custom skeleton do bow shooting animation?

eternal night
#

I am sure feedback is always appreciated

tender shard
#

And then one gets mocked for using the old one even though its just objectively better or at least consistent lol

slender elbow
#

open an issue?

eternal night
#

"so incomplete" is a wild statement

slender elbow
#

complaining in the wild isn't going to get the project anywhere

tender shard
#

I will just continue to use the old one as long as it works perfectly

eternal night
#

I doubt anyone is stopping you

slender elbow
#

you could, hear me out for a second

#

open an issue and use the old one for the time being

tender shard
#

Yeah but not now

#

I hate writing issues from the bathtub

neat mesa
#

then shut up

tender shard
#

Its inconvenient

eternal night
#

Sometimes you just need those bathtub rants KEKW

#

understandable

tender shard
#

I just cannot comprehend why they abandoned a totally fine working project and make it worse than the original one lol

eternal night
#

yknow how sometimes legacy logic is legacy logic

#

and rewrites are required

tender shard
#

yeah but then they shouldnt claim the old website is "deprecated" until the new one is actually done

ivory sleet
eternal night
#

deprecated and deprecated for removal

#

are not the same heh

tender shard
#

yeah anyway that's just my opinion, everyone is ofc free to disagree

ivory sleet
#

Yeah I mean the definition of β€œactually done” can sometimes be preferential per say, in some eyes the new one may be seen as finished, whilst in other eyes maybe just not yet PES_SadShrug

quaint mantle
cunning osprey
#

why does it show this error in console when everything is right???:

java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "org.sveaty.items.Items.getCommand(String)" is null
        at org.sveaty.items.Items.onEnable(Items.java:24) ~[Items-1.0-SNAPSHOT.jar:?]```


here my code of main class:


```package org.sveaty.items;

import org.bukkit.plugin.java.JavaPlugin;
import org.sveaty.items.commands.explosivewand;
import org.sveaty.items.coustumitems.ExplosiveStick;
import org.sveaty.items.coustumitems.ItemManager;
import org.sveaty.items.commands.wandcommand;
import org.sveaty.items.events.OnEightClick;
import org.sveaty.items.events.onRightClick;

public final class Items extends JavaPlugin {

    ItemManager im= new ItemManager();
    ExplosiveStick ie= new ExplosiveStick();

    @Override
    public void onEnable() {
        // Plugin startup logic

        im.createWand();
        ie.createExplosion();

        getServer().getConsoleSender().sendMessage("Server has Started!");
        getCommand("givewand").setExecutor(new wandcommand());
        getServer().getPluginManager().registerEvents(new onRightClick(), this);
        getServer().getPluginManager().registerEvents(new OnEightClick(), this);
        getCommand("explosive").setExecutor(new explosivewand());

    }

    @Override
    public void onDisable() {
        // Plugin shutdown logic
    }
}
north nova
#

org.sveaty.items.Items.getCommand(String)" is null

sage patio
tender shard
ivory sleet
#

Ah seems like against all odds the bathtub issue was created (:

wooden hedge
#

the animation before you shhot a bow

cunning osprey
# ivory sleet Hows ur plugin.yml looking

here:

version: '${project.version}'
main: org.sveaty.items.Items
api-version: '1.20'
commands:
  givewand:
    description: Give wand!
  explosion:
    description: Give explosive stick!
sage patio
wooden hedge
ivory sleet
#

since in ur code u call getCommand("explosive")

sage patio
wooden hedge
#

okay

sage patio
#

buy i know that bow has some stages

#

you should send packets rapidly

#

look at mojang codes

cunning osprey
wooden hedge
#

i'll take a look at that.

wheat flint
#

how can i add fake players to tab list with protocollib

wooden hedge
#

you know where can i see the list of all the packets?

north nova
sage patio
#

^

wooden hedge
#

ty

wheat flint
#

PacketType.Play.Server.PLAYER_INFO

eternal night
#

wrong reply

tender shard
#

I also included an argument for showing abstract instead of default - defaultis not a modifier and hence doesn't belong into the modifiers column :p

#

why does mojang even obfuscate their stupid .jars

eternal night
#

legal reasons

#

I presume

#

smth smth minimal entry barrier

tender shard
#

or why does spigot not just use mojang maps

#

wasn't that discussed before 1.17

eternal night
#

Well, the licence agreement of the deobf mappings

#

are a bit

#

well

#

vague

tender shard
#

sadge

eternal night
#

I mean, spigot has always been on the safe side of things

#

(c) 2020 Microsoft Corporation. These mappings are provided "as-is" and you bear the risk of using them. You may copy and use the mappings for development purposes, but you may not redistribute the mappings complete and unmodified. Microsoft makes no warranties, express or implied, with respect to the mappings provided here. Use and modification of this document or the source code (in any form) of Minecraft: Java Edition is governed by the Minecraft End User License Agreement available at https://account.mojang.com/documents/minecraft_eula.

#

The "redistribution" part is kinda out there

tender shard
#

it's funny how they prohibit you from distributing them complete und unmodified but don't say anything about removing only one line and distributing them then

eternal night
#

Welp

#

but yea, spigot at least is consistent with their legal vibes

#

I mean, they could have switched to paperclip like distribution

#

but iirc the binary patch thing is also a grey area

#

so

#

Β―_(ツ)_/Β―

remote swallow
#

isnt paperclip a big gray areaq

eternal night
#

Kinda

tender shard
#

yeah well I mean there isn't really any difference between decompiling something with preset parameters, applying changes using patch files that partly even already contained the decompiled code, then compiling it again, to just distributing only a binary patch that does not include any decompiled code at all - but try to explain that to a judge who can't even calculate what's 20% of 100

eternal night
#

question at this point is, given how long mojang has not done anythinga gainst it, if they could still sue KEKW

#

but yea

#

judges and their digital knowledge of shit

#

make this rather useless

tender shard
#

mojang should be grateful, as if anyone'd still play the game if plugins or mods wouldn't exist

eternal night
#

I mean, pretty sure they are happy

#

They are cooking some really good stuff in 1.20.2 for servers

echo basalt
#

Minecraft realms pointandlaugh

tender shard
#

are they finally adding chicken wings :mmm:

eternal night
#

they added configuration phase to the network phases

#

so you can resync stuff with the client post login

tender shard
#

is that inbetween login and play?

eternal night
#

yea

tender shard
#

ah

eternal night
#

but can be re-entered

tender shard
#

ok well that's not something I would remotely need lol

eternal night
echo basalt
#

What kind of stuff

eternal night
#

that allows you to modify registries and shit at runtime

#

and resync

echo basalt
#

Oo

tender shard
#

hmm

eternal night
#

proxies will also obviously cry tears of joy

tender shard
#

that does sound promising

quaint mantle
echo basalt
#

I wonder why they're adding that though

echo basalt
zealous osprey
#

Quick question:
I have the following Stream

final List<String[]> splitKeys = Arrays.stream(nbtPathString.split(this.utils.separator))
                    .map((s) -> s.split("(?<=\\w)(?=\\[\\d+]$)"))
                    .collect(Collectors.toList());```
How could I make it return `List<String>` instead?
So I wanna "unpack" the String arrays and add it to the stream.
#

Or do I really need to make a seperate stream for that?

quaint mantle
timid hedge
#

Can someone please help, when i kill a player it sends CraftPlayer{name=(my name)} net.md_5.bungee.api.chat.COmponentBuilder@(some letters)
This is my code: https://paste.md-5.net/baqalogafe.cs

remote swallow
#

why do you get help, then remove everything you got told

#

you HAVE to use Player#spigot().sendMessage

tender shard
timid hedge
tender shard
#

because obviously you cannot just turn a String[] into a string without losing information

zealous osprey
#

Ah, I think I know what you mean; Gimme a sec and I'll write an example

tender shard
#

better question: How does your List<String[]> look like, and how do you want the List<String> to look like?

echo basalt
#

He wants to flatten it

zealous osprey
#

String: Inventory[0]##tag##meta##size
Split String (String[]): [Inventory[0], tag, meta, size]
Second split in the stream: [Inventory, [0], tag, meta, size] (Just removed the array index from the text)

zealous osprey
tender shard
#

uugh I don't really understand that

zealous osprey
#

I think I have a solution, but it would still require atleast one more stream, was just interested if I could do it in one

echo basalt
#

or you can use a for loop

#

or well.. nested for loops

tender shard
#

why not just map() the stream another time to turn your string[] into a string

eternal night
#

what prevents you from flatMap

zealous osprey
#

Cause I want the individual Strings, I can't just concat them

timid hedge
remote swallow
#

so send it to the other player

echo basalt
#
List<String> list = new ArrayList<>();

for(String line : nbtPathString.split(this.utils.separator)) {
  for(String split : line.split("(?<=\\w)(?=\\[\\d+]$)")) {
    list.add(split);
  }
}
zealous osprey
eternal night
#

just, .flatMap(s -> Arrays.stream(s.split("regexHere")))

remote swallow
#

once again, something very very basic you can do yourself if you just go and learn java

zealous osprey
#

wait... so what's the difference between map and flatMap?

tender shard
#

i still don't understand what "Inventory[0]" is supposed to be if it's a string[]

north nova
#

u can middle click it

eternal night
#

flatMap expects you to map to a Stream<T>

north nova
#

and u have javadocs

eternal night
#

and then concats the streams into a single stream