#help-development

1 messages ยท Page 611 of 1

echo basalt
#

This is how we use it

#

Figure it out

carmine nacelle
#

wtf (respectfully)

echo basalt
#

we needed a simple system to make animations without hardcoding shit ยฏ_(ใƒ„)_/ยฏ

#

So I made it in a week

grizzled oasis
#

im sorry but i didn't understand nothing, but thanks for trying helping me

echo basalt
#

Doing stuff

#

The idea is to read the string and split it into left, right and operator

#

Based on the operator you do comparisons between your left and right (the OPERATORS map in my sample is responsible for that)

#

Replace any placeholders or variables in both your left and right arguments

#

And run the operator on them

carmine nacelle
#

ngl i copied your Hologram class over top of mine and im using it as a base

#

im even using lambdas n shit to try keeping your simplicity and proness

#

kek

echo basalt
#

lambdas are fun

carmine nacelle
#

they look pro

echo basalt
#

eh

carmine nacelle
#

so it makes you pro, ez

#

they're simple

echo basalt
#

They have their use-case

#

I abuse them in my minigame lib

#

but I also abuse extending a class

grizzled oasis
#

?paste

undone axleBOT
grizzled oasis
echo basalt
#

Let's start by breaking this down a bit

#

What would the full line look like

grizzled oasis
echo basalt
#

Example: !player_sneaking

#

Or something

grizzled oasis
#

like if !player_sneaking then [break] 3x3 <= Currently this last part i don't know how to "style" it

echo basalt
#

Okay

#

So in simple words it'd be something like if <condition> then <action>

carmine nacelle
#

Ppl bully me for using protocollib so im gonna try not to anymore, so would changing your PacketContainer to private final ClientboundRemoveEntitiesPacket destroyPacket; be bad practice?

carmine nacelle
#

dope

echo basalt
#

Your condition is a bit tricky

#

And it can be broken down into

#

[!]<state>[<>=]<other>

#

As in

#

!player_sneaking
player_level=3

grizzled oasis
#

wtf is this? pattern?

echo basalt
#

I'm just breaking this down

grizzled oasis
#

oh ok

echo basalt
#

into a sort of pattern yeah

#

Anyways let's ask chatgpt to write some regex

grizzled oasis
#

lol chatgpt and regex best friend

#
\[!\][A-Za-z]+[<>]=\w+

Regex given by chatgpt

echo basalt
#

= is optional too

carmine nacelle
#

holy shit thats an amazing use for gpt

grizzled oasis
echo basalt
#

if\s*(!)?\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*(<|>|=)?\s*([a-zA-Z0-9_]+)?\s*then

grizzled oasis
#

WTF IS THIS

echo basalt
#

Group 1 will be the ! if it's present
Group 2 will be the left side
Group 3 will be the operator, if present
Group 4 will be the right side, if present

grizzled oasis
#

so what i do, im really lost

echo basalt
#

Put that into a pattern

#

In java code, create a matcher

#

Basically

#

Let's structure this in a funky way

grizzled oasis
#
Pattern pattern = Pattern.compile("if\\s*(!)?\\s*([a-zA-Z_][a-zA-Z0-9_]*)\\s*(<|>|=)?\\s*([a-zA-Z0-9_]+)?\\s*then");
echo basalt
#

Yes

#

Make that a constant

grizzled oasis
#

that's already constant?

#

you mean final?

echo basalt
#
public class Condition {

  private static final Pattern REGEX = Pattern.compile("if\\s*(!)?\\s*([a-zA-Z_][a-zA-Z0-9_]*)\\s*(<|>|=)?\\s*([a-zA-Z0-9_]+)?\\s*then");

  private boolean negated;
  private String left;
  @Nullable private String operator;
  @Nullable private String right;

  public Condition(String input) {
    parse(input);
  }

  private void parse(String input) {
    Matcher matcher = REGEX.matcher(input);

  }

  public boolean isMet(Player player) {
    
  }
}
#

Let's start with this

grizzled oasis
#

ok

echo basalt
#

Let's start with this

#

On our Parse method we can write some sanity checks

#

If 3 is undefined yet 4 is defined, it's illegal

#

Which represents trying to compare 2 variables with no operator

grizzled oasis
#

in theory

echo basalt
#

We'll also need to make some sort of placeholder system

#

As well as a comparison system

#

Because comparing 2 booleans isn't the same as comparing 2 strings or something

#

But we can just use comparators

#
public interface PlayerPlaceholder<T extends Comparable<T>> {

  String getName();
  T fetch(Player player);

}
#

This will be our supplier thing

grizzled oasis
#

one thing im gonna ask you "What is T"?

echo basalt
#

It's a generic type

grizzled oasis
#

oh ok

echo basalt
#

Basically if we say PlayerPlaceholder<Boolean>

#

The method returns boolean

#

It's the thing that powers lists

carmine nacelle
#
  private final Packet<ClientGamePacketListener> spawnPacket;
    private final Packet<ClientGamePacketListener> metadataPacket;
    private final Packet<ClientGamePacketListener> destroyPacket;
 private void sendPacket(Player player, Packet<ClientGamePacketListener> packet) {
        ((CraftPlayer) player).getHandle().connection.send(packet);
    }

    private Packet<ClientGamePacketListener> prepareSpawnPacket() {
        ClientboundAddEntityPacket packet = new ClientboundAddEntityPacket(entityId,
                UUID.randomUUID(),
                hologramLocation.getX(),
                hologramLocation.getY(),
                hologramLocation.getZ(),
                0.5f,
                0.5f,
                EntityType.TEXT_DISPLAY,
                1,
                new Vec3(0,0,0),
                0.25
        );

        return packet;
    }

This seem legit...? the metadata packet probably cant be final since its gonna be updating the text to whatever I need as it needs it...

echo basalt
#

Anyways back to our class, we can do a basic

private final Map<String, PlayerPlaceholder<?>> placeholders = new ConcurrentHashMap<>();

public void registerPlaceholder(PlayerPlaceholder<?> placeholder) {
  this.placeholders.put(placeholder.getName(), placeholder);
}

echo basalt
#

Honestly the comparator thing is stupid

#

Nah

grizzled oasis
#

same class?

echo basalt
#

In your condition class

#

The placeholder system is so you can make a

grizzled oasis
#

that class is gonna be 30000 lines

echo basalt
#
registerPlaceholder(new PlayerPlaceholder("player_shift", Player::isShifting));
#

Let me write this up actually

grizzled oasis
#

inside the isMet conditions

echo basalt
#

no

grizzled oasis
echo basalt
#

I am

#

Just writing this

#

In a proper IDE

grizzled oasis
#

oh

echo basalt
#

Think I'll use strings for this

carmine nacelle
grizzled oasis
#

i think im gonna quit coding in java after this, i don't know nothing about java this man is superiour

limpid nexus
#

Everyone is at a different stage with it.

wet breach
echo basalt
#
public class Condition {

    private static final Pattern REGEX = Pattern.compile("if\\s*(!)?\\s*([a-zA-Z_][a-zA-Z0-9_]*)\\s*(<|>|=)?\\s*([a-zA-Z0-9_]+)?\\s*then");

    private final List<PlayerPlaceholder> placeholders = new ArrayList<>();

    private static final Map<Character, BiPredicate<String, String>> OPERATORS = Map.of(
        '=', String::equalsIgnoreCase,
        '>', (a, b) -> a.compareTo(b) > 0,
        '<', (a, b) -> a.compareTo(b) < 0
    );

