#help-development

1 messages ยท Page 1674 of 1

sullen dome
#

you can disable blc rp afaik

golden turret
gleaming jasper
#

Still didn't work. And i've gotten about 30 erros.

#

@quaint mantle

sullen dome
#

people hate pinging them

gleaming jasper
#

I don't

#

also how else is he going to see this messasge?

sullen dome
#

if he wants to see it maybe?

gleaming jasper
#

it's after a coversation we had

sullen dome
#

imagine i'd ping an admin everytime i want help from them

gleaming jasper
#

do you scroll up every single channel soo see if somebody sent something to you after getting on dc?

sullen dome
#

sometimes

gleaming jasper
#

well

#

im in about 20 servers

#

probs at least 100 channel

#

s

#

cant say I have the time for that and I woudn't think any body else does eather

sullen dome
#

i'm on like 50 servers
active on maybe 3

crude charm
#

Send code

lavish hemlock
#

Listen, pinging someone is dependent on that person's mood and whether or not they want to be pinged. You can't just plainly say "Everyone hates pings" because sometimes I don't :p

#

why's that second one end in .kotlin? it's not Kotlin

#

I'mma just blame Hastebin for that

atomic gyro
#

Is there a means of calling a loot table in a plugin?

quaint mantle
#

just change it

worldly ice
#

when you spawn an entity in your event handler it runs the listener again

#

that's why you're getting an overflow error

#

i'm not sure, but what i did is check the spawn reason in your listener

#

you can test if a plugin spawned it, or commands, natural spawning, etc.

#

yep

lavish hemlock
#

fun

young knoll
#

Just toggle a boolean before and after you actually spawn it

astral imp
#

if a library doesn't provide a (maven) repo but provides the dependency, what do I do?

unreal quartz
#

install

astral imp
#

wdym?

unreal quartz
#

if its a maven project you can just run mvn install and it will add it to you rlocal repository

astral imp
#

oh, idk what the heck i was doing. it resolved the dependency

#

just need to shade it in

rugged topaz
#

has anyone ever pulled off a per player message logger in mysql? or is some other database that isn't strictly tables and columns like mongodb required, without of course encoding/decoding base64 to hold data types not viable in mysql, seems that my database choice has been a downfall and a waste of time due to my endeavor

crude charm
#

but I'd probs say redis

inland scaffold
#

how would I send a message to a player that has multiple lines from the config

#

like say

#
//Config.yml
sendmsg:
  1: ''
  2: ''
  3: ''
  //etc in number order or whatever

unreal quartz
#
key: |
 this
 is
 a
 multiline
 message!
#

no need for string list shenanigans

quaint mantle
#

hes right

inland scaffold
unreal quartz
#

sendMessage( getString(key) )

inland scaffold
#

and then have a public void above that for the getconfig stuff

unreal quartz
#

uh

#

sure

inland scaffold
#

I also saw this somewhere

for (String line : getConfig().getStringList("helptext")) {
  player.sendMessage(line);
}
#

would that work?

unreal quartz
#

if you decide to define it as a list, then yes

atomic gyro
#

Hey there guys, how can I prevent a player from clicking inside an inventory that gets opened? I want them to be able to hover over items but not take them out or interact with them.

quaint mantle
#

?eventapi

undone axleBOT
quaint mantle
#

event.setCancelled(true)

#

InventoryClickEvent

inland scaffold
#
//Config

//When a player has no permission show this message.
nopermissionmessage: |
    &4&lALERT!
    &c&lYou do not have permission to send:
    
#

could I do this?

quaint mantle
#

try it

inland scaffold
#

ok

astral imp
#

Someone mentioned guard clauses, but, these if statements are building on each other and not returning values based on anything else until the very end

#

So I'm not quite sure how to implement guard clauses in this situation

quaint mantle
#

Jesus christ

quaint mantle
#
# Config

# When a player has no permission show this message.
nopermissionmessage: |-
    &4&lALERT!
    &c&lYou do not have permission to send
paper viper
#

learn to use return statements or combine the conditionals

astral imp
#

gotten that twice in 5 minutes.. so funny..

paper viper
#

lmao

#

theres a reason why we send that

astral imp
#

Because I was looking for recommendations. As said, someone mentioned guard clauses, which I'm interested in implementing. However I'm asking how, due to the if statements building on each other and not return one after another.

But thanks for your input.

paper viper
#

guard clauses are only ideal for use cases that are extremely common. In fact, they are like utility methods

#

you should not use them if you are only going to use them once for one particular thing

inland scaffold
#
this.getConfig().options().copyDefaults();
saveDefaultConfig();
private String noperms = "";

for the private string noperms, how would I get it from the config

nopermissionmessage: |-
    &4&lALERT!
    &c&lYou do not have permission to send
paper viper
#

as that defeats the purpose of creating the clause the first place

atomic gyro
#

Is there a method to check if an inventory is open or not, or will I just have to make a variable?

inland scaffold
#

@unreal quartz or @quaint mantle

#

it wouldnt be a string tho because its multi lined right?

#
//stuff
this.getConfig().options().copyDefaults();
saveDefaultConfig();
private String noperms = this.getConfig().getString("nopermissionmessage");

would this work if its multiple lines??

# Config

# When a player has no permission show this message.
nopermissionmessage: |-
    &4&lALERT!
    &c&lYou do not have permission to send
#

hello?

median anvil
#

what would I use for a persistentdatatype if I want a boolean?

inland scaffold
#

when I do my /cmd

#

and I deopd myself

#

player.sendMessage(noperms);

#

so I should get this

#

hello?

#

anyone on?

crude charm
#

m8

#

chill

#

lmfao

#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Create a thread in case the help channel you are using is already in use!

crude charm
undone axleBOT
crude charm
#

send code

inland scaffold
crude charm
#

why are you extending JavaPlugin in your Command class...?

inland scaffold
#

send this to the player

# Config

# When a player has no permission show this message.
nopermissionmessage: |-
    &4&lALERT!
    &c&lYou do not have permission to send
#

because I need to ready the config

crude charm
inland scaffold
#

OOh

#

and then I use a public void

median anvil
#

I can't believe persistentdatatype doesnt contain boolean as native...

inland scaffold
#

right Zoi?

crude charm
#

and void means no type

inland scaffold
#

package com.nik.warcentercmd;

import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin {
    
    @Override
    public void onEnable() {
        System.out.println("War Center Commands by Nikplayz has Loaded!");
        
        this.getConfig().options().copyDefaults();
        saveDefaultConfig();
        System.out.println("War Center Commands Config Locked and Loaded!");
        //Commands
        getCommand("discord").setExecutor(new DiscordCommand());
    }
        
}

this is my main class

crude charm
#

yeah do your config there

#

which you have already done

inland scaffold
#

ok

crude charm
#

and use a constructor to get an instance of main

#

to use the config methods

worldly ice
#

also why is your DiscordCommand class extending JavaPlugin?

crude charm
worldly ice
#

whoops

inland scaffold
crude charm
#

yeah

inland scaffold
#

I put it under the savedefault thing

crude charm
#

but I usually do config messages in an enum

#

its alot easier

inland scaffold
#

what would I do then?

crude charm
#

Messages.NO_PERMISSSION

inland scaffold
#

?

crude charm
#

if you used an enum you would only have to do that instead

#

I thought thats what you asked

inland scaffold
#

ik but walk me through

#

cause I havent learned em yet

crude charm
inland scaffold
#

Public enums?

#

I have a enums.mp4 in my tutorial

quaint mantle
inland scaffold
#

I havent learned yet to do multiple configs

median anvil
#

@quaint mantle I'm trying to use persistentdatacontainers instead of lore like you said to do yesterday, but I am failing to see how it is better because for my soulbound plugin it seems easier just to check if lore contains soulbound, especially sense their isn't a persistentdatatype of boolean where I can set a namespacekey soulbound = true...

worldly ice
#

Can't you just use and int and set it to 1 if it's true and 0 if it's false?

median anvil
#

ew

quaint mantle
#

both work

