#help-development

1 messages ยท Page 1758 of 1

onyx shale
#

if you do things manually you have full control over everything

spare estuary
#

That is true, but I'm new to plugin development and figured it would be easier to use a template for now

uneven lily
#

i deleted essentilas but they can still fly

quaint mantle
#

Sus

uneven lily
#

why is all players fly while joining my server
how to fix it
please help me!!

onyx shale
#

stop spamming

quaint mantle
#

Maybe disable the permission that says minecraft.fly

onyx shale
tender shard
#

wdym it "doesn't work"?

#

does it print "Successfully reloaded the config files."?

spare prism
# tender shard wdym it "doesn't work"?

nothing changes on the server, but I already figured out that it is cause I'm using enum to store the messages. Could u advise what to do in order to fix it if it's possible?

tender shard
#

enums are instantiated only once. can you show your messages code?

spare prism
#

ofc

tender shard
#

enums are basically nothing else than static final fields

spare prism
#

yeah, I know, that's why I dunno what to do now

tender shard
#

yeah you'll probably want to transfer all the messages to a normal class

spare prism
#

yes

tender shard
#

most of the time, I simply create a class "Messages" that has some methods, e.g. Messages.getInventoryFullMessage() etc

#

and that method then just returns main.getConfig().getString("your-message-name") etc

spare prism
#

do u make a method for every single message?

tender shard
#

in some plugins, yes

#

tbh I do it differently in every plugin

spare prism
#

what can u advise to do

tender shard
#

in some other plugins, the messages are static fields

tender shard
#

in the end, it doesn't matter whether you have a bunch of static fields that you can update on each reload, or whether you create a method for every message, etc

tawny horizon
#

I would personally recommend using JSON for Message configs, but YML works just fine too and is a little easier ๐Ÿ™‚

tender shard
#

I wouldn't use json because it's messier for the server admin

ivory sleet
#

I mean yaml should allow json

#

since yaml is a superset of json

tardy delta
#

i think my litematica fucked it up

tawny horizon
#

The main reason that I like it is because with how I set it up, the config auto updates when i add things

tawny horizon
#

i think there is a modding discord

#

for that XD

spare estuary
#

I'm having troubles with specifying the version in my pom.xml. Spigot 1.17.1 works fine, but any other version (1.8.8 is what I want to target) is underlined in red and IntelliJ tells me it doesn't exist. Here's my pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>global.minecraft</groupId>
    <artifactId>MinecraftGlobalAnalytics</artifactId>
    <version>1.0-SNAPSHOT</version>

    <repositories>
        <repository>
            <id>spigot-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.17.1-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
</project>
tardy delta
#

just redownload it

spare estuary
#

How would I do that?

tardy delta
#

nah not talking to you

tawny horizon
#
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.8.8-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
tawny horizon
#

that should be all ya need for 1.8.8

spare estuary
tender shard
#

it's underlined because your local maven repo doesnt have that version yet

spare estuary
tender shard
#

hit the "reload maven project" button and intellij will download it automagically

spare estuary
#

Thank you

tender shard
#

np

spare prism
spare estuary
tender shard
#

you're welcome ๐Ÿ™‚

torn shuttle
#

Perchance is clearly superior to if

#

Also look at that sexy class system

tender shard
#

lmao it doesnt make sense

#

how is "splendid" the same word as "break"?

#

I mean... echo -> announce makes sense

#

but how does break -> splendid make any sense?

ivory sleet
torn shuttle
rough jay
#

How can I detect when a player rights click on a block?

young knoll
#

PlayerInteractEvent

tender shard
#

be sure to check the hand otherwise your code runs twice

rough jay
#

wdym?

#

check for the hand to but check what? if it's air?

spare marsh
#

What do you recommend me for error handling? LBYL method or EAFP

tardy delta
#

whoa

tender shard
#

only run your code when it returns EquipmentSlot.MAINHAND

rough jay
#

ok

tender shard
#

reason is:

#

the event gets called twice on every right click

#

once for the main hand, once for the offhand

rough jay
#

like this?

@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
    Player player = event.getPlayer();

    if (event.getHand() != EquipmentSlot.HAND) return;
    if (event.getMaterial() != Material.LECTERN) return;

    CityUtils.giveEmeralds(player);
}
tender shard
#

exactly

#

@rough jay

rough jay
#

what?

gritty urchin
#

How do I set custom scoreboard criteria

#

current ones are:

pine island
#

im bad at debugging lol

#

ok gimme a sec shall i send all classes?

gritty urchin
#

no wait

#

LuminaEXE it literally tells

#

you

#

where to look

pine island
#

ok gime a sec

gritty urchin
#

which one is line 33

#

im not counting

pine island
#

bro

#

double bal1 = economy.getBalance(player);

gritty urchin
#

#getBalance() method is returning null

pine island
#

hmm

gritty urchin
#

or the instance is null

#

Economy economy = HardcorePurge.getEconomy();

pine island
#

Shall i send hardcode purge too?

#

its not null for sure

gritty urchin
#

ye send the #getBalance() method

#

doesnt seem to be null

pine island
#

maybe use player.getName() instead of (player)sender

gritty urchin
#

Depends if it accepts a String or a Player

pine island
#

that has caused problems in the past

gritty urchin
#

If it accepts a Player

pine island
#

a string should work too so yeah ill have ago

gritty urchin
#

it doesnt accept a String

#

no it shouldnt

#

Player object is not a String

pine island
#

ill have a go anyways

#

:)

tight hedge
#

Does anyone know how i can disable spawn delay without disabling other delays in essentials?

pine island
#

no idea maybe ask in ess's discord?

tight hedge
#

ah ok

pine island
gritty urchin
#

Show me the method

tender shard
#

you gotta upload it to some repository

#

e.g. I have one, but there's tons of other repos you can use instead too

#

you can use mine if you like

#

DM me

#

another alternative is to use jitpack but tbh they suck

vale ember
#
  1. Make sure you register your event handler
  2. Cite from spigot javadocs: "Plugins should check that hasLocalizedName() returns true before calling this method."
tender shard
#

and 3: "it aint workin" is not a valid description, please state exactly WHAT doesn't work

#

print some text when the event gets called

#

also print some text to check whether your if statement gets executed

vale ember
#

try printing localized name to check if it's right

#

like

@EventHandler
public void onEat(PlayerItemConsumeEvent e) {
e.getPlayer().sendMessage(e.getItem().getItemMeta().getLocalizedName());
}
#

i'd recommend using PersistentDataStorage to check it instead of name, @quaint mantle

iron palm
#

uhhh
ItemStack icon1=KitsConfiguration.get().getItemStack("1.icon");
if (e.getCurrentItem().getType().equals(icon1.getType()))
it isnt working it used to work fine btw

grand flint
#

If I set an item to setInvulnerable will it stop burning in lava and breaking on a cactus?

iron palm
#

wait a second

#

i think the problem isnt from this code!!!!

vale ember
#

remove "()"

iron palm
#

remove ()

#

hehe

grand flint
iron palm
vale ember
grand flint
#

What about other breaking methods

#

Like cactus?

vale ember
#

from post:

@EventHandler
            public void on(EntityDamageEvent event) {
                if (event.getEntityType() == EntityType.DROPPED_ITEM) {
                    event.setCancelled(true);
                }
            }

            @EventHandler
            public void on(EntityCombustEvent event) {
                if (event.getEntityType() == EntityType.DROPPED_ITEM) {
                    event.setCancelled(true);
                }
            }
#

this code will prevent ANY item from being destroyed by cactus or lava

iron palm
#

seems i have your problem now
when i wanna describe my problem i accidently remember that i missed somewhere else but when i wanna go and check where did i missed i forget where it is :i

vale ember
#

if you want only specific item's just edit listener code

#

