#help-development

1 messages ยท Page 144 of 1

kindred valley
#

actually

#

no

#

it does not

iron glade
#

then you're probably returning from the condition before

#

Add a debug message before returning and see if it runs through

wintry ibex
chrome beacon
undone axleBOT
wintry ibex
eternal oxide
#

paste teh full log as your snippet shows no actual error

wintry ibex
#

what

eternal oxide
#

oh looks like you have a corrupt file in your local maven

wintry ibex
#

h-how to fix

eternal oxide
#

delete the 1.12.2 folder C:\Users\Nurisantoso\.m2\repository\org\bukkit\craftbukkit\1.12.2-R0.1-SNAPSHOT

wintry ibex
#

bc i have wait buildtools for 20+ minute to run bruh

eternal oxide
#

delete the folder ^ and run buildtools again.

wintry ibex
#

this folder?

eternal oxide
#

if that is the folder I linked then yes

wintry ibex
#

ok

#

do i need to delete this folder on buildtools folder?

eternal oxide
#

You shouldn't need to.

wintry ibex
#

Ok

eternal oxide
#

just run buildtools again

chrome beacon
#

It can help to remove the old BuildTools files

wintry ibex
#

yeah done, now i just need to wait 20+ minutes

eternal oxide
#

you could probably just run mvn install but I can;t remember the full command

#

Silly question to ask at this point. Are you using 1.12.2 NMS?

#

Yay 3 minutes left of backing up my 4 TB of data on my NAS

wintry ibex
#

what NMS

eternal oxide
#

I guess not then

wintry ibex
#

ok

weak bear
#

Hello How can I do a command clickable message pls I try with TextComponent but I cannot create a new TextComponent

wintry ibex
#

ah still same error

chrome beacon
wintry ibex
#

@eternal oxide still same error

chrome beacon
eternal oxide
#

same error with buildtools?

wintry ibex
#

yes

eternal oxide
#

Then paste full log

wintry ibex
#

wait

lost matrix
wintry ibex
weak bear
chrome beacon
#

Mohist ๐Ÿ’€

lost matrix
#

wtf is Mohist?

chrome beacon
#

A bad Forge + Spigot hybrid with security issues

lost matrix
#

Forge implementing Paper

#

i see

#

Back in the days we used Cauldron for this XD

lost matrix
weak bear
#

Okay

#

Thx

wintry ibex
weak bear
#

I dont find the method of Bukkit or paper

eternal oxide
#

looking, but I see no reason for your error

wintry ibex
#

@eternal oxide

#

so how to fix

eternal oxide
#

um, at prompt type mvn

#

nope, ignore me

wintry ibex
#
AzureAD+Nurisantoso@PUTRA MINGW64 /e/BuildTools
$ mvn
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.408 s
[INFO] Finished at: 2022-09-21T18:54:45+07:00
[INFO] ------------------------------------------------------------------------
[ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [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/NoGoalSpecifiedException
eternal oxide
#

I have to say, I've never seen your error before

lost matrix
# weak bear That's not work
TextComponent message = new TextComponent("Click me");
message.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "some command") );
message.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Goto the Spigot website!").create()));
player.spigot().sendMessage(message );
wintry ibex
#

i type mvn and that happened

lost matrix
eternal oxide
#

nah that was me

#

his error is strange

wintry ibex
#

;/

lost matrix
#

Whats his plan? Didnt follow. This looks like he is trying to compile BuildTools for some reason.

eternal oxide
kind hatch
#

What's the full command that he ran initially?

eternal oxide
#

his command is fine just java -jar buildtools.jar --rev 1.12.2

lost matrix
#

Delete everything besides the BuildTools.jar
There might be fragments of newer versions interfering
and its --rev

weak bear
#

Error: 'TextComponent(java.lang.String)' is not public in 'java.awt.TextComponent'. Cannot be accessed from outside package

eternal oxide
#

already had him do that

#

even had him move it off his desktop

#

still throws that error

#

same error every time

lost matrix
eternal oxide
#

I've never seen his issue before. Never even mentioned

wintry ibex
#

hm

weak bear
#

or Paper

#

Look you PM @lost matrix

kind hatch
lost matrix
eternal oxide
#

did that, Had him delete teh folder

#

um one sec

#

it was a different file last time

#

it was the 1.12.2 folder

kind hatch
#

Which ones? The entire .m2? Or only the craftbukkit folder?

wintry ibex
#

craftbukkit

weak bear
eternal oxide
#

Yes, this is a slightly different error

lost matrix
weak bear
#

Yes I think that's true

#

I dont think so that mohist use spigot api

eternal oxide
#

