#help-development

1 messages · Page 1832 of 1

lethal coral
#

nowhere

#

I just need the chatcolor object because setting the glow color (of an npc) and team color requires it

candid galleon
#

where's the skript code / functionality?

lethal coral
candid galleon
#

you should be able to do if (color == Color.RED) return ChatColor.RED

lethal coral
#

why did I even bother converting to a bukkit color

candid galleon
#

better yet make that a switch statement

lethal coral
#

🤦‍♂️

lethal coral
#

anyways thank you for your help

candid galleon
#

gross

#

👍

lethal coral
waxen plinth
#

It does

#

== is reference equality

lethal coral
#

It's SkriptColor that's why

#

for the enum

vale ember
#

what can cause this?
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:383) ~[server.jar:git-Spigot-cbd1a1b-009d8af]
at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:358) ~[server.jar:git-Spigot-cbd1a1b-009d8af]
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:158) ~[server.jar:git-Spigot-cbd1a1b-009d8af]
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:100) ~[server.jar:git-Spigot-cbd1a1b-009d8af]
at com.google.gson.Gson.getAdapter(Gson.java:423) ~[server.jar:git-Spigot-cbd1a1b-009d8af]
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAda

tacit drift
#

?paste

undone axleBOT
vale ember
#

it's infinite recursion ig

#

this is the class

package com.aregcraft.customstevechaos.game.world;

import com.google.gson.annotations.SerializedName;
import lombok.*;
import org.bukkit.Location;

import java.util.List;
import java.util.Map;
import java.util.UUID;

@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class GameMap {
    private String name;
    private UUID uuid;
    @SerializedName("mob_arenas") private List<SpawnArea> mobArenas;
    @SerializedName("duel_arenas") private Map<BiSpawnArea, SpawnArea> duelArenas;
    @SerializedName("spawn_area") private SpawnArea spawnArea;
    @SerializedName("upgrade_location") private Location upgradeLocation;
    @SerializedName("trash_location") private Location trashLocation;
    @SerializedName("shop_location") private Location shopLocation;
    @SerializedName("bets_location") private Location betsLocation;
}
#

with only name and uuid it works fine

#

also all the fields except name and uuid is null

#

at serialization moment

tacit drift
#

Why so many annotations

vale ember
#

the top ones is for setters, getters, constructors, for the fields, i want to use snake_case

#

ig the problem is in Location

#

for some reason it can't be serialized by gson

drowsy bramble
#

Oh. Plus i had to go to bed right when i posted tht

sterile token
#

Hello. I want to know if I can made a custom Thread implementation so i can use: throws Exception Oracle will allow me?

eternal oxide
#

You can extend Thread and throw any exception you want

buoyant viper
eternal oxide
#

true

vale ember
#

????

#
    @Override
    public void write(JsonWriter out, Location value) throws IOException {
        if (value == null) return;

        out.name("world").value(Objects.requireNonNull(value.getWorld()).getUID().toString())
                .name("x").value(value.getX())
                .name("y").value(value.getY())
                .name("z").value(value.getZ())
                .name("yaw").value(value.getYaw())
                .name("pitch").value(value.getPitch());
    }
lavish hemlock
#

you checked the docs for JsonWriter::name to see why it may throw illegal state?

vale ember
#

it don't say

lavish hemlock
#

not surprised

vale ember
#

but from source code it's

    if (deferredName != null) {
      throw new IllegalStateException();
    }
lavish hemlock
#

what's deferredName?

vale ember
#

idk

lavish hemlock
#

you know don't?

#

I know don't too

#

such a crazy coincidence

#

anyway gimme a sec

#

ok so it seems to be throwing that exception on the first name call

#

since deferredName is set to name after it's checked

vale ember
#

and what am i supposed to do?

lavish hemlock
#

meaning you're probably missing a few method calls

#

like beginObject and endObject?

#

I don't know

#

never used this API

#

yeah

#

you need to call beginObject and endObject before and after any other calls it seems

vale ember
#

it still throws the same exception

lavish hemlock
#

show me your code now?

vale ember
#
    @Override
    public void write(JsonWriter out, Location value) throws IOException {
        if (value == null) return;

        out.beginObject().name("world").value(Objects.requireNonNull(value.getWorld()).getUID().toString())
                .name("x").value(value.getX())
                .name("y").value(value.getY())
                .name("z").value(value.getZ())
                .name("yaw").value(value.getYaw())
                .name("pitch").value(value.getPitch()).endObject();
    }
lavish hemlock
#

hmm

#

I don't know why it's doing that

#

could you try putting each call on a separate line

vale ember
#

tried

lavish hemlock
#

and then giving me the line and column number of the error within your class?

#

also having the full class'd be nice too

vale ember
lavish hemlock
#

so it's on line 115 then?

#

which line is that

