#help-development

1 messages Β· Page 1996 of 1

lavish hemlock
#

Although there's also uhh

tardy delta
#

:{

lavish hemlock
#

Hibernate and jOOQ

#

Note that all SQL libs are fucking gigantic

#

So I would recommend library loading when using them

grim ice
#

btw

#

if i would do that

#

for my main class

#

what do i even name the interface

#

and how do i prevent them from just

#

actually

quiet ice
#

IEntitySerializerContextHolder

dire salmon
quiet ice
#

if you compress it it will be much less probably

signal meteor
#

how can i use a variable from the main class in another package ?

patent flame
quiet ice
signal meteor
#

the better way :)

quiet ice
#

?di

undone axleBOT
tender shard
patent flame
#

ok so 1.8 usually?

tender shard
#

if you want to support MC older than 1.17, then yes

patent flame
#

okk

#

ty

quiet ice
#

if you use maven or gradle, don't choose anything

tender shard
quiet ice
#

eclipse automatically fetches the target version based on the maven pom or the gradle build script

tender shard
#

well but "nothing" is not an option in the screenshot

grim oak
#

Does anyone know the answer to this?

tender shard
#

I don't understand the question

#

Cow cow = ...;

quiet ice
grim oak
# tender shard I don't understand the question

okay so if i have an event involving an entity, if i save the entity to the hashmap, when i go to fetch the entity from the hashmap later, will it get that exact entity, or just an entity of the same type. for example if i tried to teleport that entity, will it try to teleport that entity specifically, or just any entity of the same type

tardy delta
#

i mean in terms of data and stuff

grim oak
#

yeah

supple bay
#

Yes but use a uuid instead

tardy delta
#

entities have a location iirc

supple bay
#

Storing an entity might cause issues

tardy delta
#

different uuid too

#

different id

lavish hemlock
supple bay
#

So when you are trying to get the entity
Just get entitt via bukkit I think then use that

supple bay
grim ice
#

how to fix it

#

if you know

lavish hemlock
#

I dunno, my design process is primarily instinct

grim ice
#

and btw

#

i fixed it

#

by removing the methods

#

since i wasnt even using them

#

lmfao

lavish hemlock
#

gg

grim ice
#

i was passing the fields to the objects when initializing

#

so the getters had no use

rough drift
#

Is there a way to set a skull's texture to an in game player without NMS?

#

ty

#

another thing

#

can you check when an item is renamed with an anvil?

thick scarab
#

Hi.
Why player.getWorld().rayTraceEntities(player.getLocation(), player.getVelocity(), 10) return null and not RayTraceResult if I'm looking at player?

rough drift
#

I guess InventoryMoveItemEvent would be better?

#

as whenever any entity or block tries to move

young knoll
#

That’s for hoppers

rough drift
#

ohk

patent flame
rough drift
#

just gonna use inventory prepare event

patent flame
#

yes

#

i used 1.18.1 spigot

#

is there something different?

grim ice
patent flame
#

it doesnt work

tardy delta
#

if i would execute createKingdom(k).onException(/* ... */) would the onException ever fire, cause im surrounding it with a try catch

rapid rock
#

Hello, I was making a simple command which shows information about my plugin i get this error from intellij
Non-static method 'sendMessage(java.lang.String)' cannot be referenced from a static context
I tried to


import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class CoreCommand {
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if (cmd.getName().equalsIgnoreCase("core") && sender instanceof Player) {
            Player player = (Player) sender;
            Player.sendMessage(ChatColor.GREEN + "CrackedCore by" + ChatColor.WHITE + "v1shy!!!");
        } return true;
    }

}
thick scarab
#

player.sendMessage
Not Player.sendMessage

rapid rock
#

oh

#

its fine now

#

but idk for some reason it worked before

#

nvm im blind

grim ice
#

only handleException would fire

patent flame
grim ice
#

and then the exception would disappear probably

tardy delta
young knoll
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

tardy delta
#

throwable being notnull indicates an exception happened executing the future
and im wondering if an exception would occur if it will be thrown instead of handled by the onException

subtle folio
#

Hey im using 1.18.1 spigot and im trying to change the name above the player, #setDisplayName(); doesnt seem to do the job, any ideas?

tardy delta
#

thats for chat name

subtle folio
#

oh, then is there a method for the overhead name?

patent flame
tardy delta
subtle folio
wary harness
#

Do those placeholders for spigot work in free plugins

#

?

tardy delta
#

i dunno for 1.18

#

anyways im wondering if a future completed exceptionally (calculation failed) if the exception will be thrown instead of handled by onException?

wary harness
#

I would like to be able to send message to players with op to remind them to leave review on plugin if they didn't do it already ?

ivory sleet
#

fourteen depends

#

idr if whenComplete runs regardless of exception caught or not

#

tho iirc it does

kind hatch
ivory sleet
#

thus it basically would run

wary harness
#

but still it would be nice if that worked with logged in users

lavish hemlock
#

Either way Spigot placeholders are a bit meh

#

They're just another DRM that, to anyone who is at least semi-competent, is easy to bypass.

#

Well actually

#

I would rather call them a counter-attack

#

