#help-development

1 messages Β· Page 739 of 1

quaint mantle
#

You don't need to do it.

sick edge
#

But I thought size was fixed to amount of slots there are in general

pseudo hazel
#

yes it is

quaint mantle
#

I think, you can just add an itemstack, get it's slot and then remove it. But idk if you need to update the inventory to do it. I don't think so

pseudo hazel
#

what if you have air slots in between

sick edge
quaint mantle
#

Oh

glad prawn
#

start loop at the end of contents, if not null, get πŸ€“

pseudo hazel
#

or air

young knoll
#

I think inventories return null

#

Idk the api is kinda inconsistent

pseudo hazel
#

yeah you can never be too sure

#

no harm in checking both cases

young knoll
#

Well, you can be sure

#

That’s what the nullability annotations are for

pseudo hazel
#

🀷

quaint mantle
true perch
#

I deleted my local files and pulled code from my github repository. Afterward for some reason my imports are erroring. Any ideas why?

hazy parrot
#

Maybe you didn't push local files before deletion?

true perch
#

prior

hazy parrot
#

I mean you can check if those files are present on remote

true perch
#

they're present on github as well

#

nothing to commit or push

pseudo hazel
#

except its in item_data

#

or is it not?

#

hard to tell

true perch
#

no it's not

midnight fulcrum
#

When I made my plugin I was 16 and much less knowledgable of what I should have done. Now I am 23 and much wiser in regards to programming and its related sciences. Life's complicated, there's family, friends, job, hobbies, free time, relationships, etc and it keeps getting more complicated as you stack up routines that supposedly make your life better. It would be foolish to assume I am lazy and that's it, that's a counterproductive way to think of developers in this community.

true perch
young knoll
#

What's that button IntelliJ has

#

Invalide caches and restart or somethin

#

Or maybe it's just invalidate caches and then you restart yourself :p

midnight fulcrum
#

IntelliJ gives you the option to restart it in the selection of which cache to invalidate

#

so just press that, happens from time to time in my case

sick pagoda
#

