#help-development

1 messages Β· Page 179 of 1

warm token
#

Oh wait I confused with the .setAttributeModifiers

#

btw what is the meaning in the parameters in the constructor in the AttributeModifiers class

fluid river
#

maybe i'm dumb but MultiMap is not in java core

#

I can see it's implemented in Google guava

wraith flame
#

Would anyone know how to create a plugin that would allow a player placed sculk shrieker to be replaced or have it's state changed so it can spawn the warden?

fluid river
#

setCancelled(true);

#

spawn warden at location

wraith flame
round finch
#

BlockFromToEvent?

fluid river
#

free spigot lessons too

round finch
#

spigot doc is very helpfull

fluid river
#

true

eternal oxide
#

?jd-s

undone axleBOT
round finch
#

and java doc

#

if you bother to read or can πŸ˜‚

fluid river
#

?learnjava

undone axleBOT
warm token
warm token
round finch
flint coyote
warm token
round finch
#

easy way to get attribute

echo basalt
tardy delta
#

Smh school at 2pm for 2 hours and im home at 5:30pm

fluid river
#

i just found a new student

#

and you blocked me

zealous osprey
#

two lessons today, one at 8:05 and the other at 11:25.
Schoolhours today: 1 hour 30 mins.
Home at 13:20... I was at school for 5+ hours for basically nothing

round finch
#

haha

fluid river
#

bro

#

i have philosophy at 10:40

#

and programming at 18:00

#

in different buildings

#

of my university

#

basically 3 metro stations distance

#

that's the cringe

#

some real dogshit

zealous osprey
#

3?!

fluid river
#

?

#

6 hours i just do nothing

#

from 12:10 to 18:00

#

eating at KFC

#

walking

#

sitting in my laptop

glad prawn
#

Sleep

fluid river
#

yeah sometimes

stuck galleon
#

Hi. I'm a bit stuck trying to set a custom zombie mob to break doors. I'm trying to use Zombie#setCanBreakDoors()

Zombie newZombie = (Zombie) e.getEntity().getLocation().getWorld().spawnEntity(mobLoc, EntityType.ZOMBIE);

newZombie.setCanBreakDoors(true);

But I get this error: The method setCanBreakDoors(boolean) is undefined for the type Zombie

