#help-development

1 messages ยท Page 2045 of 1

spring minnow
#

to write java code

#

xD

plush gulch
#

`?

spring minnow
#

Yes

#

thanks

plush gulch
#

๐Ÿ‘

spring minnow
quaint mantle
#

Unless you loop all the sounds and do player.getWorld().playSound()...

spring minnow
#

probably its the whole event that gets triggered twice

#

not sure about that, btw can someone help?

vocal cloud
#

?paste it in pastebin works too

undone axleBOT
vocal cloud
#

And it's nicer to read than on discord

plush gulch
spring minnow
#

ok

spring minnow
spring minnow
#

you can just loop it with a for and remove it from the list when you play it

vocal cloud
#

I think you're misunderstanding what they want. From the sounds of it they want to make an achievement for hearing all the sounds in-game?

spring minnow
#

so like

  for(Sound s : remainingSoundsToPlay) {
         world.playSound(s, ..., ...);
         remainingSoundToPlay.remove(s);
  }    
ivory sleet
#

not sure that'd work

spring minnow
#

ofc he has to make a way to pause it until he gives a command to make the next sound play

#

this was just the concept of what he should do

#

but i mean, there could be over 300 sounds, you can't know all of them

#

1200*

#

just checked

spring minnow
#

ye

ivory sleet
#

oh well just make sure you don't modify the collection whilst iterating, gonna get a ConcurrentModificationException then

spring minnow
#

yeah ofc

#

as i said you could make a way to play the next only after you gave him the command that you heard it

#

otherwise they're all going to getting played in a sec and you'll get an exception

spring minnow
vocal cloud
#

Just write a client-side mod that when every sound has been played to give them an advancement

quaint mantle
#

Maybe intercept packets with ProtocolLib?

spring minnow
#

didn't him say he wants a challenge

#

not an advancement

#

i mean i speak italian so may i misunderstood

vocal cloud
#

same difference

#

It's literally 1 word in the config

spring minnow
north cipher
#

What do you think is the best way to detect when user activates redstone? I was looking into BlockRedstoneEvent but there is no way to detect if a player activated it, and PlayerInteractEvent i would have to specify all the materials and is overall not as reliable (standing on pressure plate spams the event). Thanks

naive loom
#

Oh my bad, I didn't see what you were looking for I just inferred that's what you wanted.
Their are two methods you need to listen to for this to work the way you want it and it's getting the destination and the initiator, you can check the initiator and ensure it's a chest and you can ensure that the destination is a PlayerInventory.

https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/inventory/InventoryMoveItemEvent.html

signal gale
#

Hi, i'm very new to spigot api and am currently using the 1.12.2 version, I am a bit confused as to why this doesn't work, any help would be appreciated ๐Ÿ˜…
(the flight is not disabling after being enabled, it sends the message but it does not disable flight)

vocal cloud
#

?paste code rather than sending files

undone axleBOT
signal gale
north cipher
quaint mantle
signal gale
#

it seems I had a misunderstanding on what that was used for

quaint mantle
#
private List<UUID> flying = new ArrayList<>();

to

private final Set<UUID> flying = new HashSet<>();
signal gale
#

Can I ask what difference it would make?

quaint mantle
#

set doesnt keep an order of things so its faster

#

and also #contains is faster since it uses hash instead of comparing all of the objects fields

signal gale
#

Is there something an array would be better for compared to a set?

quaint mantle
#

like ummmm

#

ArrayList is like this
[1] [2] [3] [4] [5]..... []
calling #add will put the next element here ^

#

a set just has a bunch of elements without keeping an order like that

signal gale
#

huh, so would an array be better for like punishment tracking and stuff?

north cipher
#

punishment tracking would be done with a database

signal gale
#

ah

quaint mantle
#

you could use an array for matrixes but you dont need to learn about that stuff right now

#

arrays are just containers of elements with a fixed size

#
String[] names = new String[]{"Bob", "Joe", "Billy"};
System.out.println(names.length); // 3

you can change these 3 elements but not the size of it

#

idk i just feel like teaching rn

signal gale
#

not totally but a little bit

north cipher
#

but at that point you shouldnt use an array

warm light
#

How can I play Ender Chest open animation?

night torrent
#

how would i spawn a falling block with motion?

worldly ingot
#

I mean technically speaking they all have motion. They're falling blocks Kappa

hasty prawn
#

heh Kappa

worldly ingot
#

Nah but really. World#spawnFallingBlock(), then it returns the FallingBlock which is an entity. You can #setVelocity() on it

#

world.spawnFallingBlock(location, Material.STONE.createBlockData()).setVelocity(new Vector(1, 0, 0));

night torrent
#

thanks!

warm light
night torrent
#

getting an error for "new Vector(1, 0, 0)", says Cannot Resolve Symbol "Vector"

worldly ingot
#

I mean, import it ;p

#

The correct one, anyways. Java has a Vector and Bukkit has a Vector. You want the Bukkit one

hexed hatch
worldly ingot
#

So if you have a java.util.Vector (or something like that, I forget what package it's in) in your imports, you've got the wrong one

hexed hatch
#

I don't know if enderchests implement Lidded though

worldly ingot
#

They don't. They have no state afaik

night torrent
#

wow i feel stupid. For some reason i forgot what import class ment

hexed hatch
#

Then looks like you'll have to use some packet magic for the opening of an ender chest

worldly ingot
#

Yeah :/ When we initially introduced the Lidded interface we kind of overlooked ender chests, and honestly I don't know how we would have gotten that supported

hexed hatch
#

What exactly is it doing?

worldly ingot
#

Sec. Will link the impl

hexed hatch
#

Is it just sending a packet saying that it's open

worldly ingot
#

It sets a boolean that we patched in then sends a packet iirc

hexed hatch
#

ah

hexed hatch
#

The only thing stopping me from being able to look at nms and spigot source is my inability to set up intellij properly

worldly ingot
#

(blockEvent() sends a packet last I recall looking at that method)

hexed hatch
#

I know annoyingly little about how to work the ide and maven, I know just enough where I can compile shit but that's it

#

I need to sit down and take the time to learn it

#

Oh so whether the block is open or not is in the block's state

worldly ingot
#

It keeps track of how many players have it open and if it's incremented to 1, it sends an animation packet. If it's decremented to 0, it sends an animation packet

#

Though we patched in a boolean that would keep it open if that method was invoked

#

Man it sure doesn't feel like almost two years ago

outer pond
stuck flax
#

is there an event for when villager trades occur

warm light
#

what is the default vol and pitch of Echest opens & close?

warm light
outer pond
north cipher
#

whats the best way to detect when a player activates redstone?

quaint mantle
#
getServer().getScheduler().scheduleSyncRepeatingTask(this, () -> {

How would I schedule a task that only repeats 5 times?

hollow bluff
hollow bluff
quaint mantle
hollow bluff
#

stopping the task

north cipher
#

Ive tried PlayerInteractEvent but its buggy

worldly ingot
#

Well it depends on what you want to look for. Most times it's a PIE, though you have to understand that redstone isn't always activated by a player

#

Daylight sensors for instance are entirely unrelated to players

#

Tripwires, while triggered by players, doesn't necessarily have a direct correlation to a redstone circuit so if you're trying to stop a dispenser from being triggered by a tripwire hook, you're going to struggle to do that without just cancelling all tripwire hook activations

low temple
# quaint mantle wdym cancel

Create a int variable called "count" or something, then within the method, increase it by 1 and if the count reaches 5, run the cancel method

#

can probably just call cancel() within the loop

low temple
#

?

rancid snow
#

are there any plugins that allow you to make a custom item then update that item later everywhere?

sharp bough
#

could someone check my custom world thread please

#

otherwise im just gonna close it tbh

warm light
warm trout
#

NMS obfuscation is broken....they obfuscate to do()

#

And do is an actual thing in java

#

LOL

muted sand
#

is it possible to change the simulation distance on a per-world basis?

#

or even, per player basis?

summer scroll
earnest forum
#

^

#

inside the runnable you can call this.cancel()

#

or if you save the BukkitTask object you can call cancel from that

quaint mantle
#

How do I add arguments to commands in the plugin.yml file @earnest forum?

#
  home:
    description: Sets your home!
    usage: /<command>
#

Example for the second arg, instead of showing players

#

it should show "tp" or "home"

#

*tp or set

earnest forum
#

args don't need to be in plugin.yml

quaint mantle
#

oh... how do i set them?

earnest forum
#

unless you're talking about description?

#

or usage

quaint mantle
#

no, for example, yknow in later versions of mc

#

typing can show auto results

#

like for /tp

#

it can show players

earnest forum
#

the tab complete

#

yes

quaint mantle
#

yes

earnest forum
#

there's a special class

#

like commandexecutor

#

I'm not too familiar with it

#

some googling will help

rancid snow
#

how can I add a method call to the end of a method programatically?

#

like a mixin to the tail of a function, but without mixins

quaint mantle
#

@earnest forum How do I make a list like so:

String[] argList = {1: true};
#

I dont wanna have to use arrays and insert them constantly

#

๐Ÿ˜ญ

wet breach
#

List<String> argList = new ArrayList<>();
argList.add("whatever");

quaint mantle
wet breach
#

can use a set or map then

#

in either case you won't really escape arrays

#

HashMap<Integer, String> argMap = new HashMap<>();
argMap.put(1,"true");
#

swap String for Boolean if its going to be nothing but booleans for values, I just put string because I have no idea what the arg list will consist of

quaint mantle
#

@wet breach How do I do for each on a hash.

radiant cipher
#

Yo I wrote a plugin and the console is giving me this message, what does this even mean
[Server] Server thread/ERROR Could not load 'plugins/com.lerfing-1.0-SNAPSHOT.jar' in folder 'plugins': uses the space-character (0x20) in its name

wet breach
#

does the directory you are running the server from, contain a space in the path?

quaint mantle
#

is there like a getName.raw function

#

or smth

wet breach
#

could strip the color codes from the name first

radiant cipher
quaint mantle
#

if not it doesnt matter

wet breach
#

should affect tab complete

#

shouldn't*

quaint mantle
#

alr so ill just reset the chat color

#

ah

radiant cipher
#

Found the issue, in name you can't have a space

#

for plugin

wet breach
#

Ah

radiant cipher
#

zzz

wet breach
#

Sorry was in a game, was my next suggestion ๐Ÿ˜›

#

but you found it on your own

#

so awesome ๐Ÿ˜„

radiant cipher
#

very dumb thing they have there lol

quaint mantle
#

@wet breach sorry i suck at switching
how do I check for any other case?

ex: if i was compairing numbers, if a case afterwards is bigger than 2, do the same action

#

is it case.Default

#

or

#

*i dont wanna copy n paste it a million times lel

wet breach
#

but if not it makes sense to not allow spaces

wet breach
#

So that I have a better understanding and don't just give you random code stuff for something ๐Ÿ˜›

quaint mantle
# wet breach alright what exactly are you doing? lol
switch(args.length){
                case 1 -> {
                    ArrayList<String> argList = new ArrayList<>();
                    argList.add("spawn");
                    return argList;
                }
                case 2 -> {
                    return new ArrayList<>();
                }
            }

I want it so that any other case 2 or higher would return new ArrayList

#

im doing TabComplete

#

for commands

wet breach
#

You might want to return an Empty List instead of just a new ArrayList but it depends what you are doing

wet breach
#

prevents them pesky NPE's

#

to return an empty list

#

in case you want to check its size or something

#

at least it will return a size of 0, instead of NPE

quaint mantle
#

hold on, for switching, is it default?

#

for anything else?

wet breach
#

default is if nothing matches it will run the default

quaint mantle
#

tysm

earnest forum
#

you can do Arrays.asList(params)

#

i use it for creating lore

#

in item meta

#

ArrayList<String> lore = Arrays.asList("This is lore line 1", "This is lore line 2")

wet breach
#

that works too

quaint mantle
#

which is kinda funny

#

funni color coded tag

#

*tab

earnest forum
#

yeah

#

it should work for anything

wet breach
#

they mean the tab complete

quaint mantle
earnest forum
#

oh

quaint mantle
earnest forum
#

List then

#

List<String> name = Arrays.asList()

#

try that

warm light
wet breach
warm light
#

I want to play echest open animation

#

I did this

wet breach
#

I think chest opening is client side

#

not seeing anything in the protocol for the server to send

grizzled pollen
#

my friends and I used autoclicker to force the chests to be permanently open

#

they were open all the time for all players

wet breach
#

so basically used a client

#

to keep it opened lol

#

I suppose that is one way to do it

grizzled pollen
#

I mean that it was enough for a few seconds to click on the chest a lot and quickly and it remained open for everyone all the time until the restart

#

there were no people who just did it all the time, it was enough to do it 1 time

wet breach
#

probably could make a fake invisible player do it by sending a packet into the packet pipeline to make it appear it came from a client to also do it

#

In either case, it is client side so....will have to resort to some hacky method to get it to work regardless ๐Ÿ˜›

grizzled pollen
#

anyway i think what he wants to do is possible

wet breach
#

server side? yes, but you need to do some network trickery to get the packet to go around and come back in

grizzled pollen
#

yeah

wet breach
#

there isn't a server side packet you could send sadly to make it easier

warm light
wet breach
#

there isn't a server side packet that exists for what you are wanting

#

you would have to somehow get a packet to come into the pipeline for inventory opening on the chest

#

since its a client packet that comes to the server

#

I mean I could be wrong

#

but I don't see it in the protocol server side to allow it

proper marlin
#

Hey, I am having troubles with OCM/OldCOmbatMechanics on 1.18.2

I can still attack player for damage inbetween delays. Anyone know how to fix this

wet breach
#

ah I didn't see that

#

so there does appear to be a packet you could use

wet breach
#

so you need to send an id and param which would seem to be you would have them both set to 1

#

well locaiton, action id, param, block type(which needs to match the block type at the location given)

#

and it appears you only need to send that once, when the chunk loads

#

thank @quaint mantle for pointing out the relevant packet ๐Ÿ˜„

#

@grizzled pollen just pinging you in case you don't want to use an autoclicker ๐Ÿ˜›

grizzled pollen
#

I haven't played minecraft for a long time

#

I just make plugins for it sometimes

#

or mods

wet breach
#

ah

agile sand
#

Hi! Somebody know, how to turn decompiled NMS to remapped NMS?
for example: PacketPlayOutEntity -> <remapped_copy>

smoky oak
#

only idea i have is using remapped nms from the beginning

lone remnant
#

tried java ItemStack item = new ItemStack(Material.getMaterial(itemName)); with itemName = "cookie", but got ```java
java.lang.IllegalArgumentException: Material cannot be null