median anvil
#

okie, ill try, if you insist its better.

inland scaffold
quaint mantle
#

its a library i made

inland scaffold
#

can I just figure out how to use the public string noperms = this.getConfig().getString("nopermissionmessage");
for

# Config

# When a player has no permission show this message.
nopermissionmessage: |-
    &4&lALERT!
    &c&lYou do not have permission to send
quaint mantle
#

dont use .

inland scaffold
#

under getstring?

quaint mantle
#
message:
  nopermissionmessage: |-
    Something
#

then config.getString("message.nopermissionmessage")

inland scaffold
#

ok ty

#

๐Ÿ˜„

worldly ice
#

string should be capitalized

#

config is JavaPlugin.getConfig()

inland scaffold
#

that fixed string

worldly ice
#

so just use an instance of your main class

inland scaffold
#

still Highlighted

quaint mantle
#

?learnjava before trying to make plugins

undone axleBOT
inland scaffold
#

I did

#

but just not that

quaint mantle
#

obviously not

#

you dont know the String type

#

@median anvil go ahead

median anvil
#

my intelij is saying 1 and 0 are ints not bytes ๐Ÿ˜ฆ

inland scaffold
#

Pls this is one thing I want to do for my test server

median anvil
#

byte is 1-16 right?

worldly ice
#

pretty sure you have to cast to byte

quaint mantle
inland scaffold
#

what should I do

median anvil
#

okie i just used (byte) 0

quaint mantle
#

fair enough

inland scaffold
#

Illegal modifier for parameter noperms; only final is permitted

#

on public String noperms = this.getConfig().getString("message.nopermissionmessage");

worldly ice
#

are you putting that inside of a method

quaint mantle
#

Bruh

worldly ice
#

^

#

at least read the error and fix it based on that

inland scaffold
#

Oh

median anvil
#

@quaint mantle persistentdata is amazing thank you so much. ๐Ÿฅฒ

#

idk why I never knew about nbt...

astral imp
#

anyone familiar with ternary operators

#

getting variable expected error on mine

#
this.message = config.contains(path) ? config.getString(path) : this.message = "";
inland scaffold
#
[20:36:47 ERROR]: Cannot load configuration from stream
org.bukkit.configuration.InvalidConfigurationException: while scanning an anchor
 in 'string', line 5, column 5:
      - &4&lALERT!
        ^
expected alphabetic or numeric character, but found &(38)
 in 'string', line 5, column 7:
      - &4&lALERT!
          ^

i did

nopermissionmessage:
  - &4&lALERT!
  - &c&lYou do not have permission to send

then

public class DiscordCommand extends JavaPlugin implements CommandExecutor  {
    //DiscordCommand
    
    
    
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        
        Player player = (Player) sender;
        
        //Methods
        
        if (cmd.getName().equals("discord")) {
            if (player.hasPermission("warcentercmd.discord")) {
                for (String line : getConfig().getStringList("nopermissionmessage")) {
                      player.sendMessage(line);
                    }
            } else {
                for (String line : getConfig().getStringList("nopermissionmessage")) {
                      player.sendMessage(line);
                    }
            }
        }
        

        return false;
    }

}

astral imp
#

surround it in apostrophes or quotations?

inland scaffold
#

ok

worldly ice
astral imp
#

Oh jesus christ

#

im fucking stupid

#

thank you

inland scaffold
#
# Config

# When a player has no permission show this message.
nopermissionmessage:
  - "&4&lALERT!"
  - "&c&lYou do not have permission to send"
astral imp
#

you register the command in your onEnable? id switch .equals to .equalsIgnoreCase

inland scaffold
#

package com.nik.warcentercmd;

import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin {
    
    @Override
    public void onEnable() {
        System.out.println("War Center Commands by Nikplayz has Loaded!");
        
        this.getConfig().options().copyDefaults();
        saveDefaultConfig();
        System.out.println("War Center Commands Config Locked and Loaded!");
        //Methods
        
        //Commands
        getCommand("discord").setExecutor(new DiscordCommand());
    }
        
}
#

thats my main class

astral imp
#

and its also in your plugin.yml right

inland scaffold
#
main: com.nik.warcentercmd.Main
name: WarCenterCMD
version: 1.0
author: Nikplayz
commands:
  discord:

yep

astral imp
#

is your configuration actually populated on the test server

inland scaffold
#

?

astral imp
#

go to /Plugins/DiscordPlugin/

#

is there a config.yml there with that inside of it

inland scaffold
#
# Config

# When a player has no permission show this message.
nopermissionmessage:
  - "&4&lALERT!"
  - "&c&lYou do not have permission to send"

#

thats whats there

astral imp
#

hmm

hasty prawn
#

Add print statements, try to debug where the code is failing.

inland scaffold
#

also

#

[20:40:37 ERROR]: Error occurred while enabling WarCenterCMD v1.0 (Is it up to date?)
java.lang.IllegalArgumentException: Plugin already initialized!
at org.bukkit.plugin.java.PluginClassLoader.initialize(PluginClassLoader.java:183) ~[spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]

#

this is in console

hasty prawn
#

DiscordCommand shouldn't extend JavaPlugin

#

Unless it's your main class.

inland scaffold
#

oh

#

but how am I gonna get config

astral imp
#

just implement commandexecutor

#

and you'll need a reference to the main class

inland scaffold
#

a public statement?

#

public String noperms {
for (String line : getConfig().getStringList("nopermissionmessage")) {
}

#

that errors

#

what should I do

inland scaffold
inland scaffold
#

ooh

#

it goes above on enable??

#

I do this then
public OtherClass other;

public void onEnable() {
other = new OtherClass(this);
}

#

@hasty prawn ok now I have this


package com.nik.warcentercmd;

import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin {
    public NoPerms noperms;
    
    
    @Override
    public void onEnable() {
        System.out.println("War Center Commands by Nikplayz has Loaded!");
        
        this.getConfig().options().copyDefaults();
        saveDefaultConfig();
        System.out.println("War Center Commands Config Locked and Loaded!");
        //Methods
        noperms = new NoPerms();
        
        //Commands
        getCommand("discord").setExecutor(new DiscordCommand());
    }
        
}

and a newly created class

fast niche
inland scaffold
#

eclipse

fast niche
#

ohk

inland scaffold
#

to do /discord

hasty prawn
#

You can pass this into the constructor for the NoPerms class now, and then use that instance to get the Configuration.

inland scaffold
#

and a multilined message that is configurable gets sent to the player

fast niche
#

oooooo

hasty prawn
#

Wait, what is NoPerms...?

inland scaffold
#

just using the thing

#

if you dont have perms

#

for the cmd

#

or there will be one more that you will have perms

fast niche
#

can we set perms from luckperms?

inland scaffold
#

ok

#

wait

#

just forget about no perms, how would I just have it if the player has perms a multilined message gets sent to them

#

I already have the command

hasty prawn
#

You should probably just go with Method 2 from that link Nikplayz, it's generally the best way. (I know all the people in the thread say 3 is the best, it isn't.)

fast niche
#

hey nik if you dont mind can you send me the jar file of the /discord command? plzzz

inland scaffold
#

sure

fast niche
inland scaffold
#

there

#

@hasty prawn

hasty prawn
#

?

inland scaffold
#
package com.nik.warcentercmd;

import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;



public class DiscordCommand  implements CommandExecutor  {
    //DiscordCommand
    
    
    
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        
        Player player = (Player) sender;
        
        //Methods
        
        if (cmd.getName().equals("discord")) {
            if (player.hasPermission("warcentercmd.discord")) {
                
            } else {
                
            }
        }
        

        return false;
    }

}


#

how would I use method 2 on this

hasty prawn
#

In your main class you need to create a private static final Main instance variable, and then onEnable(), set that to this. Then have a public static getter.

#

Then you can use that getter to access your plugin instance from another class, such as the DiscordCommand one.

inland scaffold
#

package com.nik.warcentercmd;

