#help-development
1 messages · Page 33 of 1
done refactoring
If this fixes the problem I have no idea what it was
welp same problem
at least things look good now
why not setOut
you can just delegate it to the previous value
and if everything does that it should work fine
bruh
That's why you can firstly declare a lambda outside
thats a negative from me chief
Looks ugly ngl, but ..
indeed its ugly, its also a valid fix for callback hell in js
but, i never used it
pff im dying , its damn 26°C in here
Ugly as hell
?paste
javadocs make everything look better
why isnt this working tho :/
https://paste.md-5.net/oyesejiniy.java
anyone tell me what the duck I did wrong here
whats not working
Use this(name, owner, location)
void methods cannot return a value
https://paste.md-5.net/ukubevoxoy.cs
I refactored. It spawns 1 sheeptower a second. I dont get why its repeating. Could it be because my task is running a nested task?
i cant, i need to use a try catch cuz it accepts a resultset
just trying out smth
wtf is that formatting
cant tell what is what
but i assume its cuz you have a method in another
sorry 🙏
or smth
Don't use records then
I find them useless
java weird
Records are great for immutable database objects, data pulled from APIs, etc.
or when you have immutable stuff and are too lazy to write constructor getters and setters
That's why we're too close to OOP
What
Use lombok
ew

eventually i might
intellij -> right click -> generate -> getter and setter -> template: builder
ik that generate exists
just use alt-insert
alt insert tho
never studied the keybinds
https://paste.md-5.net/ukubevoxoy.cs
I refactored. It spawns 1 sheeptower a second. I dont get why its repeating. Could it be because my task is running a nested task? Its supposed to spawn 1 btw.
1 per player
not using the bukit scheduler with a lambda :(
Heard of block neighbor?
also dont use Integer -> int
you might want to use a Set<UUID> instead of List
i'd make a method void forEveryCageBlock(Consumer<Block>) to set it to glass and also to reset it aaaaaaa
thats just me
Which particles are used in fireworks (I mean this colored particles)
declaration: package: org.bukkit, enum: Particle
Hi, i need help, i'm trying to learn how to use AES in java to encrypt strings using a password and it works (but get stuck on decrypting), giving a BadPaddingException
and these are not the white ones that are when the rocket is flying?
ye
yeah i always just make records of those (or classes) tuples and triplets are yikes
doesnt Particle.DustOptions fixes the color?
declaration: package: org.bukkit, enum: Particle, class: DustOptions
bruh i broke my maven project again
No, dustoptions cannot be applied to fireworks_spark
That breaks too
yes
nothin g is perfect
well everything logic based is perfect
but no human is perfect
so everything will break
Random question, if ur in 1.19.1, report chat enabled, but a plugin takes care of cancelling every messages, and rebroadcasting (tellraw or whatever, or just player.sendMessage) to everyone the intercepted message, will it still be somehow reportable and readable by mojang/microsoft?
damn im happy to have vscode with this memory usage
got the 16 gigs ram so this isnt bad
I want to be a pro at programming plugins for minecraft, can someone who makes good plugins tell me what should i learn and how to do it, i already know how to make plugins but basic ones
site off?
learning by doing
block.setType(Material.31:2);
why doesn't it work via id?
thats not how enums work
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
Ok, so colored fireworks particles are only client-side so I can't spawn individual particles
no idea
ok
?pdc
is there any way for me to view bukkit pull requests without needing a verified spigot stack account
There's a plugin in my server that is teleporting a player on an event, and the plugin i'm developing also teleports the player on the same event. Is there a way to make it so my event fires after the plugin's event?
cant you delay what you're doing by a tick
instantiating a bukkitrunnable 😵💫
?scheduling
but anyway is there a way for me to view those bukkit pull requests without a verified account? im trying to view this PR to see how this guy did it because i just need some type of method to deal damage to an entity with a specific damage cause https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/pull-requests/469/overview
Thank you!
@eternal oxide so I did what u have said and I have also used ur pdc code but the args[1] is still red
args[1] is from your command
yes
Item
ItemStack rankbook = new ItemStack(Material.ENCHANTED_BOOK);
NamespacedKey key = new NamespacedKey(PvPSystemPlugin.getPlugin(), "args");
ItemMeta rankmeta = rankbook.getItemMeta();
rankmeta.getPersistentDataContainer().set(key, PersistentDataType.STRING, args[1]);
rankmeta.setDisplayName("§7» §e" + args[1]);
book.add("§7with this book,");
book.add("§7you will get,");
book.add("§7the rank §e" + args[1] + "§7.");
rankmeta.setLore(book);
rankbook.setItemMeta(rankmeta);
player.getInventory().addItem(rankbook);
if args[1] is entirely red it means you dont have a variable args to use
Listener
if(event.getItem().getItemMeta().getDisplayName().contains("§7» §f§e")) {
ItemStack itemStack = new ItemStack(Material.ENCHANTED_BOOK);
NamespacedKey key = new NamespacedKey(PvPSystemPlugin.getPlugin(), "args");
ItemMeta itemMeta = itemStack.getItemMeta();
PersistentDataContainer container = itemMeta.getPersistentDataContainer();
if(container.has(key , PersistentDataType.STRING)) {
String foundValue = container.get(key, PersistentDataType.STRING);
}
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "lp user " + player.getName() + " group set" + args[1]);
player.sendMessage(" ");
player.sendMessage(" §e§m--------§6 Vouchers §e§m--------");
player.sendMessage(" ");
player.sendMessage("§8[§e»§8] §7you got the §6rank §f§m-§f§e " + args[1]);
player.sendMessage(" ");
player.sendMessage(" §e§m--------§c§l §e§m-------§f §e§m--------");
player.sendMessage(" ");
}
}
what does your command method look like
wait pastebin I send whole code
brh
it does work like this so why not using it this way
I just need the message at the end of the cmd so the args[1]
in this case it may be useful if you want to easily make it interchangable with, for example, permissionsex
permissionsEx is not allowed to use anymore
not sure tho
just ane xample
how can I get the args[1] with pdc now
thats true
wdym
if they don't have the permissions they dont
but I know what u mean I think I will do it that way
yeye u right I will use their API
how would it look like?
if(container.has(key , PersistentDataType.STRING)) {
String foundValue = container.get(key, args[1]);
}
like that?
I am rlly confused sry tried so many things in th past few days
I found something interesting...
cancel();
Bukkit.broadcastMessage("Cancelled!");
``` I did as some kinda wanky debugging. and the message never gets displayed in chat. So somethings up...
oh
well
the message is still not being broadcasted
which is
bad
but also kinda good
then I know that the code is not being reached. But I have no idea why though
I found some errors hehe
Aug 02 03:03:11 server java[14668]: java.lang.NullPointerException: null
Aug 02 03:03:11 server java[14668]: [03:03:11] [Server thread/WARN]: [Sheepstack] Task #10 for Sheepstack v1.0 generated an exception
Aug 02 03:03:11 server java[14668]: java.lang.NullPointerException: null
Aug 02 03:03:11 server java[14668]: [03:03:11] [Server thread/WARN]: [Sheepstack] Task #10 for Sheepstack v1.0 generated an exception
Aug 02 03:03:11 server java[14668]: java.lang.NullPointerException: null
Aug 02 03:03:11 server java[14668]: [03:03:11] [Server thread/WARN]: [Sheepstack] Task #10 for Sheepstack v1.0 generated an exception
Aug 02 03:03:11 server java[14668]: java.lang.NullPointerException: null
Aug 02 03:03:11 server java[14668]: [03:03:11] [Server thread/WARN]: [Sheepstack] Task #10 for Sheepstack v1.0 generated an exception
Aug 02 03:03:11 server java[14668]: java.lang.NullPointerException: null
Aug 02 03:03:11 server java[14668]: [03:03:11] [Server thread/WARN]: [Sheepstack] Task #10 for Sheepstack v1.0 generated an exception
Aug 02 03:03:11 server java[14668]: java.lang.NullPointerException: null
Aug 02 03:03:11 server java[14668]: [03:03:11] [Server thread/WARN]: [Sheepstack] Task #10 for Sheepstack v1.0 generated an exception
Aug 02 03:03:11 server java[14668]: java.lang.NullPointerException: null
Aug 02 03:03:11 server java[14668]: [03:03:11] [Server thread/WARN]: [Sheepstack] Task #10 for Sheepstack v1.0 generated an exception
Aug 02 03:03:11 server java[14668]: java.lang.NullPointerException: null
Aug 02 03:03:11 server java[14668]: [03:03:11] [Server thread/WARN]: [Sheepstack] Task #10 for Sheepstack v1.0 generated an exception
Aug 02 03:03:11 server java[14668]: java.lang.NullPointerException: null
Aug 02 03:03:11 server java[14668]: [03:03:11] [Server thread/WARN]: [Sheepstack] Task #10 for Sheepstack v1.0 generated an exception
Aug 02 03:03:11 server java[14668]: java.lang.NullPointerException: null
Aug 02 03:03:11 server java[14668]: [03:03:11] [Server thread/WARN]: [Sheepstack] Task #10 for Sheepstack v1.0 generated an exception
Aug 02 03:03:11 server java[14668]: java.lang.NullPointerException: null
Aug 02 03:03:11 server java[14668]: [03:03:11] [Server thread/WARN]: [Sheepstack] Task #10 for Sheepstack v1.0 generated an exception
Aug 02 03:03:11 server java[14668]: java.lang.NullPointerException: null
Aug 02 03:03:11 server java[14668]: [03:03:11] [Server thread/WARN]: [Sheepstack] Task #10 for Sheepstack v1.0 generated an exception
Aug 02 03:03:11 server java[14668]: java.lang.NullPointerException: null
I get this exception
java.lang.IllegalArgumentException: passenger == null
your list.get(i + 1) returns null
How to mix a json with a normal message
if (Bukkit.getPlayer(args[num]) != null && Bukkit.getPlayer(args[num]).isOnline())
How do i strip chatcolors from a string?
wouldnt work as you're checking fro a String against a list of players
oh right
so should I make the for loop go for one less round?
if (Bukkit.getOnlinePlayers().contains(Bukkit.getOnlinePlayer(args[your args])) this should tho
You can map the players to a string and then check lol
you should use an enchanted loop and check then, else just use this
Anyways, any ideas?
youre setting the next player on the sheep, when looping over the next player, just set the first player on the sheep
^
wdym by "mix"
a sec
im confused
oooohhh
But how could I set the json just for a part of the message?
pain
{"text":"your text here"} something like this?...
; -;)
i'm not sure i get it
oh
how can I attach that thing to a player
Don't think it would work
so essentially you want the suggestion to only appear over a part of the message?
You got it
(also i am a dumbass, this is a thing)
send seprate messages
that would put them on separate lines though
ComponentBuilder
no you can do spigot().sendMessage(text1 + text2)
thats one line then
- only works for strings
nah that worked allways for me
And it’d just call toString()
i suppose this is the solution then
It does with different lines
hows such a thing called?
something with crystal
ah end crystal
declaration: package: org.bukkit.entity, interface: EnderCrystal
YEEEES. IT WORKS. Thanks @tardy delta
@vast raven
(I needed to delete jdk thats the error) and that works
Yeah I saw, I'll try with spigot().sendMessage(msg+msg2)
thx
Can you send me in DM?
the code?
y
Btuh that wont work
Not if you want to have only part of the message clickable
You’d get some weird json message instead
it works I use it in many of my plugins and I never had any problem with it yet
You’re hugely confusing another method
for (UUID pId : Sheepstack.this.sheepstackPlayers) {
Sheepstack.this.playersSheep.get(pId).get(0).teleport(Bukkit.getPlayer(pId).getLocation().add(0, 2, 0));
Sheepstack.this.playersSheep.get(pId).get(0).addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, 255, 255));
Bukkit.broadcastMessage("Tick");
}
``` this is run once per tick. the sheep is glowing but is not being teleported to the player
why wont the teleport work
there is no errors
this is run once per tick
Not asynchronously, right?
Sheepstack.this.playersSheep horrible
Why did you scrap the idea of mounting the sheep?
it is mounting the sheep
the 4 sheep is mounting 1 sheep
but I still need to teleport one of them
nope
why
No you just mount the last on the player
Or use a slime as spacing first
No cause it would block the players vision
Use an invisible slime as spacing
but wouldnt arrows u shoot then just go in the slime?
They also go in the sheep. Take a step back and tell us what you are trying to do in the first place.
Well so the goal of teleporting
is that I am planning to make it so that when the player looks upwards
the sheep will float a bit backwards
Take a step back and tell us what you are trying to do in the first place.
okay
so
I am making a minigame right
Where players have sheep floating over their heads
the goal is to shoot down the others people sheep
sighs di for enums sucks
Well... everything enum related should be known at compile time.
Otherwise use a bunch of static constants.
i'm trying to make a Settings enum that wraps the plugins fileconfig 🥺
Hm yeah then the slime might me a problem. Just teleport them for now and give them the same velocity as the player.
PS: I think if you teleport an entity then the mounted entities dont get teleported with it.
I tried doing tp with a command
all got teleported
also
How do you handle types then? Enums cant be generic.
debug it
I made it broadcast tick in the for loop
it said tick every tick
and there is no errrors
f.e. Settings.USE_SMTH.asBoolean()
Don't print random crap print what you're using
Did you print the locations or whatever you're doing?
no
i wish enums could be generic like in rust smh
imma just use methods instead of an enum ig
could integrate it with my Config class
If I set a sheeps velocity to a players velocity every tick
will the sheep move with the players?
wait could I use #setCollidable false on the slime maybe?
Im actually not sure if this affects arrows. Let me test that.
thanks
i dont really get the different between all of those in CraftItemStack
.
Yes that works
like wtf is the difference between asBukkitCopy, asCraftCopy, asCraftMirror, asNewCraftStack, ...
thanks
Btw do you think the plugin instance may be null due to some error in Paper api?
I should probably try if it works on Spigot
But it should work
lol
Alex himself yesterday said it should work
At this point I've tried everything
You issue is almost 100% down to some fubar with Lombok
99.99% no
Show your code
?paste your code pls
and show the full stacktrace
add some constructors manually and don;t rely on lombok. its the only way to diagnose it
but do the slime take damage
cause I might have to do the same for the sheep
I've also tried initializing the classes in onLoad
and onEnable
and using static getter instread of constructor injection
did you try moving your code from that constructor to onLoad ?
could there be a way of making the sheep non collidable for one player only?
hang on
Hey @tender shard after reading and using your library, there doesn't seem to be a method to decode an Inventory + Armour from b64, even though there's one that encodes inventory + armour... Am I missing something?
You tried a static getter and it STIll came up as null?
yes
Thats impossible
your fields get instantiated before the constructor gets called
unless you don;t set teh instance until after you try to use it
The code you posted doesnt even have that method
feel free to PR it then 😛
Yes
Let's goooo
Because it's an older paste
remove final from your fields
from command and events
Well... then post the code that caused the problem... wtf
what?
I said
It causes that problem
I tried other fixes
do you want me to paste the code for every single fix I've tried?
oh I see his issue
Ok.
- Compile
- Replicate error
- Post code and stacktrace
Yeah i have the same suspicion.
Heyy, can you make something to re-light the whole world?
Code plugin mod for 1.19
private final AntiChatSpam plugin;
private final int serverTps = getFromConfig("ticks-per-second");``` getFromConfig is called in the field before the constructor runs.
your plugin is null, when the class is instanced
The class should get instanced with the plugin?
no
yes?
the class is instanced the first time you create the instance. You do not set the plugin reference untill teh constructor runs.
Yeah makes sense. I think using lombok like this is really problematic.
Because it kind of hides the problem if you dont know all the implications
delomboking it would have the same result
You dont say...
Because it kind of hides the problem if you dont know all the implications
that's clearly their own fault to access stuff that they only set in a constructor, before calling that constructor
if he removes Lombok from that class and adds a constructor to set all fields it will be fine
Using the constructor to initialize all fields is more obvious if the constructor is present
yeah that's true ofc
Do not call getFromConfig in a field. Its accessing plugin before the constructor has been called.
I am kinda confused Rn.... :
*** Error, this build is outdated ***
*** Please download a new build as per instructions from https://www.spigotmc.org/go/outdated-spigot ***
*** Server will start in 20 seconds ***
Is there a video of how to do this, I downloaded the thing and have a server-1.19.jar in the "work" folder it created. What do I do next?
?buildtools
So I should just have
private final int serverTps;
and assign a value to it in the constructor
after I get the instance?
pass the instance using DI, in teh constructor
I do that
set all fields IN the constructor
okay
Ok I saw that, but I have the server-1.19.jar and do I just replace the old one?
lastly, do not call getFromConfig in a field.
well 1.19 will always be outdated since 1.19.1 was released
ahh ok but then I have to deal with the "Server will start in 20 sec"
so something like this?
there's a cli parameter you can use to skip this
I think it's called -DIReallyKnowWhatImDoingISwear or similar lol
let me check
yeah it's -DIReallyKnowWhatIAmDoingISwear=true or so
Only if you want to update and use a newer version with fewer bugs and more features.
WhAT is happening?
gc
alright now it works
i think
ty
Pog java code
garbage collector sweeping unused memory
so it can be reused
marking it as free
making the graph go down like a lot instantly
why does it keep going up
ProjectileLaunchEvent is called when someone shoots with bows or crossbows right?
thanks
gotta check projectile type
Why are you so concerned about it you just started it lol wait till it has 60 plugins
the server is doing stuff
and its not immediately cleaned
so it builds up
until its cleaned
it doesnt matter
server really do be existing tho
If it keeps going up and doesn't stop using more memory then you've got a leak
java: im gonna use tons of memory to clear out stuff using memory, to gain you memory
ope there I go using 8gb
am i able to create a config section and a key at the same time by using .createSection().set
Warning
/worldborder warning time <timeInSeconds>
Causes the screen to be tinted red when a contracting world border reaches the player within the specified time. The default is 15 seconds. The tint does not display if the user is using fast graphics.
is there any way to do this with plugins?
u want the tint or the border
its probably some sort of packet
But It might cause lag if I set it to 60m
my friend is bad he has errors
not my code btw its his and i dont wanna fix it cause my brain is loosing brain cells on how bad thi is
https://paste.md-5.net/efozifivov.java
thi is
this is
Missing parenthesis
THATS IT?
💀
This is meant to stop a player moving a boat
it still lets me move however
any ideas why it doesn't work?
cant you just cancel the event
not cancellable
not all events implement cancellable
it's a vehicle move event
declaration: package: org.bukkit.event.vehicle, class: VehicleMoveEvent
the idea being that when it tries to move it teleports the vehicle back to it's previous position
do I need to teleport the player insead?
pretty sure you cant teleport vehicles with players in them?
but i also think if you teleport the player it will just dismount them
I did boat stuff in the player move event
right
does java use garbage collection or should I free up/delete variables myself?
Java has garbage collection
unfortunately everything ive seen on this results in people having to quickly dismount and remount after it is moved
if it actually is a player, yes
right ok, ty
I'll try a few things first
this doesn't seem to be working 🤔
do I need to delay by a tick?
do an instanceof check to be safe
thanks
🥲
public
how can i make gradle or intellij automatically get, index and suggest dependencies from a dependency?
right now, if i have
a |
b | dependencies: a
c | dependencies: b
``` i would need to declare it as
a |
b | dependencies: a
c | dependencies: a, b // need to decl both
to be able to use classes from a in c
which is annoying when youve got a lot of modules
which are not one letter names
and external deps
It still thinks I'm in the boat, even when I'm not in the boat
With gradle,
plugins {
id 'java-library'
}
dependencies {
api <depend>
}
It'll add whatever api dependencies as well when you add the main project.
ah
thanks
is there also a version for implementation
which is shaded
or does it do that
Thats what api is
aight thanks
a*i
Yeah it took me a while to figure out the difference between implementation and api
i never knew api existed, i thought implementation meant like implement it into the output jar
bump
The process there is probably going to be basically the same. Afaik there's no API for changing their name above their head. You can only add to the front/end of it.
No
i've never messed with packets before
Well, Google is always your friend. Fortunately DarkSeraphim outlined what order and what packets you should send. You just need to send them and use reflection to do what you want.
hmm okay
I'm suprised that this isn't built into the spigot api
changing the player tag is such a common thing to do
Well like I said, you can add to the front and end of it easily
But changing their actual name requires packets.
ah damn
Why is player death event event.getEntity()?
I have a questioni have multiverse-inv and İ have 2 games on one server soo i have to do setspawn on 3 lobbys How can i do that like i have oneblock spawn and survival.
Because it extends EntityDeathEvent and just overrides the method
there's no api for brewing recipes
at least there wasn't any last time I checked
maybe it's possible with NMS
oh yeah you should avoid NMS as much as possible anyway
What counts as a duplicate?
but there just really isn't any spigot api for brewing recipes
probably same UID
How can I change the UID then?
I want to clone a world
so I copy the world folder
it explains it in the error message
simply delete the uid.dat file
then it will probably just generate a new random UID for that world
ok cool
this is how I parse custom recipes
here's an example config https://github.com/JEFF-Media-GbR/JeffLib/blob/master/examples/RecipeUtils_getRecipe.yml
Is there a reason for images randomly disappearing from your spigot page and only showing [IMG]
the proxy thing is broken / down right now
it'll probably be fixed soon automatically again
okay ty 👍
yk these days
ive been coding in notepad
like fr
i am actually coding in notepad
i memorized all the imports and shit
and im too lazy to open intellij
any idea on why the content doesn't actually change?
function showNotification(title, header, message, duration, icon) {
if (!showWatch && inAnimation == false) {
var watch = document.getElementById("notificationsWatch");
document.getElementById("notificationTitle").textContent = title;
console.log(document.getElementById("notificationTitle"))
document.getElementById("notificationHeader").textContent = header;
console.log(document.getElementById("notificationHeader"))
document.getElementById("notificationContent").textContent = message;
console.log(document.getElementById("notificationContent"))
document.getElementById("notificationIcon").src = icon;
console.log(document.getElementById("notificationIcon"))
watch.style.display = "flex";
} else {
}
}
you mean in the inspector?
in the document, yeah
the stuff from the console is the element after being modified
no clue
but i see the watch appearing
so it works right
are you changing it back when it disappears
nope
How to I get a Map<UUID, String> from Gson?
how are bukkit Vectors serialized in yaml
Isnt just the x,y and z
It can be used as an absolute position
or defined as a displacement to 0,0,0 (or another coordinate)
Guys, I need some help to use Listener
yeah but how is it stored
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
what are the best tutorials to make plugins with spigot?
?pastebin
?paste
I can't seem to find that channel if you could just send me a link
Why doesnt work?
https://paste.md-5.net/ehewecafor.java
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
you didnt use the EventHandler annotation
you need to reload the config to see config changes
wdym
CustomConfig.reload()
🤦♂️
did you copy paste those methods or did you write them?
write them
seems like a weird solution to make this all static
why not just make file, customFile, and all the methods instance-related? Then you can reuse this for any custom files as you want
is their an event that gets triggered if a console message is sent
no
can i get a console message
you can attach custom filters to the default logger. what do you need it for, though?
im trying to make my own discord plugin
Then just attach a custom filter to the logger https://www.spigotmc.org/threads/filter-console-messages.362931/
you probably gotta attach it to Bukkit.getLogger(), not your plugin's logger
ok
dint work
changed element ids, this solved the issues somehow, makes no sense since those were used only once 😵💫
?paste
?paste
And now im incredibly confused,
https://paste.md-5.net/fefeliwugi.cs
doing /timer 120 180 got me this:
TimerRange:
Min: '120'
Max: '180'
But nothing else worked
some how addDefault does not work
Is there a good video using object orientation in Minecraft? 
is there any way to send a toast
toast ???
🍞
Advancement
ye the message type it called Toast
kinda like this
Windows 10 has its action center that slides out from the side of the screen and contains a notifications panel to let you scroll through any of its toast-like messages you may have missed or dismissed (where to find the action center).
You get that when an Advancement is completed. just complete it https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Player.html#getAdvancementProgress(org.bukkit.advancement.Advancement)
bump
public void loadMap() throws IOException {
Gson gson = new Gson();
File file = new File(plugin.getDataFolder().getAbsolutePath() + "/playtime.json");
if(file.exists()) {
Reader reader = new FileReader(file);
Map<UUID, String> result = //what goes here
}
}```
That is where I'm at atm
Stay in #general
sorry
bump
use
if (player.hasPlayedBefore())
That's not what they want to do
its not what im trying do do but that might work
Looks like that document isn't open. Don't know much about mongodb can't help more than that
ah maybe it's not the document but the connection
im trying to make function type things for my plugin that allow you to do stuff like:
- summon entity x y z
- summon entity x+1 y+2 z+3```
but im not toooo sure where to start, how would i be able to get the x, y, z values in the function? also how would i be able to allow math in the commands?
You're using a database wrong BTW. The point is the database filters for the document you want and then only returns that document.
That's practically making a small esoteric language
You should start by looking that up, probably
well first, I'd recommend not doing that and instead making use of an existing language
however, if you want to do that
then you need to create an interpreted language
now you seem to be creating it based off of english, similar to Skript
that's a bit more complicated than recognizing symbols and searching for function names, but still doable
How do I make it so my custom configuration is created with defaults inside? I thought doing .addDefaults and .save would write the defaults into the config.yml file, but it seems like not?
hi i have so plyers get somthing on there screen when i tag them but when i changed to 1.18.2 i can't see it like pl.sendTitle(ChatColor.RED + e.getPlayer().getName(), ChatColor.RED+ "tagget deg!", 20, 40, 20);
||
can someone expert on plugins help me but pls not with youtube||
vids
(1)summon entity(3)x+1 (4)y+2 (5)z+3)
consider you've found that you're looking for a function "summon entity". You know now you need 3 integers, so you go ahead and parse the next token and so forth til you reach the space
now that you're at the space, you try and match x+1, x is matched to the function parameter from the previous line
- is matched as an expression, 1 is a literal
then you perform, literally, x+1 in code now that you know that's the goal
help with what
It should be something more like
collection.find(Filters.eq("_id", idYouWant) != null
can u come dm
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
sure
y'all are still doing mongo on the main thread
well first make use of the database server to do binary operations, which is what it's meant for
then you can use new threads and async your code
bump
Idk if you've been reading th3 chat and replies but you know we've answered u right?
mb was expecting a ping, how do i use filters?
you was just given an example xd
lol im blind haha
Having two points ( locations ) defined as A and B, how can I get the velocity needed for a projectile to reach B from A
there are frameworks and apis a shit ton worse when in older versions
e.g forge gradle
e.g gson in really old versions
compared to them, spigot 1.8.9 is really pog
ive got the same error but for this line 29 now. any ideas sorry for this
well honestly i'm still stuck on this
I don't understand how to use PacketPlayOutPlayerInfo and stuff
Which part are you stuck on?
I'm calling .saveDefaultConfig(); but the config.yml file isn't being created...
u need to create in code too
What do you mean?
This should be "creating it in code" according to
https://www.spigotmc.org/wiki/config-files/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
.
There's no docs on it
I don't know what it does
or where or when to use it
Thats because it's NMS
Mojmaps are helpful here, since it'll deobfuscate most the names so they're more useful.
I've worked with nms for custom entities and custom pathfinding before
Ah, "will write the config.yml file from your plugin's jar file to the plugin's data folder.", So it'll copy it
haven't used this packetplayout stuff though
using "#"
Yes but, is it through code or manually written? And if it's manually written, won't they be overriden?
it will only create the config.yml if it doesnt exist
and comments dont override with saveDefaultConfig()
like how do I use this though
how would I "send" this packet to a player
if thats how it works
With mojmaps: ((CraftPlayer) event.getPlayer()).getHandle().connection.send(packet);
is there a way to get the language of the account?
can you use spaces in config sections? ex:
config section: i forgot if you could
yes
ight ty
when am I supposed to send this?
right when the player joins or something?
Depends, send it whenever you want to change their nametag.
If you want to do that when they join then yes, but maybe delay it slightly.
Anyone any good with vault api?
EconomyResponse economyResponse = plugin.getEconomy().bankBalance(target);
```economyResponse.balance is giving 0.0
when doing /bal i see it says $3000 so i do have money in my vault account
How can i spawn colored firework particles?
Thank you
You need to use OfflinePlayer
am I sending this packet to the player whose nametag should be changed, or everyone else in the server?
ty
I think you are using the old api
Because the new one doesnt work with player names
Allright your welcome
is my mojang mapped even working correctly?
let me finish typing lmao
Why don you just write all in 1 message
Oh no vscode 🤢
CloudFlare is becoming extremely annoying
I've just tried to upload a jar update three times
is this intentional?
and all times got blocked
does mojang mapped not cover the packet classes?
I don think this is the channel
What version are u using?
You can not legally use vscode for java
version of what
Agree vscode != java
VScode is really shity for java
I'm not sure where to complain exactly. I'm a developer trying to upload to SpigotMC and I need help apparently 😐
Maybe use this email
?support
?
Oh ok
man I've been trying to change a player's nametag for like 3 hours now
i dont know how to start
bump
EntityDamageByEntityEvent will also be triggered by arrow shots?
Yes and the damager will be the arrow
First issue I'm running into is that I'm pretty sure I've installed mojang mapped correctly
but the Packet classes are still obfuscated
everything else is fine though
In my server, there's a mod called LOTR, which adds an NBT tag to an item when it gets created. I really don't want that NBT tag to exist, so I tried to register an InventoryPickupItemEvent and have it remove the tag, but it doesn't seem to be working.
Before I get into a debugging session, I'm using NMS, and the nbt tag is a custom modded one.
Simply: Is it even possible to remove the custom nbt tag?
Is it just me or does mojang mapped not deobfuscate packet classes for 1.18.2?
can someone help
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>me.noah</groupId>
<artifactId>FirstPlugin</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>me.noah</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
and im having this issue
Could not find artifact me.noah:spigot-api:jar:1.16.5-R0.1-SNAPSHOT in spigot-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/)
Try to run Maven import with -U flag (force update snapshots)
groupId is wrong
groupid is wrong
The spigot group id
yep
thx
i straightly recommend forward reading about maven
anyone?
Minecraft have every class obfuscated
mhm.. and mojang mapped is meant to undo that
Yeah
But take in care that maybe spigot doesnt have packet remaps
thats what im trying to figure out
ok
So just being pacient if your best solution here
Maybe open a thread on these channel
PAtient
That is all what i can said
As a developer you will have days that you wont have energy to move 1 finger but other days you will not go to sleep because everything goes as you wish
CommandSender.hasPermission("a.b.c")
does the same as
CommandSender.hasPermission(new Permission("a.b.c"))
``` right
at least yields the same result
Is there any doc about which mc version fits best with which java version? I can set sourceCompatibility
targetCompatibility from build.gradle.kts and IDK what should I set them to
well hasPermission() takes either the string node or a permission object
yeah
but the string node gets converted into a permission object right
because the permission object represents a node
or not/
that I do not know
can someone german help me
can I make the Slime entity not spawn a bunch of smaller ones when it dies?
I'm creating a land claim with 2 locations, how can I get how many blocks are in it ?
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
sorry
Just ask your question your in english
And no probblem mate we are humans. Hahahha
A basic question, if i have some classes inheriting another and have 2 methods right? If i call the methods from the super class its get trigered on every class right?
Can I use an NMS ItemStack in a BukkitObjectOutputStream#writeObject?
@sterile token just bc im german and cant speak-write english very good
We have english since 4te Klasse. Step up your game my man.
Is the command in plugin.yml
Is "plugin" null"
any startup errors?
is the plugin loaded in /pl?
if you do /help <plugin> does it show the command?
Can we see your main clas pleae?
Also, dont do that what you are doing here:
((Damageable) sender).setHealth(0);
Its completly unncesary
I am getting this intellij error while trying to make a config in yaml Invalid child element in a block mapping
entitytypes:
CAVE_SPIDER:
items:
STRING: 1
chance: 0.7
#You can have multiple items be given to the player.
SPIDER_EYE: 1
chance: 0.33
experience: 1
He is explaning that the plugin variable value is null
So then you are getting an exception
that's not a valid yaml structure.
You have a key:value with a subkey
you would have to put it like
SPIDER_EYE:
amount: 1
chance: 0.33
Indeed also +1 to that answer
oh weird
this.getCommand("ch").setExecutor(new CommandHandler(this));
this works just fine
CommandHandler is your commands handler right?
I used all life CommandExecutor since i started coding on 1.8 and moved to 1.19 spigot api
yep then my commandhandler handles my subcommands
I know what you are doing haha
I also planning to code my own simple command api because the ones already exists i dont really have patient to use them its seems that im really weird when i code
Your code seems to be okay
What ex do you have?
Change plugin.getCommand("brewingstand").setExecutor(this); to getCommand("brewingstand").setExecutor(this);
wait
ignore
he is not on mai nclass
I thought this was all in your main.
So he must use plugin.getCommand
Is he getting any excep?
register commands in your main class
You can do it in the command itelf but shouldnt be that
that will cause issues if you run the command from console
or commandblock, powertool
That what i tell
Hahaha
Also you will get an exception because you are not checking if sender is an instance of player before casting it
in the onEnable of the main class set the executor to the command class
Is the same bro
😂
Sorry if sound rude
@flint coyote Thank you, i wasnt watching discord but figured that out
ask question
ignore answer
What a chad
Hey! I'm currently trying to make some GUIs and have my code formatted like this:
GUIItem nextPage = new GUIItem(player, "&eNext Page", "ee5d9dc951196223ac72947803a1093965ea8986a95bd9cd42e3d00240113f10",1);
nextPage.addCustomClickEvent(ClickType.LEFT, (target, item) -> { page.getAndIncrement(); buildGUIs(items, inventory, page.get());});
nextPage.place(inventory, 7, 6);
the variable "page" is an AtomicInteger which is used so I am able to access it in the lambda, I understand that it is used for multi threaded environments however is this an ok use of the type? Is there anyway to go around it?
Thanks
hello, im configuring a recipe for a lifesteal book and i want to modify the recipe to be a book in the middle surrounded by 16 emerald blocks in each of the remaining eight slots. how do i add a quantity in the documentation from one emerald block to 16 emerald blocks required in each slot
recipe-enabled: true
item: revive_book
shaped: true
discover: true
items:
- TOTEM_OF_UNDYING
- TOTEM_OF_UNDYING
- TOTEM_OF_UNDYING
- ENCHANTED_GOLDEN_APPLE
- BOOK
- ENCHANTED_GOLDEN_APPLE
- TOTEM_OF_UNDYING
- TOTEM_OF_UNDYING
- TOTEM_OF_UNDYING```
this is an example of formatting for the normal items, im pretty dense when it comes to coding
You don;t. recipes can;t take a quantity
To do that you have to manually handle the recipe and the crafting
recommend https://github.com/BeefDev/Crafter
thx
what api are u using?
i made it xd
yeah
Can i ask something?
sure
Could be dm or not?
yea
Allright really thank
how can i summon a entity in a class that implements CommandExecutor? because for me it doesnt work, it only works in a listener class
Could you provide some code
yes
main file (not all of the code):
getServer().getPluginManager().registerEvents(new MadnessStart(), this);
armorstand file:
public class MadnessStart implements Listener {
@EventHandler
public void onConsoleCommand(ServerCommandEvent e) {
String command = e.getCommand().toLowerCase().substring(1);
if (command.equals("start")) {
Player p = (Player) e.getSender();
p.getWorld().spawnEntity(p.getLocation(), EntityType.ARMOR_STAND);
}
}
}
Why are you trying to handle commands that way?
oh wait
And also
That's ServerCommandEvent
It is only fired when the server runs a command
But you really shouldn't be doing commands that way in the first place
i provided the wrong code
So what's the right code
public class MadnessStart implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) {
Player p = (Player) sender;
p.getWorld().spawnEntity(p.getLocation(), EntityType.ARMOR_STAND);
}
return true;
}
}
Have you registered this CommandExecutor?
And have you declared the command in your plugin.yml?
yes
You're also not checking the command label
Can I see?
name: MadnessPlanet
version: '${project.version}'
main: madnessplanet.madnessplanet.MadnessPlanet
api-version: 1.19
authors: [ RevolvingMadness, thunder_sh0k ]
description: A Game Made By RevolvingMadness
commands:
start:
description: Starts the game
aliases: madnessstart```
And your onEnable
package madnessplanet.madnessplanet;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.Objects;
public final class MadnessPlanet extends JavaPlugin {
@Override
public void onEnable() {
// Plugin startup logic
System.out.println("CREDITS: thunder_sh0k");
System.out.println("-----------------------------------------------");
System.out.println("thunder_sh0k: came up with the name of the game");
Objects.requireNonNull(getCommand("start")).setExecutor(new MadnessPlanet());
}
@Override
public void onDisable() {
System.out.println("MadnessPlanet is shutting down.");
}
}```
If you add a print statement in your command code, does it print to console when it's run?
no which i found funny
that's not the correct class name
Well that means it's not running at all
your command executor is MadnessStart
not MadnessPlanet
omg
You tried to instantiate your plugin class
command label is not used anymore
Hello everyone!
I have a question for the smarter guys among you all :
I want my plugin to get initialized only in one server, so it can't be stolen from the owner for other servers.
How would you do it ?
Any tips are welcome...
(Obviously I'll obfuscate it and cipher every raw text)
- Obfuscation wont stop them
- DRM won't stop them
Because obf can be reverse engeniering
The solution is to stop caring
Genuinely
Yeah but it will slow them really hard, mainly in a plugin with 200+ class
You can make them harder with obfuscation and a secure license system (if isnt mean to be uploaded to spigot)
Yeah but you can use the same licence in another server ? No ?
Open source your plugin
Well that, and there are many benefits to it
Mh ?
People will trust your code a lot more, you'll gain the ability to have other people contribute, you'll be able to use it on your portfolio
And it won't really decrease revenue much
There are plugins that are open source and premium
Because most people don't want to download and compile a plugin on their own
Most people don't know how
hello guys i need help
And even if they do, they don't get support without paying, presumably
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
Ah, I see 🤔
Thank you for all of these tips 🥰
Take care bro
imagine
That's so sad
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
I created a mini really basic plugin and i would like to add a method to when i start the plugin in a server it creates a config.yml file
Lmao give a price
Can
I'm done
But won't know how unless they research it
"gradlew build"
sorry for asking a question in a row in under 5 minutes lol. how can i place a block relative to a ArmorStand entity so for example ```java
ArmorStand as = (ArmorStand)p.getWorld().spawnEntity(p.getLocation(), EntityType.ARMOR_STAND);
as.placeBlock(0, 0, 0, Block.BEDROCK); // I know this isnt a real function
who is pinging me?
Plugin#saveDefaultConfig()
Well gn
where do i put it im new at creating plugins
What's your point
My eyes hurt
Yes I know it's simple
But most people do not know how
It's not just one command
You have to clone the repo
You have to open a terminal and navigate into its directory
Not rly
And then run the build command
U can download it
My guy
You're missing my goddamn point
It is simple but most people do not know how
It's easy to look back in retrospect and say how easy it is
You're just a broken record aren't you
Like, once you know, yes it takes 10 seconds
But to someone with no background knowledge
They don't know how to clone a repo
They don't know what a repo is
this is such a dumb argument
They don't know what gradle is and wouldn't know how to use anything related to it
u dont need to clone it but you have a point
Right, lots of things seem easy once you've at least got your foot in the door
I'm just trollin anyways tbh don't mind me
But they can seem daunting if you have zero experience
where in the code
💀
Read docs
lol
?jd-s

