#help-development
1 messages ยท Page 142 of 1
like with tellraw you would do in my case
[{"text":"\uE001"},{"translate":"space.-5"},{"text":"\uE001"}]
but i am trying to somehow use that with plugins
If it comes down to it you can always just dispatch a command from a plugin
MrEpiko I'm jealous that you got profile themes
I don't see the problem
nvm
Look I am not, I can't disable this white theme ๐ญ
everyone is hating on me
anyways, how do I force open book and quill?
1.8
I know that I have to use NMS for it
I've successfully made it force open normal book, but I don't know how to open book and quill
no clue on 1.8 but current book and quill is just an ItemStack of unwritten book
WRITEABLE_BOOK
1.8 would be legacy
how do i utilize custom languages from resource packs in the Player#sendMessage
I am trying to use negative spaces
Ive done this a few days back. One moment.
yes yes yes yes yes thank you
Inside your default.json file which defines your font chars:
{
"providers": [
{
"file": "minecraft:stick/2006.png",
"chars": [
"ใฃ"
],
"height": -3,
"ascent": -2000,
"type": "bitmap"
},
{},
{}
]
}
The "height" determines how far the character is being spaced
Setting "ascent" to -2000 basically shifts it out of the screen.
The image file can be of whatever size.
Just type in your replaced character.
I just started in the middle of old mandarin characters in the unicde table.
Or you can use them in the unicode form \uF000, \uF001...
You could also make separate fonts, if you have the ability to make your own plugins
Then your players won't ever be able to use those in chat
ok
how do i use those languages
in the plugin
thats what I am doing currently
yes
languages are defined in the resource pack though not the plugin right
Alright, so you could do it by separating the fonts into different files or do it all in the default.json file.
Yes
Yes ofc
are fonts and languages the same thing
Using separate files will also be incompatible with some parts where text is shown, because not all support TextComponents
can i add you to a thread to explain my use case
No, fonts are the textures of the characters that you type with. Languages are the text that gets translated client side
Yes of course
did u get added
hmm kinda long ago but how can i remove a few records from a database where i know the id of all those, can i use one query for that or not?
probably have to made a query for each removal ig
can someone help me h2 database please ty
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
hmm saw this but idk the number of records that should be removed :/
how do i create read and write from h2 db pls
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
do people even google
mysql
mysql != h2
same for all stuff
honestly
its quite funny how signed ints have a whole bit worth 2.1bil in decimal just for the sign
looks kinda hot actually
ngl
1.19 way of getAction()? for player interact event to register who left clicked itemstack anyone?:)
ngl?
How can I listen to Command block executions?
not gonna lie
yeah SQL stuff should be wrapped into stuff, but I forgot the name
yes
what is it called again
the name of what
of this idea to wrap every SQL stuff into their own object
?
just use db framework
object oriented programming?
like object to table mapper or whatever its called
nah you usually have some object for every SQL stuff, e.g. if you put a... erm let's just say Player object into a DB, you will have sth like a PlayerDatabaseSource object or similar
I forgot how it's actually called
i mean thats just oop
you are referring to mongo ?
yeah sure but there is a specific name for this idea and I just cannot remember the name
applies to every kind of DB
Can anyone shed any light on why this isn't registering the right click and performing the command? I'm going to debug but just asking if anyone can help ๐
errors?
Nope
kekw im already regretting writing this
broo
but if it works dont touch it
Yeah i had a brain fog i was checking for right click of entity lol
do event.getRightClicked() != null if it's true then the player is interacting with an entity
I'm using wrong event completely
why not just setObject ?
At*
Hello Someone have faction booster update for 1.12?
And
Killstats too update for 1.12
according to jdbc driver it automatically checks instanceof and use approperate method
PlayerInteractAtEntityEvent will do the job ig
I need PlayerInteractEvent, I'm just right clicking an itemstack i messed up
okaay
Thats why getAction() wasn't working i was like wtff xd
not sure if database might save it into the correct type?
.
check you driver impl, but default java one does that
all databases do that?
It's not evening broadcasting any... Not sure why this isn't working :/
early returns where
If you use a codec then it will. Also neat usage of the instanceof pattern.
A Map<Class<?>, Consumer<PreparedStatement>> is probably a little bit faster
mye thought about that but seemt a little overhead
Is the class registered as a listener?
Yes
not really overhead, more like too much work for smth small
Dont get the main hand item. Get the used item from the event.
Is it the class loaded in your main class
https://paste.goksi.tech/oxidelapeg.php this is snippet from com.mysql.jdbc.PreparedStatement
And dont check custom items by their name. Very error prone. Use the pdc of the ItemStack to tag custom items.
declaration: package: org.bukkit.event.player, class: PlayerInteractEvent
Yeah i've been told this before, I will give pdc a go thanks
?pdc
bitch
Thanks! Equipment slot then slot? I'm news to 1.19 what is equipment slot?
ahh hand, chestplate etc?
i believe so, long time since i touched spigot code
went learning c++ and created expression parser lmao
Do you find c++ easier?
No not equipment slot then item. Literally just getItem().
It returns the ItemStack which was right clicked with.
It asks for an args
No c++ is not easier...
getting basic io is easier lol
No there are no args
spares me some time
just do event.getItem()
This is not a method from EntityEquipment
Its from PlayerInteractEvent like the docs ive sent stated.
Well I'm not sure that's the only option i've got
What are you saying? You are calling this method on an EntityEquipment object.
But you need to call it on your PlayerInteractEvent object.
I have no idea that's what im saying, I'm using PlayerInteractEvent but it's giving me that
Show me a screenshot of what you are doing
Guessing not seen as you're saying it like that LOL
Hover over the method and tell me its return type.
Sir, entityequipment
Add an empty lore line to the list
next index in lore
oh i see, i'm so dumb thx
Right. Now which object in your code is of type PlayerInteractEvent
run getItem() on e not p, should look like ItemStack item = e.getItem();
Ahhhhh
it's normal that people get confused when they call their variables "e" and "p" etc ๐
I was using player
enums and equals hehe
damn im getting roasted
Yeah tutorials that introduce those ambiguous names should be banned
i can see the event calling e, but calling player p i dont get
Sending your own blog posts is the ultimate comeback ;D
well I do that all the time
damn this is how it feels to be gender fluid?
after all I wrote those blog posts so I dont have to repeat myself all the time
I've always been calling player variables p and event e, no problem with that
I did the same with spigot posts...
I'm just dumb
I would not allow that in my codebase
@EventHandler
public void onInteract(PlayerInteractEvent event) {}
Just looks a ton nicer and more readable <3
so how'd you call an exception that might also occur? e2?
Well my projects are not open source, nobody else than myself has to look at them, and as long as I know what it does idc
how would you call an entity? e3?
fair point
ignored xD
๐
jk
Single letter variables are only ok if they are exclusively used in the next 3 lines. Im with Bob Martin on this one.
true
good
imagine having to complete player all the time
Still nothing though
instead of p.
Yeah this is why i used p, way easier but
well I mean you just do "p" and press tab
or you spell it out completely, it takes like 0.3 seconds to write "player"
yeah and this way I press p. and i'm done
Ah yes. The countless hours you will save...
well as I said I don't really care as it's not open source and I know what I use p for
@lost matrix it works thanks
sure, do it however you like
You're a good teacher, didn't just give me the answer
Even in my for loops i dont use i actually...
same somtimes
for(int noti = 0; ....
crunch ๐
crunchyyy 
:newspapersmack: lol
no idea where it's from
๐คค

its from kyori
what's that
adventure
adventure
I dont think Im a member there
adventure papi
o.O
discord moment
oh that discord
dang jusr discovered it got a fast charging mode on my laptop3

why do you have 3 laptops
Is there anyway for me to set the damage cause
so i have this wand that shoots a beam
it does damage but it doesnt send a damage causer event
does that make sense?
Dealing damage with a specific cause?
e.g
I hit cow damage causer is Me the player
you could just call the event yourself
just do new EntityDamageEvent(...), then use the PluginManager to call this event
wait, are you damaging items, or damaging entities?
entity
double BlocksToShoot = 10; //Number of blocks to shoot for if 10 the beam will be 10 blocks long
Location end = player.getEyeLocation().clone().add(player.getEyeLocation().getDirection().normalize().multiply(BlocksToShoot));
Location start = player.getEyeLocation();
Particle particle = Particle.ASH;
double d = start.distance(end) / 10;
for (double i = 0; i < 10; i = i + 0.1) {
Location l = start.clone();
Vector direction = end.toVector().subtract(start.toVector()).normalize();
Vector v = direction.multiply(i * d);
l.add(v.getX(), v.getY(), v.getZ());
start.getWorld().spawnParticle(particle, l, 20);
List<Entity> near = l.getWorld().getEntities();
for (Entity e : near) {
if (e.getLocation().distance(l) <= 1.5D) {
if (e instanceof LivingEntity && !(e instanceof Player)) ((LivingEntity) e).damage(3);
}
}
}```
then as said, just call the EntityDamageEvent yourself
i do do that
i was using EntityDamageByEntityEvent
however the beam isnt a "entity"
i dont know if im making sense here
and i cant call player for "EntityDamageEvent"
just fire event yourself
Then why call the EntityDamageByEntityEvent?
If the player is not damaged by an entity
Is it possible for a player to execute a command and then plugin would execute some built-in command. For example, player executes /diamond and plugin will do /give {player} diamond
Bukkit.dispatchCommand
Yes. But dont do that.
or smth
Dont tell him 
๐ฅฃ
The reason im calling EntityDamageByEntityEvent is because i need to get the player to display some text on their action bar
Too late now
poor cow
You got a whole api at your disposal. Use it.
Dont be lazy and do some hacky implementations like dispatching commands.
๐
Then use entity.damage(10, otherEntity)
stop hurting that cow D:

should buy nitro but my mom sees everything i buy with my card :/
then she like pissed off
nitro is kinda useless unless you want a fancy colored name
i want the fancy emotes
you can also just boost this server without getting nitro, but I guess your mom would see that too ๐
its not fancy its animated
your mom is animated
I'd animate your mom if I could
have fun
putin talks to nation
this isnt the channel for that smh
Gonna start really soon
general mobilization incoming
How can I create a loopTask in bungeecord? (Something like bukkitrunnable)
getScheduler().schedule(Plugin, Runnable, long, long, TimeUnit)
How could I create a class for that?
is there any extend Scheduler?
or Implements
?
Implement Runnable
the runnable is the thing you implement
ProxyServer.getScheduler().schedule(yourPlugin, new Runnable { ... }, ...);
Thank you!
alex you forgot your lambda again hehe
I assumed they dont know about lambdas
not anonymous anymore
so I suggested a normal thing
If he needs fields than an anonymous class is needed
Trouble with reobfuscation Spigot 1.19.2
never underestimate people kekw
plot twist: I know about lambdas
What are you going to do now?
call the police
nothing
lmao
nuke your house
ofc Nuker suggests nukes lol
ez
get the FREE JAVA LESSONS
checkmybio
Nuke extends Weapon
Nuke extends God
no, God is a final class
implements Divine
my teacher programming asked so much boring questions today lol
skip pairs
"can an object be an instance of multiple classes"
don't go
well i came to late to lesson anyways
damn trains
nuke him too!
nuke him
her3
And the answer is?
nuke him
yes lol
the only proper answer is "at least not in java"
basically nuke him
the proper is bro what the heck are you asking looool
well it works in other languages
how do you even imagine it
BMW < Car < Vehicle < Object
That makes 4 already
It's an instance of BMW
i forgot my book too lmao
trash <
i was just making pong in lesson lol
since java is c++ made, instance of BMW just hase copy constructor from the language
true but I guess that's nitpicking since you only say "extends Car"
Ello! Got a quick question, is registering and unregistering events resource intensive?
ig not
What?
Yes
It has to rebake the entire event list every time
hows event listeners even stored? Map<Event, Set<Consumer<Event>>> or smth lol?
yeah but how long is that going to take? 2ms?
There is also no good reason to do that
Which is resource intensive in my books.
it depends on whether you call it once or every tick, I guess
you know c++?
I mean its not horrible like IO.
I just want to express my disapproval
yes
std::cout << "hello\n"
noone here ever heard of it, what is it?
I see, thanks for your input guys
btw corals what you are you trying to do?
This is a copy ctor
Thought of creating a gui lib which involves registering and unregistering events.. specifically events in each instance of the gui open
But wasn't sure if it was alright that's why I asked lol
oh that sounds like a bad idea. you should only have one listener that distributes the stuff to each separate GUI thing
Who uses this language? This was such a pain to learn even after knowing java pretty well.
mid++
Hmm I see
university students
Well I tried that before, the listener quickly bloated
ill probably learn assembly this year
One of the reasons I'm trying to create a better one is to have less loc
I'm sorry for your loss
I hope you get better soon
seems interesting lol
Tell your prof that gotos are a really clean tool to control code flow
So basically as long as there are no pointer operators in java
Its a java keyword as well btw
Yeah
Is there any reason that two players see the same mob facing different directions on there screens? I have like multiple mobs and players see them differently
so is const ๐ญ
How can I check if a Server is full using its name? (BungeeCord)
Im new to bungee, sorry guys
Here are some other lesser known keywords:
exports
volatile
transient
strictfp
I use transient quite a lot actually. The rest is pretty useless in terms of usability.
Hey! I made a .txt file with random names and saved it at the resources folder.
String wizzard_names = new File("").getAbsolutePath() + "/src/main/resources/wizzard_names.txt";
It says that the file doesn't exist. Can anyone help me?
what do you use transient for?
that's what this discord is for. you can get a server by it's name using ProxyServer.getServer(String), then do getPlayers() to get the amount of players
Export the file into a folder and read it from there or get the resource as stream
transient is to exclude stuff from getting serialized
i know transient, googled strictfp (sometihing with numbers), also know volatile and exports is new api so idk lol
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/plugin/Plugin.html#getResource(java.lang.String)
declaration: package: org.bukkit.plugin, interface: Plugin
so, it's purely for code-style
nothing about performance
What's that?
Documentation for a method
javadocs?
ok
How can I check for max player?
i dont think that bungeecord has any method for that
?jd
I was making a plug-in for queues.... And I just found out about it now ๐
damn only now do I realize that md heavily used lombok in bungeecord
yeah I also remember that from university. you go there, and learn nothing. then you skip the next day and you missed new stuff haha
[bump]
wat
usually no
that's how you can get the maxPlayers of a server
you can ping() the server and get a Callback to a ServerPing thing in return
dont even know if i must go to lesson
humh
ProxyServer -> getServerInfoโ(String name)
ServerInfo -> pingโ(Callback<ServerPing> callback)
ServerPing -> contains all the infos you need
Maybe there is an easier way but this is what i put together just skimming through the docs
how can I get the callback
You provide it
So, what should I do? I can't understand the javadocs
use a lambda
private void useInfo(ServerPing ping) {
}
public void something() {
...
info.ping(this::useInfo);
}
๐ง
a callback is like a lambda with 2 arguments, one for success (the ping instance that you're looking for) and one for an exception in case anything goes wrong
I am using mob.setInvisible(true) and on one player's screen they can see it and on the other they can't see the mob
This should honestly be updated to a BiConsumer
where should I export the file?
Placing command block while being unopped doesn't call the BlockPlaceEvent, what do I do?
did you try with another block?
yes
PlayerInteractEvent probably
Because you can't place Command blocks when you're not opped
ah. did not even know that
What do I exactly check?
PlayerInteractEvent
Well I don't know what you're trying to do, but check if it's in their hand first.
Wait how is he placing a command block when he is not opped?
He's not that's the issue
He wants BlockPlaceEvent to be fired for un-opped people placing Command Blocks but obviously that won't happen
Why does he want that if the players cant place it in the first place?

Ok I figured it out
what event should I use in my listener if I want to check if a player has right clicked a non interactable block
How can i get the a path key witch is a player name
Current:
return getGangsData().getConfigurationSection("gangs").getKeys(false).stream().filter(key -> getGangsData().getString("gangs." + key + ".Leader").equals(playerUUID.toString())).findFirst().map(key -> key).orElse(null);
ok ty
tryna loop through all players in there?
you would do that exactly the same way you did with the gang name
how can i loop all all players in there?
using #getKeys(false)
why are you storing both UUID and name?
because i need the possibility to check who is that player via data
then just store UUID and get teh offline player for its name
i have this class called TC which i make an instance of for every one of those in the world, it has a load of info in it like its location and who has accessed it. I would like to save this to a yml file.
In my main class i have a list of all of the instances of the TC class, along with a really simple bit of code to save stuff to a yml file.
Issue im having is i cant just save the classes, because its yknow a class. Im guessing id have to serialize it, but im not really sure how to do that. Or how id then load it afterwards.
I know i should just read the docs etc but ive tried and for some reason just cant understand what to do
well you could make 2 functions in TC, ine to serialize data and one to read (deserialize) it
depending on whats actually stored in TC it might be really hard or really easy
this is whats in my TC class
import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
public class TC implements Serializable {
private final Location location;
private final List<String> accessed;
private String accessCode;
public TC(Location location) {
this.location = location;
this.accessed = new ArrayList<>();
this.accessCode = "";
}
public TC(Location location, List<String> accessed, String accessCode) {
this.location = location;
this.accessed = accessed;
this.accessCode = accessCode;
}
public Location getLocation() {
return location;
}
public List<String> getAccessedPlayers() {
return accessed;
}
public void addAccessedPlayer(OfflinePlayer op) {
accessed.add(op.getUniqueId().toString());
}
public void clearAccessedPlayers() {
accessed.clear();
}
public String getAccessCode() {
return accessCode;
}
public void setAccessCode(String accessCode) {
this.accessCode = accessCode;
}
}
implement ConfigurationSerializable, follow the instructions for that and register your class.
ima be honest none of that makes any sense to me ive been using java for all of a month
what does tc stand for
making some rust eh ? xD
oxidize daisy
the game rust, yknow what i mean. maybe
should be easy since its just like 3 things
so uh, what would i put in these functions ๐ sorry for my lack of braincells lol
intelliJ
okay
so implement the interface and then intellij will let u know what you need to implement
not completely
you also need the map constructor or the static deserialize method
read the javadocs, it explains everything
declaration: package: org.bukkit.configuration.serialization, interface: ConfigurationSerializable
so i need a serialize and a deserialize in that class?
yes
one returns a Map<String,Object>, the other one takes one and returns your new object
is deserialize the one taking it?
deserialize is the one that takes a Map and returns your own object
got it
i added that but now a 2 variables are red lining saying that they might not have been initialized
wait i think im just an idiot
you only set the "name", you never set the location or the "accessed" thing
usually your deserialize method should do sth like this
return new TC(map.get("location"), map.get("name"), ...);
ahhh ok i think i get what you mean
btw TC is a bad class name, you should try to make it more descriptive ๐
but otherwise, it should work fine
also in your serialize() method, you ONLY save the name
you normally want to save all properties, not just the name
map.put("location", location);
map.put("accessed", accessed);
etc
oki
yea its because the short term for toolCupboard in rust is TC and i guess thats just what im used to calling it lol
just wanted to mention it haha
Call the class "p", "i" or "e"
Those are the most popular names for everything.
Or call it "main"
you forgot the /scnr part mr bratwurst
oh @latent tartan you also misspelled the deserialize method name
it's supposed to be called "deserialize", and NOT "deSerialize"
oki
Hmm. Why do you need this?
get the field using SomeClass.getField("..."), then call "get(myObject)" on it?
why do you need reflection for this
https://paste.md-5.net/oyihuyizek.cpp
Line 68 is still erroring. Now saying it needs a string, location, list etc and that im supplying an object instead of those
I dont really understand what you mean
you can just case these objects
e.g. ```java
return new TC((String) map.get("name"), (Location) map.get("location"), ...);
the object you want to get the field value from, or null if it's a static field
There are already tools for that. But here is the general approach:
Object instance = ...;
try {
Class<?> clazz = instance.getClass(); // Or Class.forName("")
Field field = clazz.getDeclaredField("number");
Object value = field.get(instance);
} catch (ReflectiveOperationException exception) {
exception.printStackTrace();
}
so?
Fun fact: graphs are hella cool, but also a pain to impl
Huh?
i thought ur example used getInt not get ignore it lolz
also i didnt mean generic in the literal java generics sense if thats what ur thinking
You dont. You pass the instance of which you want the field value from and
it will return the value stored in that field. This will always be of type Object
For marshalling you would do something like this:
Object instance = ...;
try {
Class<?> clazz = instance.getClass();
for(Field field : clazz.getDeclaredFields()) {
String fieldName = field.getName();
Type fieldType = field.getType();
Object storedValue = field.get(instance);
}
} catch (ReflectiveOperationException exception) {
exception.printStackTrace();
}
Can you set a null value to a PDC?
no
๐ ty
There is is a Void type iirc
it's annotated with NotNull
there is no builtin one, and there'd also be no way to distinguish it from actual data
ye i saw that right after :') my ide was giving it a solid maybe
haha
so i thought i'd ask then realised i could just yk, check
ty for help @tender shard <3 I got another error now but i dont think its related to saving so ill try figure it out
np,. feel free to send it
that's what this channel is for
:3
yea might as well im now beating my head against a wall tryna figure this out lol
true true
Might damage the wall, and re-painting is a bitch
Arti can I dm you quickly
sure
How to let unopped players to access and modify command blocks?
Hello, Is it possible to change the tab list order?
Does Entity#getVelocity() return an alias or a copy of said vector?
In other words would
entity.getVelocity().add(<some vector>);
change the entity's actual velocity or just a copy thereof?
pls tell me i can get the color name from dyes
doing a firework builder plugin thing since it popped in my head and i really dont want to have 50000 tables with different colors
So, I have some commands on my plugin and they are case sensitive. Is there a way to make them not case sensitive? Here is one of the commands:
public class GMSP implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)) {
Message.send(sender, "&cOnly players can use this command!");
return true;
}
Player player = (Player) sender;
if (!(player.hasPermission("coolplugin.command"))) {
Message.send(sender, "&cYou do not have permission to use this command!");
return true;
}
player.setGameMode(GameMode.SPECTATOR);
Message.send(sender, "Set own game mode to Spectator Mode");
return true;
}
}
Here is my spigoit.yml:
name: CoolPlugin
version: '1'
main: coolplugin.CoolPlugin
api-version: 1.19
description: This is a cool plugin.
commands:
heal:
description: Heals the executer.
usage: Use /heal.
spawn:
description: Teleports the player to the server spawn.
usage: Use /spawn.
suicide:
description: Kills the player.
usage: Use /suicide.
discord:
description: Sends the player a prompt to join the discord server.
usage: Use /discord.
gmc:
description: Changes the player's gamemode to creative.
usage: Use /gmc.
gms:
description: Changes the player's gamemode to survival.
usage: use /gms.
gma:
description: Changes the player's gamemode to adventure.
usage: use /gma.
gmsp:
description: Changes the player's gamemode to spectator.
usage: use /gmsp.
you mean /heal works, but /HEAL doesnt?
exactly
hm that's weird, lemme check if it also happens to me
k
oh yeah it seems to be normal
what you could do, as a dirty workaround, is to listen to AsyncPlayerChatEvent, then setMessage(...) and just turn the first word to lower case
if you want it to apply to every command
or you switch to a proper command framework like ACF ๐
I could check if first character of asyncplayerchatevent is / and if it is then just set all letters to lowercase
yeah that's what I meant
how do u do that
but ofc only change the first word
@EventHandler
public void onCommand(AsyncPlayerChatEvent event) {
String message = event.getMessage();
if(!message.startsWith("/")) return;
String split[] = message.split(" ");
split[0] = split[0].toLowerCase();
event.setMessage(String.join(" ", split));
}
try sth like this
that is ACF?
acf is framework for commands
noo, that's just a normal listener thing
yea ik
it should work for basically every command
im looking at it from github rn
but I havent tried it
im tryina see what its abt
ACF is totally different from vanilla commands
it lets you do stuff like this:
(1 sec)
cus tbh I learned how to do cmds from a yt tutorial and that's what they told me to do
@CommandAlias("gamemode")
public class GamemodeCommand extends BaseCommand {
@Default
public static void execute(Player sender, GameMode gameMode) {
sender.sendMessage("Gamemode set to " + gameMode.name());
sender.setGameMode(gameMode);
}
}
this is e.g. how a gamemode command looks like in ACF
maven
then you just add the <repository> and the <dependency> to your pom.xml. Oh and you also need to add the maven-shade-plugin if you don't have it already ๐
but yeah basically you only have to edit the pom, nothing you have to download yourself
alex
if something is named "1 second"
flightTime = Integer.parseInt(event.getCurrentItem().getItemMeta().getDisplayName().split(" ")[1]);```
this should work
right
[0]
or am i really stupid and its painfully obvious-
this will get you the word "second"
im going to sleep
arrays start at 0
so uh where do I put repository and dependency in pom.xml cus my pom.xml file has a lot of stuff in it
zzzzz
"1 second"
[0] = "1"
[1] = "second"
yeah im hella tired please kill me asap
inside of <dependencies></dependencies> or whatever is it spelled and <repositories></repositories>
^
oh what do I put in there?
1 sec
k
oh ok
this belongs into <build><plugins>
everything is explained here
as version use 0.5.1-SNAPSHOT, and as "artifactId" use "acf-paper" (even if you want to support spigot, you can safely use acf-paper instead of acf-bukkit)
so I just change all this text like change the org.spigotmc to co.aikar
no no
ah ok
you keep that stuff
read this, then add everything mentioned there except the "kotlin" part
or uh read it
and then you click the maven reload button
and then you can ping me here again ๐
k
ok what
flightTime = Integer.parseInt(event.getCurrentItem().getItemMeta().getDisplayName().split(" ")[0]);```
hm not sure then. but anyway, you should NEVER use the item name to get the value in the first place
you should rather set a PDC tag
so uh its telling me to replace org.spigotmc in here with co.aikar is that what im supposed to do?
pdc tags
nooo nooo nooo
maaaaaaaaaaannn im too lazy for this lol
you must create a second <dependency> section
he told me to put it inside of dependencies
except for all the other dependencies, ofc
you should have one spigot dependency, and one for acf
ah ok gotcha
just dont touch your existing spigot thing and add ACF separately :3
so like this
close
ok
you now have 2 <repositories>
uh ok
you also have to "insert" what you put into the second repositories thing into the first one
it is underlined in red
yea
at the top and in the middle
so
you also have to "merge" this
I put this inside of the first one
like this
ah ok
you have one <repositories> but you can have many <repository>
so u can have <dependencies> twice but not repositories
<pluralThing>
<singularThing>
...
</singularThing>
<singularThing>
...
</singularThing>
</pluralThing>
e.g. you can have 100 repositories and 200 dependencies, but every single dependency must be inside <dependencies> and every single repository must be inside <repositories> ๐
so
no D:
that's good
why is groupId and artifactId red
but replace [PLATFORM] with "paper" and replace "[VERSION]" with "0.5.1-SNAPSHOT
because you didnt read the text I sent ealier
^
like this
its all red now
that's normal. now you click on the reload button
ok
yea I am
it should take a few seconds and then it should work
did you also add the maven-shade-plugin ?
nah hold on
https://blog.jeff-media.com/persistent-data-container-the-better-alternative-to-nbt-tags/ yo ushould really use PDC for this ๐
or read the guide written by the handsome dude who "invented" PDC:
although I think mine is a bit easier to understand
๐ฅฐ
mentioning PDC is indeed how you summon me
haha
how do I put this code it says in my jar file
it wont let me open jar files cus u cant edit those
huh
you put this into your pom.xml as well
oh ok
you can ignore the maven-compiler-plugin thing for now
k
I have it already
okay then you're good
yeah that's good
dunno where I got it from but I just had it
now you can just create a new PaperCommandManager in your onEnable()
uh ok
and the GamemodeCommand() class will have to extend BaseCommand
e.g. like this
and then you're done
so I replace getCommand() thing with PaperCommandManger?
yeah, getCommand("someCommand").setExecutor(new MyCommandClass()) is basically the same as acf.registerCommand(new MyCommandClass())
but obviously you will now have to rewrite all your old command classes to the ACF version
no, one
u sent 2
you can ofc reuse the same "acf" / "PaperCommandManager" object everytime
hm
why are you using light mode alex
feels like a flashbang in csgo everytime xD
so I can still read stuff when the sun is shining
I switch between light and dark mode like every day haha
isn't there an option in windows switching between dark and light according to sun
its not working
yeah windows is disgusting, I only have it to play MSFS2020
do you even have a class called "gmsp"?
oh frick its capitalized
and even if pls capitalize the G
;-;
gj
and as said, remember - you have to completely rewrite your existing commands
ACF doesnt need you to implement CommandExecutor, it needs you to extend BaseCommand
sometimes I have the feeling that md5 and aikar wouldnt be very good friends haha. md loves interfaces, aikar loves abstract classes ๐
๐ฎ
its trueee
always depends, ofc
true, I abuse them all the time
๐ฅฒ
e.g. why can't interfaces cannot declare static fields in java 8 ๐ข
or can they? maybe I'm confusing 2 things right now
I think they can do that, I meant something different but I forgot what exactly I meant ๐
ye yea
yeah there's some feature that interfaces cannot have but I really cannot remember what it was
its static
thank god for default methods๐
because static infact, cant be abstract, can they
OH YEAH
I mean
interfaces can have static methods
hance there is no reason to have them in interfaces
and fields
cant in java 8 atleast
can
pretty sure java 8 interfaces can have static methods and fields yea
private default methods or sth might not be possible
or if it was private static
idr
I'd love to do something like this
interface PluginHook {
boolean canBuild(Player player, Location location);
PluginHook(Plugin myPlugin); // but this doesnt work
}
yeah
there isn't much point in a constructor
on an interface
not like it does anything with that parameter
I can see why you might want it
Hmm
but it would be hassle for eventual implementers
well they'd make sense
e.g. right now I gotta pass a Supplier
just have an init method or sth
which ofc also works
ah
but wouldnt it be nicer to have a way to tell javac that everything that implements PluginHook has a specific constructor?
I mean yea, factory pattern is the way to go
I think so
the type of what?
the one that implements the interface
like, anything on an interface only takes effect on an existing instance
yap, was my bad, you just must have body
well I basically just want to have a method that takes a Class<? extends PluginHook> and can then construct it
ofc, no problem with reflection, but that ignores the interface thingy
it would need some new syntax or sth to work without reflection
oh yeah Lynx I must ask, whats your take on elegant objects as well as data oriented programming ๐ฎ
Elegant has some nice concepts
idk just for example
new PluginHook::givenClass(myPluginsMainClass)
sth like that
idk
and givenClass could be e.g. WorldGuardHook.class
or whatever
tho I get more and more iffy on the whole "don't instanceOf" thing
Hello someone can help me to setup phpmyadmin i getting crazy ๐ญ
like, at the start I thought it was really bad
and with more and more pattern matching support in java
a nice switch statement just begins to look cool
similar to like, your enum usage in rust
fair
isn't it usually enough to extract the whole .tar.gz into some folder, change the "root account" settings and then make your webserver point at that folder?
at least that's how it worked 10 years ago
I know some people who counter it by saying enums + switches are generally evil because they end up doing more than one thing and sometimes they just become a dependency magnet
but it does clean up the code especially with the new java features introduced
I mean, enums is kinda funny
enum is nice in Java
Well yea just design wise they are funny
hehe
like, you don't want to store your data in the enum instance itself
because now your data is compile time
but on the other side, then you'd have a lookup for any form of data or relation the enum indicates
yeah, only thing I miss is type params for Enum<?> derivatives
tries very hard to not send a your mama joke
would be so nice
I have already php but when I setup and I go to myip/phpmyadmin
"You don't have permission to access /phpmyadmin on this server." I saw every blog to fix but nothing
NOO
let's go to #general
yea, generic enums or something
damn, thats a pity
indeed
301
enum Argument<X> { // declares generic enum
STRING<String>(String.class),
INTEGER<Integer>(Integer.class), ... ;
would indeed be very enjoyable to work with
so uh on here there is no return true; or return false; at all?
k
in ACF, all methods are "void"
k
fair
true
union types + yeet type erasure ๐
or acc thatd be problematic
but in theory
I fucking hate type erasure so much
I mean, the second request is coming
is it possible to register all the commands in a certain folder or no?
iirc
List<? super MyStuff> uuugh
thought that was speculations merely
oh yeah fair
java.lang.NullPointerException: Cannot invoke "org.bukkit.entity.Player.equals(Object)" because the return value of "me.quared.itemguilib.items.CustomItem.getOwner()" is null
public boolean isCustomItem(Player player, ItemStack stack) {
return customItems.stream().filter(item -> item.getOwner() != null).anyMatch(s -> Objects.equals(player, s.getOwner()) && Objects.equals(stack, s.getItemStack()) && s.isEnabled());
}```
how is this even happening anymore (1 is error, 2 is code that is causing the error)
CustomItem.getOwner() is null