#development

1 messages · Page 35 of 1

lyric gyro
#

works! tysm

signal grove
#

bukkit vectors are dumb, why would they modify and return

#

spent a while trying to figure out an issue because the original vector was modified

#

i guess ill just call clone() on everything

royal cypress
#

I found the version that clip made and decompiled it, seems to be pretty straight forward. Are you limited to only string based placeholders? Also are the calls for placeholders thread safe? meaning if an API action is calling a database call it is done outside the main server thread? Or is that not possible?

minor summit
#

What thread the expansion is called on is the same as the plugin requiring the placeholder ran PlaceholderAPI.setPlaceholders on

#

And the thread safety of the setPlaceholders call depends on what the expansions do

signal grove
#

hmm. this is close, but im not sure 100%. When it's shot, i set the arrow to be 100 ticks old (should be long enough to damage the player, but it still doesn't). Teleporting it behind the player and shooting slowly, it hits me, while shooting fast passes through me. This implies that it is time based, but not based on ticksLived.

#

maybe i could spoof the projectile source to something else

#

or (everyone will hate this) have pre-spawned arrows take its place xD

#

i dont like either solution

floral beacon
floral beacon
#

Any ideas how to cancel properly bungee's ServerConnectEvent event?

minor summit
#

just cancel it? the event is cancellable

shell moon
#

true

floral beacon
#

this is what i get when i cancel it

#
net.md_5.bungee.util.QuietException: A plugin cancelled ServerConnectEvent with no server or disconnect.
#

until timeout
[02:38:17 INFO]: [Test2] disconnected with: ReadTimeoutException : null

#

i think i'm not doing anything special here, yet it just happens

minor summit
#

is this like an initial login connection? or server switching?

floral beacon
#

yes

#

initial

#

i just wanted to mention that like right while you were typing

minor summit
#

you should use the login event for that

floral beacon
#

but i need to check for specific server (target server)

minor summit
#

mm

floral beacon
#

how can i check the target server too

minor summit
floral beacon
#

yes

#

maybe connection.disconnect(?)

#

i'll give it a try

#

works 😄

#

thanks @minor summit

minor summit
#

nice

pure crater
#

Just wondering, is there a gradle plugin that can clone repos from Github and build them into your local maven/gradle repo?

#

I tried using Grgit and making my own method in kts but i failed miserably

#

And no, I'm not using Jitpack 🤢

dusty frost
#

it's a pretty cool system actually

ashen lodge
#

Basically, I made a custom mining system using packets. But if i mine with a pickaxe it will override and my canceling of block damage event doesnt work?

#

what shall i do

dusty frost
leaden sinew
ashen lodge
#

yes

#

they have mining fatigue -1

#

should it be 1?

#
@EventHandler
    public void blockDamage(final BlockDamageEvent e) {
        e.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOW_DIGGING, Integer.MAX_VALUE, -1, false, false), true);
        e.setCancelled(true);
    }```
signal grove
#

people arent allowed to break blocks at all?

ashen lodge
#

You talking to me?

signal grove
#

yes

ashen lodge
#

here ill make video

signal grove
#

just make sure that you also cancel a block break event. I'm not positive that cancelling all the damage events will stop a break event from happening with a laggy client

ashen lodge
#

heres the problem

#

the pickaxe mining speed

#

is like faster that the speed i made

#

so they get a glitch where they "break the block" but its not supposed to be broken yet so they have to continue breaking again

signal grove
#

what do you want to happen

ashen lodge
#

look dms for videop

signal grove
#

yes i see, what is the intended behavior though

ashen lodge
leaden sinew
#

I’m not sure I understand your issue though

edgy hearth
#

how to get category name from path
example

PlayerLevels:
  3ffc17e8-e417-30ef-80ce-4f9b1da4f0f6:
    guilda:
      Test:
        name: test2
        dono: zThyPvpTK

how to get "test" category in yml
I tried

``` but it returns null value, help pls
dark garnet
#

Database or collection?

dense drift
#

I meant table, sorry, so if you are using mongo that would be a collection

edgy hearth
# dark garnet `guilda` is not a string

in this case the guild is just to get the value inside with getstring, in this case the Test value would not be a string, my question is what would it be? and how can i pull

dusky wolf
#

Any ideas on why that won't return anything?

    @Override
    public String onPlaceholderRequest(Player p, String identifier) {

        if (p == null) {
            return "";
        }
        // %townywild_cooldown%
        if (identifier.equals("cooldown")) {
            return plugin.getConfig().getString("protection_time_after_exiting_town_border", "Not protected");
        }```

```java
    PROTECTION_TIME_AFTER_EXITING_TOWN_BORDER(
            "protection_time_after_exiting_town_border",
            "20",
            "# This is the amount of time in seconds, the player exiting the town border will have PvP protection for, during that time, the player cannot hit or get hit by other players.")```
I have this in my ConfigNodes
proud pebble
#

not onPlaceholderRequest

dense drift
#

maybe player is null?

#

dont do null checks for player if you dont need a valid player

proud pebble
#

that could be true

dusky wolf
#

would that be right?

#
    @Override
    public String onPlaceholderRequest(Player player, @NotNull String identifier) {
        if (identifier.equals("cooldown")) {
            long remainingTime = Integer.parseInt(getConfig().getString("protection_time_after_exiting_town_border")) * 20L;
            return Long.toString(remainingTime);
        }
        return "";
    }
}```
dusky wolf
#

protection_time_after_exiting_town_border is in ticks so it multiplies by 20 to get seconds

sharp ibex
#

is it possible and if how

tight junco
#

possible yes, how it entirely depends

#

most common way id think is a worldguard flag

#

but you could also define custom regions etc etc etc

dusky wolf
#

is there an easier way of doing a cooldown system?

#
    private HashMap<UUID, Long> scheduledRemovalTimes = new HashMap<>();

    public void scheduleRemoval(Player player, long time) {
        scheduledRemovalTimes.put(player.getUniqueId(), System.currentTimeMillis() + time);
    }

    public long getRemainingProtectionTime(Player player) {
        Long scheduledRemovalTime = scheduledRemovalTimes.get(player.getUniqueId());
        if (scheduledRemovalTime != null) {
            long remainingTime = (scheduledRemovalTime - System.currentTimeMillis()) / 1000;
            if (remainingTime > 0) {
                return remainingTime;
            }
        }
        return 0;
    }
.......................

    @Override
    public String onPlaceholderRequest(Player player, @NotNull String identifier) {
        if (identifier.equals("cooldown")) {
            return Long.toString(getRemainingProtectionTime(player));
        }
        return "";
    }
}```
#

this is what it looks like but it still doesn't seem to return anything

#

It takes it from a listener class I made before

    //create a map to store the scheduled removal time for each player
    private Map<UUID, Long> scheduledRemovalTime = new HashMap<>();

    @EventHandler
    public void on(PlayerExitsFromTownBorderEvent event) {
        UUID uuid = event.getPlayer().getUniqueId();
        protectedPlayers.add(event.getPlayer().getUniqueId());
        long scheduledRemovalTime = System.currentTimeMillis() + (Integer.parseInt(getConfig().getString("protection_time_after_exiting_town_border")) * 1000);
        scheduledRemovalTimes.put(uuid, scheduledRemovalTime);
        Bukkit.getScheduler().runTaskLater(plugin, new RemoveProtectedPlayerTask(uuid, protectedPlayers, scheduledRemovalTimes), Integer.parseInt(getConfig().getString("protection_time_after_exiting_town_border")) * 20L);```
opal geyser
#

Easier to get it and no need to worry on how to save on server shutdown.

dusky wolf
#

yeah but it isn't a cooldown for a command

#

basically when a player exits a town, his uuid is saved and he is protected from being attacked for a set amount of time

#

then after the timer, his uuid is deleted from the list

opal geyser
#

You can still use the PDC for it.
1 - you can have a task running to delete that from PDC. Though, here, y'd need to save which players still need to be checked due to server shutdowns.
2 - you said that the player is protected from being attacked for a set amount of time. You can check when the player get attacked and see if the "amout of time" have already passed. If so, remove the node from the PDC.

dusky wolf
#

Just a small question, what is PDC

#

it's my first plugin I'm doing so i'm still learning

dusky wolf
#

Thanks!

opal geyser
#

Yw

cinder hare
#

Can someone tell me why this isn't working? There's no errors or anything but when i join the server it doesn't say anything

#

package me.predatolian.bountyplugin.handlers;
import me.predatolian.bountyplugin.BountyPlugin;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;

public class PlayerHandler implements Listener {
public PlayerHandler (BountyPlugin plugin){
Bukkit.getPluginManager().registerEvents(this, plugin);
}

@EventHandler

public void PlayerHandleEvent(PlayerJoinEvent event){
    Player p = event.getPlayer();
    Location loc = p.getLocation();
    int x = loc.getBlockX();
    int y = loc.getBlockY();
    int z = loc.getBlockZ();
    Bukkit.getLogger().info("Player spawned at " + x + y + z);
}

}

