#help-development

1 messages · Page 2220 of 1

dark harness
#

Ok thanks!

quaint mantle
#

You may need to create all combinations and register the recipe

modest garnet
#

Hey all,

this is probably a message you will skim over.
However me and my mate have an amazing idea for a project
however we are in need of a developer.

if this is something you are interested in then the idea can be
further explained in DM

there is a slight catch. me and this mate are both students.
money is not the easiest to come by. however we are devoted to this server
and would love to have someone join the team. and once the server has launched etc
money that we receive we will aim to provide you with money worth your time (dependent on server growth)

any questions or possible discuses the offer please DM me

eternal oxide
#

?services

undone axleBOT
glossy venture
#

im working on a crafting engine where you can configure it to work with any skull, but its sort of broken rn

upper tendon
#

There a reason my server would use 50% of my CPU just having a player run around?

humble tulip
#

Check timings

upper tendon
#

ope ya

dark harness
elfin tusk
#

So I'm currently trying to get an advancement using this Bukkit.getAdvancement(NamespacedKey.fromString("advancement here")) and it only works with default minecraft advancements, not custom ones. Does anyone know a way to be able to make it work with custom ones as well?

modest garnet
dark harness
snow sluice
#

How do you set durability of players item?

#
                    ItemStack item = player.getInventory().getItemInMainHand();
                    Damageable meta = (Damageable) item.getItemMeta();
                    meta.setDamage(500);```
#

doesnt work

modest garnet
dark harness
#

no, that's wrong too D:

crisp steeple
elfin tusk
#

Would that make it work with both custom and default advancements, though?

modest garnet
#

java

crisp steeple
elfin tusk
#

okay

#

is there a way to make it work with both or no

dark harness
crisp steeple
brave sparrow
#

It’s the “amount” of the item you need

#

So 1 creeper head

#

Since that’s a shapeless recipe there is no “slot”

#

Not ‘1’, 1

ocean lion
#

?paste

undone axleBOT
modest garnet
ocean lion
brave sparrow
#

Because that’s not a method you made?

#

?learnjava

undone axleBOT
tardy delta
#

Rank.prefix.get(rank) + player.getName() 😵

ocean lion
#

I did make it

brave sparrow
#

Lol

brave sparrow
#

You need to learn Java before attempting this

ocean lion
#

Someones angry

tardy delta
#

lul

brave sparrow
#

I’m not angry 😂

modest garnet
tardy delta
#

calm down (╯°□°)╯︵ ┻━┻

brave sparrow
#

I’m just letting you know that you lack the required knowledge to make a plugin

#

And where to obtain said knowledge

tardy delta
#

meanie

brave sparrow
tardy delta
#

hehe

tall dragon
#

running into a very weird compilation error "cannot find symbol" however at the line described there are no problems whatsoever

#

any1 any idea what could be causing this?

brave sparrow
#

Show us the line

tall dragon
#

import me.epicgodmc.epicgens.compatibility.CompatibilityManager;

tardy delta
#

average tmux enjoyer

#

smh why is my 2nd screen on that

brave sparrow
elfin tusk
lost matrix
tall dragon
lost matrix
tall dragon
#

shoulnt it say "does not exist" then?

chrome beacon
#

Did you import a dependency from the jar directly with your IDE and then try to build with maven

lost matrix
tall dragon
#

its a module

kind hatch
#

Did you install the module?

tall dragon
#

well it gets auto installed

eternal oxide
#

is it configured in your pom as a module. Does it correctly have its own pom?

tall dragon
#

as my other module needs it

cunning shard
#

Hey for some reason when i added a cooldown thing to my taser plugin the cooldown doesn't work and the console goes nuts

tardy delta
#

show the code

#

and what does the console say?

cunning shard
#

import org.bukkit.entity.Player;

import java.util.HashMap;
import java.util.UUID;

public class Cooldown {

    public static HashMap<UUID, Double> cooldowns;

    public static void setCooldowns() {
        cooldowns = new HashMap<>();

    }

    //setCooldown
    public static void setCooldown(Player p, int seconds){
        double delay = System.currentTimeMillis() + (seconds*1000);
        cooldowns.put(p.getUniqueId(), delay);
    }
    //getCooldown
    public static int getCooldown(Player p){
        return Math.toIntExact(Math.round((cooldowns.get(p.getUniqueId()) - System.currentTimeMillis())/1000));
    }

    //checkCooldown
    public static boolean checkCooldown(Player p){
        if(!cooldowns.containsKey(p.getUniqueId()) || cooldowns.get(p.getUniqueId()) <= System.currentTimeMillis()){
            return true;
        }
        return false;
    }


}```
lost matrix
tardy delta
#

uhh looks like making it more difficult with static

cunning shard
#

huh

slim kernel
#

what is the best way to store a date in json?

lost matrix
lost matrix
tender shard
slim kernel
cunning shard
#

I am so confused

#

so it has to be private?

tender shard
cunning shard
#

everything else is fine?

tender shard
cunning shard
#

sounds about right

lost matrix
cunning shard
#

fuck how do i send images

tender shard
#

get verified

#

!verify

undone axleBOT
#

Usage: !verify <forums username>

cunning shard
#

i literally dont have an account

tender shard
#

then create one

cunning shard
#

fair enough

tender shard
#

😄

cunning shard
#

ight now i can send the error

tender shard
#

your "cooldowns" object is null

cunning shard
#

y tho?

tender shard
#

probably you never assigned any object to that field

#

idk, send your code

cunning shard
#

im so stoopid tf

dark harness
#

How can i check if a recipe is already added?

lost matrix
covert karma
# cunning shard

dont make a setCooldowns method just initialize it right at the top

cunning shard
#

oh like before anything else?

#

in the interact thingy?

glossy venture
#

yay generics

#

god damn

lost matrix
#

This is one way to do it when you want to use a higher level approach than raw millis.

public class Cooldown {

  private static final Instant ZERO = Instant.ofEpochMilli(0);
  private static final Map<UUID, Map<Object, Instant>> CD_MAP = new HashMap<>();

  public static <T> void setCooldown(Player player, T key, Duration duration) {
    CD_MAP.computeIfAbsent(player.getUniqueId(), k -> new HashMap<>()).put(key, Instant.now().plus(duration));
  }

  public static <T> boolean isCooldownDone(Player player, T key) {
    return Instant.now().isAfter(CD_MAP.computeIfAbsent(player.getUniqueId(), k -> new HashMap<>()).getOrDefault(key, ZERO));
  }

  public static <T> Duration getCooldownLeft(Player player, T key) {
    return Duration.between(CD_MAP.computeIfAbsent(player.getUniqueId(), k -> new HashMap<>()).getOrDefault(key, ZERO), Instant.now());
  }

}
cunning shard
#

to be fair i dont wanna make it too intricate or complicated

lost matrix
tardy delta
#

my EyEs kekw

glossy venture
#

im not very excited to implement all the methods tho

#

so i think ima leave it like this

cunning shard
lost matrix
tardy delta
#

i should be working with durations too instead of separate timeunits and longs

waxen plinth
glossy venture
#

ah yes

#

classic

lost matrix
cunning shard
#

i feel like an idiot for not understanding anything

lost matrix
#

But who in their right mind would use a List<String> as a primary key