    private boolean negated;
    private String left;
    private String operator;
    private String right;

    public Condition(String input) {
        parse(input);
    }
    
    public void registerPlaceholder(PlayerPlaceholder placeholder) {
        placeholders.add(placeholder);
    }

    private void parse(String input) {
        Matcher matcher = REGEX.matcher(input);

        if (!matcher.matches()) {
            throw new IllegalArgumentException("Invalid condition: " + input);
        }

        negated = matcher.group(1) != null;
        left = matcher.group(2);
        operator = matcher.group(3);
        right = matcher.group(4);

        boolean validOp = (operator != null) == (right != null); // XOR

        if (!validOp) {
            throw new IllegalArgumentException("Invalid condition: " + input);
        }
    }

    public boolean isMet(Player player) {
        String left = replace(this.left, player);

        if (operator == null) {
            return left.equalsIgnoreCase("true") || left.equalsIgnoreCase("1");
        }

        String right = replace(this.right, player);

        BiPredicate<String, String> predicate = OPERATORS.get(operator.charAt(0));

        if (predicate == null) {
            throw new IllegalArgumentException("Invalid operator: " + operator);
        }

        return predicate.test(left, right) != negated;
    }

    private String replace(String original, Player player) {
        String whatever = original;

        for (PlayerPlaceholder placeholder : placeholders) {
            whatever = whatever.replace(placeholder.getName(), placeholder.get(player));
        }

        return whatever;
    }
}
public interface PlayerPlaceholder {

        String get(Player player);

        String getName();
}
#

This might just work

grizzled oasis
echo basalt
#

Don't get discouraged

wet breach
#

yeah if you have a proper IDE open its not hard

echo basalt
#

I've done this before

#

and I have years of experience under my belt

#

a bit over a decade of coding

wet breach
#

You have to realize some of us have years of doing this stuff like illusion said

carmine nacelle
#

ive been on/off though not constant

wet breach
#

I am not providing much because I am drunk ๐Ÿ˜›

#

not very helpful in that regard

echo basalt
#

Doing about like 6 years of constant plugin dev

carmine nacelle
echo basalt
#

~13ish years of on/off development

#

but half those years barely count because I'm 18

carmine nacelle
echo basalt
#

and I wasn't a 6 year old prodigy

#

And it's 7am

carmine nacelle
#

what would be the most efficient way of setting up this metadata packet since the text is gonna change a lot..?

echo basalt
#

I'd use protocollib as it uses reflections

#

but in your case

#

uhh great question

carmine nacelle
#

I dont think I could prepare it once

#

since its gotta be modified a lot

echo basalt
#

honestly I hate the nms entity data thing

#

as you require a real entity

#

not spawned

#

And it makes copies

carmine nacelle
#

well.. if I spawn it with a packet and modify the data with a packet it should be fine..

echo basalt
#

But yeah just have a final entity and create the packet on the fly ig

grizzled oasis
#

sorry for asking but the registerPlacehoder where should be used and how i can use it in my code?

carmine nacelle
echo basalt
#

ugh

grizzled oasis
echo basalt
#

It's okay

#
public class SimplePlaceholder implements PlayerPlaceholder {

  private final String name;
  private final Function<Player, ?> function;

  public SimplePlaceholder(String name, Function<Player, ?>> function) {
    this.function = function;
  }

  @Override
  public String get(Player player) {
    Object result = function.apply(player);

    if(result == null) {
      return "null";
    }

    return result.toString();
  }

  @Override
  public String getName() {
    return name;
  }
}
#

paste this bitch in

carmine nacelle
#

Oh wait, in theory I think I can initialize the metaDataPacket with all the values set. Then in #setText, I can grab the existing metadata packet, ONLY modify 22 (text) and re-send it..

echo basalt
#
registerPlaceholder(new SimplePlaceholder("player_sneaking", Player::isSneaking));
#

Should work

grizzled oasis
echo basalt
#

No

#

Outside somewhere

#

I usually make a registerDefaultConditions method and register a bunch of them

#

and call them somewhere

#

This list can also be static

grizzled oasis
#

on start so its easier

echo basalt
#

But it'd be a bit annoying for more complex things

#

You can also just implement the interface and make your own getter

#

For things like custom name

grizzled oasis
#

really thanks man, im shaking, im reconsidering my life choices and crying on the floor after this

echo basalt
#

It's okay

#

Bit of a complex topic

#

How deep are you into java?

grizzled oasis
#

i made many complicated code for my api but not this level

echo basalt
#

Read about lambdas if you don't know enough about them

grizzled oasis
#

ok so for recapture everything

Now i need to makea new class
for reading each line checks like

if(new Condition(script).isMet(player)) {
   actionsSystem.run(player)
}

If anything wrong im sorry

carmine nacelle
#

https://i.imgur.com/sQjQPkL.png Since ClientboundSetEntityDataPacket requires a List<DataValue> instead of List<WrappedDataValue>, is there an easy way of modify my data value list to work with this method?

echo basalt
#

Just saw this but no don't ask me I know jackshit about thread pools and executors

echo basalt
#

You create a condition in your enchant object

grizzled oasis
#

inside the event?

echo basalt
#

No

#

Outside somewhere

grizzled oasis
#

yes that's something i was doing already

echo basalt
#

Basically you "primed" the check by running the parser

#

Which is heavy

#

isMet can be called plenty times but only create the condition once basically

#

You can have for example an enchantment registry where each custom enchant has a condition

#

And you just check for that condition and then run the enchant

grizzled oasis
#

but the purpose of this system is the player makes action and if one string as if then runs the conditions

#

and then recalls the action system to run it

#

or else stops

echo basalt
#

Oh yeah we need to modify this a little bit

grizzled oasis
#

so should be something like

actions:
  - if !player_sneaking then break block
  - POTION:SPEED:30:2
echo basalt
#

that's pretty much my scripting engine lma

grizzled oasis
#

an example im making, the client is really stupid and im making even a docs at the same time

#

idk why not buying a plugin similar to the one im making but he is paying me so nice

echo basalt
#

Well I'm done helping other people get money

#

for free >:)

grizzled oasis
#

my paypal now has 7 dollars lol

remote swallow
echo basalt
#

? I didn't

#

I don't intentionally play with paper

#

I've written code before that does multithreaded shit but I just stick with forkcommon

grizzled oasis
#

dead chat

echo basalt
#

p much

grizzled oasis
carmine nacelle
#

im switching back to protocollib..

#

๐Ÿ˜…

#

dont think i can do what I need to without it.

grizzled oasis
#

imIllusion sorry for asking but in the code is already implemented the last part of taking after then or is not done?

#

in case im gonna implement it by myself, i mean it gives you after the then

echo basalt
#

Taking what?

#

You can just add an extra group to the regex that'll be the action

#

And making a attemptApply(Player player) method that just does an isMet -> runAction

carmine nacelle
#

hey illusion bbg

echo basalt
carmine nacelle
#

๐Ÿ˜ณ

grizzled oasis
#
public void run(Player player) {
        if(isMet(player)) {
            //run action?
        }
    }

?

echo basalt
#

yeh

#

Now let's talk about your Action system

grizzled oasis
echo basalt
#

Ideally

#

You'd make an action parser too

grizzled oasis
#

yes?

echo basalt
#
private final Map<String, Function<String, Action>> initializers = new HashMap<>();

public void registerInitializer(String name, Function<String, Action>> initializer) {
  this.initializers.put(name, initializer);
}