trim surge
#
[04:05:38] [Server thread/ERROR]: "Silently" catching entity tracking error.
net.minecraft.server.v1_8_R3.ReportedException: Adding entity to track```
#

Anyone seen this error before?

vale ember
#

gson.toJson(maps.get(uuid), writer);

#

private final Gson gson = new GsonBuilder().setPrettyPrinting().registerTypeAdapter(Location.class,
new LocationAdapter()).create();

lavish hemlock
#

so I guess Gson doesn't show me the line of the adapter since it uses some kind of reflective wrapper

vale ember
#

i fixed it

#
        if (value == null) {
            out.nullValue();
            return;
        }
#

idk why it was problem

tulip linden
#

Hi 1.18.1 Spigot Jar Is too Heavy Like i Have 45 Plugins and 6.3GB Ram but it crashes my server is it gonna be the same or will they reduce it ?

lavish hemlock
#

that's strange

#

anyway gj

acoustic pendant
#

how can i add a default value that is not 0 to an int in mysql?

acoustic pendant
lavish hemlock
#

I feel the static usage in my veins

acoustic pendant
#

what?

lavish hemlock
#

nvm sorry I was bein' a fucking idiot

#

I feel the direct field access in my veins

acoustic pendant
dire ocean
#

Hey all, I'm working with anvils & enchantments and I'm having a strange issue. What I've done so far is changed the max enchantment level for every item that accepts enchantments. Here's the current problem I'm trying to tackle.

I'm attempting to remove the block that prevents the player from having multiple protection types on a single piece of armour, I've successfully got the result in the anvil, but I'm unable to take the result out as it costs nothing (When I log the value, it states 1xp level. and i've attempted to use SetRepairCost() however it has no effect)
Just looking for general direction to search in as I feel I've exhausted all my options

tacit drift
#

and when they get it in the inventory, replace it

#

idk if it will work

clear iris
#

how would I go about making a specific mob follow another specific mob but not with hostile intent?

wicked lake
#

Basically you set the cost the next tick

tidal hollow
#

How can I detect how long a player has been awake? and if you've been awake for a long time an event will run

buoyant viper
#

schedulers, probably

wicked lake
#

Pretty much, run a timer that ticks down until 0 or the player sleeps (PlayerLeaveBedEvent + check if day)

sterile token
eternal oxide
#

You throw an exception, an object throws an exception

sterile token
#

I dont want to use try-catch. I want to use this:

public methodName () throws Exception {}

So my library looks cleaner

#

The one who use the library should made try-catch

queen patio
#

Is there a way to cause the ender dragon respawn to occur. I don't mean by just summoning another dragon, I mean the type of respawn that happens when you place the 4 end crystals on the portal frame and it has the animation and replaces all the broken end crystals and such. I tried summoning the four end crystals at the right coordinates but it doesn't seem to work unless a player places them down

sterile token
#

How do I set the durability of a ítem to 3 uses let say

#

Its possible?

novel frost
#

https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/data/BlockData.html#matches(org.bukkit.block.data.BlockData)

States:

Checks if the specified BlockData matches this block data.
The semantics of this method are such that for manually created or modified BlockData it has the same effect as Object.equals(java.lang.Object), whilst for parsed data (that to which merge(org.bukkit.block.data.BlockData) applies, it will return true when the type and all explicitly set states match.
Note that these semantics mean that a.matches(b) may not be the same as b.matches(a)

in my test plugin, I'm clearly manually creating the BlockData, But I want the behavior of a 'parsed' BlockData.

https://gist.github.com/ryantheleach/8201d2b75da86013cff7a0be5dfee1ee

How can I get a 'parsed' BlockData?

tardy delta
#

will this create an new decimalformat instance whenever the run method is called?

sterile token
#

Why player.spigot()?

#

U can use directly player#sendMesssge()

novel frost
#

@tardy delta yes.

sterile token
tardy delta
sterile token
#

Ah btw

novel frost
#

@sterile token I pinged fourteen, not you

#

why would it apply to your message?

sterile token
#

Why people its agresive here?

sacred ice
#

What's your version?

novel frost
#

I'm not being aggressive.

sterile token
#

Ah ok

tardy delta
opal juniper
tardy delta
#

lol

sacred ice
#

If you don't want player.spigot() there is an nms solution but again its nms

opal juniper
#

just use the spigot method

sterile token
#

Why people hate nms

opal juniper
#

cause it’s not an api

novel frost
#

because it breaks every version

#

also, doing .spigot is far easier then nms

tulip owl
#

How can I make a command to reload my config? I have got a reload method in my main file

public static void reloadSVL() {
        reloadConfig();
    }

And then in my command class I reference it

@CommandAlias("svl|simplevotelistener")
public class SVLCommand extends BaseCommand {

    @Subcommand("reload")
    @CommandPermission("SVL.reload")
    @Description("Reloads the configuration file")
    public static void onReload(CommandSender sender, String[] args) {
        SVL.reloadSVL();
    }
}

But the command class wants it to be static and the reload function doesn't want it to be static

sacred ice
#

its pain

sterile token
#

Yes

#

?paste

undone axleBOT
opal juniper
light surge
#

Is there an unbreakable flag in spigot version 1.17?

opal juniper
#

?di

undone axleBOT
tulip owl
#

ty

undone axleBOT
tulip owl
#

oh, i'll update my github

sterile token
#

Ok

tulip owl
#

easier than making loads of paste files 😆

candid galleon
#

It’s existed from 1.8 at least I believe

light surge
tulip owl
candid galleon
#

If you’re talking about the give command, the format for it has changed

light surge
candid galleon
#

Gotcha

novel frost
candid galleon
#

Shouldn’t the method be symmetrical

novel frost
#

Nope! read the JD

#

It explicitly said about it violating symetry

Note that these semantics mean that a.matches(b) may not be the same as b.matches(a)

candid galleon
#

Neat

novel frost
#

It didn't however clarify, which was supposed to be the 'wider' type though

#

I thought it was block.matches(predicate) not predicate.matches(block) which is clearly wrong with hindsight

light surge
# candid galleon Gotcha

You know how to define this in the newer versions? I always coded 1.8.9 - 1.12.2 so idk about this lol.

misty current
#

you need to cast the itemmeta to damageable

#

iirc

#

actually maybe just the normal itemmeta is fine

light surge
#

make an command that makes the item that im holding unbreakable

candid galleon
light surge
#

thanks for helping 🙂

sterile token
#

Np sir. We are for help

queen patio
tardy delta
#

is there a tutorial somewhere how to use the hikaridatasource?

candid galleon
buoyant viper
summer scroll
#

How can I remove all bossbars? And make them not visible to any of players.

#

I've tried this, but the bossbar is still visible to player

        Iterator<KeyedBossBar> iterator = Bukkit.getBossBars();
        while(iterator.hasNext()){
            KeyedBossBar bossBar = iterator.next();
            bossBar.setVisible(false);
            bossBar.removeAll();
        }
queen patio
candid galleon
summer scroll
#

wth

#

is packet really necessary here?

warm mica
summer scroll
candid galleon
#

¯_(ツ)_/¯ if you find another way by all means use it

#

That could work actually

summer scroll
#

You simply use Bukkit#createBossBar to create a bossbar

#

Oh

#

I created BossBar, the one on Bukkit#getBossBars are KeyedBossBars

candid galleon
#

Mate are you trying to MAKE a bossbar or HIDE it

summer scroll
#

hide

#

i just found out that there are 2 different type of BossBar

candid galleon
#

So you can get the bossbar linked to the entity and remove the players from it

summer scroll
#

It's not linked to any entity

candid galleon
#

So where are they coming from?

summer scroll
#

I don't know the details

candid galleon
#

🤦‍♂️

quaint mantle
#

me imagine someone rewrite every codes from mojank then remove the eula thingy from the jar and public the source 😎

summer scroll
#

You don't need to create an entity to create a bossbar anymore

candid galleon
#

I know

#

Look into that API

summer scroll
#

yeah i figured it out man

candid galleon
#

👍

#

By the way that was the first result on google

summer scroll
#

i figured it out on my own

candid galleon
#

👍

#

Even better

quaint mantle
#

wtf are you asking bro

ivory sleet
#

::setMaxHealth

#

or use the attribute api

buoyant viper
#

i think Glowstone is nms free

ivory sleet
#

Not complete tho?

quaint mantle
#

mojank

ivory sleet
#

Because generally it’d be a pain to keep up with nms

acoustic pendant
buoyant viper
#

yeah its still on like 1.12.2 sadly

quaint mantle
#

why would that guy want to remove the message?

acoustic pendant
#

was with setHealthScaled(true)

quaint mantle
#

just keep it

#

why dont you

ivory sleet
quaint mantle
#

i cant imagine how people in mojank know how to maintain mc code lul

buoyant viper
ivory sleet
#

Hmm yeah, I know impls like minestom and krypton but they’re far from being denoted as fully implemented. Altho minestom aims for another goal.

random epoch
buoyant viper
#

ooo it has a 1.16.5 version now, indev tho

ivory sleet
#

I don’t know a lot about glowstone so can’t speak for it but yeah

acoustic pendant
#

is there any 1.8 method about defense?

#

i don't find nothing

buoyant viper
#

what

#

like blocking with a sword?

tacit drift
#

In 1.14+ at least

onyx fjord
#

which remapped jar should i use for nms?

#

remapped-obf or remapped?

quaint mantle
#

Remapped

sleek pond
#

Anyone know why this:

System.out.println(enchantmentsSection);
System.out.println(enchantmentsSection.getKeys(false));

Causes that output statement?

#

config:

#

0:
material: STONE_AXE
name: "&cSharpened Axe"
enchantments:
SHARPNESS: 2
FIRE_ASPECT: 1
chance: 0.05
minAmount: 1
maxAmount: 1

#

the enchantmentsSection is the enchantments: of the config

white thicket
#

Hey guys, how can I send boss bar to all players using packets??

sleek pond
white thicket
#

I do know that we need to use the API but idk exactly how

sleek pond
#

google

white thicket
#

I did and I already found it but I want to know how I can keep the bossbar forever

halcyon mica
#

Does someone by chance have a idea setup to launch and update a plugin in the IDE?

#

Similar to how fabric and force can contain and run a server in-ide

acoustic pendant
#

Hey! do anyone know how to solve this error? mysql db

tardy delta
#

why is the MySQL one striked through?

halcyon mica
#

nvm, I've just set up one myself

ivory sleet
tardy delta
#

oh
⚠ The MySQL DataSource is known to be broken with respect to network timeout support. Use jdbcUrl configuration instead.

candid galleon
#

Never mind that should work

#

That’s the whole code of the print log?

halcyon mica
#

Just define a artifact that builds the jar and copies dependency, target a server you have somewhere and just define a jar run config with the artifacts as before launch tasks

#

Really easy

sleek pond
ivory sleet
#

yuh altho a drawback with that is that the run config is not replicate-able for someone if they dont use intellij and you dont share the .idea config folder

worldly steppe
#

Problem

ivory sleet
#

?paste @worldly steppe

undone axleBOT
ivory sleet
#

how?

halcyon mica
#

If you consider yourself a developer, you should know how to use your tools

#

plus, ide specific configurations have no business being in vsc repos anyway

ivory sleet
#

well, it makes it a hella lot easier if people can just clone your upstream and get it to work

halcyon mica
#

To be fair, no one except people capable of developing their own software does that anyway

#

You can have the best documentation and readme outline a step to step list and people will still fail, complain and ask

#

And in the end just give up and ask or wait for you to build one

#

(Or pay someone to do it, which I genuinely had someone approach me for once)

ivory sleet
#

doesnt take away the fact that providing a good setup will simplify things for your users, for instance forge could just simply have a gradle plugin you'd add, altho that would for sure make people complain about the complexity of setting it up, by providing a fully working setup there are few who ask questions in regards to confusion and misunderstandings.

candid galleon
#

By your logic @halcyon mica there’s no point in having open source projects

ivory sleet
#

thats at least my very take on it, tho Ig one wants to make it cumbrous for others to use and contribute then so be it

halcyon mica
candid galleon
#

Code doesn’t have a target audience

#

Your project does

halcyon mica
#

That's your take, and that's ok

#

But I disagree

candid galleon
#

¯_(ツ)_/¯

#

If you don’t wanna conform to standards you do you

#

I always love hunting down a projects dependencies checking their versions and manually doing it

ember estuary
#

What do you guys thing, should one introduce unnecessary variables for better code readability?

little trail
#

how would i use the java.net HttpClient for a uri with query params?

ivory sleet
#

they're called explanatory variables

#

and make code hella lot more readable

#

if (a == b || b == c && (ab == d || dd == d)) is hard to understand

#

boolean isEntityDeadOrInvalid = a == b || b == c && (ab == d || dd == d)
if (isEntityDeadOrInvalid) {

}

#

reads like well written prose

acoustic pendant
#

could someone tell me what's wrong here? i don't understand, is mysql

fervent gate
#

if(cpName.equalsIgnoreCase("Chestplate of the Void") && lgName.equals("Leggings of the Void") && btName.equals("Boots of the Void")){
player.sendMessage("true");
}

It doesn't execute the code inside of that statement. The code for the items is the following:
Player player = (Player) damager;
ItemStack cp = player.getInventory().getChestplate();
ItemStack lg = player.getInventory().getLeggings();
ItemStack bt = player.getInventory().getBoots();
String cpName = cp.getItemMeta().getDisplayName();
String lgName = lg.getItemMeta().getDisplayName();
String btName = bt.getItemMeta().getDisplayName();

ancient plank
#

use pastes and/or code blocks for code

#

?paste

undone axleBOT
fervent gate
halcyon mica
#

Huh, this is odd

#

Apperantly remapping with mojmap causes some issues

#

It builds and remaps properly, but executing it immediatly causes issues

#

Which I suppose means it does not remap properly, as Level is mojmap

late sonnet
acoustic pendant
late sonnet
#

if is local/remote is another thing

acoustic pendant
#

localhost

#

i don't think are the permissions

#

but i don't know what could be

late sonnet
acoustic pendant
late sonnet
#

the image tell you are using "pma"

acoustic pendant
acoustic pendant
#

username: "root"

late sonnet
#

why a ! in the database name?

acoustic pendant
#

ehm

#

was a proof

#

with another table didn't work as well

late sonnet
#

ok and the console tell another thing?

you show the error in phpmyadmin (maybe bad installation)

acoustic pendant
#

while enabling the plugin

#

it says that is connected

#

(onEnable method)

late sonnet
#

but works in plugin?

i ask this because your first image was from phpmyadmin

quaint mantle
#

kindergarten nugget chicken

#

cause the class?

#

you should implement commandexecutor

#

or tabexecuter if you use tab completer

tulip owl
#

Why doesn't this work?

Location deathWorld = new Location(Bukkit.getWorld("purgatory"), 0, 63, 0);
p.teleport(deathWorld);
#

(the world is created with multiverse)

minor garnet
#
public abstract class AbstractCommand implements CommandExecutor {
    
    
    protected final DeanLoot plugin;
    private final String permission;
      
    public AbstractCommand(DeanLoot plugin, String command) {
        this.plugin = plugin;
        this.permission = command;
        if (command == null) throw new NullPointerException("command is marked non-null but is null"); 
    }
      
    public boolean onCommand(CommandSender sender, Command cmd, String lb, String[] args) {
        if (sender instanceof Player) return true; 
        if (!sender.hasPermission(this.permission)) {
            sender.sendMessage("§cVocê não tem permissão para executar este comando"); return true;
        } 
            
        plugin.getServer().getScheduler().runTaskAsynchronously((Plugin) plugin, () -> {
            try {
                perform(sender, lb, args);
            } catch (final Exception exception) {
                exception.printStackTrace();
            } 
        });
        return true;
    }
      
    protected abstract void perform(CommandSender paramCommandSender, String paramString, String[] paramArrayOfString);
}```
#

