#help-development

1 messages · Page 1700 of 1

trail flume
#

How can I send an entity via a packet (that is not server-side) with a custom UUID?

opal juniper
#

lol

mellow edge
#

lol

drowsy helm
#

lmao

fossil lily
#

well time to figure out how to do that

drowsy helm
#

new Commands(this);

#

in your main class

fossil lily
#

is it that easy?

drowsy helm
#

yep

fossil lily
#

wow im dumb

quaint mantle
#

That finally worked. Even though in the end I found the solution on my own, I appreciated your help and it was a moral lifesaver. Thank you very much for your help.

fossil lily
#

😅

#

YAY I MADE MY FIRST COMMAND

mellow edge
#

lol

quaint mantle
#

Congrats

fossil lily
#

:D

idle grotto
#

Hey guys, I'm having a really weird issue. I have a table looking something ike:

player | some_boolean | timestamp

For some reason, modifying the some_boolean, sets the timestamp value to the current time.
I have tested it both in code and manually via a shell, to make sure I have no logic flaws in my code, and I can confirm it's not a flaw in my code.

fossil lily
#

Do you need a separate java file for each command?

drowsy helm
idle grotto
#

bigint | boolean | timestamp

#

Using mariadb btw

drowsy helm
chrome beacon
#

You could just store timestamp as bigint/long no? Might not be the best way though

drowsy helm
#

hmm strange could we get a code snippet?

#

yeah can do time as millis

chrome beacon
#

If you can't figure out timestamp use millis

idle grotto
drowsy helm
#

oh strange

idle grotto
chrome beacon
#

Yeah

drowsy helm
#

i might try recreate in mysql

#

see if its a maria problem or not

idle grotto
#

if you could that'd be great

drowsy helm
#

ill have to do it later though ill get back to you if i do

idle grotto
#

okay, I'll probably be asleep, but do ping me and I'll check it later

chrome beacon
#

From what I can find you can configure it to auto update timestamp

#

Not sure if that's on by default

idle grotto
#

another thing, it only happens when the boolean value actually changes, if you set it to true when it's already true it doesn't happen

drowsy helm
#

The timestamp field is generally used to define at which moment in time a row was added or updated and by default will automatically be assigned the current datetime when a record is inserted or updated.

chrome beacon
drowsy helm
#

maybe you want DateTime?

#

not timestamp

idle grotto
#

oh I didn't know that, I was actually reading an article about the difference between DATETIME and TIMESTAMP, and it didn't mention that

#

thanks

chrome beacon
#

Time for me to get some sleep

#

Good night

idle grotto
#

gn 😴

shy wolf
drowsy helm
#

has something to do with a discord bot

shy wolf
drowsy helm
#

what are you trying to do thats throwing the error

shy wolf
#

idk

#

whan i send msg or kick

drowsy helm
#

why does jda need a zipFile

#

to me that looks like a jda issue

#

is com.neovisionaries.ws.client your package?

shy wolf
#

nop

#

my is me.fish

drowsy helm
#

could i see the line where you are trying to send the message

shy wolf
#
            MessageChannel channel = event.getChannel();
            channel.sendMessage("Pong!");
ivory sleet
#

You need to queue it

young knoll
#

Does spigot have any convenient way to check if a block can be legally placed at a location

#

IE: Saplings can not be placed if the block below is sand

drowsy helm
#

Probably not. I think that check is clientsided

#

Unless someone went out of their way to make it

ivory sleet
#

Isn’t it both client and server

feral socket
#

there is Player#placeBlock

drowsy helm
#

Could be

ivory sleet
#

That’s paper ?

naive jolt
#

Hey so I want to check if there is a player near my npc how do i do that

young knoll
#

I know I can do it with NMS but blah

naive jolt
#

player.getNearbyEntities(5, 5, 5)

#

but like idk how to use it

drowsy helm
naive jolt
drowsy helm
#

Iterate through each entity in the areay and check if it’s a player

naive jolt
#

omg I should learn more java 😓

ivory sleet
#

Indeed

naive jolt
#

tried with a list

drowsy helm
#

Does it return an array of entities?

naive jolt
#

List<Entity> entities = player.getNearbyEntities(5, 5, 5);

#

then i should do what?

#

for(entities : ?)

drowsy helm
#

Yep then instanceof Player

naive jolt
#

ah

shy wolf
# ivory sleet You need to queue it

channel.sendMessage("Pong!") /* => RestAction<Message> /
.queue(response /
=> Message */ -> {
response.editMessageFormat("Pong: %d ms", System.currentTimeMillis() - time).queue();
});

naive jolt
#

that makes more sense

naive jolt
naive jolt
# drowsy helm Yep then instanceof Player

        }``` uh lol so basically i did instanceof then when i did autocomplete it did all this just wanted to know if its necessary or i should remove all that and just get ofc the instance of the player
drowsy helm
#

Nah you want to iterate over entities

#

Then do if(entity instanceof Player)

#

So a regular iteration for(Entity entity : entities)

undone axleBOT
#

You can use the discord code block format to display code or just text in a more pleasing way:

```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {

}

}```
Becomes:

public class MyPlugin extends JavaPlugin {
    @Override
    public void onEnable() {

    }
}```
naive jolt
#

that auto completed correctly

#

then if i just if the entity is an instance of player correct?

drowsy helm
#

Yeah

wild reef
#

Hey got a little issue:
I got this exception: Caused by: java.lang.NoSuchMethodError: 'java.util.List de.schmidi.config.PluginConfig.getCustomItemDrops()'
When calling the above named method. But I am kinda confused why it's happening. I am on Spigot Version 1.8.8 rn and made a other plugin similar to this one there methods like this work as well. Any idea why this error can pop up?

ivory sleet
#

Binary incompatibilities

wild reef
#

sooo, what can I do about it?

shadow night
#

What if i use a domain i don't own for my plugins ids?

eternal night
#

the internet police will find you

shadow night
#

And if I'll buy it when they find me?

eternal night
#

no but to be honest, it does not matter if no one owns the domain. stuff like me.raydanomg is perfectly fine even if you don't own it

ivory sleet
#

Well that error is a linkage error and yields when you for instance depend on a compile dependency which provides a class or interface with a specific method.
Let’s say the method add(Object o); from the interface PluginDataHelper.
Now when the server runs it uses your plugin jar which depends on that compile time dependency with that method, however the runtime dependency variant does not have the method add(Object o) it has for instance add(String str, Object o); instead [different signature] thus yielding the exception. @wild reef

eternal night
#

I wouldn't publish my library using com.google for example

shadow night
#

what if you do?

eternal night
#

but as long as it is only associated with you, its pretty okay

#

I mean, idk if google can do something about it ?

ivory sleet
#

com.google.lynxplay 😏

eternal night
#

but tbh, why do that in the first place

#

kinda sexy domain ngl

ivory sleet
#

lol

shadow night
#

I can imagine com.youtube

eternal night
#

io.github.raydanomgr

#

github reserves that for your github.io page anyway

#

so you can be sure no one can own it (unless you change your github username)

wild reef
ivory sleet
#

Well

#

Is this all in one plugin?

wild reef
ivory sleet
#

Also do you use plugman?