waxen plinth
#

We all start somewhere

waxen plinth
covert karma
glossy venture
waxen plinth
#

Well, it was String[] but still

covert karma
#

Map<UUID, Double> cooldowns = new Hashmap<>();

lost matrix
tardy delta
#

primitive generics 🥺 🙏

cunning shard
tall dragon
#

no idea what that had to do with line 7

covert karma
tall dragon
#

mystery to me

cunning shard
true perch
#

Having an issue deleting a file using the java.io.File delete method. I'm able to read the contents of the File object, but when it comes to actually deleting that same object it does not work.

tardy delta
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

true perch
#

The file does not get deleted and I'm not sure why.

glossy venture
#

need to cast it to the raw type

lost matrix
glossy venture
#

i always use Path.of(...) does that matter

lost matrix
glossy venture
#

oh yeah lol

tardy delta
#

ye lol

ornate patio
humble tulip
#

I'd assume that get Dismounted would return the horse

tardy delta
#

im confused too

humble tulip
#

And getEntity returns player

covert karma
#

yea

#

wth are these names

humble tulip
#

For player and horse that is

covert karma
#

Entity what

humble tulip
#

There are other stuff

ornate patio
#

yeah lmao its confusing

#

thanks

humble tulip
#

They could've called it rider or something

covert karma
#

yeah like getVehicle and getRider

humble tulip
#

Or passenger

covert karma
#

ye

humble tulip
#

Since that's what it's called in spigot

#

event.getWhat

humble tulip
glossy venture
#

bruh how th do i get rid of these 0% classes ...

humble tulip
#

Wdym?

covert karma
#

what editor is that

glossy venture
#

intellij

west scarab
#
    @Override
    public boolean onCommand(CommandSender p, Command command, String label, String[] args) {
        if(command.getName().equalsIgnoreCase("pve")) {
            String prefix = getConfig().getString("messages.prefix");
            p.sendMessage(color(""));
            String world = getConfig().getString("spawn.player.world");
            Double x = getConfig().getDouble("spawn.player.x");
            Double y = getConfig().getDouble("spawn.player.y");
            Double z = getConfig().getDouble("spawn.player.z");
            Player player = Bukkit.getPlayerExact(p.getName());
            tp(player, world, x, y, z);
        }
        return true;
    }```
**why isn't my command working ingame? it doesn't show it exists..**

```yml
pve:
    aliases: pvtp```
covert karma
#

intellij theme?

glossy venture
glossy venture
#

idk

west scarab
#

how do i register a cmd?

glossy venture
#

with a background image

tardy delta
#

google it

glossy venture
#

with i believe either material or atom icons

covert karma
west scarab
#

i have that in the on enable but idk if that registers cmds

glossy venture
#

no

#

you need to define the command in the plugin.yml

humble tulip
tardy delta
#

getCommand(name).setExecutor(new ClassThatExtendsCommandExecutor())

golden turret
#

Help

glossy venture
#

and then set the code to run with plugin.getCommand(name).setExecutor(commandExecutor);

tardy delta
#

smh

glossy venture
#

where plugin is this in your main class

covert karma
#

you can also just use the onCommand method but make sure that you command is specified in your plugin.yml

tardy delta
#

¯_(ツ)_/¯

ornate patio
humble tulip
ornate patio
#

or wait

#

nvm its not

humble tulip
#

That's stupid

#

Oh great

covert karma
#

i guess its "what entity have you just dismounted" or something idk

tardy delta
covert karma
west scarab
#

waitt i fixed

limpid bronze
#

Hey, how I can calculate the number of times a Shapeless recipe can be crafted in my custom crafting gui?

cunning shard
#

i still get the same Caused by: java.lang.NullPointerException: Cannot invoke "java.util.HashMap.containsKey(Object)" because "me.saeko.taser_plugin.Cooldown.cooldowns" is null error for my cooldown thing

noble forge
#

I am getting this error when I run my maven build

error: invalid target release: 17.0.2

Module HAES SDK 17 is not compatible with the source version 17.

Upgrade Module SDK in project settings to 17 or higher. Open project settings.

Does anyone know what it could be?

limpid bronze
covert karma
#

wdym

tardy delta
cunning shard
#

I literally have no idea what that means im sorry

covert karma
#

i already sent the answer above

#

just do that

cunning shard
#

literally what i did

tardy delta
#

instead of static void initMap() { map = new HashMap }
just do Map<bla, bla> map = new Hahsmap() directly

glossy venture
limpid bronze
# covert karma wdym

Like if you can craft 5 netherite ingot with scrap and gold, when you shift click it give you all the 5 netherite ingot instead of clicking one by one

covert karma
#

thats just default behaviour

covert karma
limpid bronze
cunning shard
#

I have no idea

covert karma
#

remove the Cooldown map and instead initialize the cooldowns map

tardy delta
#

cuz you made them ¯_(ツ)_/¯

covert karma
glossy venture
#

yeah and then take the minimum from that

cunning shard
cunning shard
#

my fucking brain is on airplane mode

covert karma
#

private static Map<UUID, Double> cooldowns = new HashMap<>();

tardy delta
#

yes

#

and in my opinion you should make it a long, as youre using system.currentimemillis

glossy venture
# limpid bronze okay and?

then take amount items from every ingredient and set the result to the desired item with amount itemsPerCraft * amount

glossy venture
#

np

cunning shard
glossy venture
#

ah shit

#

worth a shot

thick scarab
#

How can I get active container window id from EntityPlayer?
In 1.16.5 I could use ((CraftPlayer)player).getHandle().activeContainer.windowId
But in 1.17 I can't found that field or method

Any ideas?

winter fog
#

How do I use 1.19 packets? This is not working right now:

        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot</artifactId>
            <version>1.19-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
humble tulip
#

Did u run buildtools?

#

Also do u use mojang mappings?

noble forge
west scarab
#

code that's causing error:

            String world = getConfig().getString("spawn.player.world");
            Double x = getConfig().getDouble("spawn.player.x");
            Double y = getConfig().getDouble("spawn.player.y");
            Double z = getConfig().getDouble("spawn.player.z");```

