#help-development
1 messages Β· Page 788 of 1
even so, there is too many variables where we can't tell you which to exactly use
all we can tell you is what is out there, and some of the benefits and cons of them
its really up to you to choose which you want to use
and the one you choose may not even be the best at first and you won't know that until later down the road
lol
other than that, mongo is cool
What are they
there is literally hundreds. Mysql, postgresql, mongo, sqlite, h2, MsSQL, IBM DB2, Cassandra, NoSQL, CSV, Orient, Dynamo, Neo4j, Firebird. And this isn't event a complete list
This is a list of relational database management systems.
that link is for relational DB's
there is even more if we consider the non-relational DB's
such as transactional
there is even a java database built upon bson called Nitrite
most people would recommend you to use sqlite or Mysql namely because they are the easiest in terms of learning, using, and a bit forgiving in terms of screwing up stuff
So how the hell am I supposed to pick correct one
there is no such thing as correct one
depends on your needs, for starters I'd pick SQLite or MySQL
?xd
you can't look at it in terms of correct, you won't know if its correct until later when its not providing what you need or its not performing how you need it to
but it also depends on your level of skills to use them as well
not to mention in programming their tends to be no "correct" tooling
Ill just stick to configs as long as itll work
if its working for you and not providing you any issues right now, then I don't see a reason for you to need to change
I wouldn't pass up an ability to learn a database
but if you insists not an issue
but it does happen where you figure out how you are storing data does need to change, but you shouldn't need to worry about that until the time comes for it
and yeah, it may be wise at some point to learn about DB's
especially the common ones because then when you do need it, it won't be such a daunting task to learn it or try to use it
and as I have said, not all DB's are equal each one has its pro's and cons and some are tailored to very specific kinds of things or tasks
so when you do decide you want to use one, its up to you to research which ever and determine if it fits your needs or not
Idk man sitting in IDE and just doing homework is plain and boring as hell
In plugins it can at least be applicable right away
well, programming is not always exciting and filled with thrills π
some of us here have been doing this stuff for a couple of decades
some others they are probably hitting or already hit their first decade π
Hey frostalf I have reached a roadblock in my code can I have some help?
I dont wish to waste 10+ years of life doing that to just make some stupid mc project
sure give me a few, in a game
Thank you
don't have to, just point is the only reason some of us are as good as we are is because the amount of time we have spent learning this stuff
what road block did you hit? lol
Errors with the thing you sent me and performComamnd
well the thing I sent wasn't complete
also, I wasn't using my ide, so the size() method might not have been correct
could be length() not entirely sure XD
it seems to be neither actually
also, my for loop assignment may have been wrong π
it probably should have been Player player
for (Player player : Bukkit.getOnlinePlayers())
WEll that fixed every error
Except the one I have with perform command
since I am confused on how to use it
Usage: !verify <forums username>
!verify SkiiTahoe
Rate limited. Please try again later.
Thanks its rate limited :(
!verify Skiitahoe
Rate limited. Please try again later.
Spoigot go brr
?img
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
Ok we good now
what do I do for the paste site?
copy and paste your code
I did then
on the right hit save, then share the link
oh didn't know you already had a foreach method
just fyi, the for loop I sent is the eact same as using foreach
so we can just move that bit up
What do you mean move that bit up?
You mean your hashmap and my hashmap are the same?
ok removed my for loop you put in, and moved it to your for each
since its the exact same
IE, no need to duplicate π
alright, that doesn't solve your whole command thing, but we will get to that. So are you trying to implement your own command for the plugin?
oh, need to move the assignment of the random too to be above that foreach
otherwise you get a NPE lmao
forgot to do that
randomsMap.put(uuid, randomNum.nextInt()); above?
ok I did that however randomNum is still a error
alright, this is different then what you were asking for in regards to the whole random thing. So you want this to randomly execute commands for them?
that is because you named it random instead of randomNum
either change randomNum to random or change the variable name
kk
either or it don't matter π
Ok I did that then last thing I need is to somehow make the players run the command
that isn't hard, there is a dispatchcommand method for players
whats the difference ? or is there not many
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "someCommand");
would it be this
so, do you want this in a loop or do you want this to happen when they do something?
like when they join
not quite sure why you would want them to execute commands randomly lmao
im goign to make it so that it uses a class plugin I have to just force switch class
if they run it
Thats why I want them to be random commands since theres like 5 classes and they willl just do 1 of them
Its going to be something called /class 1 /class 2 etc
However how would I make them do the command according to there id since i tried uuid and player but both didnt work for perform command
I tested it you dont
Need a slash i think
I am getting a error forscheduler.runTaskTimer(plugin, () -> {
well send the error?
Cannont resolve method for runtask timer
send ur code and error in a pastebin
error as in the whole stack trace
and code as in the whole class that has a problem
https://paste.md-5.net/pucabeloge.java im getting errors on performCommand and runTaskTimer
if (randomNum==0){
UUID.performCommand("help");
}
how does this even compile
Chatgpt code be like
anyways this code makes no sense
you're invoking static performCommand from classes that don't have it
you're using some random ScheduleBuilder class
Okay but 10y of just learning?
and u have timers in timers :?
now send the error you got @lament slate the whole stack trace
lol, they had it commented out when I was helping them
yeah probably shouldn't put the scheduler inside the scheduler
XD
there is always something to learn. Programming languages change, new things come out etc
I don't get this mindset at all
even I still learn stuff just on a different level
It's not 10y of "just learning." It's 10 years of learning and producing
it's not like you're doing school assignments for 10 years to "learn"
you just learn while doing
they basically want to cheat the time it takes to learn the basics and just magically produce quality stuff
seems like it Β―_(γ)_/Β―
DusskTaler, ask your doctor why they didn't just spend a year learning and if they just quit learning now that they got their job
but they fail to understand that without learning they won't understand the help being provided or why you should do something in a particular way, and instead accuse people of giving them half measures XD
Ok let me do it now I got water and am back
Any good doctor will tell you that they are constantly learning every time they see a patient and write a diagnosis, research a problem, etc
What do you mean send the whole stack trace error?
bro
in your console you told me you get "Cannont resolve method for runtask timer"
You do
everything in red in your console, or everything that looks gibberish
School sucks
Ok i understand
and programming is not school
that was my point
programming is learning by doing
not learning by instructure
And I am told to not do plugins
you will learn by instructure your basics, then you will learn by doing everything else
So wheres the logic in that
you still need instructure to learn the basics Β―_(γ)_/Β―
cannot find symbol for runTaskTimer(plugin
Maybe not, but you treat it the same. It takes work, time and effort which is no different then school
ok
anyways thats a compile error? not a runtime error?
are you programming in Notepad? I have no idea how you can write code that invokes non-existant methods
you are missing imports for the scheduler
then maybe its because you stuffed the scheduler inside of a scheduler XD
what are you programming in? Microsoft Paint?
so probably should correct that issue
probably
nah he wouldnt get that error for the stupid scheduler thing
INtelliJ
no you are not
I was given half measure, actually I was given different answer everytime I asked same question
Pretty confusing to say the least
where are you getting the error?
in your server console or as a tiny tooltip in IntelliJ?
when I run I get this
cannot find symbol
cannot find symbol
non-static method performCommand(java.lang.String) cannot be referenced from a static context
non-static method performCommand(java.lang.String) cannot be referenced from a static context
okay yeah
that is your opinion, but I distinctly remember multiple people providing help and not just me and you were essentially having an issue in what people were trying to tell you so it just came down to just use what the API provides so you wouldn't have to learn all that much to use it again going back to you refusing to learn basics or anything proper.
?learnjava
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.
you're writing code that isn't going to compile
other then learning basics, I would recommend using a proper IDE
Nobody has provided me with what basics are
like I wish I could help you more
the list is above, and they have
he is using IJ, just somehow I was confused on "error" being a server runtime error not a compile time error
I did w3school
Well the main problem you are seeing is wit hthe double scheduler which I didn't add I used a util schedule builder for mine to work
@storm crystal can you point me to your problem / the convo? maybe I can be of help?
no the main problem is that you're writing Player.performCommand
Could not find artifact com.github.ToastArgumentative:ToastRPG:pom:v1.0.1-2 in papermc-repo (https://repo.papermc.io/repository/maven-public/)
Why is maven trying to get my library from paper? i have jitpack in my repo which is where my library is suppose to come from.
Ya thats the only error I am getting dominick also
that's not a static method and therefore cant be invoked like that
Ok well I do not know how to invoke it
maven goes by order of repos listed
thats why I was here XD
ohh
try refreshing your maven if that doesn't work you prob have something wrong, that and make sure jitpack is a repository
I am trying to make it so that players perform a command acording to the number but I do not know how hence performCommand
You know getting told to "duh get the basics" without stating what you find basics doesnt help much
hmm yeah it's not being detected. I realesed the new version like 15 minutes ago.
unsure of how jitpack works but I'd say for now post it to your local repo with mvn install, quick dirty fix for this problem
https://paste.md-5.net/ibihetazos.java this is what you need to do
@lament slate ^
basically you were invoking methods out of context
you had Player.performCommand instead of player.performCommand. Player is a class, player is a variable
and you couldn't do player.performCommand because it was outside of the scope where you looped all players (it was outside the brackets)
Yeah other then maven going in order of repo's listed, it will search all repos listed for dependencies you have listed until it finds it, or it doesn't find it and errors out
yeah ill do that, its just very annyoing my 2 other versions work but -2 doesnt.
Thats dominick Il ltry it
I dont think so
its possible there is some update timeframe or something
OH ok thatnks ill try that
jitpack is so dumb why I just use reposilite or repsy
it could be...
if you provide a version on github jitpack will use that instead of trying to compile
this is the first im using of it. this is my first library
just fyi
yeah that's how i have it. i use the tags
with compiled source code? or it just zipped?
if you instead upload a release to the github repo using a tag for version
jitpack will use that release instead of trying to compile the project
it is zipped.. but i can add a jar
so you can just compile from ide, and then upload the jar as a release
and then jitpack will use it, and its faster that way π
jitpack sucks if it has to compile it and sometimes takes too long that the compiler will error before jitpack finishes
sure why not? have to compile it anyways for a proper maven repo anyways
if you did have one
just most people who have a proper maven repo also have a CI that builds that stuff for them π
for player.performCommand do people need op or no
no
Thank you!
they need permission to run the command
you can also use something like sonatype or reposilite that you just deploy too and does all the heavy lifting for you
they even provide viewing of docs etc
I just use a webserver since maven repo's don't actually need anything specific as long as the structure is proper
@zenith gate how much usage do you expect to see? if its not a ton, I can give u access to my reposilite instance @ https://maven.dominick.sh
Ok is there a way without permission or no
eh there might be, not sure
typically all players have permission to run basic commands
like help for example
unless you specifically take that perm away from them
oh no, the bot is typing
I'm new to spigot, and was wondering if it is possible to check an items stats, like how many blocks a pickaxe has mined and display that number in one specific line of its lore
kind of a bit ironic that you are a blue bot, without being blue o.O
No no I think i know what the issue is, 1 prolly is timing out if it isnt ill still compile ahead of time, and I also had a few classes I updated, and i didnt update the supers, so it wouldnt compile anyways.
can someone add 3 slot here i dont know how to dev and this came in a tutorial pack
No that info isn't stored, you'd need to store it yourself
how would it be possible to wait to load the players inventory?
like for example when the player joins, their inventory is blank and then after the player runs a command their sever inventory is loaded
do i just copy the inventory to a hashmap, clear it, and set it later?
or is there a better way to do it
Lol, that last bit might be the cause lmao
jitpack won't provide anything if it fails compiling π
if you didn't provide a release, and zips can be used as a release just fine but the user has to specifically set the package type of the dependency as a zip instead of jar
so, typically better to provide a jar and not confuse your users
look into github actions for a simple CI workflow to test compile on each commit btw
tho u can also setup IJ to do that pre-commit iirc
surprised the automatic code analysis on commit didnt catch that tho?
code for it
not the place
that's not even code
idk
do you think this would work
Bukkit.dispatchCommand(player,"me hi")
i dont code but thats the rtp code
thats the rtp config*
config != code
that makes the menu?? i need to add 3 more buttons some how
but it could be code though, whats that one language that I forget XD
skript?
there it is
I know lol
I mean maybe mycommand, never used that
but they would still be in wrong place if it was skript or something else
agreed
Good call, I will switch to using jars for new releases.
can someone just help me add 3 buttons to it
no
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
cant post lol
that isn't our problem, its the appropriate place for what you are wanting
this channel is to help those who are developing plugins and the related. You already stated you are not a developer so what you are asking doesn't belong here, the other help channel is for help with the server related issues. That only leaves the forums for what you are requesting and not here. π
@wet breach do you know a good bit about bit shifting I'm actually curious about something.
so this is the code for packing 2 ints into a single long long packedInts = (((long) left) << 32) | (right & 0xffffffffL);, but why does it work
I get pushing up the left int 32 bits, but besides that I'm not really sure
for example the Binary OR and AND
Well
You bitmask the 32 bits to the right and then u just concat them
like the AND just makes sure that the 32 bits to the right are the remaining ones that should be
basically
yyyy|0000
->
0000|xxxx
->
yyyy|xxxx
Here is an example of understand bitwise OR
The bitwise OR (|) operator returns a number or BigInt whose binary representation has a 1 in each bit position for which the corresponding bits of either or both operands are 1.
const a = 5; // 00000000000000000000000000000101
const b = 3; // 00000000000000000000000000000011
console.log(a | b); // 00000000000000000000000000000111
// Expected output: 7
so when we add 5 and 3 together using or, the result is 111
thus 7 and not 8
beecause we are not counting the numbers or doing addition
we are instead assigning the bits where they are filled and putting them together
for the x part, we remove the 32 leading bits
hold up let me demo with 8 bits here and two 4 bit ints
int4 num0 = 0001 // 1
int4 num1 = 0111 // 7
int8 pack = num0 << 4 // this woud result in 00010000
int8 pack = pack | num1
/*
* 00010000
* 0111
* --------
* 00010111
*/
Is this kinda the idea
oh okay cool I always struggle to apply the stuff I've learned in assembly to bigger numbers
if you right shift num0 it will make it 0
it won't wrap around
so right or left shifting kind of shifts the bits off into the ether
hence why when left shifting the sign gets lost
but in your example other then the incorrect shift your answer is correct on the bits returned
does the & just make sure its not bigger than x amount of bits
oh wait I just realized what the front is lmfao
I thought that was hex for some reason
but if you use the bitmask
1111 it will basically just allow 4 trailing bits of whatever input u take
oh lol
I didn't realize it was just 1111 in binary
Bitwise AND is the opposite of OR
3 => 00011
& 5 => 00101
------ -------
1 00001
indeed
cuz the sign bit dies
so what would I do if I wanted to preserve signage π€ wouldn't that be hard though
typically its best to record the sign before doing any shifting so you can apply it later if sign is really important
however most bitshifting doesn't need the sign and thus ignores it
right now I'm seeing if I can pack an location (x, y, z) into a long array with length 2
for example 3 is still 3 even if its -3 because in binary, the very left most bit is either 1 for negative or 0 for positive
otherwise everything is on the right
given xxxx and yyyyyyyy (binary)
we make xxxx0000 by xxxx << 4
we make 0000yyyy by yyyyyyyy & 00001111
we concatenate to xxxxyyyy by xxxx0000 | 0000yyyy
Visual representation of this concept sorta
ahh okay
since I have you here conclube I'm wondering a good way to go about this, as I've been trying to think up stuff, but I'm not sure what the "best" way to do it is
if you get really good at bitshifting, you can actually do very large calculations that exceed integer sizes by splitting up the numbers between two or more integers and working on each as appropriate and then you would just combine them together to get your result
Yea
Essentially I'm making a plugin where you can place Multiblock structures into the world, I am adding PDC to each chunk the structure is in which references the data of the structure, once its interacted with its loaded in from the chunk's PDC into a cache so I don't have to keep constructing the object while the chunk is loaded.
https://paste.md-5.net/emaxazijop.java. Right now I'm doing what is in the paste, but I feel like there may be a much better way to go about this
I generally want to be fairly efficent with this seeing as their could be thousands of these structures
they store very little data and do most of their functions lazily already, but actually storing them is another issue, I've got the PDC thing down pat for sure, but storing and retrieving them from memory is another story
world.getMostSignificantBits(), world.getLeastSignificantBits() you can combine these together and store it as a single long
there is actually a method for this where you can get a UUID from a long
in fact there should be one for the UUID to get its long format
is this even a viable solution to my problem is more what I'm concerned about
an *efficent viable solution
well, storing purposes you don't need to split them up like this
but as for unraveling a long into a UUID you can do it with bitshifting too if that is a concern
not super concerned with the micro optimizations atm just want to make sure I'm somewhat on the right track, wasn't really sure how else to go about this
I feel like a data object isn't really needed here for the map either as it'd be a waste I'm only storing numbers
a Generator is a multi-block strucutre.
Essentially multiple generators can exist in one chunk, but each generator takes up multiple blocks, usually 3x3x3 or 27 blocks
Which version of uuid does the world have frost?
should be version 3
Ah ok yeah
I should add generators can not intersect either
but a generator can't just be a single location?
it could be it depends the size of the structure
my default one is not, but one could create a schematic which is simple 1 block
I know for instance world edit and worlguard uses octrees for their regions y2k
Or well I believe they do at least lol
I am just concerned with what you are making, not what someone else could do
in my default case no they can't be a single location
they are always multiple locations
in this specific case its a grouping of 27 blocks
then you are better off using a format similar to chunks for your coords
basically you would treat your coords as chunks but custom because of your requirements
in this manner, regardless of a coord you should easily be able to obtain any other part of it
since we are going with multiples of 3, it wouldn't be that much different then what MC uses where its a multiple of 8 or 16
not sure if you were aware, but you can actually obtain a chunk coord from the location coord via bitshifting by 16 I think it was
yep :P
x >> 4 z >> 4 for the chunk coordinates
ah right 4
so how would that work out though. I'd need to way to determine if I'm in a 3x3 area based upon a coordinate location
so anyways, in MC, locations are all backed by a chunk, and each chunk backed by a region file, which is backed by the world
math, based on 3
if it makes it easier use base 3 system
but remember since I'm using Chunk PDC i'd also need to beable to determine what chunk/chunks I'm in, but that'd be a completely separate concern huh, that really owuld have no bearing on how its stored in memory
using base 3 would make it easier on you in terms of doing the math since it can be a bit hard to keep track or visualize with base 2
and its really not hard to go from base 3 to base 2 and vice versa
the math is actually quite simple for that
wait wouldn't this fall through because you could technically place these generators inbetween my "chunks of 3"
you mean you could place a generator inside the locations of another generator?
well you can't but let me show an example of what I mean
I will just use 3 chunks as an exmaple here on a 2d plane
x is our first chunk
y is our second chunk
z is our third chunk
g is where the generator lays
xxgggyzzz
xxgggyzzz
xxgggyzzz
``` as you see my generator intersects with chunk x and y where you now have 2 y's taken and 1 x taken
Y2K i donβt think ur current system is bad
I'm literally hounding for any advice on improving this
but this goes against what you said previously that generators are 3x3x3
like u can change it and do it with what frosty suggested, but like⦠then u need to prevent intersections and possibly spaces of arbitrary n blocks between 2 generators
not really its still 3x3x3 it just intersepts 2 different chunks of 3x3x3 areas
which is what asked in that you could place a generator inside the location of another generator
and you said no lol
but now you are saying yes
well you can't, x, y and z aren't generators only G is
I couldn't place a generator at the 2 x spots left, and the 1 y spot left
ok, so then I am not understanding then since I am only concerned with generators
nothing else
But as said, another way to represent these regions is in an octtree-styled fashion
what is an octtree
tree with 8 nodes per node
but if your generators can't overlap at all you shouldn't have an issue in creating custom chunk structure and your own coord system to refer to each generator
basically each 3x3x3 is its own chunk coord, and from there you would get everything else in there, and then you could get real coords easily
I think another issue is that there may exist 2 generators both with the volume of 3x3x3, but there might be 1 block spaces in between
that's what I was leading on about
or trying to explain earlier
Yea
Well if generators are only these size cubes, what exact issue is there if the spacing between one generator is a block distance or even 2 block distance?
what would be in between the generators that would be important ? o.O
other blocks spawners etc
well, you didn't say anything about other block spawners lol
I could just force a snap to a 3x3 grid, but then again I feel like a better solution would be afoot then
having it axis aligned would be ideal
I'm assuming we are within a normal Minecraft Environment
however even if we are not doing axis aligned you could do a sudo alignment as well
but I think the easiest would just to treat those gaps as their own thing
you could just map those gaps as needed to whatever you needed them to be
@ivory sleet I've got to head to bed, but would it be fine for you to explain the OCTOTREE to me more tomorrow night, If I can't get a good grasp on it I might just do an 3x3 grid as forst suggested for now and maybe switch it up later.
It'd be pretty easy to make a grid snapping system for them, so if I were to execute this I'm not too concerned about all that
ah yes the historical misspelling of my name can't forget that π
lol forstalf xD
Yeah miles, lets takr that tmrw then :)

Are you... Adding imports by hand?
Do you know about the IDE's auto import/import select?
nope
Also what do you program in?
IntelliJ
huh more ya know
Left alt
Thanks for teaching me that trick
It should suggest imports if there is more than one class with that name
Anyway gtg now, school's waiting
Peace
It'll also suggest them when you are typing
// suggests Player, you can select it and it'll autoimport
Pla
whats the diff between creaturespawnevent and entityspawnevent
waitnvm
makes sense actually
?paste
Hi currently my plugin makes all players every minute randomly choose a number between 0-2 and a command happens based off that. However I found a error the player needs to have OP to use the commands or the perms to use them which is a problem for me. Does anyone know a work around to this? My idea was to make another class which grabbed the players name and stores it and then tells console to run it as the player with execute? I do not know if thats possible though and could use some guidance.
Code Here if you want to see it:https://paste.md-5.net/ijaharisin.java (Reply to this if you can or ping me since its late for me and I might not see it until tommorrow)
give them the perms
console as sender, pass name as arg
NO im not giving everyone creative perms XD
they don't need creative perms to run commands?
one of the commands is gamemode creative
ok....then how you expect them to run that command ?
what are you expecting to actually happen?
Well I am going to change it something that is a class thing later on for fighting however the point is you get the class and no switches until 10 minutes
fyi, you can just change their game mode via the api
that too
it should never really be necessary from the plugin to make a player do a command
how would I pass the name as a arg since I am new to args
Well its to late to go back on that now XD
add the string at the end but frosthalfs right, use Player::setGamemode
ive been here for 7 hours I am not wasting that time :(
I see we are going to get a bunch of new developers wanting to do the wrong things π
Ya frost you already know that with me tho
well you may be new, but that shouldn't be used as an excuse for doing it wrong
True
its your plugin however, therefore you are indeed free to do whatever
just can't expect some of the experienced people here to keep their sanity in trying to help you
or help for that matter
ya fair
The point of the plugin is to not change there gamemode i was just using that to test I have a /class plugin to set somenoes class and no one can acess it however I want it so that the server randomly chooses one for them every 10 minutes
hey frost, if its my plugin is there a way to obfuscate it so this doesnt happen again?
https://discord.com/channels/@me/994727503925096458/1173400568312639558
I didnt mean to do it wrong I was using gamemoded as a testing thing
what do you mean class?
like a kit?
Ya
Correct
this isn't hard to do, and you don't need commands for this although you can implement a command for testing purposes that only you can access
Well how else would I give them a random kit
as I said earlier, it is generally never necessary to make a player perform a command
you can just stick the stuff on them in their equipment slots
I suppose that would also work ya
instead of running a command, you instead would invoke one of your classes for a kit to give
and you would turn this into a method that gets invoked instead of your command thing you are doing lol
Ya true
if you need something to provide some insight here is one of my defunct plugins that is handy for teaching
Thanks
its open source under the MIT license I believe so feel free to use what you find handy
I plan for this plugin that im making to be a one time thing then since I did it so badly
so next time im better
well as long as you are learning and plan to do better next time around. It is what makes some of us here so called professional
because we learn from our mistakes and try to not do them again π
Welp for now ima try to do it wrongly and make console run the command for the player but next time ima just do the kits thing where I make them equip the stuff
lol
Yes im coping since I have done this for 6 hours or something
don't worry I have had projects where it took a couple of months
just take your time on it π
public static Player getPlayerExact(){
return getPlayerExact();
} would this be a way of grabbing names and then sending them
you could, but uh I recommend not using static though
if you want to use static then use the Bukkit method
Bukkit.getPlayerExact(name or uuid here);
that method is static already so no need to duplicate and create one
Donβt need a new method
.
I tried that it did not work for me
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
might be getPlayer().getPlayerExact() lol
Bukkit.getPlayerExact(name or uuid here);
?jd-s
declaration: package: org.bukkit, class: Bukkit
Wait so I am confused then what do I put inside the parentehsis
Bukkit.getPlayerExact();
either a string which is the player name
Are you coding for a singleplayer game?
or a UUID which belongs to the player
Only takes name
getPlayer for uuid
so what I am hearing is that for Bukkit.getPlayerExact(); it will not get the player name since it needs the player name?? im confused
I am confused since this does not seem to grab someones name but the class I made might?
it grabs the player with that name or closest match to the name
Ok is there a way I can just grab all players names?
and then do the whole process of making them run a command through console
you woul need to loop through online players
Ok I can do that hwoever what is teh command to grab a players name?
Use the javadoc
In 90% of cases you should call methods instead of letting them invoke commands when you are coding.
Sometimes people prefer learning through videos. You should also look into that.
Otherwise:
?basics
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.
Thank you
Why am I getting the following error for the following code: ```java
java.lang.NoSuchMethodError: 'net.dv8tion.jda.api.entities.TextChannel github.scarsz.discordsrv.DiscordSRV.getDestinationTextChannelForGameChannelName(java.lang.String)'
at com.neomechanical.neoperformance.integrations.discorsrv.DiscordSRVHook.sendMessage(DiscordSRVHook.java:16) ~[NeoPerformance-1.15.jar:?]
at com.neomechanical.neoperformance.performance.performanceHeartBeat.HaltNotifier.notifyResumed(HaltNotifier.java:53) ~[NeoPerformance-1.15.jar:?]
at com.neomechanical.neoperformance.performance.performanceHeartBeat.HeartBeat$1.run(HeartBeat.java:58) ~[NeoPerformance-1.15.jar:?]
at org.bukkit.craftbukkit.v1_20_R2.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.20.2.jar:git-Paper-260]
at org.bukkit.craftbukkit.v1_20_R2.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:480) ~[paper-1.20.2.jar:git-Paper-260]
at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1470) ~[paper-1.20.2.jar:git-Paper-260]
at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:446) ~[paper-1.20.2.jar:git-Paper-260]
at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1379) ~[paper-1.20.2.jar:git-Paper-260]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1156) ~[paper-1.20.2.jar:git-Paper-260]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:315) ~[paper-1.20.2.jar:git-Paper-260]
at java.lang.Thread.run(Thread.java:840) ~[?:?]
You sure itβs bugged?
package com.neomechanical.neoperformance.integrations.discorsrv;
import github.scarsz.discordsrv.DiscordSRV;
import github.scarsz.discordsrv.api.Subscribe;
import github.scarsz.discordsrv.api.events.DiscordReadyEvent;
import github.scarsz.discordsrv.util.DiscordUtil;
import net.dv8tion.jda.api.entities.TextChannel;
public class DiscordSRVHook {
public void sendMessage(String message) {
TextChannel textChannel = DiscordSRV.getPlugin().getMainTextChannel();
if(textChannel!=null) {
textChannel.sendMessage(message).complete();
}
}
@Subscribe
public void discordReadyEvent(DiscordReadyEvent event) {
// Example of using JDA's events
// We need to wait until DiscordSRV has initialized JDA, thus we're doing this inside DiscordReadyEvent
DiscordUtil.getJda().addEventListener(new JDAListener());
}
}
?whereami
only works for paper π¦
yeah , yesterday nothing got wrong
What class is target
everything , it's like im using 1.13
Classname
"Info"
Itβs hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
wait i will send u the class
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
What is your pom/gradle?
wait
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
@lavish cliff
Thx
I can tell you brandname does not work
It does not exist in the api
also getPing?
getPing is there i. 1.19.2 on Player
Curious
so how i can fix that
Ctrl click on target?
Then ctrl click on player
See what it bring up from what dependency
why bukkit 1.13?
Well blame maven
i don't find any method added in "latest" version
@tender shard tell hum how to look throigh his maven dependency tree
Looks like the runtime version of jda is different than the version you are using on compiletime
@SuppressWarnings("all")