import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin {
    
    private static Main instance;
    
    
    @Override
    public void onEnable() {
        System.out.println("War Center Commands by Nikplayz has Loaded!");
        
        this.getConfig().options().copyDefaults();
        saveDefaultConfig();
        System.out.println("War Center Commands Config Locked and Loaded!");
        //Methods
        
        
        //Commands
        getCommand("discord").setExecutor(new DiscordCommand());
        instance = this;
    }
    public static Main getInstance() {
        return instance;
    }
}

I have this now

#

Im guesing I can now use Main()

hasty prawn
#

instance = this; should be the first line in the onEnable

#

You can use Main.getInstance()

#

?learnjava

undone axleBOT
hasty prawn
#

Recommend reading these too PeepoHappy

inland scaffold
#

I will

#

but rn I just wanna finish this one cmd

#

Dessie

#

in main, where do I get the config just for the message

exotic obsidian
#

hello guys

#

Im trying to make Particle trails

#

and i want to store the Particle in my database

#

anyone can help me plz?

waxen plinth
#

You're trying to store what?

exotic obsidian
#

the Particle of player

#

because if i do restart or reload

#

the Particle of this player will be remove

waxen plinth
#

What do you mean by "The particle of player"

#

What particle effect they have enabled/equipped?

exotic obsidian
#

i don't have experience with database

#

so

#

but im trying to learn it

#

anyone can help me?

waxen plinth
#

The fact that you're following a tutorial for a specific plugin isn't exactly encouraging

#

But if you're looking to learn about databases, then maybe start by looking up some sql tutorials

silent galleon
#

So, I've been trying to make Custom Enchantments (like the extra ones that are given with higher levels provided in an enchantment table), but haven't been able to find anything that can help. I'm pretty new to Minecraft Plugin Development (and Java as a whole), so I'd appreciate if you could redirect me to some resources I could use for this. Thank you!

proud basin
#

So apparently the class doesn't exist but it does so I'm a bit confused here is where the class is being called```java
@Inject(method = "startGame", at = @At("RETURN"))
public void startGame(CallbackInfo callbackInfo) {
CowRunner.getInstance().init();
}

chrome beacon
proud basin
#

and if you really want the error here ```java
java.lang.NoClassDefFoundError: me/toy/runnitback/CowRunner
at net.minecraft.client.Minecraft.handler$startGame$zza000(Minecraft.java:3354)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:561)
at net.minecraft.client.Minecraft.run(Minecraft.java:362)
at net.minecraft.client.main.Main.main(Main.java:113)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
at GradleStart.main(GradleStart.java:26)

chrome beacon
chrome beacon
proud basin
#

it is

silent galleon
#

I can understand that, but the reason I want to do it is to learn (even though I should probably focus more on other things). I'd like to have the know-how to create my own Enchantments Plugin, on the event that I need it in the future.

chrome beacon
silent galleon
#

I figured that was the case, but it's still something I want to do.

proud basin
chrome beacon
proud basin
#

ima try to call another class

chrome beacon
#

So what are you working with? Forge or Fabric

proud basin
#

Forge

#

pure Mixin

#

hm didn't work

chrome beacon
#

Mixins should be avoided when possible

proud basin
#

How come

chrome beacon
#

They can break compatability with other mods

proud basin
#

It's not a forge mod I'm making

#

I'm just making my little own client thing

chrome beacon
#

Ah

proud basin
#

yea

#

and I'm not gonna use mcp

chrome beacon
#

MCP should be avoided

proud basin
#

mhm

#

that's why im using mixin

chrome beacon
#

Aight

proud basin
#

So I tested it with another class and same error

chrome beacon
#

Yeah you would have to send the project or jar

proud basin
#

ok

#

give me a sec to put it on github

#

Do you mind letting me know what your github name is?

chrome beacon
#

Click on it to see

proud basin
#

I sent you something

chrome beacon
#

Yeah now what class is causing the issue

proud basin
#

Nitrous

#

if you go into mixins then MixinMinecraft

#

you can see where I call it

crude charm
#

I have a question

#

Do "marker" blocks cause lag?

#

like 100000 Armour stands will cause lag

#

what about markers

chrome beacon
#

So it refuses to mixin it

#

Change the package to the folder where you want mixins in the mixins json

#

Also please follow naming conventions .-.

proud basin
#

shhh

lean gull
#

can someone help? i deleted the folder with the config files and now i'm getting this error in startup:

[08:39:28 ERROR]: Error occurred while enabling Gamerules v1.0 (Is it up to date?)
java.lang.NullPointerException: Cannot invoke "org.bukkit.configuration.file.FileConfiguration.set(String, Object)" because the return value of "ConfigManager.getMaterialsConfig()" is null
        at ConfigManager.<init>(ConfigManager.java:35) ~[Gamerules.jar:?]
        at Main.loadConfigManager(Main.java:20) ~[Gamerules.jar:?]
        at Main.onEnable(Main.java:14) ~[Gamerules.jar:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[patched_1.17.1.jar:git-Paper-224]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[patched_1.17.1.jar:git-Paper-224]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500) ~[patched_1.17.1.jar:git-Paper-224]
        at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugin(CraftServer.java:535) ~[patched_1.17.1.jar:git-Paper-224]
        at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugins(CraftServer.java:449) ~[patched_1.17.1.jar:git-Paper-224]
        at net.minecraft.server.MinecraftServer.loadWorld(MinecraftServer.java:654) ~[patched_1.17.1.jar:git-Paper-224]
        at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:306) ~[patched_1.17.1.jar:git-Paper-224]
        at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1141) ~[patched_1.17.1.jar:git-Paper-224]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:318) ~[patched_1.17.1.jar:git-Paper-224]```
the code: https://paste.md-5.net/juyimufeye.cpp

it makes the materials.config file and sends the message that it created it, but it then sends this error and doesn't create the preset file
waxen plinth
lean gull
#

it says it's null

waxen plinth
#

And also dear god are you using the default package

lean gull
#

i already know that, i just don't know how to fix it

lean gull
#

i was told the com.whatever is unnessecary

waxen plinth
#

I am appalled

#

It's not unnecessary

#

It's how you avoid namespace collision and it's how you know what is providing what

#

Use a goddamn package

lean gull
#

alr sheesh

waxen plinth
#

And if something is null

#

Trace it back to its source

#

Look at where ConfigManager.getMaterialsConfig() gets its return value

proud basin
waxen plinth
#

And try to figure out why it is null

chrome beacon
#

Instead of root package

ivory sleet
#

?paste

undone axleBOT
lean gull
#

didn't i send a message here

ivory sleet
#

You should paste the error and send that link

lean gull
#

it's a 10 line error wdym

ivory sleet
#

I meant what I said

lean gull
#

are you mad because you failed to steal my plugin

ivory sleet
#

?

lean gull
#

you are aren't ya

ivory sleet
#

You have to stop being so paranoid and accuse everyone all the time.

hybrid spoke
narrow furnace
#

the guys a schizophrenic

lean gull
#

bro you literally asked for my whole plugin when the problem was in one class

#

the error was about that one class

narrow furnace
#

do u know what github is

lean gull
#

do you know what being nice is

narrow furnace
#

its a place where people get their code stolen VOLUNATARILY

ivory sleet
#

Yes but itโ€™s generally harder to figure out errors if weโ€™re not given the entire picture

narrow furnace
lean gull
narrow furnace
#

has your code ever worked

lean gull
narrow furnace
#

why would i want to u use it if its so full of simple to fix bugs

#

why would i want to use it if its so full of simple to fix bugs

lean gull
#

i didn't say you do, i said conclure does

ivory sleet
hybrid spoke
lean gull
#

i gave you two classes

ivory sleet
#

Yes but you updated them, refactored something

lean gull
lean gull
hybrid spoke
lean gull
#

idk how 2

#

the sequal

ivory sleet
#

Anyways please behave appropriately, it is not nice to simply go around and accuse people here and there. For the record youโ€™re being really ungrateful, wouldnโ€™t be too bad with some appreciation.

lean gull
#

im the one being not nice l m a o

lean gull
hybrid spoke
#

try to use the Files class to create it

lean gull
#

i swear to god if you delete that message-

#

but it does create it

narrow furnace
#

what are you even trying to make

lean gull
hybrid spoke
#

does your datafolder exist? @lean gull

lean gull
#

wat dat

#

is it the folder that has all the config files?

hybrid spoke
#

the one you are creating in your first constr. line

lean gull
#

idk what u mean

#

if it's the folder that has all the config files then yes i have it

#

btw if i delete the folder then start it creates the materials.yml file with an error, then if i stop and start it creates the preset.yml file with an error, then if i stop and start it doesn't send an error and saves and loads the files

#

but it still doesn't set anything inside the folders

hybrid spoke
#

send the error

lean gull
#

which

hybrid spoke
#

the ones coming up

lean gull
hybrid spoke
#

ok well now your FileConfigurations are null. that would also explain why its not loading anything

lean gull
#

wat dat mean

rocky glacier
hybrid spoke
#

materials and preset is null until your last 2 lines

#

but you use it before

lean gull
#

these?

        materials = YamlConfiguration.loadConfiguration(materialsFile);

        preset = YamlConfiguration.loadConfiguration(presetFile);```
