#help-development

1 messages · Page 332 of 1

brave sparrow
#

I understand that

#

The issue is your timer being redefined every run, you’ll need to keep a reference to the one that’s created on the first run

sterile token
#

oh ok

#

So what do you think its the issue?

rotund ravine
#

What is your “Execution.Period” set to?

sterile token
rotund ravine
#

That’s every 100 miliseconds

mystic terrace
#

?paste

undone axleBOT
mystic terrace
#

Hello! I have a problem with my plugin, I don't know why because I have actually the same code as my other plugin and It's not working.

Here's the error
https://paste.md-5.net/oyixeduduf.pl

Here's the code:

public class DeathBan implements Listener {

    private HardcoreDeaths plugin;

    public DeathBan(HardcoreDeaths plugin) {
        this.plugin = plugin;
    }

    @EventHandler
    public void onPlayerDeath(PlayerDeathEvent event){

        Player player = event.getEntity();
        FileConfiguration config = plugin.getConfig();

        String pathtp = "Config.Ban-On-Die";
        if (config.getString(pathtp).equals("true")){
            Bukkit.getBanList(BanList.Type.NAME).addBan(player.getName(), "§c¡HAS MUERTO!", (Date)null, "console");
            player.kickPlayer("§c¡HAS MUERTO!");
        }
    }
}
sterile token
mystic terrace
#

Ban-On-Die: true

#

should be working

#

I don't know why

#

It does, yes

desert loom
#

your path is Config.Ban-On-Die

so it has to be

Config:
 Ban-On-Die: true
mystic terrace
#

OH

#

IT'S TRUE

#

man I feel so dumb

#

thanks

sterile token
#

Im confused with many so many tasks

#

oh ok, good idea

#

But how would add them?

wicked remnant
#

pollFirst returns and removes, peekFirst only returns

sterile token
#

But it will only be 1 task

#

That why im really consued

#

No, only one will be

#

I mean it will be only 1 event

remote swallow
#

verano have you smoked wheel or drank any alcohol today

bright spire
#

Hello! How do I clone Spigot and compile it? I would like to make changes to the source code. :) Thanks!

remote swallow
#

?contribute too

remote swallow
#

last 2 are useful

bright spire
#

Does Spigot use some kind of Patch system?

#

Or is it just editing the Source code?

#

Nice. To edit it's "git rebase -i upstream/upstream" right?

#

Or is it base or something similar

#

Does it use Gradle or Maven?

remote swallow
#

clone the repo then you can just edit it on your computer

remote swallow
bright spire
#

Thanks guys!

#

Btw, if I happen to port all PaperMC or Purpur patches into the Spigot source, is this probably going to go well?

buoyant viper
#

well all paper patches are in purpur iirc, and all (most?) spigot patches are in paper

#

so u can just... use purpur

bright spire
#

It uses gradle

rotund ravine
#

Yes?

remote swallow
#

gradlew build be like

bright spire
#

I am having trouble getting it up and running on my PC

rotund ravine
#

There is a quickstart guide

remote swallow
#

if you use intellij, gradle is shipped with it

#

and you can build with gradle in ij

bright spire
#

I use VSCode, seems Gradle is broken with it. ./gradlew build overheats my computer and takes a lot of time to compile.

#

So for now I will port all purpur patches into the original Spigot source

buoyant viper
#

r u compiling on an original intel 8086 pc?

bright spire
#

I tried with a Ryzen 1700 in the past and rn I am using a 11400H from intel

rotund ravine
#

Think you are doing something very wrong then lol

bright spire
#

Yeah I might

regal scaffold
#

How can I block a player from running any commands except the ones I allow him to

regal scaffold
#

Mmmmm

remote swallow
#

command pre process event

bright spire
#

Listen to the command pre process event and check if the command equals the ones you allowed him

regal scaffold
#

Is that the best solution? I'm adding a spectator mode to my game and I want to prevent people from leaving or changing gamemodes or tping other players, etc

#

Alright preprocess it is

#

Thanks both

bright spire
#

So its safer

dire marsh
regal scaffold
#

wym

bright spire
#

GamemodeChangeEvent and others

rotund ravine
regal scaffold
#

But I legit need to block everything

bright spire
#

I dont think this is normal

regal scaffold
#

I think preproc is better no?

dire marsh
#

what cpu?

bright spire
#

11400H

rotund ravine
bright spire
regal scaffold
#

Really

#

Alright

bright spire
#

Yeah just in case

rotund ravine
#

Just do one.

meager wharf
#

has anyone here used structureblocklibapi?

i get this error

[16:37:10 ERROR]: Could not pass event ProjectileHitEvent to Plugin v1.0.0
java.lang.ExceptionInInitializerError: null

with this code

        StructureBlockLibApi.INSTANCE
                .loadStructure(Plugin.getPlugin())
                .at(location)
                .loadFromWorld("world", "me", "mushroom_5")
                .onException(e -> Plugin.getPlugin().getLogger().log(Level.SEVERE, "Failed to load structure.", e))
                .onResult(e -> Plugin.getPlugin().getLogger().log(Level.INFO, ChatColor.GREEN + "Loaded structure 'mushroom_5'."));
bright spire
#

And they get through it

#

You know this kind of aliases "gm" "gmc"

rotund ravine
bright spire
#

Oh right

regal scaffold
#

Gonna block legit all

#

And allow like 3

bright spire
rotund ravine
#

So if == the one he likes else if == the ond he likes else block

meager wharf
# bright spire Isnt there a bigger stacktrace?

yeah, just didnt think itd be helpful

[16:37:10 ERROR]: Could not pass event ProjectileHitEvent to Plugin v1.0.0
java.lang.ExceptionInInitializerError: null
        at me.fury.plugin.MushroomBowEvents.onProjectileHit(Plugin.java:69) ~[Plugin-1.19.3-R0.1-SNAPSHOT.jar:?]
        at com.destroystokyo.paper.event.executor.MethodHandleEventExecutor.execute(MethodHandleEventExecutor.java:40) ~[purpur-api-1.19.3-R0.1-SNAPSHOT.jar:?]
        at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[purpur-api-1.19.3-R0.1-SNAPSHOT.jar:git-Purpur-1897]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[purpur-api-1.19.3-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:680) ~[purpur-api-1.19.3-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_19_R2.event.CraftEventFactory.callProjectileHitEvent(CraftEventFactory.java:1452) ~[purpur-1.19.3.jar:git-Purpur-1897]
        at net.minecraft.world.entity.projectile.Projectile.preOnHit(Projectile.java:200) ~[?:?]
        at net.minecraft.world.entity.projectile.AbstractArrow.preOnHit(AbstractArrow.java:297) ~[?:?]
        at net.minecraft.world.entity.projectile.AbstractArrow.tick(AbstractArrow.java:233) ~[?:?]
        at net.minecraft.world.entity.projectile.Arrow.tick(Arrow.java:112) ~[?:?]
        at net.minecraft.server.level.ServerLevel.tickNonPassenger(ServerLevel.java:1294) ~[?:?]
        at net.minecraft.server.level.ServerLevel.lambda$tick$6(ServerLevel.java:755) ~[?:?]
        at net.minecraft.world.level.entity.EntityTickList.forEach(EntityTickList.java:42) ~[purpur-1.19.3.jar:git-Purpur-1897]
        at net.minecraft.server.level.ServerLevel.tick(ServerLevel.java:732) ~[?:?]
        at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1564) ~[purpur-1.19.3.jar:git-Purpur-1897]
        at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:482) ~[purpur-1.19.3.jar:git-Purpur-1897]
        at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1424) ~[purpur-1.19.3.jar:git-Purpur-1897]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1194) ~[purpur-1.19.3.jar:git-Purpur-1897]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:321) ~[purpur-1.19.3.jar:git-Purpur-1897]
        at java.lang.Thread.run(Thread.java:1589) ~[?:?]
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: com.github.shynixn.structureblocklib.bukkit.Main
        at com.github.shynixn.structureblocklib.api.bukkit.StructureBlockLib.<init>(StructureBlockLib.java:33) ~[Plugin-1.19.3-R0.1-SNAPSHOT.jar:?]
        at com.github.shynixn.structureblocklib.api.bukkit.StructureBlockLibApi.<clinit>(StructureBlockLibApi.java:16) ~[Plugin-1.19.3-R0.1-SNAPSHOT.jar:?]
        ... 20 more
