#help-development

1 messages ยท Page 133 of 1

dire marsh
#

setResourcePack

#

url pointing to a zip file with just pack.mcmeta and assets folder and nothing else

noble crown
#

okay, but i need it to remove pack from another proxy server

boreal seal
#

i think its client side

#

you can just force to download diff texturepack

noble crown
#

in lobby

dire marsh
#

then install your plugin to remove the pack on the lobby server

#

i don't understand your question or what the issue is

noble crown
#

if i connect to lobby on subserver with custom rp i still have it

hasty prawn
#

Remove it before they switch servers

#

Or just send an empty one when they join the subserver

dire marsh
#

indeed

noble crown
#

there's no pack remove packet

dire marsh
#

Player#setResourcePack

hasty prawn
#

Sam told you how

dire marsh
midnight shore
#

Hi, how can i get all the files under a directory?

noble crown
#

so i can't do it other way?

dire marsh
#

no

noble crown
#

okay, thx

dire marsh
hasty prawn
#

Yes

#

Just make sure it's a directory File#isDirectory

midnight shore
#

ty!

hazy parrot
#

what is exactly reason for Bukkit.getOfflinePlayer being deprecated ?

#

what can i do if i want to get player by name that currently isn't online ?

wet breach
hazy parrot
#

is it ok if i just want to get its uuid ?

wet breach
#

and you should be able to do that from offlinePlayer

hazy parrot
wet breach
#

you can cast offlinePlayer to Player just fyi, but don't be surprised if things don't work just have to be careful lol

worldly ingot
#

You don't even have to do that. getPlayer() does it for you Sunglasses

peak wharf
#

How can i do this, i don't understand...

chrome beacon
#

You could also store the inventory instance

worldly ingot
#

You should hold the inventory instance, or InventoryView

#

The beauty of Maps with int values

#

You're calling #get() on a Map where the key doesn't have a value

#

int value = map.get(key); will throw an NPE if the key isn't mapped because it will auto unbox. Solution would be to use Integer value = // ... instead and null check that, or just check if the map contains() the key first

#

o/

chrome beacon
#

?main :c

chrome beacon
#

Also static instance variable :c

peak wharf
#

how can i put a inventoryView in a hash map ?

chrome beacon
#

?di

undone axleBOT
chrome beacon
peak wharf
#

to save my bagpack

chrome beacon
#

Store the inventory

#

Not the view

peak wharf
#

InventoryHolder ?

chrome beacon
#

No

#

Inventory

peak wharf
#

hmm. i can put this in a hash map ?

chrome beacon
#

Yeah

peak wharf
#

and the Inventory have all contents ?

chrome beacon
#

yes

peak wharf
#

ok

#

i will try

eternal oxide
#