hybrid spoke
#

yeah

lean gull
#

ok, where do i put them

hybrid spoke
#

they're null until the end of the constructor but you are using them already before

#

right after your file instantiations

lean gull
hybrid spoke
#

presetFile = new File...
preset = YamlConfg..
if(!presetFile.exist)

#

and also dont forget to save the config back to the file

#

otherwise your changes made will just be local

#

in an object thrown right away

lean gull
#

am confusion

hybrid spoke
#

you refer your variables materials and preset at the end of the constructor to the respective FileConfiguration. until they're refered, they're null. you are using them before refering them. so you literally use null. you have to instantiate it before you use it to set your config values. that will fix the incoming NPE.

next step: saving the config back to the file.

currently you set the values into the config but not the config back to the file. so you change the variables local but never persist them.

lean gull
#

alr 1 sec

#

wait i forgot to delete the folder

hybrid spoke
lean gull
#

it doesn't create materials.yml anymore

hybrid spoke
#

send your updated code

lean gull
#

i didn't change anything in the code

hybrid spoke
#

yeah well so no wonder then

lean gull
#

no i mean like i didn't change anything now

#

when i deleted the folder

hybrid spoke
#

so do your changes

lean gull
#

i did however move the stuff you told me to before if(!materialsFile.exists())

burnt current
#

Hey quick question: I'm trying to connect my plugin to a database and I'm following this tutorial: https://www.spigotmc.org/wiki/connecting-to-databases-mysql/

It says in one part that you should call the following method in your onEnable() method of the Main class and the returned data source should be cached in a private DataSource dataSource field. :