Caused by: java.lang.ClassNotFoundException: com.github.shynixn.structureblocklib.bukkit.Main
        at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:179) ~[purpur-api-1.19.3-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:126) ~[purpur-api-1.19.3-R0.1-SNAPSHOT.jar:?]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[?:?]
        at java.lang.Class.forName0(Native Method) ~[?:?]
        at java.lang.Class.forName(Class.java:390) ~[?:?]
        at java.lang.Class.forName(Class.java:381) ~[?:?]
        at com.github.shynixn.structureblocklib.api.bukkit.StructureBlockLib.<init>(StructureBlockLib.java:26) ~[Plugin-1.19.3-R0.1-SNAPSHOT.jar:?]
        at com.github.shynixn.structureblocklib.api.bukkit.StructureBlockLibApi.<clinit>(StructureBlockLibApi.java:16) ~[Plugin-1.19.3-R0.1-SNAPSHOT.jar:?]
        ... 20 more
#

wait ill make a pastebin sorry

bright spire
#

Class not found

meager wharf
#

oh

bright spire
#

Something is missing

remote swallow
#

you need to shade structure block lib

meager wharf
#

yeah i thought i did

remote swallow
#

which jar do you use

meager wharf
#

i have this

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.4.1</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

and

        <dependency>
            <groupId>com.github.shynixn.structureblocklib</groupId>
            <artifactId>structureblocklib-bukkit-api</artifactId>
            <version>2.9.0</version>
            <scope>compile</scope>
        </dependency>
#

i didnt download any jars... i thought it downloads on its own?

remote swallow
#

how do you build, and which jar do you use

#

which jar = which jar in the target folder

regal scaffold
#

Hey so this gonna sound dumb but I'm trying to block commands using PlayerCommandPreprocessEvent only when a specific gamestate is activated

#

Should I put the event in the gamelogic file and check there? return if true

remote swallow
#

lmao

meager wharf
meager wharf
remote swallow
#

that would be ucorrect

#

incorrect

#

use the one with no additions to its name

#

Plugin-version-snapshot.jar

meager wharf
#