i dont know why i dont receive message f

quaint mantle
#

you return early if the sender is a player

minor garnet
#

what

quaint mantle
#

this line

#

if (sender instanceof Player) return true;

ancient plank
#

me too

paper viper
#

thats why debugging is useful

#

lol

smoky lance
#

does PluginMessageListener run on threads other than Main thread by default?

acoustic pendant
late sonnet
tender shard
acoustic pendant
#

this is the code executed when the server goes on

late sonnet
halcyon mica
#

Building a artifact in idea compiles the code, but doesn't actually run maven configurations

#

As such, the remap goal is never executed, and the final jar that is loaded still uses mojmap

acoustic pendant
#

@late sonnetbefore you were telling me that the problem was a "SELECT"
Here is the only method where i call it.

tender shard
tender shard
solid cargo
#

why dafaq is it still throwing illegal argument exception even though i have handled it

#
     try {
    e.setJoinMessage("§7[§a+§7] " + player.getName() + suffixSimplified);

}catch (IllegalArgumentException ex) {

e.setJoinMessage("§7[§a+§7] " + player.getName());
}```
tender shard
#

show the error message

solid cargo
tender shard
#

what's line 28 in FastJoin?

cinder tusk
#

i started making a minecraft plugin that places a spawner in a random spot in a defined range, and when the spawner is mined, it dropsitself and regenerates somewhere else. how do i set the mob type of the spawner?

solid cargo
#

String suffixSimplified = ChatColor.translateAlternateColorCodes('&', suffix);

solid cargo
#

i know

tender shard
#

then what's your question?

solid cargo
#

but i believe i have made it to get handled

ancient plank
#

why not do an if else on if suffix is null

tender shard
cinder tusk
solid cargo
#

cause if i make an if statment it returns always true/false

#

depending if i put != or ==

tender shard
tender shard
#

obviously

#

that's what it's for

halcyon mica
cinder tusk
tender shard
#
String suffixSimplified = suffix == null ? "" : ChatColor.translateAlternateColorCodes('&', suffix);
quaint mantle
#

?learnjava a bit, just in case, but meh idk

undone axleBOT
halcyon mica
#

The idea artifact functionality is crucial to my workflow to hot reload and debug a plugin

tender shard
#

why would using maven prevent you from doing it?

halcyon mica
#

Because I have to build, copy, copy dependencies, execute internal tools for data generation and finally start and attach the server

ancient plank
#

isn't there a spawner interface, can't you do stuff with that?

tender shard
ancient plank
#

it'd be odd if spigotmc didn't have api methods for spawners

tender shard
ancient plank
halcyon mica
#

There is more to this project than just "copy and run plugin"

tender shard
#

and intellij can do all of that but maven can't? I doubt that

tender shard
#

I probably missed it for years

ancient plank
#

this existed in 2016 from what I can see

ancient plank
#

I found a thread on it

halcyon mica
#

Maven does not seem to be able to

tender shard
#

lol

#

maven can do anything

#

it can literally run shell scripts sooo

halcyon mica
#

The please elucidate me as to how I can achieve this with maven

tender shard
#

well maybe explain what you mean with "copy dependencies and execute internal tools for data generation" then

halcyon mica
#

What is so hard to understand there?

ancient plank
#

big words hard

#

brain small

late sonnet
golden turret
#

bruh, so many deprecated methids

halcyon mica
#

It copies the provided maven dependencies as their own artifacts into the working directory and runs a variety of shell script and applications to generate data

tender shard
golden turret
#

like, the methods that use string to be entitytype in the intrrnal code

trail lintel
#

mfnalex you are a machine 😉

#

Always see you active hahah

tender shard
#

exec-maven-plugin can run any shell scripts

#
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2.1</version>
                <executions>
                    <execution>
                        <phase>deploy</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <executable>java</executable>
                    <workingDirectory>${basedir}/../</workingDirectory>
                    <arguments>
                        <argument>-jar</argument>
                        <argument>${basedir}/../PluginCompiler.jar</argument>
                        <argument>AngelChest</argument>
                    </arguments>
                </configuration>
            </plugin>
#

eg. in this case at deploy phase but ofc you can set it to install or other phases

#

you can use that to run your shell scripts

halcyon mica
#

Alright, what about attaching the debugger and executing the server executable

tender shard
#

you can of course use it to copy the files to your working dir, or use the maven resource plugin for that, one sec:

tender shard
halcyon mica
#

If I want proper integration of the profiler and hot reload, no

trail lintel
#

So I got a question for you guys. Namespaced keys can share the same name across different plugins because they are.... well namespaced right. But I think custom model data can conflict with each other. I was thinking I would just prefix all my custom model data with the ModId, thus ensuring no conflicts with other resource packs. How do you guys approach that?

wooden fable
#

Is it possible to get all the commands from a certain permission?

tender shard
tender shard
halcyon mica
#

Because jprofiler requires integration and control over the JVM creation, and to support hot reloading, you need to recompile and swap out changed bytecode on the fly

trail lintel
#

Are you sure about that? I have seen them starting with 0 but perhaps it just truncates that

halcyon mica
#

Which you cannot do without having your ide support and integrate into the run process

tender shard
tender shard
halcyon mica
#

What did you think I was talking about when saying "attach"?

tender shard
#

idk, like screen or tmux. I asked you twice about what you meant

trail lintel
#

Ahh yup you are right. Hmmm, perhaps I will encode my mod name as a binary string and use that as the "identifier"

#

I failed to consider how long a string would be lmao 8 bits per character. Perhaps I will just pick an arbitrary "id"

tender shard
#

I always use PDC strings to identify my items

#

or booleans if you just need to know whether its one of your items after all

trail lintel
#

Well I have this custom model data. At the moment its just 1, 2, 3. But if another resource pack wants to work on custom model data for the same item, they are likely using 1,2,3 as well

#

I want to use some identifiers that are likely not being used by another resource pack, causing conflicts

tender shard
#

e.g. I think ItemsAdder uses values from 1000+

trail lintel
#

Ohh thats not a bad idea, I could have the actual model data that is applied be configurable

cinder tusk
trail lintel
#

Or just start at some arbitrary value that will likely not conflict

tender shard
tender shard
trail lintel
#

I think thats what I shall do =] thanks a bunch

tender shard
#

np 🙂

tender shard
#

yeah that's why I don't get my work done

trail lintel
#

Plugin is really really coming together now. Got all the functionality I want now just adding bells and whistles to make it look good 😄

#

friends are already loving it haha

#

Gonna put it on spigot website when I'm done =]

delicate cargo
tender shard
delicate cargo
#
final NamespacedKey key = new NamespacedKey((Plugin)Main.instance, "ITEMID");
tender shard
#

Main.instance is null

delicate cargo
#

heres main:

package me.generallyblinky.realmofeternia;

import org.bukkit.command.CommandExecutor;
import org.bukkit.plugin.java.JavaPlugin;

import me.generallyblinky.realmofeternia.commands.CustomGive;
import me.generallyblinky.realmofeternia.item.ItemManager;

public class Main extends JavaPlugin {
    
    public static Main instance;
    public ItemManager itemManager;
    
    @Override
    public void onEnable() {
        Main instance = this;
        System.out.println(instance);
        itemManager = new ItemManager();
        itemManager.init();
        
        this.getCommand("customgive").setExecutor((CommandExecutor)new CustomGive());
    }
    
}
tender shard
#

you never assign "this" to the instance field

#

instead you create a local variable called instance too

delicate cargo
#

oh zamn

#

youre right

tender shard
#

🙂

delicate cargo
#

idk how th i didnt notice that

#

tysm

tender shard
#

it happens 😄

#

np

ancient plank
#

oh goodness don't show pulsebeat

#

the main class is named main

delicate cargo
#

yeah

#

cuz thats what usually gets run

#

right?

#

aaanyway i got another error

java.lang.NullPointerException: Cannot invoke "java.util.List.add(Object)" because "lore" is null
        at me.generallyblinky.realmofeternia.item.CustomItem.create(CustomItem.java:42) ~[?:?]
#

lines 41 and 42:

List<String> lore = meta.getLore();
lore.add("");
tender shard
#

you can't add something to null

#

use this

List<String> lore = meta.hasLore() ? meta.getLore() : new ArrayList<String>();
delicate cargo
#

ok

tender shard
#

you seem to be using the Adventure API but not running paper

#

oh you already removed the messages lol

terse raven
#

how do i get something like persistant storage for blocks?

tender shard
terse raven
#

thats pogchamp

#

could you send me it?

tender shard
terse raven
#

does it delete the old block data once the block is removed / replaced?

#

or do i have todo that manually

tender shard
#

you have to do that yourself

terse raven
#

okay

tender shard
#

you can just listen to BlockBreakEvent on monitor and then remove the PDC

acoustic pendant
delicate cargo
#

hey how can i hide item flags?

late sonnet
acoustic pendant
trail lintel
#

Yo mfnalex I had a look at your github you are the chest sort guy! Thats like one of my must have plugins, ur a legend

delicate cargo
#

ive seen you need to use that

#

but i dont know how

late sonnet
tender shard
acoustic pendant
#

thanks

tender shard
#

or wait

#

was that the right one?

#

let me check

acoustic pendant
#

wdym

tender shard
#

Adminer

#

that was what I meant

acoustic pendant
#

thanks

fervent gate
tender shard
ancient plank
#

does it have colors in the display name bc iirc doesn't displayname include the color symbols n whatnot

quaint mantle
#

yeah you have to strip colors if thats the case

proud basin
tender shard
#

sorry wrong reply

ancient plank
#

^

tender shard
#

it would be better to identify custom items by their PDC tag

quaint mantle
#

PDC ftw

ancient plank
tender shard
#

I like 2 and 3

#

in the first one, I think the wrong words are highlighted

ancient plank
#

2 looks weird to me since its the opposite of what I always use lol

tender shard
#

oh lol, it's vice cersa for me 😄

#

I think the "keywords" should be highlighted

quaint mantle
#

i like 1

fervent gate
ancient plank
#

?pdc

tender shard
stone sinew
#

I prefer NBTTags still 😉 String -> Object is better then Object -> object in my opinion.

tender shard
#

Object -> Object?

#

you mean the namespacedkey?

proud basin
#

so I guess 1 wins

tender shard
#

nooo

#

not 1

proud basin
#

I'm trying to find a color scheme

tender shard
#

I only see "Your ... has been Disabled" in #1

ancient plank
#

do 3 bro

#

3 is solid

tender shard
#

in two I see "Staff Mode ... Disabled"

#

and in three I actually read the whole sentence lol

ancient plank
#

actually wait yeah my brain dumb

#

2 is the one I use

proud basin
#

what

tender shard
#

HA I knew it

acoustic pendant
#

@late sonnet ehm very strange thing, i can access the db in other browser

ancient plank
#

im colorblind bro dont hate me the colors are very similar

proud basin
#

Are you color blind

#

ah

tender shard
#

why are you color blind*

#

just stop being color blind and... see all the colors correctly instead!

proud basin
#

^

ancient plank
#

I'm insensitive to hues between colors, & I can't see yellows xd

tender shard
#

imagine going to the doctor and he just tells you to be healthy

ancient plank
#

no bananas for me bro they're invisible

proud basin
#

ayo?

proud basin
#

so which option do you like adel

trail lintel
proud basin
#

1, 2 or 3

ancient plank
#

2 or 3

#

3 is cool tho

#

use 3

tender shard
#

6

stone sinew
tender shard
#

7

#

?

proud basin
#

that's a 1

sacred ice
#

its 6

stone sinew
proud basin
#

no?

fallen snow
#

Hi all, I'm a bit confused with BungeeCord events.

Is the event for when a player first joins the proxy ServerConnectEvent or ServerConnectedEvent?

quaint mantle
#

still 6

tender shard
#

why the heck is it called Block#getType but BlockData#getMaterial

quaint mantle
#

you can faintly see the outline lol

tender shard
#

why is not always getMaterial

#

?jd

acoustic pendant
# tender shard ?

in one browser i access a db but sends errors but if i open the db in other browser it doesn't ask for perms

tender shard
#

you probably need one of those instead @fallen snow

proud basin
tender shard
#

I don't think players need a message at all to tell them who sent a ton of newlines

#

but if you want to do it, I'd use dark gray so it's barely visible

proud basin
#

the text can be changed in the config obv so

tender shard
#

I'd use dark gray as default without any ------- things

ancient plank
#

people will think something broke if their chats randomly "disappear" without warning

proud basin
#

should I just remove the ---------

tender shard
#

I never understood the reason to have to clear chats anyway 😄

ancient plank
#

someone spams the hard R or smth you go brrt chat cleared

#

gg ez

tender shard
#

yeah I know but people could still read it if they wanted to^^

ancient plank
#

yeah but

proud basin
#

What if its a pg server

#

or a Christian minecraft server

ancient plank
#

that's extra effort 9/10 people don't even know how to do

tender shard
#

the whole chat should be disabled anyway, players should communicate using real life mail instead that they send to the server's address and the server then makes a phone call to all players and tell them about the message

ancient plank
#

you gotta recognize 9/10 people playing on a server with these commands don't know fuck all about minecraft outside of clicky click miney in-game survival stuff

tender shard
proud basin
#

pov Adelemphii playing minecraft in real life

ancient plank
#

corruptcarnage moment

proud basin
#

never

opal juniper
proud basin
#

ayo what?

proud basin
#

huh

rough drift
#

Kotlin warning, gonna add a java equivalent:

fun Player.setMaxHealthAttribute(value: Double) {
  getAttribute(Attribute.GENERIC_MAX_HEALTH)?.baseValue = value
}

fun doSomething(player: Player) {
  player.setMaxHealthAtribute(currValue + someOtherValue)
  player.health += someOtherValue
}
public void setMaxHealthAttribute(Player player, double value) {
  player.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(value)
}

public void doSomething(Player player) {
  setMaxHealthAtribute(player, currValue + someOtherValue)
  player.setHealth(player.getHealth() + someOtherValue)
}

The code above is throwing an error saying that the health is above the max, even when i am at one heart and max health is 10, why's that?

delicate cargo
#

java doesnt let me save when i try and use an emoji like \🌊

acoustic pendant
#

if i return something in a #EntityDamageByEntityEvent does it apply to the final damage alone or i have to do something else?

tender shard
tender shard
acoustic pendant
#

does "finalDamage" apply?

tender shard
#

no

delicate cargo
#

should i save as utf8?

tender shard
#

you have to set the damage inside your "e" object

tender shard
delicate cargo
#

alr

tender shard
#

well doesnt matter if the files dont contain any special symbols

#

but as soon as you have customizable messages people might use chinese, russian, german chars

#

so yes, utf8 goood

acoustic pendant
tender shard
#

probably, why don't you just check

#

?jd

acoustic pendant
tender shard
ancient plank
#

🤦

tender shard
#

do you use the Entity

acoustic pendant
#

oh wait

tender shard
#

I just told you to use the event itself 😄

acoustic pendant
#

i'm in 1.8

tender shard
#

hint: it's easier to use proper variable names like "event" isntead of "e"

ancient plank
#

^

tender shard
acoustic pendant
#

i prefer e

tender shard
#

and if you have an event, and an entity? do you call them e1 and e2 then?

acoustic pendant
#

like this?

tender shard
#

yes but returning something from your event handler method is totally pointless

#

the event handler doesn't check your return value anyway

acoustic pendant
#

ye

tender shard
#

it just calls it with reflection and doesn't care about what you return

acoustic pendant
#

my faylt

tender shard
#

no problem^^

acoustic pendant
#

thanks 😄

acoustic pendant
#

should it be EntityDamageByEntityEvent instead of EntityDamageEvent ?

#

wait

#

i'm dumb

ancient plank
#

Hi dumb, I'm Mom.

vale turret
#

Hey!!! I have a problem like this: I played a little on my server, after which I closed the console (my server is not on hochting), when I closed it, after 20 minutes I had to start the console, but my spigot folder was not in the java file, but in notepad file. That is, when I wanted to open the console, it was not the console that opened for me, but the code that was in this file. Please tell me how to start the console now? via start.bat does not work (I don’t know why) the text may be with errors, since I wrote it in the translator in another language

ancient plank
acoustic pendant
#

well, could anyone help me? i'm supposed to get a damage reduction but i'm not getting any

tender shard
dusty sphinx
#

is the list provided by EntityDeathEvent#getDrops mutable

tender shard
eternal oxide
dusty sphinx
#

i want to add a drop

acoustic pendant
tender shard
dusty sphinx
#

ok then what should I do if i want to add a drop

vale ember
#

anyone know why bukkit uses Reference<World> in location instead of just World?

tender shard
acoustic pendant
# tender shard show the full code please for your event handler
public void damageCalculator(EntityDamageByEntityEvent e){
        Player player = (Player) e.getEntity();
        double damage = e.getDamage();

        double calculation = plugin.data.getDefense(player.getUniqueId()) + 100;
        double damageReduction = plugin.data.getDefense(player.getUniqueId()) / calculation;


        double finalDamage = damage * calculation;
        e.setDamage(finalDamage);
    }
}```

