#help-development

1 messages · Page 1522 of 1

ivory sleet
#

Make the command red?

keen kelp
#

like in vanilla, if you type /tp a 90 90, the command will be highlighted

#

above 1.13 that is

ivory sleet
#

Oh yeah implement the TabCompleter

keen kelp
#

because it knows where a is should be an number

hardy swan
#

Even tabcompleter doesnt care about arguments

ivory sleet
#

I think at least

keen kelp
#

yeah but tabcomplete requires me to return an array of possible arguments

#

not if this argument is valid or not

ivory sleet
#

Hmm maybe that’s some sort of brigadier feature or nms stuff then

keen kelp
#

nor can i have an array with all the numbers

#

since that would take infinite ram

hardy swan
#

Best bet is accept and parse them

keen kelp
#

and infinite CPU

hardy swan
#

if invalid send usage

dusty sphinx
#

I have both. maven still complains about not being able to find the symbol, and neither can my IDE

ivory sleet
#

Yeah adding every number to a list sounds like a terrible idea

keen kelp
#

I am doing that but it's just not ideal innit

hardy swan
#

it is not spigot-api for artifactid

keen kelp
hardy swan
#

just spigot

ivory sleet
hardy swan
ivory sleet
#

spigot artifactId requires BuildTools

hardy swan
#

i mean, spigot requires buildtools

minor garnet
#

is there a way to make this code more fluid

hybrid spoke
#

you mean more clean?

keen kelp
#

more fluid as in?

minor garnet
#

yes

keen kelp
#

like smoother camera?

hybrid spoke
#

there are several ways

minor garnet
#

and maybe reduce some lines or improve the back end

minor garnet
#

and that sometimes the crosshair went from where it was

hybrid spoke
#

would firstly divide into various methods

minor garnet
#

original idea

keen kelp
#

In that case get a curve and send multiple packets

minor garnet
#

what do you mean curve

keen kelp
#

a mathematical curve

hybrid spoke
#

spray pattern

minor garnet
#

yes...

keen kelp
#

make one for the speed the the camera should be moving at

minor garnet
#

I don't know how to handle it

keen kelp
#

dont bother with this yet

minor garnet
keen kelp
#

the speed

minor garnet
#

?

keen kelp
#

distance/time

minor garnet
keen kelp
#

say the player's camera goes up by 10 degrees from firing the shot

minor garnet
#

yes

keen kelp
#

say you seperate it into 5 parts of 2 degree

#

then the delay between you sending each packet to move the camera up

#

would be determined by the curve

minor garnet
#

but in this case it would be interesting to go up faster and faster because of the shots, right?

#

the camera would get a bit stuck

#

that's why I created a lerp

keen kelp
#

well every tick is 50ms

#

so if you do it real fast the stutter wouldn't be as noticeable

#

this is the only way to get a smoother camera

#

unless you require the client to install mods

#

but if you think that's too messing, just setting their looking direction works too

potent pecan
#

Is there a way to run an action before the plugin get disabled without using the onDisable() ?

dusty sphinx
#

I reloaded my maven configuration and removed the javadoc dependency, and I'm still having this issue. There must be something else.

keen kelp
#

it's saying server#Spigot() doesn't exist

keen kelp
#

for like reload? or restart

potent pecan
keen kelp
#

So your lib is has an entire plugin shaded in

#

and when the plugin gets disabled, you close the sql connection?

potent pecan
#

plugin.jar
| my library

keen kelp
#

and when the plugin is disabled

#

close the connection

potent pecan
#

yes

keen kelp
#

and why do you not want onDisabled?

potent pecan
#

because I got the plugin instance with JavaPlugin.getProvidingPlugin(MyLibraryClass.class) and I prefear to not ask to the user to add a string on the onEnable and onDisable

keen kelp
#

I see

#

is your lib an independent plugin?

#

like if you build it and drop it into plugins folder would it work?

maiden briar
#

How can I prevent an item in an player inventory from dropping if the player dies?

#

So nobody can pick it up, just remove it

keen kelp
#

cause the best way to do it is make it a plugin and have its own onDisable

#

like How protocolLib doesn't do anything by itself

#

but is still a independent plugin cause it needs event from bukkit and spigot

keen kelp
maiden briar
#

No, I just listen to PlayerDeathEvent, this is the right event maybe?

keen kelp
#

that is correct

maiden briar
#

What can I do in there?

keen kelp
#

and they have a method called getDrops()

#

that returns a List of ItemStacks

#

do you know where to go from there?

maiden briar
#

Yes just remove it from the list?

keen kelp
#

correct

maiden briar
#

Ok thanks

keen kelp
#

that will directly affect the items dropped

maiden briar
#

Yes I understand

keen kelp
#

Good luck

supple elk
#

anyone know why this doesn't give bold?

ivory sleet
keen kelp
#

not sure, try adding the symbol yourself ig?

supple elk
#

what is the symbol for bold?

keen kelp
#

iirc it's b?

ancient plank
#

no

ivory sleet
ancient plank
#

L

#

iirc

supple elk
keen kelp
#

right l yes

supple elk
#

yep that's fixed it

#

I don't know why it's in the order tho

keen kelp
#

I think overwrites

supple elk
#

oh wait I know why

keen kelp
#

I think color codes overwrites the color code

timid kestrel
keen kelp
#

for maven/gradle?

timid kestrel
#

am using gradle, which can handle maven repos I believe

#

yea

keen kelp
timid kestrel
#

Ah, why didn't I think of that!

keen kelp
#

yep

timid kestrel
#

If only I'd of searched for it for the past half hour before coming here!

#

Anyone with any idea what they're talking about have anything actually useful to bring to the conversation?

keen kelp
#

so what do you want

eternal oxide
#

Which version of spigot are you going to build against?

keen kelp
#

just ctrl c ctrl v man

#

why bother

timid kestrel
#

1.17, but the repo's are all listed as snapshots and not releases? Just wanted to double check if that's normal, or if there's a releases repo I'm missing somewhere?

keen kelp
#

they are all snapshots

eternal oxide
#

to build against 1.17 (as its not a full release) you need to run BuildTools to get it locally

#

all release builds are under xml <repository> <id>spigot-repo</id> <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url> </repository>

timid kestrel
keen kelp
#

all of them are in snapshot :)

eternal oxide
#

the link I gave you is the repos

timid kestrel
#

Right, so the idea of having the releases and snapshots repos (which both just contain snapshots) are just there purely to cause confusion?

eternal oxide
#

you use the repo root and the id and version you pick selects which snapshot

timid kestrel
#

Right ok, so the tl;dr is basically just use whatever file is in any of the repo's, even if the filename suggests it may be an unstable snapshot?

eternal oxide
#

you are using gradle so you are not interested in the individual files