you replace the folder Files.copy(rootFolder, Paths.get(updatesFolder.getPath()),

#

You do know if you download your jar to a folder called update in the server root, the next restart it will be auto copied into the plugins folder

chrome beacon
#

Ghost ping ๐Ÿ’€

#

rude

iron glade
#

Be patient, if someone knows how to help, they will, we're not getting paid here โ˜ ๏ธ

chrome beacon
#

You alreay have the code just specify the other folder

smoky oak
#

?paste

undone axleBOT
smoky oak
#

there a better way to do this

#

cuz it should work but i feel like im being really stupid

midnight shore
#

how can i get all the keys and values in a pdc?

smoky oak
#

u cant since namespaced keys are unique to whatever set em

#

u can look at the data tho

#

/entitydata iirc

midnight shore
#

what if i get all the namespaced keys using pdc.getKeys() and then i do a for loop and get all of the values?

smoky oak
#

u cant

#

or rather

#

u cant access all

#

im unsure if you can loop through the internal keys, but you definitively cant loop through the keys other plugins have set

midnight shore
#

oh no i didn't need to see other plugin ones

smoky oak
#

yea that should work

#

honestly you should try it instead of asking here

#

probably faster

midnight shore
#

okay

smoky oak
#

i recommend just printing out the namespaced key's names to either console or chat to check

#

whats the code to convert a resource into a fileconfiguration again?

quiet ice
#

You probably want to convert it to a memory config instead

smoky oak
#

ah thats annoying

#

my codes using fileconfig

#

also

#

its supposed to read in actual configs later

#

this is temporary so i dont have to edit stuff in two locations

quiet ice
#

Okay bukkit was designed by a moron

smoky oak
#

wat

#

so i do that file thingy that gets the inputstream as string and pass it to that?

#

that sounds wrong somehow

quiet ice
#

Nah

charred blaze
#

How do I add string in config like this from config?

smoky oak
#

'

#

quotes

charred blaze
#

I know I wanted to use this: but wouldn't it appear like this?

quiet ice
#
YamlConfiguration cfg = new YamlConfiguration();
try {
    cfg.loadFromString(new String(getClass().getClassLoader().getResourceAsStream("myresource.yaml").readAllBytes(), StandardCharsets.UTF_8));
} catch (IOException e) {
   System.exit(-7643);
}
charred blaze
quiet ice
#

Oh it's a secret code that let's the universe explode

#

Well, at least it used to

smoky oak
#

yo wtf

#

i cant use that in a static method

quiet ice
#

After Redhat filed JDK-29456 the exit code now only lets the JVM explode

quiet ice
#

Sadly there is no easy way to get the caller class of something

smoky oak
#

dug up some old code

#
public InputStreamReader getResourceReader(String filename) {
        return new InputStreamReader(getResource(filename));}
    private FileConfiguration getBakedConfig(String configFile){
        return YamlConfiguration.loadConfiguration(getResourceReader(configFile));}
quiet ice
#

basically identical

smoky oak
#

yea but it works in a static context

eternal oxide
#

new File() will give you a handle to teh servers root

quiet ice
#

You can just change getClass() to SomeRandomClassWithinThePlugin.class

wet breach
smoky oak
#

unless it returned null

#

no error at least

quiet ice
#

Well those method are not static

wet breach
#

not sure why you are dead set on needing it static

smoky oak
#

cuz i have a separate handler class

#

which in turn aint extending javaplugin so why should it be an object when its just supposed to hold methods

quiet ice
#

getResource() is as little of a static-able method as getClass() (Although frostalf did show a decent workaround)

wet breach
wet breach
quiet ice
#

Performance?

wet breach
#

and that is, it won't filter out if the caller came from the same class

#

you need to do some looping to filter such things out

quiet ice
#

hm yeah, but for getting the classloader of A class within the plugin it should suffice

smoky oak
#

urg

#

ill just do that in the javaplugin instance

wet breach
#

I should say might be more beneficial for you

#
index 0 = Thread
index 1 = this
index 2 = direct caller, can be self.
index 3 ... n = classes and methods that called each other to get to the index 2 and below.
charred blaze
smoky oak
#

i aint using code i dont understand unless the code i dont understand is math

quiet ice
#

I meant to some degree with "caller" - "caller of the method getting the caller"

charred blaze
#

lol

quiet ice
#

getResource() does it under the hood anyways

smoky oak
charred blaze
#

HOW CAN I ADD STRING HERE?

wet breach
#

the only other method that is generally just as efficient and sufficient to get the caller is this
sun.reflect.Reflection.getCallerClass()

ivory sleet
smoky oak
#

theres a difference between watching a video explaining it and understanding it

wet breach
#

0x5F3759DF

smoky oak
#

well yes

#

but also screw you

ivory sleet
#

mye I mean knowing all steps from top to bot is probably a bit much

#

but understanding the general concept wouldnt be too hard Id say

wet breach
#

it is just inverse square root

#

but done more quickly

ivory sleet
#

yep

wet breach
#

its not accurate but generally good enough

smoky oak
#

i know what it does but the IEEE bullshit is where my brain turns off

wet breach
#

754?

#

that is just floating point arithmetic

#

we discussed this like two days ago

smoky oak
#

wasnt there

#

my ass of a brother made me sick with his cold

wet breach
#

obviously not, we even discussed fixed point vs floating point too

#

but floating point arithmetic isn't all that hard really and all the IEEE does is just defines a standard way of doing it, but there is multiple ways to do it

vivid hill
#

I got a little problem so in the consol it says it cannot find the class Main.java this is my main class I specifide in the plugin.yml main: me.jockerlight.addon.Main

wet breach
#

generally should avoid calling your main class Main

vivid hill
#

okey lemme rename it

#

then

wet breach
#

second, odds are the package path you are putting, probably doesn't match what is being compiled

vivid hill
#

yeah it gives me an error when trying to compiole

wet breach
#

generally when errors are encountered during compiling, it stops the compiling process. Probably should fix that problem first ๐Ÿ™‚

vivid hill
#
  JAR creation failed. See details for additional information.
  Resource is out of sync with the file system: '/SKLO/plugin.yml'.
  Resource is out of sync with the file system: '/SKLO/plugin.yml'.
smoky oak
wet breach
#

@fluid river the majority of that standard is about floating point arithmetic

#

small portion describes how to round and interchange the data but otherwise its mainly for floating point arithmetic lol

fluid river
#

integers also use ieee754

#

I calculated sum of numbers in my textbook

#

on my informatics courses

#

with direct/reverse codes

#

and ieee754

#

It was a mess

#

rly

#

get number transfer to 2 system get mantisse and exponent

#

Change exponent when needed

#

by fucking redoing entire number

wet breach
fluid river
#

add and transfer

twilit roost
#

When I use my own dependency which also runs .sendMessage
it doesn't appear on players side, any ideas why?

fluid river
#

to different precision

wet breach
#

but like integers don't actually have to follow 754

fluid river
#

but still i used it for ieee754))

#

idk how to translate the things i learnt to english

wet breach
#

it is only necessary for precision and interchanging

fluid river
#

well as long as your machine is built for ieee754

#

You can't escape it

#

But i outsmarted machines and can do it with pen and paper

twilit roost
# tardy delta ?

I have plugin 1 which is the dependency
there are some commands registered and they do some stuff and then print some message
but when I use the plugin as dependency and try to use the command, nothing happens

And yes, I have the plugin 1 in my /plugins as well with my plugin 2

fluid river
#

i don't rly understand

wet breach
fluid river
#

ez

#

i'm turing: complete edition

vocal cloud
vivid hill
#

tryed almost everything the consol still says that it cannot find the main class ._.

#

``Cannot find main class me.jockerlight.addon.Addon'`

chrome beacon
#

Remove the .java

peak wharf
#

Hi, when i do this lines :

            ItemStack clickedItem = e.getCurrentItem();
            if(clickedItem == null){
                p.sendMessage("Clicked == Null");
            }else{
                p.sendMessage("[" + clickedItem.getItemMeta().getDisplayName() + "]");
            }

My minecraft send me "[]" when i click on a item, but if i click on a item who i changed the name of.. its working

vivid hill
#