tardy delta
#

then thats not a valid name

agile sand
chrome beacon
#

If you want to use Mojmaps in your project read the release post for your version

wet breach
#

?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

lone remnant
# tardy delta then thats not a valid name

and where do i find valid names? in the code the getMaterial looks like this: ```java
@Nullable
public static Material getMaterial(@NotNull String name) {
return getMaterial(name, false);
}

@Nullable
public static Material getMaterial(@NotNull String name, boolean legacyName) {
    if (legacyName) {
        if (!name.startsWith("LEGACY_")) {
            name = "LEGACY_" + name;
        }

        Material match = (Material)BY_NAME.get(name);
        return Bukkit.getUnsafe().fromLegacy(match);
    } else {
        return (Material)BY_NAME.get(name);
    }
```
earnest forum
#

COOKIE is

#

use the enum

#

Material.COOKIE

#

your ide should come up with autocomplete for every enum

lone remnant
#

yea, but i want the user to be able to customize that item by a config

earnest forum
#

material.valueof?

chrome beacon
#

Why are you forcing legacy

lone remnant
#

no

chrome beacon
#

Oh wait nvm

wet breach
earnest forum
#

yes

#

it has to be all caps

#

you should first check if its null and if it is print an error

tardy delta
#

why not just Material.COOKIE?