the plugin.data is from a database
tender shard
acoustic pendant
#

oh my lord

#

i just realized

#

sorry 😭

tender shard
#

it happens lol

#

first thing to do if something doesn't work:

#

add some simply debug messages

#

System.out.println("Yaaay my code is actually being called :3 uwu gg");

acoustic pendant
#

ye 😄

#

ty

acoustic pendant
dusty sphinx
#

whats a good way to play sounds randomly

tender shard
#

yes well you literally set the damage to be damage*100

dusty sphinx
#

emulating an ambient sound

tender shard
#

I'd create a runnable and then just... randomly play sounds? ^^

dusty sphinx
#

alrighty then

tender shard
#

you probably want to use World#playSound instead of Player#playSound

#

or wait

#

it depends

#

do you want two nearby players to hear the exact same sounds?

#

or do you not care about that?

acoustic pendant
rough drift
#

i add like 1 to max health, and 1 to health

#

it still does it

tender shard
# rough drift it aint tho

add some debug statements to print out entities current health, their max health, and the new values you're trying to set

#

there MUST be an error in your code if it says that you're exceeding max health

dusty sphinx
#

does anyone know how often ambient sounds play

#

like whats the math for it

tender shard
#
Minecraft Wiki

Ambience (also called ambience sounds or ambient sounds) are sounds that can be heard in specific conditions. They were created by C418 and Samuel Åberg. Currently, there are 167 different ambience sounds.
Ambience is divided into groups of ambience sounds that play under same condition/s. Currently, there are "cave", "underwater" and "Nether" a...