timid kestrel
#

I have to specify implementation 'org.spigot:spigot-api:1.15.2-R0.1-SNAPSHOT' in my build.gradle file, for example

eternal oxide
#

You provide gradle with the repo, the groupId, artifactId and version and it selects the correct files

#

yes

#

groupId, artifactId and version

#

groupId is org.spigotmc

#

artifactId is spigot-api

timid kestrel
eternal oxide
#

the R0.1 is the release version, snapshot is a prerelease as far as I know

hardy valley
timid kestrel
#

Right, I see, the release is denoted by the R in the filename, and pre-releases are denoted by pre

I was mistaking snapshot for pre(release)

#

Thanks for helping me clear that up @eternal oxide 🙂

eternal oxide
ivory sleet
#

I mean you could just skip version and use something like + I believe or latest to always target latest @timid kestrel

eternal oxide
hardy valley
#

I did

timid kestrel
#

@ivory sleetOh does it? That's handy to know :), I assume in the case of Gradle, you'd use implementation 'org.spigotmc:spigot-api:+'?

eternal oxide
hardy valley
#

it gives me an error at line 44 (if (!(e.getDamager()).getCustomName().equals("§4§lSanta Claus")) return;)

eternal oxide
#

What is the error?

hardy valley
#

EventException

#

Caused by: java.lang.ClassCastException: org.bukkit.craftbukkit.v1_8_R3.entity.CraftZombie cannot be cast to org.bukkit.entity.Player
at me.thamessia.santaescaper.Santa.onPlayerHitted(Santa.java:44) ~[?:?]
at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_281]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_281]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:300) ~[craftbukkit-1.8.8.jar:git-Bukkit-18fbb24]
... 34 more

ivory sleet
#

implementation is if you shade it such that you provide the dependency at runtime

#

When the dependency is provided and runtime and you only need it at compile time use compileOnly

hardy valley
timid kestrel
#

@ivory sleetAh, okay, something for me to look abit more into (I'm still fairly new to Gradle) - Thanks 🙂

ivory sleet
eternal oxide
hardy valley
#
((Player) e.getEntity()).addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 60,10));
        ((Player) e.getEntity()).addPotionEffect(new PotionEffect(PotionEffectType.POISON, 60, 10));