wait this is all done automatically, this is my pom.xml

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.3.1</version>
                <configuration>
                    <outputDirectory>/home/*/Code/plugins/server/plugins</outputDirectory>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.4.1</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>

how should i change it ?

remote swallow
#

one sec

#

@tender shard maven boy wake up

#

that looks correct from what i remember from maven

regal scaffold
meager wharf
# remote swallow Plugin-version-snapshot.jar

wait when i remove the config i get this
Replacing /home/*/IdeaProjects/Plugin/target/Plugin-1.19.3-R0.1-SNAPSHOT.jar with /home/*/IdeaProjects/Plugin/target/Plugin-1.19.3-R0.1-SNAPSHOT-shaded.jar

#

so theyre the same arent they ?

remote swallow
#

every time i used maven, using -shaded broke stuff

#

you might need to relocate

meager wharf
#

whats the point of the shaded plugin

#

i dont get a -shaded jar

remote swallow
#

maven is weird

karmic grove
#

hey so i was trying to do some stuff when lava and water forms cobblestone the forums said BlockFormEvent but that dont seem to be triggering is there another event?

tidal anchor
#

how do i set all of the Players health in a list in a for loop

remote swallow
#
for (Player player : Bukkit.getOnlinePlayers()) player.setHealth(20)
atomic swift
#

how to i drop an item by a location

gaunt relic
#

Hello so i have this plugin that makes water air when you right click it on PlayerInteractEvent, which event priority should i use for better compatibility with other plugins?

atomic swift
#

depends what plugins your talking about

gaunt relic
#

i want to publish my plugin and i want it to be as compatible as possible, if i change the block to air on monitor priority, would that cause any issues for other plugins listening to interact event?

remote swallow
dry yacht
gaunt relic
#

so if it should be executed last, do i use Highest?

dry yacht
gaunt relic
#

The events are fired from lowest to highest, monitor being the last to monitor the outcome of the event.

#

I think highest should be fine then, thanks

regal scaffold
#

How to override a vanilla crafting recipe and change it

#

Is the only way using nms?

vital bloom
#

Hey there, does anyone know how to bind an HTTP server to a server's IP? Kinda what Dynmap does

sullen marlin
#

Embed jetty or something

sullen marlin
idle loom
#

How can you test if someone's inventory contains an item with a specific NBT value?

remote swallow
#

nbtvalue on what

regal scaffold
#

I'm currently debugging

    public void activateDungeon(Player player) {
        new BukkitRunnable() {
            @Override
            public void run() {
                if (!isEnabled()) {
                    ChatManager.sendMessage(player, "This dungeon is not enabled!");
                    cancel();
                    return;
                }
                switch (state) {
                    case WAITING:
                        ChatManager.sendMessage(player, "The dungeon is waiting for players!");

                        setWorldBorder();
                        break;
                    case RESETTING:
                        ChatManager.sendMessage(player, "The dungeon is resetting!");
                        currentLevel = 1;
                        resetVariables();
                        state = State.WAITING;

                        break;

                }
            }
        }.runTaskTimer(plugin, 10, 10);
    }
``` but for some reason the state of the game is stuck on resetting. resetVariables() is void after defaulting 4 variables
regal scaffold
#

I m currently debugging

snow ember
#

Shading custom classes into .jar

unkempt peak
#

Does anyone know if the PlayerBedLeaveEvent is called if a player disconnects or is teleported to another world?

unkempt peak
#

I was just asking if anyone knew.. There is no reason to be rude

vast kelp
#

Not being rude, just a suggestion

unkempt peak
#

I will test it if nobody knows but I was asking to save time

tender shard
quick valve
#

How do I implement potion brewer? I've done everything but I can't figure out the input instantiation for RecipeChoice()

meager wharf
tender shard
meager wharf
#

anyhow do you know why it doesn't work ?

tender shard
#

what exactly doesnt work?

meager wharf
#

epic told me it was because it wasn't shaded

tender shard
#

yeah show your full pom please

#

did you set the scope of structure block lib to "compile"?

meager wharf
#

yeah

tender shard
#

and you do use maven to compile instead of Build Artifacts?

meager wharf
#

damn i cant upload files

remote swallow
#

?img

undone axleBOT
tender shard
#

!verify

undone axleBOT
#

Usage: !verify <forums username>

remote swallow
#

?paste

undone axleBOT
meager wharf
#

woah

tender shard
#

that looks good. open your .jar with winrar or similar and check if it includes the structure block lib

meager wharf
#

looks like it

tender shard
#

but it doesnt show the "bukkit" package

#

you got a link to their github?

quick valve
#

same with itemstack

tender shard
#

erm yeah

#

obv a RecipeChoice is not a Material, nor an ItemStack

quaint mantle
#

I wanna do something like this

remote swallow
#

that is not a book gui

quaint mantle
#

my brains slow

remote swallow
#

thats just chat messages

quaint mantle
#

ye but I got the command ready

#

I just want it to send a warning wait for a time period

#

and then delete the player profile

remote swallow
#

save the unix time it should be deleted

#

check how long until that time

#

convert that to hours

quaint mantle
#

any tuts?

gaunt relic
#
public void onSprint(PlayerToggleSprintEvent event) {
        if (event.isSprinting()) event.setCancelled(true);
}

Despite cancelling it, the player still sprints like nothing happened

chrome beacon
#

Player movement is client side so that's not always going to work and if it does there might be a delay where the player can sprint

obsidian lynx
#

Can i somehow clone the entity ?

tender shard
#

might work, might not work

distant ridge
#

can someone help me unregister a default bukkit command? the method i'm trying isn't working

    public void unregister(String commandName) {
        try {
            final Field field = getCommandMap().getClass().getSuperclass().getDeclaredField("knownCommands");
            field.setAccessible(true);
            final Object value = field.get(getCommandMap());
            field.setAccessible(false);
            final HashMap<K, Command> hashMap = (HashMap<K, Command>)value;
            final Command command = hashMap.remove(commandName);
            Methods.log("unregistered " + commandName);
        }
        catch (Throwable t) {
            t.printStackTrace();
        }
    }```
tender shard
#

whats the stacktrace

distant ridge
#

no error this time

#

it just doesn't do it

tender shard
#

hm then I have no idea

distant ridge
#
    public void register() {
        ReflectCommand cmd = new ReflectCommand(this.command);
        if (this.description != null) cmd.setDescription(this.description);
        if (this.alias != null) cmd.setAliases(this.alias);
        if (this.usage != null) cmd.setUsage(this.usage);
        if (this.permMessage != null) cmd.setPermissionMessage(this.permMessage);
        getCommandMap().register("EpicCore", cmd);
        cmd.setExecutor(this);
    }```

maybe there's a different way to register the command
distant ridge
#

oh my god

#

i figured it out i think

#

i forgot to include the command in modules.yml. so my plugin thought the command was disabled and didn't register it. it didn't matter if it was a base minecraft command or not fml

#

all that wasted time

tall dragon
#

it happens shrug haha

dull magnet
#

I want to know the code that resets the value and makes the stone disappear when the snowball hits the stone twice, but I couldn't find a way.

quaint mantle
#

?paste

undone axleBOT
jagged monolith
dull magnet
#

@jagged monolith I tried that method too, but I couldn't do it because I was a beginner.

quaint mantle
#

uhh can anyone help me with timed deleting of files?

jagged monolith
chrome beacon
#

?scheduling

undone axleBOT
jagged monolith
dull magnet
#

ok i will do it thank you

quaint mantle
#
}.runTaskLater(plugin, 20L * 30L);```
what does the 20L * 30L stand here for?
chrome beacon
#

20 ticks per second

#

20 * 30 = 30 seconds

quaint mantle
#

so if I wanna make it something like 15 hours

#

20 * 54000

#

right?

jagged monolith
#

Yes, that would be 15 hours.

#

20L = 20 tick = 1 Second

quaint mantle
#

hmm okay so heres the code!

#
@Override
    public void execute(CommandSender sender, String[] args, Skyblock plugin) {
        if (args.length != 1) { sendUsage(sender); return; }
 
        OfflinePlayer target = Bukkit.getOfflinePlayer(args[0]);
 
        if (target.isOnline()) ((Player) target).kickPlayer(ChatColor.RED + "Your account has been wiped!");
 
        File playerData = new File(Skyblock.getPlugin().getDataFolder() + File.separator + "players" + File.separator + target.getUniqueId() + ".yml");
 
        boolean success = IslandManager.deleteWorld(target.getUniqueId()) && playerData.delete();
 
        sender.sendMessage(success ? ChatColor.GREEN + "Successfully wiped " + target.getName() : ChatColor.RED + "Failed to wipe " + target.getName());
    }
``` right so where do I add the bukkit scheduler?
chrome beacon
#

You shouldn't use the com.skyblock package if you don't own that domain. Don't cast offline player to player, use getPlayer

#

as for the scheduler it depends on what you want

quaint mantle
#

hmm

#

oka

#

import java.io.File;

@Usage(usage = "/sb wipe <player>")
@Permission(permission = "skyblock.admin")
@Description(description = "Wipes a player's account")
public class WipeCommand implements Command {

    @Override public void execute (CommandSender sender, String[] args, Skyblock plugin) {
        if (args.length != 1) {
            sendUsage (sender);
            return;
        }
        OfflinePlayer target = Bukkit.getPlayer (args[0]);

        if (target.isOnline ())
            ((Player) target).sendMessage (ChatColor.WHITE + "[WARNING]" + ChatColor.RED + "Your Skyblock profile has been" + ChatColor.DARK_RED + "WIPED");

        new BukkitRunnable () {
            @Override public void run () {

                File playerData = new File (
                  Skyblock.getPlugin ().getDataFolder () + File.separator + "players" + File.separator + target.getUniqueId () + ".yml");

                boolean success =
                  IslandManager.deleteWorld (target.getUniqueId ()) && playerData.delete ();

                sender.sendMessage (success ? ChatColor.GREEN + "Successfully wiped " +
                  target.getName () : ChatColor.RED + "Failed to wipe " + target.getName ());
            }
        }.runTaskLater (plugin, 20L * 86400L);

    }
}
#

did I do this right?

jagged monolith
#

You're still casting an offline player to a player.

#

If the player is an OfflinePlayer you wouldn't be able to send messages to them.

quaint mantle
#

ohhhh

#

so I just do Player target = Bukkit.getPlayer

#

?

jagged monolith
#

Yes

quaint mantle
#

the rest is correct?

jagged monolith
#

(Player) target) you won't need the cast here as well

quaint mantle
#

why not?

jagged monolith
#

Player target = Bukkit.getPlayer because that's why

tender shard
jagged monolith
#

You're already setting the target to Player

tender shard
#

that looks so cursed

jagged monolith
#

Also, you're using a runnable, you should be using a scheduler instead

jagged monolith
quaint mantle
#

hmm

tender shard
#

it looks a bit like kotlin

quaint mantle
#
if (target.isOnline ())
            (target).sendMessage (ChatColor.WHITE + "[WARNING]" + ChatColor.RED + "Your Skyblock profile has been" + ChatColor.DARK_RED + "WIPED");```
#

correct?

jagged monolith
#

A little, but still having the spaces between class names and methods is hideous

quaint mantle
jagged monolith
quaint mantle
#

the bukkit runnable just needs to be BukkitScheduler

#

right?

jagged monolith
tender shard
quaint mantle
#

oh

tender shard
# quaint mantle correct?

no, Bukkit.getOnlinePlayer("name") returns null if the player is not online. that means you shouldnt call "isOnline()" but rather just check if it's null, as Omega already said

#

just use Bukkit.getPlayer(name) then check if it's null

#

if yes, shout something at the player who entered the command, e.g. "You fucking imbecile cannot even spell the target player's name correctly"

quaint mantle
#

im still fixing the scheduler thing

#

holdonnn

jagged monolith
#
Player target = Bukkit.getPlayer(args[0));
if (target == null) {
  // send sender message
  return;
}
// rest of code.
quaint mantle
#

hmm

#

still not able to figure out the bukkit scheduler

#
BukkitScheduler scheduler = Bukkit.getScheduler();
        scheduler.runTaskLater (plugin,() -> Skyblock.getPlugin ().getDataFolder () + File.separator + "players" + File.separator + target.getUniqueId() + ".yml"), 20L * 60L * 60L * 24L);
    }
}```
#
Cannot resolve method 'runTaskLater(Skyblock, <lambda expression>)'```
jagged monolith
#
BukkitScheduler scheduler = Bukkit.getScheduler();
scheduler.runTaskLater(plugin, () -> {
  // your code
}, 20L * 30L /*<-- the delay */);
#