#

Be honest

eternal night
#

Be honest

#

LOL

wild reef
#

idk what that is, so I guess no xD

shadow night
ivory sleet
#

Oh okay gud

eternal night
ivory sleet
#

Well might be the case some other plugin is reserving the plugin name of yours?

#

What’s the name of your plugin inside plugin.yml?

wild reef
#

it's called customDrops but that's the only plugin on the server

ivory sleet
#

And if you restart it would still yield the error?

wild reef
#

I tried to run the plugin on a 1.17.1 server as well, it worked there. But on 1.8.8 it throws the error even after restart.

eternal night
#

👀

ivory sleet
#

Oh

wild reef
#

But there is like no code contained in this method from spigot

#

it's literally just a print statement

eternal night
#

are you sure there are no errors prior then

ivory sleet
#

Send the entire error stacktrace

eternal night
#

^^

ivory sleet
#

?paste

undone axleBOT
ivory sleet
#

I’m on phone so discord sucks btw

wild reef
#

oh yea forgot about that, one sec

eternal night
#

is that the only error ?

#

nothing during startup ?

wild reef
#

no that's the only one

#

that's why I am really confused about it. I had a similar functional plugin tested on 1.17 and 1.8.8 and it also worked

ivory sleet
#

And if you just redeployed your plugin?

#

like recompile it

wild reef
#

same happens

eternal night
#

it is a single module plugin as well right ?

#

(I am guessing you are on maven)

wild reef
#

yep it is

eternal night
#

can you decompile the jar in the 1.8.8 server and validate that the respective method is there

#

really don't know anything else 😦

wild reef
#

yea I will give it a try

eternal oxide
#

what is line 32? Caused by: java.lang.NoSuchMethodError: 'java.util.List de.schmidi.config.PluginConfig.getCustomItemDrops()' at de.schmidi.listener.PlayerDeathListener.onPlayerDeath(PlayerDeathListener.java:32) ~[?:?]

naive jolt
#
    public void movement(PlayerMoveEvent e) {
        Player player = e.getPlayer();
        List<Entity> entities = player.getNearbyEntities(5, 5, 5);
        for (Entity entity : entities) {
            if(entity instanceof Player){
                sneakEvent();

            }

        }

    }

    private void sneakEvent(PlayerToggleSneakEvent event) {
        Player player = event.getPlayer();

        player.sendMessage("hmh Works");
    }``` so uhh why doesnt me calling the sneak event not work. Maybe its different with java
eternal oxide
#

you don;t call the sneak event. Even then you called it with no args. that does not correspond to your method/

#

a PlayerSneakEvent is triggered when a player sneaks

#

and it needs to be annotated just like all other events

#

and public

naive jolt
#

oh yeah I forgot thank you!

quaint mantle
#

hey how might one go about making some kind of minutely reward system

#

definitely hashmaps, lonsg, and runnables?

quaint mantle
#

Even async repeating tasks will help you

eternal oxide
#

?scheduling

undone axleBOT
quaint mantle
#

i just dont want 100000000 different tasks

#

You don’t need too

eternal oxide
#

You need 1

quaint mantle
#

Create one task that gives someone EXP depending on certain conditions

#

Than call that method for everyone

#

i see

#

Using a .forEach or something

#

Inside the repeating task

#

So like

task {
if player has 10 xp {
Give player diamond;
}
}

#

If you get me 🤣

#

I’m on phone rn

dry forum
#

i created a plugin thats just an api to test, how am i supose to use that plugins api in another plugin? ive tried to google it but everything i found is rly bad and doesnt even explain it

barren nacelle
#

Hey is there some sort of command I can use for detecting broken blocks like the opposite of e.getBlockPlaced()

young knoll
#

BlockBreakEvent

naive jolt
#
    public void movement(PlayerMoveEvent e) {
        Player player = e.getPlayer();
        List<Entity> entities = player.getNearbyEntities(5, 5, 5);
        for (Entity entity : entities) {
            if(entity instanceof Player){
               player.sendMessage("ItWorks!");

            }

        }

    }``` why is it not working  its in my main class and i registered it onEnable like this  ```getServer().getPluginManager().registerEvents(this, this);```
young knoll
#

Oh boy that will be hard on the server

naive jolt
#

I wanna check if the player is near a corpse

young knoll
#

Anyway, are you near a player

#

A real player that is

naive jolt
#

im near a corpse

#

(npc)

young knoll
#

NPCs are client side

#

So that will not find them

eternal oxide
#

your corpses are packet generated?

young knoll
#

Store the location of the corpse and look for that

naive jolt
young knoll
#

Store the location of the corpse and look for that

naive jolt
#

my corpse class

naive jolt
#

let me try tthat

barren nacelle
# young knoll BlockBreakEvent

I know this exists but I mean something I can use in this sentence: public class BlockListener implements Listener {

@EventHandler
public void onPlace(BlockPlaceEvent e) {

    if (e.getBlockPlaced().getType().equals(Material.OBSIDIAN)) {
        e.getBlockPlaced().setType(Material.LAVA);
        e.getPlayer().getWorld().createExplosion(e.getPlayer().getLocation(), 10);
    }
    
    
}

}

young knoll
#

The entity does not actually exist on the server, so you can't find it with the API

elder oyster
#

Hi I'm retrieving a set of commands for Bungeecord, through the config.yml file. But I'm not able to retrieve specific values of the yml file.
I managed to separate the commands using the following, but I cannot get the key value pairs of the sub properties