``` prob this?
eternal oxide
#

yes

hardy valley
#

how can I fix this?

eternal oxide
#

From the code you have shown it should be impossible to have that error. You exit early if getEntity() is not a player

#

ok I see your error

#

You really need to post the correct line numbers

#

((Player) e.getDamager()).addPotionEffect(new PotionEffect(PotionEffectType.HEAL, 60, 2)); getDamager() will be a Zombie not a player

foggy bough
#

these lines give me an error saying that you can't go past kb 2 does that apply to all of these? java Netherite_Axe.addEnchantment(Enchantment.KNOCKBACK, 10000); Netherite_Axe.addEnchantment(Enchantment.FIRE_ASPECT, 10); Netherite_Axe.addEnchantment(Enchantment.DAMAGE_ALL, 10);

tawdry plume
#

Hey guys, two questions:

  1. is there any difference between the player1 and event.getplayer add potion effect as shown here or would they accomplish the same thing?
  2. It seems like my potion effects are being added to the player before the player logs into the game because I see debug msgs in the console. What am i doing wrong here?
@EventHandler
public void playerJoin(PlayerJoinEvent event) {
    
  Player player1 = (Player) event.getPlayer();        
  player1.addPotionEffect(new PotionEffect(PotionEffectType.LEVITATION, 60, 50));

  event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.LEVITATION, 60, 50));

}
ivory sleet
#

player1 points to the same player object which event.getPlayer() returns, if you want to add it later, use the BukkitScheduler and delay the addition of the potion effect.

woeful crescent
#

Does Player#getVelocity() return a clone of the player's velocity?

ivory sleet
#

Yeah

woeful crescent
#

Damn

ivory sleet
#

idk if it’s a clone or just a reconstructed instance

woeful crescent
#

Is it mutable?

ivory sleet
#

Vectors are mutable I think?

woeful crescent
ivory sleet
#

👍

woeful crescent
#

Thanks, you saved me from a bit of trouble. Have a good one.

#

I have another question

#

Similarly, does setting a velocity set a clone of it?

tawdry plume
#

RE: bukkit scheduler and ticks, the L means ticks right? so 5L = 5 ticks where 1 tick = 0.05 seconds? Just want to make sure I understand the time/length lol

eternal oxide
#

L = long

#

which in this case is a tick

ivory sleet
#

Well if u update ur vector instance after, the changes won’t reflect on the player

#

Or the entity for that part

tawdry plume
eternal oxide
#

yes, 20 to a second

#

if your server is not lagging

woeful crescent
#

Is an Invulnerable Entity instanceof Damagable?

eternal oxide
#

good question, you tell us

woeful crescent
#

I can't really test rn

#

I'm on crappy hotel wifi

#

Does this mean that Invulnerable Entities will not implement Damageable?

eternal oxide
#

yes they will

woeful crescent
#

Whoops, meant to post screenshot

eternal oxide
#

whether you can damage them via the methods is another question

woeful crescent
#

Yeah, I was wondering because I was checking if an entity was damageable to include them in a certain attack...

#

What's a good way to make sure you can't knock back holograms or NPCs with special attacks?

eternal oxide
#

give them knock back resistance?

woeful crescent
#

Can I give them 100% knockback resistance?

potent pecan
tawdry plume
#

Should I be using bukkit scheduler or scheduleSyncRepeatingTask for repeating methods? I want to add a potion effect to all players that are alive every x seconds

clear harness
#

How difficult is it to make a class that extends EntityPlayer to make fake player bots?

clear harness
#

Every time I try to spawn in one of my EntityPlayer bots my server crashes

lofty junco
quaint mantle
#

could someone help what are this imports right now in 1.17 spigot please the imports : IChatBaseComponent, PacketPlayOutPlayerListHeaderFooter, ChatSerializer

rancid condor
#

Is there a way to use persistent data storage in 1.8?

alpine urchin
#

net.minecraft.network.chat.IChatBaseComponent

quaint mantle
#

thanks

#

and the others sorry for bothering you

alpine urchin
#

net.minecraft.network.protocol.game.PacketPlayOutPlayerListHeaderFooter

quaint mantle
#

and the chat serializer

alpine urchin
#

ChatSerializer is a inner class in IChatBaseComponent

quaint mantle
alpine urchin
#

np

#

what are you developing mato

quaint mantle
#

a tab plugin

alpine urchin
#

ok

lofty junco
rancid condor
# quiet ice no

So there’s no other way to do it in 1.8? I want to create a player vault plugin but was wondering how I would store the item info

quaint mantle
#

Terrible work around as you wish to develop for such an old version.
Store your stuff in linked maps, and save the maps to a config / database at restart.
Persistent data containers replaced the need for that

upper mica
#

Hello, how do I check if inventory is empty? I tried getContent() method, but it returns as it would be a full inventory, but all values are null when I checked it by printing

#

I was thinking about using stream to filter null values, but there should be another way lol

#

ok nvm, I'm dumb, I forgot about isEmpty() method -_-

amber vale
#

How can I get the attacker of entity X from EntityDamageEvent

upper mica
#

or just use EntityDamageByEntityEvent event

timid kestrel
#

Does spigot have a built-in Sqlite/jdbc connection? Cos It seems to be outright fucking my p6spy/sqlite connection I'm trying to make

eternal oxide
#

yes

timid kestrel
#

wicked, good that's it's been documented precisely nowhere and has been causing me problems for the past 2 days trying to work out wtf is up

eternal oxide
#

take a look inside the spigot jar. you will see everything thats shaded

tame coral
#

I can't remember where to look to know which packet is used for what in protocollib

#

Their docs are really bad so I don't really know

eternal oxide
#

?paste

undone axleBOT
tame coral
#

?

eternal oxide
timid kestrel
#

I don't suppose anyones ever tried using p6spy on spigot? I'm having real trouble getting it to play nicely

eternal oxide
#

thats whats shaded in the spigot jar

timid kestrel
#

All this to simply try and log the SQL querys in terminal...

tame coral
eternal oxide
#

So I gave you the list

tame coral
#

Hmmm

timid kestrel
#

List? What list?

chrome beacon
tame coral
#

Okay thx

eternal oxide
tame coral
#

Okay

stoic osprey
#

My code here:

@Override
    public void onEnable() {
        System.out.println(ChatColor.GOLD + prefix + ChatColor.GREEN + "Initialised");

        Objects.requireNonNull(getCommand("duel")).setExecutor(this);
        Objects.requireNonNull(getCommand("accept")).setExecutor(this);

    }

Is producing this error:

java.lang.NullPointerException: null
at java.util.Objects.requireNonNull(Objects.java:221) ~[?:?]

and I don't know why?

eternal oxide
#

either duel or accept is not in your plugin.yml

stoic osprey
eternal oxide
#

which is line 221?

#

sec

stoic osprey
#

i dont have that many lines

eternal oxide
#

paste your full error

stoic osprey
#
20.06 17:10:29 [Server] ERROR Error occurred while enabling Miniplugin v1.0-SNAPSHOT (Is it up to date?)
20.06 17:10:29 [Server] INFO java.lang.NullPointerException: null
20.06 17:10:29 [Server] INFO at java.util.Objects.requireNonNull(Objects.java:221) ~[?:?]
20.06 17:10:29 [Server] INFO at com.miniplugin.org.miniplugin.Miniplugin.onEnable(Miniplugin.java:27) ~[?:?]
20.06 17:10:29 [Server] INFO at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.16.5.jar:git-Paper-"809466f2e"]
20.06 17:10:29 [Server] INFO at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:380) ~[patched_1.16.5.jar:git-Paper-"809466f2e"]
20.06 17:10:29 [Server] INFO at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:483) ~[patched_1.16.5.jar:git-Paper-"809466f2e"]
20.06 17:10:29 [Server] INFO at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:501) ~[patched_1.16.5.jar:git-Paper-"809466f2e"]
20.06 17:10:29 [Server] INFO at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:415) ~[patched_1.16.5.jar:git-Paper-"809466f2e"]
20.06 17:10:29 [Server] INFO at net.minecraft.server.v1_16_R3.MinecraftServer.loadWorld(MinecraftServer.java:591) ~[patched_1.16.5.jar:git-Paper-"809466f2e"]
20.06 17:10:29 [Server] INFO at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:281) ~[patched_1.16.5.jar:git-Paper-"809466f2e"]
20.06 17:10:29 [Server] INFO at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1065) ~[patched_1.16.5.jar:git-Paper-"809466f2e"]
20.06 17:10:29 [Server] INFO at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:289) ~[patched_1.16.5.jar:git-Paper-"809466f2e"]
20.06 17:10:29 [Server] INFO at java.lang.Thread.run(Thread.java:829) [?:?]
20.06 17:10:29 [Server] INFO [Miniplugin] Disabling Miniplugin v1.0-SNAPSHOT
eternal oxide
#

Miniplugin.java:27

stoic osprey
#

lines 27 is:

Objects.requireNonNull(getCommand("duel")).setExecutor(this);
quaint mantle
#

does someone know which one is playerConnection right now in spigot 1.17

#

?

eternal oxide
stoic osprey
#

I fixed it (apparently I had 2 plugin.yml?)

eternal oxide
#

ok

stoic osprey
#

thanks for help

cyan oyster
#

im new how to start

#

i know java but dont know what to do

tame coral
#

(you really should use intellij and not eclipse)

eternal oxide
#

Do not tell people what IDE to use

#

Use whatever IDE you prefer.

tame coral
#

Eh, just telling my opinion

cyan oyster
#

ok i use eclipse bc i installed it

eternal oxide
#

I also use Eclipse

#

as I like it

cyan oyster
#

and mainly use it to do some random stuff with java

cyan oyster
tame coral
#

Okay

steep nova
#

I started with eclipse and moved to IntelliJ

tame coral
steep nova
#

both are pretty good

cyan oyster
#

i have to use builds too and git bash?

#

type this command in bash? java -jar BuildTools.jar --rev 1.8

stoic osprey
#

I use intellij - I tried eclipse and I didn't like the UI - and also intellij and pyCharm (which I both have) fit nicely together

quaint mantle
#

does someone mind explaining what is bStats and what is its metrics?

eternal oxide
cyan oyster
eternal oxide
#

its minecraft code, not spigot api

#

if you are only using teh API you don;t need nms

cyan oyster
#

idk if im using api

#

i didnt download any api

#

so i think i didnt use api

eternal oxide
#

follow the tutorials I linked

#

The second is most comprehensive

glacial maple
#

Is there any way to specifically prevent certain structures from generating, such as villages?

lofty junco
#

does anyone know how to sort items by its displayname with the comparator

lofty junco
#

i tried it also without reversed

eternal night
#

I think the list is sorted, but you update the inventory everytime before fully populating the list so it is only as sorted as possible at that point

lofty junco
#

did you saw the code corectly?

eternal night
#

yes

#

you add a new friendInfo to the list

#

and then directly add the item to the inventory

#

the inventory is never sorted tho

lofty junco
#

i logged the informations with and without the reversed mevod both doesent work

eternal night
#

You are sorting a partial list dude

#

like, you have n friends

lofty junco
eternal night
#

you first populate the entire list list

#

do not touch the inventory at all

#

then sort once after adding all the friendInfo instances into the list

#

after that iterate over the sorted list and add the items into the inventory

lofty junco
#

@eternal night i tried something like that

#

private void sortFriendsInfo(Player player) {
List<String> friends = SpigotServices.getService().getFriendsService().getPlayerFriendsInfo(player.getUniqueId().toString()).getValue().friends;

    for (int i = 0; i < friends.size(); i++) {
        playerInfo = SpigotServices.getService().getPlayerService().getPlayersInfo(friends.get(i));
        FriendsInfo friendsInfo = SpigotServices.getService().getFriendsService().getPlayerFriendsInfo(playerInfo.uuid).getValue();
        list.add(friendsInfo);
        list.sort(Comparator.comparing((info) -> friendsInfo.isOnline).reversed());
        sendConsoleFriendsInfo(list.get(i));
    }
}
#

would it work tho

eternal night
#

don't sort after the add

#

you sort once the entire list is filled

lofty junco
#

where do i put the sort method then

eternal night
#

outside the loop ?

lofty junco
#

after the method?

#

oh okay xD

eternal night
#

no just outside the loop

quaint mantle
#

what is the easiest way to send colored messages to an user?

eternal night
#

probably legacy chat colour codes

quaint mantle
#

but am I going to need any dependency on my plugin in order to send colored messages?

lofty junco
#

na example player.sendMessage("§bHELLO");

eternal night
#
player.sendMessage(ChatColor.RED + "This is red");
#

would work perfectly fine

#

just legacy 😭

#

and we all hate old stuff

granite stirrup
lofty junco
#

yea it would work too but you can also use example player.sendMessage("§bHELLO");

granite stirrup
eternal night
#

Yes but then you need to know what the b character is mapped to

lofty junco
#

yea right xD

ember crag
#

or you can just use translateAlternateColorCodes

quaint mantle
#

oh, someone already said that

#

god it hurts

lofty junco
#

damn chill whats the probleme there

granite stirrup
#

its ugly

quaint mantle
#

very ugly

lofty junco
#

okay

granite stirrup
#

and hurts ur eyes

quaint mantle
quiet ice
#

and you cannot read it

lofty junco
quiet ice
#

There is 0 contrast and syntax highlighting

quaint mantle
quiet ice
#

It is good enough for normal message, trash for code

quaint mantle
ember crag
eternal night
#

That is still a plugin lmao

#

Yeah you'll need tell raw

eternal night
#

There are a bunch of message generators out there

quiet ice
#

well, player.sendMessage would be a plugin in the first place

ember crag
#

oh sorry i misread the question lmao

#

why did you put java plug-in syntax?

quiet ice
undone axleBOT
bitter briar
#

?eta

undone axleBOT
#

There is no ETA. Having an ETA leads to unrealistic deadlines, false hope, and a bad product. It will be ready when it's ready.

lofty junco
dense goblet
#

is the block break sound's pitch always 1?

#

soundGroup.getPitch() seems off

dusty sphinx
#

this is driving me insane

#

ive tried clearing dependencies, getting the server in different ways, using different API versions, nothing works

#

one line java if(plugin.getServer().spigot().getConfig().getBoolean("settings-bungeecord")) {

odd sentinel
#

is there no statistic for pets tamed? kinda surprised

lofty junco
bitter ridge
#

Is 1.17 nms out? I can't import it in my plugin

chrome beacon
#

Ofc it's out how else would the server work 👀

quaint mantle
#

lol

chrome beacon
plucky comet
#

How do i check if i dont get a real offlineplayer from java OfflinePlayer target = Bukkit.getOfflinePlayer(args[0]);

plucky comet
#

I mean see if the offplayer is a player because if i enter daosadhasoidhasiodjhasiodhasiodhos it will return an object

opal sluice
bitter ridge
ivory sleet
#

EzBedwars I believe you could just use some regex to determine if the name is valid

keen shadow
#

guys can someone give me link to the best plugin for OnePlayerSleep-1.17?

ivory sleet
#

nms package versions don’t exist in 1.17

chrome beacon
sonic dirge
#

Ohh. There's no NMS versioning any more. It's back to the old way.

bitter ridge
chrome beacon
opal sluice
keen shadow
#

guys can someone give me link to the best plugin for OneSleeper-1.17?

keen shadow
#

ohhh wow

alpine urchin
#

Lets say I am pushing values into a ConcurrentMap frequently. If the Map already contains a key, I'd preferably not push the value into it (to save performance), because the values are always the same.

#

Is it worth checking if the map already contains the key? (performance wise)

#

I read a stackoverflow page, someone said for a normal Map its not worth it, but for ConcurrentMap its a different story

#

Does anyone know why? and can they confirm that this is true?

ivory sleet
#

putIfAbsent exists right?

alpine urchin
#

that checks if it contains it

#

probably

chrome beacon
#

🤷‍♂️ Maybe you could make a performance test

ivory sleet
#

Hmm thought it had a special implementation to avoid unnecessary locks

alpine urchin
#

idk

#

lol

#

im just guessing

#

does it?

#

hm

ivory sleet
#

But yeah putting an entry in a concurrent hashmap uses its internal locks so might be worth checking contains

dense goblet
#

okay so turns out sound group for blocks is implemented really poorly

alpine urchin
#

so do i use putIfAbsent

dense goblet
#

it only exposes the pitch/volume of the step sound of all things

ivory sleet
#

Yeah I think that’s best retrooper

alpine urchin
#

Ok Conclure

dense goblet
#

is there a non-NMS way of playing a block break sound properly?

alpine urchin
#

Thank you for your assistance Conclure.

dense goblet
#

with the correct pitch

dusty sphinx
#

what api version were you using? i have almost the exact same implementation and it still isnt working

#

was it removed? whats the alternative?

weary geyser
#

He want's the spigot config

dusty sphinx
#

its super weird

#

its documented, but it doesnt work

weary geyser
#

Yeah

#

Very weird

dusty sphinx
#

how the hell would I do this

lofty junco
#

does anyone know why my list isnt sorted

#

private void sortFriendsInfo(Player player) {
List<String> friends = SpigotServices.getService().getFriendsService().getPlayerFriendsInfo(player.getUniqueId().toString()).getValue().friends;
FriendsInfo friendsInfo = null;

    for (int i = 0; i < friends.size(); i++) {
        playerInfo = SpigotServices.getService().getPlayerService().getPlayersInfo(friends.get(i));
        friendsInfo = SpigotServices.getService().getFriendsService().getPlayerFriendsInfo(playerInfo.uuid).getValue();
        list.add(friendsInfo);
    }
    FriendsInfo finalFriendsInfo = friendsInfo;
    list.sort(Comparator.comparing((info) -> finalFriendsInfo.isOnline).reversed());
    sendConsoleFriendsInfo(list.get(0));
    sendConsoleFriendsInfo(list.get(1));
}
weary geyser
#

?paste

undone axleBOT
weary geyser
#

or indent

#
test```
dusty sphinx
#