(Even then, staff here said they're not completely used for bans bc someone can frame another user via replacing them)

tardy delta
#

is CompletableFuture#onException even doing anything?

#

or does the exception needs to happen when calculating the result?

#

lemem try

lavish hemlock
tardy delta
#

well nothing seems to be printed

quiet ice
fluid nacelle
#

You need to use player.sendMessage() not Player.sendMessage() @rapid rock

robust tide
#

yea

fluid nacelle
#

Omfg chat isn't that far behind now smh

dusk flicker
#

lol

rapid rock
fluid nacelle
#

Anyway, I'm trying to make a "dolphin circle" of 3 dolphins going in a circle moving with a player in the middle. I'm thinking along the lines of having them riding an invisible entity like an arrow or something then having those go around in a circle by settings its velocity but how would I go about updating that for when the player moves? Would I literally have to move it on PlayerMoveEvent every time? Because wouldn't that be laggy as hecc?

#

Any ideas?

tardy delta
#

lol try catch seems to work but neither CompletableFuture#whenComplete nor #exceptionally seems to do anything when throwing exception

smoky oak
#

considering the dolphins are moving already, why don't you make a bukkitRunnable that does change their position relative to the player?

#

bc whatever you use to make them move has to be updated frequently

fluid nacelle
quiet ice
#

that is because 0 / 1 is computed before the method is invoked

smoky oak
#

it would be but it would look blocky

tardy delta
#

this however seems to work

smoky oak
#

however i believe it is simpler to do it on a runnable, even if it is once per tick

#

the advantage of a runnable is that it only runs once per tick per that player

quiet ice
smoky oak
#

playerMoveEvent hooks into all players moving

fluid nacelle
#

Yeah, that's true. I'll have to see what sort of performance impact it'll have

#

I'll have to listen for when players collide with the dolphins (other players) as they're meant to take damage if they do

smoky oak
#

cant you do that in the runnable too? Check for nearby players

#

then run collision checks

fluid nacelle
#

I could, happy to try whatever to get it working at this point xD not sure how much of a performance impact it'll have

#

Since multiple people might be using the ability at once

tardy delta
#

so this is exactly the same?

fluid nacelle
#

I'm also looking at making a weak spot being revealed for players but only for 1 player and while their bow is drawn, should I do something similar as well? Register a BukkitRunnable and when the bow is no longer drawn or has been fired, end the runnable? I'm thinking of having an xp orb represent the weak spot to be shot by a bow

#

Just worried about spamming the hell out of the player with packets lmao

quiet ice
tardy delta
#

well the second one wont print the result

#

just figured out how it works

#

#thenAccept only executes when the future didnt complete exceptionally

subtle folio
#

hey, is there like a way to add a bukkit runnable inside a bukkit runnable

#

or is that bad practice or smt

tardy delta
#

you can

#

just like nested ifs

subtle folio
#

i put a bukkitrunnable.runtaskLater() inside a bukkitrunnable.runtasktimer() and it didnt work

#

is there like another way of doing this?

tardy delta
#

lol sqlexception doesnt want to get handled by future

subtle folio
#

huh?

tardy delta
#

not meant for you

subtle folio
#

oh sorr y

dire salmon
#

Im using this to make particle circle

for (int degree = 0; degree < 360; degree++) { 
double radians =
Math.toRadians(degree); 
double x = Math.cos(radians); 
double z = Math.sin(radians);
location.add(x, 0, z);
location.getWorld().spawnParticle(Particle.END_ROD, location, 1);
location.subtract(x, 0, z); 
}

What would happen if i did this?

for (int degree = 0; degree < 360; degree++) { 
double radians =
Math.toRadians(degree); 
double x = Math.cos(radians); 
double z = Math.sin(radians); 
double y = Math.cos(radian);
location.add(x, y, z); location.getWorld().spawnParticle(Particle.END_ROD, location, 1); location.subtract(x, y, z); 
}
```?
#

Hate phone copy and paste

tardy delta
#

i think i dont have to throw exceptions but instead return a CompletableFuture#failedFuture

quaint mantle
#

doesn't #whenComplete handle exceptions

tardy delta
#

ye

#

but the problem is futures combined with a delegate

ivory sleet
#

how r u combining them

tardy delta
#

im having a Storage interface with method like #loadUser which do database stuff and when they catch an exception, they will throw an RuntimeException(innerSqlEx)

#

that isnt caught by CompletableFuture#exceptionally cause it didnt occur when calculating the future's result

ivory sleet
#

thats odd

tardy delta
#

i cant rethrow the exception cause Future#exceptionally wont catch it

#

lemme just add throws clausule and remove the catch

#

then handling exceptions in the delegate

#

which will return a failed future instead of printing stacktrace

#

πŸ‘€ lol

#

this looks weird lol

ivory sleet
#

CompletableFuture.runAsync(() -> {
throw new RuntimeException();
}).exceptionally(t -> {
System.out.println(t);
return null;
}).join();

#

this worked just fine

tardy delta
#

ye but SQLException wont

#

._.

ivory sleet
#

wrap it

#

throw new CompletionException(sqlException)

tardy delta
#

ye but problem is the code that throws and the code that catches are seperated

#

so #exceptionally wont trigger

tardy delta
#

github weird lol syntax highlighting gone

ivory sleet
#

basically

#

dont log the exception in handle exception

#

have something like

tardy delta
#

im at looking at returning a failed future instead

ivory sleet
#

Cf.do(() -> {
try {
action.do();
} catch (Exception e) {
if (e instanceof RuntimeException) {
throw (RuntimeException) e;
}
throw CompletionException(e);
}
}

#

now it'd work fine if you'd later chain it with
.whenComplete or .exceptionally

#

and

#

if you really wanna log

#

then just do it like

Conclure (ping for help) β€” Today at 4:33 PM
Cf.do(() -> {
  try {
    action.do();
  } catch (Exception e) {
    logger.severe(e); /////////////
    if (e instanceof RuntimeException) {
      throw (RuntimeException) e;
    }
    throw CompletionException(e);
  }
}```
tardy delta
#

conclure ping for help do i need to include that too

#

kekw

#

hmm ye

#

in the delegating thing?

ivory sleet
#
    private <T> CompletableFuture<T> makeFuture(Supplier<T> supplier, String errorMessage) {
        return CompletableFuture.supplyAsync(() -> {
            try {
                return supplier.get();
            } catch (Exception e) {
              if (e instanceof RuntimeException) {
                throw (RuntimeException) e;
              }
              throw new CompletionException(e);
            }
        }, executor);
    }```
#

I'd would advice you not to log in the delegating class

#

but do it in the lowest level classes, such as in your connection listener for instance

tardy delta
#

are you sure that the exception is given to the future and thats its not a global thing?

ivory sleet
#

as you then can be more specific about plausible exceptions

tardy delta
#

that #exceptionally will even fire

ivory sleet
#

yes it would

#

assuming Supplier::get throws

tardy delta
#

ye that would be a db error

ivory sleet
#

oh yeah btw fourteen

#

you might wanna use something like
interface ThrowingSupplier<T> {
T get() throws Exception;
}

#

assuming your delegate actually throws checked exceptions

tardy delta
#

ah ye

#

you always have such genius ideas lol

#

but what would that change if i create that kind of supplier vs a normal one?

#

so i can do it like this?

ivory sleet
#

well

tardy delta
#

that means a no i guess

silver shuttle
#

Okay I am just curious, what would happen if this object were to be created?

rapid rock
#

Build results are outdated for requested compile scope.
Subsequent incremental build will compile files for changed sources and remove obsolete results of the previous build.
when tryna compile

silver shuttle
ivory sleet
#
interface ThrowingSupplier<T> {
  T get() throws Exception;
}
interface StorageTool {
  UserModel loadUser(Id id) throws Exception;
}

class SqlStorageTool implements StorageTool {
  @Override public UserModel loadUser(Id id) throws Exception {
    throw new SqlException("rip");
  }
}

class StorageAdapter {
  final StorageInterface delegate;

  StorageAdapter(StorageInterface delegate) {
    this.delegate = delegate;
  }
  
  <T> CompletableFuture<T> makeFuture(ThrowingSupplier<T> supplier, String errorMessage) {
    return CompletableFuture.supplyAsync(() -> {
        try {
          return supplier.get();
        } catch (Exception e) {
          if (e instanceof RuntimeException) {
            throw (RuntimeException) e;
          }
          throw new CompletionException(e);
        }
      }, executor);
    }

  CompletableFuture<UserModel> loadUser(Id id) {
    return CompletableFuture.supplyAsync(() -> {
      return this.makeFuture(() -> this.delegate.loadUser(id));
    });
  }
}```
@tardy delta
#

or sth

tardy delta
#

wrote that on phone again?

ivory sleet
#

nope

tardy delta
#

xd

ivory sleet
#

x)