public Action parse(String input) {
  for(Map.Entry<String, Function<String, Action>> entry : initializers.entrySet()) {
    String word = entry.getKey();
    Function<String, Action> initializer = entry.getValue();

    if(!input.startsWith(word)) {
      continue;
    }

    return initializer.apply(input);
  }

  return null;
}
#
public interface Action {

  public void applyTo(Player player);

}
#
public class ConditionalAction implements Action {

  private final Condition condition;
  private final Action action;

  public ConditionalAction(String input, ActionRegistry registry) {
    int index = input.indexOf("then") + 4;

    String conditionText = input.substring(0, index); // include the word
    String actionText = input.subString(index + 1);

    this.condition = new Condition(conditionText);
    this.action = registry.parse(actionText);
  }

  @Override
  public void applyTo(Player player) {
    if(condition.isMet(player)) {
      action.applyTo(player);
    }
  }
}
#

Something like this

#

And you register this action as well

#
registerAction("if", (text) -> new ConditionalAction(text, this));
registerAction("potion", (text) -> new PotionAction(text));
grizzled oasis
#

something to ask what's actionRegistry the first code?

grizzled oasis
#

ok

echo basalt
#

It's just a place where you register actions

#

So the idea is you can create "actions" from the lines in your config

#

The conditional action is just a regular action that only runs is a specific condition that's specified in the action itself is met

#

Basically a sort of filter

grizzled oasis
echo basalt
#

Yeah

grizzled oasis
#

idk why but intelli says im doing wrong the implements, privates and applyTo

#

but not sure why

carmine nacelle
#
    private PacketContainer prepareSpawnPacket() {
        PacketContainer spawnPacket = new PacketContainer(PacketType.Play.Server.SPAWN_ENTITY);

        List<WrappedDataValue> dataValues = List.of(
                new WrappedDataValue(22, WrappedDataWatcher.Registry.getChatComponentSerializer(), CraftChatMessage.fromStringOrNull(ColorUtil.translateColorCodes(String.valueOf(this.text)))),
                new WrappedDataValue(14, WrappedDataWatcher.Registry.get(Byte.class), (byte) 3),
                new WrappedDataValue(24, WrappedDataWatcher.Registry.get(Integer.class), 0),
                new WrappedDataValue(26, WrappedDataWatcher.Registry.get(Byte.class), (byte) 0)
        );

        spawnPacket.getModifier().write(0, entityId);

    }

Do you know what the indices need to be for spawning..? I had this at one point and lost it ๐Ÿ˜… heres the bitmasks and such https://i.imgur.com/cpsobGG.png

echo basalt
#

metadata values are part of the metadata packet

echo basalt
#

the ConditionalAction is a class and not an interface**

grizzled oasis
echo basalt
grizzled oasis
echo basalt
#

No clue what's going on in your side

#

but things seem fine here

grizzled oasis
#

i changed one name and now works everything wtf?

echo basalt
#

Go figure

grizzled oasis
#

OOHHH i probably understand inside my api there's an Action system for mongodb so that's why lol

#

they had the same name

#

so i made a class like this and put it on OnEnable that should be fine?

public static void loader() {
        //Actions Loader
        new ActionRegistry().registerInitializer("if", (text) -> new ConditionalAction(text, new ActionRegistry()));
        
        //Conditions Loader
        new Condition("").registerPlaceholder(new SimplePlaceholder("player_sneaking", Player::isSneaking));
    }
#

ded chat again

echo basalt
#

what the actual fuck

#

n o

#

Make the placeholder list on your Condition class static and register them all at once

#

In a static method somewhere

#
ActionRegistry registry = new ActionRegistry();
registry.registerInitializer("if", (text) -> new ConditionalAction(text, registry));
grizzled oasis
#

the all class

echo basalt
#

Your registerPlaceholder can be static too

#

And you can remove the run method

#

That's part of the action system now

grizzled oasis
#

for registring the condition i need to do new Condition("").register()
because is not outside or how can i do it?

echo basalt
#

nah

#

Just use the static methdo

grizzled oasis
#
SimplePlaceholder IS_SNEAKING;

    static {
        IS_SNEAKING = registerPlaceholder(new SimplePlaceholder("player_sneaking", Player::isSneaking));
    }

inside the condition class

echo basalt
#

You can just register it in another class

#

take a moment to look at what you've achieved

#

And think about it

grizzled oasis
#

the only thing i can think is by making a new Constructor like

new Condition("").register()

Nothing else comes in my mind

echo basalt
#

Okay so

#

Forget about the idea of creating new conditions

#

Forget half of what I said

#

The main focus is the action system

#

You register placeholders for the conditions with your static registerPlaceholder method

#

Let's say onEnable

#
public void onEnable() {

  Condition.registerPlaceholder(new SimplePlaceholder("player_sneaking", Player::isSneaking));

}
grizzled oasis
#

i can't because i need to pass a parameter inside the condition?

echo basalt
#

No

twilit creek
#

Sorry for the small question, but is there an way to check, if a player is breaking a block? (like in the break animation)

echo basalt
#

Uhh great question

#

There might be a tracker for it somewhere but I'm not aware of an API method

grizzled oasis
echo basalt
#

^ Not the best

#

Client sends packets for this kind of stuff

twilit creek
echo basalt
#

If you're comfortable with packets it's really easy

#

With packets, the client sends packets for:

  • When it starts breaking a block
  • Arm swing for every tick the block is being broken
  • When it finishes breaking a block
  • When it cancels a block break
twilit creek
#

I try it. But can i check too, if the player holding in this moment an specific item like an pickaxe with an custom name or an specific itemstack?

grizzled oasis
echo basalt
#

And run those actions n the event

grizzled oasis
echo basalt
#

Yes

grizzled oasis
#

so i need to ActionRegistry.parse() to run the actions

echo basalt
#

No, you parse them onEnable and convert them to a list

echo basalt
#

The player sends this to the server

#

You can intercept it with ProtocolLib

grizzled oasis
#

but the registerInitializer is for that?

echo basalt
#

So it knows what to read

#

The idea is you grab an action (if ... = ...) and parse it against the initializer map

#

In this case we have an initializer for "if", which creates a ConditionalAction

#

And we also have one for "potion" that creates a PotionAction

#

Those actions then run on the player to run whatever fancy logic

grizzled oasis
#

but it has already everything so i just pick the string

ActionRegistry.parse("if !player_sneaking then POTION")

echo basalt
#

In the case of potion it gives a potion to the player

grizzled oasis
echo basalt
#

This structure is neat but a little confusing

grizzled oasis
#

im not great explaining what i meant

echo basalt
#

Can take a bit to understand but once you do, you'll like it

grizzled oasis
#

i really thank you without you i wouldn't made it without crying

echo basalt
#

Now give me your lunch money

grizzled oasis
#

nothing else

#

i have only that, in rl i have 200 euros but that something else

echo basalt
#

Hmm you probably need it more than me

#

get yourself some chicken toast then

grizzled oasis
echo basalt
#

I might go get some myself

#

should I really spend 20 bucks on breakfast

#

when I can just sleep through it

grizzled oasis
#

now i understand

echo basalt
grizzled oasis
echo basalt
#

the system at work is a bit more advanced

grizzled oasis
echo basalt
#

I make plugins

#

for a living

#

But yeah so at work

#

It looks like this

#

and you can do this

#

I can also do tab completion in real time

#

for commands

#