but it depends on version

#

code above may not work on some MC versions

grand flint
#

Which versions?

vale ember
#

not sure, ill check

grand flint
#

1.17?

iron palm
#

ok my problem fixed i found where was my problem i just forgot something

vale ember
#

also this should work, but i don't tested it in game, you may try it:

@EventHandler
    public void onEvent(EntityDeathEvent e){
        if(e.getEntity().getType() == EntityType.DROPPED_ITEM){
                e.getEntity().setHealth(20);
        }
    }
lavish hemlock
#

the JVM don't lie

tardy delta
#

java virtual machine ๐ŸŽƒ

quaint mantle
#

This is not 100% about Spigot, but is there a way to make seperate namespaces inside namespaces?

#

Like

#

there are different categories of mcfunctions

#

This is about datapacks btw

#

leme try smth

quaint mantle
#

can someonehelp me?

#

eh?

#

can i get bungeecord tech support?

#

Could not connect to a default or fallback server, please try again later: io.netty.channel.ConnectTimeoutException

#

when i joine the bungee server

#

no

#

see

#

my config

wary harness
#

they are same Country as me only diferent city

quaint mantle
#

what is this when i try to use gradle 7.2

#

oke

spark pagoda
#

hey, i'm trying to deal with tile entities in my small worldedit clone experiment, but for some reason the call to Chunk#b(TileEntity) results in a stack trace with "Attempted to place a tile entity --- where there was no entity tile!"
anyone have a clue as to what might be going on? how do tile entities work, and what does my code do, or rather, what doesn't my code do, that causes the tile entity to not be placed properly?

/*
* row[z] = IBlockData
* ch = chunk
* fHandle = Chunk#f(TileEntity) method handle
* */
if (row[z].isTileEntity()) {
    row[z].remove(world, pos, row[z], false);
    TileEntity tileentity = ch.a(pos, Chunk.EnumTileEntityState.c);
    if (tileentity == null) {
        tileentity = ((ITileEntity)row[z].getBlock()).createTile(pos, row[z]);
        if (tileentity != null) {
            ch.b(tileentity);
        }
    } else {
        tileentity.b(row[z]);
        try {
            fHandle.invoke(ch, tileentity);
        } catch (Throwable ignored) {

        }
    }
}
quaint mantle
#

same error

spark pagoda
quaint mantle
#

oh

tribal holly
#

I wanna cry.. I try to change a NPC skin with a command : It work once ! (the player see the npc changing skin) but when i do it a second time it come back to steve (when i logout then login the skin is applied but not in real time) some have uncounter this problem ?

#
public void setSkin(String url) {

        Bukkit.getScheduler().runTaskAsynchronously(Histeria.getInstance(), () -> {

            Skin skin = new Skin(url);
            GameProfile gameProfile = npc.getProfile();
            gameProfile.getProperties().removeAll("textures");
            gameProfile.getProperties().put("textures", new Property("textures", skin.getTexture(), skin.getSignature()));
            System.out.println("propertie applied");

            for (Player player : Bukkit.getOnlinePlayers()) {
                removeNPCPacket(player);
                
                System.out.println("Sending packet to player " + player.getName());
                DataWatcher watcher = npc.getDataWatcher();
                watcher.set(new DataWatcherObject<>(16, DataWatcherRegistry.a), (byte) 127);
                PacketPlayOutEntityMetadata packet = new PacketPlayOutEntityMetadata(npc.getId(), watcher, true);
                ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);

                addNPCPacket(player);

            }

        });
}

    private void removeNPCPacket(Player player) {

        PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection;
        connection.sendPacket(new PacketPlayOutEntityDestroy(npc.getId()));

    }

    private void addNPCPacket(Player player) {

        PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection;
        connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, npc));
        connection.sendPacket(new PacketPlayOutNamedEntitySpawn(npc));
        connection.sendPacket(new PacketPlayOutEntityHeadRotation(npc, (byte) (npc.yaw * 256 / 360)));
        Bukkit.getScheduler().runTaskLater(Histeria.getInstance(), () -> connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, npc)), 1);

    }

    }```
frank harbor
#

why do i get this error when trying to use buildtools : ```'C:\Users\sedoy\Desktop\minecraft\plugins' is not recognized as an internal or external command,
operable program or batch file.
Exception in thread "main" java.lang.RuntimeException: Error running command, return status !=0: [C:\WINDOWS\system32\cmd.exe, /D, /C, C:\Users\sedoy\Desktop\minecraft\plugins,BUILDTOOLS\BuildTools\PortableGit-2.30.0-64-bit\PortableGit-2.30.0-64-bit.7z.exe, -y, -gm2, -nr]
at org.spigotmc.builder.Builder.runProcess0(Builder.java:919)
at org.spigotmc.builder.Builder.runProcess(Builder.java:850)
at org.spigotmc.builder.Builder.main(Builder.java:220)
at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:27)

quaint mantle
#

Mhm

tribal holly
#

do you pass the if condition ?

young knoll
#

Does the if work

tribal holly
#

to slow ๐Ÿ™‚

lunar thunder
#

Quick question. I'm updating an old plugin and there's usage of player.getItemInHand() != null as a condition. Did this mean if the item in the hand was air or was there actually some other reason it could have been null? (or was it simply not possible to be null?)

tribal holly
#

do your "work" message inside the if ?

lunar thunder
#

Well I mean, as of 1.13.2, it's annotated with Nonnull, so I guess only check if it's air or should I just completely remove the that check entirely?

#

I've already dealt with that as well, just wasn't sure about a "replacement" for the null check or if I should just remove that entirely

tribal holly
#

well can't see what's cannot work on your code

#

do you handle somewhere EntityPotionEffectEvent ? and cancel it ?

young knoll
#

It will return air instead of null then

tribal holly
#

well don't know

prisma needle
#

Adding custom players or text to playerlist

tribal holly
#

NPC Change skin

quaint mantle
#

how can i turn for example

location: "59.5, 87.0, 15.60"

to

double x = ..
double y = ..
double z = ..

i mean seperate the commas

#

why not split it into 3 values

#

save your time

#

location-x:
location-y:
location-z:

tribal holly
#
String[] splitedLoc = string.replace(",","").split(" ");
int x = Integer.parsInt(splitedLoc[0]);
...
...
#

but i think the better way is to store inside your yml this yml x: 59.5 y: 87.0 z: 15.6

#

and just get int

young knoll
#

Is vector serializable?

quaint mantle
#
location:
  x: 59.5
  y: 87.0
  z: 15.6
young knoll
quaint mantle
#

isnt it

vale ember
#

can i have some help:
when i create module for nms version, which spigot version i should import, for example 1.16.4 and 1.16.5 has same nms version: 1_16_R3, but what spigot version i should import in maven?

quaint mantle
#

1.16.5 ig

vale ember
#

so the latest sub-version with corresponding NMS>

#

?

quaint mantle
#

| look ugly

#
location: "59.5:87.0:15.60"
#

Why cant you Just use a comma with space

#

locales

#

1,05 = 1.05

#

oh ok

#

always used dots in decimals

grand flint
#
ItemStack potion = new ItemStack(Material.POTION);
ItemMeta meta = potion.getItemMeta();