lone remnant
earnest forum
#

hes trying to customise it

wet breach
#

Material.valueOf(String.toUpperCase("ItemName"));

tardy delta
#

String.toUpperCase ๐Ÿค”

wet breach
#

makes it all caps

#

which the enums are

tardy delta
#

itemName.toUppercase()?

wet breach
#

if itemName is a string

#

yes

tardy delta
#

what would it be otherwise?

wet breach
#

an itemstack

#

idk

chrome beacon
#

Don't forget to specify locale in that uppercase or things could go wrong

lone remnant
#

no, that is directly read from the config

tardy delta
#

there is no static toUppercase method kek

earnest forum
#

are u trying to publish it

wet breach
chrome beacon
#

Turkish has different i and might break stuff

wet breach
#

that is fine, the enums are in english

chrome beacon
#

Well yeah but if you enter lowercase i and try to uppercase it... it will use the wrong i

#

(If system lang is set to turkish)

#

I'm not sure how it will handle that

lone remnant
#

why is now my mc crashing on connecting to my testserver???

wet breach
wet breach
lone remnant
#

ok, now i found another error. when i edit the default config it doesnt change the used config

lone remnant
wet breach
tardy delta
#

servers arent crashing randomly

wet breach
#

easiest way is to implement a reload command in your plugin or just have your plugin every so often refresh its config it has loaded

lone remnant
tardy delta
#

thats not good either

lone remnant
#

and i meant the config you put into the resources folder while programming

wet breach
#

so when you recompile, it is putting the changed config into the jar?

#

is that what you are saying?

#

I am pretty sure it is, and it is just the fact that since config.yml already exists on your test server for that plugin

#

it is just not pulling the new config.yml and replacing the already existing one

#

either implement in detecting a newer config.yml version or just delete the old config and let it get remade

#

on the test server

lone remnant
warm light
#

what is that?

lone remnant
#

i like intellij. i just need to press one button and it builds the maven package, copies the plugin to my testserver and then runs the testserver

wet breach
#

if config.yml already exists in the plugin directory

#

then the updated one in the jar, isn't going to automatically replace the existing one

#

either implement such in your code, or just simply delete the old config.yml

tardy delta
#

then the changed options will be resetted

#

if you delete it

wet breach
#

if instead you are saying it isn't putting the config.yml in the directory at all even if it doesn't exist, then you need to use the relevant method to make it do such. saveDefaultConfig()

tender shard
#

that's 1.16 and below only though

wet breach
#

๐Ÿค”

tender shard
#

1.18 has other names

#

e.g. no packet is called "PacketPlayOut", they are rather just called "Clientbound"

#

does someone know the "official" spigotmc hex color?

#

I guess it's #ed8106?

#

I just need it for a button

grim ice
#

How to open the command prompt

#

when someone opens my jar file

rough drift
#

wdym

tender shard
#

Boolean.getBoolean is such a weird method

#

like, why is that method even in the Boolean class, it doesn't belong there at all

unreal quartz
#

To fuck with you

tender shard
#

it should be in the Properties class

tender shard
#

add a MANIFEST.MF file inside META-INF that specifies a Main-Class: com.whatever.Main

grim ice
#

but would that open the command prompt

wet breach
#

without that method, it be a pain to get the boolean value of a system property without resorting to your own boolean method check

tender shard
tender shard
#

you also don't use String.getString() to get string properties

#

it should be Properties.getBoolean imho

wet breach
#

but then things that extend Boolean or whatever wouldn't have that automatically

tender shard
#

it's final

wet breach
#

internal stuff is not subject to java stuff ๐Ÿ™‚

vocal cloud
#

Just gotta make your own Boolean

#

With blackjack

#

And reflection

tender shard
vocal cloud
#

Now that is beautiful

crimson terrace
#

To backport a plugin from 1.17 to 1.16 all I have to do is change the dependency version in the pom, right? like this? (and find errors created by this obviously)

earnest forum
#

longs i think

tardy flame
#

Doubles

vocal cloud
#

Just read their source it's public

grim ice
#

not run smth on it

#

i alr figured it out

#

its platform dependant tho

#

so i gotta check what os is it

#

for widnows

#

windows

#

Runtime.getRuntime().exec("cmd /c start cmd.exe").waitFor();

glossy venture
#

what is the class with the largest parent tree?

#

including interfaces

#

not the exact one but what would be a good guess

#

from the java standard library

#
@ depth 0: |- class javax.swing.JSlider
@ depth 1:   |- class javax.swing.JComponent
@ depth 2:     |- class java.awt.Container
@ depth 3:       |- class java.awt.Component
@ depth 4:         |- interface java.awt.image.ImageObserver
@ depth 4:         |- interface java.awt.MenuContainer
@ depth 4:         |- interface java.io.Serializable
@ depth 2:     |- interface java.io.Serializable
@ depth 2:     |- interface javax.swing.TransferHandler$HasGetTransferHandler
@ depth 1:   |- interface javax.swing.SwingConstants
@ depth 1:   |- interface javax.accessibility.Accessible
#