You're missing a {

quaint mantle
#
  @Override public void execute (CommandSender sender, String[] args, Skyblock plugin) {
        if (args.length != 1) {
            sendUsage (sender);
            return;
        }
        Player target = Bukkit.getPlayer (args[0]);

        if (target == null) {
            return;
        }
            (target).sendMessage (ChatColor.WHITE + "[WARNING]" + ChatColor.RED + "Your Skyblock profile has been" + ChatColor.DARK_RED + "WIPED");

                BukkitScheduler scheduler = Bukkit.getScheduler();
        scheduler.runTaskLater(plugin, () -> {

            File playerData = new File (
              Skyblock.getPlugin ().getDataFolder () + File.separator + "players" + File.separator +
                target.getUniqueId () + ".yml");

            boolean success =
              IslandManager.deleteWorld (target.getUniqueId ()) && playerData.delete ();

            sender.sendMessage (success ? ChatColor.GREEN + "Successfully wiped " + target.getName () : ChatColor.RED + "Failed to wipe " + target.getName ());
        }, 20L * 86400L );

        }
    }
#

how about now is it correct?

#

yea

#

I know

wet breach
#

Lol 1 day

#

Such a time period is pointless to set if you restart your mc server daily lol

jagged monolith
#

An you say it has been deleted, but you don't delete it for a full 24hrs after you say that

quaint mantle
#

hey

#

does anyone know an easy library for sqlite in java?

#

i looked at jdbc but it seems too low level and it could be kind of a pain to write raw sql queries with that

#

something that maybe also provides an easy crud api for basic operations as well?

jagged monolith
#

HikariCP might be able to

quaint mantle
#

i was looking for ORMs in java

#

and it looks scary lol

#

so

#

this is the one recommended in the spigot tutorial itself

#

the webpage so low budget, and no syntax highlighting, its a bit scary to even look at.

wet breach
#

Idk was just pointing out that if you set a 1 day delay and then restart daily it will basically never run as that delay would get reset lol

wet breach
quaint mantle
#

ok any sort of high level sqlite libraries for java?

#

i have only really ever used nosql databases

#

i understand sql but these libraries look really complicated to me

wet breach
#

Mysql driver supports jdbc connections to sqlite. But literally the connection for sqlite is loading the file and having a file handle opened on it. Then you just do normal sql queries

quaint mantle
#

also, does jdbc take raw text sql queries only or does it have the option to parse in user input without sql injection?

wet breach
#

You can do prepared statements which takes input if you set it up properly

quaint mantle
#

i am kind of new to this

#

ok

#

nvm.

formal bear
#

Any idea why white color does not work on shulker boxes? XD All of the available, only white does not work

remote swallow
#

might be an mc limit

upper lark
#

Relative faces is this I thought

quaint mantle
#

oh

quaint mantle
#

no logs nothing

remote swallow
#

?paste the new method

undone axleBOT
buoyant viper
#

its only recommended that u do the reverse of a domain u own

#

not required

quaint mantle
remote swallow
buoyant viper
#

i do io.github.winnpixie :v

remote swallow
#

but you own winnpixie.xyz

tall dragon
#

since when do you own github

remote swallow
buoyant viper
#

oh god theres 2 epics

quaint mantle
tall dragon
#

i was here first

#

i swear

buoyant viper
quaint mantle
#

I like the first one better

buoyant viper
#

hell, Paper used to use that naming scheme

tall dragon
#

yeaa i know i was just messing about

remote swallow
tall dragon
#

github domain is fine iirc

buoyant viper
quaint mantle
buoyant viper
#

some people also do like me.username.thing or just username.thing

remote swallow
#

use getOfflinePlayer again, check if they are online then set a Player variable

buoyant viper
#

without necessarily owning a .me domain

tall dragon
#

yea i do me.epicgodmc.thing

remote swallow
#

i do me.epic.plugin

quaint mantle
#

oga

tall dragon
remote swallow
#

im more epic

#

because its just epic not anything else

tall dragon
#

i an epic god tho

#

cant rlly outdo that

remote swallow
#

oh fuck

#

boom

#

ur dead

#

im more epic

remote swallow
#

ill get the necrosword

quaint mantle
#

?paste

undone axleBOT
quaint mantle
#

dis?

remote swallow
#

no

quaint mantle
#

then?

remote swallow
#
OfflinePlayer target = Bukkit.getOfflinePlayer(args[0])
if (target.isOnline) {
    //code
    target.getPlayer().sendMessage()...
} else {
  return;
}
quaint mantle
#

u forgot the isOnline())

remote swallow
#

i typed that without an ide

#

i forgot about that

#

run you need the rest of your code on that top if statement

quaint mantle
#

everything clean

#

ohhh

#

that wont break the bukkit scheduler thing

#

right?

remote swallow
#

it wont

quaint mantle
#

coreect?

remote swallow
#

yeah\

quaint mantle
#

so this can happen once the player logs on the network and "x" time given in the scheduler has been reached?

remote swallow
#

i dont think it will check if they are online after the scheduler has been started

quaint mantle
#

oh

#

but once's it done it will send the success message?

remote swallow
#

if they are online yes

quaint mantle
#

ah

#