#

it doesnt really say anything about "when" or "how often" :/

#

This means that if you are in complete darkness and there are no lit blocks around you, an ambient noise will play every 6000 ticks (5 minutes).

#

but tbh you should play them way more often, ambient sounds are nice

dusty sphinx
#

im talking about mob ambience

tender shard
#

oh sorry

dusty sphinx
#

nah it doesnt matter lol

tender shard
#

I thought you wanted to play some random awesome flute solo from stal every other minute lol

#

because THAT would be awesome

dusty sphinx
#

maybe

tender shard
#

I think I'll code a new plugin.

Minecraft, but you will hear stal's flute solo everytime you mine a block

dusty sphinx
#

every time i hear that recorder solo i get an instinctive urge to go break the nearest jukebox

tender shard
#

haha

#

and no thats not a rick roll

trail pilot
#

Nice im using IJ IDEA as a minecraft server xd

#

Its make my work more easy

cinder tusk
#

how do i add an iron golem spawner to a chest?

#

or a iron golem egg

wise prairie
#

Hello im trying to code a plugin with a vote sword that will try and teleport you after you right click and it doesent work. Here is the code:

@EventHandler
    public void on_use(PlayerInteractEvent event) {
        if (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR) {
            if (event.getItem() != null) {
                if (event.getItem().getItemMeta() == ItemManager.voteSword.getItemMeta()) {
                    Location loc = new Location(Bukkit.getWorld("world"), 0, 80, 2, 0, 0);
                    Player player = event.getPlayer();

                    player.teleport(loc);
                }
            }
        }
    }
