#help-development
1 messages · Page 547 of 1
help
import it
Did you try to make an event listener at the bottom? @errant shale
you should not extend Enchantment
no
help
yes
@EventHandler
public void mushroom(BlockSpreadEvent e) {
if (e.getSource().getType() == Material.BROWN_MUSHROOM) {
e.setCancelled(true);
}
}```
is that code true ? i tried but not working
i need getblock ?
so is someone gonna help?
What even are the errors tho
you havent imported
idk
if you are not using notepad for programming, your ide should scream that you havent imported those classes
this is what i got
have you used chatgpt or smth ?
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
just put mouse on it -> alt + enter -> import class
Or if that doesn’t work just click import class
i tried getSource and getBlock event still not working is something wrong on my code ?
i cancelled all blockspreadevents and worked
i try with debug
how to i send code again?
You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
Becomes:
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
i added debug and not working
i changed
you should still have access to getType in 1.12
what u think for my code ?
i wanna cancel the mushroom spread
but didnt worked debug and event
@EventHandler
public void onBlockSpread(BlockSpreadEvent event) {
if (event.getBlock().getType() == Material.BROWN_MUSHROOM) {
event.setCancelled(true);
}
}```
looking
Yes. BookMeta#spigot()
guys i wanna add cooldown to some events
event will not be available within 5 hours after running
for do this i need scheduler ?
if server close or crash tihs cooldown will work after restart ?
it would not
i need save cooldowns to some file ?
have a guide for this ?
i mean add cooldown to evets