Server is using DiscordSRV-Build-1.26.2.jar, I am using <version>1.26.2</version> api
all latest
the documentation on discordsrv is horrid
Are you relocating jda?
no, because the documentation doesn't cover that
just for don't see the "no usage" for the class , I checked everything before putting it
never said anything on literally nothing
use JDA
How about @SuppressWarnings("unused")
there only this on it is this github repo https://github.com/DiscordSRV/DiscordSRV-ApiTest/blob/531bfaa9974878dc885e56ed4ff2da8bb318a70d/pom.xml
the pom doesn't relocate
i've asked on their discord server but there is 0 support lol
Did you shade jda?
Ok I figured out how to do commands without having perms to actually do said commands thanks to you and JanTruck and 7smile7
ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
Bukkit.dispatchCommand(console, "execute as "+ player.getName() +" run gamemode creative");
System.out.println("execute as "+ player.getName() +" run gamemode creative UPDATE TEST");
i shaded my plugin?
pom.xml pls
I mean... This works but its def not how a developer would do this.
For my first program its acceptable :(
Sure
Look I didnt even know what a class was until like 6 hours ago
This is progress to me XD
also how would a developer do it?
Just as a future reference. Your code will probably look more like this
Bukkit.getOnlinePlayers().forEach(player -> player.setGameMode(GameMode.CREATIVE));
Ok well lets say I want the command to be /supersecretcommand
Then it would work :D
If there is no way around using the command, then yours is the proper way
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Ok ya for gamemode though I am saving that command you sent me since I needed that
?
Put the spigotmc import on top of your dependencies.
And then run mvn clean
I think luckperms pulls oder versions. Same goes for Vault
ye i need to update them
dear lord this is shameful
Nah i mean they always pull ancient spigot versions no matter what XD
they made an example project that doesn't cover half of it and called it a day
oh ok lmao
Pls show the pom which shades jda. Your root level pom is kinda useless π
not sure what you mean by shading the jda, but here: https://github.com/KyTDK/NeoPerformance/blob/master/api/pom.xml
Where is your DiscordSRV dependency located??

i have a set of 2 coords minX Y and Z and max X Y and Z in a config file
how can i detect if a player is inside the region?
Something like this
areas:
test:
enabled: true
world: world
time_required: 10
location:
minX: -439.0
minY: 95.0
minZ: 386.0
maxX: -432.0
maxY: 89.0
maxZ: 395.0
Did you install DiscordSRV on your server as well? Same version?
Create a BoundingBox with those coordinates and check when a players BB intersects with the region.
This can either be done through a scheduler or when a player moves.
Alright
Thanks
Idk then.
Make sure to never use plugman or the /reload command of spigot. Other than that it sounds like a problem with their API.
oh
hold up...
that might be it
nope
i was really hoping that was it
might just tell the person who suggested that to get fucked
thank you for the help, once again
Could you send the exception again?
The path youve sent before looks scuffed
java.lang.NoSuchMethodError: 'net.dv8tion.jda.api.entities.TextChannel github.scarsz.discordsrv.DiscordSRV.getMainTextChannel()'
at com.neomechanical.neoperformance.integrations.discorsrv.DiscordSRVHook.sendMessage(DiscordSRVHook.java:13) ~[NeoPerformance-1.15.jar:?]
at com.neomechanical.neoperformance.performance.performanceHeartBeat.HaltNotifier.notifyHalted(HaltNotifier.java:33) ~[NeoPerformance-1.15.jar:?]
at com.neomechanical.neoperformance.performance.performanceHeartBeat.HeartBeat$1.run(HeartBeat.java:52) ~[NeoPerformance-1.15.jar:?]
at org.bukkit.craftbukkit.v1_20_R2.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.20.2.jar:git-Paper-260]
at org.bukkit.craftbukkit.v1_20_R2.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:480) ~[paper-1.20.2.jar:git-Paper-260]
at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1470) ~[paper-1.20.2.jar:git-Paper-260]
at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:446) ~[paper-1.20.2.jar:git-Paper-260]
at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1379) ~[paper-1.20.2.jar:git-Paper-260]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1156) ~[paper-1.20.2.jar:git-Paper-260]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:315) ~[paper-1.20.2.jar:git-Paper-260]
at java.lang.Thread.run(Thread.java:840) ~[?:?]
The bouding box is in the newer versions of spigot API im currently using Spigot 1.12 any idea on this version?
Copy the BoundingBox implementation of a newer spigot version into your plugin
how can I do it? Im new to this lol
Seems complicated
You go into the class, mark everything, copy it, create your own class with the same name, and paste everything
I mean the method is here
yeah lol
Alternatively you can just do these minX >= x <= maxX yourself
So like I have to open the spigot src and copy the BindingBox class from that and add it to my plugin?
hmm
Look into your jar and check if you have a github.scarsz... path in your compiled plugin
Not sure where to look
i think its not there
maybe
idk
Or you create your own box class and write the logic yourself.
Its really just a few if checks between player x,y,z and your min/max x,y,z
i could set it to compile instead of provide?
your root should have something like
com
net
org
Domains like that. And now you look for github
not there
I'm going to set it to compile for it to shade
Nope if its a standalone plugin then you always use provide
Hmm. Put your DiscordSRV dependency right under your spigot import and try again.
This is what I currently have in a Event Listener https://pastebin.com/33iZaSGd
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
You should not read out of configs the whole time. Write more classes and load your data into those.
WE GOT HELP FROM THE ACTUAL DEVELOPERS
they said: DiscordSRV api users: if you need to use JDA please use the 1.27.0-SNAPSHOT version of the DiscordSRV api until we publish the next version of DiscordSRV
gonna try it
okay so maybe its just badly designed and appartently a pinned discord message is enough
this is utter shame
π
just need to crash my server to test it
thats how its triggered lol
well problem solved
thank you again 7smile7
if i could updoot you i would
i cant hit people
good
?
why is /reload not being recommended?
Because spigot doesnt support it and plugins constantly break because of it
ok
mvn dependency:tree
spigot does support it, it is typically plugins not supporting it like they are supposed to
not sure why, there is nothing in spigot itself that would cause it to not work
but it could just be because plugins historically failed to support it
so might as well say its not supported lol
no clue Β―_(γ)_/Β―
My language of choice is c; it's more universal. Is there a way to code plugins in c?
if you are brave enough
There are ways to write spigot plugins in any (turing complete) language
it'd be much easier to just learn basic java
But you should really learn some object oriented language besides C.
Or any to be honest. C is kind of like a surgical knife in an arsenal of weapons. Sure you can finish every opponent if you just
resiliently poke him enough, but there are def more sophisticated tools you could use.
could use JNI
I know some java and I'm learning in college basic coding I can apply to all languages; just finished loops, arrays, and lists. File handling and applications is this week but I already know a little about that
Oh so C isnt you language of choice. You would need choices before you can clam that ^^
another method may be to create a native lib and have it be loaded by the JVM. Kind of like a spigot plugin, but instead a JVM plugin
I just prefer c at least currently I'm more familiar and my environment is already setup.. Technically I have intellij setup for Minecraft as well and Python setup
is there a way i can set the hostality of a creature? For example make a zombie not attack players or a sheep attack players
I mean its possible
But like java will be so easy for u
In this case: def learn java. It has a pretty similar syntax to C and you will get the hang of ot pretty quickly as soon as you understand objects.
I'm also trying to learn unreal engine... I can't seem to find where the code goes though... Unreal engine I'm trying to learn for ark survival ascended but I need to start from scratch with this
Python looks less involved I like needing the brackets in c and Java
How about you master one language before picking on other languages...
Wdym
I mean that in the literal sense
It's best to learn universal concepts before focusing on one language; at least that's what they are teaching us
Just finished for and while loops
malloc is just a function to allocate space, or well memory on heap
Java has it
Just that its a bit higher level
Yeah memory allocation by hand is disgusting
no not really
What's your major?
I wish you could study Chicken Wing science
Memory allocation by hand is not disgusting, in fact memory allocation not by hand is generally considered disgusting, I meanβ¦ we invented garbage collectors because weβre noobs at memory management
Cybersecurity
You aren't on week 4 this week are you? Really weird if we are in same course lol. I just learned loops as well
I'm an expert in chicken wings, I could teach it
In this case working very close to the memory is extremely important for you
Eh like 6 week ig
idrc
it has malloc but Java uses it at a low level, but it primarily makes use of the new variant calloc
Teachers know what we need on course better and they dont teach us it
Ah, I'm majoring in app development with a bit of history focused just because I like history
any ideas?
Only with a custom nms implementation
It's better to learn things or know things before taking a course that's supposed to teach you; you need to adjust your thinking to understand basic cis concepts I started about 7 months ago and I'm just taking my first core course which that plus khan acadamey and 7 months of messing around with code made it a lot easier to grasp
declaration: package: org.bukkit.event.entity, class: EntityTargetLivingEntityEvent
just cancel this
or
declaration: package: org.bukkit.event.entity, class: EntityTargetEvent
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
thx
what should the json file look like for a block that loads a texture for a specific state?
I never went to school, got to mess with satellites, sub contracted with one of the largest DC's in Arizona, done some custom networking setups for a few different businesses, have been a systems admin for a few different places π
but is there a way were i would not need to constantly update the target?
Not really possible
i feel like that is gonna be VERY bad for the usage
cause in my situation i would have to do it for EVERY living entity
you don't need to update the target, you just cancel it
I mean how to add a texture to a specific block state
I understand that and I understand college isn't for everyone... I just learn better this way in the environment for me personally it helps
your other method if its for all entities is just to set the server peaceful
server resource pack
no i need to update it. as i said make a sheep attack a player for example
I only know how to use ModelData
And there are still places that wont hire you if you dont have the paper
but idk how use block state
well sheep don't attack players and if you try to make them do so they kind of bug out
in order to do it, you would have to disguise another entity as a sheep XD
what does bug out mean
okay sure i can disguise another entity
sheep in real life are already bugged, they don't give bacon
lol
what do you mean the other way around?
disguise a sheep as a zombie so the zombie doesnt attack the player
I know that textures require a texture pack. But I need to know how to bind a specific texture to a specific block state. How is this written in a json file?
You can stop mobs from attacking and it not bugging out if you want you can have my sneak skill that does just that
yh but i also need to make friendly creatures attack the player
i need to be able to set every level of hostility on every creature
and im looking for the best way to do that
It's probably possible you just need to get all the edge cases, and probably a better way to do it then I am thinking
Hello, I'm looking for Android library that can connect with the RCON. Hard tried on the internet. Does it really exist one?
But i couldn't find one.
I've found only a java library, but it doesn't work for Android enviroment
should be telnet protocol
oh tfnks
How much time do you have? You could just write a wrapper for that protocol yourself in a few hours. Maybe 2 days.
No, I can run server command on Android app, and do much more stuff. The problem is that the existing Java libraries do not work for Android.
The Socket class just does not work when I write it in an Android app
you are better off using a SSH client on android then you are using RCON
Have you tried all those?
or better yet just make your own mc plugin for connecting
then you don't really have to worry about much
Not all yet, but most not work
for something basic and easy, the plugin only needs a single class really and all you are doing is using as a passthrough for console in essence
Because of this, I have no idea to hook from Android app to other Java application
There are some of Android apps using RCON. Why can't we?
not sure what you mean by Socket class just does not work
android has sockets....it must since it has internet
question is, what in fact is actually wrong with the class file that needs to be changed
as there is difference between android sdk and java sdk
//code
}```
are there better ways to do this? or are better ways not needed because it is efficient?
so even with 100 players it would cause lag?
depends on what //code is ofc lol
Thread.sleep of course
Depends on your code inside that for each
an example would be a tabcompleter for a command
I would rename all to each or player
that recommends all players
if looping over a collection with 100 entries would cause lag per se, we wouldn't have anything coded in java
good idea, i will rename it
each is not all by the way, π
//alternative way instead of the for loop. This is the Lambda way.
Bukkit.getOnlinePlayers.foreach(player -> {
//do something here
});
Thats the point 
you mean forEach(...) ?
would this be better? or does it change nothing at all?
it wouldn't be better
yeah I forgot the foreach, added it π
it doesn't matter at all. just loop over it, it's not an issue
it is the exact same, both are foreach so no difference just a different way
some people like using the enhanced for loop
others like using the lambda
the enhanced for loop internally uses foreach
so, preference π
If you want more, I think that you can iterate each player in a tick. Do stuff with one player per tick. Hint is using Bukkit.getScheduler().runTask()
depends overall what is they are trying to accomplish
Yeah
not really necessary to use a scheduler just for iterating π
Now I still can't find the easiest way to use RCON on Android π΄ Maybe bye here. Suck Android limitation over Java.
Isn't it translated to Iterator?
fernflower at least shows exactly the same source code
no, enhanced for loop internally uses foreach
it compiles to using the Iterator
you can break out of an enhanced for loop, you can't break out of a forEach
enhanced for loop uses foreach
might wanna take a look at your javap π€
how would that work if forEach was added long after enhanced for?
anyway, doesn't matter whether one uses Collection#forEach or a normal for loop or an enhanced for loop to loop over all players, in the end
because updates
they are basically both the same except in a few different scenarios
helps to reference more up to date specs
it doesn't make sense for the enhanced for loop to compile to use forEach, again you can't break out of forEach, you can break out of an enhanced for, so how does that work?
in any case, the bytecode doesn't lie https://godbolt.org/z/hq9Y7bz9s
i'm surprised you don't know this one
well according this, it essentially means that foreach would also be a form of iterable in the end
which makes sense
it doesn't say that enhanced for loop isn't the same as for each, just what the rules are for something to be an enhanced for loop. But this is isn't implementation though, more or less a specification. Big difference between a spec and an implementation
What is this static with {}
a static initializer
like constructor, but it runs when the class is loading
runs when the instance is created
So once per class basically
Why is there separate thing like that
its usefull?
Yeah well, it has its usefulness as elgar said
emily
and the specification mandates how a language feature is implemented
powercas stfu
well for example for the stuff I have sent
A constructor runs every time an instance is created.
A static block just runs once, when the class is loaded by the classloader.
the static init block basically IS a constructor, but for the class itself, not an instance of it
So no difference, its still loaded either way
no, a normal constructor is called per instance, not per class
next weekend I will check the implementation
I could be wrong, and it may be something else that is the same as the enhanced for loop
you are wrong
But you have your shit loaded and ready to go
In both cases
the Iterable interface was introduced as a base for enhanced for loops
since day 1 an enhanced for loop has compiled to iterator usage
(for Iterables, indexed for arrays)
I never said it didn't
you heavily suggested it changed in some versions which it clearly doesn't
a static init block is, as the name suggests, there to initialize static stuff
unlike a constructor which only runs when an instance is created
show me where I said its not an iterable
And why you cant do it in constructor
because the list is static
and the methods that access it are too
so the list would be empty if I would populate it in the constructor
Why method needs to be static to access static shit
literally this
all I said is that enhanced for loop uses foreach, which foreach is a form of iterable itself so it doesn't mean it breaks the contract. As I said I will check the implementation this weeked
it doesn't have to be
man can't accept he's wrong
Why
but why should it not be static if it does not require an instance
because I have never created an instance
Because it doesnt make sense otherwise. Its like trying to drive the blueprint of a car.
are you going to check the implementation?
Well people here told me to not make shit static
because you don't understand what it means
you don;t use static unless you know what you are doing
no because i know how it works
So make your mind
oh so you don't know then
thanks for confirming you are not willing to show implementation π
because you clearly do
that's just wrong, forEach is a default method in Iteratable which then uses an enhanced for loop under the hood
You shouldnt abuse static. And 90% of beginners simply do just that when they see static, they abuse it.
as I said, I will check the implementation this weekend
i literally shared a godbolt link with the bytecode
Then just make one lol
feel free to scroll up
So we suggest them to not use static at all for a while until they fully understood the difference between classes and instances
why? it's not needed
do whatever you want to do, what matters is what the JLS and method contracts say
thanks for the help guys