this.commands = this.configManager.getConfig().getList("commands");

 for (Object command : this.commands)
 {
//getLogger().info(command.toString());
 }```
Example config.yml
```yaml
commands:
   - discord:
      command: /discord
      types:
      - TEXT
      text:
      - 'Click here to join our Discord server!'
      hover:
      - 'link'
      link: 'link'```
young knoll
#

That isn't a sentence

#

That is a block of code

barren nacelle
young knoll
#

Okay so what is the issue

#

Change the event to BlockBreakEvent

#

And i'm pretty sure BlockBreakEvent just has event#getBlock

barren nacelle
#

if (e.getBlockPlaced().getType().equals(Material.OBSIDIAN)) is there something like e.getblockbroken

young knoll
#

?jd

young knoll
#

Search for it

barren nacelle
#

Good idea

barren nacelle
quaint mantle
#

or dont ping people specifically

#

someone will help when they can

#

unless coll allows you to

barren nacelle
young knoll
#

For the API I have I just use gradle to shade it into my other plugins

barren nacelle
#

Sorry Coll

young knoll
#

And to depend on it from my MavenLocal

dry forum
#

im not using maven though, i made a test plugin that has an api and i just made a new project, added the jar file from the api, and idk how im supose to the use the api theres no tutorials or anything

barren nacelle
#

Also I think spigot just forgot to add a e.getblockbroken I can only find events

young knoll
#

Just use getBlock

#

I don't know why getBlockPlaced exists and the other doesn't

barren nacelle
#

Never mind I can't spell

naive jolt
#

of the npc

#

so how do i store

#

it

eternal oxide
#

Thats because it doesn;t exist

#

you created it and sent it to the client

#

so it now only exists on the client machine

naive jolt
#

oh

eternal oxide
#

you have to store the data you need when you create it

naive jolt
#

I cant acess that?

#

ah

#

so how

#

like

#

I get location

#

corpse.getBukkitEntity().getLocation();

eternal oxide
#

its the location you set when you send the packets to spawn it

naive jolt
#

ohh so its on the player

#

im gonna store it

#

same time

#

ok one last thing

#

I stored it

barren nacelle
#

A ha! Spigot has boolean breakBlock​(@NotNull
Block block) (That sounds very cheesy)

naive jolt
#

how do I take that location var from there to the main class

#

how do I use it on the main class

eternal oxide
#

?di

undone axleBOT
barren nacelle
#

Welp

lean gull
#

anyone know how to put a long fishing line from a player and also set the bobber's location to a variable?

#

empthasis on long, i want more than the default 33 blocks distance

naive jolt
#

cause I dont think its the best way

naive jolt
young knoll
#

What are you trying to do?

naive jolt
#

its to excess the Location var from the corpse class in the Main class

barren nacelle
#

I made a simple plugin (The picture below) for testing making blocks into lava but it isn't working does anyone know why?

quaint mantle
#

e.setCancelled(true)

elder oyster
#

Basically get fields from config.yml and put them in key value pairs or a non-generic class/object

quaint mantle
young knoll
#

Not going to fix anything, but yes

lost matrix
# elder oyster Hi I'm retrieving a set of commands for Bungeecord, through the config.yml file....

This setup doesnt look like it should work.
Your setup should look like this:

commands:
  discord:
    command: /discord
      types:
      - TEXT
      text:
      - 'Click here to join our Discord server!'
      hover:
      - 'link'
      link: 'link'
    YamlConfiguration config = ...;
    final ConfigurationSection commandDeclSection = config.getConfigurationSection("commands");
    // Check if commandDeclSection == null
    final Set<String> commandKeys = commandDeclSection.getKeys(false);
    for (final String commandKey : commandKeys) {
      final ConfigurationSection commandSection = commandDeclSection.getConfigurationSection(commandKey);
      // Check if commandSection == null
      final String commandAlias = commandSection.getString("command");
      List<String> typesList = commandSection.getStringList("types");
      // And so on
    }
lost matrix
# barren nacelle

The block is set after the event is done. So you need to cancel the event and then set the blocks value or set the blocks value one tick later.

lean gull
#

so can anybody help?

young knoll
#

Not sure if you can do that without messing with internal stuff

#

Trying teleporting the bobber

lean gull
#

it'll disappear doe

#

i think

young knoll
#

Then yeah, messing with internal server stuff

lean gull
#

wdym

young knoll
#

NMS and packets

lean gull
#

idk what those things are and how to use them

violet girder
#

Hello, i have a question. This is my first time that i have create a Minecraft plugin but how can i set it in a file that i can add the plugin in a Minecraft server?

lost matrix
violet girder
lost matrix
violet girder
#

Thank you!

lean gull
#

does anyone know how to make a player do a certain animation? like crossbow load, trident throwing etc etc

young knoll
#

You gotta have them hold said item and send a certain packet

formal dome
#

if i'm including external libraries do they have to be shaded into my plugin via the plugin.yml?

#

i'm including a java discord api interface

lost matrix
formal dome
#

so it builds but still throws this exception: java.lang.NoClassDefFoundError: net/dv8tion/jda/api/JDABuilder

lean gull
#

dumb question: how do i spawn an entity in a certain location? such as 0, 5, 0

formal dome
#

i guess i don't understand the difference between building and shading

timber whale
#

can i dm someone for help rq

lost matrix
lost matrix
formal dome
#

if i can run a script to shade the files vs just including it when compiling

lost matrix
#

You will still need the dependencies when compiling.
But assuring availability on runtime has to be done by

  1. Shading them in
  2. Downloading before starting (via plugin.yml)
formal dome
#

ok

#

thanks smile

#

is shading done in the build.gradle file or no?

lost matrix
formal dome
#

awesome 🙂

lean gull
lost matrix
lean gull
#

this article says it can do player data corruption

#

thanks, but i'mma pass

young knoll
#

Anything can corrupt player data if you do it wrong enough

quaint mantle
#

ya

outer sorrel
#

I use Player#isGliding in my plugin but that makes it generate exeptions on 1.8 servers, how could I fix this and still use Player#isGliding?

lost matrix
outer sorrel
#

Many servers still use it sooo

#

its not my main target though, still would like basic support for it though

young knoll
#

You can't fix it

#

The method doesn't exist

lost matrix
outer sorrel
#

ill do that, thanks

torn oyster
#

hey guys

#

how do i store a block

#

in yaml

#

nvm

young knoll
#

Location

fading pulsar
#

Emm who can teach me how to get str[rand]
i want do a random announcer

#

it just say "The type of the expression must be an array type but it resolved to String"

young knoll
#

getStringList will give you a list of strings

#

Which you can use get(index) to get a random element from

fading pulsar
young knoll
#

getConfig().get("announcers") returns a list

fading pulsar
#

Can only iterate over an array or an instance of java.lang.Iterable ?

young knoll
#

Okay, and?

fading pulsar
#

Error?

young knoll
#

getStringList will give you a list of strings
Which you can use get(index) to get a random element from

fading pulsar
#

what .w.

young knoll
#

?learnjava

undone axleBOT
torn oyster
#

hey

young knoll
#

hi

torn oyster
#

is it possible to get a list of config sections

#

like

#
crops:
  46ebc584-25f7-4915-be12-2804df5b5285:
    owner: d36d4ae9-b37b-45c7-9426-5496390c98a9
    growth-period: 5
    location:
      ==: org.bukkit.Location
      world: world
      x: 1.0
      y: 64.0
      z: -14.0
      pitch: 0.0
      yaw: 0.0
  1c4005dc-cdee-4f36-9e53-202e362197ef:
    owner: d36d4ae9-b37b-45c7-9426-5496390c98a9
    growth-period: 5
    location:
      ==: org.bukkit.Location
      world: world
      x: 1.0
      y: 64.0
      z: -13.0
      pitch: 0.0
      yaw: 0.0
  07db581d-b782-460c-acc1-c267f2134b2c:
    owner: d36d4ae9-b37b-45c7-9426-5496390c98a9
    growth-period: 5
    location:
      ==: org.bukkit.Location
      world: world
      x: 1.0
      y: 64.0
      z: -12.0
      pitch: 0.0
      yaw: 0.0
  b07a4390-94ff-4541-a3d3-918cbb556d38:
    owner: d36d4ae9-b37b-45c7-9426-5496390c98a9
    growth-period: 5
    location:
      ==: org.bukkit.Location
      world: world
      x: 1.0
      y: 64.0
      z: -11.0
      pitch: 0.0
      yaw: 0.0```
#

i have this

#

i wanna get all the config sections in "crops"

manic furnace
#

Hey guys! I compressed my program to an exe file and made a installer with inno setup for it. Befor i publish , how is that wity the licences

young knoll
#

Your server isn’t actually laggy

#

The load is only 17%

#

But whenever that task does run, it takes a lot of time, what the heck is it doing

hasty prawn
#