silver shuttle
#

Say I want to have a directory in which multiple configs of the same kind can be placed, but I need to (very often) read values from anywhere within all of them - Is there an easy way to make them all act like one single config which I can call?

ivory sleet
#

well

#

if its configs

#

then a single read should suffice

#

else it sounds more like arbitrary data that you store during runtime for persistency

tardy delta
#

i get it, thanks conclure πŸ’—

silver shuttle
#

Well it is something like from crackshot's weapons directory in which multiple fileconfigs of the same kind can be created

tardy delta
#

sometimes im stupid, i was combining a whenComplete and exceptionally and wondering why the exception wasnt being handled

silver shuttle
#

and each one can have multiple sections which are used to define the properties of the weapon you get

ivory sleet
#

yeah but why do you need to read them very often

silver shuttle
#

well ok I can just store it all into ram

#

but it needs to keep the structure

#

so what would be the best way of combining lots of yaml configs into one hypothetical file

ivory sleet
#

well

#

you dont combine them into one file

#

but you just read the content of the files

silver shuttle
#

mhm okayy

misty current
#

how can I get the current tick of the server? (The actual tick, not TPS)

tardy delta
#

if a java.sql.Connection is closed, is the corresponding PreparedStatement closed too?

ivory sleet
#

i dont think it gets automatically closed

#

but any of the methods would probably end up throwing an exception

neon nymph
#

Is there a raw getter for a resource's latest update description from Spigot? Much like getting a plugin's current version, but for the description instead

tardy delta
#

then i got two preparedstatements in the same method

tardy delta
ivory sleet
tardy delta
#

although do you mean the version of the plugin or what?

tender shard
ivory sleet
#

so yeah a normal request where you filter out the content you want would be needed Corals

neon nymph
#

Yea exactly, what url should I enter

misty current
ivory sleet
#

the plugin url

neon nymph
#

So I have to filter one myself huh

ivory sleet
#

well

#

idk

tardy delta
#

if the plugin is on spigot site

ivory sleet
#

maybe you can find some nice rest api

tender shard
#
        try {
            final Field currentTickField = Bukkit.getScheduler().getClass().getDeclaredField("currentTick");
            currentTickField.setAccessible(true);
            final int currentTick = currentTickField.getInt(Bukkit.getScheduler());

@misty current

ivory sleet
#

idk

misty current
#

thanks

#

so it's not in the api i guess

tender shard
#

nope

neon nymph
tender shard
#

spiget API

tardy delta
#

i dont know if you can even reach that with a web request

misty current
#

one last question, should i prefer doing this compared to using the current unix time? i feel like unix would be unsynced with server ticking

tender shard
#

just get the list of updates, and from the latest one, get the "description" part

tardy delta
#

oeh

#

fancy

neon nymph
wary harness
#

is there class in Bungee like BukkitRunnable ?

#

or I should just use Runnable?

ivory sleet
#

use the api's executor service

#

or just create ur own

merry kindle
#

Is there a good way of making a loot table or is it just RandomInt and doing % on the RandomInt?

ivory sleet
#

as bungeecord doesnt really have a server /main thread

wary harness
tender shard
silver shuttle
#

Is ChatColor.translateAlternateColorCodes more efficient than String.replace()?

ebon coral
#

It just does the work for you

ebon coral
#

No point not using it

tender shard
#

ProxyServer.getIntsance().getScheduler().schedule(plugin, Runnable, int, TimeUnit)

ebon coral
#

ProxyServer*

tender shard
#

erm

#

yes

ebon coral
#

No ()

lost herald
#

Hello everyone! I am trying to make a snowball that sets freezing ticks to 140 upon hitting an entity. All I’ve accomplished so far is create a custom item stack of snowballs so they can be told apart from regular snowballs. I’m struggling with how throwable projectiles work and how can a projectile hold data such as if the snowball is freezing or not.

tender shard
ebon coral
#

Does anyone work with Paperweight here?

#

I am gonna cry

tardy delta
tender shard
fresh drum
#

Hey :)
Do you know if there is any event fired when a player crash ?

tardy delta
#

i should stop sending implementations lol

#

when their connection broke?

fresh drum
tardy delta
#

then it wont fire anything else

fresh drum
#

Okie

#

Thx

tender shard
#

PlayerQuitEvent will be called

silver shuttle
#

still

tender shard
#

once they timed out

misty current
ebon coral
#

I will bet money even Hypixel does that lol

tardy delta
#

oh he was saying that no quit event was fired

ebon coral
#

@misty current I can tell you Skript by you saying unix time

tender shard
misty current
#

at least afaik

ebon coral
#

Well it's like so weird to hear XD

#

Beside Skript

misty current
#

yeah you're not wrong lol

#

btw were you a mh community member

ebon coral
#

I know :>

misty current
#

i remember yesterday you said oh no a mh guy

ebon coral
#

Wait

misty current
#

lol

ebon coral
#

Yeah I was

#

c4mer0ns

misty current
#

oo i remember you

#

you worked on evara didn't you

ebon coral
#

Yeah

#

Left and went to larger scale projects, though.

misty current
#

ah nice

crude loom
#

Hi, is it possible to set commands outside the main class?

ebon coral
#

Of course

ivory sleet
#

Yep

ebon coral
#

I am so mad that I linked my Spigot account on here

#

It made my nickname so lame

#

I haven't been called this name in 4 years

ivory sleet
#

not that bad

misty current
#

in both cases yes

crude loom
#

Ah, then do I need to do something extra other then just type the onCommand function?

misty current
#

you need to implement commandexecutor

#

in the class where you wanna put the code the command needs to execute

drowsy harness
#

what is the right way to allow players to place blocks but not open chests, or any type of container

wary harness
lost herald
drowsy harness
#

but if i cancel player interact event, they cant place blocks

tender shard
tender shard
crude loom
tender shard
crude loom
#

no this is a listener class that I want to put a command in

misty current
#

you can't extend JavaPlugin outside your main class

verbal heron
#

does 1.18.2 have nms changes

crude loom
misty current
#

its not

rapid rock
#

https://i.gyazo.com/thumb/1200/f68a7fb6dd0eeaefdbe13e0a30d0f390-jpg.jpg

Any way to actually like get this thing away as this wont load at servers 😦

        System.out.println("Config Loaded");
        saveConfig();
        System.out.println("Config Saved");
        getCommand("core").setExecutor(new CoreCommand());
        System.out.println("CoreCommand has been enabled");
        getCommand("helpop").setExecutor(new HelpOPCmd(this));
        System.out.println("HelpOPCommand has been enabled");
        getCommand("god").setExecutor(new GodCommand());
        System.out.println("GodCommand has been enabled");
        getCommand("day").setExecutor(new DayNightWeatherCommand());
        getCommand("night").setExecutor(new DayNightWeatherCommand());
        getCommand("weather").setExecutor(new DayNightWeatherCommand());
        System.out.println("DayCommand has been enabled");
        System.out.println("NightCommand has been enabled");
        System.out.println("WeatherCommand has been enabled");