meta.setColor(Color.RED);```
Why does setColor give error, Cannot resolve method 'setColor' in 'ItemMeta'
young knoll
#

Because ItemMeta does not have a setColor method

grand flint
grand flint
young knoll
#

That should work

grand flint
#

Does \n work for an item lore?

young knoll
#

Donโ€™t think so

grand flint
young knoll
#

Mhm

grand flint
#

So I just have to add another line of lore by adding another lore?

#

lol it just disappeared

young knoll
#

SetLore takes a list

patent horizon
#

anyone know a workaround for that entity glitch that screws up entity positioning if you teleport them too frequently

hybrid spoke
#

you got an example of that glitch?

patent horizon
#

uh

#

basically im removing mob ai and just teleporting them to the locs of a vector

#

it works fine with particles, but mobs are weird and it takes ~5-10 seconds for their position to update to the correct one

hybrid spoke
#

any code? video?

#

never heard of something like that

patent horizon
#

hmm

#

it's fine

#

i ran into it a few weeks ago and just thought it was a common bug or smth

tacit drift
rough jay
#

I'm having trouble using HologramAPI from Holographic Displays plugin

#

I can't figure out how to delete every hologram created

#

HologramCommand line 58

HologramsAPI.getHolograms(plugin).removeAll(HologramsAPI.getHolograms(plugin));
#

plz help me

drowsy helm
#

Have you tried iterating over them instead of removeall

quaint mantle
#

its 'unmodifiable'

#

exception tells you the issue

#

the API likely has a supported way to remove holograms

drowsy helm
#

Oh wait you are just doing removeall on the list. You want to delete them

rough jay
#

yes

rough jay
#

Like this maybe?

Collection<Hologram> holograms = HologramsAPI.getHolograms(plugin);
for (Hologram hologram : holograms) {
    hologram.delete();
}
drowsy helm
#

Yes

crisp arch
#

how do i store an item to sqlite3?

#

im using the JDBC driver btw

drowsy helm
#

Serialize it to a string

#

Popular methods are to a binary blob or base 64

crisp arch
patent horizon
#

can i grab pitch/yaw from a location datatype?

crisp arch
crisp arch
#

Location#getYaw()
Location#getPitch()

patent horizon
#

:(

drowsy helm
crisp arch
#

ah, ok, then ill go with base64, since im more familiar with base64 then messing with blobs

drowsy helm
#

But blobs use far less space

#

So up to you

crisp arch
#

technically, base64 would just require a text datatype right?

drowsy helm
#

Yeah

crisp arch
quaint mantle
#

why do you even need base64

#

Just set raw bytes

paper viper
#

you know the point of base64 is so you can avoid the raw bytes

#

lol

quaint mantle
#

but.. Why do you need it in a database

jaunty ruin
#

What plugin reveals players cords in chat?

young knoll
#

What do you mean in chat

twilit wharf
#

Is there a way I can tell if a player has changed their name since the last time they logged on?

drowsy helm
twilit wharf
#

alright, I was thinking I could take the players uuid and compare it to the data in a db

#

and if the playername associated is different than switch it, but that seemed a bit inefficient.

drowsy helm
#

yeah all you really need is uuid and name in a db

#

if its sql or something it should be fast enough

#

dont think theres any other faster way of doing it

twilit wharf
#

yeah, I think it should work now, dont really wanna change my name to test it though

#

heres the code I am implementing, do you think this should work? java final Player player = event.getPlayer(); String playerName = DatabaseUtils.getPlayerFromUUID(player.getUniqueId()); if (!Objects.equals(playerName, player.getDisplayName())) { DatabaseUtils.addUUID(player.getDisplayName(), player.getUniqueId()); }

drowsy helm
#

looks fine to me

#

never seen anyone use the Objects.equals on strings interesting lol

#

your DatabaseUtils method names are a bit ambiguous

spare estuary
#

How do I support multiple spigot versions? I want to support Spigot 1.8-1.17

stone sinew
#

player.getDisplayName() can be altered. Use player.getName()

drowsy helm
#

oh yeah and that^

twilit wharf
#

thanks

drowsy helm
#

you want official mojang name

twilit wharf
drowsy helm
spare estuary
#

What's NMS?

drowsy helm
#

net minecraft server

#

non spigot-api stuff

#

if you don't know what it is yet, don't worry about it

stone sinew
drowsy helm
spare estuary
#

I specified 1.8 and tried to load the plugin into a 1.17.1 server and it gave me an issue saying that it doesn't support it because it's 1.8

drowsy helm
#

idk i dont work with multi version plugins you would probs know more than me

young knoll
#

Reflection is a pain

#

I prefer modules

drowsy helm
#

yeah modules are easier to work with

spare estuary
#
[20:30:27] [Server thread/ERROR]: Could not load 'plugins\MinecraftGlobalAnalytics.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Unsupported API version 1.8
        at org.bukkit.craftbukkit.v1_17_R1.util.CraftMagicNumbers.checkSupported(CraftMagicNumbers.java:304) ~[spigot-1.17.1.jar:3273-Spigot-3892929-376edf4]
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:141) ~[spigot-1.17.1.jar:3273-Spigot-3892929-376edf4]
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:394) ~[spigot-1.17.1.jar:3273-Spigot-3892929-376edf4]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:301) ~[spigot-1.17.1.jar:3273-Spigot-3892929-376edf4]
        at org.bukkit.craftbukkit.v1_17_R1.CraftServer.loadPlugins(CraftServer.java:409) ~[spigot-1.17.1.jar:3273-Spigot-3892929-376edf4]
        at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:233) ~[spigot-1.17.1.jar:3273-Spigot-3892929-376edf4]
        at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1010) ~[spigot-1.17.1.jar:3273-Spigot-3892929-376edf4]
        at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:305) ~[spigot-1.17.1.jar:3273-Spigot-3892929-376edf4]
        at java.lang.Thread.run(Thread.java:831) [?:?]
drowsy helm
#

if you remove api-version in your plugin.yml i believe it won't whine about it

spare estuary
#

Already tried that

drowsy helm
#

thats just a warn

spare estuary
#

Wait that traceback was from a different thing I fixed I think

#

Yep

young knoll
#

API version only exists past 1.13

wary harness
#

Any one an recommend good scoreboard
I found real and animated scoreboard

#

Is that best on spigot offer

#

Or am i wrong

young knoll
#

Donโ€™t ask in multiple channels

crisp arch
#

does anyone know how much bytes an itemstack blob takes up?

#

i need to know in order to allocate the correct blob datatype for my SQL table

young knoll
#

I imagine that varies greatly

crisp arch
young knoll
#

Depends on the item

#

I imagine items with a ton of NBT will be much larger

crisp arch
#

im trying to add custom items to the game, so that would include items with enchantments, and probably lots of lore

#

is there a datatype that is dynamically allocated for blobs?

#

honestly, i think ill just go trial and error

#

ill just continue with my plugin, and if my database runs out of memory, ill just increase the blob datatype size

young knoll
#

What database system is it

crisp arch
young knoll
#

I donโ€™t think SQLite even differentiates between blob types

crisp arch
#

really?

#

oh maybe because im reading sql docs not sqlite docs: https://www.w3schools.com/sql/sql_datatypes.asp

crisp arch
#

really straight forward datatypes

young knoll
#

Dynamic typing

tranquil viper
#
java.lang.IllegalArgumentException: Data cannot be null```

happens for the other permissions aswell, the plugin works fine but the error just bugs me and fills up console

```permissions: 
  minealerts.alerts:
  slowchat.use: 
  slowchat.bypass: ```
quaint mantle
#

It expects properties if you define a permission I'd assume

#

Oh, because no reason exists to define permissions in your plugin.yml unless you're adding those properties

young knoll
#

You should define them

#

With just a description at least

#

That way stuff like luckperms can tab complete them

raw coral
#

Anyone know why whyen i spawn this its invisible

package xyz.fragbots.sandboxend.entities

import net.minecraft.server.v1_8_R3.EntityEnderDragon
import net.minecraft.server.v1_8_R3.PathfinderGoalSelector
import net.minecraft.server.v1_8_R3.World
import org.bukkit.Location
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld
import org.bukkit.event.entity.CreatureSpawnEvent
import org.bukkit.util.Vector
import java.lang.reflect.Field


