#help-development

1 messages · Page 1626 of 1

torn oyster
#

but it still tracked

#

the one farther away

#

like i was inside the other one

#

but it never tracked that

quaint mantle
#

use <=

#

since you're inside the player its 0 block difference

#

so < is always false

torn oyster
#

its usually Double.MAX_VALUE

quaint mantle
#

?

tame elbow
#

How to get all mobs (including hostile) to run away from the player, Kinda Like when you hit a passive mob? is it in Creature Spawn Event or something?

quaint mantle
tame elbow
quaint mantle
#

I'm still have no idea why this isn't working ;-;

#

there's a separate one for the player, PlayerDropItemEvent

torpid zinc
#

I would need yall's advice

quaint mantle
#

pp

quaint mantle
torpid zinc
#

for my click detection on my gui, I check if inv title is the same as a certain string, is there any way to prevent a user of simply naming a chest and faking my GUI??

quaint mantle
#

i hate it when i cant read errors bcuz stoopid console spam to fast

quaint mantle
#

but i just need it for the mobs, and not the player

#

i put the == instead of != at first by accident, and changed it during the next attempts

#

oh, well then cancel the event on PlayerDropItemEvent

#

then do what you want in EntityDropItemEvent

#

i-i'm trying to cancel it when a mob drops an item

#

im so confused lol

#

so then just cancel it in EntityDropItemEvent, as im pretty sure that doesn't apply to players

#

no need to check if it's a player

#

that's pretty much what i'm trying to do but it doesn't work or output anything, also, i'm pretty sure players would trigger it as well since they're entities

#

right now you are testing if the entity is a player, if you want it to apply to all mobs, remove that check

#

i want it to apply only to non-player mobs*

#

yeah so you wouldn't need any check, just cancel the event

#

EntityDropItemEvent does not apply to players

#

that's why theres PlayerDropItemEvent

#

mmmmkay give me a second

#
public class EntityDropItem implements Listener {
    @EventHandler
    public void onEntityItemDrop(EntityDropItemEvent event) {
        System.out.println(1);
        event.setCancelled(true);
        //if(event.getEntityType() != EntityType.PLAYER) {
        //    event.setCancelled(true);
        //}
    }

}

revised version

#

that should work

barren moon
#

I wonder if there is any way to create a generic instance dynamically

quaint mantle
#

annnd still nothing ;-;

quaint mantle
#

not even an output?

quaint mantle
#

no output, and i'm pretty sure i compiled it right

#

i tried EntityDropItem it didnt work for players for some reason

#
  • was making an anti-dupe button
#

that's not what he wants though

#

and i'm only trying to get it for mobs and not players

#

ohhhh sorry

#

i only saw the code on phones

#

i'll stfu lol

barren moon
quaint mantle
#

it's alri

quaint mantle
#

he did register it, so im not quite sure

#

mind if i uhhh try screensharing in a vc while deafend if it might help?

#

you cant

#

oh, nvm then

barren moon
#

Does anyone konw if there is any way to create a generic instance dynamically?

barren moon
#

yes

quaint mantle
#

(MyObject) myObject.getClass().getDefaultConstructor().newInstance(args)

barren moon
#

i mean generic , like ArrayList<T>

#

And I need to define what T is in runtime

quaint mantle
#

look through here

barren moon
#

Sorry, my question is not very accurate. But I googled it and they say generics are a compile-time only feature. So i guess i cant do it.

quaint mantle
#

[20:24:21 ERROR]: Could not load 'plugins/AbsenceBasics-1.0.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: dev/bunk/absence/AbsenceBasics has been compiled by a more recent version of the Java Runtime (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0

#

how to fix thdsi

young knoll
#

Update java on the server

#

Or compile with java 8 compatibility

quaint mantle
#

i am

young knoll
#

Evidently not

quaint mantle
#

r

cunning ermine
#

what is the difference between player.getName() and player.getDisplayName()?

quaint mantle
#

UGH

eternal oxide
#

getName is the players actual name. getDisplayName can be modified and is used in chat

cunning ermine
#

aight, better to use getName() instead

#

dont use getDisplayName() if ur gonna use it for data storage purposes

#

if im correct

#

yes

#

yeah thats my main identifier

#

for my plugin

#

ik that players can change their username

#

which messes everything up

quaint mantle
#

far

#
[20:48:51 ERROR]: Could not load 'plugins/AbsenceBasics-1.0.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: dev/bunk/absence/AbsenceBasics has been compiled by a more recent version of the Java Runtime (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:133) ~[patched.jar:git-PaperSpigot-"4c7641d"]
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:331) ~[patched.jar:git-PaperSpigot-"4c7641d"]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:254) [patched.jar:git-PaperSpigot-"4c7641d"]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugins(CraftServer.java:293) [patched.jar:git-PaperSpigot-"4c7641d"]
        at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:202) [patched.jar:git-PaperSpigot-"4c7641d"]
        at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:563) [patched.jar:git-PaperSpigot-"4c7641d"]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_292]
Caused by: java.lang.UnsupportedClassVersionError: dev/bunk/absence/AbsenceBasics has been compiled by a more recent version of the Java Runtime (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0
        at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.8.0_292]
        at java.lang.ClassLoader.defineClass(ClassLoader.java:756) ~[?:1.8.0_292]
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[?:1.8.0_292]
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:468) ~[?:1.8.0_292]
        at java.net.URLClassLoader.access$100(URLClassLoader.java:74) ~[?:1.8.0_292]
        at java.net.URLClassLoader$1.run(URLClassLoader.java:369) ~[?:1.8.0_292]
        at java.net.URLClassLoader$1.run(URLClassLoader.java:363) ~[?:1.8.0_292]
        at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_292]
        at java.net.URLClassLoader.findClass(URLClassLoader.java:362) ~[?:1.8.0_292]
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:102) ~[patched.jar:git-PaperSpigot-"4c7641d"]
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:87) ~[patched.jar:git-PaperSpigot-"4c7641d"]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:418) ~[?:1.8.0_292]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[?:1.8.0_292]
        at java.lang.Class.forName0(Native Method) ~[?:1.8.0_292]
        at java.lang.Class.forName(Class.java:348) ~[?:1.8.0_292]
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:65) ~[patched.jar:git-PaperSpigot-"4c7641d"]
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:129) ~[patched.jar:git-PaperSpigot-"4c7641d"]
        ... 6 more
#

i cant IFX it

#

you using maven?

#

yes

#

send pom file

#

k

#

?paste

undone axleBOT
quaint mantle
#

what u want me to paste

#

that ☝🏿

quaint mantle
#

yea

#

it used to wiork

#

and then i chjanged my code a bit and compiled it again

#

and then it no work

#

you're building with java 9

#

whut shoudl i bne building iwhj

quaint mantle
#
                <configuration>
                    <source>9</source>
                    <target>9</target>
                </configuration>
#

change that to 8

#

line 25

#

OH

#

i usually just put ${java.version}

#

but idk why it changed

worldly ingot
#

1.8*

#

I don't think 8 will work

unreal quartz
#

it will

quaint mantle
#

maybe its because you took so long to send a message

#

😠

#

carry me to gc

#

in InventoryClickEvent is there a method to get the item you are moving if you use number keys?

worldly ingot
#

Does Maven actually support <source>8</source>?

#

Because I always use 1.8

quaint mantle
#

i always put 1.8

#

yeah

#

it probably works

paper viper
#

maven 🤢

#

lombok 🤢

quaint mantle
quaint mantle
paper viper
#