Is there an easy way to disable unwaxing copper / stripping logs (so that if a player is holding an axe with blocks in their offhand, if they right click it'll place a block instead of unwaxing / stripping)

pseudo hazel
#

maybe you can cancel the interact event?

#

idk how that works exactly

sick pagoda
#

That cancels it but doesn't place the block

pseudo hazel
#

what block

sick pagoda
#

The block in the player's offhand

pseudo hazel
#

oh

#

well thats just how the hand priority works

#

you can place it with code I guess but can be pretty buggy I guess

sick pagoda
#

Yeah that's what I've got atm using blockfaces but I was curious to see if there was an easy way to do it

#

Ig not :(

true perch
#

I'm still able to build the plugin although it's saying the imports are invalid. Any help?

hazy parrot
#

Try to invalidate cache

#

Ij likes to be goofy

true perch
shadow night
#

hey guys, I'm currently making a forge mod and I have a few custom packets to keep in sync with the server and tell other clients about stuff. Is it possible to make a bukkit plugin that would have the same behaviour allowing for users of the mod to see each other without needing a modded server and if yes, how?

worldly ingot
#

Yes. That's what the message channels are for

shadow night
#

hmm

worldly ingot
#

registerIncomingPluginChannel() will let you accept packets from your Forge mod, registerOutgoingPluginChannel() will let you send them via Player#sendPluginMessage()

shadow night
#

that's very cool

#

thank you

young knoll
#

Thanks Mojang

worldly ingot
#

Reading and writing the data in a way that Forge will understand it is a bit different though. They use Mojang's protocol format so things like varint and varlong exist

#

No-arg constructor to write, single arg constructor to read

shadow night
#

hm

robust helm
#

is it bad to add ExampleApi#getInstance when developing an Api?

#

or do i need to use PluginManagger#getPlugib

quiet ice
#

not really

robust helm
#

or maybe static methods

young knoll
#

You should have static methods for things

quiet ice
#

The only breakage you might get if you do that is reloading plugins. But the same applies if you do it differently and are not careful enough

robust helm
#

thx

robust helm
#

and instance = this in condtructor

quiet ice
#

As long as you don't store the value anywhere dangerously there is nothing to worry about

robust helm
#

non lazy

#

alr ty

young knoll
#

For mine API I like to have a setInstance method

#

Which will fail if the instance is already set, so nobody else can make use of it

#

But there are a bunch of ways to do it

eternal night
#

But you aren't XD

#

You increment in degrees

past oriole
#

any one know how can i do an animation with an item in spigot?

young knoll
#

What do you mean

#

Do you want the item texture to animate?

past oriole
worldly ingot
#

Probably, but what would be more efficient is precalculating sin and cos given your variables don't ever change

#

Store the results in one or two arrays and iterate over them

#

i

#

They're independent to anything else in your loop

#

Could also store your max and increment in constants

#

The location can change, that's fine. But the fact of the matter is that you're only doing Math.sin(i) and Math.cos(i) but those i values are entirely unaffected by local variables. They're constant

young knoll
#

Do max and increment get calculated each iteration

young knoll
quiet ice
#

AffineTransform is AWT, no?

#

In that case I recommend against it. Could cause funky behaviour in headless envs or on macs

worldly ingot
#

Okay, well in the snippet you send your i value is constant so they can be precomputed. So if you expect to use some other snippet where i is variable then don't bother

#

And if you're using radians, iterate in radians. It makes no sense to iterate in degrees if you're just going to convert to radians

#

It's nonsensical

quiet ice
#

It's funky

worldly ingot
#

Not a headless one because why would you need a graphics package in an environment that can't display graphics?

young knoll
#

Doesn't spigot kinda die on headless

worldly ingot
#

Modern versions of Bukkit have JOML shaded so you can use that if you want

quiet ice
#

Paper sure doesn't. Spigot, idk?

worldly ingot
#

But you'll lose support for 1.19 and below

#

k

young knoll
#

Shade joml yourself

worldly ingot
#

Also an option

young knoll
#

Or libraries it

#

Wait no that is 1.17+

quiet ice
#

Or use my funny maven resolver

young knoll
#

No

quiet ice
#

No. JOML is quite massive

worldly ingot
#

It's pretty much the standard graphical mathematics library

#

It's designed to be used for LWJGL games

young knoll
#

Main person is this guy

#

That's John JOML

worldly ingot
#

Good ole Johm JOML

young knoll
#

I trust it

#

He's German

worldly ingot
#

I mean if we're being honest here, shading JOML probably isn't worth it if you expect to use only one class lol

young knoll
#

This is what minimize is for choco

worldly ingot
#

THIS IS WHAT YOUR FACE IS FOR

young knoll
#

You know what

#

I blame you for all the test failures i've had the past 24 hours

upper hazel
quaint mantle
#

Prob no

upper hazel
#

lol

worldly ingot
#

Definitely not lol

quaint mantle
#

Website litteraly diffrent

upper hazel
#

i was think this spigot rus verison

worldly ingot
#

I've been blocked so πŸ‘€

#

I'd be shocked if it were official

upper hazel
#

demm

worldly ingot
#

Probably just "if not Russian browser, block"

upper hazel
#

I'm tired of writing plugin instructions not in my native language(

#

most of the visitors are English people

#

I will risk

sick edge
#

Hi I have a short question I am working with an InventoryClickEvent: The event only happens after all handlers are run through and it wasnt set to cancelled right? This means that anything I want to happen that needs the event to have already taken effect needs to be scheduled?

fluid river
fluid river
sick edge
#

I have an item that should be updated whenever a clickevent happens. The item change checks for an inventory and what is in the inventory. The problem is that inventory can also change due to the click event. The way I have it now it would only show the newest change after another InventoryClickEvent

fluid river
#

why don't you just cancel the click and update the item after

#

if i got you right

sick edge
#

Because its pretty much a backpack and it shows the items in the inventory through a bundle so I still have to allow adding items to the inventory while then directly updating the bundle

fluid river
#

well then why do you change item in backpack

#

if it's supposed to be a backpack

#

you probably should launch a scheduler after invclick

#

which would update item 1 tick later

upper hazel
#

The question is how well the administrators check for viruses

young knoll
#

That assumes they even do

sick edge
upper hazel
#

this site too

#

but rus my native

fluid river
#

bruh

young knoll
#

How many are there

#

smh

upper hazel
fluid river
#

you can

#

idk if you can buy/sell

#

but at least you can post

lilac dagger
#

yml is the best

#

it's the most readable

young knoll
#

...

lilac dagger
#

i don't think json is readable enough

young knoll
#

It's a math library lmao

lilac dagger
#

oh lol

#

sorry

quiet ice
#

Yeah I was confused for a sec

lilac dagger
#

joml toml

#

i thought they were the same

quiet ice
#

TOML is absolutely horrible.

#

The worst markup language I have looked at

lilac dagger
#

i mean, it looks okay, but definitely not worth shading it for 4 config files

young knoll
#

SPOML

#

Spigot Object Markup Language

quiet ice
#

It is good enough for key -> value pairs, but once you have arrays it is not usable.

lilac dagger
#

i see

#

yeah, this is why i keep saying yml is the best

worldly ingot
#

Velocity uses TOML and they're migrating to YAML lol

young knoll
#

Forge uses TOML

quiet ice
#

Yeah, and to this day I wonder why

worldly ingot
#

Yeah but at least they're in a different enough ecosystem

remote swallow
#

cmarco uses toml

#

for some reason

lilac dagger
#

but then again, if the users get used to a specific config format, it is best to follow the standard for that platform

ivory sleet
remote swallow
#

if he was here he would say something like "have you seen ViperTomlLib its really good for configs"

quiet ice
#

Over at forge the standard is either use TOML or JSON5 or YAML or whatever

#

It is defo way more nonstandard than here

worldly ingot
# ivory sleet wait why lol?

It was the only large software in the Bukkit community that used TOML so it was unfamiliar for most users wanting to migrate from Bungee

#

I dunno if they've finished the migration or not but I know they were talking about it some time ago

lilac dagger
#

i always assumed the standard for spigot/bukkit is yaml

young knoll
#

It is

#

It's the only format the API supports atm

remote swallow
#

someone pr json

worldly ingot
#

You could in theory add other FileConfiguration implementations

lilac dagger
#

99% was yaml when i had a server

worldly ingot
#

Just... y'know, why?

quiet ice
remote swallow
#

we should make configs brainfuck

#

feck hes here

lilac dagger
#

haha

#

he couldn't miss this chance

young knoll
quiet ice
#

Can it work adequately with arbitrary-size arrays?

worldly ingot
#

If you want your plugin to be the only one on the server to be in a different format then go for it I guess

young knoll
#

Make things nice and confusing when you run a sevrer with plugins using 3 differnt formats

quiet ice
#

Especially when nested

worldly ingot
#

Doesn't need to be in Bukkit natively

remote swallow
#

yes it doe

worldly ingot
#

It provides you API to add it yourself in your own plugins

quiet ice
#

I mean I extensively use JSON or HOCON in my plugins

quiet ice
#

Especially for I18N

remote swallow
#

whats hocon

quiet ice
#

JSON but with comments would be my summary

young knoll
#

hocon these nuts

remote swallow
#

very mature colluthine

worldly ingot
young knoll
#

Hey json can have comments

lilac dagger
#

i was actually wondering how would json look with comments

young knoll
#

If you use lenient parsing

lilac dagger
#

i don't like it

worldly ingot
#

Yeah, GSON has it

lilac dagger
#

it would be great if gson impl a break line character for comments

#

but not sure how parsing it/beautifying would work

quaint mantle
#

Hi, I need help with one thing i've been stuck at

sick edge
#

I'm having a really weird problem: If I move an item really fast fom one slot to another sometimes only one InventoryClickEvent fires vs the normal two Events
Does someone know if this is intentional or something?

quaint mantle
#

I want to make sure every player in the game's camera is stuck at one block

lilac dagger
#

sounds easy

quaint mantle
#

Like all the players can see what that block sees, even though they are in a different place and they control their characters elsewhere

#

Uh like a platformer game

#

like those old mario games

lilac dagger
#

just listen for playermove if the player is in game and a check for not moving is, event.setto event.getfrom

quaint mantle
#

Any advice on how I can get the player camera to do that?

lilac dagger
#

i don't understand

quaint mantle
#

You know the old mario games right?

lilac dagger
#

like a spectator of a block?

quaint mantle
#

You view mario from a third person perspective

lilac dagger
#

oh hmm

quaint mantle
#

I want all players in a game to view their character like that

young knoll
#

Force the player to spectate an entity

#

and then just move the entity

lilac dagger
#

so third person view of some character?

quaint mantle
#

third person view of their own character

lilac dagger
#

that sounds difficult from the server to enforce

quaint mantle
#

Being able to control their minecraft character in third person perspective

lilac dagger
#

that's just f5

young knoll
#

You would have to make a model of their character

#

And somehow apply the skin to it

quaint mantle
#

theoretically you can just lock the player camera to a specific block right?

young knoll
#

no

quaint mantle
#

you cannot?

young knoll
#

Not without a client mod

quaint mantle
lilac dagger
#

you can be a spectator and put a item in front, but it's so difficult, not even sure it'll work best

quaint mantle
#

can we send links in the server?

lilac dagger
#

you have to rely all the movements to the block yet the camera has to remain somewhat stable

#

if you verify sure

quaint mantle
#

this is pretty much what i wanna make

#

the guy in the video codes a plugin and shows it for a split second but i do not really get the code

lilac dagger
#

i can look it up

quaint mantle
#

i know it forces the player to look north but

#

is there any specific event used?

lilac dagger
#

sounds easy

#

yeah

#

playermoveevent

#

and just set the yaw towards north

#

i think it's 0?

quaint mantle
#

-180

#

thank you

sick edge
lilac dagger
# quaint mantle -180

i just watched the whole video, he pretty much tells you everything he did to make it

robust helm
young knoll
#

what

robust helm
#

u have a custom api, and the user can do setInstance once?

#

or u do setInstance yourself

young knoll
#

I do it

#

From onEnable

#

You could also skip the method and set the instance via reflection

twilit roost
young knoll
#

It should always fire

hardy cairn
#

hi can i get some code help here?

young knoll
#

Unless you are in creative, creative messed up the inventory events

hardy cairn
#

can i ask some code related problems here?

twilit roost
#

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

sick edge
wicked quail
#

When publishing a plugin on the forum, is it allowed to use the link to the plugin's modrinth page as the external download URL?

hardy cairn
#

i making a gem which will give speed in offhand but it isnt giving potion effect pls help

#
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.PluginCommand;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerItemHeldEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import SpeedGem.SpeedGemItem;
public final class BlissPluginRemake extends JavaPlugin implements Listener {
    @Override
    public void onEnable() {
        // Plugin startup logic
        PluginCommand command = getCommand("GiveSpeedGem");
        if (command != null) {
            command.setExecutor(this);
            getServer().getPluginManager().registerEvents(this, this); // Register the event listener
        } else {
            getLogger().warning("Command 'GiveSpeedGem' not found!");
        }
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (sender instanceof Player) {
            Player player = (Player) sender;
            ItemStack SpeedGem = SpeedGemItem.createSpeedGem();
            player.getInventory().addItem(SpeedGem);
            player.sendMessage("You received a Speed Gem!");

            return true;
        } else {
            sender.sendMessage("This command can only be executed by a player.");
            return false;
        }
    }
    @EventHandler
    public void onPlayerItemHeld(PlayerItemHeldEvent event) {
        Player player = event.getPlayer();
        ItemStack offhandItem = player.getInventory().getItemInOffHand();
        if (offhandItem == SpeedGemItem.createSpeedGem()) {
            player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 99999, 2));
        }
    }
}```
#

this is my main class

#

i have another class which have the code for gem

#

if someone got free time then pls help me out

#

im new so i prob did smthing stupidd

twilit roost
#

for the sake of classes
please make seperate class for events and command

worldly ingot
#

It's fine. Plugin is small enough

#

Any reason you're opting to use potion effects instead of attributes?

hardy cairn
#

uh i dont know i just needed speed so went for potion..

twilit roost
#

try System.out.prints instead of potions
just to check whether the listener even works

hardy cairn
#

oh ok let me see

worldly ingot
#
ItemStack itemStack = new ItemStack(Material.EMERALD);
ItemMeta itemMeta = itemStack.getItemMeta();
itemMeta.addAttributeModifier(Attribute.GENERIC_MOVEMENT_SPEED, new AttributeModifier("my.special.emerald", 2.0, AttributeModifier.Operation.ADD_NUMBER));
// Your other methods
itemStack.setItemMeta(itemMeta);```
#

Speed boost should be handled automatically. No need for potion effects at all

#

You can play around with that number or with different operations

hardy cairn
#

ok so i just replace it with all the stupid potion effect i tried to did in Held Item event?