Based on the name, it's probably a good thing it takes a while for whoever it involves sj_freakouteyes

young knoll
#

What?

#

Plugins are pretty much always jar files

#

I mean we can’t say much about the task without seeing it

torn oyster
#

if (playerData.getConfigurationSection("profiles." + uuid.toString()) == null) {

#

why is that always true

#

it isnt

#
profiles:
  ad53c106-4be2-461a-af03-604c46e6b1fb:
    name: xEmty
    money: 3072.0
    xp: 456
    level: 9
  d36d4ae9-b37b-45c7-9426-5496390c98a9:
    name: Quared
    money: 0.0
    xp: 69
    level: 0
  af9dd2f2-eb67-4df2-b3f4-69bd15fea282:
    name: Mutiniux
    money: 13592.0
    xp: 291
    level: 21```
#

the uuid is af9dd2f2-eb67-4df2-b3f4-69bd15fea282

#

which should be mutiniux's profile

#

but it returns true

#

when it clearly isnt

still widget
#

o/ does anyone know where to go to to learn how to make a plugin?

quasi flint
#

?learnjava

undone axleBOT
quasi flint
#

first learn java

#

and then just try messing around

#

or watch youtube videos

still widget
#

dam

#

okie

still widget
#

that still works? even in 1.17.1

quasi flint
#

he has a 1.17; playlist too

still widget
#

oh fantastic

quasi flint
#

then spigot

#

thats a lotmless pain for others

still widget
#

basic or all of them?

#

im guessing all of thm

torn oyster
opal juniper
#

instead of using a memory section

torn oyster
#

can u give example?

opal juniper
#

if (config.get(“key”) == null) {}

torn oyster
#

or just profiles

#

cuz uuid.tostring is another config section

opal juniper
#

yeah do the uuid as well

torn oyster
#

okay ill try

torn oyster
opal juniper
#

meh idk then

quaint mantle
# quasi flint then spigot

I learn java and spigot at the same time, spigot is very easy to use but also needs to know some basic

violet girder
cerulean jasper
#

Hi, how do I create inventoryHolder?

#

I am trying to make a GUI using a library and I am kinda lost

quasi flint
#

which lib?

cerulean jasper
#
#

Was looking at this doc

#

But I am quite lost

quasi flint
#

i dont see nothing he does not explain

ivory sleet
#

Also there’s an example section

quasi flint
#

yea

cerulean jasper
#

I think examples section is for other lib 😦

ivory sleet
#

Wat

#

Oh idk maybe

cerulean jasper
#

Yea, well, do I have to keep it null? because that gave me error

ivory sleet
#

Keep what null?

cerulean jasper
#

InventoryHolder

quasi flint
#

what parameetr fors it take?

#

does it

ivory sleet
#

The holder acts like an identity key if you want to later retrieve the same inventory gui instance

south wharf
#

п

stone sinew
#

Is there a better/cleaner way to do HexColors?

private Pattern pattern = Pattern.compile("(#[a-fA-F0-9]{6})");
public String hexColor(String s) {
    if(s == null) return s;
    if(s.isEmpty()) return s;
        
    Matcher matcher = pattern.matcher(s);
    while(matcher.find()) {
        String color = s.substring(matcher.start(), matcher.end());
        s = s.replace(color, String.valueOf(ChatColor.of(color)));
        matcher = pattern.matcher(s);
    }
        
    return s;
}
ivory sleet
#

Nothing particular

stone sinew
#

Just not a fan of while statements really lol

ivory sleet
#

Well it suits you in this case (:

#

Ig you could use a StringBuilder instead of mutating the variable s

stone sinew
#

True.

#

I'll fiddle around with it see what I can come up with. Now that I know it just uses ChatColor.of(String)

ivory sleet
#

👍

quaint mantle
#

how to send a chat of a particular color

#

also how to kick and the kick message should be a particular color

#

please tell me thanks

eternal night
#

Normal usage of chat color ?

quaint mantle
#

can u please tell me how to call it

quaint mantle
eternal night
#

idk first google result

#

the message you pass to kick/banning can include those colour codes

quaint mantle
#

wait yea I forgot to google anyways thnx

quaint mantle
# stone sinew Is there a better/cleaner way to do HexColors? ```java private Pattern pattern =...
private static final Pattern HEX_PATTERN = Pattern.compile("#([A-Fa-f0-9])([A-Fa-f0-9])([A-Fa-f0-9])([A-Fa-f0-9])([A-Fa-f0-9])([A-Fa-f0-9])");

public static String color(String message) {
    return ChatColor.translateAlternateColorCodes('&', HEX_PATTERN.matcher(message).replaceAll("&x&$1&$2&$3&$4&$5&$6"));
}

or

private static final Pattern HEX_PATTERN = Pattern.compile("#([A-Fa-f0-9]){6}");

public static String color(String message) {
    StringBuffer buffer = new StringBuffer();
    Matcher matcher = HEX_PATTERN.matcher(message);
    while (matcher.find()) {
        matcher.appendReplacement(buffer, ChatColor.of(matcher.group()).toString());
    }
    matcher.appendTail(buffer);
    return ChatColor.translateAlternateColorCodes('&', buffer.toString());
}
stone sinew
#

2nd is cleaner to me lol. Still uses while. I try to stay clear of while statements.

eternal night
#
private static final Pattern HEX_PATTERN = Pattern.compile("#([A-Fa-f0-9]){6}");

public static String color(String message) {
    return ChatColor.translateAlternateColorCodes(
        '&',
        HEX_PATTERN.matcher(message).replaceAll(m -> ChatColor.of(m.group()).toString())
    );
}
quaint mantle
#

idk why but my command always say that im a console not a player even when i go into the server


@Override
   public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, @NotNull String[] args) {
       if (sender instanceof Player p && args.length == 1) {
           if(!sender.hasPermission("risingcore.spawnsystem")) {
               sender.sendMessage("hello u dont have perm");
               return true;
           }
           String locationName = args[0];
           locationsData.getCustomConfig().set(locationName, p.getLocation());
           locationsData.saveCustomConfig();
           p.sendTitle("hello", "hello" , 20, 60, 20);
           return true;
       }
       sender.sendMessage("only player can execute this");
       return true;
   }
}```
already registered in main and plugin.yml, i know i should switch to acf but im testing things out
eternal night
#

well do you actually supply an argument ?

quaint mantle
eternal night
#

well there is your issue xD

eternal night
#

imagine not knowing about replaceAll on matcher smh xD

quaint mantle
ivory sleet
#

Oo that’s a nice oneliner

eternal night
#

it is

eternal night
#

java 9

#

so, above java 8

stone sinew
#

Damn

eternal night
#

but tbf if you are still vibing with java 8

#

sucks to live in the past

slim kernel
#

Whats the best way to check if there is a Water source in a specific range of Blocks around the Player? Should be: as fast as possible, radius: 0-30, at max usage about once every 10 seconds.

opal juniper
#

just loop thru the blocks really

lost matrix
opal juniper
#

its not that expensive

slim kernel
lost matrix
#

in like 15min i can give you an example

slim kernel
#

thank you!

slim kernel
lost matrix
slim kernel
lost matrix
#

Not sure but i sometimes get a StackOverflow. Mabye the recursion is faulty. Youll figure it out.

lost matrix
#

Example

  @EventHandler
  public void onInteract(final PlayerInteractEvent event) {
    if (event.getHand() != EquipmentSlot.HAND) {
      return;
    }
    final Block center = event.getClickedBlock();
    final Optional<Block> optFound = BlockFinder.findNearest(center, 10, Material.WATER);
    optFound.ifPresent(block -> block.setType(Material.RED_WOOL));
  }
tardy delta
#

do teams take a lot of resources if a lot of players are added?

quasi flint
#

dont thunk so

tardy delta
#

ok

#

anyways is there a way to write this shorter?

public static boolean isPlayerOnline(CommandSender sender, String playerToCheck, boolean exactName) {
        if (exactName && !Bukkit.getOnlinePlayers().contains(Bukkit.getPlayerExact(playerToCheck))) {
            message(sender, "&c" + playerToCheck + " is currently not online!");
            return false;
        } else if (Bukkit.getOnlinePlayers().contains(Bukkit.getPlayer(playerToCheck))) {
                message(sender, "&c" + playerToCheck + " is currently not online!");
                return false;
            }
        return true;
    }
stone sinew
tardy delta
#

so like this?

public static boolean h(CommandSender sender, String playerToCheck, boolean exactName) {
        if ((exactName && Bukkit.getPlayerExact(playerToCheck) == null) || 
                (!exactName && Bukkit.getPlayer(playerToCheck) == null)) {
            message(sender, "&c" + playerToCheck + " is currently not online!");
            return false;
        }
        return true;
    }
main dew
tardy delta
#

uhh first way seems easier

main dew
#

oke

#

how to load an external library from a jar file when starting server?

lost matrix
main dew
#

in total you are right

#

I didn't think

tardy delta
#

owh bruh returning Collections.emptyList() in a tabcomplete doesnt show the player names..

eternal night
#

returning null might

#

tho actually, I don't think that does it either

#

but implementing your own player name tab suggestion is really not too difficult

tardy delta
#

yea i tried it with null and that worked

maiden briar
#

The scoreboard makes my server very slow, and I want to do it async on the NMS way. What is a good way?

weak mauve
#

how can i get current target of an entity bukkit?

tardy delta
#

entitytargetevent#getTarget or something?

regal dew
#

Mob#getTarget

quaint mantle
#

i have a List<Entity>

#

List<Entity> entityList = player.getNearbyEntities(15, 15 ,15);

#

i want to see if there is any wither skeleton in it

quaint mantle
#

player.getNearbyEntities(15, 15 ,15);

eternal oxide
#

yes

#

but you only want wither skeletons

quaint mantle
#

so

eternal oxide
#

so use the method I linked

quaint mantle
#

how can i use it

eternal oxide
#

what about it don;t you understand?

quaint mantle
eternal oxide
#

ok

tardy delta
#

its a lambda

quaint mantle
#

i want to check if there is any wither skeleton near it
so it doesnt remove mana for no reason

tardy delta
#

..., entity -> entity instanceof Skeleton) or something

eternal oxide
#
Location loc = player.getLocation();
List<Entity> entities = loc.getWorld().getNearbyEntities(loc, 15, 15, 15, e -> { return e.getType() == EntityType.WITHER_SKELETON; })```
#