still doesnt work Cannot find main class `me.jockerlight.addon.Addon

chrome beacon
#

How did you build your jar?

vivid hill
twilit roost
#

How to hide command suggestion from some players?

vocal cloud
#

By giving the command a perm they don't have

twilit roost
#

yee but that will still show when typing / into chat?

chrome beacon
vivid hill
chrome beacon
#

Could you show how you did that

vivid hill
#

I cant upload pictuzres in the chat here

chrome beacon
#

!verify

undone axleBOT
#

Usage: !verify <forums username>

chrome beacon
#

or DM me

vivid hill
#

ok

twilit roost
vocal cloud
#

Uh then figure out how to mess with spigots method. Reflection probably

wet breach
wet breach
#

and then yon can easily implement permissions for those additional sub commands that don't need to be in plugin.yml

#

will so you how I do permissions

#

show*

twilit roost
twilit roost
#

removeTutorialView removes the suggestion?

vivid hill
wet breach
#

you stated you didn't want to hardcode perms in plugin.yml

#

gave you a solution that doesn't require adding perms to plugin.yml

vocal cloud
#

Jar export

haughty idol
#

how would i go about making a healthbar above each mob and player

peak wharf
# hazy parrot

But i cant get the display name of a Oak wood for example, but the item has a name ....

hazy parrot
#

idk if it is overriden

chrome beacon
#

Instead of getting it as a string

#

Using chat components is easier on Paper

haughty idol
#

i meant something like this [||||]

#

like above each mob's head

#

and when you damage it part of it goes red

#

ah

#

then how do i do that?

#

is that possible without a plugin?

#

or no it needs a plugin

primal wave
#

Hey, i've got a problem on my server i'm attempting to fix with a spigot plugin, i migrated from a world with the y=0 world limit to the new one, but my server is still on 1.17.1, just using a datapack to add the world height and generation features etc.

My issue here is, Maps seem to never render correctly, it Seems all the Rendered Pixels are inside the ground, and not from a normal Birds-eye view.

Does anyone know good way to solve this besides just copying the normal MapRenderer render function to a new MapRenderer extending class and changing it? Thanks

#

i assume it's MapDecoration not returning the correct y level inside the vanilla Map render function

arctic moth
#

any efficient way of checking if a location is in simulation distance

#

aside from checking if a player is in getNearbyEntities using simulation distance

haughty idol
#

which is weird

#

af

south lantern
#

Hello I am looking for a programmer [with payment ๐Ÿ’ธ ] who can help me with a project for Minecraft the project is a RolePlay like GTA 5 FiveM
The server will be in Turkish language it would also work if you leave a YML so that we can translate it.

hazy parrot
#

?services

undone axleBOT
primal wave
#

do you mean as in the healthbar is not visible, or do you mean it only changes its value after two hits?

#

and does every hit after the second work?

haughty idol
#

and yes, every hit works after the 2nd

primal wave
#

could it be that entity.getHealth() is not with the damage subtracted?

#

since the event could be cancelled or changed

haughty idol
#

hm

#

i could put it at priority lowest

#

jsut in case

primal wave
#

no i mean

#

(int)(entity.getHealth() - e.getDamage())

proven sierra
#

It would be suitable for monitor priority

primal wave
twilit roost
sterile token
#

Ok

#

Perfect

raven fern
#

dont really know if i should ask here but i need some cool in game minecrfat sounds lol

vocal cloud
#

If you have a decent mic you can always make them yourself

vivid skiff
#

How can i check if a player has his inventory open?

#

I wanted to check if it was closed and i done it like this if (player.getOpenInventory() == null) { but it isn't working

#

nothing, it isn't working

#

oh, and so how can i make it check if a player has his inventory closed?

fluid river
#

add to list on open remove on close

#

check if not on the list

#

๐ŸคŸ

vivid skiff
#

Me to

#

before tring that i will search something else online or ask to a friend, thaks ๐Ÿ™‚

quaint mantle
#

^^^

primal wave
#

using .equals(null) will send you straight to jail

raven fern
#

is there a way to change an items max dura

arctic moth
#

anyone know what to put for the type parameter in NearestAttackableTargetGoal

#

nms btw

smoky oak
#

shouldnt it show a class even if it doesnt have javadoc

chrome beacon
arctic moth
chrome beacon
#

Open the class and see what it does

#

Usually it sets a named field

arctic moth
#

target type

#

trying to make it attack players but they apparently dont extend LivingEntity

#

oh i was using craftplayer

#

ig that doesnt extend livingentity

chrome beacon
#

Use getHandle on CraftPlayer

arctic moth
chrome beacon
#

?

arctic moth
#

welp i somehow made myself immortal

chrome beacon
#

ServerPlayer should extend LivingEntity. You can get it with CraftPlayer#getHandle

arctic moth
#

i did /kill and did the taking damage effect

#

but took no damage

#

ok now i need to figure out how to make an EntityInsentient like literally nothing casts to it

river oracle
#

more a question for you why would you ever do that

#

lol

#

it makes absoslutely 0 sense

#

not only would you never need to do that its also a bad practice

#

equals throws a NullPointerException

#

if you want a predicate to always be true it'd defeat the purpose of a predicate in the first place

#

just don't use one

arctic moth
#

how would i go about creating a Mob from an Animal

#

stupid idea ik

#

but how would i make it so i can change the goals of normal creatures

#

yes

#

also why cant i get EntityInsentient imported or anything

#

like it doesnt show up in the ide

#

but its there

raven fern
#

is there a way to change an armors max dura

#

or decrease the chance of it taking dura damage other than unbreaking cause that caps out at a certain point

arctic moth
raven fern
#

thats gonna a pain lol

arctic moth
hazy parrot
#

Yes

arctic moth
#

trying to use Mob bc i cant see EntityInsentient anywhere

ivory sleet
#

n -> true works

#

But iirc there is a singleton for such functions that maps a given set to a singleton set

#

For boolean values at least

#

Maybe it was guava or just java std

#

Same story for identity functions

#

You can use x->x

#

Or Function.identity()

snow lava
#

it's possible to check if is an entity into a bounding box?

drowsy helm
#

What

snow lava
#

i wanna check if an entity is inside an area and execute a code from there

drowsy helm
#

Yes, just use bounding box

#

The .contains method

snow lava
#

can be this

drowsy helm
#

Theres 4 overloads

arctic moth
#

any idea wtf this means

#

trying to make custom EntityCreature

primal wave
#

i'd need to reconstruct the whole function or do some sort of bytecode injection and i am not well versed enough in spigot plugin development to even know if that is actually a thing

heavy swan
#

Does anyone know a wiki or something that explains to me how to create a variable, for example I want to create a variable that contains the life of the player and that I can use that variable on my server without the need for the PlaceHolderApi? ๐Ÿค

fresh timber
#

uh where ru doing this in? A handler, a command?

heavy swan
#

in a command to put it in an ItemStack

fresh timber
#

...

#

you wanna put someone's health in a command in an item?

#

like in the name of the item?

heavy swan
#

What I want is to create a variable that contains the life or something else of a player, nothing else without using the placeholdeapi!

pallid cove
#

Hello i need some help please-

arctic moth
#

lmao i need to know who named this

pallid cove
#

Im trying to sign up and I filled all the stuff out but it tells me That i did not complete the CAPTCHA verification properly ;-;

subtle folio
#

I'm not doing the cooldown formula right am I gun.cooldowns.get(uuid) - System.currentTimeMillis() >= gun.cooldown * 20L ๐Ÿฅฒ

static ingot
#

system current millis is probably never gonna be lower than your gun cooldown in ticks, so yea

pallid cove
#

its says Verification: then there is nothing there its just blank

fresh timber
#
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
    UUID pUUID = event.getPlayer().getUniqueId();
    if (spawnmap.get(pUUID) != null) {
        spawnmap.remove(pUUID);
        event.getPlayer().sendMessage(ChatColor.translateAlternateColorCodes('&', "&cYou have moved! You will no longer be teleported."));
    }
}

I am trying to make a /spawn cmd where they can't move and I have this checker but it triggers if they even just move their mouse. Is there a way to make this if they actually move like move over a block or around on a block or hit any w, s, d, and a keys if that is their move forward, move backward, strafe left, and strafe right key binds?

pallid cove
#

Nvm i figured it out just had to go onto a different web page

static ingot
fresh timber
#

uh what

static ingot
#

what's confusing

worldly ingot
fresh timber
#

so I say in an if statement (event.getTo() != event.getFrom()) in my code before I check and it'll work?

static ingot
#

Yes, though you should use the #equals method and not the == operator

fresh timber
#

uh

#

ok

static ingot
#

so (!event.getTo().equals(event.getFrom())

fresh timber
#

oh

#

why

#

does it make it faster or smthin?

#

or is it just easier to read

#

or what

static ingot
#

No, the equals method is oftentimes overridden so that it works slightly different from ==

fresh timber
#

hm

static ingot
#

also upon further inspection, it also uses yaw and pitch values, so you'd be better off comparing the x y and z values directly

#

My bad!

worldly ingot
#

== compares referential equality whereas equals() is overridable and can compare member fields

fresh timber
#

ok

worldly ingot
#

Which is why you often can't check if player.getName() == "Username"

#

because they're not the same instance

static ingot
#

Yeah, but this will instead

Location to = event.getTo();
Location from = event.getFrom();
if (to.getX() != from.getX() || to.getY != from.getY() || to.getZ() != from.getZ()) {
    // ...
}```
fresh timber
#