dense drift
#

do you instantiate the class?

cinder hare
#

I don't know what that means

#

this is the first time i've ever tried doing anything with java/minecraft

dense drift
#

do you have new PlayerHandler(plugin); (or this instead of plugin) somewhere in your code?

cinder hare
#

uhh no

dense drift
#

ok, do that

cinder hare
#

where though

dense drift
#

in your onEnable method

cinder hare
#

oh

#

public final class BountyPlugin extends JavaPlugin {
@Override
public void onEnable() {
getLogger().info("Succesfully loaded");
new PlayerHandler(BountyPlugin);
}
}

#

It's giving me an error

dense drift
#

use this, not BountyPlugin.
this is an instance of the class where you use it - in this case, an instance of BountyPlugin - and BountyPlugin is a class.

cinder hare
#

thank you so much

dense drift
#

np

trail burrow
#

looking for code to remove a yml file

pure crater
#

Ughhh whatever

#

File#delete for java io
Files.delete for java nio

dusty frost
#

Files!delete for java jio

tired olive
#

Java jio on top

spiral prairie
#

jaja jio better imo

shell moon
#

If my plugin depends on adventure (which is available on paper only) but ofc i want it to work in spigot too

#

what would be the best way to do it?

dusky harness
#

would be so nice with kotlin extension functions 😌

dusky harness
#

I think most, if not everything should still work if you use legacy serializer with hex and bungee component serializer (or you can use nms and gson serializer)

shell moon
#

additionally, the fact that not only 1 of my plugins will use it, but at least 3 (and probably more in the future)

dusky harness
shell moon
#

maybe making a library (.jar) with adventure inside which can be updated when new versions of adventure appears without needing to shade it

#

and updating each plugin, would be a good idea?

dusky harness
#

yeah
they have the bukkit-platform which helps sending messages to players and console

#

wait what

#

I don't know about automatically updating adventure since it might have like breaking changes

shell moon
#

i mean, i doubt Component.of etc appendReplacements and other methods change in a future

#

probably internally, hence why updating just a .jar with the adventure inside

#

would be the better solution instead of updating every single plugin that has the library shaded

#

(saldy, making the plugin paper exclusive, is not an option, in case someone was going to say that)

dusky harness
#

is the plugin open source

#

a possibility is to setup github actions &/or repository-only bot to automatically update (the buildscript) and build the jar 💀

#

idk how easily slimjar/alternatives makes it easy to add custom libraries

#

might be really easy or hard

#

¯_(ツ)_/¯

shell moon
#

😮

#

i honestly have no idea how to do that tbh

#

i guess i'll just make a library .jar for now

#

until spigot shades adventure

dusky harness
shell moon
#

yeahhh, i think, at least maven and its relocation works for me :,v

dusky harness
#

🤔

#

ok

shell moon
cinder hare
#

nvm i found a solution

ashen lodge
#

Is it possible to change a block texture using a texturepack

dark garnet
ashen lodge
#

no

#

like some times its bedrock then some times it turns into redstone block

#

for say

#

didnt explain well

#

lol

#

@dark garnet

dark garnet
ashen lodge
#

do you know how i would do that?

dusky wolf
#

any idea for this?