Fuck maven

#

actually so bloated and verbose

quaint mantle
#

verbose = good

paper viper
#

Its really not

quaint mantle
#

verbose = more debugabble

paper viper
#

You can't "debug" buildscripts

#

lol

quaint mantle
#

errors

#

stupid mr stupid

paper viper
#

thats not debugging

quaint mantle
#

shutup

paper viper
#

thats like fixing compile time errors

#

lmfao

quaint mantle
#

reading errors

paper viper
#

plus, gradle aims to closer to a real language

#

and in fact, it uses kotlin or groovy

#

xml is like hell na

quaint mantle
#

PES_CoolBiker c a t g i r l l o v e r

fluid cypress
#

how do i put a player head itemstack as a block in the world?

paper viper
#

lol

quaint mantle
paper viper
#

Mhm

quaint mantle
#

but your simpleton mind is too stupid to recognize the pure intelligence of my being

#

you incapable nincompoop

quaint mantle
#

Yes I am

paper viper
#

nope

young knoll
#

Did someone say cat girls

quaint mantle
#

when u make an interactive book does ClickEvent.Action.RUN_COMMAND make player send command or does it make console send command?

#

k

worldly ingot
#

It's sent by the player, yes

quaint mantle
#

me

#

to gc

worldly ingot
#

It was the whole reason Mojang added /trigger

#

Nah, I'm not even GC atm. I haven't played much rank. I think I finished at C3 again KEKW I just don't care about ranked at all

#

Played to get my rewards then stopped playing. I really only play with my buddy, that's about it

young knoll
#

Garbage collection?

unreal quartz
#

just git gud

opal sluice
#

Hi, do a serializable class would be serialized automatically if I just put a map containing the serialized object into an YamlConfiguration?

#

Like Map<String, MySerializedObject> would it be all serialized ?

unreal quartz
#

if it implements configurationserializable it needs a deserialise method

opal sluice
#

serialized** sorry ^^'

unreal quartz
#

that can be a declared method or a constructor accepting a map<string, object>

native nexus
#

I am C3 too I am too lazy to grind...

opal sluice
#

Like if I do myYamlConf#set(myMapWithSerializedObject)

#

would it be all serialized ?

quaint mantle
native nexus
#

Sure?

quaint mantle
#

i mean its almost the end of the season

unreal quartz
#

if the object implements configurationserialisable yes

native nexus
#

@worldly ingot surely team of 3

quaint mantle
#

add me on epic imajindevon kbm

native nexus
#

ok!

opal sluice
worldly ingot
#

Yeah sure why not. I guess so. I don't know what rank I'm at atm

native nexus
#

I haven't played in like a month so may not be c3 lol

worldly ingot
#

I've not played ranked in a while either tbf

#

I also rarely play 3s 😛

native nexus
#

We got this!

opal sluice
#

Now, if I want to get all the data at once, like, My: data: is: here, would it be myYamlConf#get("") ?
And, would it be deserialized ?

woeful moon
#

Hello, I couldn't find anything for this online:

Is there a way to make it so that mobs like zombies or skeletons don't drop their armor when they die?

opal sluice
woeful moon
#

How?

opal sluice
#

If I'm correct, you just listen to the death of the entity and clear the drops

woeful moon
#

Alright

#

Thank you!

#

@opal sluice I used EntityDeathEvent and e.getDrops().clear();, but that seems to clear all drops (not just the armor). How can I clear only the armor?

quaint mantle
#

Caused by: java.lang.NoSuchMethodError: org.bukkit.inventory.meta.BookMeta.spigot()Lorg/bukkit/inventory/meta/BookMeta$Spigot;

opal sluice
#

get the drops

quaint mantle
#

y no method

opal sluice
#

loop through them and check the item material

quaint mantle
#

wait

#

cant u do it in 1.8

opal sluice
#

Use an iterator btw and then iterator#remove() to remove the actual drop

opal sluice
quaint mantle
opal sluice
#

He maybe use some nms to make it working, or the spigot lib could be changed in 1.8, anyway, we don't really support outdated versions ^^'

woeful moon
# opal sluice loop through them and check the item material

Something like this?

    public void onEntityDeath(EntityDeathEvent e) {
        List<ItemStack> drops = e.getDrops();
        for (drop : drops) {
            if(drop == Material.LEATHER_BOOTS) {
                drops.remove();
            }
        }
    }

