#help-development

1 messages · Page 431 of 1

wary harness
#
<Configuration status="WARN">
    <Appenders>
        <Console name="Console" target="SYSTEM_OUT">
            <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %level %logger{36} - %msg%n" />
        </Console>
        <File name="File" fileName="logs/app.log" append="true">
            <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %level %logger{36} - %msg%n" />
        </File>
    </Appenders>
    <Loggers>
        <Root level="debug">
            <AppenderRef ref="Console" />
            <AppenderRef ref="File" />
        </Root>
    </Loggers>
</Configuration>
jagged monolith
sullen marlin
#

why are you even putting a log4j in your plugin

wary harness
#

trying to modify colors for logger and format

jagged monolith
#

If you mean the bukkit.getLogger, I modify that easier without needing anything extra

wary harness
jagged monolith
#

The timestamp is the normal timestamp that your console uses. An don't think you can modify the colours of the log level

brave sparrow
#

Copy the raid world template directory to a new directory with a unique name, load it into the server’s active worlds, then start a new instance of a raid inside it. When the raid finishes, unload the world and delete the directory

forest pumice
#

Is there a way to get an inventory more specifically something maybe like a persistent data container or something similar to it instead of getting its title? (Clicked inventories)

rain sierra
#

Yo, have an issue where I'm tracking damage done to a specific mob via EntityDamageByEntityEvent, but my mob is a custom coded boss that sometimes has invincibility frames, however when tracking the damage, it still counts the damage as done torwards the mob. I'm using event.finaldamage to get the final damage done. Any ideas to fix it tracking damage when the mob is invincible?

#

heres my code

#
if(event.damager !is Player) return

event.damager.sendMessage(convertColorCodes("&cDAMAGE DONE NOW:&a " + event.finalDamage.roundToInt(), false))

if(!damageHashMap.contains(event.damager.name)) {
  damageHashMap[event.damager.name] = event.finalDamage.roundToInt()
} else {
  damageHashMap[event.damager.name] = damageHashMap[event.damager.name]!! + event.finalDamage.roundToInt()
}

event.damager.sendMessage(convertColorCodes("&cDAMAGE DONE TOTAL:&a " + damageHashMap[event.damager.name], false))
#

convertColorCodes is my own function that is just a util function

#

im coding in kotlin btw

tawny remnant
#

How do i apply a PDC tag to a projectile? I want to check for a ProjectileHitEvent and then create an expolosion there, I just dont know how to set the PDC to the snowball.

near crypt
#

Is there a easy way to spawn a nice build house when you type a command? The house is pre-build in my world but its kinda complex

hazy parrot
# rain sierra ```kotlin if(event.damager !is Player) return event.damager.sendMessage(convert...

Don't know about your specific problem, but you can refactor all if-else to damageHashMap[event.damager.name] = (damageHashMap[event.damager.name] ?: 0) + event.finalDamage
There is no reason to call containes then get, because map for contains internally just call get and check if its null
Also consider using uuids instead of names
Now to the problem, how do you declare your mob as invincible?

rain sierra
#

Thank you for the refactoring though

ocean hollow
#

Hi all. How to make permission with a number? For example furnaceQ.multiply.4 (the number can be changed), and depending on the number there will be a different multiplier for the group

humble tulip
#

Not the first post

#

But read the others

bitter steeple
#

How I add a dependency on Maven for spigot from GitHub/Jar ?

wet breach
ocean hollow
#

I have added a String permission variable. And still return 1

hushed spindle
#

could you not just better split the permission by . and then take the last argument

#

i think you would need to add 2 instead of 1 to the last index anyway because this index is exclusive, so it doesnt actually include the number yet this is wrong mb

tender shard
#

you mean URL

jagged monolith
tender shard
#

are there any other "wooden" materials that I forgot?

cinder spindle
#

Hey! I've got this piece of code, but I don't get the new name of the shears. Whats the problem with it?

tender shard
#

What is the issue?

#

Oh you never set back the ItemMeta

cinder spindle
#

wdym sorry?

tender shard
#
ItemMeta meta = myItem.getItemMeta();
meta.setDisplayName("asd");
myItem.setItemMeta(meta);
#

getItemMeta() only returns a clone of the meta so you gotta set it back to the itemstack

cinder spindle
#

Like this ?

tender shard
#

yes

#

if you want to suppress the warning for setDisplayName(), you can also use Objects.requireNonNull

ItemMeta meta = Objects.requireNonNull(myItem.getItemMeta());
cinder spindle
#

Thanks man

#

It works

#

How to reference to a sheep what is sheared and a baby sheep?

tender shard
#

not sure what you mean

cinder spindle
#

Because now I only got getType().Entity.SHEEP done, but I want this to wor on all kinds of sheeps, except mushrooms

#

You can see it here 🙂

tender shard
#

you mean like this?

        if(sheep.isSheared()) {
            // Sheep is already sheared
        }
        if(!sheep.isAdult()) {
            // Sheep is a baby
        }
#

btw you are not supposed to identify your custom shears by it's name. remember people could just rename it on an anvil

#

rather use PDC tags to identify your custom shears

cinder spindle
#

Well, yeah but I want it to apply to all kinds of sheeps.

#

instead of mushrooms

cinder spindle
tender shard
#

i don't think mushroom sheep exist?

#

there's only mushroom cows

cinder spindle
#

oops

#

yeah

#

but you can shear that too

#

😄

tender shard
#

and you want to prevent that?

cinder spindle
#

I want the event to apply on all the sheeps, whether is sheared or not, adult or kid.

#

Forget the mushroom part sorry 😄

tardy delta
#

me wondering what is happening here lol

#

looks like hes generating java code

tender shard
# cinder spindle I want the event to apply on all the sheeps, whether is sheared or not, adult or...
    @EventHandler(ignoreCancelled = true)
    public void onShear(PlayerShearEntityEvent event) {
        Entity sheared = event.getEntity();
        if(!(sheared instanceof Sheep)) {
            // Don't do anything if the sheared entity is not a sheep
            return;
        }
        if(!isMyCustomShears(event.getItem())) {
            // Don't do anything if this is not my custom shears
            return;
        }
        // Now do your stuff, it'll only run for sheeps, no matter whether already sheared or not, or whether it's a baby or not
    }

    private boolean isMyCustomShears(ItemStack item) {
        // Check if the item is your custom shears, preferably with PDC tags
    }
cinder spindle
#

Thanks, it'll help for sure

cinder spindle
#

(after setting the location)

tender shard
#

Do you call saveConfig() after changing the config?

cinder spindle
#