private DataSource initMySQLDataSource() throws SQLException {
        MysqlDataSource dataSource = new MysqlConnectionPoolDataSource();

            File file = new File("my File Path");
            YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(file);
                dataSource.setServerName(yamlConfiguration.getString("host"));
                dataSource.setPortNumber(yamlConfiguration.getInt("port"));
                dataSource.setDatabaseName(yamlConfiguration.getString("database"));
                dataSource.setUser(yamlConfiguration.getString("user"));
                dataSource.setPassword(yamlConfiguration.getString("password"));

                testDataSource(dataSource);
                return dataSource;```
However, I cannot call this method in my OnEnable method. My guess now would be that it doesn't work because my methods are private. That's why I'm confused, because in the tutorial private methods were also used. can anyone help me there?
Then I wanted to ask what exactly is meant by caching the returned DataSource in a `private DataSource dataSource` field. Does it mean that I should store it in a variable?
median anvil
#

can you check if there is an item/items with a specific pdc/nbt in players inventory and grab that item/items

#

making rainbow armor and want to be able to stop the task if player no longer has armor with rainbow nbt.

#

please pm or reply your answers cause I'm going to sleep now. thank you!

crimson terrace
north niche
#

hey I need to store custom nbt tags for itemstacks
so i used the PersistentData to store custom values!

PersistentDataContainer data = itemMeta.getPersistentDataContainer();
data.set(new NamespacedKey(this,"CustomModelData"), PersistentDataType.BYTE, (byte)1);
item.setMeta(itemMeta);

i used this code to set a custom nbt named "CustomModelData"! and it showed like this

Itemstack data
tag:{PublicBukkitValues:{"PLUGIN_NAME:custommodeldata":1b}}

but i need like this

Itemstack data
tag:{CustomModelData:1b}
ivory sleet
#

yes

#

PDC is not for the custom model data

#

ItemMeta would be the way to go here

north niche
north niche
#

and what if i need to set some tags like something:1b

chrome beacon
#

NMS

north niche
chrome beacon
#

If you don't want pdc

#

PDC or NMS choose one

north niche
north niche
# chrome beacon If you don't want pdc

it shows like this when using the pdc for itemstack

tags:{ PublicBukkitValues:{"OUR_PLUGIN_NAME_HERE:something":1b} }

but i need like this

tags:{ something:1b }
sullen dome
#

are the player's datacontainer's entries the same on all worlds?

vagrant stratus
#

Channels a mess like always?
We have threads enabled, use them ๐Ÿ˜‚

vivid cave
#

is it possible to create bossbar with a custom hex color?

sullen dome
#

i have like no fricking way how those threads work

vivid cave
#

in the docs it seems to indicate it has to be an enum constant

#

just making sure

vagrant stratus
sullen dome
#

why tf does this channel still exist then?

vagrant stratus
#

helps keep threads in one place, also because people don't even use threads lol

sullen dome
#

yeah because threads feel like whatsapp groups where you put in 20 people, and no one will ever answer you

vagrant stratus
#

you get that anyways because the channels a mess as soon as more than one person asks for help lol

sullen dome
#

so... for everything we should use threads now?

vagrant stratus
#

If you need to ask a question that's going to take a while to answer, yes. Whether or not threads will be enabled for the entire server, who knows

sullen dome
#

lol

vagrant stratus
#

and that doesn't have to be a thread lol

sullen dome
#

then why do you tell me to

vagrant stratus
#

Just a general thing so they get used ๐Ÿคฃ

sullen dome
#

i see

vagrant stratus
#

People were like "Gib threads" now we have them and they don't get used ๐Ÿ˜‚

sullen dome
#

i thought you were like hey, OpEn A TiCkEt FoR ThIs YeS/No QuEsTiOn

#

because people dont know they even exist

#

discord never informed me

#

idk if thats a me thing

vagrant stratus
#

at max it's two messages ๐Ÿคฃ

sullen dome
#

yea

#

3

#

bc i like to say thank you at the end

vagrant stratus
#

if it's like bug fixes or something, then a thread is more appropriate ๐Ÿ˜‚

sullen dome
#

makes more sense

vagrant stratus
#

Yee

sullen dome
#

btw

#

if people really use them in future

#

enjoy deleting those threads

or no one will ever be able to answer them

vagrant stratus
#

Why's that?

sullen dome
#

like

#

now it has just 1 thread... thats nothing

#

but imagine there would be like 50

#

they get saved for 3 days

vagrant stratus
#

well, we'll figure something out lol

sullen dome
#

aka, you never thought of that? xd

vagrant stratus
#

more along the lines of I'd be surprised if that'll ever happen ๐Ÿ˜‚

sullen dome
#

if what happens? 50 threads existing? lol

vagrant stratus
#

people actually using threads enough for it become an issue ๐Ÿ˜‚

sullen dome
#

how many questions does this channel get a day?

vagrant stratus
#

hard to tell tbh

sullen dome
#

that can get a huge pain

north niche
sullen dome
#

without some auto-remove

vagrant stratus
#

so basically what you get anyways when more than one person needs help anyways? ๐Ÿคฃ

sullen dome
#

especially if they don't know that

#

?paste

undone axleBOT
sullen dome
#

exists

vagrant stratus
# sullen dome can't disagree tbh

ofc not because it's true.
In this case no solution fixes the issue permanently, but threads at least make it a little better ๐Ÿ˜›

sullen dome
#

threads kinda just clears the chat more

questions won't get proper answered if they're not high-prio in the list

#

bc no one scrolls that damn list up lol

vagrant stratus
#

i think it says in chat if a thread was created? Could be wrong

sullen dome
#

can i delete my created threads?

vagrant stratus
#

๐Ÿคทโ€โ™‚๏ธ

sullen dome
#

let's hope

#

does

#

that's fair

#

but can't delete it tho... that would help at least a bit if people could remove their own threads if their question got answered

vagrant stratus
#

Deletion would mean people can't look through the threads to see if their question got answered already though ๐Ÿ™‚

#

just like the forum

sullen dome
#

do people do that?

vagrant stratus
#

some blank it out lol

sullen dome
#

i never did that tbh

#

maybe thats why all people hate me :3

vagrant stratus
#

iirc blanking out a thread is against the rules too

eternal night
#

the answer to the pdc would be yes btw xD idk if anyone answered

sullen dome
#

no no one did
thanks :)

#

they kinda just started yelling about those threads xd

#

optic, i feel like you have a good wallpaper for me?
i need one

vagrant stratus
sullen dome
#

sad

vagrant stratus
#

the wallpaper i have is of a vtuber though ๐Ÿคฃ

sullen dome
#

mine is just.... well

vagrant stratus
#

mine lol

sullen dome
#

well

#

better than mine

vagrant stratus
#

:3

sullen dome
#

send me that lol
why not

vagrant stratus
#

fuck i don't have the original image ๐Ÿ˜‚

sullen dome
#

lol

#

doesn't your wp reset if you delete the file?

vagrant stratus
#

I don't know where the file is stored then ๐Ÿคฃ

sullen dome
#

lol

#

your pc that big?

vagrant stratus
#

1080

sullen dome
#

ty

vagrant stratus
#

in the comments there's 1080, 1440, and 4k ones

sullen dome
#

oh god

#

i dont wanna know where i land if i follow that link

#

in which universe

vagrant stratus
#

lol

#

also, it's no longer dev related so #general would be better lol

sullen dome
#

why do i feel like i know what that "disclaimer" says

vagrant stratus
#

actually, it's a nice disclaimer.
basically a thank you and stating it's personal and non-commercial use only

old cloud
#

What is org.bukkit.block.data.BlockData handling?

burnt current
#

Hey quick question: I'm trying to connect my plugin to a database and I'm following this tutorial: https://www.spigotmc.org/wiki/connecting-to-databases-mysql/

It says in one part that you should call the following method in your onEnable() method of the Main class and the returned data source should be cached in a private DataSource dataSource field. :

private DataSource initMySQLDataSource() throws SQLException {
        MysqlDataSource dataSource = new MysqlConnectionPoolDataSource();

            File file = new File("my File Path");
            YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(file);
                dataSource.setServerName(yamlConfiguration.getString("host"));
                dataSource.setPortNumber(yamlConfiguration.getInt("port"));
                dataSource.setDatabaseName(yamlConfiguration.getString("database"));
                dataSource.setUser(yamlConfiguration.getString("user"));
                dataSource.setPassword(yamlConfiguration.getString("password"));

                testDataSource(dataSource);
                return dataSource;```
However, I cannot call this method in my OnEnable method. My guess now would be that it doesn't work because my methods are private. That's why I'm confused, because in the tutorial private methods were also used. can anyone help me there?
Then I wanted to ask what exactly is meant by caching the returned DataSource in a `private DataSource dataSource` field. Does it mean that I should store it in a variable?
ivory sleet
#

Yes the forge docs

#

And sources of other mods

#

Also just reading mojmapped code will get you far enough

trail flume
#

Hiya, I'm working with PacketPlayOutWorldParticles in version 1.8.8/1.8.9 and it seems to me that instead of Red Green Blue the colour variables are Red Yellow Purple. Any ideas?

ivory sleet
#

No

#

It encourages the use of IntelliJ lol

#

Thatโ€™s bullshit

#

Itโ€™s almost safe to say it support IntelliJ just as good if not better

#

It should be something like, Forge initially aimed to support Eclipse IDE, however the support for IntelliJ is a working pleasure. Or something

hybrid spoke
#

how can it only support eclipse if ive used it in notepad

ivory sleet
trail flume
#

ok

#

PacketPlayOutWorldParticles Not working as expected

plain scroll
#

how would i make a command that opens a book where people can write in? and then get the thing they wrote as a variable?

#

is there an API i can use??

hybrid spoke
#

so you would have to go with packets

dry spruce
#

How to re-code/Upgrade an 1.13 to 1.17 Plugin

hybrid spoke
#

well well well. no. dont do something someone else already did and specialised on. i mean if its bad, yeah, dont use it. but if its not, you are just doubling your work and probably make it even worse than the api author did

#

well. so recode the java api

#

api is api

#

we can also not exaggerate and you can start redoing spigot

#

if you are doing it in a team you wont learn everything

#

what i am saying is: dont redo something yourself someone else already did better

#

a fucking ton of C

#

its literally not

#

you should not redo something someone else already did. that leads to nothing and is very time consuming. if you want to learn it, you can ** try** to redo that or look at the implementation of the already done work.

#

why do you want to reinvent the wheel

#

okay. here a better one: if you want to make a shop plugin, would you create your own economy system, or use the already optimized vault one EVERYONE is using so your plugin is compatible with nearly every server?

#

i mean you could gain some experience by making your custom economy system. but what does it bring you

#

nothing than extra work

ivory sleet
#

What am I reading

#

You donโ€™t say

thin venture
#

So i want to store the user or uuid of player who placed down chest ( I am a beginner to this )

regal dew
#

BlockPlaceEvent#getPlayer

quaint comet
#

Hi, I have question about posting my first plugin.

I made plugin called OpAll and it is made for situation when someone beg for free premium plugin in chat. You will send him this plugin and when someone join the server and the plugin is on, the person will get op.

With this plugin my goal is to force people to follow spigot rules.

Last message : Can I post this plugin on the Spigot, because I dont want to break rules and get banned.

hybrid spoke
quaint comet
#

Ok, I will respect it.

old cloud
hybrid spoke
ivory sleet
#

Itโ€™s a malicious concept

hybrid spoke
#

@vagrant stratus

old cloud
#

I mean, it doesn't really make sense but if you want a plugin that gives everyone OP and you as a user of the plugin clearly know what it does, why would it be malware then?

hybrid spoke
#

i mean if the plugin is designed to punish others with forceop, its not allowed

hybrid spoke
#

otherwise you could state it as a permission plugin

quaint comet
#

ok, ill wait for official response

#

from resource staff

sour sand
#

does anyone know how i might go about using custom player heads

ivory sleet
ivory sleet
sour sand
#

ok thanks

quaint comet
ivory sleet
#

Yes the problem isnโ€™t the plugin itself as we concluded, itโ€™s your intentions with it

quaint comet
#

My intentions are to punish people, who doesn't want to pay for premium plugins

ivory sleet
#

Exactly

lean gull
#

how do i get custom item tags off an item

chrome beacon
#

Store the location and use a runnable to place fire

#

What other way did you expect?

gloomy goblet
#

does anyone know how to map a bukkit material to an item

chrome beacon
#

Wdym?

quaint mantle
#

EnumMap<Material, ItemStack>?

gloomy goblet
#

i used some reflection and called the NMS Items.registerItem(MinecraftKey a, Item b) method to inject an item
and some more reflection to add to $VALUES of enum org.bukkit.Material
and even more reflection to set the new material's key to the correct NamespacedKey to match the vanilla item of the material

#

but when i try to give the material to the player, it doesnt give anything

#

and when i try to getType of the new item injected in NMS, it returns AIR

#

so im wondering how to map the material to the item

chrome beacon
#

You really shouldn't be doing that

#

Find a better way to handle your custom items

#

What you want requires you change the Spigot source directly with a patch

gloomy goblet
#

is it possible with paper mixins

#

wait nvm paper mixin only available for 1.12

chrome beacon
#

They had Mixins ๐Ÿ‘€

quaint mantle
#

What the

young knoll
#

Someone made a wrapper that launches the paper jar with mixins

gloomy goblet
#

i also tried looking into magma but its currently bugged and wont allow vanilla clients

chrome beacon
young knoll
#

Why do you need to add a new item

crude charm
#
    @EventHandler
    public void onDrop(PlayerDropItemEvent event) {
        Player player = event.getPlayer();

        if (!player.getWorld().getName().equals("world") && player.getGameMode() != GameMode.CREATIVE) {
            event.setCancelled(true);
        }

    }

    @EventHandler
    public void onMoveItem(InventoryClickEvent event) {
        Player player = (Player) event.getWhoClicked();

        if (!player.getWorld().getName().equals("world") && player.getGameMode() != GameMode.CREATIVE) {
            event.setCancelled(true);
        }
    }

why is this not working...? I have other listeners in this class that are working fine

gloomy goblet
#

also its not limited to items, also blocks, oregen, etc (i havent tried those yet i just wanna get items working)

young knoll
#

You want mods then

paper viper
#

^

gloomy goblet
#

i want to allow vanilla clients though

paper viper
#

You canโ€™t then

gloomy goblet
#

and allow them to play by using protocollib to modify packets

paper viper
#

You have to use a resourcepack then

quaint mantle
#

Fabric?

crude charm
#

Pretty sure you can

young knoll
#

Fabric has a mod for that

#

PolyMc iirc

gloomy goblet
#

hold up

crude charm
#

HWELP

#

check one block under the player

#

well it should work...

#

idk why you're so angry

#

then say that

young knoll
#

Use a runnable?

hybrid spoke
#

use a runnable and the blockface

#

blockface

#

if(to.getBlock().getRelative(BlockFace.DOWN).getType() == material)

lost matrix
#

No. You will never have to "mess with nms shit" when calling API methods.

lean gull
lost matrix
lost matrix
lean gull
#

1.17.1

lost matrix
#

Then the PersistentDataContainer you can get from the ItemMeta is your best choice.

#

Ive linked a guide above

lean gull
#

wat dis ItemStack itemStack = ...;

tardy delta
#

what would be the best way to disable a command if a player is holding a specific item? Checking the commandpreprocess event and cancalling?

tardy delta
#

basically a minecraft item

lean gull
#

ok

quartz pike
#

?learnjava

undone axleBOT
lost matrix
lean gull
#

???

#

the " ..." says unexpected token

tardy delta
#

like ItemStack item = event.getItem()

lean gull
#

so i can do whatever i want with it?

tardy delta
#

what-

lost matrix
lean gull
#

i can make whatever itemstack i wnat here, right?

tardy delta
#

ItemStack item = new ItemStack(Material.OAK_BOAT);

#

like that

lean gull
#

ok

eternal night
#

or your itemstack or whatever item stack

#

just some item stack xD

lost matrix
lean gull
#

-_-

tardy delta
#

^^

eternal night
#

just flame the post author ๐Ÿ™

lost matrix
lean gull
#

plugin instance is red, how do i get the plugin instance

tardy delta
#

๐Ÿฅบ

lean gull
#

dis? private Main plugin = Main.getPlugin(Main.class);

#

it's from another plugin

lost matrix
#

What is a title entity?

tardy delta
#

the entity provider of a certain block/ entity?

lost matrix
#

Ah. No. Well... Let me think.

tardy delta
#

idk

lost matrix
#

Maybe. But it would be hacky af.

#

Play around with the piston events and check if they are fired even if the block doesnt extend.
If not you will have to look at the redstone events.

young knoll
#

Or asm

maiden briar
#

player.kickPlayer...

[05:10:15 INFO]: tvhee lost connection: The game is finished, goodbye!
[05:10:15 INFO]: tvhee left the game

BUT instead I get this (Translated: "The external host disconnected")

stoic ravine
#

Hey I was wondering how you can place down a chest and everyone can open it but its like an enderchest so everyone has their own inventory in there? :)

