#help-development
1 messages · Page 1671 of 1
it's inside the die method within a NMS entity class.
So that would be odd if the die method gets called infinite times
It will only run once
It does not
Last 3 times I tried, I had to shut down the server and kill 4k+ entities.
Argue all you like. That code will run ONCE> if you find it being executed more then it is being called more. a runTaskLater runs once
you are spawning a new entity as it dies?
Yes. after a 20 tick delay
and you are trying to kill all entities?
Well I get that part.
But when I kill the first, it just keeps spawning.
Even though only one has been killed
then your code is not doing what you expect it to.
Your logic is wrong
If teh code keeps running, its being called over and over
I see what you are trying, but I don't get it.
I simply extended EntityMonster
omfg.
nvm
I'm a dumbass
i think
yes
mb
xD
runTaskLater physically only runs once and cannot run more than once.
if I make blockplacevent and cancel it will the block be still placed?
it will be placed and be removed
hmm is it a good plan to give every command class a cooldownmanager field?
runTask makes code run on main thread right
Yes
Nope. Millis for Unix time and nanos for the native cpu clock measurement.
Millis is more precise relative to the absolute time and nanos is very precise regarding delta values.
i was trying to store my cooldowns in seconds and not in millis bcs thats the smallest unit i need
the easiest way is to get the millis and divide by 1000
Depends if you have a fixed point system.
can someone explain threads to me?
Oof
uh no
threads can do tasks at the same time
So you constantly count down the time? You should not.
this is the code
long timeLeft = System.currentTimeMillis() - cooldowns.getCooldown(p.getUniqueId());
if (TimeUnit.MILLISECONDS.toMinutes(timeLeft) < 5) {
Utils.message(p, "&cPlease wait&e " + Utils.millisToHumanReadable(TimeUnit.MINUTES.toMillis(5) - timeLeft) + " &cbefore reusing this command!");
return true;
}
millis to human readable that method name goes brr
o
does a spigot server have multiple threads? if so how many
The spigot server has one main thread. There are a ton of extra threads like the ones spawned by the BukkitScheduler
but in most cases you will never use them as they are used for internal stuff (exception are the BukkitScheduler ones)
Ill do some chores and then ill write you an example for threading.
o
1.8 is not supported anymore.
But you can check if any variable is null by comparing them
to the null pointer if(var == null)
How can I support both Java 8 and 16? I set language level to 8, but still get class has been compiled by a more recent version of the Java Runtime (class file version 60.0), this version of the Java Runtime only recognizes class file versions up to 55.0
is that even possible?
supporting both means your project and the executor must have j16
Yes so I have to compile it completely to 16?
yes
Ok but the problem is, the executor is still Java 11
And I want to make my plugin work on Java 8 AND Java 16 servers
you could let it compile then with j8
Ok
you just cant use j8+ api functions then
and async chat
Ok thanks
how do i check if something is either a certain item or another spesific item
anyways it is a good way of having an instance of this class in all my commands?
?paste
(items are variables)
what type of variables?
itemstack
You should check custom items by comparing their PersistentDataContainer
itemStack.isSimilar(other item)
Because methods like this will fail if you rename the item or the durability changes.
?pdc
What version are you on?
1.17.1
Ok. Then pdc is your friend. Its a bit complicated at first but very powerful.
wdym by that tho
What exactly is the ItemStack you are checking? Is it modified/renamed? or just a default item?
it means isSimilar checks itemmeta
itemmeta can change
pdc cannot unless u remove it
oh so u just check for item tags?
prob a modified one
waet
I'm guessing he wants to test an item he's created with one that was used, to see if its the same
what
no, i have two variables set to custom items, i want to check if the clicked item in an inventory is one of them
you mean a GUI item?
yup
then isSimilar will work, as will == or .equals
how do i do with .equals
if (!next.isSimilar(event.getCurrentItem())) return;```next being the item you created and stored in your variable
even if you learnt 2 minutes worth of java u would know how to use .equals
lol
some good stuff is going on here
will it take you a month like it did with me or what
He's trying
it is something you forget if you have a memory like mine
my boy not recommending PDC
disgusting
?ban @onyx fjord spam in thread
Done. That felt good.
LOL
very old
conclure can you give 2hex another warnning for being toixc please? thanks
boomer old
toixc?
lmao
yes toixek
seems fine to me
You tixoc boy
a boomer whose been here since 2017
2hex tbf you’re not the most civil person around here
and coding for long😂
Yes, because no one is civil here except a few
i am very civil
i agree
well usually you get what you give
i know alot of nice boys here
an overwhelming amount
🙉
he is right though, there are not many civil and nice people on here
here wo go again
totally right
well thats minecraft dev into a nutshell,spigot is in the middle allowing some freedom actually
go into paper and be a dick and see you getting booted in minutes
Hey, has anyone worked with packets? Could it do something like showing an entity to only one player?
i assume i'm not a part of the civil group
@eager hinge thing is a packet is useless without sending it,meaning you decide who gets it
tbh ur not that bad
right. he is even worse
i had you blocked so probably not
i shitpost a lot in spigot discord
reda is a bad girl
or to be more exact if your going the normal way once you get the connection of a player you can send that packet
lol, you had everyone blocked, until you were talking to yoruself 🙂
i only blocked mean people
I guess I'm mean then
i guess that is everyone huh
bro
🤣
more like you blocked people who tried to help you but you couldnt handle the critism
im not even getting started with this
oh boy that hits deep for some
if i do im getting banned
pretty much
and you admit?
yup

doesn't make you nice though
great advancement
deeper than the ISP time to respond to my port forwading issue
bro
i don't understand 😅
i wouldve agreed if u blocked anyone
what version you using?
the world is changing
u fucking blocked the nicest human here lmfao
the latest. 1.17
ur not finding anyone nicer than elgar
Anyways, Have fun help-dev lurkers
u2 noob
i suppos if 1.17 didnt change the way
((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet)
playerConnection is b now iirc
damn
ahh yes i see
fkn
yoink
private static void sendPacket(Player player, Object packet) {
try {
Object nmsPlayer = getNMSPlayer(player);
Object connection = nmsPlayer.getClass().getField("b").get(nmsPlayer);
connection.getClass().getMethod("sendPacket", Packet.class).invoke(connection, packet);
} catch (Exception e) {
e.printStackTrace();
}
}
wait
though
b
this can be simplified
Ok number one:
Understanding how the minecraft main thread works.
Minecraft is like many other games tick based.
This means the main thread wants to schedule N ticks every second. For Minecraft
this number is 20, which will result in 50ms per tick that can be used to run code.
If the code takes longer then the TPS (ticks per second) effectively drops down.
Some of the tick time is used by NMS code some by Bukkit/Spigot and
some by plugins. If the server has nothing to do then it just waits some milliseconds
so the tick takes exactly 50ms.
o
so i can just create some kind of entity packet and send the location each tick?
Not quite. One uses reflections while the latter calls nms methods.
o
still need help btw :p
well yes,but actually no
...then don't respond?
first you create a entity then you call the spawn packet with it
do i need to remove the packets afterwards?
packets are more fragile.. they get bonked fast
I didnt read the posts above but are both methods not working?
Elgarl suggested the isSimilar() method from ItemStack
and i that you should use the PDC of the ItemStack. There is even a guide for that.
for example teleporting away with a packet spawned entity will remove it
once you come back
i prefer .equals
this is my special pet,look at it https://media.discordapp.net/attachments/694661573125472256/845627676568190976/finally.gif
This is very fragile and will lead to further problems but ok.
what a good abandoned plugin
thanks, i'll try to write a code and i'll see how it goes 🙂
can he climb blocks?
yes has pathfinding
how did you do the legs
cool
how
how do u all work with armorstands
was meant to be a free alternative to those premium pets plugin.. sadly my passion died
i dont understand it at all
so in the end its left in the trash can
not hard you just keep sending the refresh packet
[05:31:40 ERROR]: Error occurred while disabling <> v1.0.0 (Is it up to date?)
java.lang.NoClassDefFoundError: me/tvhee/tvheeapi/spigot/api/crafting/CraftingRecipe
at me.tvhee.tvheeapi.spigot.core.BukkitPluginLoader.onDisable(BukkitPluginLoader.java:110) ~[?:?]
????
thanks for specifically not including the ondisable
are you using an external api?
ah but uhh maybe a screen of onDisable() would work better than this
ok i figured it out
@Override
public void onDisable()
{
CraftingRecipe.unregisterAll(); //Exists
this.tvheeAPIPluginLoader.disablePlugin();
}
i found a stackoverflow thing
playin minecraft for 18 hours
e
and whcih line is the eror?
The first
possible that i cant find the unregisterall method?
Oh let me show
🤔
public static void unregisterAll()
{
for(CraftingRecipe recipe : registeredRecipes)
recipe.unregister();
}
ah
That does Bukkit.unregisterRecipe()
could still use help with this
The actual method is removeRecipe
i can throw my file manager but that goes brr
I was wrong
oh
But I still get the error, the class is just in the jar as normally and other classes also work fine
I also have never had this issue before
I am wrapping it in try/catch, let's see if it catches
?kick @reef wind
Done. That felt good.
what did he do?
Yes confusion
🧠
why are you so strict about threads?
they wont do anything
you can just join and leave them
so anything written in there doesnt harm others
Gay
?ban @quaint mantle disrespectful
Done. That felt good.
wtf
I have told him countless times now
bruh
this goes fast
Ehm when I wrap my problem in try/catch I even do not get the message in the logger I set in the catch clause
I’m not strict about threads however they should be used to distribute peoples problems in the help channels, once they have no use then they should be archived. It makes it easier to navigate those threads that are still unresolved. We have a channel for general off topic, in fact verified also. We don’t need one more.
how can I delete the minecraft world on startup
I've tried using the the plain java way by grabbing the file and using file.delete(), but it isn't working.
I'm even using the Bukkit.unloadworld() before attempting to delete it, but it's still not working
world.getWorldFolder().delete()?
What world?
main world. I'm going to try what you said
at what point in your "startup" are you attempting to delete it?
Note the main world can not be "unloaded"
I've not looked at the load sequence so can;t tell you if its possible or not. I just know once loaded you can;t unload.
well i want to generate a new world on startup, i've seen other servers do it so it has to be possible.
?stash
okay so getting the world file and using .delete() on it is doing nothing. is there a way to force delete it?
You can;t delete folders with contents. you need to perform a recursive delete
Is there a wildcard for materials? E.g. Material.ALL or *
in what world would that make sense
There are Tags
because im trying to see if the item a player is holding is any item
if it's not material.air or if the itemstack is not null
ok i was just being dumb nvm
what do you mean by "is any item"
how to make arrays public for other methods?
Declare it outside the method
like 20 years of experience little
@Override
public void onPluginLoad()
{
saveDefaultConfig();
String worldName = getConfig().getString("plugin.world");
if(worldName == null)
throw new RuntimeException("Could not find the default world name, please specify it at \"plugin.world\"!");
File worldFile = new File(getDataFolder().getParentFile().getParentFile(), worldName);
getLogger().info("Detected world folder: " + worldFile);
if(worldFile.delete())
getLogger().info("Successfully deleted the world!");
}
Only the last 2 lines do not function, it does not delete the world folder and does not print the message
You need to delete it recursively
How would I do that?
Not that much ;-;
loop the contents until there are no child contents (empty directories and files) and delete them
org.bukkit.plugin.IllegalPluginAccessException: Unable to find handler list for event org.bukkit.event.player.PlayerEvent. Static getHandlerList method required!
I get this error when loading my plugin.
Heres my code
public class AllPlayerStat implements Listener {
@EventHandler
public static void playerAttributeEffect(PlayerEvent event) {
if (event.getPlayer().getInventory().getItemInMainHand().getType() != Material.AIR) {
AttributeModifier attackSpeed = new AttributeModifier("attack_speed", 20.0, AttributeModifier.Operation.ADD_NUMBER);
event.getPlayer().getInventory().getItemInMainHand().getItemMeta().addAttributeModifier(Attribute.GENERIC_ATTACK_SPEED, attackSpeed);
}
}
}
someone pls help
what is a playerevent?
is that a custom event?
Yeah you cannot by definition listen to PlayerEvent
o ok
Because it does not have a HandlerList
right good to know
whats the code
its a tutorial
I know its a tutorial but Im on cell data
You can not listen to any abstract events
@fading lake something like this?
private List<File> removeDirectory(File direcotry)
{
List<File> notDeleted = new ArrayList<>();
File[] subFiles = direcotry.listFiles();
if(subFiles == null)
return notDeleted;
for(File file : subFiles)
{
if(file.isDirectory())
notDeleted.addAll(removeDirectory(file));
if(!file.delete())
notDeleted.add(file);
}
return notDeleted;
}
Yes it is working!
notDeleted is just to print that it failed
@fading lake this still gives me this problem: [07:02:10 ERROR]: Failed to save player data for tvhee
Thats not coming from the code you posted
It was when I kicked a player
If I remove the world myself it just works
I saw it left 4 directories without deleting them
in onLoad
what directories
Those are all empty
Your method isnt deleting them, hang on I might have one of my own
Ok
I think regenerating the world does not work as expected
But if I delete it myself it all works
Ok but I am trying it through my plugin
@maiden briar Use this method and tell me which ones it cant delete
https://hatebin.com/qapenhtzsr
youll have to change some of it like the loggers n stuff
Ok I will add them to the list
Ok implemented, testing...
I don't get any, but directly after Bukkit shouts at me
[07:15:22 WARN]: [org.bukkit.craftbukkit.v1_16_R3.util.WorldUUID] Failed to write ./world/uid.dat
java.io.FileNotFoundException: ./world/uid.dat (No such file or directory)
at java.io.FileOutputStream.open0(Native Method) ~[?:?]
at java.io.FileOutputStream.open(FileOutputStream.java:298) ~[?:?]
at java.io.FileOutputStream.<init>(FileOutputStream.java:237) ~[?:?]
at java.io.FileOutputStream.<init>(FileOutputStream.java:187) ~[?:?]
at org.bukkit.craftbukkit.v1_16_R3.util.WorldUUID.getUUID(WorldUUID.java:42) ~[patched_1.16.5.jar:git-Paper-788]
at net.minecraft.server.v1_16_R3.WorldServer.<init>(WorldServer.java:327) ~[patched_1.16.5.jar:git-Paper-788]
at net.minecraft.server.v1_16_R3.MinecraftServer.loadWorld(MinecraftServer.java:554) ~[patched_1.16.5.jar:git-Paper-788]
at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:298) ~[patched_1.16.5.jar:git-Paper-788]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1069) ~[patched_1.16.5.jar:git-Paper-788]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:291) ~[patched_1.16.5.jar:git-Paper-788]
at java.lang.Thread.run(Thread.java:834) [?:?]
Ok and if I directly stop the server after the plugin, it still left the 3 folder
But no warnings in console
What are the components?
The non directory files
Ok
I think that is happening here, because there are 3 empty directories left
@fading lake it did not print anything, but still left the directories
does your plugin have access to delete them?
Yes I don't know that
That method should be deleting the entire thing
Ok it is randomly fixed if I restart the server again....
show me how youve implemented it
private void removeDirectory(File file)
{
if(file == null)
return;
if(file.isDirectory())
{
File[] files = file.listFiles();
if(files != null)
{
for(File childFile : files)
{
if(childFile.isDirectory())
removeDirectory(childFile);
else if(!childFile.delete())
getLogger().warning("Could not delete file: " + childFile.getName());
}
}
}
if(!file.delete())
getLogger().warning("Could not delete file: " + file.getName());
}
File worldFile = new File(getDataFolder().getParentFile().getParentFile(), worldName);
getLogger().info("Detected world folder: " + worldFile);
removeDirectory(worldFile);
getLogger().info("Successfully deleted the world!");
nono where its being called
There above
odd
wait
The error could be stopping it from running theoretically
what line is the error coming from
hmm i am making instances of a commandclass to execute something
java.io.FileNotFoundException: ./world/uid.dat (No such file or directory)
I still get this, and if I try to do Bukkit.getWorld() in onEnable it returns null
what line is the error coming from
at java.io.FileOutputStream.open0(Native Method) ~[?:?]
at java.io.FileOutputStream.open(FileOutputStream.java:298) ~[?:?]
at java.io.FileOutputStream.<init>(FileOutputStream.java:237) ~[?:?]
at java.io.FileOutputStream.<init>(FileOutputStream.java:187) ~[?:?]
at org.bukkit.craftbukkit.v1_16_R3.util.WorldUUID.getUUID(WorldUUID.java:42) ~[patched_1.16.5.jar:git-Paper-788]
Shall I replace the current method temporairely?
no just put the try/catch around it
Ok I will catch nothing then?
deleteFile(file); does not exist
Pls send me also that method
Or is this a reference back to the method?
That is the fix!
But Bukkit.getWorld(world) still returns null
That method does it for me which is why I'm lost, I'm convinced its erroring and then just not deleting the directories
It is deleting it in onLoad and I am calling it in onEnable
Worlds load after onload im pretty sure yeah
yes, and by the time you call it on onenable, the world doesn't exist
Thatll do
Ok I will try it
What I do is I have a map that doesn't load when the server starts, then when my plugin enables, I delete the old world and duplicate the unloaded one
takes more storage but is safer
Oh I haven't used that before, interesting
No errors now
does that work with specific maps? i.e hub worlds etc
the real question is, does it work
No, still same world
Company
Which one
From this company (ManHuntMC) I got a test server, the server is from HQS Hosting
I got it for free to test
What's manhuntmc? Dream's hosting service?
It is
See their website: https://mcmanhunt.com/
Probably comes preinstalled with drop modifying plugins.
"I host my server on hypixel survival"
What Hypixel survival?
he said it was a mod, yet mods don't affect serverside stuff which was super sus
hypixel launched a thing where donators can create SMPs, that's what they are referring to I believe
I am
Oh ok
you can't add plugins and stuff to it can you?
No I can
I uploaded my own plugin
I can try changing the seed, and regenerate chunk by chunk
I don't want to
I don't think they use the permission system, I know mineplex doesnt which makes opping useless
I mean I am not using hypixel's service
If your company wont generate a new world, I think either one of my or @last temples methods from above will be your best option
depends, either mine, duplicating an unloaded world and deleting the old one, or using the worldcreator which morice said
if unloading doesnt work, try either of the above
you may need to nms unload it tho
Is this a channel for plugin help aswell?
Still not working
whats the issue gummeh
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage("Player command only");
return true;
}
Player player = (Player) sender;
if (cmd.getName().equalsIgnoreCase("gmc")) {
player.isOp();
player.getGameMode().equals(GameMode.CREATIVE);
player.sendMessage("§6You are already in gamemode §cCreative");
}
else if (cmd.getName().equalsIgnoreCase("gmc")) {
player.isOp();
player.setGameMode(GameMode.CREATIVE);
player.sendMessage("§6Your gamemode has been updated to §cCreative");
}
return true;
}
}
What am i doing wrong
Nope
No errors
you're not checking their gamemode
How do i do that though?
if (statement) {
// code
}
struggling to read its format
but from what I can tell, hes got conditions without the ifs
player.getGameMode().equals(GameMode.CREATIVE) this line on its own does absolutely nothing
I see, I think i could just better start off again
then give us the link
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.
Any courses that claim to teach you java not by doing or by no example are usually bullshit
so I recommend programmingbydoing.com
@fading lake they advise there to create a totally new different world (other name) and to replace it, but how would I do that?
No nothing
if (gamemode == GameMode.CREATIVE()) ```
would that be correct
alright, thank you everybody for the help
The problem is that I can't delete the main world
Ok then if I comment it out it also does not work
that depends
if you make a new one straight after I think its fine in 1.13 up, but on 1.8+ it leads to crash, fire burning hell on earth dearh destruction
It is not working, here is my code:
mainWorld.setKeepSpawnInMemory(false);
//Bukkit.unloadWorld(mainWorld, true);
File worldFile = mainWorld.getWorldFolder();
getLogger().info("Detected world folder: " + worldFile);
removeDirectory(worldFile);
mainWorld = Bukkit.createWorld(new WorldCreator(worldName));
if(mainWorld == null)
throw new RuntimeException("Could not create a new world!");
getLogger().info("Successfully regenerated the world!");
No errors btw
why are you throwing a runtime exception lmfao
Is this yoru own world or an Overworld?
overworld
The overworld can never be unloaded
It doesn't even print the generating, only this:
[07:57:58 INFO]: [DogLeader] Detected world folder: ./world
[07:57:58 INFO]: [DogLeader] Successfully regenerated the world!
I can sysout that too
Ok, do you know how to regenerate the overworld to a completely new world?
once the overworld is loaded it is blocked from being unloaded by Bukkit
Yes, and they said I can't remove it in onLoad (and that causes errors)
if you want a new Overworld, delete the files/folders in onLoad of your plugin
Making lava-proof items — but these events aren't doing it 100%...
EntityCombustByBlockEvent()
EntityDamageEvent()```
The item looks destroyed visually, but still can be picked up.
What event would I target to prevent the visual destruction?
when are you calling getWorld? you can;t do it onLoad
I mean if I do that in onEnable
that means Bukkit has already checked its world, but not loaded when onLoad is called
You also can;t use the WorldCreator in onLoad
Ok
You could try just deleting all teh mca files, leaving the folders
its rare, but possible
it may be your old world spawn and just luckilly happened to be in a cave
Now I am spawning 20 blocks higher so that is not the cause
Thanks guys for wasting time on me
or the ground is 20 blocks lower?
I checked with coordinates
Removing the entire folder
ok
how can i migrate a server from online mode to offline mode
server properties
online-mode set to false
You can't easily.
Online the player UUID is generated by Mojang. Offline the UUID is generated by the server based upon the player name
all player data is stored based upon the players UUID
Anyone is familiar with Forge and knows how can I get mod list? Hypixel somehow did that, and kicks me if I use certain mods. (they don't send plugin message on their own)
plugin messaging channels. Forge has a mod query channel
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Forge has a message channel at which the mod list of the client is published. I think you should
go on the Forge discord and ask how their protocl specification looks like.
not that wiki]
Didn't know they had a Discord 😳
Hiya is there a way to make a sound follow the player? (Basically the sound continues playing even when out of range)
This can be done by either using a volume of -1 or by streaming the sound to the player.
Cool thanks
Just made it silent
How do I stream it?
oppurtunity, Using an aromic reference, If you decide to access a filed with this keyword
o
fancy diagrams
Good resource, other than the three typos above.
@lost matrix cant u just do new Thread
or smth
i didnt read it all
idk if u mentioned it or not
yes, you can, but I have heard that it may be dangerous to do so
Ah thanks
The article explains why new Thread() is not always a good idea and when to use thread pools / an executor service instead.
aromic reference
👃
easy async plugin
public void onEnable() {
new Thread()
}
it would be easier if spigot had mixins. Md, please add mixins
? i’m not familiar with mixins?
because then we could register the thread in the craftbukkit main, thus shortcircuiting bukkit classloading logic
quick read of wikipedia and i agree with you
Mixins defeat the purpose of Bukkit lol
Is it normal for summoned entities to be removed on server restart?
no?
Hmm.
unless you spawned them using packets
is there a way to separate the boats in game? i want to have a method that drops a boat according to the wood type and idk what to check
maybe .getWoodType()
hi i wanted to ask why i can not add servers dynamically with the api to bungeecord
@Override
public void execute(CommandSender commandSender, String[] args) {
final String prefix = "§c/addserver <name>";
if(args.length != 1) {
commandSender.sendMessage(prefix);
return;
}
String name = args[0];
int port = ServerManager.getNextFreePort();
ServerInfo info = ProxyServer.getInstance().constructServerInfo(
name, InetSocketAddress.createUnresolved("localhost", port), "added by command", false);
ProxyServer.getInstance().getServers().put(name, info);
commandSender.sendMessage("added!");
}
The command works, but when i add a server, every other server is removed from the list. An example:
The upper /server command was before issuing /addserver x, after i entered the command, server x appeared, but "lobby" and "test" were gone
im using the latest bungeecord build, i also tried it with waterfal#448 (newest) and a travertine version
something tells me that getServers() ain’t actually gonna return the internal map
in a mutable form at least
?jd
@opal juniper but however it still adds the server to the list, it just also removes all existing servers
issue remains the same using ConfigurationAdapter
anyone know where I can get JDK 1.8_301 that is not an exe installer? (https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html only offers an installer)
uh that’s weird, i mean i guess you could get all the current ones and add them back but that seems like a jank solution for the sake of it
i’m not familiar with the bungee api though so i may not be the guy to take to about this
tbh i’m not sure if you are supposed to add servers programmatically
this may be the mitigation against this
question: java player.getWorld().spawnEntity(arrowstormlocation, EntityType.ARROW); how do i spawn arrow like that and set its damage value ?
hi i still need help with this
(sorry for not responding last time i asked, i went afk)
you can spawn an entity like that
but you will want to give it a vector
and also you can listen to the EntityDamageByEntityEvent and modify the damage there
store the eid of the entity or something
just load it into a YamlConfiguration
@lean gull
or
i have another queston how do i spawn an arrow that kills iteself after some time ?
I have an ArrayList with blocks and I need to remove each block one by one with a delay, how can I do it?
YamlConfiguration config = new Yamlconfiguration;
config.load(File);
ok but how do i set stuff in it
config.set…..
example?
ok, and what do it do
Hey guys! Is there some way (perhaps a packet?) which will make a skeleton play the shooting bow animation?
is this the real command geek or am i gettin jebaited
That is what I thought, however after some google searches I can't seem to find a solution
I don’t know, does the bow get pulled like the string?
Like once the skeleton prepares to shoot
Ow wow its the Actual commandGeek
Yeah, basically I want the skeleton to be in the state where the bow is pulled (ready to shoot)
1 sec i gotta check somethin
oh cool it's the real one
for loop
Hmm I’m unsure maybe this https://wiki.vg/Protocol#Entity_Metadata @prisma needle
However it’s probably assumable it’s totally client sided
yeah that doesn't matter, taking a look at that rn
Well if it’s client sided, then you probably can’t trigger the animation yourself. Unless you fake a bow shoot maybe.
wdym?
From what I understand it might be the case that the client is acting on its own when the bow shoot animation is happening
Which means you cannot control it with a packet
However you could fake a bow shot
well for my specific case, I need a skeleton to pull back it's bow when a player pulls back its bow... it's sorta a morph system, I need the animations to be the same
I don't need any actual functionality of an arrow being shot, just the looks
Yeah hmm
Oh seems like this could actually work
hmmm ngl that page doesn't make a ton of sense to me... but I can't find anything related to skeletons or a bow being pulled...
nah i think it is more this:
https://wiki.vg/Protocol#Entity_Status
Oo yeah
yeah can't find anything there either unfortunately...
maybe it is just a general "use item" which the client works out that it means fire bow
is there a property on Arrpw.class to set timer until it despawns ?
rip still couldn't find anything related to making entities use their item...
bump ):
@young portal because the server actually has to point somewhere
if you add the server localhost:123456 you need to actually have a running minecraft server that is at that address
is a new instance of a command class made every time the command is executed? i assume not
as you can see in the screenshot, the server i added is listed, but every other server dissappeared. The Lobby server dissappeared as well and its obviously running because in the very same message it says im on the lobby server @glossy scroll
no
okay
Hey I encountered a little problem. So on my local test server my plugin is running fine. But when it's running on my friends server it throws the following exception:
[15:47:08 ERROR]: Could not pass event CreatureSpawnEvent to LandSystem v1.0
java.lang.NoClassDefFoundError: org/bukkit/generator/WorldInfo
at schmidi.services.WorldService.containsWorld(WorldService.java:26) ~[?:?]
Line 26 looks like this:
return this.registeredWorlds.stream().map(World::getName).anyMatch(name -> name.equals(worldName));
Couldn't find something relatable online by now, can anyone help?
leme check very quick
no, your friend has to update their spigot server to latest
it definitely is
I can
?
the class called did not exist till 2 weeks ago
so update spigot could fix it?
oh
oh okay
yes, have them run build tools and build latest
the new server jar should be able to run your plugin just fine
alright thank you @eternal night I will tell him
👍
can anyone help?
Material announceAdvancementsMaterialDisabled = (Material) cfgn.getMaterialsConfig().getString("announceAdvancementsMaterialDisabledConfig");
https://i.imgur.com/7WsS0Qm.png
you cannot cast a String to a Material ?
Dont just cast. Use Material.matchMaterial(String)
what's that do
🥺
How can I reload a chunk in 1.17 spigot? I'm trying PacketPlayOutMapChunk but it doesn't work, or i'm doing something wrong.
Material is an Enum. Usually you convert a String to an Enum by calling the Enums valueOf() method.
Material has a better method which doesnt throw an exception. Material.matchMapterial(String)
i dont get it
w h a t
What do you mean by "reload".
the old World#refreshChunk
team group higher than admin that doesnt makes sense
lmao you just killed the poor guy
i dont understand what youre talking about
do you understand how variables work, how to cast something, and how you use different types of variables ?
Why "old". Its deprecated because it might not work on every client implementation as some throw away the chunk packet if they have it in their cache.
What you could do is
- Send the chunk unload packet
- Send the chunk map packet again
i think?
smh
you either know or you dont
assume thats a no
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.
idk man im quite new to this
yea i know
you gonna ?learnjava now?
u know what an enum is?
no
so a variable is something, you can assign a variable to a type, for example
int num = 2, this defines the variable num with type int to 2
that part i already know
a variable is in the memory, you can also storage data in the disk, to understand this you need to understand how a cpu, ram, disk, and motherboard work
he doesnt
ok, when you cast a variable what you are doing is changing the type of a variable for example
string numString (string) = num
what this is doing is defining the new variable numString with type string to the (string) value of the variable num
One question. Why do you refuse to just sit down and learn the few java basics?
It will save you and use countless hours of struggle. You will progress so much faster
with spigot if you just go ahead and learn the java basics. It will go a long way.
im tryna make cool plugins while also having fun, this is my way of having the most fun there is in learning java
not
bro you cant tell me when u were 12 u would sit down and read docs
i mean i dont know anyone that does that
didn't understand the last line there
do you understand how hard is it for us to help you if you ask that?
we have no fking idea what you mean
i dont think thats possible
Tyvm, I've been searching this solution for hours, now it's working!
Not possible since most punishment plugins store their punishments themselves
i'm starting to see why i should share more code sometimes...
where are we even talking abt?
When i was 12, i was outside and beat other kids with sticks...
😂
Or build bows
with that sticks
If the stick hold up after beating then it will be a robust bow
xd
are you 12?
i wish
was gonna say
how do i check if a player has open invoentry ?
hi
declaration: package: org.bukkit.entity, interface: HumanEntity
can anyone give me code for update scoreboard every 5s
getOpenInv

Check if the return value is not of type Crafting
7smile is too fast for me
wat
No. Run a scheduled task every 100 ticks
then why does java if (player.getOpenInventory() == null) not work ?
Its NotNull. You need to check if the type of this inventory is not the internal crafting view
Another question, I have a Location, how can I get all nearby blocks from a direction, for example I want to get all blocks in a radius of 5 in north direction of my location... I don't know if this makes sense, but it is...
wont it return internal crafting if i have player inventory open ?
would it be too bad if we start banning players that beg for code or refuse to learn java?
You need loops and the getRelative method
Its either PLAYER or CRAFTING
You cant detect if a player has its own inventory open or not
bump ): is bumping forbidden?
btw is there an event that executes every tick ?
TickEvent...
Lol
doesent seem to exist
That sounds made up
thanks
getServers() should be deprecated for you. And for a good reason.
There is a ServerTickStartEvent in paper but dont use that. Its for monitoring only.
Just run a scheduler that executes every tick.
Do you mean in what language the jvm and the original compiler where written in?
could i just do a while loop in onEnable ?
Nope. This crashes your server.
All the code you execute is ran concurrently with minecrafts code. If you do a while loop or Thread.sleep() then you tank your TPS and in worst case just crash the server.
yes
C
java was made just like any other language: starting small and then bootstrapping over and over again
how was C made
...
Starting small and then bootstrapping over and over again
assembly
Today a lot of the java toolchain is actually written in Java
Assembly also started small and then boostrap over and over again.
assembly
is that not a language?
assembly
lmao
wdym
o
imagine knowing assembly
what did you think i meant when i said assembly
Uhm. Isnt it just a minor abstraction for native machine code?
yikes
I do not know that language
its like
how
Yes, but especially early CPUs used different assembly syntax. Nowadays NASM is quite in use, but back then you probably used another type of assembly
buh
NOT ASM
waht then
Well, not objectweb ASM at least
assembly is machine code
#help-development is java-centric. Most people would think ASM means objectweb ASM because most of the time it means exactly that in java world
in human readable form. Its not actual cpu instructions.
ye
just code in binary
what can I do if I forgot my bStats password? the guy didn't respond to my email
well, rip. Nothing you can do really
Make a new account.
Ok because I'm not sure. Do I have to do anything on the website for custom graphs? Or is it just code in my plugin?
01000010 01110101 01101011 01101011 01101001 01110100 00101110 01110011 01101000 01110101 01110100 01100100 01101111 01110111 01101110 00101000 00101001 00111011
The same way the laws of general relativity were "invented"
ez
I mean, the search engine was created centuries ago, I bet coding was invented a few millennia ago
01101000 01110100 01110100 01110000 01110011 00111010 00101111 00101111 01110111 01110111 01110111 00101110 01111001 01101111 01110101 01110100 01110101 01100010 01100101 00101110 01100011 01101111 01101101 00101111 01110111 01100001 01110100 01100011 01101000 00111111 01110110 00111101 01100110 01100011 01011010 01011000 01100110 01101111 01000010 00110010 01100110 00110111 00110000 00100110 01100001 01100010 01011111 01100011 01101000 01100001 01101110 01101110 01100101 01101100 00111101 01010010 01101001 01100011 01101011 01110010 01101111 01101100 01101100 01001110 01101111 01100001 01100100 01110011
deception
This is all ASCII, why would you bother sending this shit
Google your question before asking it:
https://www.google.com/
why are you asking these questions
To be honest, you should binge watch all of Tom Scott and related channels' videos if you are asking such questions
There was actually a guy in the middle ages who was philosophizing about "a human who performed calculations or computations"
with given instruction sets.
Ah yes
Computerphile, Tom Scott and consorts
Was gonna say computerphile (3
Wait let me share my fav programming channels.
Ben eater is also an interesting one if you want to know how computers work
tom scott 😍
jdh
LiveOverflow
Ben Eater
carykh
Code Bullet
CodeParade
Computerphile
Dani
Devon Crawford
John Hammond
Ottomated
Sam Hogan
The Coding Train
i am sorry for asking this but i still don't know how to check if a player has no inventoryes open
isn’t like Player::getOpenInventory or something
You can only check if a user has not his own inventory open.
There is no way to check if a player has his own Inventory open or not.
ok
Oo yeah the player inventory is always open isn’t it
and how do i do that ?
player.getOpenInventory().getType() == InventoryType.PLAYER doesen't work
live overflow and his sexy accent 🥵
He looks like the guy from superbad
Michael Cera
not work
ineed to update scoreboard place holders
o.getScore("§8| §fPlayers: §a" + PlaceholderAPI.setPlaceholders(p, "%bungee_total%")).setScore(2);
like this
and this update code not work
public void update(Player p){
new BukkitRunnable(){
@Override
public void run(){
if(p == null){
this.cancel();
}else{
Scoreboard SB = p.getScoreboard();
}
}
}.runTaskTimer(Main.plugin, 0, 5);
}
}
@lost matrix
Pls format your code or use a paste service
?paste
InventoryType.CRAFTING
@lost matrix
@lost matrix
doesent do it
Sysout the type of the inventory and check what it is.
@lost matrix >?
why do you keep pinging him
Yes mr "software engineer"?
I need a little help
Anyone?
@umbral pagoda
?
?paste
When do you call the update method?
yes
Can anyone help me?
wtf
thats how u wrote it?
Dont question him. He is a real software engineer. Thats how its supposed to look.
i need a little help
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.
I have... no idea what im reading.
Could you try to explain it again with short sentences? Try using some dots pls.
how do you type for 4 minutes straight and come up with that
Sorry for my bad english
Its all good. Could be my fault too. Im not a native english speaker myself.
wait i will elaborate more
Is it possible with the API to request the player to open the advancements menu?
Yo guys, i have a quick question. I am making a plugin for my friend's server and i wanted to add a cyclic message(If number of players is more than 0 then broadcast, wait 10 minutes and check if number of players is more than and continue the loop). And i want the message to be broadcasted but i don't know what to put there to broadcast the message(in the 34th line). Could anyone help me?
I am working on a Plugin Whenever a player activates the plugin a Pig and Carrot on a stick given to the player but i want to respawn the pig and give carrot on a stick to player whenever he dies. What is the better way to do it?
I dont think so. You could look if there is a packet for that but even that i toubt.
https://i.imgur.com/GybtQua.png
Bukkit.getScheduler().runTaskTimer(plugin, new BukkitRunnable() {
@Override
public void run() {
if (timer <= 0) {
player.sendMessage("§cExtra §f➤ §cYou have 30 seconds to write this in the chat : §f" + message);
start = LocalDateTime.now();
plugin.keyboard_practice_list.put(player,message);
cancel();
} else {
player.sendMessage("§cExtra §f➤ §cPrepare your keyboard in : " + timer);
}
timer--;
}
},0L,20L);
What are you doing with the ServerListPingEvent here? I dont get what you are trying to do?
Why do you listen for that event if you just want to broadcast some messages?
You can listen for the PlayerDeathEvent and set keepInventory to true.
Also check if the player is sitting on a pig and then simply kill it.
Spawn a new Pig in the PlayerRespawnEvent.
cause i tried to get the number of online players
what is the max and min temperature in a Minecraft world?
You add an extra second by subtracting timer after checking if the time is 0
so what can i do ?
Do you call the run() method yourself?
nop
But keep inventory works on all the items and What if i removed the pig and carrot on a stick whenever a player dies?
Didn't realize the imgur was a error lol
Whats at line 128?
probably cancel()
What version are you on?
ok. making sure.
Do you run Bukkit.cancelTasks() anywhere?
nop
You could just remove the carrot on a stick and the pig. Then on PlayerRespawnEvent -> give him a new carrot and spawn a new pig.
Can you show the whole class/method. Can't see a reason that would cause an error.
player.closeInventory();
player.getInventory().clear();
timer = 3;
timer_game = 30;
Bukkit.getScheduler().runTaskTimer(plugin, new BukkitRunnable() {
@Override
public void run() {
if (timer <= 0) {
player.sendMessage("§cExtra §f➤ §cYou have 30 seconds to write this in the chat : §f" + message);
start = LocalDateTime.now();
plugin.keyboard_practice_list.put(player,message);
cancel();
} else {
player.sendMessage("§cExtra §f➤ §cPrepare your keyboard in : " + timer);
}
timer--;
}
},0L,20L);
Bukkit.getScheduler().runTaskLater(plugin, new Runnable() {
@Override
public void run() {
Bukkit.getScheduler().runTaskTimer(plugin, new BukkitRunnable() {
@Override
public void run() {
if (plugin.keyboard_practice_list.containsKey(player)) {
if (timer_game <= 0) {
player.sendMessage("§cExtra §f➤ §cSorry but your time is up");
plugin.giveSpawn(player);
plugin.keyboard_practice_list.remove(player);
this.cancel();
return;
}
plugin.title.sendActionBar(player, "§7✦ Time remaining : §f" + timer_game + "s§7 ✦");
timer_game--;
} else {
this.cancel();
}
}
},0L,20L);
}
}, 60L);
}
}```
Its a value generated by perlin noise. So should be between 0.0 and 1.0
Or i can keep Carrot On A Stick (this specific item) and teleport Pig to player whenever he respawn after death
You can just do that by checking the size of the online player list.
when I use World#getTemperature() it's 2.0 somewhere
like I know maximum is 2.0, but I am not sure about minimum
does anyone know how to get all blocks inside a bounding box?
Interesting. Lets see if there is a wiki entry
Yes i have a util method for that. One moment
I looked in the Wiki, they didn't mention the maximum and minimum
public static void forEachBlock(final BoundingBox box, final World world, final Consumer<Block> blockConsumer) {
for (int x = (int) box.getMinX(); x <= (int) box.getMaxX() - 1; x++) {
for (int y = (int) box.getMinY(); y <= (int) box.getMaxY() - 1; y++) {
for (int z = (int) box.getMinZ(); z <= (int) box.getMaxZ() - 1; z++) {
blockConsumer.accept(world.getBlockAt(x, y, z));
}
}
}
}
ty
@stone sinew ?
Ill search for some more minutes and then ill just make a broad analysis by loading a ton of chunks.
wow, thank you so much!
Give me a sec was playing a game.
ok sorry
Quick question from a total Java noob
How exactly do I compile my plugin from a directory with all the class files + subdirectories to a .jar file?
This doesn't look nice.
Why don't you just save like 2 diagonals and then just check if block is between those two?
If I do Player.getUniqueID().toString() will it return the UUID or the Class@MemoryAddr
Former
https://pastebin.com/CrSdKsSz (Whenever i execute the command it prints "/gmc" in chat after putting me in Creative, Anything i did wrong because i don't see it
Alright tysm
declaration: module: java.base, package: java.util, class: UUID
you have to return true; if your command executor was able to handle the input (whether that is a custom error message or successful execution). If you return false the server will send the usage message to the command sender
Thank you ;)
player.closeInventory();
player.getInventory().clear();
timer = 3;
timer_game = 30;
BukkitScheduler scheduler = Bukkit.getScheduler();
scheduler.runTaskTimer(plugin, new BukkitRunnable() {
public void run() {
timer--;
if(timer <= 0) { // This is when the timer ends
player.sendMessage("§cExtra §f➤ §cYou have 30 seconds to write this in the chat : §f" + message);
start = LocalDateTime.now();
plugin.keyboard_practice_list.put(player,message);
cancel();
}else {
player.sendMessage("§cExtra §f➤ §cPrepare your keyboard in : " + timer);
}
}
},0, 20);
scheduler.runTaskLater(plugin, () -> {
scheduler.runTaskTimer(plugin new BukkitRunnable() {
public void run() {
timer_game--;
if (plugin.keyboard_practice_list.containsKey(player)) {
player.sendMessage("§cExtra §f➤ §cSorry but your time is up");
plugin.giveSpawn(player);
plugin.keyboard_practice_list.remove(player);
cancel();
return;
}else {
cancel();
}
plugin.title.sendActionBar(player, "§7✦ Time remaining : §f" + timer_game + "s§7 ✦");
}
},0L,20L);
}, 60l);
``` In the code you posted above you did this.cancel() Your class isn't a runnable. Also here is a bit of cleanup to your code.
How would I go about using the ConversationContext when the conversation has ended?
Use it for what is needed, in the last prompt? or is there a better way, so you can access it outside the scope of the prompts.
This sounds like a BoundingBox with extra steps. lol