#help-development
1 messages · Page 1721 of 1
Enum Constant Details
NETHER
public static final World.Environment NETHER
Represents a nether based map ("hell)
copied from the spigotdocs
so it represents hell which is supposed to be a biome
but in later versions hell is replaced with something else and theres like another 50 biomes in the nether
i think that's the reason why it returns NORMAL in nether
Doubt it
That was changed way back in 1.13
And world environment isn’t connected to biomes
Hmmm what else would cause it then
that is like the only reason that makes sense to me but eh
idk what do i do now
i haven't tested in end yet btw
Im using bukkit4fabric api
because im using fabric server
Oh, yeah, that would 100% be it ;p
Those are definitely important details to include
A complete version of the bukkit API on fabric would be neat
But we are not there yet
yea well
i guess im gonna have to switch to paper, spigot or bukkit server instead of fabric
wait really?
i've never done it before
but is it possible?
like a mod or something?
Yes, you can write server side mods
He means rewriting your plugin to support Fabric using Fabric's API
i never knew
You can do it with forge too if you really wanted
time to get learning then
so I officially just found the shadiest name for a spigot fork
VeryGoodSpigotNoVirus
Is there any way to get a list of all modified slots from an inventory click event? I'm trying to make a custom gui where the player can still modify their own inventory while it is open without either losing items in the gui or taking them out.
Cancel any events where the clicked inventory matches the top inventory
The issue is things like the double click to collect action, where the click is in the player's inventory, but it still affects the other one.
You could add random pdc data to all the items in the top inventory to prevent that I suppose
Or just cancel that click type in general
I guess I can just go through the list of possible click types and cancel the ones that can do that.
@silk tusk You can either create a wrapper around the Inventory class, or if you only want to cancel the event you can create array size of inventory view that holds booleans or custom slot objects which should be protected
i always hear people speaking how fabric and spigot can be used together, is there an explanation on this anywhere
This is not the channel to advertise
can anyone tell me good scoreboard libirary to use it with out flicker
you don;t need a library. The API is fine
Hey everyone!
I had a question.. since I'm new to java and spigot stuff..
So I have a plugin named playershopgui+
There is a possibility to save data on a mysql database..
Item stack is saved in hashed string..
{
ownerUuid: 'ee454be8-086a-40e6-990f-99bb432d769a'
state: 'IN_PROGRESS',
startTimestamp: 1633597692829,
endTimestamp: 1633856892829,
price: 100,
itemStack: 'H4sIAAAAAAAA/+NiYOBgYMpMYeDLzcxLTS5KTCuxKk7MS2FkYHXOL80rYWQAADaxoS8iAAAA'
}
Is there a way I can decode this ?
Probably using same way you encoded it first? There should be a way to translate it back into a item in the source code
Depends on how you got that. If it's the hashcode, you're not likely gonna be able to reverse that. If you serialized it, then it could be reversed
That said, I wouldn't really recommend using serialization, since if there's any change to the itemstack class, now your data is useless.
Dumping the item's info to JSON or XML would be a better way to go imo. You'll still be able to save it in a database, and it'll remain functional even when the ItemStack class changes. (Just make sure you store all the properties of the item, e.g. durability, enchantments, lore, custom names, etc..)
you will realize how much more powerful gradle is when you use it
Hmmm I hear it can make client-side stuff
but no idea how to use it ;-;
You really should change that question... the reason no one awnsers you is that no one knows what you're trying to do since there is no executing a line of code as a player
Gradle isn't something just only for client-side stuff
in fact
its like literally another buildscript
Gradle is cool. I do prefer maven for simple things though
decompile the shopguiplus too see how it deserializes the data
maybe playershopgui+ provides API
for retrieving items
How can i execute this Rcd.setScore(1); line of code as the player. (Rcd is a scoreboard)
that literally makes no sense
^
Still doesn't make sense
what is the best way to save data?
aka
after server stop/restart
YamlConfiguration is what I use for now
not sure if there's something better
Try telling us what the wider issue is and what you're trying to achieve
SQL servers
how is your data being used?
with async tasks
how frequent are fetch
Databases arent good unless you fetch data periodically
and not always constant
such as
home locations (setHomes plugin)
tpa requests (last for around a minute and vanish out of the data)
etc
You may want to use a database for those
some last for 30secs
some last until is deleted manually
those are examples of things that happen once in a while and sometimes and stuff
but not always
help pls
what does a database mean?
like how to use it and how to set it up?
is there a link i can follow to learn about them?
i only started coding with java like what a month ago or something?
or other databases
You need to change your question to something more descriptive
thats one example
well for tpa requests you shouldnt save data inside files
No one know what you want to do
ok
what makes databases better than a simple Yaml file inside of the plugin folder?
since i only make spigot/bukkit/paper plugins
- Databases scale better with resources and more entries
- Databases are fast, so when you want to retrieve a value once in a while, it's ideal
- Jedis uses Redis, which is a native database written in like C or C++ that interacts with the Disk and native functions, allowing it to be much faster than Java
- When you load a YAML file, you have to load the whole contents, save and do all of that annoying stuff. Also, you don't want to end up with a gigantic YAML file at the end.
SQLite is another good option
what is the latest spigot(Not spigot-api) version?
Yeah
like i tried:
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.17.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
but it doesn't work
Did you run BuildTools
bruh, why use build tools if i'm using maven
Because NMS has copyright and can't be distributed
NMS?
net-minecraft-server
aha
its the minecraft server source code stuff
but then how did i import that thing before usign maven?
k
Do you want NMS?
if you want nms you need to import jar to maven repo or use tools like paperclip with arguments to do that for you
idk how you can do it via buildtools
its already relocated the chunk
hey i have run build tools where i put on m2
Hello, i want to make all of items Unbreakable for players, but this method works from 1.9 to 1.17
event.getItem().getItemMeta().setUnbreakable(true);
Anyone can help me for 1.8 ?
idk google it
sacarsm
get the meta, set unbreakable, then put the meta back on the item
EntityPlayer craftPlayer = ((CraftPlayer) player).getHandle();
Property textures = (Property) craftPlayer.getProfile().getProperties.get("textures").toArray()[0];
I can't seem to import stuff like Property and CraftPlayer
looking for a developer who could create a plugin that saves inventory data in sql database.
itemstack data as json.
item save on playerleave & every 5 minutes.
If anyone is interested... please let me know.
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
thanks.
Those are spigot not spigot-api
I dont have 20 posts tho 😄
@eternal oxide So how do I solve that, I will need both
do you use maven?
yes
yes, so long as you ran buildtools to create spigot
<artifactId>spigot</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
if I change that to spigot there is an error
@eternal oxide
did you run buildtools?
Where is that?
?bt
Corrupt chunk
you are as bad at my wife at listening.
not really
delete the corrupt chunk
How does Bukkit.dispatchCommand("",""); work?
ok
how could i do something like this
i would like a thread talking about that
specifically that movements
Why does this Bukkit.dispatchCommand("@a" ,"/scoreboard players add @s Rcd 1"); give an error?
No idea, perhaps the error could give you a clue
'dispatchCommand(org.bukkit.command.CommandSender, java.lang.String)' in 'org.bukkit.Bukkit' cannot be applied to '(java.lang.String, java.lang.String)' i dont get it
You're passing two strings when you need to pass a commandsender and a string
ok, what about that error do you not understand?
aka a player object or the console command sender
ohhh ok thanks
Jesus fanaly AFTER DAMM 5DAYS OF NON STOP TRIAL AND ERROR I FINNALY MADE MY FIRST PLUGIN. NEVER AGAIN NEVER AGAIN.
LATER NERDSSSS
gg
ban me
How do i reference all players in my main class? I tried Player p = (Player) Bukkit.getOnlinePlayers();
then how do i do it?
You'd have to get the online players then iterate through the list
idk how to do that im new
simplest way is a for each loop
e.g.
List<Player> players = Bukkit.getOnlinePlayers();
for (Player player : players) {
// do what you need to with each player here
}```
i would like to add something to all players tho, e.g. player.setHealth(20)
so put that inside the loop
it'll process each player one at a time
Say you have 3 players online: Jeb_, Notch, and Dinnerbone. player will be the player object for Jeb_ run all the code inside the loop, then it'll be Notch and run all the code inside the loop, then Dinnerbone and run all the code inside the loop
oh ok
so i found this
and i want it to be vertical
any help pls
Is the main plugin class supposed to be unused?
Yes. The server loads it at runtime but its not instantiated in the plugin itself
Oh ok the more you know
Swap the y coordinate for either the x or z coordinates
wdym
Your animation is horizontal. So if you want it vertical, switch the x and y axis around, or the z and y axis
thanks
so i decided to increase the RAD_PER_SEC and i saw this
that means that even if with a small value, the circle will increase and decrease
i would like it static
yo that’s kinda swaggy although why is the quality poo
if a player gets X blocks away from an armor stand i spawned with packets, the armorstand will disapear
and the x is entity tracking range
Why isn't my line in First Start is PermissionConfig.INS.setList("plugin.permissions", permissions); this line not working
Main Class:
https://pastebin.com/MFbR23uh
Permission-Config:
https://pastebin.com/4yAKeyjF
First Start:
https://pastebin.com/6icyfd12
help pls
change your math calculations
would there be any issue when I have a plugin and I want to link to some site that is unavailable in China? Would it maybe be unavailable there then?
or just don't loop it
change to...?
[Ketchop_Tutorial] Plugin Ketchop_Tutorial v0.10 has failed to register events for class me.ketchop.pog.main.Events.MobHeads because org/bukkit/event/entity/EntitySpawnEvent does not exist.
public void onMobSpawn(EntitySpawnEvent e) {
List<EntityType> types = Arrays.asList(EntityType.ZOMBIE, EntityType.SKELETON, EntityType.VILLAGER);
if (!types.contains(e.getEntityType())) {
return;
}
LivingEntity entity = (LivingEntity)e.getEntity();
entity.getEquipment().setHelmet(new ItemStack(Material.PUMPKIN));
}
}
wth
help?
it does exist like wut
how can i make my custom itemstack not placable
wait wrong one
how can i make this not placable
Ideally you'd give it some NBT tag in the PersistentDataContainer
o k
Can then check for it in BlockPlaceEvent and cancel as necessary
i wish this worked :(
Completely not copied
completely
Block metadata is set on the block in the world, not the item
PDC is similar to ItemStack metadata, I guess. If you want to think of it like that
Difference being that it's not. lol
Use the PDC. We have API for this now
If you set some PDC data to an item stack which is an instance of a placable block the place it down and get it back later will@it still contain the same pdc?
No
@ Pillow, ItemMeta implements PersistentDataHolder
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/persistence/PersistentDataHolder.html#getPersistentDataContainer()
So then how to pass it on to the@block?
You'd have to hold reference to that block and when broken, edit the item that's dropped
Save it to disk if necessary
I believe Chunk also implements PersistentDataHolder now so that's also an option. Can write the block to the chunk itself
But blocks also have pdc don’t they?
Custom block PDC stored on the chunk https://github.com/JEFF-Media-GbR/CustomBlockData/blob/master/src/main/java/de/jeff_media/customblockdata/CustomBlockData.java
Would definitely avoid implementing PDH
Oh, PDC even. That's worse. Heh
Especially because there's literally zero reason to
So you’re that once a certain item is placed, if it has Pdc with values I need, to store the data of that block somewhere and once it is dropped, to apply pdc back into it?
Of that item*
explain
Like on Block placed event?
Whoever wrote that, please inform them to not implement that interface. Just write wrapper methods. The implementation there is entirely useless and can still match the class, just remove the overrides ;p
Yes, on a place and break event, Daniel
Sounds good thanks
More API-friendly way to handle the dropping might be BlockDropItemEvent though
add your command to plugin.yml
Why do I get this error each time I open my project in IntelliJ.
Could not find spigot-api-1.17-R0.1-SNAPSHOT.jar (org.spigotmc:spigot-api:1.17-R0.1-SNAPSHOT:20210706.122143-68).
Searched in the following locations:
file:/home/retrooper/.m2/repository/org/spigotmc/spigot-api/1.17-R0.1-SNAPSHOT/spigot-api-1.17-R0.1-20210706.122143-68.jar
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
But building the project with Gradle works.
command not in plugin.yml
nope
you missed one or formatted it wrong
post full error
?paste
lol
oh - hey retrooper
LOL no - ping conclure
he is
or dm him
he will help fo sure
um did all the peoples icons just turn square from round or did I miss something?
what?
send pic
Just do a null check before you do the getChestplate()
LOL
after*
wtf
No idea, they just all went square
css didn't load properly
well either works ig
true
I really need help with MiniGames and Server Links
Please DM me
no
Payment includede
?services then
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
Oh right tysm 😉
first facebook now discord is going wonkey
mines been playing up for a few days. Its been blanking out or flashing
maybe just uninstall & reinstall or repair it or summin
maybe
its a method under InventoryView iirc
the get title
so InventoryClickEvent#getView#getTitle
yep it was moved a while back to the view
what api version - are you devving against
what server version
there is your issue
yep it was moved a while back to the view
yes
Ok, So if i have a List<Node> objects (where node is a custom object) and i do .contains(otherNode) what method is used to check? is it .equals? or is there another i have to override
it will use equals, but hash may also be used
I have a question..
I save player inventory to database...
{id:"minecraft:efficiency",lvl:2s}
but when I try to parse it with javascript it gives an error because of lvl:2s since there needs to be lvl:2
it here a way to keep integer only ?
Hello guys, I'm wondering if this function: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/LivingEntity.html#hasLineOfSight(org.bukkit.entity.Entity)
is it considered true even if the LivingEntity is not looking at the target entity?
from my testing it appears to return true even if the one of the entities is facing away from it
[18:34:09 ERROR]: Could not load 'plugins\HeroRushPlugin.jar' in folder 'plugins'
org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
Everything is correct in my plugin.yml im sure
name: HeroRushPlugin
version: '${version}'
main: net.higherlight.herorushplugin.HeroRushPlugin
api-version: 1.17
authors: [ HigherLight ]
description: Heros collect ritual torches in order to perform dark ritual which will defeat Herobrine.
that can;t be all your yml
wym
didn;t you have commands?
its a new plugin
im using gradle this time not so sure how to build the plugin but i made a new artifact that builds all modules. Maybe it's not including the plugin.yml?
Presumably yes. "Line of sight" seems to imply that they need to be looking at you but that's pretty misleading. Based on the documentation of that method it seems that the more appropriate name would be "canPathfindTo(Entity)"
e.g. how a zombie can still see you after you turn a corner
that would line up with the behavior I'm seeing. thanks
What's the issue with this?
Even tho it says this code works pretty fine.
Any idea?
the code is pretty big so wait ill just send the log
the full error is enough
mobkillcounter.java:28
Something is null on that line
check there is a killer first, then check they have a display name
No
?
That’ll still throw an exception
i mean doing this
Yes
Because checking if things are null prevents null pointer exceptions
does any of you understand why bukkit CommandMap implementation, SimpleCommandMap, register is synchronized method while getCommand method is not.
wouldnt that lead to visibility problems?
private synchronized boolean register(@NotNull String label, @NotNull Command command, boolean isAlias, @NotNull String fallbackPrefix) {
this.knownCommands.put(fallbackPrefix + ":" + label, command);
if ((command instanceof BukkitCommand || isAlias) && this.knownCommands.containsKey(label)) {
return false;
} else {
boolean registered = true;
Command conflict = (Command)this.knownCommands.get(label);
if (conflict != null && conflict.getLabel().equals(label)) {
return false;
} else {
if (!isAlias) {
command.setLabel(label);
}
this.knownCommands.put(label, command);
return registered;
}
}
}
@Nullable
public Command getCommand(@NotNull String name) {
Command target = (Command)this.knownCommands.get(name.toLowerCase(Locale.ENGLISH));
return target;
}
help pls
is it because registering commands can happen in different bukkit thread, and access to these particular bukkit commands are from main thread only?
afaik synchronized flushes its CPU L1-L3 thread cache to RAM, thus the main thread should see changes via getCommand(@NotNull String name) even if its not synchronized, right?
Hi everyone I need an developer that can help the server from me if there are problems to fix it and also add plugings. Dm me if u want.
You seriously are sending this to every text channel?
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
any ideas besides my problem?
i hate multithreading ngl
im just trying to reverse engineer a bit
for fun (fact: its not fun)
what damage cause does ender pearl count as?
guys how do i wait for the player response?
for like: i created a GUI, in whcih when player clicks on a item, he is supposed to send a message in chat, which should not be broadcasted to the entire server and i want to take the input of his message.
If i even get ways of how do it, that would be helpful, i dont even know what to use to make that...pls helP!
You can just add the uuid to a set and then intercept the next chat event
use the conversation api
Is it a stupid idea to run an async task that retrives stats from a database every 20 ticks? will this cause any major server lag?
depends on the database
well its stupid for me
20 ticks = 1 second
I think it is too stupid
i would store values in memory instead, in that case
async so not really any lag but every second is quite a lot - why not store in memory and purge to file?
It is not basically able to load 1000+ variables (/datas) per second
mongodb getting things from discord, which i sorta can't save in memory
are you getting some kind of chat history or what
you definitely don;t need to poll anything every second for discord
ye something like that, I don't want to use JDA though
then i might aswell increase it
what about fetching chat history whenever you really need it?
how am I supposed to check if I need this data now or later though.
also isnt logging chat kinda illegal in tos?
oh wait nvm
well its not for me to talk about tos im using LightCord lol
not sure really, it's not logging chat, but like discord (but more scuffed)
mfw the logs folder of a server exists, as do client logs which logs every single message your client receives
- no one talks about how discord might log their own messages 🍭
I mean it has to
Otherwise I wouldn't be able to Ctrl + F for the first ever message sent in this channel
It must be inside their databases.
true & true
"log their own messages" what
Are you seriously acting like storing messages is some sort of privacy invasion
It is literally necessary to the service
so, thanks!
i'll just increase my polling time as 1second seems far too much
2 seconds is still a low amount of time.
i still don't seem to think why don't you do query whenever you invoke the method or some sorts, there should be some kind of entry point to this usage
You should set it to at least 10 seconds.
i was thinking more of 60, but idk
Or if you are sending too many datas/variables, you will need at least 1, or more minutes.
oh
What type of data is it?
logs
message content
For example: one of my project's has like 300 datas in it. It needs at least 5 seconds for me to send them all along the services.
i am not literally logging my messages to the spigot server
But since I changed host, the amount is way more shooter, and is able to send them in under 3 or 1 second.
I read your initial use case, you're just trying to prompt the user to respond to something in chat, right?
Theoretically you could save everytime someone sends a message just do it asynchronously.
async would be fine if it was a short period right?
Syncing is not good with low amount of time.
Wait.
You want to send a message in every other server?
'cuz it is basically not that easy but be ready
Wishin' thy best
. . .
like discordSrv plugin, but more scuffed-
- i do all my discord stuff in python, so i need a way to link them together, hence mongodb
Isn't a MySQL better for that?
Mongo works fine
Then forget what I asked
🤣
It was never thee
It was asked by someone who is copying me. 😆
mysql, idk how to use it 🍭
how am i supposed to send a set in a event class??
but anywhos, thank you!
you dont. You create a seperate class holding a set with event handler inside it
also is there a way i can somehow create my own event?
ie, an op event when someone got opped
Check it in every ticks. 😆
walp
also found the forum for this
And set a variable to stop the event repeating itself.
i didnt understand, but i got a idea :)
@ivory sleet did retrooper message you about gradle?
Nope
Or well he sent conc
maven is just simple and it works
i have no need for gradle
hence i am in no hurry to learn
Ollie learning gradle 2030??

Sadge
but hey
im sure it isnt that bad
just need to learn it first
i hate how many files it generates tho
Doubtful


You might be shading something and shouldnt be
max you can post is 4mb
no i just shaded okhttp
its 3mb alone
so what do i do i cant just break my plugin bc spigot got a small limit
limit should be like 10mb
Depend on it rather then shade it
or use the plugin.yml dependency thing
No one said anything about an external site
anyone would like to help me with synchronization of an object?
Unless aternos blocks the new dependency system XD
sounds like something aternos would do tbh
Legacy Support moment
wait how is discordsrv still on aternos if its external link now
lets say i have a map inside MapHolder.java:
public class MapHolder {
public Map<String, Object> map = new HashMap<>();
public synchronized void setMap() {
}
}
and another class MapAccessor.java:
public class MapAccessor {
public MapHolder holder;
public MapAccessor(MapHolder holder) {
this.holder = holder;
}
public Object accessValue(String key) {
synchronized(this.holder) {
//...
}
}
}
will these synchronized thread locks would "communicate" even if they're in different classes, but having the same instances as monitors?
will accessValue method be thread blocked until setMap() initializes?
cmon where are the experts
at this i really need some help this time
no because they are sync on different objects
let say MapHolder instance and MapHolder instance in MapAccessor are the same
isnt synchronized keyword is just synchronized(this) syntax sugar
no
its syncs on an object
like two threads could enter accessValue and one would lock, however any thread could call setMap (if it has access)
as its a method sync anything that has access to the object coudl call it, one at a time
I have a small problem, I logged in my server with 2 accounts, one of the account has operator, and another doesn't, and now I realized that I am not able to run commands with non op account....what do I do??
go back to the other acc
but it would not be restricted by the accessValue as its already passed through that and got a reference
but synchronized method uses its own class instance to lock on
so it should be technically possible to make them interchange

Synchronized method locks the entire object. Synchronized block just locks the code within the block.
yes, but not the outer object
wdym by outer object
your accessValue
but synchronized block inside another class is using the same instance as MapHolder instance class
why do you not just use a SynchronizedHashMap? or TreeMap?
because its beautiful NMS
oh
sychronized 🥴
hello can you help me to replace my mapping, when I want to use an nms function it is always a,b,c etc... so how can I do (im in 1.17.1)
Obfuscation changes every update gotta find the new packages/methods
yeah but im on it from yesterday and I didn't found so I request help here
Hello I would like to save a GUI inventory to a json, I already made so the inventory gets saved to a List with inventory.getContents() then save the List data to a .json file. This works but in the json this is what I find [[Lorg.bukkit.inventory.ItemStack;@1947a941], and I can't seem to restore that to an inventory. What should I save to the json? and how can I restore what I saved?
Save each itemstack
uh no I found (I said nothing lol)
that's the output of toString() method. Your json parser doesnt know what to do with that object how to serialize and use toString method
iirc
Ah json not yaml
can i ask about plugins here?
yes
IMO I find json easier to use, I always have issues with yaml
do any of yall know how to sync ultra permissions with nametagedits?
Should I use a for loop?
how would you iterate the itemstacks besides that
You probably need to run them through base64 or something of the sort
No idea what the api has internally for serializing itemstacks
something like for(ItemStack item : inventory.???) but idk how to get each itemstack
if item!=null
Worth noting that Inventory itself is Iterable
Is it? cool
oh
itemstacks has implementation of ConfigurationSerializable
that way you can return Map of serialized objects and store it
so wait for each item that is not null inside inventory, I add it to the List?
whenever you would like to deserialize it you'll get that map from the file and use deserialize method
my test is very dumb but i don't have time for proper test class, but this test shows that synchronized blocks and synchronized functions communicate with each other whenever lock object is the same
it is syntax sugar after all
import java.lang.Thread;
public class TestClass {
public static void main(String []args){
ObjectHolder holder = new ObjectHolder();
ObjectAccessor accessor = new ObjectAccessor(holder);
new Thread(() -> {
holder.set();
}).start();
for (int i = 0; i < 9999; i++) {
accessor.accessValue();
}
}
}
class ObjectHolder {
public String value = "String havent been changed yet!";
public synchronized void set() {
try {
System.out.println("Changing the value...");
Thread.sleep(4000);
this.value = "Value via accessor print";
} catch (Exception e) {
}
}
}
class ObjectAccessor {
public ObjectHolder holder;
public ObjectAccessor(ObjectHolder holder) {
this.holder = holder;
}
public void accessValue() {
synchronized(this.holder) {
System.out.println(this.holder.value);
}
}
}
I can't find a good, well, anything to find how to make a maven plugin. I added the spigot api and the repository to the pom.xml but when I do implements JavaPlugin to the main class, it doesn't exist
?paste
access value waits for lock of synchronized method instance lock to finish doing set() function
output:
...
String havent been changed yet!
Changing the value...
Value via accessor print
Value via accessor print
...
i've never written such dumb code before
but hey it works lol
^
A synchronized method is just syntactic sugar for a synchronized block. Functionally, they're identical. https://coderanch.com/t/607701/java/Difference-synchronized-method-block-advantages
Synchronized Method :. Is the above difference and uses correct?
here is my pom.xml https://paste.md-5.net/ukigubuwom.xml
you need to extend the JavaPlugin not to implement it
JavaPlugin implements Plugin Interface
omfg lol
im dumb
just a little brainfart
wait
its still not working JavaPlugin cannot be resolved to a type lol
have you added spigot-api to maven pom.xml?
Intellij?
Eclipse
Have you tried reloading maven project?
in intellij context menu there's reload maven project button
it resolves dependencies then
I friggin didn't save my pom.xml 🤦♂️
I am brand new to maven as you can see, so where to I put my plugin.yml?
src/main/java?
src/main/resources
src/main/resources
oh
i suggest you using intellij
y
I am not blind
and intellij autocompletes plugin.yml for you
kinda
it provides you default keys of yaml values of plugin.yml
shows code smells
etc
I don't want to use intellij, I learned to code java with eclipse, i'm not switching and thats final
that's my personality regarding Sublime Text lol
I don't want to use VSCode, I learned to use ST and im not switching, that's final
also vscode is SLOW
the only cons of ST4 is that it does have worse version control support
I used Sublime Text before I switched to vscode but I agree ST is really good, but I only used sublime text for a month so its not my personal choice
and annoying popups of free version
vscode 100% free just saying
but look how much ram does it eat up
open-source I believe too
its fricking electron app
not much
is there a way to get a player object with just the player username string?
its basically chromium without the tabs.
if it was native win32 application, i would love to use VSCode and i would ditch ST away, but whenever i use VSCode i feel some kind of slight input lag while typing
while in ST4 its fluent
anyone pls 🥺
player#getName();
30 mb Sublime with opened files
Bukkit.getPlayer / Bukkit.getPlayerExact
Bukkit.getPlayer()
ooooh thats what he meant lol
^ 🤣
i remember i used a life hack to get exact players on skripts 😄
i used offline player as an arg everywhere
bbbbb
Only the string version
I literally got so much bullied for using skript from my colleagues as my main scripting language that i've challenged myself to learn java lol
ty @young knoll @mortal hare
I just figured out what skript was and if I was one of your colleagues no offence I'd be the one that is laughing the loudest
i was so good at it that i've managed to beat some plugins on the market in terms of performance
i remember i skripted chunk collector skript that performed roughly 80% faster than native java plugin lmfao
and had a nicer gui
tbh i used java a bit
there was a addon for skript called skript-mirror if im correct
it would allow you to hook into java plugins
via skript
How does one beat native java with an interpreted lang
I am lucky i had option to decrease my plugin jar but idk what other users can do now
hence minimize
this doesn't look like code https://imgur.com/a/KeRfkad
This is not development, this is just skript hmm
I know
that's basic stuff
import:
java.lang.String
java.lang.StringBuilder
expression convert minecraft font %string% to unicode font:
get:
set {_unicodefont::*} to ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz") split at ""
set {_minecraftfont::*} to ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz") split at ""
set {_minecraftstring::*} to expression-1 split at ""
set {_minecraftstringsize} to size of {_minecraftstring::*}
remove {_minecraftstring::%{_minecraftstringsize}%} from {_minecraftstring::*}
loop {_minecraftstring::*}:
if {_minecraftfont::*} doesn't contain loop-value-1:
add loop-value-1 to {_converted::*}
continue
loop {_minecraftfont::*}:
if loop-value-2.equals(loop-value-1):
set {_order} to loop-index-2 parsed as number
add {_unicodefont::%{_order}%} to {_converted::*}
continue
set {_unicodestring} to new StringBuilder()
loop {_converted::*}:
{_unicodestring}.append(loop-value-1)
return {_unicodestring}
this is an example of unicode converter i've made earlier
via skript-mirror
that still doesn't look like code
Why not use java instead of skript
maybe on racket level
indexof would be great here
this was written in 2019 iirc
in early 2020's i switched to java
and here i am now looking at NMS and frustratingly trying to hook it to my code thread safe lol
I wonder if skript was around when I started
skript was made i think in 2014 iirc
2012
imagine not writing all your plugins in x86 assembly
i made factions copies lol
smh
So yes it was around when I started
i had a 3k line skript which was complete replica of factions plugin
OOP isnt a thing in skript
it have option to google translate
basically he tells his opinion about skrpit
i think skript is fine, for simple commands
i would still prefer skript over for example mycommand or deluxecommands due to the flexibility of it
if i didnt had any coding experience
How do I interact with worldguard regions in myplugin?
yeah but for anything more than super basic stuff in a very small-scale environment skript is no good
its inefficient and generally just a terrible idea for anything other than like a basic command in a server with a few friends
yea i get it, its due to the way it interprets its slower than native java, but the performance is not that noticeable, at least at my end when I was skripting back then. I've ran a server with constant 150 player base, and i have no issues with skripts at all, but yeah java is way more better.
i am sorry i only saw the ping, my bad...thank you too!!
it was inefficient af before, now its more optimised with newer builds
Skript runs using Java so it must be as fast as Java 🤡
Skript extends Java
javaskript
yep but it is just a basic scripting "language" and honestly shouldn't be used
java as a whole is a performance nightmare but an interpreted language written in java is so much worse
I wish notch had just used c++
Java is nice
Java isn't even that bad
if it was compiled language there wouldnt be mods that powerful enough
that makes no sense
The performance is inevitably worse however we got garbage collection in return
compared with a language like c++ that gives you low-level control among many other things java is very slow
good luck trying to find function pointers and memory addresses for a game which wouldnt have had any api for devs
A lot of the performance problems comes from jank code, not java itself
java itself has an inherent overhead because of jvm
there are c++ libraries too... lmao
Anyways Java is providing new features like the new incubator api allowing us to interface with low level stuff.
maybe but c++ will always be more efficient and give more control to the programmer
BUT
CUTE PFP CONCLURE
Sure it gives control but the cost is that we have to concretely, manually do a lot of stuff for ourselves which take time
☺️
cpp requires waaaaay more skill and knowledge to use effectively and Java much less of a learning curve and some nice features
Yeah
and no boilerplate code or any stuff like that
Though I love cpp cus vararg templates lol
how would you make a mod that replaces internal parts of the game besides patching the executable, and that requires assembly knownledge which only population density of iceland knows
cant imagine what a leaky nightmare new devs' plugins would look like if they had to write them in c++ lmao
dynamic linked libraries lol
doesnt require assembly knowledge
you need to find the entry points to the game first of all to use it.
windows uses the concept of a dynamically linkable library for example that could be used as a plugin
yes
it not as if they written the server from scratch
people have already written functional minecraft servers in c
that's just makes things harder to manage
I'm pretty sure people have written functional minecraft servers in everything
to have it analyse the game without knowing its source code properly
the c implementation can use java libraries lol
just uses JNI for compatibility
and u could also implement a plugin system into the server software itself with an interpreter for something like lua
like basinserver did
but imagine updating your modded server software every time a new version releases
Low memory footprint (13 MB for a 400-chunk spawn and one player on a 64-bit system) and you gotta admit thats pretty incredible
without any tools like Fernflower
Yeah good thing we don't have to do that now
thats why it would have to become more of a community situation lol
i mean to be fair u can setup a cron job script to pull newest release from a mirror automatically
we do, but mappings, decompilation tools, exist. While decompilation of compiled languages are either decompiled in assembly form or broken c form in IDA pro decompiler, which is not cheap, nor very fast to do so
but auto updates on critical backend stuff (eg server jar) is a bad idea
IL2CPP
Think that only works with stuff that was originally converted from C#
No idea
yeah that's unity compiler from c# to cpp
C# also runs much slower than c++ afaik
it isnt??
^
well Java does have both interpreter and JIT
C# is compiled to IL (Intermediate Language) which is later JIT'ed (just-in-timed) at runtime into instructions which are specific to the processor
java is WAY slower than (extremely well written) C
Where is that chart
a relatively new dev will write much more efficient java than c
just like Assembly can be WAY faster than C
wait holy shit since when is rust so fast
yeah but like
i felt it somehow
i wouldnt really want to use any other lang than python for API dev for example
even tho im not rly a python dev
i dont get the hype behind python tho
I think it's all the libraries
i don't like it, maybe i should try it more
Slap out a data analysis program in like 50 lines
python is great for short stuff, apis, data science, among other things
best quick scripting language that can do anything
and u can learn the whole lang in like 30 mins
for some reason i like PHP, it feels strong typed,
I'm trying to make a custom chat plugin for my roleplay server. It's gonna have things like roleplay chat, global chat, and kingdom chat. What's the best way to do this and still have to code looking organized and expandable? Any references would be appreciated!
it feels like C sometimes
but without memory addresses and such things
although im not into web dev
bukkit was created by lead minecraft developers
yea but it wasnt official, no?
not really
pretty much it was
bukkit was created, THEN they were hired by Mojang
pretty much is very different from yes lmao
ye
Yes
oh
Same thing happened with the Aether mod
yeah dinnerbone was hired after the bukkit iirc
Dinnerbone from bukkit,
kingbdogz from aether,
slicedlime from youtube
Imagine a world where Minecraft used Swedish for all its internal stuff
😌
/give @p minecraft:krut 1

There are a few former Forge maintainers in there too
Fry for instance was hired by Mojang
what's up default dancers
you know what would be really cool? an enum saying why the player item damage event got triggered
ain't that the truth
Isn’t that the cause?
it says as a result of being used, could be block break or entity damage right
The PlayerItemDamageEvent doesn't have a cause
You can somewhat detect by the amount
or other use
declaration: package: org.bukkit.event.entity, class: EntityDamageEvent, enum: DamageCause
Oh item damage
yeah PlayerItemDamageEvent is what I'm talking about
Items take 2 damage for the wrong use
Axe:
-1 for breaking any block
-1 for chopping wood
-1 for stripping wood
-2 for hitting a mob
I thought they changed axes since they are a weapon now
just to name a few "uses"
uh
Axes, pickaxes, and shovels:
Breaking a block that breaks instantly counts as 0 uses.
Breaking other blocks counts as 1 use.
Paving dirt or a grass block using a shovel to make a dirt path counts as 1 use.
Using an axe on a log or wood to strip it counts as 1 use.
Hitting a mob (hostile, neutral or passive) counts as 2 uses.
I mean if the wikis are right it should be like this
I don't really need it to be as granular as telling me every possible use because there's quite a few but distinguishing between block damage, entity damage and other damage would be 💯
I mean you could hack in a way to detect it
yeah I am aware
See which event was called last for that player
I might have no choice here, still thinking about my options as I wait for that second cup of coffee to kick in
PR
this might be a 3 cups of coffee issue
I have one bit of NMS in my plugin and it makes me sad
I have no nms on my 50k line project and everything is sunshine and unicorn farts
Cries in
if (!((CraftBlockData) material.createBlockData()).getState().canPlace(((CraftWorld) target.getWorld()).getHandle(), new BlockPosition(target.getX(), target.getY(), target.getZ())))
return;
And yes it is ugly
if I could assume that the event goes unmodified tbh I could guesstimate the type of damage based on how much damage was dealt
but that's a really fun hack that for sure is going to come back to bite me in the ass
I would just use the last event triggered
block break event vs entity damage by entity event with a player filter?
I assume the durability event comes after entitydamage and blockbreak
Pretty much
when you assume you make an assuredly good bit of code is what my grandma always used to say
I am the world's leading expert on the latter
my highscore is 1 year and 1 day of continuous intensive work on my plugin with no public releases
and I think 50 something dev releases
Honestly I just don't want to write the resource page
correction, 45 dev releases
A nice little site like the quark mod would be cool, but that requires money
I even procrastinate on dev releases, half of them have changelogs so long they go beyond the discord character limit
ok well I realistically only ever need to know if the damage is coming from damaging another living entity so I'll just scan for that based on my own internal damage detection, which is the specific case I want to account for
it's a 2 cup of coffee problem after all
ah but this will trigger multiple times possibly in the same tick for the same player
actually certainly in the same tick
How can i disable the recipe book? I already try to cancel the PacketPlayInRecipeSettings but i doesn't work
oh no I'm becoming twitter
Make it final and use UPPER~CASE
and add a diamond operator
I know but its for a custom furnace inventory. For normal furnace inventorys i want the recipes. I know i can add them again but i dont know man xD
also, there's probably no reason to make this static
every time you tell me how to do it I will make it worse
Not yet
don't make me pull over and turn it into an arraylist
Oh god lol
it is now an arraylist that keeps adding entries and has a separate hashmap that tracks how many entries it last had so if there are more entries than the last count it is valid again and should cancel the event
why
because I just want to see the world burn
if i say p.sendMessage(ChatMessageType.ACTION_BAR + "§7You used §6STUN!"); in an event it rather sends it via the chat oddly like this: ACTION_BARYou used stun!
Obejct[] that stores ArrayList<HashMap<Object, Boolan>> @torn shuttle
the world wont burn
it will skip to nonexistence
any help?
Comma
ohh 🤦
p.spigot().sendMessage(ChatMessageType.ACTION_BAR,...); iirc
uhh it gives this error
new BaseComponent(...)
also what is the use of #spigot after p
Specifically you probably want a TextComponent
how do i use that?
Coll will help u im headin to bed
public static Object c = new HashSet<Player>(); if you want real chaos
how i can do a countdown that start when I put a command
🙃
how does choicemap work? for shaped recipes
The simplest is just new TextComponent(string)
so p.sendMessage(new TextComponent(...)) ?
im fine thx
supports format and color hex codes but not hoverevent or clickevemts
oh ok
can anyone help?
like the class
how do stuff like different wood chests, inversed shears, axes and hoes work?
this?
p.spigot().sendMessage(new TextComponent(ChatMessageType.ACTION_BAR,"You used §STUN!"));
ChatMessageType should be outside the text component
Oh ok thx
Not sure if you need multiple recipes for flipping the shape
§§§§?
wont show up in minecraft
It will
then shears?
But you can’t use them with components
You need to use TextComponent.fromLegacyText
shoot
It’s used as the color character
but the char itself wont show right?