maiden briar
#

Yep

tardy delta
#

are you dutch?

maiden briar
#

Yes ofcourse

tardy delta
#

oh me too

maiden briar
#

Nice that is why you knew that

lean gull
#

help pls

tardy delta
#

what is the error smh

#

we cant help if you give us nothing

lean gull
#

Modifer 'private' not allowed here

tardy delta
#

where

lean gull
#

on private

maiden briar
#

Then you are in a method

tardy delta
#

you can only use it on class level

maiden briar
#

Remove it, it is already private

lean gull
#

k thx

maiden briar
#

Because it's YOUR method ๐Ÿ˜„

tardy delta
#

its mine

maiden briar
#

Also I get java.lang.NoClassDefFoundError at random moments in onDisable from my external (self-written) library

#

Looks like classes already started unloading or smth?

#

Even other classes in THE SAME package have no problems, it's always random

eternal night
#

once it landed ? or in the air?

#

well I guess rayTrace

tardy delta
#

is checking if a player is null after getting it by Bukkit.getPlayer(args)
the same as checking if the online players does not contains the player?

#

why is that so difficult

maiden briar
#

If I try to kick everyone in onDisable, nobody gets kicked. (basic for loop). Even trying like this will still kick nobody

while(Bukkit.getOnlinePlayers().isEmpty())
{
    for(Player player : Bukkit.getOnlinePlayers())
        player.kickPlayer(new Component("&aThe game is finished, goodbye!").toLegacyText());
}
#

The method gets called, I am sure

tardy delta
#

try without component?

#

but you want to kick everybody when there are no players?

hybrid spoke
#

dont spam

maiden briar
#

Ok that Component is my own class

worldly ice
#

Maybe toggle a boolean whenever you send that message and it itโ€™s true, donโ€™t run any commands

#

And if itโ€™s*

eternal oxide
#

block commands in command pre process event

tardy delta
#

?

#

do what elgar said

limpid veldt
#

How can the ChatComponent API be used to display an itemstack on hover like the image below?

The api mentions it but does not go into detail on how to actually utilize it.
https://www.spigotmc.org/wiki/the-chat-component-api/

Several forum posts kind of show how to do it but they eventually devolve into "just use NMS" or convert the item to JSON and store it in an Item

Looked into the adventure API for hover stuff but their documentation on hover events is incomplete and apparently itemstack hovers are not implemented yet.

        textComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_ITEM, <<itemstack here>>));```

Suggestions?
elfin creek
#

getCommand("plugins").setExecutor(new PluginsCommand());


import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class PluginsCommand implements CommandExecutor {

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if(!(sender instanceof Player)){ return true; }
        Player player = (Player) sender;

        if (command.getName().equalsIgnoreCase("plugins")){
            player.sendMessage("NICE TRY!!");
        }

        return true;
    }
}
java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "me.superfalcon.supersmp.Main.getCommand(String)" is null
        at me.superfalcon.supersmp.Main.onEnable(Main.java:13) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.16.5.jar:git-Purpur-1171]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[patched_1.16.5.jar:git-Purpur-1171]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500) ~[patched_1.16.5.jar:git-Purpur-1171]
        at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:518) ~[patched_1.16.5.jar:git-Purpur-1171]
        at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:432) ~[patched_1.16.5.jar:git-Purpur-1171]
        at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:280) ~[patched_1.16.5.jar:git-Purpur-1171]
        at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1074) ~[patched_1.16.5.jar:git-Purpur-1171]
        at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:293) ~[patched_1.16.5.jar:git-Purpur-1171]
        at java.lang.Thread.run(Thread.java:831) [?:?]```
tardy delta
#

whoa

#

use ?paste

#

?paste

undone axleBOT
elfin creek
#

ohh sry

tardy delta
#

aha

#

nullptr

elfin creek
#

๐Ÿ˜ตโ€๐Ÿ’ซ

#

haha

eternal oxide
#

command is not in plugin.yml

elfin creek
eternal oxide
#

nope