What am I doing wrong? (I'm using Maven dependency to use the Spigot API 1.19.2-R0.1-SNAPSHOT)

opal juniper
#

I PR'd this method not too long ago. What version is our server

#

or... is this an IDE error?

fluid river
stuck galleon
#

My server is 1.19.2. It is an IDE error though

opal juniper
#

show your pom please

fluid river
echo basalt
#

got a meeting at 9 and wanted to hit the gym but gotta work

stuck galleon
#

I think so. I can use all of the other Zombie# methods

My IDE auto suggests every method in the class except setCanBreakDoors

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>MyPlugin</groupId>
  <artifactId>MyPlugin</artifactId>
  <version>2.4.3-SNAPSHOT-51</version>
  <build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
        <configuration>
          <release>11</release>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <repositories>
       <repository>
         <id>spigot-repo</id>
         <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
       </repository>
   </repositories>
  <dependencies>
       <dependency>
           <groupId>org.spigotmc</groupId>
           <artifactId>spigot-api</artifactId>
           <version>1.19.2-R0.1-SNAPSHOT</version><!--change this value depending on the version or use LATEST-->
           <type>jar</type>
           <scope>provided</scope>
       </dependency>
   </dependencies>
</project>
echo basalt
#

it could be a paper think

opal juniper
#

its not

#

i added it

fluid river
echo basalt
#

Yeah it's a paper thing on 1.18

opal juniper
fluid river
opal juniper
#

I added it to spigot

fluid river
fluid river
#

reinstalling dependency

stuck galleon
#

No luck with either :/

fluid river
#

then use CraftEntity#getHandle()

#

and work around it

sterile token
#

Some time maven from intellij get really annoying

stuck galleon
sterile token
#

I once had a problem that dependencies only were working for multi module Project

fluid river
#

No errors with eclipse

#

πŸ’©

#

its's so funny that intellij had Minecraft preset

#

which like nobody used

#

from my friends who prefer IDEA

lost matrix
#

There is nothing which could be registered anywhere in this code

#

No this will do nothing on its own

#

What are you trying to achieve?

#

When?

#

When do you want to change the tablist and for whom?

golden turret
#

guys

#

is there any interface in the default java library like this?

lost matrix
#

Without type constraints this class is completely useless

#

Its just a Function<ItemMeta, T> and has no real purpose

#

Show us how you apply the tablist changes

tardy delta
lost matrix
#

This does nothing on its own. You just defined a method which could set the header/footer of one Player at some point.
Where do you use this method?

round finch
# warm token πŸ₯²
ItemStack item = new ItemStack(Material.STICK,1);


ItemMeta Meta = item.getItemMeta();

AttributeModifier modifer = new AttributeModifier(UUID.randomUUID(), "generic.attack_damage", 10.0, Operation.ADD_NUMBER,EquipmentSlot.HAND /** Slot */);

Meta.addAttributeModifier(Attribute.GENERIC_ATTACK_DAMAGE, modifer);
item.setItemMeta(Meta);

p.getInventory().setItem(EquipmentSlot.HAND /** Slot */ , item);

#

you can change some stuff around

tardy delta
#

day 3 of i dont know what im doing

#

ill probably have to use reflections/ annotations vs my Map<Class<?>, ContextAdapter> now

lost matrix
#

Listen to the PlayerJoinEvent and set the tablist when a player joins

round finch
#

i'm Lagging rn

lost matrix
tardy delta
#

im basically trying to create a pojo mapper for sql if you didnt know already

#

so i need a way to set each field of an object to a preparedstatement

#

and not even each column might be included in the insert query πŸ’€

lost matrix
#

Ah i see. Then make sure you provide all the default adapters (for primitives, Strings, Lists etc)
and create a single ReflectiveContextAdapter which is used for classes without any context adapters registered

#

?learnjava

undone axleBOT
tardy delta
#

which then has a way to map each field to a db column? cuz they might not want to insert every column so calling ps::setWhatever wont work if its not in the query

round finch
lost matrix
#

Player player = e.getPlayer()
is missing

lost matrix
#

Hibernate is the most common one

tardy delta
#

it gets mapped to annotations iirc

#

might wanna use those too

lost matrix
#

Yeah there are quite a few important annotations because you need to define
the model at a meta layer

#

Otherwise you would need one table for each (non-primitive) class

#

And each entity always needs an id anyways

round finch
#

brain error moments, i feel ya!
it happens sometimes

tardy delta
#

so ye, i'd want to use @Table("...") and @Id already

sterile token
#

Smile you are answering to fourten righ?

lost matrix
#

So for example a players data could look like this:
| playerId | name | exp | idOfLevelContainer | idOfminigameStats | ...

sterile token
#

Fourteen are you asigning each model values vΓ­a reflections!

#

?? **

tardy delta
#

not yet

#

smth like this ig

#

wondering why it needs both entity and table annotation

round finch
#

what MultiMap?

prisma needle
#

Any reason not to extend CraftPlayer?

tardy delta
#

Map<K, List<V>> wrapper iirc?

round finch
#

just map`?

tardy delta
whole olive
#

anyone help me here ping me when u can

#

with plots plugin

tardy delta
undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

whole olive
#

yeah so

#

with plots plugin

fluid river
#

?jearnlava

whole olive
#

can u help?
@tardy delta

#

ti need help with your plots plign

fluid river
#

if you need help with plots plugin

whole olive
#

b urh

fluid river
#

go there

chrome beacon
#

With?

lost matrix
#

\n

ocean ginkgo
#

How might I call an event when player clicks? I cant seem to find right or left click

river oracle
#

InventoryClickEvent

#

PlayerInteractEvent

ocean ginkgo
#

thanks :)

tardy delta
#

i guess this will work to annotating a class

river oracle
#

Table

tardy delta
#

wdym what table

river oracle
#

Dummy

#

Oh it's for sql

tardy delta
#

y

river oracle
#

I see

#

I wanna learn how to manipulate bytecode ima do that when I get home

grim ice
#

i wana learn how to manipulate bitches

#

ima do that when i get home

river oracle
#

πŸ’€

tardy delta
#

didnt you forget to learn how to get bitches

river oracle
#

I did lol first mistake was starting to code second mistake was watching anime third mistake was quitting all the sports I was in

tardy delta
#

saw a few special thing today

#

also extends @shrewd sphinxtation Clazz

#

bruh

#

@Annotation

shrewd sphinx
#

you dare

tardy delta
waxen plinth
#

Yeah you can put annotations in all sorts of nonsense places

tardy delta
waxen plinth
#

public @NotNull Map<@NotNull String, @NotNull List<@NotNull Integer>> doSomething(@NotNull String param1, @NotNull int param2) {

tardy delta
#

there must be people that code like that

waxen plinth
#

I just don't bother with nullability annotations at all

tardy delta
#

@NotNull CompletableFuture<@NotNull byte @NotNull []>

waxen plinth
#

I try to return null only for lookups where you'd expect to get null if nothing is found

#

Otherwise values are always non-null

#

And nullability will always be documented

tardy delta
#

yep

zealous osprey
tardy delta
#

speaking of really empty

zealous osprey
#

ye, some shit like that

#

Though I normally only use custom annotations with ClassGraph, so they often look like that

tardy delta
#

first time im actually using reflections lol

sterile token
#

Maybe is not the correct channel but please recommend me a good tutorial for installing Bitvise SSH Sever but using Linux

#

I have looked 3/4 part of google and i couldnt find a tutorial

echo basalt
#

what distro?

#

you do realize bitvise is a Windows-only ssh server right?

sterile token
#

Oh

#

Shit that why

#

🀣 🀣 🀣

#

So i dont really know what im using on my Linux

echo basalt
#

OpenSSH

#

probably

sterile token
#

Yes maybe

warm token
tardy delta
zealous osprey
sterile token
#

I mean the docs contain all the Atributes

prime reef
#

been thinking recently about uh

sterile token
sterile token
prime reef
#

Basically, y'all know when a server crashes, people can lose items/etc. for whatever reason?

#

Placed an expensive deco block, moved something valuable into/out of a chest, etc.

#

first off, there a plugin out there that compensates for this already? i'm not looking to reinvent the wheel here.

#

basically, vanilla data protection lmao

#

easier to protect plugin-specific data since the dev's in control of that one

sterile token
#

I mean

prime reef
#

this is a programming question

sterile token
#

I dont know why lot of people use wrong the channel cuz they have a big description

prime reef
#

it'll become one if no plugin exists lmao

willow widget
#

Hey, how can I get a Player's armor? c:

sterile token
#

Or go a fast google research

prime reef
willow widget
prime reef
#

but yeah honestly

willow widget
#

or maybe I'm just not working with the armor's name properly (?) idk

prime reef
#

googling "spigot get player armor" would probably tell you

sterile token
#

I mean i first look what i need for 10-15m if not i ask it on Spigot channels

willow widget
prime reef
#

if you're new, docs probably won't help as much as google.

warm token
#

but they still doesn't work

prime reef
#

docs are great for people who know the ropes already and understand how to navigate the docs

warm token
#

generic.armor

willow widget
#

anyways, the thing is that it keeps looking like the armor's displayname/localizedname is null idk why

prime reef
#

what are you doing

#

like, what's the use case, what's the code, etc.

chrome beacon
willow widget
prime reef
willow widget
#
(item.getItemMeta().hasDisplayName() ? item.getItemMeta().getDisplayName() :
                    (item.getItemMeta().hasLocalizedName() ? item.getItemMeta().getLocalizedName() : "some item")
#

It is always saying "some item"

prime reef
#

yeah you need to specify a localization iirc

willow widget
prime reef
#

I write all my plugins entirely in English so I've never run into this issue

sterile token
#

Also ?notworking

#

?notworking

undone axleBOT
#

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

prime reef
#

it's just string manipulation at htis point

#

you can get the material name

willow widget
#

true

#

forgot about that lol

#

ty

crimson merlin
#

Hello I want to place a torch on a wall but I can’t find out how. (api-version: 1.19)

private static void setTorch(Location pos){ Material torch = Material.TORCH; torch.setFacingDirection(BlockFace.EAST); pos.getBlock().setType(torch); }

chrome beacon
prime reef
#

if you don't know how to convert WOODEN_HOE into "Wooden Hoe" then I would suggest a Java crash course :p

crimson merlin
#

yes Intellij

prime reef
#

hang on, let me pull mine up, because that looks real wrong

#

you skipped a step here

#

intellij should be throwing an error

willow widget
#

so I don't mind raw Material names

#

thanks for the advice tho c:

prime reef
willow widget
prime reef
#

if you need a debug tool, you need a debug tool

sterile token
#

Everything you code MUST be on english not matter if personal or public

prime reef
#

i literally work on debug tools at my actual job

prime reef
#

are you joking πŸ€”

sterile token
#

No

prime reef
#

squints

willow widget
prime reef
#

^

glad prawn
#

🀣

sterile token
#

I have worked for a sever which i have asked $40 extra because their full code was in Spanish

prime reef
#

i'm pretty sure you got underpaid on that one

#

that's literally less than what i make in an hour

willow widget
#

lmao

prime reef
#

but servers don't pay devs properly at all

willow widget
prime reef
#

never have

sterile token
#

Shut up

willow widget
prime reef
#

idk I'm from the US and a certain server owner threw a fit over a bill that came out to $5 an hour, then refused to pay another dev

willow widget
prime reef
#

as long as they're not demanding shit from you, you're doing them a favor at this point lmao

#

reasonable requests? great

"do this or you're fired"? bruh i got no stake in this place

willow widget
#

pretty much

#

but i'm kinda co-owner so I don't mind that either c:

sterile token
#

I mean the problem there was that i need to add some things for a survival core which was like 40% done i ask then for $80 and then when i realize its was really harcoded and have variable names, methods, getters/setters on spanish, etc i charged then around $60-70 more

#

And i was working for Latam guy

prime reef
#

hmm

#

adventure's text component API seems like Spigot just

#

directly yoinked it for the most part

#

weir

chrome beacon
#

Not really

ivory sleet
#

No its not

sterile token
ivory sleet
#

Hi

sterile token
#

I really miss you

prime reef
#

i mean i wouldn't complain if it had, it's a nice api

#

lmao

warm token
#

[20:01:02 INFO]: 3.0 [20:01:02 INFO]: 3.0
With Armor
[20:00:47 INFO]: 4.787233829498291 [20:00:47 INFO]: 3.07605242729187

sterile token
#

What happened with you?

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

prime reef
#

but I'm literally just glancing at it

warm token
#

it seems like the attribute dobules the damage

prime reef
#

idk I don't really use spigot APIs that often unless it's protocollib

chrome beacon
#

Adventure comes bundled with Paper

willow widget
prime reef
#

ah alright

#

that clarifies things, thanks

#

figured I was missing a piece here

#

I basically only work with Spigot for compatibility reasons so I'm generally OOTL on forks/etc.

sterile token
#

Not the aproapiate discord but: I need to get the player locale from Paper

#

Im doing it via reflections because i need to work on Spigot and Paper

chrome beacon
#

Why reflection ;/

ivory sleet
sterile token
chrome beacon
#

It's a Spigot method no need for reflection

sterile token
chrome beacon
#

?

sterile token
#

I mean the spigot impl is already done

#

?paste

undone axleBOT
sterile token
#

Dont spam the chat bruh

warm token
#

ok

ivory sleet
#

Its just pastebin

sterile token
# grim ice wow

Na i was really mad with the them the full facked plugin was coded in spanish

grim ice
#

i mean arent u spanish as well

sterile token
#

I mean i have done this:

public interface Locale {

 String getLang(Player player) throws Exception;

}

sterile token
chrome beacon
sterile token
sterile token
#

And he told me that not work on paper

chrome beacon
#

Test it for yourself

sterile token
chrome beacon
#

If it doesn't work report it as a bug

sterile token
#

Na bruh

grim ice
#

because that's the language it's made in

sterile token
#

I ownt even give food to eat to that shity community

grim ice
#

there is no sign of valid java in that file

sterile token
#

They sucks my dig

#

Really inactive comm shity support

grim ice
#

most C languages look the same

#

you need some hard evidence to differentiate

fickle mist
#

Why my plugin crash server?



import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityToggleSwimEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerToggleFlightEvent;
import org.bukkit.event.player.PlayerToggleSprintEvent;
import org.bukkit.plugin.java.JavaPlugin;

public class Stamina extends JavaPlugin implements Listener {

    public static Stamina plugin;
    FileConfiguration config = this.getConfig();
    int stam;
    int wasterun = config.getInt("waste-of-stamina-run");
    int wasteswim = config.getInt("waste-of-stamina-swim");
    int wastefly = config.getInt("waste-of-stamina-fly");
    int wastewalk = config.getInt("waste-of-stamina-walk");
    int efslow = config.getInt("when-effect-slow");
    int regen = config.getInt("regen-of-stamina");
    int maxstam = config.getInt("max-stamina");
    int sum;

    @Override
    public void onEnable() {
        plugin = this;
        Bukkit.getPluginManager().registerEvents(this, this);
        this.getConfig().options().copyDefaults(true);
        this.saveDefaultConfig();
    }

    public void EfSlow(Player p) {
        if (stam <= efslow) {
            p.setWalkSpeed(0.1f);
            p.setFlySpeed(0.05f);
        } else {
            p.setWalkSpeed(0.2f);
            p.setFlySpeed(0.1f);
        }
    }

    @EventHandler
    public void onJoin(PlayerJoinEvent e) {
        Player p = e.getPlayer();
        sum = maxstam;
        int pon = 1;
        while (pon == 1) {
            p.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent("Stamina: " + sum + " / " + maxstam));
        }
    }


    @EventHandler
    public void onRun(PlayerToggleSprintEvent e) {
        Player p = e.getPlayer();
        if (p.isSprinting() && !p.getGameMode().equals(GameMode.CREATIVE)) {
            sum = maxstam - wasterun;
        }
    }

    @EventHandler
    public void onSwim(EntityToggleSwimEvent e) {
        if (e.getEntity() instanceof Player) {
            Player p = (Player) e.getEntity();

            if (p.isSwimming() && !p.getGameMode().equals(GameMode.CREATIVE)) {
                sum = maxstam - wasteswim;
            }
        }
    }
    @EventHandler
    public void onMove(PlayerMoveEvent e) {
        sum = stam;
        Player p = e.getPlayer();
        Location from = e.getFrom();
        Location to = e.getTo() ;
        if (from.getX() > 0 && from.getZ() > 0) {
            sum = maxstam - wastewalk;
        } else if (from.getX() == 0 && from.getZ() == 0) {
            sum = stam + regen;
        }
    }

    @EventHandler
    public void onFly(PlayerToggleFlightEvent e) {
        Player p = e.getPlayer();
        if (p.isFlying() && !p.getGameMode().equals(GameMode.CREATIVE)) {
            sum = maxstam - wastefly;
        }
    }
    @Override
    public void onDisable() {
        saveConfig();
    }
}```
undone axleBOT
sterile token
#

?paste

undone axleBOT
undone axleBOT
grim ice
#

oh god

#

that breaks so many oop principles

sterile token
#

lmao

#

that type of people

#

Should be banned

chrome beacon
#

Infinite while loops :kekw:

grim ice
#

nah not really

sterile token
chrome beacon
#

Looks like a Roblox Lua dev

grim ice
#

kekw

tardy delta
#

man never heard about access modifiers

chrome beacon
#
    int pon = 1;
    while (pon == 1) {
        p.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent("Stamina: " + sum + " / " + maxstam));
    }