ah ok

#

so event.getTo() in a PlayerMoveEvent is where they moved and event.getFrom() is where they moved from?

#

also if this is true, does a playermoveevent happen when they stop moving or after a certain time of moving for or happen when they have moved a certain distance because if it happened right when they started the to and from would be exactly the same

static ingot
#

It's based on movement packets sent by the client, so no, to and from won't ever be the same, and it can be called as many as 20 times per second throughout the entire time the player's moving

fresh timber
#

so the minecraft client tells the server that the player using it moved?

static ingot
#

well yeah. that's pretty much the basis of every player event.

fresh timber
#

oh yea cus u have to tell the server u moved to move im dumb

fresh timber
#

so uh I tested the code and it doesn't work

#
    @EventHandler
    public void onPlayerMove(PlayerMoveEvent event) {
        Location to = event.getTo();
        Location from = event.getFrom();
        if (to.getX() != from.getX() || to.getY() != from.getY() || to.getZ() != from.getZ()) {
            UUID pUUID = event.getPlayer().getUniqueId();
            if (spawnmap.get(pUUID) != null) {
                spawnmap.remove(pUUID);
                event.getPlayer().sendMessage(ChatColor.translateAlternateColorCodes('&', "&cYou have moved! You will no longer be teleported."));
            }
        }
    }

doesnt work. it sends me message you have moved! you will no longer be teleported even when you move your mouse a tiny bit

abstract sleet
#

I canโ€™t spot the problem. Make sure you are using the latest jar you have compiled

iron glade
abstract sleet
#

ContainsKey

iron glade
#

yeah just use #contains

fresh timber
#

yea

#

ok

iron glade
#

can also just do
event.getPlayer().sendMessage("ยงcYou have moved! You will no longer be teleported.");

fresh timber
#

oh

#

I thought u had to translate it lol

iron glade
#

my IDE would look like shit if I'd use that translate & every message

abstract sleet
fresh timber
#

yea ik

#

I used to use those in skript

abstract sleet
#

Or you can move the translate method into something like a colorize method which is far shorter and involves no section symbols

fresh timber
#

I used skript before this its a plugin that is like java but just is so slow

#

plugin that makes code easier

abstract sleet
#

Itโ€™s not like Java at all. You will have so much more fun with Java

fresh timber
#

yea well yk what I mean

#

u write code to change things in the server

#

just not rly codew

#

kinda like normal sentinces

hazy parrot
#

There are few different approaches

#

You can have api( in real meaning of it), shared database etc

abstract sleet
#

With a plug-in or Minecraft command?

#

Ask in the plug-in discord

hazy parrot
#

There is some thing called plugin channel, not sure if that is for bungee as I have never worked with it, but you can Google about it

abstract sleet
#

I donโ€™t trust the link can you share it elsewhere like paste.gg or

#

?paste

undone axleBOT
abstract sleet
#

Oh you mean through the bukkit api

#

They try their best to not change things because otherwise it will break lots of plugins

#

So I doubt it has changed

#

I didnโ€™t see a reference to armor stands changing in the past versions

#

Ther might be a tutorial on modifying these in the spigot wiki

dreamy dove
#

How to Play Function Datapack for Players without command?

my players on the Server cant and should not use the function command. But i want to play a function for a player like the command does.
/function <functionname>:play

I googled a lot and cant find anything how to do it