error:
```java
org.bukkit.command.CommandException: Unhandled exception executing command 'pve' in plugin PVE v1.0
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[patched_1.17.1.jar:git-Paper-411]
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159) ~[patched_1.17.1.jar:git-Paper-411]
    at org.bukkit.craftbukkit.v1_17_R1.CraftServer.dispatchCommand(CraftServer.java:869) ~[patched_1.17.1.jar:git-Paper-411]
    at net.minecraft.server.network.ServerGamePacketListenerImpl.handleCommand(ServerGamePacketListenerImpl.java:2262) ~[app:?]
    at net.minecraft.server.network.ServerGamePacketListenerImpl.handleChat(ServerGamePacketListenerImpl.java:2073) ~[app:?]
    at net.minecraft.server.network.ServerGamePacketListenerImpl.handleChat(ServerGamePacketListenerImpl.java:2054) ~[app:?]
    at net.minecraft.network.protocol.game.ServerboundChatPacket.handle(ServerboundChatPacket.java:46) ~[app:?]
    at net.minecraft.network.protocol.game.ServerboundChatPacket.a(ServerboundChatPacket.java:6) ~[app:?]
    at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$1(PacketUtils.java:56) ~[app:?]
    at net.minecraft.server.TickTask.run(TickTask.java:18) ~[patched_1.17.1.jar:git-Paper-411]
    at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:149) ~[app:?]
    at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:23) ~[app:?]
    at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1426) ~[patched_1.17.1.jar:git-Paper-411]
    at net.minecraft.server.MinecraftServer.executeTask(MinecraftServer.java:192) ~[patched_1.17.1.jar:git-Paper-411]
    at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:122) ~[app:?]
    at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1404) ~[patched_1.17.1.jar:git-Paper-411]
    at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1397) ~[patched_1.17.1.jar:git-Paper-411]
    at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:132) ~[app:?]
    at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1375) ~[patched_1.17.1.jar:git-Paper-411]
    at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1286) ~[patched_1.17.1.jar:git-Paper-411]
    at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319) ~[patched_1.17.1.jar:git-Paper-411]
    at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.IllegalArgumentException: Name cannot be null
    at org.apache.commons.lang.Validate.notNull(Validate.java:192) ~[patched_1.17.1.jar:git-Paper-411]
    at org.bukkit.craftbukkit.v1_17_R1.CraftServer.getWorld(CraftServer.java:1318) ~[patched_1.17.1.jar:git-Paper-411]
    at gardened.pve.tp(pve.java:64) ~[PVE-1.0.jar:?]
    at gardened.pve.onCommand(pve.java:58) ~[PVE-1.0.jar:?]
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[patched_1.17.1.jar:git-Paper-411]
    ... 21 more```
#

i don't get why im getting the error..?

humble tulip
west scarab
#

this is my config

spawn:
    - player: # where /pve will take the player
        - x: 100
        - y: 100
        - z: 100
        - world: "world"```
humble tulip
#

That cuz that's a list

#

Not a valid config path

#

Remove the -

#

Also the spacing on that looks weird

humble tulip
west scarab
#

this better?

#
spawn:
    - player: # where /pve will take the player
        x: 100
        y: 100
        z: 100
        world: "world"```
#

ok, worked

#

now im getting this though

#
[18:56:47 ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'pve' in plugin PVE v1.0
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[patched_1.17.1.jar:git-Paper-411]
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159) ~[patched_1.17.1.jar:git-Paper-411]
    at org.bukkit.craftbukkit.v1_17_R1.CraftServer.dispatchCommand(CraftServer.java:869) ~[patched_1.17.1.jar:git-Paper-411]
    at net.minecraft.server.network.ServerGamePacketListenerImpl.handleCommand(ServerGamePacketListenerImpl.java:2262) ~[app:?]
    at net.minecraft.server.network.ServerGamePacketListenerImpl.handleChat(ServerGamePacketListenerImpl.java:2073) ~[app:?]
    at net.minecraft.server.network.ServerGamePacketListenerImpl.handleChat(ServerGamePacketListenerImpl.java:2054) ~[app:?]
    at net.minecraft.network.protocol.game.ServerboundChatPacket.handle(ServerboundChatPacket.java:46) ~[app:?]
    at net.minecraft.network.protocol.game.ServerboundChatPacket.a(ServerboundChatPacket.java:6) ~[app:?]
    at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$1(PacketUtils.java:56) ~[app:?]
    at net.minecraft.server.TickTask.run(TickTask.java:18) ~[patched_1.17.1.jar:git-Paper-411]
    at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:149) ~[app:?]
    at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:23) ~[app:?]
    at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1426) ~[patched_1.17.1.jar:git-Paper-411]
    at net.minecraft.server.MinecraftServer.executeTask(MinecraftServer.java:192) ~[patched_1.17.1.jar:git-Paper-411]
    at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:122) ~[app:?]
    at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1404) ~[patched_1.17.1.jar:git-Paper-411]
    at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1397) ~[patched_1.17.1.jar:git-Paper-411]
    at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:132) ~[app:?]
    at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1375) ~[patched_1.17.1.jar:git-Paper-411]
    at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1286) ~[patched_1.17.1.jar:git-Paper-411]
    at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319) ~[patched_1.17.1.jar:git-Paper-411]
    at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.IllegalArgumentException: Name cannot be null
    at org.apache.commons.lang.Validate.notNull(Validate.java:192) ~[patched_1.17.1.jar:git-Paper-411]
    at org.bukkit.craftbukkit.v1_17_R1.CraftServer.getWorld(CraftServer.java:1318) ~[patched_1.17.1.jar:git-Paper-411]
    at gardened.pve.tp(pve.java:64) ~[PVE-1.0.jar:?]
    at gardened.pve.onCommand(pve.java:58) ~[PVE-1.0.jar:?]
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[patched_1.17.1.jar:git-Paper-411]
    ... 21 more```

```java
            tp(player, world, x, y, z);
``` is the line that's causing it
#

tp is defined here:

#
   private void tp(Player player, String world, Double x, Double y, Double z) {
        player.teleport(new Location(getServer().getWorld(world), x, y, z));
    }```
harsh totem
#

I have this: saveResource("data.json", false); in the main file
and I have the file data.json in the resource folder but when i load the plugin i get
java.io.FileNotFoundException: plugins\RaidsPlus\data.json (The system cannot find the file specified)
any ideas?

west scarab
#

@humble tulip any ideas?