And it also does automatic filtering and smart checks

grizzled oasis
#

at dinner table for Christmas,
random dude in your family: "what you do for living"?
you: "making something for a cube game, but it pays really well"

echo basalt
#

I once had to explain to this little kid

#

that loved minecraft

grizzled oasis
#

that minecraft sucks

echo basalt
#

how part of my job is making plugins for youtube videos

echo basalt
#

and then I gave him a tnt mug from my collection

#

and when the kid's parents asked how much money I made

grizzled oasis
#

you crushed the kid dream to meet herobrine

echo basalt
#

in a country where people make 4$ an hour

#

I just replied "I've made 8 grand on a good month"

grizzled oasis
#

WTF

#

nah dude send me your fucking java tutorial rn

echo basalt
#

I didn't learn java through a tutorial

grizzled oasis
#

i know someone who has your "same experience" and makes code worst than mine lol

#

and he get paid even more

echo basalt
#

same experience

#

Bold of you to assume how much experience I really have

grizzled oasis
#

i mean for years like 13 years

grizzled oasis
echo basalt
#

yeah checks out but was it really 13 active years

#

where you try to beat your competition

grizzled oasis
#

and after i made a big exploit, i just stop it and now im coding plugins lol

echo basalt
#

I got about ~13 years coding, 6 of those are in minecraft

#

An associate's degree in systems management and programming

#

And some other minor qualifications and achievements

#

Like fully rebuilding and setting up a cisco-certified computer lab from scratch but that's minor

grizzled oasis
#

im currently at school and learning law but probably quitting for human studies

echo basalt
#

But like

#

Education and experience years don't mean shit if you're just standing around instead of doing something cool

grizzled oasis
echo basalt
#

I'm tired of these fake devs that think they're the bomb

grizzled oasis
#

because they didn't made her learn REAL coding and i made the entire backend for her

echo basalt
#

but I was also that clown at some point

#

but in my defense I was like 6

#

playing around with html tags lmao

grizzled oasis
#

i was like 10 when i just started making websites and i skidded too much, sometimes even now, or go to stackoverflow to do that (praise the one who made stackoverflow he is the savior of all developers)

#

olivio typing and then no message

#

@echo basalt i know thought something im making a plugin for customenchants and i didn't even think about the random numbers

#

to chance them

#

for that only a simple placeholder because the operators are already added

echo basalt
#

I'm not gonna be making your entire enchants plugin damn

icy beacon
#

did somebody say custom enchants

grizzled oasis
grizzled oasis
echo basalt
#

they do, pretty sure

icy beacon
#

elaborate on your problem plz

grizzled oasis
icy beacon
#

alrighty

#

i happen to know a slight bit about custom enchants

grizzled oasis
# echo basalt they do, pretty sure

something, i was testing and thought how can i pass the player. Because on the ActionHandler no player is passed and nowhere is passed and by testing the script does not give error but even works

#

i made a simple SendMessage to debug on simpleAction

echo basalt
#

The action handler just creates an action from a string

#

You gotta then run the action in context

grizzled oasis
echo basalt
#

Yeah so

#

Outside your command you create the action list

#

And when the player runs the command

#

you loop through the list and run each action on each player

#

Easiest way to test is just a runnable each tick and a conditional action

grizzled oasis
#

wait, im testing and i used the ActionRegistry.parse() to run that line to "simulate", but the lines doesn't run and debuging the Conditional doesn't even display a player

echo basalt
#

๐Ÿคฆ

#
List<String> script = List.of(
  "if !player_sneaking then message"
);

List<Action> compiled = new ArrayList<>();
for(String line : script) {
  compiled.add(registry.parse(line));
}


...

on Command

for(Action action : compiled) {
  action.applyTo(player);
}
grizzled oasis
#

im stupid

echo basalt
#

I'm aware

#

gtg for a couple hours

grizzled oasis
#

now works fine

#

im sorry

twilit creek
echo basalt
#

Nms

twilit creek
#

I need the BuildTools to use nms right?

echo basalt
#

Somewhat

twilit creek
#

I mean, i dont have the nms in my source. I use the 1.20.1 for my plugin.

icy beacon
#

i'm doing a 1.8.8 commission and i'm experiencing extreme pain

#

i hoped i would never come back to that api

hushed spindle
#

oh god you poor soul

icy beacon
#

nice pfp

hushed spindle
#

thank you im very peas'd with it

icy beacon
#

don't tell me you only use it for this pun

icy beacon
#

๐Ÿ˜ญ

hushed spindle
#

anyway, i have a plugin that registers a bunch of new smithing recipes using custom ingredients. most of them are a tool/armor + a material, these recipes use RecipeChoice.ExactChoice for the material and MaterialChoice for the tool/armor. Though ever since 1.20 these recipes no longer register to the server and I assume this is because of the armor trimming recipes, that my recipes are now considered duplicates. My recipes don't require a template though and since they use an exact meta requirement they should take priority, could this be a bug?

#

and does anyone know of a way to make these recipes register anyway

quaint mantle
#

Show code

hushed spindle
#

i mean what code specifically

#

the recipes themselves are data driven so i cant really show that practically

#
public boolean register(DynamicSmithingTableRecipe recipe){
    if (allRecipes.contains(recipe.getName())) return false;
    
    smithingRecipes.put(recipe.getName(), recipe);
    smithingRecipesByKey.put(recipe.getKey(), recipe);
    allRecipes.add(recipe.getName());
    plugin.getServer().removeRecipe(recipe.getKey());

    if (!plugin.getServer().addRecipe(recipe.generateRecipe())) plugin.logWarning("Could not register recipe " + recipe.getKey().getKey());
    return true;
}

this is what's used for registering the recipes themselves

#

and yeah the smithing recipes using some type of armor + a material will not register

#

generateRecipe will just take the base and addition of the recipe and return a new smithingrecipe with an exact choice if an exact meta is required or a materialchoice if not

upper hazel
#

how get inventory when i click e button

#

openInventoryEvent not work

hushed spindle
#

you mean you wanna get the player inventory?

upper hazel
#

i wanna listner when player open his inventory

#

when he click we

#

e

hushed spindle
#

did you register the event listener

upper hazel
#

yes

#

his PRIVATE inventory

hushed spindle
#

what

#

can you show your code

eternal night
#

client side inventory is unknown by the server

#

them pressing e to open their inventory will not trigger anything on the server

hushed spindle
#

oh i guess that makes sense

#

what do you want to do with that inventory though because you can easily just interact with the player's inventory

upper hazel
eternal night
#

no

hushed spindle
#

there are item drop events and item swap events yes

eternal night
#

pressing f means the server has to be informed by the client that the item is getting swapped

hushed spindle
#

they are considered interact events and not inventory events

eternal night
#

pressing q means the server has to drop an item

#

pressing e means the server doesn't have to know anything ๐Ÿ˜…

upper hazel
#

lol

#

shift?

eternal night
#

button presses are not sent

#

the client does something because you pressed a button

hushed spindle
#

yeah sneaking is also known to the server

eternal night
#

that might include the server getting some packet

#

and the server then calling some event

hushed spindle
#

you should refer to these buttons with actions and not their key

eternal night
#

but the button press itself is unknown to the server

upper hazel
#

bukkit api what a crutch api

eternal night
upper hazel
#

so many restrictions

eternal night
#

litearlly no plugin api can do this KEKW

#

without modifying the client

#

the client simply does not inform the server, what do you want the server to do ๐Ÿ˜…