elfin creek
#
main:me.superfalcon.supersmp.Main
version:1.0
author: superfalcon
commands:
  heal:
    description: doesnt allow players to use plugins
    usage: /<command>
    aliases: plugin
#

ohh wait

#

wtf

#

i copid it from another file lmaoo

#

sry

eternal oxide
#

I'm never wrong, except for when I am ๐Ÿ™‚

elfin creek
#

๐Ÿคฃ

elfin creek
# eternal oxide I'm never wrong, except for when I am ๐Ÿ™‚
main:me.superfalcon.supersmp.Main
version:1.0
author: superfalcon
commands:
  plugins:
    description: doesnt allow players to use plugins
    usage: /<command>
    aliases: plugin
        at me.superfalcon.supersmp.Main.onEnable(Main.java:13) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.16.5.jar:git-Purpur-1171]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[patched_1.16.5.jar:git-Purpur-1171]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500) ~[patched_1.16.5.jar:git-Purpur-1171]
        at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:518) ~[patched_1.16.5.jar:git-Purpur-1171]
        at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:432) ~[patched_1.16.5.jar:git-Purpur-1171]
        at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:280) ~[patched_1.16.5.jar:git-Purpur-1171]
        at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1074) ~[patched_1.16.5.jar:git-Purpur-1171]
        at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:293) ~[patched_1.16.5.jar:git-Purpur-1171]
        at java.lang.Thread.run(Thread.java:831) [?:?]```
#

sadly

#

didnt fix

eternal oxide
#

command is still not in plugin.yml

elfin creek
#

it is right?

eternal oxide
#

I'm going to guess one of two things. You never actually updated the jar on your server correctly, or you tried to update it with the server running

elfin creek
tardy delta
#

doesnt "/<command>" literally prints it out?

eternal oxide
#

open the jar with 7zip and examine the plugin.yml that is inside the jar

elfin creek
#

even with a fresh build

lusty raft
#

Does anyone have a system to remove certain entities in unloaded chunks?

#

since currently it needs a player to be in that area to run the code since it doesn't find any entities in that chunk

lost matrix
formal dome
#

hey guys, just wondering if there is a gradle command to run to build the dependencies for the spigot plugins or if i can just import the spigot 1.17.1 jar

elfin creek
lost matrix
lusty raft
#

I'm trying to remove certain entities on startup, I think I have made a solution 2s.

maiden briar
#

If the plugin reloades I can't access some of my classes (java.lang.NoClassDefFoundError). If the plugin shuts down (EXACTLY same piece of code) it works fine

lost matrix
lost matrix
formal dome
#

thank you!

lost matrix
maiden briar
#

Ok wait a moment

#

It is premium, and I want to support reloads

#

Am I getting crazy or smth? It just dissappeared

lost matrix
maiden briar
#

But the problem is with kicking players

#

Getting this instead of my own message

lost matrix
maiden briar
#

Ok but the library is not a plugin, it comes with the plugin as compiled set of classes

#

And I can't depend my own library in my own library

lusty raft
#

That's what my work around was

#

I've now made it trigger on ChunkLoadEvent

#

Just need to stress test it and make sure it doesn't affect performance

atomic gyro
#

hey y'all, stupid question here, but when using a # while giving snippets of code, what does that mean? never seen it before.

lost matrix
#

Class#method() <- Instance method
Class.method() <- Static method

atomic gyro
#

ahh ok, thank you

#

is there a means of accessing files stored within default minecraft in plugins? like if i wanted to pull from a loot table, how would I go about that?

young knoll
#

Spigot has a loot table API

lost matrix
formal dome
#

so what is the relation between maven and gradle?

#

are they the same concept just two different implementations of dependency building?

lost matrix
#

Both are just dependency managers. You pretty much can do everything with both. Maven has a much bigger audience.

ivory sleet
#

Gradle is faster (:

#

At least once cached

lost matrix
#

Oh hell no.

ivory sleet
#

๐Ÿคจ

formal dome
#

haha

lost matrix
#

??

ashen flicker
#

I prefer maven

formal dome
#

i was just haha-ing the "oh hell no" to gradle benig faster

lost matrix
#

There was a time where i tried really hard getting into gradle. At this time gradle just crashed with java 16 for several months so
i stayed away from it ever since.

formal dome
#

i mean the spigot example uses gradle

lost matrix
#

It literally didnt support an LTS java version

lost matrix
#

Gradle is a bit of a niche

formal dome
#

i just built it with gradle

lost matrix
ancient plank
#

then I go use anything that isn't spigot and its all gradle

gaunt saffron
#
            BufferedReader in = new BufferedReader(new InputStreamReader(http.getInputStream()));
            String inputLine;
            StringBuffer content = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            http.disconnect();
            System.out.println(http.getResponseCode() + " " + http.getResponseMessage());
            System.out.println(content.toString());

how do i get the json object now? so i can do stuff like .get

lost matrix
ancient plank
#

idk man everywhere I look its just gradle gradle gradle

quaint mantle
#

Gradle is becoming more popular tho, just cuz of how much better

lost matrix
gaunt saffron
#

like this?


            Gson gson = new Gson();
            String json = gson.toJson(content.toString());
ancient plank
#

i love the dip in searches for both in january

lost matrix
formal dome
#

hmm.. so my plugin.. at least in its most basic form will not necesarily need any commands... but it will interact with the console logger. any pointers to the appropriate classes would be cool

gaunt saffron
#

api

quaint mantle
#

So mavens just losing percent and gradles not gaining. I love it :3

lost matrix
quaint mantle
#

But personally I think mavens slow and old

#

Gradle is future

lost matrix
ancient plank
#

can't wait for ant !!!

quaint mantle
#

And I canโ€™t forget that xml is just aids

atomic gyro
#

I've been reading the Loot Table stuff on the JavaDoc and I can't really seem to understand how to implement a loot table.

#

The commands are mostly to modify and implement an already existing table, but I don't understand where they get the table from.

quaint mantle
gaunt saffron
lost matrix
# gaunt saffron yeah

Example REST -> JsonObject via Gson

    Gson gson = new GsonBuilder().create();
    final URL url = new URL("https://reqbin.com/echo/get/json");
    final HttpURLConnection http = (HttpURLConnection) url.openConnection();
    http.setRequestProperty("Accept", "application/json");
    
    int responseCode = http.getResponseCode();
    // Do some safety with responseCode
    String jsonContent = http.getResponseMessage();
    
    http.disconnect();
    
    JsonObject jsonObject = gson.fromJson(jsonContent, JsonObject.class);
#

jsonContent contains the raw json String

gaunt saffron
#

lemme delete everything and try this...

gaunt saffron
formal dome
lost matrix
lost matrix
formal dome
severe oracle
#

how do i change explosionPower of a firecharge that is launched from a dispenser ?

lost matrix
#

And then we'll see

proud basin
lost matrix
gaunt saffron
# lost matrix Its a String. You already have the response. Just print it.
            JsonObject jsonObject = gson.fromJson(jsonContent, JsonObject.class);
            System.out.println("test");
            System.out.println(jsonContent);
            System.out.println(jsonObject);
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }

[14:56:43 INFO]: Expected a com.google.gson.JsonObject but was com.google.gson.JsonPrimitive

will be back in 30mins got food, please ping me !

#

not even test "test" got printed

lost matrix
formal dome
#

ok, when is a plugin "enabled"

#

when you start up the server?

lost matrix
#

-.-

lost matrix
rare cave
#

hi there are their any way to add servers to bungeecord without restart

tall dragon
#

Yes

rare cave
#

how to

tall dragon
#

Honestly no clue

#

๐Ÿ‘

limpid veldt
#

How can the ChatComponent API be used to display an itemstack on hover like the image below?

The api mentions it but does not go into detail on how to actually utilize it.
https://www.spigotmc.org/wiki/the-chat-component-api/

Several forum posts kind of show how to do it but they eventually devolve into "just use NMS" or convert the item to JSON and store it in an Item. Neither of these options are optimal.

Looked into the adventure API for hover stuff but their documentation on hover events is incomplete and apparently itemstack hovers are not implemented yet.

        textComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_ITEM, <<itemstack here hopefully>>));```