#
spawn:
    player: # where /pve will take the player
        x: 100
        y: 100
        z: 100
        world: "world"```
is config now,
humble tulip
#

That'll work

harsh totem
humble tulip
#

Where do u load the json

tardy delta
#

just the code that does stuff with the file lol

humble tulip
#

Before u save it?

west scarab
pale egret
#

Im making a mc server on a vps should I have a panel

#

idk

#

i cant decide

#

it is complicated to make the panel

humble tulip
#

U can use screens

tardy delta
harsh totem
#

ok nvm i got it thx anyways

#

it worked before, idk why it didnt now

pale egret
winter fog
lost matrix
golden turret
#

Help me guys, I only need this to finish one of the systems on my plugin

lost matrix
#

Im suspecting that the metadata packet afterwards just respawns the armorstand for the player.

golden turret
#

I will try that

golden turret
lost matrix
golden turret
#

Yes, I tried for both PacketPlayOutSpawnEntityLiving and PacketPlayOutSpawnEntity but the PacketPlayOutSpawnEntityLiving is only fired for a creeper I have, the other is not even fired

modest garnet
#

Hey all,

this is probably a message you will skim over.
However me and my mate have an amazing idea for a project
however we are in need of a developer.

if this is something you are interested in then the idea can be
further explained in DM

there is a slight catch. me and this mate are both students.
money is not the easiest to come by. however we are devoted to this server
and would love to have someone join the team. and once the server has launched etc
money that we receive we will aim to provide you with money worth your time (dependent on server growth)

any questions or possible discuses the offer please DM me

lost matrix
undone axleBOT
golden turret
#

If I create a nms entity and create a Bukkit entity, can they have the same id?

pulsar vessel
#

can someone help me out rq

covert karma
pulsar vessel
#

well i have a network and for some reason this minecraft 1.8.8 server wont let me conntect through bungee

#

this is the error it throws when i try and connect

ocean lion
#

My groupmanager wont use the prefix provided in chat

#

its all just normal

quaint mantle
#

no

#
  1. its bungee 2. its 1.8 3. you pinged me while im minecrafting
covert karma
#

how to get discord helper role

ocean lion
#

u have to recreate all of hypixels plugins in under 1 hour

ocean lion
#

@covert karma

bold copper
#

Hello guru Spigot tell me how can I disable logging of some commands?

humble tulip
#

Playercommandpreprocessevent

#

Cancel it

#

Get the command from the commandmap

#

And pass the args to the execute method woth the sender as the player

#

You basically have to handle command execution yourself

#

Maybe there's a better way to do it but that's how i would

#

If it's your own command, you can use playercommandpreprocessevent as your command executor basically

quaint mantle
pulsar vessel
ornate patio
#

bump

tardy delta
covert karma
#

Map<UUID, Guild> ?

#

uuid being player uuid

#

store in a db or yml

west scarab
#

why isn't this working?

            player.teleport(new Location(getServer().getWorld("world"), 100.0, 100.0, 100.0));
#

tried that, still nope.

tardy delta
#

same thing

#

same thing lmao

night copper
#

How to make an item glow when a player is holding it but the glowing effect can only be seen by the player who's holding the item

#

ok

tardy delta
#

should be more a thing for admins only but its not really bad

#

i'd parse their input with some regex as people are idiots

#

what are you using it for actually?

bold copper
tardy delta
#

if you learn some basic sql it wont

humble tulip
#

If it's for another plugin, u can get the commandmap and knowncommands with reflection to call the method manually

echo basalt
#

^ modifying the command map only works during onEnable for some reason

humble tulip
#

He doesn't need to modify it

humble tulip
#

Maybe even before bukkit does its commad stuff

waxen plinth
#

because it's worked fine for me

echo basalt
#

I attempted to register a command after the first tick, and it simply didn't work

waxen plinth
#

how did you do that

#

because I have a plugin manager

#

it can load plugins at any time, and their commands register just fine

echo basalt
#

by accessing the commandmap and registering stuff after connecting to Db

waxen plinth
#

and they use my command framework which registers them through the command map

echo basalt
#

getCommand works, but messing with the commandmap is kinda icky

waxen plinth
#

the commands that will be sent as tab completions don't get updated automatically

#

you have to call something else, I forget what it is

#

but to my knowledge you can still register commands just fine after the first tick

echo basalt
#

Odd

waxen plinth
echo basalt
#

it would just not do anything in my case

waxen plinth
#

It's a private method syncCommands in CraftServer

echo basalt
#

Could be that

bold copper
#

Maybe someone knows what the team's color change is related to? No matter how much I searched, I couldn't find it

worldly ingot
bold copper
humble tulip
waxen plinth
#

Yes

humble tulip
#

I was having a problem with tab completions being oresent after removing and unregistering commands

#

I assume this fixes it?

waxen plinth
#

In 1.13+ it should

#

ConfigurationSection#getKeys(false)

#

Or change it to true if you want the entire config tree

#

Excluding map lists sadly

#

Curse you map lists, you make writing config libraries so difficult 😩

#

Look at the shit I had to do to get map lists working with my serialization lib

#

I had to make a wrapper that can wrap either a map, list, or config section to be able to read from and write to it from config

#

It's not like it was crazy difficult it's just that this shouldn't have been needed

#

All that's necessary is to make it possible to index lists with numbers

#

So:

#
thing:
- hi
- hello
- hey```
#

thing.0 = hi

#

thing.2 = hey

#

like it just makes sense

#

😢

#

Can you not just do getKeys(false) on the root?

#

YamlConfiguration is a ConfigurationSection

#

The hell

#

It 100% works

#

👍

minor otter
#

do persistent leaves still call any log check events?

waxen plinth
#

pretty sure

#

since a leaf that is player-placed and has a log placed or destroyed next to it will update observers

#

which is pretty funny lol

#

it's a form of instant redstone

#

a very powerful one actually

#

because it doesn't interact with any other redstone components except at the input and output

dark harness
#

Is the ´e.getChunk().setForceLoaded(true);´ function persistent after reload/restarts?

waxen plinth
#

reloads yes

#

restarts no

minor otter
#

so do you think I could use LeavesDecayEvent for persistent leaves?

waxen plinth
waxen plinth
#

because player-placed leaves do not decay

lost matrix
#

*If you want to make generated leaves non-decayable

minor otter
#

that's not what i'm trying to do but thanks for the tip

minor otter
sage patio
#

Hi, I've a custom sign shop works with Interact and SignChange event
When i made a shop with a sign like this
First line: [Buy]
My plugins gives that line a color
and when i'm cheking for that in InteractEvent is a switch case for sign's 1th line, does not work! (needs the chat color too for the check)
Buy, sell and many other type of shops have different colors, what should i do?

eternal oxide
lost matrix
sage patio
lost matrix
eternal oxide
#

but if you can't/don't want to do that you switch (ChatColor.stripColor(signtext))

echo basalt
#

sql

eternal oxide
#

If just on the local server sqlite

#

depends on the amount of data

lost matrix
#

Save it to a File or into a Database.

#

Its persisted independent from the host. Meaning multiple server instances/applications can access it.

waxen plinth
#

it can be indexed much more easily without loading it all into ram

lost matrix
#

Its easier to migrate your data. Queries are also a benefit. But all of that really only matters if you
expect thousands of players or several server instances.

eternal oxide
#

It all comes down to what data you want to store

woeful crescent
#

when my data plugin is disabled, it dumps records for all players.

#

when a player quits, their record is dumped.

#

many times when i stop the server, i get a concurrentmodificationexception.

#

any reason why?

lost matrix
#

because you concurrently modify a collection...

woeful crescent
#

?

lost matrix
#

Probably something like

for(Element element : elements) {
  elements.remove(element);
}

But we need more context.

eternal oxide
#

sqlite, just initialize teh driver

#

sql server, an installation

tardy delta
#

sqlite vs h2?

lost matrix
#

You mean programmatically interact with the DB or how to install a DB on your host.

woeful crescent
#

*imagine a really hard facepalm, so earthshattering that the ground probably just shook in your country*

lost matrix
woeful crescent
#

im making fallenmc

tardy delta
#

bruh what code is causing the error?

eternal oxide
#

the error will tell you where its happening

woeful crescent
#

no, i fixed it

west scarab
#

how do i register other classes?

eternal oxide
#

register?

tardy delta
#

what

lost matrix
west scarab
#

because everything i put in other classes just straight up wont work

tardy delta
#

anyone ever used the tmux config file?

#

having a mental breakdown cuz of that lmao

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

west scarab
#

ok so

eternal oxide
undone axleBOT
lost matrix
#

Im guessing you need to give yourself one or two weeks and learn the basics of java.

west scarab
#

i put somthing in a second class, no errors, just didn't work. I put it in the main class no errors and it worked but i want it seperated

eternal oxide
#

put what exactly?