so once the player gets online and the 12 hours has passed it will send this to the player "[WARNING]" + ChatColor.RED + "Your Skyblock profile has been" + ChatColor.DARK_RED + "WIPED"); and once its done with the timer the success message appears in console? which is this (without the player being online)? ````"Successfully wiped " + target.getName () : ChatColor.RED + "Failed to wipe " + target.getName ());```

remote swallow
#

you would need to use logger to make it send to console too

quaint mantle
#

oh

#

so my assumption is right?

remote swallow
#

whats your assumption?

crystal palm
#

trying to make a randomizer system in config. basically, a command is executed every x ticks. would be something like this:
- eco give %player% %random:10-1000%
so, any number from 10 to 1000

#

any idea on how to pull this off?

remote swallow
quaint mantle
#

nice

remote swallow
#

get a random number between those 2

crystal palm
#

sure, but how'd i specifically get those two numbers from config?

haughty granite
#

hello, do you have any interesting plugins under intellij to code more intelligently with spigot?

quaint mantle
#

room gen!

remote swallow
crystal palm
#

ye figured it out

#

stackoverflow to the rescue

ivory sleet
#

Regex very nice

crystal palm
#

also a headache

ivory sleet
#

Well in ur case its barely gonna give you a headache

crystal palm
#

xd

ivory sleet
#

(:

crystal palm
#

on scale of 10 to 10, how inefficient is this?

#

and yes, i dont code a lot

crystal palm
#

that'd also yoink out the %random stuff

#

the splitter doesn't keep the split stuff.

ivory sleet
crystal palm
#

so true

#

but it works kekw

ivory sleet
#

var matcher = Pattern.compile("%random:(\\d+)-(\\d+)%").matcher("someString");
while (matcher.find()){
String firstNumber = matcher.group(1);
String secondNumber = matcher.group(2);
}

#

it wont be able to match extremely huge numbers

#

But doubt thats an issue

#

(And you could probably cache the pattern btw)

crystal palm
#

very nice

#

works like a charm. thanks a ton!

perhaps i should learn regex now

ivory sleet
#

Ye, its a bit counterintuitive at first, but it makes sense after some time

tardy delta
#

Matcher#group(n) returns the nth match right?

ivory sleet
#

Yes

#

or well, find() resets the group number since its a new match

tardy delta
#

hmm the only regex code ive ever used comes from stackoverflow

ivory sleet
#

🥲

#

In my experience stackoverflow had pretty bad regex solutions

tardy delta
#

good to know 💀

remote swallow
#

only regex i used is from alex

ivory sleet
#

For unknown reasons, some phenomena drives stackoverflow devs to always shove in random . in groups, and classes into their patterns

crystal palm
#

yes, but i dont wanna leave the %random stuff in there

#

bleh.

lavish hemlock
ivory sleet
#

Probably more than one

lavish hemlock
ivory sleet
#

But often havent I seen random .+

#

Ah thats also not java regex if im not mistaken

#

Or is it?

#

Ah nvm it is

sterile token
#

Lmao definitly spigot tasks are not what i expected tho, they are causing more issues than i can solve

#

For some fkg reason my code is joining an ifinite loop ceaused by the task

ivory sleet
#

BukkitScheduler?

lavish hemlock
#

Threads + infinite loop makes me think there's some kind of deadlock going on 🤔

tardy delta
#

skill issue

ivory sleet
#

Also sorta sounds like a pebkac issue 😅

tardy delta
#

a what

sterile token
ivory sleet
tardy delta
#

💀

#

something tells me you can just the time api instead of calendars

sterile token
#

And this the code

#

Im really confused because my task is being executed continuesly

lavish hemlock
#

Calendar is practically legacy

tardy delta
#

💀

sterile token
#

From wha i know about tasks they should be run once and then wait until the next execution. But im getting an inf loop

remote swallow
#

runtasktimer will run until you cancel it

lavish hemlock
remote swallow
#

on the interval of what you set

tardy delta
#

Stack uses a Vector :(

sterile token
lavish hemlock
remote swallow
tardy delta
#

no cue, i did my own FastStack

sterile token
tardy delta
#

then realised my algorithm was slow asf and then removed it

lavish hemlock
#

Fitting name /s

haughty granite
#

It can happen that sometimes the token is null, how can I avoid an error on the results.get() properly?

tardy delta
#

i removed all checks to make it the 3µs faster 💀

tardy delta
#

write some method

#

get() returns a JsonElement?

#

can probably return an empty one

lavish hemlock
#

I ended up writing an entire wrapper lib for that lib just to make it bearable to work with

haughty granite
#

the token is similar to a 6-digit sequence

ivory sleet
#

You can use JsonObject::has or check if JsonObject::get returns null Ig

tardy delta
#

getOrDefault(key, new JsonElement()) maybe

lavish hemlock
#
  1. I don't think you can create arbitrary elements
  2. I don't think there's a getOrDefault.
ivory sleet
#

Well maybe just JsonElement::isJsonNull

tardy delta
#

JsonObject is a Map<?, ?> no?

ivory sleet
#

If they mean the json value null

sterile token
ivory sleet
#

Its not simplejson

#

Gson

#

(:

tardy delta
#

no idea

#

i stopped using that crap

ivory sleet
#

Lol

#

Moshi or jackson best

tardy delta
#

had to write too much typeadapters to do simple stuff

lavish hemlock
#

(Agreed)

ivory sleet
#

Mye we need more map lookups /s

ivory sleet
#

How’s all of your projects you were going to write coming along

sterile token
haughty granite
#

is there anything better?

tardy delta
#

null check lol

ivory sleet
#

sylfaen

#

By null

#

Do you mean
{
key: null
}?

#

or do you mean that a particular value does not exist

#

Because gson treats those 2 cases differently

haughty granite
#

if it doesn't exist it must come out null

ivory sleet
#

Wat

#

No im asking you

#

What exactly are you referring to

sterile token
haughty granite
#

in what the "results" variable shows me, it is possible that "token" does not exist

ivory sleet
#

Ah okay

haughty granite
#

that's why the condition should be "null" if it doesn't exist

#

so instead of 0 I put null, and instead of "int" I put "String" ?

#
  • getAsString() ?
ivory sleet
#

I’d just say

sterile token
#

Conclure please bro i really need you im too much stressed. Im feeling really stupid because i have an inifinite loop caused by tasks

ivory sleet
#

var x = get("token")
if (x==null){
//does not exist such a key
}
x.getAsString();//else

sterile token
#

Want full code?

ivory sleet
#

Ugh, ye

#

Send it

sterile token
#

oh thanks because im really deperess with this shit

ivory sleet
#

Sounds depressing quite frankly

sterile token
#

I havent sleep in night

ivory sleet
#

Get some sleep then

#

Sleep is crucial

#

:|

sterile token
#

I sleep 4 hours, but still cannot understand the fkg infinite loop

#

Doesnt make sense

ivory sleet
#

Get sleep

#

Then fix problem

sterile token
#

no i need to fix it that why im aksing here

#

There you have conclure

ivory sleet
#

Im presumably no better than you

#

I will look at it once I get home

sterile token
#

oh ok, how much more or less?

ivory sleet
#

Idk

#

Soon probably tho

sterile token
#

perfect

ivory sleet
#

However I’m inclined to believe @tardy delta is far more proficient regarding debugging than me so maybe ask them

sterile token
#

well i will have to wait more time but i dont care if i fixe it

ivory sleet
#

😀

sterile token
#

oh right

#

@tardy delta i need your help for debugging pleasei having an ifinite loop with runTaskTimer()

karmic mural
#

I have a plugin that needs to remove items of a certain Material value from an inventory, but it needs to ignore custom items that have a matching material value... Is there a simple way to do this or do I need to make something myself?

remote swallow
#

loop over the inventory contents, if its your item continue, if not check it for what you want to remove then set the amount

karmic mural
#

Okay, that's what I was thinking, just wanted to make sure I wasn't missing anything. Thank you :)

frank kettle
#

where do i change the java version im compiling with?

remote swallow
#

maven?

frank kettle
#

my plugin is doing the error has been compiled by a more recent version of the Java Runtime (class file version 62.0), this version of the Java Runtime only recognizes class file versions up to 61.0. server is using java 17

dry forum
#

how would i add a command to the default / tabcomplete

remote swallow
#

register it like normal

frank kettle
#

i believe i changed something cause it was asking for me to update the java

frank kettle
dry forum
#

its not just a regular command

remote swallow
frank kettle
remote swallow
#

check the java version in ij project settings

sterile token
#

Because tha is what i need cuz the event should run every 24h at the specific config time

remote swallow
frank kettle
#

oh i see

#

this was automatically setup by intellij tho

#

and has been working before i changed to 18

remote swallow
#

our sdk level is probably 18 also

#

look at ur ij project settings and make sure the java ver and sdk level is also 17

sterile token
#

Zacken but why is the code being run all time? If the runTaskTimer() will only run the runnable once and wait until next delay time

#

Doesnt make sense 🤔

frank kettle
#

is it fine to use sdk 18?

#

or do i change this to 17?

remote swallow
#

yea

haughty granite
#

I do not send any message in my command and yet in my chat I have the message of the command I sent, any idea why?

remote swallow
#

if you run java 17 you need to use java 17 to compile with

remote swallow
#

so send them the usage of the command

frank kettle
#

so weird intellij doesnt tell me about that

remote swallow
#

it would error if it wasnt in plugin.yml

frank kettle
#

i mean it doesnt allow me to get higher than 3.2.4

haughty granite
frank kettle
#

even when refreshing maven

remote swallow
haughty granite
#

add what ?

remote swallow
#

return true if the command is correct

#

return false if its not correct

sterile token
haughty granite
remote swallow
#

yeah

remote swallow
#

so im no help lol

sterile token
#

But help bro

#

I fix this and i go to continue sleeping i wont be sending msg for like hours

haughty granite
frank kettle
#

it's still giving error @remote swallow @quaint mantle 🤔

#

Caused by: java.lang.UnsupportedClassVersionError: net/miau/survivalmc/Main has been compiled by a more recent version of the Java Runtime (class file version 62.0), this version of the Java Runtime only recognizes class file versions up to 61.0

remote swallow
#

also check that you arent using 2 different subversions of java 17

frank kettle
#

hm

#

i was using java 1.8 before and sdk 18 and it was workign fine

#

why to java 1.17 i need older sdk? 🤔

remote swallow
#

jre isnt distrubuted anymore, only jdk

frank kettle
#

well, the plugin works fine on my computer server, it's just the host is running on java 17

#

fcking hell

frank kettle
frank kettle
#

he says to donwload jre 18 and u say its not distributed

#

😂

remote swallow
#

?java17

undone axleBOT
frank kettle
#

what do i do?

remote swallow
#

if you need to run java17, download the java 17 jdk

frank kettle
#

ok i will do that

remote swallow
#

because the jre isnt distributed seperately, its shipped with the jdk

#

if his server is running java 17, like he said, he would need to compile with java 17

frank kettle
#

wtf

#

how do i install that

#

it downloaded a zip file

remote swallow
#

download the msi

frank kettle
#

🤔 do i put this inside a already made folder?

#

ah ok

#

im lost again

#

it was installing and then it closed and said nothing 😂

#

and nothing new here

#

still same error

#

anything else to fix this?

remote swallow
#

make sure you reload maven

#

that should fix your issues

frank kettle
#

always do it

#

didn't fix

#

nothing to update

remote swallow
#

how you building

frank kettle
#

wdym building?

remote swallow
#

compiling

#

make it become a jar

frank kettle
#

"install"

remote swallow
#

try using package instead

frank kettle
#

well

#

when i start any of that it says its using jdk 18 still

#

🤔

frank kettle
# frank kettle

for some reason openjdk 17 is "Oracle OpenJDK version 18.0.2"

#

🤔 wtf is going on

rotund ravine
#

you probably downloaded it wrong

frank kettle
#

there was no option even to make it wrong

#

i downloaded the msi and installed it

#

💀

#

i see where it is wrong

#

this shit installed it on a completely different folder, thats why i couldn't find it

#

usually java downloads to java folder, this downloaded to some "Eclipse Adoptium" new folder

#

oh wow

#

we can download java versions through intellij itself

#

this would have been way easier and right away to the correct folders/paths 💀

frank kettle
rotund ravine
frank kettle
rotund ravine
#

write java -version in command prompt

frank kettle
#

it's now the version 17 said before

frank kettle
rotund ravine
#

any where

frank kettle
#

my own computer 🤔

rotund ravine
#

K, delete the plugin and all the classes already compiled.

#

Do mvn clean package.

sage patio
#

is that possible to put same thing twice in a hashmap?

frank kettle
#

are u telling me to delete all of my plugin? 💀

rotund ravine
sage patio
#

ow thanks

rotund ravine
sage patio
#

so .put replaces the value everytime

remote swallow
#

yeah

rotund ravine
rotund ravine
frank kettle
#

is that it?

rotund ravine
#

sure

#

now run package

frank kettle
#

done

rotund ravine
#

Cause he's putting like 3 different way to do a cd together and trying to make it work.

remote swallow
#

what class name sounds better for handling pdc stuff on items, PDCHandler, PersistentDataHandler, PDHandler

rotund ravine
#

ItemDataManager

tardy delta
#

PersistentDataHandler

frank kettle
#

holy fuck

#

thanks a lot mate @rotund ravine

#

it works now

remote swallow
remote swallow
rotund ravine
tardy delta
#

might wanna refactor that code

rotund ravine
#

Told him to rewrite it fully.

sterile token
#

Yeah its a mess

#

Because i dont really have time and just need to fix it quickly

tardy delta
#

takes 20 min

sterile token
#

20m is you are experienced 🙃

rotund ravine
#

Nah, that was 5minutes.

haughty granite
#

Is it possible to use LuckPerms groups and permissions through another plugin?

remote swallow
#

with their api yes

frank kettle
#

is there a reason the player heads aren't working?

I'm using setOwningPlayer(Bukkit.getOfflinePlayer(name));

is there a different better way to do this? it was working fine in my test server 🤔

#

(they should be left arrow(MHF_ArrowLeft) and right arrow(MHF_ArrowRight))

#

oh wait, my test server was in online mode true, this is in false, is "setOwningPlayer" not working cause of that?

eternal night
#

offline-mode=false is genius

frank kettle
#

😔 some friends don't own minecraft, it's a private survival server

haughty granite
#

on maven, can we define a command prefix for all other commands already created and future?

frank kettle
#

is that the reason why it doesnt work? 🤔

remote swallow
hasty prawn
frank kettle
#

it's just that it works fine with the actual player head 🤔

#

im changing to setOwner even tho it's deprecated, will see

haughty granite
eternal night
#

the server prevents that on the method iirc

#

if you are not online or proxy online

frank kettle
#

oh damn, setOwner also doesnt work

remote swallow
frank kettle
#

so i can't use "outside" server player heads at all?

primal goblet
#

Yo guys, how to prevent the infinite water source? is there's any event?

haughty granite
chrome beacon
eternal night
#

or it shouldn't be able to fetch skins 😅

eternal night
#

SkinRestorer does that I presume

chrome beacon
haughty granite
eternal night
#

or whatever other plugin you abuse to allow pirating a game 🙃

remote swallow
#

i dont like doing reflection or touching spigot src

frank kettle
#

it's just one guy in like 40 😢

tardy delta
#

💀

chrome beacon
#

Then skip the skins

frank kettle
#

everyone else has the game

eternal night
#

that is tough

hasty prawn
#

Buy him an account

eternal night
#

maybe if you crowdfund with the other 40, you can afford them a copy

hasty prawn
#

easy

frank kettle
#

🤔 well yes but now we already started like this

#

wouldn't set to true online mode reset inventories and such?=

#

cause uuids change

eternal night
#

it indeed would

#

tho I believe tools exist to remap those files

frank kettle
#

also all of the database is using uuids(my plugin)

eternal night
#

cannot wait for a namechange to fuck that KEKW

frank kettle
#

so i kinda just left it like this since it's a private server anyways

quaint mantle
#

?paste

undone axleBOT
quaint mantle
#

any idea what this means?

eternal night
#

?1.8

undone axleBOT
eternal night
#

But beyond that, a null point exception

#

Line 95 in revanant horror

quaint mantle
#

oh right

#

forgot

tardy delta
frank kettle
tardy delta
#

 💀

buoyant viper
tardy delta
#

oh

primal goblet
#

Yo guys, how to prevent the infinite water source? is there's any event?

remote swallow
haughty granite
#

LuckPerms is installed in my dependencies, and yet I can't call it in onEnable(), do you know why?

tardy delta
#

out and err arent synchronized on eo

buoyant viper
buoyant viper
buoyant viper
haughty granite
haughty granite
#

thanks @buoyant viper @remote swallow

tardy delta
#

this is good enough

mystic terrace
#

How it's possible to display this without decimal numbers?

Location loc = new Location(world, (double) x, (double)y, (double)z);

Iterator var14 = Bukkit.getServer().getOnlinePlayers().iterator();
        while (var14.hasNext()) {
            Player players = (Player)var14.next();
            players.sendMessage("௳ " + ChatColor.RED + player.getName() + " ha muerto en " + ChatColor.WHITE  + loc.getX() + ", " + loc.getY() + ", " + loc.getZ());
            players.sendMessage();
        }
tardy delta
#

cast it to an int

#

or loc.getBlockX()

mystic terrace
#

actually tried int, I'm gonna try the second method

#

Works, tysm ^^

quaint mantle
#

?paste

undone axleBOT
tardy delta
#

when

quaint mantle
#

hi

#

so

#

i am trying to create a few tables in a sqlite database

#

but it is not making all the tables

#

it only creates the Players table and none of the other tables.

#

can somebody take a look?

tardy delta
#

are you sure there are no errors

quaint mantle
#

its not mysql, its sqlite

tardy delta
#

its the same principe, they dont use anything dependant on mysql

#

ig he works with chunk corners

dry yacht
haughty granite
#

any idea why the condition doesn't apply when I have the guest rank?

remote swallow
#

.equals for strings

haughty granite
remote swallow
#

sure

dry yacht
haughty granite
#

just primaryGroup.equalsIgnoreCase("guest") ?

tardy delta
#

"guest".equals(primaryGroup)

quaint mantle
haughty granite
tardy delta
#

if primaryGroup is null, your approach will throw a nullpointer ex.

dry yacht
haughty granite
quaint mantle
#

okay sorry. I don't really know how to read stacktraces and figure out errors with those, so, i just use Exception.getMessage().

undone axleBOT
tardy delta
#

thats the result of a toString

quaint mantle
#
    at org.sqlite.core.DB.newSQLException(DB.java:1135)
    at org.sqlite.core.DB.newSQLException(DB.java:1146)
    at org.sqlite.core.DB.throwex(DB.java:1106)
    at org.sqlite.core.NativeDB.prepare_utf8(Native Method)
    at org.sqlite.core.NativeDB.prepare(NativeDB.java:122)
    at org.sqlite.core.DB.prepare(DB.java:264)
    at org.sqlite.jdbc3.JDBC3Statement.lambda$execute$0(JDBC3Statement.java:51)
    at org.sqlite.jdbc3.JDBC3Statement.withConnectionTimeout(JDBC3Statement.java:454)
    at org.sqlite.jdbc3.JDBC3Statement.execute(JDBC3Statement.java:40)
    at org.example.Main$Database.executeStatement(Main.java:54)
    at org.example.Main$Database.createTables(Main.java:33)
    at org.example.Main$Database.<init>(Main.java:23)
    at org.example.Main.main(Main.java:12)```