(sorry I'm really bad at coding but I need this for my server)

opal sluice
#

Modifying the actual list while looping it

#

You can modify safely the list with an iterator

summer scroll
#

Maybe you can use List#removeIf in this case.

opal sluice
woeful moon
#

I'll try the removeIf and google the syntax

#
    public void onEntityDeath(EntityDeathEvent e) {
        List<ItemStack> drops = e.getDrops();
        drops.removeIf(n -> (n.getType() == Material.LEATHER_BOOTS));
    }

this could work

unique halo
#

i have an item with a ton of color codes and all in its name, how do i get the item name without the color codes in it?

solid horizon
#

yo, how can I execute a command as a player? player.performCommand isn't working..

#

It simply does nothing, nothing in console or anything

barren moon
#

spawnPacket.getIntegers().write(0, 1).write(1, 1)
Im using protocolLib to spawn an armorstand. but it spawned a potion particle Effect. no matter what number i set to entitytype(field index is 1)

#

btw im in 1.16

solid horizon
#

this channel is dead

quaint mantle
#

your code must be failing leading up to that point

#

send code

solid horizon
#

hang on, i may have fixed it 🤞

#

nevermind .. ill send the code just a sec

quaint mantle
#

Result of ' ' is ignored

#

why it keep say this

quaint mantle
#

there legit is no code

solid horizon
quaint mantle
#

send code

quaint mantle
solid horizon
#

hm?

quaint mantle
#

getCommand("gmc").setExecutor(new GMC(this));
Also, the check if the command name matches "gmc" is useless.

woeful moon
#

This isn't working sadly

    @EventHandler
    public void onEntityDeath(EntityDeathEvent e) {
        if (e.getEntity().getType() == EntityType.ZOMBIE || e.getEntity().getType() == EntityType.SKELETON) {
            List<ItemStack> drops = e.getDrops();
            List<String> armortypes = (List<String>) AdvancedSpawnersFix.plugin.getConfig().getList("armor-types");
            drops.removeIf(n -> (armortypes.contains(n.getType())));
        }

    }

Config

armor-types:
  - "LEATHER_BOOTS"
  - "LEATHER_LEGGINGS"
  - "LEATHER_CHESTPLATE"
  - "LEATHER_HELMET"
  - "IRON_BOOTS"
  - "IRON_LEGGINGS"
  - "IRON_CHESTPLATE"
  - "IRON_HELMET"
  - "GOLDEN_BOOTS"
  - "GOLDEN_LEGGINGS"
  - "GOLDEN_CHESTPLATE"
  - "GOLDENt_HELMET"
  - "CHAINMAIL_BOOTS"
  - "CHAINMAIL_LEGGINGS"
  - "CHAINMAIL_CHESTPLATE"
  - "CHAINMAIL_HELMET"
#

Anything I did wrong?

solid horizon
#

Am I replacing that in the if statement?

quaint mantle
#

place this getCommand("gmc").setExecutor(new GMC(this));

#

in your onenable

solid horizon
#

alright, ill give it a go

#

ahh, it works! thank you so much 😄

woeful moon
solid horizon
#

hey, another quick question, should i use the linked s to do color codes?

quaint mantle
#

nope

#

ChatColor.translateAlternateColorCodes('&', msg)

solid horizon
#

Would i place that as the string in sender.sendMessage?

quaint mantle
#

yes

solid horizon
#

alrighty

#

and where would i set the color code?

#

after the &?

barren moon
summer scroll
#

Can you make player wear helmets with packets and keep track of the helmet, so you can remove it later on.

#

I want to force the player to wear a helmet whereas they can still equip/unequip helmet on their helmet slot freely.

barren moon
#

you mean let a player wear two helmet at the same time? or just render a fake helmet and wear a true helmet? both i think is not possible

summer scroll
#

Something like that yeah, so just a visual helmet, not actually an helmet.

#

But I want them to wear them at the same time.

wide dew
#

Like Most online Game

#

Custom_Model_Data?

barren moon
#

maybe, you can let player put their own helmet in somewhere else and read its property , then apply it to player. but i think you cant let the client render two helmet at same time

summer scroll
#

Yeah I want to force them using a helmet with custom model data.

#

Ah, what If player wears netherite helmet and I force them to use the custom helmet that I want but the netherite helmet effect still applies.

#

So the actual helmet is netherite but the visual is the custom helmet.

#

I've seen a plugin on spigot do this I think.

wide dew
#

Maybe player equipped a helmet A ,then he has a helmet B in hand then dosothing,u remove the helmet in hand & set the helmet A's CustomModelData

summer scroll
summer scroll
barren moon
#

I will see the sourcecode

wide dew
quaint mantle
#

how 2 make player play fart sound?

summer scroll
#

Yeah they use packet, it's not complicated as I thought xd, just entity equipment packets.

proud basin
#

Can you get a player from a uuid?

narrow vessel
#

it is most likely not able to be done async just saying

summer scroll
#

No need to do it async anyways xd

solid horizon
#

how come 2+ classes cause my plugin to stop workingh?

proud basin
#

so Im guessing if I did it async i'd just get a null pointer

raw coral
#

How can i remove all ai from a mob

wide dew
#

u mean setNoAI()? Or remove all pathfinder?

summer scroll
solid horizon
#

fixed it, was an issue in plugin.yml

#

also, is there a way i can run a command like summon without it saying anything in chat?

#

like no "Object successfully summoned."

summer scroll
#

You might want to create the your own command I think.

solid horizon
#

simple or no?

summer scroll
#

Just summoning an entity is simple.

solid horizon
#

ah, im quite new to this so how would i do it?

raw coral
#

Is there a function to make a LivingEntity invisible? If not how would one

summer scroll
raw coral
solid horizon
#

I know how to listen, but i don't know how to summon an entity

raw coral
#

And you can use World#spawnEntity() to summon

solid horizon
#

Alright, thanks ^^

#

oh also, how can i set the location of the summoned entity to @a?

#

would i need another variable?

raw coral
#

or like whats @a

unique halo
#

how do you get the amount of damage an item deals, i have p.getItemInHand()

proud basin
#

What's the max size of a inventory again?

#

is it 56?

compact ice
solid horizon
compact ice
#

1.8 spigot FUCKING SUCKS

#

I HATE IT

unique halo
#

how do you get the amount of damage an item deals tho

raw coral
#

You can

compact ice
#

first

raw coral
#

Use nms

compact ice
#

you need to STOP. USING. 1.8. SPIGOT.

raw coral
#

to get AttributeModifiers

#

then find the damage attribute

compact ice
#

it is literally the ABSOLUTE WORST thing possible thing that you can do

raw coral
solid horizon
#

Simplified

raw coral
#

Bukkit#getOnlinePlayers() to get all the palyers

#

*players

compact ice
#

nothing grinds my gears more than 1.8 spigot

raw coral
#

Anyway does anyone know how can make an entity invisible?

#

Like should i use potion effects

solid horizon
#

World.spawnEntity(allplayerlocations,"LightningBolt"); how can i put it in this?

#

as an example

solid horizon
#

oh?

raw coral
#

Just iterate

#

through al the players

#

and spawn them

#

at the locations

solid horizon
#

can you send a script? im pretty stupid ;-;

raw coral
#

Do you know java btw?

#

If not a reccomend learning it better before trying to make a plugin

#

i guess i could write some pseudo code of thats what its called

#

for player in players
World.spawnEntity(player.location,entity)

#

pretty simple

#

Anyway does anyway know how to make a mob invisible :pepehands:

barren moon
#

how to use protocolLib to send a Entity_Metadata packet? I dont know how to write the entity metadata.

barren moon
raw coral
#

Dont think that exists in 1.8 PepeHands

echo saddle
#

Can we have it so thread owners don't have a cooldown on replies on SpigotMC web site?

raw coral
#

yes boosting was worth it duckPog

raw coral
summer scroll
#

just create a suggestion on the forum

echo saddle
#

It makes it really hard to respond to queries on a plugin.

#

@worldly ingot who is responsible for Spigot website development?

summer scroll
#

oh god, pinging Choco

echo saddle
#

can I PR a fix for it?

summer scroll
#

Create a suggestion bro

raw coral
#

How do i send packets to players?

echo saddle
#

oh is cindy still doing?

summer scroll
raw coral
#

yeah i was already using the version with nms and thanks

barren moon
summer scroll
#

idk how to do it on protocollib, sadge

barren moon
#

an example without protocollib is okay, i think

summer scroll
#
PacketPlayOutEntityMetadata metaDataPacket = new PacketPlayOutEntityMetadata(entityID, dataWatcher, false);

playerConnection.sendPacket(metaDataPacket);
#

also required to use the nms version/buildtools

barren moon
#

got it, I need to learn about datawatcher first

raw coral
#

Ok so i am using the giant to make a big sword for something, how can i make it so this giant cant be attacked and doesnt move at all

solid horizon
#

quick question, how can i get the location of the first argument as a player?

raw coral
#

I dont really get the question

solid horizon
#

i want to save a players location to a var, and the player is an arggument from a command

raw coral
#

Can i have more context

solid horizon
#

sorry if im typing slow, i have a broken arm

summer scroll
#

I'm guessing he want a Player object from String.

raw coral
#

If the string is a player name i can help you

#

or a uuid

solid horizon
#

the player is the first(i think) argument, like: /spawnzombie (this is the location i want, as a player)

#

as an example

raw coral
#

Also i was wondering if anyone had any idea if i could make a mob be unable to be moved by a palyer

solid horizon
#

NoAI:1b or whatever?

solid horizon
#

but thats not just player

summer scroll
raw coral
#

Theres a collision event?

summer scroll
#

I think there is like a collission variable or something, to make the mob collide with something.

solid horizon
#

how can i save the first argument as a player?

summer scroll
solid horizon
#

string being args[1]?

#

or is that wrong

summer scroll
#

something like that

#

args[1] is the second argument

solid horizon
#

oh?

summer scroll
#

args[0] is the first argument

solid horizon
#

mybe thats what im doing wrong

compact ice
#

ssssssssssssssssssssssssssssssssssssssssssssssssssspigotmc

summer scroll
#

/command arg0 arg1

summer scroll
raw coral
#

How do i do that

#

theres no invulnerable setter in the LivingEntity class

#

i think

summer scroll
#

really?

raw coral
#

nop

solid horizon
summer scroll
#

alright then, i don't know xd

raw coral
#

alr time to do some intense googlin

solid horizon
#

im just testing it

summer scroll
solid horizon
#

ayy! it works, tysm, that was me being stupid

raw coral
summer scroll
#

how's the entity being pushed?

raw coral
#

which ruins the sword position

raw coral
#

its invisible

summer scroll
#

but there is no colission

raw coral
#

Is there a channel i cans end videos in?

summer scroll
raw coral
summer scroll
#

yeah i saw it

raw coral
#

any ideas?

summer scroll
#

i have one but this is like whatever idea

solid horizon
#

yo, how come EntityType.LIGHTNING isn't working?

summer scroll
#

constantly checking the entity location, and teleporting them if the location does not match

raw coral
#

eh

#

ittl work

#

and since the giant will only be there for 3 seconds

summer scroll
raw coral
#

wont be a big deal

#

thanks for the help ducklove

solid horizon
#

Alrrighty

raw coral
#

Any way for me a stop a repeating task inside itself?

summer scroll
#

is BukkitRunnable exist on 1.8?

raw coral
summer scroll
#

use that, BukkitRunnable can cancel itself

solid horizon
#

same for both of them;

raw coral
# summer scroll use that, BukkitRunnable can cancel itself

wait just wondering do you think this could work

var timesRan = 0
var taskId = 0
taskId = Bukkit.getScheduler().scheduleSyncRepeatingTask(SkyblockSandbox.instance, {
if(timesRan==30){
Bukkit.getScheduler().cancelTask(taskId)
}
timesRan++
},0,2)

summer scroll
raw coral
#

i just dont wanna use a bukkit runnable because a dont feel like making a class :p

solid horizon
#

nevermind, i.getWorld().strikeLightningEffect(i.getLocation()) seemed to work for some reason

raw coral
#

or smth like that

#

anyway how would i use bukkit runnable without a class?

solid horizon
#

1.8.8?

summer scroll
#
new BukkitRunnable(){
  @Override
  public void run(){
    if location is not the same:
      teleport the entity back

    if time equals to 30
      this.cancel();
  }
}.runTaskTimer(...
summer scroll
#

no problem

raw coral
# summer scroll no problem

Also just did some research and the only way to make invulnerability in 1.8 is with nasty nms

public void setInvulnerable(Entity en){
    net.minecraft.server.v1_8_R2.Entity nmsEn = ((CraftEntity) en).getHandle();
    NBTTagCompound compound = new NBTTagCompound();
    nmsEn.c(compound);
    compound.setByte("Invulnerable", (byte) 1);
    nmsEn.f(compound);
}
summer scroll
#

Is Invulnerable just make the entity cannot take any damage?

#

And player will still be able to collide with it.

fluid cypress
#

how can i get the seconds since the server start, or the current timestamp in seconds, or whatever thing to calculate timing stuff? whats the proper way

bright jasper
#
@Command(
        aliases = {"test"},
        permission = "discordlink.test"
)
public class CommandTest {
    @Default
    public void test(CommandSender sender, boolean bruh, @Choice({"hi"}) String bruh2, PlatformPlayer player) {
        sender.sendMessage(bruh2);
        sender.sendMessage(String.valueOf(bruh));
    }

    @Command(aliases = {"sub"})
    public void sub(CommandSender sender, @Choice({"yes", "no"}) String choice) {
        sender.sendMessage("You said " + choice);
    }
}

made my own command framework type thing with autocompletion built in, AND a brigadier implementation for fabric

#

Only one level of command nesting unfortunately tho

raw coral
bright jasper
#

It will be soon, atm its part of my plugin DiscordLink

#

Which is on github

#

need to split it into its own thing

raw coral
#

seems awesome

#

i will take a look : D

bright jasper
#

It mainly just exists for the pure reason of well... i want my plugin to work on fabric which uses brigadier instead of default commands (which is a lot harder to code for so i use annotations)

raw coral
#

what package is it in?

bright jasper
#

Im about to push an update but theres a separation. The platform agnostic stuff is in com.github.riku32.discordlink.core.platform.command

#

The actual implementation in spigot for it to be used in commands is in com.github.riku32.discordlink.spigot.SpigotCommand

#

the spigot command is one class that gets dynamically registered using this ```java
private void registerDynamicCommand(String name, Command command) {
String bukkitVersion = getServer().getClass().getPackage().getName();
try {
Class<?> clazzCraftServer = Class.forName("org.bukkit.craftbukkit." + bukkitVersion.substring(bukkitVersion.lastIndexOf('.') + 1) + ".CraftServer");
Object craftServer = clazzCraftServer.cast(getServer());
Object commandMap = craftServer.getClass().getDeclaredMethod("getCommandMap").invoke(craftServer);
Map<String, Command> knownCommands = (Map<String, Command>) commandMap.getClass().getDeclaredMethod("getKnownCommands").invoke(commandMap);
knownCommands.put(name, command);
} catch (ClassNotFoundException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) {
e.printStackTrace();
}
}

@Override
public void registerCommand(CompiledCommand compiledCommand) {
    Arrays.stream(compiledCommand.getBaseCommand().getAliases())
            .forEach(name -> registerDynamicCommand(name, new SpigotCommand(name, compiledCommand, this, commandLocale)));
}
#

Works with most versions so dw

raw coral
#

that seems pretty jank but what works works lol

bright jasper
#

You might need to modify it to suit your needs a bit tho

raw coral
#

idk tho im pretty dumb

bright jasper
#

Yeah those methods are generally only there since spigot wants you to define commands in plugin.yml

#

this is a workaround

#

everything else is pretty clean tho

raw coral
#

although

#

i might yoink that

#

because

#

i have been wanting

#

to make a custom command handler

#

but the plugin.yml thing

bright jasper
#

Beware it does not register CommandExecutor it uses the base Command class which is a little different (mostly the same tho)

raw coral
#

has been screwing it up for me

#

ill take a look at yours and maybe make my own version for my needs duckFlush

bright jasper
#

thanks, atm the commands are kinda packed using CompiledCommand so that does error checking when the command is created.

#

So the SpigotCommand implementation just validates that all args are accounted for and beware, EVERYTHING is required

#

you cant have an optional argument for a command

#

You can have a Choice but that makes sure the response is at least in that list

#

I need to add @Optional later

#

so yeah if someone types an invalid reply it will just send them a "invalid arg lol"

#

when i make the fabric impl it will use brigadier so it just wont have error messages ig

raw coral
#

thats pretty cool

bright jasper
#

Well no it has a Spigot and Fabric jar that essentially provide adapters for core

#

the core contains the main logic and code and i only write what is in core once

#

Spigot registers implementations for Plugin, Player, and its own Eventbus into templates core provides

#

and after that it kinda just works

#
public class JoinEvent {
    @EventHandler
    private void onPlayerJoin(PlayerJoinEvent event) {
        event.getPlayer().sendMessage("Welcome");
    }
}

@EventHandler is my own thing i based around spigots

raw coral
#

Ah yeah i also really like how spigot manages events basically copied it for one of my projects with a minecraft bot

bright jasper
#

Yeah i ended up just writing my own eventbus

#

has no priority yet tho

#

this

raw coral
#

Anyway this channel is for spigot dev help dont wanna get too off topic

bright jasper
#

ah yeah lmao

#

sorry

raw coral
#

Does anyone know why my entity that im freezing in place by teleporting it to the same location is able to turn its head

#

i thought location stored yaw and pitch so if im teleporting it to the same location everyh tick

opal juniper
#

Um… no

#

Myeah it is

raw coral
#

thats so wierd

opal juniper
#

So they cannot move?

raw coral
#

Nah they arent moving

#

but they are turning their head

#

which ruins what im going for

#

well not head but their whole body

opal juniper
#

Yeah… huh

#

Seems weird

summer scroll
#

Just try to set the yaw pitch again

raw coral
#

wait

#

actually

#

i just removed the invisible tag

#

and it seems that

#

the body isnt parralel with the head

#

so it adjusts after

#

hm

opal juniper
#

I’m so confused what I’m looking at

summer scroll
#

yea bro

#

i literally turned my head

bright jasper
# raw coral

are you remaking hypixel skyblock or something

raw coral
#

already made some cool stuff 😄

bright jasper
#

Ah makes sense

#

Thats impressiv

raw coral
#

thanks

raw coral
quaint mantle
#

how 2 add 1.8 to maven

#

bcuz itkeep saying MUSHROOM_SOUP no work

#

but 1.8

#

work

#

sop hwop to do

raw coral
#

instead of stoup

#

soup

quaint mantle
#

but its SOUP on 1.8

raw coral
quaint mantle
#

i have 1.17

#

i was asking

#

what the thinguy is for .81

#

i alr fixed dw

raw coral
#

ok

cunning ermine
#
[17:20:17 WARN]:     at java.base/java.io.FileInputStream.open0(Native Method)
[17:20:17 WARN]:     at java.base/java.io.FileInputStream.open(FileInputStream.java:211)
[17:20:17 WARN]:     at java.base/java.io.FileInputStream.<init>(FileInputStream.java:153)
[17:20:17 WARN]:     at org.bukkit.configuration.file.FileConfiguration.load(FileConfiguration.java:126)
[17:20:17 WARN]:     at io.github.eddiediamondfire.economyplus.config.file.Config.load(Config.java:50)
[17:20:17 WARN]:     at io.github.eddiediamondfire.economyplus.config.FileManager.onLoad(FileManager.java:22)
[17:20:17 WARN]:     at io.github.eddiediamondfire.economyplus.EconomyPlus.onEnable(EconomyPlus.java:47)
[17:20:17 WARN]:     at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263)
[17:20:17 WARN]:     at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370)
[17:20:17 WARN]:     at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500)
[17:20:17 WARN]:     at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugin(CraftServer.java:518)
[17:20:17 WARN]:     at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugins(CraftServer.java:432)
[17:20:17 WARN]:     at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:277)
[17:20:17 WARN]:     at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1126)
[17:20:17 WARN]:     at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:316)
[17:20:17 WARN]:     at java.base/java.lang.Thread.run(Thread.java:831)
[17:20:17 ERROR]: Error occurred while enabling EconomyPlus vdev-SNAPSHOT (Is it up to date?)
java.lang.NullPointerException: Cannot invoke "String.equalsIgnoreCase(String)" because the return value of "org.bukkit.configuration.file.FileConfiguration.getString(String)" is null```
#
    at io.github.eddiediamondfire.economyplus.EconomyPlus.onEnable(EconomyPlus.java:51) ~[?:?]
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.17.1.jar:git-Paper-112]
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[patched_1.17.1.jar:git-Paper-112]
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500) ~[patched_1.17.1.jar:git-Paper-112]
    at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugin(CraftServer.java:518) ~[patched_1.17.1.jar:git-Paper-112]
    at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugins(CraftServer.java:432) ~[patched_1.17.1.jar:git-Paper-112]
    at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:277) ~[patched_1.17.1.jar:git-Paper-112]
    at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1126) ~[patched_1.17.1.jar:git-Paper-112]
    at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:316) ~[patched_1.17.1.jar:git-Paper-112]
    at java.lang.Thread.run(Thread.java:831) [?:?]```
opal juniper
#

your save method is empty

#

just call saveResource() in the onEnable or something

summer scroll
#

How to remove fake players only on the tablist?

round iris
#

what kind of damage fireball does? entity explosion, block explosion or somethinfg else?

summer scroll
crude charm
#

why TF is this not working?

ArmorStand stand =  (ArmorStand) p.getWorld().spawnEntity(p.getLocation(), EntityType.ARMOR_STAND);
#

no errors or anything

opal juniper
#

It works for me normally

#

lmao

#
private ArmorStand createArmorStand(Location started) {
    ArmorStand armorStand = (ArmorStand) started.getWorld().spawnEntity(started, EntityType.ARMOR_STAND);
    armorStand.setVisible(false);
    armorStand.setGravity(false);
    return armorStand;
}

in my current project ^^

quaint mantle
#

Hey there
I have a problem with Destroy Entities packet, which got changed in 1.17 to Destroy Entity pakcet and then it revert back to Destroy Entities packet in 1.17.1
I'm using protocollib for writing the packets and I made a function to determine if it's 1.17 or not

public void destroy() {
        PacketContainer destroyEntityPacket = new PacketContainer(PacketType.Play.Server.ENTITY_DESTROY);
        if (Utils.is1_17) {
            destroyEntityPacket.getIntegers().writeSafely(0, entityID);
        } else {
            destroyEntityPacket.getIntegers().writeSafely(0, 1);
            destroyEntityPacket.getIntegerArrays().writeSafely(0, new int[]{entityID});
        }
        try {
            ProtocolLibrary.getProtocolManager().sendServerPacket(handler, destroyEntityPacket);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

but the problem is, it doesn't work on 1.17.1
even thou according to wiki.vg/Protocol, it is back again to what it used to be in 1.16.5, it doesn't destroy the entity and also it doesn't log any errors.
I also tried using 1.17 method in 1.17.1, it still doesn't work

crude charm
#

does the fact I'm using 1.8 change it at all?

opal juniper
#

bruh wtf is wrong with your server

#

no

#

it works on 1.8

#

add a sysout to check it actually gets called

crude charm
#

already done it

opal juniper
#

get a new spigot jar??

#

or paper

crude charm
#

mb I can try on my other test server

torn oyster
#
  public void gameEnd(Team winner, EndReason reason) {
        setFinished();
        if (reason == EndReason.TEAM_WIN) {
            for (Player pp : Bukkit.getOnlinePlayers()) {
                pp.sendTitle("" + ChatColor.RED + ChatColor.BOLD + "GAME OVER!", ChatColor.GRAY + winner.name() + " has won!");
                inventoryManager.setDeadFinishedInventory(pp);
                SqlSetup.updateInt(pp.getPlayer().getUniqueId(), "losses", SqlSetup.getPlayerInt(pp.getPlayer().getUniqueId(), "losses") + 1);
                SqlSetup.updateInt(pp.getPlayer().getUniqueId(), "winstreak", 0);
            }
            getPlayersInTeam(winner).forEach(p -> {
                p.getPlayer().sendTitle(
                    "" + ChatColor.GOLD + ChatColor.BOLD + "VICTORY!", ChatColor.GRAY + "Your team won the game!");
                ||||||||||||||||||||||SqlSetup.setPlayerXP(p.getPlayer().getUniqueId(), SqlSetup.getPlayerXP(p.getPlayer().getUniqueId()) + 200);
                SqlSetup.updateInt(p.getPlayer().getUniqueId(), "wins", SqlSetup.getPlayerInt(p.getPlayer().getUniqueId(), "wins") + 1);
                SqlSetup.updateInt(p.getPlayer().getUniqueId(), "winstreak", SqlSetup.getPlayerInt(p.getPlayer().getUniqueId(), "winstreak") + 1);
            });
        } else {
            for (Player pp : Bukkit.getOnlinePlayers()) {
                pp.sendTitle("" + ChatColor.RED + ChatColor.BOLD + "GAME OVER!", "");
                inventoryManager.setDeadFinishedInventory(pp);
                SqlSetup.updateInt(pp.getPlayer().getUniqueId(), "losses", SqlSetup.getPlayerInt(pp.getPlayer().getUniqueId(), "losses") + 1);
                SqlSetup.updateInt(pp.getPlayer().getUniqueId(), "winstreak", 0);
            }
        }
        new BukkitRunnable() {
            @Override
            public void run() {
                finish();
            }
        }.runTaskLater(CaptureTheClay.getInstance(), 200L);
    }```