grim ice
#

but yes, it's very identical to how a '_G' keyword 0 brain cell idiot would code in Lua

tardy delta
#

also while loop crashes it

#

?scheduling

undone axleBOT
tardy delta
#

scheduler api smh

sterile token
#

I wouldnt tell him to code plugins

#

I would tell learn JAVA

#

HAHAHA

tardy delta
#

people instantiating bukkitrunnables for no reason πŸ’€

sterile token
#

You never answered me

#

Sorry for pinging

#

How do you assign values from dbs to models without using reflections?

tardy delta
#

by using the jdbc api ig?

#

where context

sterile token
#

I mean

#

context

#

i dont understand

#

You always mention context, context

#

You need to talk with a context!!

#

🀣

grim ice
#

honestly im scrolling thru forums rn

#

and why are people associating "async" with performance

chrome beacon
#

"async" has become a magic word that means performance in the Spigot community

grim ice
#

lmao

#

i really want an official term for workload distributing

chrome beacon
#

So many unsafe forks makes everything async without caring about safety

grim ice
#

would be cool

#

"workload distribution" isnt used as much

ivory sleet
#

Memory fences neither :<

tardy delta
#

i mean async faster /j

#

also hello conclure

grim ice
#

conclure i just remembered some really unfunny and mean thing but

#

it might be funny

sterile token
#

I havent seen you in a long term

grim ice
#

do you remember the times where people called you "cocklure"

sterile token
#

Also my condolences

grim ice
#

that was like a year ago? idk

sterile token
#

I really know what you happening thru

ivory sleet
#

Oh god

grim ice
#

lol

sterile token
ivory sleet
#

Me?

grim ice
#

he was replying to me verano

ivory sleet
#

I started playing some games

sterile token
sterile token
grim ice
#