Here or when?

tardy delta
#

after doing smth with .set

cinder spindle
#

Yeah

tender shard
#

In your setcage command

#

Hm yeah that should do

cinder spindle
#

But it doesnt 😄

tardy delta
#

also copy defaults wont do anything if you dont add defaults

cinder spindle
#

Theese are here

tardy delta
#

are you calling addDefault?

tender shard
#

The included config also sets the defaults

cinder spindle
tender shard
#

Does your config.yml properly get added to your jar?

sacred wyvern
#

Is there a way to add custom skins for Villagers or is it only NPC Player Mobs?

tender shard
#

Only players

sacred wyvern
#

Thank you 🙏

cinder spindle
tardy delta
#

change .jar to .zip and go look for it

cinder spindle
#

So yes...

#

Does it override the defaults, or? I'm not sure why is not working, are you?

tender shard
#

delete your config.yml in your plugins/ folder, then try it again

#
  1. stop server, delete plugins/YourPlugin/config.yml
  2. start server
  3. check if config.yml now includes the defaults
  4. use your command
  5. config.yml should now include the default setting AND the location
cinder spindle
#

before

#

after

#

It does override it

tender shard
#

then you must have some other code that also does sth to your config

cinder spindle
#

Let me check

#

hm so I must save it in here too

#

oh its just getting

tender shard
#

nah that's fine

#

idk maybe upload the whole project to github, otherwise it's hard to debug

#

but I gotta go in 5 minutes anyway

cinder spindle
#

Alright

#

I'll be quick

terse ore
#

they changed the minecraft Development plugin UI?

tardy delta
#

is there some kinda of ai where i can upload my 500 lines long build.gradle and it says me wtf im doing?

tender shard
tardy delta
#

working with ancient code 🙏

#

im seriously rethinking to rewrite it from the ground up but its just so many files

cinder spindle
versed canyon
#

I see they deprecated getWorldType() from World. Any alternatives to determine if a World is overworld, nether, or end?

regal scaffold
#

Hey, if I want to access something inside com.mojang.authlib does this mean I need to use spigot mojang-remapped and correctly export my jar or is there an alternative?

quiet ice
#

no, just use the authlib maven artifact

regal scaffold
#

Oh, sure

undone axleBOT
rotund ravine
#

.getEnvironment

versed canyon
tawny remnant
versed canyon
#

I think your second vector is overriding the first one, you need to combine them

#

Can't you modify the first vector and add the Y acceleration?

tawny remnant
#

i dont know that is why im asking

forest pumice
#

How can I use the arguments in the code to be in the config file? For example I have {player} in the config, and I want it to be the same as event.getPlayer() for example.

versed canyon
versed canyon
forest pumice
#

So I want it so that when you do for example:

message: "{player} is now green!" in config.yml
it will send in game the name of the player that I have stored in the code aka:
Player player = e.getPlayer();

#

does that make sense

versed canyon
#

I see what you're trying to do, but that won't really work. I would do this in your config file:

message: "%s is now green!"

I'm not sure where you're showing that message in the code, but as an example:

String message = plugin.getConfig().getString("message");
Player player = event.getPlayer();
Bukkit.broadcastMessage(String.format(message, player.getName());
#

There's null checking you need to do there, but that's the general idea

forest pumice
#

Is that the only way

eternal oxide
#
String message = getConfig().get("message").replace("{player}", player.getName());```
#

err

versed canyon
#

You can do that, by why not just use String.format?

remote swallow
#

end users

#

most of them wouldnt understand it

versed canyon
#

That's what comments are for 😄

remote swallow
#

true, but loads just dont read them

forest pumice
eternal oxide
#

yes

forest pumice
#

I just need to understand it so I remember it in the future lol

#

okay thanks

tawdry echo
#

when player was kicked then playerquitevent is called?

versed canyon
#

Yes, kicking a player triggers PlayerQuitEvent

forest pumice
remote swallow
#

you can trail replaces

versed canyon
#

You can also use replaceAll if you need to replace multiple occurences of the same thing

cinder spindle
#

Hey I have a config.yml but whenever I load it up, and execute a command which will et a location in the cvonfig, the default config is gone, can anyone help me?

#

before

#

after

eternal oxide
#

you are overwriting your config is all

forest pumice
eternal oxide
#

string.replace(...).replace(...).replace(...)

remote swallow
#

config.get("message").replace("{player}", player.getName()).replace("{bank}", something)

forest pumice
#

oh okay

#

ty

tawny remnant
#

Is there a way to check for a MobCollision? Im trying to launch an animal from a player and then create an explosion on collision.

lost matrix
smoky oak
#

is EntityDamageEvent::setDamage setting the final damage? it doesnt say

#

or rather

#

idk what 'raw damage' is

lost matrix
#

No its the damage before the defence calculation

smoky oak
#

dammit

#

welp reflection time

cinder spindle
eternal oxide
#

be sure you save your default config. Can;t really advise without any code

versed canyon
# smoky oak dammit

Are you trying to see how much damage the player is taking with armor, or are you trying to do a set amount of damage to the player?

tardy delta
#

dunno wtf im doing

#

keeps complaining that it cannot find my lombok generated getters

smoky oak
#

to be specific

#

i want to apply a percentage reduction to the damage taken

remote swallow
tardy delta
#

i dont even know

remote swallow
#

you have no repositories block, and you have the lombok plugin so no need for their deps

chrome beacon
tardy delta
#

i have 9 build.gradle files lol

lost matrix
versed canyon
# smoky oak second

I was just thinking, if you're trying to apply a specific damage amount to the player you could just cancel the damage event and use player.setHealth()

remote swallow
tardy delta
#

i just need lombok in the :core module

remote swallow
#

fucking discord

remote swallow
lost matrix
smoky oak
tardy delta
#

other error now lol

smoky oak
#

i really dont want to handle all the edge cases

lost matrix
smoky oak
#

its not for deaths

#

its for conveying damage

tardy delta
#

dunno why one of the classes that i import is in the build folder??

smoky oak
#

i dont think the setHealth has that option

lost matrix
#

Then just reduce it...

versed canyon
smoky oak
#

wdym

#

can you apply a percentage reduction to the damage event?

lost matrix
#
event.setDamage(event.getDamage() * 0.9);

There you go. 10% damage reduction.

smoky oak
#

didnt yall say that setDamage was before damage reduction via armor etc

versed canyon
smoky oak
#

ah

lost matrix
#

Yes but it doesnt matter if its before or after. Its multiplicative either way.

smoky oak
#

are all damage reductions multiplicative then?

tardy delta
#

not lombok one

lost matrix
smoky oak
#

alright that makes that viable then

chrome beacon
#

Yeah the protection enchant caps at 80% damage reduction

sudden grail
#

someone recommend me a plugin that can give me a healer tool for rpg aternos

tawny remnant
#

Is there any way to set a Snowball invisible? or another projectile

sudden grail
#

which one

chrome beacon
versed canyon
lost matrix
eternal oxide
#

item

#

I don;t think it allows to use Air

smoky oak
#

is it only armor or enchantments too? i dont remember

versed canyon
lost matrix
#

If you want to realise something like "Reduces incoming damage by 20%" then
simply reduce the damage in the event

versed canyon
tawdry echo
#

when i use bukkitscheduler for timertask and in the console i have "Craft Scheduler Thread - 23", can a large number of these threads cause some overhead?

young knoll
#

Not really

#

It’s a thread pool

tawdry echo
#

ok

lost matrix
pine forge
#

How exactly would i go about translating my plugin to be compatible with bungee servers?

lost matrix
#

Spigot plugins are always compatible with bungee servers... They dont know of each other.

pine forge
#

What i want is to listen for certain events like chat messages, player kills etc. on all servers that are proxied

lost matrix
#

Or do you want the same jar to run on bungeecord and spigot

pine forge
#

With spigot, i can only put my plugin on one of the servers, with bungee i can put the plugin on the proxy server thats distributing the players, am i understanding that correctly?

lost matrix
#

Yeah but the proxy should be very lightweight.
It should not have to handle a lot of logic.

#

What is your overall goal?

chrome beacon
pine forge
#

I basically want to log certain events

chrome beacon
#

You will need a plugin on the server to send the events to the Bungeecord

pine forge
#

hmm

#

So it makes more sense to just have plugins on each server and connect them together?

lost matrix
pine forge
#

Im sending them over http to another application

#

What you want me to do is just tell the application to accept requests from multiple spigot plugins rather then from only a single bungee one right?

tawny remnant
#

How can i set a Snowball invisible?

lost matrix
#

The application should not talk directly with your plugins at all

pine forge
#

Wdym

river oracle
#

You should have a middle man like a database is what he means

pine forge
#

The application (http server) needs and handles it though

river oracle
pine forge
#

app is not on the server

river oracle
#

Or prometheus

pine forge
#

and why is that better

#

than direct communication

lost matrix
#

This is what you want

tawdry echo
lost matrix
#

Plugins publish events. Applications subscribe to events

pine forge
lost matrix
#

An application which you can publish and subscribe on

#

For example Apache Kafka is state of the art.
Or Redis.
Or something you wrote yourself.

pine forge
#

So plugin receives chat, publishes it to the broker and then the broker redirects it to all subscribed application

pine forge
#

Ah

#

That sounds good

#

Thanks for the help, ill try that out :D

lost matrix
lost matrix
river oracle
#

I'd use a proper caching tool like caffeine to manage expiry tbh

#

You don't have to worry about size because you can just use spigot libraries feature to download and depend upon caffeine without bloating your jar size

forest pumice
#

How exactly do I fix this

river oracle
#

A loop

forest pumice
#

For string in lore add a line?

river oracle
#

Or

ancient plank
river oracle
#

Even crazier

#

addAll

tawdry echo
forest pumice
river oracle
#

?nocode

undone axleBOT
#

It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.

river oracle
#

Check it out it deals with expiry and other things for you as well as being a great cache

forest pumice
#

So.. @river oracle? :|

river oracle
#

I need your code

#

?paste

undone axleBOT
forest pumice
#

Code for what exactly

#

I'm just asking how to add lore

river oracle
#

However you do the lore

forest pumice
#

It's in a config file

river oracle
#

LeatherArmorMeta Iirc

forest pumice
#
ArrayList<String> itemLore = new ArrayList<>();
itemLore.add(lore);
river oracle
#

Your lore is a list

forest pumice
#

oh

tawdry echo
river oracle
#

Caffeine isn't a code fix its a great tool to help you solve your problem

#

I'd argue it's the best way

#

Industry tested and proven java library

forest pumice
river oracle
#

ConfigurationSection#getStringList

forest pumice
#

like I know what that is

ancient plank
#

lowqualitykappa.png

river oracle
#

Bruh

river oracle
#

You are helper you have to help

tardy delta
#
BukkitWiki

The Configuration API is a set of tools to help developers quickly parse and emit configuration files that are human readable and editable. Despite the name, the API can easily be used to store plugin data in addition to plugin configuration. Presently only YAML configurations can be used. The API however was designed to be extensible and allow ...

river oracle
forest pumice
#

yea bro who said I can read

cinder spindle
#

Hey whenever I try to set a value in my config.yml, the default stuff gets overriden, why is it?

eternal oxide
#

?nocode

undone axleBOT
#

It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.

forest pumice
#

And reloading

cinder spindle
#

before

forest pumice
#

Are you sure you aren't deleting the config file before putting it?

cinder spindle
eternal oxide
#

as I said earlier, you have not saved your default config so there is nothing on disc

cinder spindle
eternal oxide
#

delete teh top line, it's pointless

cinder spindle
#

alright, but it still overrides it

eternal oxide
#

just saveDefaults

#

there is no way just setting a section will overwrite a config. show more actual code

cinder spindle
remote swallow
#

im guessing the issue is there is no section its in, and the key doesnt exist already

cinder spindle
regal scaffold
#

Is there a check for all blocks that are openable

#

Like trapdoors, doors, and such

#

Are those part of a specific type

hazy parrot
regal scaffold
#

Yes

#

I mean if those blocks have a specific interface

eternal oxide
regal scaffold
#

Oh wait

#

There's literally

#

an interface

#

Called Openable

eternal oxide
#

my guess you don;t actually have a config.yml in your jar

hazy parrot
regal scaffold
#

Cool lol

regal scaffold
#

I just noticed

hazy parrot
#

That is why I was confused hahahaha

regal scaffold
#

5 seconds ago

#

Yeah yeah mb

#

And thanks goksi

eternal oxide
cinder spindle
eternal oxide
#

I'm going to guess you are using maven but building using artifacts instead

cinder spindle
eternal oxide
#

open that config.yml

#

the one in the jar

ancient plank
#

side note getdisplayname will throw an NPE if the item has no display name

regal scaffold
#

@hazy parrot Obviously openable doesn't have the same methods as a door

#

Like, I can't even use getLocation on openable

cinder spindle
regal scaffold
#

So I assume I just need to check for all instances individually

hazy parrot
eternal oxide
# cinder spindle

ok delete the config you have on your server in your plugins folder

regal scaffold
hazy parrot
#

Can you show code

regal scaffold
#

Or do I just use the blockData

alpine swan
#

if I need to share a hashmap between two classes (used frequently in one of the classes), would it be better to just make the hashmap public+static, or to make a public+static method on the first class which returns the hashmap

this is in terms of performance

eternal oxide
regal scaffold
#
        Block block = sender.getTargetBlockExact(10);
        if (block == null) {
            sender.sendMessage("§cYou are not looking at a block!");
            return;
        }
        if (!(block.getBlockData() instanceof Openable)) {
            sender.sendMessage("§cYou are not looking at a openable block!");
            return;
        }
          //Here I need to get the location of the block, I guess I can use the block directly?

    }
eternal oxide
#

saveDefaultConfig will not overwrite any config which is already there

cinder spindle
hazy parrot
cinder spindle
#

Now this is the config now

regal scaffold
cinder spindle
eternal oxide
#

show your main class

#

you are using a cached config or something

cinder spindle
#

Here is the main class

eternal oxide
#

ok makes no sense, what you are showing is impossible

cinder spindle
#

Where do I have to store the config.yml?

#

And maybe there is 1 little line...

eternal oxide
#

store the config.yml?

cinder spindle
#

I mean

#

I do have it in the resources folder

eternal oxide
#

your safeDefaultConfig copies the config.yml from teh jar to the plugins folder (IF) it doesn;t exist.

#

you have shown that works

cinder spindle
#

Yep

eternal oxide
#

as such you config can not be empty or wiped by set("Location"

#

its literally impossible

cinder spindle
#

mhm

#

its possible.

#

because

#

it does it

#

😄

#

I made an enter at the start and:

#

its strange, how can I modify it's place

eternal oxide
#

you can;'t

cinder spindle
#

Why is it acting so weirdly

eternal oxide
#

you can adjust the comment locaton

cinder spindle
#

Yeah how?

eternal oxide
#

don;t have it in the default config. add it using the API when you add the location

cinder spindle
#

huh?

#

Nevermind, I dont need comments

abstract sorrel
#

guys how would i make a custom rpg health system i tried to make one but it didnt work

cinder spindle
#

thanks man!

eternal oxide
#

so getConfig().setComments("Location", "you can edit this location");

cinder spindle
#

oh its that simple?

#

in that case...

eternal oxide
#

yes

cinder spindle
#

in the main class?

eternal oxide
#

do that after you set the location

#
getConfig().set("Location", ...
getConfig().setComments("Location", new ArrayList<>("you can edit this location"));
getConfig().save();```
cinder spindle
eternal oxide
#

it wants a list

cinder spindle
#

singletonlist

#

or whatever

eternal oxide
#

however you want to do it

cinder spindle
#

thanks man!

#

Eh it overrides the whole config, whatever, nevermind

eternal oxide
#

don't forget a new line at the end of your default config

ocean hollow
#

how can I get first item that has on of Material in array?

cinder spindle
#

just at the end?

eternal oxide
#

wasn;t that your issue before?

#

a messed up default config

cinder spindle
#

Maybe 😄

versed canyon
ocean hollow
#

yeah, I know it

#

this is example

hybrid spoke
ocean hollow
#

okay, thanks

hybrid spoke
#

suggesting to use stream api

versed canyon
#

The .first method will return -1 if that item isn't present, so you need to do this instead:

if(inv.contains(Material.STICK))
    ItemStack itm1 = inv.getItem(inv.first(Material.STICK));
hazy parrot
versed canyon
ocean hollow
#

i mean first() with list of materials. So if I have in inventory Diamonds and Coal, i need to find, which is first

hazy parrot
#

Just loop over inv or use stream api

tardy delta
remote swallow
#

ratio

#

downgrade lombok plugin

#

i think latest is made for gradle 8

#

use 6.6.3

verbal slate
#

Guys, please help. I want maven to automatically select the version for the project + for plugin.yml. How can I achieve this?

remote swallow
#

resource filtering

#

and in plugin.yml set version to version: '${project.version}' iirc

tardy delta
#

now it just tells me it cannot find the getter methods i generated with @Getter

#

trash gradle

remote swallow
#

stop breaking stuff

hazy parrot
#

And for changing in maven file, I just use sed in any kind of ci/cd

verbal slate
#

Maybe you know some guides? Specifically for maven, since everything turned out to be easier with plugin.yml

remote swallow
#

why are you manually running buildtools

hazy parrot
#

Why not

remote swallow
#

fair

hazy parrot
#

It's basically same as adding another third party action

#

They are doing same thing anyway

remote swallow
#

org/spigotmc/spigot

#

just need to add the mojang repo

hazy parrot
#

Well that can significantly speedup workflows, didn't think of it Mao

tardy delta
#

maybe this could help

#

still cant find methods generated by annotation processors 💀

#

and i have no clue what im doing

#

like what is this crap

near crypt
#

why is "RUNNING" never executed?

#

scheduler is Bukkit.getServer().getScheduler();

pseudo hazel
#

because you are printing before the task actually started?

near crypt
#

ye ik but there is another weird thing where the first if statement of the Event onPlayerInteract is never true

lost matrix
# near crypt why is "RUNNING" never executed?

I would use a different approach to this.
Create a runnable which is started in your onEnable.
This runnable contains a collection of players.
OnCommand add -> add player to runnable
OnCommand remove -> remove player from runnable
On logout -> remove player from runnable

#
public class TargetDisplayTask implements Runnable {

  private final Set<Player> activePlayers = new HashSet<>();

  public void addPlayer(Player player) {
    this.activePlayers.add(player);
  }

  public void removePlayer(Player player) {
    this.activePlayers.remove(player);
  }

  @Override
  public void run() {
    for (Player player : this.activePlayers) {
      this.markTargetBlockFor(player);
    }
  }

  private void markTargetBlockFor(Player player) {
    // Some logic
  }

}

Pretty much like this

#

This runnable starts once and is never stopped.
Main benefit here is: You never have to worry about managing a ton of runnables.
You simply add and remove players from this single runnable.

near crypt
#

ok so the runnable is always running but not for every player right?

#

so i can add and remove them

lost matrix
#

Right, you have just one runnable. This is started in your onEnable.

near crypt
#

ok

vivid skiff
near crypt
lost matrix
near crypt
pseudo hazel
#

so you can start it easily

lost matrix
worldly ingot
#

Time to open a PR this morning!

near crypt
vivid skiff
worldly ingot
#

I'll tell you in about 2 minutes when I implement the API

vivid skiff
#

Ok

worldly ingot
#

Though in a few days when it gets merged, I urge you to use Bukkit methods

lost matrix
young knoll
#

Oh yeah since ChooChoo is here

#

Does spigot accept PRs to fix vanilla bugs

worldly ingot
#

Sometimes yes

#

Depends on the impact that vanilla bug has

remote swallow
#

bet its those 2 structure rotation bugs in vanilla

near crypt
vivid skiff
young knoll
#

Well when the methods are implemented he’ll tell you :p

worldly ingot
#

None. I'm adding them now

lost matrix
near crypt
icy beacon
#

?

remote swallow
#

he left

#

lmao

icy beacon
#

little did he know, the plugins that i send to my orderers before they pay have a "time bomb"

#

good luck bozo

remote swallow
#

what kind of time bomb

icy beacon
#

well basically a seven day time bomb that will kill some server files like the world and plugin configurations

remote swallow
#

do you just have a scheduelr to check if its been like 3 days

worldly ingot
# vivid skiff Witch methods can i use from bukkit to do this?

In the meantime,

CraftBlockState state = (CraftBlockState) block.getState();
if (state.getHandle() instanceof BlockBell bell) {
    net.minecraft.world.level.World world = (net.minecraft.world.level.World) ((CraftWorld) block.getWorld()).getHandle();
    EntityPlayer player = ((CraftPlayer) player).getHandle();
    BlockPosition position = BlockPosition.containing(block.getX(), block.getY(), block.getZ());
    bell.attemptToRing(player, world, position, EnumDirection.NORTH);
}```
This will probably work
icy beacon
#

i store a timestamp

#

in the config

worldly ingot
#

I wrote that all in Discord though so don't quote me lol

#

Might need to change World to WorldServer or something

icy beacon
#

but the dude does not know how to use that shit apparently

#

so i'm safe

remote swallow
#

"```java
CraftBlockState state = (CraftBlockState) block.getState();
if (state.getHandle() instanceof BlockBell bell) {
net.minecraft.world.level.World world = (net.minecraft.world.level.World) ((CraftWorld) block.getWorld()).getHandle();
EntityPlayer player = ((CraftPlayer) player).getHandle();
BlockPosition position = BlockPosition.containing(block.getX(), block.getY(), block.getZ());
bell.attemptToRing(player, world, position, EnumDirection.NORTH);
}

#

get quoted

worldly ingot
#

wow

young knoll
#

Attempt to ring

ancient basin
#

I used the function setKeepInventory on the PlayerDeathEvent only if the player is server OP. But when the player die, he drop his inventory on the ground. How to avoid that ?

young knoll
#

What happens if the attempt fails

#

Does the bell explode

worldly ingot
#

Nothing. It will fail if it's in the process of ringing

remote swallow
icy beacon
#

in case you're still here,
в плагины, которые я отправляю заказчикам, заложен кусок кода, который через некоторое время уничтожит важные файлы сервера. если в течение 7 дней вы оплатите мой заказ, я отправлю вам безопасный файл; в противном случае, удачи выжить

worldly ingot
#

Might add an event for it too

remote swallow
#

banned

icy beacon
remote swallow
#

i now want to make a time block class in my lib

icy beacon
#

and judging by how the dude was talking to me, he won't be able to touch it

young knoll
#

BellRingEvent

#

Let’s go

worldly ingot
#

Yeah. Maybe a BellResonateEvent as well

#

I'll have to find that though

remote swallow
#

BellFailRingEvent

near crypt
worldly ingot
#

It's actually been a while since I've added an event to bukkit last lol

young knoll
#

Go revive the entity jump event pr

remote swallow
#

can we piss paper off and get a PlayerJumpEvent

verbal slate
young knoll
#

The problem is it’s just not easy to detect a player jump with perfect accuracy

worldly ingot
#

You have Stash access!

remote swallow
#

he does

#

no way

#

coll gonna have 2 prs open

young knoll
#

lol

remote swallow
#

pull a choco

#

go on a pr spree

young knoll
#

You have stash access too

remote swallow
#

yeah

#

and

#

you think my brain has enough in it to do that

worldly ingot
#

Dude I've got like 9 open PRs atm

remote swallow
#

more

young knoll
#

I’ve never had a PR stay open very long

#

But that’s probably because none of them have been anything big so far

remote swallow
#

also choco when you next see md tell him that the material enum changes or all enum changes should be done 1.20

worldly ingot
#

Oh it's not on the tile entity

#

🤔 I'm not sure whether putting it on the BlockState is the best idea then

steady sand
#

Guys

#

how to develop?

#

i dont know

remote swallow
#

do you know java

steady sand
#

ye little bit

remote swallow
steady sand
#

But i wanna try with Visual studio code

young knoll
#

:pepewhy:

#

Pretend that works

remote swallow
#

same steps but do the vsc equivilent

steady sand
remote swallow
#

equivalent

#

brain smooth

flint coyote
#

well there's nothing wrong with using a different ide but if you just got into coding then why not start with tools dedicated to the language you are using?

young knoll
#

The problem is vs code isn’t really an ide

flint coyote
#

unless the dedicated tools are too expensive. But the community version of IDEA is perfectly fine

steady sand
#

nvm im just trying to code in inteliJ IDEA

flint coyote
steady sand
#

but i dont have this groofy thing

remote swallow
#

use maven

steady sand
#

ok

near crypt
#

@lost matrix i now implemented everything but the block is now marked just one time and then never again

near crypt
#

@lost matrix

desert tinsel
#

how to make playerInteractEvent to be executed only once

remote swallow
#

?interactevent

undone axleBOT
#

The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.

For example, only executing code if the main hand was used:

@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
    if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
        return; // do not progress past this point  |
    }
    // provide functionality
}
lost matrix
icy beacon
#