``` is what causes the thing
misty current
#

for commands

tardy delta
#

that background lol

rapid rock
kind hatch
rapid rock
misty current
#

it just says that it might be null because getCommand is nullable

#

thats because u didnt register commands in plugin.yml

kind hatch
#

You likely don't have the commands in your plugin.yml then.

tardy delta
subtle folio
#

How do I make my spigot plugin backwards compatible?

rapid rock
#

i registere only 2

tender shard
# wary harness

you can just use a holder or a final temp variable, like this

        Holder<ScheduledTask> scheduledTaskHolder = new Holder<>();
        scheduledTaskHolder.value = ProxyServer.getInstance().getScheduler().schedule(main, () -> {
            if(!player.isConnected()) return;
            scheduledTaskHolder.value.cancel();
        }, 1, TimeUnit.SECONDS);
rapid rock
#

Thank you

misty current
#

i am trying to work with mongo and i'm trying to disable logging with this code
((LoggerContext) LoggerFactory.getILoggerFactory()).getLogger("org.mongodb.driver").setLevel(Level.ERROR); i have found in a stackoverflow post.
However, this code throws a classcastexception:

Caused by: java.lang.ClassCastException: class org.apache.logging.slf4j.Log4jLoggerFactory cannot be cast to class ch.qos.logback.classic.LoggerContext 

I was wondering why was it the case, I have tried googling about this issue but i had no success

kind hatch
misty current
#

i guess it's because minecraft does soemthign with the default logger but i have no idea how to make it work with minecraft bs

crude loom
# misty current you just need to implement commandexecutor

so this should work?

public class MyListener implements Listener, CommandExecutor {

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

        sender.sendMessage("Command executed");
        //dont mind the actual command
        if (label.equalsIgnoreCase("cRefresh")) {
            players.clear();
            for (Player p : Bukkit.getOnlinePlayers())
                players.add(p.getUniqueId());

            sender.sendMessage(players.toString());
        }
        return true;
    }

}
    
misty current
#

no need to implement Listener

ebon coral
#

^

misty current
#

that's for event listening as the name says

ebon coral
#

Also make sure to register the command obviously

subtle folio
crude loom
ebon coral
#

I mean it is

#

But we didn't know that

#

lol

misty current
#

^

#

you should split the classes up tho

tender shard
#

having a listener and a commandexecutor in one class sounds messed up

misty current
#

because it's kind of a mess else

crude loom
#

ah

tender shard
#

I mean of course you can do it, if it somehow belongs together, but normally you wouldn't do it

kind hatch
crude loom
#

I just need the command to reset a list, hence it would be convenient

verbal heron
#

does 1.18.2 have nms changes?

tender shard
#

yes

kind hatch
#

Yes?

#

What versions don't?

tender shard
#

1.18 and 1.18.1

#

or 1.16.4 and 1.16.5

misty current
#

ofc never versions have more stuff in it

ebon coral
#

Could help :>

merry kindle
#

Is there a way of editing a loot table?

ebon coral
#

Does anyone know how to use Paperweight?

verbal heron
#

did they change the obfuscation

kind hatch
#

Compared to?

tender shard
verbal heron
#

on older versions i coould use "nbttag.getKey()" now i need to use smth like "nbttag.a()"

tender shard
kind hatch
#

That's because of the mojang mappings.

verbal heron
#

how do i use them

slate pendant
#

(for 1.18) How can I get default chunk generation and use it with another seed?

  1. I know I can create custom BiomeGrid, but it is not supposed for default generation
  2. It is kinda deprecated in 1.18
slate pendant
#

there is some other thing in 1.18 instead BiomeGrid but it is difficult to make use default algorithm too

#

and how can I set current generation type to another

#

if there is stuff for that (like interfaces to implement)

crude loom
#

it works now, thanks for the help :D

lean gull
#

is there a way to make an item be held up like when you hold a crossbow?

quaint mantle
#

wdym by that?

misty current
#

you mean the loading animation or the direction the item is facing?

#

like how it renders while a player holds it without doing anything

lean gull
#

i wanna have an item that is held like this

quaint mantle
#

ohhh

#

I think you have to use NMS for it

misty current
#

probably with animation packets

lean gull
#

frick

misty current
#

animation packets should be pretty easy with protocollib if you don't want to mess with nms code

quaint mantle
#

personally I like raw nms code

misty current
#

same here

lean gull
#

packets are sooo hard to learn

#

let alone nms

misty current
#

they are not actually

quaint mantle
#

there are tutorials on yt

lean gull
#

for me they are

misty current
#

easy stuff is well documented

#

actually i am not sure if the right packet is the one i said

ivory sleet
#

Some parts of nms is like an ancient overgrown mangrove jungle, not always trivial

grim ice
#

whats wrong with stuff that were in my api packagae

#

i dont see the problem with them

ivory sleet
#

Nothing wrong

#

I just said that it’s not really a good api

misty current
#

not sure if i misread something

grim ice
#

o but how to improve it

ivory sleet
#

Expose interfaces

misty current
#

or something with a valid animation

ivory sleet
#

Instead of exposing implementation

#

This feedback I gave you is of course a bit towards the enterprise and professionalism direction

#

So if you’re just creating an average spigot lib, then it doesn’t matter that much

quiet ice
#

just don't go too far in the enterprise rabbit hole

merry kindle
#

Anyone know how loottables work?

grim ice
#

but like

#

do i tell the user to do smth like

golden turret
#

is that right or should i create the cache using the syncrhonizedMap?

grim ice
#

oh wait

grim ice
#

but like i would have to make a factory pattern for that right

ivory sleet
#

As the method simply wraps the map

grim ice
#

and factories are annoying for the user

#

arent they

golden turret
#

alright thanks

ivory sleet
#

Depends 2Hex

#

They’re much better than direct instantiation

#

As it decouples instantiation and creation

#

Like when I worked on a semi-professional project then I pretty much used static factory methods and sometimes factories whenever I creates new objects because it really helps decoupling

mortal hare
#

is there any way to get internal crafting inventory of player

#

not player's inventory

#

but the crafting's inventory inside player's inventory view

tardy delta
#

what does async mode means in the context of executors? arent they considered to be running on another thread?

mortal hare
#

player.getOpenInventory() works if player doesnt have any inventory opened

#

but is there any way to have that instance directly

ivory sleet
tardy delta
#

ye

ivory sleet
#

in that case it just switches execution priority

#

normally they have a last-in-first-out order

#

forkjoinpool has a boolean property to toggle that

#

such that it can become first-in-first-out instead

grim ice
ivory sleet
#

which is better if you want to make some sort of event based system

#

2Hex uh

#

I'd do sth like

tardy delta
#

i thought it would be fifo so the tasks are executed as quickly as possible but probably because its a forkjoinpool it uses lifo?

#

becausse the tasks are split into smaller tasks πŸ€”

ivory sleet
#

by default fjp uses lifo

ivory sleet
#

not necessarily

#

fjp is better at distributing tasks than cached thread pool

#

but it cannot simply tear down a runnable just like that

grim ice
ivory sleet
#

@mortal hare isnt it exposed in the PlayerInventory?

#

1 sec 2hex

ivory sleet
#

oh nvm

mortal hare
#

PlayerInventory and crafting Inventory are different

ivory sleet
#

the api seems to be somewhat vulgar in this case

#

yeah

mortal hare
#

they're split up

#

i would love to set items at that inventory

#

even if the player opens chest or any other container type

ivory sleet
#

yeah

#

@grim ice can you link the github repo again

dire salmon
#

How can i make waves with particle?

rough drift
#

sin go brrrrrrrrrrrrrrr

#

cos go brrrrrrrrrrrrrrrrrrr

dire salmon
#

Like this but a circle

#

I dont understand sin and cos

red sedge
#

does ArrayList#sublist modify the array

#

if so is there anyway i can do the same function without modifying it

rough drift
quiet ice
rough drift
quiet ice
#

actually, lemme plot something

quaint mantle
ivory sleet
#

it returns a view

grim ice
#

btw conclure in case of my class EntityHolder, how would i name the interface

ivory sleet
#

link the github

#

I will write an example

grim ice
#

and if i make an interface named Holder, i must make it generic, cuz a holder can be many stuff

#

a sec

grim ice
red sedge
mortal hare
#

this would always return player's inventory view no matter if container is opened

quiet ice
ivory sleet
#

new ArrayList<>(list.subList(from,to)); or sth @red sedge

#

I think there is a better way of doing it

dire salmon
ivory sleet
#

but that's one

quiet ice
#

A variable that is proportional to the time passed

waxen plinth
#

Best way:
IntStream.range(from, to).mapToObj(list::get).toList()

dire salmon
quiet ice
#

It can be anything

rough drift
quiet ice
#

The faster it increments the higher the frequency of the waves however

#

Ticks might be too fast

rough drift
vague swallow
#

Does anyone know how to move an entity to a player?

waxen plinth
#

Entity#teleport(Entity)

rough drift
ivory sleet
#

sadly not

rough drift
#

well then i am too used to kotlin

ivory sleet
#

lol

#

yeah

rough drift
vague swallow
ivory sleet
#

well I dont blame you

waxen plinth
#

I am a nerd

#

That's how

rough drift
#

if you mean walking thats an entire other can of worms

vague swallow
#

yes

waxen plinth
#

If you want to make it pathfind to another entity that's gonna be hellish

#

Though actually

#

Depending on what entity it is

rough drift
#

just implement A*

waxen plinth
#

You could just set its target

vague swallow
#

oh oh

rough drift
#

oh yeah

waxen plinth
#

And it will pathfind there

#

Should work for any living entity I believe

vague swallow
dire salmon
grim ice
rough drift
quiet ice
vague swallow
waxen plinth
#

My library has pathfinding built in but it does ignore gravity

rough drift
rough drift
quiet ice
#

It should be sin((x * x + y * y) * k + time) instead. k dictates the between waves frequency and must be a constant. Time is an everyincreasing variable and is proportional to the frequency of high and low at a certain point

grim ice
rough drift
waxen plinth
#

All code ever written is derivative of RedLib

rough drift
#

great point, i do like making command libs

rough drift
vague swallow
waxen plinth
#

Oh cool

quiet ice
vague swallow
#

Thanks!

waxen plinth
#

Probably overkill to use the entire library just for this small function

#

Feel free to just copy+paste the code you need

#

Credit is appreciated but not required

wary harness
#

So I would need some suggestion what would be best solution for my problem with ThreadPool
public ExecutorService ex = Executors.newFixedThreadPool(10);
So I am using 10 ThreadPools and hikaricCP mysql
So problem now which I have is that for example if player votes on some web sites and he gets reward of coins which is added thru this thread pool
Server will run for example 5 reward one for each vote which will run /Coins add %player% 5
that will then run mysql code but problem is all of those reward will run at same time and on the end player will end up getting one reward
because multiple task in mysql will override each other
So what would be best solution to keep track if there is already task with that player in pool HasSet and then make another thread which will collect tasks and when player is removed from HashSet add that player and next task to pool?

vague swallow
vague swallow
dire salmon
#

Im on phone so probably missed something

quiet ice
#

Not quite. You also need to update the position of the particle afterwards

#

And it should be x * x + y * y, not x * x * y * y as you want it to be proportional to the distance from the center (which in this case is assumed to be 0/0 - so change accordingly)

dire salmon
#

Ah ye i didnt see you put a +

quiet ice
#

And y should be z in minecraft space really

ivory sleet
#

@grim ice just an example,
but here the api user would first use for instance
EntitySerializer serializer = EntitySerializer.create(this);
and then they can do whatever they want with the serializer...

interface EntitySerializer {

  static EntitySerializer create(Plugin plugin, StructureManager structureManager) {
    return new SimpleEntitySerializer(plugin,new EntityHandler(structureManager, new StructureFactory()));
  }

  static EntitySerializer create(Plugin plugin) {
    return create(plugin,plugin.getServer().getStructureManager());
  }

  static EntitySerializer create() {
    return create(JavaPlugin.getProvidingPlugin(EntitySerializer.class));
  }

  Plugin getOwner();

  Serializer<Entity, NamespacedKey, EntityHolder> getHandler();

}

class SimpleEntitySerializer implements EntitySerializer {
  final Reference<Plugin> plugin;
  final EntityHandler handler;

  SimpleEntitySerializer(Plugin plugin, Serializer<Entity, NamespacedKey, EntityHolder> handler) {
    this.plugin = new WeakReference<>(plugin);
    this.handler = handler;
  }

  @Override @Nullable Plugin getOwner() { return this.plugin.get(); }

  @Override Serializer<Entity, NamespacedKey, EntityHolder> getHandler() { return this.handler; }
}```
dire salmon
quiet ice
#