#

alright there it is

#

and the source code is posted above

#

so

#

any idea what is going wrong?

dry yacht
quaint mantle
#

i am using sqlite not mysql

quaint mantle
dry yacht
tardy delta
#

not closing statements 🙏

#

and conn

brave sparrow
#

Not true

quaint mantle
#

sorry

tardy delta
#

hikaricp 🙏

brave sparrow
#

Some events are async, some are not

tardy delta
#

async ones are?

dry yacht
#

World-Events will never run async.

snow ember
quaint mantle
#

oh

#

thought they had different syntaxes.

dry yacht
quaint mantle
#

oh

#

okay

#

that took a while to debug but

#

i really appreciate the help!

grizzled oasis
#

Hi how can i create a placeholder that need a player name like %PLAYER_NAME_getLevel% and would look like "%test_getLevel%"

tardy delta
#

have you atleast tried smth?

dry yacht
# quaint mantle i really appreciate the help!

I hope that you understood what I was trying to explain about how you first need to declare all your columns with their datatypes and then, at the end of those declarations, specify foreign key constraints. Other than that, I'm happy to help! :)

grizzled oasis
peak cradle
#

Hi how can i Fix this Issue
sent out-of-order chat ?

dry yacht
peak cradle
#

wait send you Screen

tardy delta
#