now he's aware

desert tinsel
near crypt
#

once

icy beacon
steady sand
#

how can i make the spawners work like donutsmp?

icy beacon
#

ffs i'll start asking to be paid per hour next time

remote swallow
#

what are the spawners on donutsmp like

steady sand
near crypt
steady sand
remote swallow
near crypt
remote swallow
icy beacon
#

the code there is so bad

#

it pains me to read

#

wanna see some snippets?

remote swallow
#

my first plugin was a jda suggestion bot

icy beacon
#

what's that

remote swallow
#

i was asking @young knoll so many dumb questions

icy beacon
#

suggestions of what

remote swallow
#

but mc

#

for a server

icy beacon
#

ah

remote swallow
#

allowed people to suggest stuff in game too

lost matrix
icy beacon
remote swallow
#

ouch

icy beacon
#

that's a pain

remote swallow
#

i also used maven

#

hurt a lot

icy beacon
remote swallow
#

i swapped to gradle when i got a class version unsupported error or wtf its called

remote swallow
icy beacon
#

ah

#

maybe xd

remote swallow
#

not the lower case messages

icy beacon
#

if i someday decide to refactor this plugin, i'll have to fetch myself some holy water

remote swallow
#

i was debating about updating this

#

and making it public

#

and add a gui in game