upper hazel
#

(

grizzled oasis
#

how can i get all the player permissions?

hushed spindle
#

Player#getEffectivePermissions()?

grizzled oasis
#

didn't know was a thing

#

thanks

icy beacon
#

because it allows for cheats like moving while in an inventory

#

because the server does not know that the player has an inventory open

quaint mantle
#

How do u get a player's current scoreboard team

eternal night
#

scoreboard.getEntityTeam(player)

quaint mantle
#

dd

worthy moat
#
plugins {
    id 'com.github.johnrengelman.shadow' version '8.1.1'
    id 'java'
}

group = 'de.marvn.alphablock'
version = '1.0'

jar {
    destinationDirectory.set(file("C:\\Users\\Killi\\Desktop\\TestServer\\plugins"))
}

repositories {
    mavenCentral()
    maven {
        name = "spigotmc-repo"
        url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/"
    }
    maven {
        name = "sonatype"
        url = "https://oss.sonatype.org/content/groups/public/"
    }
    maven { url "https://repo.dmulloy2.net/repository/public/" }
}

dependencies {
    compileOnly "org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT"
    compileOnly 'com.comphenix.protocol:ProtocolLib:5.0.0'
}

def targetJavaVersion = 8
java {
    def javaVersion = JavaVersion.toVersion(targetJavaVersion)
    sourceCompatibility = javaVersion
    targetCompatibility = javaVersion
    if (JavaVersion.current() < javaVersion) {
        toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
    }
}

tasks.withType(JavaCompile).configureEach {
    if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
        options.release = targetJavaVersion
    }
}

processResources {
    def props = [version: version]
    inputs.properties props
    filteringCharset 'UTF-8'
    filesMatching('plugin.yml') {
        expand props
    }
}
echo basalt
#

I am back bitches

worthy moat
#

HEY

#

got the problem

#

I registered my Serializables after I get the Config xD

#

And the next Problem is , that my world wasnt loaded

worthy moat
#

xD

remote swallow
#

you have the shadow plugin, but dont use it and modify the dest dir in the wrong place to make it work with shadow

worthy moat
worthy moat
#

xD

remote swallow
#

hi md

placid moss
#

gradle is good

remote swallow
#

what was up with couldflare stealing buttons yesterday

warm mica
#

But maven is better

placid moss
#

cloudflare couldflare

placid moss
worthy moat
#

hey how can I load all YML files from a directory

#

?

warm mica
#

True but i am internally cooking when I have to deal with a gradle project