man speaking google translate

peak cradle
ivory sleet
#

I mean if you run your code on some other thread that the server thread, then yes most events are gonna be invoked asynchronously in respect to where you run your code, but in general this is false regarding spigot

dry yacht
mystic terrace
#

I'm having errors in this, I'm trying to make that when a player dies it joins in a team but i don't know how to continue:

public class DeathBan implements Listener {
    private Scoreboard board;

    @EventHandler
    public void onPlayerDeath(PlayerDeathEvent event){

        Player player = event.getEntity();

        org.bukkit.scoreboard.Team muertos = board.getTeam("muertos");
        if (muertos == null) {
            muertos = board.registerNewTeam("muertos");
        }
        muertos.addEntry(player.getName());
}

error:https://hastebin.com/igaxanubem.properties

tardy delta
#

you never initlialize scoreboard

#

probably want Bukkit.getMainScoreBoard()

peak cradle
tardy delta
#

?img

undone axleBOT
mystic terrace
tardy delta
#

when you declare it

mystic terrace
#

im lost

tardy delta
#

oh its actually Bukkit.getScoreboardManager().getMainScoreboard()

dry yacht
peak cradle
#

Oh ok thx

mystic terrace
tardy delta
#

behind private Scoreboard board;

#

private Scoreboard board = Bukkit.getScoreboardManager().getMainScoreboard()

mystic terrace
#

Works perfectly, thanks!

#

And if I want to put a custom suffix and color what I should do?

tardy delta
#

Team#setSuffix

mystic terrace
#

It adds me to the team, but it doesn't put the color or the suffix

#
org.bukkit.scoreboard.Team team = board.getTeam("muertos");
        if (team == null) {
            team = board.registerNewTeam("muertos");
            team.setColor(ChatColor.RED);
            team.setSuffix(" ᧰");
        }
        team.addEntry(player.getName());;
tardy delta
#

add the stuff after the if

#

team probably existed, then you added suffix code

mystic terrace
#

okey, basically the team was created before, that's it, thanks mate

pulsar veldt
#

Anyone know anything about structure generation? I'm writing my own world gen plugin that generates mazes. I have the maze part down, and now I want to generate structures in the maze that are always at least ~100 blocks away from each other and that can only generate on flat surfaces. The flat surfaces part is pretty easy, and there are no problems there. I already know how to place structures into the world. But I'm stuck on the 100 block distance part because I don't know how to tell if a structure was already generated within the 100 blocks. Anyone know any clever techniques I can use?

coarse turret
#

I cant Run bungee with java 17, can anyone help me?

#

Cannot exec './start.sh': No such file or directory

pulsar veldt
coarse turret
#

Ubuntu 20.04

twilit roost
dry yacht
# pulsar veldt Anyone know anything about structure generation? I'm writing my own world gen pl...

That kinda reminded me of this video I watched recently: https://youtu.be/Ge3aKEmZcqY

Skip to 41:50. It basically was about generating random grass patterns with a minimal distance, and he talked about how he improved the algorithm even further. Maybe you can take some inspiration on that.

Kickstarter link: https://www.kickstarter.com/projects/annarettberg/meow-the-infinite-book-two

This was a presentation I gave to the University of Twente in early 2021. It's a case study of how simple, straightforward coding can turn several thousand lines of code and 10's of seconds of runtime into a few dozen lines of code and a sub-second ru...

▶ Play video
karmic grove
#

so i havae this code so when cobble generates when lava and water touch it does stuff i saw on forums to use blockformevent but it dont trigger is there another event for that?