#

and all the other stuff in game

icy beacon
#

NOOOOOO

icy beacon
lost matrix
# near crypt

Again: You are creating two different instances of your TargetDisplayTask class.
Dont do that. Create one instance and pass this one instance around.

remote swallow
#

it took hours for this

#

i had a breakdown before i even tested it because i couldnt figure out how to build it

lost matrix
undone axleBOT
icy beacon
#

not too bad, not the best

remote swallow
#

note the class is called Bot

ancient plank
#

Bote

icy beacon
#

better than Main

remote swallow
#

i couldnt even figure out how to use di lol

icy beacon
remote swallow
#

the fun commits

icy beacon
#

lmao

#

detailed commit desc

young knoll
#

Why is buildtools committing

remote swallow
#

lmfao

#

i ran buildtools

#

it set my git

#

i didnt realise it

#

oh yeah

icy beacon
#

i remember trying to get a cooldown working

icy beacon
young knoll
#

When is buildtools going to get a spigotmc account

#

Start posting plugin

icy beacon
#

cherry on top - 3 NMS classes that are NOT used and that I've absolutely simply copypasted from elsewhere

#

but, you know, they are there

#

let them be

remote swallow
icy beacon
#

i don't want to touch this project ever again

#

easier to code it from scracth i reckon

ancient plank
#