also what happened to conclure

ivory sleet
#

I started playing games

grim ice
#

wdym condolences

ivory sleet
#

And got forced to watch one piece

grim ice
#

i dont think u offer condolences to somebody whos having fun watching anime and playing games lol

warm token
ivory sleet
#

But ye verano dont worry :)

grim ice
#

im bored god

#

also conclure i kinda wanna start watching one piece

#

but it kinda ticks me off how the characters barely have any personality

sterile token
grim ice
#

like i wouldnt care if any of them died

sterile token
#

I remember all the talks wehave and we i really need someone you were with me

#

I also started to play PUG mobile on BlueStacks

chrome beacon
#

Why though

grim ice
#

i think you mean pubg

chrome beacon
#

PUBGBG

#

Best name*

grim ice
#

worst game

#

its not pubgbg tho

#

PlayerUnknown's Battlegrounds

chrome beacon
grim ice
#

only one "battlegrounds"

#

PUBG: BATTLEGROUNDS

#

OH

chrome beacon
#

Yeah :p

grim ice
#

yeah

#

Brendan sucks at naming wtf

#

just repeat the last word in ur title after a colon and boom

#

free name

chrome beacon
#

I'd rather play Apex

#

I'll hit 1000 hours tomorrow

#

At 998 now

grim ice
#

how did u do it?

#

im doubting thats the reason it dropped 400mb lmao

#

thats 400 million bytes

chrome beacon
#

You must have messed up real bad for it to take 400mb

grim ice
#

thats a normal way

chrome beacon
#

That's not going to take much memory

grim ice
#

thats a perfectly okay way to do it

#

lmao

#

it's called dependency injection

chrome beacon
#

no no

#

Go back

grim ice
#

it doesnt matter

#

olivo no

#

theyre both equally as good

chrome beacon
#

One is a better practice

grim ice
#

Nope

#

Olivo ive been digging this subject for ages

#

both of them are equally as good

chrome beacon
#

I'm not about to have this argument again

#

leaves

grim ice
#

especially in this example

#

bukkit plugins main classes are always singletons

#

by completing the singleton pattern, ur doing nothing wrong

chrome beacon
#

?di

undone axleBOT
grim ice
#

i think they use that shit to hire people or something

#

lmao

#

its an invite only challenge

echo basalt
#

that's an invite only challenge yeah

grim ice
#

The world’s search engine monster analyzes your search history to provide you access to an invite-only challenge called β€œThe Google Foobar” challenge. And if you’ve received one, many congratulations; you should have realized that this isn’t just any invitation; it’s one that Google issues to a select group of developers.

#

if you finish all of the questions successfully

#

you might get contacted by a google employee

#

for an interview

#

bro just got an invite from the world's biggest tech company

#

go do it

#

u never know what u wanna do in the future

#

πŸ’€

eternal oxide
#

If you actually get hired you can be set for life

grim ice
#

yeah

tardy delta
#

πŸ’€

eternal oxide
#

A friend I taught to code a few years back now works for Google.

chrome beacon
#

Keep going, you'll at least learn something

grim ice
#

eh

#

they probably review ur answers even if u asnwered correctly

#

so no

#

but god damn

#

that makes me sorta angry

#

i wish they sent u that like

#

4 years in the future

#

when ur an adult

#

i did

#

i did for years

chrome beacon
#

I've searched at lot for years as well

grim ice
#

never got soemthing like that

chrome beacon
#

^^

#

Random probably

grim ice
#

they review it, as they say

#

but definitely random

chrome beacon
#

They are both common programming languages

grim ice
#

because they want java developers

#

google uses java a lot

#

unlike python tho

#

they do use it, but not as much as java

#

as ive heard

mental moon
#

I found the vanilla values for food and their hunger and saturation values, but it's all obfuscated. Is there any way to get this through the API, like through the Material?
I either need this data or a way to shorten the eating animation time.
Making a feature where you can eat food quickly if you're wearing a pig's head.

chrome beacon
#

You can unobfuscate it with mappings

mental moon
#

Would that make my code version specific then?

chrome beacon
#

Yes

mental moon
#

Damn. Alright, I'll look into that

trim lake
#

Im taking data from .yaml file. Why just data stay in variabel even after restart of whole server? Data in .yaml and data in variabel are difrent. Just data get from variable should be same as data in .yaml file.
.yaml

fertilizer:
  basic:
    material: COCOA_BEANS

Code:

public static ConfigurationSection yamlFertilizersSection;
public static Set<String> yamlFertilizers;
yamlFertilizersSection = this.getConfig().getConfigurationSection("fertilizer");
        yamlFertilizers = yamlFertilizersSection.getKeys(false);


for (String fertilizers : Main.yamlFertilizers ) {
            player.sendMessage("CustomModelData: " + Main.yamlFertilizersSection.getInt(fertilizers + ".customModelData"));
            player.sendMessage("YAML CustomModelData: " + Main.inst.getConfig().getInt(fertilizers + ".customModelData"));
        }

Output:

sterile token
#

Weird it doesnt display the domain info

#

I mean with youtube does it

#
tardy delta
#

fail

glass mauve
#

is it fine to use a different Logger instead of JavaPlugin#getLogger()?

chrome beacon
#

You can use what you want but it's recommended to use the plugin logger

glass mauve
tardy delta
#

guess not

glass mauve
#

ok ty

humble tulip
#

Thread pictures still not showing ?

buoyant viper
#

ok nvm its the ssl

tardy delta
#

ah sad

#

me trying to abuse the system

ivory sleet
tardy delta
#

this whole evening was like creating code and then realizing i dont need it

ivory sleet
#

oh yeah

#

thats relatable

tardy delta
#

love those days

delicate badger
#

Can someone help me with this error? One error also comes when disabling.

[23:12:31 ERROR]: Error occurred while enabling EssentialsCore v1.1.2
java.lang.NoClassDefFoundError: ml/kumina/Core
        at me.kumina.Main.onEnable(Main.java:13) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[patched_1.8.8.jar:git-PandaSpigot-52]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:332) ~[patched_1.8.8.jar:git-PandaSpigot-52]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:445) ~[patched_1.8.8.jar:git-PandaSpigot-52]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:359) ~[patched_1.8.8.jar:git-PandaSpigot-52]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:318) ~[patched_1.8.8.jar:git-PandaSpigot-52]
        at net.minecraft.server.v1_8_R3.MinecraftServer.s(MinecraftServer.java:439) ~[patched_1.8.8.jar:git-PandaSpigot-52]
        at net.minecraft.server.v1_8_R3.MinecraftServer.k(MinecraftServer.java:403) ~[patched_1.8.8.jar:git-PandaSpigot-52]
        at net.minecraft.server.v1_8_R3.MinecraftServer.a(MinecraftServer.java:358) ~[patched_1.8.8.jar:git-PandaSpigot-52]
        at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:301) ~[patched_1.8.8.jar:git-PandaSpigot-52]
        at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:603) ~[patched_1.8.8.jar:git-PandaSpigot-52]
        at net.minecraft.server.v1_8_R3.MinecraftServer.lambda$spin$0(MinecraftServer.java:133) ~[patched_1.8.8.jar:git-PandaSpigot-52]
        at java.lang.Thread.run(Thread.java:829) [?:?]
