#help-development
1 messages · Page 140 of 1
and have a caffeine cache for my items
that way, my lookup is pretty damn fast anyway
compared to deserializing all data from the PDC
Use Protocollib and replace the PDC with a UUID
Going to break stuff in creative mode though so keep that in mind
Where can i find a good tutorial on how to save data in a yaml file?
well
you can create a new YamlConfiguration with the name of your file (or the file object itself, not sure)
and the use it like you would use a config
bukkit docs
?configs
See this wiki page on how to use custom configuration files: https://www.spigotmc.org/wiki/config-files/
Thanks
Why is event. going red?
I had this working yesterday 😢
shit
now get player is red
Player p = (Player) event.getEntity();
That worked
True
You'll get an error
Anyone who has used WorldCreator? I removed the water and it still creates a world with water
My code
WorldCreator creator = new WorldCreator("mine");
creator.generatorSettings("{{\"coordinateScale\":684.412,\"heightScale\":684.412,\"lowerLimitScale\":512.0,\"upperLimitScale\":512.0,\"depthNoiseScaleX\":200.0,\"depthNoiseScaleZ\":200.0,\"depthNoiseScaleExponent\":0.5,\"mainNoiseScaleX\":80.0,\"mainNoiseScaleY\":160.0,\"mainNoiseScaleZ\":80.0,\"baseSize\":8.5,\"stretchY\":12.0,\"biomeDepthWeight\":1.0,\"biomeDepthOffset\":0.0,\"biomeScaleWeight\":1.0,\"biomeScaleOffset\":0.0,\"seaLevel\":1,\"useCaves\":false,\"useDungeons\":false,\"dungeonChance\":1,\"useStrongholds\":false,\"useVillages\":false,\"useMineShafts\":false,\"useTemples\":false,\"useMonuments\":false,\"useRavines\":false,\"useWaterLakes\":false,\"waterLakeChance\":1,\"useLavaLakes\":false,\"lavaLakeChance\":10,\"useLavaOceans\":false,\"fixedBiome\":1,\"biomeSize\":1,\"riverSize\":1,\"dirtSize\":33,\"dirtCount\":10,\"dirtMinHeight\":0,\"dirtMaxHeight\":256,\"gravelSize\":33,\"gravelCount\":8,\"gravelMinHeight\":0,\"gravelMaxHeight\":256,\"graniteSize\":33,\"graniteCount\":10,\"graniteMinHeight\":0,\"graniteMaxHeight\":80,\"dioriteSize\":33,\"dioriteCount\":10,\"dioriteMinHeight\":0,\"dioriteMaxHeight\":80,\"andesiteSize\":33,\"andesiteCount\":10,\"andesiteMinHeight\":0,\"andesiteMaxHeight\":80,\"coalSize\":1,\"coalCount\":0,\"coalMinHeight\":0,\"coalMaxHeight\":0,\"ironSize\":1,\"ironCount\":0,\"ironMinHeight\":0,\"ironMaxHeight\":0,\"goldSize\":1,\"goldCount\":0,\"goldMinHeight\":0,\"goldMaxHeight\":0,\"redstoneSize\":1,\"redstoneCount\":0,\"redstoneMinHeight\":0,\"redstoneMaxHeight\":0,\"diamondSize\":1,\"diamondCount\":0,\"diamondMinHeight\":0,\"diamondMaxHeight\":0,\"lapisSize\":1,\"lapisCount\":0,\"lapisCenterHeight\":0,\"lapisSpread\":0}");
creator.createWorld();
Yes worldcreater is like that
I mean its just a json file cramped into a string
throw that in a json file lol
as for the actual problem, my WorldCreator never went further than creating new vanilla worlds
you might actually have a parsing error xD
since I think you arent closing with enough }
or you typed a { too many at the start
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
just throw in a file and ask the classloader gently to give the contents
this is everything inside that string
no
why
so why not make an object
you can make a hasmap with target and a list of pairs that store sender and times
like HashMap<UUID, List<Pair<UUID, TimeStamp>>>
but even this is excessive
a pair is a single map element
<L, R>record Pair(L left, R right) {};
yeah or you can just use records
java should introduce record class
assuming you have atleast java 14
make a hasmap with UUID and a record of UUID and timestamp
thats all the info you need
for denying or accepting requests, you check by target , i.e key of the map, and for sending you add a new entry to the map
but if you want a target to be able to handle multiple requests, you need to store a list of player records
sometimes im wondering wth people are doing
Or just valueOf :3
.equalsIgnoreCase != .equals
valueOf(name.toUpper
I mean thats fine and all if you only have 1 worded names
looking thro all the code of my saved repos
I refuse! 😂
)
Hello, I have a problem. I set the player's resource pack using the Player#setResourcePack method. Pack uploads without any problems. Unfortunately, for some reason it never returns SUCCESSFULLY_LOADED status. The other 3 statuses work without any problems. When it returns ACCEPTED, it never returns FAILED_DOWNLOAD. What is it caused by? How to solve it?
Turkish locale bug
It's all fun and all until you actually need (or rather want) to use it
isnt that the point of a predicate lol
imagine willing to use it
i had to
for database and visual stuff
had to create a whole application and it sucked
It's hard to mod most games without experience in C#
mmhh
I am currently attempting that but just went "eh who cares" and tried to edit the CIL directly
However for some ungodly reason there is no proper CIL assembler/disassembler
lmfao
we had out first lesson introductions to programming today, there were like people there who'd never touched a line of code and teacher started explaing bytecode 💀
I mean there are - 4 in fact - but one does not easily work on linux and the other three do not like generics or are not compatible with monos ilasm
I dont wanna spread hate but java and cs are pretty similar ngl
🥲
They began with bytecode?
mwoa explaing oop first
and then how java code gets executed and stuff
i was like bored lol
Yeah the CIL is pretty similar from what I have seen
you should start by explaining variables and functions
not OOP , bytecode or java code
she explained oop lol
ig those people who never programmed didnt understand anything of it
she was like going crazy thro her explenation
same for databases dude
did 100 slides on hour n half
cuz you need to know what variables and functions are to know what objects are and why/how they exist in teh first place
I have been doing programming at school for a bit over a year now - and unless you are in uni I can say you will stay bored for the rest of your stay
smh
only thing that i'll learn that idk yet is awt stuff
well actually
she said we wont be coding graphical apps :/
isnt that just a library?
AWT is standard java API
i saw some awt imports so i guess its called like that
Swing is a standard extension for java
mmh
You will ikely use that
this shit
JFrame is Swing (javax.swing.*), Frame is AWT (java.awt.*)
ug
Do note that AWT and Swing have rather large interop
Swing is mostly just updated AWT
isnt it
and like you can use most of awt. classes when working with swing
Assuming that you are in a course comparable to the one that I am in (where 90% of people have never seen a line of code) you will do that in two years at earliest.
More like a superset
umm same in university lol
in school we studied PascalABC
On first HE grade c++
On second Java + Python
Still nobody on 2nd grade know anything about programming cuz they just copied + pasted code to pass exams
that just sounds like bad exams
Same here
We've had one year of programming and one year of web dev
The people in my class can't do either
well basically they had to learn descriptions of what pointer is
contructor
and so on
basically you have to convince examiners that you know what these things are
probably write some examples
but mostly just talk
But to get access to this exams you need to complete tasks
basically a solution with four-five .cpp and .h
which you can copy paste
the rest is done by simply memorizing what pointers/constructors/destructors/methods are
I am trying to see if the first character of a AsycPlayerChatEvent message is equal to "/" but im getting an error saying cannot resolve method
if (event.getMessage().charAt(0).equals("/") {}
how do I fix this?
Dont do that
Even if it were possible you'd need to use event.getMessage().charAt(0) == '/' (although I'd use codepointAt instead of charAt)
However commands are not messages, and therefore this does not apply
I am trying to set the chat format to something different for different permissions so I would do for a quick example:
@EventHandler
public void onChat(AsyncPlayerChatEvent event) {
if (first letter of message is not /) {
if (the player has the permission for the highest rank format) {
set the format to the highest
} else if (has permission for the second highest rank format) {
set the format to the second highest
} and so on for all ranks then else {
set the format to the lowest rank
}
}
}
And why dont you just create a command for that?
tf
would a cmd do for that
I am setting the chat format
for each luck perm rank
Ah you are excluding the /
yea
Talking about brigardier?
cus tbh idk what it'll do for cmds or if I even need that
If so you'd need to use brigardier
whats that
Mojank's command framework
I think he just wants to format his chat according to his ranks
OH
so do I need to exclude cmds or I dont need to do that
Then you don't even need to check for /
Do you have luckperms installed?
yea
Since all comamnds are automatically not messages
but I make my cmds with asyncplayerchatevent
??
xD
You can?
actually no
Even then it will not have an effect
I use the preprocess
I used to
but I cant cancel them ;-;
to remove the error msg
cus otherwise all my cmds are case sensitive
@fresh templetHandler
public void onCommand(PlayerCommandPreprocessEvent event) {
Player player = event.getPlayer();
if (event.getMessage().equalsIgnoreCase("/store") || event.getMessage().equalsIgnoreCase("/buy") || event.getMessage().equalsIgnoreCase("/shop")) {
event.setCancelled(true);
player.sendMessage("§fHere is our store: §bwildgames.tebex.io");
}
}
or operator breaking discord lol
codeblocks
can still edit the message yk
@EventHandler
public void onCommand(PlayerCommandPreprocessEvent event) {
Player player = event.getPlayer();
if (event.getMessage().equalsIgnoreCase("/store") || event.getMessage().equalsIgnoreCase("/buy") || event.getMessage().equalsIgnoreCase("/shop")) {
event.setCancelled(true);
player.sendMessage("§fHere is our store: §bwildgames.tebex.io");
}
}
ok welp thx
yea ik
why do use java?
the green thing
uhh
try it
It details the java words
m ok
@EventHandler
public void onCommand(PlayerCommandPreprocessEvent event) {
Player player = event.getPlayer();
if (event.getMessage().equalsIgnoreCase("/store") || event.getMessage().equalsIgnoreCase("/buy") || event.getMessage().equalsIgnoreCase("/shop")) {
event.setCancelled(true);
player.sendMessage("§fHere is our store: §bwildgames.tebex.io");
}
}
cool
Don't you wanna send a clickable link?
public class Fart extends Fortnite
;-;
more like
public class Fortnite extends Trash
^
Is it possible to run the methods on onEnable(); method synchronized
Any idea how if (and how if possible) to make third party library that is using slf4j as logger to use Bukkit logger format ? I successfully removed message with filters, but i wonder if there is any way to just make it in that format
so if I do this will it carry the color codes over to the players name and all or do I have to do smthin else?
event.setFormat("§c§lOWNER§c " + event.getPlayer() + ": " + event.getMessage());
setFormat is using C style string formatting iirc
u wanna use event.getPlayer().getDisplayName() or smth probably?
.setFormat("%s : %s"); where first s is name and second message
will event.getPlayer() not work to get their ign?
you cant append player to string
ok
Hey, I want to add a dependency to my "depend" field in plugin.yml. Where can I find the name attribute for said dependency?
It's simply the other plugin name(s).
what
The name that comes up if you type in /pl
depend: [OnePlugin, AnotherPlugin]
How can i save data in a Yaml File?
Use the configuration api from bukkit
Start here. This is written for the default config.yml file, but later they tell you how to save other data in the file.
https://bukkit.fandom.com/wiki/Configuration_API_Reference
The Configuration API is a set of tools to help developers quickly parse and emit configuration files that are human readable and editable. Despite the name, the API can easily be used to store plugin data in addition to plugin configuration. Presently only YAML configurations can be used. The API however was designed to be extensible and allow ...
Note that the API has changes for comments, but you shouldn't be putting comments in a data file anyway.
And only use it for small-ish files, because big YML files take forever to save.
weird flex
thats not a flex but nice sarcasm
how to get nms remapped jar for 1.16? when I run java -jar .\BuildTools.jar --rev 1.16.5 --remapped
I will get [WARNING] The requested profile "remapped" could not be activated because it does not exist.
1.16.5?
So efficient
I'm guessing remapped option only works with 1.17+ ?
Learn javas concurrent lib entirely
1.16.5 exists?
aight
yup. it builds the regular jar file but no remapped
that's an oddly specific version
they probably didn't add a remap for it
try 1.16 or 1.16.2
I tried 1.16.1 and 1.16.3
oh
2Hex on a deeper level even memory fences
how can i prevent a falling block to place himself? i'm launcing some blocks in the air but i don't want them to be placed when hitting the ground, i like them to be destroyed once they hit the ground
name: MineFallsCore
version: '${project.version}'
main: dev.giorno.minefallscore.CoreMain
api-version: 1.19
authors: [ TheGiorno ]
description: Core API and functionality for MineFalls
website: https://giorno.is-a-good.dev
commands:
spawnentity:
usage: /spawnentity ENTITYNAME
description: Spawns a custom entity with their name
depend: [ProtocolLib, LibsDisguises]
``` im getting a `org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml` error on this config
anyone have an idea on why this happened?
How can i get all data saved in a YAML file like a list of team. Example: TEAMS LIST: team1, team2, team3
There should be more to that error
?paste the whole thing
there's a method getList() this returns a List<?> so you can use that, if you are using other types of lists there are also string lists and int i believe
getStringList()
can you send me an example of a command?
I don't know what you're trying to do. A command of what?
a command witch send the list of the all teams created
What does your config look like?
test: owner: ==: Player name: Gurwi30
So something like
teams:
test:
#other stuff for test team
anotherTeam:
#other stuff for anotherTeam
#etc
?
yest
Ah, use getKeys(false) then
Will return a Set<String> that would have {test, anotherTeam}
ok
when they are not properly closed
How can i create commands automatically?
define automatically
like i do /team create Test and it creates a command /Test
iirc there's a thing called command map, could add it there. but can't help you further, don't have experience with it myself
Ok, thanks very much i will serch it online, i didn' t know what search to find it.
Someone have faction booster update for 1.12?
And
Killstats
(why aint nobody using lambdas)
if you hover your mouse over the read line, it tells you the problem
also that too ^
using inventory names too ugh
declaration: package: org.bukkit.event.inventory, class: InventoryEvent
its not a mistake to return a connection from a method
and regarding your other question. i think its best to just always use a pool
meaning get a connection from the pool, use it for a query, return it
activate your windows
waste of money
yeah?
what context is this screenshot for
inventory does not have a getTitle()
please read what kacper is saying
i believe in you @onyx fjord 
thank you 🫶
#help-server message bruh
yeah if you post a screenshot with zero context and don't get a reply instantly, you have to post it again duh
right here
What would cause an event to just not be ran ever? I am registering the event WorldLoaded and it registers fine. The problem is, it seems that it is being blocked from ever getting called? Or at least it just doesn't call like at all. All my other registered events run fine. Just the world loaded event doesn't get called even once. I know its not being called because I built it with the entire method only saying in the console if the method was called or not and that message never gets called.
if you're tryna catch the world loading on startup. its due to your plugin enabling after worldload
is there something in plugin.yml I need to set to make it load before worldload?

Can someone explain to me how I can make it so that when I right click on an item created with the ItemStack method, it sends me to a crafting table and shows how to make the recipe for that custom item?
PlayerInteractEvent has that covered
just tag the item and look for the tag every time someone right clicks
does anyone know if when spawning an entity using packetplayout it is possible to make it ride a player and it follows wherever the player walks?
pretty sure you would need to send another packet
are you using protocolLib?
no
thb idk what the default packet is. but i know there is a packet for it
i used packet SpawnEntityLiving and OutAttach
did you try PacketPlayOutMount?
i dont have
old..
double yikes
k 1.8 for now
How can I change the color of a /title multiple times while is displaying? Like a command block chain with repeaters
ok
How do I forcefully make my data folder without making a config.yml?
doesn't really matter
tyty
as the parent folder plugins exists anyway
i'm having a bit of an issue when trying to use the NBTTagCompound#setString(x,y)
so how it is now:
crateItem is just a class in between the configs and the item,
it has my nbt i got from the config just fine
but every time i try to use the setstring , it seems to add an extra pair of quotes around the value (nbt) , causing the item to be invalid
even removed every quote in my nbt value to make sure it doesn't have any without succes , so wondering if i did anything wrong or how to solve it atleast
net.minecraft.server.v1_16_R3.ItemStack nmsStack = CraftItemStack.asNMSCopy(stack);
for(Map.Entry<String,String> nbt:crateItem.getNbt().entrySet()){
NBTTagCompound compound = nmsStack.getOrCreateTag();
compound.setString(nbt.getKey(),nbt.getValue().replace("\"",""));
}
stack = CraftItemStack.asBukkitCopy(nmsStack);```
resource removed stars-pack
why are you using nbt
when PersistentDataContainer exists
well persistentDataContainer likes to fail on me when i try to add nbt which it might not have set by default
tried looking into it,
but like the plugin is kinda gonna be used with pixelmon, where the sprites all have the custom nbt to make it unique, and couldn't find a way to alter the meta to make it add those anyway
and as it's from a config, i can't use like some item handler to try and get the meta another way
well if you really want to use nbt i suggest you use this api https://www.spigotmc.org/resources/nbt-api.7939/
works very nicely
alright, will take a look, thanks in advance 🙂
Is there an event that detects when a player's potion effects change? Either added or removed?
declaration: package: org.bukkit.event.entity, class: EntityPotionEffectEvent
maybe that one
thats exactly what I needed, thank you!
addUnsafeEnchantment?
nah, i need breaking multiple blocks
AH
i think he is talking about custom enchantments
like i have it down but i need a way to improve it
@EventHandler
public void onbreak(BlockBreakEvent e) {
Location block = e.getBlock().getLocation();
Location loc1 = block.clone().add(50, 0, 50);
Location loc2 = block.clone().add(-50, 0, -50);
double minX = Math.min(loc1.getX(), loc2.getX());
double minY = Math.min(loc1.getY(), loc2.getY());
double minZ = Math.min(loc1.getZ(), loc2.getZ());
double maxX = Math.max(loc1.getX(), loc2.getX());
double maxY = Math.max(loc1.getY(), loc2.getY());
double maxZ = Math.max(loc1.getZ(), loc2.getZ());
new BukkitRunnable() {
@Override
public void run() {
int amountOfBlocks = 0;
for (double x = minX; x <= maxX; x++) {
for (double y = minY; y <= maxY; y++) {
for (double z = minZ; z <= maxZ; z++) {
Location loc = new Location(loc1.getWorld(), x, y, z);
Material mat = loc.getBlock().getType();
if (mat == Material.AIR) continue;
amountOfBlocks++;
Bukkit.getScheduler().runTask(plugin, () -> {
loc.getBlock().setType(Material.AIR);
});
}
}
}
e.getPlayer().sendMessage("Successfully broken " + amountOfBlocks + " blocks!");
}
}.runTaskAsynchronously(plugin);
}```
kek
there are a multitude of ways to do this
you could store the enchantments & level on the pickaxe using pdc
then have a class for each enchantments
i need the best way to loop all the blocks
since it lags the server a bit
this is my current code
it sucks ik xD
no im not
i change back to the main thread
yep
should i store it in a list
and loop the list?
instead of making a task every single time?
that would be an improvement
👍
but you could do much more than that
just depends on how optimized you want it do be
and you can read all about that in great detail right here https://www.spigotmc.org/threads/guide-on-workload-distribution-or-how-to-handle-heavy-splittable-tasks.409003/
Anyone know why entity.setVelocity() isnt working on my phantom that has ai set to false
because that dont work on entities with ai on false
How can I have the functionality of ai set to false while still retaining entity.setVelocity();
remove its pathfinder goals
ok ty!
People, could someone give me a wiki or explain where I could create custom attributes? Is it that I want to create a Speed-type attribute that I can add to the armor and that armor gives me more speed?
is there a way to wait in a loop?
scheduler
alrighty
Anyone know how to make a kill counter + a death count on a tab scoreboard?
why isnt System.out.println("Hello World);" working
it does work
if you would put the quotes correctly
haha np
how does one aquire the direction of a player?
player.getLocation().getDirection()
Why do Class.getResourceAsStream() or Class.getClassLoader().getResourceAsStream() return null on BungeeCord?
val config: MutableMap<String, Any> = Yaml().load(
dataFolder.resolve("config.yml").apply {
if (!exists()) {
createNewFile()
appendBytes(this@Loader.javaClass.classLoader.getResourceAsStream("/config.yml")!!.readAllBytes())
}
}.inputStream()
)
this is what Ive tried
and config.yml is supposed to be there
jfc, is this real Kotlin? this@Loader.javaClass
That's cursed as fuck
Kotlin CEO: "How can we make our dot separators stand out from Java?"
Random Intern: "What if we put random fucking characters in front of them!"
Kotlin CEO: "GENIUS!"
You can
- Annotate your dot separators
- Use ?. for null safety
- Use !! for null assertion
TL;DR:
Not even once
haha
yeah kotlin is very weird at times
I really don't like it
it doesnt add anything useful for me, only makes things more complicated
How do I make the head indicatirs from mcc?
Whats the best thing to make a database with? Or should i just use json
Depends on the data you're storing, how you want to store it, how you prefer to store it, and whether or not you're releasing something publicly or working on a private project
I mean again, boils down to
the data you're storing, how you want to store it, how you prefer to store it
There's no one answer
And im probably going to be storing. Strings, doubles, booleans, timestamps (long), maybe locations (so strings). Depends
And idk how i like to store it xD
If you think it's something you can store in an SQL schema (e.g. tabular data) then opt for SQL. If you want some serialization/deserialization and just don't care how things are stored, Mongo is NoSQL and is basically just remote JSON storage lol
Local JSON files also works fine, but gets messy if you're storing data for each player or something
Ultimately between SQL and NoSQL, it comes down to preference
I mean, its not like im going to edit the file alot.
I already have a json storage setup but i was thinking of using a database.
No I know, but I mean more portability "messy". What if you have to move those files to a new system? You then might have thousands of files to migrate
Yeah true
is it possible to get the colors of each individual pixel on a players face
you can get the base64 texture and decode it to a buffered image
Hey, I was wondering how I could cancel all active async tasks when reloading/disabling the plugin.
I tried:
@Override
public void onDisable(){
Bukkit.getScheduler().cancelTasks(this);
}
However this doesn't work. The task I'm running is:
https://pastebin.com/WE7F78WT
(Although keep in mind this is generated code, not hand-written so I would not recommend trying to read the inside of the bukkit task)
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
they are disabled automatically iirc
also what is
while(Repeat.invokeAction(ParamManager.formatParameters(new HashMap<>(){},
new HashMap<>(){}, "REPEAT:Forever", localVars), "Forever", localVars, 85982394.571d + threadID)){```
are you just doing an infinite while loop
yes
with a wait inside
I'm not doing anything typical and I would not like to explain
thats why its not cancelling
because it's an infinite while loop
why would that matter, if it'd need to reach the end to cancel then wouldn't it do that automatically?
no?
all the cancel method does is not call the next run() call
there is no next run call if you have an infinite while loop
hold on a second, why would it call the run method multiple times? This isn't a repeating task
ah
either waqy
the cancel method doesn't terminate the thread
if its an infinite while loop you will have to terminate it yourself
probs easiest to do while(whatever the infinite boolean is && !isCancelled)
then override the cancel method
oh I see so the cancel method fires even with the infinite loop?
it should
okay, thanks
https://paste.md-5.net/eguqusoqat.cs I am getting this.
It says the custom_stack is null but i am defining it here
public static CustomStack setMeta(String displayName, CustomStack custom_stack, ItemMeta meta, int pdcValue, String name) {
custom_stack = CustomStack.getInstance(name);
meta = custom_stack.getItemStack().getItemMeta();
meta.getPersistentDataContainer().set(Keys.smithingItems, PersistentDataType.INTEGER, pdcValue);
custom_stack.getItemStack().setItemMeta(meta);
meta.setDisplayName(displayName);
return custom_stack;
}```
Their server does not support fuck it
Alex can take look huh
Then the CustomStack.getInstance might be returning null?
Its something different. When im trying to give it to my hand its working
Surely you might've checked that already, but that's the only way such an error is appearing
Also as a sidenote, it seems that you change the meta once more after applying it, when you set its display name
Wdym
The error is for when you try get the itemsadder itemstack
So idk how giving it to a hand may change that
I can give it to my hand by an event
But i cant put it on an inventory
@worn tundra
Show your code in the event
p.getInventory.addItem(SmithingTable.setMeta("Blabla", SmithingTable.itemsadderSwordGui, SmithingTable.itemsadderSwordGuiMeta, 500, "itemsadder:ruby_sword").getItemStack();```
Did you write that by hand? Why can't you paste code
I am not on pc🫥
Yes, lile what is SmithingTable.setMeta and why does it take all of that as instructiond
Then apparently supplies a Itemsadder item id
Which is completely different to how you try to give the same item here
So without proper code and context im unfortunately unable to help
.
setMeta is this
Alr thanks
You sure your using the same itemsadder ids in both cases?
Yes
Someone know how i can drive my vehicle (armorstand) on water with the packetplayinsteervehicle event?
Because everything i try, gravity false and all those things wont work and if i put gravity on it will sink
Swimming in water is usually an ai goal for the entity. You either need to create a custom nms implementation
or do a bunch of calculations in order to emulate the swimming behavior.
But isnt it possible to just let it float on water and drive normally as i do on the land?
And how do you expect the "let it float" part to happen?
To let it float and stay on the water but that it is able to drive with WASD
Because now if i pit gravity false it will stay on the water but it is not able to drive
hi i have an error when i try to put my 1.16.5 plugin in a 1.16.5 server
this is the error code
1.16.6 is not a thing. This version doesnt exist.
this is the error 18:43:54] [Server thread/ERROR]: Fatal error trying to convert MyFirstPlugin v1:com/georgemushroom/MyFirstPlugin.class
java.lang.IllegalArgumentException: Unsupported class file major version 62
at org.bukkit.craftbukkit.libs.org.objectweb.asm.ClassReader.<init>(ClassReader.java:196) ~[server.jar:3096-a-Spigot-9fb885e-af1a232]
The plugin was compiled using java 18 but the server runs an older version.
Also: 1.16.6 is still not a thing
Having a very weird issue with mongodb
Invalid BSON field name datauuid
Makes no sense
i typed wrong
oh okay thank you
Does this happen in an update query?
Show the code in question. You are probably passing a data document where a functional document is expected.
i typed wrong
thank you it worked :)
Fetch is safe
"use sql instead of storing them"... lol
I see. You should really use the javadsl for this. One moment.
Just trying to abstract away mongodb
I should probably just write a Map<String, Object> -> Bson document
🤦
Evan I know what I'm doing
uuids are 2 longs, or about 16 bytes
Ah i did the same. Let me send you the whole class in that case.
brb gotta mix my spaghet
https://github.com/orbyfiedis/hscsms/blob/master/server-core/src/main/java/net/orbyfied/hscsms/db/impl/MongoDatabaseItem.java this is what i use for serialization
and database abstraction
Why do people hate codecs so much? This is so much unnecessary work which is already implemented in the mongodb java driver.
because what if i want to support SQL
how are mongodb codecs gonna be of use
Go do your homework. You have no idea what you are talking about.
with this abstraction i can use SQL too
So can I
just map key name to column id
Ehhhhhhhhh
depends
You gotta flatten your map
because the value can be a collection
yeah
then get the appropriate data column
I have some code for that
Thing is I'm not really messing with relational data
MongoDB makes more sense
and I can cluster it easier
yeah
https://gist.github.com/Flo0/9231eb21e0e6d2d648ab92ab4b15a85f
Look at line 51
upserting a document is faster than merging the fields
exactly
kotlin how fun
You can easily translate it. No fancy stuff happening here.
This class can be used like a remote Map<K, V> if you added a good codec
If you pass only one parameter to .eq then its referring to the primary id field.
Which should be of type ObjectId. What data type are you using for the primary id field?
Because you can also use UUIDs for that.
I see I see
Should be this then
I just gotta optimize the codec a bit more
but I'm pretty much out of time for the morning
If you look at the write method you can see how you can insert objects and provide an arbitrary object as the primary field.
fun write(key: K, value: V) {
val filter = Filters.eq(key)
val options = ReplaceOptions().upsert(true)
mongoCollection.replaceOne(filter, value, options)
}
it really looks like your value is just a POJO
K is in most cases an int or UUID for me
Yes
Nope
Only if you have a MongoCollection<Document>
Which is like using a List<Object>
You can also have a MongoCollection<WhateverYouWant>
ehhhhhhhh
I already serialize everything to a map
so I might just make it a MongoCollection<StoredData> and move on
open class TypedMongoStorage<K, V>(
mongoCollection: MongoCollection<V>,
valueClass: Class<V>,
private val keyFunction: (V) -> K
) {
Im passing a typed MongoCollection to my accessor class.
simple enough
I really gtg now
gotta eat breakfast, shower and go to school
got mf programming class
looks good
gonna learn php or something stupid
oof
Hah school Starts at 11am here
And then you have to be there until its dark... meh
9am - 6pm here :/
Got like 2 hours with the most psychopathic teacher
Hehe
is remaking the collection better than just deleting all the documents? i've always just used deleteMany
It's simpler
wym?
Not sure about how complex it is for mongodb
But not only is the code easier to read, it's also logically easier to comprehend
Always Fun when i have no fucking clue where to be
I mean it's just collection.deleteMany(new Document());, or for me I have an EMPTY_DOCUMENT constant.
bish asked us to fill out a form with our entire personal details (address, parents occupation, parents age, parents education? wtf) for her own "personal safekeeping"
so I just turned in a blank paper
Oh wait Filters.empty() exists, so just that then.
So collection.deleteMant(Filters.empty())
creating the collection might have more overhead than deleting the records
perhaps
I just find it simpler
Also if u have any indexes in the future idk how that'll affect you with recreating
might do some experimentation to actually see how long it takes with recreating vs remove with no filter
actually cba whatever
hmm damn.
time to flex for eternity
the way i've done my indexes would be a bit of a pain to recreate but i'll change it in the future
Guys, would you mind lending a hand? I can't figure out where I've gone wrong. Even if i type PLAINS, DESERT and etc, it always puts "SNOW".
e
Wtf am i seeing here...
It's terrible code. I'll clean it up later, I want to make sure it's working first
ee
um if(String.valueOf(snow) != null) {
You should drop this approach because the cleanup will never come.
What you should do is add debug messages and see which lines of code are being run.
The error is clear to me but you need to understand the code you are writing.
And adding debug messages helps you understand the code flow.
PS: String.valueOf(...) never returns null
I think what you mean is Biome.valueOf
} catch(Exception e) {
p.sendMessage("Could not find Empire");
}
And exceptions are not meant to be used as a code flow element.
They are used for error handling.
that's pretty much subjective
EO says no
I do agree with you here. I wasn't sure if my old code or this one is worse tbf
eo suggests that to have robust code, it needs to be fragile
SNOW,
JUNGLE,
DESERT,
PLAINS,
};
public static ArrayList<String> snowList = new ArrayList<String>();
public static ArrayList<String> jungleList = new ArrayList<String>();
public static ArrayList<String> desertList = new ArrayList<String>();
public static ArrayList<String> plainsList = new ArrayList<String>();
public static HashMap<String, ArrayList<String>> playerListMap = new HashMap<String, ArrayList<String>>();
public EmpirePlayerList() {
playerListMap.put("snow", snowList);
playerListMap.put("jungle", jungleList);
playerListMap.put("desert", desertList);
playerListMap.put("plains", plainsList);
}```
I'm reading them from another class and putting them in a config
What is "EO" referring to?
Hello I am making a plugin for a bit of fun. When I try put it into the server it gives me the error org.bukkit.plugin.InvalidPluginException: Cannot find main class
The plugin is 1.18.2. Help appreciated.
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
your entry in plugin.yml is wrong
elegant objects
You are missing the "main" path or its pointing to a wrong location
Isnt that an esoteric language?
No, i mean the set of principles
https://www.spigotmc.org/wiki/plugin-yml/ More infos here
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Object-oriented programming philosophy that refuses to use getters-and-setters, static methods, NULL references, type casting, implementation inheritance, and similar misconcepts.
??
what?
what are you talking about
wtf
???
do you have the wrong person or what
lmao
wtf are you talking about
???
i legit have no clue what youre on
lmao what
how does me suggesting a set of principles to 7smile7 result in stealing codes then obfuscating then reselling
lmao
????
what does that have to do with anything?
and i never stole code
@lost matrix do you get whats happening here
because i have no clue wtf this guy is saying
No clue here
Interesting read. This guy really really likes oop. And then there are people who think oop should die and
functional style is the future.
Lol
???
are you trolling
ill just ignore you
it is true that i cant obfuscate because i never did that in my life
lmao
Hmm this really looks like a decent set of rules. I agree with most of them like no code in constructors.
Is there a sonar code analyzer for this?
I'm bad for that. I often put code in constructors
Im not sure, probably not though
I sometimes throw every clean code out of the window if im angry with the code i wrote.
"Why did i make this so clunky. Now i cant add features easily. Well... might as well hack this one in."
Yeah? that was a few days ago of me trying to learn how to obfuscate
Evan you sound angry. Time to take a break from the Internet.
wtf?
I never succeeded so I never did it. (I actually gave up after frostalf told me to not obfuscate)
ok wtf that word was uncalled for this is 2022 not 2012
I never did.
it wasnt a plugin eitherway
now time for your lovely ban or mute
@ancient plank
we have an angry kid here
???
how did you assume im a theif from this..
wtf
lmao
Guys dont feed the troll. Important rule of the internet.
@boreal seal You've proved nothing. Stop being so anrgy or we will summon a mod.
yeah im just gonna ignore him
Dude i was confused because you made absolutely no sense.
What's the importance of this screenshot? It just looks like an accusation was thrown and nothing came of it.
hes talking about you
You were supposed to ignore him
It hurts my brain
2Hex doesnt have a single premium plugin...
Everyone here knows 2Hex. He joined over two years ago and we taught him the basics. He's a good dude
Jeez what's with the cat fight
LOL
Evan I've known 2Hex for over two years now.
I think someone else is using Evan's account. Either that or the dude is having a mental breakdown.
You are making a mistake
send me the jar i sent you then??
You are still feeding, my guy. Put the shovel down.
That's not proof
Yes we saw that. it shows nothing
Yes i never did because i was trying to learn how to obfuscate
I was here for teh obf discussion
and i gave up because frostalf told me to
LOL
Jesus christ, he still keeps on going
Yeah, but there are overkill principles EO states, for example where they say that, you should use decorators for almost every interface that applies an operation to the object
e.g instead of String#toLowerCase()
they want you to have a decorator LowerCaseString
Yeah thats why i meant most are viable in my opinion.
Its well intended but you need to find a good middle ground
so that your principles dont prevent you from providing actual
value.
Lol this guy made a thing that stops your project from building if it has null
Its called kotlin
LOL
Myeah wel EO goes under the extreme assumption that our objects are living organisms
Which is the main pro and con
Does anyone using FactionsAPI know how I can change the attack time?
Depends if the state of the class is important
Maybe i'm tired here, but if it's a situation where you can just instantiate the class every time it can just be a utility class.
You tend to use DI where you can't just instantiate it every time. E.g you can't just create another instance of your plugin class. Basically what smile said above.
hoyaahhhh
Oh okay, thanks
This question doesnt make sense
You can essentially have to use DI sooner or later as well as the new keyword
They’re not equivalent and not interchangeably equivalent
Just make everything static and only use functional style. Abandon the new keyword.
I literally wrote a blog post about it @grim ice
but you should just ignore that idea
obfuscating is not worth it
Myes, only primitive types
obfuscation only works until someone decides to put enough effort into cracking your stuff
once you reach like 500 downloads on spigot, someone will put DAYS into cracking your stuff anyway and then you can't help it anymore anyway
The only point in obfuscation is when you are legally required to make a "best effort" in protecting your IP.
well it also helped me in not having leaks everywhere when I still had this "Too many IPs use this copy" stuff
but eventually someone cracked that ofc and since then it's pointless
anyway, I never argue against people who want to obfuscate their stuff, I'll explain to them how I did it, and then it's up to them whether they also wanna do it or not :3
I just don't bother at all. If people are willing to pay for something they will. If not, they will get a hacked version. Nothing will force them to become customers.
Then again I don't sell anything, I give it away for free and make zero monies.
you're lucky because that means you have an actual job that earns you money 😄 I for example dont have any other income 😢 (at least not right now)
The only time I ever made any money was from Essentials advertising on its wiki
?paste
Ty
Nothing will force them to become customers.
actually my verification thing is quite effective. sometimes people join my discord and ask for support. then I ask them to verify their purchase. 5 minutes later I got a paypal notification that they now actually bought it haha
Each month the team divvied up the income from advertising to whoever had contributed that month.
oh that's awesome
it paid for my internet for a few months
I love this idea
but most people probably won't get anything from ads on their wiki
maybe 0.3€ per months 😄
Yep Ess had a LOT of hits on its wiki
back then it was on a few hundred thousand servers.
my blog also has a few thousands hits per day but I guess I'd still rather keep it ad-free
Just make you plugin ambigous and hard to use
Life Steal cough
how to craft hearts
I remember when Ike put a "Join the Discord for questions" text into his plugin page, then people kept joining THIS discord to ask questions haha
he got like a million downloads in a few months
hi all! I am doing an anti-cheat in my plugin, and I have a question how to make it so that in case of an effect, for example, a jump boost, the rights are given at which the plugin will not be able to ban the player by mistake
You need to adapt your algorithm to take such changes into consideration.
A simple bypass would be a bad idea.
Only how then, I just don’t understand much how to implement it
you have to calculate that yourself
by inspecting how vanilla works
anti cheats are very annoying to code
Then you are not ready to implement an anti cheat plugin. You need a very deep understanding
of the internals in order to write a half decent one.
^
I do spigot plugins since 5 years or so now and I wouldnt bother in writing any anti cheat myself
leave it to an anti-cheat plugin
I rather spend my time on other things and let other people do the anti cheat plugins 😄
Just add a timed parcour/course that tracks the path that players used.
I catched so many cheaters by simply checking the best scores and their path.
Best half automatic anticheat.
/s in case it's needed
With even a few staff members you could still create your own anticheat that just tells staff to check on a player.
If it leads to false warnings due to jump potions or similar things you can improve it continuously.
true
A good way to dive into that topic without "hurting" innocents
"innocents"
I mean they might be
I'd rather assume that everyone is cheating haha
except for @jagged quail
his PC couldnt handle running BOTH, a cheat and minecraft
lmao
Most players cheat so obvious that your anticheat doesn't even have to be good to catch them
that was more of a /s statement tho
To joke about people that just activate their flyhack/flymod and fly through space.
I'm very aware that anticheats are hard to do.
It will require a lot of testing. Also a lot of try and error. And lots of bugfixes if you didn't think about everything that can affect a players velocity
I'm aware of all that. No need to tell me about it.
An anticheat will be a very tedious project and a starter will probably lose motivation not even halfway through
Yeah that was more of an exaggeration 😅
I mean as long as you don't run the server on everyones router you will never have 0ms for everyone xD
I never tried to obfuscate a plugin, and i dont need to
it was a forge mod, so your blog better be in gradle :o
im not even talking to you
so sit down
I dont know shit about gradle
I only know the basics 😄
barely enough to make it create a shadowJar
I mean proguard has a gradle dep
like
gradle probably also has some thing equivalent to the maven-exec-plugin
soooo yeah it'd work with any build tool
but as said, obfuscating is a shit idea anyway
I only do it because I did it a year ago already 😄
you realize that zelix costs money, while proguard doesnt, right?
👀
please discuss your personal issues in DMs instead
its 1/6 of that price
i dont know the kid
hes been harassing me the whole day
💀
I can't change that, all I can do is to ask both of you to stop
engineering
can you please both shut up about this now
oh no
smh let me get some kicks
so true
it's just annoying for people who have actual questions in this channel
no one is asking anything
someone wrote something a minute ago but then never sent their message
where the mods at
probably watching some anime haha
Holy crap are we back at this again
Evan, please
the spigot api has a yaml api
im dying
crack Denuvo
you can just use that
oh cmon please discuss your personal issues in DMs
ik you can
oh god
Possibly
because I wasnt here when this started, I can't tell who of you is the little kid
for which snakeyaml should be fine
oh right u werent there
neither was lynx
I was, Evan has been harassing 2Hex all day
yeah that's a conclusion
I am always here
pretty much
elgarl is pretty much here all the time for all the 2 years ive been in here
why would you
what
imagine if at least one of the two of you were mature enough to just drop it and leave the chat
what a world we'd be in
mate
why would I? this is seriously funny
snakeyml is fine
it hasn't been funny for anyone else
how is snakeyaml bad
ah my bad
shading another yaml library for doing "give me the string at a.b.c" is pretty meh
How can i mute the armorstand making walk sounds if i drive it with the packetplayinsteervehicle event?
for real I'll ping some staff member if you don't drop your stupid discussion, it's 100% useless and only annoys everyone else. Why don't you just DM yourselves instead
what are you talking about
Isnt ir possible without texturepack because other plugins does have no sound then driving armorstand
generally, you should be able to setSilentit ?
some sounds are clientside however
at which point
not much to do
But walking sounds like grass will be muted then?
didnt they say "make it silent" and not "make it invisible"?
1.12.2
iirc the fall sound of armorstands should be server side
so making it silent should work out
just try it tho
hello back
greetin's
hyd
damn that sounds... boring
kinda
At least it's not as boring as maths
I go to university for English, Java and Philosophy
basically
skip everything else
actually the only one guy in a group who even knows philosophy and studied it before
-> the only one who answers all of the questions
still up to discuss why humans are different from every other animals
yes
nobody except my school friend who i tought java, know it
he got to the same university
but we were in different groups first year
this year groups were joined
so now i'm with him
And basically my engrish is the best in group too
teachers basically make me auto-pass end-year exams
why tf i use basically in every sentence
What's wrong with me today
But still
it's like saying "like" after every word
parasites
?
I never touched snakeYaml, but i can help with YamlConfiguration directly
YamlConfiguration uses snakeyml under the hood
which I guess is what they are on about
I mean ofc but yamlconfig is a wrapper