Yeah (but let's ignore that)

dire salmon
#

That what

quiet ice
#

It's not really relevant how the waves are set up

#

Well it is, but you get the gist either way

vague swallow
#

How can I get an entity a player is looking at?

grim ice
#

ur hiding that, but showing the other

ivory sleet
#

no its an interface

grim ice
#

ik

ivory sleet
#

it exposes what, not how

dire salmon
#
public static final double K = 1.0;
public void makeWaves(double x, double z, int k, long time, Player p){
double waveThing = Math.sin((x*x+z*z)*k+time);
spawnParticle(particle, waveThing, 1);
}```
?
grim ice
#

isnt there any other way that isnt that ugly

ivory sleet
#

but if you want, you could obv create a shorthand interface like interface EntityHandlerSerializer extends Serializer<Entity, NamespacedKey, EntityHolder>

#

and then return EntityHandlerSerializer

ivory sleet
#

but like, I'd just return Serializer<Entity, NamespacedKey, EntityHolder>

somber hull
#

What Mike said, reverse the map so its entity, player so you dont itterate through the map a lot

#

Wait

#

didnt realize you responded to his message

#

Sorry for ping lol

grim ice
quiet ice
grim ice
#

even though it implements it

quiet ice
#

But I am too lazy to explain

ivory sleet
#

yes u can?

grim ice
#

u cant return a subclass from its parent class tho

#

u cant turn a parent class into a subclass is what i mean

ivory sleet
#

obv if u wanna use sth like the example EntityHandlerSerializer you'd have to expose that instead of just Serializer<..., ..., ...>

grim ice
#

u cant return the serializer interface when the type is EntityHandlerSerializer

dire salmon
ivory sleet
#

the concretion must implement EntityHandlerSerializer

ivory sleet
#

yeah, well I'd just stick with the Serializer interface

#

sure its long

#

but its a high abstraction which is nice

grim ice
#

ok

minor garnet
#

why i geting nothing on this String from a nbt value

    public static ItemStack setNBTValue(final DeanGuns plugin, ItemStack item, String key, String value) {
        net.minecraft.server.v1_12_R1.ItemStack itemStack = CraftItemStack.asNMSCopy(item);
        if (itemStack == null) return null; 
        
        NBTTagCompound nbt = itemStack.getTag();
        if (nbt == null) {
            plugin.sendMessage("null");
            nbt = new NBTTagCompound();
            itemStack.setTag(nbt);
            nbt = itemStack.getTag();
        } 
        
        nbt.setString(key, value);
        String value1 = nbt.getString(key);
        plugin.sendMessage("value1:" + value1);
        itemStack.setTag(nbt);
        item = CraftItemStack.asBukkitCopy(itemStack);
        return item;
    }

    public static String getNBT(DeanGuns plugin, ItemStack item, String key) {
        net.minecraft.server.v1_12_R1.ItemStack stack = CraftItemStack.asNMSCopy(item);
        final NBTTagCompound nbt = stack.getTag();
        plugin.sendMessage("value:" + nbt.getString(key));
        return (nbt != null && nbt.hasKey(key) ? nbt.getString(key) : null);```
grim ice
#

im gonna pull since my local version is a mess now lmao

ivory sleet
#

πŸ₯²

grim ice
#

ill fix it now

grim oak
quiet ice
#

basically you'd need to have something like

makeWaveMomentarily(xCenter, zCenter, yMin, t, size):
  for (x)
     for (z)
        x2 = (xCenter + x);
        z2 = (zCenter + z);
        spawnParticleMomentarily(x2, sin(x * x + z * z + t) * size + yMin, z2)

makeWavePersistent(xCenter, zCenter, yMin, size):
   t = 0;
   schedule:
      makeWaveMomentarily(xCenter, zcenter, yMin, t++, size)
#

@dire salmon

#

Just note that this is highly pseudocode since I cannot be arsed to write compileable java code there given that I never worked with particles

dire salmon
#

Ok

#

Wich one do i call

quiet ice
#

Stop trolling

dire salmon
grim ice
#

when python:

#

when yaml:

dire salmon
#

True

quiet ice
#

Like jesus, this won't compile anyways!

#

Heck, this won't run even with eclipsec

dire salmon
#

I dont know what pseudocode is

grim ice
#

its actually impossible i think

#

there isnt a shorthand

ivory sleet
#

there is

dire salmon
grim ice
quiet ice
ivory sleet
#
interface EntityHandlerSerializer extends Serializer<..., ..., ...> {}
class SimpleEntityHandlerSerializer implements EntityHandlerSerializer {
  //TODO
}

interface EntitySerializer {

  static EntitySerializer create(Plugin plugin, StructureManager structureManager) {
    return new SimpleEntitySerializer(plugin,new SimpleEntitySerializerHandler(structureManager, new StructureFactory()));
  }

  static EntitySerializer create(Plugin plugin) {
    return create(plugin,plugin.getServer().getStructureManager());
  }

  static EntitySerializer create() {
    return create(JavaPlugin.getProvidingPlugin(EntitySerializer.class));
  }

  Plugin getOwner();

  EntityHandlerSerializer getHandler();

}

class SimpleEntitySerializer implements EntitySerializer {
  final Reference<Plugin> plugin;
  final EntityHandler handler;

  SimpleEntitySerializer(Plugin plugin, EntityHandlerSerializer handler) {
    this.plugin = new WeakReference<>(plugin);
    this.handler = handler;
  }

  @Override @Nullable Plugin getOwner() { return this.plugin.get(); }

  @Override EntityHandlerSerializer getHandler() { return this.handler; }
}
#

2hex

grim ice
#

ic

dire salmon
midnight shore
quiet ice
#
  • for (x)
  • No return types
  • :
  • schedule:
  • No variable types
  • No access modifiers
#

Are you sure that the block represents an analoguepowerable?

dire salmon
#
makeWaveMomentarily(xCenter, zCenter, yMin, t, size):
  for (x)
//returns nothing
     for (z)
        x2 = (xCenter + x);
        z2 = (zCenter + z);
        spawnParticleMomentarily(x2, sin(x * x + z * z + t) * size + yMin, z2)

makeWavePersistent(xCenter, zCenter, yMin, size):
   t = 0;
   schedule:
//returns this?
      makeWaveMomentarily(xCenter, zcenter, yMin, t++, size)
midnight shore
honest sentinel
#

How would I be able to play this as a title?

play-title:
  - "&c&lP         L         A         Y         !"
  - "&c&lP       L       A       Y       !"
  - "&c&lP     L     A     Y     !"
  - "&c&lP  L  A  Y  !"
  - "&c&lP L A Y !"
  - "&c&lPLAY!"
  - "&e&lP&c&lLAY!"
  - "&c&lP&e&lL&c&lAY!"
  - "&c&lPL&e&lA&c&lY!"
  - "&c&lPLA&e&lY&c&l!"
  - "&c&lPLA&e&lY&c&l!"
  - "&c&lPLAY&e&l!"
  - "&c&lPLAY!"```
I tried this https://paste.md-5.net/ezolabibud.java but it only plays the first one cuz of me using cancel(); but removing it just makes it loop through it all endlessly.
midnight shore
dire salmon
quiet ice
#

that is probably a bukkit moment then

midnight shore
honest sentinel
quiet ice
#

REDSTONE is not analogue powerable

#

actually..

midnight shore
#

it also doesn't work with REDSTONE_WIRE

quiet ice
#

Yeah it is

lost matrix
quiet ice
#

Okay, according to the material enum redstone wire is analogue powerable, but redstone redstone is not

kind hatch
lost matrix
#

Wait... You even start one runnable per line and let them run all at the same time,,,

quiet ice
#

But bukkit has been strange from time to time, so Β―_(ツ)_/Β―

midnight shore
quiet ice
#

as in crash or just not doing anything?

honest sentinel
midnight shore
#

Just doing nothing if you are talking to me

quiet ice
#

and do sysouts print anything?

lost matrix
midnight shore
quiet ice
#

then add a few just to be extra sure.
The fact that if it is redstone is throws an exception is normal, but if it is an redstone wire it is strange

midnight shore
#

it doesn't throw anything, it just doesn't do anything at all

quiet ice
#

then it probably is not called

#

Oh

#

You do not set the block data do you

midnight shore
quiet ice
#

block.getBlockState().setBlockData() is basically a NOP

midnight shore
quiet ice
#

(if block is a bukkit block)

midnight shore
#

then how do i do it? πŸ˜…

quiet ice
#

what type is block?

#

block.setBlockData?

#

?jd-s

undone axleBOT
midnight shore
#

my goodness

quiet ice
midnight shore
#

it doesn't do anything either this way

lost matrix
#

Not a hard concept. Incrementing a counter isnt that complex.

quiet ice
midnight shore
#

yes

quiet ice
#

And the sysouts do get called?

sharp saffron
#

hello! so im developing a spigot plugin and in the plugin it has custom items which have custom textures . So far this has not been a problem (managing to put custom textures via a resource pack) but ive gotten stuck when it came to armor. So does anyone know how to make the armor look different? below ive attached some images of the item json files and what it looks like in game like shown in game it still shows up on the player like netherite armor

midnight shore
#

so wait wait

#

i tried adding a sysout at the end

#

and it works

#

so there is a problem updating the block i guess

quiet ice
#

As in fully works or just the sysout working?

lost matrix
midnight shore
#

the block updating are not

lost matrix
chrome beacon
dire salmon
quiet ice
#

Don't bother

chrome beacon
#

Aight

kind hatch
quiet ice
#

y = sin(x * x + z * z + t) should already be enough info

dire salmon
#

Ok

quiet ice
#

I certainly do not see any issue with the code

sharp saffron
quiet ice
#

Math.sin

midnight shore
#

but is the part of the power correct?

lost matrix
# honest sentinel I don't get it?

Here is most of it. The rest should be trivial:

    public void sendLines(Player player, List<String> lines) {
        new BukkitRunnable() {
            int index = 0;

            @Override
            public void run() {
                if (index == lines.size()) {
                    cancel();
                    return;
                }
                String line = lines.get(index);
                player.sendActionBar(line);
                index++;
            }
        }.runTaskTimer(plugin, 1, 1);
    }
quiet ice
#

Math.cos should also work

sterile token
#

What that things?

quiet ice
#

Basic trigonometry

sterile token
#

I dont think that the correct sintaxis

quiet ice
#

Of course it isn't the right syntax

lost matrix
quiet ice
midnight shore
#

uh wait! I tried using a command to set the redstone power of a redstone wire and it doesn't work either, so there must be a problem within my other plugins i guess

sharp saffron
#

ah ok well ty for the help

sterile token
#

sin, cos and tan, takes 2 paameters...

quiet ice
#

could be paper interfering

#

sin takes 2 params?

sterile token
#

Yes

quiet ice
#

what

#

the

#

hell

lost matrix
sterile token
#

Yeah ir ima ring!

#

πŸ€”

lost matrix
#

What kind of sin are you using? 2 params makes no sense

#

Like. Sin is just a one dimensional function f(x)

sterile token
#

Yeah its a funciΓ³n and need 1 arameer

#

the degress

#

And that all

honest sentinel
sterile token
#

Corrector its wrolikgn romg

quiet ice
#

pretty sure in java the input needs to be in radians

sterile token
#

Idk what happen

grim ice
#

what do u guys think

quiet ice
sterile token
lost matrix
grim ice
#

about abstraction in the api package

sterile token
#

On fridaday I was drunkπŸ˜‚

grim ice
#

now users

#

will get exposed to nothing but interfaces

#

if im not missing smth

lost matrix
grim ice
#

nah man u cant tell me its unimportant after spending all that time πŸ’€

sterile token
#

In my api im between using interfaces or abstract classes. Recommendations?

grim ice
#

jk

thick scarab
#

How to update ItemStack in player's inventory?
For e.g. I want to change it's displayName
getItemMeta().setDisplayName() isn't working

grim ice
#

well nothing is important except that the code works if u think about it, but ur not gonna feel good and no one is gonna feel good about ur code if u just follow that statement

lost matrix
sterile token
thick scarab
#

Not in hand

lost matrix
thick scarab
lost matrix
#

Im pretty sure thats the problem

sterile token
#

I was told that for building api classes i should use interfaces

thick scarab
# lost matrix Show your code.
public void replaceItemName(CustomPlayer customPlayer) {
  if(getCooldown() == 0) {
    ItemMeta itemMeta = getItemStack().getItemMeta();
    itemMeta.setDisplayName(Utils.colorize("&fSword | &aCan use"));
    getItemStack().setItemMeta(itemMeta);
    customPlayer.getPlayer().updateInventory();
  } else {
    ItemMeta itemMeta = getItemStack().getItemMeta();
    itemMeta.setDisplayName(Utils.colorize("&fSword | &cWait"));
    getItemStack().setItemMeta(itemMeta);
    customPlayer.getPlayer().updateInventory();
  }
}
lost matrix
thick scarab
#
public ItemStack getItemStack() {
  return itemStack;
}
lost matrix
kind hatch
#

Why not just get the item the player is holding and then work off of that? Or if you just need something from the inventory, iterate over the inventory till you find what you need to edit.

thick scarab
#

πŸ€”
hm, okay, I'll try

minor garnet
lost matrix
#

Or use the nbt api

minor garnet
#

pdc dont exist for 1.12.2

#

i tried already

quiet ice
#

which is why the word "and" was used

minor garnet
quiet ice
#

either by synchronising on the map while iterating or just using ConcurrentHashMap

lost matrix
golden turret
#

a

#

the latest pic

daring lark
#
@EventHandler
public void roleMenuEvent(InventoryClickEvent e) {
        if(e.getClickedInventory() != null) {
            Player player = (Player) e.getWhoClicked();
            if(guiManager.createRoleSelector(player).equals(e.getClickedInventory().getHolder())) {
                e.setCancelled(true);
            }
        }
    }```

how could i Disable taking items from inv? I have sth like this but it's not working
golden turret
#

the cache is the cache object

#

not the map

golden turret
silver shuttle
#

new PropertyMalformedException().printStackTrace();
Is this the correct way of throwing a custom exception?

quiet ice
#

use CHM really

golden turret
#

ok

silver shuttle
#

i just realized too

viral temple
#

?learn java

silver shuttle
#

so NVM

viral temple
#

what was the command?

quiet ice
#

?learnjava

undone axleBOT
viral temple
lost matrix
#
throw new PropertyMalformedException("Some message");
silver shuttle
#

yup got that now too

#

ty

raw ibex
#

how would i use getWorld() in a command

daring lark
#

i think Bukkit.getWorld();

lost matrix
#

Bukkit.getWorld(String)

raw ibex
#

the name of the world?

daring lark
#

yes

#

"World"

raw ibex
#

oki

#

so the name of the file?

daring lark
#

of tge world folder

raw ibex
#

oki

#

ty

daring lark
#

how could i get inv name?

candid galleon
#

?jd

candid galleon
#

look at its javadocs

grim ice
dire salmon
#
for(int degree=0;degree<360;degree++){
double radians = Math.toRadians(degree);
double x = Math.cos(radians);
double z = Math.sin(radians);

location.add(x, 0, z);
location.getWorld().spawnParticle(Particle.END_ROD, location, 0);
location.subtract(x, 0, z);
}
candid galleon
#

don't think inventories have names*

somber hull
somber hull
daring lark
#

i mean title

somber hull
#

Wait

candid galleon
#

titles are tied to the view

somber hull
dire salmon
somber hull
#

I could be wrong

daring lark
somber hull
#

Your checking if the player is equal tk the person opening the inventory?

lost matrix
quiet ice
#

I never worked with particles so I do not know

daring lark
#

    GUIManager guiManager = new GUIManager();

    @EventHandler
    public void roleMenuEvent(InventoryClickEvent e) {
        if(e.getClickedInventory() != null) {
            Player player = (Player) e.getWhoClicked();
            Inventory inv = e.getClickedInventory();
            if(inv.equals(guiManager.createRoleSelector(player))) {
                e.setCancelled(true);
            }
        }
    }
}``` 

this also don't work.
quiet ice
#

also, if that is just for a circle, it can just be y + sin(t) * k where as t is something proportional to time and k just a constant size factor

tender shard
daring lark
#

yes it doesn't cancel event

tender shard
lost matrix
daring lark
#
        Inventory roleSelector = Bukkit.createInventory(inventoryOwner, 9, "Wybierz rolΔ™");

        ItemStack glass = new ItemStack(Material.WHITE_STAINED_GLASS_PANE);
        ItemMeta glassMeta = glass.getItemMeta();
        glassMeta.setDisplayName(ChatColor.WHITE + "Wybierz rolΔ™");
        glass.setItemMeta(glassMeta);

        ItemStack policeButton = new ItemStack(Material.BLUE_WOOL);
        ItemMeta policeButtonMeta = policeButton.getItemMeta();
        policeButtonMeta.setDisplayName(ChatColor.BLUE + "Policja");
        policeButton.setItemMeta(policeButtonMeta);

        ItemStack criminalButton = new ItemStack(Material.RED_WOOL);
        ItemMeta crminalButtonMeta = criminalButton.getItemMeta();
        crminalButtonMeta.setDisplayName(ChatColor.RED + "Kryminalista");
        criminalButton.setItemMeta(crminalButtonMeta);

        roleSelector.setItem(0, glass);
        roleSelector.setItem(1, glass);
        roleSelector.setItem(2, glass);
        roleSelector.setItem(3, policeButton);
        roleSelector.setItem(4, glass);
        roleSelector.setItem(5, criminalButton);
        roleSelector.setItem(6, glass);
        roleSelector.setItem(7, glass);
        roleSelector.setItem(8, glass);
        return roleSelector;
    }```