Caused by: java.lang.ClassNotFoundException: ml.kumina.Core
        at java.net.URLClassLoader.findClass(URLClassLoader.java:476) ~[?:?]
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:102) ~[patched_1.8.8.jar:git-PandaSpigot-52]
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:87) ~[patched_1.8.8.jar:git-PandaSpigot-52]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:589) ~[?:?]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:522) ~[?:?]
        ... 13 more
#

How

vagrant stratus
#

They're most likely just not providing the correct class within the plugin.yml

fluid river
undone axleBOT
vagrant stratus
#

now back to screwing w/ mob spawners lmao

delicate badger
#

It is

fluid river
#

depends on main class name tho

#

what is the name of your class which extends javaplugin

tardy delta
#

it gets called so ig they are using a core api which isnt shaded: me.kumina.Main.onEnable

delicate badger
#

Main

fluid river
#

what's it folder

delicate badger
#

spigot which gives access to 1.8 version and using java 11

fluid river
#

?

#

show your Main class path

#

bro

delicate badger
#

it's me.kumina.Main

fluid river
#

should be smth like: main: me.kumina.projectName.Main

#

then why is server seacrhing /Core folder

#

you messed up class path in yml

#

or in ide

delicate badger
#

Cause I use own API

#

Which is correctly dependenced

tardy delta
#

their Main.onEnable gets called and i believe the error message would say that the main class couldnt be founded otherwise, so isnt the issue that they didnt shade their api cuz ml/kumina/Core or whatever couldnt be found?

#

idk its late im just saying smth

delicate badger
#

Does the api need plugin.yml btw

tardy delta
#

if its a separate plugin it does

#

if its a standalone api you need to shade it

delicate badger
#

It's like a plugin, but used as an api

tardy delta
#

then it needs its own plugin.yml and make sure to depend on that api then

#

by adding depend: name-of-plugin or soft-depend whatever

delicate badger
#

and do I then need to add the api and the plugin to the server or just the plugin

tardy delta
#

both

delicate badger
#

Okay

midnight shore
#

Hi. Does anyone know why from about 3 minutes i can't compile my plugin because it says that every class doesn't exist while actually it does. Please

chrome beacon
#

Make sure that package exists

midnight shore
#

yeah everything does

#

its like they entered a ghost mode

quaint mantle
#

there is probably an invalid package name at the top of a java file

#

where it specifies the package

midnight shore
#

no no

#

its all the classes

#

while intellij gives me absolutely no error

#

when i try to compile

#

it makes errors out of nothing

tranquil viper
#

Is there an event (or way to know) when the server is reloaded?

#

Using the /rl command ^

#

Doesn't onDisable() get called when the server restarts though?

#

hm ok

#

I just wanted to make a way to notify players when the plugin is reloaded and that they need to restart the server for things to work properly, sort of how essentials does it. Thanks.

tardy delta
tranquil viper
#

Oh awesome that sounds like a good solution!

#

Thank you :)

rigid loom
#
java.lang.IllegalArgumentException: Plugin already initialized!```
#

what causes that?

young knoll
#

Are you doing new MyMainClass()

rigid loom
#

nope

#

the reason i had it is because i was DIing for stuff

rigid loom
#

it might not actually be the di. im kinda guessing

young knoll
#

Afaik the only thing that causes that is trying to instantiate your main class

stuck flax
#

if the config is updated with FileConfiguration.set, does it need to be reloaded for the value to be updated when getting it?

lost matrix
torn shuttle
#

FileConfiguration is a map for crazy people

echo basalt
#

pro tip: convert it to a Map<String, Object> because you aren't like the other normies

torn shuttle
#

haha config parsing go brrrrrrr

#

I finally got noise cancelling headphones strong and comfortable enough that I can actually sleep with

#

I can't wait till I am out of this place, I swear I'm going to end up moving to the middle of nowhere just so I can have some silence

golden turret
#

guys

next stratus
golden turret
#

why??

buoyant viper
#

dont even worry about it πŸ˜”πŸ”«

torn shuttle
#

you can't convince me otherwise

remote swallow
#

lombok is shit.

torn shuttle
#

lombok is the shit

buoyant viper
#

if by the shit u mean shit, then yes, lombok is the shit

torn shuttle
#

you're just not used to good things

buoyant viper
#

ur right, thats why im still writing java

#

πŸ˜”

torn shuttle
#

if you live in the sewer everything will smell like shit

#

meanwhile up here in my ivory tower everything smells like expensive roses imported from a different planet

buoyant viper
#

no embed?

torn shuttle
#

I always knew you lombok haters were rats

buoyant viper
#

theres a reason they called me alrat in high school πŸ€

crude charm
wary topaz
#

Can someone help me? I imported buildtools with all steps done percisly but my CraftBukkit player still wont import even doing it manually.

lethal coral
#

What characters aren't allowed in a plugin name?

wary topaz
#

" <, >, |, *, ?, ", : "

hybrid spoke
#
  • what does the warning say
#

otherwise force clean install

lethal coral
#

is bukkit noise slow?

buoyant viper
#

like audio or perlin noise

lethal coral
#

noise generation

#

not audio

vagrant stratus
#

for Player#spigot()#sendMessage(ChatMessageType) what do CHAT and SYSTEM do?

raw prairie
#

Can anyone help me with development problems I have currently

#

Preferably in dms..

glad prawn
#

For what. Just send it here.

raw prairie
vagrant stratus
#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

raw prairie
#

Hello, I am wanting to paste a schematic repeatedly for infinity as long as players are loading new chunks, but I can't seem to do that.. heres my current code

#

    @Override
    public void onEnable() {
        // Plugin startup logic
        System.out.println("Backrooms Plugin enabled");
    }

    File file = new File("Backrooms.schem");
    Clipboard clipboard;

    public Backrooms() {
        ClipboardFormat format = ClipboardFormats.findByFile(file);
        try (ClipboardReader reader = format.getReader(new FileInputStream(file))) {
            // Stuff here
        } catch (FileNotFoundException ex) {
            Bukkit.getLogger().severe("Schematic file doesn't exist!");
            ex.printStackTrace();
        } catch (IOException ex) {
            Bukkit.getLogger().severe("Error reading schematic file!");
            ex.printStackTrace();
        }
    }


    @EventHandler
    public void chunkLoad(ChunkLoadEvent e, int getX, int getZ) {
        if (e.isNewChunk()) {
            try (EditSession editSession = WorldEdit.getInstance().newEditSession(BukkitAdapter.adapt(e.getWorld()))) {
                Operation operation = new ClipboardHolder(clipboard)
                        .createPaste(editSession)
                        .to(BlockVector3.at(getX * 16, 40, getZ * 16))

                        .build();
                Operations.complete(operation);
            }
        }
    }

    @Override
    public void onDisable() {
        // Plugin shutdown logic
        System.out.println("Backrooms Plugin disabled");
    }
}```
#

Anything I could do

#

Right now its producing this error

#

org.bukkit.plugin.InvalidPluginException: com.sk89q.worldedit.extension.platform.NoCapablePlatformException: Not all platforms have been registered yet! Please wait until FastAsyncWorldEdit is initialized.

at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:149) ~[spigot-api-1.19-R0.1-SNAPSHOT.jar:?]