in a codeblock, preferably

weary geyser
#

i meant that

#
public void code(blah blah blah)```
quaint mantle
lofty junco
#

wdym how

quaint mantle
#

youve been told twice now

somber hull
#

What would be the best way of making an update to a plugin that adds a new config key, and doesnt require resetting the config

dusty sphinx
#

```java
your smelly code here
```

quaint mantle
#

yeah that

chrome beacon
quaint mantle
#

i cant screenshot yet on linux ;(

lofty junco
#

help

quaint mantle
lofty junco
#

you are so funny

dusty sphinx
#

so since Server.spigot() just straight up doesn't work, how would I go about getting the Server.Spigot instance

quaint mantle
eternal night
#

why does Server#spigot not work o.O

dusty sphinx
#

good question!

eternal night
#

no like, what is the error

dusty sphinx
#

compile time error, not found

dusty sphinx
#

getConfig is a method of Server.Spigot

lofty junco
somber hull
#

why the fuck is this eroring?

chrome beacon
somber hull
#

fuck

#

lol

#

thank you

eternal night
#

@dusty sphinx can you show me your pom.xml ?

#

I can compile a test plugin calling this method perfectly fine

eternal oxide
#

works fine for me too

dusty sphinx
#

already shared it

#

im using API version 1.13-R0.1-SNAPSHOT now, but i had the error then too

#

im not sure what is happening

eternal night
#

any specific errors when running mvn package ?

#

als @lofty junco ```java
list.sort(Comparator.comparing((info) -> finalFriendsInfo.isOnline));