vale ember
wise prairie
#

Yes

#

Like This right:

getServer().getPluginManager().registerEvents(new VoteSwordEvent(), this);
vale ember
#

why are you comparing item metas?

wise prairie
vale ember
#

!!!

#

you use == reference equality

#

you should use .equals()

wise prairie
vale ember
#

ALSO don't use snake case

#

use camelcase

wise prairie
#

I like java but Im new to spigot

vale ember
#

onUse not on_use

minor garnet
wise prairie
tender shard
#

in java it's
CamelCaseForClasses
lowerCamelCaseForMethodsAndFieldsAndLocalVariables
AND_UPPERCASE_WITH_UNDERSCORES_FOR_STATIC_FINAL_FIELDS

#

and enums because they are also just static final fields too

tender shard
minor garnet
#

nothing

tender shard
#

it looks a bit messy but other than that, it's fine I'd say

vale ember
#

why do you suppress deprecation?

wise prairie
minor garnet
tender shard
#

E.g. I'd never hard code messages unless it's admin only messages, and not use § but ChatColor instead 🙂

minor garnet
#

but I don't know how to use predicate and how could I use it

tender shard
upper niche
#

is there a way to delete all existing bossbars?
i reloaded my plugin while a custom bossbar was onscreen and now i cant get it to go away

