#help-development
1 messages Β· Page 495 of 1
i had c++ exp mostly
but java is 10 times easier
in russian you say
Enn Shteinn
sad
sad x2
anyways
are you new to spigot?
well then
basically
Nothing is comming, nothing for me is called .length
offlinePlayer.getLength
Player player = e.getPlayer(); OfflinePlayer offlinePlayer = e.getPlayer();
.
.
Everything minecraft server does is receive and send packets
incoming packets are covered in Events or Commands
and then after all manipulations server sends the packets to players
basically after all events are processed and all commands executed
also bukkit provides file writing to .dat files(by impl) and .yml(by depending on SnakeYaml)
everything else than file writing and packets is not part of Spigot api
if you struggle with creating a list then it's Java-related
not spigot-related
?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.
now when you know all of that
you just open the spigot javadocs
and loop through all possible events
loop through all of their getters and see which objects they return
javadoc search box is your best friend. Always use it
and then loop through this objects and their methods
and so on
if you want something exact
here is a search tab for you
here
Thank you π
i started with a replacement of the anvil in a gui (worst way to start)
custom enchants? π
well itemstacks and invs are simple
lol
if you know how to work with
also you would need to connect your chat manager to PAPI
So you can use Permission plugin prefixes
and stuff
what's your plugin about
NUKER
um
i just use scoreboads API lol
no look at the code:
super
small
but the problem is
hello, i have a problem, i implemented a fountain show and use a function to spawn falling blocks, this always have been worked fine but since i changed my server version the blocks wont get spawned anymore at least i dont see it but i don't get an error
everybody once tried rpg plugin heh
you used API or just installed a plugin
i wrote an own plugin and just use falling blocks
that was also for my server
DivineRPG i called it
the first thing i tried to implement was custom locks on chests
so if you want to pick it you have to solve a maze
it's working let's goo thx for helping me ^^
basically interact with inventory slots to move a cursor to the end
probably lol
from somewhere
my plugin was deleted in like 2 weeks
from my pc
i didn't publish it
i mean i made mazes
but was too lazy to make their actual logic
so you can interact with a maze
?
wait how did you remove the text?
ahaha
bro learns now
can you show what you are talking about
or like describe better
π₯²
my brain cant understand
in texture pack you need to add for all lang json
{
"container.inventory" = ""
}
it's remove for all xD
I see, well then its a compromise im not willing to make haha
i was ban in Hypixel because anti cheat π and i don't unban but i send all proof and he verified me xD
i think you can add special char and make with json langs the name of inventory if is not your menu
nope
never tried
guess just need to loop through spigot news
and learn how to make resourcepacks
?
You posted nothing for anyone to work with. Not even a question.
i tried it out to spawn just a falling block with summon commnad, which worked but when i try to spawn it with my plugin it doesnt work and i dont get an error and i didn't even changed something in my code and it worked fine until i changed my server version
public Shooter(World world, Location sl, double xd, double yd, double zd, int stay, Material mat) {
new BukkitRunnable() {
int time;
public void run() {
this.time++;
if (this.time >= stay)
cancel();
MaterialData matd = new MaterialData(mat);
FallingBlock fb = Main.getWorld().spawnFallingBlock(sl, matd);
fb.setDropItem(false);
fb.setHurtEntities(false);
fb.setVelocity(new Vector(xd, yd, zd));
fb.getWorld().spawnParticle(Particle.BLOCK_CRACK,sl, 10,xd, yd, zd,0.001, Material.BLUE_STAINED_GLASS.createBlockData());
fb.getWorld().spawnParticle(Particle.WATER_SPLASH,sl, 10, xd, yd, zd,0.001);
}
}.runTaskTimer(Main.getInstance(), 0L, 1L);
}``` hier is my code
I see nothing imediately wrong there. You should update to use BlockData over MaterialData
okay i will try it
and add a debug sysout to make sure you code is actually being called
also didn't work
yeah i also printed the spawning location and they show that it spawns at the right location
but i cant see the blocks
did you print it IN the run task?
yes
what block are you trying to spawn?
a falling block Blue_stained_glass
do you have an api-version in your plugin.yml?
yes 1.19
unless another plugin cancels the spawn
bruh i know thats why im so confused cause i changed nothing at this code and it has been worked for over 2 month and when i changed to another server version it wasn't going fine anymore
mhm but then also the ingame summon would not work and that works
I can only comment on what you have shown. Nothing is incorrect in it.
Hello, things before // Bug here works but after, it doesn't. I have no errors or warnings :java public void GenNoteBlock(Block block, Instrument instrument, int octave, Note.Tone tone){ block.setType(Material.NOTE_BLOCK, false); NoteBlock nblock = (NoteBlock) block.getBlockData(); nblock.setInstrument(instrument); nblock.setNote(Note.flat(octave, tone)); PersistentDataContainer customBlockData = new CustomBlockData(block, this); // Bug here customBlockData.set(new NamespacedKey(this, "instrument"), PersistentDataType.STRING, instrument.toString()); customBlockData.set(new NamespacedKey(this, "octave"), PersistentDataType.INTEGER, octave); customBlockData.set(new NamespacedKey(this, "tone"), PersistentDataType.STRING, tone.toString()); block.setBlockData(nblock); getLogger().info(block.getX() + " " + block.getY() + " " + block.getZ()); }
I would still test it without other plugins interfering. Just to be sure
the weird thing is that it wont get spawned cause when i press f3 and b it also is not marked as existing but when i print the location, it is fine
How do i make so when you join my server the first time your group will be set to C?
Help me please
With luckperms, can i make so when a new player joins the group of the player will be set to C with luckperms
ask in luckperms discord
But im trying to make it in a plugin?
ask in luckperms discord.
Okay.
and see the luckperm doc https://luckperms.net/wiki/Home
Pleasseeee π«
Does <Entity>.getLocation().getChunk.getX() and .getY() return the chunk's x and y location?
for instance, if the entity was a chunk bordering 0,0, it would return 1 for both the x and y (assuming that the entity was at coords like 10, 10)
yes
Cool, thanks
Try to add a Sysout before the Bug here and see if that's printed. Maybe you are not actually running the version you compiled.
while working with mysql/hikaricp, are these necessary to have?:
config.setMaximumPoolSize(this.maximumPoolSize);
config.setConnectionTimeout(this.connectionTimeout);```
it's printed
I already made this
but after the bug here it's not printed
none of those sets can cause an issue. they are literally just PDC set calls
Sounds odd. Are you sure? Otherwise the only option would be that /reload fucked up your server. You could try a full restart. That only ever happened once to me tho
so add a sysout before block.setBlockData(nblock)
not printed
because it's after bug here
I printed after all lines
and it's after bug here
if you can sysout before getting teh PDC but not after then you must be getting an exception thrown which is hidden
Why does List<Player>.class cause Cannot select from parameterized type?
config.getObject("played-before", List<Player>.class);
Are you even testing what we saying or just assuming it won't work? You are quite quick with answering
with catch(Exception err) ?
yes
Type erasure during runtime. You can't do List<Player>.class. During runtime every List is a List<Object>
then how do I get a list of players from a config?
never store Players in a config
I'm launching my server
why?
you can not create a Player object
what type are UUIDs?
So, I do config.getObject("played-before", List<String>.class);?
List<String>.class does not exist
why are you storing a list of players who have played before?
starter kit plugin
doesn;t matter. Every OfflinePlayer object has a hasPlayedBefore() method
I'm trying to use getObject if I can, bcs I have a utility method that wraps around it
all you have to do is check that onJoin and give them a kit if false
Yes, but I'm setting an option to have the plugin see if they played before
makes no sense
In case they played before the plugin was installed
ah ok
Here's the description from the yml
#Are new players ones not seen before by the server or the plugin? (server,plugin)
#For example, a player who played on the server before the plugin was installed would not have been seen before by the plugin
#Players who the plugin has seen before are stored in played_before.yml
well
no exception, nothing...
tbh, configuring a starting kit plugin would nt be something you do halfway into your server life
Thats pretty much impossible
its safe to assume you dont wantto save player data if you move over to having kits
there is nothing.
No error but you are saying no code runs after that line
yes
Thats impossible
looks like it's possible
wdym
The only way it would be possible is if that line was locking the thread, but it can;t be as you are in a RunTask
well why would a server owner want to use your plugin
also, is here any way to use getObject with a List<String>?
or is getStringList the only way?
getStringList is the way yes
Get it and cast to List<String>
do I need AI enabled for navigation?
My plugin is built with Spigot 1.19.4 on my 1.14.4 server
so I'll check if the librairy is compatible with it
That just causes a warning Unchecked assignment: 'java.util.List' to 'java.util.List<UU>'
at least it isn't 1.8.8 this time lol
The lib you are using is written by Alex so I'd pretty much guarantee it is.
thats just asking for compatibility issues
do I need AI enabled for navigation??
somethings aren't compatible with spigot 1.14.4 x)
It's warning, not error, if you are sure it's string list you can just supress that warning
Alex is oine of the top devs in here. If he says it works on 1.14 it will
Yes
so what it is ??
But I'm going to publish it, so I'm not sure
I have no idea. What you are sayign is happening seems impossible without a race condition.
is there any way without?
If you are sure it's gonna be string list, no need to worry, it's just saying you are not checking beforehand
manually yourself
I have the answer : I'm cursed, my plugin too and my server too
Seems so
π€£
Someone might change the config manually later on to an int or something
I know it's unlikely, but it's a possiblility
for sure
Well, if it's supposed to be string list and user change it to int, I would say it's their mistake. Anyway, you can always check instanceof beforehand
ok, thx
um
this is a bug x)
why are you using CustomBlockData?
definitely not you not following java conventions
because it's what I saw
this block is a Noteblock so has a TileState and as such has it's own PDC
I was just looking a tutorial about that x)
wait, what error does Unchecked assignment: 'java.util.List' to 'java.util.List<java.util.UUID>' throw?
just apply to container
you don;t needs a CustomBlockData
If it works it's really cool
how do i make entity not look at things
if it works I'll boost the server you want x)
right now it is bugging out because i try to force it to look at a block but it looks are random thing
Nice
what server do you want me to boost ? x)
Thanks but no Thanks. Just boost Spigot if you want
already did x)
joking aside, thank you really much !
what issue are you having?
I can't make anything out in the Gif as I don't see what it's supposed to do
4 sides of what?
ok
I thought entities thrown into a portal maintained their velocity?
Have you debugged to make sure it's not early exiting on your Box overlapping?
Just because they spawned doesn't mean you didn't early exit, it just means the entity (falling block) was left alone and continued with it's original velocity
How to make a void generator in 19.3
Without using deprecated
What's the replacement for generateChunkData
with the code you have (it looks like) one block gets sent through the portal and should produce 5 at the destination.
4 if it has no velocity
correct
so its falling through on the overlap
Also test the block.getType() when it fails
just debug so we see which is causing it to fail
so it's never checking the box collision
seems an odd test as it shoudl never be the portal block
pretty sure that should be != AIR not testing for absence of a portal
this whoile math seems odd
π
i would use a playerinteractentity event to detect if i had fed a specific mob right?
!block.getBoundingBox().overlaps(boundingBox) is testing the modified locations BB to make sure it doesn't overlap teh current entity (shrunk) BB
yeah, I don;t even see what that test is for at all
eaither of them
yep, they seem pointless
I have a GitHub package and I am using it in a project of mine. That project has a GitHub action for building using the Gradle action. As the project uses the GitHub package, Gradle raises a 401 error when building the project. How can I fix that?
ok so the check is to prevent it forming before it's teleported
do you have local credentials
No, I guess
how do I set them?
this is my gradle.yml file
You said the sand appeared on your duper
thats the other side of the portal?
not where it falls
I see nothing π
yep add the check back then
Just loading thousands and thousands of chunks
portal
I don;t get why this code even has spawnFallingBlock
it already has a falling block entity
ok thi is where it's making your sand just appear one block in each direction and fall if (velocity.getX() == 0.0D && velocity.getZ() == 0.0D) {
that spawned block has no velocity, other than Y axis
it's just being moved to each of the 4 directions
probably
yep, give it a go
just use the last spawn
no velocity on them?
someone help me doing a single scoreboard
i cant :(
ive tried now with 3 apis and a scoreboard that i made
and anything works
idk why
You do get 5 blocks each block you send in though?
yep, they wouldn't be as it would be air
ah one sec, you are offsetting before you check teh location
Take the add off the end Location loc = event.getBlock().getLocation().add(direction);
each block shoudl be spawned 0.25 offset but that is causing you to test 1 offset
you add the actual offset in the spawn code
nothing spawns?
if you manually send one only one spawns the other side?
when you send a single through what errors?
if you stop nesting if statements i will π°ββοΈ
yeah I still have no idea why that test is even there
the fix for nesting is java if ((event.getTo() != Material.AIR) || !(event.getEntity() instanceof FallingBlock falling)) return;
good
π€
I may have to open my IDE
How can I prevent chunks from being unloaded in 19.# +
Add a chunk ticket
Exactly how it says
Mhm
its been so long I can;t even remember how to spawn an end portal
doh end is disabled on my test server π
odd. I filled out an end portal fram and no portal
oh
nope
what command?
Yeah the facing part is weird
I have never used that, ever
/setblock ~ ~ ~ end_portal
Well, maybe ~ ~-2 ~ if you donβt want to suddenly be in the end
I just got the end setup so I can test π
I did see some wierd triggering of it while I was building and it threw obsidian blocks
Every other plugin?
Yes
My plugin loads worlds
And I need to be able to load the worlds before other plugins
Yeah itβll mostly be on them to handle that tbh
Some of them load it themselves
plugin.yml
Although yours should be load startup so thatβll put it before most plugins
you can play with files
What you mean
i don't think you can load worlds in STARTUP
You can't
Besides default
So how can I make sure my plugin has control of the world management before others attempt to load them
autoSave(false)
I'm probably just gonna write a bunch of worldids to a file and delete those ids on startup
Any ideas? @tender shard
delete them in onLoad not onEnable. It runs before worlds are loaded
just check Bukkit.getWorlds().isEmpty() first so you don;t trigger on a reload
true but if this works onDisable then I'll be happy
When do we get onEnable(boolean reload)
haha compatibility go boom
onEnable(EnableContext context) π
So any ideas on mine?
not a compatibly problem if you just have 2 methods
you could make a tempfile that stores disable epocj
and on enable, if the epoch offset is less than 2 secs
magic
Lol
There's loadBefore in plugin.yml
Can I disable the F3 menu with mods?
Yes, I know, does forge have a discord server? thank you
You can reduce what is shown on it with a gamerule
But thatβs all you can do server side
What's that?
What does that do?
It hides stuff like coordinates
nvm
@last temple I can't get it to do anythign close to yours
However it only HIDES them
What about the piechart?
They are still sent to the client
Hello! Does anyone know why when I edit the name in WrappedGameProfile (PLAYER_INFO), it doesn't change in the tab? Perhaps I need to edit a different packet?
mans using a 4080 on 1080p
This event is for when the block lands not for portaling
The fps/bar chart was shift + f3 iirc
Well if there was a hacker, I don't think he would be using the piechart anyways π Thank you though
So wait no pie chart right?
but I usually always code on my main monitor which is also my gaming monitor
so 2k 144hz for now
I don;t get how you are getting dropped blocks in the end
Its a falling block so it forms when it lands
Well in smp servers, people use it to find hidden bases
Since it just shows the client's mspt per section
That would mean that the amount of (block-) entities has a serious impact on performance
damn 2k 144hz is like 250 bucks but if I want 4k I gotta pay 1k$
What?
For the pie chart to be usable for tracking down bases something must produce severe amounts of clientside lag
No I meant, if there are mob spawners near the person
it does form instantly but it always quits because of that crazy portal test
not end portal
Even then hard to make use of it unless you have a very keen eye
Most smps suffer from this issue
Are you sure you don't mean the more usable debug info (e.g. entity count in view)?
Single-multiplayer
You know you can specific the pie chart to show certain things
Against debug screen?
It only shows render times basically
I don't know what arcane magic you are pulling off there unless for some ungodly reason mob spawners have their dedicated category (highly doubt so given that that should be serverside only)
I mean who cares if you find a hidden base if itβs protected
^
It's normal survival
then what are you doing in #help-development
To make something to disable piechart
They can just use a cheat client anyway?
im being exposed
And if the concern is that people are too dumb to claim their shit there is https://github.com/Geolykt/Presence
Yes I know, I just want to disable it for normal players
But cheating is against the rules
No it's a custom client
Everyone knows people canβt break the rules
Excatly
Meh, easy to circumvent if you are technical enough
Server checks what mods you join with
But if you have a custom client you can just patch out the pie chars anyways
Yes, that's why I asked with mods at first
Itβs easy to bypass a mod check
skids hate this man
Like how?
I just realized that I'm assuming more competence
Just make the mod lie about its name
still workign on it
No the mods have custom code that sends info to the server
?whereami
They probably are just using plain fabric or plain forge which is just π
You can easily RE that logic and send it yourself
Yes, but why would they know that it sends it?
What's recaf?
how do i power trip
Modern java bytecode editor
Oh so they can get the code in the jar file?
Yep
Can someone link me to where I can find the source for this method: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/World.html#getNearbyEntities(org.bukkit.util.BoundingBox)
In intellij it just takes me to the interface, not the actual implementation
Yes but can't I detect that there are more mods then there should be?
Or less?
Or if the files just don't match?
CraftWorld most likely
You are being too paranoid
Well I'm not trying to work on a client for ages just for some dude to insert his hacks in it
I don't care if a master hacker manages to get thru them all
I don't think a 8 year old kid that installed random hacks is gonna pass it
treadmill
We need a layer 0 anti cheat for minecraft
I just want basic protection

Snapshot 23w18a: added denuvo
i'd rather drink bleach
Aren't XXw18a snapshots the april fools snapshots?
how would that even woirk
What are just basic stuff I can add to stop kids from inserting hacks easily?
File checking good enough?
public void onPluginMessageReceived(String channel,Player player,byte[] message) {
if (! channel.equals("BungeeCord")) {
return;
}
ByteArrayDataInput in = ByteStreams.newDataInput(message);
String subchannel = in.readUTF();
if (subchannel.equals("PlayerCount")) {
ServerSelector a = new ServerSelector();
a.PlayerServerCount = in.readInt();
}
}```
First one to say ?learnjava is a meanie
But really, i dont undestand message channels
Where do we sign up
Basically you'd need to AOT compile minecraft, then insert denuvo ontop
I donβt see the point of forcing players to use a custom client just to play your server
public Integer PlayerServerCount = - 1;
What part don't you understand
I guess this isnt ok...
I dont know why the PlayerServerCount isnt being set
Prevent dumping of classes, disable dynamic agents, make sure there are no javaagents on the classpath, etc.
i don't think so
toArray() returns object[]
isnt castable to String[] ?
Alright, thank you
Is there an error? Does the reading code match what is documented? I can't remember if server name is somewhere. Is your method being called?
Noerror.
choosemetaarray.add(ChatColor.RED + "There is a total of " + PlayerServerCount + "players online!");
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF("PlayerCount");
out.writeUTF("survival");
if you want I can send full code
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
yes i know, i dont need the server nameinput though
oh really?
Yes
String ignore = in.readUTF();
Reading something advances the pointer forward
do you think thats all?
You donβt even need to assign it to a variable
If message received is being called, then probably
No, look at toArray(String[]) or just use list, probably better than array
Yah, but the api needs array
same problom
ill send full code
https://paste.md-5.net/uwesafedis.java < Server selector gui
public ItemStack storage(String s) {
is where the item is
line 114
You make a new serverselector variable and then do nothing with it
where?
ServerSelector a = new ServerSelector();
a.PlayerServerCount = in.readInt();
?
Yes, it's never put on an itemstack
Line 117, Server selector GUI
Plugin messages are asynchronous so putting them back into the server is difficult
That's a different instance because you used new
public Integer PlayerServerCount = - 1;
Best approach is probably to request player count every 30 seconds in a scheduled task, store the count in a field, then use that for the gui
ah
Where will this scheduledtask be located?
and how will it recieve the information
onEnable it will send request to bungee (if a player is online)
BRO FINALLY MY SCOREBOARD WORKED
The existing receive method can then update field when it gets response
and just to verify, if (subchannel.equals("PlayerCount")) {
is right?
Line 40 of main
Think so
alr ill be back when I finish
Err, when i update my scoreboard, like, disapears and appears in like, 2s and stuff, why?
no 2s like instantly
lemme record
just send the code
@last temple This seems odd. In your gif you are getting dropped sand blocks not falling blocks
how? that doesn;t happen unless they fall on torches
They're not running spigot
oh they are not?
hi md_5 bestie
well it shoudl be easy to simulate but not replicate
as you can see the List is in red, indicating the variable is not registering the value
maybe bc im accessing the config constantly...
^
wdy
also I thought .getStringList returns String[]?
what
no, List<String>
o
getStringList
But isnt it bc im accessing in the runnable?
lemme try
Nah it wasnt that
@wary topaz, what do u suggest
i do not understand what u said
didnt*
I want to get a list of entities that are either in the same chunk or one of the 8 neighboring chunks to an entity.
Would it be faster to create a BoundingBox that contains all of those chunks, then use world#getNearbyEntities(boundingBox)
Or (assuming I already have a list of chunks) iterate over the chunks and call myList.addAll(chunk.getEntities()) for each chunk
Obviously I could benchmark it, but I'm hoping that someone might know, as I don't have a benchmark setup for this atm π³
idk
If you have the chunks, use the chunks
public ServerSelector(Plugin plugin) {
this.plugin = plugin;
Objects.requireNonNull(plugin.getServer().getPluginCommand("serverselector")).setExecutor(this);
}```<ServerSelector
```public Integer survivalPlayerCount = - 1;
new ServerSelector(this);```< Main
@last temple knowing that they don;t use Spigot are you wanting to continue with this? As in Spigot it would be much easier to do in the https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityPortalExitEvent.html
entity portal exit is Spigot
why would you?
Who's to say
Probably, paper gives you an error for everything
?whereami
I don;t write anything that doesn;t run on Spigot
paper is weird
but i love spigot
please, elaborate
WEIRDO ANIMATIONS
Are you creating a new scoreboard each time?
ah right
https://paste.md-5.net/qagiyegeju.cpp ig im not
wanna see the 2 other methods?
Yeah the update ones
?paste
What DI lib do you guys prefer for spigot plugins?
Koin, Guice, spring, or otjher?
none
I just pass the instance myself
I never understood guice etc, it seems to just create new instances. using it properly seems more complicated to me then just not using it
just make a constructor
whats the issue
Code:
where are you creating your boards at
are you caching them correctly as in the docs of FastBoard
any clue why I get this warning in line 31? https://paste.md-5.net/atofijitud.cs
no clue that looks like a stupid asf warning though lol
the array list has stuff added but never used anywhere
Sometimes the ide is smart :p
ok but this really makes no sense
I am checking if it's assignable, how is that an unchecked cast
for (float *itPtr = &data[0], *endPtr = itPtr+1000; itPtr != endPtr; itPtr += 4) {
asm(
"mov rax, %[itPtr] \n"
"movaps xmm0, [rax] \n"
"mulps xmm0, xmm0 \n"
"movaps [rax], xmm0 \n"
:
: [itPtr] "rm" (itPtr)
: "rax", "xmm0"
);
}
oh yeah
SIMD operations
4 multiplication instructions at one cycle atomically without any multithreading
For those who dont know what are SIMD instructions, they're basically instructions that lets you execute the same operation for multiple data at the same time
in my case
I've managed to crunch 1000 iterations into 250
but I'm checking isAssignableFrom, it is not "unchecked"
I did check it with isAssignableFrom π₯²
Generics are mean
I think i am https://paste.md-5.net/uharoyemix.cs
nah the warning is pointless
na
its the (Class<Type>) castable
cuz type erasure
How to get the type of death?
Like in PlayerDeathEvent how do i differentiate between a player and water lets say
I am calling SomeClassObject.isAssignableFrom(AnotherClass), and only cast SomeClassObject to AnotherClass if it's true, so it can never happen that this causes a ClassCastException
btw can I always reuse the same Gson instance, or do I always (or sometimes?) create a new instance?
the javadocs unfortunately don't tell me anything about it
you can reuse or create a new one
alex yes but
reflection is runtime
static analyzer doesnt care
nor does compiler
yeah that is the issue, javac should be able to see that I called "isAssignableFrom"
I mean, it also realizes when you do instanceof on normal object
then why can it not realize that I called isAssignebleFrom on the class i'm gonna cast
instanceof doesnt work on higher ordered types
and isAssignable still doesnt prevent type erasure
but my GlobalEvent class isn't generic
but java knows that it must work, otherwise it'd complain
String and GlobalEvent are entirely different
as said and it does not matter how you look at it
its an unchecked cast, because it cannot be checked accurately in regards to the higher ordered types due to type erasure
and yes u have reifiable and non reifiable types
but thats also decided during runtime
new Consumer<Map<String,Object>>(){public void accept(Map<String,Object> o){}} would create a new type
where Map<String,Object> is stored during runtime

anyone who has some code for
generating 3d Pentagon with rotationZ and rotationY
i can't do math
i will probably quit and just try later 
what the fuck was I thinking when I wrote this
cant you just use the parametric equation for a regular polygon and change the initial value of theta?
then you can have any polygon you like
even worse is i want it to be scalable
width, height, depth
i did it with a circle and a cube but now the real challenge is here
?paste
this is my working code
i'm definitely not ready to become a 3d graphic developer that is for sure
so a dodecahedron
wait is that called a Pentagon Ball?
woah
that is probably why chat gpt couldn't do it
i said it wrong
what is a checked cast then?
A regular dodecahedron or pentagonal dodecahedron is a dodecahedron that is regular, which is composed of 12 regular pentagonal faces, three meeting at each vertex. It is one of the five Platonic solids. It has 12 faces, 20 vertices, 30 edges, and 160 diagonals (60 face diagonals, 100 space diagonals). It is represented by the SchlΓ€fli symbol {...
thank you md_5 math genius
terms that get cast to non higher ordered types
like
void x(Object o) {
List<String> s = (List<String>) o;
}
this is an unchecked cast, or rather "uncheckable"
whereas
void x(Object o) {
String s = String o;
}
is checkable
specifically String in the higher ordered type is uncheckable due to type erasure
however
like if u were to do List<?> s = (List<?>) o or List s = (List) o then IJ wouldnt complain
first one due to that the generic type can be anything, so no "uncheckability", second one is due to that there is no generic type, aka a raw type
(and then again, no "uncheckability")
but what does the term "check" refer to? I can check whether a Class<?> object called "clazz" is instanceof Class<String> by checking whether clazz.isAssignableFrom(String.class) returns true, or not
but why does it work then
rather
isAssignableFrom checks it, but not in the way you think
like
alex
its a normal java method
ofc I cannot check whether List<String> is instanceof List<Integer>, that I know. But I have a class OBJECT
its not a special semantic like instanceof
jetbrains ide could have considered isAssignableFrom to be a special case scenario
How can I send players to other Bungeecord servers?
where they would regard it as a special semantic
yes that's what I meant the whole time
but they didnt
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
think that was an issue brought up even
yeah they are unfortunately very slow in handling any suggestions
since we have some special stuff like from annotations, reflective lookups etc
thanks
jeffmedia ide when
I have tried to do IJ plugins a few times π
but their docs are so shitty
it's hard to believe
sometimes I wonder, how do people manage to create IJ plugins in the first place
I mean, where did they get the required info from?
because I seem to be too stupid to find it
u're not alone :.)
literally me when I tried to find some info of how to develop PHP extension in C
literally no proper docs for that, except for some github projects showing how to setup the barebones without actuallly explaining a lot
like wtf is .m4 macro language
I've found an article deep in the web from 20 years ago that clarified that a little bit but still
sounds abysmal and ludicrous
Programming Support Tools: DIGITAL UNIX Versio
n 4.0D
if not this
i would've struggled more
yeah also apache velocity lmao
maven uses it for archetypes but there's like, only one website that has ANY information about it
how exactly am I using this?
?paste
anyone have suggestions on how to improve this code. Essentially the goal is to process a class like this
Object Code
https://paste.md-5.net/rufinucaxi.java
Processor Code
https://paste.md-5.net/umucuzezif.java
Same here
I'm looking to clean up the processor code I feel like I'm missing maybe some improvements that could be done especially dealing with the nested object
isn't it all explained there?
- If you are repeating the same code over and over again you are doing something wrong. It can be reduced
case "gsgp" -> {
choose = new ItemStack(Material.GRAY_STAINED_GLASS_PANE);
choosemeta = choose.getItemMeta();
if (choosemeta != null) {
choosemeta.setDisplayName(" ");
}
choose.setItemMeta(choosemeta);
}
case "psgp" -> {
choose = new ItemStack(Material.PURPLE_STAINED_GLASS_PANE);
choosemeta = choose.getItemMeta();
if (choosemeta != null) {
choosemeta.setDisplayName(" ");
}
choose.setItemMeta(choosemeta);
}
case "bsgp" -> {
choose = new ItemStack(Material.BLACK_STAINED_GLASS_PANE);
choosemeta = choose.getItemMeta();
if (choosemeta != null) {
choosemeta.setDisplayName(" ");
}
choose.setItemMeta(choosemeta);
}
``` the only difference between these 3 switches is a material
extract all of that code into a method
I searched for a yt tutorial, I am sorry for the 2nd question, was dumb
next don't hard code all of your text its better to put it into configs
just scroll to the top of the page and then you see how everything works
how can I do that for a inventory?
ServerSelectorInventory.setItem(0,storage("gsgp"));
ServerSelectorInventory.setItem(1,storage("bsgp"));
ServerSelectorInventory.setItem(2,storage("gsgp"));
ServerSelectorInventory.setItem(3,storage("bsgp"));
ServerSelectorInventory.setItem(4,storage("gsgp"));
ServerSelectorInventory.setItem(5,storage("bsgp"));
ServerSelectorInventory.setItem(6,storage("gsgp"));
ServerSelectorInventory.setItem(7,storage("bsgp"));
ServerSelectorInventory.setItem(8,storage("gsgp"));
ServerSelectorInventory.setItem(9,storage("bsgp"));
ServerSelectorInventory.setItem(10,storage("gsgp"));
ServerSelectorInventory.setItem(11,storage("psgp"));
ServerSelectorInventory.setItem(12,storage("gsgp"));
ServerSelectorInventory.setItem(13,storage("psgp"));
ServerSelectorInventory.setItem(14,storage("gsgp"));
ServerSelectorInventory.setItem(15,storage("psgp"));
ServerSelectorInventory.setItem(16,storage("gsgp"));
ServerSelectorInventory.setItem(17,storage("bsgp"));
ServerSelectorInventory.setItem(18,storage("gsgp"));
ServerSelectorInventory.setItem(19,storage("psgp"));
ServerSelectorInventory.setItem(20,storage("survival"));
ServerSelectorInventory.setItem(21,storage("psgp"));
ServerSelectorInventory.setItem(23,storage("psgp"));
ServerSelectorInventory.setItem(25,storage("psgp"));
ServerSelectorInventory.setItem(26,storage("gsgp"));
ServerSelectorInventory.setItem(27,storage("bsgp"));
ServerSelectorInventory.setItem(28,storage("gsgp"));
ServerSelectorInventory.setItem(29,storage("psgp"));
ServerSelectorInventory.setItem(30,storage("gsgp"));
ServerSelectorInventory.setItem(31,storage("psgp"));
ServerSelectorInventory.setItem(32,storage("gsgp"));
ServerSelectorInventory.setItem(33,storage("psgp"));
ServerSelectorInventory.setItem(34,storage("gsgp"));
ServerSelectorInventory.setItem(35,storage("bsgp"));
ServerSelectorInventory.setItem(36,storage("gsgp"));
ServerSelectorInventory.setItem(37,storage("bsgp"));
ServerSelectorInventory.setItem(38,storage("gsgp"));
ServerSelectorInventory.setItem(39,storage("bsgp"));
ServerSelectorInventory.setItem(40,storage("gsgp"));
ServerSelectorInventory.setItem(41,storage("bsgp"));
ServerSelectorInventory.setItem(42,storage("gsgp"));
ServerSelectorInventory.setItem(43,storage("bsgp"));
ServerSelectorInventory.setItem(44,storage("gsgp"));
``` if you are doing something like this instead of a loop you need to look at configs as well
mk
thank you very much :D
I'm not quite, the responsible kind when it comes to json files
could I have an example? Not a spoon
your ide should have json syntax highlighting and linting
if it doesn't there might be a plugin
{
"key": "value",
"another-key": "another-value"
}
``` json just looks like this
Alright thank you!
for an inventory you could make a json like this
{
"title": "&4Inventory Title",
"background": {
"name": " ",
"material": "RED_STAINED_GLASS_PANE"
},
}
``` and so on
honstly since you are are newer it'd be easier just to use yaml
since its already built into spigot very easy to use
bump
Any more details about what this is for?
Mapping Objects from a database
generally that's how it works
Its got a nesting structure due to the emphasis on using NoSQL
JSON structure basically which makes nesting objects not that uncommon especially in a data object like a Player or Entity
yeah basically just formatting objects from BSON, the generic retrieval API i have setup kinda works like Bukkit's Config API so its super easy
what's main line 54?
serverSelector.survivalPlayerCount = in.readInt();
ah ok. on first glance, looks fancy, but I don't got any suggestion lol
public Inventory ServerSelectorInventory = Bukkit.createInventory(null,45,ChatColor.YELLOW + String.valueOf(ChatColor.BOLD) + "Available servers!");
public Integer survivalPlayerCount = - 1;
Plugin plugin;```
why do you readUTF() in that part?
yeah the most GSON like portion is my TypeConverters which essentially function similarly to GSON's
https://github.com/Y2K-Media-Creations/Raven/tree/master/api/src/main/java/sh/miles/raven/api/conversion
you don't even save the value, you just discard it. get rid of that useless readUTF()
I thought about that too, but md_5 said to keep it
the first readUTF(), where you check whether it's "survival", is fine. but the next one is useless and reads the int. now when you wanna read the actual count, you're already at the end
o
I think md_5 misread your code, or you misunderstood him
alr ill try the new code
calling "readWhatever()" without saving it, is in 99% of cases wrong
what event is being fired when a player hits an interaction hitbox?
wdym with "hit"? left-clicking / melee attacking it?
PlayerInteract(At)EntityEvent
it says thats only for right clicks
oh my bad, you are right
lemme check
what's the name of that entity class again?
InteractionDisplay or sth?
ah yeah
but you can beatifully combine them into a interactable scene I have deduced
hmmm try the PlayerInteractEntity nonetheless pls
yeah that was my second option aswell since you can configure it to make a hit sound and what not
almost ther
what are you trying to do btw? get the number of players online on the whole bungee?
you just need to stop making a new server selector each time
on the survival server
store it as a field
wdym each time?
oh md do you know which event is fired when hitting an interaction?
line 55, with new
@sullen marlin do you know which event is called when someone left-clicks an "Interaction" entity?
idk, presumably an interact event
PlayerInteractEvent?
the javadocs for PlayerInteract(At)Entity event claim it's only for right-clicking
alr illtry it
but that wouldn't give you the entity that was clicked
so I doubt it's that
it is,
how? where?
if (event.getItem == null)
:?
that's jsut the item in their hand
also event.getPlayer().getItemInMainHand()
oh wait you mean entity
erm items are not entities
well
Items are lol
but getItem() is not an item, but an itemstack
no clue what you on about. I thought you wanted to detect which "Interaction" entity a player left-clicked, right?
PlayerInteractEvent will NOT work for that, it doesn't have any method that returns an entity (besides the player itself)
anyways ill test it out later since I dont have 1.19.4 set up atm but I am fairly certain the entityDamageEvent might be the one
but I was hoping someone in here might have just known
yeah but that wouldn't allow you to check WHERE they clicked it
where I dont care about that
the fuck you mean where they clicked it
you can only check if they interacted with it
its still -1
well if you don't care about where, then go for "EntityDamageByEntityEvent", check if damager is instanceof Player, and getEntity is instanceof Interaction
that should definitely work
show your current code again pls
I thought maybe there would be a separate event for it that I didnt know about
thanks for your help btw
https://paste.md-5.net serverselectorhttps://paste.md-5.net/kajinuzuxe.java main
I also would have thought it, idk π₯²
what the heck is this
public ServerSelector(Plugin plugin) {
this.plugin = plugin;
Objects.requireNonNull(plugin.getServer().getPluginCommand("serverselector")).setExecutor(this);
}
its a way to get the plugin
these 1.19.4 additions will really reshape public servers, especially minigame servers, when all the libraries have caught up ofc
implying people will stop supporting 1.8
NOO
lmao
me love 1.8
well that too, but I have given up that cause
im just saying there are about a 100 hologram libraries or smth that can benefit greatly from the new additions xD
but if it aint broke, dont fix it
so π€·
any idea?
Log4j would have been a perfect way to get rid of 1.8 π₯²
Wdym?
I sent you the updated code
s
Gimme a few minutes, laptop battery just died
mk
Its gotta charge a few minutes before it boots again
Oh right you sent this
I wonder what thatβs supposed to do
You just create objects and then throw them away?
Why
@tender shard the constructor for those objects register themsevles as commands
Damn that is nasty
its bad design
it saves the plugin variable
Yes, very bad
which is very useful
well that aint the problom lol
you can do that by registering it the normal way too
what you're doing is terrible
how else am I gonna get the pluginvariable
Wdym
learn Java π€
Look ifit works for me it works for me
okay so I'm back
public void onEnable() {
getCommand("blah").setExecutor(new MyCommand(this));
}
public class MyCommand {
private final MyPlugin plugin;
public MyCommand(MyPlugin plugin) {
this.plugin = plugin;
}
}
there, that's how it's typically done
you still have the plugin variable, and the executor is still set by the plugin (good practice when not using a library)
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
yes, its literally di
Idont need it
u dont need what
the dependency injecter
why do you refuse to do things properly
bro you literally use DI in your ugly code
I dont need it in the way you do it
a command should not register itself, that's not its responsibility