or somethign close

tardy delta
#

xd

naive jolt
#
    public void movement(PlayerMoveEvent e) {
        CorpseEntity corpseEntity = new CorpseEntity();
        Player player = e.getPlayer();
        World world;
        if(player.getLocation() == corpseEntity.loc){
            player.sendMessage("IM tired");
        }


    }``` noooo still not working umm im trying to check if a player sneaks near a corpse(npc) i removed the uhh sneak event to test the location and its not working ive been trying to do this for soooo long
tardy delta
#

ah for some reason this gives a npr

if (dataFile.contains("safe_chests") && dataFile.getConfigurationSection("safe_chests").getKeys(false).size() > 0) {
maiden briar
#

People say me that most of the times I can better use team prefixes to display on the scoreboard instead of entries, but how?

quaint mantle
maiden briar
#

And also (a common problem) the health is always 0 if the game starts, if sb takes damage it changes to the actual number

eternal oxide
quaint mantle
#

so i can check with isEmpty to see if there is any near it so it doesnt remove mana for no reason

#

right ?

eternal oxide
#

yes

maiden briar
#

That is the main purpose of a List

opal juniper
#

you are instanciating on every move event??

#

so uh

#

i have no clue what you are doing

eternal oxide
#

are you trying to detect them approaching the corpse while sneaking, or starting to sneak near a corpse?

naive jolt
#

starting to neak

eternal oxide
naive jolt
naive jolt
#

ok so then how do i make the location part work tho?

#

im honestly unsure

#

cause I do have the location of the npc

eternal oxide
#

when you spawned your corpse for teh player (not on the server) it had a location

naive jolt
#

yes

#

I have that location stored

eternal oxide
#

you compare that location to teh players using player.getLocation().distance(npcLocation)

#

The distance method returns a double. you make sure thats under a certain amount to be close to teh corpse

naive jolt
#

hah

#

ok let me try to do that

violet girder
naive jolt
#

what should I do to

#

my

#

Location loc

#

variable

#

for the corpse

naive jolt
#

do umm hold on

#

are you using jre16?

#

if so make sure your making your plugin on 1.17.1

#

cause its the version that uses that

#

1.16

#

is like 8

#

i think

violet girder
violet girder
naive jolt
#

ah try 8

violet girder
#

Okay, thank you! (:

naive jolt
#

tell me if it works

violet girder
#

Shall i do

lusty cipher
#

Is there some shorthand to getting the default world folder? Say the default world folder for example? (Where playerdata, advancements and everything else is saved)

stone sinew
lusty cipher
#

welp you didn't understand my question but hey
guy on paper server said the first world in getWorlds() is the default one

opal juniper
#

uh i think it is normally - you would have to look at the implementation tho i imagine

quaint mantle
#

is there anyway to override vanilla items ?

#

like hypixel

#

they change its lore

hasty prawn
#

ItemMeta lets you modify an item.

quaint mantle
#

a wooden axe

#

like when you craft one

#

or take from your creative inventory

hasty prawn
#

Oh, no it's not possible globally. You have to modify it for all cases yourself.

#

With the ItemMeta PeepoHappy

sleek pond
#

I was about to write in spanish cuz i'm in spanish class and we can only talk in spanish

opal juniper
#

cool

lost matrix
quaint mantle
#

like lore

#

name

#

and stuff

#

the whole itemmeta

lost matrix
#
  1. Get the ItemMeta from an ItemStack
  2. Change it
  3. Set the ItemMeta back to the ItemStack
quaint mantle
#

bruh i know it

#

i want to

#

change the item entierly

#

like a wooden axe lore

eternal night
#

using the item meta ?

quaint mantle
#

when you craft it

#

whatever

eternal night
#

listen to the respective event ?

quaint mantle
#

when you craft, get from creative menu

#

essentials /i

#

and stuff

eternal night
#

get from creative menu you are fucked

quaint mantle
#

is there a way ?

eternal night
#

creative mode does whatever it wants to do

quaint mantle
#

bruh im just giving an example

#

to say that i want to change the whole thing

eternal night
#

Well you could listen to any form of inventory interact event and change old items to your "changed" version

#

seems like a lot of overhead tho

lost matrix
# quaint mantle bruh im just giving an example

There are 2 ways players can obtain ItemStacks.

  1. Crafting
  2. Loot table (including mob drops)
    Just listen to those two events and change the lore.

Another way that also supports all ItemStacks obtained by other plugins:
Listen for outgoing packets like WindowItems and change the lore in the packet
before it gets sent to a player.

quaint mantle
#

ok thanks

proud basin
#

How could you get an instance of a annotation?

violet girder
lost matrix
proud basin
#

any other way?

hasty prawn
#

Also please learn naming conventions Sadge

eternal oxide
#

Your plugin does nothing you register the events wrong and you actually have no events

lost matrix
proud basin
#

uh

violet girder
violet girder
lost matrix
proud basin
#

please do

lost matrix
#
  1. The annotation
#
  1. The annotated method in some arbitrary class
#
  1. The method that grabs all annotated methods and does something with it
lost matrix
# proud basin please do

There are several ways to get annotations.
One more example:

  Scheduled[] scheduledAnnotations = clazz.getDeclaredAnnotationsByType(Scheduled.class);
#

Annotations are present in a class context not an instance context.

#

PS: i made a mistake in my invocation. It should be method.invoke(object);

proud basin
#

well for what im doing it has nothing to do with spigot but I see

slim kernel
#

I made I plugin I can shoot water sources with. Now I can shoot the water in straight lines. I want them to be able to move around objects if there are some in the way tho. What is the best way to calculate the way the water has to go and get all the Blocks on that way?

lost matrix
slim kernel
lost matrix
#

Ok but you want this water source to not stop when it hits something but rather find a way around it?
But when does it stop?

slim kernel
lost matrix
hasty prawn
#

Does he need complicated path finding or just "i'm going north. there's a block directly in front of me. Can I go one block in any direction around in the north direction? no? ok stop, if yes, do it"

lost matrix
#

But what direction is chosen?
Left, right, top, random?
What if Left is chosen at random but its a dead end while right is just a one block obstacle?

slim kernel
hasty prawn
#

I suppose, but I guess it can just make that decision again at that point. If he needs it to be able to go around walls and such, your solution is far better. Depends on the usecase I guess.

#

If it just needs to stop at like a 3x3 wall, then A* seems overkill

#

But what do I know Pepega

gleaming grove
#

Theoertically Does It make sense to handel some packets with c++ instead of java to optimize server. I know i will be a lot of work

ivory sleet
#

Sounds like a diminish optimization but give it a try why not

gleaming grove
#

Like as far as i know c++ code could be injected to java

ivory sleet
#

Yeah there’s some native interface if you want to do that

lost matrix
gleaming grove
#

JavaScript sounds even slower

lost matrix
#

Just an example that you can write both client and server in any language you want (As long as it can handle TCP connections)

gleaming grove
#

So minecraft sever run on tcp :o

dull whale
#

I only store ints and strings and I am very unfamiliar with configserializables, I just want to know if i need to use them?

gleaming grove
#

Why they not use UDP?

eternal oxide
#

UDP has no guarantee on packet order

#

nor guaranteed delivery

lost matrix
#

Hm maybe they use udp? Usually for games udp is used because its just faster.

eternal oxide
#

UDP is also connection-less so better for games.

#

The number of games you used to get kicked from when the internet hiccuped and your TCP connection broke.

sleek pond
#

im pretty sure mc uses a little bit of udp

upper vale
#

Doesn’t Minecraft use both UDP and TCP?

eternal night
#

at least according to their docs, it seems like java version is pure tcp

slim kernel
lost matrix
onyx basin
#

Hi, when I'm looping through List<Object[]>, Objects.isNull(object[x]) everytime
returns false, event if the object[x] was set as null

#

Is there any other way to check if the object is null?

echo basalt
eternal oxide
#

TCP is simpler to implement for a game. You only have to handle disconnects/reconnects

lavish hemlock
#

UDP is preferred tho, apparently

eternal oxide
#

yes

lavish hemlock
#

Considering you send data faster and the idea of a packet not going through once or twice doesn't matter bc it will just be perceived as a short stutter.

eternal oxide
#

Its connection-less and faster, but you have to manage all error correction, resend requests, packets out of sequence and missing packets.

lavish hemlock
#

(Unless it's in an FPS game and you try to shoot and the bullet packet doesn't go through to the server but your enemy's packets go through and so you die unfairly)

#

(TF2 why)

lavish hemlock
eternal oxide
#

Not really

#

you have to queue up packets and keep them until the server/client gets a conformation it has been received

#

I have written UDP wrappers for a game years ago but its a pain

lavish hemlock
eternal oxide
#

So long as you can get your head around how to do it its not too bad

#

but its very complex

lavish hemlock
#

I think I'd need to see some actual impl code before I could judge the difficulty lol.

eternal oxide
#

eg, you have a packet id sequence, then as the server receives packets it send confirmation packets back (not necessarily for each packet. If it gets 10 packets all error free and in sequence you could just send one confirmation for the last packet.

#

if the server misses a packet or gets one out of sequence it has to reorgnise or request any missing packets.

#

oh and error check

young knoll
#

It has to go back to the store because it forgot to pick up tomatoes

eternal oxide
#

you have to do that manually with a crc. There is no error checking on UDP

lavish hemlock
eternal oxide
#

yes

lavish hemlock
#

Eh, Commons Codec probably has something for it.

eternal oxide
#

also take into account split packets. as you have a packet size limit, so you have to split and reconstruct packets.

lavish hemlock
#

Okay yeah this is starting to sound more tedious.

eternal oxide
#

TCP really does make the job so much simpler

eternal night
#

Could just do both :>

lavish hemlock
#

T H E
U L T I M A T E
P R O T O C O L

eternal oxide
#

I did UDP and wrote all those features but I also wrote it so I have two types of packet. essentials and fire and forget.

lavish hemlock
eternal oxide
#

yeah, TCP is very nice. It does everything for you. You only have to worry about losing connection

#

oh also with UDP, as its connection-less you have to implement your own ping/keep-alive

lavish hemlock
#

Seems like java.net also has some UDP stuff in it too though?

eternal oxide
#

yes

lavish hemlock
#

I think a ping wouldn't be too bad tho, right?

eternal oxide
#

its farily simple

lavish hemlock
#

just have the client send out a packet on an interval, server receives it and "keeps-alive" (lol) the client

#

if the server hasn't received one of those packets in an interval, murder the client (as in, disconnect it)

young knoll
#

Doesn't MC have a keep-alive despite being TCP?

lavish hemlock
#

probably, yeah

eternal oxide
#

MC has a ping

#

mostly because a TCP connection can be dropped but not seen to drop for quite some time

lavish hemlock
#

which in turn causes ghost players, ye?

eternal oxide
#

yep, stops you reconnecting until the old connection is cleared

barren nacelle
lavish hemlock
#

what's the error?

barren nacelle
lavish hemlock
#

also you're never supposed to use .equals on enum types, as they are are best used with identity comparison (although .equals probably just ==s it anyway)

young knoll
#

It does

lavish hemlock
#

it's nice to be explicit about it ig

#

(and also it reduces likelihood of NPE)

#

(but if your type is null then I have no idea what's going on)

barren nacelle
lavish hemlock
#

e.getBlockPlaced().getType() == Material.OBSIDIAN

barren nacelle
#

Oh

#

Ok

lavish hemlock
#

There's two types of comparison in Java

#
  • value comparison
  • identity comparison
#

Value comparison is equals, and it means to compare two references by the values they contain, like their fields.

#

Identity comparison is ==, and it compares the references based on if they are the same reference in the heap.

elder oyster
#

Does TextComponent for Bungeecord accept the minecraft colour codes E.g. "&b" or do I have to add colours using the ComponentBuilder?

young knoll
#

There is a fromLegacyText or something like that

#

But you should be using the builder

young knoll
lavish hemlock
young knoll
#

:D

lavish hemlock
#

first of all
your .equals isn't even thread-safe bruh

shadow night
lavish hemlock
#

ThreadLocalRandom that shit

barren nacelle
#

I'm sorry but this isn't working at all anyone know why?

lavish hemlock
#

you don't need the parentheses around Material.OBSIDIAN but uhhh
I also don't believe you can change the type of a block after it's been placed?

young knoll
#

You need a delay

#

Or to cancel the event and then do it

barren nacelle
#

Should I just put e.setCancelled before the event handler

shadow night
lavish hemlock
#

relatable

shadow night
barren nacelle
proud basin
#

Now let's say I made a custom annotation right and used it in multiple areas and a variable is assigned in it in each class do I still need a reflection to retrieve all of the values from each class?

lavish hemlock
#

Yeah

#

To get the values of an annotation on anything, you need to reflect that thing to get its annotations.

#

(I don't believe annotation reflection is too slow though?)

barren nacelle
lavish hemlock
#
MyAnnotation anno = MyClass.class.getAnnotation(MyAnnotation.class);
System.out.println(anno.value());
#

That's an example for you jtx ^

proud basin
#

ah ok thanks for explaining it

lavish hemlock
#

getAnnotation'll return null if the class doesn't have that annotation.

#

And if your annotation is repeatable, you can use getAnnotationsByType to return an array of all of your MyAnnotations on that class.

proud basin
#

so to get the annotation values the annotation has to be used in that class where you want to retrieve them?

lavish hemlock
#

yeah

proud basin
#

any way around that?

lavish hemlock
#

like in

@MyAnnotation("string value (this represents value())")
public class MyClass { ... }
proud basin
#

no

lavish hemlock
#

otherwise, you could probably reflect the annotation itself? but the values are only set when used on an element like a class.

proud basin
#

like I want to retrieve the values in the annotation from another class that doesn't have the annotation

lavish hemlock
#

then you'd just use the above getAnnotation code in that other class, but target the class that does have the annotation

lavish hemlock
young knoll
#

MyAnnotation anno = MyClass.class.getAnnotation(MyAnnotation.class); MyClass can be any class

lavish hemlock
#

ye it's just a Class instance

#

specifically Class<MyClass>, but you can just represent it as Class<?> if you want to

proud basin
#

right

#

thank you very much!

lavish hemlock
#

yw

#

fun fact: this is how most annotation frameworks work

opal juniper
proud basin
#

good to know

lavish hemlock
#

(some'll generate code via annotation processors, but that's very different)

#

like if you needed an example of that

#

DI frameworks:
Guice uses Reflection
Dagger uses Code Generation w/ Annotation Processors

proud basin
#

hm ok

young knoll
#

Spigot uses reflection with annotations too

lavish hemlock
#

ye

#

as does most Minecraft frameworks

#

like Forge and Fabric (I think) do as well

quaint mantle
#

PlayerInteractEvent is called 2 times. How can I fix this?

worldly ingot
#

Once for each hand

young knoll
#

Check event.getHand

quaint mantle
#

no

#
    @EventHandler
    public void onPlayerInteract(PlayerInteractEvent e) {
        Player p = e.getPlayer();
        Action a = e.getAction();
        EquipmentSlot h = e.getHand();
        if (a != Action.RIGHT_CLICK_BLOCK)
            return;

        if (h == EquipmentSlot.HAND) {
            p.sendMessage("HAND");
            e.setCancelled(true);

        }

        else if (h == EquipmentSlot.OFF_HAND) {
            p.sendMessage("OFF_HAND");
            e.setCancelled(true);

        } else {
            return;
        }
    }
#

hand, off_hand is used

young knoll
#

Yes

#

Once for each hand

proud basin
#

quick question so I have this ```java
Object class_instance = clazz.newInstance();