worldly ingot
#

Correct. You can remove your listener entirely

#

The reason your method wasn't working by the way was because you were comparing ItemStack instances with == instead of itemStack.isSimilar(itemStack)

hardy cairn
#

okay i will try and see if it works

#

oh

#

ok

worldly ingot
#

I would still opt for the attributes though. Just a bit cleaner

hardy cairn
#

anything will help if it gives speed i can spend some time playing around with the value

young knoll
#

You may want to set the slot for the attribute

#

Lest you get a big mess on the tooltip

worldly ingot
#

You could hide the tooltip entirely if you wanted

hardy cairn
#

uhm

young knoll
#

Also an option yeah

worldly ingot
#

itemMeta.setItemFlags(ItemFlag.HIDE_ATTRIBUTES)

hardy cairn
#

oh ok

robust helm
# young knoll I do it

so its just ```java
private static ExampleApi instance;

@Override
public void onEnable() {
instance = this;
}

public static ExampleApi getInstance() {
return instance;
}

hardy cairn
#

@worldly ingot im sorry for ping but i have sperate class for the Gem i added the code you said its kinda not working idk what i did now ```package SpeedGem;

import org.bukkit.Material;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeModifier;

import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import net.kyori.adventure.text.Component;

public class SpeedGemItem {
public static ItemStack createSpeedGem() {
// Create the Speed Gem (renamed Amethyst Shard)
ItemStack speedGem = new ItemStack(Material.AMETHYST_SHARD);
ItemMeta speedGemMeta = speedGem.getItemMeta();
speedGemMeta.displayName(Component.text("Speed Gem"));
speedGemMeta.addAttributeModifier(Attribute.GENERIC_MOVEMENT_SPEED, new AttributeModifier("SpeedGemAbility", 9.0, AttributeModifier.Operation.ADD_NUMBER));
speedGem.setItemMeta(speedGemMeta);

    return speedGem;
}


}
restive meadow
#

Does anyone know how to get the client version? Not the server. It doesn't matter if it's using NMS or just the spigot api.

young knoll
#

ViaVersion has an api for it

#

Idk how they do it

eternal night
#

ClientIntentionPacket provides the protocol version

full holly
#

Hello, does anyone here know if there is an event that is triggered when a rail changes direction?

eternal oxide
#

probably redstone something event

lilac dagger
#

when the client joins i think it says the client version

#

i assume the check whether the client version is correct is done server side

young knoll
#

yeah

#

Of course without viaver that data is useless to devs

quiet vector
#

Is there a way to add the html files in the resources to my plugin folder?

eternal oxide
#

Plugin#saveResource

cyan sluice
#

Is there a way I can control on which slot a item is added to the players inventory?

onyx fjord
#

can i force player to start consuming an item ?

#

bread in this case

hardy cairn
#
    public void onPlayerItemHeld(PlayerItemHeldEvent event) {
        Player player = event.getPlayer();

        // Check if the player has a Speed Gem in their offhand
        ItemStack offhandItem = player.getInventory().getItemInOffHand();
        if (!offhandItem.isEmpty() && offhandItem.isSimilar(SpeedGemItem.createSpeedGem())) {
            System.out.println("Speed GEm Detected");
            // Get the player's movement speed attribute
            AttributeInstance movementSpeed = player.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED);

            // Check if the attribute is not null
            if (movementSpeed != null) {
                // Apply the "Speed" attribute
                AttributeModifier speedModifier = new AttributeModifier(
                        UUID.randomUUID(), "Speed Gem", 9.0, Operation.ADD_NUMBER);
                movementSpeed.addModifier(speedModifier);
            }

        }
    }``` can someone help me this event is not executing
#

i tried using an Sysout line to see if the event works but the event is not just working

#
    public void onEnable() {
        // Plugin startup logic
        PluginCommand command = getCommand("GiveSpeedGem");
        if (command != null) {
            command.setExecutor(this);
            getServer().getPluginManager().registerEvents(this, this); // Register the event listener
        } else {
            getLogger().warning("Command 'GiveSpeedGem' not found!");
        }
    }``` i even have registerd the event
shadow gazelle
#

How can I make sure a task timer starts at a certain time?

#

I want to start it at the beginning of an in-game day. i know how to find that, but I'm just not sure how to delay the start to that point.

fluid river
#

get current time

#

get amount of ticks till the next day

cyan sluice
# hardy cairn ```@EventHandler public void onPlayerItemHeld(PlayerItemHeldEvent event) { ...

Try this

```java

public SpeedGemListener(Plugin plugin) {
    this.plugin = plugin;
    plugin.getServer().getPluginManager().registerEvents(this, plugin);
}

@EventHandler
public void onPlayerItemHeld(PlayerItemHeldEvent event) {
// Check if the player has a Speed Gem in their offhand
ItemStack offhandItem = event.getPlayer().getInventory().getItemInOffHand();
if (!offhandItem.isEmpty() && offhandItem.isSimilar(SpeedGemItem.createSpeedGem())) {
System.out.println("Speed Gem Detected");

        // Get the player's movement speed attribute
        AttributeInstance movementSpeed = event.getPlayer().getAttribute(Attribute.GENERIC_MOVEMENT_SPEED);

        // Check if the attribute is not null
        if (movementSpeed != null) {
            // Apply the "Speed" attribute
            AttributeModifier speedModifier = new AttributeModifier(
                    UUID.randomUUID(), "Speed Gem", 9.0, AttributeModifier.Operation.ADD_NUMBER);
            movementSpeed.addModifier(speedModifier);
        }
    }
}```

Main Class:


    @Override
    public void onEnable() {
        new SpeedGemListener(this);
    }
fluid river
#

run taskTimer on that value

quiet vector
fluid river
#

also use java

shadow gazelle
fluid river
fluid river
shadow gazelle
#

I mean is there some way to delay the start? Another task is the only way I can think of.

fluid river
#

isn't there a delay before first run right in the tasktimer

river oracle
shadow gazelle
#

assuming that would even be accurate

quiet vector
fluid river
#

?

shadow gazelle
remote swallow
shadow gazelle
#

I guess that's the only way

remote swallow
#

use something like winarar or 7zip to check

quaint mantle
river oracle
fluid river
shadow gazelle
shadow gazelle
remote swallow
#

delay

#

use the delay

fluid river
#

delay

#

not the period

river oracle
fluid river
river oracle
#

long delay

fluid river
eternal oxide
#

use a ScheduledExecutor not the Bukkit Scheduler if you want accurate periods

shadow gazelle
#

I can read very wellℒ️

fluid river
fluid river
#

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

quiet vector
#

code is this
File file = new File(plugin.getDataFolder(), "files/key.html");
File file1 = new File(plugin.getDataFolder(), "files/style.css");
if (!file.exists()) {
plugin.getDataFolder().mkdirs();
plugin.saveResource("files/key.html", true);
}
if (!file1.exists()) {
plugin.getDataFolder().mkdirs();
plugin.saveResource("files/style.css", true);
}

remote swallow
#

that isnt how you should do it

hardy cairn
remote swallow
cyan sluice
hardy cairn
#

yes im trying

#

in your code this.plugin is giving error "cant resolve symbol 'plugin' "

remote swallow
#

remove the line this.plugin = plugin; from the constructor

hardy cairn
#

ok

#

anything else?

remote swallow
#

that should fix that error

hardy cairn
#

okay i will try to see if it works..

remote swallow
#

does your jar include said resources

#

also you probably need to mkdirs the filesFolder

eternal oxide
#

saveResource will preserve directory structure

#

he likely doesn;t have a files folder with resources in his jar

quiet vector
#

resources
files
Key.html
style.html
It looks like this.

eternal oxide
#

thats your project not your jar

onyx fjord
#

can i somehow add two items on fish hook?

#

or at least replicate the pulling behavior?

hardy cairn
#

uh its not working... im not able to send my full code here either..

remote swallow
#

?paste it

undone axleBOT
hardy cairn
undone axleBOT
remote swallow
#

use the link

#

the issue with that is like very obvious

cyan sluice
#

lol

lofty badge
#

who can help me with 64-bit assembler

#

?

river oracle
#

why

remote swallow
#

somehow i dont think you should be touching assemble

river oracle
hardy cairn
hardy cairn
lofty badge
river oracle
#

πŸ’€ wtf they're making you make a bootloader

#

jesus christ

#

have fun no thanks

remote swallow
#

?learnjava before using an api

undone axleBOT
pale pulsar
#

hi, can you explain why it doesn't claim 16x16 but 8x8