First error [ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.4:install (default-install) on project craftbukkit: Failed to install metadata org.bukkit:craftbukkit:1.12.2-R0.1-SNAPSHOT/maven-metadata.xml: Could not parse metadata C:\Users\Nurisantoso\.m2\repository\org\bukkit\craftbukkit\1.12.2-R0.1-SNAPSHOT\maven-metadata-local.xml: only whitespace content allowed before start tag and not \u0 (position: START_DOCUMENT seen \u0... @1:1) -> [Help 1]

#

Second error [ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.4:install (default-install) on project craftbukkit: Failed to install metadata org.bukkit:craftbukkit/maven-metadata.xml: Could not parse metadata C:\Users\Nurisantoso\.m2\repository\org\bukkit\craftbukkit\maven-metadata-local.xml: only whitespace content allowed before start tag and not \u0 (position: START_DOCUMENT seen \u0... @1:1) -> [Help 1]

#

same cause different files

wintry ibex
#

first error is this

lost matrix
eternal oxide
#

he is using git bash

lost matrix
#

Then use the normal terminal ๐Ÿ˜„

eternal oxide
#

๐Ÿ™‚

wintry ibex
eternal oxide
#

run in command prompt instead of gitbash

#

but

wintry ibex
#

already

echo basalt
eternal oxide
#

first delete the folder C:\Users\Nurisantoso\.m2\repository\org\bukkit

lost matrix
#

Na C users nvm

wintry ibex
#

Windows 10

eternal oxide
#

yes, clean it all out so nothign is old

echo basalt
#

bukkit folder in cache

#

yeah

eternal oxide
#

and run in command prompt not git bash

wintry ibex
#

ok

#

i will delete this folder again in buildtools folder

eternal oxide
#

yep, start everything clean

wintry ibex
#

Oke

kind hatch
#

You shouldn't need to in this case.

eternal oxide
#

Best to be safe as nothing else has worked ๐Ÿ˜‰

fluid river
#

clap 4 me

#

another successful java lesson

eternal oxide
#

oh my, I just took 5 days backing up my NAS due to a failed drive (bought a full replacement set) updated and rebooted it and the dead drive sprang to life ๐Ÿ˜ฆ

lost matrix
#

F

kind hatch
#

Lol. At least you now have spares at the ready.

eternal oxide
#

Yep, not a lot of use for 5 x 3 TB drives now though. Upgrading to 5 x 6TB

#

Can;t put them in my PC either as I'm all SSD other than an Archive drive

fluid river
#

F

eternal oxide
#

very F

fluid river
#

learning from random discussion is nice

hazy parrot
#

btw now when you mention it, there is no way to copy some text with click event on component ?

#

just SUGGEST_COMMAND ig ?

kind hatch
warm light
#

Anyone can tell me how can I get the id?

#

I did this but not working

lost matrix
#

response -> resource -> id

lost matrix
warm light
#

Its giving org.json.JSONException: A JSONObject text must begin with '{' at 1 [character 2 line 1] error

lost matrix
#

pipe the stream into a String and print it. I personally would always use the httpclient from java 11 for rest requests

tardy delta
#

probably free

#

depends on quality

wintry ibex
#

Yessssss

#

after waiting 1 hour+ my buildtools now no error again

#

Yeaaaaa

fluid river
#

there's only way lol

#

player.getInventory().getItemInMainHand()

#

or OffHand

lost matrix
#

There are several ways. I would go over PlayerInventory

fluid river
#

umm you just code it wrong then

paper falcon
#

would it be possible to make it so whenever a player types a message, I automatically send message in chat as well. Contents don't matter rn I'll modify it.
But I don't want a plugin, ik how to make it, could I modify it in my client, so I'm playing on random servers and when someone chats I chat

#

do I need to make a whole new client for this?

#

slash launcher

vital mica
#

Make a mod?

lost matrix
#

You need client modifications for that

paper falcon
lost matrix
#

client modification = A modification of the client

paper falcon
#

lol

river oracle
#

Forge or fabric

#

For the normies

lost matrix
#

In theory you could also do packet sniffing and write a 3rd party application which sends back chat packets

tawdry python
#

Hello, I want to create a world whenever the server starts, in case this world already exists, I want to replace it with a new one, can anyone help? any documentation?

lost matrix
#

?jd

rough drift
#

well tbf the client has 0 clue about the sender

#

it only knows the message

#

so like

#

<IkeVoodoo> hey

#

that's the message

#

and it has to parse to figure out who sent it

lost matrix
# tawdry python Hello, I want to create a world whenever the server starts, in case this world a...

Creating a world:

    WorldCreator creator = new WorldCreator("worldname");
    Bukkit.createWorld(creator);

WorldCreator also has a bunch of parameters you can tweak.

Some inspiration for checking if a folder exists and removing a directory recursively

  public boolean worldFolderExists(String worldName) {
    return new File(Bukkit.getWorldContainer(), worldName).exists();
  }

  public void removeWorldFolder(String worldName) throws IOException {
    deleteDirectory(new File(Bukkit.getWorldContainer(), worldName));
  }

  private void deleteDirectory(File directoryToBeDeleted) {
    File[] allContents = directoryToBeDeleted.listFiles();
    if (allContents != null) {
      for (File file : allContents) {
        deleteDirectory(file);
      }
    }
    directoryToBeDeleted.delete();
  }
robust light
#

how can I get the last damager of a player if they fall into the void?

worldly ingot
#

Well, the last damager would be the void ๐Ÿ˜…

rough drift
#

they probs meant the last human damager

robust light
#

I mean the last player, that damaged the player

rough drift
#

in that case just store a hashmap

#

<UUID, UUID>

rough drift
#

and on player damage update it

#

you can just call #put again to update

worldly ingot
#

That value might be null though because Minecraft only tracks the last player damager for up to (10?) seconds

rough drift
#

yep

#

and also zombies

#

zombies result in null

#

so do mobs

worldly ingot
#

Yeah because it would be the last damager

rough drift
#

only players are tracked in that method

robust light
#

I used Objects.requireNonNull(player.getKiller()).getInventory().addItem(giveThisOnPlayerKill);
in the PlayerDeathEvent but it doesnt work, any idea why? (giveThisOnPlayerKill is an Itemstack)

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.

robust light
lost matrix
#

Is the listener registered? Did you add the EventHandler annotation?

robust light
#

yeah

worldly ingot
#

(also remove the Objects#equireNonNull(), it doesn't do what you think it does)

#

Just do a proper null check

robust light
#

if I check if the killer is online, would that be a proper null check?

echo basalt
lost matrix
warm light
chrome beacon
#

What nbt tag do you want to check for?

lost matrix
eternal oxide
#

I'm going to guess your request doesn;t account for redirects

lost matrix
#

Thats why i would just use javas httpclient

#

Instead of opening a random stream on an url

worldly ingot
#

ItemStack#hasItemMeta()

untold jewel
#

Anyone who has a DataManager/FileManager class with everything normal config has like customConfig#set customConfig#contains

#

etc

eternal oxide
#

?configs

undone axleBOT
slim kernel
#

Hello! I made a spigot 1.18.2 plugin which works perfectly on my spigot server. But when I put it on my friends Bungeecord Paper Server also 1.18.2 everything works aswell except one method which is only doing some for loops to check if there is a block or not.... Anyone know what the problem could be?

eternal oxide
#

We are supposed to guess from that?

#

I say sunspots

lost matrix
slim kernel
slow wigeon
#

Hello

lost matrix
eternal oxide
slow wigeon
#

Bro I open spigot and error is coming how to solve

lost matrix
untold jewel
#

xD

green prism
#

How can I obfuscate a plug-in?
I don't need any moral advice

lost matrix
lost matrix
slim kernel
slow wigeon
#

I can send my error photo in dicord

eternal oxide
#

I'm going to guess that your "friends" server uses a different main world name.

green prism
#

ElgarL is my dad

floral drum
#

cap

lost matrix
#

nocap

green prism
#

no cap

floral drum
#

if something can be obfuscated, it can be deobfuscated owo

slim kernel
green prism
floral drum
#

unless it's variable name/field changing

#

what are you trying to hide?

green prism
#

an hello world plug-in

lost matrix
green prism
#

Smile

#

Could you help me?

lost matrix
#

Sure

green prism
#

?paste

undone axleBOT
green prism
slim kernel
lost matrix
lost matrix
slim kernel
lost matrix
green prism
#

hint:
those are the problem

    public int getMaxPlayers(String server) {
        try {
            AtomicInteger max = new AtomicInteger(-1);
            CountDownLatch latch = new CountDownLatch(1);
            ProxyServer.getInstance().getServerInfo(server).ping(((result, error) -> {
                if (error == null) {
                    max.set(result.getPlayers().getMax());
                }
                latch.countDown();
            }));
            latch.await();
            return max.get();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return 0;
    }```
#

Idk how to fix

eternal oxide
lost matrix
slim kernel
#

Oh didnt think of that thank you

lost matrix
green prism
#

I believe that, the ping action, takes a longer delay sometimes

#

for returning a response

lost matrix
#

Yes thats the nature of a ping. Thats why you have to pass a callback because the ping might take some time.

green prism
#

what can I do to reduce that delay time?

#

I'm stuck in this process

lost matrix
#

Nothing

green prism
#

So, any queue plug-in has the same problem?

lost matrix
#

There are a ton of approaches to this like caching the amount or tracking the connected players manually.

lost matrix
#

Ive written a queue plugin with instant responses. It was event driven and backed by redis topics.

green prism
#

hoW

lost matrix
#

Have a Queue of connections. When a player leaves -> poll the queue and connect the next player.

#

You can use a PriorityQueue and even force an ordering so you can support premium queues.

#

Or just a simple ArrayDequeue. First come, first serve.

green prism
#

I'm using a private final Map<String, LinkedList<ProxiedPlayer>> queues;

lost matrix
#

Ah yes. The LinkedList. The worst possible Dequeue. (But should work)

short cedar
#

This is not my exact code

but i have something like this

``

String materialName = args[0].toUpperCase();
try {

    if (location.getBlock().getType().equals(Material.getMaterial(materialName)))         {
         // code here to use material
     }

}catch (IllegalStateException e)
{
player.sendMessage("ยงcYou have to input a invalid material!");
return true;
}

``

and I still get a IllegalStateException error

green prism
#

whats an ArrayDequeue

dusk flicker
#

Google

green prism
dusk flicker
#

ArrayDequeue is in Java

#

A simple Google will tell you that

lost matrix
green prism
# lost matrix

What changes between the two?
Why should I use it instead of LinkedList?

#

I'm not understanding this

lost matrix
#

Dont worry. Doesnt matter for you.

green prism
#

wdym

lost matrix
#

You can take that quite literally. Do not worry. It does not really matter if you use a LinkedList or an ArrayDequeue in your case.

short cedar
lost matrix
eternal oxide
#

DA is not a material

short cedar
#

but thats what im trying to catch

#

but it doesnt catch the error, and then sends me an internal error in console saying the thing im trying to catch

lost matrix
green prism
lost matrix
dusk flicker
green prism
#

thx

short cedar
#

im using IllegalStateException e

and the error
Caused by: java.lang.IllegalArgumentException: No enum constant org.bukkit.Material.DA

I might be stupid, but I thought those are the same, where can i read up on all the exceptions to learn better

lost matrix
short cedar
#

thank you

#

oh i see LMAO

state expection
argument exception

very stupid mistake

#

.

Thank you everyone for the assistance

green prism
#

what's playeronjoin event equivalent in bungee?

vivid skiff
#

how can i get a key from a value?

lost matrix
#

Are you speaking about maps?

vivid skiff
#

yes

eternal oxide
#

BiMap

river oracle
vivid skiff
#

I asked the wrong thing, i wanted to say how can i get a HashMap key

river oracle
#

And filter

lost matrix
#

In theory there could be several keys which correspond to a value.
But if the 1 to 1 contract is bidirectional then you can either use a BiMap
from Guava, use a second Map or store the key inside the value.

green prism
#

what is a bimap

vivid skiff
#

thakns

green prism
#

google, okay, im sorry guys

green prism
#
public Counter(final HQueue plugin) {
        for(String server : ProxyServer.getInstance().getServers().keySet()) {
            server = server.toLowerCase();

            if(plugin.getConfigs().getConfig().getString("servers." + server + ".max-player") == null) {
                plugin.getConfigs().getConfig().set("servers." + server + ".max-player", 100);
                plugin.getConfigs().saveConfig();
                plugin.getMaxPlayerCount().put(server, plugin.getConfigs().getConfig().getInt("servers." + server + ".max-player"));
                continue;
            }

            if(plugin.getConfigs().getConfig().getString("servers." + server + ".join-permission") == null) {
                plugin.getConfigs().getConfig().set("servers." + server + ".join-permission", "hqueue.join." + server);
                plugin.getConfigs().saveConfig();
                plugin.getJoinPermission().put(server, plugin.getConfigs().getConfig().getString("servers." + server + ".join-permission"));
                continue;
            }


            plugin.getJoinPermission().put(server, plugin.getConfigs().getConfig().getString("servers." + server + ".join-permission"));
            plugin.getMaxPlayerCount().put(server, plugin.getConfigs().getConfig().getInt("servers." + server + ".max-player"));



        }```


Doesn't saves into the settings.yml file, could you help me?

```java
    public void saveConfig() {
        try {
            ConfigurationProvider.getProvider(YamlConfiguration.class).save(config, new File(plugin.getDataFolder(), "settings.yml"));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }```
#

please fourteen

#

I believe in you pal

vivid skiff
#

How can i get only the text, test from a HashMap keySet and not [test]?

green prism
#

Maybe String.join?

tall dragon
pseudo hazel
#

what are you doing to get [test]

lost matrix
#

You mean your KeySet contains Strings in the format "[data]" and you want to only get the "data" part?

vivid skiff
#

yes

lost matrix
#

Why do you store the Strings in this format?

green prism
#

yoo guys, at the first strange thing you all reply, to me you didn't even put a reaction to the message :C

eternal oxide
#

He's probably not. He's getting the KeySet and sysout. It will show as that

vivid skiff
#

because i need it for a playerdata where it saves like:

gangs:
gangname:
....

and i need to add a new path to the gang

eternal oxide
#

if he has a single entry

dusk scroll
#

https://pastebin.com/QdtC3X1V
I am getting a nullpointerexception in the addPriceToLore method in my ShopItems enum here.
Where it attempts to get the shop on line 393
I do not understand how this value could possibly be null, as if you check the enum it specifies the shop it's supposed to be getting for each item.
(ex. GOLDEN_APPLE) is what it is trying to get when I get this error.
Does anyone know why it would do that in this case?

tall dragon
pseudo hazel
#

well if you inly want one item in a set or array or list, you just use .get(i)

#

where i is the index of the item, in this case probably 0

vivid skiff
worldly ingot
lost matrix
vivid skiff
#

                if (gangInvite.containsValue(player.getUniqueId())) {

                    String gang = String.valueOf(gangInvite.keySet());

                    RPGangs.getInstance().addGangMember(gang, player.getUniqueId());
                    player.sendMessage("ยง4ยงlGANGS ยง8ยป ยง7Ti sei unito alla ยงc" + gang + "ยง7!");```

right now is like this
dusk scroll
#

in this case, it is trying to get the currency display name from the shop, but it believes the shop is null

#

even though it is specified in the enum

lost matrix
tall dragon
eternal oxide
#

BadString gang = String.valueOf(gangInvite.keySet());

vivid skiff
#

it gets the gang name with the format [gangName] and i don' t know how to remove the []

eternal oxide
#

as I said, you are toString on a KeySet

dusk scroll
eternal oxide
#

You are calling toString() on the Keyset which gives you [] around the keys

dusk scroll
vivid skiff
#

How can i fix it?

eternal oxide
#

read the keys properly

dusk scroll
#

As you can see every System.out.println() before it works fine.

#

But as soon as it tries to print the shop debug, it has an error

vivid skiff
eternal oxide
#

you either iterate the keys or you read a specific key

lost matrix
dusk scroll
#

I know that. That's what ive been saying

#

It should not return null

#

It is directly specified in the enum for the item

#

that's what ive been asking the whole time, if anyone would know why that could be

lost matrix
#

Is Shops and enum? @dusk scroll

dusk scroll
#

Yes, Shops is an enum

#

I can send that too if you want

lost matrix
#

Circular reference

dusk scroll
#

is that not allowed?

#

i never got any error for that before

#

What it is doing is

#

When I click on the menu item to open that shop menu

lost matrix
#

Let me think how enums are initialized

dusk scroll
#

It is basically looping through all the shop items to add them to the gui

#

The reason it is referencing back to the shop in this case, is to get the currency display name to put in the price of the item

pseudo hazel
#

is the GOLD one the only one that doesnt work?

dusk scroll
#

I only implemented GOLD and DIAMOND into the inventoryclickevent for testing. Neither one works.

#

For the same reason

pseudo hazel
#

and how is createItem called?

lost matrix
#

Using enums for this is really a horrible design choice. But i can only speculate that you are dealing with a initialisation problem.

pseudo hazel
#

I asume you dont get a nullpointer because of the item.getDisplayName aswell right before addPriceToLore call right?

dusk scroll
dusk scroll
#

where it tries to print out the shop as well (was debugging to see what was null and that's how i narrowed it down)

dusk scroll
# pseudo hazel and how is createItem called?

createItem gets called when the GUI is being created. it takes the information for the item from the enum to create an item with the material, displayname, enchants, etc as configured, and even adds the existing lore, then it will call addPriceToLore() to add the price onto the existing lore and then return the new lore so the item can be created

lost matrix
dusk scroll
#

All those methods are outside the constructor

pseudo hazel
#

it might still be a circular reference though

lost matrix
#

Im also leaning towards this

pseudo hazel
#

because the ShopItems constructor constructs the enum value for Shops, but in that enum constructor you call the ShopItems Item

lost matrix
#
        System.out.println(item.displayName);
        System.out.println(item.getShop());

So this prints
"Golden Apple"
"null"

dusk scroll
#

correct

pseudo hazel
#

this seems like a design flaw

#

why does the item need to know the shop it came from

#

shouldnt just the shops knowing what items they have be enough for everything?

lost matrix
#

Yeah its almost certainly a problem with two enums referencing each other

dusk scroll
#

i think i had some reason but i don't remember it TBH, I did all of this last night ๐Ÿ˜‚

#

I'll have it provide the shop it's looping through in the method

#

maybe that will fix it

#

lol that worked ๐Ÿ˜ƒ

#

now ive just gotta change the order of the items and add the interaction back

#

(im reworking the shop system, previously it was hardcoded into a listener which was pretty trash but now with that at least it's configurable through the enum ๐Ÿ˜‚)

tardy delta
#

Map<Integer, Consumer<InvClickEvent>>?

lost matrix
tardy delta
#

best thing

iron glade
dusk scroll
iron glade
#

don't like see through ones

#

although they can be nice for pvp and minigames n stuff

prime reef
#

just spitballing for a second, but i'm thinking about trying to untangle the game code a little w.r.t threading

dusk scroll
prime reef
#

I despise that I have to use my old username here lmao

dusk scroll
iron glade
prime reef
prime reef
#

aye

lost matrix
#

*mostly

prime reef
#

guessing that "mostly" has to do with stuff like hover components

#

but that's a conjecture lmao

#

and a very raw one at that

#

anyway, asking since I've got a pretty chunky plugin and while I haven't properly stress-tested it yet, I'm considering ways to reduce or distribute CPU load

#

aside from cutting down the regular old asymptotic runtimes I mean

severe marsh
#

So I have this function which is supposed to transfer skull item into skull with custom texture:

public static ItemStack getHead(ItemStack item, String url, UUID uuid) {

        try {

            SkullMeta headMeta = (SkullMeta) item.getItemMeta();
            
            GameProfile profile = new GameProfile(uuid, null);

            Property property = new Property("textures", Base64Coder.decodeString(url));

            profile.getProperties().put("textures", property);

            try {

                Field profileField = headMeta.getClass().getDeclaredField("profile");

                profileField.setAccessible(true);
                profileField.set(headMeta, profile);

            } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) {

                e.printStackTrace();
            }

            item.setItemMeta(headMeta);

        } catch (Exception ex) {

            ex.printStackTrace();

        }

        return item;


    }```
#

However it always returns normal steve head

dusk scroll
#

you can def offload some tasks to async

#

but just be careful and considerate

severe marsh
#

Here's the URL: eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZWQyZDM2NzQ3YmMzZTJjMzdkOTFmYWZlYjU2MjhjZDg4N2ZjZjU0ZWVkNDllY2Y3ZGRjNTRkMjAzMzYzMzNmMCJ9fX0=

dusk scroll
#

since obviously not everything will work in async

prime reef
#

The way I usually see more intensive shit like dungeons/raids handled is honestly just through BungeeCord lmao, as in "let's just have a separate server process that hosts this other world"

prime reef
#

and there's not really a need to do it sync

iron glade
#

?paste

undone axleBOT
prime reef
#

but I was thinking more uh

#

and this is obviously complex, I just spent 6 weeks working on something similar for work

#

basically dynamically partitioning the world based on player density lmao

lost matrix
prime reef
#

then distributing computation load across multiple sync threads

severe marsh
lost matrix
undone axleBOT
prime reef
#

It's sort of a worst-case optimization, like the plugin runs fine rn, but I've never seen it with like 1k people online at once lmao

prime reef
#

for this exact reason, actually

dusk scroll
# lost matrix ?1.8

I'm so tired of people ragging on people for using 1.8 when more players use it and so do the most popular servers in the game ๐Ÿ˜‚

dusk scroll
#
ItemStack head = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
        if (url.isEmpty())
            return head;
        SkullMeta headMeta = (SkullMeta) head.getItemMeta();
        headMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', name));
        GameProfile profile = new GameProfile(UUID.randomUUID(), null);
        byte[] encodedData = Base64.getEncoder()
                .encode((String.format("{textures:{SKIN:{url:\"%s\"}}}", url)).getBytes());
        profile.getProperties().put("textures", new Property("textures", new String(encodedData)));
        Field profileField = null;
        try {
            profileField = headMeta.getClass().getDeclaredField("profile");
            profileField.setAccessible(true);
            profileField.set(headMeta, profile);
        } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e1) {
            e1.printStackTrace();
        }

        headMeta.setLore(lore);
        head.setItemMeta(headMeta);

        return head;
    ```
prime reef
#

I was initially thinking about just launching a thread for this plugin by itself, but tbh, forking Spigot might not be the worst idea for general optimizations

lost matrix
#

1.8 is a bubble

prime reef
#

tbh i don't see why people cling to 1.8 the way they do

#

i don't know what's so great about it

dusk scroll
prime reef
#

i've been playing this game since i was literally 9 years old (older cousin bought it for me as a birthday present in 2008) and idk I've enjoyed seeing it change

#

i'm now almost 24 lmao

prime reef
trim creek
lost matrix
# prime reef i don't know what's so great about it

Its horribly outdated. It has many bugs which will never be fixed.
Absolute garbage version which is only played by pvp fortnite kiddies which
wanna hammer their left mouse button real fast. Everything more complex
is too hard to comprehend for them.

prime reef
#

but the server software? I was under the impression they'd actually cleaned up a lot of server performance

#

I mean just watching the profiler the GC is doing way less work but that might be my launch settings actually

trim creek
dusk scroll
#

My entire experience with the latest Java version has been quite terrible

prime reef
dusk scroll
#

Everytime there's an issue

lost matrix
prime reef
#

Maybe it was 2009 and I was 10, idk

#

I was a literal child so my memory isn't the greatest

iron glade
#

2009 was early access

dusk scroll
#

I ran a server with it and the memory kept climbing up and up. Like the GC didn't even work. lmao

drowsy pawn
#

hello can help ProtocolLibrary.getProtocolManager().addPacketListener((PacketListener)new PacketAdapter((Plugin)plugin, new PacketType[] { WrapperPlayClientUseEntity.TYPE }) { public void onPacketReceiving(PacketEvent event) { if (event.getPacketType() == WrapperPlayClientUseEntity.TYPE) { WrapperPlayClientUseEntity packet = new WrapperPlayClientUseEntity(event.getPacket()); if (TrollCommandMain.this.names.containsKey(event.getPlayer().getName()) && packet.getType().equals(EnumWrappers.EntityUseAction.ATTACK) && packet.getTargetID() >= TrollCommandMain.this.set.startID && packet.getTargetID() <= ((WatchDogPlayer)TrollCommandMain.this.names.get(event.getPlayer().getName())).getLastID()) { int hits = ((WatchDogPlayer)TrollCommandMain.this.names.get(event.getPlayer().getName())).getHits(); TrollCommandMain.this.names.put(event.getPlayer().getName(), ((WatchDogPlayer)TrollCommandMain.this.names.get(event.getPlayer().getName())).upHits()); if (hits >= TrollCommandMain.this.triggerBhop) { TrollCommandMain.this.btc.addBhop(event.getPlayer().getName()); } else { TrollCommandMain.this.btc.send(event.getPlayer(), "&4&lNETRANKYK, NES BUSI PALAIKOMAS SUKCIUMI!"); } } } } }); this.btc = new BhopTask(this); this.set = new Settings(); plugin.getServer().getPluginManager().registerEvents(new TrollListener(this), (Plugin)plugin); }

dusk scroll
#

Went back to Java 8, no problem

untold nymph
prime reef
#

but I know I played MC classic lmao

trim creek
# prime reef ...the game had an /indev/?

The indev version was released in 2010. The game's first version was released in 2009 (and its original name - Cave Game - has been replaced to Minecraft with that)

dusk scroll
#

how can we see the problem with no info

prime reef
#

if you bought the game you could get a custom skin

dusk scroll
lost matrix
#

Im not gonna get into this but if you prefer java 8 then you are standing
right here

dusk scroll
prime reef
#

yeah i'm ngl, there was this super hairy ugly period where both spigot and java were kind of shit, and the older versions were just easier to work with

#

but Java 16+ and the latest game versions are actually really nice

drowsy pawn
dusk scroll
untold nymph
prime reef
severe marsh
#

no error

prime reef
severe marsh
#

it just returns steve head

dusk scroll
kind hatch
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.

prime reef
#

it's not really a learning experience if you're doing it wrong

iron glade
dusk scroll
#

Learning NMS is extremely valuable.

untold nymph
severe marsh
lost matrix
prime reef
#

NMS is only valuable if you plan on diving into more complex mechanics.

severe marsh
#

@iron glade

iron glade
severe marsh
dusk scroll
prime reef
#

false

iron glade
prime reef
#

if you have to use NMS nowadays, you're doing one of two things:

  1. Whatever you're doing, you're doing it the wrong fucking way, because Spigot has APIs for pretty much everything except modifying mob AI
  2. Modifying mob AI
severe marsh
#

didn't work

iron glade
#

hm weird, I have no idea if it works in 1.8, it works for me in 1.17+

trim creek
# lost matrix Im not gonna get into this but if you prefer java 8 then you are standing right ...

And this is something I hate in most people. Most devs prefer every other to use the latest software. Its not how it goes by. As I look into all this, most devs just do not realize, that others has their own minds. If they prefer an older software, they shall use it. I use 1.8 and 1.18, while doing stuff in 1.16 as well. I don't mind if I get no support on 1.8. I just google my problem, and voilรก. I typically hate when everyone forces me to do use this and that. No. That's not how its going to work. Just stop being mean telling people they are stupid because they prefer an older software. Each software has its own greatness. And you HAVE TO ACCEPT IT.

dusk scroll
#

It also forces you to learn advanced java concepts like reflection you might not have to use in the later versions

severe marsh
#

it is possible btw, as this command works

/give @p skull 1 3 {display:{Name:"Pumpkin Spice Latte"},SkullOwner:{Id:"9aac9003-8d9b-461d-bcdd-1ffa7b24dc3a",Properties:{textures:[{Value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZWQyZDM2NzQ3YmMzZTJjMzdkOTFmYWZlYjU2MjhjZDg4N2ZjZjU0ZWVkNDllY2Y3ZGRjNTRkMjAzMzYzMzNmMCJ9fX0="}]}}}

dusk scroll
prime reef
#

Honestly, I'm gonna disagree with that as well. The vast majority of plugin devs are doing this shit as a hobby, and the reflection you have to use in NMS really doesn't give you much of a grounding in what reflection is actually capable of

dusk scroll
#

i'll try it too

severe marsh
#

and eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZWQyZDM2NzQ3YmMzZTJjMzdkOTFmYWZlYjU2MjhjZDg4N2ZjZjU0ZWVkNDllY2Y3ZGRjNTRkMjAzMzYzMzNmMCJ9fX0= as url

iron glade
#

ah no

#

bad values

dusk scroll
iron glade
#

use something like (gimme a sec)

dusk scroll
prime reef
severe marsh
#

\http://textures.minecraft.net/texture/ed2d36747bc3e2c37d91fafeb5628cd887fcf54eed49ecf7ddc54d20336333f0

iron glade
#

input a link of this type

prime reef
#

since one of the main features is basically hooking Jackson into Spigot

iron glade
#

yes

dusk scroll
#

But if you want to be a professional (like work at hypixel or something) then you should learn all this 1.8 stuff and experience it

prime reef
#

that's a more appropriate use of reflection, all NMS really does is make you comb through a bunch of obfuscated nonsense and waste time.

prime reef
#

well

#

for starters they'd ask why the hell I'd want to work on minecraft servers fulltime LOL

#

but yeah, I dunno, NMS is just a hallmark of shit software design

#

it's why I strongly advocate for staying up to date on Spigot as much as you reasonably can

trim creek
#

btw wtf is an nms

prime reef
#

net.minecraft.server

trim creek
#

ahh

prime reef
#

it's a package that basically contains the obfuscated game code

#

Spigot itself is an interface that runs on top of that

#

basically provides a (mostly) version-independent and human-readable API

trim creek
#

thats probably something i dont have in my latest buildtools jar I decompiled or somehingn. I cannot check TPS with the plugin xd

prime reef
#

iirc you need to explicitly create the craftbukkit jar

#

which is where NMS code lives

#

but I could be wrong, it's been a while

trim creek
#

I use the shaded API

#

(spigot)

#

idk if it matters

prime reef
#

yeah I haven't looked into that enough to know either

trim creek
#

but if I cannot use it, then probably it doesn't has it

prime reef
#

I'm inferring that "shaded" means "server code shaded in"

#

but if you can't access nms code, then yeah idk

trim creek
#

its... more complicated, I guess...

#

I mean... The normal version is less compatible with stuff

prime reef
#

how's that?

trim creek
#

uhh idk

#

I was not able to use somethjing

#

I was able with the shaded

#
  • also there is a little difference between the two documents' filesize on space -
#

I just realized I have the whole Spigot code.

#

and I can edit it...

#

xd

#

The normal doc is 1,32MB, while the shaded doc is 5,39MB.

severe marsh
dusk scroll
#

and it doesn't work

#

?

severe marsh
#

ye

dusk scroll
#

ok

#

let's see

prime reef
#

Out of curiosity: what's the overhead of repeatedly creating/deallocating spigot Vectors?

#

They don't seem to be pooled

#

I do a lot of work with vectors, wasn't really sure is all

#

disclaimer that I primarily work in C++ nowadays so I'm overly conscious of this sort of thing

dusk scroll
#

this is how i use it

severe marsh
#

did that work?

dusk scroll
#

You can make a new class called "SkullMaker" and copy this code and just change the package name if you want...

dusk scroll
#

Should work in yours too, as the only difference the url and what name you want

severe marsh
#

let me try your method

dusk scroll
#

you can add lore too if you would like to the item by adding stuff to the array

#

btw there is no %22 at the end of the url

#

discord is bugged out lol

ivory sleet
#

well we have gc

#

and then soon youll be able to have stuff on stack

#

but the overhead is minimal unless you allocate millions

severe marsh
dusk scroll
#

Yes, just take off the %22 at the end. Discord is bugged out and added it for some reason.

severe marsh
#

It worked

#

thank you

dusk scroll
#

np

prime reef
#

pretty OOTL on Java GC efficiency

#

all I know is that it's much better than Python lmao

hasty prawn
#

Doing it by hand is probably better than python PepeLaugh

prime reef
#

LMAO

#

manually taking out the trash

#

write a new OS that allows you to modify system memory in real time and manually manipulate memory

hasty prawn
#

Exactly, I'm sure you could write that entire OS before Python managed to even run anything

#

๐ŸŒ

ivory sleet
trim creek
prime reef
#

oh I was joking

#

not too experienced with OS dev

#

i've done a bit but not in any reasonable amount

untold jewel
#
  if (Integer.parseInt(args[1]) <= 0) {
                ChatUtil.sendMessagePrefix(player, "&7Please specify a positive number!");
                return true;
            }
dusk scroll
#

windows 2.0

untold jewel
#

this worked like 1 hour ago

#

now that I start the plugin up again it gives error

#

Caused by: java.lang.NumberFormatException: For input string: "asd"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:67) ~[?:?]

tall dragon
#

what error

tall dragon
#

ur inputting a sting..

obsidian drift
#

What you entered isnโ€™t a number

tall dragon
#

cant be parsed to a number

dusk scroll
#

NumberFormatException

hazy parrot
#

you probably want to put arg[0], not [1]

untold jewel
#

I sent

#

wrong

hazy parrot
#

if not, you have to catch exception

untold jewel
#

text

#
 if (economyManager.isInt(args[1])) {
                try {
                    economyManager.payPlayer(player, target, Integer.parseInt(args[1]));
                    ChatUtil.sendMessagePrefix(player, "&7You paid &a$" + args[1] + "&7 to &a" + target.getName() + "'s &7account");
                    ChatUtil.sendMessagePrefix(target, "&7Current balance: &a$" + economyManager.getBalance(target));
                    ChatUtil.sendMessagePrefix(target, "&a" + player.getName() + "&7 has paid &a$" + args[1] + " &7to your account!");
                    ChatUtil.sendMessagePrefix(player, "&7Current balance: &a$" + economyManager.getBalance(player));
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            } else {
                ChatUtil.sendMessagePrefix(player, "&7Please specify an actual number!");
                return true;
            }
dusk scroll
hazy parrot
untold jewel
#
  public boolean isInt(String string) {
        try {
            Integer.parseInt(string);
        } catch (NumberFormatException exception) {
            exception.printStackTrace();
            return false;
        }
        return true;
    }
hazy parrot
#

it printing stacktrance because you said it to print

#

lol

untold jewel
#

but it gives An internal error

#

ingame

hazy parrot
#

because isInt is called

#

and its printing nfe stacktrace

untold jewel
#

lol ok ill try to remove it, but it worked literally 1 hour ago

#

give me a sec

tall dragon
#

also why would you return a boolean

#

why not the number

hazy parrot
tall dragon
#

and -1 if failed

#

hes parsing twice now...

#

for no reason

hazy parrot
#

that is tru tho

obsidian drift
#

parseInt can return negative 1

eternal oxide
#

they could enter -1

subtle folio
#

How am I supposed to make a new objective for my scoreboard?? lol??

obsidian drift
#

just parse it once and catch an exception there

tall dragon
#

make it return null then

obsidian drift
#

you canโ€™t return a bull int

#

null

eternal oxide
#

null is likely better, but then you still have a second test

untold jewel
#

ok now you guys type alot and im confused

tall dragon
#

u can if you use the wrapper

hazy parrot
#

Hey, can anyone help me think of some non messy way of doing this:
So I have string in my config that looks like this:

|-
&8---&6%player &3Something&8---
&3%placeholder - &6%timestamp
&3%placeholder - &6%timestamp
&3%placeholder - &6%timestamp
&3%placeholder - &6%timestamp
&3%placeholder - &6%timestamp
&8--------&6%current&8/&3%max&8---------

I want to make it TextComponent and only %placeholder parts clickable (each with different click event), but it seems to bit a little more complicated for me then expected

obsidian drift
#

or just parse it once

untold jewel
#

What is the best solution? I dont want them to put in -1

obsidian drift
#

Donโ€™t use isInt

#

and in the command try parse

#

if you catch an exception then send a message to the player and return

tall dragon
#

nah thats a shit solution too. having a method is a good idea

obsidian drift
#

no, itโ€™s not

tall dragon
#

what if he wants to do it somewhere else

obsidian drift
#

why parse twice

tall dragon
#

type that all out?

untold jewel
#

btw i removed the e.printstacktrace and it still gives me internal error

#

when i type a string in

#

and not just return the message that says please specify a number

eternal oxide
#

Two methods. Test it's an int and parse it.

#

safest and cleanest

tall dragon
#

ive always just done something like this

public static Integer parseInteger(String in){
  try{
    return Integer.parseInt(in);
  }catch(NumberFormatException e){
      return null;    
  }
}
eternal oxide
#

you could. store teh result and check for null

#

so really doing a parse and a test.

#

no real advantage

tall dragon
#

thats what i would do yea

#

well you only parse once

eternal oxide
#

yep

tall dragon
#

though i don't know how fast parsing is

untold jewel
#

but how would i check if the number is equal to or less than 1

eternal oxide
#
Integer value = parse(args[0]);
if (value != null && value > 0) {```
untold jewel
#

operator != cannot be applied to int, null

eternal oxide
#

Integer

untold jewel
#

ah yeah

#

im stupid

#

ty

eternal oxide
#

fixed in my code ๐Ÿ˜‰

#

Not sure if auto boxing is the best approach

#

probably better to keep it as an int and return -1 as suggested before

eternal night
#

cool kids OptionalInt it ๐Ÿ™

tall dragon
#

i mean used like this in a command is it rlly that bad?

eternal oxide
#

you can't assign null to a primitive

#

so return -1 is best for not an int

tall dragon
#

thats what i usally do yea

#

but if he needs to support negative values thats not rlly an option

eternal oxide
#

then its better to test and parse

pseudo hazel
#

I just use Integer.parseInt() in a try/catch xD

hasty prawn
#

Same

#

It's ugly but I don't parse enough ints to warrant another method for it I guess

untold jewel
#

I understood my code before but now with ElgarL and EpicGodMC advise i kinda do but not quite

#

and that is very annoying

#

haha

eternal oxide
#

๐Ÿ™‚

hasty prawn
#

What do you not understand about their methods

tall dragon
untold jewel
#

            Integer amount = economyManager.parseInteger(args[1]);

            if (amount != null && amount > 0) {
                ChatUtil.sendMessagePrefix(player, "&7Please specify a positive number!");
                return true;
            }
            
                try {
                    economyManager.payPlayer(player, target, Integer.parseInt(args[1]));
                    ChatUtil.sendMessagePrefix(player, "&7You paid &a$" + args[1] + "&7 to &a" + target.getName() + "'s &7account");
                    ChatUtil.sendMessagePrefix(target, "&7Current balance: &a$" + economyManager.getBalance(target));
                    ChatUtil.sendMessagePrefix(target, "&a" + player.getName() + "&7 has paid &a$" + args[1] + " &7to your account!");
                    ChatUtil.sendMessagePrefix(player, "&7Current balance: &a$" + economyManager.getBalance(player));
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            } else {
                ChatUtil.sendMessagePrefix(player, "&7Please specify an actual number!");
                return true;



        }
#

so is this ok?

#

for what im doing

#

dont want a negative number

#

and I want the args[1] to be an Integer

tall dragon
#

then change it to a normal int

#

and make the method return -1 if it fails

eternal oxide
#
int parse(String value) {
  try{
    return Integer.parseInt(value.trim());
  }catch(NumberFormatException e){
      return -1;    
  }
}

// to use.
int value = parse(args[0]);
if (value <= 0) {
  sysout("Must be a positive integer!");
  return;
}```
tall dragon
#

real chads also automatically remove accidental chars in the input string cPES_Wink

eternal oxide
#

there ๐Ÿ™‚

untold jewel
#
            int amount = economyManager.parse(args[1]);

            if (amount <= 0) {
                ChatUtil.sendMessagePrefix(player, "&7Please specify a positive number!");
                return true;
            }
                try {
                    economyManager.payPlayer(player, target, Integer.parseInt(args[1]));
                    ChatUtil.sendMessagePrefix(player, "&7You paid &a$" + args[1] + "&7 to &a" + target.getName() + "'s &7account");
                    ChatUtil.sendMessagePrefix(target, "&7Current balance: &a$" + economyManager.getBalance(target));
                    ChatUtil.sendMessagePrefix(target, "&a" + player.getName() + "&7 has paid &a$" + args[1] + " &7to your account!");
                    ChatUtil.sendMessagePrefix(player, "&7Current balance: &a$" + economyManager.getBalance(player));
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            } else {
                ChatUtil.sendMessagePrefix(player, "&7Please specify an actual number!");
                return true;



        }
tall dragon
#

looks good

#

tho u dont have to parse again

#

u got the amount already

eternal oxide
#

you have value so use it

untold jewel
#

yeah

#

i saw

#

ahha

#

ty guys!

#

I will test and come back if something is wrong

#

if im allowed :3

eternal oxide
#

We are always willing to confuse more ๐Ÿ™‚

untold jewel
#

Haha

#

exactly

tall dragon
dim palm
viscid ember
#

not really coding help but which colour looks better

tall dragon
tall dragon
#

i only see a "build" part

#

and like 500 schedulers

dim palm
opal wedge
#

Hey, is there an elegant solution to listen for all block events? Currently I'm trying to use the "BlockEvent" class, but I'm getting the error message you see below.

My goal is to cancel the event depending on the location.

untold jewel
#

ElgarL

#

How would I send a message to the player that they have to specify an actual number when using your parse method?

#

like where do I put it

eternal oxide
#

you do that in the method you called it from

hasty prawn
untold jewel
#

but there I did if (economyManager.isInt(args[2])) {

} else {
player.sendMessage("has to be a number")

opal wedge
hasty prawn
#

You could probably make a custom event that is fired when any other BlockEvent was fired

#

You'd still have to listen to all the events, but all you'd be doing was firing another event, so probably a little cleaner.

dim palm
eternal oxide
#

the iterator runs from a low value to a high value. You want it to run the opposite way to give you blocks from high to low

#

Simplest would be base + size and reduce size until size == 0

#

just from a quick look

#

its only the Y you neeed to reverse

tall dragon
#

but that cant really be called elegant ๐Ÿ˜„

opal wedge
#

haha

modest garnet
#

anyone know whats going on here

hazy parrot
#

google that

eternal oxide
#

Class.forName("com.mysql.jdbc.Driver"); or something close

worldly ingot
#

Depends on the version of your driver

eternal oxide
#

coiuld be com.mysql.cj.jdbc.Driver

worldly ingot
#

Correct

eternal oxide
#

if v8

modest garnet
#

wait sorry?

#

little lost

eternal oxide
#

You need to initialize teh driver

grim ice
#

u shouldnt change the name color with tiers for items imo tho

modest garnet
eternal oxide
#

add Class.forname.... before asking for a connection

#

you only need do it once at startup

viscid ember
#

and now im trying to work on a combo system

modest garnet
viscid ember
#

where with each tier a new combo gets unlocked

eternal oxide
#

no

grim ice
#

Why would you use forName though

#

thats only for jdks under 6

eternal oxide
#

it just makes sure the Class is loaded

viscid ember
#

im confused why its not letting me push?

tall dragon
#

u did not commit anything

viscid ember
viscid ember
tall dragon
#

looks like u also need to define ur remote repo

viscid ember
#

i wasnt logged onto my github

#

๐Ÿคก

tall dragon
tawdry python
#

Does anyone know how I can create a world using WorldCreator, but this world can only have bedrock on tier 1?

eternal oxide
#

You have no driver

#

are you using Spigot?

modest garnet
#

no JDA

#

but i thought it didnt matter as its just sql

eternal oxide
#

Then you need to include a MySQL driver

#

Spigot includes a driver. You are not using spigot so you need to provide your own driver

modest garnet
#

oh mb, ok ive fixed that now

modest garnet
eternal oxide
#

no

hazy parrot
#

They have full pom example on github

high pewter
#

I made a thread a few days ago sorta related to this but I got no responses so thought it would be a good idea to ask my new question here. Is there a way to use IntelliJ's debugger for Spigot plugins?

untold jewel
# high pewter I made a thread a few days ago sorta related to this but I got no responses so t...

Learn how to create a #Spigot debug server inside of #Intellij

0:00 Intro
0:45 Creating New Project
2:30 Setting Up Export Settings & Start.bat
5:52 Testing & Overview

Subscribe: https://www.youtube.com/BGHDDevelopment?sub_confirmation=1

View all our plugins here:
https://www.spigotmc.org/resources/authors/111582/
https://www.mc-market.org/re...

โ–ถ Play video
#

maybe this helps

tall dragon
#

really easily actually

high pewter
#

I'll have a look, thank you!

tall dragon
#

all you need to do is create a remote jvm debugger & intellij will give you some commandline arguments in there. you add those to your servers startup script

#

and boom ur done

untold jewel
#

BOOM

high pewter
#

Never heard of a 'remote jvm debugger' but I think I understand how it would work and ye that makes a lot of sense. So instead of making IntelliJ run our testing server, we make our testing server run IntelliJ (well, it's debugger)?

tall dragon
#

uhhh

#

not entirely

#

you bassically just open a port on your server

#

and intellij uses that

#

in intellij you need to add a run configuration

#

and select remote jvm debug there

high pewter
#

Ah, makes sense! I'll have a go ๐Ÿ˜„

tawdry python
#

I'm trying to enchant an item with fortune 4, and it's saying I can't because I can only enchant 1-3, how can I get around this?

quiet ice
#

But considering that I never used it outside of the IDE's debug env I never bothered checking out if it really is possible to use it like I think you can

tall dragon
#

or a server question

quiet ice
#

?jd-s

undone axleBOT
tall dragon
#

yea it is possible like that geol

quiet ice
tall dragon
#

all you need to do is create the config, copy the cmd line args it gives you and add that to your startup script

high pewter
#

The video seemed to show it working would having to set up a remote jvm debugger or adding any commandline arguments which is strange but I'm not gonna complain about ๐Ÿ˜… Sadly, I thought this would also solve the issue of having to copy the JAR to the plugins folder, but the video got around this using build artifacts which afaik means I won't be able to test any Maven configuration

tall dragon
#

you can also achieve that with maven

high pewter
#

Is there a way that doesn't pollute the pom.xml and can be copied between projects? I'm aware that it's possible, but it's just slightly more annoying

tall dragon
#
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-jar-plugin</artifactId>
      <version>2.3.1</version>
      <configuration>
        <outputDirectory>/my/path</outputDirectory>
      </configuration>
    </plugin>
  </plugins>

like this

high pewter
#

Yeh, but then that pollutes the pom.xml. I don't want to be including the path to my testing server every time I push to GitHub ๐Ÿ˜…

#

I know it's really fussy, but it's annoying me cos I feel like there's got to be a better way

tall dragon
#

how else are you going to specify a path Hmmm

#

i always just copy my jar manually

high pewter
#

Well, one thing I tried was having my run configuration run a batch file which takes the path as a parameter. But to make this easy to copy between projects, I wanted to use Maven properties to get the path of the JAR to copy, but it doesn't seem IntelliJ allows Maven properties in run configurations

eternal oxide
#

my test server pulls a new jar at startup

hybrid spoke
#

just make a profile in intellij for a test server

#

if thats the topic

#

didnt read

high pewter
#

There's also Maven's build profiles (settings.xml) which seems perfect for this, except that profiles made in settings.xml can't configure anything inside <build>, including build plugins

hybrid spoke
#

i mean what is exactly meant by pollute

#

you can have a parent pom and inherit from that

sterile token
#

Yeah

high pewter
#

imo, the pom.xml should be effective for anybody who uses it on any computer. I'd consider anything inside the pom.xml which only works on one computer/filesystem 'polluted'. Since not everyone has their testing server in the same location on their computer (or would want the JAR to be copied to it in the first place), this includes that.

hybrid spoke
#

you normally dont have test stuff in your pom anyways

tawdry python
tall dragon
#

well you could also just build with an extra argument. for example mvn clean package -DoutputDirectory=<path> iirc

high pewter
#

Again, sorry that I'm being really fussy, I'd honestly be quite happy to just manually enter the JAR's location for each of my projects, it's just bothering me that there seems to be so many ways that get so close to solving this but then reach a dead-end

sterile token
high pewter
high pewter
sterile token
#

For maven you can use:

<outputFile>path</outputFile>

#

That worked for me

tall dragon
#

he doesnt want that

sterile token
#

I now there is a way but im not sure since im not on my home and i dont have a pc

#

What does he want?

tall dragon
#

a way to do this that would work on any pc

#

and not everyone has their testserver in the same location

high pewter
#

I tried this. It didn't come up with any errors or warnings, but the JAR still outputted to the default location, so I guess it does just act as a property to use in the pom.xml

sterile token
#

WHAT. ARE. YOU DOING. ?

tall dragon
#

uhh yea configurations aint gonna work with maven like that

high pewter
#

Hm?

sterile token
#

Sorry my cellphone its not working okay

#

I mean I wanst mad

tall dragon
#

@high pewter try adding

<build>
    <directory>${dir}</directory>
</build>

in your pom

sterile token
#

What he wants

tall dragon
#

note that this method does require you to always specify a path on command line

sterile token
#

Does he want to run a server directly from Intellij and have the plugin jar already setup inside the plugin directory

#

๐Ÿค”

#

I dont really understand what he wants...

high pewter
#

I think that works if you use -Ddir="path". But ye, being required to set it to run the Maven goal is annoying

tall dragon
#

yea indeed

#

u would use Ddir

sterile token
#

But what the fuck you want to do bruh

tall dragon
#

i mean there arent many other options really haha

sterile token
#

๐Ÿ˜ก

high pewter
#

Dang ๐Ÿ˜•

sterile token
#

What is he doing

#

๐Ÿ˜‚ ๐Ÿ˜‚ ๐Ÿ˜‚

tall dragon
#

he simply wants the plugin in the plugin folder in a way that works on any pc

#

xD

high pewter
#

Give me a chance to explain it lol

#

I'm wondering if there's a way to easily test plugins (so package the plugin and run a testing server with the plugin) which can be applied to any project (don't need to copy the build directory for every project, just enable a run configuration for example) but without polluting the pom.xml (I want all my plugins to be open-source and I don't want to include stuff involving my testing server whenever I push to GitHub)

eternal oxide
high pewter
#

I'll have a look, thank you!

#

Sadly not what I'm looking for, but it explains that there are different methods for debugging (local or with remote JVM) which clears up something I was confused about earlier, so thank you!

humble tulip
#

Wait do you mean you don't wanna build to your server directory?

#

Do you habe intellij ultimate?

high pewter
#

No? The only mention of building the plugin is at the very bottom

Build your releases by building the artifact or compiling your maven plugin

high pewter
humble tulip
#

You can create a debug configuration that runs a bat file which copies the plugin to plugons after build

#

As well as runs the server

#

Just don't commit the bat file

high pewter
#

That doesn't require IntelliJ Ultimate ๐Ÿ˜… But ye that's something I've tried, but the thing I'm stuck with there is if there's a way to automatically get the path of the JAR to copy from. I was hoping I'd be able to send this ${project.build.directory}\${project.artifactId}-${project.version} as an argument, but IntelliJ doesn't seem to allow Maven properties to be used for run configurations

humble tulip
#

Ohh

#

Hm

#

Well you don't need the build directory because i doubt you're changing it much

humble tulip
sterile token
#

Why dont use docker

humble tulip
#

Use regex to make it so that it can copy any version

high pewter
#

But the build directory would be different too

high pewter
sterile token
#

Oh lmao

#

Dont over-kill yourself

humble tulip
#

There's probably an easier way to do it tbh

sterile token
#

Oh minion nice. To see you

humble tulip
#

I just don't know it

humble tulip
high pewter
humble tulip
#

I've been very busy with school

sterile token
#

Me too

ivory sleet
#

Many attempts have been made to create some canonical convention

#

For instance maven with its target dir

sterile token
#

Yes

#

In other words he want to make weird things

high pewter
#

But the target dir is still relative to the project directory itself

sterile token
#

Hey mare

#

Its not posible

#

Just forget about that

#

This channel is more for other type of support

high pewter
#

Fair enough, sorry

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.

sterile token
#

?

#

Oh ok

#

I understand

#

You are talking about plugin Messaging channel

#

Its sent and receive by a player connection

#

Thst why it doesnt work when a player its not online

#

I explain

#

When you write thru spigot to bungee you the player connection is used to sent a packet

sterile token
#

@quaint mantle look dm

#

Yes

#

spigot -> get the player connection -> send a plugin Messaging channel to BungeeCord channel or your custom channel

torn oyster
#

i only just learned that you can cast/use instanceof on this

#

is that a problem

jaunty crag
#

How can I slowly create a message and then send it to the player

#

like im running a for loop to get certain colors and I want to add to a piece of text that will be sent to the player each time the loop runs and then send it to the player

#

any help appreciated

tall dragon
#

so in the end its 1 message?

jaunty crag
#

yes

tall dragon
#

use StringBuilder

jaunty crag
#

can I add ChatColorto that?

tall dragon
#

i would just use the translated color codes

#

like &6, &5 etc

#

and translate it when done building

jaunty crag
#

I cant in my use scenario

tall dragon
#

why not?

jaunty crag
#

I am getting colors from a bufferedimage and then applying them

#

i need to use ChatColor

tall dragon
#

ah well

#

you should be able to yes

jaunty crag
#

Ok

torn oyster
#

how would I get an enchantment from a string formatted like "ENCHANTMENT:LEVEL"

#

well, i know most of it

#

but how would I get an enchantment enum value from a string

#

there isn't a .valueOf

tall dragon
#

well thats hard to believe

#

since that is part of enum itself

fresh timber
#

How do I make command arguments with acf commands

torn oyster
upper vale
#

enchantment is not an enum

tall dragon
#

yeaaaa

#

my bad