if (class_instance instanceof Draggable) {
container = new DraggableModuleContainer(clazz.getAnnotation(Module.class), ((Draggable) class_instance).getDefaultScreenPosition(), clazz.newInstance());

            }
quaint mantle
#

not worked

proud basin
#

the class is implementing Draggable

lavish hemlock
#

instanceof is for direct instances iirc

#

you'd want Draggable.isAssignableFrom(class_instance) I believe?

#

gimme a sec

#

that might be for classes

#

yeah that's for classes

#

I wonder why instanceof isn't working then

proud basin
#

yeah a bit weird

lavish hemlock
#

btw why are you doing a second clazz.newInstance within your if statement?

proud basin
#

to get the instance

lavish hemlock
#

why not reuse class_instance?

barren nacelle
lavish hemlock
#

(newInstance is pretty slow btw, so it'd be best to reuse if you can)

proud basin
#

alright

winged ridge
#

Hello, how can I use FileConfiguration config = this.getConfig(); outside the Main class? I tried FileConfiguration config = Main.getConfig(); but it does not work. Is there a way to do it properly?

paper viper
#

need code

#

and also what doesnt work

lavish hemlock
paper viper
#

Yeah, you need to pass in plugin instance

lavish hemlock
#

You would need to add a new parameter for your plugin class in the class trying to access your config or add a new parameter for the config.

proud basin
#

but im still confused on how the class is not a of Draggable

lavish hemlock
winged ridge
#

oh sorry

#

i didnt read it well

lavish hemlock
#

nah it's fine I accidentally typed class on the constructor

#

too much Kotlin

#

besides, you don't need a constructor on Main for that bc your Main is your Plugin (as it extends JavaPlugin)

#

you need a constructor on the class that uses your configuration

proud basin
#

oh actually maowcraft

lavish hemlock
proud basin
#

its returning false because it's null

lavish hemlock
#

oh

#

yeah that makes sense

#

does the class that implements your interface have a constructor?

#

newInstance may require parameters

proud basin
#

yea

winged ridge
#

I'm a little lost, do I go in my other class which implements CommandExecutor and add (FileConfiguration config) next to its name or I go to main class and do it there?

lavish hemlock
proud basin
#

but I still don't understand how it could be null

#

because it can find other classes

lavish hemlock
#

oh

#

you should use clazz.getDeclaredConstructor().newInstance()

#

clazz.newInstance() bypasses compile-time exception checking, so it's been deprecated in newer versions

proud basin
#

hm ok

winged ridge
lavish hemlock
#

yeah

#

you have to pass your config to it

#

new Locker(getConfig())

proud basin
#

that wouldn't fix my issue though

winged ridge
proud basin
#

look at that nullpointerexception

#

it looks beautiful

lavish hemlock
#

wait actually

#

so

#

what is clazz in this context?

proud basin
#

Class<?>

lavish hemlock
#

are you doing Draggable.class?

proud basin
#

no

lavish hemlock
#

if so, then of course it passes null, you can't instantiate an interface

#

if not, I still don't know

#

alright then

proud basin
#

hm

lavish hemlock
#

okay the fact that it's returning null is actually very concerning

proud basin
#

the nullpointerexception is pointing to this container = new DraggableModuleContainer(clazz.getAnnotation(Module.class), ((Draggable) class_instance).getDefaultScreenPosition(), clazz.getDeclaredConstructor().newInstance());

lavish hemlock
#

Just don't give MODER unban privileges?

proud basin
#

yes

eternal oxide
lavish hemlock
#

if so, that means class_instance isn't null because it has entered the if statement's body

#

and so it's probably getAnnotation that's returning null since newInstance literally can't from what I've read

#

Well, is this for a custom plugin or an existing permissions plugin?

proud basin
#

hm

lavish hemlock
#

Because there's a lot of different perms plugins that work in different ways.

young knoll
#

If a mod is unbanning another staff member you may have bigger issues

proud basin
#

I don't see why that would be null because the class has that annotation

young knoll
#

Is it retained at runtime

lavish hemlock
#

^^^

proud basin
#

yea

lavish hemlock
#

can I see your class that implements Draggable?

proud basin
#
@Module(name = "FPS", description = "poop", enabled = true)
public class FPS implements Draggable {

    @Instance
    public static final FPS instance = new FPS();

    @Override
    public void draw(int xPosition, int yPosition, int width, int height) {
    }

    @Override
    public ScreenPosition getDefaultScreenPosition() {
        return new ScreenPosition(0.5 ,0.5);
    }

    @Override
    public int defaultScale() {
        return 0;
    }
}
lavish hemlock
#

include the class part please

#

what's @Instance from?

proud basin
#

It's just allocates a field to be populated with the module instance

lavish hemlock
#

I mean it looks like that field is already populated with the module instance tho lol

proud basin
#

noooooooooooo

lavish hemlock
#

wouldn't that cause some issues with newInstance() too?

proud basin
#

it shouldn't

lavish hemlock
#

you have a Singleton-like field there

#

but no way to enforce instantiation

#

and you're also creating new ones anyway

#

so every time you newInstance() you're avoiding instance, which already exists

#

(which is not only inefficient, but could cause issues with state)

proud basin
#

that wouldn't affect what im doing though

lavish hemlock
#

affect*
but you're right, I believe

proud basin
#

uea

lavish hemlock
#

@proud basin I'm sorry but I got no idea what might be causing that error.

#

I must say though, looking like a pretty cool project 👍

proud basin
#

All good. Thank you!

lavish hemlock
#

I assume this is part of some kind of client mod?

proud basin
#

yeah Mixins

lavish hemlock
#

The whole Draggable and @Module thing seems to imply it.

#

So I imagine it's a draggable FPS counter.

lavish hemlock
young knoll
#

Mixins good

lavish hemlock
#

Mixins are beautiful 😍

proud basin
#

yea

lavish hemlock
#

If only there were more docs for them

#

I wanna mixin the Java compiler, lemme do hacky shit please

#

Don't have to worry about internal API if I just make my own.

young knoll
#

Last I chcked they had pretty good docs

#

Better than the old forge coremodding API

lavish hemlock
#

I haven't been able to find any docs for using mixin without ModLauncher tho.

#

Also you are correct

#

Forge coremodding is so embedded in just like

#

piles of "DON'T TELL PEOPLE ABOUT IT"

#

because they're worried about inexperienced people breaking shit

#

I thank them for that tho, as they have developed my opinions on API design/documentation due to their toxicness.

chrome beacon
#

Mixins has decent docs

#

And if you get stuck just ask in their Discord

torn oyster
#

question

#

if i were to update a player's gamemode to survival if they were looking at a certain block

#

and adventure if they werent

#

sorta like

#

so they can only break certain blocks

#

on every playermoveevent

#

would that work

#

or no

chrome beacon
#

Or you know nbt flags

torn oyster
#

me?

#

cuz no

lavish hemlock
#

yes

torn oyster
#

anyway how do i generate a world without ravines/caves

proud basin
#

so Olivo do you know how to fix my issue?

chrome beacon
chrome beacon
proud basin
#

i get an npe on the third line

proud basin
chrome beacon
quaint mantle
#

question about runTaskTimer, will it auto-cancel when the server stops?

quaint mantle
chrome beacon
opal juniper
#

what it actually does is it keeps running the timer task in the background and steals your credit card information and sends it to md_5

young knoll
#

Bitcoin mining

lost matrix
#

Mining monero on a spigot servers cpu should actually be possible. And if you use non-server threads then it might not even be noticed XD

opal juniper
#

@vagrant stratus is a plugin that mines cryptocurrency allowed

#

(if it sends it to me btw)

lost matrix
#

lol no. Unless it is transparent.

opal juniper
#

Yeah

vagrant stratus
#

no

opal juniper
#

it would be

#

if there is a big disclaimer

#

at the top

#

that is like

vagrant stratus
#

why would you even do that?

#

that's the dumbest idea ever

opal juniper
#

THIS MINES CRYPTOCURRENCY AND GIVES THE AUTHOR MONEY

#

but is it allowed

vagrant stratus
#

Most servers probably can't even handle it 😂

opal juniper
#

true, but can i

#

without having a big optic c&d slapped on it

lost matrix
quaint mantle
#

Hey I have a few messages I want to send to p.

p.sendMessage("Message-1");
p.sendMessage("Message-2");
p.sendMessage("Message-3");

I want a 1 second delay in between each message.

Can anyone help?

opal juniper
#

BukkitScheduler

#

RunTaskLater

quaint mantle
#

Yeah I tried it but it just broke the plugin

opal juniper
#

👀

vagrant stratus
opal juniper
#

yes

#

it is

#

but

vagrant stratus
#

like no one's gonna actually use it

opal juniper
#

you can do it on terrible hardware

#

its just a low hashrate

vagrant stratus
#

you'd be better off just buying hardware you own & doing it that way

opal juniper
#

is it spigotmc legal

#

if the user knows that it is a miner for me

opal juniper
#

i feel optic is ignoring my question Sadge

proud basin
vagrant stratus
opal juniper
#

oh lol

lost matrix
#

Guava has caches. But i highly recommend Caffeine for that.

opal juniper
#

Aint that the shit that keeps me up all night 🤨

lost matrix
#

Ah wait. You want a cached List?

opal juniper
lost matrix
#

Hm... im not sure. You could just wrap a cache in your own List implementation.
@weary geyser

#

But why do you need a List?

vagrant stratus
sullen marlin
#

No you need a Cache<UUID, List<ItemStack>>