public class Commandclaim implements CommandExecutor {

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (sender instanceof Player) {
            Player player = (Player) sender;

   
            GriefPrevention griefPrevention = GriefPrevention.instance;

            World playerWorld = player.getWorld();

            int playerX = player.getLocation().getBlockX();
            int playerY = player.getLocation().getBlockY();
            int playerZ = player.getLocation().getBlockZ();

            int x1 = playerX - 28;
            int y1 = playerY;
            int z1 = playerZ - 16;
            int x2 = playerX + 16;
            int y2 = playerY + 319; 
            int z2 = playerZ + 28;

            UUID ownerID = player.getUniqueId(); 

            CreateClaimResult result = griefPrevention.dataStore.createClaim(
                    playerWorld,
                    x1, x2, y1, y2, z1, z2,
                    ownerID,
                    null,
                    null, 
                    player
            );

            if (result.succeeded) {
                player.sendMessage("Claim created");
                griefPrevention.dataStore.saveClaim(result.claim);
            } else {
                player.sendMessage("Imposible to create claim");
            }
        }
        return true;

    }

}

echo basalt
#

ooh that's some weird math

lofty badge
hardy cairn
cyan sluice
sick edge
remote swallow
#

you should only have 1 class extending java plugin, you should only have 1 on Enable

hardy cairn
#

oh ok

remote swallow
#

as said, learn java or atleast the basics before using spigot

hardy cairn
#

okay

pale pulsar
icy beacon
# lofty badge I was a bad student and they told me that if I didn't write this, I would be exp...