#

why

#

does the one

opal juniper
#

?paste

undone axleBOT
opal juniper
#

please

torn oyster
#

with the |s before it

#

ok

#

why does the one with |||||||||| before it

#

get run

#

like

#

52387257894235789 times

#

idk

#

like instead of changing it by 200

#

it changes it by like 1 billion

crude charm
#

create a method for get wins and get losses

torn oyster
#

yea i will

crude charm
#

same with winstreak

torn oyster
#

but im focussing

#

on the xp

hoary mango
#

i got a small issue here, when I use breakNaturally() it just acts as if you just set the block type to AIR.. there is no sound or particles

hoary mango
#

aw really

torn oyster
#

can anyone help?

hoary mango
#

whats your issue

torn oyster
hoary mango
#

yeah nvm

#

can you show SqlSetup maybe

unique halo
#

how do i give a zombie a helmet, or spawn a zombie with a helmet

torn oyster
#

im an idiot

#

lol

hoary mango
#

what was it because im curious :D

hoary mango
#

tho that will make it so with every spawn egg and natural zombie spawn itll have a helmet

grim ice
#

this is holograms

unique halo
#

ooh i have to cast creature to it now ik

hardy swan
#

Is it true that inventories cannot store air?

grim ice
#

yes it cant

#

lmao