class CustomEnderDragon(world: World) : EntityEnderDragon(world) {
    init {
        try {
            val goalB = getPrivateField("b", goalSelector) as MutableList<*>
            goalB.clear()
            val goalC = getPrivateField("c", goalSelector) as MutableList<*>
            goalC.clear()
            val targetB = getPrivateField("b", targetSelector) as MutableList<*>
            targetB.clear()
            val targetC = getPrivateField("c", targetSelector) as MutableList<*>
            targetC.clear()
        } catch (ignored: Exception) {
        }
    }

    fun start() {
        getBukkitEntity().velocity = Vector(1.0,1.0,1.0)
    }

    private fun getPrivateField(fieldName: String, `object`: Any): Any? {
        val field: Field
        var o: Any? = null
        try {
            field = PathfinderGoalSelector::class.java.getDeclaredField(fieldName)
            field.isAccessible = true
            o = field.get(`object`)
        } catch (e: NoSuchFieldException) {
            e.printStackTrace()
        } catch (e: IllegalAccessException) {
            e.printStackTrace()
        }
        return o
    }

    companion object {
        fun spawn(location: Location) : CustomEnderDragon {
            val world = (location.world as CraftWorld).handle
            val dragon = CustomEnderDragon(world)
            dragon.setLocation(location.x, location.y, location.z, location.yaw, location.pitch)
            dragon.isInvisible = false
            world.addEntity(dragon, CreatureSpawnEvent.SpawnReason.CUSTOM)
            dragon.start()
            return dragon
        }
    }
}
sullen marlin
#

kotlin is at the point where I cant even understand what it's doing anymore

raw coral
#

What about it is confusing?

sullen marlin
#

don't understand why half those things are there

raw coral
#

Probably just my bad code

sullen marlin
#

the issue is probably you havent registered your custom entity, follow a tutorial or something

raw coral
#

Oh that would make sense

sullen marlin
#

not clear why you need a custom subclass for what you have written though

raw coral
#

Would it be possible to control where the dragon moves without nms?

sullen marlin
#

using nms != making a custom subclass though

#

unclear what subclassing is doing here

raw coral
#

Nothing really, in what scenario would you want to use a subclass versus just using getHandle?

sullen marlin
#

where you actually override a method

raw coral
#

So i wont need to do that for changing how it moves?

sullen marlin
#

not on the basis of the code you currently have

raw coral
#

How would I make the dragon fly to a block, would it be a pathfinding goal?

spare marsh
#

Quick question, so If I start a runnable all inside a method, then after the runnable I have another piece of code. Will the other piece of code wait for the runnable to stop running or will it schedule the runnable and the next piece of code at the same time>

#

?

raw coral
#

The latter

spare marsh
#

Correct

vital yacht
#

Iโ€™m pretty sure it runs 1 tick later

young knoll
#

It doesnโ€™t

raw coral
#

The runnable would run one tick later not the rest of the code in his function

young knoll
#

It runs right after the runnable is scheduled

vital yacht
#

I donโ€™t know where I heard it from

raw coral
#

If you just did Bukkit#getScheduler#runTask that would run on the next tick i believe

spare marsh
#

So for example

public boolean doSomeTask(){
  boolean[] successful = {true};
  
// RUN SOMETHING FOR 5 MINUTES
   new BukkitRunnable() {
        @Override
        public void run() {
          if(!somecondition){
              successful[0] = false
            }   
         }
    }.runTaskTimerAsynchronously(plugin, 0, 20);

return successful[0];
}
#

So the return would run right after the BukkitRunnable is scheduled or it will await for it to finish>

#

?

raw coral
#

also that function seems wierd, what you're returning doesnt have the same type as the function defines

spare marsh
#

Yeah yeah my bad haha messed up

#

There

#

So it wouldn't wait for the task to end right?

young knoll
#

Correct

raw coral
#

Still wrong, you're returning a boolean[], an Array of booleans

#

when the function defines itt o be a boolean

young knoll
#

Why do you have an array of 1 Boolean anyway

raw coral
#

^

spare marsh
#

Because the successful boolean is outside the runnable and will need it later to return something I guess

#

I don't like using AtomicBoolean either

vital yacht
#

That doesnโ€™t work like that

raw coral
#

You should just make an object that stores the boolean

vital yacht
#

Your method will return the value in the array, the runnable never sets a value you can use.

spare marsh
young knoll
#

If you want to return something later you need to use futures

raw coral
#

Well that's pretty much the only way to do it

#

or use futures

vital yacht
#

Or use a callback

raw coral
#

sure

spare marsh
raw coral
#

I could help you better with context

spare marsh
# raw coral I could help you better with context

So I have been making a class that when it is instantiated, the constructor just calls the start method of the class. On the start method it is just calling methods and making sure everything is setup correctly before it can continue. One of these is ran by a BukkitRunnable so I need to make sure everything went okay before proceeding to the next method. I need to make sure everything in that runnable went correctly before starting the next one which is scheduled exactly 60 seconds after the previous one. So I need a boolean that will define if it was successful or not. If its not it will just terminate the whole thing, if it was it will just be saved to a Set so its not accessed anymore but just for checking.

#

the object will be saved to the set ***

#

Its actually surrounded by try and catch and it catches any errors with returning just false

#

but the thing is that at the end if it was successful I want it to return the value of the boolean to see if it continues or not.

young knoll
#

Then you need a future or a callback

spare marsh
#

I'm guessing making a private final variable that will just be checked before proceeding to the next one?

young knoll
#

Probably a future

spare marsh
#

That would be the easies way?

#

Alright I will used that thank you.

manic furnace
#

How can i make a command with subcommands?

warped granite
#

Is it possible to get the inventory after a click on InventoryClickEvent without a runnable

ivory sleet
ivory sleet
sullen marlin
#

no monitor is still in the event though

ivory sleet
#

Yes but no mutations should by convention happen in MONITOR thus the event state should be preserved so unless youโ€™re doing something that needs to be pedantically coordinated after one tick it should work perfectly fine using MONITOR.

opal juniper
#

no real way to have it after without a runnable afaik

ivory sleet
#

monitor is theoretically after the event has been fired and possibly mutated so Iโ€™d say it works fine there "getting the inventory"

opal juniper
#

itโ€™s probably under the nms itemstack

#

or not

#

idk

#

lol

tawny quartz
#

Hey can someone help me with a plugin

#

I packed the plug-in LobbyLeave from BukkitTNT on my bc server and entered the standard and admin group in the bungeeconfig and also transferred the correct name of the server to the lobby leaveconfig, but this error message always comes up "When executing this command is a Internal error occurred, please check console log for details. "

#

@help

ivory sleet
sullen marlin
#

Why would you use packets for this, thereโ€™s an api

#

Type cooldown into the javadocs

plush crescent
sullen marlin
#

Idk ask the api author?

#

Check one of the 50 other plugins that does this?

plush crescent
#

"Code details"

@EventHandler
    public void onJoin(PlayerJoinEvent joinEvent) {
        Player player = joinEvent.getPlayer();
        UUID player_uuid = player.getUniqueId();
        LunarClientAPI api = LunarClientAPI.getInstance();

        /*
        ใ€€LunarClient
         */
        if(api != null && api.isRunningLunarClient(player_uuid)) {
            player.kickPlayer("Kick");
        }
    }
quaint mantle
#

So iwent through all the wiki on spigot then what should i do after that to learn more

drowsy helm
#

is the event registered

plush crescent
plush crescent
drowsy helm
#

sounds like an api issue then contact the dev

drowsy helm
#

learn more about what?

wide coyote
#

add 1 or 2 tick delay

#

1 tick = 50ms

drowsy helm
wide coyote
drowsy helm
#

tps isnt always 20, so it can vary

wide coyote
#

when the server is overloaded i guess?

#

ah yea