my first plugin used a random thing raycasting library I found on the internet to check if there's an entity within line of sight that I'm looking at

icy beacon
#

maybe run a scheduler where you check if a player is holding an item

icy beacon
ancient plank
#

yep

icy beacon
#

smart

lost matrix
#

Should it constantly run while the player holds it or only once when its equipped

icy beacon
#

i love me a good List<String> list

lost matrix
#

??

icy beacon
#

wait

#

not the uppercamelcase packages

quaint tapir
# lost matrix ??

oh I thought you were saying it should constantly run mb
I think I got the answer
I was saying thanks for help!!

icy beacon
#

if we all publish our first plugins the world is gonna burn

#

this was my second private plugin?

rotund ravine
#

I don't even have mine haha

ancient plank
#

I silently lurk in here a lot so I quickly learned a bunch of do's and dont's between my first and second plugin

icy beacon
#

i was posting so many threads on spigot about the stupidest stuff

remote swallow
#

being here has taught me like 70% of the stuff i know

icy beacon
#

same prob

regal scaffold
#

Hey

#

Where the aikar tryhards at

#

I have a question:

If I want to have a command completion have a parameter like a player, to apply per-player completions. Is that achievable?

icy beacon
#

wdym?

#

explain a bit more in detail please

regal scaffold
#

ACF can have something called CommandCompletions

In my case, this one gives all the available regions:

acf.getCommandCompletions().registerAsyncCompletion("regions", c -> {
            List<String> regions = new ArrayList<>();
                    for (ProtectedRegion r : getHouseManager().worlds.keySet()) {
                        if (getHouseManager().owners.containsKey(r))
                            regions.add(r.getId());

                    }
                    return regions;
                });

I'm wondering if I can have this commandCompletion have a player parameter to be able to only select those which the player sending the command is part of.

icy beacon
#

i think that c (context) has a getSender method or something

remote swallow
#

uhhhh @lost matrix wake up

icy beacon
#

so you can just do something with it

regal scaffold
#

CommandCompletion is a annotation

lost matrix
icy beacon
#

yeah

#

ik

regal scaffold
#

Oh I see what you mean

#

let me try

remote swallow
lost matrix
#

Ah

hot warren
#

if I make my plugin paper only but I never update the spigot resource will my resource be taken down?

regal scaffold
#

Yes indeed

#

That's great

remote swallow
#

you cant put a paper plugin on spigot in the first place

icy beacon
#

np

regal scaffold
#

Think that does the trick

lost matrix
#

Already answered. context contains the sender

icy beacon
hot warren
regal scaffold
#

Smile, ngl

#

This acf learning curve

hot warren
#

less code

regal scaffold
#

Is.... interesting

#

But I'm getting to it

#

Been forcing myself to use it

icy beacon
#

same with kotlin

regal scaffold
#

Still some things I can't comprehend but yeah

#

What is kotlin used for in java

#

I saw a project a few days ago

icy beacon
#

kotlin is a separate programming language

regal scaffold
#

That had a bunch of kotlin stuff on top of the java code

hot warren
#

kotlin is for less boilerplate and null stuff

icy beacon
#

yeah

#

that

regal scaffold
#

I know that, but why would it be mixed with a java plugin?

icy beacon
#

well convenience

hot warren
#

because it's interopable

#

its like js and ts

regal scaffold
#

So you're telling me

hot warren
#

the two can work together

icy beacon
#

my UnderscoreEnchants is currently mostly java but some parts of it are kotlin because the code is just more concise

regal scaffold
#

This guy made a java plugin and decided to write some parts in kotlin too?

icy beacon
#

yeah why not

hot warren
#

why not indeed ^

#

but it has downsides of making the jar bigger but that's just mb

regal scaffold
#

Fair I guess just sounds overcomplicated since you well, already hava java

icy beacon
#

i have two public plugins in kotlin and they are so fun to code

#

for some reason

#

the null safety is so great

rough drift
#

Kotlin is the devil

icy beacon
#

why

rough drift
#

Because of Class.method

icy beacon
#

?

rough drift
#

And all of the nesting required to do anything

rough drift
regal scaffold
#

At the start I thought kotlin was a better way to manage config files only lol

#

Noob me

hot warren
icy beacon
#

i love it

regal scaffold
rough drift
lost matrix
# regal scaffold Been forcing myself to use it

Then go all the way. Dont use String arguments unless you have to.
Create your methods like this

