#help-development
1 messages · Page 177 of 1
epic
obfuscated code be like tho
How about
if (args[0].toLowerCase().equalsIgnoreCase("HACKING".toLowerCase())) {}
nested toLowerCase() methods 😛
we all have those moments XD
i sent the exact same thing
you said "equals"
oh true
sry it's just half-screen discord formatting
XD
hard to read
toLowerCase(Locale.ROOT)😌
brains arent braining today
oh crap
what about if (args[0].toLowerCase().equalsIgnoreCase(ChatColor.stripColor(ChatColor.translateAlernateColorCodes('&', "HACKING".toLowerCase())) {
take away the &4 and we have a deal
there
thanks
amazing if statement
char[] args0 = args[0].toUpperCase().toCharArray();
if (new String(args0).toLowerCase().equalsIgnoreCase(new String(new char[] {'H', 'A', 'C', 'K', 'I', 'N', 'G'}).toLowerCase())) {}
lmfao
is this a contest?
probably
add chat strip color and translate alternate color codes
obfuscated code be like i guess
then add minimessages strip color
if so you broke the rules of only one statement
wonder what the longest most pointless if statement is
that has way too much excess
God made the mistake of letting us call methods after a method call. The CPUs will suffer
if(((Object)"HACKING") instanceof String hacking && args[0].equalsIgnoreCase(hacking))
who knows
nobody does because theres always one more line you could pointlessly add
its probably gotta be convert a string to char then convert that char to string strip chat colour and translate alternate desterilize with minimessages then check all the to lower case stuff
another thing you could do is convert every character in that to its number in the alphabet then convert that back
you hacking nasa?
contributing to a good cause (bloat)
Does inv have UID or something like that?
what would be the best way to store a location in mysql
you can store json in mysql?
Why is nothing logged?
I also cant logg anything with sender.sendMessage or Bukkit.getConsoleCommandSender
is it in plugin.yml
does it error/not error if either does it just not do anything
What?
What does running the command do in game or from console
add an else statement to your if (sender0
else {
ok
Thats strange...
When I execute the cmd clientside, its run through as expected but the else breakpoint starts
And when I execute the cmd serverside, still nothing happens
It has something to do with the intelij debugging, I'll just do it the old way xd
int amount = Integer.parseInt(args[2]);
if (amount == null) {
sender.sendMessage("§4§lPlease use a number or do not set this argument.");
return true;
}
Operator '==' cannot be applied to 'int', 'null'
an int cant ever be null
How would I check if its nots whole numbers?
alr
I check it with regex hehe
probably takes longer
Returning null would make Sense tho
Should search how execution speed evolves when An exception is thrown
Never mind. I just want to look clean code. Especially for simple plugins.
Smh
hi, can any 1 help me plz? i asked this question like 4 times and no one answered...
Why does the diamond sword not appear there!?!?! (the gui does)
okay
nope
@quaint mantle doesnt work
but i tried an anvil gui and that works
i have no fking idea why it doesnt work!!
Smithing is clearly broken
yes
Try placing an actual smith and provide it's location to your code
can u report an issue to md_5?
wdym?
You can yourself
Jira
When you create an inventory you have the option of providing a location to an actual inventory
see if it works when you provide an actual smith
If it does then it's simply incomplete code in Bukkit
thx
?jira
yeps
Yep Smithing inventory is not implemented in Spigot Caused by: java.lang.UnsupportedOperationException: Not supported yet.
lol
?stash
Yep, only anvil and WorkBench are implemented.
I set to watching that ticket. I'll be interested in how fast it gets closed 🙂
Why do you ping people
Bug fixes only apply to latest
so 1.19.2?
Yes
After it’s open?
like the name of the inventory
(holder, slot, title)
Gotta open a new one every time if you want a new name.
oh ok thx
createInventory takes a name
what are u smoking
p a c k e t s
he asked how to set the name
^
Yea, and afaik, there is no built in method to rename an inventory. You have to use Bukkit#createInventory with the new name you want.
built in != hacky
public void setTitle(Component name) {
for (HumanEntity player : this.inventory.getViewers()) {
ServerPlayer NMSPlayer = ((CraftPlayer) player).getHandle();
int containerID = NMSPlayer.containerMenu.containerId;
ClientboundOpenScreenPacket packet = new ClientboundOpenScreenPacket(containerID, getMenuType(),
PaperAdventure.asVanilla(name));
NMSPlayer.connection.send(packet);
((org.bukkit.entity.Player) player).updateInventory();
}
}
:p
There’s a second method that takes a material
What method is that?
declaration: package: org.bukkit, interface: OfflinePlayer
Oh thats easy thanks :D
how do u make the item just shiny, not give it an actual enchantment?
give it an enchantment and set the flag
kk thx
also how do player heads work in spigot (i wanted to put a player head in an inventory with an ign)
Use SkullMeta
By the way, all these simple questions is okay to ask but docs will help you out alot faster
Google your question before asking it:
https://www.google.com/
?bing
Bing your question before asking it:
https://www.bing.com/
?duckduckgo
bing is top tier
Bing 💀
Literally googles ugly little brother
I remember in my old high school in the Uk they blocked google and we had to use bing
great experience
I use startpage.com since DDG went political
Hi everyone !
How i can make a permission system in my plugin please ?
Just a question, how come you want to make a permissions plugin?
Actually i have a plugin where system similar to faction and i want the owner of the faction wan set a rank for a specific player into a faction
Like a hierarchy
I didn't know if it's clear
just use luckperms
Go look at Towny. I added a permission system to that for Mayor and King ranks
Towny is open source?
yes
bruh code didnt want to do anything cuz i supressed exceptions from being printed
30 minutes to find the shit lol
literally wasting my time by coding in college
I see you use DB too, do you know i can "SELECT * FROM" and put all result in one array to pick only the result i want ?
add a WHERE clause lol
...
or a LIMIT whatever
Is not my question
if that was a question, yes i know
why would you do that
If you wanna cache your result in an array and always do select * anyway you don't have to use a db lol
fuck everyone arriving and this room getting full of people
Why would you fuck everyone arriving? 🤔
you gotta be kiddin me
that's a lovely error you got there. Good luck
Hi, i want to make a kind of a texture painting system. For example i give the system a center and i want to have some offsets that according to the center direction will spawn a particle to the generated position.
wondering how to see table structure on sqlite cli
for example i give the system center X and offset -1,0 and it should spawn a particle here
.schema table_name
use some trigonometry

some sin cos shit
if only i knew that stuff
what is the question?
man
Yeah i read that but there is no question there
its a statement
what do you need help with?
The question is how can i generate a location according to the center rotation and the specified offset
well, what sort of orientation are you using? if its just a flat image you can just add to the location directly
is it supposed to point at the player?
oh so the idea is that it always faces the direction they are looking?
Im creating Portable Furnaces and I need to somehow get its current smelt status, so I can store it into config
Any clues how?
Hello, what data does spigot/bukkit cache when player disconnects, e.g. does it cache (last disconnected) location? I'm using Bukkit#getOfflinePlayer
Furnace have its own block state and I just checked there is a method called getCookTime
nvm just checked getLocation does not even exists lmfao
you could just read the player's .dat file to get their logout location
I could but I have found a workaround
Does Spigot's .sendMessage() method send any packets that I can log?
Since you can read the message on the client it must send a packet
why does this happen? https://code.skript.pl/CYgh8kzb
line 17 is
Guild guild = plugin.getJDA().getGuildById(plugin.getConfig().getString("guild_ID"));```
Looks like your plugin is disabled
I can't see any packets being sent to the player in my packet logger.
presumably your packet logger has an issue then
It's meant to log packet reads and packet writes.
It logs them for the player specifically.
Well something is wrong then 😅
sendMessage certainly sends a packet
specifically a ClientboundSystemChatPacket
I'm trying to log that but nothing is showing up.
Well your packet logger is broken then
Oh I see the issue
I had a return; statement in the wrong place.
Thanks for all of the help. 🙂
help?
java.lang.IllegalStateException: InventoryCloseEvent may only be triggered synchronously.
player.closeInventory()
don't trigger the code off main thread
?! How can I fix that?
schedule a callback to the bukkit scheduler ?
Bukkit.getScheduler().runTask(main, r -> event.getPlayer().closeInventory());
Something like that?
Yeah
thank you olivo
nah, I use java 2.0 for programming
fixed, thank you haha
Has nothing to do with Java 2.0
No
Ig
Lambda functions are Java 8
https://github.com/MichealsLab/Identity/wiki
However, Fourteenbrush, do you like my first wiki?
it's about spigot
Il look when im home in like half An hour
thank you 🙂
how do i set my gender
well...
/identity gender or /identity setup or /identity setGender <player> <gender>
via API?
Huh! Nice idea, Im going to coding it. Thanks!!!
tomorrow update

i still can't find out why PlayerInteractEvent simply wont trigger if i am not looking at a block
ive run many checks
and it only triggers when i hit a block
empty hand? If not paste your event
when i look at a block and right click it does hi1 through hi7
but when i do it in the air there is no debug
doesnt trigger at all
what item is in your hand?
No clue then, it should
put a torch in your offhand and see if still doesn;t trigger
offhand (shield slot)
any information appreciated
why torch?
I know a torch will trigger an interactevent
it doesnt trigger with torch or empty hand
in shield slot?
then you have a broken spigot. no reason it should not trigger
only an empty hand doesn't fire as its predictive
lol
unless it got cancelled smh but i tried it at highest priority
there are like 20 other plugins running on the server
well remove them and try with a fresh compile of spigot
17*
wait am i on the latest version?
intellij isnt warning me to update it
1.19-R0.1-SNAPSHOT
but it says spigot-1.19.jar is the latest download
why tf do they distribute spigot
where are you downloading this from
may thow a nullpointer, dereference it lol
looks neat for the rest
do they delete everything containing "get bukkit" (without the space)?
yes
xD
its illegal
where do i download the actual spigot from
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
nah it creates a server jar
It both installs sources and creates server jar
with flag you can only install sources and don't build jar tho
yep. tired of spigot compile times? move to paper!
paper is cringe
i also want to allow tnt duping
if(!List.of(Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK).contains(event.getAction())) return;```
heh
yeah ik its cringe
i just didnt want to write two ifs or use the or thing
too redundant for my taste
ew
switch to enum name matches
ok fine
creating a list on every interact event is terrible
switch to if (bool || switch(state) {A -> true, default -> false})
if (!event.getAction().toString().matches("RIGHT_CLICK_BLOCK|RIGHT_CLICK_AIR")) return;
isnt it [,]
?
idk im bad at regex
never learnt that
i did
- NPE
How many genders is there?
lets just shut my mouth
not null itemstack though bc it wouldnt trigger on air for empty hand
/setgender bird
Also you don't check for item you use is an IRON HOE
./setgender 2 spirit non binary gender fluid elephant
Female, Male and Non-Binary.
Names are fully customizable but, there are only these three types
bruh
get rid of non binary
There is 2 genders, male or female.
for what reason
wdym
it's not triggered with empty hand
always was
I used to work for a mcmmo server, I said the same thing, and I was told that I was not very inclusive lmao
lets keep working on this, looks kinda hot doesnt it?
cant be null
is that in a plugin
nah just thing im making for myself
might publish it if people like
trying to abstract away sql statements
You really use that theme? lmao
Lol, I can't stand people who go on about these other "genders" they're brain washed.
i still dont see the point of using abstract classes when interfaces exist
they have their own use?
I dont want to get banned for something weird but, I fully agree with you
you cant define variables in an interface
but you can just define a getter and setter or smth and have people make them when implementing
Nah
no need to redefine variables
you can only declare constants in an interface
Help plzz, there is an OpenLogin plugin on the server, how to check if a player is authorized?
use its api
also interfaces can only implement method bodys using "default". And since you implement them instead of extending, you don't have access to the protected modifier
How would I make a custom recipe configurable in the config.yml file?
save the ingredients in some way?
How might I make some instances available exclusively to the project classes in order to pass them to the API class?
wha
yeah they are always final. otherwise it wouldnt make any sense anyway
mye just public and static too
visibility modifiers? Or am I not getting the question?
Yeah
I want to pass to the APIManager class constructor an instance
without making it visible to others who use the API
Maybe protected modifier could do the job
package-private should be enough unless you want to extend the class aswell
oh god
But it's not necessary to overly protect your other classes. Some people might want do to more complex stuff and are happy when they can actually access those things
for NMS I also have to use reflection a lot and it's annoying
I usually just mark stuff that's not part of api as @Internal and then, when people use it anyway, it's up to them
and I hide it from the javadocs
Can i ask a question how long will it take for a persons to respond to my question in #help-server
ty
how would we know
check out the pinned message in this channel
Ignore him, he's or she or they or them is a snowflake, It doesn't take long for someone to reply usually 🙂
ok
did you have a bad day or sth lol
Yeah someone broke into my car actually
that's unfortunate, but also not my fault
lol
I didn't say it was but i also think your views on gender are delusional and argue with science... Which for someone as clever as you are, i'm shocked to hear this
we can continue this discussion in #general if you like
But anyway, I don't wanna get banned (Can't say anything these days)
you wont get banned for discussion about this here
I did on mcmarket
you really have to fuck up big time to get banend here lol
oh xd
When i was a kid i wanted to be a pirate
I identify as a mushroom
what about null? As a developer I know there's always a null option
glad nobody took me seriously and nobody changed place i live and my gender
i guess null = dead
fair enough
war heli
https://en.wikipedia.org/wiki/Gender_identity
and now I guess this discussion should either end or move to #general
Bro linked a wiki and thinks that means anything
switch to general bro
you expressed only your personal opinions and think it means more?
Science is proven
Science is WAY more reliable than random snowflake kids saying theyre not a girl or a boy but a they lool
ew there isnt colored text in spigot console
#general
which is awesome
there is
the console shouldnt be colored imho
it should only have 3 colors
normal, warning, and error
basically works for me
and no custom colors
wdym
only white
works on both spigot and paper(tho paper has 99 colors)
idk if its a hang or just a freeze
oh thats what happened
not even my plugin for once
worldedit is such a buggy plugin
Nobody said you can't fork it/make your own version
which event?
did you define api-version: 1.19 in plugin.yml
yes
playerinteractevent not working when not looking at a block
It does not fire if you don't have an item in your hand (on right click)
i do have an item in hand
it only gets called for certain items
well in that case it's probably a missing @EventHandler or you forgot to register it
not all items trigger a interactevent when clicking into air
is iron hoe one?
i am not sure, just try it with some different items
i did
still doesnt trigger when clicking air
a stick e.g. should work if I'm not mistaken
I never had an item no trigger interact event on air :o Except maybe a bow
not sure about tools since they have their own logic
i tried torches and sticks
simply wont work
Did you register the event?
Does it have @EventHandler?
Does it implement Listener?
it triggers when i click blocks lmao
how else would i register it
?paste your code pls
with reflection lol
so it doesnt even print "hi1" when you right-click air with a torch or stick or hoe?
i tried it at highest priority
that's the last execution priority
oh
it will probably already fire as cancelled
try to set ignoreCancelled to false
just for debugging
the order (from first execution to last) is
LOWEST, LOW, ..., HIGHEST, MONITOR
and some events already get called in cancelled state
oops i think i just broke git
sidenote: Use monitor to modify events and everyone will love you
i also love it when I do things in monitor that do NOT change the event and people still complain lol
e.g.
@EventHandler(priority = MONITOR)
public void onWhatEverEvent(WhatEverEvent event) {
myMap.remove(event.getSomething());
}
and people are like "uuugh dont do this on monitor"
lol
welp apparently my spigot jar just
disappeared
always a great sign
git is a great software
amazing quality
unbreakable
I mean you can't tell whether it will modify the event. Maybe you use the same map in the same event with different priority lol
Wouldn't make any sense but I've seen a lot of nonsense
oh now its back
wtf
i was just about to run buildtools again
and it just reappeared
why would you add the spigot.jar to git anyway?
git is trolling rn
but even if, then simply removing something from the map on monitor will not change anything event related now
git is basically unbreakable unless you delete or touch the .git folder
im just using it as free backups bc there are other people like map builders and stuff
eventually im gonna delete the repo when i find a host
But then again there's no point in using monitor for that removal either
Not that it breaks anything but it just doesn't change anything either
well let's imagine I have a Map<> of myPlacedCustomBlocks and I add to that map in BlockPlaceEvent on monitor, and I remove in BlockBreakEvent on monitor. and in interactevent, I cancel all events on LOWEST or HIGHEST that include my custom blocks
Hey question, how do you make a hashmap
new HashMap<K,V>
I mean
like you create any other object
maybe you should make your question a bit more precise
Thanks
usually you do it like this:
private final Map<String,Integer> agePerName = new HashMap<>();
uhh
then you can do
agePerName.put("mfnalex",27);
thats not good
thread death on startup and i havent even updated my plugin
huh stacktrace goes to shutdown
wtf is happening
i have corrupted this poor server software so much
Sounds like a weird usecase but ye that does make sense
is permissions.yml actually used for anything
always empty for me
ok for some reason the server just started workign again
i changed absolutely nothing
hm how is that weird?
I mean how else you would block interacting with your custom blocks or similar
what is this even caused by
how? I once broken t
oh yay my server started hanging again
@floral drum are you today's date
I broken git once because i had lot of git projects and i remember i run a merge and everything broken down
you didnt break git, you only fucked up your repo
just revert that commit and it's fine again lol
No no
git never breaks anything >.<
Well why do you need to add them on monitor in order to cancel interact events that occur in the future?
sevrer shutdown thread keeps dying smh
I mean its fucked because then i try to run git commands and appeared an error
over and over
hi bae
how else would I know whether the block was actually placed? e.g. when someone tries to place myCustomBlock in a WG region, then it might get cancelled on ANY priority
so ofc you need monitor to check whether it was actually placed, that's what its for
are you?
huh
because you're a 10/10
Worldguard cancels on normal priority iirc
its like 50/50 chance of thread death
It was an example. Other plugins could cancel on highest
And monitor is there to know the final resulg
"server attempted to load a chunk on a newer version of mc" i deleted the world 💀
it should be generating the world
Do you actually have a spigot jar in your plugin repo?
why
Idk because it doesnt really belong there
ik its server redistribution but its a private repo
just so people can manage the plugins and stuff
I see. Ye makes sense then
im just not paying for a host this early in development of the server
but why do you need it in the repo when all you need is a few lines in maven?
wdym a few lines in maven?
I think they want their staff to clone the whole thing be able to run the server locally
pretty much
ohh so the git repo is a full server
Hi all! I have a question, so I display the text through Bukkit.broadcastMessage, and you can supposedly make a radius on which the text will be shown to the players text
Well just replace the spigot jar and commit and push it
You have to loop over all players in the world, check their distance and then do sendMessage to them individually
ok spamming discard changes somehow uncorrupted git
time to get back to fixing my plugin
sth like this
public static void broadCastWithinRadius(Location origin, double radius, String message) {
for (Player player : origin.getWorld().getPlayers()) {
if (player.getLocation().distanceSquared(origin) <= radius * radius) { // distanceSquared is a tiny bit faster than normal distance
player.sendMessage(message);
}
}
}
cant there be a npe for location.getWorld()?
in theory, yes, but I guess that in 99.999% of cases you will get the location from something that's guaranteed to exist, e.g. anotherPlayer().getLocation()
you cannot even load a Location from a YAML when the world isnt loaded
I've never seen location.getWorld() return null. this will only happen if you cache a location and then unload the world
some plugin might be passing location objects with a null world
weird, they should use a Vector or similar instead
but yeah, location.getWorld() MIGHT be null, but in reality, it basically never is
really? Does the Location constructor check whether the world exists?
but sure, to be safe, check if the world is null before
Player#getLanguage() is from paper right?
im setting the world to null to indicate a home has been invalidated and should be removed
abuse
no, but who would call new Location(null, 0,0,0) ?
Me hahaha
I have done it
There you go
the location constructor just throws whatever you toss in as "world" into a WeakReference
but why lol verano
thanks and where can I set the radius on which the players will see the message here
if you dont need a world, you shouldnt use a location but a Vector
weird that the client loads resource packs before you actually join the world
in the parameter that I handily called "radius"?
it's just 2 radius
oh cool i spawned in an unloaded chunk smh
you do know what a method is, right?
Is java smart enough to only calculate radius*radius once in this case?
it's in a loop
yes
I'm pretty sure that it does radius*radius every time
then just call that method
I mean since the value doesn't change it could technically avoid it. But idk if the compiler goes that far.
ok so something was cancelling it this whole time
public void onJoin(PlayerJoinEvent event) {
broadCastWithinRadius(event.getPlayer().getLocation(), 100, event.getPlayer().getName() + " joined nearby you.");
}
nah it doesnt do that
it calculates it every time
that method doesnt exists
how did you test that?
broadCast
compile, decompile, look at source
ah makes sense^^
Broadcast is one word
jit will optimize if compiler does not already
I do >:(
😢
it could, but does it?
here
Oh common 🤡
it inlines Math.pow calls with a power of 1 or smth too so yes it will
POW POW
if it sees that its always x * x
Someone up to converting my 1.12.2 project to 1.19.2? xD
I dont understand a bit of higher versions then 1.12.2
And how do you test that in order to confirm it? For future reference
1.13 is so much easier than <1.13 lol
Really?
Indeed
ofc
uhhhhhh
Moving old version to new is faster but not backwards
Material.ANDESITE is way more readable than using those weird numeric IDs like 0:2
No i dont agree
I prefer using the Ids
okay then tell me what 53:2 is, without looking it up
Buncha weirdos in here
Alright that makes sense but i want to convert it to 1.19.2 but i will also have to import a 1.13 jar because otherwise none of the events work lol
you should use maven or gradle to import an 1.19.2 .jar
I mean multi-versioning is a BIG problem
46 best id tho
I mean why would use 1.13 to make it work on 1.19 o0
yeah but that's still 5 days longer than using the actual names
i know jmh will show the optimized bytecode which got compiled for faster calls in the future but idk if you can see it for variables
Yes i use eclipse and i need to import the jars but only 1.19.2 jar will not work for some reason
?bootstrap
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
@knotty meteor select either 1.19 or 1.13 dont make multi versioning plugin
They are always a mess
because it's marked as deprecated
I can say it being a 1.8 and now moving to 1.19
and might be removed at anytime
😂
Ooowh so i have to use a bootstrap jar?
no
you are supposed to use spigot-1.19.2-R0.1-SNAPSHOT-shaded.jar
or use a proper build system like maven or gradle, which will handle this automatically for you
yeah they make you angry for the first 2 hours, and then everyone loves it
Hahaha alright i will try to use maven if that isnt working out for me i will try a shaded jar
a tiny tutorial on how to setup a maven project for spigot
I don't
I write my pom files manually lol
only annoying thing is the shade plugin every time
Oh ❤️
Thanks!
because it doesnt do anything without any <execution>
I mean in my case maven shade by default every dependency into jar
Maybe because i dont add the correct scope
it only shades stuff that is set to "compile" (which is the default scope, yes)
that why haha
So i dont put another scope they ill be always shaded
So its perfect haha
Because i dont need to make shade via POM
mfalex
Something diff i will ask it for u on general
wdym not level column lol
you sure you can name your column level ?
have you check if it even create
because iirc its reserved
the table probably already existed when you ran this statement
dropped it
so it didnt create a table called players with a level column
then do DESCRIBE and see if it actually has this column
or use phpmyadmin or whatever that actually shows you the table
i forgot but does sqlite needs CREATE DATABASE?
works perfectly fine when doing manually lol
Any beginner Java tasks to do to practice OOP anyone?
and nothing too "mathsy" i really am not the best with maths :/
Battleships?
Idek how i'd start with that
Not very much OOP, but you can do alot with access modifiers and static/non-static practicing
I'm just trying to focus on OOP at the minute
I sort of understand access modifiers, just need to practice statics tbf
Try making Items, some with abilities, some without, some with passive abilities
not neccessarily in Mc, but just in the console
Would be something with inheritance using both superclasses and interfaces ig
how do i spawn a particle without it shooting in a random direction
which method has the velocity stuff
supplier will be called before constructor right?
nah the file is the database
thats not the issue then
also code after System.exit will never be executed right?
weird
Player player = (Player) sender;
How do i do this in kotlin

modifying database by cli didnt seem to have effect or not directly
you might want to try a search engine of your choice
"kotlin cast"
Internet Explorer on a Windows Vista
the first result explains exactly what you are looking for 😅
(https://kotlinlang.org/docs/typecasts.html) to make sure you don't miss it xD
use nms
Bro loves that emoji
Depends on what version you are on
yoo it works
Yes, if you use a version old enough to go to school that has not been maintained for years, you might have to use hacks
you iterate over all players online
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Bukkit.html#getOnlinePlayers() returns you the collection of all players online
tbf I also googled it and didnt find anything useful within the first 3 results
with kotlin cast ?
I googled "kotlin cast object"
Indeed
though "45mins" seems overexagurated
it showed me examples like
if(myObj is Integer)
or
if(myObj) {
is Integer: ...
but not how to normally cast stuff
you'd have to scroll down like
a little
to unsafe casting, which is what (Player) sender is
thats wha she-
this worked just fine for me val player = sender.server.getPlayer(sender.name)
i refuse to believe thats what your supposed to do
uuh yikes
but yeah
your telling me
and ofc also check before
did you just not read my link
I didnt know it until 30 seconds ago myself
lol
I'll never use kotlin voluntarily lol
not you
first time using kotlin
usually use java
I wanna learn something new
yo how do i create a project with kotlin instead of java
the converting thing is annoying af
in IntelliJ, just do new project and then you can choose "maven" and "kotlin"
or "gradle" and "kotlin"
with spigot
you just add spigot as dependency as you'd normally do
since when does kotlin work with spigot
since kotlin was invented
It's compiled to byte code lol
kotliin would have died very early if it would not allow to use java dependencies
might wanna start using this
what I still dont get is why kotlin doesnt allow normal static methods and fields
For loop and then .sendTitle
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
fancy fancy
as it should
Too late I already I have
that's why you're so toxic all the time and that's probably also why you shot fourteenbrush's cat
I'm not
How do you know I'm not his cat
because you're still alive
ChatColor.RED + "" + ChatColor.UNDERLINE
or use toString() on any of the chat colors
is using metadata as temporary storage a bad idea or should i use hashmaps
Use Maps where possible. Metadata is meant more as a means of communication between plugins with primitive data
thanks
(tab completer)
so the first one (args.length == 1) is working but the other one doesnt.
show full code of length == 2 block
so what happens when you try second argument?
it does the same thing as args.length == 1
you have args[0].toLowerCase() tho
BUT when I replaced the 2nd with 1 it actually worked
what is in this arg
materials
that's embarassing
if (args.length == 1) return Bukkit.getOnlinePlayers().stream().map(Player::getName()).toList();```
How?
returns you all online players' names on the server
as a list of strings for tabcompleter
just return null
same thing
Why it can' t find the player, it should be correct
player.sendMessage("§3§lJAIL §8» §7Comando errato! Uso corretto: §b/jail <Player> <Jail Name>");
return false;
} else {
String playerName = args[1];
Player target = sender.getServer().getPlayerExact(playerName);
if (target == null) {
player.sendMessage("§3§lJAIL §8» §7Player non trovato!");
return true;
} else if (FDOCore.getInstance().checkIfJailExist(args[2])) {
FDOCore.getInstance().jailPlayer(target.getUniqueId(), args[2]);
player.sendMessage("§3§lJAIL §8» §7Hai incarcerato §b" + target.getName() + "§7 con successo!");
}
}```
args 1 should be the player
args[0] is the player
like /jail TestPlayer Jail1
args[0] man
I tried it gives me error
what error can it possibly give, except arrayindexoutofbounds when you have 0 arguments
show stack trace
It didn't find the player there is no error
where can i get the spigot account url?
bro what
I don't know
I will go sleep
if you just said you have an error
Isn' t jail the arg[0] in this command /jail TestPlayer Jail1?
How would it be?
You start from 0 and read left to right.
TestPlayer is args[0]
Jail1 is args[1]
Anyone know how to serialize a block including block state?
so like this should be correct
player.sendMessage("§3§lJAIL §8» §7Comando errato! Uso corretto: §b/jail <Player> <Jail Name>");
return false;
} else {
String playerName = args[0];
Player target = sender.getServer().getPlayerExact(playerName);
if (target == null) {
player.sendMessage("§3§lJAIL §8» §7Player non trovato!");
return true;
} else if (FDOCore.getInstance().checkIfJailExist(args[1])) {
FDOCore.getInstance().jailPlayer(target.getUniqueId(), args[1]);
player.sendMessage("§3§lJAIL §8» §7Hai incarcerato §b" + target.getName() + "§7 con successo!");
}
}```
Yes
It can't find the player either
if (args.length == 3) {
return getNumbers().stream().map(Number :: ++).toList();
}
How would I make this work?
Send the error then, and also make sure you're typing the player's full name with correct capitalization
What are you trying to do
Hey everyone,
Is there an easy way to get all the Materials into a list for TabComplete?
Material.values()
Luckily we're trying to do the same thing @mental sorrel
:_)
return Integer.valueOf(args[2]);?
Incompatible types. Found: 'java.lang.Integer', required: 'java.util.List<java.lang.String>'
But yeah
Yeah works :) thnx!
What..? Are you trying to do tab completion?
Don't do tab completion for a number just let them type it in 
d:why not :?
wait alr but how can I make it return nothing (so it doesnt show player names?)
Return an empty list
Didnt work.

google just does not think of you as devs