made something to print the tree

crimson terrace
#

I am getting a NoSuchMethodError when setting fuse ticks on a creeper. I have my api-version at 1.16 and my dependency at version 1.16.5-R0.1-SNAPSHOT. The Method it is referencing is the one below. Any ideas?

golden turret
#

how can i render a full map here

golden kelp
#

hey guys how to get a plugin from the PluginManager using its name

fallen sandal
#

hello

#

what does this error mean?

#
[17:33:40 ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'rh' in plugin Swapnocraft v1.0-SNAPSHOT
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]```
tardy delta
#

Type skills on phone smh

golden kelp
#

gies NPE

tardy delta
#

What?

#

For plugin?

#

Make sure to use the exact name

#

And if it's still null the plugin isn't installed

golden kelp
#

okay ill try again

#

What will you use to get the list of the numbers in the below YAML (File is config.yml)
yaml versionID: versionList: [9089, 4568, 6969, 4200, 6969]

hardy swan
#

Is there a dummy entity that can be used to track custom damage done by World#createExplosion(@NotNull Location loc, float power, boolean setFire, boolean breakBlocks, @Nullable Entity source)?

tardy delta
#

Cant you do int[] config.get("versionID.versionlist" )

grim ice
#

So i figured out how to open a command prompt

grim ice
#

Runtime.getRuntime().exec("cmd /c start cmd.exe").waitFor();

#

but how do i listen for messages in it

tardy delta
#

That isn't a list?

tardy delta
#

A list is with -

hardy swan
#

trust

tardy delta
#

Oh

#

Never tried

golden kelp
fallen sandal
eternal oxide
#

its a null error in your command processing.

#

read the rest of the stacktrace to see which line in your code is causing it

grim ice
#

Runtime.getRuntime().exec("cmd /c start cmd.exe").waitFor();
but how do i listen for messages in the command prompt i started>

eternal oxide
#

sec. I did this a while ago

wet breach
# grim ice Runtime.getRuntime().exec("cmd /c start cmd.exe").waitFor(); but how do i listen...

public static void main(String[] args) {
    try {
        String ss = null;
        Process p = Runtime.getRuntime().exec("cmd.exe /c start dir ");
        BufferedWriter writeer = new BufferedWriter(new OutputStreamWriter(p.getOutputStream()));
        writeer.write("dir");
        writeer.flush();
        BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
        BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream()));
        System.out.println("Here is the standard output of the command:\n");
        while ((ss = stdInput.readLine()) != null) {
            System.out.println(ss);
        }
        System.out.println("Here is the standard error of the command (if any):\n");
        while ((ss = stdError.readLine()) != null) {
            System.out.println(ss);
        }

    } catch (IOException e) {
        System.out.println("FROM CATCH" + e.toString());
    }

}
eternal oxide
#

That shoudl work. I did it with a ProcessBuilder and redirectErrorStream

granite owl
#
I use a map to store my config file values

if i store this string in my map
00FF00
it gets stored as
00FF00

if i store this string in my map
#00FF00
it gets stored as
ยงxยง0ยง0ยงFยงFยง0ยง0
``` Are maps not able to store # characters as part of string values?
#

java map*

wet breach
#

down to preference I suppose lol

wet breach
granite owl
#

nvm ive found the mistake

wet breach
#

however, if it has anything to do with the API of spigot/bukkit it would be because the second version is considered hex color code

granite owl
#

i ran the string incorrectly trough my custom color parser

#

xD

wet breach
#

well that would do it

granite owl
#

and then ran it again

#

which obv scrambles it

wet breach
#

mainly because you really shouldn't use Runtime.exec()

smoky oak
#

is there a function to rotate vectors or do i need to do the math myself?

granite owl
#

how can i typecast a chatcolor from string to chatcolor

granite owl
#

one that is already stored in the minecraft format

#

not as hex

wet breach
#

there is like 5 methods to rotate vectors

smoky oak
#

oh its a simple rotation

#

the vector's supposed to get rotated 60ยฐ around the y axis

wet breach
#

well you can rotate via axis too

grim ice
#

frost

#

that just sends

grim ice
#

directory information

smoky oak
#

thanks

wet breach
grim ice
#

oh okay

golden kelp
granite owl
#

soo

#

how can i typecast a correctly formatted ChatColor from string to ChatColor?

#

one that doesnt need to be translated

golden kelp
#

I think ChatColor has a method #fromString

grim ice
#

well i didnt

granite owl
#

it has #of() but that translates a hex string to color

#

thing is ive already done that before

eternal oxide
#

?paste

undone axleBOT
eternal oxide
tender shard
#

get the input and output stream of that process

#
public static void main(String[] args) {
    try {
        String ss = null;
        Process p = Runtime.getRuntime().exec("cmd.exe /c start dir ");
        BufferedWriter writeer = new BufferedWriter(new OutputStreamWriter(p.getOutputStream()));
        writeer.write("dir");
        writeer.flush();
        BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
        BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream()));
        System.out.println("Here is the standard output of the command:\n");
        while ((ss = stdInput.readLine()) != null) {
            System.out.println(ss);
        }
        System.out.println("Here is the standard error of the command (if any):\n");
        while ((ss = stdError.readLine()) != null) {
            System.out.println(ss);
        }

    } catch (IOException e) {
        System.out.println("FROM CATCH" + e.toString());
    }

}
#

sth like this

grim ice
#

this is what frostalf sent

#

i dnt get how it works

#

and it doesnt anyways

tender shard
#

well with the writer you can "put" text into the terminal

#

and with the reader you get the output

tender shard
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.

grim ice
#

Whatever you write in the cmd

#

it sends nothing

#

"Here is the standard output of the command:"

#

thats all it sends

tender shard
#

remove the "start" part

grim ice
#

then it doesnt open a terminal

#

at all

#

lol

tender shard
#

erm wait, you want to start a terminal from java, and then catch what people enter there? why? o0

grim ice
#

input and output

#

in a cool way

visual tide
#

scanner ๐Ÿ˜

grim ice
#

Sir

tender shard
#

yeah but he wants to make it work without entering java -jar app.jar

grim ice
#

that wont work

#

its a jar

#

yeah

visual tide
#

oh

tender shard
#

well just make a bootstrap class

visual tide
#

^

grim ice
#

that runs my jar?

tender shard
#