public void addPlayerToRegion(CommandSender sender, OnlinePlayer targer, ProtectedRegion region) {

Add a context resolver for the PR class

hot warren
#

He even added proguard shit to minimize the jar

rough drift
#

somePlayer.updateCommands(); is this a method I made or standard api @icy beacon

hot warren
#

1-2MB after being built

regal scaffold
regal scaffold
#

I'll give it more time rn actually

#

Let me try this stuff again

icy beacon
#

or Ctrl+Q

rough drift
icy beacon
#

i'd clone the project, click F4/Ctrl+Q and find ouit

#

if I REALLY had to

rough drift
#

lmao

icy beacon
#

but why do i need to know this

hot warren
#

extending classes with special functions I don't like

icy beacon
#

to me it's very convenient

hot warren
#

I didn't do it in js

lost matrix
hot warren
#

I don't plan to do it in kotlin

regal scaffold
#

ACF has no javadocs lol

#

What is the difference between context.getPlayer() and context.getIssuer()

steady sand
#

Is there a free arena regen plugin?

regal scaffold
#

Oh wait, getPlayer() is for player object, getIssuer() can be any CommandSender

regal scaffold
#

Oh wait, nvm I think

lost matrix
regal scaffold
#

Wait so let me get this straight

#

If I make my context correctly

#

@lost matrix registerIssuerAwareContext vs registerContext?

#

I wish his classes were documented

tawny remnant
icy beacon
#

cast an entity to LivingEntity

#

make sure it's a LivingEntity at first

#

you can use setHealth on a LivingEntity

tawny remnant
#

Thank you good sir

icy beacon
#

anytime

tardy delta
#

english is difficult

tardy delta
#

wait thats issueronly

#

im outta here

lost matrix
#

What even is a "Seq"
A Sequence?

tardy delta
#

dude made his own arraylist alike thing

remote swallow
#

thrown't

remote swallow
#

src/arc

#

no src/main/java

tardy delta
#

this whole project is a joke to me

lost matrix
#

Fee-fi-fo-fum,
I smell the blood of an Englishman,
...

remote swallow
#

whats a URI and whats the difference between a uri and a url

ivory sleet
#

identifier vs locator/locator

#

URL on equals will open a connection and compare

#

making it io device dependent

#

(blocking essentially, same with hashCode)

polar atlas
#

can someone explain me why is there two types of slot? raw slot and just slot

young knoll
#

slot is bound to the inventory

#

Raw slot is bound to the entire view

polar atlas
#

ok

young knoll
#

Specifically, rawslot will be unique across the top and bottom inventories, where as slot will not be

lost matrix
#

Example for 2 inventories with 18 slots each (0-17)
top has 0-17 bottom has 0-17 but there are 36 raw slots (0-35)

polar atlas
#

is there built in method to get items at given raw slot?

lost matrix
#

InventoryView#getItem(int)

polar atlas
#

tysm!

lapis lark
#

Hello everyone! SpigotAPI fails to detect PLAYER_HEAD placing on 1.19.0-1.19.3 if player is wearing a helmet
Any ideas to somehow fix it?

#

BlockPlaceEvent is triggered, but getItemInHand is AIR.
Moreover, player.getInventory().getItemInMain/OffHand call results to AIR

slow cypress
#

Hey all, I've been working on a proof of concept for a Socket-based plugin...
From my knowledge, since the socket event is async I have to use BukkitRunnable() to interact with stuff. My question is this; is this the best way of doing things? Using a for loop looks okay but I'm not sure on its speed... Is this good enough to run on 20-50 players "instantly"? Code is in kotlin btw

  private fun giveAllPotionEffect(effect: PotionEffectType, duration: Int, amplifier: Int) {
    object : BukkitRunnable() {
          override fun run() {
            server.onlinePlayers.forEach { player ->
              player.addPotionEffect(PotionEffect(effect, duration, amplifier))
            }
          }
        }
        .runTask(plugin)
  }

radiant umbra
near crypt
#

how can i cancel a bukkit runnable in the easiest way?

regal scaffold
#

If I want to change the base command for ACF Command class, I need to make a separate class right? ACF only allows subcommands but if I want the main command to do different I have to do what I said, right?

tardy delta
#

uhh refactoring? anyone..?

#

🤓

young knoll
#

seeing public code always make me feel better about my own code

tardy delta
#

he then has 6000 lines to init every single one of them

hot shoal
#

pls come

#

there

near crypt
#

bro...

young knoll
#

Man already had an answer and still came here

slow cypress
#

you HAVe to help

bold vessel
young knoll
#

Caused by: java.lang.NullPointerException: Cannot invoke "org.bukkit.inventory.meta.ItemMeta.getPersistentDataContainer()" because the return value of "org.bukkit.inventory.ItemStack.getItemMeta()" is null

#

getItemMeta is only null on air

#

So you need to make sure the item is not air

bold vessel
#

So i create an exception for air ?

young knoll
#

mhm

#

Material has an isAir

#

Which covers any type of air

bold vessel
#

I only want to verify when its shield with the pdc shieldleg

#

i dont want the plugin look if its air

#

how can i do this ?

young knoll
#

Then check if the material is a shield

#

And if not, return

bold vessel
#

If i add this to my if

#

itemInOffHand != null && itemInOffHand.getType() == Material.SHIELD

young knoll
#

yeah that'll work

bold vessel
#

i try

livid dove
#

So the latest app we've been making has identified a huuuge problem with bobby (Or any mod that allows longer render distances due to fake chunks loading) + any app utilising the method for converting minecraft region files into the block type / coordinates of individaul region chunks.

Step 1: Install bobby
Step 2: Join a server and explore casually for a few hours
Step 3: Utilise the methods we use in our app to convert chunk data into useful data
Step 4: Oh mother of god....

Reason i'm mentioning this here is erm... how the hell can we counter this guys? xD

#

There arent too many apps that use the raw chunk data, but I'm worried that is only a matter of time till someone realises the potential, sees how one of the few apps publicly available does it, and then suddenly every 10 year old with a basic grasp of java can make undetectable xray xD

#

Christ on a bike you could even take these coordinates and create a "What is the most effective 3x3 tunnel you can dig between 2 points 1000's of blocks away to hit the most diamonds whislt mining" and shit like that

young knoll
#

The normal method of anti-xray should adress that too

livid dove
#

because if it sore obfuscate i hate to say but stuff like bari can already figure that out xD

young knoll
#

Scrambling the chunk data sent to clients by replacing all non-visible stone with random ores

kind hatch
#

Orebfuscator solves all.

livid dove
hot shoal
#

can anyone tell is this error from host side or mine ?

livid dove
#

Same fix slapped into this bad boy, boom, job done

hot shoal
#

as i cant connect to my server

tawny remnant
#

How do i save and load Hashmap from config that determines player's max Mana? Base is 100 but player can get more by doing things

young knoll
#

Well then you can't really address it

#

Unless you rewrite the ore generation on your server so it doesn't match vanilla I guess

livid dove
# young knoll Well then you can't really address it

Well then there is a huge problem as rn, even baritone is caught due to the odd way folk mine.

But if we say release our app, or anyone with half a brain realises the potential of the raw data, then you can do all the calcs, over literally regions of data, outside of the game and create the most least sus mining tunnels possible.

young knoll
#

I guess

#

But the least sus mining tunnels probably just means normal strip mining

livid dove
livid dove
#

And essentialy xray without any indication its xray

#

Now imagine it with crap thats even more rare like ancient debris :S

kind hatch
late hinge
#

yo @kind hatch could ya help me

#

do you know how to change this message when i change my gamemode?

bold vessel
#

texture pack

#

Or essentials (if u have it on your server)

tardy delta
#

someone didnt come to enum class

late hinge
bold vessel
#

but you probably can do it on your plugin too

late hinge
#

i want to know how could i program this

tardy delta
#

override gamemode cmd id ssay

late hinge
tardy delta
#

no

#

(idk if this even works but) register a command with the same name

bold vessel
#
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerGameModeChangeEvent;

public class GameModeChangeListener implements Listener {

    @EventHandler
    public void onPlayerGameModeChange(PlayerGameModeChangeEvent event) {
        Player player = event.getPlayer();
        GameMode newGameMode = event.getNewGameMode();
        if (newGameMode == GameMode.CREATIVE) {
            player.sendMessage(ChatColor.GOLD + "now gmc");
        } else if (newGameMode == GameMode.SURVIVAL) {
            player.sendMessage(ChatColor.GOLD + "now gms");
        } else if (newGameMode == GameMode.ADVENTURE) {
            player.sendMessage(ChatColor.GOLD + "gma");
        } else if (newGameMode == GameMode.SPECTATOR) {
            player.sendMessage(ChatColor.GOLD + "gmsp");
        }
    }
}
#

@late hinge

bold vessel
#

it should work ?

tardy delta
#

where convert to enum?

kind hatch
# livid dove how do you mean?

Instead of looking for xray tunnels or pathing, compare averages. If you have a way to track average mining sessions and the loot acquired then you can use that as a baseline for detecting people who are likely xraying.

Either that or you're going to have to start making an AI anticheat.

livid dove
kind hatch
#

I think you know what I meant though. :p

livid dove
#

Aye.

late hinge
#

it doesn't works

ancient basin
#

Is there a simpler solution to know if an ItemStack is a bed or not instead of using this function ?

public static boolean isBed(Material material)
    {
        return material == Material.RED_BED || material == Material.BLUE_BED || material == Material.WHITE_BED || material == Material.BLACK_BED ||
                material == Material.YELLOW_BED || material == Material.GREEN_BED || material == Material.PURPLE_BED || material == Material.ORANGE_BED ||
                material == Material.BROWN_BED || material == Material.LIGHT_BLUE_BED || material == Material.MAGENTA_BED || material == Material.PINK_BED ||
                material == Material.GRAY_BED || material == Material.LIGHT_GRAY_BED || material == Material.CYAN_BED || material == Material.LIME_BED;
    }
bold vessel
bold vessel
#

Or just edit lang in your texture pack

livid dove
late hinge
bold vessel
ancient basin
#

oh yes, much simpler, thank you

return Tag.BEDS.isTagged(material);
bold vessel
#

edit the gamemode change message

#

its easy

#

u dont need a plugin

late hinge
# bold vessel u dont need a plugin

wdym i wanna make that each of my staffs receive this same message without this default message, just tell me if its possible make this coding

remote swallow
#

yes

#

command pre process event

bold vessel
#

Or just go in your texture pack and edit the line of gamemode change

remote swallow
#

texture pack is pointless

bold vessel
#

Every1 is going to get the same message

remote swallow
#

who the hell wants to install a texture pack just for 1 message

kind hatch
#

^

#

Plus it's completely unnecessary

bold vessel
tardy delta
#

ah cmon

remote swallow
#

if its /gamemode you want to override just grab it from the command pre process event then do stuff

winged anvil
bold vessel
tardy delta
#

i want to rewrite this project but there are a few thousand classes

winged anvil
#

what is it

kind hatch
#

"Light work"

tardy delta
#

isnt there some shortcut to convert a class to an enum?

remote swallow
tardy delta
charred rune
#

Hi everyone. Is there a custom TileEntity creation guide anywhere?

late hinge
ancient basin
#

Is there a function that looking like:

Bed bed = (Bed) event.getClickedBlock().getBlockData();
Player owner = bed.getOwner();

with spigot 1.19 ?

ivory breach
#

Hiya,

I'm trying to get a players ping but for some reason when I do java int ping = player.getPing();

I get this error: The method getPing() is undefined for the type Player

remote swallow
ivory breach
#
public void onPlayerJoin(PlayerJoinEvent event){
        Player player = event.getPlayer();```
ancient basin
#

But org.bukkit.block.Bed is deprecated

ivory breach
#

mc version?

#

1.8.8

#

Is it not a thing in .8?

late hinge
# remote swallow listen to the command pre proccess event, check if the command is what you want,...
package me.clow.commands;

import org.bukkit.GameMode;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.defaults.GameModeCommand;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;

public class gm implements CommandExecutor {
    public boolean onCommand(CommandSender sender, Command cd, String label, String[] args){
        if (sender instanceof Player){
            Player p = (Player) sender;
            if (p.getGameMode() == GameMode.CREATIVE){
                p.setGameMode(GameMode.SURVIVAL);
                p.sendMessage("§aVocê está no survival!!");
            }
            else{
                p.setGameMode(GameMode.CREATIVE);
                p.sendMessage("§cVocê está no criativo!");
            }
            return true;
        }else{
            sender.sendMessage("Você nao e um player");
        }
        return false;
    }
}

``` im doing like that
ivory breach
#

rip

icy beacon
#

text wall

ivory breach
#

any other way to get their ping?

remote swallow
icy beacon
late hinge
icy beacon
#

like I love the version itself but the API is unusable

remote swallow
ancient basin
#

does not exists

ivory breach
late hinge
remote swallow
#

sure

#
@EventHandler
public void onCommand(PlayerCommandPreprocessEvent event) {
    switch (event.getMessage) {
        case "/gamemode creative": {
            event.setCancelled();
            event.getPlayer().setGameMode(GameMode.Creative);
            event.getPlayer().sendMessage("new message");
            break;
        }
    }
}
``` i might have got formatted off on the gamemode enum'