#

you are right

hybrid spoke
drowsy helm
hybrid spoke
# drowsy helm Could you explain?

every tick is 50ms. if your operation or smth else comes over this 50ms, the tick will "expand", what is called a lag spike. mh, maybe not expand, its more like "out of tick". after that little excurse it will try to continue in time. so not the tick time varys, the ticks amount does

solid cargo
#

anyone a bit deeper in java than me, question for you: How the heck does a perfectly working plugin just decide to break one day

#

if server jar isnt updated or anything

hybrid spoke
#

define "break"

solid cargo
hybrid spoke
#

exploits or exceptions?

solid cargo
#

i would say uh

#

exceptions

#

yes, exceptions

#

sorry bout that confusion

hybrid spoke
#

mhh, there could be several reasons

solid cargo
#

one day the plugin decides to color red in plugin list

hybrid spoke
#

what kind of exceptions?

solid cargo
#

i dont have that problem atm

#

im just asking in general

#

if a plugin works perfectly 1st day and it completely dies in the 2nd day

hybrid spoke
#

so maybe it failed to load something. a missing file, corruption, anything else what just broke

#

or it fucked itself by loading something wrong

#

moving anything

#

caches not empty

solid cargo
#

ahh

#

ok

#

now i know another thing!

#

yay

hybrid spoke
solid cargo
#

thats a good one lol

summer scroll
#

@plush crescent try to give a delay to kick the player.

#

maybe 3 ticks or more, also put a debug message to make sure

quaint mantle
pastel stag
#

more of a general java question here than a spigot question but if i create an ArrayList in Main.java how do i properly pass that arraylist through and allow it to be edited by another class? ive already tried passing it through as a variable but i'm getting a nullpointer

drowsy helm
drowsy helm
#

Whats the use case?

quaint mantle
#

Any suggestions

pastel stag
#

toggle command and the same array needs to be able to be accessed by multiple separate classes

drowsy helm
#
public class Main{
  public List<String> myList = new ArrayList<>();

  public void onEnable(){
    new MyCommand(this);    
  }
}

public class MyCommand{  
  private Main main;
  public MyCommand(Main main){
    this.main = main;
  }

  public void onCommand(){
    main.myList.doWhatever();
  }
}```
#

something like that

#

thats a very basic version of it

pastel stag
#

is there a reason behind not creating the array in onEnable{}?

drowsy helm
#

Itโ€™s just an example do it however you need to

pastel stag
#

so i think i basically tried this same thing and it wasn't working either let me re-type it all maybe theres a typo....

#

brb

drowsy helm
#

Make sure your access modifiers are correct

pastel stag
#

i may have also forgotten to make it public in Main

#

super possible

summer scroll
pastel stag
#

@drowsy helm am i not able to ArrayList array1 = main.wpurgeArray;

#

in the child class

summer scroll
#

If you initializing the list on onEnable then you'll receive NPE exception.

pastel stag
#

it isn't being initialized in onEnable its in the Main constructor

summer scroll
#

show code

pastel stag
#
    public ArrayList<String> wpurgeArray = new ArrayList<String>();

    @Override
    public void onEnable(){```
#

in the child class:

#
    private Main plugin;
    private final SQLLogger sqllogger;
    public TogglePurgeBlock(Main plugin , SQLLogger sqllogger){
        this.plugin = plugin;
        this.sqllogger = sqllogger;
        plugin.getCommand("wpurge").setExecutor(this);
    }

    ArrayList array1 = plugin.wpurgeArray;```
#

TogglePurgeBlock is initialized in onEnable{}

#

TogglePurgeBlock togglepurgeblock = new TogglePurgeBlock(this , sqllogger);

#

in Main.java

gilded pond
#

hello
anyone know how to configure a fireball so it can actually fireball jumps?
we're using the bedwars 1058 plugin
somehow it doesnt make u jump

#

the tnt jump works it was default, i didnt set it up

summer scroll
gilded pond
#

any help?

hybrid spoke
#

since you just want to know more about spigot, i assume that you already know java. therefor it shouldnt be too hard

pastel stag
#

@summer scroll so rather than specifying plugin.wpurgeArray.doThings() everywhere i wanna use that array shouldnt i just be able to ArrayList array1 = plugin.wpurgeArray;

#

just like you can int blockx = b_loc.getBlockX();

summer scroll
pastel stag
#

i feel like theres something im missing ugh lol i feel dumb

lost matrix
lost matrix
gilded pond
#

uh

pastel stag
#

@gilded pond it seems like a plugin configuration question for a plugin that already exists which is why its been ignored

lost matrix
pastel stag
#

@gilded pond yeah this channel is for coding issues in creating plugins you mentioned an existing bedwars plugin and while ive never used bedwars the question you asked seemed more like a configuration issue w/ that plugin than you asking how to fix code in one of your own plugins

#

@lost matrix the data inside the array is not sensitive its just for a toggle command and holds nothing but uuids of people who have the toggle turned on

pastel stag
gilded pond
lost matrix
pastel stag
#

@gilded pond i dont know anything about bedwars as i said but unless you're coding your own plugin which it really doesn't seem like you are or youd know it, you should ask the developer of bedwars your question or maybe #help-server

summer scroll
#

Yeah like I said, ideally you will have one class that handle the thing, and never expose the list itself.

pastel stag
#

if you had multiple classes reading and writing from/to the same array what would be the 'ideal' way to handle that use-case then

lost matrix
#

In theory you should be able to just do something like this:

  plugin.wpurgeArray.get(1);

Or

  ArrayList<String> list = plugin.wpurgeArray;
  list.remove("Something");

But i strongly advise against that

pastel stag
lost matrix
summer scroll
#
public class ToggleManager{
    private final List<UUID> list = new ArrayList<>();

    public void toggleOn(Player player){
      list.add(player.getUniqueId());
    }

    public void toggleOff(Player player){
      list.remove(player.getUniqueId());
    }
}
```Something like that, and all you need to do is pass the class. Encapsulation.
pastel stag
#

@lost matrix so i should basically chock it up to weird behaviors due to bad overall structure more or less

#

@summer scroll so lets say you have another class DifferentClass.java that also needs to be able to see what's inside ToggleManager.list

summer scroll
lost matrix
# pastel stag <@!220605553368498176> so i should basically chock it up to weird behaviors due ...
public class PlayerTrack {

  private final Set<UUID> trackedPlayerIDs = new HashSet<>();

  public boolean isTracked(final UUID playerID) {
    return this.trackedPlayerIDs.contains(playerID);
  }

  public void track(final UUID playerID) {
    this.trackedPlayerIDs.add(playerID);
  }

  public void unTrack(final UUID playerID) {
    this.trackedPlayerIDs.remove(playerID);
  }

}

Then

public final class SpigotSandbox extends JavaPlugin {

  private final PlayerTrack blockPlayerTracker = new PlayerTrack();
  private final PlayerTrack someOtherTracker = new PlayerTrack();

  @Override
  public void onEnable() {
    // Pass the trackers to other classes here or write getters for them
  }

}
pastel stag
#

hmmm alright

summer scroll
#

@pastel stag you don't want other class to directly access the List.

#

instead you can minimize with method for specific goals.

pastel stag
#

for, security purposes? or optimization or just bad implementation in general

summer scroll
#

for example to check if the uuid is exist on the list or not.

pastel stag
#

i see what you are saying just curious now what the real life downside is

lost matrix
# pastel stag <@!299801068450086912> so lets say you have another class ```DifferentClass.java...

Lets assume your Listener needs the tracker:

public class SomeListener implements Listener {

  private final PlayerTrack blockPlayerTrack;

  public SomeListener(final PlayerTrack blockPlayerTrack) {
    this.blockPlayerTrack = blockPlayerTrack;
  }