worthy moat
#
public ArenaUtils(Plugin plugin, String path) {
        this(plugin.getDataFolder().getAbsolutePath() + "/" + path);
    }

    public ArenaUtils(String path) {
        this.file = new File(path);

        if (!file.exists()) {
            try {
                file.createNewFile();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        this.config = YamlConfiguration.loadConfiguration(this.file);
    }```
#

This is how I load one

warm mica
#

You can get all files using new File("MyFolder").listFiles()

worthy moat
#

But now I want to load a full directory because there could be multiple Arena.yml

remote swallow
#

list the files, check if its a yml and load it to a map or something with its file name to its yaml config value

warm mica
remote swallow
#

^^

upper hazel
#

someone give me site for read code

remote swallow
#

what

upper hazel
#

i want give code for some help

remote swallow
#

?paste

undone axleBOT
worthy moat
# remote swallow list the files, check if its a yml and load it to a map or something with its fi...
HashMap<File, FileConfiguration> arenas = new HashMap<>();

    public ArenaUtils(Plugin plugin) {
        this(plugin.getDataFolder().getAbsolutePath() + "/arena/");
    }

    public ArenaUtils(String path) {
        
        if (new File(path).listFiles() == null) return;
        
        try {
            Arrays.stream(new File(path).listFiles()).forEach(file -> arenas.put(file, YamlConfiguration.loadConfiguration(file)));
        } catch (NullPointerException e ) {
            System.out.println("No arenas found!");
        }
        
    }```  You mean like that?
remote swallow
#

string to yaml config

worthy moat
#

I check the directory if there is any yml and if yes it load all into the Map

#

right?

remote swallow
#

you dnt check if its a yaml

worthy moat
#

ah

#

right

#

uhm

upper hazel
#

https://paste.md-5.net/ejipexigob.cs - why this serialization does not also take into account the number of itemsStack - for example, if there are 2 apples in the inventory, then they are combined into 1

icy beacon
#

show the itemToString(ItemStack) method

worthy moat
icy beacon
hazy parrot
#

Also don't catch npe

icy beacon
upper hazel
#

demm

remote swallow
upper hazel
worthy moat
#
    public ArenaUtils(String path) {

        if (new File(path).listFiles() == null) return;

        try {
            Arrays.stream(new File(path).listFiles()).forEach(file -> {
                if (!file.getName().endsWith("yml")) return;
                arenas.put(file, YamlConfiguration.loadConfiguration(file));
            });
        } catch (NullPointerException e ) {
            System.out.println("No arenas found!");
        }

    }```
tender shard
remote swallow
remote swallow
tender shard
#

hm but where else would you set it, if not in jar?

#

i mean, jar is the last step

remote swallow
#

they have shadow plugin, so shadowjar

tender shard
#

but what does shadow have to do with the output?

remote swallow
#

it outputs the uber jar

worthy moat
#
 public ArenaUtils(String path) {

        try {
            
            for (File file : new File(path).listFiles()) {
                if (!file.getName().endsWith("yml")) return;
                arenas.put(file, YamlConfiguration.loadConfiguration(file));
            }

        } catch (NullPointerException e ) {
            System.out.println("No arenas found!");
        }

    }```
#

So like this?

tender shard
#

at least in maven, shade comes after compile, and before package

#

it wouldnt make any sense to first create a .jar, and then manually add the shaded stuff to it. shadow should definitely run before jar

remote swallow
#

in everything i do shadowjar depends on build

#

and i change the output in shadowjar

rose trail
#

?paste

undone axleBOT
icy beacon
#

is there any way to simplify this?

return if (requiredLevel == null) object: Kit {
      override fun getHelmet(): ItemStack? = helmet
      override fun getChestplate(): ItemStack? = chestplate
      override fun getLeggings(): ItemStack? = leggings
      override fun getBoots(): ItemStack? = boots
      override fun getPrimaryWeapon(): ItemStack? = primaryWeapon
      override fun shouldGiveSpecial(): Boolean = shouldGiveSpecial
      override fun getInventory(): List<ItemStack> = inventory
      override fun getKitName(): String = kitName
      override fun getKitDescription(): List<String> = kitDescription
      override fun getRepresentativeGUIItem(): ItemStack = representativeItem
      override fun getHealth(): Double = health
      override fun getPotionEffects(): List<PotionEffect> = effects
    } else object: LevelRestrictedKit {
      override fun getHelmet(): ItemStack? = helmet
      override fun getChestplate(): ItemStack? = chestplate
      override fun getLeggings(): ItemStack? = leggings
      override fun getBoots(): ItemStack? = boots
      override fun getPrimaryWeapon(): ItemStack? = primaryWeapon
      override fun shouldGiveSpecial(): Boolean = shouldGiveSpecial
      override fun getInventory(): List<ItemStack> = inventory
      override fun getKitName(): String = kitName
      override fun getKitDescription(): List<String> = kitDescription
      override fun getRepresentativeGUIItem(): ItemStack = representativeItem
      override fun getHealth(): Double = health
      override fun getPotionEffects(): List<PotionEffect> = effects
      override fun getRequiredLevel(): Int = requiredLevel
    }
#

it feels too clunky to repeat the same stuff twice just to add one value

tender shard
icy beacon
tender shard
#

which means that shadowjar runs before build

tranquil ferry
#

Hey, I want to ask which event in BungeeCord API is called when player successfully switched server to another ? I see, there is ServerConnectedEvent & ServerSwitchEvent but I don't see difference between them

remote swallow
tender shard
#
12:36:55: Executing 'build'...

Starting Gradle Daemon...
Gradle Daemon started in 1 s 812 ms
> Task :generateEffectiveLombokConfig UP-TO-DATE
> Task :compileJava UP-TO-DATE
> Task :processResources UP-TO-DATE
> Task :classes UP-TO-DATE
> Task :jar UP-TO-DATE
> Task :assemble UP-TO-DATE
> Task :shadowJar UP-TO-DATE
> Task :generateTestEffectiveLombokConfig UP-TO-DATE
> Task :compileTestJava NO-SOURCE
> Task :processTestResources NO-SOURCE
> Task :testClasses UP-TO-DATE
> Task :test NO-SOURCE
> Task :check UP-TO-DATE
> Task :build UP-TO-DATE

BUILD SUCCESSFUL in 16s
6 actionable tasks: 6 up-to-date
12:37:12: Execution finished 'build'.

very weird that jar runs before shadowJar lol. that makes little to no sense

icy beacon
worthy moat
#
    public boolean save() {
        try {
            for (Map.Entry<File, FileConfiguration> entry : arenas.entrySet()) {
                File file = entry.getKey();
                FileConfiguration config = entry.getValue();

                config.save(file);
            }
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }```
#

And this is how I would save the whole list

icy beacon
#

is there any way to simplify this

magic glacier
#

now i have tried
perms.get(player.getUniqueId()).unsetPermission("permission);

#

and its not working

#

so whats the solution

#

its from 1.8 btw

tender shard
#

?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.

magic glacier
#

as im developing a pvp server

icy beacon
magic glacier
#

its not an error

icy beacon
#

i hope not

tender shard
#

what even is "perms"

magic glacier
icy beacon
#

or did you just send pseudocode

magic glacier
icy beacon
#

can just be Map<UUID, PermissionAttachment> perms = new HashMap<>();

shadow night
#

yeah

tender shard
#

and what is "not working"?

magic glacier
tender shard
#

why would removing something from a random unrelated map change any actual permissions?

icy beacon
#

ok just show your actual code and describe the problem properly

magic glacier
#

it doesn't remove the permission

#
public     HashMap<UUID, PermissionAttachment> perms = new HashMap<UUID, PermissionAttachment>();

public HashMap<UUID, PermissionAttachment> Permissions(Player player) {
        this.attachment = player.addAttachment(this);
        perms.put(player.getUniqueId(), attachment);
        return this.perms;
    }```
icy beacon
#

?conventions your method should be in lowerCamelCase to increase readability

tender shard
#

i have no clue what that even is supposed to do

icy beacon
icy beacon
#

but good coding practices reduce bugs significantly

icy beacon
tender shard
#

I thought Permissions(Player) is a constructor

icy beacon
#

same

magic glacier
#

hmm

icy beacon
#

that's why conventions are needed

magic glacier
#

but why it doesn't remove the permissions

icy beacon
#

why would this particular snippet of code remove anything

hybrid spoke
#

because you are not removing it

magic glacier
#

i tried it several times and removed the op

tender shard
#

because you never remove any permission

icy beacon
#

it literally says add

tender shard
#

all you do is to create a hashmap

hybrid spoke
#

?learnjava

undone axleBOT
tender shard
#

i really don't get why you'd think this would unset any permission

magic glacier
hybrid spoke
#

for how long

magic glacier
#

java indermediate and introduction to java

hybrid spoke
#

a day?

magic glacier
#

the both courses

#

and finished all the parctise

icy beacon
hybrid spoke
#

and yet you have no clue what you are doing

magic glacier
#

the should i make player.removeattachment ?

tender shard
#

to remove a permission you call setPermission(somePermission, false) on the existing attachment

magic glacier
#

or what

silent steeple
#

what happened to my server whenever i join there is no world i just fall forever

magic glacier
silent steeple
#

im at like -4000 on the y coordinate

icy beacon
#

also this message literally gives 0 information

tender shard
icy beacon
#

we know nothing about your server

magic glacier
#

try restarting the server or your router

icy beacon
#

if anyone has experience with kotlin, please take a look at my thread, much appreciated ๐Ÿ™‚

silent steeple
icy beacon
silent steeple
#

ok

magic glacier
icy beacon
#

show the line of code you have now

magic glacier
#

HashMap<UUID, PermissionAttachment> perms = new HashMap();

icy beacon
#

HashMap<>()

#

and it's a good practice to just specify the most parent type, e.g.
Map<UUID, PermissionAttachment> perms = new HashMap<>();
instead of
HashMap<UUID, PermissionAttachment> perms = new HashMap<>();

magic glacier
icy beacon
#

that's ๐Ÿ˜ญ

#

java is already very verbose

#

no need to make it even harder

shadow night
#

lol

remote swallow
#

the correct way is Map<Woof, Meow> map = new HashMap<>();

placid moss
#

sololearn is on older java version still

#

i dont think it teaches things like streams

smoky anchor
#

Why would it teach streams, this isn't twitch smh
\j

worthy moat
#

Hey i get following error:

#

[12:57:21 WARN]: java.io.IOException: The system cannot find the path specified

#
    public boolean saveArena(String name, Arena obj) {

        try {
            File file = new File(this.path + "\\" + name);

            if (!file.exists()) {
                file.createNewFile();
            }

            FileConfiguration fileConfiguration = YamlConfiguration.loadConfiguration(file);
            fileConfiguration.save(file);

            arenas.put(file, fileConfiguration);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }```
#

this is my code

icy beacon
#

what do you supply for this.path

worthy moat
#

plugin.getDataFolder().getAbsolutePath() + "\\arena"

icy beacon
#

oh and instead of "\\" use File.separator

#

i'm not sure but it could be that the file variable isn't updated after you call file.createNewFile() and it still thinks that the file is nonexistent when you try to load the configuration

#

if that's not the case, then the arena folder is not existent

worthy moat
#

In the end the file poathname is \plugins\AlphaWars\arena\name

worthy moat
icy beacon
#

not sure

tender shard
#
File arenaFolder = new File(getDataFolder(), "arena");
File nameFile = new File(arenaFolder, "name");
#

do it like this

icy beacon
#

just check for the file existence

#

yeah

#

and if (!arenaFolder.exists()) arenaFolder.mkdir();

tender shard
#

wdym

worthy moat
#

what is getDataFolder

icy beacon
#

plugin.getDataFolder()

remote swallow
#

Plugin#getDataFolder

shadow night
#

What directories does the plugin have access to?

tender shard
#

everything the server has access to

icy beacon
#

yeah from plugin.getDataFolder() you can navigate to anywhere

#

or if you create a file without using plugin.getDataFolder() (e.g. new File("abc")), it is created in whenever the start script is running from

worthy moat
#

it works

#

great thanks

#

but it isnt a yml

#

its just a file

#
    public boolean saveArena(String name, Arena obj) {

        try {

            File file = new File(arenaFolder, name);

            if (!file.exists()) {
                file.createNewFile();
            }

            FileConfiguration fileConfiguration = YamlConfiguration.loadConfiguration(file);
            fileConfiguration.set("Arena", obj);
            fileConfiguration.save(file);

            arenas.put(file, fileConfiguration);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }```
#

This is my save method

smoky anchor
#

append ".yml" to the end of the name

#

I am quite rusty with exceptions.. shouldn't he catch IOException instead of just any Exception ?

ivory sleet
#

Yes

#

Catch specific exceptions if possible

#

Much more precise and expressive error handling

quaint mantle
#

this is getting stupid

shadow night
#

It indeed is

quaint mantle
#

i cant write more than 2 lines of code without it freezing and doing that

worthy moat
quaint mantle
#

how the christ do i fix this shti

worthy moat
#

[13:10:17 WARN]: java.io.IOException: The system cannot find the path specified

#

again

#
public boolean saveArena(String name, Arena obj) {

        try {
            File file = new File(arenaFolder, name + ".yml");

            if (!file.exists()) {
                    file.createNewFile();
            }

            FileConfiguration fileConfiguration = YamlConfiguration.loadConfiguration(file);
            fileConfiguration.set("Arena", obj);
            fileConfiguration.save(file);

            arenas.put(file, fileConfiguration);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }```
#

Is it because the directory arena doesnt exist again?

shadow night
shadow night
#

Ask the person who said that, not me

quaint mantle
#

well who said it...

shadow night
#

Hmm

worthy moat
#

How can I create a directory from a file?

smoky anchor
#

call mkDirs on arenaFolder if it does not exist

shadow night
smoky anchor
remote swallow
#

hi thats me

quaint mantle
#

yea did that fix the stupid crashing thing

remote swallow
#

mostly

quaint mantle
#

we shall see

#

next topic

icy beacon
#

why wouldn't you download sources immediately? intellij prompts you with it

quaint mantle
#

do i have to add the lore manually for custom enchantments?

remote swallow
#

just note you cant control click classes to see their impl and more

remote swallow
quaint mantle
icy beacon
quaint mantle
#

like how do i get a book of my custom enchant

icy beacon
#

add the enchantment there and then add the lore to the book

quaint mantle
#
public static ItemStack customEnchantBook(CustomEnchant customEnchant) {
        ItemStack book = new ItemStack(Material.ENCHANTED_BOOK);
        EnchantmentStorageMeta meta = (EnchantmentStorageMeta) book.getItemMeta();
        meta.addStoredEnchant(customEnchant, customEnchant.getMaxLevel(), true);
        book.setItemMeta(meta);
        return book;
    }
#

got that

#

seems to give me the right book

icy beacon
#

and lore

quaint mantle
#

but

#

i cant seem to apply it to anything?

icy beacon
#

in my plugin i handle books manually

#

one sec

remote swallow
#

feeling bored

remote swallow
#

might make a custom enchants api

icy beacon
#

but you can reference it

ivory sleet
#

U have to make sure the parent file exists

worthy moat
#

.mkdir

#

just found the missing thing

#

xD

icy beacon
quaint mantle
icy beacon
#

your choice, maybe you can figure something out

#

actually wait

#

the "can't apply" is a case of

#

?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.

icy beacon
#

if you mean that the lore does not appear on the item, it's because it shouldn't, you have to apply it manually

#

but the enchantment should probably appear, you can check with /data get entity @s SelectedItem

quaint mantle
#

with cant apply i mean

icy beacon
#

hm perhaps the anvil does not support custom enchants either

#

well try writing an anvil handler

remote swallow
#

you have to rewrite the anvil impl for custom encahnts

quaint mantle
icy beacon
#

yeah

icy beacon
#

before it becoming stable

shadow night
#

Well, *** p a i n ***

quaint mantle
#

i have just been informed, no need for anvils

#

custom way it is

#

they dont want any vanilla enchants

timid hedge
#

How do i get which group a player is in with luckperms?

worthy moat
#

Is there a nice GUI framework or should I generate all this myself?

worthy moat
#

I want to display some GUIs if you click on some Itemsโ€ฆAnd either I build those GUIs myself or I use a nice framework which makes it a bit easier

icy beacon
#

i really like it

worthy moat
icy beacon
drowsy helm
icy beacon
#

some people also love IF

drowsy helm
#

You can be in multiple groups

icy beacon
#

but i haven't tried it

timid hedge
remote swallow
#

User#getPrimaryGroup

#

it wasnt hard

timid hedge
#

Where did you find it? i need to method to get it to work

remote swallow
#

opened the javadocs and looked at the user class

tawny remnant
sullen marlin
#

Check Material docs to see what blockdata skull has (Rotatable iirc) and set accordingly

wintry python
#

Hey, I want to get if a sign is glowing, how do i get it ?

timid hedge
icy beacon
#

is it common to use reflection during serialization/deserialization?

class LocaleDeserializer : JsonDeserializer<Locale> {
  override fun deserialize(json: JsonElement?, typeOfT: Type?, context: JsonDeserializationContext?): Locale {
    val messages = json?.asJsonArray ?: throw IllegalArgumentException("A locale must be an array of messages.")
    val locale = Locale()

    for (message in messages) {
      val messageObject = message.asJsonObject

      val terms = messageObject["term"].asString.split("-")
      terms.forEach { it.replaceFirstChar { char -> if (char.isLowerCase()) char.titlecase() else char.toString() } }
      val term = terms.joinToString("")

      val definition = messageObject["definition"].asString

      locale::class.java.getDeclaredField(term).set(locale, definition)
    }

    return locale
  }
}
remote swallow
eternal oxide
#

implement Vault over a specific permission plugin API

timid hedge
vast ledge
#

Ask them

timid hedge
#

I have

vast ledge
#

youre asking on a spigot discord a lp question

remote swallow
#

Ask in the api help channel or general help channel

undone axleBOT
young knoll
#

Did you shade jda

timid hedge
#

What does that mean?

young knoll
#

You need to include it in your jar

timid hedge
#

I have

young knoll
#

Otherwise you wonโ€™t have access to it at runtime

timid hedge
#
      <dependency>
          <groupId>net.dv8tion</groupId>
          <artifactId>JDA</artifactId>
          <version>4.2.1_253</version>
      </dependency>
crimson tinsel
#

how do i cancel the block drop even after blockbreakevent

remote swallow
timid hedge
remote swallow
#

No

#

they use semver

drowsy helm
remote swallow
drowsy helm
hushed spindle
#

maybe im asking a dumb question but how can i configure my pom.xml to import several versions of nms mappings
im using jeff media's plugin archetype builder thingy

crimson tinsel
timid hedge
remote swallow
#

Yes

timid hedge
#

Okay thanks, but i still get the same error

#

.

remote swallow
#

Add tye maven shade plugin

#

X

#

Coll lonked it

timid hedge
#

And what does that do?

remote swallow
#

Shade studd

#

Stuff

timid hedge
#

How do i add tye?

remote swallow
#

I meant the there

#

The maven shade plugin

#

My fingers are too big for ny phone

timid hedge
#

Ohhh lol

icy beacon
#

that's good

timid hedge
#

I cant find the dependency

remote swallow
#

Reload maven

worldly ingot
#

Conditions are AND and OR, nor ,

rose trail
drowsy helm
#

Should probs be caching that data aswell

hushed spindle
#

does anyone happen to know if alex is ok with someone messaging him for a question or does he find that annoying

#

jeff media alex that is

remote swallow
#

Ask him first

worldly ingot
#

lol

#

You're almost always best asking in here just in case someone else can answer

hushed spindle
#

i did but since he developed the thing i thought he would know best

remote swallow
#

Isit a lib or plugin

hushed spindle
#

using his plugin archetype builder thing which configures mojang mappings in an easier way, but only for 1 version

#

wanted to know if you could configure a range of versions for it

#

or if i would have to make several subprojects for it with individual poms

remote swallow
#

Modules

hushed spindle
#

yeah i mean modules mb

rose trail
#

Is it possible to pass TextComponent to player between servers?

remote swallow
river oracle
hushed spindle
#

makes sense

remote swallow
river oracle
#

Anyways if you want to you'll have to serialize the component into a json string then send it through plugin messaging with the username

#

Then deseralize it back into a component and send it to the UUId you sent it with

rose trail
worldly ingot
#

Depends on the component library you're using

#

Both BungeeChat and Adventure have component serializers

remote swallow
#

Uuid to string, component to json

#

Before uou ask idk what thr to json class is

worldly ingot
#

ComponentSerializer for BungeeChat, GsonComponentSerializer for Adventure

remote swallow
#

Ty choco

rose trail
#

thank you very much

worthy moat
#

Is ther also a nice Scoraboard framework?

timid hedge
tender shard
#

then you didnt follow that guide

#

show your pom.xml

timid hedge
#

Here it says Exception 'javax.security.auth.login.loginException' is never thrown in the corresponding try block at LoginException

    @Override
    public void onEnable() {
        saveDefaultConfig();

        String botToken = getConfig().getString("bot-token");
        try {
            jda = JDABuilder.createDefault(botToken)
                    .build()
                    .awaitReady();
        } catch (InterruptedException | LoginException e) {
            e.printStackTrace();

        }
undone axleBOT
tender shard
#

then simply don't catch it?

#

just remove LoginException from your catch

wintry python
#

Hey, I want to get if a sign is glowing, how do i get it ?

tender shard
#

oh wait, what do you mean with "how do I get it"

#

you get a block's BlockState, cast it to Sign, get the sign's side, then you can check if it's glowing with SignSide#isGlowingText

ivory sleet
#

Else spigot api allows u to do everything, no?

wintry python
#

i am coding a plugin when a specific sign is clicked (the glowing sign) a player gets teleported

craggy estuary
#

Kinda not related to spigot but is there a api similar to quick.db (JavaScript) in Java?

ivory sleet
#

Yeah sorta

tender shard
#

i always use hikari for database stuff

#

no idea what quick.db does though

ivory sleet
#

Its a high level minimalistic database abstraction framework sorta

rose trail
worldly ingot
#

Same classes

#

#parse() for BungeeChat, #deserialize() for Adventure

#

You've gotta use Javadocs or at least your IDE, man

rose trail
#

ok

timid hedge
#

Why does it say Cannot resolve method 'sendMessage(MessageEmbed)'?
chatChannel.sendMessage(builder.build()).queue();

ivory sleet
#

sendMEssage

timid hedge
#

I wrote wrong in discord

ivory sleet
#

Oh

#

Probably because no such method named sendMessage takes a single message embed

tender shard
#

you haven'T even mentioned what "chatChannel" is

wintry python
#

Can I give a sign a "thing" so I can identify it as the "thing sign"?

ivory sleet
#

PDC

tender shard
#

what is chatChannel?

timid hedge
#

Its the channel where the messages is getting send on discord

tender shard
#

what is it?

#

which type?

timid hedge
#

text channel

austere cove
#

probs part of jda

ivory sleet
#

Yee

austere cove
#

any of you guys worked w custom chunkgenerators? my generatecaves isn't called ever

timid hedge
#

Thanks

shadow night
#

I've tried this code, but for some reason it does not work. Neither the entity, nor the player are uncollidable. When I checked the data using the /data command it didn't show anything about collidability

craggy estuary
#

(Late)

austere cove
# ivory sleet Got any code?

I have a class extending ChunkGenerator. I set an instance of this class as generator in the WorldCreator used to create the world. The other methods (generate noise/surface/bedrock) are all called

timid hedge
ivory sleet
#

With no arguments

austere cove
#

as per the docs overriding those methods merely indicates that the vanilla generator should also be used

austere cove
#

besides haven't done that for the others and they still work

shadow night
ivory sleet
#

You must override both

#

The one with no arguments and the one with

#

However

#

You can return false I believe to prevent vanilla cave generation, no?

#

Wait fuck

austere cove
#

they return false by default

ivory sleet
#

Ah okay

#

Hmm

hazy parrot
#

when they are ready to make babies ig

#

example when you feed wheat to horse or whatever

tender shard
#

when they're about to fuck

shadow night
austere cove
#

The weird thing right, is that shouldGenerateBedrock() or whatever is deprecated

#

but caves should work fine as far as I know

cinder abyss
#

Hello, how can I get the player who caused the generation of a mob ?

dawn plover
#

hello, i have created a team thing, that saves all kind of stuff, including the players

the problem is, when a player leaves, and relogs, the old player instance stays in that team, though for some reason that old instance is not the same as the player instance that has relogged,
Any idea's why this is and how to fix it

remote swallow
#

Saved the uuid to the team, not player instance

odd cobalt
#

please help

cinder abyss
odd cobalt
odd cobalt
cinder abyss
#

but idk how sorry

odd cobalt
#

hmm okay

smoky anchor
#

lol
you can use reflection to access 'b'

remote swallow
#

Use mojmaps

smoky anchor
#

Look if 'b' has a getter method first
Also I recommend using mojmaps

remote swallow
#

?switchmappings

odd cobalt
#

okay thanks lemme try

remote swallow
#

@worldly ingot can you add a ?mappings thar has the mappings.cpehx link, idk what the actual link is. The new screaming sandles

worldly ingot
#

?mappings

#

Yeah sure. Lemme just figure out how to add a command lol

remote swallow
#

Kek

worldly ingot
#

?mappings

undone axleBOT
remote swallow
#

Woooo

#

Go choco

austere cove
#

choco have you experimented w custom worldgen?

worldly ingot
#

Not particularly. At least not since recent overhauls

austere cove
#

;-;

worldly ingot
#

Never had much reason to

remote swallow
#

Go get a job doing world gen

shadow night
#

IJ is a super IDE

#

I was coding, there was a lot of code

#

it froze

remote swallow
#

Meh

shadow night
#

I ended it

#

and

#

ww

#

wow

#

my code is gone

remote swallow
#

Real

shadow night
#

EVERYTHING

#

fix this shit finally

cinder abyss
#

Hello, how can I raytrace between a player and a Entity ? (raytrace in green, direction of Player in black)

eternal oxide
#

you want the green direction from player to entity?

eternal oxide
#

entity.getLocation().toVector().subtract(player.getLocation().toVector()).normalize()

tawdry monolith
#

I'm making my own chat formatter but some of our ranks have custom hex codes as the color, I want them to show the color ingame but I have no clue how to do that :/ (first image is how it looks, second is how it should look)

#

I thing I found out

#

do I need to use legacy hex colors

#

&x&f&b&6&9&0&0

umbral ridge
#

Here's one of my methods for hex color converting, maybe it'll help you out xd

tawdry monolith
#

yep I got it lmao

#

legacy hex colors

#

mb ๐Ÿ˜‚

remote swallow
rough drift
#

I got a simple regex

shadow owl
umbral ridge