public static void main() {
Runtime.exec("cmd.exe /c java -jar this.jar ClassName

tender shard
#

I'd just tell people to run it from CLI and that's it

#

or just create a tiny console window GUI with swing or similar

#

or just include a .bat and .sh file

#

that's what most CLI apps do

grim ice
tender shard
#

with your .jar name

#

why don't you just include a .bat file

#
@echo off
java -jar MCMapperGUI-1.1.1-all.jar
#

that's what MCMapperGUI includes

grim ice
#

"include a bat file" wdym

tender shard
granite owl
grim ice
#

oh ic

tender shard
#

ChatColor.getByChar('c') returns a ChatColor.RED

granite owl
#

well ive got the whole formatted string

#

like this

#

ยงxยง0ยง0ยงFยงFยงFยงF

#

cast from the color #00FFFF

granite owl
#

i could avoid parsing it beforehand, but that would add redundancy to the code

tender shard
#

ChatColor.of takes a Color and you can get a color using new Color(int r, int g, int b)

granite owl
#

hm

tender shard
#

and you can get an int from hex using Integer.valueOf("ff",16)

#

16 for hex, obviously

fallen sandal
#

my yaml is valid but when i start my plugin

#

it says

#
org.bukkit.configuration.InvalidConfigurationException: while parsing a block mapping
 in 'reader', line 1, column 1:
    world-name: swapnoworld
    ^
expected <block end>, but found '<block mapping start>'
 in 'reader', line 29, column 5:
        CorrectlyReported:```
granite owl
#

hm

tender shard
#

?paste your config.yml

undone axleBOT
fallen sandal
#

ok wait

golden kelp
#

ello guys, can anyone tell me how to build my plugin using the cmd line and mvn?

fallen sandal
golden kelp
#

ok tanks

fallen sandal
golden kelp
#

That installs the libs I think

tender shard
golden kelp
#

ohhh

#

lets do that ig

fallen sandal
#

..

golden kelp
#
$ mvn clean install
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------< com.vinitjar.versionchecker:VersionCheckerX >-------------
[INFO] Building VersionCheckerX 1.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ VersionCheckerX ---
[INFO] Deleting D:\Vinesh\Github\VersionCheckerX\target
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ VersionCheckerX ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ VersionCheckerX ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to D:\Vinesh\Github\VersionCheckerX\target\classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.548 s
[INFO] Finished at: 2022-03-25T18:21:33+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project VersionCheckerX: Fatal error 
compiling: invalid target release: 17 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
tender shard
#

compile = only compile
package = compile + put into .jar
install = package + install to local repo

golden kelp
#

Any idea idea why it failed

tender shard
golden kelp
#

how to know

tender shard
eternal oxide
#

only use install when you really want it in your maven local. If you do it for every build you will rapidly fill your HD

fallen sandal
golden kelp
fallen sandal
#

project structure?

eternal oxide
#

clean package is used usually for dev work

tender shard
tender shard
#

set your JAVA_HOME path to your install path of your java 17 jdk

golden kelp
#

xDD its using 1.8

fallen sandal
#

then what should i do?

tender shard
golden kelp
#

can u send that first one here

tender shard
#
JAVA_HOME=/c/Program\ Files/Java/jdk-17.0.1/ mvn -v
golden kelp
#

tanks

fallen sandal
#

okay i fixed it..

wet breach
#

@grim ice still haven't figured out the example?

dreamy chasm
#

is there a way to cancel/stop a repeating task from within the task, I basically only want it to keep repeating until a bool is false, then it will stop itself is what I am looking for?

#

nvm, a bukkit runnable seems way better than using a scheduler and it has its own cancel method

misty ingot
#

how can I check if the player last logged in within 24 hours? (bungeecord)

#

basically a daily login reward system

grim ice
#
        while(true) {
            if (utils.isOn()) {
                System.out.println("on");
                wait(2000);
            }
        }```
#

how would i do this without spigot btw

#

without getting cpu usage to 99% LMAO

grim ice
#

with a bat file

last sleet
#

PersistentDataTypes are just which primitive type the key from namespaced key is, right?

wide coyote
grim ice
echo granite
wide coyote
#

a class which extends BukkitRunnable or Bukkit.getScheduler().runTaskAsync(plugin, ()->{})

wide coyote
#

i did and didnt understand a shit

#

what does "without spigot" even mean

chrome beacon
#

Pure Java

#

No spigot

wide coyote
#

well i dont see any method that comes from spigot in that code

grim ice
#

dayum

chrome beacon
#

The bukkit scheduler is part of spigot

grim ice
#

do you see Bukkit in the jdk?

wide coyote
#

okay then use threads

#

and sorry for missunderstanding

grim ice
#

a thread will close once it stopped working

#

also idc about pausing the main thread

#

i just dont want too much cpu usage

wide coyote
#

that actually should not cause that high cpu usage

grim ice
#

while(true) alone does

#

without any content

#

i mean it does have

#

if statements so

wide coyote
#

take a look to java.util.Timer

#

may be the thing that you are looking for

quaint mantle
#

Can you please tell me how you do mysql queries?

sharp flare
#

resources from the internet exist

fallen sandal
#

how to valid a player name if its incorrect in args?

#

== null?

wide coyote
#

Bukkit.getPlayerExact(args[0]) == null

candid galleon
#

How are you getting the player given a string?

fallen sandal
#

??

candid galleon
#

How are you converting the string to a player?

fallen sandal
#

Bukkit.getPlayer(args[0])

candid galleon
#

What does that tell you?

fallen sandal
#

ok

fallen sandal
candid galleon
#

What does that image tell you

fallen sandal
#

get a player object by the given username

candid galleon
#

Right, and what does it return?

fallen sandal
#

oh

tardy flame
#

It's better to use getofflineplayer

hardy swan
#

bruh cancelling EntityExplodeEntity doesn't cancel the damage ._.

candid galleon
#

because you're cancelling the explosion

hardy swan
#

yea, that's very specific

candid galleon
#

so if you cancel a creeper explosion

#

does the creeper still explode?

hardy swan
#

no

#

cause it is cancelled

candid galleon
#

but players still get damaged?

hardy swan
#

i mean, in reality, yes

candid galleon
#

so players get damaged even when the explosion was cancelled? and the creeper still exists?

hardy swan
#

yes, players get damaged even when explosion is cancelled

#

creeper should be gone

candid galleon
#

interesting

#

that is odd behavior

#

guess you have to listen to EntityDamageEvent or similar

hardy swan
#

it is like one broken plugin i have seen, when players get damaged from using beds in nether although there are no explosions

#

think is towny lmao

#

yea that should do

fallen sandal
#

still this error is coming

#
org.bukkit.command.CommandException: Unhandled exception executing command 'report' in plugin Swapnocraft v1.0-SNAPSHOT
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_18_R2.CraftServer.dispatchCommand(CraftServer.java:905) ~[paper-1.18.2.jar:git-Paper-230]```
candid galleon
#

Can you paste the full error

fallen sandal
#

wait a min please

#

my discord was glitched

golden kelp
#

hello guys I am trying to add a cmd to my plugin, this is my plugin.yml

name: VersionCheckerX
version: '2.2'
main: io.github.vinesh27.versioncheckerx.VersionCheckerX
api-version: 1.18
authors: [ vinesh27, Bastaboii ]
description: Version Checker is a plugin that can check for all the plugins in your server and inform if a plugin is outdated
commands:
  versionChecker:
    description: Used to check the versions of plugins
    usage: <command>

But when I execute the versionChecker command it says unknown command

#

?paste

undone axleBOT
candid galleon
#

Can we see the onEnable section

fallen sandal
#

heres the error

#

wait

candid galleon
#

Caused by: java.lang.NullPointerException: Cannot invoke "String.replace(java.lang.CharSequence, java.lang.CharSequence)" because the return value of "org.bukkit.configuration.file.FileConfiguration.getString(String)" is null

#

Swapnocraft.java:405

fallen sandal
#

no

golden kelp
# candid galleon Can we see the onEnable section
@Override
    public void onEnable() {
        saveDefaultConfig();
        Bukkit.getServer().getConsoleSender().sendMessage(
            ChatColor.GOLD + "" + ChatColor.BOLD + "[VersionCheckerX]" + ChatColor.RESET + "" + ChatColor.GREEN + " has started :)");
    }

Do i need to register the cmd if its in the main class?

golden kelp
#

by registerCommand thing from the PluginManager?

#

o h

fallen sandal
#

config is not null .-.

#

okay so heres the code

torn badge
fallen sandal
#

oh

torn badge
#

Oh my

fallen sandal
#

oh

#

i was practising this

torn badge
#

There is a thing called getStringList()

#

And itโ€™s not for decoration

golden kelp
#

How to register a command that is in the main class?

#

the onCommand is in main class

torn badge
#

registerCommand(this, this)

golden kelp
#

Oh okay

#

Do i need to implement CommandExecutor, or does JavaPlugin do it automatically?

torn badge
#

You need to explicitly implement it

tender shard
#

wow wtf that "report" command is possibly the worst code I've ever seen

#

and you decompiled THAT to learn sth?

#

yeah even worse

fallen sandal
#

.-

tender shard
#

at least steal good code

fallen sandal
#

lol

candid galleon
#

just look at open source stuff

torn badge
#

Okay guys decompiling something is not automatically "stealing"

fallen sandal
#

it was a 1.8.8 code

candid galleon
#

It doesn't matter where it's from

tender shard
#

are those buttons too big / too ugly etc? or are they at least halfway okay?

candid galleon
#

^

#

why not just use hyperlinks with bold centered text

tender shard
#

shit then have to redo them all lmao

#

I'll just do custom ones with photoshop then

#

I tried to use some online png button generators but this was the best I could get from those lol

tender shard
#

so I thought colored buttons will prevent people asking where the javadocs etc are

candid galleon
#

do you have the links in the table of contents?

fallen sandal
#

the author didn't given any contact link like dc or what

tender shard
fallen sandal
#

:))

candid galleon
#

@tender shard do you not forget to update buttons?

tender shard
#

unlike the table of contents, those would never change

candid galleon
#

sure, but you could just have a toc that is just the links

glossy venture
#

jezus

#

yeah

#

report.recive

hasty prawn
#

well that sounds awesome

dreamy chasm
#

does the code after a bukkit runnable only run once the task has finished/been cancelled?

hasty prawn
#

Which is basically instantly. It doesn't wait.

dreamy chasm
hasty prawn
#

You should send a video of your mortar I kinda wanna see that LOL

#

I can't open MC rn PepeHands

#

I'm in class lmao

brisk estuary
#

Could someone explain me what are lambda expressions and when I should use them? I've already googled it but I still don't understand it that well.

brisk estuary
#

ty ๐Ÿ™‚

grim ice
#

or is that the same website

tender shard
#

that's even larger and even more ugly

grim ice
#

this is way better than the ones you used

#

u can change the size as u want

#

i just made it big so u can see it in discord

tender shard
#

well I obviously wanted the spigot button in spigot colors lol

grim ice
#

thats with a bubble effect

#

and the curvy thing

#

u can remove both if u want

#

as long as the shadow

#

ew you

#

i made it with an online generator

tender shard
#

yeah I also don't like them

#

as said I'll just use photoshop

grim ice
#

Lol

#

they look fine

#

also @tender shard

#

how to do

#

while(true) {
if(boolean) {
run();
}
}

#

without 100% cpu usage :D

#

and without spigot

tender shard
#

why would you want to do that

ivory sleet
#

I mean you cant rly

grim ice
#

there is a wait() in the middle btw

#

i wanna run some code

#

between each 2 seconds

tender shard
#

java has timers builtin

grim ice
#

as long as the user is clicking a button

ivory sleet
#

ScheduledExecutorService would be by far the most sophisticated solution in your case

prisma harness
#

?learn ava

vocal cloud
#

I love the Executors#

grim ice
#

kekw

ivory sleet
#

ye wonderfully wonderful stuff

grim ice
prisma harness
#

?learnjava

undone axleBOT
grim ice
#

pausing the main thread is not bad here

ivory sleet
#

then just join the future

vocal cloud
#

You're approaching whatever you're doing wrong if the user holding down a button needs to do something

grim ice
#

not holding down

#

its uh

#

modes

#

turned on and turned off

vocal cloud
#

Make a toggle?

grim ice
#

i did

vocal cloud
#

and the issue is?

tardy delta
#

bool = !bool

grim ice
tardy delta
#

kek

tender shard
grim ice
#

is that actually what i should use or is that sarcasm

#

i assume sarcasm

tender shard
#

lmao

tender shard
#

lol

hasty prawn
#

I love that it's Abstract so you have to implement the same thing anyways LMAO

vocal cloud
#

ReflectionFlipFieldBooleanUtil

tender shard
#

enterprise code is such a joke sometimes ๐Ÿ˜„

spring minnow
#
        List<String> a = Arrays.asList(s.split(" "));
        int damager = 0;
        for (int i = 1; i < a.size(); i++) {
            System.out.println(i);
            if (a.get(i).contains("thDamager")) {
                damager++;
                a.set(i, a.get(i).replace("%" + damager + "thDamager%", "na"));
                a.set(i, a.get(i).replace("%" + (damager - 1) + "thDamager%", "na"));
                a.set(i, a.get(i).replace("%" + (damager + 1) + "thDamager%", "na"));
            }
            if (a.get(i).contains("thDamage")) {
                damager++;
                a.set(i, a.get(i).replace("%" + damager + "thDamage%", "na"));
                a.set(i, a.get(i).replace("%" + (damager - 1) + "thDamage%", "na"));
                a.set(i, a.get(i).replace("%" + (damager + 1) + "thDamage%", "na"));
            }
        }
        return toString(a);
#

any advice on how optimize this?

#

a is a string that has all strings inside this:

tender shard
#

oh wait

#

one is damager

spring minnow
#
messagesOnBossDeath:
  - '&7The boss: &e%boss% &7has been killed by &e%killer% &7and has dropped: &e%drops%&7.'
  - ''
  - '&aTopDamagers: '
  - ''
  - '&c%1thDamager%: &a%1thDamage%'
  - '&c%2thDamager%: &a%2thDamage%'
  - '&c%3thDamager%: &a%3thDamage%'
tender shard
#

and one is damage

spring minnow
#

yeah

#

i would like to make the 3 a.set in just one

#

but i'm quite unable to do it xD

tender shard
#

what is that even supposed to do

spring minnow
#

basically its a top damager

tender shard
#

what is s?

spring minnow
#

classification of players hit a boss

#

like the first on top made 20 damage and second 10

#

to a mob

#

the 1thDamager represents the name of who made most damage

#

and 1thDamage represents the damage he made

#

and that's for all the others

#

List<String> a = Arrays.asList(s.split(" ")); converts a string to a list of strings

spring minnow
#
    public static String setPlaceholders(String s, Player killer, LivingEntity boss) {
        List<Pair<OfflinePlayer, Double>> topDamagers = Tools.getTopDamagers(boss);
        if(killer != null)
            s = s.replace("%killer%", killer.getName());
        for(Pair<OfflinePlayer, Double> pair : topDamagers) {
            int i = topDamagers.indexOf(pair) + 1;
            s = s.replace("%" + i + "thDamager%", topDamagers.get(i - 1).getA().getName());
            s = s.replace("%" + i + "thDamage%", String.valueOf(topDamagers.get(i - 1).getB().intValue()));
        }
        List<String> a = Arrays.asList(s.split(" "));
        int damager = 0;
        for (int i = 1; i < a.size(); i++) {
            System.out.println(i);
            if (a.get(i).contains("thDamager")) {
                damager++;
                a.set(i, a.get(i).replace("%" + damager + "thDamager%", "na"));
                a.set(i, a.get(i).replace("%" + (damager - 1) + "thDamager%", "na"));
                a.set(i, a.get(i).replace("%" + (damager + 1) + "thDamager%", "na"));
            }
            if (a.get(i).contains("thDamage")) {
                damager++;
                a.set(i, a.get(i).replace("%" + damager + "thDamage%", "na"));
                a.set(i, a.get(i).replace("%" + (damager - 1) + "thDamage%", "na"));
                a.set(i, a.get(i).replace("%" + (damager + 1) + "thDamage%", "na"));
            }
        }
        return toString(a);
    }
#

this is the whole function

#

the

        for(Pair<OfflinePlayer, Double> pair : topDamagers) {
            int i = topDamagers.indexOf(pair) + 1;
            s = s.replace("%" + i + "thDamager%", topDamagers.get(i - 1).getA().getName());
            s = s.replace("%" + i + "thDamage%", String.valueOf(topDamagers.get(i - 1).getB().intValue()));
        }

part actually sets all the thDamagers as the name and thDamage as the damage

#
        for (int i = 1; i < a.size(); i++) {
            System.out.println(i);
            if (a.get(i).contains("thDamager")) {
                damager++;
                a.set(i, a.get(i).replace("%" + damager + "thDamager%", "na"));
                a.set(i, a.get(i).replace("%" + (damager - 1) + "thDamager%", "na"));
                a.set(i, a.get(i).replace("%" + (damager + 1) + "thDamager%", "na"));
            }
            if (a.get(i).contains("thDamage")) {
                damager++;
                a.set(i, a.get(i).replace("%" + damager + "thDamage%", "na"));
                a.set(i, a.get(i).replace("%" + (damager - 1) + "thDamage%", "na"));
                a.set(i, a.get(i).replace("%" + (damager + 1) + "thDamage%", "na"));
            }
        }

sets instead the remaining thDamager in the config to na

#

cuz like for example, if in the config are supposed to be a top 10 but actually only 5 players hit the mob then the others one who can't fit a name and damage gets just na

spring minnow
spring minnow
tender shard
#

they are normal entities and once they hit the ground, they turn into solid blocks (EntityChangeBLockEvent)

#

there isn't much more to them

smoky oak
#

does Collection.toArray return null or an empty array when the collection is empty?

smoky oak
#

k

spring minnow
#

mfnalex can you help me with the code since you're here? XDD

tender shard
#

that shouldn't matter. how did you spawn the falling block?

sterile token
#

Which is the lastest version of the spigot 1.18?

tender shard
#

are you using World#spawnFallingBLock to spawn them?

sterile token
#

Build tools doesnt find the version

tender shard
smoky oak
#

how does TreeSet sort its entries?

tender shard
#

ok

#

and send your code

#

Try to spawn them 2 blocks higher and see if that makes them become solid once the hit the ground

#

seems like they are already "too low" when they try to become solid

sterile token
#

Just for curious can i see your this#runCommand() method?

tall dragon
#

class lombok.javac.apt.LombokProcessor (in unnamed module @0x7bdb8858) cannot access class com.sun.tools.javac.processing.JavacProcessingEnvironment (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.processing to unnamed module @0x7bdb8858
any1 know what this error upon compiling means?

tender shard
#

are you using it via maven dependency?

tall dragon
#

yes

#

1.18.12

tender shard
#

what java version?

tall dragon
tender shard
#

that version is horribly outdated

#

use latest

#

1.18.22

tall dragon
#

ah yea

tender shard
#

should work then

tall dragon
#

this isnt my project & never had that issue before

tardy delta
#

create a thread pool with fixed size

sterile token
#

Allright do you have full code on github? I wanna to implement your way for executing data. Its looks really clean and insterest

tall dragon
tender shard
#

wrong quote

#

anyway lol

sterile token
#

Oh ok

#

So i cannot see all the redis part ?

tardy delta
#

dunno if there's really a profit of doing that

sterile token
#

Because im just interested on the redis part

tardy delta
#

not really changing much in this case i guess

tender shard
#

what was it?

quaint mantle
#
try (final Response response = client.newCall(request).execute()) {
            final Gson gson = TebexAPI.getGson();
            final JsonObject json = gson.fromJson(response.body().charStream(), JsonObject.class);

            if (!response.isSuccessful()) {
                return TebexResponse.error(json.get(Constant.ERROR_MESSAGE).getAsString());
            }

            return TebexResponse.of(gson.fromJson(array == null ? json.getAsJsonArray() : json.getAsJsonArray(array), type)); // Errors here
        } catch (IOException e) {
            e.printStackTrace();
        }

        return TebexResponse.empty();

Server thread/ERROR Error occurred while enabling EmeraldsPlugin v1.0.0 (Is it up to date?)
25.03 17:07:08 [Server] INFO com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: For input string: "tripwire_hook"

#

Any reason this is erroring?

tender shard
#

tripwire_hook is not a number

quaint mantle
tender shard
#

maybe send the full error

quaint mantle
#

@tender shard Here

tender shard
#

show Responses line 30

quaint mantle
quaint mantle
# tender shard show Responses line 30
{"categories":[{"id":2069325,"order":1,"name":"Keys","only_subcategories":false,"subcategories":[],"packages":[{"id":5027337,"order":0,"name":"Common Key x 5","price":"1.25","sale":{"active":false,"discount":0},"image":false,"gui_item":"tripwire_hook"}],"gui_item":"54"}]}
tender shard
quaint mantle
minor fox
tardy delta
#

formatting lol

tender shard
#

no I meant the class that's mentioned in your stacktrace

quaint mantle
quaint mantle
#

Here is the class

tender shard
#

what does TebexAPI.getGson() return? an empty gson object?

quaint mantle
# tender shard what does TebexAPI.getGson() return? an empty gson object?

Returns:

private static final Gson GSON = new GsonBuilder()
            .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
            .registerTypeAdapter(new TypeToken<Discount.DiscountType>() {}.getType(), new Discount.DiscountTypeDeserializer())
            .registerTypeAdapter(new TypeToken<Effective.EffectiveType>() {}.getType(), new Effective.EffectiveTypeDeserializer())
            .create();
tender shard
#

it expects "gui_item" to be of type int

#

hm you must have somewhere, somehow told it that "gui_item" is a number, which makes sense since your actual response contains "gui_item" twice and once it's actually a number

quaint mantle
# tender shard hm you must have somewhere, somehow told it that "gui_item" is a number, which m...

Well, here is the TebexResponse class if that helps

package me.emerald.emeraldsplugin.http.objects;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.function.Consumer;

public class TebexResponse<T> {
    private final boolean successful;
    private final T data;
    private final String errorMessage;

    private TebexResponse(@Nullable T data, @Nullable String errorMessage) {
        this.successful = errorMessage == null;
        this.data = data;
        this.errorMessage = errorMessage;
    }

    @NotNull
    public static <T> TebexResponse<T> of(@NotNull final T data) {
        return new TebexResponse<>(data, null);
    }
    
    @NotNull
    public static <T> TebexResponse<T> error(@NotNull final String errorMessage) {
        return new TebexResponse<>(null, errorMessage);
    }
    
    @NotNull
    public static <T> TebexResponse<T> empty() {
        return new TebexResponse<>(null, null);
    }
    
    public boolean isSuccessful() {
        return successful;
    }
    
    @Nullable
    public T getData() {
        return data;
    }
    
    @Nullable
    public String getErrorMessage() {
        return errorMessage;
    }
    
    public TebexResponse<T> ifSuccessful(final Consumer<T> data) {
        if (isSuccessful()) {
            data.accept(this.data);
        }

        return this;
    }
    
    public void ifNotSuccessful(final Consumer<String> errorMessage) {
        if (!isSuccessful()) {
            errorMessage.accept(this.errorMessage);
        }
    }
}

#

.. Didnt expect it to be that big.

#

Oops.

sterile token
#

How much would you ask for your redis implementation system?

tender shard
#

as said, one of those classes you want to deserialize probably has a a field called "guiItem" or sth like that that's a number and not a string

quaint mantle
#

Its converting the keys into numbers.

misty ingot
#

how can I get an offline player with the username? (Bungeecord)

tender shard
#

I don't think that bungeecord saves any playerdata

#

is there even sth like offlineplayer in bungee?

#

iirc no

misty ingot
#

any way to do it? I need a way to get the player uuid for database stuff

tender shard
#

you can just manually store that data with a plugin

#

just create a mysql table / json file / yaml file / sqlite db / whatever

#

and save UUID <> name yourself there

misty ingot
#

I was trying to avoid having to do that but I guess I have to

grim ice
#

Executors.newScheduledThreadPool(1).scheduleWithFixedDelay(() -> {

    }, 3, timeMillis , TimeUnit.MILLISECONDS);
#

if timeMillis change

#

in between the delays

#

will the time chang

#

change

#

if not how can i do it

quaint mantle
#

@tender shard Can I change how building works so it runs other commands on the terminal in intel idea

smoky oak
#

does HashMap.equals(HashMap) return true if both maps are identical in their keys and values, or does it consider loadfactor and initial/current size?

brave sparrow
#

Key value pairs

sharp bough
smoky oak
brave sparrow
smoky oak
#

ah

#

right

golden kelp
#

hey guys I m using PluginManager.getPlugin("EssentialsX) to get the plugin EssentialsX but its throwing a NPE

void wraith
#

Hi! How to close port with iptables?

sterile token
vocal cloud
smoky oak
void wraith
golden kelp
#

ohhh

#
loadbefore: EssentialsX

This or

loadbefore: [ EssentialsX ]
brave sparrow
smoky oak
#

second i believe

brave sparrow
sterile token
brave sparrow
#

So it will always be null

#

You need depend, not loadbefore @golden kelp

vocal cloud
#

Yeah don't listen to them

brave sparrow
#

Theyโ€™re wrong

#

Lol

vocal cloud
#

Use depend

golden kelp
#

xD

#

I want my plugin to load at the last, can I do that?

brave sparrow
#

If you know every other plugin

#

Otherwise no

lavish hemlock
#

Depend on all plugins that ever existed

smoky oak
brave sparrow
#

Youโ€™re only guaranteed to load after the plugins you depend on

golden kelp
#

I want to get all the plugins of a server, so i can get their dcurrent version

vocal cloud
#

You make a runnable that executes your enable code 1 minute after server start

brave sparrow
#

Donโ€™t do it on load

#

Yeah

#

Run it later

vocal cloud
#

Or I imagine there is an event for it

golden kelp
#

almost spelt the godly word wrong

quaint mantle
#

I fixed my code, but had to redo a ton of it :/

smoky oak
quaint mantle
golden kelp
smoky oak
#

also note that i still operate under a 'if it works' philosophy

tardy delta
#

i had the X one in my plugins folder

golden kelp
#

I have X in my folder

sterile token
#

I have X in my folder

golden kelp
vocal cloud
#

Then it's the wrong name

#

Check their plugin yml

tardy delta
#

im very sure its just Essentials

golden kelp
#

oh

#

then its just the case fo essentials ig

misty ingot
#

how can I get the UUID of an offline player using their name?

golden kelp
#

i woudlve used namemc api but theres definately a better way

tender shard
#

Bukkit.getOfflinePlayer(String)

#

OfflinePlayer.getUniqueId()

misty ingot
#

oh forgot to mention

#

its bungeecord

tender shard
#

there are still no offlineplayers in bungeecord

#

bungee only knows ProxiedPlayers

keen basin
#

How do I set my plugin support spigot and bungeecord ?

tender shard
#

did you ever do any bungeecord plugin?

#

if you have code for both bungee and spigot, simply include a plugin.yml and bungee.yml

#

the bungee.yml obviously points to your bungee plugin main class while the plugin.yml points to your spigot plugin main class

viral crag
#

could always ask the user cache

tender shard
#

which one? bungee has none

viral crag
#

well the server one is the only relevent one, since only known players would be in it

#

if a player made it to the proxy lobby and never joined a server, I am not sure they are really useful to know?

tender shard
#

a server could have many different lobby servers though

#

the only proper way is to cache UUID <> Name on the proxy itself using a file or database

grim ice
#

how do i

#

service.scheduleWithFixedDelay

#

with a changing delay

#

i want the delay to be something else each time