west scarab
#

    @EventHandler
    public void clicker(PlayerInteractEvent event) {
        Player p = event.getPlayer();
        p.sendMessage("testing");
        Block block = event.getClickedBlock();
        String bl = block.toString();
        Material b = Material.matchMaterial(bl);
        Location l = event.getClickedBlock().getLocation();
        UUID u = event.getPlayer().getUniqueId();
        String path = returnPath(b);
        int upgrade = getConfig().getInt(path + "upgrade");
        int give = getConfig().getInt(path + "upgrade");
        if(b.equals(Material.WHITE_CONCRETE)) {
            p.sendMessage("" + give + upgrade);
        }

    }

    private String returnPath(Material b) {
        String path = "NaN";
        if(b.equals(Material.WHITE_CONCRETE)) {
            path = "clickers.clicker1.";
        }
        if(b.equals(Material.ORANGE_CONCRETE)) {
            path = "clickers.clicker1.";
        }
        if(b.equals(Material.MAGENTA_CONCRETE)) {
            path = "clickers.clicker1.";
        }
        if(b.equals(Material.LIGHT_BLUE_CONCRETE)) {
            path = "clickers.clicker1.";
        }
        if(b.equals(Material.YELLOW_CONCRETE)) {
            path = "clickers.clicker1.";
        }
        if(b.equals(Material.LIME_CONCRETE)) {
            path = "clickers.clicker1.";
        }
        if(b.equals(Material.PINK_CONCRETE)) {
            path = "clickers.clicker1.";
        }
        if(b.equals(Material.GRAY_CONCRETE)) {
            path = "clickers.clicker1.";
        }
        if(b.equals(Material.LIGHT_GRAY_CONCRETE)) {
            path = "clickers.clicker1.";
        }
        if(b.equals(Material.CYAN_CONCRETE)) {
            path = "clickers.clicker1.";
        }
        if(b.equals(Material.PURPLE_CONCRETE)) {
            path = "clickers.clicker1.";
        }
        if(b.equals(Material.BLUE_CONCRETE)) {
            path = "clickers.clicker1.";
        }
        if(b.equals(Material.BROWN_CONCRETE)) {
            path = "clickers.clicker1.";
        }
        if(b.equals(Material.GREEN_CONCRETE)) {
            path = "clickers.clicker1.";
        }
        if(b.equals(Material.RED_CONCRETE)) {
            path = "clickers.clicker1.";
        }
        if(b.equals(Material.BLACK_CONCRETE)) {
            path = "clickers.clicker1.";
        }
        return path;
    }


    public static HashMap<UUID, Integer> Balance = new HashMap();
    public static HashMap<UUID, Integer> Clicks = new HashMap();
#

that

#

yes i was using implements listener

echo basalt
#

oh god what the fuck

eternal oxide
west scarab
west scarab
lost matrix
eternal oxide
#

In your onEnable Bukkit.getPluginManager().registerEvents(new YourLiostenerClass(), this);

west scarab
#

yes

#
    public void onEnable() {
        Bukkit.getPluginManager().registerEvents(this, this);
        getConfig().options();
        saveDefaultConfig();
    }```
lost matrix
# west scarab yes
  @Override
  public void onEnable() {
    Bukkit.getPluginManager().registerEvents(new YourListener(), this);
  }
lost matrix
# west scarab yes

Do yourself a favour and check out some java basics tutorials. It will speed up your development big time.

eternal oxide
#

Delete getConfig().options(); it does nothing

eternal oxide
#

is that what you called your class?

lost matrix
#

Do yourself a favour and check out some java basics tutorials. It will speed up your development big time.

west scarab
eternal oxide
#

then new Clickers()

west scarab
#

ok

#

put it in the main class?

eternal oxide
#

using new Clickers()

tardy delta
#

im loosing my last braincells

eternal oxide
#

lost

west scarab
tardy delta
#

i lost my last braincells many times uwu

eternal oxide
#

Its ok no insult, we are just having fun at your expense 😄

lost matrix
eternal oxide
#

Or be prepared for lots of ?learnjava messages 🙂

#

Its never said with ill intent though

tardy delta
#

and its saturday

shy shadow
#

Hey guys, could we somehow use the StructureType in order to remove something ? I'd like to make an event that moves the stronghold to another location 🤔

eternal oxide
#

You can place a Structure, removing is unlikely

shy shadow
#

Do you have a tip on how to place it ? Can't seem to have a methode to create it ? 🤔
To remove it I could just look for certain blocs and remove them i guess

eternal oxide
sage patio
#

Can I run setTime() in a ASync runnable?

shy shadow
#

Oh yea my bad there is just a Structure interface lmao, I'm kinda noob with the doc, thanks a lot ! Have a great day/night 😄

eternal oxide
sage patio
#

ow ok, thanks

golden turret
#

How can I make the player not dismount the entity if he is spectating it?

eternal oxide
#

cancel the dismount event

golden turret
#

but he is on the spectator mode

eternal oxide
#

If he can dismount then the event will fire

lost matrix
#

Something something ping events

river oracle
#

^ sounds about right

formal bear
#
        at pl.botprzemek.handlers.JoinQuit.onPlayerJoin(JoinQuit.java:45) ~[?:?]```
#

how to get PlayerProfile?

#

for playerhead

eternal oxide
#

what version of Spigot is your server running?

formal bear
#

api 1.18

eternal oxide
#

update it

#

PlayerProfile was added in 1.18.2 I think

formal bear
#

hm i want to use it on 1.18+ so, do i need to use deprecated setOwner or?

eternal oxide
#

You just need to have your server running a new enough jar

formal bear
#

i want to run this on 1.18.1 jar

eternal oxide
#

then You can;t use PlayerProfile

humble tulip
#

Gotta use reflection and gameprofile

#

Get the nms player

eternal oxide
#

Don;t need nms player, just authlib

humble tulip
#

?paste

undone axleBOT
humble tulip
#

util class for skulls^

#

version independent

eternal oxide
#

you shoudl be able to pull it from teh Players gameprofile

dark harness
#

I'm trying to create a chunkloader that also spawns mobs.
With setForceLoaded(true); the Chunk keeps loaded but how can i get mobs to spawn there?

formal bear
humble tulip
#

Meaning it'll block the main thread causing lag

golden turret
#

How can I make the spectator's name not have a low opacity and italic style?

formal bear
humble tulip
formal bear
#

can i change api without any errors then? xDD

humble tulip
#

Wdym?

formal bear
#

to 1.18.2 from 1.18.1 to get PlayerProfile

#

and make it that way

humble tulip
#

U can't

#

It depends on the server version

humble tulip
#

To set the skull

#

It's version independent

#

Oroblem is it doesn't work with names

#

So u gotta get the texture code urself

formal bear
#

hm okay

#

tysm

humble tulip
#

That's pretty easy to do tbh just google it

#

Get texture async and set it sync

dark harness
#

How can i get mobs to spawn in a forceloaded chunk without a player?

formal bear
#

wdym texture ;D

humble tulip
#

One sec

#

like that

#

3866a889e51ca79c5d200ea6b5cfd0a655f32fea38b8138598c72fb200b97b9

#

or just that

#

or even the base64 of it

#

eyJ0aW1lc3RhbXAiOjE1ODM2ODg4ODAzMTcsInByb2ZpbGVJZCI6IjkxZjA0ZmU5MGYzNjQzYjU4ZjIwZTMzNzVmODZkMzllIiwicHJvZmlsZU5hbWUiOiJTdG9ybVN0b3JteSIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMjlhNWM4MGE3ZTUyZjc3MDc3MDE5ODNkMzFiOWRlMzU2YzJjNzBkYzE0NDEwNTIyMjlkOGJkMDQ1MDRiZmMxNSJ9fX0=