tender shard
# minor garnet but I don't know how to use predicate and how could I use it

a Predicate takes some object as input and then returns true or false. It's mostly used for filtering, e.g. to get all creepers in "world":

Bukkit.getWorld("world").getEntities().stream().filter(new Predicate<Entity>() {
            @Override
            public boolean test(Entity entity) {
                return entity instanceof Creeper;
            }
        });
tender shard
#

or, as lamda:

Bukkit.getWorld("world").getEntities().stream().filter(entity -> entity instanceof Creeper);
upper niche
#

yeah

tender shard
#

you must keep track of your bossbars and delete them in onDisable

#

there's no way to get all existing bossbars through the API

#

you have to "remember" them yourself

minor garnet
#

i have this

    private static final Predicate<? super Entity> BULLET_PREDICATE = entity -> 
    {
        if (entity.isSilent() || entity.isInvulnerable()) { return true; }
        return entity instanceof LivingEntity && !entity.isDead();
    };```
tender shard
#

so what's exactly your question? 😛

#

you could use it for example like this:

#
private static final Predicate<? super Entity> BULLET_PREDICATE = entity ->
    {
        if (entity.isSilent() || entity.isInvulnerable()) { return true; }
        return entity instanceof LivingEntity && !entity.isDead();
    };

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

        Bukkit.getWorld("world").getEntities().stream().filter(BULLET_PREDICATE);
minor garnet
#

hmm

tender shard
tender shard
#

ooh sorry

#

I thought you were talking about the predicate code

young knoll
#

You can get a bossbar if it’s a persistent one

#

Aka you made it with a namespacedkey

tender shard
#

well first of all I would always put the return into it's own line @minor garnet

#

right now it's hard to spot when it's at the end of the line

#

and then, as said, better use ChatColor instead of § but it doesnt matter if that's just for testing rn

mortal hare
#

ok this might be embarassing, i've developed plugins since 2019-2020 but does any of you can explain to me what does Context named class have in its purpose? What does context mean for a class. Im not native english speaker so its hard for me to understand what's the behind of the concept of contexts in java classes. any examples?

#

I see Context classes passed around as like abstract form of object classes around

tender shard
#

E.g. talking about this discord chat, a Context class could hold all the previous messages

#

Spigot's conversation api is a good example to learn about contexts I think

mortal hare
#

So its like a container?

upper niche
vale ember
tender shard
golden turret
#

Map<String, Object>

tender shard
golden turret
sterile token
tender shard
#

e.g. when you have a conversation, you can use the context to store information you might use later, and then when you have a new conversation "event" you can get your previously saved data

mortal hare
#

why not pass the data directly

#

or store it

#

inside the listener class

golden turret
#

Map<String, Object>

tender shard
tender shard
golden turret
#

map.get("why-am-i-saying-this")

tender shard
tender shard
# mortal hare why not pass the data directly

imagine you have a real life conversation with a stranger. He says "Excuse me" and you listen to the StrangerTalksToMeEvent. How would you reply?
Excuse me could mean they just need to walk by and you're standing in the way. It could also mean they didnt understood what you said earlier. So you check the context - did I talk to that person before? Or is this the first sentence you exchange with him? So you can react properly according to what happened earlier

mortal hare
#

can we call Event in bukkit as context

#

it has data in it about specific circumstances

tender shard
#

every object has data in it

#

Contexts are meant to be used to pass the same data around in different "events"

tender shard
golden turret
#

a context is

#

a context

mortal hare
#

no shit

tender shard
mortal hare
#

1 = 1

#

true = true

tender shard
#

would be nice though. If you need help, people don't spam useless stuff either

golden turret
#

i just see what i want

tender shard
#

@mortal hare I have a tiny example for Contexts in Spigot's conversation API

#

but I dont know if its of much help

#

??? java

#
public class WarpLorePrompt extends ValidatingPrompt {

    @Override
    protected boolean isInputValid(@NotNull ConversationContext conversationContext, @NotNull String input) {

        Player player = (Player) conversationContext.getForWhom();

        String[] lines = input.split("\\\\n");
        List<String> lore = Arrays.stream(lines).map(s -> TextUtils.format(s, player)).collect(Collectors.toList());
        for (String line : lore) {
            if (ChatColor.stripColor(line).length() > WarpBooks.Config.getMaxLoreLength()) {
                player.sendMessage(WarpBooks.Messages.getPromptLoreTooLong());
                return false;
            }
        }
        if (lore.size() > WarpBooks.Config.getMaxLoreLines()) {
            player.sendMessage(WarpBooks.Messages.getPromptLoreTooManyLines());
            return false;
        }

        conversationContext.setSessionData("lore", lore);

        return true;
    }
#

this is so people can enter a lore in the chat for an item

#

I save that in the context, then later on ask other things

#

Once I got all information, the item will be created

#

So I have different prompts but they all belong to one item, so I can just use the conversation's context to store it during the different prompts

golden turret
#

Map<String, Object>

#

basically that

tender shard
#

in this case, kind of, yes

cinder tusk
#

how do you add items to a chest block?

tender shard
#

but it can be different in other context classes

tender shard
#

Then cast it to Container

trail pilot
#

Hello, I need an idea for a plugin BC I don't want to lose my java knowledge

tender shard
#

then you can access its inventory

#

after that you have to update the block state

#

done

cinder tusk
#

how do i place it in the world?

tender shard
tender shard
golden turret
#

shop

tender shard
#

Block#setMaterial I think

cinder tusk
#

i created another chest var and casted the chest's state to it

golden turret
#

setType

trail pilot
tender shard
cinder tusk
#

setType only sets to a general material

golden turret
#

yes

#

and after that

#

just get the block state

tender shard
#

and after that: Map<String,Object>

golden turret
#

and modify the data

cinder tusk
#
BlockState state = onBlockPlace.getBlock().getState();
                Chest chest = (Chest) state;
                int chance = new Random().nextInt(20);
                if (chance < 3) chest.getBlockInventory().addItem(new ItemStack(Material.SKELETON_SPAWN_EGG, 2));
                if (chance < 7) chest.getBlockInventory().addItem(new ItemStack(Material.ZOMBIE_SPAWN_EGG, 2));
                if (chance < 11) chest.getBlockInventory().addItem(new ItemStack(Material.SPIDER_SPAWN_EGG, 2));
                if (chance < 15) chest.getBlockInventory().addItem(new ItemStack(Material.COW_SPAWN_EGG, 2));
                if (chance < 19) chest.getBlockInventory().addItem(new ItemStack(Material.CREEPER_SPAWN_EGG, 2));
                if (chance < 20) chest.getBlockInventory().addItem(new ItemStack(Material.WITHER_SKELETON_SPAWN_EGG, 2));
                chest.update();
tender shard
#

I understand now why you kept posting it

#

lets make this a running gag

golden turret
#

i dont want anymore

tender shard
cinder tusk
#

yep

tender shard
#

it should work then I think

#

try it

cinder tusk
#
@EventHandler
    public void onBlockPlace(BlockPlaceEvent onBlockPlace) {
        if (onBlockPlace.getBlock().getX() == -625 && onBlockPlace.getBlock().getY() == 94 && onBlockPlace.getBlock().getZ() == -1430) {
            if (onBlockPlace.getBlock().getType() == Material.CHEST) {
                BlockState state = onBlockPlace.getBlock().getState();
                Chest chest = (Chest) state;
                int chance = new Random().nextInt(20);
                if (chance < 3) chest.getBlockInventory().addItem(new ItemStack(Material.SKELETON_SPAWN_EGG, 2));
                if (chance < 7) chest.getBlockInventory().addItem(new ItemStack(Material.ZOMBIE_SPAWN_EGG, 2));
                if (chance < 11) chest.getBlockInventory().addItem(new ItemStack(Material.SPIDER_SPAWN_EGG, 2));
                if (chance < 15) chest.getBlockInventory().addItem(new ItemStack(Material.COW_SPAWN_EGG, 2));
                if (chance < 19) chest.getBlockInventory().addItem(new ItemStack(Material.CREEPER_SPAWN_EGG, 2));
                if (chance < 20) chest.getBlockInventory().addItem(new ItemStack(Material.WITHER_SKELETON_SPAWN_EGG, 2));
                chest.update();
                onBlockPlace.getBlock().getState().getBlock().getState().getBlock()


            }
        }
    }

tender shard
#

the last line is useless

mortal hare
#

have you tried Map<String, Object>

golden turret
#

i dont think that it needs the update

cinder tusk
#

i know it was for fun

golden turret
#

at least i used a code do add items into a chest

tender shard
cinder tusk
#

was weird for me the amount of function chaining

golden turret
#

and didnt used update

cinder tusk
#

i like chaining but that was overwhelming

ancient plank
#

fallthrough

tender shard
ancient plank
#

^

young knoll
#

Yeah don’t call .update

cinder tusk
#

oh wait oops

tender shard
cinder tusk
#

was supposed to write it opposite

tender shard
#

otherwise the chest won't get the items

cinder tusk
#

and needed else ifs

tender shard
young knoll
#

Update will clear the items

#

Don’t ask

tender shard
#

it will not

young knoll
#

Spigot be weird

golden turret
tender shard
#

I will check it to be sure, I don't want to give false information

sterile token
tender shard
#

Checking this now:

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

        Player player = (Player) sender;
        Block block = player.getTargetBlockExact(100);
        Container chest = (Container) block.getState();

        chest.getInventory().addItem(new ItemStack(Material.DIAMOND));
        chest.update();
        return true;
    }

If I'm not mistaken, this should add a diamond to the chest the player is looking at when using the command

mortal hare
#

so basically Context class is a Class responsible for holding data about current object's situation

tender shard
#

yes

golden turret
#

yes

tender shard
#

well

golden turret
#

with a Map<String, Object>

tender shard
#

yes

tender shard
#

it can be something different too

#

e.g. the conversation api context class also has other fields like forWhom

golden turret
#

List<Map<String, List<Map<String, Object>>>

ancient plank
#

forWhomstved

tender shard
#

for_THE_DUDE

#

they peed on my carpet

#

best movie

tender shard
#

so @cinder tusk do NOT use .update() after adding the items

rancid flume
#

Hey unrelated question, why does /experience query report that I have 0 experience points despite having 30 levels

little trail
#

for coloured kick messages, would i just use org.bukkit.ChatColor

young knoll
#

Levels and points are different

tender shard
#

points is only the points in your current level

#

if you need the total XP points: I have a method for that

#

let me find it

ivory sleet
#

Experience points are just the amount of points you have in regards to your level.

rancid flume
#

But you can 30 levels worth of points to achieve level 30

#

Its not looking at points/level right?

ivory sleet
#

It’s a bit counter intuitive but it’s probably to avoid absurdly big numbers

golden turret
tender shard
golden turret
#

you choose

#

i use § because it is simple

tender shard
#

so to get total XP: get current XP and add getTotalXPRequiredForLevel(currentLevel)

little trail
#

yes i know, ive used it before, was just seeing if its the same enum

golden turret
#

the bungee one supports hex

young knoll
#

Not true

rancid flume
tender shard
young knoll
tender shard
golden turret
#

ik

tender shard
young knoll
#

TL;DR pretty much always use the bungee one

tender shard
rancid flume
tender shard
#

yeah 😄 I just did the math that was explained in the MC wiki, should be working fine - at least no one complained to me yet lol

rancid flume
#

tyy

golden turret
#

player.getExp() ?

tender shard
rancid flume
#

Only shows the exp for that level ;\

tender shard
#

^

golden turret
#

a

rancid flume
#

and a percentage of the bar at that

tender shard
#

yes, kinda confusing

#

If I knew how to fork spigot and do PRs, I'd do so

#

but

#

I don't know how

#

lol

ivory sleet
#

I mean

tender shard
#

what do you mean

#

are you mean?

#

yes Conclure is mean

ivory sleet
#

?

tender shard
#

nothing, I'm just bored

#

people must ask more spigot dev questions

ivory sleet
#

lol

#

found it

young knoll
#

How make plugin

tender shard
#

otherwise I have to work on my update

ivory sleet
#

Here (:

#

Believe that could be of help

tender shard
ivory sleet
#

In case you want to contribute 12434b1bf8604b228598a41d3936d2cd

tender shard
#

I definitely want to

#

I should give it a try

ivory sleet
#

Not that I have contributed yet but yeah 😊

young knoll
#

Booo

tender shard
mortal hare
#

i still dont get it why in conversation API ConversationContext is passed in prompt and not just raw Conversation instance

#

is it for encapsulation

ivory sleet
#

Probably lol

tender shard
#

how should that work? the prompt doesn't have any access to the Conversation itself

ancient plank
#

I've contributed

#

I fixed a typo in the contribution readme

tender shard
#

haha

#

gj

#

that's how my wikipedia contirubtions work

#

I have more than 1000 edits on wikipedia but its always just typos, missing commas or updating links lol

ivory sleet
#

Anyways dovidas looks like it has with event/callback design to do

young knoll
#

Every bit counts I suppose

mortal hare
#

it doesnt because its an interface

#

it could easily support having the raw Conversation object in its implementation

tender shard
#

if you really wonder why, ask md_5 why it's done this way

mortal hare
tender shard
#

he will know it for sure

ivory sleet
tender shard
#

or he'll say "idk I was sooo drunk that day that I decided to just invent a context thingy". but probably he had a reason

#

oh btw @golden turret

young knoll
#

Assuming he even made it

tender shard
#

it's a Map<Object,Object> 😛

#

not String,Object