#

it can store null

#

but not air

hardy swan
#

Okk

#

Thanks

grim ice
#

np

hoary mango
#

if I want to make a natural block break I need to set it to air and then do the particles and sound manually?

hardy swan
#

So air is only for hands?

grim ice
#

I don't think you use air with inventories at all

#

Last time i tried i got a bunch of errors

hardy swan
#

Well you can get air from entityequipment

grim ice
#

better to use null imo

hardy swan
#

Thats definitely the case

grim ice
opal juniper
#

it is not

grim ice
#

o

hoary mango
#

whats even the point of the breakNaturally method

grim ice
#

then what is it

#

if u dont mind answering

opal juniper
#

Drones

grim ice
#

?jd

opal juniper
#

but it is still a WIP

hoary mango
#

hm yeah "Breaks the block and spawns items as if a player had digged it regardless of the tool."
so i guess there is no mention of an actual particle+sound break

#

fair enough

#

thanks

hoary mango
#

i did already

#

just sets it to air :(

#

ill just be lazy and make it do the setblock vanilla cmd

grim ice
#

tbh my plugin is doing way better than I expected

eternal night
#

the OnceUnCraftable one ?

summer scroll
#

How can I remove fake player only on tablist?

chrome beacon
#

Send the remove data info packet

#

Make your life easier by using Citizens no need to reinvent stuff

grim ice
#

anyone can help me understand .stream()

#

ik its java but

summer scroll
chrome beacon
#

ah then you can't remove it from tab

summer scroll
#

There is a server called Origin Realms, they can do that.

barren moon
#

Player Info Packet maybe?

summer scroll
#

It will entirely removes the fake player, so the fake player doesn't exist anymore.

barren moon
#

I haven't tried, but those online solutions just use it

worn tundra
#

Maybe something related to the player receiving a player list to display there

chrome beacon
barren moon
#

how can i see the 1.16 version of protocol wiki?

lyric grove
#

How would i check for a colon in commands? I use this and it always is true for some reason

ivory sleet
#

That’s the chat event

#

Well idk maybe it works for both on bungee

lyric grove
#

it works on commmands

ivory sleet
#

But anyways

#

Java isn’t indentation based

#

So that for loop will run regardless if the command contains : or not

lyric grove
#

oh

grim ice
#

with a

#

prefix

#

i used asyncchatevent

timid tulip
#

how do i create a command like /gm <gamemode>

lyric grove
barren moon
#

Compared with direct rotate a real armorstand, using packet to rotate a fake armorstand has obvious lag. is this normal?

crude charm
crude charm
#

you should learn day one java before spigot

plain oxide
#

I want to update my personal Scoreboard every second, is there a good way?

mortal hare
#

nvm

#

unless you create separate commanddispatcher

#

that's a lot of work

summer scroll
mortal hare
#

iirc brigadier commands can start with anything, including :

#

maybe im wrong

gritty urchin
#

Hey, how would I call around 1000 fake BlockBreakEvents to the server without any lag.

#

for a specific player.

#

I have tried this:

#

Bukkit.getPluginManager().callEvent(new BlockBreakEvent(loc.getBlock(), e.getPlayer()));

#

But I get a lot of lag

ivory sleet
#

Split it into smaller tasks

#

And run in different ticks

dusk flicker
#

Might also be worth taking another approval into whatever you are doing

native nexus
#

Seems like there is a much better alternative way to do whatever you want todo…

ivory sleet
#

That’s probably not api yeah

gritty urchin
#

For a prison plugin, to destroy a whole layer of a mine whilst registering each block broken as a event by the plugin.

opal juniper
#

Why don’t you add an api to that plugin

ivory sleet
#

Why do you need the plugin signature of that block break

opal juniper
#

So that it knows who mined them

dusk flicker
#

I presume what you are trying to do is have like an upgrade where you can mine the entire mine?

opal juniper
#

^

#

I think so

gritty urchin
#

Yes

opal juniper
#

Well

#

Is the mine plugin yours

#

Ie did you make it

dusk flicker
#

If so instead of actually breaking them all, id just get a count of all the blocks in that mine, (material, amount) delete all the blocks and do the math to give the loot rather then using a huge amount of events

My best guess at first glance, might be a better way

gritty urchin
gritty urchin
opal juniper
#

I mean if it had an api you could probably hook into it

#

To like add broken blocks

#

But that is all dependent on it having an api and I doubt it

#

So probably just use racks way

native nexus
#

Have a map of materials as the key and amount as the value.

ivory sleet
#

An enum map I presume

bright helm
#

Hi, im new to spigot and i had a question.

hazy igloo
bright helm
#
    private Bukkit event;
    final Player player = event.getPlayer();
    if (event.getAction() == Action.LEFT_CLICK_BLOCK) {
        if (event.block().getType() == Material.WEB) {
            if (event.getItem() != null && event.getItem().getType() == Material.SHEARS) {```
#

its all in red

#

Does someone maybe have an example of this because im trying to learn

eternal night
#

java logic is hosted in methods

hazy igloo
bright helm
#

where?

#

idk how to use it

#

getaction just doesn't work

#

for some reason

dusk flicker
#

are you working on a decompiled class?

#

and it;s not going to work as you arent working in a method

#

?learnjava

undone axleBOT
bright helm
#

i already did some on the codecademy

#

dont you just have an example for me of how to use it?

echo saddle
#

Indy, you need to setup a class that implements Listener, then in that class, create a method that is decorated as an EventHandler. Keep in mind that some events will be called for each hand of the player.

bright helm
#

public class c4 implements Listerer {

#

like this?

echo saddle
#

that method should be to handle your events

#

yeh

bright helm
#

but i dont want a listener

#

or i mean

#

i need to but

#

I dont want anything to be in it

echo saddle
#

then under that classe, create a method that has the @EventHandler(priority = EventPriority.LOWEST) or similar annotation

#

the method should have a single parameter that is the kind of event

#

like BlockDamageEvent

torn shuttle
#

so I have a weirdish question, are chunks actually meant to be able to load twice in a single tick

echo saddle
#

you can look at the different events in the JavaDocs

bright helm
#

public class c4 implements Listener {
@EventHandler(priority = EventPriority.LOWEST)

#

its not damage event

#

its block click event

echo saddle
#

no, like under your c4 class, create a method

bright helm
#

can you give me an example?

crude charm
torn shuttle
#

I have a world where every chunk on there is loading twice

#

it seems to just be that one world

echo saddle
#
public static void onBlockDamage(BlcokDamageEvent event) {
  if (event == null || event.isCancelled()) return;
  Player player = event.getPlayer();
  Block block = event.getBlock);
  ...
}```
torn shuttle
#

so this has me confused

echo saddle
#

something like that, doesn't have to be static if you are referencing by class

native nexus
#

Why static…

#

Huh

echo saddle
#

doesn't have to be

#

just as i said

bright helm
#
    public static <ApplicableRegionSet, WorldGuardPlugin, ProtectedRegion> boolean playerinRegion(Player var0, String var1) {
        ApplicableRegionSet var2 = ((WorldGuardPlugin)Bukkit.getServer().getPluginManager().getPlugin("WorldGuard")).getRegionManager(var0.getWorld()).getApplicableRegions(var0.getLocation());
        Iterator<ProtectedRegion> var3 = var2.iterator();
        while (var3.hasNext()) {
            ProtectedRegion var4 = var3.next();
            if (var4.getId().contains(var1))
                return true;```
#

dont work

torn shuttle
#

does location#getBlock() load the chunk the block is in?

bright helm
#

its all red again

crude charm
#

there is so much wrong

#

have you touched java before?

#

like...

bright helm
#

no? thats why i am testing things like this

crude charm
#

this is horrendous

bright helm
#

and asking for help

dusk flicker
#

then learn java

#

?learnjava

undone axleBOT
dusk flicker
#

you are just wasting our time and your own by trying to do this with no understanding

echo saddle
#

yeh, way above your paygrade

reef wind
bright helm
#

toxic

reef wind
bright helm
#

i've already followed a course

dusk flicker
#

you didnt learn anything then

crude charm
#

OMG

bright helm
#

why is it wasting time?

#

not one

crude charm
#

SOMEONE HIRE THIS MAn

#

ONE JAVA COURSE

bright helm
#

you are the one asking for help too?

dusk flicker
#

asking for help != stupid

crude charm
bright helm
#

youre the most toxic kid i've ever seen fucking hypocrit

reef wind
echo saddle
#

anyway, suggest you try the examples for the event stuff, aside from all the worldguard api stuff

reef wind
torn shuttle
#

hm I smell blood in the water

dusk flicker
#

and overall learn java

#

as the course you used either didnt go into anything or what not

echo saddle
#

and not get discouraged by folks on this channel

bright helm
#

i already expected something like this

echo saddle
#

and take advantage of the wiki and javadocs

bright helm
#

some people who get mad because im not good at it

crude charm
young knoll
#

Don’t learn java by jumping into an API

dusk flicker
#

Spending time now to learn the basics of Java and then coming back to the spigot api will help way more then you could imagine

bright helm
#

ok, ill just do a course then

native nexus
#

You got this Indy!

bright helm
#

for the kids with autism like @crude charm not one course just a course

#

thx

reef wind
native nexus
#

You will learn and get there just be patient. It takes time 😦

dusk flicker
#

You may have to do the course multiple times so you get a good understanding, or rotate between a few of them

bright helm
#

how do i know if im ready to learn spigot

dusk flicker
#

Java is not an easy language to learn

#

Takes a while

reef wind
bright helm
#

i kind of do understand it

crude charm
bright helm
#

but code academy

#

is not the same as intelji

crude charm
#

?

bright helm
#

its just different

dusk flicker
#

You need an understanding of methods, fields (vars), classes, lists, maps, etc.

bright helm
#

i did courses for like 5 hours

dusk flicker
#

The code is the same just prob a diff IDE

crude charm
dusk flicker
#

?learnjava has multiple courses

undone axleBOT
dusk flicker
#

A different one might help

bright helm
#

but java is really not the same as spigot

#

or is it

#

i mean java is spigot

#

but

dusk flicker
#

It is, its a java library

bright helm
#

its diffrent

#

different*

dusk flicker
#

You will need to learn Java first then come back and learn the spigot library

#

Which will be 100 times easier with a good java understanding

echo saddle
#

@torn shuttle loading twice how?

regal moat
#

Error: ```java
[15:34:39 WARN]: [Shaza] Task #2 for Shaza v1.0-SNAPSHOT generated an exception
java.lang.NullPointerException: null
at sh.aza.OnJoin$1.run(OnJoin.java:55) ~[?:?]
at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftTask.run(CraftTask.java:64) ~[patched_1.12.2.jar:git-Paper-1618]
at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:423) ~[patched_1.12.2.jar:git-Paper-1618]
at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:840) ~[patched_1.12.2.jar:git-Paper-1618]
at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:423) ~[patched_1.12.2.jar:git-Paper-1618]
at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:774) ~[patched_1.12.2.jar:git-Paper-1618]
at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:666) ~[patched_1.12.2.jar:git-Paper-1618]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_291]