  @EventHandler
  public void onBreak(final BlockBreakEvent event) {
    final Player player = event.getPlayer();
    if (!this.blockPlayerTrack.isTracked(player.getUniqueId())) {
      return;
    }
    player.sendMessage("You are tracked!");
  }

}

Then you would pass this PlayerTrack instance in the constructor of your Listener when you create it:

public final class SpigotSandbox extends JavaPlugin {

  private final PlayerTrack blockPlayerTracker = new PlayerTrack();
  private final PlayerTrack someOtherTracker = new PlayerTrack();

  @Override
  public void onEnable() {
    final SomeListener listener = new SomeListener(this.blockPlayerTracker);
    Bukkit.getPluginManager().registerEvents(listener, this);
  }

}
summer scroll
#

it will be hard to maintain the code, and in the future if you keep updating it, it will make the code not readable.

lost matrix
#

Btw this is called dependency injection or just DI in short

young knoll
#

I have getters for a lot of collections

#

Iโ€™m bad ik, I should probably return immutable copies

lost matrix
pastel stag
#

@lost matrix @summer scroll well thank you guys for the assistance ๐Ÿ™‚

summer scroll
#

np, good luck!

lost matrix
young knoll
#

I need the list for tab completion

lost matrix
#

Ah i see

young knoll
#

I guess I could make a method where I pass the tab complete args and return a list<string>

tardy delta
#

dependency injection for collections ๐ŸŒ

lost matrix
tardy delta
#

i mean

#

is that even used?

lost matrix
tardy delta
#

oh ๐Ÿง

ashen agate
#

Does anyone know how I would loop through these values with SnakeYAML?

spawn-points: # property with type string list
  - # (1) list item 1
    - 'x:y:z' # (2) list item 1
    - 'x:y:z' # (2) list item 2
  - # (1) list item 2
    - 'x:y:z' # (2) list item 1
    - 'x:y:z' # (2) list item 2
stone sinew
ashen agate
#

Right. Thanks.

stone sinew
#

np

tardy delta
#

hmm still havent fixed it smh

tardy delta
#

bruh optifine internal shaders cause rendering problems

eternal oxide
#

all shaders break glow effects

stone sinew
tardy delta
#

optifine breaks it all :/

#

aha fixed it

frank harbor
#

how can i get the net.minecraft library to work

tardy delta
#
<repositories>
   <repository>
      <id>spigot-repo</id
      <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
   </repository>
</repositories>

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

add this to your pom.xml and replace the versions

summer scroll
#

?bt

undone axleBOT
tardy delta
#

what is this even?

ivory sleet
# lost matrix No. Bad ForteenBrush ๐Ÿ˜ 

I do it sometimes when I want to components to rely on high level abstract data structures, then I pass the concrete data structure class through the constructor when instantiating.

#

So wouldnโ€™t say itโ€™s always bad

tardy delta
#

heh i'm getting confused

#

i guess the first one is an older version

ivory sleet
#

One is the shaded version when shaded into mc server jar

tardy delta
#

oh

#

wondering why its in my pom

quaint mantle
#

how do i get the nbt tags from an item in a player's inventory

tardy delta
#

saw this

#

then use tag.getKeys()

quaint mantle
#

wait ill send screenshot

#

nvm

#

somehow it works now

#

but thanks

tardy delta
#

oh

quaint mantle
#

im really bad at understanding things

tardy delta
#

i also saw this

#

i saw alot

quaint mantle
#

if tag.getKeys().hasKey("mynbt:1b)

#

okkk

tardy delta
#

ignore the public ArrayList smh

quaint mantle
#

oka

#

what is an nbt base?

tardy delta
#

uhh i guess google is your best friend

quaint mantle
#

okay i gues

#

i still dont get it

#

say i have an nbt

#

bottle:1b

#

on an item "bottle"

#

i go

#

NBTTagCompound tag = bottle.getTag();

#

now how do i check

stone sinew
#

I still have to fix my item nms class

quaint mantle
#

if bottle:1b exists in the tags

quaint mantle
tardy delta
quaint mantle
tardy delta
#

loop through the tag.getKeys()

quaint mantle
#

but thats what i am confused about

#

are the keys the nbt data itself

#

or maybe just an index

tardy delta
#

like this and check if it instanceof the thing you're looking for

#

if you want a string

stone sinew
# quaint mantle ?

I was gonna just copy mine and send it but I have to fix it xD. Because for some reason NBTTags are LinkedTreeMaps instead of normal fucking objects like String, Double, List etc...

quaint mantle
tardy delta
#

the keys are maps i guess

quaint mantle
#

what data type is "tagList"

#

array right?

tardy delta
#

List<>

#

as you cant perform .get() on an array

quaint mantle
#

oka

tardy delta
#

ah tag.getKeys() returns a list

#

not a map

#

sorries

stone sinew
#

If I run tag.get(key).getClass().getName() it returns the LinkedTreeMap class lol

tardy delta
#

heh

#

why not for (Map.entry<String, Object> key : tag.getKeys()) then?

stone sinew
#

Ill show my code later

next stratus
#

Hey, I've been attempting to add fawe into my plugin with no luck at all. Can someone help?

tardy delta
#

i still think craftItemStack.getTag().getKeys() returns a list

tardy delta
tawny quartz
#

can someone help me?
I packed the plug-in LobbyLeave of BukkitTNT on my bc server and entered the standard and admin group in the bungeeconfig and also transferred the correct name of the server to the lobby leaveconfig, but this error message always comes up "When executing this command is a Internal error occurred, please check console log for details. "

tardy delta
#

i think..

next stratus
#

I'm trying to add it into my plugin like the API part

tardy delta
#

uhu

next stratus
tawny quartz
#

can someone help me?
I packed the plug-in LobbyLeave of BukkitTNT on my bc server and entered the standard and admin group in the bungeeconfig and also transferred the correct name of the server to the lobby leaveconfig, but this error message always comes up "When executing this command is a Internal error occurred, please check console log for details. "

pine island
#

it just downloads all things again

next stratus
#

I've tried this yesterday and today same problem

quaint mantle
#

how

quaint mantle
#

can i show how many players it is in a ntt bungee server?

tardy delta
#

and i think you have to soft-depend it

next stratus
#

light mode ahh

tawny quartz
#

can someone help me?
I packed the plug-in LobbyLeave of BukkitTNT on my bc server and entered the standard and admin group in the bungeeconfig and also transferred the correct name of the server to the lobby leaveconfig, but this error message always comes up "When executing this command is a Internal error occurred, please check console log for details. "

#

plsss

tardy delta
#

github..

pine island
#

yeah u need dependencies{--}

next stratus
#

ok i hate gradle lol

tardy delta
#

use maven lol

pine island
#

maven > gradle

next stratus
#

๐Ÿคฎ

tawny quartz
tardy delta
#

:/

next stratus
#

they add ()'s but adding those break it

acoustic pendant
#

Hello, do anyone know any guide about creating a schematic?
I mean, to create a construction with a command for example

next stratus
#

And it can't find the things ahhh

acoustic pendant
tardy delta
#

a mod :kekw:

acoustic pendant
#

hmm

#

i want to do it in a pl

#

xD

next stratus
tardy delta
acoustic pendant
#

i mean, like an skyblock plugin... You can create a construction (island) that is predefined

tardy delta
#

it has a schematic function

#

not that big as a mod but still

acoustic pendant
#

but

#

it's not the same

tardy delta
#

i understand

acoustic pendant
#

okay

#

do you maybe know any guide about that?

tardy delta
#

i dunno how those skyblock islands work tbh

acoustic pendant
#

i haven't found nothing

tardy delta
#

havent they all different worldborders while in the same world? ๐Ÿ‘€

stone sinew
#

My skyblock plugin is the reason I'm reworking my ItemNMS class xD

acoustic pendant
#

should i use NMS for creating an island for example?

quaint mantle
#

can someone help me?

tawny quartz
#

can someone help me?
I packed the plug-in LobbyLeave of BukkitTNT on my bc server and entered the standard and admin group in the bungeeconfig and also transferred the correct name of the server to the lobby leaveconfig, but this error message always comes up "When executing this command is a Internal error occurred, please check console log for details. "

#

pleeeeeeeeeeeeeeeeeeese

acoustic pendant
stone sinew
acoustic pendant
#

check the console and see what is wrong

tawny quartz
acoustic pendant
#

so i don't know

quaint mantle
#

how can i make it show under my npc how many players it is in my otther bungee server?

tardy delta
#

probably need a holographic for that

quaint mantle
#

cant i use placholder?

tardy delta
#

if you want it under your npc, you better use a holographic

#

and then you can probably use placeholders

tawny quartz
#

can someone help me?
I packed the plug-in LobbyLeave of BukkitTNT on my bc server and entered the standard and admin group in the bungeeconfig and also transferred the correct name of the server to the lobby leaveconfig, but this error message always comes up "When executing this command is a Internal error occurred, please check console log for details. "

#

heeeeeeeeeeeeeeeeeeelp please

quaint mantle
#

i know but what is the thing i type like %total or yea yk%

tardy delta
#

a placeholder

#

it gets replaced by a value

quaint mantle
#

yea what value i put?

tardy delta
quaint mantle
#

thx

#

what

#

means this error?

tardy delta
#

duplicated handler

#

rename it or something

rough jay
#

Hey I have an issue

tardy delta
#

ZUser.java:80

quaint mantle
#

??

#

rename what?

rough jay
#
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    if (args.length == 0) {
        sender.sendMessage(MaxiCity.chat("/broadcast <message>"));
        return true;
    } else {
        StringBuilder message = new StringBuilder();
        for (String arg : args) {
            message.append(arg);
        }
        MaxiCity.broadcast(plugin.getServer(), "&6&l----------");
        MaxiCity.broadcast(plugin.getServer(), "&6&l" + message.toString());
        MaxiCity.broadcast(plugin.getServer(), "&6&l----------");
    }
    return true;
}