dusty sphinx
eternal night
#

finalFriendsInfo.isOnline is the same for every element

#

info is the placeholder for the lists contents

#

in your case

#

huh. Maybe you have a screwed up local repo ? Could try to purge the spigot api artefacts

umbral vault
#

Does anyone know how to get spigot 1.0.1

dusty sphinx
#

already cleared ~/.m2
tried building under windows, same thing. tried building under wsl, same thing.

eternal night
#

any other dependency in your pom that exports the same class ?

#

you have left out a bunch

dusty sphinx
#

good question

#

lets see what the minimum reproduceable pom is

eternal night
#

👍

lofty junco
eternal night
#

what

#

you want it with a lambda

somber hull
#

How can i get all items from shift-clicking while crafting

#

Because i have a plugin that adds lore to a crafted item

#

But if you shift click multiple stacks

#

it breaks

quaint mantle
#

Anyone know how can i make something like spawn void that if you fall into the void youll be teleport to spawn

eternal oxide
#

just check for damage type

#

first bit of void damage, teleport them and cancel the damage

quaint mantle
#

I dont want players to get damage

chrome beacon
#

Hence the cancel

lunar schooner
#

Hey there, when a scaffolding block is broken, is the BlockBreakEvent called for every block broken as a result?

eternal night
#

don't think so

eternal oxide
#

It should but don;t count on it. It may just trigger through a physics update.

eternal night
#

only direct player action is captured by that event afaik

#

^^ yea

lunar schooner
#

bollocks.

#

Thanks though 😄

digital rain
#

if i have two instances of the same event can it be the cause of above, or what does this want to tell me

eternal oxide
#

read the full error you have a null somewhere

#

look through the stacktrace until you find a mention of one of your packages.

#

The first one mentioned will list the class and its line number

lunar schooner
#

Also checking, it's safe to cancel a physics event? (In this case a breaking scaffolding block)

lunar schooner
#

Sweet. Thanks

eternal night
#

I think there might be some client desync for falling blocks

digital rain
#

oh yeah right im actually dumb since that error message is completely from another thing, still quite confused i am, well whatever, ill have to mess with it more

eternal oxide
#

Learning to read a stacktrace is like a god power for a Java dev.

digital rain
#

ture lol

#

its just that i cant get a thing to work in period of last two days, thats what is mildly infuriating, and the 30degree celsius temperatures are also killing me since im living on the top floor

formal dome
#

is there a command for changing @p (closest player) gamemode

quiet ice
#

yes, "/gamemode @p <gamemode>"

quaint mantle
eternal oxide
quaint mantle
#

I mean thanks for help but how can i teleport player from +5 and lower to spawn?

quaint mantle
#

What should i check?

eternal oxide
#

not as easy

#

you have to monitor all players movement and check their Y axis

quaint mantle
#

Is it recomended to do that?

eternal oxide
#

Its a heavily used event though and should be used carefully.

quaint mantle
#

I want to use less server resource

eternal oxide
#

then detect void damage as I said earlier

quaint mantle
#

I did

#

Eh

#

I think its not matter?

eternal oxide
#

Those are your two choices

quaint mantle
eternal oxide
#

yes, PlayerMoveEvent

quaint mantle
#

And?

lunar schooner
#

Hm, cancelling the physics event does not stop the block from breaking 🤔

quaint mantle
#

How can i check if player is lower than +5 Y

eternal oxide
#

if (event.getTo().getBlockY() <= 5)

quaint mantle
#

Oh Thanks!

wraith rapids
#

learn java

eternal oxide
#

sorry sec

wraith rapids
#

add it as a depend or soft depend

#

or was that loadbefore

#

that was loadbefore

eternal oxide
wraith rapids
#

loadbefore acts like an inverse depend

wise mesa
#

loadbefore will make it unload after

#

and load before

wraith rapids
#

if you have a dependency, that dependency will be fully loaded before your plugin loads

eternal night
#

Try BlockFaceEvent @lunar schooner

wraith rapids
#

it will also be fully loaded when your plugin unloads

#

therefore the inverse would imply that a loadbefore will not be loaded when your plugin is loaded

wise mesa
#

is there a way other than using singletons to expose my plugin's api to other plugins

#

maybe through di?

wraith rapids
#

and that the loadbefore would not be loaded when your plugin is unloaded

#

that is, it gets unloaded first

eternal night
#

bukkit has a service manager

#

you can register an implementation instance for you API interface

paper olive
#

is there a specific way to find the location where the dragon egg spawns after killing the dragon? or would i need to find it manually?

wraith rapids
#

and only one plugin in the world uses it

#

namely vault

grand imp
#

I'm making my first plugin and i get this error:
org.bukkit.plugin.InvalidPluginException: Cannot find main class

lunar schooner
eternal night
#

BlockFadeEvent ?

lunar schooner
#

Yep thats it

eternal night
#

I can see it o.O

wise mesa
#

I do know about the RegisteredServiceProvider

#

I'll use that