at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:394) ~[spigot-api-1.19-R0.1-SNAPSHOT.jar:?]

at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:301) ~[spigot-api-1.19-R0.1-SNAPSHOT.jar:?]

at org.bukkit.craftbukkit.v1_19_R1.CraftServer.loadPlugins(CraftServer.java:412) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3553-Spigot-14a2382-ef09464]

at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:224) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3553-Spigot-14a2382-ef09464]

at net.minecraft.server.MinecraftServer.v(MinecraftServer.java:966) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3553-Spigot-14a2382-ef09464]```
#

Thanks in advance

drowsy helm
#

looks like FAWE isnt initialized yet

raw prairie
buoyant viper
raw prairie
#

I made a work around, but it doesn't seem to actually paste the schematic if I implement the work around

#

This is the code for the work around

#

    @Override
    public void onEnable() {
        // Plugin startup logic
        System.out.println("Backrooms Plugin enabled");
    }

    File file = new File("Backrooms.schem");
    Clipboard clipboard;


    @EventHandler
    public void chunkLoad(ChunkLoadEvent e, int getX, int getZ) {

    ClipboardFormat format = ClipboardFormats.findByFile(file);
        try (ClipboardReader reader = format.getReader(new FileInputStream(file))) {
            // Stuff here
        } catch (FileNotFoundException ex) {
            Bukkit.getLogger().severe("Schematic file doesn't exist!");
            ex.printStackTrace();
        } catch (IOException ex) {
            Bukkit.getLogger().severe("Error reading schematic file!");
            ex.printStackTrace();
        }
        if (e.isNewChunk()) {
            try (EditSession editSession = WorldEdit.getInstance().newEditSession(BukkitAdapter.adapt(e.getWorld()))) {
                Operation operation = new ClipboardHolder(clipboard)
                        .createPaste(editSession)
                        .to(BlockVector3.at(getX * 16, 40, getZ * 16))

                        .build();
                Operations.complete(operation);
            }
        }
    }

    @Override
    public void onDisable() {
        // Plugin shutdown logic
        System.out.println("Backrooms Plugin disabled");
    }
}```
#

This one doesn't produce an error

#

But it doesn't paste my schematic either

#

My goal is once again to paste the schematics side my side infinitely.

drowsy helm
#

if its inifinite you could just make your own world generator

raw prairie
#

Just started

#

This was the easiest solution

#

For me

#

Ig

drowsy helm
#

    public Backrooms() {
        ClipboardFormat format = ClipboardFormats.findByFile(file);
        try (ClipboardReader reader = format.getReader(new FileInputStream(file))) {
            // Stuff here
        } catch (FileNotFoundException ex) {
            Bukkit.getLogger().severe("Schematic file doesn't exist!");
            ex.printStackTrace();
        } catch (IOException ex) {
            Bukkit.getLogger().severe("Error reading schematic file!");
            ex.printStackTrace();
        }
    }
#

howcome you have a constructor?

raw prairie
drowsy helm
#

the thing i just posted

raw prairie
#

I'm going to sound dumb for it..

#

Ah

raw prairie
#

It didn't let me use public void

#

So I just took the void out

#

And I did try my own wolrd generator

#
        public ChunkData generateChunkData(World world, Random random, int chunkX, int chunkZ, BiomeGrid biome) {
            SimplexOctaveGenerator generator = new SimplexOctaveGenerator(new Random(world.getSeed()), 8);
            ChunkData chunk = createChunkData(world);
            generator.setScale(0.005D);

            for (int X = 0; X < 16; X++)
                for (int Z = 0; Z < 16; Z++) {
                    currentHeight = (int) (generator.noise(chunkX*16+X, chunkZ*16+Z, 0.5D, 0.5D)*15D+50D);
                    chunk.setBlock(X, currentHeight, Z, Material.GRASS_BLOCK);
                    chunk.setBlock(X, currentHeight-1, Z, Material.DIRT);
                    for (int i = currentHeight-2; i > 0; i--)
                        chunk.setBlock(X, i, Z,     Material.STONE);
                    chunk.setBlock(X, 0, Z, Material.BEDROCK);
                }
            return chunk;
            try (EditSession editSession = WorldEdit.getInstance().newEditSession(BukkitAdapter.adapt(e.getWorld()))) {
                Operation operation = new ClipboardHolder(clipboard).createPaste(editSession).to(BlockVector3.at(16* chunkX, 40, 16*chunkZ)).build();
                Operations.complete(operation);
            }


        }```
drowsy helm
#

oh you cant have a method that is the same name of the class

pearl glade
#

@raw prairie you didn't register listener so you event as never called

raw prairie
pearl glade
#

With pluginManager

raw prairie
#

Og yea

#

The 1 in the tutorials

raw prairie
#

It doesn't work regardless lol

pearl glade
#

getServer().getPluginManager().registerEvents(new Event class name(), this);

pearl glade
#

You put this

raw prairie
#

Yea I put it in startup logic

pearl glade
#

because you are in the same class

#

Okok

raw prairie
#

So getServer().getPluginManager().registerEvents(backrooms(), this);

pearl glade
#

No

#

Just this

#

So getServer().getPluginManager().registerEvents(this, this);

raw prairie
#

K

raw prairie
#

Other than removing the method

#

Thats the same name as the class

raw prairie
#

Should I delete it, rename it

pearl glade
raw prairie
pearl glade
#

You could remove other parameter into method and that working

raw prairie
pearl glade
#

Yep, getX and getZ

raw prairie
pearl glade
#

XD

raw prairie
pearl glade
#

You see ?

raw prairie
#

Another reason this should been done in dms cause I'm slow as fuck

raw prairie
pearl glade
#
    @EventHandler
    public void chunkLoad(ChunkLoadEvent event) 
raw prairie
#

Oh

#

πŸ’€

pearl glade
#

Xd

raw prairie
pearl glade
#

It's okey

#

for me by i just woke up

raw prairie
#

For my code

pearl glade
#

Yep, np

vagrant stratus
#

I'd test it myself, but I've got more important things to do which means it's easier to just ask lol

delicate fossil
#

i want to give the player a book with text in it. how do you set the data? it crosses it out when i type it (yes i know its deprecated) and even if it didnt i dont know how to use it.
edit: i partially found out how to do it.

buoyant viper
#

?jd-s for me self

undone axleBOT
buoyant viper
#

CHAT is probably standard player chat

SYSTEM is most likely server system messages (still shown in normal chat window)

and ACTION_BAR is... well... action bar

vagrant stratus
#

Ah

buoyant viper
#

can fuck around and find out in about T-10 minutes

#

i think its up to the server to not? normally send chat to someone who has it disabled but idk

vagrant stratus
#

πŸ€·β€β™‚οΈ

agile anvil
halcyon mica
#

Can I not update a inventory when scheduling it after a inventory tick event?

#

I schedule a inventory update one tick later when a inventory click event happens, but any kinds of inventory changes do not get applied

eternal oxide
#

when you call update you are likely using the old instance and overwriting changes

halcyon mica
#

Of the block?

#

I always get the inventory from the block before modifying and calling update

#

Or does a block object keep a instance of its state and inventory

echo basalt
#

state keeps the inventory

#

block keeps the state

#

thing is it's a new instance every time you call getBlock

#

and any changes just update the internal nms handle

halcyon mica
#

So I have to re-fetch the block every tick in my task

echo basalt
#

ehh not really

#

It just keeps a reference of its internal handle

#

It's basically a fancy wrapper

#

You're fine with reusing it

halcyon mica
#

Then what causes my issue above

echo basalt
#

Uhh you might be opening an inventory copy lmao

halcyon mica
#
    public BrewingTask(BrewingRecipe recipe, BrewingStand block) {
        this.recipe = recipe;
        this.block = block;

        this.brewTime = recipe.getBrewingTime();

        if (block.getFuelLevel() > recipe.getFuelCost()) {
            block.setFuelLevel(block.getFuelLevel() - recipe.getFuelCost());
        } else {
            int rest = recipe.getFuelCost() - block.getFuelLevel();
            block.getInventory().setFuel(decrease(block.getInventory().getFuel(), 1 + rest / 20));
            block.setFuelLevel(20 - rest % 20);
        }

        block.setBrewingTime(DEFAULT_BREW_TIME);

        runTaskTimer(Adapt.instance, 0L, 1L);
    }```