If you actually need to write a bootloader (in which case I'm sending best wishes for your mental health), you can take a look at this guy who's got a detailed tutorial on how to create a rather simple operating system, where he explains how they work on a very low level: https://www.youtube.com/@writeyourownoperatingsystem
And I advise you take a look at this helpful wiki: https://wiki.osdev.org/Main_Page

#

If you study the process and do some additional research, you'll maybe be able to go with it somewhere

lofty badge
#

and guys, who can help with blueprints? i'm new in ue4, and want make crouch for my game

icy beacon
#

You are taking two extremes and putting them very close

#

You asked for help with a bootloader and then for help with unreal engine lol

remote swallow
#

i would love to know how ur managing to do a bootloader in assemble but cant make a project in intellij or read docs

icy beacon
#

This sounds like a hood joke

lofty badge
lost matrix
remote swallow
#

zbll ur sus

icy beacon
#

In what way πŸ‘€

remote swallow
#

in the way of message deletion

icy beacon
#

Well the server is English only so I deleted the message swiftly after I assumed it could be read

remote swallow
#

fair

lilac dagger
#

do min max on the locations and then - n on min and + n on max

lofty badge
pale pulsar
icy beacon
pale pulsar
#

i dont understand

lilac dagger
#

wait nvm, it's on playerlocation

lofty badge
lilac dagger
#

why is the x and z changed between the two points

#

?

lofty badge
remote swallow
#

unreal engine will take a fraction of the time making a bootloader will

icy beacon
#

I personally can't work on one project at a time because I get bored with it

remote swallow
#

thats called adhd

icy beacon
#

So I have to work on two projects concurrently so I always ahve something to work on

icy beacon
lost matrix
pale pulsar
lofty badge
#

help me make this blueprint..

icy beacon
pale pulsar
remote swallow
sick edge
#

InventoryClickEvent not firing

icy beacon
lost matrix
quiet vector
silent slate
#

Hi, im doing a mute plugin with this as my mute handeling. Ive already tested the background stuff, the mutes are getting saved to the file and ive checked it with both java and bedrock accounts (geysermc) and its not working on both.

Problem: I can still write although being muted:

Code: ```java
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onSpeak(AsyncPlayerChatEvent e) throws ParseException {
if(!DataConfiguration.INSTANCE.getData().contains("Data." + e.getPlayer().getUniqueId())) return;
e.setCancelled(MuteUtils.muteCheck(e.getPlayer()));
}

grim hound
#

very little

#

information

#

also why would you need to not ignore the cancelled event? What if there's another antiswear plugin that has already cancelled that event and you just allowed him to speak if he's not muted

silent slate
#

well there is no other antiswear plugin, i just need to know why i can still speak, although being muted in the system

grim hound
#

you never showed the system

#

just one event of two classes with having no idea of how they work

#

don't worry, we won't steal your code

#

Just from looking at this I can tell it's not worth stealing

silent slate
#

doesnt make sense, right..

This is the backend data:

Data:
UUID1_CENSORED: '2023-10-07 22:16:59'
UUID2_CENSORED: '2023-10-07 22:30:55'

Shows both my accounts are banned until 2 hours

MuteUtils.muteCheck does this:

public static boolean muteCheck(Player p) throws ParseException {
        Date dNow = new Date();
        Date endMuteDate = getDateTimeFormat().parse(DataConfiguration.INSTANCE.getData().getString(DATA + p.getUniqueId().toString()));

        int test = Objects.requireNonNull(endMuteDate).compareTo(dNow);
        if ((test == 0) || (test < 0)) {
            unmutePlayer(p);
            return false;
        }

        long timeIn = endMuteDate.getTime() - dNow.getTime();
        p.sendMessage(ChatColor.AQUA + "Laser Network " + ChatColor.GRAY + "Β» " + ChatColor.RED + "You are currently muted! Please wait " + TimeUtils.calculateTime(timeIn));
        return true;
    }

grim hound
#

you can just

#

save the System.currentTimeMillis + theMutedTimeInMillis

hazy parrot
#

Have you tried printing MuteUtils.checkMute

silent slate
#

well im a beginner and i try to learn by projects, even if its more complicated, if i understand it better i can learn more

hazy parrot
#

Also this looks like static abuse

silent slate
#

doing that rn

grim hound
#

that's how I made the most basic mutes

#

but they're also pretty much the fastest this way

grim hound
#

Using static methods?

hazy parrot
#

Using statics in context where there shouldn't be static

remote swallow
#

read this

hazy parrot
#

MuteUtils

silent slate
#

im working on it

grim hound
hazy parrot
#

It's having some state, which shouldn't exist in static context

silent slate
#

so im using this

if(MuteUtils.muteCheck(e.getPlayer()) == false) {
e.getPlayer().sendMessage("is false");
}

and am writing in chat, but nothing happens, even if i change it for true in the if clause, nothing happens

lilac dagger
#

i recommend you use ! in front instead of == false

grim hound
#

that's just basic knowledge

lilac dagger
#

it might be the muteCheck wrong

grim hound
silent slate
#

Bukkit.getPluginManager().registerEvents(new PlayerListener(),this);

#

ye

grim hound
#

in the onEnable() method?

silent slate
#

yes

#

this si onEnable

public void onEnable() {
        try {
            registerCommands();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

        DataConfiguration.INSTANCE.init(this);
        DataConfiguration.INSTANCE.saveData();
        Bukkit.getPluginCommand("tempmute").setExecutor(new mute());
        Bukkit.getPluginCommand("unmute").setExecutor(new unmute());
        Bukkit.getPluginManager().registerEvents(new PlayerListener(),this);

    }```
grim hound
grim hound
pale pulsar
grim hound
#

but for now it'll suffice

silent slate
#

well there are only 2 returns

grim hound
#

you always put debugs

silent slate
#

1 = false if the dates are before each other or same

and true are when its not the case

grim hound
#

before each return

silent slate
#

well i can send a message if that helps with debugging

grim hound
#

yes

#

definitely

#

do that

silent slate
#

well i get an error now when i use plugman to reload the plugin

#

!paste

#

/paste

#

how does this work

grim hound
#

?paste

undone axleBOT
silent slate
#

and also its neither showing the debug

grim hound
#

do you use PlugManX?

silent slate
#

ye

#

i guess

#

yes

lost matrix
#

Why dont you just claim the chunk the player stands currently in?

lethal coral
#

if I have a final itemstack and I give it to players then modify something about that itemstack will it affect the itemstack in every inventory?

river oracle
#

the final modifier on item stacks really doesn't do anything other than say yo I can't assign this reference to anything else while I use it

lethal coral
#

yeah I just said it so you understood the context of what I'm saying

river oracle
#

ItemStacks are inherently mutable so always be careful when editing them while there is no guarentee it will change all of the items as some are coppied it may adversly affect some

lethal coral
#

so does it not clone the itemstack when you add it to an inventory?

eternal oxide
#

it depends

river oracle
eternal oxide
#

it could hold the reference, it could clone it or it could merge with another stack

pale pulsar
silent slate
#

so ill get back to my problem tomorrow, im tired rn

grim hound
#

is there a way

#

to stop player data loading?

#

of only certain players

river oracle
#

remove their dat files

#

I'd assume that's the only realistic way

grim hound
#

without removing their files

#

I only want to stop it's loading for certain points in time

#

and then load it if I deem them fit

#

cuz there is Player#loadData

lost matrix
grim hound
#

and that is

#

without direct server code modification

thin iris
lethal coral
grim hound
#

your main plugin class

thin iris
#

yeah but where do i put my image

pale pulsar
grim hound
#

wait, lemme help you out

#
    public static File getWithJarCompiledFile(String s) {
        File f = getPluginFile(s);
        try (InputStream in = YourMainClass.class.getClassLoader().getResourceAsStream(s)) {
            Files.copy(in, f.toPath(), StandardCopyOption.REPLACE_EXISTING);
            return f;
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public static File getPluginFile(String fileName) {
        String path = YourMainClass.instance.getDataFolder().getAbsolutePath();

        new File(path).mkdirs();

        return new File(path + File.separator + fileName);
    }
#

do

lost matrix
grim hound
#
File imageFile = getWithJarCompiledFile("test.png");
if(!imageFile.exists()) imageFile.createNewFile();
#

and just add whenever to your project a test.png file

thin iris
grim hound
#

returns this folder

thin iris
grim hound
#

yes

lost matrix
# pale pulsar but how ? If you know
    Chunk chunk = player.getLocation().getChunk();
    World world = chunk.getWorld();
    Block lowest = chunk.getBlock(0, world.getMinHeight(), 0);
    Block highest = chunk.getBlock(15, world.getMaxHeight(), 15);
    
    // The rest should be self-explanatory
echo basalt
#

oh yeah chunk.getBlock is a thing

halcyon hemlock
#

Can't you just .clone

fluid river
#

jree fava

halcyon hemlock
#

Wut

odd lark
#

Hello, do you know if there is a way to have the messages in the server's language without creating a translation file ourselves?

for example I have: String description = event.getAdvancement().getDisplay().getDescription();
but this message is in English, I would like it in the language of the server

fluid river
#

tho you can try sending player some shit via packets

#

so client will adapt it to user's language

past rune
odd lark
past rune
fluid river
#

does server actually have region/language setting tho?

past rune
#

should have it it'll make it easier

fluid river
#

idk how you want it to look like

#

clients have own language settings

past rune
#

i can help u make the custom languages @odd lark

fluid river
#

imagine getting achievements on chinese when playing on russian client

odd lark
#

It's a shame, since Minecraft offers to choose your language, I told myself that there was the possibility of recovering their translation file. it is to send the messages of death and success

past rune
#

are u using google translate

fluid river
#

but your code will turn into ```java
if locale == english {

} else if locale == chinese {

} else {}```

odd lark
slate tinsel
#

Hello! Anyone have any idea why my server crashes after I reload the world if asking about the highest block?

so, I first delete the world with "deleteFolder" and then create it with "createWorld"

TestPlugin.getInstance().custom.getHighestBlockAt(1, 1)```

```java
    public static void createWorld(String worldName, Long seed, ChunkGenerator generator) {
        WorldCreator wc = new WorldCreator(worldName);
        if (seed != null) wc.seed(seed);
        if (generator != null) wc.generator(generator);
        Bukkit.createWorld(wc);
    }

    public static void deleteFolder(String worldName) {
        World world = Bukkit.getWorld(worldName);
        if (world == null) return;
        File folder = world.getWorldFolder();
        Bukkit.unloadWorld(world, false);
        try {
            FileUtils.deleteDirectory(folder);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }```
fluid river
#

you need to load the world with a player ig

slate tinsel
#

I've tried it doesn't seem to help unfortunately, but everything works if I just restart the server then there's no problem with the server crashing

fluid river
#

well then restart the server after reloading world πŸ™‚

slate tinsel
#

So if I find the highest block immediately after generating the world without restarting the server crashes, if I restart the server after generating the world it works

slate tinsel
lost matrix
lost matrix
echo basalt
#

I remember I had that issue with my skyblock stuff

#

and my cosmos project still trips up so I've just decided to give it a temp tag and delete tagged worlds on startup too

lost matrix
#

Yeah i also just tag worlds for removal and try to not reuse folders

#

Doesnt prevent the lag from IO on the main thread tho

echo basalt
#

I've gone with the "copy .mca files and load the world" approach before

#

that was fun

slate tinsel
lost matrix
restive mango
#

If you get several blocks in an unloaded chunk and change them in one tick, it will only load that chunk once, right?

slate tinsel
lost matrix
slate tinsel
shadow gazelle
#

It's in the spigot.yml

minor grotto
#
[ERROR] Plugin org.apache.maven.plugins:maven-checkstyle-plugin:3.3.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-checkstyle-plugin:jar:3.3.0: 1 problem was encountered while building the effective model
[ERROR] [FATAL] Non-parseable POM C:\Users\User\.m2\repository\org\apache\maven\plugins\maven-checkstyle-plugin\3.3.0\maven-checkstyle-plugin-3.3.0.pom: only whitespace content allowed before start tag and not \u0 (position: START_DOCUMENT seen \u0... @1:2)  @ line 1, column 2
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
#

Why are you getting this error when trying to compile bungeecord?

fluid cypress
#

is there a way to store data within an item or block, like a string, and make it persistent? meaning, it keeps that data or info when putting it on and breaking it again, when changing inventory, idk moving it through hoppers, etc

odd lark
#

How do we get the β€œverified” role? because I followed all the steps but I got nothing and it is impossible to start again because the bot tells me that I have already verified

hazy parrot
#

There is also

#

?blockpdc

undone axleBOT
fluid cypress
# hazy parrot ?blockpdc

it seems to be just what i need, but will it still work when, for example, plugins that modify blocks with nms and magic, like fast async world edit, make modifications to those blocks?

mighty mason
#

Hello, question: Is there a reason or a way to avoid "'\t" in Bukkit to show a weird character

#

I need to tabulate a formatted string, but its showing me a weird character

pseudo hazel
#

add 4 spaces

keen olive
#

hello, does anyone know why spigot().setUnbreakable(true) mess with the item texture?

fluid cypress
#

i want to allow players to place mob spawner in survival, so i did this in the block place event

BlockStateMeta blocKStateMeta = (BlockStateMeta) event.getItemInHand().getItemMeta();
CreatureSpawner itemSpawner = (CreatureSpawner) blocKStateMeta.getBlockState();
CreatureSpawner blockSpawner = (CreatureSpawner) event.getBlockPlaced().getState();

blockSpawner.setSpawnedType(itemSpawner.getSpawnedType());
blockSpawner.setSpawnRange(itemSpawner.getSpawnRange());
// all setStuff(getStuff) methods...
blockSpawner.update();

it works, but there is no method to specify things like if the mob has passengers, armor, effects, etc. how can i do that? is there a way to literally just copy everything and thats it? or even better, disable the "no survival spawners feature"

#

btw i should clarify i dont fully understand the difference between block state, block data, block metadata, item meta, and all that stuff, not very familiar with spigot and minecraft development in general

river oracle
#

Is this not offered with item meta

pseudo hazel
#

does anyone here happen to hae experience with changing default vanilla terrain generation?

#

I think maybe there is an easy way using nms but I havent found it yet

#

I just want to make smaller biomes

keen olive
river oracle
#

who knows unsupported version unsupported behavior ig

keen olive
#

yeah, but was looking for someone who maybe had a similar issue? lol

young knoll
#

Unbreakable stuff has a different predicate in a resource pack

keen olive
#

seems like it was an incompatibility between plugins

mighty mason
#

Is there any symetric Minecraft font?

quaint mantle
#

has anyone here used kong as a load balancer before?

ivory sleet
#

i have wanted to try it out but no sadly

kind hatch
#

Anybody up to date on the recent Advancement NMS changes? I think I need to serialize the advancement now, but I don't know how.

remote swallow
#

For toasts?

#

I think i added stuff for that to jefflib 1.20.w

#

1.20.2

kind hatch
#

Yea, I need toasts, but I'm struggling with the new requirements for criteria.

#

Criterion used to provide a ResourceLocation. There was no need to serialize since the impossible trigger just ignored it anyways.

#

Now it's requiring a manual trigger which doesn't even provide the ability to set a predefined one.

#

@remote swallow If you have this figured out, just shoot me a message.

quiet vector
#

Is there a way to get TPS?

remote swallow
kind hatch
minor grotto
#
[WARNING] The POM for org.apache.maven.plugins:maven-checkstyle-plugin:jar:3.3.0 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for BungeeCord-Parent 1.20-R0.2-SNAPSHOT:
[INFO]
[INFO] BungeeCord-Parent .................................. FAILURE [  0.610 s]
[INFO] BungeeCord-Chat .................................... SKIPPED
[INFO] BungeeCord-Config .................................. SKIPPED
[INFO] BungeeCord-Event ................................... SKIPPED
[INFO] BungeeCord-Protocol ................................ SKIPPED
[INFO] BungeeCord-API ..................................... SKIPPED
[INFO] BungeeCord-Log ..................................... SKIPPED
[INFO] BungeeCord-Native .................................. SKIPPED
[INFO] BungeeCord-Query ................................... SKIPPED
[INFO] BungeeCord-SLF4J ................................... SKIPPED
[INFO] BungeeCord-Proxy ................................... SKIPPED
[INFO] BungeeCord-Bootstrap ............................... SKIPPED
[INFO] BungeeCord Modules ................................. SKIPPED
[INFO] cmd_alert .......................................... SKIPPED
[INFO] cmd_find ........................................... SKIPPED
[INFO] cmd_kick ........................................... SKIPPED
[INFO] cmd_list ........................................... SKIPPED
[INFO] cmd_send ........................................... SKIPPED
[INFO] cmd_server ......................................... SKIPPED
[INFO] reconnect_yaml ..................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.836 s
[INFO] Finished at: 2023-10-08T00:29:24-03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-checkstyle-plugin:3.3.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-checkstyle-plugin:jar:3.3.0: 1 problem was encountered while building the effective model
[ERROR] [FATAL] Non-parseable POM C:\Users\User\.m2\repository\org\apache\maven\plugins\maven-checkstyle-plugin\3.3.0\maven-checkstyle-plugin-3.3.0.pom: only whitespace content allowed before start tag and not \u0 (position: START_DOCUMENT seen \u0... @1:2)  @ line 1, column 2
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
#

why?

eternal oxide
#

corrupt pom by the looks

#

C:\Users\User\.m2\repository\org\apache\maven\plugins\maven-checkstyle-plugin\3.3.0\maven-checkstyle-plugin-3.3.0.pom

#

why not GameRule.DO_INSOMNIA?

quartz goblet
#

does anyone know why this code would have the rotation apply instantly and not over time (interpolation isnt working)

        BlockData blockData = Bukkit.createBlockData(Material.DIAMOND_BLOCK);
        bd.setBlock(blockData);

        Display disp = (Display) bd;

        transformationLeft(p, disp, new Vector(0,1,0),  0.785F);

    }

    public void transformationLeft(Player player, Display entity, Vector axis, float angle) {
        entity.setInterpolationDuration(40);
        entity.setInterpolationDelay(-1);
        Transformation transformation = entity.getTransformation();
        transformation.getLeftRotation()
                .set(new AxisAngle4f(angle, (float) axis.getX(), (float) axis.getY(), (float) axis.getZ()));
        entity.setTransformation(transformation);
    }``` no stack dump or anything
past rune
#

and raise an issue flag to the original github source

past rune
quartz goblet
vocal cloud
#

All entities essentially tick since that's what makes them entities. Do Block Displays not tick? That'd be interesting to see

eternal oxide
#

they must tick as they have an interpolation/delay

hardy cairn
#

import SpeedGem.SpeedGemItem;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeInstance;
import org.bukkit.attribute.AttributeModifier;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerItemHeldEvent;
import org.bukkit.event.player.PlayerSwapHandItemsEvent;
import org.bukkit.inventory.ItemStack;

import java.util.UUID;

public class SpeedGemEventListener implements Listener {

    


    @EventHandler
    public void AbilitySpeed(PlayerSwapHandItemsEvent event) {
        System.out.println("Event is working!");
        // Check if the player has a Speed Gem in their offhand
        ItemStack offhandItem = event.getPlayer().getInventory().getItemInOffHand();
        if (!offhandItem.isEmpty() && offhandItem.isSimilar(SpeedGemItem.createSpeedGem())) {
            System.out.println("Speed Gem Detected");

            // Get the player's movement speed attribute
            AttributeInstance movementSpeed = event.getPlayer().getAttribute(Attribute.GENERIC_MOVEMENT_SPEED);

            // Check if the attribute is not null
            if (movementSpeed != null) {
                // Apply the "Speed" attribute
                AttributeModifier speedModifier = new AttributeModifier("Speed Gem", 2.0, AttributeModifier.Operation.ADD_NUMBER);
                movementSpeed.addModifier(speedModifier);
            }else {
                
             }

            }
            }
        }``` i have made a modifier for whenever somone have this item in their offhand but how do i remove the modifier if they remove this item from there offhand or dont have it in there offhand?
quaint mantle
#
public class scoreboard implements Listener {

    @EventHandler

    public void scoreboardJoin(PlayerJoinEvent e) {
        new BukkitRunnable() {
            @Override
            public void run() {
                Player p = e.getPlayer();
                ScoreboardManager manager = Bukkit.getScoreboardManager();
                Scoreboard sb = manager.getNewScoreboard();
                Objective obj = sb.registerNewObjective("spawn", "spawn", ChatColor.YELLOW + "Survival");
                Score nick = obj.getScore("Nick: " + p.getDisplayName());
                Score przerwa = obj.getScore("---------------");
                przerwa.setScore(5);
                nick.setScore(4);
                Score rank = obj.getScore("ranga: soon");
                rank.setScore(3);
                Score przerw = obj.getScore(" ");
                przerw.setScore(2);
                Score serv = obj.getScore("PlaygroundHC.PL");
                serv.setScore(1);
                p.setScoreboard(sb);
            }
        }.runTaskTimer(plugin, 0, 100);

    }
}```
why this code doesn't work?
#

?

chrome beacon
#

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

quaint mantle
#

?paste

undone axleBOT
quaint mantle
placid moss
#

Nobody can help you if you don't tell us what is not working

quaint mantle
#

i can't see scoreboard in game

#

and an error

#

cannot find symbol

#

in ide

#

and i can't build jar file

#

becouse of this error

glad prawn
#

bro stop spamming

#

i saw your code 4 times

hardy cairn
#

thanks but this is not what im looking for

glad prawn
#

just like that lol

quaint mantle
#

?paste

undone axleBOT
quaint mantle
#

server engine: paper 1.17.1

hardy cairn
#

anyway i figured it out on my own

peak depot
peak depot
#

but if im not mistaking I think you need to set the DisplaySlot

scenic onyx
#

how i can get Fish by "PlayerFishEvent"???

scenic onyx
# tall dragon https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerFishEvent...

because "@EventHandler
public void PlayerFishBreak(PlayerFishEvent event) {
Player player = event.getPlayer();
if (!isInProgress(player)) return;
if (!playerFishHashMap.containsKey(player)) return;

    if (event.getState() == PlayerFishEvent.State.CAUGHT_FISH) {
        EntityType fish = event.getCaught().getType();
        if (!fish.equals(playerFishHashMap.get(player))) return;
    }


    int remaining = remainingAmount.get(player) - 1;
    remainingAmount.put(player, remaining);
    addBossbar(player, "Β§aΒ§lYou still have to fish "+ remaining + " " + playerFishHashMap.get(player).toString().toLowerCase() +  "!", maxAmount.get(player), remaining);
    if (remaining == 0) {
        stopQuest(player);
        addBossbar(player, "Β§aΒ§lYou have completed The quest!", 100, 100);
        Bukkit.getScheduler().runTaskLater(QuestAddon.getInstance(), () -> removeBossbar(player), 20L);
    }
}" dont go?
tall dragon
#

please properly format it

scenic onyx
#

?paste

undone axleBOT
tall dragon
#

or that

tall dragon
#

so whats the problem

scenic onyx
tall dragon
#

yea but nothing will be caught

scenic onyx
tall dragon
#

your code still counts it because ur only returning out of the event when the player HAS caught a fish

#

when its anything other then caught_fish also return out

scenic onyx
#

aaa

#

i do if(!event..) return; ??

tall dragon
#

i would do it like this:

        if (event.getState() != PlayerFishEvent.State.CAUGHT_FISH) return
        EntityType fish = event.getCaught().getType();
        if (!fish.equals(playerFishHashMap.get(player))) return;
scenic onyx
#

yes yes

#

ok, tnx very much

tall dragon
#

πŸ‘

paper viper
#

Is there a way to set the block loot in code
something like
table.put(Material.Cobblestone, new ItemStack(Material.Dirt));

remote swallow
solid apex
#

Is there a way to give players the operator items tab without giving them OP?

peak depot
solid apex
#

The Creative Operator Items Tab

thorn saffron
#

???

solid apex
#

What?

thorn saffron
#

nvm

pale pulsar
# lost matrix ```java Chunk chunk = player.getLocation().getChunk(); World world = chu...

I have the same error it claims in 8x8

public class Commandclaim implements CommandExecutor {

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (sender instanceof Player) {
            Player player = (Player) sender;

            GriefPrevention gp = GriefPrevention.instance;


            Chunk chunk = player.getLocation().getChunk();
            World world = chunk.getWorld();

            
            Block lowest = chunk.getBlock(0, 0, 0);
            Block highest = chunk.getBlock(15, world.getMaxHeight(), 15);
            UUID ownerID = player.getUniqueId();

            CreateClaimResult result = gp.dataStore.createClaim(
                    world,
                    lowest.getX(), lowest.getY(), lowest.getZ(),
                    highest.getX(), highest.getY(), highest.getZ(),
                    ownerID,
                    null,
                    null, 
                    player
            );

            if (result != null) {
                player.sendMessage("Claim créé avec succès !");
            } else {
                player.sendMessage("La crΓ©ation du claim a Γ©chouΓ©.");
            }

        }
        return true;

    }

}
minor jetty
#

Yo

#

I want to ask how can i redirect connecting player

#

To the server

#

Or run multiple proxies on the same port

#

And when player is connecting to one of them

#

It choose the proxy with less load

quaint mantle
silent slate
minor jetty
#

Netty pipeline will do kaboom

quaint mantle
minor jetty
#

Or you just telling me what someone told you on the form

#

Or smt

silent slate
# silent slate So im back with my Problem, to make it short: i can write although being muted b...

this is my mute check player:

public static boolean muteCheck(Player p) throws ParseException {
        Date dNow = new Date();
        Date endMuteDate = getDateTimeFormat().parse(DataConfiguration.INSTANCE.getData().getString(DATA + p.getUniqueId().toString()));

        int test = Objects.requireNonNull(endMuteDate).compareTo(dNow);
        if ((test == 0) || (test < 0)) {
            unmutePlayer(p);
            Logger.getLogger("warn").info("test1");
            return false;
        }

        long timeIn = endMuteDate.getTime() - dNow.getTime();
        p.sendMessage(ChatColor.AQUA + "Laser Network " + ChatColor.GRAY + "Β» " + ChatColor.RED + "You are currently muted! Please wait " + TimeUtils.calculateTime(timeIn));
        Logger.getLogger("warn").info("test2");
        return true;
    }```

Ive already checked my backend stuff works the mute things get saved to a file and that works, but it doesnt really check anything and the logging debugs dont get logged.
#

Although im muted i can write in chat

#

(cant send the picture)

#

ping if answer pls

silent slate
#

ik

#

xD

#

im a beginner and tried to learn by making the projects

ivory sleet
#

Thats fine

#

Thats how it should be

minor jetty
tender shard
#

yeah well then it's okay, I will give you some suggestions of why I think your code is bad:

  1. inproper variable names. "dNow" should be "now" or "dateNow". "endMuteDate" is a good name
  2. you're testing if test == 0 ||test < 0. Why not just test if it's <= 0 ?
  3. Logger.getLogger("warn") what's that?
  4. the method is called "muteCheck" so it should only CHECK for a mute - it should not be reponsible for sending a message
  5. the message should ofc be configurable
#

a good thing is that you used ChatColor instead of hardcoded Β§c things. But I wonder why are are you rethrowing the ParseException? Where does it come from? And why are you Objects.notNulling the endMuteDate ?

silent slate
#

okay, well i understand the first but i dont want a config system because i havent learned it yet and only need to plugin for my own server so i dont need a config

tender shard
#

ok no problem

#

the other stuff is valid though

silent slate
#

yes

#

but i still dont know why the AsyncChat thing isnt firing and cancelling the packet

#

its not even showing the debug msgs

tender shard
#

the message definitely should not be sent within the muteCheck method itself, or you shuold rename the method to checkMuteOrSendMessage or sth

tender shard
silent slate
#

thats the event stuff:

@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
    public void onSpeak(AsyncPlayerChatEvent e) throws ParseException {
        if(!MuteUtils.muteCheck(e.getPlayer())) {
            e.getPlayer().sendMessage("is false");
        }
        if(!DataConfiguration.INSTANCE.getData().contains("Data." + e.getPlayer().getUniqueId())) return;
        e.setCancelled(MuteUtils.muteCheck(e.getPlayer()));
    }
}
#

i have done the "is false" for debugging

#

but its not showing

minor jetty
#

First you need to save somewhere the players that are mutted

silent slate
#

i did that

#

in a file and its showing that in the file

#

i tested it already

minor jetty
#

So you should read it from the file in muteCheck method

tender shard
silent slate
#

so i have a DataConfiguration class for that

minor jetty
#

Or put it when plugins starts from file to List and when plugins disable put list to file

tender shard
silent slate
#

i have heard that before but need to learn what it means

minor jetty
#

Don't use static all the time

tender shard
#

what's the goal of your plugin? I suggest you rewrite it from scratch and we do everything step by step, then we can explain things to you better

minor jetty
#

Static is only for methods that you want to have acces all over your project

#

Like some MathHelpers etc.

silent slate
#

i want to have a mute system, i already did ban, kick and unban

#

you prob wont like the others cause theyre very messy written

tender shard
#

Many people are going crazy whenever they see the static keywoard inside some source code. That’s ridiculous, because it alleges the people who developed Java were totally stupid. It is true that the static keyword gets abused by many people, but there’s a difference between static abuse and proper use of the keywoard. What does...

quaint mantle
# silent slate you prob wont like the others cause theyre very messy written

Better way to do this.

interface MuteInfo {
/*
Returns time stamp
*/
  long expire();
}
// database
interface MutedRepo {
  MuteInfo getMuteInfoOf(UUID uuid);
  void removeMuteInfo(UUID uuid);
}
//logic
public boolean isPlayerMuted(Player player) {
  MuteRepo repo = myMainInstance.getMuteRepo();
  MuteInfo muteinfo = repo.getMuteInfoOf(player.getUniqueId());
  
  if (muteInfo.expire() > System.currentTimeInMills()) {
    player.sendMessage("You muted blah blah blah, mute expires at " + SomeUtilParser.parse(muteInfo.expire()))
    return true;
  }
  repo.removeMuteInfo(player.getUniqueId()); // order to remove.
  return false;
}

|| πŸ₯„ ||

tender shard
#

"static" is for things that do not need any instance access

ivory sleet
tender shard
#

you should be passing an instance instead or use a proper singleton pattern

silent slate
#

bedrock just crashed when i opened chat, like it

ivory sleet
#

Some common allowed static usages are

  • utility classes
  • nested classes
  • pure/stateless methods
  • static factory methods
  • singletons
  • multitons
  • constants
  • immutable collections that live a long life
silent slate
#

i get an internat error when i did this debug thing

tender shard
#

a utility class is only a utility class if it does not require any instance of anything else, otherwise it's just a fake utility class

silent slate
#

i have this:

public void onSpeak(AsyncPlayerChatEvent e) throws ParseException {
        e.getPlayer().sendMessage("Test works");
        if(!MuteUtils.muteCheck(e.getPlayer())) {
            e.getPlayer().sendMessage("is false");
        }
        if(!DataConfiguration.INSTANCE.getData().contains("Data." + e.getPlayer().getUniqueId())) return;
        e.setCancelled(MuteUtils.muteCheck(e.getPlayer()));
    }```

and now i get a error when i try to mute someone
tender shard
ivory sleet
#

Well there are many fake utility classes, because just because a method doesn’t require an instance doesn’t imply its a utility

lilac dagger
#

what's an example of an immutable collection that lives a long time?

tender shard
# silent slate i have this: ```java public void onSpeak(AsyncPlayerChatEvent e) throws ParseExc...

Most people who get started with Spigot development somehow think it’s a good idea to make everything as short as possible (at least in terms of naming variables). This is considered bad practice for a good reason. What’s the problem? Let’s imagine this is your code: In this example, it is obvious in line 4...

ivory sleet
#

for instance VarHandle.loadLoadFence()

tender shard
ivory sleet
#

Thats a utility method in principle

#

But its stateful

tender shard
#

(not that I wouldnt often do this myself, but I don't think it's good)

#

I'm also a chronic alcoholic, doesn't mean that I think drinking is good

ivory sleet
ivory sleet
#

but myeah presumably bad oop design

tender shard
#

I like thinking in objects

ivory sleet
#

Because java have introduced and is encouraging other paradigms

eternal night
#

I like

ivory sleet
#

Like functional and data oriented programming

#

Yeah its just objects I know

tender shard
#

oh yeah sure that exists but I never found a use case for that in like stuff like spigot plugins or desktop applications or similar

ivory sleet
#

But the semantic style is there

eternal night
#

I mean, it is pretty subjective how you use the language

tender shard
#

aint nobody gonna use haskell to rewrite JDownloader lol

ivory sleet
#

Haven’t seen much written in haskell when it comes to the actual industry

#

i mean there is a project here and there

tender shard
#

the closest thing that is still barely acceptible to me as "stateful util class" is like the Bukkit class as the server itself is a singleton

ivory sleet
#

That’s the biggest fake utility class true

#

More like a static helper

eternal night
#

I mean, you can literally go full functional in java

tender shard
#

yeah it's handy but also pretty useless (the bukkit class)

tender shard
#

people could also be passing around the getServer() object but what's the point

#

Bukkit class is fine imho

ivory sleet
#

I do that

tender shard
#

I do that sometimes too

ivory sleet
#

since that gives me mockability against Server :>

tender shard
#

but mostly not lol

tender shard
ivory sleet
#

I refuse to use PowerMocks or anything weird

tender shard
#

MockBukkit is a mess and I hate it

ivory sleet
tender shard
#

I still use it because I don't wanna completely rewrite all my 2018 plugins

ivory sleet
#

Trying to avoid pushing all my tests onto it

#

Like if a test is testable without emulating the server environment

#

Then heck yeah

tender shard
#

in my newer stuff I tend to use so many modules that basically nothing depends on bukkit anymore besides an adapter class and a basic plugin loader

#

gradle is a curse and a blessing

ivory sleet
#

Yeah right, so then you decoupled yourself enough to not having to rely on MB

#

Yeah

#

Gradle is nice but I hate it at the same time

tender shard
#

I think this applies to every gradle user

ivory sleet
#

Most definitely lol

tender shard
#

worst choise they ever made was the toolchains forcing to use -release instead of -source and -target as compiler args

#

at least this applies if you do stuff like spigot plugins where you wanna support both 1.16 and 1.20

#

I think toolchains should at least give you the option to not be forced to use -release

ivory sleet
#

Isnt sourceCompatibility and targetCompatibility a thing? Or was it that feature which got deprecated for removal?

tender shard
#

sure but not if you use toolchains

ivory sleet
#

Ah yea okay

tender shard
#

if you set the toolchain to e.g. JavaVersion.of(17) then it sets -release to 17 and if you then try to set an additional source or targetCompat it says "no you cannot use this option together with -release"

ivory sleet
#

Oh yeah thats true

tender shard
#

that's why I refuse to use paperweight

ivory sleet
#

Lol ok

#

Im sure there might be some hacky solution to it

#

But yeah

tender shard
#

yeah probably but I prefer to just use oldschool specialsource then instead

#

doesn't require any hacky workarounds

#

bad thing: it only gives you spigot-api
good thing: it does not force to use paper-api lol

#

in a perfect world, paper would just contribute upstream more but yeah I get it, people disagree with md bla bla and stuff

#

sorry I shouldnt have started this topic here lol

#

I know it's not a very popular discussion here lol

ivory sleet
#

Idk

#

I just try to keep myself out of the drama

lost matrix
chrome beacon
#

Gradle always breaks

lost matrix
pale pulsar
#

okay

silent slate
#

finally

#

this is a dc bug

#

if u send a msg thats really long and then cluck on "make it a file" but you dont have perms to send files you cant see the file and cant remove it and cant every write in the channel again if u not verify and get perms

#

but back to my question

#

?paste

undone axleBOT
chrome beacon
#

Plugman πŸ’€

silent slate
quaint mantle
chrome beacon
#

Use getCommand and make sure it's in your plugin.yml

silent slate
#

well i have commands registered that i havent created yet

#

is that the error

terse pumice
#

is there a way to get a plugins download version/link from the spigot api?

wary remnant
silent slate
#

so when i debug like this:

@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
    public void onSpeak(AsyncPlayerChatEvent e) throws ParseException {
        e.getPlayer().sendMessage("Test works");
        if(!MuteUtils.muteCheck(e.getPlayer())) {
            e.getPlayer().sendMessage("is false");
        }
        if(!DataConfiguration.INSTANCE.getData().contains("Data." + e.getPlayer().getUniqueId())) return;
        e.setCancelled(MuteUtils.muteCheck(e.getPlayer()));
    }```

And send a message it doesnt show "test works" in the chat
wary remnant
#

Did you register the event listener?

silent slate
#

yes

#

Bukkit.getPluginManager().registerEvents(new PlayerListener(),this);

silent slate
# silent slate Bukkit.getPluginManager().registerEvents(new PlayerListener(),this);
public class PlayerListener implements Listener {


    @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
    public void onSpeak(AsyncPlayerChatEvent e) throws ParseException {
        e.getPlayer().sendMessage("Test works");
        if(!MuteUtils.muteCheck(e.getPlayer())) {
            e.getPlayer().sendMessage("is false");
        }
        if(!DataConfiguration.INSTANCE.getData().contains("Data." + e.getPlayer().getUniqueId())) return;
        e.setCancelled(MuteUtils.muteCheck(e.getPlayer()));
    }
}```
eternal oxide
#

you shoudl only do this if the event is not already cancelled e.setCancelled(MuteUtils.muteCheck(e.getPlayer()));

#

else you could be setting the cancelled state to false when another plugin has cancelled it

drowsy cosmos
#

Hi guys. I've this scenario here.

Player gets Slow 1 effect for 1 minute -> Player gets Slow 2 effect for 20 seconds -> Slow 2 effect wears out -> Slow 1 effect is seen as active.

How do I remove 20 seconds Slow 2 effect instantly before it wears out on its own, without removing the existing Slow 1 effect?

Using removePotionEffect removed the potion effect altogether.

trim elk
#

Guys I'm using smart Inventory API and I've come across a problem, when I put a list of items starting in the slot (1, 1) if I put fillBorders after setting the items, the items in the border will be above the items in my list and if I put it before, my items will be above the border, do you know how to solve this?

smoky oak
#

can u schedule sync from async or do i have to jump through hoops to get data back into the main thread

echo basalt
#

You can schedule it on another thread

lost matrix
# pale pulsar okay

To be honest, after seeing two lines of their code i would have dropped it and just built on top of WorldGuard instead.

kind hatch
remote swallow
#

from jefflib

smoky oak
#

man ive started hating diff lol

#

i want to see the whole class

young knoll
#

Proper advancement API when?

remote swallow
#

this is 1.20.2

#

this is 1.20.1

smoky oak
#

so

pale pulsar
smoky oak
#

they swapped one map for another

remote swallow
#

method changes

kind hatch
remote swallow
#

i think so

#

it adds it to the server through nms

#

@tender shard how does jefflib do toasts

kind hatch
#

That means I need a .json file to read from right?

remote swallow
#

this works of string json, but a file could work

kind hatch
#

That's fine. As long as I can actually send a toast, adding a file seems like a small price to pay.

lost matrix
lost matrix
tender shard
tender shard
#

without creating any files

ivory sleet
#

Can’t believe you got banned just cause of that

tender shard
ivory sleet
#

Anyway this is not the channel for those kinds or discussions

lofty badge
#

who can help mee?

lost matrix
ivory sleet
#

wait what? lol

lost matrix
shadow night
#

Is there a don't ask to ask command here

lost matrix
#

Sure

lofty badge
remote swallow
#

you got given docs yesterday

lost matrix
shadow night
#

I thought of "what" too

remote swallow
#

read the docs you got given yesterday

lost matrix
#

Then just call fillBorders after setting the items. Isnt that what you need?

#

@trim elk

kind hatch
trim elk
#

so, but the items on the border will overlap the items I placed before

quaint mantle
#

Hi everyone

I came across the problem that version 1.20.1 of NMS does not have the ClientBoundPlayerInfoPacket package...
Which package can I use instead of the outdated one?

trim elk
#

@lost matrix