#
        if (identifier.equals("countdown")) {
            return Long.toString(getRemainingProtectionTime((Player) player));```
this returns the seconds without anything, example: Protection time left: 5 (placeholder here)
#

But when I use this

#
    @Override
            public String onRequest(OfflinePlayer player, String identifier) {
                if (identifier.equals("countdown")) {
                    long remainingProtectionTime = getRemainingProtectionTime((Player) player);
                    long remainingProtectionTimeInSeconds = TimeUnit.MILLISECONDS.toSeconds(remainingProtectionTime);
                    if(remainingProtectionTimeInSeconds>60){
                        long remainingProtectionTimeInMinutes = TimeUnit.SECONDS.toMinutes(remainingProtectionTimeInSeconds);
                        return Long.toString(remainingProtectionTimeInMinutes) + " minutes";
                    }else{
                        return Long.toString(remainingProtectionTimeInSeconds) + " seconds";
                    }
                }
                return "";
            }
}```

It returns **0 seconds**
dusty frost
dusky wolf
#

Basically I set up the protection time in the config file

protection_time_after_exiting_town_border: '20'```
#

But it only outputs 0 seconds instead of doing it like

20
19
18
...

dusty frost
#

okay so check if TimeUnit.MILLISECONDS.toSeconds(remainingProtectionTime); is what you think it is

#

just have it return that first

dusky wolf
#
    @Override
    public String onRequest(OfflinePlayer player, String identifier) {
        if (identifier.equals("countdown")) {
            long remainingProtectionTime = getRemainingProtectionTime((Player) player);
            long remainingProtectionTimeInSeconds = getRemainingProtectionTime((Player) player);
            if (remainingProtectionTimeInSeconds > 60) {
                long remainingProtectionTimeInMinutes = TimeUnit.SECONDS.toMinutes(remainingProtectionTimeInSeconds);
                return Long.toString(remainingProtectionTimeInMinutes) + " minutes";
            } else {
                return Long.toString(remainingProtectionTimeInSeconds) + " seconds";
            }
            }
            return "";
        }
}```
#

this doesn't return 0

#

but the bossbar gets stuck for some reason

#
        public void startProgressUpdater() {
        progressUpdaterTask = Bukkit.getScheduler().runTaskTimer(this.plugin, new Runnable() {
                @Override
                public void run() {
                    Long scheduledRemovalTime = scheduledRemovalTimes.get(uuid);
                    if (scheduledRemovalTime == null) {
                        return;
                    }
                    long remainingTime = scheduledRemovalTime - System.currentTimeMillis();
                    if (remainingTime <= 0) {
                        run();
                        return;
                    }
                    BossBar bossBar = bossBars.get(uuid);
                    if (bossBar == null) {
                        return;
                    }
                    double totalProtectionTime = Integer.parseInt(Objects.requireNonNull(getConfig().getString("protection_time_after_exiting_town_border"))) * 1000L;
                    double progress = remainingTime / totalProtectionTime;
                    bossBar.setTitle(PlaceholderAPI.setPlaceholders(getPlayer(),bossBarText.replace("%townywild_countdown%", String.valueOf(remainingTime))));
                    bossBar.setProgress(progress);
                }
            }, 0L, 20L);
        }```
#

maybe my bossbar progress updater is wrong

grim oasis
#

y'all is it possible to find which .jar a plugin is coming from/loading from?

#

@true mountain has a plugin Custom Enchants that is loading and no idea where from

#

no .jar exists in the plugin directory

#

gah

#

we found it

#

smh

river solstice
# floral beacon any ideas?

I haven't tested it but,

for (Player player : Bukkit.getOnlinePlayers()) {
    player.setPlayerListHeaderFooter("", "");
    player.setPlayerListName(" ");
}

maybe?

#
    public static <T> T loadOr(File file, T def) {
        Object result;

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

        try {
            ObjectInputStream ois = new ObjectInputStream(new FileInputStream(file));
            result = ois.readObject();
            ois.close();
        }
        catch (Exception ex) {
            ex.printStackTrace();
            return def;
        }

        return (T) result;
    }
[13:12:11 WARN]: java.io.EOFException
[13:12:11 WARN]:        at java.base/java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2926)
...

any idea why I'm getting this?

#

stack trace says at new ObjectInputStream line.

tired olive
river solstice
#

well it's definitely not empty

#

even if I save default value before reading, I get the exception

sterile hinge
#

Don’t use the old file api, don’t close streams manually (use try-with-resources), probably don’t use java serialization

icy shadow
#

even better

shell moon
#

if my plugin needs to be configurable with custom GMT (yes, for date)
how would i make it exactly? was thinking about getting current machine time and then modify it to match specified GMT, any ideas?

river solstice
#

so I don't mind using it

#

just need some things to persist through restarts is all

dense drift
shell moon
#

mmmm if i want owners to be able to set
Local-gmt: "-5" (for example, for my country)

#

so they dont need to worry about machine time in dedicated/hosting

dense drift
#

You can do that, but id recomment to allow them to write any type of time zone, e.g. Europe/Bucharest for Romania instead of GMT+2 and GMT+3 for summer time

shell moon
#

issue is that people might make errors when editing that

#

in my case (iirc) is Bogota/Lima for GMT -5

#

but many people dont know what to write there

#

so if they fail, system will fail too right?

dense drift
#

Google exists

shell moon
#

You know how people is

#

I wanna make it for spigotmc

#

and ppl in spigotmc is kinda

dense drift
#

is just a time zone, is not a big deal

#

put this link in config and tell them to look for Continent/Capital or City or whatever that's relevant to their local time

#

and if they enter an invalid value, just fallback to the time of the machine

minor summit
#

for ZonedDateTime (more specifically ZoneId/ZoneOffset) you can input both Continent/City and GMT±n

dense drift
#

yup, exactly

spiral prairie
#

Why exactly are people still using DeluxeMenus?

broken elbow
dense drift
#

wrong channel also

spiral prairie
#

Are there any special features? Cause I'm currently searching for a good menu plugin to use xD

dense drift
#

whether a plugin is good "good" depends on your needs

proud pebble
#

tbh i very much enjoyed using deluxemenus, it has very good documentation

spiral prairie
#

I'll try it out, thank you

cinder hare
#

I'm trying to activate a loop inside of a switch case without stopping the switch case, does java have coroutines or something that can help me do this?

shell moon
#

Best way to make it players cannot only play for 1 hour and reset it at 00:00?

#

so if they play from 21:00 they are kicked at 22:00

stuck hearth
#

Schedule a task

shell moon
#

but if they play at 23:30, they are not kicked at 00:00 but at 01:00

#

sync or async?

#

one per player or for the server to constantly check seconds left?

stuck hearth
#

I would probably have a global task. Probably synchronous

shell moon
#

so basically a timer with interval 20L

fiery pollen
#

For MySQL databases, would it be better to update the data every time there is a change to the value or only update it every 30s?

minor summit
#

on every change is fine, just make sure you run the queries off the server thread

cunning geyser
#

Would anyone happen to know about paginated guis using triumphguis (mf-gui)

#

I'm clicking the next button (created from wiki) but it's not actually moving pages

dusty frost
cunning geyser
#

I haven’t made 2 pages, i’m not sure how

dusty frost
#

you have to add items to it

#

PaginatedGui#addItem()

cunning geyser
#

I didn't realize there was a parameter to expand, thanks!

unborn ivy
#

does anyone know why theres a stacktrace when i use this code

        ItemStack item = e.getCurrentItem();
        if (item != null && item.getItemMeta().hasLore()) {
            String lore = item.getItemMeta().getLore().get(0);
            if (ChatColor.stripColor(lore).equals("test123")) {
                for (String lores : item.getItemMeta().getLore()) {
                p.sendMessage(lores);
                }
            }
        }
    }
```  (when i first click on the item with the lore test123, it works and sends me the lores, but after i click it back to another slot, a stack trace pops up and i have no idea whats causing it)
#

using InventoryClickEvent fyi

dusky harness
neat pierBOT
unborn ivy
#

my bad

unborn ivy
#

ill put the stack on pastebin

dusky harness
unborn ivy
dusky harness
#

barry did it for you

dusky harness
unborn ivy
#

oh ok

dusky harness
#

but yeah as I suspected, it's a NullPointerException - likely due to the item meta

unborn ivy
#

wait so i need to check if the itemmeta is null aswell?

dusky harness
#

yep
it's null for air

#

idk if there are others

unborn ivy
#

wait

#

but if i already checked that the item is null

#

why do i still need to check for the itemmeta

dusky harness
unborn ivy
#

in my code im just checking if the item isnt an empty space, and if it has lore itemmeta

unborn ivy
#

on the first click it says that the itemstack is air

#

and when i put them item back it shows me my item with its meta

dusky harness
#

the meta is not the item

#

technically multiple items can have the same itemmeta

#

I wouldn't recommend it but it's possible

#

you have to check if the itemmeta is null

unborn ivy
#

i was just debugging

#
        if (item != null && item.getItemMeta() == null) {
            p.sendMessage("test");
            return;
#

"test" seems to always send

#

even if the item has itemmeta

#

or no meta

dusky harness
#

show full code

#

🤔

unborn ivy
#
        Player p = (Player) e.getWhoClicked();
        ItemStack item = e.getCurrentItem();
        p.sendMessage("" + e.getCursor());
        if (item != null && item.getItemMeta() == null) {
            p.sendMessage("test");
            return;
``` this is what i have rn, i have commented out the other code
dusky harness
#
        ItemStack item = e.getCurrentItem();
        if (item != null && item.getItemMeta() != null && item.getItemMeta().hasLore()) {
            String lore = item.getItemMeta().getLore().get(0);
            if (ChatColor.stripColor(lore).equals("test123")) {
                for (String lores : item.getItemMeta().getLore()) {
                p.sendMessage(lores);
                }
            }
        }
    }
```this should work btw
unborn ivy
#

thats what you meant by checking if its null... i was gonna check if it had lores with !item.getItemMeta().hasLore()

dusky harness
#

the sendMessage you're doing getCursor

#

but item is getCurrentItem

#

iirc getCursor is what was previously selected on your mouse/cursor, and getCurrentItem is what was previously in the slot

#

I might have it mixed up though

#

🥲

unborn ivy
#

i figured

#

minecraft is weird

#

thanks for the help

dusky harness
#

yeah I don't remember exactly what it is but I can tell you 100% that they are different

dusky harness
dusky harness
#

🙃

hoary scarab
dusky harness
#

wow

#

bad @uneven lantern

hoary scarab
#

Ah. Isn't there hasItemMeta()?

dusky harness
#

I think so

#

I assume it does the same thing though like hasLore

hoary scarab
#

👍

proud pebble
#

but if it doesnt have meta, then it doesnt have lore

dusky harness
#

they both check for null and in lore's case it checks if the lore is not empty and for meta it pretty much just checks if the meta is null or not

#

not exactly related but apparently for air, the nms item is null 🤔

#

I wonder how air looks like in internal minecraft code then (and if an air type exists in internal minecraft code? 🤷)

proud pebble
#

in most instances the itemstack is still AIR

#

even in nms

proud pebble
#

oop double ping

#

AIR,CAVE_AIR and VOID_AIR

minor summit
#

the internal inventory lists are specifically lists that disallow null elements, bukkit literally transforms air nms itemstacks into null bukkit itemstacks, it's so fucking stupid

tired olive
#

Im 0% sure but i think theyre different
https://wiki.vg/Slot_Data
Here null would mean present is false and material.air would mean air item id but honestly idk that could just be for the protoxol

minor summit
#

Yeah wiki.vg doesn't really represent how the game is actually structured, they only show you the raw byte streams for the packets when sent through the wire
Which doesn't even represent the packet Java classes structure but many people using ProtocolLib think they do and then wonder why some things don't work when "wiki.vg says this but ProtocolLib says that"

proud pebble
#

from my own testing virtual inventorys their slots that are empty are null, but with actual inventorys their slots that are empty are air.

minor summit
#

virtual and actual?

#

what

broken elbow
#

just like money

#

Virtually, they're like air, actually, they're missing

minor summit
#

vanilla/internals/nms does not use null for empty slots, it uses a NonNullList and it uses a constant ItemStack.EMPTY (air) item for empty slots
bukkit is the one that uses nulls for bukkit inventories most of the time, there are places where it actually uses air items which makes things even more confusing
the serialised packets use a boolean flag for empty/non-empty because writing an entire item stack for empty slots would be extremely wasteful

worn jasper
#

Is it possible to know which plugin logged something in the console? (if it didn't use it's own logger, but the server's logger)

proud pebble
# minor summit virtual and actual?

virtual inventories that are created through bukkit.createinventory have null slots, inventories that are created from a opening it using a block have AIR itemstacks in their slots, so you are correct, bukkit is the reason slots can be null

dusky harness
#

although I think the majority just calls to nms, but for things like inventories - would it increase the memory usage by a noticeable amount?

#

or are there too little cases where bukkit copies stuff that it doesn't impact memory by much

minor summit
#

yes

broken eagle
#

i need help

neat pierBOT
#

There is no time to wait! Ask your question @broken eagle!

broken eagle
#

when i try to join my server

#

it spams the console

#

with this

#

this is not the full console

#

pls someone help

minor summit
#

wrong channel

spiral prairie
broken eagle
#

and ram isn't broken

spiral prairie
#

ok

broken eagle
#

its a web host dude

#

how can the ram get broken

spiral prairie
#

oh my god

#

well that's why it isn't working lmao

#

you just said it

dusky harness
#

why you using a web host for spigot

#

🪦

dark garnet
#

how can i parse 1y1mo1w1d1h1m1s into a long representing milliseconds

#

just gonna quickly ask chatgpt actually

#

chatgpt gave me a huge regex thing for it and then gave up at the end, it's last word was It's on a new line lmao

dusky harness
#

there's also piggy's timeapi

#

but luckperms >

pulsar ferry
#

Just copy Kotlin's Duration kek

proud pebble
#

like if your wanting to go down that path

dark garnet
proud pebble
#

ic

dusky harness
dusty frost
#

capital M

icy shadow
#

wow so helpful

shell moon
proud pebble
#

my thoughts when i said that was by using single characters to find the unit, which M and m are different characters technically. wouldve thought it was faster or something to do exactly that

shell moon
#

that means? xd

supple oar
shell moon
dusky harness
#

thats it

supple oar
dusky harness
#
 *  The above copyright notice and this permission notice shall be included in all
 *  copies or substantial portions of the Software.
#

I might not be right tho idk 🤷

shell moon
#

what?

supple oar
# shell moon what?

just put the mit license in like a LICENSE file, hope it doesnt blow up ur pc and ull be good

dusky harness
#

ye

shell moon
#

what's that

#

xD

#

you mean the comments?

supple oar
#

a file

#

called LICENSE

dusky harness
supple oar
#

look up "MIT license" and paste it into that file

dusky harness
#

I'd assume you paste that in there

supple oar
#

ye

dusky harness
#

I don't remember what projects do

dusky harness
#

oh ok

shell moon
#

ahhhhh

#

too complicated

#

:,v

dusky harness
#

feel free to google it

#

or ask chatgpt

#

¯_(ツ)_/¯

shell moon
#

xD

minor summit
#

or a lawyer

#

ideally

supple oar
#

shouldnt matter tho if ur taking 1 file

#

lucko or whoever will just ask u to change it at worst

#

its too much effort to cry over it

#

and costs them money if they wanna cry and sue or smth and probably not win

soft swift
#

it is posible progressbar in voteparty plugin?

solar veldt
#

whats the use of adding plugins to proxy i dont really understand it

broken elbow
tired olive
river solstice
#

(suggestion for whoever is maintaining it)

signal grove
#

could also be used to detect bumps in request channels^

#

though i guess it doesnt happen as often as copy pasting in channels

broken elbow
#

barry is quite broken

broken elbow
river solstice
#

@urban oar wya

signal grove
#

anyone know how to damage a player without affecting their velocity? I calculate what their velocity is supposed to be separately and set it, but the damaging sends them off randomly. https://paste.helpch.at/heyugejoso.java

signal grove
#

i can use player.setHealth() instead of player.damage(). this works fine, but i'd prefer the player to actually get a hurt sound and turn red.

edit: Fixed by not specifying the damager entity

proud pebble
#

nice

hazy summit
dusky harness
#

Or softdepend

hazy summit
river solstice
#

well, do you have the classes that vault provides?

#

ex. net.milkbowl.vault.economy.Economy

hazy summit
river solstice
#

hm, that's weird. where do you call the setupEconomy?

hazy summit
#

I call it onEnable(), after initializing the plugins' files and registering commands

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

  FileManager.loadFiles();
  CommandManager.register();

  EconomyManager.setupEconomy();
}
#

for the event, I just implement Listener into the EconomyManager and replace the EconomyManager.setupEconomy(); with getServer().getPluginManager().registerEvents(new EconomyManager(), this);

river solstice
#

well, could you try making it non-static and moving the method from EconomyManager class to your main one?

river solstice
#

could you paste the full class, with imports and what-not?

hazy summit
#

yea sure one second

river solstice
#

well, everything seems to be correct

#

are you sure vault is installed on the server?

hazy summit
#

its enabling and everything, only thing not working is my plugin

#

Maybe it would work if I had actually added an Economy plugin 🤦‍♂️

river solstice
#

true

dusky harness
#

¯_(ツ)_/¯

proud pebble
#

ah yes, that might help just a tad

floral beacon
#

is BukkitRunnable() looping over and over until it reaches cancel()?

river solstice
#

Basically, yes.

#

Or your plugin gets disabled

floral beacon
#

what can i use that is like BukkitRunnable() but to execute only once?

river solstice
#

Bukkit.getScheduler().runTask

#

Or .runTaskAsynchronously

#

Or .runTaskLater

floral beacon
#

thanks a lot

river solstice
#

Might not be the exact syntax, but use Bukkit.getScheduler instead of BukkitRunnable itself

floral beacon
#

That is recommended?

dusky harness
#

it doesn't always loop

#

only if you do runTaskTimer or runTaskTimerAsynchronously

floral beacon
#

also related to this
how can i delay the first iteration?

dusky harness
#

yes

#

look into runTaskLater

#

runTask delays it by 1 tick

#

runTaskLater lets you cutomize it

#

same with runTaskTimer, etc

floral beacon
#

i want to do something on player join (talking about bukkit/spigot plugin)
how can i delay the task, but to delay it in such way that the first iteration that is ever done within that code will be delayed, so like

  • player joins
  • wait x ticks
  • do first iteration/whatever
  • ...

❌ not like:

  • player joins
  • do first iteration/whatever
  • wait x ticks
#

i see that it has delay

#

but how to make delay apply for first iteration ever

#

ok finally

#

it worked with runTaskLater

#

thanks a lot @dusky harness

dusky harness
#

it has 2 parameters

#

1 for the initial delay, then another for the delays after

tight junco
#

you're looking for taskLater

#

taskTimer is repeating

floral beacon
#

thanks

#

what's the best idea to remove all potion effects for the player (i want to do this on join)

#

should i first get user effects then loop and remove each or is there a way to remove them all at once (something like Player#clearEffects())

tight junco
#

there isnt a clear effects function from what I can see

#

probably just getActivePotionEffects forEach removePotionEffect

dusky harness
#

but if it's not repeat then yeah tasklater works

dusky wolf
#
    @EventHandler
    public void on(PlayerEntersIntoTownBorderEvent event) {
        UUID uuid = event.getPlayer().getUniqueId();
        System.out.println("Player just entered the town border");
        if (protectedPlayers.contains(uuid)) {
            protectedPlayers.remove(uuid);
            System.out.println("player protection ended");
            Long scheduledRemovalTime = scheduledRemovalTimes.get(uuid);
            if (scheduledRemovalTime == 0) {
                return;
            }
            scheduledRemovalTimes.remove(uuid);
            if (bossBars.containsKey(uuid)) {
                BossBar existingBossBar = bossBars.get(uuid);
                existingBossBar.removeAll();
                bossBars.remove(uuid);
                // stop the running task if it exists
                if (bossBarTasks.containsKey(uuid)) {
                    Bukkit.getScheduler().cancelTask(bossBarTasks.get(uuid));
                    bossBarTasks.remove(uuid);
                }
            }
        }
    }```

The bossbar should actually be cancelled and not count the 5 seconds I spent inside my town then remove the bossbar when it says I have 10 seconds of protection left but I wonder if it's something to do with the HashMap for bossBars

Here is the whole class: https://paste.learnspigot.com/uhuhadacog.java (sorry for the bad code, it's my first plugin)
bitter flint
#
@EventHandler
    public void onItemClick(PlayerInteractEvent e) {
        if (e.getAction() != Action.RIGHT_CLICK_BLOCK && e.getAction()!= Action.RIGHT_CLICK_AIR) return;

        ItemStack item = e.getItem();
        if(item == null) return;
        e.getPlayer().sendMessage("Start!");
        if(item.getType() == Material.NETHERITE_CHESTPLATE) {
//            e.getPlayer().sendMessage(String.valueOf(e.getItem().serialize()));
            e.getPlayer().sendMessage(String.valueOf(e.getItem().serialize().get("extra")));
//            e.getPlayer().sendMessage(String.valueOf(e.getItem().getData()));
            e.getPlayer().sendMessage("Blaze rod clicked!");
        }
    }

I want to get the value by the key.

graceful juniper
#

there isnt an "extra" field in what serialize returns

signal grove
#

unless it's some convention ive not seen before

broken elbow
#

In your CMD execute java --version. What does it return?

#

When have you installed java? Was it today and it broke right after installation or did it work before?

#

If it broke after working before, any chance you messed with the environment variables?

#

I guess that is also a way to fix it. I was thinking you probably just need to edit an environment variable to fix it.

#

Well JAVA_HOME and PATH I guess.

#

Did reinstalling not fix it?

neat pierBOT
#
Uploading Images

You won't be able to upload images here directly to avoid spam, so please use https://imgur.com/upload or similar service to upload images/screenshots.

broken elbow
#

Ohhhh.

#

I thought you meant that you reinstalled in the time it took me to respond and it fixed it

#

haha

bitter flint
#

what handling event keyPressed in plugin java 11?

broken elbow
#

In your PATH variable, are you sure there is a path pointing towards your java.exe?

#

No, as in you're not sure?

bitter flint
#

Blitz help me pleasse

broken elbow
#

It won't actually end with java.exe. It is just going to point to the parent directory.

broken elbow
bitter flint
broken elbow
#

Oh do not worry. I was brain dead long before I met you.

#

Can you open the PATH variable and send a screenshot from there?

#

No. That's not what I meant

#

There's a variable called Path

#

you can see it in the screenshot

#

Where did you install java? Is it C:/Program Files/Java/jdk-19/ ?

#

Then double click on Path (environment variables), click New and in the new filed it creates, type C:\Program Files\Java\jdk-19\bin

minor summit
#

after changing the path you need to close the open terminal/cmd line and open a new one

#

well maybe you don't

#

i don't know if you do or don't know

#

what are you running? powershell? that's the default on win11 i belive

broken elbow
#

Can you check both the user variables and the system variables? They both will probably have a variable PATH. Send a screenshot from both.

dusky wolf
river solstice
#

is there a better way to store data instead of using a List if I only need to store exactly 2 values?

dusky harness
#

so you'd have to make your own Pair class

#

or preferably a data class

#

the best way would be a data class

sterile hinge
#

java 8 💀

dusky harness
#

even for 2 values it's probably best

river solstice
dusky harness
#

lol

minor summit
hoary scarab
#

Could use an array.
Object[] values = new Object[2];

dense drift
#

yeah, no

icy shadow
#

Not heterogenous

lyric gyro
mental cypress
#

Looks like a bad link?

lyric gyro
#

Actually, this is a simple error log, but I don't understand it

mental cypress
#

Okay well that image doesn't actually load.

lyric gyro
#

what

#

maybe so?

tight junco
mental cypress
#

Just looks like they can't connect to survival. Bad IP / Port? Probably better in #minecraft though.

dusty frost
lyric gyro
dusty frost
#

If they're on the same machine, it'd be 127.0.0.1

dark garnet
lyric gyro
dark garnet
lyric gyro
#

In fact, I don't really know where to change this. 😅

#

I also rewrote it. Nothing has changed

#

Although it only says 127.0.0.1:1028

dusky harness
#

no he's just saying that you may not want to just tell everybody your ip

minor summit
#

insert liveoverflow video about showing public IPs here

dusky wolf
#

is this something that can be done?

#
    public long getRemainingProtectionTime(Player player) {
        if (TownyWildTownEventListener.scheduledRemovalTimes.containsKey(player.getUniqueId())) {
            long scheduledRemovalTime = TownyWildTownEventListener.scheduledRemovalTimes.get(player.getUniqueId());
            Bukkit.getScheduler().runTaskTimer((Plugin) this, new Runnable() {
                int remainingTime = Math.round((scheduledRemovalTime));

                @Override
                public void run() {
                    if (this.remainingTime == 0) {
                        return;
                    }
                    this.remainingTime--;
                }
            }, 0L, 20L);
        }
        return 0;
    }```
#

inside of the PlaceholderExpansion class

#
java.lang.ClassCastException: class com.agaloth.townywild.hooks.TownyWildPlaceholderExpansion cannot be cast to class org.bukkit.plugin.Plugin (com.agaloth.townywild.hooks.TownyWildPlaceholderExpansion is in unnamed module of loader 'TownyWild-1.00.jar' @4dd3bb9d; org.bukkit.plugin.Plugin is in unnamed module of loader java.net.URLClassLoader @58d25a40)```
tight tide
#

change "this"

signal grove
#

^ in your runTaskTimer, there needs to be your main plugin class

#

or if you're just coding a standalone expansion, you can use PlaceholderAPIPlugin

signal grove
#

I'm making a plugin which creates different types of golden apples that give different effects when you eat them. I want to be able to add them to EssentialsX kits, but I'm gonna assume it won't handle persistent data tags properly. Does anyone have alternatives, other than not using essentialsx kits?

#

i mean, if worst comes to worst, i can store the effects on lore lines

mellow pond
inland meadow
#

o/

I've been working on a custom block breaking speed implementation (what a mouthful) and it works completely fine, but one thing.
Usually after the client breaks a block, there is (unless instantly broken) a 6 tick delay before you can start mining the next block;
However with my implementation the server is the one breaking the block using Block.breakNaturally, which means the client does not get the intended delay and can immediately start breaking the next custom block.
My current workaround is setting the player to Adventure Mode for 6 ticks and setting them back to Survival Mode, which... works, but doesn't feel right at all;

Is there a packet or something I've missed that let's me tell the client they've broken a block to trigger the delay?
If there isn't and someone has a better idea, I'd appreciate it!

leaden sinew
inland meadow
#

I am using mining fatigue yes;
since I am trying to make it look as convincing as possible; the issue is that the client still hears the mining sound if I was to just block the progress

static jewel
#

is PlaceholderExpansion#canRegister() called before or after Configurable#getDefaults()? what I want to do is check on canRegister whether the values on the config are valid or not

dense drift
#

Uh, It should be before I guess

static jewel
#

maybe I should fallback to defaults or something since the values won't exist yet on canRegister

dense drift
#

Yup, I was looking for that but it takes time on mobile xD

static jewel
floral beacon
#

is there a way to use BukkitRunnable#runTaskLater at some method but while it is being counted down until its actual execution, to execute next part of the code that comes right after that BukkitRunnable?

wheat carbon
#

just.. put code after #runTaskLater?

#

not understanding the question

floral beacon
#

thanks for the answer, that will be it
i just thought that it will wait for #runTaskLater to finish and after it is executed fully, then execute code that comes after it

wheat carbon
#

nope

#

for future reference, maybe test it out before asking the question

river solstice
#

very true and real ^

past ibex
#

yeah, looks like he did

past ibex
spiral prairie
#

I am currently thinking about finnicking a solution to prevent PieRay (seeing tile entities in the F3 chart) and I am thinking about what I have to check for. Are tile entities sent via the chunk data packet or separately?

floral beacon
#

How can i execute one BukkitRunnable (#runTaskTimer) and after it is cancel(), to execute next one?

river solstice
#
 () -> {  
   cancel()
   .. create new runnable?
}
#

not sure if that's the way tbh

dense drift
#

you can create a class that extends bukkitrunnable and on the cancel method, start a new task

floral beacon
#

should i try #runTaskTimerAsynchronously?

dense drift
#

What do you want to do?

floral beacon
#

i want to repeatedly send bossbar for x seconds to user
when he does what i want, that task will cancel and i want to execute new one (when the first one has been cancelled)

minor summit
#

you don't need an asynchronous task for that

#

the only cases where you really want things to be asynchronous is when
a) you are performing IO calls (file read/write or network ops, like database queries or HTTP requests etc)
b) you are performing some really heavy number crunching

#

sending a bossbar update every few seconds is neither of those, if anything it is just ever so slightly worse (not that it's anything noticeable either, but it is)

river solstice
#

Why is it bad to run async?

dusky harness
icy shadow
#

thread switching isnt free

#

and neither are threads themselves

#

the more work you do asynchronously the more work the scheduler has to do, which could require creating more threads for the pool (which has a very non-negligible performance impact)

#

plus yeah many issues can arise from doing lots of work async (race conditions, collection issues, etc)

signal grove
#

any idea why this actually heals armor durability?? im kinda baffled

public static void damageArmor(Player player)
    {
        Random random = new Random();
        for(ItemStack armor : player.getInventory().getArmorContents())
        {
            if(armor != null)
            {
                int unbreaking = armor.getEnchantmentLevel(Enchantment.DURABILITY);
                float chanceOfDamaging = 1.0F / (unbreaking + 1.0F);
                if(random.nextFloat() < chanceOfDamaging)
                {
                    armor.setDurability((short) (armor.getDurability() - 1));
                }
            }
        }
    }
#

also i know get and set durability are deprecated

#

but i doubt they would still be that wrong

dense drift
#

you need to increase the durability iirc

#

iirc durability is more like "health missing" not "health left"

signal grove
#

horrible naming

dense drift
#

nah horrible api xD

signal grove
#

yeah

#

especially when in game tool tips show durability as something that decreases over time

#

thanks that fixed it by making it +1

minor summit
# river solstice Why is it bad to run async?

what BM + plus you run the risk of things like thread exhausting, where there are more threads trying to actively run than the platform can handle, slowing things down further since now you have threads waiting for other threads to finish before they have a chance to run

#

async does not mean "performance"

#

deadlocks are quite a fun thing to run into and debug

dusky wolf
#
    public long getRemainingProtectionTime(Player player) {
        long remainingTime = 15;
        if (TownyWildTownEventListener.scheduledRemovalTimes.containsKey(player.getUniqueId())) {
            Plugin plugin = Bukkit.getPluginManager().getPlugin(getPlugin());
            assert plugin != null;
            new BukkitRunnable() {
                int remainingTime = 15;

                @Override
                public void run() {
                    this.remainingTime--;
                    if (remainingTime == 0) {
                        cancel();
                    } else {
                        player.sendMessage("You got " + remainingTime + "left");
                    }
                }
            }.runTaskTimer(plugin, 20, 20);
        }
            return remainingTime;
        }```

For some reason my bossbar doesn't update the remainingTime
#
        String bossBarText = PlaceholderAPI.setPlaceholders(player, String.valueOf(remainingTime));
        bossBarText = bossBarText.replace("%townywild_countdown%", String.valueOf(remainingTime));
        bossBarText = ChatColor.translateAlternateColorCodes('&', bossBarText);
        double timeDecrease =  (double) 0.1 / remainingTime;
        double progress = ((double) scheduledRemovalTime);
        System.out.println(progress + "%");
        if (progress < 0) {
            progress = 0;
        } else if (progress > 1) {
            progress = 1;
        }
        bossBar.setProgress((float) Math.max(0.0, bossBar.getProgress() - timeDecrease));
        bossBar.setTitle(bossBarText);
        if (remainingTime < 0) {
            bossBar.removePlayer(player);
            listener.remove(uuid);
            Bukkit.getScheduler().cancelTask(taskId);
            }```
#

text gives updates for player.sendMessage("You got " + remainingTime + "left"); but the bossbar stays at 15

dark garnet
#

anyone know of a java library for YAML that is similar (as close as can get) to bukkit/spigot's?

dusty frost
#

you can use snake yaml (the one bukkit uses) yourself lol

dark garnet
#

unless im just using snake yaml wrong

dusky harness
#

🤢

dark garnet
#

:(

dusky harness
#

Doesn't Configurate support that?

#

@dark garnet

dark garnet
#

ooooo ty

sterile hinge
icy shadow
#

There’s some platform agnostic port for the bukkit yaml api

#

But also yeah consider just not doing that

#

Object mapping >>>

supple oar
sharp cove
#

Hey, is it possible to make a GitHub repository with a password?

#

So some people can view it?

dense drift
#

yes, it is called a private repository

#

and then you give access to each person individually

sharp cove
#

Ah..

#

But it has to be a user?

#

Like not a password?

dense drift
#

hm?

sharp cove
#

Like is it not possible to set a password for a git?

dense drift
#

no

sharp cove
#

Ahh

#

Oke

#

Thank you

proud pebble
spiral prairie
#

What

proud pebble
#

well theres no reason to store the true durability in the nbt data of the itemstack

#

since its the same every time

#

how much damage the item has taken does change

#

i can see why setDurability is deprecated since its misleading

#

setDamage is much more descriptive of what it does

dusky harness
# sharp cove Ahh

Well
Technically can I thinj
Can make an acc for that repo only 🙃

#

But there's no built in way

inland meadow
#

I currently have an invisible, invulnerable baby rabbit that a player has to hit, but I cannot find any event that actually gets triggered by the player punching the rabbit.
I've tried various interact events but none seem to do anything as long as it's invulnerable/invisible.
Tried my best to find a solution, so asking here as a last resort prayge

dusky harness
inland meadow
#

I'll check that, but iirc when it was invisible it still didn't trigger the events

#

that worked

#

thank you a lot 👌

dusky harness
#

Np 👍

inland meadow
#

I misread the event, I thought this was EntityDamageEvent aswell, but this one is from the perspective of the hit entity

dense drift
#

Is possible to detect when the social interaction screen is opened?

spiral prairie
#

the what?

#

did I miss a new MC feature or

dense drift
#

Press P

spiral prairie
#

that's client side afaik

#

although dont take my word for it

weary delta
#

can any1 help me i was making bal leaderboard with %vault_eco_top_player_1% %vault_eco_top_balance_1% and its not working can any1 tell me how to fix this

broken elbow
#

Umm. Wrong channel. #placeholder-api is the correct channel. Either way, those placeholders don't exist anymore. They were moved into the Essentials expansion.

weary delta
river solstice
#

there's no essentials command to just 'create a leaderboard'

weary delta
river solstice
#

are you locked out from google

weary delta
#

alr thanks

#

got it

river solstice
#

took me like 15 seconds to open this up.
you really could've done that yourself instead of trying to ask someone to spoonfeed you this information.

dusky harness
#

harder if you don't know where to go

#

although

#

it is on the spigot page

river solstice
#

well blitz already said they were moved to essentials expansion

dusky harness
#

🙃

#

also for some reason it isn't listed here

#

🤔

river solstice
#

hardcoded?

dusky harness
#

should still be listed

#

ig they didn't update it

lyric gyro
#

im assuming to create a worldguard region i have to install the worldguard api?

dusky harness
lyric gyro
#

ok lol was just wondering if the worldedit api handled that but no sadly

dusky harness
#

🤔

proud pebble
#

worldguard and worldedit are seperate plugins

lyric gyro
#

I have an error compiling the ChatChat plugin

dusky harness
lyric gyro
#

wait sorry

dusky harness
#

seems like dev build was last updated 15 days ago

#

¯_(ツ)_/¯

lyric gyro
#

The thing is that I want to have the src of the plugin to customize it but it gives me a compilation error

Type-safe project accessors is an incubating feature.
Project accessors enabled, but root project name not explicitly set for 'build-logic'. Checking out the project in different folders will impact the generated code and implicitly the buildscript classpath, breaking caching.
> Task :api:compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':api:compileJava'.
> invalid source release: 11```
dusky harness
lyric gyro
#

ooow

#

no

dusky harness
#

it seems like that's what Github Actions does so maybe it'll work?

#

¯_(ツ)_/¯

lyric gyro
#

I'll see

dusky harness
#

or actually it seems like that build log also failed so probably not

lyric gyro
# dusky harness or actually it seems like that build log also failed so probably not

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':api:compileJava'.
> invalid source release: 11

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 12m 13s
11 actionable tasks: 11 executed``` 

With `gradle shadowjar`
dusky harness
#

and what program are you running the command in?

mental cypress
#

Do you only have Java 8 or something installed? It's complaining about the Java version you are using to compile it.

lyric gyro
#

Git bash and i have Java 8 but Gradle install jdk's

#

ooooow

#

ah no

dusky harness
lyric gyro
#

with reason

#

java 17.0.6 2023-01-17 LTS
Java(TM) SE Runtime Environment (build 17.0.6+9-LTS-190)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.6+9-LTS-190, mixed mode, sharing)

#

... xd

dusky harness
#

what if you do javac -version

lyric gyro
#

javac 17.0.6

#

I'll go change it

dusky harness
lyric gyro
#

a

mental cypress
#

What if you do ./gradlew shadowJar

dusky harness
#

ah

mental cypress
#

If you're in Linux you might need to chmod +x gradlew

lyric gyro
dusky harness
lyric gyro
#

yes

mental cypress
#

I know the CI builds on 11 iirc

#

Let me double check that

lyric gyro
#

Thank you

#
Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details
Type-safe project accessors is an incubating feature.
Project accessors enabled, but root project name not explicitly set for 'build-logic'. Checking out the project in different folders will impact the generated code and implicitly the buildscript classpath, breaking caching.

> Task :build-logic:compileKotlin
Could not perform incremental compilation: Could not connect to Kotlin compile daemon
Could not connect to kotlin daemon. Using fallback strategy.
warning: ATTENTION!

-XXLanguage:+DisableCompatibilityModeForNewInference

This mode is not recommended for production use,
as no stability/compatibility guarantees are given on
compiler or generated code. Use it at your own risk!

<=====--------> 40% CONFIGURING [7m 59s]
> :api
> IDLE
#

forget it sorry for the inconvenience using "git bash" with "./gradle shadowJar" worked, but thank you very much for taking your time to solve this problem ;)

#

thank you very much

wooden valley
#

Hi, is this the help server for the Stronger diamond swords mod?

#

I made a diamond sword and typed the command /diamondsword 10 and it only gave me 3 diamond swords instead of 9

#

how do you craft the diamond swords together? It doesnt work for me

shell moon
#

i doubt it, this is HelpChat for PlaceholderAPI, and plugins from funnycube and clip

#

afaik this is not support of a mod like t hat

shell moon
wooden valley
#

what do you mean? 😂

wooden valley
#

what is

torpid raft
#

the author of that mod is actually maranthi so the plugin only recognizes item ids written in maranthi

#

so instead of diamond sword you'd write "हिरा तलवार"

wooden valley
#

yeah thats real funny man, minecraft is english not a chinese server 🤣

#

and why would i write in chinese if my game is made english Lol

torpid raft
#

actually minecraft is multicultural

#

people from all areas of the world can enjoy it

wooden valley
#

yeah but my diamond sword is english

#

and this mod is english im pretty sure

torpid raft
#

yes that's why it is not working

wooden valley
#

what do you mean XD

torpid raft
#

i'm telling ya you need to call it हिरा तलवार

north robin
#

I try running the command /papi ecloud download skript and it says theres no skript expansion found anybody have an idea on this?

#

1.19.2 papi version 2.11.2

wooden valley
#

and why

torpid raft
#

you need to replace diamond sword in your command with that

wooden valley
#

the mod is supposed to give you diamond swords or make your one holded stronger

#

if you write /diamondsword 10 it gives 10-amount of swords in inventory

torpid raft
#

10 diamond swords is a lot of diamond swords

#

what are you doing with 10 diamond swords

wooden valley
#

if you add a my word at the end it will add strength to the current one

#

i need this to make stronger kits for my server

#

but its not working

torpid raft
#

i think 10 is too strong

#

maybe 7 or 8 at most

#

be reasonable

wooden valley
#

sure but why will it not work

torpid raft
#

beats me this isn't the help discord for that mod

#

i suspect that not a single person here has heard of it

#

considering it doesnt even come up in a google search

wooden valley
#

over 7 mill downloads

torpid raft
#

that looks a lot like a mod that has nothing to do with diamond swords

wooden valley
#

uhh, have you ever used the mo creatures mod?

#

it is everything

#

yesterday it all worked fine and things are good now i switch to cauldron things break I need to use plugins on my server because there is no other way to make my players use things like fly and kit

#

and i need kit

torpid raft
wooden valley
#

thats why they created this server

torpid raft
#

well i guess if it did have everything it would also have this server

wooden valley
#

there are to many things in the mod lol

torpid raft
#

that adds up

wooden valley
#

what adds up

#

the command is subtraction

torpid raft
#

what is subtraction if not addition but backwards

wooden valley
#

wut

#

🤔

torpid raft
#

did you know the word addition reversed makes subtraction

wooden valley
#

lets not change the sentence

#

im in need of help very urgently

torpid raft
#

will you pay me for my time

wooden valley
#

why?

torpid raft
#

because i want money

#

i think it's only fair

wooden valley
#

yee take 💰

#

🤑

torpid raft
#

nah i'll take some btc or xmr tho

wooden valley
#

wut are those words

#

oh, bitcoin LOL.

torpid raft
#

i'll take $10 for my time

wooden valley
#

you didnt even do anytihng

torpid raft
#

i will

wooden valley
#

haha you are just trying to mess around with me right

torpid raft
#

nono

#

i would never

wooden valley
#

I got news I dealt with you are not different

torpid raft
#

feel free to send the money and i can make you as many diamond swords as you'd like

#

837qe5doGT1QLnr16qVD5jNx72HFX5LU7LAaFw46Tjj2QstzbSHrUGBfvWFVFjmPf19EYN8b3ULtRZxWe49BVHeQ7G1ayGB

wooden valley
#

spamming ^

torpid raft
#

yes spam that address with money

wooden valley
#

im good 😄

torpid raft
#

then no diamond sword for u

wooden valley
#

that was never my problem

#

Lol

torpid raft
#

what was your problem

warm steppe
#

Bruh some dude uses not-paper server software and wonders why nothing works

#

Uhh im using fabric, why is my server lagging and not being able to hold 20 players

#

Get real

shell moon
#

rain particles are client side right?

#

I mean, i cannot use protocol lib for example to interecept rain particles and change it for other particle

#

(dumb question, but still)

spiral prairie
#

yes

proud pebble
#

also thats not chinese

#

thats goan konkani according to google translate, i thought it was hindi at first

signal grove
#

so you have the option to not send that, and instead send your own custom particles

proud pebble
#

afaik rain isnt particles, they are a cascading texture or something

signal grove
#

that seems right because they dont move like normal particles

#

actually i dont think youll need protocollib at all

#

you can use a WeatherChangeEvent, then use player.setWeather

#
 @EventHandler
    public void onRain(WeatherChangeEvent event)
    {
        for(Player player: Bukkit.getOnlinePlayers())
        {
            //if event is rain
            //    player.setPlayerWeather(WeatherType.CLEAR);
            //    add them to a list of people to send particles to
            // else if event is clear
            //    remove from list
        }
    }
#

bad code but you get the idea

proud pebble
#

rain is a texture, but there are particles that spawn on the floor but im not sure if they are hardcoded or not

spiral prairie
#

yeah they are

#

i mean maybe the texture isnt

#

but the server isn't sending thousands of particle packets

signal grove
#

when in the desert, you can't see anything happening in other biomes

#

so it must make those particles clientside

minor summit
#

they are client sided

#

the server only sends if it's raining or not

shell moon
signal grove
#

yes

hoary scarab
#

Any reason windows command prompt shouldn't be displaying colors?
System.out.println("\033[36mcyan\033[0m"); -> ←[36mcyan←[0m
I've also tried "\u001b[36mcyan\u001b[0m", "\u033[36mcyan\u033[0m"

minor summit
#

what does the second one look like when printed?

hoary scarab
#

System.out.println("\033[36mcyan\033[0m"); -> ←[36mcyan←[0m
System.out.println("\u001b[36mcyan\u001b[0m"); -> ←[36mcyan←[0m
System.out.println("\\u033[36mcyan\\u033[0m"); -> \u033[36mcyan\u033[0m

hoary scarab
#

Out of ideas lol

proud pebble
#

that looks like its printing out unicode characters rather then colors

dusky harness
#

think forge but better

forest jay
#

I want to track to know if a player has accepted a provided resource pack. Is there a way to do this through code? I want to display a GUI after they have accepted the pack.

forest jay
#

thanks

forest jay
dusky wolf
#

I'm confused on what needs to be done here:

    @EventHandler
    public void ExitTownBorder(PlayerExitsFromTownBorderEvent event) {
        // Gets a player's UUID.
        UUID uuid = event.getPlayer().getUniqueId();
        System.out.println("Player just exited the town border");

        // Adds a player's UUID to the protectedPlayers list when exiting a town.
        protectedPlayers.add(event.getPlayer().getUniqueId());
        Bukkit.getScheduler().runTaskTimer(plugin, (Runnable) protectionTimeLeft, 0, 20);

        System.out.println(protectionTimeLeft + " seconds left of protection");
        System.out.println("protectedPlayers after adding player: " + protectedPlayers);
    }```

This part specifically:
```java
        protectedPlayers.add(event.getPlayer().getUniqueId());
        Bukkit.getScheduler().runTaskTimer(plugin, (Runnable) protectionTimeLeft, 0, 20);```

This is what I did:
```java
package com.agaloth.townywild.tasks;

import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;
import org.bukkit.scheduler.BukkitRunnable;

import java.util.UUID;

import static com.agaloth.townywild.listeners.TownyWildTownEventListener.protectedPlayers;
import static com.agaloth.townywild.listeners.TownyWildTownEventListener.protectionTimeLeft;

public class RemoveProtectedPlayerTask implements Runnable {
    private final UUID uuid;

    public RemoveProtectedPlayerTask(UUID uuid) {

        this.uuid = uuid;
    }

    public void protectionTimeLeft() {
        if (protectionTimeLeft.containsKey(uuid)) {
            Plugin plugin = Bukkit.getPluginManager().getPlugin(this.toString());
            assert plugin != null;
            new BukkitRunnable() {

                int remainingTime = 15;

                public void updateProtectionTime() {
                    protectedPlayers.add(uuid);
                    this.remainingTime--;
                    if (remainingTime < 0) {
                        protectedPlayers.remove(uuid);
                        cancel();
                    }
                }
                @Override
                public void run() {
                    updateProtectionTime();
                }
            }.runTaskTimer(plugin, 20, 20);
        }
        protectionTimeLeft.getOrDefault(uuid, 0);
    }

    @Override
    public void run() {
        protectionTimeLeft();
    }
}```

Adding protectionTimeLeft would cause a ClassCastException since protectionTimeLeft is a HashMap in TownyWildTownEventListener but I want to take the protectionTimeLeft from RemoveProtectedPlayerTask and adding updateProtectionTime won't work (since it can't find it?) (Players never end up getting deleted from the protectedPlayers map after the countdown is over)

For information:         ``if (protectionTimeLeft.containsKey(uuid)) {`` uses ``public static Map<UUID, Integer> protectionTimeLeft = new HashMap<>();`` from TownyWildTownEventListener
upper jasper
hoary scarab
signal grove
#

does anyone know off hand - if calling player.damage(dmg, null) will invoke the EntityDamageEvent with event.getCause() == null?

#

no, apparently its not nullable

#

then my question is what happens to the damage cause

lyric gyro
#

would it be possible to create something with worldguard where if the player lands on a block outside of their region they're teleported back to their region?

signal grove
#

you mean, if theyre flying, or jumping in the air? then land on solid ground outside the region, they get teleported back?

#

you'd need to store a history of their last touched spot using onGround (probably deprecated) and then when they touch again, see if theyre within the desired region. If not, teleport them back to their last touched spot inside the region

river solstice
#

Everything is possible if you are brave enough

signal grove
lyric gyro
#

is player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() != Material.AIR) the best way to check if the player is on the ground since the isOnGround() method is deprecated.

minor summit
#

uh no that would be the worst tbh

dusky harness
#

idk the context but I'd consider it safe to use isOnGround

#

assuming the server has an anticheat

minor summit
#

in the vast majority of cases it'll probably be fine

dusky harness
#

afaik

minor summit
#

yeah you can stand on the edge of a block and the block beneath you will be air lol

#

or like standing on a bottom slab that's got nothing underneath it etc

forest jay
#

if you didnt want to use isOnGround couldnt you also just use a raycast that is the width of the player? that would account for the standing on edge.

#

and then you would just make the raycast a length of 1 block

#

idk, just a thought. not sure how isOnGround works, for all I know it could use a raycast

spark skiff
#

Sorry if this is a stupid question but i'm trying to create an inventory gui item that when clicked cycles through different selections in the lore:

Toggle Scoreboard Color (Red)
 » Red
 Blue
 Orange

I'm not sure how to get this working so if anyone can help that would be greatly appreciated (ping ok)

past ibex
#

please dont

#

All the ways this will fail:

  • A player can stand on the edge of a block
  • The player can stand on a shulker entity
  • The player can stand on a boat entity
  • The player is in cave air
  • onGround occurs with YXZ movement order, so a player can be in midair while still being on the ground for one tick
#

and much more but it's a terrible idea

past ibex
#

on a 1.8 client, hitting the ground while activating stepping movement so you hit the ground but stop mid-air vertically above the ground

#

allowing onGround stuff while in water, lava, non-full blocks, etc.

fading stag
#

I update a variable outside of a Runnable but I can't use new value of the variable at runnable :/

dense drift
#

I work on a KeyVault plugin and I've previously stored the amount of keys using NBT inside the vault item, now I was thinking to use sqlite for storage and the schema looks like this

CREATE TABLE IF NOT EXISTS `vault`
(
    id   INTEGER PRIMARY KEY,
    uuid VARCHAR(36) NOT NULL
);

CREATE TABLE IF NOT EXISTS `key`
(
    id       INTEGER PRIMARY KEY,
    vault_id INTEGER     NOT NULL,
    name     VARCHAR(32) NOT NULL,
    amount   INTEGER     NOT NULL,
    FOREIGN KEY (vault_id) REFERENCES vault (id)
);```
The players might get certain type of keys quite often (maybe 1 every second for the low level ones), is it ok if I update the data on database every time?
#

I will keep an in-memory cache as well for online players, so I won't constantly query the database for the data to update the key vault item visually (to display how many keys are stored inside).

icy shadow
#

Probably fine

#

Databases are designed for high throughput

minor summit
#

yeah it's fine

little summit
#

i've got a problem with my plugin, i can't find any errors or anything bad in my plugin atm but for some reason every time the plugin tries to load it fails. no errors other than [14:44:11 ERROR]: Could not load 'plugins/KitEditor-1.0.4.jar' in folder 'plugins'
or sometimes it just enables and then immedaitely disables.

i'm about to send the code.

neat pierBOT
river solstice
#

cool, why not just send in the whole project at this point

#

(weird how there are no error messages though, usually there's an obvious error message telling why it did not enable)

minor summit
#

lol

little summit
river solstice
#

I'm joking obviously

#

you could at least put it all in one paste, not 30 different ones

little summit
#

anyways, any ideas on why this is happening?

#

any NPE's?

river solstice
#

well, remove everything from onEnable and go from there

#

though

#

what's this

      @Override
        public void onEnable() {
            Bukkit.getPluginManager().registerEvents((Listener) this, this);
            getCommand("editkits").setExecutor(new KitSelectGUI());
            getCommand("adddefaultkit").setExecutor(new KitEditorCommand());
            kitSelectGUI = new KitSelectGUI();
            kitSelectGUI.createInventories();

        }

Bukkit.getPluginManager().registerEvents((Listener) this, this);

#

you're casting main class which is not a listener and registering it

#

that's your issue

little summit
#

oh yeah

#

alr ty

hoary scarab
#

Huh.... So https://wiki.vg/Protocol says the Login Start packet should be Name, Has Player UUID, Player UUID
But I am getting an output that contains the server IP then my username as well as some other data.

The packetsize alone should be more then 16... UUID -> 16, String -> 16, Boolean -> 1

And if I attempt login again the data past the username is removed

icy shadow
#

the only packet that sends the IP is the handshaking start

#

so you must not be reading it properly

little summit
#

the version is correct (i double checked like three times already)

little summit
# little summit nevermind, same error doesn't load at all.
package me.defusemc.kiteditor;

import org.bukkit.Bukkit;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin implements Listener {
    KitSelectGUI kitSelectGUI;
    @Override
    public void onEnable() {
        Bukkit.getPluginManager().registerEvents(this, this);
        getCommand("editkits").setExecutor(new KitSelectGUI());
        getCommand("adddefaultkit").setExecutor(new KitEditorCommand());
        kitSelectGUI = new KitSelectGUI();
        kitSelectGUI.createInventories();

    }
}
hoary scarab
icy shadow
#

🤨

#

i dont think it does

river solstice
#

also try to use something different than Main, ex. KitsPlugin or something like that

#

does your plugin.yml have editkits and adddefaultkit defined as commands?

hoary scarab
#

Now its just the UUID giving me problems lol

little summit
little summit
#

when I remove the listener implementation then it gives me a error:

'registerEvents(org.bukkit.event.Listener, org.bukkit.plugin.Plugin)' in 'org.bukkit.plugin.PluginManager' cannot be applied to '(me.defusemc.kiteditor.Main, me.defusemc.kiteditor.Main)'

icy shadow
#

you're decoding something wrong

#

they are 100% sent as distinct packets

hoary scarab
#

Yes they are separate. I didn't explain it right. I can read both of there data in succession is what I meant. I thought it would have something between the packets.

Also the way I read the packets was a factor in this. So all data comes in at once.

#

Anyway I got it to work 😄

edgy lintel
#

PlusOne 💯

icy shadow
edgy lintel
#

looking forward to your standalone packet framework

past ibex
#

technically speaking, the size of second packet is between the packets

icy shadow
hoary scarab
past ibex
#

so you can do real fun stuff like sending one packet but it actually having two packets

edgy lintel
#

nice server set up

past ibex
#

maybe, the splitter might get angry at you

hoary scarab
edgy lintel
#

might as well make my own packet framework to mess with

past ibex
#

the best packet framework would be to copy packetevents 2.0 and rewrite everything except the injector (Injectors suck.) and wrappers

#

what the fuck is the Varint21FrameDecoder decoder doing

#

wouldn't this only loop once

#

oh wait nevermind, i'm stupid

#

It's letting you send a 21 bit number

#

so max packet size is 2097152 bytes

#

yep

little summit
# little summit i've got a problem with my plugin, i can't find any errors or anything bad in my...

any ideas?

package me.defusemc.kiteditor;

import org.bukkit.Bukkit;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin implements Listener {
    KitSelectGUI kitSelectGUI;
    @Override
    public void onEnable() {
        Bukkit.getPluginManager().registerEvents(this, this);
        getCommand("editkits").setExecutor(new KitSelectGUI());
        getCommand("adddefaultkit").setExecutor(new KitEditorCommand());
        kitSelectGUI = new KitSelectGUI();
        kitSelectGUI.createInventories();

    }
}```
edgy lintel
little summit
#

that's literally the only error LOL

#
name: KitEditor
version: '${project.version}'
main: me.defusemc.kiteditor.Main
api-version: 1.19
authors: [ Axecy ]
description: Used for the FFA @ DefuseMC
website: dsc.gg/defuse
commands:
  editkits:
    description: Opens kit editor menu.
  adddefaultkit:
    description: Sets the default kit for a specific kit.
edgy lintel
little summit
#

normally, however in my case there is none. let me try checking agai

#

n

edgy lintel
#

right not descriptions but error stack trace
still kind of descriptions i guess

little summit
# edgy lintel right not descriptions but error stack trace still kind of descriptions i guess
[16:35:08 INFO]: Closing Thread Pool
[16:35:17 INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD'
[16:35:17 INFO]: Reloading ResourceManager: Default, bukkit
[16:35:18 INFO]: Loaded 7 recipes
[16:35:20 INFO]: Starting minecraft server version 1.17.1
[16:35:20 INFO]: Loading properties
[16:35:20 INFO]: This server is running Paper version git-Paper-411 (MC: 1.17.1) (Implementing API version 1.17.1-R0.1-SNAPSHOT) (Git: 6625db3 on ver/1.17.1)
[16:35:20 INFO]: Using 4 threads for Netty based IO
[16:35:20 INFO]: Server Ping Player Sample Count: 12
[16:35:20 INFO]: Default game type: SURVIVAL
[16:35:20 INFO]: Generating keypair
[16:35:20 INFO]: Starting Minecraft server on 0.0.0.0:25659
[16:35:21 INFO]: Using epoll channel type
[16:35:21 INFO]: Paper: Using libdeflate (Linux x86_64) compression from Velocity.
[16:35:21 INFO]: Paper: Using OpenSSL 1.1.x (Linux x86_64) cipher from Velocity.
[16:35:21 ERROR]: Could not load 'plugins/KitEditor-1.0.4.jar' in folder 'plugins'
[16:35:22 WARN]: [ViaVersion] Blocked protocol version 1.9/107 already covered by upper or lower bound
[16:35:22 WARN]: [ViaVersion] Blocked protocol version 1.12.1/338 already covered by upper or lower bound
[16:35:22 WARN]: [ViaVersion] Blocked protocol version 1.9.2/109 already covered by upper or lower bound
[16:35:22 WARN]: [ViaVersion] Blocked protocol version 1.7-1.7.5/4 already covered by upper or lower bound

nothing.

#

there is nothing else related to the plugin

#

[16:35:38 ERROR]: [STDERR] [org.bukkit.craftbukkit.v1_17_R1.legacy.CraftLegacy] Initializing Legacy Material Support. Unless you have legacy plugins and/or data this is a bug!

edgy lintel
#

thats very weird

shell moon
#

just wondering, whats the issue here

edgy lintel
#

probably paper loads plugin async and error gets covered

little summit
#

Is it because I should have it implementing listener and then changing the @override to a eventhandler or something by any chance?

edgy lintel
little summit
edgy lintel
#

nvm valid yaml