#help-development
1 messages Β· Page 1513 of 1
@quaint mantle please refer to the premium resource guidelines.
the backpack is on the armor stand helmet equipment
here's my method https://paste.md-5.net/zosovamiji.cpp
@quaint mantle I will quote for you:
https://www.spigotmc.org/threads/premium-resource-guidelines.31667/
Please do not contact us regarding ETAs
one sec...
oh wat?! there is a passenger method.... Im missing a lot
frick
in that case, can't you set the backpack as the passenger itself?
the backpack is an itemstack with custom model data
K good, "real" players get added to the usercache, so they're being distinguished in some way
You cna compare the UUID of the returned player to UUID.nameUUIDFromBytes(("OfflinePlayer:"+name).getBytes(Charsets.UTF_8)); If its a match then its not a realy player (unless in ofline mode.
and afaik armor cannot have custom model data
ewww haha
ohhh passenger must be entity
I remember it returning with a null name but I guess it no longer does
armor stand is a entity
yes wat i meant is, I thought you could just add the backpack as a passenger
self-realization exclamation
Where are the sources you just looked at?
I was looking at my own util classes, but that line is pulled directly from Bukkit.
yea I was wondering where was good to read them
I just use the decompiled sources BuildTools generates
great
so, are there any solution?
err try setting gravity false, tho I dun think it really matters
also just use one of the visibility methods
.setVisible(false) should suffice
Wait, I'm having like a weird problem.
So I'm trying to spawn an armor stand, but it's automatically be the player's passengers.
when did you call equipBackpack() lol
Do you mean you want to it be the players passenger or it already is?
I was testing without that method.
Hold on, I'm gonna do some couple of testing
o.O, definitely called setPassenger somewhere
he was creating a backpack cosmetics, but he now has the armorstand on passenger whenever he spawns one even without the equipBackpack() method
The armor stand is already on the player passengers even though I didn't add the passenger onto the player.
try killin the entity and try again
sighs "wont work" is not telling us much
when are you calling this?
try to delay it by a tick and see if that changes it
delay it
scheduler
runTaskLater or runTask
the event doesn't count that player, which just entered the bed. just a tick later the player will be added or better said the player will be sleeping
Can I execute a command on behalf of a player?
player#chat(command);
no need to wait a whole second. 1 tick is enough.
also you won't need that BukkitTask task =
in the task. otherwise you will have the same problem again
can i change item nbt in player's inventory without giving item?(inventory.setItemInMainHand(ITEM))
it is
try: .setTime(world.getTime() + 24000)
24000 = 1 day
Player#getHealth()/Player#getMaxHeatlh() * 10
ehm? wha?
Player#getMaxHealth is deprecated I think
how can i make it so my custom item can not be placed on the ground
like it stops them from doing it, so the attributes of the item stay
cancel the block place event π€
Can I do this and bypass the permission check?
i am not sure what you mean by permission check. #chat just lets the player chat the given message just like he would type it
I want to run a command that the player might not have the permission to run
many abuse the hell out of setop
I think Bukkit.getConsoleSender() might do it
i am not sure if #performCommand bypasses the needed permissions but i dont think so. you could send it over the console
Bukkit should have a doPrivilegedCommand or something tbh
I don't need the original sender, so... hopeful
Bukkit#dispatchCommand should it be
@EventHandler
void onBeaconPlace(BlockPlaceEvent event){
if(event.getItemInHand().isSimilar(itemManager.megaBeacon)){
event.setCancelled(true);
}
}
``` So like this?
most likely
wouldn't prevent plugins from checking it manually
return Bukkit.dispatchCommand(Bukkit.getConsoleSender(), String.format("whitelist add %s", String.join(" ", args)));
```atm
let's see!
that can be done via bukkit api
why don't you use the bukkit api for that
anyone know alternative way to write this for java 11 ```java
Bukkit.getScheduler().runTaskLater((Plugin)main, () -> {
}60L);```
because this way is easier π
With assignment crossbow in hand it isn't charged
ItemStack item = new ItemStack(Material.CROSSBOW)
CrossbowMeta meta = (CrossbowMeta) item.getItemMeta();
meta.addChargedProjectile(new ItemStack(Material.ARROW, 1));
meta.setCustomModelData(200);
item.setItemMeta(meta);
new BukkitRunnable() {
@Override
public void run() {
p.getInventory().setItemInMainHand(item);
}
}.runTaskLaterAsynchronously(Main.getInstance(), 1);
I already have the working code using the bukkit api
what is wrond?
but it has funky error conditions
it forces me to UUID defaultUUID = UUID.nameUUIDFromBytes(("OfflinePlayer:"+playerName).getBytes(Charsets.UTF_8));
what is the issue there?
uhm, why don't you just get the offline player? EDIT: ah nvm, you don't have the UUID
cant use lambas in java 11
You mean java 1.1, right?
;D
Because java 11 def. supports it, check your target/source versions
that is not a lambda expression
J11 supports 1.13 - 1.17, so it is a good middle ground
oh
you've left a , at the and. remove the run method
but 1.17 doesn't support J11
not even then
π€i did not know this
so the old way with cauldrons I just had to cast block data to Cauldron, but now with layered cauldrons how do I set that up now? I tried against block data and even state and both state I cant cast it for either
hey?
Sure it does, Java is backwards compatible
ahhh i see it works thanks
It wont work
is damage all like sharpness for a sword?
You have a half anonymous class - half lambda construct
set item attribute
DamageAll iirc is sharpness
a Java 16 JVM will in 99% of cases be able to load Java 11 plugins
i'm adding enchants not attributes atm
So this works with the only downside being that the feedback is printed to the console instead of back to the player
which makes total sense
but bleghh
the api's just passing around a bunch of strings and I dont think I get to touch the permissions
why can't you just do Bukkit.getOfflinePlayer(String.join(" ", args)).setWhitelisted(true);? Or is there an issue with the UUIDs
The alternative version is ```java
if (args.length == 1) {
String playerName = args[0];
UUID defaultUUID = UUID.nameUUIDFromBytes(("OfflinePlayer:"+playerName).getBytes(Charsets.UTF_8));
OfflinePlayer player = Bukkit.getOfflinePlayer(playerName);
if (!player.getUniqueId().equals(defaultUUID)) {
player.setWhitelisted(true);
sender.sendMessage(String.format("Could not find player "%s"", playerName));
return true;
}
sender.sendMessage(String.format("Could not find player "%s"", playerName));
}
return false;
But this has two problems
The UUID hackery sucks
because the method with getting an offline player by the name is contacting the mojang server
and it's on the main thread so it freezes the game for a mo
why not check for hasJoinedBefore?
this could cause lags AND you could be banned if you have too many requests
Because it's too late then
it will contact anyways
you need the uuid
And I need players who havent joined before
mojang does not do that anymore
#getOfflinePlayer(String) will contact the mojang api no matter what. it needs to get the uuid.
At least unless you do that really frequently
as i said, at too many requests
The CommandSender interface is interesting though
Can I extend it to have the isPermissionSet api return "yes"?
that is in the dozens of requests per second, if not more
Otherwise you could easily ban servers by just logging in a ton of offline-mode accounts
This is still way simpler :/ ```java
boolean isOp = sender.isOp();
sender.setOp(true);
boolean ret = Bukkit.dispatchCommand(sender, String.format("whitelist add %s", String.join(" ", args)));
sender.setOp(isOp);
return ret;
why do you argue against me if we are actually saying the same?
because it is not a concern
Well, wouldn't work
You still need the offline player instance to #setWhitelisted
Well, ig I'll use this π https://paste.md-5.net/xofisaguye.java
is the cauldron api messed up or something? I cant even cast blockdata to Levelled anymore. (worked 1.16.5, trying to get working in 1.17)
guess im missing something.?
It works π€·ββοΈ
but its a very bad and insecure practice
but very often used
What vulnerabilities does it really create?
Bc if the only alternative is 10x as long for no real benefit then... I dont think I want to use it
the real concern is that there is a chance of the programmer fucking up and resetting it, other other lesser concern is that anti-malware applications are going to flag the plugin
basically alias my /welcome <player> command to /whitelist add <player>
The user should only need permission to call /welcome, /whitelist shouldnt matter
for a moment I wanted to suggest the commands.yml file, but that wont work
while im aware of it, i even tried the new LayeredCauldronBlock and I couldnt get that to work, and its api setup appears to specifically target water, and there was a lava one as well. Im specifically trying to target a cauldron to see if its empty and then if its empty set its water level to full. I have a setup that uses dispensers with water buckets to fill, it worked in 1.16.5 and earlier but with new cauldron mechanics uhg xD
just get your offline player by the name.
in your case its not a big thing
the layredCauldronBlock is extended off block data but then tells me it cant be casted to blockdata
so idk xD
I need to write scheduling, reporting, unstable validation, and user feedback logic
It's not a huge amount of work, but it's far more complex than "call whitelist add"
basically 2 lines of code
And doesn't represent what Im trying to do as well
Oh? Nice! What would this involve?
well not even 2
the name of the player.
basically something like this: Bukkit.getOfflinePlayer(name).setWhitelisted(true);
So...
I just explained why that's insufficient
If I want a command with the same utility as whitelist add, I need to write much more code
I already suggested that and you were the person to decline it
why not just dispatchCommand with a ConsoleSender
yeah, but in his case it seems fine. its much more worse to just give the command sender op so he can execute the command
I'd like to keep the feedback to the user of "who's that?" or "added so and so to the whitelist"
But what harm does this do?
Then you use the returned boolean to tell them if it was successful or not.
I think that was already done but replaced due to some reason
Yes, and I also would want to find a way to remove the output from the server console
why?
The command can also fail for other reasons
The command will alwasy return a boolean. There is no other outcome
I'd want to avoid putting the user message in the console because it doesn't belong there
what user message?
The other outcome is the command failing to parse
you are defining the command it is impossible for it to not parse
"That player does not exist" doesn't belong on the console
...
the command is defined by vanilla minecraft
You seem to be making it harder than it actually is
You are misunderstanding each other
Im happy with the simplicity of my impl
You test if the player exists, if it does you issue the command
I don't know why I'd make it more complex
Right, but testing for the players existence is the complex part of this
The player will never exist though
1 method
no its not, its very simple to test if a player exists
Lol
If you are only allowing players who have been on the server you can simply getOfflinePlayers() and see if yoru player is in there.
if you want ANY valid player, getOfflinePlayer, get teh UUID, then get again using the players UUID checking name for null, or compare their returned UUID to the offline generated one.
3 ways of doing it
Issue is NIO
And all of them suffer from the same problem of blocking the thread they're running on
(though i'd argue NIO is involved there either way)
No only the get offlinePlayer by name blocks
I'm not going to keep talking about this. Thankyou for your time
every other method is non blocking
meta.addAttributeModifier(Attribute.GENERIC_ARMOR_TOUGHNESS, 2);
``` Im getting a a underline on the 2, is this how u use a Modifier?
If not just gimme the link to docs page..
yeah i see it now thanks
yeah no errors with this now
AttributeModifier modifier = new AttributeModifier(UUID.randomUUID(), "generic.armor_toughness", 2, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlot.HEAD);
meta.addAttributeModifier(Attribute.GENERIC_ARMOR_TOUGHNESS, modifier);
Have anyone find a way to get around the refection final field problem in java 16?
I have a problem, i want to import files, but idk it dosen`t work, it always gets red :c
thats real descriptive
Hmm do you know how t import other of your files?
wtf are you even asking?
kk
Am i correct in saying that HashMap#getOrDefault will either get the value of the key or return the new default
correct

So if i had a
Map<String, Set<UUID>>
and i ran this:
getOrDefault(isoKey, new HashSet<>()).add(player.getUniqueId());
it would either add it to the existing key or it would add a new set and add the uuid?
getOrDefault does not add it a return
add does not return a HashSet so no that would not work
So we have attributes and I now have them on my armor, but the armor bar can it go more then 10 like health? i want it to show 20 bars of armor because custom armor will each have higher then 10 but at different values
Why would i need add to return a hashset?
The idea behind getOrDefault is to return a value from a key or return something if its no there.
ohhh i get ya
public static PluginDescriptionFile description = this.getDescription();
public static String version = description.getVersion();
here "this" says "cannot use this in a static context"
how do i get around this?
how do i import other files in a file?
cause i need to add to the set if it does not exist in the map already
don't do the add on the same line
Then you need a check for the key, if not found add it, then return it.
what so like:
Set<UUID> uuids = map.getOrDefault(isoKey, new HashSet<>());
uuids.add(player.getUniqueId());
map.put(isoKey, uuids);
as an example
i dont think i can use this. under onEnable()
you dont have a check in there
Helppp
You are just adding it every time
yes, but I'm not certain you need to push back to the map, it shoudl not be a copy but a reference
ah - makes sense
Test though
π
Set<UUID> uuids = map.getOrDefault(isoKey, new HashSet<>());
if (!uuids.contains(player.getUniqueId())) {
uuids.add(player.getUniqueId());
map.put(isoKey, uuids);
}
Check if its not there add and update the map
but sets cannot contain duplicates
correct
then you have to check that also
but that is what that does
you see how i have it checking the set to see if its not there then it adds it
its its there it will not add it and update it
just add. If its a new Set it will get added, if its not it will be added if its not there.
That was the plan
Also unless its a manager class you should not be access a map with a direct call.
what
although that is a valid point
it seems a bit like you are spouting random knowledge to try and prove yourself?? π
the 'map' object should not be access from a direct call from somewhere lese
No i am trying to help, with better code practices
yes how is it delcared?
public static Map<String, Set<UUID> map = new HashMap<>();
Maybe like this?
just like this
Map<String, Set<UUID>> targetPlayerLanguages = new HashMap<>();
cause it is a variable
and do you access it from outside of the class it is defined in with a direct call?
bump
They are typically the ones which are part of a method
sorry i made a typo
fields are part of a class
variables are part of methods
do you see what i mean now
you mean local variables
no its not
kinda is but we should just move on
there are 3 types of variable
local
instance
static
and where does it print null??
in other plugin
i use skript plugin to broadcast player's balance
just to debug
local - in side the method
instance - inside the class
static - global
Bukkit.broadcastMessage("Double: " + i); doesn't look like skript to me
no i mean the null
broadcast "%balance of player%"```
this is the skript
try writing a plugin to access it instead? don't think many people here know how skript works
for all we know it could be skript that is broken
and other plugins
i have auction house plugin
and when i have 10000 coins i cant buy stuff for 1 coin
does this broadcast null @vital swift
no it doesn't
that won't broadcast null
Arenas:
Map2: {}
Map1: {}``` How come I can't get the sections under Arenas with this: https://paste.md-5.net/xubakorizu.cs ?
how about the auction house plugin
π€·
could be your plugin is loading (and registering its economy provider) after other plugins get the economy provider
so to other plugins it appears as null
Main.java
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin {
PluginDescriptionFile description = this.getDescription();
String version = description.getVersion();
}
this works fine, but how do i pass it to the below?
CMD.java
sendMessage(String.valueOf(Main.version)
pass whatever you need in the constructor of CMD and store it in a field
in this case you can pass the version string, or the plugin instance itself if you want to do more with it
17.06 09:54:01 [Server] INFO Caused by: java.lang.UnsupportedClassVersionError: me/combatborn/firstplugin/FirstPlugin has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
Am I getting this error because I'm using SDK 11.0.4?
yes
Which version should I use?
What do you recommend?
everybody would recommend the latest version for obvious reasons
I've been learning java for the last few months, thought I'd give minecraft plugins a try
souns good, thanks for the help
but some servers still run java 8, some java 11, though with mincraft 1.17 java 16 is required
Does anyone know why If I logout and have armor stand as a passengers, the helmet won't get removed.
just depends who you're targeting
ill see
but i don't haev other economy plugins
like essentials
I'd like to do a 1.17 server yeah
This is the method that I used when player logged out https://paste.md-5.net/ritaralivo.cs
Would this be recommended for 1.17? Java SE Development Kit 16.0.1
if you're using 1.17 then you can use any version up to 16
seems fine to me? is it just the helmet that isn't being removed
Hey,
Is it possible to disable portals?
I want players to create them, but not use them
cancel the event
The helmet isn't being removed.
That's why it has flying object.
I cancelled EntityPortalEvent and PlayerPortalEvent without effect
what version of spigot is it
1.16.5
is it registered? or you can listen to the teleport event or the switch wordld event, one or both has a cause you can check
They are registered, yes
@unreal quartz or it's because I add equipment lock to the armor stand?
I add these on armor stand spawn
armorStand.addEquipmentLock(EquipmentSlot.HEAD, ArmorStand.LockType.ADDING);
armorStand.addEquipmentLock(EquipmentSlot.HEAD, ArmorStand.LockType.ADDING_OR_CHANGING);
armorStand.addEquipmentLock(EquipmentSlot.HEAD, ArmorStand.LockType.REMOVING_OR_CHANGING);
PlayerChangedWorldEvent can't be cancelled... I also tried the PlayerTeleportEvent
can try removing the equipment lock before removing the helmet
don't see any other reason why none of your approaches work except for the fact that it might not be registered then
It definitely is registered:
Bukkit.getPluginManager().registerEvents(this, this);
My events are in my main class.
There isn't even any console output... (Tried to print out some messages)
https://www.youtube.com/watch?v=Y60lp-XPlpY
send your code
show whole class maybe
is the plugin even running?
Yes π
The armor stand doesn't even got removed I think.
is it even iterating over anything from player.getPassengers()?
could be that they get dismounted prior to the event being called
Okay, I'm gonna debug it. But what should I do if the entity got ejected before the PlayerQuitEvent got called?
keep track of them somehow
And yeah, the entity got rejected before the event gets called.
What about store it on the map Map<Player, Entity>?
Anyways, thank you for that, i'm gonna sleep for now.
could do that, or by UUID, UUID if you don't want to keep hard references
Yeah I think UUID fine, I don't really need Player object.
your class is final
maybe remove that
Does somone know, how to upload maps in spigot server? xd
the final wouldnt affect things
drag the zip folder over ?
Never had any problems with that, but ok, I'll remove it
and also - put a debug sys out in onEnable
Tyyy and where do i have to put it?
Tyyy!!
And do you know, how do i come to the map?
use a plugin like multiverse to import it, or alter your server.properties to point to the new folder
Thank you!!
quick question what does ambeint mean? java p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, duration, amplifier, ambient))
ohhh ok and amplifier means that my speed will go faster right?
yeah
I added multiverse, do you know, how i come to the map? I only know from Pocket Edition /mw tp "Worldname" but here nothing works :c
mvtp
Tysm!!
I unpacked the zip, but there isn`t the map when i do /mv list
How do i import it? xd
mv import ?
I have done this, have i to put in /mv import "name of the folder? Or what do i have to input there?" ?
that's why each multiverse command has feedback when you run it
Mhh it tells me, that that not seems like it is a world :c
signs dont work when i click them
i should be teleported to hunger games game but dont tp me
you're not making a plugin, wrong channel
hey , can someone tell me how to add multiple nms versions to plugin
Hello, is it possible to view the spigot mappings in the ide?
multi module project if ur using maven/gradle
thnx i will check it out
nvm i did saw that video
@frosty tinsel how to do that with maven?
how to set it up?
looks comprehensive enough https://www.spigotmc.org/threads/maven-nms-tutorial.347254/
Is it possible to have Mojang mappings for NMS and spigot mappings for Bukkit at once?
Since now, all spigot methods are obfuscated
Hey, can anyone tell me if it matters which plugin instance I put for Bukkit.getScheduler().runTaskLater()?
The plugin, you execute this in
You mean
I have to put the plugin instance it's executing from?
That's what I've been doing, but I was wondering if it really mattered
I think so, because then, the task is tied to your plugin.
yes it does because otherwise it may not unload properly
public class Test implements CommandExecutor {
private SecondPlugin plugin;
public Test(SecondPlugin plugin){
this.plugin = plugin;
plugin.getCommand("test").setExecutor(this);
}
@Override
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
if (!(commandSender instanceof Player)){
commandSender.sendMessage("Only players may execute this command.");
return true;
}else{
Player p = (Player)commandSender;
if (p.hasPermission(("test.use"))){
p.sendMessage("Hello there, this is a test.");
return true;
}else{
p.sendMessage(p.getDisplayName()+" does not have permission to send this command!");
}
return false;
}
}
}```
In the constructor I have the line: ``plugin.getCommand("test").setExecutor(this);``.
When hovering over the "setExecutor" method, it's producing this warning: ``Method invocation 'setExecutor' may produce 'NullPointerException'``
Why is that? Should I be concerned?
Because it isnt certain the command actually exist.
How can I make it so only the localName of an item matters in a crafting recipe?
I added this: yml commands: test: description: This is a test command.to the plugin.yml file. Is there anything else I can do to make sure it knows the command exists?
as long as you register it correctly you can just ignore it yes
okay cool! good to know thank you
Anyone know why this isn't working?
player.setHealth(player.getHealth() / player.getAttribute(Attribute.GENERIC_MAX_HEALTH) * 50);
It says I can't divide the two
what do you want to do
I want to heal the player by 50%
maybe you're diving by 0
Division by zero can make weird things like 1=2 in math
in that case programming languages forbid you from doing that
1 sec
?jd
Wait
It says that I can't use the divide operator
Why javadoc is not loading
Β―_(γ)_/Β―
Oh it fixed
I guess a better question then is how would I divide a double and an Attribute?
since player.GetMaxHealth() is deprecated
AttributeInstance#getValue returns double
could someone help me debug my plugin, it should be working fine but i have no idea whats going wrong, ( its a simple chest cleaner plugin, i also have the code that works fine, but when i try the same for others blocks like barrels, it dont work )
?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.
this works for "chunk" but not for "world" or "server"
if (Blockname.equalsIgnoreCase("Barrel") && blockState instanceof Barrel) {
Barrel barrel = (Barrel)blockState;
barrel.getInventory().clear();
}
else if (Blockname.equalsIgnoreCase("BlastFurnace") && blockState instanceof BlastFurnace) {
BlastFurnace blastfurnace = (BlastFurnace)blockState;
blastfurnace.getInventory().clear();
}
else if (Blockname.equalsIgnoreCase("Chest") && blockState instanceof Chest) {
Chest chest = (Chest)blockState;
chest.getInventory().clear();
}
else if (Blockname.equalsIgnoreCase("Dispenser") && blockState instanceof Dispenser) {
Dispenser dispenser = (Dispenser)blockState;
dispenser.getInventory().clear();
}
else if (Blockname.equalsIgnoreCase("Dropper") && blockState instanceof Dropper) {
Dropper dropper = (Dropper)blockState;
dropper.getInventory().clear();
}
else if (Blockname.equalsIgnoreCase("Furnace") && blockState instanceof Furnace) {
Furnace furnace = (Furnace)blockState;
furnace.getInventory().clear();
}
else if (Blockname.equalsIgnoreCase("Hopper") && blockState instanceof Hopper) {
Hopper hopper = (Hopper)blockState;
hopper.getInventory().clear();
}
original, this works fine but it only supports "chest"
if (blockState instanceof Chest) {
Chest chest = (Chest)blockState;
chest.getInventory().clear();
}
this works for "chunk" but not for "world" or "server"
?
trying the above one for "world" or "server" gives an internal error
you can also just cast to InventoryHolder rather than checking for each one
basically you can reset the supported blocks, within your chunk or world or server
Is there an existing method that's better for sending a message to all online players other than doing this:
ArrayList<Player> players = new ArrayList<>(plugin.getServer().getOnlinePlayers());
for (Player player : players) {
player.sendMessage("The console has sent you a message.");
}```
why are you creating a new array list?
loop through them all to send a message
also you can just use Bukkit.broadcastMessage
ah thanks
yeah but you don't need to create a whole new array list
for (Player player : plugin.getServer().getOnlinePlayers())
thats good too
How can i run a command from a console?
Does a bed count as a container or something?
depends on if you have a host or if you're hosting the server yourself
type it without the /
Because my telekinesis enchant doesn't work on beds, this is the only line that could be stopping that
if (event.getBlock().getState() instanceof Container)
return;
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/block/Bed.html doesn't appear to be
Maybe because it's a persistent data holder?
Can you show me an example? Please
this method provides the console command sender https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Server.html#getConsoleSender()
pass the returned value of that into the first one
It's easy to fix, anyway Β―_(γ)_/Β―
How to make an inscription in front of a nickname? Is it in the documentation or not?
I can see the inscription in the list of players!
Oh thanks
how would i check if a player died to a sword or a bow, i understand that i use PlayerDeathEvents and their last cause but how would i get the item they were killed with
you can check the killers held item for a sword, for a bow you need to track each arrow as their are shot to their bow, i don't think there is a simple way to get the bow which shot an arrow
alright, thanks
and more question: how would i check if the player's killer was an entity or a player type, i know instanceof exists but player and entity are abstract so it doesn't exactly work
do you guys throw IllegalArgumentException when the arguments specified in the function are invalid? If so, why? Doesn't the runtime throw nullpointerexception, and doesnt make the code more heavy just because you add one unneccesary if statement?
anyone know how to use all the dust particle stuff? like options, transition and normal?
spigot api doesn't have examples
what if the passed argument isn't null but say, for instance, out of range? then what
if you're writing a method for someone else to use, then throwing an exception with a short message telling them how they fucked up is generally a good idea
maybe you're right
it is also much safer to check the arguments and throw an exception than let the code execute with bad parameters as the code relying on that data could be safety critical and potentially cause damage with bad data
yeah
for instance if u spawn a redstone particle u can choose to pass new Particle.DustOptions(color,size) through the data parameter iirc
or smtng like that
does binding a socket freeze the main thread?
its probably call sensitive
So I made a custom item , but people can use it anywhere on the server .
any tips
what are you trying to do?
what's the difference between playEffect & spawnParticle
One spawns any particle, the other one spawns preset particles from already existing sources
Horrible explination but I tried ;/
how would i make a broadcasted chat message colored with the minecraft color codes, it broadcasts fine and everything else works but it's only the literal color codes, no actual coloring
this is what it looks like right now "&arkfish&7 fell fatally"
ChatColor.translateAlternateColorCodes('&', <string>);
^^
a bed is formed from 2 blocks
thanks
https://paste.md-5.net/ucesifucig.java
never worked with sockets in java
System.out.println("Accepted client! " + client.getRemoteSocketAddress().toString());
this isnt being ran
Oh yeah...
Any errors or something to work with?
none
startup log
[13:23:28] [Server thread/INFO]: [SocketControl] Loading SocketControl v1.0.0
[13:23:28] [Server thread/INFO]: [SocketControl] Enabling SocketControl v1.0.0
[13:23:28] [Server thread/INFO]: [SocketControl] Enabled!
[13:23:28] [Server thread/INFO]: [SocketControl] Binded socket!
You never start the thread?
=p
thats 2 brainfarts in under 30 minutes
I mean at least you haven't rewritten your entire system 5 times in one day like I've had to do for my project π’
oh no it crashed without an error π
Alright, I need help with my multi java versions due to 1.17.
So My project Holograms (https://github.com/wherkamp/Holograms/tree/new_mc)
However I cant compile it. Because The 1.17 module needs to use Java 16
Because it fails and says
class file has wrong version 60.0, should be 55.0
If I set it to Java 16
Gradle Says
ublic class EntityNameable extends EntityArmorStand implements Nameable {
^
bad class file: /home/wherkamp/.m2/repository/org/spigotmc/spigot/1.17-R0.1-SNAPSHOT/spigot-1.17-R0.1-SNAPSHOT.jar(/net/minecraft/world/INamableTileEntity.class)
class file has wrong version 60.0, should be 55.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
2 errors```
My guess is to have Gradle do two releases one with 1.17 Java 16 and one without.
But I am not sure how to do that. And if that is the best idea
Looks like you're not using Java 16
I dont want to use Java 16. Because I want to keep older support
You need Java 16 if you want to use NMS
My user base is mostly 1.16 and non of them use Java 16. So I want to push it a bit longer before forcing an update
You might be able to work around this by using a module that you shade in
Thats what I am doing. The 1.17 is shaded in.
can someone please explain to me how to use LootContext?
Yes MC 1.17 requires Java 16, No alternative
If I set the 1.17 module to java 16 this happens
Yeah, you are still forcing java 8 compat
I need to set the entire project to 16
java {
withJavadocJar()
withSourcesJar()
targetCompatibility = org.gradle.api.JavaVersion.VERSION_16
sourceCompatibility = org.gradle.api.JavaVersion.VERSION_16
}```
I just did that to the specific module
public class Open implements CommandExecutor {
@Override
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
if (!(commandSender instanceof Player)){
commandSender.sendMessage("Only a player can execute this command.");
return false;
}else{
Player player = (Player)commandSender;
Inventory gui = Bukkit.createInventory(player,9,"Custom GUI");
ItemStack gameItem = new ItemStack(Material.DIAMOND_AXE);
ItemMeta gameItemMeta = gameItem.getItemMeta();
gameItemMeta.setDisplayName("test");
gameItemMeta.setUnbreakable(true);
gameItemMeta.setCustomModelData(101);
gameItem.setItemMeta(gameItemMeta);
ItemStack[] menuItems = {gameItem};
gui.setContents(menuItems);
player.openInventory(gui);
return true;
}
}
}```When executing this command, I get a long list of errors, what am I doing wrong and how can I fix it? I was just loosely following a video and everything seems to be find until the second I run the command.
**Here are the errors**: https://hastebin.com/ulobafupez.apache
well fist of all you dont need the else
you are returning inside the first if statement, so no matter what it wont execute past that if that condition is met
Just make everything Java 16 it will make your life easier
The major versions will support this
I've never seen the Inventory#setContents used before, ill take a look at the javadocs for it but if you can send your entire class that would be useful/
?jd
That will drop support for the old versions. But ok
1.8.8, 1.12.2 and 1.17 the major versions all run fine on Java 16
But it will require them to update their server platform
at this point most services will be running J16 for minecraft as its required for 17
what location does LootContext.Builder() need?
Check the javadocs
I think I am just going to keep a branch open with older versions for a bit of LTS. and a main branch will be 1.17 + and Java 16 so I can use all the fun nice features
The location that the loot should use
I always check the javadocs before asking a question here, it just does not give the answer
Olivo answered you, and that does answer your question.
Look closer
what is it using that location for though
Its where the loot will generate
Took me a few seconds to find that in the Javadocs, you will have to look closer.
where did you find that
So Builder is a builder for the 'LootContext' class, so I looked into the actual LootContext class for the getter of 'Location'.
this is basic java and javadoc understanding
I need to make api requests but I need them to be as fast as possible - anyone got any tips
Imagine having the Javadocs open and not even reading them smh
Id use something like redis but it really depends per application
I just essentially need it to be as fast as possible
It needs to translate things the player inputs in real-time
So request to a translation api
You're going to struggle to do that without client mods
But if you need it, the best thing you can optimise is the location the server is running
so that it can make direct requests to the translation service
some cloud providers will give you much more negligible latency on the requests
Yeah - i have no doubt that a lot of the bottle neck is the actual packets getting from a -> b
so i am just trying to minimise as much as possible of my latency π
I'm not familiar with the libraries you'd use in java, but a big way to lower latency on frequent requests would be reeping the http connection open
so youll need a http library capable of that
Yeah - the thing is that on average the same request is about 30% faster on python
So π€·
What are we talking about now?
@Override
public void run() {
System.out.println("Receive thread is running!");
try (
BufferedReader stream = new BufferedReader(new InputStreamReader(socket.getInputStream()))) {
while (SocketControl.notKilled()) {
if (stream.ready()) {
sender.sendRawMessage(stream.readLine());
}
}
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("Receive thread killed!");
}
any reason why this isnt sending any messages to console?
are you starting it
ye
the thread that is
is it sending the first debug?
yeah
and the last?
nope
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(("localhost", 29317))
while True:
try:
sock.send(input(">> ").encode())
except Exception as e:
print(e)
>> /tellraw @a "hi"
heres the client program
not sure ive never messed with sockets like that lol
this is my first time
Havenβt used java net in ages but do u have the code on GitHub or smtng
yeah ill post it
1 sec
https://github.com/ImajinDevon/SocketControl @ivory sleet
What was the issue btw
i send a message and nothing is sent to the console
Oh from that python thing ?
ye
that's the whole plugin
name: FirstGUI
version: 1.0.0
author: CombatBorn
description: This is my first GUI plugin.
main: me.combatborn.firstgui.FirstGUI
api-version: 1.17
commands:
open:
description: This commands opens a GUI.```
That's the yml, forgot to include it
just wanted to ask if im doing the things correctly, this is supposed too be a function that can get called anywhere in the plugin, and i wanna be able to input an itemstack into it. so if you have any recommendations tell me
Only thing that I see in your command is the setContents method and not sure if thats what is causing it, try using Inventory#addItem(ItemStack...)
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/Inventory.html#addItem(org.bukkit.inventory.ItemStack...)
declaration: package: org.bukkit.inventory, interface: Inventory
just make addEnchant public
imaginedev
yes
I'll give it a try
was it the client or server which didnt work
server
hmm okay thanks that would look more clean
Im making a shaped recipe and was wondering how you would have a custom item as an item in the recipe. //Shaped Recipe ShapedRecipe shapedRecipe = new ShapedRecipe(NamespacedKey.minecraft("flamethrower_recipe"), item); shapedRecipe.shape("PGP","PFP","PLP"); shapedRecipe.setIngredient('P', ironPlate); shapedRecipe.setIngredient('G', Material.GOLD_INGOT); shapedRecipe.setIngredient('F', Material.FLINT); shapedRecipe.setIngredient('L', Material.LAVA_BUCKET); Bukkit.getServer().addRecipe(shapedRecipe);
IronPlate being the custom recipe
ExactChoice
ok
declaration: package: org.bukkit.inventory, interface: RecipeChoice, class: ExactChoice
do u rly need BufferedReader#ready ?
https://hastebin.com/qiqukuwajo.apache
Same issue
gui.addItem(gameItem); crashes as well
i've tried without it, doesnt work still
Is it something to do with Spigot 1.17?
I added that and rebuilt the jar and ran it in my server and when i go to put the plates in the places it does not work, but i can craft the item as if they were not part of the recipe
https://github.com/ImajinDevon/SocketControl/tree/master/src/main/java/me/imaginedev/socketcontrol
Anyone know why no messages are being sent to the console?
Also, Does anyone know why Maven is suddenly giving me this error?: ```[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project structureboxes-
nonlegacy: Fatal error compiling: java.lang.ExceptionInInitializerError: Unable to make field private com.sun.tools.javac.processing.Jav
acProcessingEnvironment$DiscoveredProcessors com.sun.tools.javac.processing.JavacProcessingEnvironment.discoveredProcs accessible: modul
e jdk.compiler does not "opens com.sun.tools.javac.processing" to unnamed module @2095c331 -> [Help 1]
Reflection is not usable in java 16 for internal methods
what the hell are you doing here
How do I fix it?
Impossible
It has been always convention to not poke at JVM internals, now it is a rule
Well, it has been for a few years now (since august 2017)
Except I am unable to find any classes that reflect Java internals in that module.
Is yoru IDE not updated? Eclipse?
IDE is IntelliJ IDEA 2020.2.3
In Minecraft 1.17 where is the registerEntity method inside the WorldServer class
anyone know why this is happening?
https://i.imgur.com/uf9yNW4.png
i just made a new paper server with a new plugin like i did twice before (following a tutorial) but this time this happens?
the only change i made was instead of making a 1.16.5 server i made a 1.17 server
1.17 on a 1.16.5 jar
So should I update the IDE?
Sorry I don't use that IDE
elgal i clicked show message cause i was bored and you do realize you're blocked in my account, right? (don't bother answering, i won't click show message again)
for some reason it doesnt recognize addprimeenchant from the other class, yeah im quite new to coding, anyone can help?
I answer to whoever asks for help, If you are too much of a prick to accept help, thats upto you
no elgarl is cool
Have you registered the command/executor in yoru onEnable?
Why does this crash the server? java Inventory gui = Bukkit.createInventory(player,9,"Custom GUI"); player.openInventory(gui); Crash report: https://hastebin.com/qiqukuwajo.apache
It crashes regardless of if I add an item to the gui object like so: java ItemStack gameItem = new ItemStack(Material.DIAMOND_AXE); ItemMeta gameItemMeta = gameItem.getItemMeta(); gameItemMeta.setUnbreakable(true); gameItemMeta.setCustomModelData(101); gameItem.setItemMeta(gameItemMeta); gui.addItem(gameItem);Does anyone know another solution or know how to fix this?
do you have the command correctly in your plugin.yml?
Do you get the same issue with the standalone maven? If yes, then it is something with your buildscript, not your IDE
You need to run BuildTools again. Your Spigot is out of date and bugged IndexOutOfBoundsException: Index 0 out of bounds for length 0
I recommend recompiling with the --stacktrace (I think that was it) flag, I highly doubt that your IDE is at fault here
When you use the command is the command recognised?
yes the command is all good just the addprimeenchant is unrecognized in the class
ok so I'm trying to cancel players from damaging them selves through arrows and harming potions
but how can I check the shooter of such potions/arrows
It looks like you are not adding the meta back to the item
oh yeah true
EntityDamageByEntityEvent and cancel the event if the attacking entity is an arrow
you test teh Entity instanceof Projectile. If it is, cast to Projection and use .getShooter()
You guys literally need to try maven with sublime text 4 and java language server
its basically an eclipse but way more efficient
on resources
no lag whatsover
it uses the same language server as Eclipse do
No lag here on Eclipse
its even more smoother on ST4 since its written in CPP and has hardware acceleration support
it supports maven, stub generation, auto imports
its feels like VSCode but way faster and more aproppiate for java
I liked VSCode before it became VSCode. Back when it was for VB8
oh yeah i fixed it by changing void method => itemstack, anyways ty for the help
np
When I attempt to run BuildTools.jar, the command prompt appears titled C:\Prorgram Files\Java\jk1.8.0_281\bin\java.exe for a split second and nothing happens. Any fix?
try running java -jar BuildTools.jar inside cmd
okay
if(e.getDamager() instanceof Projectile){
Projectile projectile = (Projectile) e.getDamager();
if(projectile.getShooter() instanceof Player){
Player shooter = (Player) projectile.getShooter();
if(shooter == e.getEntity()){
e.setCancelled(true);
return;
}
}
}``` something like this
If you are looking to use 1.17 MC you are going to need to install Java 16
yea.. And i still don't understand why archlinux doesnt have java 16 inside their official repo, now i need to use AUR's to install it
But a damage potion isn't a projectile when it attacks the player, right.
however, use .equals not ==
They only have lts versions right?
alright
not sure
I think that's the case
Try installing a non-lts version and see if it can find it
You have 3 events for potions Splash, Lingering and effect
use whatever you need
but can I get the shooter of a splash
wait
they added it
no way
they literally added couple days ago to the repo
nice
that's not the case then
getEntity() returns the Potion, which is also a projection, so you should be abel to cast and getShooter()
ah coolio
ah nice
yep
couldn't I just use the damage event instead of a splash event that way
found the non headless version too
Sorry for the repeat pings ;/
I don;t believe a splash potion would trigger that event
as it has its own
but the potion is an entity right
Hi, how does one check if block contains liquid. Block.isLiquid() checks if it is water or lava and the Waterlogged interface does not work on seagrass.
isWaterlogged is for flooded blocks like corals and fenceposts/stairs. It should work for seagrass, unless its been forgotten
well seagrass is not waterlogged as it can not be without water
if it can't be without water isn't it a superfluous test to see if it has water?
@EventHandler
public void onSplash(PotionSplashEvent e){
Potion potion = (Potion) e.getPotion();
if(potion.getType() == PotionType.INSTANT_DAMAGE){
Projectile projectile = e.getEntity();
if(projectile.getShooter() instanceof Player){
Player shooter = (Player) projectile.getShooter();
e.getAffectedEntities().remove(shooter);
}
}
}```
How does one change the dye color of a piece of leather armor
I was wondering if there is like one function that checks if there is liquid in this position or not.
Use LeatherArmorMeta https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/meta/LeatherArmorMeta.html
declaration: package: org.bukkit.inventory.meta, interface: LeatherArmorMeta
Shoudl work. You may want to check the type of potion as you probably want to be able to use positive effect ones.
Hello! I am trying to make a falling block to drop random materials on the world.
I have this code, but the falling block doesnt appear or fall.
Location pos = new Location(p.getWorld(), p.getLocation().getX(), p.getLocation().getY() + 50, p.getLocation().getY());
FallingBlock fallingBlock = p.getWorld().spawnFallingBlock(pos, Material.OAK_LOG, (byte)0);```
p is the player variable by the way.
I'm not sure what you mean, if its seagrass its seagrass. Are you wanting to test when its placed or something?
4th line checks if it's INSTANT_DAMAGe
k
It works if i spawn the falling block right on the player
aka replacing pos with p.getLocation()
I also tried teleporting the player to pos, and it worked fine so it has nothing to do with pos
Location pos = p.getLocation().clone().add(0,50,0);
Caused by: java.lang.ClassCastException: org.bukkit.craftbukkit.v1_8_R3.entity.CraftThrownPotion cannot be cast to org.bukkit.potion.Potion
when i do Potion potion = (Potion) e.getPotion();
Ill try this though
Just showing a simpler way to create the location
ah
ThrownPotion
replaced it with java ThrownPotion potion = e.getPotion(); if(potion.getEffects().contains(PotionType.INSTANT_DAMAGE)){
are you using 1.8? If not you shoudl really use one of the non deprecated methods
No, I am using 1.17
NMS Mojmap LevelChunk#getFluidState(BlockPos) returns the Fluid state. Meaning if there is any kind of liquid (either waterlogged, forced water like seagrass or just regular water or nothing) it will return the state of that water. Is there any API function that does the same.
I do not care about what the block is I just want to know if there is water or not.
?paste
if IsWaterlogged() doesn;t work you'd have to ask Choco
isWaterlogged shoudl be mapping that method
Ok so whenever I make a player interact event I get a ton of errors mostly revolving around a NPE when I detect if the player has the correct item in their hand. However, I'm not sure exactly how to stop this.
https://paste.md-5.net/bomezepebi.cs
It checks the blockstate, not fluid state
item may not have itemmeta
Lots of things in line 6 can be null. You need to test for an account for that
I know that, but how exactly can I detect those things?
make like a check to see if the player is holding null and then cancel it or soemthing?
every time you can get null, assign to a variable and test it
If I did this would that just automatically make everything else not be detected?
if(!player.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equals(ChatColor.DARK_GREEN + "Common Loot Box")) {
event.setCancelled(true);
return;
}
ItemStack item;
if ((item = player.getInventory().getItemInMainHand()).hasItemMeta())```
you can then use item to do yoru other tests
Also, any way to make it slower?
setting it's velocity
Ive tried, instead of making it slower, it just instantly drops
anyone know why this returns an error?
https://i.imgur.com/IyU1pNB.png
yes
lol
or sometimes it doesnt even start dropping at all
what are you setting a velocity?
the falling block
yes, what value are you setting?
-1, -1, -1
yeah, thats not going to be good
why>
try new Vector(0, -0.1, 0)
alright
Just finished updating my java to 16, used build tools to get spigot-1.17.jar, and tested it out. It worked! Thanks β€οΈ
its just instantly on the floor
it doesnt smoothly fall
just instantly goes on the floor
i dont know if it matters that im using a chest
use a smaller value
no matter what value i do it still does it
Location pos = p.getLocation().clone().add(0,50,0);
FallingBlock fallingBlock = p.getWorld().spawnFallingBlock(pos, Material.CHEST.createBlockData());
fallingBlock.setVelocity(new Vector(0, -0.1, 0));````
here is my code
with the 0.1
figured out why
it has to do with the chest
for some reason chests cant be smoothly dropped
try fallingBlock.setVelocity(fallingBlock.getVelocity().multiply(0.5))
does it have gravity enabled?
i tried it with oak logs and it worked
let me try enabling it
enabled gravity, still not workin
odd, but good to know chests are funky
yeah lol
this just makes the barrel megafast
It should cut the velocity in half
just 0.5
yeah it just makes it super fast
k
ik this not bukkit server, but what sound from mc could I use to make a "ding" sound?
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 0.5f, 1f);
thats what i use atleast
Can anyone help me to understand this code a bit more?
for (double t = 0; t < 50; t += 0.5) {
double x = radius * Math.cos(t);
double z = radius * Math.sin(t);
p.getWorld().spawnParticle(
Particle.REDSTONE, new Location(p.getWorld(), p.getLocation().getX() + x,
p.getLocation().getY() + 1, p.getLocation().getZ() + z),
1, new Particle.DustOptions(Color.AQUA, 1));
}
this code creates a circle
a circle
the thing is
iam fully aware how cos and sin work
i know that if you multiply hypothenus with math.cos(degrees) you will get the horizontal side of the triangle
and sin returns the vertical side of the triangle
the thing is
i cant understand how this is used to create a circle
the 0.5 i understand is how close the particles are to each other
but i dont understand why it is used as the degrees
I'm trying to add some flags to an item, this is what I have but I'm not sure how to initalize ItemFlag flag;
This is what I got so farjava ItemFlag flag; gameItemMeta.getItemFlags().add(flag);
flags are added with itemmeta
ItemMeta gameItemMeta = gameItem.getItemMeta();```
Using cos and sin its calculating points on a circle
ItemStack gameItem = new ItemStack(Material.DIAMOND_AXE);
ItemMeta gameItemMeta = gameItem.getItemMeta();
gameItemMeta.setDisplayName("1");
gameItemMeta.setUnbreakable(true);
gameItemMeta.setCustomModelData(101);
ItemFlag flag;
gameItemMeta.getItemFlags().add(flag);
gameItem.setItemMeta(gameItemMeta);```
This is what I have for the itemstack so far, just not sure how to initialize the flag
look up Pythagorean theorum and see where cos and sin are used on a angle of the hypotenuse.
thank you ill look into it
not a good example though
anything helps tbh
anyone know why this isn't doing anything when i craft?
public void WaterTNTSound(CraftItemEvent event) {
uhhhh
imma just casually moonwalk outta here
instead of getitemflags.add, use gameItemMeta.addItemFlags(ItemFlag.(YOUR_ITEM_FLAG)
I wrote a quick method to remove Item Flags from an ItemMeta, but it doessn't seem to do anything java private ItemMeta hideAllFlags(ItemMeta itemMeta){ itemMeta.getItemFlags().add(ItemFlag.HIDE_UNBREAKABLE); itemMeta.getItemFlags().add(ItemFlag.HIDE_DYE); itemMeta.getItemFlags().add(ItemFlag.HIDE_ATTRIBUTES); itemMeta.getItemFlags().add(ItemFlag.HIDE_DESTROYS); itemMeta.getItemFlags().add(ItemFlag.HIDE_ENCHANTS); itemMeta.getItemFlags().add(ItemFlag.HIDE_PLACED_ON); itemMeta.getItemFlags().add(ItemFlag.HIDE_POTION_EFFECTS); return itemMeta; }
as i said, use itemMeta.additemflags
oo I'll do that
itemMeta.addItemFlags(ItemFlag.values());
much cleaner
is anyone in intellij idea rn
oh wow yeah that is very clean
anyone know why sleep has a red line below it in both of these?
TimeUnit.SECONDS.sleep(1);
Thread.sleep(1000);
Hiding the flags works great, however now I'm stuck with sseeing this: https://prnt.sc/15qj6nc
Never use sleep in main thread
If it's red, it's likely the IDE telling you to use a try and catch statement as those methods both throw IllegalArgumentException and InterruptedException
seeing what?
If you mean the dark gray text, that's client side
yeah
I believe anyways
oh right! debug mode
i'm a beginner so i don't really understand, is there a simpler ways to wait a certain amount of time?
Yes. This happens with standalone Maven too
The Bukkit scheduler: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/scheduler/BukkitScheduler.html
declaration: package: org.bukkit.scheduler, interface: BukkitScheduler
Then this is almost certainly an outdated plugin or something
which is passed through the scheduler? lol
Here is POM
what do i do with that
The three modules before that are successful
u do stufff with it
see Bukkit#getScheduler()
does anyone here have intellij idea open?
u probs have to use the runTaskLater method
i think
looks like it is as it should, I recommend running it with the stacktrace flag (or whatever it is for maven, I always forget) so we have an idea where it happens
there's no getSchedular on that
does anyone know why its doing this? I opened the server file with git and i pasted this command: java -jar BuildTools.jar --rev 1.17
It responed with this:Loading BuildTools version: git-BuildTools-7425fec-128 (#128)
Java Version: Java 8 Please do not run in a path with special characters!
Scheduler not Schedular
declaration: package: org.bukkit.scheduler, interface: BukkitScheduler
Is this the wrong channel?
when I take a date and dodate -systemtimeinmillis and do my date calcs and getting like 700,000 extra days. Is there something goofy with java date? I know its deprecated but it should still work no?
still nothin
What version are you using?
If it's not a thing, try Bukkit#getServer()#getScheduler()
wdym not in code?
i mean i'm looking at the spigot api rn
which has the Bukkit class?
?
i'm talking about this:
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Bukkit.html#getScheduler()
yes, what about it?
you said that can help, but the information doesn't help me
You're trying to delay a task, correct?
well i'm trying to delay a spawn particle within a for loop
declaration: package: org.bukkit.scheduler, interface: BukkitScheduler
Yes, so it can help you
it has what you need
he will ask you to ex plain what a task is soon
idk how to use it doe
and the information it gives isn't helpful
It tells you how to use it..
declaration: package: org.bukkit.scheduler, interface: BukkitScheduler
has it all

currently i have no errors since i'm not really doing anything
just a normal for loop with a spawn particle without the delay
@lean gull has exactly what you're looking for
declaration: package: org.bukkit.scheduler, interface: BukkitScheduler
i have no clue how to use this
bro
i think u do java Bukkit.getScheduler().runTaskLater(plugin,new Runnable() { @Override public void run() { // your code } },Ticks); i think
im not to sure
never used the scheduler myself
Love the video or need more help...or maybe both?
π¬Join us on Discord: http://discord.gg/invite/fw5cKM3
Thank you for tuning in to this episode of TheSourceCode! β€οΈ
If you enjoyed this video make sure to show your support by liking , commenting your thoughts, and sharing for all your friends to see and learn!
All code is available on Github:
...
You can either do this or pass a function instead of runnable :
Bukkit.getScheduler().runTaskLater(plugin, () -> {
// The code
},execute_x_ticks_after_this_is_called, execute_every_y_ticks);
He won't listen to you. He will find Thread.sleep and use it against all advice.
yo if this grace.getTime() - System.currentTimeMillis()) is returning 60 billion and I set it with Date grace = new Date(2021, 5, 18, 4, 35, 0); what am I doing wrong?
thread.sleep oof, RIP
How would I check the block above the block broken in a BlockBreakEvent?
block.getRelative(BlockFace.UP)
Location loc = e.getLocation()
loc.setY(log.getY()+1)
loc.getBlock----
is it possible to change the speed that an item breaks a block? say have a block of dirt mine a log at the same pace as a diamond axe (like changing it's strength per sec?)
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
public class ClickListener implements Listener {
@EventHandler
public void clickEvent(InventoryClickEvent e){
if (e.getClickedInventory().getTitle().equalsIgnoreCase("Custom GUI")){
e.setCancelled(true);
}
}
}```
For some reason there's no method ``.getTitle()`` in the clickedInventory event ``e.getClickedInventory().getTitle()``. ``.getTitle()`` errors in the above code
e.getView().getTitle()
Thank you. Was that changed recently?
But don;t match Inventories by name
What's a better way to do it?
best to match by instance
I know what the instanceOf expression is and what it does, and I'm assuming that's what you're referring to but I'm not sure how I would do that