This is my broadcast command but if I type /brodcast Hey everyone how are you?
It will display

----------
Heyeveryonehowareyou?
----------
#

Any idea how to keep the spaces?

young knoll
#

Add a space after each string

tardy delta
quaint mantle
#

nms?

#

i just did /znpcz action add server and the server name

rough jay
young knoll
#

Mhm

tardy delta
#

uh wait

#

what are you even doing?

rough jay
#

well every arg is grouping into one string

tardy delta
#

it is something with an playerjoinevent

tardy delta
quaint mantle
#

I am clicking on the npc and it sends me to the world and it is suppost to change the number abow the npc the total players but it gives me the error

tardy delta
#

do you have a ZUser.java file?

#

line 80 it says

#

you are probably sending packets to joining players

#

and using a duplicated handler

quaint mantle
#

how?

quaint mantle
tardy delta
#

i dunno

tardy delta
elfin talon
#

Does anyone know why this does not work.
skull.setOwningPlayer(Bukkit.getOfflinePlayer(UUID.fromString(rang.get(id))));

it works on the test server
but on this server nothing works with Bukkit.getOfflinePlayer()

quaint mantle
#

why dosent the total players update?

hasty prawn
#

Probably because you're not updating it

quaint mantle
#

/znpcs lines 1 &4LifeStealSMP &ePlayers-online-&7(&a%bungee_ScardCraftLifesteal%)

#

this is right ?

azure nova
#

what is namespacedkey, like I have seen it in so many spaces, and even tried researching about it, but it is really confusing for me, it would be really helpful if someone can explain it for me in simple words, pleaseeee!!!!!

young knoll
#

Itโ€™s a key thatโ€™s specific to your plugin

#

Just like how minecraft has keys for everything, like minecraft:stone

#

Minecraft is the namespace, stone is the key

azure nova
#

ohhhh

#

oh is see, so minecraft:stone is a namespacedkey right? or is it just a example that u used to compare to explain? @young knoll

young knoll
#

Yes

azure nova
#

what....

#

that was not a question for "yes" or "no" xd

tardy delta
#

it is

young knoll
#

The first part is

visual tide
gritty urchin
#

How to set horizontal and vertical knockback multiplier?

hasty prawn
elfin talon
#

i get the error: java.lang.NullPointerException at java.util.UUID.fromString(UUID.java:197) ~[?:?] at com.tyko.knockitv2.ranking.Ranking.set(Ranking.java:51) ~[?:?] at com.tyko.knockitv2.commands.SetHeightCommand.onCommand(SetHeightCommand.java:33) ~[?:?] at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[spigot.jar:git-Spigot-dcd1643-e60fc34]

code:
String name = Bukkit.getOfflinePlayer(UUID.fromString(rang.get(id))).getName();

Could anyone help me please

gritty urchin
hasty prawn
hasty prawn
#

?paste

undone axleBOT
elfin talon
glass tangle
hasty prawn
#

Looks like your map doesn't have a value of the ID @elfin talon

elfin talon
#

i have changed but dont work

old cloud
#

Hello, I noticed that you can place water with the RIGHT_CLICK_AIR action if you point your courser on the last block that is possible to reach, without "selecting" a block to place the water against, which kind of creates glitched water if you cancel the event. That water does not spread but you can collect it with an empty bucket. If you place a block where the "glitched water" is, it will just disappear.
Anyone knows how I can prevent that a player can place "glitched water"?

gritty urchin
#

It doesn't increase player vertical velocity by 2

hasty prawn
#

0 * 2 = 0

tardy delta
#

hehee

#

reminds me at my marks for school

gritty urchin
#

What does the #setY() method do

#

exactly

hasty prawn
#

It sets the Y value of the Vector to 0

gritty urchin
hasty prawn
#

Don't set it to 0..

gritty urchin
#

Yeah but the existing?

hasty prawn
#

You already have the existing, you're overwriting it by setting it to 0

#

So just don't do that

gritty urchin
#

But how would I just multiply Y

#

and X

#

seperately

#

with different values?

#

@hasty prawn

#

?

hasty prawn
#

Get the values, multiply them separately, and then use setY and setX

#

Or multiply by another Vector that has the ones you don't want to change as 1

So if you have Vector(2, 3, 4) and want to multiply the X by 2, multiply by Vector(2, 1, 1) which should yield Vector(4, 3, 4)

mystic sky
rough jay
#

Uh I have an issue.... very weird

#
@EventHandler
    public void onPlayerInteract(PlayerInteractEvent event) {
    if (event.getHand() != EquipmentSlot.HAND) return;
    if (event.getMaterial() != Material.LECTERN) return;
    // Check if player is in the correct region

    giveEmeralds(event.getPlayer());
}
#

It's supposed to execute the method giveEmeralds only if the player right-clicks on a Lectern

#

but it doesn't, it only does it if the player right clicks with a Lectern in his hand

hasty prawn
rough jay
#

ok thx

summer scroll
#

Check the click type too.

jade grove
#

i got returned this error

#

    public static String colorize(String text) {
        return ChatColor.translateAlternateColorCodes('&', text);
    }
#

my color class ^

hasty prawn
#

Text is null

jade grove
#

any solutions?

hasty prawn
#

ServerSelectorItem line 43

jade grove
jade grove
hasty prawn
#

Yeah this.getName() must be null

jade grove
#

how is it null?

hasty prawn
#

Doesn't exist in the config

jade grove
#

it does tho .-.

hasty prawn
#

"Nagivation"

jade grove
#

shit

#

im braindead

#

oh nvm

#

im right

jade grove
hasty prawn
#