#

cool

lunar schooner
#

Though that doesnt appear to be the correct event

eternal night
#

give it a try ❤️

lunar schooner
#

I just mean, looking at the docs I dont think it applies to scaffolding 😅

eternal night
#

yeah but looking at the source it seems like it

wraith rapids
#

the docs sux

lunar schooner
#

oh thats nice

#

Ill give it a shot then

eternal night
#

tho, maybe I understood the source incorrectly xD

#

we shall find out 🥳

lunar schooner
#

Odd though that cancelling the physics event does not work

grand imp
#

I'm making my first plugin and i get this error:
org.bukkit.plugin.InvalidPluginException: Cannot find main class
Can someone help me please? Because nothing in my plugin loads.

sharp bough
#

is it possible to acces the data from a config.yml using another plugin? for example
join plugin
message plugin
messages plugin creates the message "Welcome"
and then join on join event takes the message created by message plugin and then sends this

#

and use that concept for multiple plugins

#

to they all share 1 messages plugin

#

and if you edit the message in the config file of the message plugin

#

they all change

quaint mantle
plucky comet
#
OfflinePlayer target = Bukkit.getOfflinePlayer(clicked.getItemMeta().getLore().get(0).split(" ")[1].split(".")[0]);``` If the lore is `Ban Ezbedwars.` will this get ezbedwars?
wise mesa
#

can my spigot plugin have a constructor with no parameters?

lunar schooner
#

@eternal night seems you're right 😂

wise mesa
#

oh wait nvm doesn't matter anyways

eternal night
#

perfect xD

wraith rapids
#

your main class? yes, the main class must have a no-args constructor

eternal night
#

no better docs than the source code

lofty junco
#

can someone tell me how to write this without lambda list.sort(Comparator.comparing((info) -> finalFriendsInfo.isOnline).reversed());

eternal night
#

why do you want to get rid of lamda here 😭

lofty junco
#

to test something pls tell me 😦

wraith rapids
#

does the new version of windows make f5 work for the networks menu

#

because I don't know of any way to refresh the fucking network list

eternal night
#

you can always implement a lambda as an anonymous class

eternal oxide
wraith rapids
#

yet another thing that win8 actually did better than win10

#

everything just gets worse every year

eternal night
#

your code doesn't even sort anything poxh

river spear
#

how can i prevent water from flowing out of a region with Worldguard?

eternal night
#

if you want online people first, you'd have to compare the info isOnline value

noble glade
#

how do i make a sword that when you block it , it shoots like a lightning where your curser is

#

like hypickle

lunar schooner
onyx shale
eternal night
#

the block doesn't "fade"

#

it is just converted into a falling entity

lunar schooner
#

So PhysicsEvent wouldnt work there either.. damn

eternal oxide
#

Are you trying to prevent scaffolding falling?

lunar schooner
#

Sand, in this case

#

When specific conditions are met, the sand shouldnt fall 😄

#

Hm maybe I can change the block data to have it not falling? 🤔

eternal oxide
#

on block break, test the block above it. If its sand, cancel the event, set the Broken block to Air (without physics) and manually drop a block as loot.

lunar schooner
#

Hm yeah

#

though that would not work for naturally occuring sand

eternal oxide
#

yes it would

lunar schooner
#

Not if the sand block falling isn't directly a neighbor to the block broken, afaik

eternal oxide
#

you test whatever direction you want to detect sand

lunar schooner
#

This is what I tried in a BlockPhysicsEvent, however it does not work

        //We don't want gravity blocks to fall when they (could) have a torch attached/ontop
        if(event.getBlock().getType().hasGravity()) {
            if(!Common.checkSurroundings(event.getBlock().getLocation())) {
                event.setCancelled(true);
            }
        }
eternal oxide
#

not in physics, do it in block break

eternal night
#

Yeah I don't think there is an event that fully cancels sand falling

#

block break definitely is not called when sand falls

eternal oxide
#

you don;t detect each block falling, you detect the supporting block break

eternal night
#

aah

lunar schooner
#

Then I'd need to do massive amounts of calculations to figure out if a sand block is attached that could fall though

eternal night
#

I mean, that gets you in the same trouble as PDC on blocks

lunar schooner
#

Id think there would be a more efficient route

eternal night
#

there are so many events that you'd need to listen to

#

for blocks to change

eternal oxide
#

you only need test in each BlockFace

eternal night
#

you'd also have to test for piston block moving

#

explosions

#

etc

eternal oxide
#

I assumed he only wanted to prevent players breaking blocks causing sand to fall

lunar schooner
#

No, all sand falling in general (Under specific conditions)

#

Hence why I was looking at PhysicsEvent 😄

eternal night
#

Yeah there isn't any event for that

#

would kind of be an issue because it would be called each tick

#

if the sand block is eligible

eternal oxide
#

Yeah, in that case Physics is your only option

eternal night
#

physics is not called for a sandblock falling is it

lunar schooner
#

I would think so, since that's physics

#

Ill check real quick

eternal oxide
#

it will be triggered by a physics event

eternal night
#

idk I am looking at the source rn

eternal oxide
#

each falling sand block fires a physics event to all neighboring blocks

lunar schooner
#

Yep can confirm

eternal night
#

that ? xD

lunar schooner
#

That a falling sand block triggers a Physics Event

eternal night
#

ah perfect

lunar schooner
#

now just the question of how to properly cancel the thing, since event.setCancelled(true) doesnt do a whole lot of anything

wintry lily
#

Can any1 help me?, I put my Ip address in server ip, everything normal, but when I put an Domain in, It always says Failed to bind port

lunar schooner
#

Correct, that field only accepts ipv4 and ipv6, it's the bind-address.

wintry lily
#

well i'm sorry then

#

I'll head there

deft axle
#

I'm updating a plugin of mine that uses a custom inventory menu thing, but it is crashing the server whenever i try to open it
I did a bit of testing and found that it crashes right when it actually runs the player.openInventory function

dusty sphinx
eternal night
#

Yea

#

?paste

undone axleBOT
dusty sphinx
eternal night
#

Hmm, concerning you have two legacy things there, not much I can really guess.
Maybe run mvn dependency:tree to generate a full dependency tree

#

if craft bukkit shows up there somewhere

#

you might be in trouble xD

dusty sphinx
#

vault hmm

#

thats just about the only thing i see that could possibly cause an issue

lofty junco
eternal night
#

Yeah

#

vault seems to be providing bukkit

#

for whatever reason

#

try to exclude it

paper olive
#

I don't know if this is weird behavior or if I'm misunderstanding something. I'm trying to get the type of inventory that an item is being placed into:

holder instanceof Player works
holder instanceof Chest works
holder instanceof EnderChest does not work

#

event.getInventory().getType() == InventoryType.ENDER_CHEST works so it's not a big deal but i'm curious as to what i'm misunderstanding

compact haven
#

thats how you should be checking it

#

instanceof checks are expensive iirc

dusty sphinx
#

yup it was vault

#

odd

paper olive
#

ah, okay, great. that's good with me

#

thanks!

#

easier to check against a list of inventory types from config this way anyhow 👍

dusty sphinx
#

java.lang.NoClassDefFoundError: org.bukkit.craftbukkit.libs.it.unimi.dsi.fastutil.ints.Int2ObjectMap
out of one issue into another

#

i think this one may have been present before though

eternal night
#

what is throwing this issue o.O

dusty sphinx
#

let me get the traceback

#

oddly

#

doesnt happen in versions earlier than 1.17

#

just works

#

or maybe

eternal night
#

Yes 1.17 changed a bunch of the server internals

dusty sphinx
#

hmm

#

works under 1.16.5 with java 16, but it throws a non-exit exception

supple elk
#

Can anyone show me how I can customise tab, or link me to a tutorial? I've looked online and can either only find plugins or find tutorials which just deal with headers/footers and I would like to be able to do complete customisation

dusty sphinx
#

thats fun

#

java 16

#

yay

eternal night
#

not really java 16

#

more spigot 1.17

dusty sphinx
#

i should elaborate

#

when the plugin is compiled with jdk 11 it raised the exception

#

but when it was compiled with jdk 16 it seems to work

#

¯_(ツ)_/¯

#

im going to keep testing to see if its actually something else

supple elk
#

wait 1.17 using java 16??

dusk flicker
#

yes

supple elk
#

cool

dusty sphinx
#

cool until you try to port your plugin to 1.17

waxen plinth
#

You don't need to compile for java 16 for it to work on java 16

supple elk
#

yeah that's probably a headache

waxen plinth
#

Java is backwards compatible

#

You can run code compiled for java 7 on java 16 if you really want

dusty sphinx
eternal night
#

should nonetheless

dusty sphinx
#

still testing

waxen plinth
#

Player#sendPlayerListHeaderFooter

lunar schooner
#

Java 16 is pretty awesome tbh, so much better than the ancients of J8

waxen plinth
#

And you can use the scoreboard and teams to set player prefixes and sort tab

lunar schooner
#

I am even more excited for J17 though

#

the new native access stuff 😍

waxen plinth
#

Is java 17 when we're getting the simd stuff?

lunar schooner
#

Should be promoted to stable then, since it's been incubating in J15 and J16

waxen plinth
#

Nice

#

I'm pretty excited for that even though I'll probably never use it

supple elk
#

what does it do?

lunar schooner
#

I actually will, a lot

#

I'm so damn tired of JNI 😂

waxen plinth
#

simd stands for Single Instruction Multiple Data

#

They're instructions that exist in most modern CPUs

#

That allow it to process much larger amounts of data in one clock cycle

#

For example, you could add to as many as 8 32-bit ints at once

#

Or move them

supple elk
#

😮

waxen plinth
#

You should always use System.arraycopy when you can because its native implementation uses simd

#

But this api will allow you to use all sorts of simd stuff

#

And it will fallback to scalar operations if there's no support for simd

eternal night
#

Isn't it mainly vector API ?

waxen plinth
#

Which is so much better than how C++ simd intrinsics work

waxen plinth
#

Vector, simd

#

Same thing

lunar schooner
#

oh yeah we are getting/have gotten Vector :pogg

eternal night
#

abolish the bukkit vector

lunar schooner
#

and record classes!

eternal night
#

then we just need to get project valhalla

#

and java be looking fine

lunar schooner
#

whats that project valhalla?

eternal night
#

generics overhaul and value types

lunar schooner
#

oeh that sounds pretty neat

waxen plinth
#

Project valhalla has me drooling

eternal night
#

passing those instances by value

#

mhhmm

waxen plinth
#

But god it seems like we're never gonna get it at this rate

eternal night
#

I wonder if they would actually manage to get us generic enums

#

with valhalla

lunar schooner
#

what I would love for Java to get is Rust's enums

#

they're the best thing ever

#

though I doubt we will

eternal night
#

I mean. You can very much create those yourself

lunar schooner
#

eh

waxen plinth
#

Type erasure is one of java's three major design flaws

#

(in my opinion)

eternal night
#

not perfectly

#

but like

#

you can

lunar schooner
#

can you recreate ```rs
enum Option<T> {
Some(T),
None
}