tender shard
dire salmon
daring lark
#

ok so how could i compare these?

dire salmon
#

ill try to make it in command block so you can see an example

lost matrix
dire salmon
#

did

lost matrix
daring lark
dire salmon
#

wha?

patent horizon
#

whats the easiest way to format money?

tender shard
lost matrix
quiet ice
tender shard
#

then remove them from the list again when they close the inv

#

I'd just use an ArrayList<UUID> or HashSet<UUID>

#

unless you still need the inventory later again

#

then go for a map

lost matrix
patent horizon
#

no just 100000000000 -> 100,000,000,000

vocal cloud
tender shard
#

I'd just use String.format

daring lark
#
    public void roleMenuEvent(InventoryClickEvent e) {
        if(e.getClickedInventory() != null) {
            Player player = (Player) e.getWhoClicked();
            Inventory inv = e.getClickedInventory();
            if(Objects.requireNonNull(Objects.requireNonNull(inv.getItem(0)).getItemMeta())
                    .getDisplayName().equalsIgnoreCase(ChatColor.WHITE + "Wybierz rolΔ™")) {
                e.setCancelled(true);
            }
        }
    }```

lol i done sth like this
quaint mantle
#

Okay so I'm sorry to bother yall but, what would you use Databases for, in what case and what are the positive/negative sides of using one in a plugin?

quiet ice
#

Pros)

  • It's a database
    Cons)
  • It's a database
dire salmon
#

particle thing

silver shuttle
#

how the f-?

tender shard
#

what's the problem?

quaint mantle
silver shuttle
#

the lower table should always have the current identifier of auto_increment

tender shard
#

auto_increment will only be changed if you actually use it

silver shuttle
#

but is doesnt

tender shard
#

if you manually inserted 1, 2, 3, then auto_increment is still at 1

silver shuttle
#

no, it was automatic

#

that is not the whole table, i am only displaying the id column

#

I set some other value to something to test it

quiet ice
silver shuttle
tender shard
#

this should also show it:

SHOW CREATE TABLE `TableName`;
silver shuttle
#

what do I use as "name"?

tender shard
#

name

silver shuttle
#

k

tender shard
#

show your INSERT statement

#

seems like you indeed never used auto_increment

silver shuttle
silver shuttle
#

couldve just asked me to show the creation sql .-.

tender shard
#

there it says auto_increment = 4

#

weird

waxen plinth
#

Use FormatUtils.formatMoney

patent horizon
#

hm

#

okey

quaint mantle
#

Okay so, what would you guys choose, MySQL or MongoDB?

waxen plinth
#

I prefer mysql

#

But that's because I have never used mongo

silver shuttle
#

same

tender shard
#

basically everyone has access to mysql

#

but only some people have access to mongodb

#

also "mongo" is a german insult for disabled people lol

silver shuttle
tender shard
#

"Du Mongo!"

silver shuttle
#

nope

tender shard
#

weird

quaint mantle
silver shuttle
#

never in my entire life

mighty bane
#

Okay so quick question, we're trying to modify a plug-in a friend gave us, however when we try to compile it. The console keeps asking us to add a ';' here. Any clue as to why it keeps tossing this error?

tender shard
#

maybe it's just in NRW

silver shuttle
tender shard
quaint mantle
# waxen plinth Yes

Would you mind taking a second to give me like a good course that I can follow to learn MySQL?

raw ibex
#

so i basically started making a bedwars plugin with togglable event handler but i quit because it was getting too messy. what is the best way to start going and in what direction?

mighty bane
tender shard
waxen plinth
#

.-.

patent horizon
haughty storm
#

How would I spawn an npc using nms?

mighty bane
waxen plinth
#

Could just replaceAll("\\..+", "")

#

But I would keep it

#

Because otherwise you end up with just 1M for everything between 1 million and 1.999 million

dire salmon
#

something like this @quiet ice

raw ibex