Suggestions?
rare cave
#

huh

#

Instantiate one

vague oracle
compact cape
#

When I use ItemStack#getEnchantmentLevel to get a custom enchantment level it returns 0 (Which is not for sure) But if I do ItemStack#getEnchantments and print the enchantments in this map, My custom enchantment is there...

What is going on ๐Ÿค”

gaunt saffron
gaunt saffron
# lost matrix
        try {

            String my_uuid = System.getenv("P_SERVER_UUID");
            System.out.println(my_uuid);


            Gson gson = new GsonBuilder().create();
            final URL url = new URL("https://mc.thechemicalworkshop.com/api/client?filter[uuid]=" + my_uuid);
            final HttpURLConnection http = (HttpURLConnection) url.openConnection();
            http.setRequestMethod("GET");
            http.setRequestProperty("Accept", "Application/vnd.pterodactyl.v1+json");
            http.setRequestProperty("Content-Type", "application/json");
            http.setRequestProperty("Authorization", "Bearer REDACTED");

            int responseCode = http.getResponseCode();
            // Do some safety with responseCode
            String jsonContent = http.getResponseMessage();

            System.out.println(jsonContent);

            http.disconnect();

i know the endpoint works, tested with curl

#

might reset toke just to doube check

lost matrix
gaunt saffron
compact cape
inland scaffold
#

so at the top of my command, I have this private static Main instance; How would I get something from it? Main().teststring?

gaunt saffron
lost matrix
gaunt saffron
gaunt saffron
# lost matrix Ah wait. thats not the playload


            URL url = new URL("https://mc.thechemicalworkshop.com/api/client?filter[uuid]=" + my_uuid);
            HttpURLConnection http = (HttpURLConnection) url.openConnection();
            http.setRequestMethod("GET");
            http.setRequestProperty("Accept", "Application/vnd.pterodactyl.v1+json");
            http.setRequestProperty("Content-Type", "application/json");
            http.setRequestProperty("Authorization", "Bearer REDACTED");
//          only use user api, server api gives error, todo

            BufferedReader in = new BufferedReader(new InputStreamReader(http.getInputStream()));
            String inputLine;
            StringBuffer content = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            http.disconnect();
            System.out.println(http.getResponseCode() + " " + http.getResponseMessage());
            System.out.println(content.toString());

this old script works fine

#
[15:19:05 INFO]: {"object":"list","data":[{"object":"server","attributes":{"server_owner":true,"identifier":"f0c00026","internal_id":19,"uuid":"f0c00026-feaa-4cfb-999f-85a1a9ac82d3","name":"testing","node":"Las Node 3core 18gb","sftp_details":{"ip":"REDACTED","port":2022},"description":"descruidescru

this is the output, well part of it

#

i want to access data.description and data.internal_id

compact cape
# compact cape When I use `ItemStack#getEnchantmentLevel` to get a custom enchantment level it ...

I even looked up in the source code of spigot and clearly both are almost using same method

    public int getEnchantLevel(Enchantment ench) {
        Validate.notNull(ench, "Enchantment cannot be null");
        Integer level = this.hasEnchants() ? (Integer)this.enchantments.get(ench) : null;
        return level == null ? 0 : level;
    }

    public Map<Enchantment, Integer> getEnchants() {
        return this.hasEnchants() ? ImmutableMap.copyOf(this.enchantments) : ImmutableMap.of();
    }

But my custom enchantment level is 0 when I use first one but it is not in second one ๐Ÿ˜ญ

hybrid spoke
stone sinew
gaunt saffron
inland scaffold
compact cape
inland scaffold
# inland scaffold https://gyazo.com/33db663712017c179a75123e3461d288 ok so I got it to work, but I...
public class DiscordCommand  implements CommandExecutor  {
    //DiscordCommand
    private Main mainClass = Main.getInstance();
    
    
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        
        Player player = (Player) sender;
        
        //Methods
        
        final String discocmd = mainClass.getConfig().getString("discordmessage");
        //-----------------------------------------------------------
        if (cmd.getName().equals("discord")) {
            if (player.hasPermission("warcentercmd.discord")) {
                player.sendMessage(discocmd);
            } else {
                
            }
        }
        

        return false;
    }

}

thats the Command

stone sinew
inland scaffold
#
# Config

# When a player has no permission show this message.
nopermissionmessage:
  - "&4&lALERT!"
  - "&c&lYou do not have permission to send"
discordmessage:
  - "Discord is"
  - "stuff"

thats the config

severe oracle
#

is it possible to boost a player flying with elytra like the firework rockets do ?

inland scaffold
#

you could check if they jump

compact cape
severe oracle
#

thanks

stone sinew
stone sinew
inland scaffold
#

it says list is underlined

#

I mean list is underlined

stone sinew
compact cape
lost matrix
inland scaffold
severe oracle
#

how do i set velocity ?

stone sinew
# inland scaffold ?
for(String s : getConfig().getStringList("discordmessage")) {
    player.sendMessage(s);
}
compact cape
lost matrix
lost matrix
compact cape
lean gull
#

anyone know why this isn't making the recipe and just gives me a normal crafting table?
MobleCraftingTable.java - https://paste.md-5.net/turanocovu.java
in main: MobileCraftingTable mobleCraftingTable = new MobileCraftingTable();

inland scaffold
stone sinew
lost matrix
#

Its a simple java syntax error. Paste the code.

crimson terrace
#

Try adding or deleting brackets?

lost matrix
# compact cape I use this method https://git.agmdev.xyz/AGMEnchants/blob/master/src/main/java/m...

Just tested the code.
This returns Lvl: 5

        final ItemStack itemStack = new ItemStack(Material.IRON_SWORD);
        final ItemMeta meta = itemStack.getItemMeta();
        meta.addEnchant(Enchantment.ARROW_DAMAGE, 5, true);
        itemStack.setItemMeta(meta);

        final int lvl = itemStack.containsEnchantment(Enchantment.ARROW_DAMAGE) ? itemStack.getEnchantmentLevel(Enchantment.ARROW_DAMAGE) : 0;
        System.out.println("Lvl: " + lvl);
compact cape
lost matrix
compact cape
lost matrix
#

The code that contains the erroneous lines.

#

?paste

undone axleBOT
lost matrix
#

Oh no...

#

You cant declare methods inside other methods

#

This strongly suggests that you didnt take the time to learn at least the java basics before jumping into spigot development.

compact cape
lost matrix
#

What precisely?

lean gull
#

how do i set a shaped recipe's ingredient to a custom item

#

i'm doing this but i'm supposed to input a material, not an itemstack:
sr.setIngredient('W', oakPlanksItem);

lost matrix
lean gull
#

how do i used that

lost matrix
# lean gull how do i used that
    ShapedRecipe recipe = ...;
    ItemStack itemStack = ...;
    RecipeChoice exactIngredient = new ExactChoice(itemStack);
    recipe.setIngredient('X', exactIngredient);
#

If you dont learn at least the basics then you wont be able to write any spigot plugins at all.

lean gull
#

i did dis instead
sr.setIngredient('W', new RecipeChoice.ExactChoice(oakPlanksItem));

lost matrix
#

Its not. This is the cleanest way.

lean gull
#

actually nvm i agree with 7simle7

#

i'll do the longer wae

lost matrix
#

We had this discussion before.

gaunt saffron
#

this works
System.out.println(jsonObject.get("data"));

but how do i do multiple .get methods?

lost matrix
#

I see that you didnt follow my suggestion to watch the youtube speech of Robert C. Martin about clean code.

gaunt saffron
gaunt saffron
lost matrix
gaunt saffron
#

ah okay

#

how do i grab the first?

#

like it's a list so [0]

#

i dont want for loop

lost matrix
#

So you will go:
mainJson -> JsonArray elements = get("data").getAsJsonArray()

gaunt saffron
#

unless it's faster

formal dome
#

any connectors between my plugin and a database