#

like this

ornate patio
#

bump 🪂

#

also quick java question

public class StatsMenu extends SubMenu {

    private ArrayList<Pane> panes = new ArrayList<Pane>();

If i do this will the panes array be the same for every object from this class or no

eternal oxide
#

only if you make it static

ornate patio
#

is it evaluated at run-time or every time when an object is created

desert loom
#

no it will be different for every instance of StatsMenu

ornate patio
#

ok good

#

because is python it does the opposite

humble tulip
#

i think the double is the speed

ornate patio
humble tulip
#

what happens?

ornate patio
#

literally nothing

#

horse is still innocent

uneven fiber
#

anyone know how to get the top half slab of a oak block?

#

or just top half slab in general

ornate patio
#

there was something wrong with maven

#

thanks

eternal oxide
ornate patio
#

i wanna be able to check if it wont "give up"

#

also sometimes the horse will find a new target halfway through

#

how do i prevent that

minor otter
#

what event is called when leaves change their distance value?

#

i've tried blockphysicsevent but it didnt work

ivory sleet
#

@ornate patio you need to make sure no goal is overriding with the navigation, also check if its stuck, then you might wanna try to re-invoke move to or sth

ornate patio
#

idk much about nms

ivory sleet
#

Explore it a little bit then? Read how mojang wrote their navigators, as well as goals

#

Smile gave you the hint, but in case you didn’t get it, ServerListPingEvent

humble tulip
ivory sleet
#

And look through the goals of said entity, there is a high plausibility they interfere with the navigation during normal occasions

#

Too bad

uneven fiber
ashen quest
#

print the string and check if it is over 30

eternal oxide
#

Color codes take 2 each

#

do a .getBytes() on the string and see how long that is

uneven fiber
#

Is it possible to cast itemstack to Slab?

#

If so how does one do this

ivory sleet
#

Nope it’s not possible

uneven fiber
#

What about a material

ivory sleet
#

No

uneven fiber
#

damn

#

so only block?

ivory sleet
#

No

uneven fiber
#

..

ivory sleet
#

get the block data of a block

#

And cast that to Slab

uneven fiber
#

got it

alpine coral
#

Is there a way to automatically update the server? As I'm going to be using the new paper 1.19 release I'd like to have future fixes be added on their own

#

or would I need to make a script running alongside the server to do that for me

#

and restart the server periodically

ivory sleet
#

You would have to… yes

alpine coral
#

ic

ivory sleet
#

Myeah I mean that’s the safest way to do it Ig

#

And then, ofc create some back ups every once in a while

waxen plinth
#

you really should not have that sort of thing done automatically

#

there could always be zero day exploits or breaking changes

#

and you would blindly update (if you'd consider something like this, no doubt you'd forego proper logging) and potentially break things and not really be able to know why

uneven fiber
#

Any ideas why?

eternal oxide
#

The block you are getting doesn;t seem to be a Slab

#

Perhaps is a sign?

uneven fiber
#

Hmm let me try something

subtle folio
#

am I going insane ```java
[02:10:55 ERROR]: Could not load 'plugins/Tazpvp.jar' in folder 'plugins'

org.bukkit.plugin.UnknownDependencyException: Unknown/missing dependency plugins: [ProtocolLib]. Please download and install these plugins to run 'Tazpvp'.

at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:286) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]

at org.bukkit.craftbukkit.v1_19_R1.CraftServer.loadPlugins(CraftServer.java:412) ~[paper-1.19.jar:git-Paper-8]

at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:278) ~[paper-1.19.jar:git-Paper-8]

at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1121) ~[paper-1.19.jar:git-Paper-8]

at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:302) ~[paper-1.19.jar:git-Paper-8]

at java.lang.Thread.run(Thread.java:833) ~[?:?]```
#

I removed protocollib from my pom.xml

kind hatch
#

You need to remove it from your plugin.yml as well.

subtle folio
#

smarttttt

kind hatch
#

Or change it to a softdepend

subtle folio
#

I forget about plugin.yml

subtle folio
#

Is there anyway to spawn/do the warden's attack

ornate patio
ornate patio
#

also how can i get the nms source code to use as a guide

drowsy helm
#

decompile server jar

ornate patio
#

how do i do that

drowsy helm
#

use something like jd gui

desert loom
#

IntelliJ/Eclipse have plugins (I think IntelliJ might have it built in?) to decompile code

#

I've used that in the past to look at nms and it worked pretty well

ornate patio
#

uh

#

i'm using vscode tho

desert loom
#

there's probably an extension for vscode as well somewhere

#

try searching in the extensions tab

drowsy helm
#

just use jd gui

#

its easy

desert loom
#

or that yeah

ornate patio
drowsy helm
#

no

#

its just a standalone jar

#

run it, drop the server jar in

ornate patio
#

alright

#

um

#

this is all thats in it

earnest forum
#

yeah because the jar doesnt contain the classes for development anymore

#

?bootstrap

undone axleBOT
#

Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.

Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163

ornate patio
earnest forum
#

build tools

ornate patio
#

i mean

#

I'm talking about original server jar

earnest forum
#

wait

#

you want nms classes?

ornate patio
#

yes

#

im trying to see the source code of nms

earnest forum
#

in the buildtools dir

#

there should be a jar that is generated which has nms and spigot api

#

it'll be under like spigot-server

ornate patio
#

oh wait

#

i figured it out

#

thanks

sterile token
#

Good nigh, im havin some troubles on my command api because on my custom Command class i need an instance of my plugin

#

But i cannot figure which is the best way to pass the instance

#

I need to pass an instance from a message api

uneven fiber
#

is there a way to get the relative face of the realtive face

#

^this is about blocks

river oracle
uneven fiber
#

how do you do this?

sterile token
#

Why the heck when im doing class#getMethodName() it showing the super class when the @Getter is set to some fields

#

Really weird

uneven fiber
#

hmmm i think im going insane

humble tulip
#

the relative face of the relative face?

uneven fiber
#

actually i figured it out just now 💪

#

stupid mistake

minor otter
#

how could I stop leaves from changing distance blockstate

humble tulip
#

Does anyone know about registering and unregistering commands via the commandmap?
I'm having a problem where if i unregister a command from the commandmap that had overwritten a mc command, and i try to execute the command, it says that it's not a command. I printed the contents of knownCommands and I could not see any minecraft commands there by default. I'm confused as to why simply unregistering the command doesnt allow the vanilla functionality to return

sterile token
# humble tulip Does anyone know about registering and unregistering commands via the commandmap...
public void register() {
        try {
            for (Command command : this.commands) {
                if (!this.getCommandMap().register(this.plugin.getName(), command)) return;
                command.unregister(this.getCommandMap());
                this.getCommandMap().register(this.plugin.getName(), command);
                this.plugin.getLogger().info("[Core] Registered " + this.commands.size() + " commands");
            }
        } catch (Exception ex) {
            this.plugin.getLogger().severe("[Core] Failed to register commands. Reason: " + ex.getMessage());
        }
    }