I tryed using Bukkit.getServer().getDatapackManager() but there I only can get Datpacks and enable / disable them.

quaint mantle
#

why doesn't this work?

lost matrix
# quaint mantle

"TimerStartEvent may only be triggered synchronously"
Pretty clear, no?

lost matrix
#

Nope. Nothing changed in that regard.

lost matrix
quaint mantle
#

only when they do createAutoTimer()

#
        new AutoTimer()
                .setTimer(timer)
                .setUpdateInterval(20L)
                .removeTimeEveryUpdate(Time.SECONDS, 1)
                .createAutoTimer();```
#

oh wait

#

im dumb

lost matrix
#

What exactly didnt work? Compiletime? Runtime?

#

Wrong import

#

What does this have to do with you importing the wrong class?

#

Show your imports

#

yes

#

Wait you didnt even import anything...

#

regarding armorstands

#

And why is your class name ArmorStand as well? This is bound to cause problems.

#

Rename your class and import ArmotStand. Your IDE should do that for your automatically.

#

Cool i guess? What should i make of this information?

#

Show your whole code

#

Rename the class

#

Then show your new code

#

Jep looks good. This works.

#

Then you fked up your pom. Or misunderstood maven.
Do you add any external jars to the project?

#

As a jar?

#

How do you compile?

#

How do you compile your project?

#

Ok good. Then all you need to do is change your dependency

        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot</artifactId>
            <version>1.19.2-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
#

What happens if you just clean compile?

#

How can one destroy his setup so badly?

#

Well then use 1.18 and call it a day. smh

fresh timber
#

I have this code and I want it to make a command cooldown but it's not working. I it registered in the main class. Can someone tell me why it doesn't work to make a 5 sec cmd cooldown for all of the commands?

public class CommandCooldowns implements Listener {

    public CommandCooldowns(CoolPlugin plugin) {
        Bukkit.getPluginManager().registerEvents(this, plugin);
    }

    HashMap<UUID, Boolean> map = new HashMap<>();
    public boolean onCommand(PlayerCommandPreprocessEvent event) {
        UUID pUUID = event.getPlayer().getUniqueId();
        if (map.containsKey(pUUID)) {
            event.setCancelled(true);
            event.getPlayer().sendMessage("ยงcWait! You cannot execute commands this quickly!");
        } else {
            map.put(pUUID, true);
            new DelayedTasks(() -> {
                map.remove(pUUID);
            }, 5 * 20);
        }
        return true;
    }
}
drowsy helm
#

wht is a DelayedTasks

iron glade
#

wtf is that

drowsy helm
#

you know bukkit has the scheduler

iron glade
#

public boolean onCommand(PlayerCommandPreprocessEvent event) { ????

drowsy helm
#

pretty sure they're doing it for any command

fresh timber
#

oh... thats not supposed to be a boolean I dont think ;-;

#

maybe thats it

drowsy helm
#

oh yeah it's a void

#

for method

#

but please just use the bukkit scheduler

#

not whatever DelayedTasks is

fresh timber
#

that is so I dont have to type out the whole thing

drowsy helm
#

oh it's an abstraction?

fresh timber
#
public class DelayedTasks implements Listener {
    private static Plugin plugin = null;
    private int id = -1;

    public DelayedTasks(Plugin instance) {
        plugin = instance;
    }

    public DelayedTasks(Runnable runnable) {
        this(runnable, 0);
    }

    public DelayedTasks(Runnable runnable, long delay) {
        if (plugin.isEnabled()) {
            id = Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, runnable, delay);
        } else {
            runnable.run();
        }
    }
}

#

its another class to make it faster

drowsy helm
#

gotcha

granite burrow
#

What's the best way to make a selection type wand, like world edits.

So like the ability to select 1 point in the world and save it and then select a second point in the world.

I already know you get the locations from the player interact event, but im not sure how to save it

drowsy helm
#

just have a map<uuid, pair<location, location>>

granite burrow
#

That was my thought, but how would I store both locations in the pair

drowsy helm
#

sec

#

ill get you a class

#

@Getter
@Setter
public class Pair<L, R> {

    private R right;
    private L left;

    public Pair(L left, R right){
        this.right = right;
        this.left = left;
    }

    public static <E,T> Pair<E, T> of(E l, T r) {
        return new Pair<E,T>(l, r);
    }
}
#

this is whta i use

granite burrow
#

how do you save the left and right side at one time?

drowsy helm
#

wdym

granite burrow
#

if im not mistaken that needs both the input for left and right to create the pair, so how would I get both the input from the player right clicking the block and the player left clicking the block, if their two different events that would need to fire?

drowsy helm
#

Pair<Location, Location> pair = new Pair<Location, Location>(location, null);

granite burrow
#

nvm I found a way to do it, with the way you said I dont think it would work if there were multiple people creating portals, the way ima do it just involves 1 more variable, one for right selection and one for left

drowsy helm
#

if you use a map it definitely would work with multiple players

#

a map<uuid, pair>

granite burrow
#

I meant more so for the pair, im not sure how I would track it for that particular player, since all the info given is just the location and null

drowsy helm
#

oke doke

granite burrow
#

I could just be being dumb but this other way seems easier for me to handle

drowsy helm
#

whats the other way

#

two maps?

granite burrow
#

yeah basically

granite burrow
boreal seal
#

question guys

#

Why i would like to summon armor stand with packets and not just armorstand?

#

i have seen people use packets for it (my goal is not to display different armorstand at same location to different players.

#

so is there really any reason to use the packets options

#

or hell nah?

eternal oxide
#

using packets you can keep their movement smooth

#

it also means they don;t really exist on the server so less overhead.

boreal seal
#

i dont move it ...

eternal oxide
#

but you have the downside that you have to update every single spigot release.

boreal seal
#

so in general there no really benefits with packets?

eternal oxide
#

Depends on what you need to do with them

echo basalt
#

Packet-based armorstands don't really tick

#

They also don't persist

boreal seal
#

i will just display text above chests

#

like i did it before without packets

#

but i'm improving my plugin and optimizing somethings

#

so i was thinking it might be a think that i cloud change

echo basalt
#

it would allow you to display text to certain players

boreal seal
#

yeah its what i meant that its something i dont need in general

#

hm

lost matrix
#

AAHAHAHAH

molten hearth
#

My man accepted defeat

faint frost
#

packets fucking confuse me

drowsy helm
#

that version is almost a decade old

molten hearth
#

Well sometimes people make terrible codebases and when there's an update it's too much work and they give up

vague oracle
#

#1.19ONTOP

shadow zinc
#

how can I get specific insights into plugins, like cpu usage and memory usage

shadow zinc
#

tf we saying spark lol

lost matrix
#

It has a build in profiler

lost matrix
shadow zinc
#

stuff that

molten hearth
#

Well no just don't profile all the time lol

echo basalt
echo basalt
#

They're just bundles of data transmitted between the client and the server

faint frost
#

first understanding them and trying to learn to use them

lost matrix
molten hearth
#

Just send the client random ones and watch it crash

echo basalt
#

Packets send from Server->Client (clientbound) tell the client to render something new
Packets send from Client->Server (serverbound) tells the server that the client has done something

#

For movement

Client -> Server (client tells server to update its own position to new value)

Server receives packet, updates position internally, fires events
Server -> All clients : Movement packet (server tells all other clients that player X changed position)

shadow zinc
echo basalt
#

Just a basic example

#

Pretty much all communication through the internet is done via packets

shadow zinc
#

my favourite way of helping people is making them do the work

faint frost
#

thats that im looking at rn

#

thank you for help tho

echo basalt
#

love it

shadow zinc
#

thanks

#

bruh

faint frost
#

lol

shadow zinc
#

blame the upload speed

echo basalt
#

But yeah, each packet has an ID that represents its fields and type of data

shadow zinc
#

oh lol don't you need to make your spigot plugin modular to support every version

echo basalt
#

There are also multiple protocol stages used to separate different phases of the game (handshake occurs when attempting to join the server, where both sides communicate to establish some base rules)

#

The play stage consists of all packets that are transmitted during general gameplay

#

Once you leave the handshake stage, you can reuse some packet ids because both sides have mutually agreed that the handshake process is over

faint frost
#

this feels like drinking protean but for your brain, also thank you for the crash course.

echo basalt
#

A very shitty way to visualize this, is to pretend like each packet type is a database table, where the table name is the packet id

#

and different stages are just different databases within the same server

shadow zinc
#

any ideas for another grading class?

faint frost
#

damn kinda reminds me of tron with a retro 3d lay out of code

echo basalt
lost matrix
molten hearth
#

Lmao

shadow zinc
molten hearth
#

Steal spark code

shadow zinc
#

...

echo basalt
#

this would only be useful if you actually hooked into influxdb / prometheus

molten hearth
echo basalt
#

because you have better, well-established alternatives otherwise

shadow zinc
#

why do I need that?

echo basalt
#

Why do you need to make your own, bootleg crappy version?

faint frost
#

thats actually usefull

echo basalt
#

ignore the fact that I made bootleg EVERYTHING

faint frost
#

you are a pirate

echo basalt
#

Spark is good enough

shadow zinc
#

its a small part of my plugin, its not the main idea

faint frost
#

i might use spark for xp bar shit

shadow zinc
#

also wouldn't I need to make spark a hard dependency?

echo basalt
#

nah

#

Do you really need it?

shadow zinc
#

no but i think its a cool idea

#

also i'm looking at the developer api and it doesn't show much functionality

#

so I would have to make spark a requirement for my plugin, and then use the little features that it mentions in the developer section

lost matrix
#

You can softdepend on spark and make the feature optional

shadow zinc
flint coyote
#

Doesn't Spark still have log4j infected dependencies?

shadow zinc
#

so just let it throw the exception?

lost matrix
#

No

shadow zinc
lost matrix
#

You can not load any classes of dependencies which are not on the server.
This means you need to design you plugin in a way that nothing spark related
is touched by the class loader if spark is not in the server.

shadow zinc
#

and I assume this will do for a check? java getServer().getPluginManager().getPlugin("Spark")!=null

lost matrix
#

yes

boreal seal
#

7smile7

#

what would work better an real armorstand or an packet armorstand?

#

it would work the same at the end of the day

#

(it meant to display same for all.)

lost matrix
#

The real one does drain server performance

boreal seal
#

how?

#

exactly

lost matrix
#

Its an entity so it gets ticked every tick. There is a bunch of computing happening for every entity on the server.

shadow zinc
#

EvanMclever, my favourite person ๐Ÿ™‚

#

sup home dog

boreal seal
#

hi KyTDK

#

i'm home dog.

shadow zinc
#

damn straight

boreal seal
#

HD-API*

#

because not sure how gonna make everything work correctly...

lost matrix
#

Use DecentHolograms. Better than holographic dispalys

boreal seal
#

pretty sure HD uses packets

#

they have good api?

lost matrix
#

Yes its decent

boreal seal
#

bruh how many libraries he used

#

my plugin is huge and he reaches just 100kb

echo basalt
#

HD has been going through a rewrite lately afaict

boreal seal
#

due?

echo basalt
#

100kb ain't much

lost matrix
#

My (personal) lib 33MB. Thats a lot of dependencies.

echo basalt
#

how big is it without shading stuff tho

#

just code-wise

lost matrix
#

Let me check

echo basalt
#

mans shaded amazon s3

shadow zinc
#

lol

#

my man shaded the entirety of wikipedia

#

in all the languages

lost matrix
echo basalt
#

pretty decent overall

#

did you build without deps or did you just see the size of all the .java files added up?

lost matrix
#

Wait thats the unziped size

echo basalt
#

remove about 10%

#

also check Size, not Size on disk

boreal seal
#

of code

lost matrix
#

in jar format its 410kb

boreal seal
#

i dont think 100kb is not much

#

i got question guys either something that might sound wierd

shadow zinc
#

100kb is nothing

echo basalt
boreal seal
#

very efficient

#

i made many utils to shortcut many things

#

so dont judge the book by its cover

shadow zinc
#

๐Ÿค”

boreal seal
#

if i ask questions its because im not sure its doesnt mean i'm one of those Apes that hangout here

shadow zinc
#

damn he is so smart and hot

fluid river
#

dayem

echo basalt
#

smash

shadow zinc
#

๐Ÿฅต

echo basalt
#

pretty sure my zombies minigame only has like 4k lines

shadow zinc
#

my util library is tiny

echo basalt
#

386kb compiled, not including resource files

boreal seal
echo basalt
#

plugin I started working on is already at like 240kb and I haven't even done much so far

boreal seal
#

then just a minigame

#

its a whole gamemode

echo basalt
#

well I do a minigame with client-sided blocks, custom nms entities and guns

boreal seal
#

๐Ÿ˜ฎ well i didnt make guns

echo basalt
#

where the map is shared, but certain aspects are client-sided

boreal seal
#

i just forked crack-shot

shadow zinc
echo basalt
#

And about a dozen commands

#

bit big

boreal seal
shadow zinc
#

my utils stats

boreal seal
#

nvm actually it does

echo basalt
#

imma run WinDirStat on my ideaprojects folder

#

ok nvm its crashing

shadow zinc
#

typical

boreal seal
#

Imillusion you make vechiles as well

#

for your zombie minigame?

echo basalt
#

why would I need vehicles for that

shadow zinc
#

to run over the walkers obv

echo basalt
#

what kind of kino der toten map has mf cars

lost matrix
#

My current project. Im about 5 weeks in now.

echo basalt
#

I'm not making cold war's outbreak

shadow zinc
echo basalt
#

holy shit

lost matrix
#

200hrs maybe a bit more

echo basalt
#

ok you're working full time nvm

lost matrix
#

Semester break... My last job vanished after mojang announced their nft policies

shadow zinc
#

lol

echo basalt
#

oh yeah those guys

lost matrix
#

So im taking another shot at a personal server project

echo basalt
#

server I worked for wanted to integrate nfts, they just happened to switch goals lately

#

about 30 hours in

boreal seal
#

damn

echo basalt
#

not as much but I've been working sane-levels of time

boreal seal
#

nah bruh my project moves slowly

shadow zinc
#

๐Ÿ˜‰

boreal seal
#

and its like 2 weeks old

echo basalt
#

evan tryna flex

#

don't forget my G

boreal seal
echo basalt
#

I'm the one mf who got like 7 ratings for bashing on your spigot post

boreal seal
boreal seal
#

either i made an pretty interface

#

someone suggested

echo basalt
#

it's hideous

boreal seal
#

hideous.equals?

echo basalt
#

original post was better lmao

boreal seal
#

sorry man im not graphical degisner

#

made it in 5 min in Windows Paint

echo basalt
#

20 minutes on ms-paint goes a long way

rough drift
#

Hey, not really a dev question but how does this javadoc look

boreal seal
#

nah it took me 5 min

rough drift
shadow zinc
#

looks good to me

rough drift
#

ah ok

echo basalt
#

acceptable.

rough drift
#

lmao it's going down

shadow zinc
#

4/10

echo basalt
#

basic.

shadow zinc
#

mediocre

rough drift
#

why tho

echo basalt
#

the minimum.

boreal seal
#

๐Ÿ‘ฝ

shadow zinc
#

we're just playing with you lol

lost matrix
#

Not to mention all the work that goes into UI design. Or entity animations. Or building.

boreal seal
#

its actually really the minimum...

shadow zinc
#

its fine

rough drift
rough drift
echo basalt
#

you have way too much ambition in your head

rough drift
#

I don't know how to write those fancy long texts in english

boreal seal
#

nah man 7smile7 is from the next level

echo basalt
boreal seal
echo basalt
boreal seal
#

4 hours

#

to make something that look like shit

echo basalt
boreal seal
#

I found a russian guy who is volunteer

rough drift
#

whenever I see good shit I am like "what in the hell"

boreal seal
#

told him you will get a special role on discord

#

๐Ÿ’€

echo basalt
#

like

boreal seal
#

ImIllusion i want to share something with u

#

acutally you know im not a builder and i build a huge map (DayZ)

echo basalt
#

I look at the time tracker and get happy if I work more than like 12 hours per week

rough drift
#

This shit is what I can't write

boreal seal
#

so what i did i made creative server

#

and people build those things for me

rough drift
#

but like standard JDK methods have like 96 paragraphs

echo basalt
#

That's great but I don't care

boreal seal
#

thats the result

#

its why find a russian guy

#

for free

echo basalt
rough drift
echo basalt
#

doesn't even have comments on my side

rough drift
#

That's just the fuckin class

boreal seal
#

and not everything went good

#

but yeah

#

i have to spend 15 min looking into good plots

lost matrix
boreal seal
#

the players are sick the build huge dimaond ore buildings

#

i have no clue why

rough drift
boreal seal
#

either no worldedit for them...

echo basalt
#

I'm not getting comments for java wtf

rough drift
echo basalt
boreal seal
#

4 plots

#

with shit diamond ores

#

bruh

rough drift
#

someone spent a long time just writing shit

rough drift
#

mb

echo basalt
#

my jdk might be a lil fucked

rough drift
#

lmao

#

f

shadow zinc
#

im adding a grading for mstp, what range would you consider to be A+

rough drift
#

18+

echo basalt
#

within 5mspt

rough drift
#

18 is still really good

echo basalt
#

yeh

shadow zinc
rough drift
#

at 17 you start to notice it

rough drift
echo basalt
#

mspt != tps

rough drift
#

thought tps

#

lmao

echo basalt
#

they're opposite

rough drift
#

yeah within 20mspt

echo basalt
#

tps = 1 / mspt*50

#

iirc

rough drift
#

a tick takes 50ms at min anyways

#

yeah

#

each tick is 50ms

echo basalt
#

am I the only mf who obsesses over optimizing stupid shit?

rough drift
#

and the server just does nothing for the rest of the tick if it has nothing to do

rough drift
#

and I hate that

#

he uses bytes for loops

echo basalt
#

like I optimized my canvas raytracing from like 3ms into 0.1ms

rough drift
#

instead of ints

echo basalt
#

and still wasn't good enough

boreal seal
#

@echo basalt

echo basalt
#

yep that is fixed

boreal seal
#

are you okay with that?

echo basalt
#

what font is that?

#

make it comic sans

#

you need some more pink and green for good contrast

#

mix brown on highlights

boreal seal
#

ill not remake it i think people should eat with price

#

not with eyes

echo basalt
#

lol ok wtf

#

for thread designs I just copy auxilor's eco lineup

rough drift
#

javadocs are difficult to write lmfao

#

I don't even have an impl

echo basalt
#

Spot the difference

rough drift
#

it's just a fucking line of method

rough drift
echo basalt
#

yessir

#

bottom is auxilor, top is me

#

I also changed the polygons lol

rough drift
#

yeah I do see the polygon changing

#

wait no

#

There big diff

echo basalt
#

goop is slightly different

#

and my text is black

rough drift
#

yours looks les shitty in terms of text

#

but images look worse

echo basalt
#

I don't care about the image lol

#

idk what to put, my plugin works entirely in the backend

rough drift
#

I don't even see border

boreal seal
#

and if u go crazy why i break market price

#

because this market price

#

is unreal

#

Skripts?

echo basalt
#

evan

#

how much do you realistically make per hour

#

10$ skripts are a joke honestly

boreal seal
#

Imillusion

#

you know whats the thing

#

that my main income

#

isnt mc plugins

dim palm
boreal seal
#

mc plugins is my hobbie i love it

echo basalt
#

I survived middle school by doing 5$ commissions and starving myself

rough drift
#

Am workin at โ‚ฌ500/5months (split between two devs, so the original is โ‚ฌ1k)

echo basalt
#

now I'm a highschooler

#

making like 25/hr

boreal seal
#

i make less

echo basalt
#

work in class

boreal seal
#

a hour

rough drift
#

where in tf do ya'll pull the clients from lmfao

boreal seal
#

well im the cheapest

#

they have no other options

#

๐Ÿ’€

shadow zinc
#

i make 0/hr ๐Ÿ’€

echo basalt
#

I provide solid quality

boreal seal
#

KyTDK i make many plugins for free as well

echo basalt
#

which is why people pay more

rough drift
boreal seal
#

my quality is not less then yours

echo basalt
#

sure it's my hobby but I still gotta pay for food

boreal seal
rough drift
#

^

echo basalt
rough drift
#

they are making skript

#

but it compiles to java

boreal seal
#

lol

rough drift
#

so ppl can use it outside of mc

#

;-;

boreal seal
#

my github page is full of private resp...

echo basalt
#

We can compare skillset, scalability, or plain old code standards

rough drift
#

ByteSkript or smt

boreal seal
#

ur skillset is better.

shadow zinc
#

any ideas how I can convert mstp to a percentage, like 5 mstp would be 100%

rough drift
#

yeah

#

the max is 50

#

rather than 100

echo basalt
#

ever learned about the Rule of Threes?

rough drift
#

and just standard percent calc

boreal seal
#

not sure what is that

#

not gonna google i guess nah

echo basalt
#

it's 3rd grade math

boreal seal
#

i dont remember such a topic

rough drift
#

^

boreal seal
#

so what is Rule Of Threes?

#

ill google

shadow zinc
boreal seal
#

what it has to do

#

with math

#

tell me please

rose pike
rough drift
#

It's ByteSkript

echo basalt
#

oh not that rule

#

this one

boreal seal
#

so what is that

echo basalt
rough drift
boreal seal
#

i think yeah i dont remember

echo basalt
#

also wasn't really referring to you, evan

boreal seal
#

i learn different shit

echo basalt
#

but this is basic elementary school math that goes a long way

boreal seal
#

later to 2 x , y

echo basalt
#

it basically makes a ratio between 2 numbers and multiplies that by whatever

rough drift
#

off to learn how to type really long text

echo basalt
#

basic example is like

#

2L of water make 5kg of spaghetti
15L of water make ? of spaghetti

#

calculate

#

just an example, I'm not a cook

rough drift
#

475kg

boreal seal
#

well

rough drift
#

also

#

jesus

boreal seal
#

how did u calculate 475

rough drift
#

5kg?

boreal seal
#

15*7

#

monkey

rose pike
#

15/2*5

rough drift
echo basalt
#

15 * 5 / 2

boreal seal
#

wait how the fuck i got into 15 * 7

rough drift
#

bro

#

what

echo basalt
#

multiply diagonally

boreal seal
#

7*5

#

actually

echo basalt
#

and divide by the other term

rose pike
#

Answer is 37.5

rough drift
#

OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO

#

I SEE IT

boreal seal
#

since 15/2 = 7 (lets say its int no double.) then * 5

rough drift
#

I just leveld up in maths

boreal seal
#

35

echo basalt
rose pike
#

Oooh if you do int division it's 35 ye

rough drift
#

really fast and long text

boreal seal
#

yeah i dont like dealing with doubles

#

3.3333

#

doesnt make sense at all

#

xd

rough drift
#

3.3 with the little hat

echo basalt
#

it really soundsl ike you failed math

boreal seal
#

nah i was the best student

#

sometimes i still solve different problems (DIY)

echo basalt
#

5 minute crafts lookin ahh

boreal seal
#

well you know i finished highschool 5 years ago

#

or so

#

and math 6 years ago

#

afterwards time brain become sand.

echo basalt
#

you act like you're a middle schooler so I heavily doubt

boreal seal
#

no not really

#

lol

#

an maniac can act like a child

#

he is a child