#help-development
1 messages · Page 1809 of 1
I don't waste my time on that.
LMAO
but your wasting your time with nms much more
pretty sure it's not a thing in my version
Read above messages.
i hope they change the nms methods every release for now 🙂
just to make them suffer xD
yes
I use reflection so I just get the method/field names 😉
lol

what if they change either class names or field names?
but if the methodname changes every version you will suffer
if they need yes
Not really. Only time I suffer is when @sullen marlin fucks up the api like usual
btw the only constructor i have is this one
public PacketPlayOutRelEntityMove(int var1, byte var2, byte var3, byte var4, boolean var5) {
super(var1);
this.b = var2;
this.c = var3;
this.d = var4;
this.g = var5;
}
cant remember that the api was more broken more then nms versions or at least broken at all
i guess that the int is the entityid and the bytes are the rel movement
but what's that boolean
yeah... entityid, xdif, ydif, zdif and "should entity dismount" or "isOnGround" dont know
only for events and this only when minecraft updates (?
ah kk
don't think it matters as long as it's a fake entity
still cant remember having problems with events after update
Too old! (Click the link to get the exact time)
not problems... my only recent example was skeleton freeze not sending a event when "mutate" to stray
a) the evidence suggests your code is 'fucked up' more than the API
lmao who made that
b) How would I know if you don't make bug reports
dont know ... but someone posted it here before xD
lmao
The most useful website
anyways how should i convert a short to the byte needed for the constructor?
a) evidence shows the method functions.
b) I'm not gonna waste my time making bug reports. I'm not here to test spigot Its just a server software thats used.
what version do you use ?
ahemmmm
lol
you're literally here asking why the method DOESN'T function
your method
In 1 spot. But functions every where else and in every other version mentioned
@quaint mantle I know you said you wanted to rest but that was like 10 hours ago, sorry if I'm interrupting you. However nothing I tried worked and the thing you told me to look into also didnt work
ok cool... i dont know what the calculation was back there ... probably just cast to byte then ...
lemme see what protocol.vg says
smh fixed point numbers
or whatever they call them
whats the exact issue?
fixed point? Not floating?
?paste
do i multiply my number * 32 to make it a fixed point number
Whats fixed point number
something mc protocol uses
code looks fine (though is -1 necessary?), whats the issue?
https://paste.md-5.net/opaliyuvar.java
So I have this script, however now I have to stand on said block in order to get the Light_Blue_Dye. However The thing is that players fly into rings (Yes solid rings, you dont go through them) But now if they fly against it they have to wait until they reach the botttum of the ring to actually get the Dye. How do I make it so that as soon as the player touches the Glass while for example flying into it with an elytra, the if statement still runs?
The person I was talking to told me to look into Interact Events however I wasnt able to figure it out
you'd need to check all the blocks in a nearby area
you could go for blockfaces, check if the player suffocates inside the block (if they take damage from it)
or if you know the location of the blocks, check the distance to the players location
Player player = event.getPlayer(); // get the player very useful comment
is this right for a recipe? does every .recipe call refer to a line in the crafting table?
That could work, could you perhaps show how? I have no idea how that would work
yes yes
theres like 700 rings so I'd prefer not getting the location for every single one-
i mean if they are rings, are the players supposed to actually touch them or fly through?
currently not, i am not home.
Currenctly I'm just putting a barrier of said block behind the ring since flying through them seemed almost impossible, since someone said I'd have to give every single ring a WG region then when that WG region is passed, it gives a Dye.
is it possible to make it so an anvil gui can support an infinite amount of characters?
there are many ways to accomplish this
...like?
like md said, check the blocks in a nearby area, give every ring a core location,...
so give every 700 rings a core location ah great
well you've already hardecoded the teleport destination?
are all 700 rings meant to teleport to the same spot
no definitly not
but if you can go through them, I dont want to teleport
it was just so the player doesnt get stuck inside of the ring from the way I'm handling things right now.
so you want it if you hit the edge of the ring you get teleported back?
Okay so basically. If you go through the ring, depending on the ring color you get a different amount of Light_Blue_dye. If you touch the ring ITSELF you get teleported back to spawn.
I'd store the locs in a hashset
ok touching the ring is relatively easily - check 0.5 block every side of the player or something
going through the ring is harder, but I really would suggest storing the centre of the ring somewhere
^blockfaces
and then just checking if they move with X blocks of the centre
Hi, I would like to know if it's possible to get map canvas from a map item whitout setting a new renderer ?
As someone who has never worked with Java before this seems very hard
then you should start with simpler things
I would just precalculate all locs within the Ring and push it in a set. If afterwards the Location of the Player matches one of the locs in that Set the Player has gone through it. Just don't forget to round to integers beforehand though
Thats what I was doing...
aka the script I have right now
Issue is that with 700 rings this could be very memory intensive
ye my pc doesn't have a lot of memory so that's a bad idea
But at least it has a big O of 1
my server has like 2.5gb
I mean 10k-ish loc objects should only be a couple of megs
So not too much of an issue given that we have absurd amounts of Mem nowadays
the map and your onMove spam will probably be more of an performance issue
Listen, I'd love to listen to your ideas and all. However at this moment I dont have the skills to do things like that and my computer also wouldn't be very happy about it. I also don't plan on fully learning Java as normally I don't even make my own plugins. It's just that I'm making this one myself.
Which is why I proposed a O(1) impl
but this doesnt have anything to do with the memory
MC is CPU bound, so Mem can be disregarded usually
Of course, no insane allocations should be performed
pff tell me about it. I got an i5-8400 and just simply playing minecraft already uses 60-ish percent CPU
and my cpu aint even that bad
heck even fortnite uses less cpu
To be honest, it is a wonder that it does not use more
I'm struggling to figure out where an implementation for getDefaultAttributes would go
It's not really bound to ItemMeta, but I guess that is the logical place for it
Actually no that doesn't work, because ItemMeta does not have reference to the item itself
Reset what
player.setPlayerTime
how do i send a request to "url" then get the json details of the request
ItemStack has access to the Item reference, but it's not an abstract class
anyone know why when I run my custom jar file version of minecraft it just replaces it with a default one?
hi, i'm tryna learn to use streams and i was wondering, showingTo.stream().filter(OfflinePlayer::isOnline).toArray(Player[]::new) would this work to make a list of offlineplayers a list of players if the offlineplayer is online?
my bad
i have a list of offlineplayers
i want to filter online players
and make an array out of them
filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer).toArray(Player[]::new) then
But it was mostly correct
thanks
Helloo, can anyone help me with my tree populator? i really don't know how to use the new api to make one and there aren't a lot of guides out there on it, so I thought maybe someone here would know what's wrong with my code...
@Override
public void populate(@NotNull WorldInfo worldInfo, @NotNull Random random, int chunkX, int chunkZ, @NotNull LimitedRegion limitedRegion) {
if(random.nextBoolean()){
int amount = random.nextInt(4)+1;
for(int i = 1; i<amount; i++){
int X = chunkX*16;
int Y = 1;
int Z = chunkZ*16;
for (int i = worldInfo.getMaxHeight()-1; limitedRegion.getWorld().getBlockAt(X, i, Z).getType() == Material.AIR; i--){
Y = i;
}
Location location = new Location(null, X, Y, Z);
limitedRegion.generateTree(location, random, TreeType.CHORUS_PLANT);
}
}
}
is it possible to make it so an anvil gui can support an infinite amount of characters?
how can I set the velocity for entity so that it moves in the direction the player hit?
what issue are you having
doubt it, the client will have a limit
the server straight up doesn't start lol, it just freezes at startup and gives me this warning
>.... [22:16:29 WARN]: Unable to find spawn biome
like that warning is so common but with this it just freezes idk why,,,
I dont think the new api should be much different to the old one for populators
did the old code work
not really, using the old code crashed the server and gave me an out of bounds exception
here's the old code if it helps at all
@Override
public void populate(World world, Random random, Chunk chunk){
if(random.nextBoolean()){
int amount = random.nextInt(4)+1;
for(int i = 1; i<amount; i++){
int X = random.nextInt(8);
int Z = random.nextInt(8);
int Y = 1;
for (int j = world.getMaxHeight()-1; chunk.getBlock(X, j, Z).getType() == Material.AIR; j--){
Y = j;
}
world.generateTree(chunk.getBlock(X, Y, Z).getLocation(), TreeType.TREE);
}
}
}
for (int i = worldInfo.getMaxHeight()-1; limitedRegion.getWorld().getBlockAt(X, i, Z).getType() == Material.AIR; i--){
bit concerned youre accessing the world directly, you should avoid getWorl
otherwise not sure, debug your code and see whats executing
Are block populators constrained to the single chunk or do they give you access to a 3x3 area like vanilla?
in the process of upgrading reflection i got a little confused about what is remapped and what isnt
is everything obfuscated now? including fields and methods?
or is it just fields like 1.17
ill try not to use it then, thanks for the help
not classes 😉
Not yet
my pr to implement what i wanted to implement went stale and i unfortuantely cant afford the time to make any PRs right now 😔
how can I give an entity a vector to have it kick back in the direction the player hit it
just confirm, there are absolutely no methods that have kept their 1.17 mappings
im looking through the mappings files and it doesnt seem that way, just wanna make sure someone can verify!
Use the players facing vector
event.getDamager().getFacing().getDirection(); like that?
I believe so
im trying to use https://www.spigotmc.org/resources/worldguard-events.65176/ i added the maven dependency but when i start the server i get this error failed to register events for class com.jere.regions.RegionHandler because net/raidstone/wgevents/events/RegionEnteredEvent does not exist. how can i fix this?
i dont have it on my server and it is in the depend section
Nope maven tell you code use the plugin code but not running the plugin
(bad explanation...) You still need add the plugins what your use in your plugin in the server
alright thanks
hmm, that gives me equal x, y or z, I mean vector looks like that 1, 0, 0 or 0, 0, -1
Try getEyeLocation.getDirection
ok, it works, but what if damager isn't the player?
All mobs have a getEyeLocaiton iirc
Projectiles don't, you could try just getLocation
yup, getLocation get Direction works, thx!
Hey MD any guidance as to where I would implement a getDefaultAttributes method? (For items)
dude it took me a good hour just to figure how to show a packet armorstand properly to a player
i cry
try cast damager to livingentity and see if they have the direction vector and for everything else just do the location thing
hey I am a person that is completely new to coding and I am interested in learning how to make a plugin with eclipse, can anyone here teach me the setup for it?
I just need to get to he point where I can make a hello plugin
why can i not use
if (b = null) { b is a boolean
a primitive boolean or an object boolean?
also you are trying to set the boolean to null in an if statement
im trying to see if the boolean is or isnt set
It’ll always be set
not if he is using the boolean wrapper
is it a primitive or its wrapper
im getting a boolean from the config section
wrapper
if you use getBoolean it returns a primitive
doesn't it
it's gonna default to false
so you want to check (b == null) if the boolean is null, and not set (b = null) it
no i am getting a boolean from config but it can be null so i want to check if it is null
read again
Anyways boolean variables cannot be null nor the return value of boolean methods
so if its null itll be false?
i sent packet wrong and armorstands went whoosh
Same with all other primitive types
even if the boolean isnt set in the config?
You’d have to check with ::isSet
as he already said, he is getting the wrapper of the primitive type boolean which can of course be null
ah ok thanks
or does the config always return a Boolean?
::getBoolean returns boolean not Boolean, even if you were to box it it’d still not be null 
boolean better got hands if he wants to box
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/configuration/ConfigurationSection.html#getBoolean(java.lang.String) ah, yeah. he just said the wrapper
declaration: package: org.bukkit.configuration, interface: ConfigurationSection
ok so it took me 2 hours but finally, my armorstand animations are smoother than ice
so if i used Boolean b = configsection.getBoolean(dir); there would be no way to check if the boolean actually exists?
Cannot resolve symbol 'isSet'
thats a config section?
what?
it says
Checks if this ConfigurationSection has a value set for the given path.
if (configsection.isSet(dir)) I think you mean?
yeah thanks
someone explain this to me
[ERROR] Could not load 'plugins/0.0.3.1.25.1.snapshot.jar' in folder 'plugins'
org.bukkit.plugin.InvalidDescriptionException: commands are of wrong type
at org.bukkit.plugin.PluginDescriptionFile.loadMap(PluginDescriptionFile.java:946) ~[spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52]
at org.bukkit.plugin.PluginDescriptionFile.<init>(PluginDescriptionFile.java:232) ~[spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52]
at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:159) ~[spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:133) [spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugins(CraftServer.java:292) [spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.reload(CraftServer.java:739) [spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52]
at org.bukkit.Bukkit.reload(Bukkit.java:535) [spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52]
Send your plugin.yml
ok
main: ledmans.miplugin.MiPlugin
version: '0.0.3.1.25.snapshot'
name: MiPlugin
authors: [ ledmans ]
commands:
paintball
ok
morning @ivory sleet
If I want to make an mc plugin for 1.17+ do I have to use java 16? Or can I just use java 8?
You can use 8 if you don’t use any NMS
Eh what is an NMS?
net.minecraft.server
how to decompile zelix klassmaster 15
so my plugin is too big to upload to spigotmc whats good extrnal downloading site
literally will pay for help
what are some uses for running a task asynchronously ?
wtf how big is it
did you shade your whole operating system into it?
Anything that may be heavy but can be run async safely
44 MB
wtf why is your plugin 44mb
uh
Spigot itself is like 69mb
did you shade the whole server into it?
Yeah you definitely shaded spigot
whats that mean
Show us the Pom
then send link and we'll check what you did
Or build.gradle
how i can give speed 1?, i put "amplifier 1" and gives speed 2
link of file?
yes
Amplifier 0
dms?
i dont care where you send it^^
Even in the vanilla /effect
Is PluginManager::disablePlugin(Plugin) supposed to remove the specified plugins commands from the command map?
how many kb
It's pretty normal
then whys mine so big
The api is probably 1/3rd of it
you included the whole game in your plugin
Post and share your source code or server logs here.
Because you’ve probably shaded something
You are probably including the api in the project structure
how do i not do it
What do you use to build
Everyone does that at least once lmfao
another test event was giving me speed 2

I used to too back then lol
I got it happen with the API, but not with the NMS server 😄
it still will work wont it
Theni figured
Yeah same
Yes but including the entire server is illegal
Why lol
Because it contains minecraft code?
so how do i fix xd
And it's not open source
What do you use to build
build artifacts in intellij
I did not know those could shade things
do i not do this?
In the project structure there should be something to make it not build the jar inside it
do i not do from modules with dependicies
Yea you can choose to leave a library in your jar
switching to maven would probably be easier than finding out how it works in the GUI
bruh
well my plugin will still work right
Yeah ofc
You just can’t upload it anywhere
Then you should probably go to the right one and wait
If you don’t want to use maven or grade then you should google how to properly build a plugin with IntelliJ
I’m sure someone else has had the same issue
can you add gradle to intellij or somthing
Yes
so gradle will fix my issue
right click project -> Add Framework support
you will definitely have to learn on how to use it though
bump
Easiest way is to find out
I notice some strange behaviour when I try to use a disabled plugins commands
World edit spits out errors, while other plugins don't do anything
Hmm probably depends on how they were disabled?
It doesn't unregister any commands
That would explain the errors people often have here
SomethingException: plugin is disabled
Wouldn't it make sense to remove a plugins commands too?
this is the whole disablePlugin method from JavaPluginLoader
Maybe
but why, plugins aren't meant to be unloaded while the server is running anyway
My plugin requires some plugins to be disabled on startup if they are detected
Sus
why?
Commands remain from plugin.yml i'm pretty sure, else as coll said that issue wouldnt exist
Because I have certain servers that don't need them
Then uninstall them?
Not so easy sir, I use docker images
You could remove them from the commandmap somehow i suppose but not sure
writing a plugin to disable other plugins instead of just uninstalling them is very strange lol
Well, you could delete them and disable them
Reading that code puzzles me, wouldn’t that bring a mem leak considering PluginIdentifiableCommands as well as much other stuff would hard-reference the obsolete plugin instance still
Why can't you
Because as I said, I use a docker image
Does that mean you can spam reload to eat up all the rams

Reloads were meant to be supported
then create a new image that doesn't contain those plugins
Plugins just... didn’t
Well reloads are probably fine-ish
As the entire server gets swallowed by gc
Almost
Yeah sorta
That is much more work than simply having the API disable commands too smh
Well if you make your plugin instance null on reload
Well then write the PR for it
All it requires is for plugins to implement onDisable like any decent spigot plugin 🤡
the CommandMap interface doesnt even have a unregister method
Not that easy
An instance cannot be null
Only variables can be null
But if the instance isn’t hard-referenced it may be enqueued for gc
Well I don’t think any plugin has ever done that in onDisable
also the SImpleCommandMap doesnt have any unregister method
Also this doesn’t help
Yea but if i make my code not reference to it anymore, it would be garbage collected
Right?
Yes
Unsure
but it has a final protected field Map<String, Command> knownCommands
I think
so just get it with reflection and remove the entries you want gone
I am already disabling some default commands using reflection, so I guess I could add more commands there
If the spigot api implementation is done erroneously a side effect would be that your old plugin objects might still be floating around
Not proper api
Yeah commandmap is not really api
Though I personally think its proper
It would be if you made a proper API around it :p
Just a bit too dangerous to expose
All the noobs would go around doing all sort of crazy stuff with it
I mean what’s the worst that could happen if you expose it safely
Well as long as reflection exists im fine with it
Yeah, well "api > no api"
But is there an actual reason why the PluginManager won't remove the mapped commands or is it just random
Once a command is created it doesn't go away that easily
Ferskfisk I don’t think ::disablePlugin was ever implemented with proper care
hmming champ
Quick who do we blame for disablePlugin :p

I mean Who uses it else than to disable your own plugin when there is something wrong on load
;-;
me
Another use case is making annoying plugins with hidden code that randomly disable one of your plugin and you can't tell
That would be fun to code
:p
Git blame says Jan Polak, but that was only because of nullability annotations
So it probably goes back to dinnerbone
I don't see how you can handle onDisable properly to avoid having issues with ::disablePlugin
Reflect into the map and remove your commands
And yes that is silly but that’s one way to do it
That's what I do with a bunch of other commands right now
I blame oracle for not making gc read your mind
Is there even a unregister command method in spigot
well technically
Not an accessible one
Oh
Yeah I've been working on a command manager that exposes some of that stuff
Makes me confused sometimes
Anyone else having an issue im pulling im code but it doesn't seem to be pulling it
like no files are being added
I’m not home rn so I can’t test but I wanna make plans: does hasPermission() work on the OfflinePlayer variable type?
No
does PlayerCommandPreprocessEvent send the command without the "/" like if i did /test or "/test"
Try it?
and see?
Mayhaps
?tryandsee
I have a custom config file, i want to set default values with comments. How can i do that?
I usually create a default in my plugin jar and then just save it to the plugin folder
Since any other write operations remove comments
I'm confused, do i need to make an file in my IDE with the default content?
That’s what I do
But how to create an configuration variable with that file?
YamlConfiguration.loadConfiguration
So the default file is visible / editable for users?
If you save it to your plugin folder with Plugin.saveResource
thx for the help
Is it possible to detect what minecraft client someone is using? lunar, badlion etc...
yeah?
if the client send a packet
or something relate to channel
then the server will listen to that and know what is the client
but if they dont
you have no way
the example would be the hacked server plugin
I know badlion does because you can disable modules from the server side
lunar too
Do you know how you can send a packet?
You want to send something to the server?
yea
Hmm
Unfortunately I’ve only done it the other way around, but it should work similar
You can receive them using messaging channels
what
i think this would be a mass gg
GGGGGG
GGGG12123124124
GGG3@!)_#@!+{}{{{!++++````
hi, before you help (if you want to help) please keep in mind:
- I am insufferably stupid
ok so anyway, I am trying to use plugin.getConfig() inside one of my commands as I want to have a config file for my plugin. However, plugin itself is not defined, so I used Plugin plugin = null;. I am not sure if this would work though, and I think my logic is off. There are no errors, but for some reason making it null doesn't make sense to me. Any help is appreciated
I am insufferably stupid
No, I mean I AM
because you might get frustrated with me
so just putting it out there
ah
so you don't know how to help me lol
hm
You need to pass the instance of your main class to the constructor of that class
?constructor
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
I don't think its the same col
cool
ok, so I can't just import it from bukkit, i should create a method getConfig()?
No
ok
Like I said
neverminD
It’s possible in whatever class you want
Java moment
so by putting private Plugin plugin; inside the class but outside of the onCommand boolean, then I can do plugin.getConfig()
idk if that's explained well, but I think i did something right cause code looks ok
As long as you initialize it via the constructor
Hey! I have an error on my server that says there are "Too many files open". After that, the server crashes and the world corrupts. How do I prevent this?
Does it happen during startup?
no, it happens a few hours into runtime
Sounds like an event is opening a file and not closing it. Make sure whatever events you have opening files close them after they're done being used
I did not know that was a thing that could happen
definitely something keeping files open
The error Java IOException “Too many open files” can happen on high-load servers and it means that a process has opened too many files (file descriptors) and cannot open new ones. In Linux, the maximum open file limits are set by default for each process or user and the defaut values are quite small.
No idea what quite small is defined as
usually like 1k? i think
Or how many files mc itself keeps open
netty will also open files usually for connections
itswagpvp appears to be the offending plugin
i like the random errors not related to open files
I feel like a lot of this log file should be put into a debug file instead but eh. Not spigot so
Hello, so I'm new to Spigot and new to OOP but I've been a web developer for years so not new to programming, I have a quick question about handling special blocks in world, for example a block that breaks the block next to it every x seconds my first thought is to store cords in a List and save it to a file load in on restart check if block is at cords then execute. but I'm wondering if anyone has a better approach. like I said I'm not familiar with spigot.
Is there any way of getting the MSPT of the server? I know you can calculate it or get it through Paper, but is there any method through spigot?
maybe ```java
Bukkit.getPluginCommand("command");
ah noted, I just found an example and I was just double checking the docs quick to make sure it wasn't deprecated or anything and I noticed that too
have a good one 😄
awesome thanks 😄
yeah, I'll serialize for now and in need be I'll add SQLite or something
does the api provides custom player data storage things?
@Inject(method = "handleJoinGame", at = @At("RETURN"))
private void handleJoinGame(C17PacketCustomPayload packetIn, CallbackInfo ci) {
this.netManager.sendPacket(new C17PacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString("poop")));
}
``` I get an NoClassDefFoundError at NetHandlerPlayClient
im trying to replace the brand
mmmmm mixins
yeah beauty
1.8.9
as long as ur aware, not sure if thats intentional or not
AH! quite possibly thanks a lot 😄 going go look into that now 😄
that part sounds a little more unintentional
oh def
I was just doing it off the top of my head
Because I got no clue how I could do it
Im just trying to change the brand
mhm
I'm looking at this right https://github.com/HyperiumClient/Hyperium/tree/master/src/main and plugins can detect the brand of that but I don't see where they changed the brand
@InvokeEvent
public void joinHypixel(ServerJoinEvent event) {
Multithreading.runAsync(() -> {
NetHandlerPlayClient netHandler = Minecraft.getMinecraft().getNetHandler();
if (netHandler != null) {
netHandler.addToSendQueue(
new C17PacketCustomPayload("hyperium",
new PacketBuffer(Unpooled.buffer()).writeString(new JsonHolder()
.put("id", Metadata.getModid())
.put("optifine", HyperiumTweaker.INSTANCE.isUsingOptifine())
.put("version", Metadata.getVersion()).toString())));
}
});
}
now we just gotta see where that gets called
doesn't look like it gets called
hmm i wonder what will you guys name it if we have two same object required for a method?
Did you find anything?
this.whoSet = HereIsWhatIamTalkingAbout;
player.getHandle().setMonke(-1);
}```
thanks!
anyway where can i find the official start-up manual?
i'm tired using my server jar as dependency.
what do you mean
I'm sure there's git plugins as there are in Pycharm
But barring that you can just get github desktop
That already exists in several places
Most notably with primitives
@quaint mantle
[13:11:44 INFO]: [GravityAroundThePizza] Enabling GravityAroundThePizza v420.69
[13:11:44 ERROR]: Error occurred while enabling GravityAroundThePizza v420.69 (Is it up to date?)
java.lang.Error: Unresolved compilation problems:
String literal is not properly closed by a double-quote
Syntax error on token "else", invalid RecordHeaderPart
Syntax error on token ".", @ expected after this token
Syntax error on token "UMA", ) expected
UMA cannot be resolved to a type
Syntax error on token ""!"", ( expected
Syntax error on token "}", { expected
bro i just got kicked out of my house 😭
ill help u when im free if its not solved
oh
also when i type my command in console
it says /<gravityaroundthepizza>
@quaint mantle it should say WHY U IN CONSOLE U MUST BE IN GAME
Look for the all the red markings
is it easy to fix
Idk, I can’t see them
b r u h
Make sure you close all your opening brackets.
Make sure you're depending on the spigot api or jar (If using 1.18 you unfortunately require maven, I think gradle might work too.)
Once done check for further errors.
ikr
show us ur whole code bruvva
ok
why did they kick you
😭
package me.Jaden.GravityProject.commands;
import me.Jaden.GravityProject.Main;
import javax.tools.DocumentationTool.Location;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class HelloCommand implements CommandExecutor {
@SuppressWarnings("unused")
private Main plugin;
public HelloCommand(Main plugin){
this.plugin = plugin;
plugin.getCommand("gravityaroundthepizza").setExecutor(this);
}
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (cmd.getName().equalsIgnoreCase("gravityaroundthepizza")) { // If the player typed /gravityaroundthepizza then do the following, note: If you only registered this executor for one command, you don't need this
if (!(sender instanceof Player)){
sender.sendMessage("WHY U IN CONSOLE U MUST BE IN GAME");
return true;
}
Location loc = new Location(world, 821, 32, 917);
Bukkit.getOnlinePlayers().forEach(p -> p.teleport(loc));
return true;
} //If this has happened the function will return true.
// If this hasn't happened the value of false will be returned.
return true;
}
} else{
p.sendmessage ("Ur not good boi be good boi and u have perms!");
}
return false;
}
}
feel free to laugh at me for not good at coding
im on my phone idk i cant really tell
wrong Location class imported
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.
ok ;-;
with the 1.18 nms, if i try to make a class extend EntityVillager
EntityInsentient shares a method called x() with the Entity class
which makes compilation impossible
please see the release notes
ok ill check
yeah just use intellijs builtin verson control
mojang mappings is the word you are looking for
🎅
no sry i ended up watching yt
can you compile your plugin with this without getting in trouble?
That’s what the remapper is for
Time to restart
i want to ask what is the most prefer second name for the 2nd object...?
player, player2?
Something descriptive generally
For example
public EntityDamageByEntityEvent(@NotNull final Entity damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, final double damage)
Damagee is a word
Kind of
“ee is attached to verbs that take an object to form nouns with the meaning "the person who is the object of the action of the verb'':
address + -ee → addressee”
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
// Checks if command is the one you want
if (cmd.getName().equalsIgnoreCase("gravityaroundthepizza")) {
// Checks if sender is instance of player
if(!(sender instanceof Player)) {
// Outputs to sender that command must be ran in game
plugin.getLogger().warning("Command must be ran in game.");
// Returning true here stops the code from continuing.
return true;
}
// Casts sender as player
Player player = (Player) sender;
// Checks if player has permission to preform command
if(player.hasPermission("teleport.perm.node")) {
// Loops through online players and teleports them to the player that preformed the command
Bukkit.getOnlinePlayers().forEach(online -> online.teleport(player.getLocation()));
}else {
// Sends message to player if they do not have permission
player.sendMessage("You do not have permission for this command.");
}
return true;
}
return false;
}
Direction direction = Direction.get(Direction.AxisDirection.NEGATIVE, axis);
Direction oppositeDirection = direction.getOpposite(); // direction1
Direction directionAgain = Direction.get(Direction.AxisDirection.NEGATIVE, axisAgain); // direction2
Direction oppositeDirectionAgain = directionAgain.getOpposite(); // direction3```
i put again because i have no idea what to name😂
i mean, the officially recommended way to develop a plugin.
public void onEnable() {
// Plugin startup logic
this.chunks = new HashMap<>();
getCommand("claim").setExecutor(new ClaimCommand(this));
getServer().getPluginManager().registerEvents(new PreventionListener(this), this);
}
Error:java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "me.ispeakweeb.landclaiming.LandClaiming.getCommand(String)" is null at me.ispeakweeb.landclaiming.LandClaiming.onEnable(LandClaiming.java:16) ~[LandClaimPlugin.jar:?]
Also gives the error of [23:40:02 ERROR]: Error occurred while enabling LandClaiming v1.0 (Is it up to date?)
bruh nevermind I set up my yml wrong
any example to reobfuscate it in gradle?
I remember when md_5 used to tell me I was more than not good
he still does, but I also remember when he used to say it back then
is it possible to make this editable?
If you want to make a custom jar
yes
Why do you want to mess with onEnable
no i just took that ss im not messing with it
i just tried to type smthng took ss and sent here
lol
so is it possible to edit it
Plugin
You could decompile the plugin, edit it, and then ecompile
I decompiled it with intelij but it says that
No idea if IntelliJ lets you edit stuff
I’ve used other tools that just spit out all the .java files, which you could easily edit
What tools?
put your command in your plugin.yml
I already did, I just forgot to do it my bad
is anyone free rn and could help make a plugin for me
its a pretty simple concept but i cant find anything online
we can help
yeah but i have minimal knowledge of java plugin writing
what are you trying to do?
i know like the basics and simpel commands but the one im tryna make is slightly beyond my knowledge lol
a simple kill effects/death effects plugin
i can send a detailed one in dm
its almost a text wall so i dont wanna send it here
i guess that would mean if a player dies, he gets effects
i wrote it up a while ago
no irs like
you can choose the particle effects or effects when you kill a player such as
you kill someoene and
lightning bolt strikes
red particles
you get strength I
and not that difficult
only the maths for the particles :kekw:
because mt server is 1.8 and thats the problem
and i dont think that plugin runs on 1.8 because particles were updated im pretty sure
gimme a sec i think i found smn
nvm i didnt
yeah so something like that would be cool except i think the hard partn is making all those effects
plus that plugin doesnt have options to buy effects and permissions to buy/use
like killeffects.buy.<name> and killeffects.use.<name>
@EventHandler
public void onKill(PlayerDeathEvent event) {
if (!(event.getKiller() instanceof Player)) return;
Player killer = (Player) event.getKiller();
// spawn lightning
// spawn particles
killer.getLocation().getWorld().spawnParticle(Particle.SPAWNER, ...);
// potion effect
killer.addPotionEffect(new PotionEffect(PotionEffectType.STRENGTH, 100 /*5 sec*/, 1));```
}
something liek this
^
ah
store the effect against an player uuid somewhere in a map
or i would even store it in the player's persistent data container but thats just me
1.8 go to the shame corner
:(
is pvp version
1.9 ruined everything
hello.
if i spawn an entity with packets, and move like 100 blocks and come back, the entity is not there it despawns
what should i do
you can set it not to despawn I believe. not sure how it works with entities spawned with packets, but for normal entities at least there is a method "entity.setRemoveWhenFarAway(false);"
may just be in 1.17 tho
Uhm which event is used for checking the movement of player on a lama
PlayerMoveEvent I think is likely not as its of a player and not a lama the player is sitting on?
off the top of my head i would say use a PlayerMoveEvent then just check if they are riding something and if they are check if they are riding a llama
but i could be wrong
Quick Questions is there any way to see what exactly changed for stuff relating to Custom Enchants from 1.8.9 to 1.12.2? because i was updating my code for 1.12.2 and now a ton relating to the enchants are now broken
I actually need the movement
The last location and the new location on moving
though that
I need the
Keys pressed
Like is there a event to check which key the player pressed
Like I need WASD
which I thought player move event would give but not when the player is on a lama
i don't think so since key press is client side
I need to check for those pressed keys and then override the movements with my custom one
Yep but events are not ?
while plugins can only retrieve server side stuff, like player data or packets
so In events like Player move event we should be able to get that
so no
the most the server can see is if they move
not which key was pressed to move
How does world edit do the bottom right one?
Well pretty self explanatory
Not sure if the formula inside that image is the right one tho
So you have your answer...?
what if we check which direction the player is moving
Yea actually wasn't really sure where I was going with that lol
you could
it would be like player.getLocation().getDirection()
What was that command
Hmmm is that looking direction?
!prnt
or walking direction
@frosty geyser I just cant find way to get player movement while the player is sitting on a lama, basically the lama movement
Is there like a entity move event
hmm lemme check
?paste
I could add custom tag to the lamma and then check for the InstanceOf that lama
player.getVehicle()
you could do like if(player.getVehicle() instanceof Llama)
yes I know that much
How good is getOfflinePlayer in storing UUIDS?
or should my plugin store them when player joins for the first time?
game mechanic question: When i set fire in a dark forest, it doesn't spread infinitely, despite abundant flammable material, but only to a certain radius around the initial fire, 20 blocks or something. What game mechanic is responsible for that, do encouragement and flammability get lower for blocks lit by fire spread?
It should spread infinity.... But it is random if it lits another block or not
Storing uuid is better then player object but why do you Wanne geht offline Player?
So players can send cryptos even to players that aren't currently online.
I was storing uuids of players to yaml / database.
But now I have switched to getOfflinePlayer
okay, and? whats the problem?
you wont even need the OfflinePlayer if you just want to send the cryptos
maybe for the name
i dont really understand the question
i dont get the problem. you are already storing the UUID or not?
Yes
Previously I was storing player: uuid to every player that has joined the server in players.yml file
Now I have switched to getOfflinePlayer
Was this good decision?
whats the point with getOfflinePlayer? you are getting the offline player of the player with the uuid x. and now what?
oioioi wass goin on ehre lads
or do you mean you switched to storing names?
No point, getOfflinePlayers returns every player that has ever been on your server
Now I'm getting UUIDs and Names from Offline Players
previously I was storing them in a file when someone joins the server
ahhhhhhhhhhhhh
Then i think getOfflinePlayers is better, because you also get players that joined while the plugin was not running for any reason
Edit: whoops, didn't mean to write that as areply
getOfflinePlayers even returns players that never joined your mc server before.
but mc server like freeze a little bit
getOfflinePlayers returns the players from your playerdata file
No it doesn;t
that would be every player ever? makes no sense
imagine
yes from mc servers
getOfflinePlayer can get a player that has never joined. getOfflinePlayers gets ONLY those who have joined
let me show you
maybe if you copy a world into your server, there can be OfflinePlayers which never joined before
?paste
but other than that there will no players just appear
You are confusing getOfflinePlayer and getOfflinePlayers
getOfflinePlayers() returns a Collection of players who actually have data on yoru server, and no more.
this seems like a you problem. you are probably getting those players over the name which will load the UUID from mojang
ok i've been playing around with EntityExplodeEvent and i can't seem to figure out how to use .blockList() to print the effected blocks to an ArrayList, anyone know how to do that properly?
It's not a problem. I like that you can send crypto to players that didn't joined before. It's like real live sending cryptos experience.
But how much does this impact server performance?
as long as you dont spam it 2000 times per second, none. i mean, more than getting it by the uuid, because you request the data from mojang, but other than that, it doesnt.
okay thanks.
but there can be edge cases
so it can be // This is potentially blocking :(, like the source says
bad internet and 10 second lag on each lookup woudl be bad
You are also rate limited by Mojang on lookups
if its too many, what probably needs to be 1000 or more per second or tick
I believe its a 24 hour cap
ok well 1000 per second or even per tick is a bit exaggerated
but yeah, or what happens if mojang is down f.e.
ok i've been playing around with EntityExplodeEvent and i can't seem to figure out how to use .blockList() to print the effected blocks to an ArrayList, anyone know how to do that properly?
what are you trying to do with the list?
im going to take the list and run each set of block coordinates through an sql database and cross-check them with existing info in there
thats going to be slow
^
so is there a better way of doing the same thing with the affected blocks?
well, what exactly are you trying to do?
Block protection plugin, logs protected block coordinates into a database
anytime a block is broken the block coordinates are query'd in the database if they are found they are deleted if they are not found, nothing happens on the database side
ok, then if you are nto keeping all protection data in memory, load the data on chunk load
data being memory resident if the chunk is loaded will be much simpler adn faster to check
are you doing individual block protection or areas?
individual
then load your protection data on chunk load
then you can do a simple .contains check
so what do i do with the blockList() data from the ExplodeEvent
thats the part im tricked up on
what specifically are you protecting? a block type, a block location?
the location
then get teh block location from teh Block and see if its being protected
so ill need the event to produce a set of coordinates for each protected block
ok so blockList is already an arraylist so no need to stick it in one
@eternal oxide so the part that is troubling me is using the data inside the BlockList itself, the only thing i have ever used arraylists for in the past is doing like .contains("string") for toggles
Hey quick question. There is no way to open the chatbox right?
You can't open it server side
okay thank you
it all depends on how you are storing/fetching the data from your sql
try {
PreparedStatement ps3 = plugin.SQL.getConnection().prepareStatement("SELECT * FROM wb_blocks WHERE WORLD=? and X=? and Y=? and Z=?");
ps3.setString(1, world);
ps3.setInt(2, blockx);
ps3.setInt(3, blocky);
ps3.setInt(4, blockz);
ResultSet results1 = ps3.executeQuery();
if(results1.next()) {
return true;
}
return false;
} catch (SQLException e) {
e.printStackTrace();
}
return false;```
this is the method i created to check if a block exists in the database ie; is protected
Couldn't that be simllified?
You need to store/load your protection data on chunk load
live checking will not work
is there a reason why it wont work live? im not using the data to decide if the blocks will actually be removed or not, they will be deleted in game regardless of whether they exist, they just need to be removed from the database if they exist there
um, that makes no sense. I thought this was a protection plugin?
a protection plugin is supposed to protect things
its function is to protect OTHER players from breaking the protected blocks
not protect them from npc's
players are entities
explosions come from TNT etc
if you are simply going to remove teh protection if its blow up with TNT, then foreach over teh blockList, check if it exists in yoru sql and remove it
well i was planning to cross-check the entity in the EntityExplodeEvent to see what the entity is
for the purpose right now i'm only wanting this method im creating to look at creeper explosions
if you are actually checking protections, then you can;t do that live
each sql query could take seconds to execute, It could be upto 10 seconds delay on each lookup
You are running everything single threaded so you will be locking yoru server up every time you perform an sql query to ask if the block can be broken
a single player breaking blocks is going to bring your server to its knees
i mean i have not run into any kind of issues with what you are describing yet with up to 10ish people online doing stuff all at once
maybe this is more of an issue when running an sql server that isnt local and on the same machine as the server?
You will be suffering serious lag querying an sql for every block. They may not be immediately noticable on teh client, but yoru server performace will be in the bin
from what you have shown you are performing an sql query on every single block thats broken
Method invocation 'setType' may produce 'NullPointerException'
why does this happen?
@ivory sleet
Yeah you can suffer a lot from doing IO operations or database calls without proper execution coordination
Because your variable is null
Or just can be
I did
What you think?
yeah no it is definitely hitting the grass block
@eternal oxide that would be correct thats how the plugin currently works anyways
There shouldn't be null
Well if whatever you use indicates nullability then it could be null
@eternal oxide this is the first plugin ive ever created in all honesty and i didnt and still dont know how to pull sets of data from a database into ram and flush them back to database whenever they need to be flushed thats way more advanced stuff then what i know how to do
Yeah have you worked with multithread-ify your data model?
Else you might wanna learn a bit about concurrency and multithreading.
something tells me learning and implementing that now would require an entire redesign of my entire plugin
probably
which at least for now im not going to do because im not running into any performance hits what-so-ever
Probably not n0 grief
Basically, your server needs to already have the protection data for a block break before the block is broken
Hey, is there a way to block any kind of Player related Event besides a specific one?
I want a player to only be able to chat, not move, not open inv and so on.
I am just looking for some event which is like the root of every player event and check if the event is not an AsyncChatEvent
With the assumption that you’ve just created a normal data model, it should already follow something called the humble object idea, so in principle you could wrap your existing things 🙌
Sadly the Bukkit event system doesn’t have a way to inherit event listener from event super classes. So you’d just have to create a callback for every event. A bit verbose maybe…
Hi, can anyone tell me if it is safe to use paper spigot 1.18?
Ask them
Oh okay, thank you
@ivory sleet for example https://gyazo.com/e23ae1beaf022f3868abde28c02f70d7
that's gonna be alot xd
Yeah I can tell damn, I mean you could theoretically at runtime find every loaded class which has a HandlerList and derives PlayerEvent
hm I will look arround for something
@ivory sleet at first glance does that dataset look like its formatted in a way that would work w/ what you are suggesting
Surely it works
Trying to find a good link for how to structure data in a relational database 1 sec
Can anyone walk me through exporting a .jar file? i swear i've done it before but i think i forgot a few steps lol
I didn’t find any good link but google database normalization, it should give you how to structure the data inside tables and such (:
Uh there’s actually some wiki pages covering that
maybe rotate?
What IDE do you use imnotdani?
Aye, I've followed them in the past; but now it seems when i load up the plugin onto my server it doesn't generate a config file.
IntelliJ
https://www.spigotmc.org/wiki/creating-a-blank-spigot-plugin-in-intellij-idea/ did you follow this?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Ah
Do you mind sharing the code?
sure, i'll pm?
?paste
And any errors?
no errors
my frantic research is saying i'm compiling incorrectly, and i'm not sure what i missed
Elaborate on your frantic research
So how do you build your plugin?
anyone got the NMS dependancies offhand? for 1.18
If you’ve done everything correctly you’d use maven clean install iirc
what is a reliable way of cancelling knockback?
What I have right now is a EntityDamageByEntityEvent that takes the damaged entity's velocity, saves it then runs a task later (0 ticks later) and sets the velocity to the saved velocity
Even when an entity is in NoAI state, is it possible to detect another entity within a certain range and use it as a trigger for an Event?
i tried two
project structure > artifacts > + > JAR > From modules with dependcies > Include in project build > OK > build artifacts
and maven > package
Maybe the velocity event?
? whats that
?jd-s
VelocityEvent?
oh nvm its only for players
but i only want to cancel it when they get hit