#

I am not

#

The blocks fuel level is updated just fine

#

The fuel item is not

#

And no, my decrease function is not it since I cannot even null it

echo basalt
#

are you updating the fuel inside the runnable?

halcyon mica
#

No

#

But I can update the inventory fine inside of it

#

BrewingTask itself is the runnable

#

But this is merely the constructor

echo basalt
#

Try updating it inside the runnable

#

also calling updateInventory to all viewers helps sometimes

smoky oak
#

whats the simplest collection with a O(1) contains?

#

assuming unique elements

halcyon mica
echo basalt
halcyon mica
#

There is also a problem where I am unable to remove the fuel item from the slot

#

It gives the item stack to the cursor, but immediatly sets the fuel slot back to the previous state

#
    public void run() {
        BrewerInventory inventory = block.getInventory();
        if (brewTime <= 0) {
            inventory.setIngredient(decrease(inventory.getIngredient(), 1));

            for (int i = 0; i < 3; i++) {
                if (recipe.getBasePotion().equals(inventory.getItem(i)))
                    inventory.setItem(i, recipe.getResult());
            }

            inventory.getViewers().forEach(e -> {
                if (e instanceof Player p)
                    p.playSound(block.getLocation(), Sound.BLOCK_BREWING_STAND_BREW, 1, 1);
            });
            cancel();
            return;
        }

        brewTime--;
        block.setBrewingTime(getRemainingTime());
        block.update(true);
    }```
#

This is the runnable for reference

#

Run once per tick

smoky oak
halcyon mica
#

Updating the items when the brew time hits zero works without issue

#

Moving the constructor code to it as well still fails to update the fuel however

molten hearth
#

is there like

#

a mathematical formula with cos and sin that can achieve this shape lmao

#

its fine if 24 and 25 have to be set manually

echo basalt
#

I'd probably just say for loops

molten hearth
#

hell yea ima make an array of numbers and loop through them and set them

halcyon mica
#

Logging before and after the update of the armorstand shows that it indeed updates the inventory apropriately

#

The screen however remains unchanged

echo basalt
#

try calling updateInventory

halcyon mica
#

I have, to no avail

echo basalt
halcyon mica
#

updating the block is the culprit

#

It resets the inventory to its state before changing it

molten hearth
#

tru I just assumed maths could save me

halcyon mica
#

Which does not line up with what you have said

molten hearth
#

cus its kinda like this

fluid river
#

don't call block.update()?

halcyon mica
#

I need to update the block for its metadata to update

fluid river
#

well i once coded something which required modifying block

#

it didn't work so i removed all .update()

#

and it started working

#

for some reason

#

don't even remember what i coded

halcyon mica
#

And as someone who is doing this constantly, I can tell you that modification to the blockstate are not synced to the client when you don't update the block

fluid river
#

bukkit api be like

#

i guess

#

like visual bugs with some inventory modifications

halcyon mica
#

It's not a visual bug

#

The inventory is actively being reverted

fluid river
#

i mean there is no sync between what you see and what server offers

#

sometimes

#

there was a topic on spigotmc about it

#

somewhere

#

month or two ago

halcyon mica
#

The visual aspect is completely irrelevant

#

The inventory is a part of the server, not the client

fluid river
#

i mean i just called it visual bug

#

not because it's actually LWJGL bug

#

but just desync

#

which affects what you see on the screen

halcyon mica
#

You are not listening to what I am saying

fluid river
#

i just woke up tho

#

kinda hard to brrt

#

need some fresh beer

halcyon mica
#

So there are two things that are potentially happening here

#

A: I need to update the inventory state first before calling update

#

Or B: The block instance keeps a immutable copy of the inventory that gets processed when calling update

halcyon mica
#

OK, progress

#

It looks like the inventory is being disassociated from the block by doing getInventory

#

block.getInventory().getHolder().update() does nothing

#

To which I have to say

#

What the actual fuck

next stratus
halcyon mica
#

Upon the first iteration, getHolder returns the block instance which was actually passed to the task

#

But every subsequent iteration references a completely different block

eternal oxide
#

There is only ever one instance of a Bloc, but they can have snapshots.

#

BlockState

halcyon mica
#

Yes, but this is the same block instance

#

I pass it when constructing the object

eternal oxide
#

a State will be different to a Block instance

halcyon mica
#

This is the toString for the block

#

Not the state

eternal oxide
#

it can;t be

#

a block instance will always be the same so long as its chunk is loaded

halcyon mica
#
    @Override
    public void run() {
        BrewerInventory inventory = block.getInventory();
        if (brewTime <= 0) {
            inventory.setIngredient(decrease(inventory.getIngredient(), 1));

            for (int i = 0; i < 3; i++) {
                if (recipe.getBasePotion().equals(inventory.getItem(i)))
                    inventory.setItem(i, recipe.getResult());
            }

            inventory.getViewers().forEach(e -> {
                if (e instanceof Player p)
                    p.playSound(block.getLocation(), Sound.BLOCK_BREWING_STAND_BREW, 1, 1);
            });
            cancel();
            return;
        }

        brewTime--;
        block.setBrewingTime(getRemainingTime());
        Adapt.warn(inventory.getHolder().toString() + " | " + inventory.getHolder().getLocation());
    }```
#

block never changes

#

As seen here, the block given to the task remains the same

#

First and constructed

molten hearth
#

so if I have like x = 10 b = 50 how would I calculate what % of B; X would be

halcyon mica
#

The inventory is fetched from that using block.getInventory

#

And yet after the first iteration, the holder of that inventory does not reference the original block anymore

#

So what is going on

eternal oxide
#

good question

#

is your block reference changing?

halcyon mica
#

It's literally final

molten hearth
#

nvm I found this

rough drift
#

if I use getConfigurationSection on a value like test: 123, will it return null?

eternal oxide
#

yes, that is not a section

rough drift
#

Just making sure

halcyon mica
#

So what now

#

can I just not modify a brewing inventory?

eternal oxide
#

You should be able, but without running code myself I can;t advise

#

too busy at the moment

halcyon mica
#

What makes it even weirder is that the inventory in the <= 0 block actually updates correctly

#

Literally the only two things I am doing right now is java Adapt.warn("First: " + block.toString()); Adapt.warn("Holder: " + block.getInventory().getHolder().toString());