Code: ```java
package sh.aza;

import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.scheduler.BukkitScheduler;

import java.sql.*;

public class OnJoin implements Listener {
    private final Main main;
    private Connection conn;
    private String host, database, username, password;
    private int port;
    public static ResultSet coin;

    public OnJoin(Main main) {
        this.main = main;
    }

    @EventHandler
    public void onJoin(PlayerJoinEvent e){
        this.host = "localhost";
        this.port = 3306;
        this.database = "minecraft";
        this.username = "root";
        this.password = "";
        Player p = e.getPlayer();
        try {
            openConnection();
            System.out.println("SUCCESS: Successfully connected to database.");
        } catch (SQLException x) {
            x.printStackTrace();
            System.out.println("ERROR: Couldn't connect to database.");
        }
        try {
            ResultSet rs = prepareStatement("SELECT COUNT(UUID) FROM usercoin WHERE UUID = '" + p.getUniqueId().toString() + "';").executeQuery();
            rs.next();

            if (rs.getInt(1) == 0){
                prepareStatement("INSERT INTO usercoin(UUID, COIN) VALUES ('" + p.getUniqueId().toString() + ", DEFAULT');").executeUpdate();
            }
            coin = prepareStatement("SELECT * FROM usercoin WHERE UUID = '" + p.getUniqueId().toString() + "';").executeQuery();
            coin.next();
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
        BukkitScheduler scheduler = main.getServer().getScheduler();
        scheduler.scheduleSyncRepeatingTask(main, new Runnable() {
            @Override
            public void run() {
                try {
                    p.sendTitle("", ChatColor.BOLD + "" + ChatColor.YELLOW + "Coins: " + ChatColor.WHITE + OnJoin.coin.getInt("COIN"), 0, 1, 0);
                } catch (SQLException throwables) {
                    throwables.printStackTrace();
                }
            }
        }, 0L, 1L);
    }

    private void openConnection() throws SQLException {
        if (conn != null && !conn.isClosed()){
            return;
        }

        conn = DriverManager.getConnection("jdbc:mysql://" + this.host + ":" + this.port + "/" + this.database, this.username, this.password);
    }

    public PreparedStatement prepareStatement(String query){
        PreparedStatement ps = null;
        try {
            ps = conn.prepareStatement(query);
            System.out.println("SUCCESS: Successfully prepared statement.");
        } catch (SQLException x) {
            x.printStackTrace();
            System.out.println("ERROR: Couldn't prepare statement.");
        }
        return ps;
    }
}
undone axleBOT
regal moat
#

I tried to make a coin system using databases

reef wind
#

@regal moat please put it in a paste

torn shuttle
hardy swan
#

Are there spigot api events called when player equip armor using hotkeys

echo saddle
#

Magma, is this a custom world?

native nexus
#

@regal moat the result set seems to be null inside your runnable.

#

Also I don’t recommend storing that in a static

torn shuttle
#

I believe it's a void world and we just built some stuff in it

#

it's a really inconsistent issue because so far I've only seen it happen to one world

crude charm
echo saddle
#

two ChunkLoadEvents or two ChunkEvents?

#

because a new chunk says it will make a ChunkLoadEvent, then a ChunkPopulateEvent

torn shuttle
#

and they're not freshly generated chunks, these already exsited

echo saddle
#

any other plugins that could be interfering?

torn shuttle
#

I already removed some of the more suspicious ones so at this stage I am suspecting I might be doing it myself

#

but at the same time it's incredibly inconsistent and I am treating every chunk load the same

#

it does it 100% of the time on one world, then never on pretty much every other world I've tested

slim owl
echo saddle
#

yes, but I'm very expensive.

torn shuttle
#

whatever he's charging I'm charging double

echo saddle
#

in otherwords, if you are looking for a developer please post in the forums

slim owl
native nexus
#

@torn shuttle How exactly are you interacting with the chunks?

echo saddle
#

unfortunately, that's been the bane of my existence here

#

if you would like to donate....

slim owl
#

I don't have money

torn shuttle
echo saddle
#

well what good are you then?

torn shuttle
#

but I've delayed the entire event by 1 tick on my end and it's still doing the double loading before I seemingly run any code

echo saddle
#

broke, better learn to code

#

Magma, is this on a specific spigot version?

torn shuttle
#

I think it's been cosistently on 1.17.1, it's been reported by a few of my users with a spread among at least purpur and paper, I've just noticed the issue now so I've not pinned it on any one specific version

daring sierra
#

wrong channel

#

sorry

torn shuttle
#

I did review some of the older code and I was always checking for double chunk loading so I am pretty sure this is something I've had to handle since... 1.14?

#

it's just weird that chunks would allow themselves to be loaded twice in the first place

native nexus
#

Could you try checking to see if this behaviour occurs on other spigot versions.

#

There is nothing we can do about version related bugs except for make a PR and get denied 🙅‍♂️

#

cough accepted

torn shuttle
#

I guess the main thing I need to know is whether querying a block in a chunk that is in the middle of loading will cause it to load again

echo saddle
#

hmm, maybe its designed that way

native nexus
#

Do you have the source code anywhere?

torn shuttle
#

yeah but uh, it's fairly extensive

quaint mantle
#

Hello, spigot meme lovers! I'm trying to remove living entity but it doesn't work.

LivingEntity livingEntity = BossCore.getBoss(player); // get living entity from map.
livingEntity.getLocation().getChunk().load();
livingEntity.remove()``` what's problem? (also, teleport doesnt work)
echo saddle
#