waxen plinth
#

If they fix it with project valhalla, java will be substantially better

#

And also faster

eternal night
#

technically I guess you could with some fun instanceOf crap

lunar schooner
#

that would be awesome

waxen plinth
#

List<int>

#

🤤

eternal night
#

yes gimma that Box<int>

#

🤤

lunar schooner
#

thats pretty neat

eternal night
#

no more auto-unboxing npes

lunar schooner
#

so I then wont need my helper methods to go from List<Integer> to int[] anymore :"D

eternal night
#

because who the fuck will unbox

waxen plinth
eternal night
#

JEP was closed

waxen plinth
#

You could just do BinaryOperator<double>

#

👀

lunar schooner
#

I havent ever worked with that one I think

waxen plinth
#

I've only ever used it once

#

For my math evaluation library

eternal night
#

Yeah the good DoubleStream needs it

waxen plinth
#

Because it's much faster than what I was using

lunar schooner
#

most of my stuff nowadays I do in rust, only thing that I still do in java is PDF generation and spigot plugins lol

waxen plinth
#

I was using BiFunction<Double, Double, Double>

sage swift
#

you have a math library?

#

who are you again

eternal night
#

math parser xD

waxen plinth
#

lol

sage swift
#

library is for books

waxen plinth
#

Cause they provide extra functionality specific to ints

#

range, for example

#

And sum

eternal night
#

I mean

#

that is creation stuff

waxen plinth
#

Though sum is just the same as reduce(0, (a, b) -> a + b)

eternal night
#

yea

waxen plinth
#

It's still nice though

eternal night
#

meh

#

Could have been expressed with better generics

deft axle
#

https://paste.md-5.net/anoxihojer
okay so
my server is crashing when trying to open a custom inventory menu
i debugged a bit and found that it crashes right when it runs player.openInventory

eternal night
#

what version are you on

#

is this latest ?

sage swift
#

update spigot

#

was fixed a week ago

deft axle
#

yup

#

ohhhh okay

#

gotcha

eternal night
#

says yup, but isn't running latest

#

😢

deft axle
#

i was a fool

#

i instinctively yupped for i knew it was recent but then realized

#

probably not latest

lunar schooner
#

Im not running latest either, I update the thing once every couple of days

deft axle
#

i dont need to redownload buildtools right? just re-run it?

lunar schooner
#