    @EventHandler
    public void onBlockForm(BlockFormEvent event){
        logger.warning("0");
        System.out.println("real");
}```
tall dragon
#

did you register the event?

snow sluice
#

heyo, im trying to use minimessages in spigot and ive ended up doing this:

  private static final MiniMessage SERIALIZER1 = MiniMessage.builder()
      .tags(TagResolver.standard())
      .build();
  public static BaseComponent[] component(final String string) {
    return BungeeComponentSerializer.get().serialize(SERIALIZER1.deserialize(string));
  }```

is there a way to use the BaseComponent[] in something like `item.setDisplayName()`?
chrome beacon
#

Spigot doesn't have api for that

#

Paper does though

snow sluice
#

is there any workaround to allow that in spigot?

#

i was told to serialize it into legacy, would that still keep the click actions and stuff working?

chrome beacon
#

Click actions don't work on items?

snow sluice
rough drift
#
@EventHandler(ignoreCancelled = true)
public void onPlayerInteract(PlayerInteractEvent event) {
    if (event.getAction() == Action.PHYSICAL) return;

    System.out.println(event.getAction());
}
```Simple event handler, never fires if I right/left click air, even with items, it does fire if I right/left click blocks though, anyone got an idea why?
karmic grove
tall dragon
fathom quiver
#

why the hell dosent PlayerDeathEvent work?
it just dosent do anything when i die i also tried printing stuff and still nothing

    @EventHandler
    public void onPlayerDeath(PlayerDeathEvent e){

        e.setDeathMessage(ChatColor.BLUE + "You have died");
    }
}
tall dragon
#

diiiid you register the event?

fathom quiver
#

ye

tall dragon
#

are you sure? :S

#

there is not much else that could prevent this from working i think.

rough drift
fathom quiver
#

frickin hell i completely forgor

#

i thought i registered it

tardy delta
#

💀

rough drift
#

lol

fathom quiver
#

im just stupid

#

sorry

rough drift
#

It happens

#

dw

tall dragon
#

😄

vagrant stratus
#

Is there a way to get the player's skin without NMS or using the mojang api? 🤔

rough drift
#

nah

undone axleBOT
harsh badge
#

I’m using swm anyone know why I’m crashing when editing a world?

    for (int x = -mX; x <= mX; x++) {
        for (int y = -(mY - 1); y <= mY; y++) {
            for (int z = -mZ; z <= 3; mZ++) {
                Block block = loc.clone().subtract(x, -y, z).getBlock();
                block.setType(Material.AIR);
            }
        }
    }
vagrant stratus
#

Nice, I don't have to pull my hair out due to NMS or worry about rate limiting lmao

#

I got a dumb idea and I want to see how feasible it is kek

#

lol

tall dragon
#
    @EventHandler(priority = EventPriority.HIGHEST) // make sure other plugins/events have time to deny
    public void onLogin(AsyncPlayerPreLoginEvent e) {
        if (e.getLoginResult() == AsyncPlayerPreLoginEvent.Result.ALLOWED) {
            // if the join-cache already contains player's profile we just return
            if (this.joinCache.containsKey(e.getUniqueId())) return;

            CompletableFuture<UserProfile> future = this.loadProfile(e.getUniqueId());

            // blocking
            try {
                UserProfile userProfile = future.get();
                this.joinCache.put(userProfile.getUniqueId(), userProfile);
            } catch (ExecutionException | InterruptedException ex) {
                e.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER);
                e.setKickMessage(ChatColor.RED + "Sorry, We were unable to load your user data. Please contact staff with this error message");
            }
        }
    }

i have this code right here that loads a user's data when the player is logging in. and it blocks the thread untill his data is loaded. does anyone know if this will block anyone else from logging in. or will those simply be handled on a different thread each time?

tardy delta
#

no

tall dragon
#

yea i know that. its on purpose

#

will it block any other players from logging in?

tardy delta
#

no to it will not block anyone else

#

its handled in a threadpool

tall dragon
#

great

#

then this should be fine i think

tardy delta
#

just do CF::join()

#

instead of get

tall dragon
#

whats the dif

#

never used join

tardy delta
#

uh ig kinda the same thing but get throws some kind of checked exception

#

they both block

harsh badge
#

Yo anyone know about slimeworld plug-in

tall dragon
harsh badge
#

I’m crashing and idk why

tall dragon
tardy delta
#

actually use future::exceptionally to set a kickmessage

rough drift
harsh badge
#

Everytime I edit blocks in the slime world using code, the server freezes and crashes

harsh badge
#

When cages get destroyed

vagrant stratus
#

Just need to be able to get :p

rough drift
#

Reducing arrow gravity

tall dragon
harsh badge
tardy delta
#
void onLogin() {
  if (contains profile) return;
  CF<userPfofile> future = ...;
  future.thenAccept(profile -> cache.put(uuid, profile))
  .exceptionally(e -> event.setKickMessage(...))
  .join();
  
}```
#

or smth

tall dragon
#
    @EventHandler(priority = EventPriority.HIGHEST) // make sure other plugins/events have time to deny
    public void onLogin(AsyncPlayerPreLoginEvent e) {
        if (e.getLoginResult() == AsyncPlayerPreLoginEvent.Result.ALLOWED) {
            // if the join-cache already contains player's profile we just return
            if (this.joinCache.containsKey(e.getUniqueId())) return;

            CompletableFuture<UserProfile> future = this.loadProfile(e.getUniqueId());
            
            future.exceptionally(throwable -> {
                e.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER);
                e.setKickMessage(ChatColor.RED + "Sorry, We were unable to load your user data. Please contact staff with this error message");
                return null;
            });
            
            // blocking
            UserProfile profile = future.join();
            this.joinCache.put(profile.getUniqueId(), profile);
        }
    }

@tardy delta somethng like this ?

#

oh u can chain that ofc

tardy delta
#

smth like that ig

tall dragon
#

cool, i should rlly read up on CompletableFuture

#

so much cool stuff

tardy delta
#

i do it like

#

and got blocking and non blocking ways to load stuff

tall dragon
#

well my PlayerData wrapper contains an instance of Player, so to manage that well i just store the player in a login cache

#

and only create the full wrapper when he has actually logged in

tardy delta
#

might just want to listen to playerjoin event or any event that has a player instance available, get the player wrapper and place the player in or smth

carmine mica
tall dragon
#

that was my issue

tardy delta
#

wdym

tall dragon
#

well i cant disallow the join from playerjoinevent

#

and i cant kick either. would have to mess with weird delays

tardy delta
#

and why would you want to disallow?

tall dragon
#

when the data cant be loaded

tardy delta
#

just disallow in pre login

tall dragon
#

yea

#

that what i am doing

#

lmfao

robust light
#

is there a way to make a config.yml with materials?

tardy delta
#

wdym

#

saving Material#name or something?

robust light
#

yeah

#

like Material.DIRT

coarse turret
#

How can i execute a script in java 17?

pseudo hazel
tardy delta
#

save material.name() and retrieve it later on with Material.valueOf

#

or matchMaterial as fallback

pseudo hazel
#

and material.value_of(name) to load

#

oof

regal scaffold
#

Hey. I have a question above game states in a game.

Yesterday I had a big issue in which a state wasn't getting called and I noticed it was because of the function that was never recalled. I thought timeredtasks repeated themselves until cancelled but it seems like this task was canceling on return of the method above. What's the way around this?
https://discordapp.com/channels/690411863766466590/1068007825755869214

tardy delta
#

please use the scheduler instead of instantiating a bukkitrunnable