maybe there is a spigot patch that is calling it to decorate chunks that are generated inside the world constructor

quaint mantle
#

hmm

#

it's 1.15.2

young knoll
#

Iirc the reference is lost when the chunk unloads

quaint mantle
#

what do you mean by "Lirc"?

#

sorry for dumb

crude charm
young knoll
#

If I recall correctly

quaint mantle
young knoll
#

The reference is already lost

#

Store the chunk coords and the entity uuid

#

Load the chunk and then get entity by uuid

quaint mantle
native nexus
#

Hash maps owo

quaint mantle
#

ya but my livingentity will move away

unkempt ore
torn shuttle
#

20 is not very generous buddy

unkempt ore
#

Lmaoooo

#

Sorry but I do not feel like making a bot for 2 dollars

echo saddle
#

20 ETH?

torn shuttle
#

20 btc

unkempt ore
#

eth?

echo saddle
#

20 pizzas?

unkempt ore
#

20 dollars

torn shuttle
#

disgusting

unkempt ore
#

Shut up

native nexus
#

No u owo

unkempt ore
#

...

echo saddle
#

that's not even 4 beers

unkempt ore
#

Where did that even come from

maiden briar
#

How can I change a villager's location?

unkempt ore
echo saddle
#

teleport them

regal moat
torn shuttle
#