Well then your code is wrong, cause it says "Navigation"

jade grove
#

oh

#

lol

#

im braindead

#

thanks for clarifying

hasty prawn
#

Btw Navigation is the correct spelling, not Nagivation

jade grove
#

i wrote it wrong in the config file

hasty prawn
#

Yes

jade grove
#

idk how i didnt notice that, sorry for bothering

silver shuttle
#

Theoretically coding in Kotlin should work for making Spigot plugins right?

#

since it just compiles to Bytecode

#

and runs on the JVM

vale ember
silver shuttle
#

oh ty

rotund prawn
#

can someone help

#

what does these errors mean

ivory sleet
#

Kotlin can compile to jvm bytecode and it some of its functionality can be similar to Java even more with annots like @JvmStatic etc

quaint mantle
#

do you guys know if there is something that gets legacy text from a component in kyori?

young knoll
#

Donโ€™t you still have to shade Kotlin

ivory sleet
#

Yes its stdlib

#

Wonโ€™t come long without it

ivory sleet
subtle folio
#

Is mongoDB or MySQL better for databases in minecraft?

lavish hemlock
#

but can it deserialize?

quaint mantle
#

ty didn't know it was called like that, thought it was something like bungee components

lavish hemlock
subtle folio
#

not really

#

well

#

yeah

#

ig

lavish hemlock
#

what

#

it's not a yes/no question

subtle folio
#

i going to use it in my spigot java plugin

ivory sleet
lavish hemlock
#

You should probably support MySQL.

subtle folio
#

i wanna store punishments

#

and warns,

young knoll
#

Those are easily relational

lavish hemlock
#

btw is it just me or is SQL really hard to visualize?

young knoll
#

So MySQL

rotund prawn
ivory sleet
#

If you have the chance, choose postgresql over mysql

#

As db

lavish hemlock
rotund prawn
#

waht can i do to fix it?

quaint mantle
#

Idk sql looks super Simple to me

lavish hemlock
#

oh ye SQL is simple

#

I just can't

#

visualize what it does

#

I can understand it but I can't make a mental model of it performing actions

young knoll
#

I canโ€™t really think of how to store an inventory to sql

#

1 table row per item I guess?

quaint mantle
#

serialize it to bytes and store as blob

lavish hemlock
#

but what if you only need one item at a time?

rotund prawn
young knoll
#

I figure one item per row is less ugly than one giant blob

quaint mantle
#

well, then do a table
[InventoryId, Slot, Item]

lavish hemlock
#

(oh btw I don't know SQL conventional shit for plugins)

#

(like, are you supposed to create a new table within a plugins db or a my-plugin db or are you not supposed to create a new db)

young knoll
#

Depends

#

A lot of hosts only offer 1 db

#

So you probably want to use a table

lavish hemlock
#

can you have nested tables

quaint mantle
#

I dont see whats wrong with storing inventory as fat blob

young knoll
#

But with SQLite you can just make an entire new db

quaint mantle
#

Those hostings are dumb

young knoll
#

Still, if you want to support as many users as possible

lavish hemlock
#

support more than one db

#

lol

quaint mantle
#

thats why h2, hsqldb and sqlite exists

lavish hemlock
#

there's like 50 different databases it annoys me

young knoll
#

and each 1 is slightly different

lavish hemlock
#

MySQL, MariaDB, PostgreSQL, SQLite, MongoDB, etc.

#

and they all have separate drivers

#

this is why dependency loaders are fucking beautiful

young knoll
#

The first 4 are all very similar

#

Mongo is different

ivory sleet
#

Well SQLite is local isnโ€™t it

lavish hemlock
#

ye it's flat-file

young knoll
#

Yes

#

But format wise they are similar

ivory sleet
#

Indeed

young knoll
#

I think spigot already has the drivers for MySQL and SQLite

lavish hemlock
#

really?

young knoll
#

Mhm

quaint mantle
#

For mysql yes, but extremely outdated

elfin talon
#

How can I put a skull to a player skull. When the player is offline.

acoustic pendant
#

How can i spawn a specific number of entities?

#

ArmorStand circle = (ArmorStand) player.getWorld().spawnEntity(new Location(player.getWorld(), 100, 100, 100), EntityType.ARMOR_STAND);

#

i spawn here an entity

#

but how can i spawn more?

eternal night
#

for(int i = 0; i < amount; i++)

acoustic pendant
#

oh

eternal night
#

I mean, there is no inbuild method for it if that is what you are asking

acoustic pendant
#

ye ye

#

ty

tardy delta
#

does anyone knows how a daily reward system works?
like you join the server back after 24 hours and you get a message that says you can claim a reward

#

maybe with a runnable?

tall dragon
#

if you want a daily reward you could just check the date

#

if not , just save when they claimed

#

and check if its been 24 hours @tardy delta

tardy delta
#

like comparing to System.currenTimeMillis()?

tall dragon
#

for example yes

tardy delta
#

or is there a better way?

tall dragon
#

not really

#

its better than using runnables

tardy delta
#

so i would only check that on join?

tall dragon
#

whenever the player is trying to claim the reward

#

if thats on join, then yea

tardy delta
#

ah because i was thinking of sending them a message when they could claim it

#

in that case i guess i would need a runnable

tall dragon
#

well yea, but in that case it would be pretty easy

#

just have an async runnable thats runs like once a minute

tardy delta
#

oki

#

sounds good

quaint mantle
#

Async performance optimization multithreading ๐Ÿ˜ก

tardy delta
#

heh

#

wdym?

quaint mantle
#

i mean, no reasons to do this task async. That'd probably lead to the problems with concurrency. Async doesnt means that its always better

tall dragon
#

Please enlighten me how this will lead to problems with concurrency

#

All it does is check a timer and send a message

mortal hare
#

so im reverse engineering NMS for a little bit

#

and i need to convert NMS ChatColor enum to Bukkit's chat color enum

#

is there any built in methods to do that?

#

nvm

#

found it

#

CraftChatMessage.getColor(#EnumChatFormat)

rough jay
#

How can I handle permissions with my plugin?
What does Each permission can have multiple attributes. mean? What are the attributes?

mellow citrus
#

hi,i have a problem, i have a friend that created a server with spiggot,and when i try to connect,it spawns me in void,and after a minute or something like that it automatically kicks me
and he can`t teleport me,or if he kills me from console it happens again,i spawn and fall in void constantly
can someone help me?

glass tangle
azure venture
#

does anyone know if the wither armor effect is client sided?

maiden mountain
#

Hey guys, how can I show a custom message at the bottom of the screen? (Like when you seat a boat)

ivory sleet
#

Are we talking about action bar?

maiden mountain
#

I think yes

#

When you seat a boat, you get this info message above your belt bar

#

And i'm seeing servers showing custom messages there

ivory sleet
#

Hmm I donโ€™t know if thatโ€™s actually action bar but you could achieve something very similar with sending an action bar.

Player#spigot()#sendMessage(ChatMessageType.ACTION_BAR,component); might be what youโ€™re looking for then

solar sable
#

non topic related but why do you guys do # instead of . sometimes

solar sable
ivory sleet
#

A way to show what method we mean

#

Similar to javadoc Ig

solar sable
#

ouh

#

oh ok then

ivory sleet
#

Though I usually go with method references

#

But yeah (:

solar sable
#

also how to make a player sit down

rough jay
ivory sleet
#

Define good

solar sable
#

im tryna make like a chair plugin for my own and i only figured out on the right click detection but i havent know on how to make the player sit down

rough jay
ivory sleet
#

You need to make the player ride an invisible entity

ivory sleet
rough jay
#

Because I'm trying to setup "roles" and if someone has a "role" then it can have specific permissions.
First I did the permissions and now I'm trying to see how can I setup the "roles" and their permissions