#

And it still disassociates

#

I have removed everything else

#

Meaning that after the first getInventory call to the BrewingStand interface, it returns a interface with a different owner

#

This has to be a bukkit bug

molten hearth
#

does have jave something like js map.get(1) | 2 // Incase map.get(1) doesnt exist

earnest forum
#

getOrDefault

molten hearth
#

ty

#
int totalXP = this.skillValues.get(skillType); // Total XP for skill
int current_level = this.skillTracker.getPlayerSkillLevel(this.uuid, skillType); // Total XP Required for current level
int next_level = this.skillTracker.getSkillXp().get(current_level + 1); // Total XP Required for next level
int current_next_level_xp = totalXP - this.skillTracker.getSkillXp().getOrDefault(current_level -1, 0); // Current XP removing previous level's XP

return (100*current_next_level_xp)/next_level;```
#

this is

#

my current code

#

I dont think its working very well

#

what is A exactly

#

oh bruh i found that number before by accident

#

alright

#

say the total XP for level 2 is 1000 and the player has 1500 XP at the moment and level 1 took 500 total XP I want the % the player currently is from level 1 to level 2

delicate fossil
#

how do you get the entire command contents on execute
like for example: /customcommand firstargument and a lot of random text with spaces between
and i need to get the entire command and cut off the first part and get from it just the "and a lot of random text with spaces between"

molten hearth
#

wait what

#

my example was scuffed you have gained 100% of the XP

#
Level 2 = 1000
Level 1 = 500
Player XP = 1500```
#

lol

rough drift
#

can I add a constructor to my plugin, as long as it is public and with no args?

floral drum
rough drift
#

nice

molten hearth
#

now I get -4800%

#

god damn it

floral drum
#

?tryitandsee

#

whats the cmd

remote swallow
#

?tas

undone axleBOT
rough drift
#

yeah

floral drum
#

ty

remote swallow
#

it used to be ?tias but they changed it

rough drift
#

I did know it would work sort of, I checked the plugin class loader, wanted to make sure

earnest forum
#

tool assisted speedrun?

floral drum
#

ong true

hybrid spoke
#

imagine the domain holder changes it to porn or some gore shit

#

and we all would still use it

remote swallow
#

still confused about why it stopped embeding

floral drum
#

cafebabe perms

remote swallow
#

okay that seems correct

hybrid spoke
remote swallow
#

it used to embed

floral drum
molten hearth
#

right so

#

I have

#
------------------
Total XP: 10
Current Level: 0
Next Level: 50
Current Next Level XP: 50
Remaining XP: -10
------------------```
#
        int totalXP = this.skillValues.get(skillType); // Total Player XP for skill
        int current_level = this.skillTracker.getPlayerSkillLevel(this.uuid, skillType); // Total XP Required for current level
        int next_level = this.skillTracker.getSkillXp().get(current_level + 1); // Total XP Required for next level
        int current_next_level_xp = next_level - this.skillTracker.getSkillXp().get(current_level);

        System.out.println("------------------");
        System.out.println("Total XP: " + totalXP);
        System.out.println("Current Level: " + current_level);
        System.out.println("Next Level: " + next_level);
        System.out.println("Current Next Level XP: " + current_next_level_xp);
        System.out.println("Remaining XP: " + getRemainingXp(totalXP));
        System.out.println("------------------");```
#

Total XP is correct, Current Level is correct, Next Level is correct, Current Next Level XP is Incorrect, Remaining XP idfk how it became negative its incorrect

#

Current Next Level XP should be 10 and Remaining XP should be 40

#

one sec I have discovered my formula for getting the player level is flawed

sterile token
#

WebSocket ws = new WebSocket("127.0.0.1", 8080);

AsyncWebSocket websocket = ws.async().open();

websocket.getEvents().register(new WSListener(this));

websocket.getPackets().register(User.class);

Future<WSResponse> response = websocket.send("/api/v1/users", new User(UUID.random(), "test"));

Sout("Sever response " + response.getCode() + ":" + response.getText());

crimson terrace
#

Ah yes... what am I looking at?

smoky oak
#

someone who forgot ` exists

crimson terrace
#

They forgor

molten hearth
#

alright I fixed it this is the final solution ```java
int totalXP = this.skillValues.get(skillType); // Total Player XP for skill
int current_level = this.skillTracker.getPlayerSkillLevel(this.uuid, skillType); // Total XP Required for current level
int next_level = this.skillTracker.getSkillXp().get(current_level + 1); // Total XP Required for next level
int current_next_level_xp = totalXP - this.skillTracker.getSkillXp().getOrDefault(current_level, 0); // Total XP Required for current level

rough drift
#

what is a good icon to indicate attack speed?

#

and most importantly what is a good color for it xD

#

white?

crimson terrace
#

White seems fine, how about a sword with some curved lines to indicate that its being swung?

rough drift
#

smart

#

I now need to find the icon

glad prawn
#

Does anyone know how to use ClientboundDeleteChatPacket?

onyx fjord
glad prawn
onyx fjord
#

doesnt it only work for signed messages tho?

echo basalt
#

1.19.1+ too

onyx fjord
#

kinda useless imo

#

unless you force signing

#

that has its own issues

echo basalt
#

just do a venturechat move and have a linkedlist of messages

onyx fjord
#

i have a custom system too

echo basalt
#

limit it to 500 packets / player type deal

onyx fjord
#

yeah it stores a list of previous messages and gives each one an ID

#

then that messages is excluded from list and everything else is resent

#

staff also sees the deleted message

#

that packet you mentioned doesnt seem documented on wiki.vg?

echo basalt
#

something like

@Data
@AllArgsConstructor
public class WrappedMessage {

  private final UUID id;
  private final Component component;
  private final UUID sender;

}

public class MessageChain {

  private static final int MAX_SIZE = 500;
  private final Deque<WrappedMessage> list = new LinkedList<>();

  public void send(WrappedMessage message) {
    list.add(message);
    
    if(list.size() > MAX_SIZE) {
      list.pollFirst();
    }
  }

  public void delete(WrappedMessage message) {
    list.remove(message);
  }

  public Collection<WrappedMessage> getAllMessages() {
    return list;
  }
}
#

type deal

onyx fjord
#

tf are those annotations

echo basalt
#

lombok

#

makes getter, setter, equals, hashcode

#

RequiredArgsConstructor

#

And AllArgsConstructor which makes a constructor with all fields

remote swallow
#

leave

#

lombok bad

river oracle
#

Someone hates industry standards 😳

#

Imagine if lombok was actually bad no one would use it

#

Too bad that's not reality huh

eternal night
#

I would not call Lombok an industry standard

#

Especially when you can replace most of its commonly used features with a record these days

#

tho I must say, @Delegate my beloved

subtle folio
#

lombok is just getters ??

hybrid spoke
cursive loom
#

hey i want to check in a lore if a string is inside but I'm with paper and I don't find the method to do that someone have already do that ?

river oracle
cursive loom
main dew
#

exists discord Protocollib?

raw prairie
#

Protocollib is a spigot plugin

main dew
#

yea

#

but I need help with Protocollib

raw prairie
main dew
#

for example LuckPerms have discord

raw prairie
#

Let me check