kludge I will offer you $-1 to access to your onlydevs

maiden briar
#

Do I need to do villager#teleport?

unkempt ore
#

Yes

echo saddle
#

onlydevs, wat dat mean?

#

you wanna see my precious

torn shuttle
#

it's where you post raw code, dirtied with copy pasted code, if statements instead of switch statements and everything is static all the time

native nexus
crude charm
#

can I please have help

maiden briar
#

Ok

crude charm
native nexus
#

Zoi you don’t do that based on the player direction

#

That is where you are doing it wrong to begin with

crude charm
native nexus
#

You do it based on the distance from the player

echo saddle
#

if no one ever sees the code, does it make a difference?

native nexus
#

Make it constantly want to move towards the player and if the distance is less than a certain amount have the armorstand stop moving

crude charm
native nexus
#

You are making a pet plug-in I assume?

crude charm
#

or that I saw on another server

native nexus
#

What is the idea you have?

#

I can’t help you if I don’t know exactly what you are trying to do

torn shuttle
echo saddle
#

i mean, if the stuff is utility code, and never instantiate more than one class, what is the point of not using static?

torn shuttle
echo saddle
#

why not skip oop altogether and go straight to functional coding

crude charm
native nexus
#

Oh I see what you are trying todo.

torn shuttle
#

bro why are we even bothering with spigot I'm just going to mod the server jar directly and without telling people I'm modifying it during runtime

#

what could go wrong anyhow

vestal moat
#

guys i need help i want to get list of files in the "messages" resource folder to put them in a Map of file name and its content string

native nexus
#

You need to understand how vectors work.

echo saddle
#

ah, but you also have to use self-modifying code to modify the jar

crude charm
#

but I just didnt know if I was going off distance or what

echo saddle
#

dare I say, "string manipulation"

native nexus
#

Then why are you updating the y value when that is literally the value you shouldn’t change

torn shuttle
#

by modifying itself and the server jar

crude charm
echo saddle
#

must be morning, i see light coming through the curtains

native nexus
#

The player direction is a good start.

torn shuttle
echo saddle
#

hmm, this discord server doesn't have threads enabled?

torn shuttle
#

basically that's not how you do that

#

threads are still in opt-in mode right

echo saddle
#

yeh, think the server has to be configured to make it work

native nexus
#

Go to bed it’s past all your bedtimes

stone sinew
#

In 1.16 somehow Location.getChunk().load() produced a NullPointerException.... Anyone know what would cause that?

ivory sleet
#

Not many bots rely directly on the discord rest api but on wrappers which haven’t updated to support threads yet

echo saddle
#

nah, i'm too wired from rebuilding like 20 plugins