    public void unregister() {
        try {
            for (Command command : this.commands) {
                if (!this.getCommandMap().register(this.plugin.getName(), command)) return;
                command.unregister(this.getCommandMap());
                this.plugin.getLogger().info("[Core] Unregistered " + this.commands.size() + " commands");
            }
        } catch (Exception ex) {
            this.plugin.getLogger().severe("[Core] Failed to unregister commands. Reason: " + ex.getMessage());
        }
    }


CommandMap getCommandMap() throws Exception {
        Field field = this.plugin.getServer().getClass().getDeclaredField("commandMap");
        field.setAccessible(true);
        return (CommandMap) field.get(this.plugin.getServer());```
humble tulip
sterile token
#

Oh minecraft command?

humble tulip
#

tried printing the contents of knownCommands but it's not there

sterile token
#

I never unregistered a minecraft command

humble tulip
#

you dont have to

#

it overwrites it iirc

sterile token
#

Oh ok

#

I didnt know

alpine coral
#

Is there a way to mass modify player NBT data?

#

I'd like to set all the players positions back to spawn

#

And so far

#

going through one by one

#

is gonna drive me mad

humble tulip
#

are u doing it for a plugin or just wanna do it as a one time thing

alpine coral
#

One time thing

humble tulip
#

ah

#

are u a dev?

alpine coral
#

I can write up a script but if there's a tool already out there for it I'd rather do that

humble tulip
#

it's best u write a script

alpine coral
#

also I'm not sure how I would go about read/writing to it

humble tulip
#

might take as long as finding a plugin

#

it's pretty easy

alpine coral
#

as you can't even view it in visual studio code without an extension

humble tulip
#

want me to write something for u?

sterile token
#

Ima be wrong but intellij is shity today for me

alpine coral
#

thanks

humble tulip
sterile token
#

minion?

humble tulip
#

ye?

sterile token
#

Do you have any idea?

alpine coral
#

I mean its a fresh server atm so you'd be nuking a desert in equivalent

humble tulip
alpine coral
#

lol

sterile token
humble tulip
#

then idk

#

thought it was some weird thing

#

with java version in intellij being like version 7

#

that happens to me randomly

sterile token
#

Im uisng 17

#

Not Java 7

paper viper
#

Is there a way to cancel certain advancements from occurring?

sterile token
paper viper
#

The advancement done event doesn’t have a setCancelled option

sterile token
#

Goodbye loves see you soon

humble tulip
alpine coral
#

yea

humble tulip
alpine coral
#

damn

ornate patio
#

more of a math question here

#

I'm looking at the NMS source code and I found the functions used to randomly generate horse speed, jump strength, and max health

#

why is this so weird though

#

and is it any different than what i have:

sinful willow
#

Is there a way to have custom blocks use custom textures kinda like how the wooden hoe trick works?

river oracle
#

it can take a bit to get everything going smoothly but its fun to screw around with that stuff

ornate patio
#

wtf is "RunAroundLikeCrazyGoal" lmao

sinful willow
#

would I just do the same trick as the wooden hoe or what? I'm not really sure how it'd work since blocks don't have durability in the way that tools do

river oracle
#

what version are you using

loud junco
sinful willow
ornate patio
loud junco
#

🤷‍♂️

river oracle
#

Use ItemMeta#setCustomModelData

#

it takes in an integer and can be linked to resource packs

#

now you can have players use there tools like normal

#

instead of throwing away tools for an arbitrary purpose

sinful willow
river oracle
# sinful willow I had been looking at this forum post: https://www.spigotmc.org/wiki/custom-item...
crisp steeple
humble tulip
#

think of it like this

#

if u roll 2 6 sided die, the probability of outcomes is different to rolling one 12 sided

ornate patio
#

oh yeah i see

#

ima just copy paste the code from NMS then

humble tulip
#

they probably wanted some kinda variance

ornate patio
#

normal distribution?

humble tulip
#

where it's unlikely to get a fast or slow horse

#

that's not a normal distribution

ornate patio
#

roughly normal

#

i guess

humble tulip
#

yeah it's bell sahped for sure tho

#

doubt it's normal

tawny otter
#

for my Bungeecord Plugin
I got a purgatory list with many player uuids, any player that join the server whos on the list will be sent to the purgatory server
what would be the proper way of doing this

humble tulip
#

how large is the list?

tawny otter
#

should that matter?

humble tulip
#

well if it's a few players maybe store em in a file which you load on enable

#

and cache to a map/set

#

so u can check

#

if it's a lot of players, use a database and check the database when they join

river oracle
#

idk if its even necessary to cache if your immediatly redirecting them too be completely honest

tawny otter
#

Im more asking HOW I could send them to the purgatory server, not how I could check if they are in the list

humble tulip
humble tulip
tawny otter
#

just player.connect?

humble tulip
#

yep

tawny otter
#

hmm, what join/login event can I use this in?

humble tulip
#

i think a few login events dont work

tawny otter
#

maybe the PostLoginEvent?

humble tulip
#

yeah try that

harsh totem
#

I have a JSONObject and when I write it to a json file it's all in one line.
is there a way to make each key and value in a separate line?

humble tulip
#

something with pretty

tawny otter
#

I was hoping I could re-route them before they joined the main lobby, like telling them to join the purgatory server in the first place

humble tulip
#

are u using gson?

humble tulip
tawny otter
#

I see

humble tulip
#

but after they login

tawny otter
#

alrighty, imma try that

harsh totem
humble tulip
#

may i ask why not gson?

river oracle
harsh totem
humble tulip
#

isnt gson also in spigot by defualt?

harsh totem
#

it is

river oracle
#

alternatively if you're quirky you could use jackson

river oracle
harsh totem
#

why switch?

humble tulip
#

Better json lib

#

No additional dependencies?

harsh totem
#

well i'll just backup my project and then try

humble tulip
#

Shouldn't be hard to swtich at all

harsh totem
#

wait but i have this private static JSONObject obj;.
what would it be in gson?

#

JSONObject is in json.simple

river oracle
#

do you have a static constructor?

harsh totem
#

it says 'JsonParser()' is deprecated

#

why?

#

what should i use instead?

river oracle
#

does it say why its deprecated

#

in the javadoc

harsh totem
#

No need to instantiate this class, use the static methods instead.

#

what does this mean

river oracle
#

found this in hte java doc

humble tulip
#

JsonObject convertedObject = new Gson().fromJson(json, JsonObject.class);

#

u can probably also do ^

humble tulip
river oracle
#

they changed to a static builder design

harsh totem
#

and in here file.write(obj.toJsonString());
how do I write this obj to the json file?
i have this also Gson gson = new GsonBuilder().setPrettyPrinting().create();

humble tulip
#

gson.toString maybe

#

I forgot

#

Haven't used anything with json in a while

#

Or maybe toJSonString

harsh totem
#

ok i got it

#

how do I get a JsonElement of an integer?

#

(the integer is not in the json file)

minor otter
#

anyone here know how I may be able to stop leaf blocks from updating the "Distance" blockstate?

quaint mantle
#

for what reason 🧐

minor otter
#

to stop the distance blockstate from updating 😂

#

nah but fr so I can add custom leaves

#

you can use blockstates to add models for specific distance blockstates on leaves

quaint mantle
#

makes sense

minor otter
#

sadly you can't just cancel blockphysics

quaint mantle
#

i guess whenever a leaves block decays

#

you can iterate the leaves attached

#

resetting them to their initial value

#

tho

#

i highly doubt this is efficient in large quanitites

minor otter
#

the value doesnt just change when a leaf block decays

#

and I feel it wouldn't be efficient to search through every leaf block everytime a player places any log near them

#

I tried searching online but I wasn't able to find anything

#

apparently not a common issue. 😅

harsh totem
#

it says I can't do JsonObject.add(String, int) because obj is null (has nothing in it).
how am I supposed to add anything to it?

tawny otter
#

Error

Error dispatching event PostLoginEvent(player=Teleputer) to listener me.teleputer.purgatory.listeners.PostLogin@7ca33c24
java.lang.NullPointerException: Cannot read field "configuration" because "this.plugin" is null

in PostLogin.java

    private Purgatory plugin = Purgatory.getInstance();
    @EventHandler
    public void postLoginEvent(PostLoginEvent event){
        ProxiedPlayer player = event.getPlayer();
        System.out.println(plugin.configuration.contains("Purgatory."+String.valueOf(player.getUniqueId())));
    }

and in Purgatory.java

  
    private static Purgatory instance;

    public static Purgatory getInstance() {
        return instance;
    }

    private static void setInstance(Purgatory instance) {
        Purgatory.instance = instance;
    }
#

I dont know why, but plugin is Null in PostLogin

proper notch
#

PostLogin is initialised before your instance variable is set.

You should avoid abusing static like this and follow a dependency injection structure.

tawny otter
#

just following a tutor

river oracle
#

?di

undone axleBOT
tawny otter
#

so I pass the plugin in the registerListener?

#
getProxy().getPluginManager().registerListener(this, new PostLogin(this));

and

private Purgatory plugin;

public PostLogin(Purgatory plugin) {
    this.plugin = plugin;
}
#

like so?

river oracle
#

you should pass most things like this excluding utility classes

tawny otter
#

neat, thanks = )

#

works on the first time, nice

river oracle
# tawny otter works on the first time, nice

little hint with DI is when making Util classes that require a JavaPlugin param you can actually pass in the generic JavaPlugin versus your instance Purgatory which will make your utils much more portable

#

this works because of polymorphism and is just a neat tip you should know

desert loom
harsh totem
proper notch
#

Can you show your code please

desert loom
#

did you initialize the JsonObject?

harsh totem
#
    public void badOmen(RaidTriggerEvent event){
        JsonElement element = JsonParser.parseString(String.valueOf(event.getPlayer().getPotionEffect(PotionEffectType.BAD_OMEN).getAmplifier()));
        obj.add(event.getRaid().getLocation().toString(), element);```
desert loom
#

there's no initialization for obj in that code

#

are you sure you didn't forget to initialize obj

harsh totem
#

private static JsonObject obj;

#

it not in the function

quaint mantle
#

where is obj assigned a value

harsh totem
#

I want to add a key and a value

quaint mantle
#

hey, im gonna create a variable but assign no value to it

quaint mantle
#

whats this? i cant use my variable because it has no value?!?!?

harsh totem
quaint mantle
#

that's considered being rude?

desert loom
#

you need to set obj to a new JsonObject or however you create one of those.

quaint mantle
#

good luck in this server my guy or any help server in general

humble tulip
#

😂😂

#

Imajin what's ur timezone

quaint mantle
#

UTC-4

#

US east

river oracle
#

he's mad!

humble tulip
#

US east is +4???

quaint mantle
#

or -4

river oracle
#

wait does that make me UTC+3 or UTC+5 idk how the fuck UTC works

earnest forum
#

utc is gmt

humble tulip
#

It's 2:55am and I'm utc - 4

quaint mantle
#

yeah same

river oracle
#

its actually 1:55am idiot

humble tulip
#

Ur utc - 5 then

quaint mantle
#

how are the wheat farms there

humble tulip
#

😂😂

river oracle
#

and soy beans

quaint mantle
#

😹

river oracle
#

Well atlesat I have a lot of options to go to different really shitty cities and get shot because of the high levels of uncontrolled crime because of miss managed services

humble tulip
#

:)

quaint mantle
humble tulip
#

Sounds like a bunch of shittu options tho

river oracle
#

Chicago is nice

humble tulip
#

Us is a shithole

river oracle
#

false its nice here as long as you stay out of any city and don't watch the news

#

and don't talk to anyone

humble tulip
#

Lmao

#

I'd like to visit one day

#

But too poor

river oracle
#

whatever you do don't go to california

humble tulip
#

Isn't that like beaches and stuff

#

I live in the Caribbean

#

I wanna see snow

river oracle
#

no its, its 👀 its very high taxes

river oracle
humble tulip
#

Ny will probably be nice

river oracle
#

NY has lots of agriculture

humble tulip
#

Nyc?

river oracle
#

no

#

just the state New York

humble tulip
#

Wait how big is ny compared to nyc

river oracle
#

top one is new york bottom one is new york city

quaint mantle
#
@Contract("null -> null")
public static @Nullable @Colored String[] translateArray(@Nullable @FutureColored String @Nullable ... messages) {
humble tulip
#

I've got no idea what I'm looking at

river oracle
#

new york state area = 54,556 mi²
new york city area = 302.6 mi²

humble tulip
#

Oh so nyc is tiny

#

Wow

quaint mantle
#

its really not

#

thats pretty big

tawny otter
#

on Bungeecord, how can I get the UUID from a Players name

harsh totem
#

I have this private static JsonObject obj = new JsonObject();
and this is where i add value: JsonElement element = JsonParser.parseString(String.valueOf(event.getPlayer().getPotionEffect(PotionEffectType.BAD_OMEN).getAmplifier())); obj.add(event.getRaid().getLocation().toString(), element);
and this is where i get the value: try (Reader reader = new FileReader(plugin.getDataFolder() + File.separator + "data.json")) { JsonObject jsonObject = (JsonObject) JsonParser.parseReader(reader); return jsonObject.get(key).getAsInt(); } catch (IOException e) { e.printStackTrace(); }
Why does it say java.lang.NullPointerException: Cannot invoke "com.google.gson.JsonElement.getAsInt()" because the return value of "com.google.gson.JsonObject.get(String)" is null?

charred blaze
#

?java

#

?help

undone axleBOT
#
CafeBabe Help Menu
*Red V3*
**__Admin:__**

selfrole Add or remove a selfrole from yourself.

**__Cleanup:__**

cleanup Base command for deleting messages.

**__Core:__**

embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.

**__Downloader:__**

findcog Find which cog a command comes from.

**__Mod:__**

names Show previous names and nicknames of a member.
userinfo Show information about a member.

**__ModLog:__**

listcases List cases for the specified member.
reason Specify a reason for a modlog case.

**__Permissions:__**

permissions Command permission management tools.

earnest forum
#

?learnjava

undone axleBOT
earnest forum
#

?

charred blaze
#

thx

harsh totem
crisp steeple
#

ok yes, but where are you getting it from and have you checked what it is

winged anvil
#

hello

harsh totem
winged anvil
#

so ive got a couple plugins that I want to use a currency with