Do you mean like. For Example: PlayerChatEvent can only be run every 5 hours?
yes
or my method
you could save the Unix time of when you last ran it and then check if it has been 5 hours since then
or just, simple java file read/write api
^
load on startup
write after use (if you can only use it every 5 hours, if its faster, maye only write on shutdown)
alright
just create the data and instad of creating scheduler just check the cooldown when the event is fired if it's important data you can write the data to file every 5min or something like that
depends on what IDE you are using?
You can change that directly in Intellij
Ctrl + A & Ctrl + Shift + F on eclipse. Should also similarly work in IJ
ctrl alt l for ij on windows
I don't use auto-format these days though as it often does things that I'd rather not have in a very special usecase
@EventHandler
public void onChat(PlayerChatEvent e) {
FileConfiguration config = Main.getPlugin().getConfig();
if(System.currentTimeMillis() <= config.getLong("lastrun") + 18000000) {
e.setCancelled(true);
return;
}
config.set("lastrun", System.currentTimeMillis());
Main.getPlugin().saveConfig();
// do stuff
}
This should only allow the event to be run once every 5 hours. Haven't actually tested if it works though lmao
yo, fellers, anyone know of a way to reigster a command on the fly? Im using commandMap, but only the console can execute the command, not players
when a player interacts with an "enchanted anvil", it is supposed to consume a certain item and perform a logic, but the player cannot do that. someone earlier said that the issue was that the event is cancelled immediately, but the issue is still there after fixing that. (or i fixed it wrong)
realized that the second image is barely readable, here's a pastebin. (https://pastebin.com/chV4hA6y)
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.
appreciate this, but still nothing, I even delayed it by 5 seconds when a player joins, and nothing
yes learned unix
i wasnt know
Anyone got an idea what event to use when i want to convert concrete poweder once it hits water (as a item)
You need a timer to keep checking if it's in water
Is there a way to listen for a block being destroyed by fire?
well that sucks
isnt a droped item some kind of entity?
cant i listen to entity move event?
That does not exist
Because it would be insanely laggy calling an event for every entity movement
so should i start a timer on player drop and after that check all the time durin the timer
Pretty much
Thanks!
Keep in mind that will not catch items that are not directly dropped by the player
oh true..
There is however an item spawn event
i asked chat gpt the same question and it told me BlockPhysicsEvent hes just dumb right?
It’s not a block
water is not a block?
Dropped items aren’t a block
i know that
anyone have any sample code that i could look at where you used to update a players display name on tab, above their player and in chat with protocollib packet stuff?
im trying to add a prefix to player names and color their names
but it is different color depending on who is looking at them so im using packets
Will checking every single player interact event cause lag?
like it only will work if you click a slime on to a piston, checking with if statement
No
oh ok
Tons of plugins listen for that event
Any idea why commands registered via CommandMap only console can execute?
will using a plugin cause lag
haha, very funny
Well not really. As long as everything stays below 50ms/tick it's technically not lag
I guess it requires you to define lag as “an increase in load on the server”
if (Instant.now().isAfter(timeStamp, ChronoUnit.MILLIS);
You could do a repeating task
Or a delayed task
Yes
But it won’t be super accurate as it’s dependant on tps
Use an async task and then sync back to the main thread when doing the kick
runTaskLater is sync
You want runTaskLaterAsyncronously
How computationally expensive is a raytrace?
It’s nothing that bad, the game does them all the time
can someone link a guide on how to use yml files
screenshot
Restart or reinstall it?
Hmmm, I fixed it
Deleted the entire data folder.
But, right now everything is like new haha, time to find the actual folder which is causing this issue
there must be a better way to do this....
There’s probably a tag for concrete powder
Isn’t a Unix difference already in milliseconds
you around
average day in Java Development
do you have UUID or player object?
if you have a player object they're likely online, but you can always check Player#isOnline
If you have a uuid Bukkit.getPlayer(uuid) != null
if you have a UUID you can use Bukkit.getOfflinePlayer(UUID) OfflinePlayer#isOnline
getPlayer is easier I suppose
Either works tbh
Player inherits OfflinePlayer so Player#isOnline is an what you could do
though its very unlikely they'll be offline unless you're doing heavy tasks
am i missing something?
private final VoidCrates main;
public CrateRegister(VoidCrates main) {
this.main=main;
}
File crateConfigFile = new File(main.getDataFolder(), "crates.yml");
"Variable 'main' might not have been initialized"
If it’s an event though they are likely online
Yes
what
just get name as a string and check if contains CONCERETE_POWDER
Main isn’t set when instance variables are initialized inline like that
it used to work before i swear
you should not have a Player object if they are not online
Initialize the file inside your constructor
Switch or tag
Or compile a set at startup
You can stream it
You should be careful holding reference to a player object
It’ll stop it from getting garbage collected when the player disconnects
Generally it’s better to hold the uuid instead
yes you can
yes you can
player object has so much unnessarcy fields
so it's expensive to keeping it on memory
yes rn
ur were the bungee guy right
give me like 5 i broke sum lol
?
call me whenever
did it with ends with now works too
event.getPlayer().getInventory().remove(shear);
((org.bukkit.inventory.meta.Damageable) shearMeta).setDamage(damage);
shear.setItemMeta(shearMeta);
event.getPlayer().getInventory().addItem(shear);```
oh fuck i do it wrong every time oml
anyone know whats wrong with this code?
it doesn't work like this
you need to get meta, change it and apply back to itemstack
oh
Damageable shearMeta = shear.getItemMeta();
shearMeta.setDamage(damage);
shear.setItemMeta(shearMeta);
also do you know why it wont let me just put Damageable?
You’ve likely imported another damagable
oh ur right i did the entity one im such a dumbass
Make sure you import the right one
I dont understand, this code should work, but only console can execute this new command
Why are you registering a fake command
Wtf is a fake command
a command that is fake smh
is it in the plugin file
Are we too cool to register them the normal way :p
im adding the ability to get addons you can just drop into an expansions folder, but these addons need a command to work, cant just drop in into the plugin.yml file
Nah it's just annoying and east to forget
I'm too lazy atm to write a program that auto-generates the plugin commands on compile but I will eventually
there are already command annotations
I do the same because I hate the plugin.yml
Gradle plug
doesn't look that bad actually
Wouldn't work for me as I need to update my command lib but I'll update it to work better
oh sick, I will give this a try
I'd just use acf lol
how do i do colors in the console
You don't
Unless you make your own console
theres this plugin that makes colors in my console
The console doesn’t need colors
mine does
will it sudoku if it doesn't get colors?
can an item not have meta? intellij keeps telling me to assert than item meta is not null....
Air
oh i see what it is thinking
It's not thinking anything.
IDE sees @coral knotable -> ide wants you to check for null
oh lol
no i meant not what it was thinking but why it was happening sorry
Sorry for the ping, whoever null is
i was confused cause the item meta being referred to was already shears like it had to be to get to that point in the code
so i wasnt understanding how it couldnt have meta but i realized that it doesnt like examine my entire code to figure it out
The IDE never has any logic to check whether it can actually be null. It's only driven by those annotations. Even after calling "hasItemMeta()" it will tell you that you should do a null check
You can savely ignore it
alternatively you can suppress warnings
only reccomend that if you generally know what can be null though
sometimes intellij wants to warn me because i null checked something that was nested in another class and im not checking it in another, mad annoying
Hello. I have a possibly strange question. I want to add caching to my plugin, but as you may know, maps return reference, which means I can **modify ** retrieved values as I please. This leads to the following problem: I retrieve a value from the cache, modify it, but forget to save it. What should I do in this situation? Should I always return a copy (clone) of the cached value?
If you edit an object in a HashMap (Say Player, and you set theyre health)
The object itself is changed inside the map, you dont need to "modify" or "save" anything
Mmm you should probably be caching a data object tbh not a map that way you define how its edited much more clearly
I mean caching a map is fine but IMHO data object just makes more sense
Looked at it, never used that before but seems pretty cool, complicated as hell it seems from this javadoc
Looks overly complicated for something like an MC server 😛
Whats the benefits of JDO vs just shoving it to some type of map (for smaller datasets like mc servers)?
Oh I just mean like getter setters etc
Those are called Data Objects since they just contain data and provide 0 other purposes
Well no
I think we think the question asker means different things
I'm pretty sure he has a cache storing maps
Which works but I'd think is less functional than just using a Data Object
is there an event for when a trident comes back to the player?
i cant find anything on google
yeah then he said this; I retrieve a value from the cache, modify it, but forget to save it.
Which led me to belive he took the object in a map and replaced it redundantly, i did this for like my first 4 months of java cause i didnt know how OOP entirely worked 😛
Maybe he is using a database and calling it a cache??
Too many questions
So many buzzwords my brain is hurting
typically works
Remember
MC Plugins, not enterprise coding 😛
thouuugh
unit tests for plugins do be fire
I unit test my plugins :P
i havent touched an ide in sooo long
What do you do for work?
I do IHSS (in home supportive services) basically a in home nurse
i get too bored of coding mc stuff and end up just playing games for long stretches of time
ik its been a fat minute since ive helped someone in here lol
hes so dedicated to the plugin grind he codes comissions while his gf is laying in his bed

someone on minehut showed me some insane new stuff with block displays on 1.19, had elevators and stuff it was so dope i wanna learn how to do that
Maybe I didn't express myself correctly, but... that's exactly what I'm talking about! I add a player to the cache like this:
public CompletableFuture<Optional<Profile>> getProfile(UUID uuid) {
Profile cached = cache.get(uuid);
if (cached != null) return CompletableFuture.completedFuture(Optional.of(cached));
CompletableFuture<Optional<Profile>> fromDatabase = getFromDatabase(uuid);
if (Bukkit.getPlayer(uuid) != null)
fromDatabase.thenAccept(optionalProfile ->
optionalProfile.ifPresent(profile -> cache.put(uuid, profile)));
return fromDatabase;
}
And simply remove them from the map when they leave. After every change to the player, I save them to the database. But! If I retrieve a value from the cache (map), make some changes, and FORGET to save the changes to the database, then it's THE END
every change your saving to the database?
Why not run an async task, that flashes your cache into your database every x minutes (Even better, sync it with Minecrafts auto-save time that way you dont have data loss) This way whenever you retrieve a value from the cache, you know that if its modified its gonna get saved and you do not have to do anything extra (eg another line of code calling "saveToDatabase")
Also, why remove the player when they leave? What if they are relogging? You'll have to spend all that computing power loading they're data back again, just let they're data sit until a server reboot :p Im sure you arent gonna have gigabytes of cache laying around for some player data or similar
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "papi ecloud download Player");
[18:44:28] [Server thread/INFO]: Unknown command. Type "/help" for help.
Why is this happening? I've even tried it with a /
and since the place holder api says it will be removing registerExpansion in it i cant use that
could be that the command is handled not via bukkit api
but by brigadier dispatcher
or it could be that its the bungee command
so how could I manage to dispatch it?, and its a spigot server
are you running this server under bungee
no
you should look for developer api notes from placeholder api creators how to do this instead of relying on commands
well they dont say to use commands to register it in plugins
and you cant cause they removed the api feature for it
i would so use requireNonNull if it didnt look so god damn ugly in my code
just turn the null inspection off
you can always do reflections
this will throw exception if the player is null
== null is essentially the same
ima just ask in the PAPI discord server
it will throw nullpointer exception anyways
you can do something like that Optional.ofNullable(Bukkit.getPlayer(uuid)).ifPresent(p -> p.kick());
@river oracle tried this api, but still, seems like commands cant be execute by players when making commands like this
good ol optionals
look into optionals, theyre godsend
actually optionals are good
I believe optionals are good but overusing it isnt correct
for example i dont use optionals inside internal classes
i like using them for database libary purposes, null check hell goes crazy with mongodb
i'm only using them for database methods
I've spammed optionals so hard back in the days
everywhere
constructors
methods
you name it
but each of that optional costs
a bit
so i've decided to not use it inside internal classes
yeah i agree but i think it's better than Objects#requireNonNull for null check
1000%
unpopular opinion
no
I dislike Optionals too
they suck because they dont have yes and no derivatives
so it fucks with overloading
is null and not null not enough for you?
and type inheritance
null is fucked
but Optional is scarcely better
(just for returning)
you can use a Map.Entry 
well in cpp you dont have null at all for objects
wtf
but nullptr for pointers
i used a map.entry before one time to have 2 answers at one time, was whack but also cool at the same time
wtf
u should have a
sealed interface Maybe<V> permits Yes, No {
}
this way u can subtype optional
i still dont understand the usage of sealed classes
just go for if (player !=null)
hear me out
Sometimes one liners are bad
Hmm... I really hadn't thought about Async Task for cache saving. I've always seen separate methods for retrieving and saving in different APIs. I don't think there is such a "automatic" save as far as I understand.
As for removing on leave, I've seen many projects where developers use this practice. And keeping unnecessary values in the cache... I don't know, it doesn't seem right to me
they literally couple classes together
now u're just creating throw away objects
which is against effective java (unless certain stuff like builders)
compile time awareness of subtypes @mortal hare
save an instance
yea but it you need to define class name at the sealed class
which seems counter intuitive
in oop
Player player = Bukkit.getPlayer(uuid)
if (player != null) {
// that future but without optionals
its not oop like yea
but java is multiparadigm
just look at optional that u were preaching about
yea statics
do that
check if its nullable, if it is isnt just get stuff from that, if it is just null check
what event is it
yeah you can just use the event.getPlayer or Player player = ...
table.h
template <typename t_element>
class Table {
private:
const std::size_t m_rows, m_columns;
const std::unique_ptr<t_element[]> m_contents;
public:
Table(std::size_t rows, std::size_t columns);
table.cpp
template<typename t_element>
nonogram::Table<t_element>::Table(std::size_t rows, std::size_t columns) :
m_rows(rows), m_columns(columns), m_contents(new t_element[getSize()]) {}
anyone willing to help? somehow this code throws unresolved external symbol at the constructor unresolved external symbol "public: __thiscall nonogram::Table<unsigned int>::Table<unsigned int>(unsigned int,unsigned int)"?
PacketPlayOutMapChunk packetPlayOutMapChunk = new PacketPlayOutMapChunk(((CraftChunk) chunk).getHandle(), 65535);
(((CraftPlayer) player).getHandle()).playerConnection.sendPacket((Packet) packetPlayOutMapChunk);
}```java
Hello, can anyone help me with this code? I need to modify this to spigotmc api. Couldn't find a solution for that.
they are same
Yeah you would have to make the auto-save task, you can likely just shove it into a BukkitRunnable
Well, in order to avoid unnecessary caching you can just have different cache pools
IE, for some of my plugins I have the hard player data (money, levels, etc) that gets loaded on player join and STAYS loaded until a server restart, its just not worth the resources to keep loading/unloading it, and the size of the data is often time negligable
Then, for things like my KOTH events or auctions, etc I will clear that cache out every so often, as yeah it would get messy, I guess it just entirely depends on how your data is structured and how viable it is to leave stuff cached, in most cases as long as you aren't caching stuff in some type of loop without clearing it, your gonna be fine
(from a memory leak standpoint)
Just remember, unused memory is free memory
i prefer declaring variable and then using it across the code
that way i can change the variable at any time
it easier to refactor variable than bunch of function calls
you have to define nonogram::Table<unsigned int>::Table<unsigned int> in cpp
had that problem few days ago
it doesnt work
its also more readable
literally had same error for three classes, i just added this
wtf language is this
cpp
its shit, i just like jetbrains products
had thrown std::bad_alloc and was debugging for two hours, i ran it in vs and error popped "you cant pop empty queue"
and that was reason of std::bad_alloc lol
phpstorm is superior for webdev
some people love apple products, i love jetbrains ones
webstorm is specialized for js/ts, but if doing full stack app phpstorm is the way
literally everything that jetbrains made seems high quality
😢
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>groupId</groupId>
<artifactId>Rpg</artifactId>
<name>RPGPlugin</name>
<packaging>jar</packaging>
<version>1.0</version>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<!-- This adds the Spigot Maven repository to the build -->
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<!--This adds the Spigot API artifact to the build -->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.12.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>xyz.xenondevs</groupId>
<artifactId>particle</artifactId>
<version>1.8.4</version>
</dependency>
</dependencies>
</project>
?nms
Thanks! Now I more or less understand how to better implement caching
public static void removeNpc(EntityPlayer npc) {
npc.killEntity();
npcs.remove(npc);
}
Why can't I simply remove an EntityPlayer?? i get a console error:
[02:08:25 WARN]: [Rpg] Task #22 for Rpg v1.0 generated an exception
java.lang.NullPointerException: null
at net.minecraft.server.v1_12_R1.EntityPlayer.die(EntityPlayer.java:404) ~[spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
at net.minecraft.server.v1_12_R1.EntityLiving.damageEntity(EntityLiving.java:951) ~[spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
at net.minecraft.server.v1_12_R1.EntityHuman.damageEntity(EntityHuman.java:759) ~[spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
at net.minecraft.server.v1_12_R1.EntityPlayer.damageEntity(EntityPlayer.java:577) ~[spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
at net.minecraft.server.v1_12_R1.EntityLiving.killEntity(EntityLiving.java:129) ~[spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
at de.rpg.classes.TricksterClass$1.run(TricksterClass.java:51) ~[?:?]
at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftTask.run(CraftTask.java:71) ~[spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:353) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:739) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:406) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:679) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:577) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
at java.lang.Thread.run(Thread.java:750) [?:1.8.0_372-372]
EntityPlayer npc = Npc.createNpc(p, "", p.getName());
new BukkitRunnable()
{
public void run()
{
prismCooldown.remove(p.getUniqueId().toString());
Npc.removeNpc(npc); // <===== THIS LINE OF CODE IS ISSUEING THE CONSOLE ERROR
}
}.runTaskLater(Rpg.getInstance(), 20L * 12);
Have ya'll not seen in line decleration in if statements before? Where it won't declare it if it comes back false? My brothers in christ lol
you didnt understand a word of what i said
check the javadocs say the event.getPlayer() is nullable, if it is null check it with an early return OR if it isnt just get it directly from the event.getPlayer
This seems to work just fine:
public static void removeNpc(EntityPlayer npc) {
try {
PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(npc.getBukkitEntity().getEntityId());
for (Player all : Bukkit.getOnlinePlayers()){
((CraftPlayer)all).getHandle().playerConnection.sendPacket(packet);
}
npc.getBukkitEntity().remove();
npcs.remove(npc);
} catch(Exception ignored) {}
}
I made it so when players click items in their inventory, the event is cancelled. The problem is that when a player is in a random slot in their inventory and press a key corresponding to one of the slots in their hotbar, the item can still move there. What can I do to stop this from happening?
What's the code?
if (event.getClickedInventory().equals(event.getView().getBottomInventory())){
if (event.getCurrentItem().getType() == Material.OAK_BOAT || event.getCurrentItem().getType() == Material.WATER_BUCKET || event.getCurrentItem().getType() == Material.WHITE_WOOL || event.getCurrentItem().getType() == Material.TNT){
event.setCancelled(true);
}
}
Well for one wacking all those items into a array or something and doing one check for if the array contains the item would be big brain.
2, ur better off looking up the click type method and working with those in ur checks too
I dare you to repeat getCurrentItem once more
event.getCurrentItem() :p
ty
Also imullsion is right
If u need to call something 4 times in a row, uve screwed up
Imagine what that'd look like if u had 10 different menus with 9 items each.
That'd be one long ass if chain
ty ty
Hello, everyone. After extensive contemplation, I find myself on the verge of surrender. As a server owner, I am seeking a solution for a specific biome world generation. My objective is to create small, compact plains islands scattered throughout a Warm Ocean biome. These islands should maintain a distance of approximately 300-1000 blocks from one another. Despite my attempts to develop a custom data pack, progress has been limited due to complications with the worldgen folder. Additionally, I have experimented with plugins such as OTG and Islandcraft. However, OTG proved unsuccessful, and while Islandcraft functioned adequately, it lacked the desired biome compatibility and was only compatible up to version 1.12, whereas Warm Oceans were introduced in version 1.16. I would greatly appreciate any assistance or guidance in finding an alternative solution to this quandary. The accompanying image, created by myself, is provided solely to illustrate the envisioned aesthetic.
I cant upload the photo so DM if you want to see
?img
Not verified? Upload screenshots here: https://prnt.sc/
no need to ping them
:I sowwy
What if (and hear me out).. you grab all the warm ocean world generation logic
and slap in the island generation present on the ocean biome
with a little programming magic
slaps roof this bad boy can fit so many islands
Ok you need to understand, you are probbaly gonna laugh at what ive tried. I downloaded visual code amd told ChatGPT to make me the code. it didn't work 😦 , Ive watched hours of datapack creation and i learned not much 😦
legit ive been making servers for a really long time and and mostly comprehead lots of code and copy paste types of things however this has been a challenge and i have no idea where to start
Other than my failure to create this type of world, what do you think about the idea of this type of generation?
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
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/
If you want to find someone to do it for you
I’ve never really done individual projects for hire, not sure
Btw, ive gotten ban from Spigot I never understood why I filled out a ban appeal and i really dont understand why i gotten banned. Ive never broken any rules or did sus stuff you know anyone that could help with that
just asking because its kinda annoying how the site is blocking me so i need to delete cookies and make another account to see information
vpn
will that do it?
thats wack
anyways a coupel basic notes
if you want services go on the official stuff and ask for them, never here
by any chance could you give me more information on the island generation present? and how i could find it
uhh
if possible you dont need to
Looking at the code
making a biome isn't that hard
trying to find where the nms code for islands on an ocean is
well
You'll need to make a plugin that uses nms to register a new biome that has your fancy generation
but
it's not THAT hard
P much
yeah world generation is quite convoluted
apparently you want a warm beach biome with a climate that has a lot of "continentalness"
with a not-too-high temperature otherwise it only generates deserts
how do I make it so players can't use the F key to switch items to their off hand
Could you just cancel the PlayerSwapHandItemsEvent?
ty
where i can get gens plugin?
Hopefully it'll be easier in 1.20 and the enum refractor
doubt it since its part of world generation unless 1.20 cleans that up
Well at least making it not an enum would allow for the possibility of future improvements
maybe, just need to hope mojang doesn't do any weird or crazy things in regards to it
is there a way to turn off the server-sided anticheat?
sounds like you want to do some shady things
how's that shady
because if you are the server owner this isn't a question you would ask as you would simply do it
not sure why you think such a community as this would help you do shady things
or wouldn't point it out
how can my question be related with anything shady
how is my question shady
@wet breach I think they mean the vanilla anticheat lol
I'm just looking for the programically way to do that since I received no response in #help-server
I just assumed that it was something that can be done with plugins
It’s in your server.properties
Lol, well this could be then
It’s the allow-flight option
Lol, sorry. Your question the way you have it phrased makes it sound like you want to obtain more knowledge to do something nefarious on servers
every once in a blue moon we get people like this
it's ok, i understand lol
what about the speed checks
As far as I know it’s all bundled into allow-flight
If not, there’s not much you can do about it short of actually modifying the server afaik
there is an option for that
Is there? Good to know
not sure if its named after the console spam "moving too quickly"
just know there is
yeah that
as far as programmatically goes, yes there is plugins that alter this stuff as well
I just don't know of any off top my head except NCP which allowed you to alter some things to your liking
yeah i was playing around with tridents with high riptide levels
wanted to get rid of the rubberbanding lol
thanks, I'll look into that
NCP = NoCheatPlus
not sure if has been updated at all to take in new things, but it did give you options to modify the values of some things like I said
You're dead
whats the method of Player to get what block the player is looking at
Do raytrace
Player#getTargetBlock
Or that I guess
hi question does EntityDamageByEntity Event -> event.getFinalDamage calucate the armors , enchantments , potions player have on them?
hi
public void onPlayerJoin(PlayerJoinEvent event) {
NLGangs.sqlManager.createPlayer(event.getPlayer().getName());
}
public void createPlayer(String name) {
try {
if (!playerExists(name)) {
PreparedStatement preparedStatement = Database.getConnection().prepareStatement(
"INSERT IGNORE INTO players" +
" (NAME,KILLS,DEATHS)" +
" VALUES (?,?,?)"
);
preparedStatement.setString(1, name);
preparedStatement.setString(2, String.valueOf(0));
preparedStatement.setString(3, String.valueOf(0));
preparedStatement.executeUpdate();
}
} catch (SQLException exception) {
exception.printStackTrace();
}
}
public boolean playerExists(String name) {
try {
PreparedStatement preparedStatement = Database.getConnection().prepareStatement(
"SELECT * FROM players WHERE NAME=?"
);
preparedStatement.setString(1, name);
ResultSet resultSet = preparedStatement.executeQuery();
return resultSet.next();
} catch (SQLException exception) {
exception.printStackTrace();
}
return false;
}
you're blocking the main thread for too long
cuz database calls take x hundred millis, one tick is max 50ms
do it async or block the async pre login event (async already so doesnt matter)
no executing the query
it was fine on Java Connection
i switched to the HikariCP and this happens when someone joins
also there are only 3 or 4 players, why does it have to take so long?
in the database
^
my problem with Connection was that it kept dropping out all the time
probably still lagged, configure your connection pool better
do the sql async
and fuck you too discord
@sage patio do the sql async with completablefutures
well to be honest i'm so mad today, i've deleted my custom plugin and decided to install one which its already made (GangPlus)
💀
why should a fucking sql be fine with Connection and fucked up with Hikari
bc hikari uses connection pools
sql 1
xii69 0
lol
also use try with resources, as you are not closing your RS
Hi is there a way to make a player's item and armor invisible? I tried hidePlayer() but the problem is that the player couldn't be hit by other players anymore
it sounds like a misconfiguration on your part in regards to hikari
im not a modder, but I'd expect one can reuse elements from the Potion of Invisibility
declaration: package: org.bukkit.entity, interface: Player
and which package i can use for the item in main ?
Not Hikari's fault if your code is trash
Do not execute blocking code on the main thread. Do not execute blocking code on the main thread. Do not ...
who?
stop the main thread
Exactly. Stop the main thread to execute blocking code on another thread
oh thats the /freeze command everyone always talks about
everytime someone mines a diamond you freeze the server for 5 seconds - just so everybody knows
A lot more visible than a chat message anyway
Exactly it is perfect
5 sec for each diamond
Couldn't be better
The question is: is a plugin considered harmful and deleted from spigot if it did exactly that?
But obviously mentions exactly that behaviour in the description?
In short: Is it harmful if it says it's harmful?
there is a difference between harmful and malicious
Well I think freezing the server on purpose might aswell be malicious
As it's considered DOS
well its not malicious if its made known that is what it does
By using a seperate thread. Or simply use Schedulers
you can't unless you are making another thread that is not the main one sleep
Depends on your usecase. You rarely need your own thread
What do you want to achieve?
In that case you would use a repeating Task
https://www.spigotmc.org/wiki/scheduler-programming/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
I got a plugin deleted off of spigot for being harmful even though it was advertised as such
So there is probably not much of a difference
The initial delay and the delay between runs. It's in the guide
what did it do?
Generic trolling plugin iirc
"hah i will troll the user by giving him op"
Yeah it was that sort of stuff
And troll the whole server by shutting down 12 times a day
It was more of a backdoor
Can’t imagine why a backdoor would be removed
scary
Open source backdoor????
Impossible.
Lmao
Like people watch open source code before installing
That's not open source, you are lucky
If it was community edition however...
I don't know that api. Isn't there a vault discord?
idk
Are you depending on it in your plugin.yml
y
:|
What
im lookin' for a solution
I provided you one
show us your plugin.yml
name: Event-Core
version: '${project.version}'
main: ir.Mehran1022.EventCore.Main
api-version: 1.13
softdepend:
- Vault
commands:
event:
I'd try just doing depend softdepend doesn't guarentee load order
because one of my plugin functions work with vault
https://github.com/MilkBowl/VaultAPI & follow the instructions
bruh im saying
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
Is null
Also make sure you have an economy plugin installed
oh
Essentials is one
thanks for reminding me
it does, what else would be the reason for it?
trash
you yes
like u
Softdepend is just "load when it's there or ignore it" while depend is "if it's not there don't load this plugin"
thanks for your help guys ❤️
i at least know how to install a plugin
take the L
yeah okay i auto deploy
There are weird edge cases where it wouldn't, but yeah it almost always works like that. I think I was just thinking about circular dependency which would just break regular depend too
Frrr
reversedepend: this
if i depend on them and mine loads first i will spam your github with issues
Time to delete the repo
loadbefore: spigot
then the spigot 1 star reviews fly in
this is the way
what time is it
Well if it does its job and never mentions a developer api you are out of luck
Idk you tell me
isn't time relative? who knows what time it is
its my good right to review any plugin i want with 1 star and make up some facts
3:15 PM
Saying "The non-existing developer api does not work" will look weird though.
and?
<t:1685965506>
Idk that's just rude. That's like buying a car without wheels and then writing a review that the car does not drive
sounds about right
It's not like you knew it probably won't drive
I mean you would tell the truth. But the 1 star rating would be kinda weird
i can live with that
Well then
now i will look for fabsi on spigot and begin my journey
If that's what makes you happy
No its not
i will never be
yes it is
where are you from
coding is depression
only if it doesn't work
As soon as you fixed that annoying bug that you searched 2 hours for it's big yay
if it works its a "won, but at what cost" since its work related
I'm not talking about coding for work
I don't enjoy coding for my work either
mostly because of all that shitty legacy support I have to deal with though
Don't deal with it then
the only thing that makes me at least a bit happy is a fancy UI
customers will be mad
since im a backend guy
but coding for every day for a decade now also has its downsides
I hate building UIs
unfortunately the only way we're gonna make people stop using legacy versions is if all developers refuse to support them
oh yeah as long as I don't have to build it, that's great
thats not how it works
but it is
not in a business environment
if plugins keep supporting 1.8 then people feel like they have a right to plugins supporting legacy versions
Well if you distribute software you kinda have to support it for a few versions/years
I won't support 1.8 or any legacy minecraft version - ever.
I was talking about commercial/business development
if we would drop our legacy shit 70% of the software wouldnt work anymore
sadly that's true
and rewrite it would cost too much
so we just stumble over it with both eyes closed
Cant wait to get a job and be writing 20 year old backend in nodejs while wanting to die the whole time
You should work with banks
They pay well
and are always 10 years behind in technology
(or more)
can also recommend ^
dont they use assembler
cobol mostly
you are thinking of cobol yea
I mean, its free money with cobols decimal math
Is their even a language with that much precision besides cobol
tfw the tech debt is older than you
is a player object safe to use after a respawn
The player object does not change after death afaik
do not hold references to Player objects
You can if you wipe the data on disconnect
I would argue with that statement. It's perfectly fine to hold a player object if you wipe the data on a disconnect anyway.
Not cleaning on disconnect is bad pratice
No
why keep data in memory when it's no longer required
Holding a reference to a Object that is in a WeakHashMap is bad practice, you prevent GC and have to manage cleanup. Use UUID, you don;t prevent GC, you don;t have ANY cleanup to do. You respect the contract
How do I not have any cleanup when I store a UUID in a hashmap/list/whatever? How else would it get removed?
that just keeps uuids laying around that are then checked in loops or whatever the list/map is used for
UUID is persistent, Player is not
I know but you have to wipe it anyway
what you do with yoru UUID storage is upto you, but using UUIDs will not break GC in Bukkit
Holding Players means you MUST cleanup or you prevent Bukkit properly releasing that Player and nstp GC on it
Cleaning it up on disconnect (which you have to do anyway) will not break it either
or should do
You really are not understanding
In Bukkit Players are stored in a WeakHashmap. They do so for a reason. When a Player object is dropped it's free for GC to clean it up, without any outside inteference.
You holding a Player reference breaks that cleanup.
Well it's only dropped on disconnect
Keeping an entity reference across tick is a pretty meh practice
if they start to change player objects in between ticks a lot of things will break
When it's dropped makes no difference, Holding a reference is bad practice
Doesn't mean you have to abuse it xD
reference by UUD and you'll never have an issue
already doesn't work for any other entity with chunk unloading etc
giving player instances special treatment because the server happens to maintain a single player instance for you
is a bit meh
you should always clean up your resources no matter in what context
True
ugh fine I'll adapt it.
I hope there's a UUID to Player map and it's not some weird loop in the back to determine the player based on UUID.
yea its backed by a map
plain hashmap impl I think
concerning that java's uuid only shift some bits for their hashcode , that should be pretty fast if it doesn't collide too much
Legacy versions just need to be dropped at this point
I really hope whenever material registry stuff drops it does at least break some old things xD
just so people update
inb4 someone brings up 1.8 combat 
Same here
when new combat snapshot, jeb?
The current combat isn't bad tbh lol
I didn't like it at first but I've warmed up to it
I like both, and pretty good at both, but generally lean towards 1.9 combat because clicking just hurts after a while. (referring to 1.8 v 1.9)
I did like his combat snapshots tho
the "hold down to spam" thing
was kinda nice
I believe that got some hate because it was too lenient in its timing
I mean, everything in regards to combat is gonna get hate xD
I like being able to rapid click (1.8) but I'm not willing to lose API functionality to keep it.
I don;t PVP but I do panic click when mobbed
how does a pensioner rapid click
I think its a different discussion with pve compared to pvp
The problem is not how do we rapid click, it's how do we stop once we start.
when the parkinsonian kicks in
exactly. very common behavior in the elderly
gets banned for autoclicker
Honestly, when people started making guides on how to add tape to your mouse to click faster I think 1.8 PvP fell off https://www.youtube.com/watch?v=AWDBDZp3Y14
grip tape is very useful for drag clicking , in this video i will be showing what the best grip tape is for drag clicking or ways to drag click better and get high cps
Subscribe:https://www.youtube.com/c/DigitalSmile?sub_confirmation=1
Discord Server : https://discord.gg/U6scmhq
Drag clicking with flex tape (by cake progress)
https://www.yout...
These days it's a lot of: "where do you draw the line at cheating"
You have to show who has the biggest (click)
My view it's cheating when you spawn items instead of earning, or you use ANY assistance when competing against others.
ANY assistance
rip all those fancy mouses
if its just PVE there is no competition so anything goes
rip my double click mouse
dont say that
if i want to play survival its like 10 mins farming wood
then cheating some diamonds
Thats fine
You are only cheating yourself out of enjoyment
you may as well have a play end credits button 🙂
Hi, im using ProtocolLib, i want to clear nodes in ClientboundCommandsPacket, problem is that there is nothing like getNodes method in PacketContainer, what can i do about that?? is there any work-around??? maybe there is easy way that i dont see. problem is that there is no ProtocolLib's discord server or anything so i cant ask them.
why are you messing with packets for commands?
i have just made my own implementation of command system but on lower level, i was using packetevents for that but now i want to do that with ProtocolLib
Not really anything to do with Spigot then
hmm so where should i even ask?? like there is no ProtocolLib's discord server or anything
Concerning that that packet exposed brigadier types I'd be surprised if pl has abstractions for it
Unless it reimplemented those types or exposes brigadier
i did wrapper for that in packetevents, its not that hard
https://github.com/retrooper/packetevents/blob/2.0/api/src/main/java/com/github/retrooper/packetevents/protocol/chat/Parsers.java
Big truth.
Met a player who used an audio mod to use the raw coordinates data of the blocks producing ambient sounds, and fhen slipping an ambient sound in to gold ore blocks.
How was the sweat caught? Cause he Mined 9k Ore I 3 days lmao
but if they wont do that, i still want to be able to modify this packet here, is there any work-around? can i somehow still get nodes list and modify it???
?paste
i was trying to use getModifier() but still i cant figure out
I'm trying to create custom persistentdatacontainer and then store it in my custom spawner. But I get an error at a serialization method in my custom persistent datatype class.
Error: https://paste.md-5.net/oxekubejey.cs
And that is my class: https://paste.md-5.net/mimawanono.cpp
i have this on the top of my command
File crateLocationFile = new File(main.getDataFolder(), "locations.yml");
YamlConfiguration locationFile = YamlConfiguration.loadConfiguration(crateLocationFile);
ConfigurationSection locations = locationFile.getConfigurationSection("locations");
and when i try do this later on
ConfigurationSection crateEntry = locations.createSection(args[1]);
it says
Cannot invoke "org.bukkit.configuration.ConfigurationSection.createSection(String)" because "locations" is null
you have to set to place a section, and it can't be empty
you have no locations section
not in the file you are reading
...
that section is empty, it will do nothing
its still a section?
it will return null
string
so like this @eternal oxide
if (locations == null) {
ConfigurationSection crateEntry = locations.createSection(args[1]);
crateEntry.set(args[1], targetCrate.getLocation().getX() + "," + targetCrate.getLocation().getY() + "," + targetCrate.getLocation().getZ());
}
or what
what's this lol
no
creATE YOUR SETRING, THEN CONFIG.SET(LOCATIONS", STRING)
err caps
I'm not retyping it
ok
GM BRO 🙂
can u help me for idea ?
if u help: i wanna give cooldown to cow milking
and i think this: when players right click the cow with bucket i added cows to hashmap key and i add unix time to data and
i control with if like this if(unixtime > cowtime ++ 30k) do somehing; else(cancel event;
is this good idea ?
Don't cow's have PDC? You could just read/write from the PDC and it'd give it a level of persistence as well
oh this good idea PDC is like uuid ?
?pdc
ty
Can someone help me? I put reloadConfig but my configuration is not saved, just in case I restart the server
Reload does not save it
reload would re-read it if you changed it manually
you have to call save
How do I save the configuration so that it updates in-game?
wdym by updates in game?
You change it on the file system by hand and then want the changes to be effective in game?
For example, I changed the name of the item in the configuration, but it receives the old
yes

in that case reload should be fine since you did the saving manually
reloadConfig()?
yes
does not work.
😭
try {
MainKits.getPlugin().reloadConfig();
sender.sendMessage("§aConfigurações reiniciadas com sucesso.");
} catch (Exception error) {
sender.sendMessage("§cOcorreu um erro ao reiniciar as configurações.");
}```
The config you're writing to is the getConfig()?
I noticed that my reload method looks like this:
private FileConfiguration cfg;
//.....
public void reload() {
plugin.reloadConfig();
cfg = plugin.getConfig();
}
I'm not sure if it is required. You can however try to do the same and see if that changes anything
Configuration config = MainKits.getPlugin().getConfig();
you have to update your config reference if you reload it
in that case it is actually required :)
or stop storing your config in a temp variable and access it directly with getConfig()
Whenever I try and clear everything from my custom config file, it just reappears. How can I fix this?
nvm i figured it out
I just need to disable my plugin to be able to edit it
anyone got the dependency for FastAsyncWorldEdit?
random generation is working
i mean idk i haven't actually made it randomly generate
it just makes little squares that pretend to be rooms
to visualize
now i gotta port the code over
but that'll be easy
sometimes it doesn't work thouhg and idk why
oh well
I am trying to make my plugin tell the player how long it takes them to complete the parkour. After completing the parkour, instead of giving me a normal number, it gave me 1.685975912549001E12 for some reason. Here is my code: https://paste.md-5.net/ucupeceyef.cs
your timing is in milliseconds
convert it to minutes and seconds
the parkour takes 8 seconds to do
so the milliseconds should be 8000
and I divide it by 1000 to make it 8
but it still shows as a huge number
Possibly because you never set a start time
Current time millis is 1685976882702
and you should store/get them as long and not as double
oh ok
No but I am trying to get a decimal point for the time in seconds
there is no decimal point in these values
you are talking about formatting the display of the result
in that case you'd cast it into a double after you calculated the difference as you only need it to be a double at that point
ok
so when grabbing the values of parkourstarttime and parkourendtime, what variable type would i grab?
Note that your server will heavily lag because of that plugin, there is likely no need to store these values within a config file
and to save/reload it each time
should I just store it in HashMaps?
Yes, unless you actually need that information permanently
Only some of it I need permanently
Then only store that permanently. And try to reduce the usage of config.save(), that can heavily decrease your TPS. One option would be e.g. an async scheduler that stores it each minute or something
and config.reload() shouldn't be used at all there, you already have everything loaded
ok ty
What would be the best way to go about a event happening 24 hours in the future. Should I just have a sync timer running and checking the time every tick?
use a scheduledExecutor
Can you send docs I don't think I've ever used one, sorry I'm on phone now just thinking of design lol
man clion's warnings are so sometimes annoying
Clang-Tidy: Overloaded 'operator++' returns a non-constant object instead of a constant object type
i add const as a return type
Clang-Tidy: Return type 'const typename nonogram::Table<t_element>::Row::RowIterator<t_finalElement>' is 'const'-qualified at the top level, which may reduce code readability without improving const correctness
egjava LocalDate nextDate = LocalDate.now().with(TemporalAdjusters.next(DayOfWeek.MONDAY)); Long midnight = LocalDateTime.now().until(nextDate.atStartOfDay(), ChronoUnit.MINUTES); ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); scheduler.scheduleAtFixedRate(()-> { /* Code here */ }, midnight, TimeUnit.DAYS.toMinutes(7), TimeUnit.MINUTES);
like wtf you suppose for me to do
that schedules to run every monday
i add rvalue modifier, it still complains
Thanks
This isn't like 1 task per thread right I could run like 20 or so schedulers right
yes, just increase the pool
Does spigot have a default pool I could use / is there one I could just use
Hmmm well all I'd be doing is someone enters a command for my plugin and a task is scheduled for a day later
I'd assume bukkit would be fine
what do you need to do 1 day later?
It's a start of an event
It notifies a group of players and starts the event after a day
The code for starting the event would be similar for each group I'd ideally save the time stamps, save relevant data and restart the tasks on server restart
people say java is bunch of boiler plate, wait till they see cpp's boiler plate in order to implement an iterator method:
typename nonogram::Table<t_element>::Row::template RowIterator<t_finalElement> nonogram::Table<t_element>::Row::template RowIterator<t_finalElement>::operator++(int) const & {
}