#help-development
1 messages · Page 161 of 1
label refers to the command alias if it has one, but defaults to the command if no alias is set
label is actually the command you typed, be it the command or its alias
you shoudl use cmd, if you are passing multiple commands through a single executor
cmd.getName is the command you typed, label is different
cmd.getName is the command not the alias
there is a seperate entry fore alias
you are right, but I was stating that label isn't necessarily always the same as the command typed
yep, we are both correct. label is precisely what you typed
you have return when args.length == 0 and then check for args.length to be greater than or equal to 1, when it's already guaranteed to be
ah I just realized that
when dealing with a class like you are making, always make it a habit to print debug messages
so you know exactly what is or is not being executed
it errors before it can print though
that is fine, you can always have debug messages before and after too
this way you always know where in the code blocks the issue is arising. Just makes it easier to see where you need to figure out something is all, doesn't tell you exactly the problem. Some info is better then none at all
i keep saying it's because right at the beginning of your command, you only return when args.length == 0, and then get args[1] right after
lol
so any time you have returns, you can put a debug message to print to console or broadcast where the code is being executed currently
even if that code block generally doesn't do much anyways
yeah, don't return early if you have more things to process 😛
That's not my point :v
I know it isn't but the fact that there is a return is causing it to not go to the next code block
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (args.length == 0) {
sender.sendMessage("§4§lUsage: /Gamemode <[Creative, Survival, Adventure, Spectator]> <Player>");
return true;
}
// ...
Player target = Bukkit.getPlayer(args[1]); // <---
// ...
}```
just changing the 0 to a 2 would fix it, lol
length starts from 1. index starts from 0.
^
that was directed at you. literally just change it to args.length != 2
!=
sorry
<[Creative, Survival, Adventure, Spectator]> <Player> you are checking for 2 arguments
At what line
26
we have the command at the beginning /Gamemode this is the command. Anything after the command is called arguments
Yes but what about the /gmc?
that is a command
That only has 1 argument
then you need to separate your checks
So the switch is useless?
and check if it has 1 argument or 2 arguments. If it only has 1 argument then you need to have its own code block in what to do with that
and if it has 2 arguments do something else
alr
Check what label is used and run your command based on that. if it's just gm or gamemode, then do your normal stuff
this is how I generally setup my commands
you can have multiple onCommand classes that you can divert the command to based on the arguments being used 🙂
oo
does anyone know how I can cacnel the shift click?
for what
you cant explicitly prevent the player from pressing the shift key but I guess you could control some logic that is usually used by the shift key
if (e.getClickedInventory().getType().equals(InventoryType.FURNACE)) {
if (e.getCursor().getType() == Material.IRON_ORE)
e.setCancelled(true);
```It won't let a player put that iron ore in a furnace but if they shift click it goes in the furnace so I want to try and cancel that
I'd just cancel putting iron ore at all into the furnace rather than preventing pickup with the cursor
i tried that but how would you go about doing it?
you can also check the click type by using getClickType method i'd assume
this looks promissing its an old thread but the logic is explained well
InventoryMoveItemEvent
now exists
https://www.spigotmc.org/threads/prevent-a-item-from-being-put-in-a-chest.59457/ yet another thread on doing this
while this is talking about chest same logic will apply to furances
What does this event do?
Google your question before asking it:
https://www.google.com/
declaration: package: org.bukkit.event.inventory, class: InventoryMoveItemEvent
are you trolling
indexes start at 0
?
being not educated isn't trolling
Thank you I appreciate the help!
its just being uneducated
Idk how many times i've said he needs to change that to args.length != 2
oh. right. maybe you should make your gmc, gms stuff separate commands
🤦♂️ fix the errors you also need to learn how to read stack traces and bugfix your own code stuff like this should just be a tad of tweaking
example switching index numbers
than retrying
add Sysout to see why something may be wrong
the command logic is just pretty messy in general. changing the order in which you do certain things would do a lot of good. i.e. handling /gms, /gmc, etc. probably would be one of the first things you wanna do
sender.sendMessage("§4§lCan't find player by the name of " + args[1]);
You can't get the 2nd argument from args if it doesn't exist simple problem / solution here
at BetterCommands.Commands.Gamemode.onCommand(Gamemode.java:34) ~[BetterCommands.jar:?]
We know its at line 34 in the gamemode class
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
We know there is an out of bounds exception
if (args.length == 1) { we know args length must be one so therefore you can't get the second element
indexes start at 0
not 1
0
String[] args = {"arg0", "arg1"}
sysout(args[0])
sysout(args[1])
output:
arg0
arg1
^length starts from 1. index starts from 0.
sender.sendMessage("§4§lCan't find player by the name of " + args[1]);
Exactly so after reading the stack trace you should know exactly why this won't work
fix it than recompile and try again
yes. because if you have 1 element, then your array is 1 elements long.
and yes, it doesn't contradict the fact that it's, effectively, 0th.
Holly crap that just fixed the whole plugin ty @river oracle
don't try to make major logic edits where they aren't needed after reading the stack trace fix the problem don't change the if statement will cause other breaks
in his case adding if(length != 2) change pretty much nothing accept cause more errors
the commands class is a mess and all but the stack trace gods give us the solution 🙏
hey, just a quick question.
is there any particular reason this function right here won't work? all debug prints get called properly and i get no errors in the console
damn
why can't i attach a screenshot
Not verified? Upload screenshots here: https://prnt.sc/
I believe you have to verify with your forums account
what a strange thing to be made mandatory.
?commands
is probably better for all code stuff
anyways.
public void unspecifiedEvent(PlayerSwapHandItemsEvent event) {
System.out.println("AAA");
Player player = event.getPlayer();
if (event.getOffHandItem().getType() == Material.SHIELD) {
player.getInventory().setItemInOffHand(new ItemStack(Material.WOODEN_HOE, 1)); // this func won't work
player.sendMessage("There's a good reason I've forbidden shields in offhand, you know.");
}
}
does discord md count?
well, what did i just do, pray tell?
thats not an image...
it doesn't have to be an image to show what's wrong in my case
so what about it isn't working
does it?
so both player message and system message print
the line i commented. i'm not getting the wooden hoe in my offhand
🤦♂️ yes I read so good
Are you using @EventHandler?
and registering the listener?
hmm try delaying it one tick
sometimes this works lmao
yes, I am registering it in main class.
oki. doesn't hurt to check the basics, lol
delaying?
yea using the bukkit scheduler
i'll give an example are you familiar with Dependency injection
?scheduler
fuck
Nope.
uhm do you know how to get variables to other classes without static
objectName.variableName?
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
like this ^ guide
its really good
because you'll need a plugin instance for scheduling
?scheduling
^ this is the scheduler
reading these guides should be enough to get the idea
you'd just delay it 1 tick and then place the wooden hoe in their offhand
My guess is its possible that PlayerSwapHandItemsEvent is triggered prior to the swap
yes, I figured it all out.
No offense, but it feels bloated. Like, why do I have to pass my plugin in? And why do I have to manually create and assign these objects?
can't it all be done, like, automatically or something? is there something i don't understand about java?
perhaps all these years of coding in python for godot engine have corrupted me and reduced my brain capabilities but
i fail to grasp why did they overcomplicate everything.
anyways, I figured it all out and now it works.
No one is saying you have to use di for everything. Its just recommended.
https://paste.md-5.net/adezeyojir.java
Any way to compact this more?
oh, and I didn't even start dwelving into DI.
Plus, di isnt even that bad. Yes it can be annoying but its easy
Yes. but why is that important.
It's hard to scroll to the bottom which concerns me
When you start recycling a lot of the same code like that, that's where abstraction becomes handy. You just extend from another class and then it will inherit all of the methods and fields of the class it extends from. You do have to define a constructor to invoke a constructor defined by the superclass though.
Though oftentimes you wouldn't often do it for a single method like that :b
wait
you're talking about the scheduler, i'm talking about DI, my bad, lol
anyways
all that aside
i've got a grasp of how things are doing
everything i've learned here just now, including DI, helped me out now
and will help me out later
thank you all for your help.
Is here anyone good at gradle?
?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!
An exception has occurred in the compiler (17.0.4.1). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program, the following diagnostic, and the parameters passed to the Java compiler in your report. Thank you.
java.lang.NullPointerException```
that doesn't really tell us anything
I was using java 16 before, but because of the FAWE API requirement.
So I upgrade to java 17.
Then this happened.
Brah just use enums
ok... we are not magicians here or mind readers. How about showing your build script and build log
bracket moment
You can use my new programming language, I call it enummeroni
nothing what you have showed above indicates what exactly is wrong only that the compiler encountered an NPE
as an enum user i agree
There's only one kind of object, enums
?paste
its quite possible the issue most likely in the libs
just because your code is usable with java 17, doesn't necessarily mean the libs are compatible with java 17
What if I use java 18:
Don't post that kind of smut here, illusion will probably ask to marry you
It looks like an issue in Java 17.
https://bugs.openjdk.org/browse/JDK-8278834
Don't worry, aside from the enums this code is pretty clean
The enums are pretty essential though. Since im not releasing the plugin publicly I just decided to do it this way. Kind of like an internal config that's more flexible 😂
bam
I can practically hear illusion being a coomer from here after reading that
💀
well what, you think a config file is better?
a YML?
it would be if i was releasing this publicly 😂
Ever heard of classes?
just fyi, you don't actually have to compile your project for a specific java version unless you are making use of version specific code
so compiling for java 16 is completely fine as java 17 will still be able to run it
Yes of course. But if I'm going to "hardcode" it, why should I do it in a class?
FAWE API require the Java 17
The API requires using Java 17 at development time. Make sure to point your toolchain to Java 17.
So it actually has some structure that can be browsable
in particular here these are shop items, basically itemstacks with custom properties and some other settings that affect how they are obtained etc
I would 100% understand the reasoning for using classes if it was something like a kit
that has custom listeners and functions for each one
which is actually what I do for kits
I am not sure if they are making use of java 17, what you could do to get around it is pull the FAWE project into your IDE, compile for java 16 and then you should be able to use it
odds are they just compiled using java 17 thus making the project unusable in earlier versions
highly doubt they are making use of code that is specific to java 17 though
but this enum is pretty easily understood if you just see what the variables are
and know how the game itself functions
Well don't let me stop you from making constructors where half the elements are almost always null, I'm sure that won't be a problem at any point
When would it ever be a problem?
Import it with java 16 occurred error
It's never been a problem
what error?
wait a minute
what I was talking about is cloning the fawe project, and compile the fawe jar separately
There's big games that use huge configurations like this
If you've ever played a game made by Supercell on your phone, their configs are literally CSV files. Basically structured like this where a lot of values are null unless otherwise stated
Is there a possibility I could make a CSV system too? Maybe. Or a config file? sure. But again im not releasing this to the public, this was the fastest way for me to do it 🤷
yea exactly
It's just a bunch of comma separated values
i know it's def possible to use a spreadsheet lol
you don't have to use yml if you don't want to
yml works differently though in where null values are generally not acceptable
and actually causes the entry to be removed
yea
so this would have to work differently as a yml file
or use something else other then yml
or make a custom yml lib
where it does accept null values
just use the square root of the ladderologist bias
enum works for me!
apparently triggers that magma guy for some reason.
💀
don't mind him lol
as long as you don't do cross-reference you are fine
doing this system actually taught me about that
so pretty cool
this was the result
recording is lagging for some reason
but yeah ENUMS WORK
i'm watching the cody simpson nms tutorial and for some reason i can't do some of the things he's doing.
playerConnection.sendPacket(packet)
it says sendPacket doesn't exist for some reason. I did spigot instead of spigot-api in my pom.xml but it doesn't work for some reason.
.a
Are there really mappings for 1171
((CraftPlayer) player.getPlayer()).getHandle().playerConnection.sendPacket(packet);
this works for me on spigot 1.8
dont know if it will work at all on new
lol
packets themselves change all the time
but the way you send them should still be similar at least
Hmm curious about something
obviously playerConnection.sendPacket() is supposed to still be a thing in kody's vid
?1.8
Too old! (Click the link to get the exact time)
🤔
is there a list of what most of the mappings do?
Wow 1.8 is old as fuck
or do you kinda have to ask or figure them out yourself
true
bStats disagrees but tbh I cbf arguing this atm
bstats is not accurate lmao
?
not every server uses bStats and most servers running 1.8 I would argue actually disable b stats
or just don't have it
newer version servers are mostly SMPs ran by people who just wanna have a plug-and-play type thing with their friends
they don't really bother with the config too much and thus are more likely to have bstats on/installed
Yeah but bStats is probably the best metric there is, unless you can prove that 1.8 is popular via another metric....
Hypixel players mostly use 1.8
Thats not a metric
Over half of MC accounts have logged into hypixel at some point or another
Okay, you've got one.
Who said they're all on 1.8 though? lol
I'd argue hypixel isn't a good metric if you want to have the best experience you use the core version of the server
of course
people use other versions too
however MOSTLY people use 1.8
Even if 1.8 is the most popular on hypixel that doesn't translate at all to all servers.
if we look at data from back in february
Any proof to back this up?
https://hypixel.net/threads/removing-support-for-more-minecraft-versions-1-11-1-13.4799817/ back when they removed support for 1.11 1.13 they gave us these statistics
Hello everyone!
It's been some time since we've last provided an update on what versions of Minecraft we intend to continue supporting. Since our previous thread, there's been multiple new versions and lots of movement from version to version by our players. As we continue development work on...
Does anyone here know how to check slots for brweing stands?
ya
Doesn't make the data irrelevant though
Hypixel has a LOT of players
also is using build tools still a good way of getting the latest nms version or no?
Sure but you can't take just a small sample size of exactly one server and apply it to every server in the world.
you can't do it with bStats either 😛
Yes used the --remapped flag
bStats has a much larger sample size, thats the thing 
Thats why it's the most accurate we have
how many servers use bStats? and how many players play on servers with bstats?
are there any good lists on the mojang mapping or should i just try to figure it out myself? (or ask in here :)
Screamingsandals
That's also for Bukkit/Spigot alone
hypixel's record playercount was like 150k concurrent or something like that lol
maybe even higher, can't recall atm
Ok, so?
Wow 👌 cherry picking irrelevant data
179k servers isn't really as many as I expected. lol
but interesting nontheless
guranteed there's tons of bukkit/spigot servers that do not have bStats that are not included here
has bStats been integrated into spigot itself?
and if so from what version is it integrated?
You're talking about 179k servers, and only 6% of them are running 1.8.8, and this, of course, is Bukkit/Spigot only.
Hypixel is ONE server.
It doesn't matter how many players are on there
it does because it shows what version people play more
No, it shows what server is the most popular lol
i mean if we include vanilla numbers - ofc the latest is always going to be the highest
that's just how it works
Well isn't that what we're talking about? Most popular version?
i went to their github page and it seems as though there is a gradle plugin there? i use maven but i wouldn't know what to do with it anyway. i'll most likely just as around here
Why would it matter if it's Vanilla or not 😛
I just use their website
is it possible to prevent from like a certain potion being made if a player didnt have x permission ?
well initially i made the argument that 1.8 is still one of the most popular mc versions, which it clearly is
Yes
If you don't know where to even start though your better off commissioning someine
is it that complicated?
Not in my opinion
i never stated that the latest version isn't popular, of course it will always be popular
but you can't really say 1.8 isn't popular at all
lol
I never said it wasn't popular
sorry but could you actually send me the link to the mappings when you can?
Of course it is, it's just not the most popular.
Latest version will always be the most popular version.
I was thinking of using the inventory event
if (e.getView().getTitle().equalsIgnoreCase("Brewing Stand")) {
//some code here
if (!p.hasPermission("medievalmc.physician")) {
in the some code here I was thinking of either checking the slots in the brewing stand and if like 2/3 are already there u can't put the 3rd one? BUt I don't know how to check the brewing stand slots if you could help me out with that
There's some brewing events.
But those are just to get the brewing time, fuel left, fuel time, increase fuel time, etc...
BrewEvent can be cancelled
No player target necessarily for the specific brewing stand
Best to stick to the inventory events
when a player opens the brewing stand menu you can put them in some map with the brewing stand
and check and see
lol
that's probably the cheesiest way to do it
but ig it's possible that way
inventory events should also work
so i am on the right pathh..?
If you use the map make sure to use WeakReference
Player objects tend to cause some serious memory leakage when stored in maps
when the player closes the inventory you will remove them from the map of course
but i mean ig at that point just use inventory events
i would think so, but isn't brewing stand an inventory type
you can check for this instead of the inventory name
What about slots
in the inventory click event you should be able to check the slots clicked
like each slot in the brewing stand
e.getSlot()
it's an int so just like a chest gui
there's a number for each slot
if you really don't know what these are just send a message to yourself with the number and you can see what each slot is but it should be pretty straightforward starting from 0
0-4 i just dont know which slot is 0,1,2,3,4.. but that would help a lot
e.getSlot()
yep you can just send the player a message w/ the slot number for now as a debug
then once you know what each is you can remove it and add your code for it as you need
e.getSlot() check if it contains anything and then check the rest and then if like 2/3 ingredients are there the 3rd one will not be able to go in there that could work right?
well
on inventory click event you will be able to know without checking the slot what it is they clicked (just not the slot it's in)
you need to make sure this isn't null, however
or you will get nullpointerexceptions
yes the item
hm okay im gonna mess around with it and see where I end up
awesome 😄 good luck
thank you i really appreciate it! (for everyone that helped me)
np
Good kitty
wtf i was just going to ask about mojang mapping 💀
anyways, should i use spigot mappings for 1.19 or mojang mappings?
how would I check when a player was killed by a non-player?
whatever is easier for you to work with
mojang mappings
but if you are going to distribute your plugin you must distribute it with spigot mappings
pretty sure you can obfuscate the mappings
wdym by distribute? like release it to the public to use?
ya that would be nice
yeah or technically anybody
because i mean, it's kind of "illegal"
mojang doesn't allow it
and?
they give the mojang mappings for development only
and this one is "legal"
yeah
i make plugins for 1.8 so mojang mappings are usless to me anyways
since i dont have any
😂
gotta love that wiki.vg archive
its not illegal
right just a TOS/EULA violation or something idk
that's why i said it in quotes
either way mojang doesn't intend you to use their mappings for distribution
isn't it for copyright or something
yea
the license says you can't re-distribute the mappings, not that you can't use them
yes that's what i mean by they don't intend you to use them for distribution
they allow you to use them for development
that also doesn't mean you can't have partial mappings in your code either
but when you distribute you should convert back to spigot mappings
in fact there's a way to do this automatically
with your jar
kody simpson has some tutorial for it
guys i only just started using lombok
and i gotta say
how did i not discover this sooner
Nice, looks like BuildTools changed my git config, and now I've commited as "BuildTools" for several weeks on github. wtf?
💀
lmao i think that happens to me to
WHY does is change profile configs?
intellij puts a little "BuildTools" thing on top of my methods
just buildtools
didn't know what it meant but now i think i know
yep I've disabled that since "I only work on this project, don't need VCS history". Yeah nice, 20 commits with freaking "BuildTools"
can't it just use start arguments?
Ahhh nice, and I've added a project to github. With fucking "BuildsTools" in EVERY commit. jesus it's so annoying
😂
git commit --amend --reset-author --no-edit
yep, for the last commit. But not for 20 - 30 commits.
if you need to do it for more then one commit
its not all that difficult
and that should resolve your buildtools as author problem in your project 😛
fatal: --preserve-merges was replaced by --rebase-merges
I tried git rebase -i -p <LAST_CORRECT_COMMIT_ID>
didn't work, BuildTools authored and TaskID committed 1 minute ago
love it. why would something like BuildTools change your fucking global git username and email
ah nice, found another project I made a few weeks ago, with 51 commits from "BuildTools".
everything I did on GitHub since I used build tools 2 months ago is from "BuildTools"..
because it wasn't set before
you will see 2 years later like me you have a constructor with 40 arguments and only 3 are actually needed for creating the object
bad coomer
If only 3 things were required to create the object, then I wouldn't have to do it this way
if you have this scenario you really should re-evaluate your code
yeah that's what I did last year
it was a lot of "fun" to correct
well I do recall a majority of that could have been avoided if you had listen to some
since you know it was advised to you to do it differently for some things XD
but hey, I suppose that is what keeps you in business 😛
did that happen? don't remember that
not surprising because really it wasn't a big deal how you were doing things, since it would be you later on having to fix it or refactor it XD
feature creep ends up being the reason my code gets so scuffed anyhow, the reason why I was doing it all on constructors originally was because there were only 4 fields to fill in
and they were actually mandatory
just counted, the bosses now have 57 different fields
things just creep up on you
lol
ayy my showcase is done
@echo basalt and you thought it was never going to work
https://youtu.be/6cSAfvhsPiI
Support my projects on Patreon: https://www.patreon.com/magmaguy
Join discord: https://discord.gg/9f5QSka
Check EliteMobs out: https://www.spigotmc.org/resources/⚔elitemobs⚔.40090/
certified no enums moment
certified missing a sweet voiceover
didn't want to overcomplicate it, I'll be making a full on video tutorial on how to use these anyway
sure
1.17 was the first version where --remapped is avaiable
how can i make a command with cooldown
cause i have a command but without cooldown
I once wrote this cooldown class https://github.com/JEFF-Media-GbR/JeffLib/blob/master/core/src/main/java/com/jeff_media/jefflib/data/Cooldown.java
You basically just create a cooldown object, like
private final Cooldown cooldown = new Cooldown();
and then you can do stuff like cooldown.setCooldown(somePlayer, 20, TimeUnit.SECOND)
and cooldown.hasCooldown(player)
wait what im new at developing plugins sorry
the general idea is to have a Map<Object, Long> or something
Long is a timestamp, either when you last ran the command, or when it's about to expire
how would i set the target of an entity
and then you can simpl.y check if the current time is >= the entry in the map
the question that must first be answered is this. Do you want the timer to be tied to the ticks of the server or actual seconds of the world
declaration: package: org.bukkit.entity, interface: Mob
seconds of the world
then mfn's cool down stuff should work
it's made with ❤️ and booze
im confused
you could just copy/paste the whole class and try to understand what it does
also i only just started using lombok and i have to say, i don't think i'll ever make a project without it now
and then you can instantiate "Cooldown" objects with new Cooldown()
it's pretty useful for SOME stuff
it also has some pretty shitty stuff like SneakyThrows lol
until you want to make some unit tests
https://projectlombok.org/features/
https://projectlombok.org/features/experimental/
here's a list of all features
the arch nemesis of lombok is unit testing lol
are minigames easy to make in your opinions?
depends on the minigame in what functionality it requires
I still need to finish my chess minigame with stockfish
Hi guys
Hi
<?php
$_POST['search'] = "worldedit";
$ch = curl_init();
$endpoint = "https://api.spiget.org/v2/search/resources/" . $_POST['search'];
$params = array('field' => 'name', 'sort' => '-likes', 'fields' => 'name,likes,file,rating');
$url = $endpoint . '?' . http_build_query($params);
curl_setopt($ch, CURLOPT_URL, $url);
$result=curl_exec($ch);
echo '<pre>',print_r($result,1),'</pre>';
?>
@tender shard but where do i put the command that i want to have the cooldown
in your commandexecutor, you check the cooldown
i tried the rating{count} also the rating.count also the rating[count]
but nothing helps
LIKE THIS
sorry caps
put in your command class
public class CommandKit implements CommandExecutor {
private final Cooldown cooldown = new Cooldown();
public boolean onCommand(CommandSender sender, ...) {
if(cooldown.hasCooldown(sender)) {
sender.sendMessage("You need to wait before running this again!");
return true;
}
cooldown.setCooldown(sender, 20, TimeUnit.SECOND);
// Do your stuff
}
ok thank u
also that looks so much better than my half-assed HashMap<OfflinePlayer, Long>
yeah well internally it ofc also uses a HashMap 🙂
hello guys i run into problem
hello what is your problem
java.lang.OutOfMemoryError: unable to create native thread: possibly out of memory or process/resource limits reached
download more ram
i have enough on my dedicated server 256gb ram , epyc 7502
dedotate more wam
then allow java to use it
it doesnt use full cacipity even.
the server is allowed to use! if it had to do something with the server i would ask in help-server right?
maybe
do you currently only get the full json as output? If so, you gotta use some json parsing lib
like jQuery?
PHP has "json_decode" builtin which should be more than enough
what to i put in the 3 dots
@tender shard
basically you could something like this:
$json = '{what you get from spiget}';
$jsonObject = json_decode($json);
$rating = $jsonObject->{'rating'};
$count = $rating->{'count'};
obviously that's the normal onCommand method, inherited from CommandExecutor interface
so, the method you should already have in your command executor class
?paste
yeah that i know, but tbh i said i need sorting by rating.count
https://paste.md-5.net/pubucoyusi.md thats the stacktrace
I edited it
not 100% sure but it should work at least sth like that
otherwise, maybe try $jsonObject["rating"]["count"] or sth
havent used json_decode in 10 years or so lol
before you go tell alex he's rude, it's a tradition
he'll be sad if you don't
once again it has nothing to do with server resources are way more then enough.
?paste the full log
its pretty much the same its the main problem here it repeating it self
hey, someone know how i can grab a offline player and use it to compare it to a list? wanna make a "whitelist" smilliar thing and im getting all time a nullpointer from the offline player
focus@DESKTOP-2HVCSQJ:/mnt/g/Developing/Web$ sudo php -S localhost:80
[sudo] heslo pro focus:
[Sun Oct 2 10:54:28 2022] PHP 8.1.2 Development Server (http://localhost:80) started
[Sun Oct 2 10:54:30 2022] 127.0.0.1:50950 Accepted
[Sun Oct 2 10:54:30 2022] 127.0.0.1:50952 Accepted
[Sun Oct 2 10:54:30 2022] PHP Warning: Attempt to read property "rating" on int in /mnt/g/Developing/Web/index.php on line 14
[Sun Oct 2 10:54:30 2022] 127.0.0.1:50950 [200]: GET /
[Sun Oct 2 10:54:30 2022] 127.0.0.1:50950 Closing
[Sun Oct 2 10:54:30 2022] 127.0.0.1:50956 Accepted
I'd store the player's UUIDs
before you overcomplicate it, if you're doing a whitelist consider getting player data on the join event
the thing is i want add them when they are not online, and thats the prob
im already Storing UUIDS
maybe show your stacktrace, then we'll see
Hey, I'm having a problem in which whenever I try building, it says it's finished and all. But when I look into my projectRoot/builds folder, nothing's there.
(PS: I did setLibsDirName("../builds") in my build.gradle)
Why does that happen?
theards dont work like if All theards are busy it goes into queue instead of attempting to create another theard?
or is there way to force plugin to use fewer theards? instead of creating new each time?
../builds is the builds folder OUTSIDE of your project
It's inside
Because IntellIJ Idea builds in projectRoot/build
IntellIJ Idea builds using gradle..
if you want to change the output location, get shadow and add destinationDirectory = file("./build/")
Oh wait holy shit it's there
IntelliJ's build system is totally different from gradle. what does it say if you hit control twice quickly, then enter gradle properties?
Nevermind, I don't know how it finally got in my builds folder but it's there
thats handy
Let's just hope it keeps working
bump
?paste
You ran out of threads so use Spigot
what do you mean use spigot?
You're using a fork right now correct?
true
Yeah don't
How bad are forks?
Forks will use more threads for better performance
Depends on the fork
I wouldn't go further than Paper
by the way btw https://paste.md-5.net/xogoxuyemu.cs this is the event that happens before server running out of theards
i found it by debugging
is my event not opitmized ill switch to default spigot as well rn
You could probably use Paper
Though expect no support since you're 7 years out of date
everyone keeps wanting to make and use forks, I'll be the first one to make a spork of spigot
yeah i was thinking how does it run out of resources
like i pay for a war machine epyc 7502 running out of theards how
Epyc CPU for mc 💀
thanks alot man you saved my ass i guess i hope its the right soluation to stay away from this syntetic spigot forks
its not that bad actually like its a server cpu true but its what i have ;l
i would switch to ryzen 5900x
what does your start command look like for the server?
sec
java -Xms128M -XX:MaxRAMPercentage=95.0 -Dterminal.jline=false -Dterminal.ansi=true -jar server.jar
hey wasn't it 128 gigs
128 threads
well it allows up to 95% of max memory
akairs flags might help you
i did timings
nothing really i think Olivio was right those people who try to enchance it just make a syntetic drug from herb (fork , spigot)...
how much mem do the timings say you have?
I've had some fun experiences with java not reading how much ram my pc had correctly in the past
is it still not happy using spigot/paper?
They're just warning you that you will get major lag spikes
i know i have never seen those before and before trying those forks which claim to be better and cloud actually have malicious to work like a Botnet , RAT hiding it in the source code would not be an issue since searching thru 50mb's is the real problem
nah i talk about the forks
that they are probably really bad
its offtopic Olivo thanks alot i hope the problem will be solved
Minecraft plugin malware has become a lot more common recently so only download plugins from trusted authors
i make my own
you were right its fixed
Does a bungee 1.19 plugin work in 1.8?
Yes
this is your problem
google aikars flags and use those and you don't need to use more then 10GB
assigning more ram without modifying other things for the JVM will result in negative performance
but because you didn't assign a max, java has a maximum setting in regards to allocation
it doesn't automatically use the amount of ram you have for the system, think it defaults at 2-4GB
?paste
no it doesn't
well I should be more technical, it really depends on how it is coded
but also depends if the 1.19 plugin was compiled for java 17 or not
Is there a way to sent a respawn packet to an player without resetting his inventory?
there is a gamerule you can enable for players to keep their inventory when they die
https://paste.md-5.net/kasokuseju.cs < code snippet
https://paste.md-5.net/juzopamivo.makefile < config snippet
how come only 2 spawn areas (out of 4) have mobs spawn at them?
no errors, just doesn't work
it says all 6 entities have been spawned, so it definitely knows that the custom entity exists
Yeah but i mean without that
you wouldn't need a packet, you will need to listen for the event of when they die and take stock of their inventory
when they spawn again give back their inventory
is api-version 1.12 - 1.19 ?
1.13
I'd rather work on something fun
bet you're working on an enum-based database system
Its because i have to respawn the player to update the skin
Help how to manage an entity? After half a day of googling, I came up with this class, but over 90% of what I found online doesn't work with Minecraft 1.19.2. (NMS class connected)
Eh similar
Just mongodb, redis and influxdb working together
That looks correct
woah woah woah
calm down my poor heart
I'm having too much fun
Now you just need to spawn it
damn
i got mongo and redis working for cross server, what's influx?
The thing is, I don't understand how to make it move.
velocity? or make it move as if it were using it's ai
then you need to use pathfinding
Is there a way to power redstone or change the state of a piston?
^
ah, my mobs aren't spawning on the negative axis
which is really weird
AI
So that immediately after spawn, he leaves at certain coordinates
graphs
So I can go on the server, spam left click and see how long it takes to raycast a single pixel on a client-sided image board
me who never used any of these :)
async better /j
does that use a Random?
yeah
I'll worry about unique codes later
probably just using a stripped down uuid
as of right now it's literally just this
what in the erp
what in the extended range projectile
what in the e-roleplay
where the enums at?
smoll
haha he has a small enum
this is what enums were made for
problem: my mobs aren't spawning on the negative axis
to fix the fact sometimes spigot should be using enums but doesn't
magmaguy is using enums? HEH?
every time I see you chatting I can't stop thinking of Mister Choco...
forgive me sensei, I must go all out just this once
it is not funny anymore
don't blame me if my bangers are earworms even 5 years after release
I like how our entire relationship is just us bashing at each other about enums and shitty code in a very funny way
you ping me at mf 4am to display some shitty code and then I'm forced to just not sleep for the rest of the night
why are you creating a firework effect for each iteration
because i do good code
oh yeah I forgor
lmao streams, normal for loop and ::forEach
I gotta order some eye protection I'm starting to go blind
why use many method when single method work
this code is like looking at the sun, it just blinds you
yeah I've been told I am bright young lad
🥲
DISGUSTANG
I could put all of that in a single line
probably a single method too
why is the classroom aware of its storage lol
haha nesting go brr
It's a weird database wrapper class
every single operation messes with the caching database
brr
I found this, but there are errors
oh god
this makes me want to open a charity where people can contribute to your education by helping pay for the electricity bill of the tazer that will taze you every time you write code like this
never used CF::allOf actually
It's a pain but it all worky cross-server cross-machine
r/rareinsults
imagine being such a redditor the only way you know how to communicate is by saying the name of subreddits
bet you have an enum of subreddits somewhere in your codebase
fuckin ell
don't go trying to hide that greasemonkey script you made with subreddit pseudo-enums
hm I forgot what I was fixing
oh right target tracking
Is there a way to power redstone or change the state of a piston?
oh man this is going to be fun to implement
want me to roast you all the way through?
mans got the uno cards up his sleeve
it's like trying to roast my beard, many have tried and all they've gotten out of it is falling in love
I think I'll just cache the locations / entities after the wait time and before the repeat
that probably makes the most sense
oh man this is actually made more complicated by the fact that different actions would require one of two caches but not both and just generating both is a bit expensive
ew I might have to store that info in the enum, I am becoming that which I hate most
🤮
mama didn't raise no coward, I will face the code I wrote like a man
i'd just inline false
since you'll probably expand
make the braces another like
example
SPAWN_REINFORCEMENTS(
true
),
looks prettier :)
just when you thought it couldn't get worse
I'd rather be reminded that I'll probably die alone in some remote location in canada
you'll die in a portuguese coffee shop
a fate worse than death
after the coffee you sip gives you a heart attack
the old men around you laugh, thinking you're just joking
I'm on my third energy drink today
but the scenery soon becomes dreadful
I haven't eaten anything today
I gotta get something to eat I'm hella hungry
part of me vividly believes that magmaguy would tase me if we ever met up
in broad daylight
actually
magmaguy would look around in his community and tase anyone similar to my profile pic
in hopes to get me one day
Hello , good afternoon ..
i want to use protocollib packets to spawn armortands , and rotate them ..
will this be any better than useing bukkit methods?
its for a lootbox plugin , its now working with bukkit and without nms
but its getting laggy because of rotating
are you sure
maybe there are some things you can optimize first
and iam working on 1.8.8 version , i can't update my plugin depend on 1.8.8 , i have added support for newer version and i can do that too
i just want to know if rotating armorstand using packets , will be better for performance
this really doesn't sound like a bukkit issue
how do i setup a placeholderapi placeholder
I mean yeah but it's probably something else in your code
maybe ..
just follow their guide
its not complicated code
i dont understand it
arent you supposed to be dead?
illusion you should come to Coimbra one of these days so I can tase you so we can hang out like bitter rivals normal people
no??
You should come down south so I can show you around the ghetto
this entire country is a ghetto, I'll be out of it next year
you only have a year to come down south
there's no way I'm going to give up homefield advantage for our showdown I'm going down south
your city is too nice for me
I'd prefer the knowing what parts of the sidewalk are fucked to my advantage
you're going to eat some calçada portuguesa, à maneira de Coimbra
hey anyone know how to check if player has clicked in the direction of another player?
dot product
trying to make some sort of target-lock using a ray trace or sym
how do i setup a placeholderapi placeholder
for instance this, (i know the other player is null, just the bottom line im thinking about )
does hasLineOfSight work
uh
pretty sure hasLineOfSight is just a rephrased canPathfindTo
code internally just checks
oh
worlds aren't the same? -> false
Distance above 128? -> false
Blocks clip? -> false
so basically it's just a huge 128 raycast
i might just try to make a box matrix in the direction of the player
and see if the other player's hitbox intersects
i don't want it exact, or players wont be able to hit each other
so like if they click more or less close enough
to another player within like a 30 block range
alright this is at least mostly working, gotta go
returns the hit entity if available
@echo basalt try not to be a bad influence on the youth while I'm gone
how do i setup a placeholderapi placeholder
we are not google
💀
double fov = 30; // 30 degrees
double fovRadians = Math.toRadians(fov);
double range = 30; // 30 blocks
Location playerLocation = player.getEyeLocation();
Vector playerVector = playerLocation.toVector();
for(Player target : Bukkit.getOnlinePlayers()) {
Location targetLocation = target.getEyeLocation();
if(targetLocation.distanceSquared(playerLocation) > range*range) {
continue;
}
Vector targetVector = targetLocation.toVector();
double intersectionAngle = playerVector.angle(targetVector);
if(angle > fovRadians) {
continue
}
// do something with your target
}
im on same page ye
maybe read :)
whats difficult about it
its literally
spoonfeeding
every line of code
there is literally nothing there you can mess up
create a placeholder or use one?
bruh
You aren't trying..
wouldya look at that
no way, it tells me how to register a placeholder expansion
create
then follow link i sent above
yeah cool i have this added
how do i set data to it???
what data
is that class inside your plugin
yes
and did you register it
fucking hell
ok ok ty
I generally just prefer to have a map
private final Map<String, Function<Player, String>> placeholders = new HashMap<>();
public Whatever() {
placeholders.put("name", Player::getName);
}
@Override
public String getIdentifier() {
return "test";
}
@Override
public String getAuthor() {
return "Illusion";
}
@Override
public String getVersion() {
return "1.0";
}
@Override
public String onPlaceholderRequest(Player player, String params) {
if (placeholders.containsKey(params))
return placeholders.get(params).apply(player);
return null;
}
uhh bruh
LevelExpansion send code
so %test_name% would just return the player's name
this dude doesn't even understand dependency injection I'm done
?learnjava at this point tbh
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.
bro 💀
where is ur constructor
u dont even need it for rthat tbh
just remove the 'this'
i just copied this
if you dont understand how that works then idk what ur doing. Your expansion doesnt even do anything and will probably break
thats the base structure bruh
it literally says at the top
funny how he labels himself as a "developer" on his bio
Your expansion doesnt even do anything
wanna bet
yes i do.
mhm. java isn't the only programming language LMAO
You'd understand basic concepts regardless of what language you're working with
HEHEHEHAW
🗿
html / css / js
if you call css a programming language imma whoop your ass
how tf do you write database code in css
Same for HTML, it's just glorified xml
And HTML
C++?
crying
no??
damn, y'all gatekeepy fr
copypasting code
javascript is not for sane humans
hell naw
got two hours basic programming in college tmrw :(