yup

deft axle
#

rad

lunar schooner
#

get away with your radians 😛

#

got trauma's to those bastards 😂

deft axle
#

hahaha

eternal night
#

who uses degrees

lunar schooner
#

#

Except when I cant

eternal night
#

how to ban people from spigot discord for saying something unacceptable

lunar schooner
#

like e.g calculating all (x, z) on the edge of a circle required radians

dusty sphinx
eternal night
#

5head

lunar schooner
#

well it depends I suppose, if I'm working with trig functions I do tend to use radians

#

Of all the things they teach in math class, trig is the only thing ive actually used in code 😂

deft axle
#

yeah it depends on the situation whether i use radians or degrees

eternal night
#

Yea was about to ask what your cos of 90 is doing for you lol

lunar schooner
#

yeah not much good lol

deft axle
#

if its like. precise angles that're like, semi-arbitrary, i'll go with degrees
for trig stuff, usually radians

#

but personally i havent really done anything with angles in code

lunar schooner
#

or anything i've learned in math class for that matter 😂

dusty sphinx
#

known paper mapping issue, oh well

#

at least it works in spigot

#

and it will eventually work in paper

eternal night
#

Yeah give them some time, they have a lot of remapping things to fix

lofty junco
#

why are more objects created even though I have checked if they already exist?

timid kestrel
#

question, is there not just a library or anything out there to take care of serializing/deserializing all the things? Like Itemstacks n such? Cos it's a pita

sharp bough
#

you can simply use itemstacks

#

what are you trying to do

timid kestrel
#

Put an itemstack into a database

sharp bough
#

itemstacks are really easy to use and handle

kind coral
#

hi everyone, im asking for a few tips, in my project i have a minion class, i have to save the Minion class every 5 minutes or so, the only thing is that if the server goes down and you put it back up i have no way on getting the player since its offline, how could i go around it?

eternal oxide
#

There is no Player object for offline players

kind coral
#

that is sad

#

i need to save the player somehow

#

since i need it for the reward system etc.

sharp bough
kind coral
#

im doing it

sharp bough
#

but this wont work if you shutdown the server

#

like

#

close it

kind coral
#

what i have is something like this

data:
count:
uuid:
location:

#

sadly tho i load the data on start and getting the player by UUID can return null

#

so i don't know how to actually save the player

sharp bough
#

if you are saving the info in a list you could save the list

#

go 1 by 1

#

and when you load it

#

you make sure theres no problem

eternal oxide
#

you can always get an offlineplayer but they have to be online for there to be a player

kind coral
#

as i said

#

i need the player object

eternal oxide
#

as I said, you can;t

kind coral
#

we need a work-around

eternal oxide
#

there is none

kind coral
#

impossible.

eternal oxide
#

ok

#

you go for it

sharp bough
#

ig you are gonna have to edit how you use the minion

kind coral
#

at this point don't tell me i have to load data on player join

sharp bough
#

or whats requesting it

eternal oxide
#

no you cna load it when you want, you simply can;t get a Player. Only an OfflinePlayer until they login

kind coral
#

what you mean

#

i have the UUID stored in the playerdata file

kind coral
#

still gave me a NPE

eternal oxide
#

yes, because you still tried to get a Player from the OfflinePlayer

proud basin
#

Is there a way to stop a teleportation ?

kind coral
eternal oxide
#

You use the OfflinePlayer. Nothing else

kind coral
#

mh, i'll try

#

does this work with cracked users

eternal oxide
#

I don;t care

kind coral
#

wtf

sage swift
sage swift
kind coral
#

sad

proud basin
sage swift
#

hmmm yes today i will do Cancellable.setCancelled and expect it to work

#

Cancellable is an interface

#

implemented by certain events that can be cancelled

#

i.e. PlayerTeleportEvent, EntityTeleportEvent

proud basin
#

Man why are you so annoying

hexed hatch
#

Cancellable is just an interface implemented to cancellable event classes

#

You would use event.setCancelled(true)

#

Or whatever you’re calling your event

sage swift
#

the # i used above indicated that the setCancelled method was to be used on an instance of an object that implemented the Cancellable interface

weary geyser
#

he's a beginner, I don't think that he would understand that tbh

proud basin
#

Please let me know what makes you think I'm a beginner

ornate heart
#

From your actions lol

proud basin
#

We all makes mistakes but that doesn't mean that I'm a beginner

sage swift
#

i didn't say it

#

¯_(ツ)_/¯

weary geyser
#

i said it

#

i assumed...

#

because those actions are most likely to be caused by a beginner in java

#

i am not insulting you in any way

sand raven
#

so hasPlayedBefore() for some reason isn't working, or i'm using it wrong

broken lava
#

What event is run when an anvil breaks?

wild sinew
#

Hi guys

#

where I can found new mappings?

sage swift
wild sinew
#

I need 1.17 get Item

sand raven
#

1.16.5, and using it in PlayerJoinEvent

sage swift
#

so use buildtools

wild sinew
#

before i get error Caused by: java.lang.RuntimeException: Failed to find NMS class: Item

sage swift
sand raven
# sage swift what version, how are you using it, etc
@EventHandler
    public void join(PlayerJoinEvent e) {
        if(!e.getPlayer().hasPlayedBefore()) {
            ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
            String cmd = (Main.command).replace("$$P", e.getPlayer().getName());
            Bukkit.dispatchCommand(console, cmd);
        }
    }```
sage swift
#

hmm

wild sinew
#

guys (

sage swift
#

it kinda seems to me like when the player joins it would create that data

#

but has it worked before?

sand raven
#

how does it detect if a player has played before? i don't have an alt but i deleted the usercache and playerdata folders

#

no

sage swift
#

whether or not the player data exists, probably

sand raven
#

i deleted that and the command still didn't run

sage swift
#

did you register the listener

sand raven
#

yes

broken lava
#

any clue what event runs when an anvil breaks or should I attempt to find it manually?

sand raven
#

it worked before without the online check

sand raven
#

played before check*

broken lava
#

not the anvil actually breaking (through the whole damaging stuff)

hexed hatch
#

I don’t think there is a specific event for that, surprisingly

broken lava
#

time to resort to NMS to fix dupes

quaint mantle
#

hmm

sage swift
#

i mean

sand raven
#

nms

sage swift
#

BlockPhysicsEvent probably works

broken lava
#

well true but

#

the dupe works through player interaction

sand raven
#

playerdata only gets generated when a user leaves or the server is stopped or /save-all

sage swift
#

it's called for almost everything

quaint mantle
#

what about BlockDamageEvent maybe?

wild sinew
#

heeeelloooooooooooooooooooooooooooooooooooooooo

quaint mantle
broken lava
sage swift
#

no, BlockDamageEvent is for player damaging