#development
1 messages · Page 35 of 1
bukkit vectors are dumb, why would they modify and return
spent a while trying to figure out an issue because the original vector was modified
i guess ill just call clone() on everything
I found the version that clip made and decompiled it, seems to be pretty straight forward. Are you limited to only string based placeholders? Also are the calls for placeholders thread safe? meaning if an API action is calling a database call it is done outside the main server thread? Or is that not possible?
What thread the expansion is called on is the same as the plugin requiring the placeholder ran PlaceholderAPI.setPlaceholders on
And the thread safety of the setPlaceholders call depends on what the expansions do
hmm. this is close, but im not sure 100%. When it's shot, i set the arrow to be 100 ticks old (should be long enough to damage the player, but it still doesn't). Teleporting it behind the player and shooting slowly, it hits me, while shooting fast passes through me. This implies that it is time based, but not based on ticksLived.
maybe i could spoof the projectile source to something else
or (everyone will hate this) have pre-spawned arrows take its place xD
i dont like either solution
hello there
does somebody know how to make TAB list empty ("broken") like this
https://prnt.sc/R4pFefC9Ooar
Any ideas how to cancel properly bungee's ServerConnectEvent event?
just cancel it? the event is cancellable
true
this is what i get when i cancel it
net.md_5.bungee.util.QuietException: A plugin cancelled ServerConnectEvent with no server or disconnect.
until timeout
[02:38:17 INFO]: [Test2] disconnected with: ReadTimeoutException : null
i think i'm not doing anything special here, yet it just happens
is this like an initial login connection? or server switching?
you should use the login event for that
but i need to check for specific server (target server)
mm
how can i check the target server too
i suppose you are meant to cancel the event and also disconnect the player (if you don't want them to join another server like a limbo or something)?
yes
maybe connection.disconnect(?)
i'll give it a try
works 😄
thanks @minor summit
nice
Just wondering, is there a gradle plugin that can clone repos from Github and build them into your local maven/gradle repo?
I tried using Grgit and making my own method in kts but i failed miserably
And no, I'm not using Jitpack 🤢
yeah so there's actually this concept called maven repositories who host compiled artifacts for people to use in their gradle builds so that they can utilize the api
it's a pretty cool system actually
No! That doesn't exist!
Basically, I made a custom mining system using packets. But if i mine with a pickaxe it will override and my canceling of block damage event doesnt work?
what shall i do
if ur broke tho 😭
maven central
Did you send a mining fatigue packet?
yes
they have mining fatigue -1
should it be 1?
@EventHandler
public void blockDamage(final BlockDamageEvent e) {
e.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOW_DIGGING, Integer.MAX_VALUE, -1, false, false), true);
e.setCancelled(true);
}```
people arent allowed to break blocks at all?
You talking to me?
yes
here ill make video
just make sure that you also cancel a block break event. I'm not positive that cancelling all the damage events will stop a break event from happening with a laggy client
heres the problem
the pickaxe mining speed
is like faster that the speed i made
so they get a glitch where they "break the block" but its not supposed to be broken yet so they have to continue breaking again
what do you want to happen
look dms for videop
yes i see, what is the intended behavior though
Would you wish to see videos or anything? i think you know what its supposed to look like
I’m pretty sure this doesn’t get called if you switch to another block after holding down the break button, or something like that happens
I’m not sure I understand your issue though
how to get category name from path
example
PlayerLevels:
3ffc17e8-e417-30ef-80ce-4f9b1da4f0f6:
guilda:
Test:
name: test2
dono: zThyPvpTK
how to get "test" category in yml
I tried
``` but it returns null value, help pls
Database or collection?
I meant table, sorry, so if you are using mongo that would be a collection
guilda is not a string
in this case the guild is just to get the value inside with getstring, in this case the Test value would not be a string, my question is what would it be? and how can i pull
Any ideas on why that won't return anything?
@Override
public String onPlaceholderRequest(Player p, String identifier) {
if (p == null) {
return "";
}
// %townywild_cooldown%
if (identifier.equals("cooldown")) {
return plugin.getConfig().getString("protection_time_after_exiting_town_border", "Not protected");
}```
```java
PROTECTION_TIME_AFTER_EXITING_TOWN_BORDER(
"protection_time_after_exiting_town_border",
"20",
"# This is the amount of time in seconds, the player exiting the town border will have PvP protection for, during that time, the player cannot hit or get hit by other players.")```
I have this in my ConfigNodes
your supposed to use onRequest afaik
not onPlaceholderRequest
maybe player is null?
dont do null checks for player if you dont need a valid player
that could be true
would that be right?
@Override
public String onPlaceholderRequest(Player player, @NotNull String identifier) {
if (identifier.equals("cooldown")) {
long remainingTime = Integer.parseInt(getConfig().getString("protection_time_after_exiting_town_border")) * 20L;
return Long.toString(remainingTime);
}
return "";
}
}```
oh
protection_time_after_exiting_town_border is in ticks so it multiplies by 20 to get seconds
is it possible and if how
possible yes, how it entirely depends
most common way id think is a worldguard flag
but you could also define custom regions etc etc etc
is there an easier way of doing a cooldown system?
private HashMap<UUID, Long> scheduledRemovalTimes = new HashMap<>();
public void scheduleRemoval(Player player, long time) {
scheduledRemovalTimes.put(player.getUniqueId(), System.currentTimeMillis() + time);
}
public long getRemainingProtectionTime(Player player) {
Long scheduledRemovalTime = scheduledRemovalTimes.get(player.getUniqueId());
if (scheduledRemovalTime != null) {
long remainingTime = (scheduledRemovalTime - System.currentTimeMillis()) / 1000;
if (remainingTime > 0) {
return remainingTime;
}
}
return 0;
}
.......................
@Override
public String onPlaceholderRequest(Player player, @NotNull String identifier) {
if (identifier.equals("cooldown")) {
return Long.toString(getRemainingProtectionTime(player));
}
return "";
}
}```
this is what it looks like but it still doesn't seem to return anything
It takes it from a listener class I made before
//create a map to store the scheduled removal time for each player
private Map<UUID, Long> scheduledRemovalTime = new HashMap<>();
@EventHandler
public void on(PlayerExitsFromTownBorderEvent event) {
UUID uuid = event.getPlayer().getUniqueId();
protectedPlayers.add(event.getPlayer().getUniqueId());
long scheduledRemovalTime = System.currentTimeMillis() + (Integer.parseInt(getConfig().getString("protection_time_after_exiting_town_border")) * 1000);
scheduledRemovalTimes.put(uuid, scheduledRemovalTime);
Bukkit.getScheduler().runTaskLater(plugin, new RemoveProtectedPlayerTask(uuid, protectedPlayers, scheduledRemovalTimes), Integer.parseInt(getConfig().getString("protection_time_after_exiting_town_border")) * 20L);```
Afaik, you can use PDC, adding a node like Cooldown: (EpoachTime)
Easier to get it and no need to worry on how to save on server shutdown.
yeah but it isn't a cooldown for a command
basically when a player exits a town, his uuid is saved and he is protected from being attacked for a set amount of time
then after the timer, his uuid is deleted from the list
You can still use the PDC for it.
1 - you can have a task running to delete that from PDC. Though, here, y'd need to save which players still need to be checked due to server shutdowns.
2 - you said that the player is protected from being attacked for a set amount of time. You can check when the player get attacked and see if the "amout of time" have already passed. If so, remove the node from the PDC.
Just a small question, what is PDC
it's my first plugin I'm doing so i'm still learning
Thanks!
Yw
Can someone tell me why this isn't working? There's no errors or anything but when i join the server it doesn't say anything
package me.predatolian.bountyplugin.handlers;
import me.predatolian.bountyplugin.BountyPlugin;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
public class PlayerHandler implements Listener {
public PlayerHandler (BountyPlugin plugin){
Bukkit.getPluginManager().registerEvents(this, plugin);
}
@EventHandler
public void PlayerHandleEvent(PlayerJoinEvent event){
Player p = event.getPlayer();
Location loc = p.getLocation();
int x = loc.getBlockX();
int y = loc.getBlockY();
int z = loc.getBlockZ();
Bukkit.getLogger().info("Player spawned at " + x + y + z);
}
}
do you instantiate the class?
I don't know what that means
this is the first time i've ever tried doing anything with java/minecraft
do you have new PlayerHandler(plugin); (or this instead of plugin) somewhere in your code?
uhh no
ok, do that
where though
in your onEnable method
oh
public final class BountyPlugin extends JavaPlugin {
@Override
public void onEnable() {
getLogger().info("Succesfully loaded");
new PlayerHandler(BountyPlugin);
}
}
It's giving me an error
use this, not BountyPlugin.
this is an instance of the class where you use it - in this case, an instance of BountyPlugin - and BountyPlugin is a class.
thank you so much
np
looking for code to remove a yml file
Files!delete for java jio
Java jio on top
jaja jio better imo
If my plugin depends on adventure (which is available on paper only) but ofc i want it to work in spigot too
what would be the best way to do it?
would be so nice with kotlin extension functions 😌
If you have any features that you want to only work on paper, then the safest way would probably to have a spigot module and a paper module
besides that, you should just use spigot api and shade & relocate adventure
I think most, if not everything should still work if you use legacy serializer with hex and bungee component serializer (or you can use nms and gson serializer)
i was thinking about the same, issue comes when new mc versions are released and adventure requires updates
additionally, the fact that not only 1 of my plugins will use it, but at least 3 (and probably more in the future)
besides the 1.19 chat update for example I don't think it should break each version
maybe making a library (.jar) with adventure inside which can be updated when new versions of adventure appears without needing to shade it
and updating each plugin, would be a good idea?
yeah
they have the bukkit-platform which helps sending messages to players and console
wait what
I don't know about automatically updating adventure since it might have like breaking changes
i mean, i doubt Component.of etc appendReplacements and other methods change in a future
probably internally, hence why updating just a .jar with the adventure inside
would be the better solution instead of updating every single plugin that has the library shaded
(saldy, making the plugin paper exclusive, is not an option, in case someone was going to say that)
is the plugin open source
a possibility is to setup github actions &/or repository-only bot to automatically update (the buildscript) and build the jar 💀
idk how easily slimjar/alternatives makes it easy to add custom libraries
might be really easy or hard
¯_(ツ)_/¯
😮
i honestly have no idea how to do that tbh
i guess i'll just make a library .jar for now
until spigot shades adventure

so you know how to make library .jar? 🥲
yeahhh, i think, at least maven and its relocation works for me :,v

nvm i found a solution
Is it possible to change a block texture using a texturepack
i would hope so else they wouldnt rly be texturepacks 💀 (thats a yes)
no
like some times its bedrock then some times it turns into redstone block
for say
didnt explain well
lol
@dark garnet
oh lmao i think u can use CustomModelData to achieve that but there might be an easier way
change the block's CustomModelData between 2 values and have resourcepack with those 2 values with the 2 textures
do you know how i would do that?
any idea for this?
if (identifier.equals("countdown")) {
return Long.toString(getRemainingProtectionTime((Player) player));```
this returns the seconds without anything, example: Protection time left: 5 (placeholder here)
But when I use this
@Override
public String onRequest(OfflinePlayer player, String identifier) {
if (identifier.equals("countdown")) {
long remainingProtectionTime = getRemainingProtectionTime((Player) player);
long remainingProtectionTimeInSeconds = TimeUnit.MILLISECONDS.toSeconds(remainingProtectionTime);
if(remainingProtectionTimeInSeconds>60){
long remainingProtectionTimeInMinutes = TimeUnit.SECONDS.toMinutes(remainingProtectionTimeInSeconds);
return Long.toString(remainingProtectionTimeInMinutes) + " minutes";
}else{
return Long.toString(remainingProtectionTimeInSeconds) + " seconds";
}
}
return "";
}
}```
It returns **0 seconds**
what are you asking
I'm trying to make it countdown the placeholder
Basically I set up the protection time in the config file
protection_time_after_exiting_town_border: '20'```
But it only outputs 0 seconds instead of doing it like
20
19
18
...
okay so check if TimeUnit.MILLISECONDS.toSeconds(remainingProtectionTime); is what you think it is
just have it return that first
@Override
public String onRequest(OfflinePlayer player, String identifier) {
if (identifier.equals("countdown")) {
long remainingProtectionTime = getRemainingProtectionTime((Player) player);
long remainingProtectionTimeInSeconds = getRemainingProtectionTime((Player) player);
if (remainingProtectionTimeInSeconds > 60) {
long remainingProtectionTimeInMinutes = TimeUnit.SECONDS.toMinutes(remainingProtectionTimeInSeconds);
return Long.toString(remainingProtectionTimeInMinutes) + " minutes";
} else {
return Long.toString(remainingProtectionTimeInSeconds) + " seconds";
}
}
return "";
}
}```
this doesn't return 0
but the bossbar gets stuck for some reason
public void startProgressUpdater() {
progressUpdaterTask = Bukkit.getScheduler().runTaskTimer(this.plugin, new Runnable() {
@Override
public void run() {
Long scheduledRemovalTime = scheduledRemovalTimes.get(uuid);
if (scheduledRemovalTime == null) {
return;
}
long remainingTime = scheduledRemovalTime - System.currentTimeMillis();
if (remainingTime <= 0) {
run();
return;
}
BossBar bossBar = bossBars.get(uuid);
if (bossBar == null) {
return;
}
double totalProtectionTime = Integer.parseInt(Objects.requireNonNull(getConfig().getString("protection_time_after_exiting_town_border"))) * 1000L;
double progress = remainingTime / totalProtectionTime;
bossBar.setTitle(PlaceholderAPI.setPlaceholders(getPlayer(),bossBarText.replace("%townywild_countdown%", String.valueOf(remainingTime))));
bossBar.setProgress(progress);
}
}, 0L, 20L);
}```
maybe my bossbar progress updater is wrong
y'all is it possible to find which .jar a plugin is coming from/loading from?
@true mountain has a plugin Custom Enchants that is loading and no idea where from
no .jar exists in the plugin directory
gah
we found it
smh
any ideas?
I haven't tested it but,
for (Player player : Bukkit.getOnlinePlayers()) {
player.setPlayerListHeaderFooter("", "");
player.setPlayerListName(" ");
}
maybe?
public static <T> T loadOr(File file, T def) {
Object result;
if(!file.exists()) {
try {
file.createNewFile();
} catch (IOException ex) {
ex.printStackTrace();
}
}
try {
ObjectInputStream ois = new ObjectInputStream(new FileInputStream(file));
result = ois.readObject();
ois.close();
}
catch (Exception ex) {
ex.printStackTrace();
return def;
}
return (T) result;
}
[13:12:11 WARN]: java.io.EOFException
[13:12:11 WARN]: at java.base/java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2926)
...
any idea why I'm getting this?
stack trace says at new ObjectInputStream line.
A serialization stream header is read from the stream and verified.
From the jd
2
im guessing the file is empty and its trying to read the headdr
well it's definitely not empty
even if I save default value before reading, I get the exception
Don’t use the old file api, don’t close streams manually (use try-with-resources), probably don’t use java serialization
if my plugin needs to be configurable with custom GMT (yes, for date)
how would i make it exactly? was thinking about getting current machine time and then modify it to match specified GMT, any ideas?
well, I found the issue.
and I'm not using this type of serialization for very important stuff
so I don't mind using it
just need some things to persist through restarts is all
There's ZonedDateTime if you want to get the time at a certain time zone https://docs.oracle.com/javase/8/docs/api/java/time/ZonedDateTime.html @shell moon
mmmm if i want owners to be able to set
Local-gmt: "-5" (for example, for my country)
so they dont need to worry about machine time in dedicated/hosting
You can do that, but id recomment to allow them to write any type of time zone, e.g. Europe/Bucharest for Romania instead of GMT+2 and GMT+3 for summer time
issue is that people might make errors when editing that
in my case (iirc) is Bogota/Lima for GMT -5
but many people dont know what to write there
so if they fail, system will fail too right?
Google exists
is just a time zone, is not a big deal
put this link in config and tell them to look for Continent/Capital or City or whatever that's relevant to their local time
and if they enter an invalid value, just fallback to the time of the machine
for ZonedDateTime (more specifically ZoneId/ZoneOffset) you can input both Continent/City and GMT±n
yup, exactly
Why exactly are people still using DeluxeMenus?
Why wouldn't they?
wrong channel also
Are there any special features? Cause I'm currently searching for a good menu plugin to use xD
whether a plugin is good "good" depends on your needs
tbh i very much enjoyed using deluxemenus, it has very good documentation
that's why I'm asking?
I'll try it out, thank you
I'm trying to activate a loop inside of a switch case without stopping the switch case, does java have coroutines or something that can help me do this?
Best way to make it players cannot only play for 1 hour and reset it at 00:00?
so if they play from 21:00 they are kicked at 22:00
Schedule a task
but if they play at 23:30, they are not kicked at 00:00 but at 01:00
sync or async?
one per player or for the server to constantly check seconds left?
I would probably have a global task. Probably synchronous
so basically a timer with interval 20L
For MySQL databases, would it be better to update the data every time there is a change to the value or only update it every 30s?
on every change is fine, just make sure you run the queries off the server thread
Would anyone happen to know about paginated guis using triumphguis (mf-gui)
I'm clicking the next button (created from wiki) but it's not actually moving pages
A. Do you actually have 2 pages of things in it? It only generates the minimum number of pages and B. Did you setup both click listeners?
I haven’t made 2 pages, i’m not sure how
I didn't realize there was a parameter to expand, thanks!
does anyone know why theres a stacktrace when i use this code
ItemStack item = e.getCurrentItem();
if (item != null && item.getItemMeta().hasLore()) {
String lore = item.getItemMeta().getLore().get(0);
if (ChatColor.stripColor(lore).equals("test123")) {
for (String lores : item.getItemMeta().getLore()) {
p.sendMessage(lores);
}
}
}
}
``` (when i first click on the item with the lore test123, it works and sends me the lores, but after i click it back to another slot, a stack trace pops up and i have no idea whats causing it)
using InventoryClickEvent fyi
in the future please paste the stacktrace
but in this case, IntelliJ at least should be giving a warning that getItemMeta is nullable
just like how you nullcheck item, you have to do the same for the meta (as it's null for air)
Use https://paste.helpch.at/ for errors, logs and configs. So we don't spam the discord.
my bad
i use eclipse not intellij
ill put the stack on pastebin
nonono its ok
barry did it for you
oh ok
but yeah as I suspected, it's a NullPointerException - likely due to the item meta
wait so i need to check if the itemmeta is null aswell?
wait
but if i already checked that the item is null
why do i still need to check for the itemmeta
ItemStacks can be air
however, ItemMetas cannot be air bc itemmeta stores stuff like lore, etc which air cannot have
in my code im just checking if the item isnt an empty space, and if it has lore itemmeta
i broadcasted e.getCursor()
on the first click it says that the itemstack is air
and when i put them item back it shows me my item with its meta
the item is not null; the meta is
the meta is not the item
technically multiple items can have the same itemmeta
I wouldn't recommend it but it's possible
you have to check if the itemmeta is null
i was just debugging
if (item != null && item.getItemMeta() == null) {
p.sendMessage("test");
return;
"test" seems to always send
even if the item has itemmeta
or no meta
Player p = (Player) e.getWhoClicked();
ItemStack item = e.getCurrentItem();
p.sendMessage("" + e.getCursor());
if (item != null && item.getItemMeta() == null) {
p.sendMessage("test");
return;
``` this is what i have rn, i have commented out the other code
ItemStack item = e.getCurrentItem();
if (item != null && item.getItemMeta() != null && item.getItemMeta().hasLore()) {
String lore = item.getItemMeta().getLore().get(0);
if (ChatColor.stripColor(lore).equals("test123")) {
for (String lores : item.getItemMeta().getLore()) {
p.sendMessage(lores);
}
}
}
}
```this should work btw
thats what you meant by checking if its null... i was gonna check if it had lores with !item.getItemMeta().hasLore()
getCursor and getCurrentItem are different
the sendMessage you're doing getCursor
but item is getCurrentItem
iirc getCursor is what was previously selected on your mouse/cursor, and getCurrentItem is what was previously in the slot
I might have it mixed up though
🥲
yeah I don't remember exactly what it is but I can tell you 100% that they are different
np
Pretty sure getItemMeta() doesn't return null because it's suppose to create it if it is.
for air it returns null
wow
bad @uneven lantern
Ah. Isn't there hasItemMeta()?
👍
HasItemMeta() checks if it has meta in general, hasLore is specifically if it has lore or not, so i wouldnt call it the same thing
but if it doesnt have meta, then it doesnt have lore
I mean like how the method works
they both check for null and in lore's case it checks if the lore is not empty and for meta it pretty much just checks if the meta is null or not
not exactly related but apparently for air, the nms item is null 🤔
I wonder how air looks like in internal minecraft code then (and if an air type exists in internal minecraft code? 🤷)
afaik air original was id 0
in most instances the itemstack is still AIR
even in nms
there is actually multiple versions of air
oop double ping
AIR,CAVE_AIR and VOID_AIR
the internal inventory lists are specifically lists that disallow null elements, bukkit literally transforms air nms itemstacks into null bukkit itemstacks, it's so fucking stupid
Im 0% sure but i think theyre different
https://wiki.vg/Slot_Data
Here null would mean present is false and material.air would mean air item id but honestly idk that could just be for the protoxol
Yeah wiki.vg doesn't really represent how the game is actually structured, they only show you the raw byte streams for the packets when sent through the wire
Which doesn't even represent the packet Java classes structure but many people using ProtocolLib think they do and then wonder why some things don't work when "wiki.vg says this but ProtocolLib says that"
from my own testing virtual inventorys their slots that are empty are null, but with actual inventorys their slots that are empty are air.
vanilla/internals/nms does not use null for empty slots, it uses a NonNullList and it uses a constant ItemStack.EMPTY (air) item for empty slots
bukkit is the one that uses nulls for bukkit inventories most of the time, there are places where it actually uses air items which makes things even more confusing
the serialised packets use a boolean flag for empty/non-empty because writing an entire item stack for empty slots would be extremely wasteful
Is it possible to know which plugin logged something in the console? (if it didn't use it's own logger, but the server's logger)
virtual inventories that are created through bukkit.createinventory have null slots, inventories that are created from a opening it using a block have AIR itemstacks in their slots, so you are correct, bukkit is the reason slots can be null
btw
if bukkit made a copy of a bunch of things in nms, wouldn't it increase the memory usage by a whole bunch?
although I think the majority just calls to nms, but for things like inventories - would it increase the memory usage by a noticeable amount?
or are there too little cases where bukkit copies stuff that it doesn't impact memory by much
yes
i need help
There is no time to wait! Ask your question @broken eagle!
when i try to join my server
it spams the console
with this
this is not the full console
pls someone help
possible things:
- high latency / slow internet
- broken hardware (RAM most likely)
internet isn't slow
and ram isn't broken
ok
how can i parse 1y1mo1w1d1h1m1s into a long representing milliseconds
just gonna quickly ask chatgpt actually
chatgpt gave me a huge regex thing for it and then gave up at the end, it's last word was It's on a new line lmao
yoiiiiiiink
Just copy Kotlin's Duration 
imma suggest you use M instead of mo
like if your wanting to go down that path
has to be mo, this is for a discord bot and 99% of bots use mo
ic
m conflicts with minutes
capital M
regex
wow so helpful
Looks good, allowed to copy in our plugins? 
my thoughts when i said that was by using single characters to find the unit, which M and m are different characters technically. wouldve thought it was faster or something to do exactly that
Mit license
that means? xd
it means yes but if it makes ur pc blow up u cant sue them iirc

u dont even need a header it can be anywhere
wdym?
iirc it either has to be in like the project root or in the header
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
I might not be right tho idk 🤷
what?
just put the mit license in like a LICENSE file, hope it doesnt blow up ur pc and ull be good
ye
look up "MIT license" and paste it into that file
I'd assume you paste that in there
ye
although shouldn't you put it as a header too?
so that it's known which files are taken from luckperms
I don't remember what projects do
doesnt rly matter, both work
oh ok
either just copy and paste https://github.com/LuckPerms/LuckPerms/blob/master/common/src/main/java/me/lucko/luckperms/common/util/DurationParser.java without the package line and I think you should be fine
Twisty mentioned putting the license file in the root project which I bet is probably also recommended but idk how the naming for that goes or anything
feel free to google it
or ask chatgpt
¯_(ツ)_/¯
xD
shouldnt matter tho if ur taking 1 file
lucko or whoever will just ask u to change it at worst
its too much effort to cry over it
and costs them money if they wanna cry and sue or smth and probably not win
it is posible progressbar in voteparty plugin?
whats the use of adding plugins to proxy i dont really understand it
Please do not spam multiple channels. I have answered you in #minecraft.
To add functionality to the proxy 😱
would be a good idea to add multiple-channel copy-paste protection to @neat pier
(suggestion for whoever is maintaining it)
could also be used to detect bumps in request channels^
though i guess it doesnt happen as often as copy pasting in channels
pretty sure it used to be a thing. idk if it broke or what.
barry is quite broken
does that already.
@urban oar wya
anyone know how to damage a player without affecting their velocity? I calculate what their velocity is supposed to be separately and set it, but the damaging sends them off randomly. https://paste.helpch.at/heyugejoso.java
i can use player.setHealth() instead of player.damage(). this works fine, but i'd prefer the player to actually get a hurt sound and turn red.
edit: Fixed by not specifying the damager entity
nice
Hey, Im trying to integrate vault into my plugin. This is what I tried so far: https://paste.md-5.net/uweyizurum.java
but the RegisteredServiceProvider is always null, so then I tried the ServiceRegisterEvent: https://paste.md-5.net/vipubafeda.cs
but the event is never called, even though I made sure to register it in the onEnable() method. Can anybody help me?
You're not shading vault, right?
And make sure u have it as depend
Or softdepend
I added the api to my pom like the github page says https://github.com/MilkBowl/VaultAPI
And I already set Vault as a depend in my plugin.yml
well, do you have the classes that vault provides?
ex. net.milkbowl.vault.economy.Economy
yes, I can access that
hm, that's weird. where do you call the setupEconomy?
I call it onEnable(), after initializing the plugins' files and registering commands
@Override
public void onEnable() {
instance = this;
FileManager.loadFiles();
CommandManager.register();
EconomyManager.setupEconomy();
}
for the event, I just implement Listener into the EconomyManager and replace the EconomyManager.setupEconomy(); with getServer().getPluginManager().registerEvents(new EconomyManager(), this);
well, could you try making it non-static and moving the method from EconomyManager class to your main one?
https://paste.md-5.net/qomegaporu.java
the RegisteredServiceProvider is null
could you paste the full class, with imports and what-not?
yea sure one second
https://paste.md-5.net/letibosuxu.java
Full Main class
well, everything seems to be correct
are you sure vault is installed on the server?
its enabling and everything, only thing not working is my plugin
Maybe it would work if I had actually added an Economy plugin 🤦♂️
true
¯_(ツ)_/¯
ah yes, that might help just a tad
is BukkitRunnable() looping over and over until it reaches cancel()?
what can i use that is like BukkitRunnable() but to execute only once?
thanks a lot
Might not be the exact syntax, but use Bukkit.getScheduler instead of BukkitRunnable itself
That is recommended?
BukkitRunnable#runTask
it doesn't always loop
only if you do runTaskTimer or runTaskTimerAsynchronously
thanks
also related to this
how can i delay the first iteration?
yes
look into runTaskLater
runTask delays it by 1 tick
runTaskLater lets you cutomize it
same with runTaskTimer, etc
i want to do something on player join (talking about bukkit/spigot plugin)
how can i delay the task, but to delay it in such way that the first iteration that is ever done within that code will be delayed, so like
- player joins
- wait x ticks
- do first iteration/whatever
- ...
❌ not like:
- player joins
- do first iteration/whatever
- wait x ticks
i see that it has delay
but how to make delay apply for first iteration ever
ok finally
it worked with runTaskLater
thanks a lot @dusky harness
yes, runTaskTimer allows for that
it has 2 parameters
1 for the initial delay, then another for the delays after
thanks
what's the best idea to remove all potion effects for the player (i want to do this on join)
should i first get user effects then loop and remove each or is there a way to remove them all at once (something like Player#clearEffects())
there isnt a clear effects function from what I can see
probably just getActivePotionEffects forEach removePotionEffect
he wants to repeat I think
since he mentioned "first iteration"
but if it's not repeat then yeah tasklater works
@EventHandler
public void on(PlayerEntersIntoTownBorderEvent event) {
UUID uuid = event.getPlayer().getUniqueId();
System.out.println("Player just entered the town border");
if (protectedPlayers.contains(uuid)) {
protectedPlayers.remove(uuid);
System.out.println("player protection ended");
Long scheduledRemovalTime = scheduledRemovalTimes.get(uuid);
if (scheduledRemovalTime == 0) {
return;
}
scheduledRemovalTimes.remove(uuid);
if (bossBars.containsKey(uuid)) {
BossBar existingBossBar = bossBars.get(uuid);
existingBossBar.removeAll();
bossBars.remove(uuid);
// stop the running task if it exists
if (bossBarTasks.containsKey(uuid)) {
Bukkit.getScheduler().cancelTask(bossBarTasks.get(uuid));
bossBarTasks.remove(uuid);
}
}
}
}```
The bossbar should actually be cancelled and not count the 5 seconds I spent inside my town then remove the bossbar when it says I have 10 seconds of protection left but I wonder if it's something to do with the HashMap for bossBars
Here is the whole class: https://paste.learnspigot.com/uhuhadacog.java (sorry for the bad code, it's my first plugin)
@EventHandler
public void onItemClick(PlayerInteractEvent e) {
if (e.getAction() != Action.RIGHT_CLICK_BLOCK && e.getAction()!= Action.RIGHT_CLICK_AIR) return;
ItemStack item = e.getItem();
if(item == null) return;
e.getPlayer().sendMessage("Start!");
if(item.getType() == Material.NETHERITE_CHESTPLATE) {
// e.getPlayer().sendMessage(String.valueOf(e.getItem().serialize()));
e.getPlayer().sendMessage(String.valueOf(e.getItem().serialize().get("extra")));
// e.getPlayer().sendMessage(String.valueOf(e.getItem().getData()));
e.getPlayer().sendMessage("Blaze rod clicked!");
}
}
I want to get the value by the key.
How did you test this? What is the current outcome with that code?
there isnt an "extra" field in what serialize returns
Hey! This isn't solving your problem but the first thing you should do is come up with new names for your methods (right now, they are all called "on"). For example, your PlayerEntersIntoTownBorderEvent handler should be named something like "onPlayerEntersTown" or something similar, rather than just "on".
unless it's some convention ive not seen before
In your CMD execute java --version. What does it return?
When have you installed java? Was it today and it broke right after installation or did it work before?
If it broke after working before, any chance you messed with the environment variables?
I guess that is also a way to fix it. I was thinking you probably just need to edit an environment variable to fix it.
Well JAVA_HOME and PATH I guess.
Did reinstalling not fix it?
You won't be able to upload images here directly to avoid spam, so please use https://imgur.com/upload or similar service to upload images/screenshots.
Ohhhh.
I thought you meant that you reinstalled in the time it took me to respond and it fixed it
haha
what handling event keyPressed in plugin java 11?
In your PATH variable, are you sure there is a path pointing towards your java.exe?
No, as in you're not sure?
Blitz help me pleasse
It won't actually end with java.exe. It is just going to point to the parent directory.
I'm afraid I do not know the answer
Shit...
Oh do not worry. I was brain dead long before I met you.
Can you open the PATH variable and send a screenshot from there?
No. That's not what I meant
There's a variable called Path
you can see it in the screenshot
Where did you install java? Is it C:/Program Files/Java/jdk-19/ ?
Then double click on Path (environment variables), click New and in the new filed it creates, type C:\Program Files\Java\jdk-19\bin
after changing the path you need to close the open terminal/cmd line and open a new one
well maybe you don't
i don't know if you do or don't know
what are you running? powershell? that's the default on win11 i belive
Can you check both the user variables and the system variables? They both will probably have a variable PATH. Send a screenshot from both.
that was towny api’s event haha
is there a better way to store data instead of using a List if I only need to store exactly 2 values?
Map.Entry
Map.entry()
i dont think this method exists in java 8 though
so you'd have to make your own Pair class
or preferably a data class
the best way would be a data class
java 8 💀
even for 2 values it's probably best
yeah I don't use outdated software, no worries
lol
wait until you find out about AbstractMap.SimpleEntry/.SimpleImmutableEntry
Could use an array.
Object[] values = new Object[2];
yeah, no
Not heterogenous
https://media.discordapp.net/attachments/674712515606872085/1069744529898487828/image.png
Hello! Can someone help with this? Unfortunately, I don't understand it.
Looks like a bad link?
Actually, this is a simple error log, but I don't understand it
Okay well that image doesn't actually load.
Just looks like they can't connect to survival. Bad IP / Port? Probably better in #minecraft though.
if you're using docker, it should be 172.18.0.1 not 127.18.0.1
I do not understand. And it's an RPG.
The IP address, the server it's trying to connect to. Are you hosting it on Docker? It's very unlikely the ip is 127.18.0.1
If they're on the same machine, it'd be 127.0.0.1
this contains ur own ip address fyi
I don't think this is the problem in the above mentioned message.
nope, just pointing it out...
In fact, I don't really know where to change this. 😅
I also rewrote it. Nothing has changed
Although it only says 127.0.0.1:1028
no he's just saying that you may not want to just tell everybody your ip
insert liveoverflow video about showing public IPs here
is this something that can be done?
public long getRemainingProtectionTime(Player player) {
if (TownyWildTownEventListener.scheduledRemovalTimes.containsKey(player.getUniqueId())) {
long scheduledRemovalTime = TownyWildTownEventListener.scheduledRemovalTimes.get(player.getUniqueId());
Bukkit.getScheduler().runTaskTimer((Plugin) this, new Runnable() {
int remainingTime = Math.round((scheduledRemovalTime));
@Override
public void run() {
if (this.remainingTime == 0) {
return;
}
this.remainingTime--;
}
}, 0L, 20L);
}
return 0;
}```
inside of the PlaceholderExpansion class
java.lang.ClassCastException: class com.agaloth.townywild.hooks.TownyWildPlaceholderExpansion cannot be cast to class org.bukkit.plugin.Plugin (com.agaloth.townywild.hooks.TownyWildPlaceholderExpansion is in unnamed module of loader 'TownyWild-1.00.jar' @4dd3bb9d; org.bukkit.plugin.Plugin is in unnamed module of loader java.net.URLClassLoader @58d25a40)```
change "this"
^ in your runTaskTimer, there needs to be your main plugin class
or if you're just coding a standalone expansion, you can use PlaceholderAPIPlugin
I'm making a plugin which creates different types of golden apples that give different effects when you eat them. I want to be able to add them to EssentialsX kits, but I'm gonna assume it won't handle persistent data tags properly. Does anyone have alternatives, other than not using essentialsx kits?
i mean, if worst comes to worst, i can store the effects on lore lines
LiveOverflow leaks people's ips often (from his server) so much it's a inside joke now
It may actually work
o/
I've been working on a custom block breaking speed implementation (what a mouthful) and it works completely fine, but one thing.
Usually after the client breaks a block, there is (unless instantly broken) a 6 tick delay before you can start mining the next block;
However with my implementation the server is the one breaking the block using Block.breakNaturally, which means the client does not get the intended delay and can immediately start breaking the next custom block.
My current workaround is setting the player to Adventure Mode for 6 ticks and setting them back to Survival Mode, which... works, but doesn't feel right at all;
Is there a packet or something I've missed that let's me tell the client they've broken a block to trigger the delay?
If there isn't and someone has a better idea, I'd appreciate it!
I’m assuming you’re using mining fatigue, if you are then just don’t add progress to the block during the 6 ticks
I am using mining fatigue yes;
since I am trying to make it look as convincing as possible; the issue is that the client still hears the mining sound if I was to just block the progress
is PlaceholderExpansion#canRegister() called before or after Configurable#getDefaults()? what I want to do is check on canRegister whether the values on the config are valid or not
Uh, It should be before I guess
maybe I should fallback to defaults or something since the values won't exist yet on canRegister
Yup, I was looking for that but it takes time on mobile xD

is there a way to use BukkitRunnable#runTaskLater at some method but while it is being counted down until its actual execution, to execute next part of the code that comes right after that BukkitRunnable?
thanks for the answer, that will be it
i just thought that it will wait for #runTaskLater to finish and after it is executed fully, then execute code that comes after it
very true and real ^
didn't liveoverflow purposefully leak his own ip?
yeah, looks like he did
no, there shouldn't be a packet for this
I am currently thinking about finnicking a solution to prevent PieRay (seeing tile entities in the F3 chart) and I am thinking about what I have to check for. Are tile entities sent via the chunk data packet or separately?
Looks like this: https://wiki.vg/Protocol#Block_Entity_Data
How can i execute one BukkitRunnable (#runTaskTimer) and after it is cancel(), to execute next one?
you can create a class that extends bukkitrunnable and on the cancel method, start a new task
should i try #runTaskTimerAsynchronously?
What do you want to do?
i want to repeatedly send bossbar for x seconds to user
when he does what i want, that task will cancel and i want to execute new one (when the first one has been cancelled)
you don't need an asynchronous task for that
the only cases where you really want things to be asynchronous is when
a) you are performing IO calls (file read/write or network ops, like database queries or HTTP requests etc)
b) you are performing some really heavy number crunching
sending a bossbar update every few seconds is neither of those, if anything it is just ever so slightly worse (not that it's anything noticeable either, but it is)
Why is it bad to run async?
probably to be on the safe side (as many things cannot be ran async)
And if it's not performance-intensive (emily mentioned 2 examples), there's little to no performance benefit
thread switching isnt free
and neither are threads themselves
the more work you do asynchronously the more work the scheduler has to do, which could require creating more threads for the pool (which has a very non-negligible performance impact)
plus yeah many issues can arise from doing lots of work async (race conditions, collection issues, etc)
any idea why this actually heals armor durability?? im kinda baffled
public static void damageArmor(Player player)
{
Random random = new Random();
for(ItemStack armor : player.getInventory().getArmorContents())
{
if(armor != null)
{
int unbreaking = armor.getEnchantmentLevel(Enchantment.DURABILITY);
float chanceOfDamaging = 1.0F / (unbreaking + 1.0F);
if(random.nextFloat() < chanceOfDamaging)
{
armor.setDurability((short) (armor.getDurability() - 1));
}
}
}
}
also i know get and set durability are deprecated
but i doubt they would still be that wrong
you need to increase the durability iirc
iirc durability is more like "health missing" not "health left"
horrible naming
nah horrible api xD
yeah
especially when in game tool tips show durability as something that decreases over time
thanks that fixed it by making it +1
what BM + plus you run the risk of things like thread exhausting, where there are more threads trying to actively run than the platform can handle, slowing things down further since now you have threads waiting for other threads to finish before they have a chance to run
async does not mean "performance"
deadlocks are quite a fun thing to run into and debug
public long getRemainingProtectionTime(Player player) {
long remainingTime = 15;
if (TownyWildTownEventListener.scheduledRemovalTimes.containsKey(player.getUniqueId())) {
Plugin plugin = Bukkit.getPluginManager().getPlugin(getPlugin());
assert plugin != null;
new BukkitRunnable() {
int remainingTime = 15;
@Override
public void run() {
this.remainingTime--;
if (remainingTime == 0) {
cancel();
} else {
player.sendMessage("You got " + remainingTime + "left");
}
}
}.runTaskTimer(plugin, 20, 20);
}
return remainingTime;
}```
For some reason my bossbar doesn't update the remainingTime
String bossBarText = PlaceholderAPI.setPlaceholders(player, String.valueOf(remainingTime));
bossBarText = bossBarText.replace("%townywild_countdown%", String.valueOf(remainingTime));
bossBarText = ChatColor.translateAlternateColorCodes('&', bossBarText);
double timeDecrease = (double) 0.1 / remainingTime;
double progress = ((double) scheduledRemovalTime);
System.out.println(progress + "%");
if (progress < 0) {
progress = 0;
} else if (progress > 1) {
progress = 1;
}
bossBar.setProgress((float) Math.max(0.0, bossBar.getProgress() - timeDecrease));
bossBar.setTitle(bossBarText);
if (remainingTime < 0) {
bossBar.removePlayer(player);
listener.remove(uuid);
Bukkit.getScheduler().cancelTask(taskId);
}```
text gives updates for player.sendMessage("You got " + remainingTime + "left"); but the bossbar stays at 15
anyone know of a java library for YAML that is similar (as close as can get) to bukkit/spigot's?
you can use snake yaml (the one bukkit uses) yourself lol
im trying but i miss the luxuries of simply using set(String, Object) 
unless im just using snake yaml wrong
🤢
:(
Doesn't Configurate support that?
@dark garnet
ooooo ty
Well just don’t synchronize/lock 🤓
There’s some platform agnostic port for the bukkit yaml api
But also yeah consider just not doing that
Object mapping >>>
so real
Hey, is it possible to make a GitHub repository with a password?
So some people can view it?
yes, it is called a private repository
and then you give access to each person individually
hm?
Like is it not possible to set a password for a git?
no
it kinda makes sense,
durability for items is hardcoded, damage is stored on the itemstack, quick comparison of itembasedurability - currentitemdamage.
What
well theres no reason to store the true durability in the nbt data of the itemstack
since its the same every time
how much damage the item has taken does change
i can see why setDurability is deprecated since its misleading
setDamage is much more descriptive of what it does
Well
Technically can I thinj
Can make an acc for that repo only 🙃
But there's no built in way
I currently have an invisible, invulnerable baby rabbit that a player has to hit, but I cannot find any event that actually gets triggered by the player punching the rabbit.
I've tried various interact events but none seem to do anything as long as it's invulnerable/invisible.
Tried my best to find a solution, so asking here as a last resort 
Try making it vulnerable and cancel entitydamagebyentityevent
I'll check that, but iirc when it was invisible it still didn't trigger the events
that worked
thank you a lot 👌
Np 👍
I misread the event, I thought this was EntityDamageEvent aswell, but this one is from the perspective of the hit entity

Hahaha yeah oke
Is possible to detect when the social interaction screen is opened?
Press P
can any1 help me i was making bal leaderboard with %vault_eco_top_player_1% %vault_eco_top_balance_1% and its not working can any1 tell me how to fix this
Umm. Wrong channel. #placeholder-api is the correct channel. Either way, those placeholders don't exist anymore. They were moved into the Essentials expansion.
then can you pls tell me essential command to create bal leaderboard
there's no essentials command to just 'create a leaderboard'
then how can i create bal top leaderboard
took me like 15 seconds to open this up.
you really could've done that yourself instead of trying to ask someone to spoonfeed you this information.
well blitz already said they were moved to essentials expansion
hardcoded?
im assuming to create a worldguard region i have to install the worldguard api?
not sure what you mean by install but you've got to import it into your project, yes
ok lol was just wondering if the worldedit api handled that but no sadly
🤔
worldguard and worldedit are seperate plugins
I don't know why
But you can use dev builds - https://ci.extendedclip.com/job/chatchat/
wait sorry
The thing is that I want to have the src of the plugin to customize it but it gives me a compilation error
Type-safe project accessors is an incubating feature.
Project accessors enabled, but root project name not explicitly set for 'build-logic'. Checking out the project in different folders will impact the generated code and implicitly the buildscript classpath, breaking caching.
> Task :api:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':api:compileJava'.
> invalid source release: 11```
did you do gradle shadowJar?
I'll see
or actually it seems like that build log also failed so probably not
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':api:compileJava'.
> invalid source release: 11
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 12m 13s
11 actionable tasks: 11 executed```
With `gradle shadowjar`
what java version do you have installed?
and what program are you running the command in?
Do you only have Java 8 or something installed? It's complaining about the Java version you are using to compile it.
gradle doesn't install jdks afaik
with reason
java 17.0.6 2023-01-17 LTS
Java(TM) SE Runtime Environment (build 17.0.6+9-LTS-190)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.6+9-LTS-190, mixed mode, sharing)
... xd
what if you do javac -version
no 17 is good
a
What if you do ./gradlew shadowJar
ah
If you're in Linux you might need to chmod +x gradlew
get a errror
.
you did it with the ./?
yes
Thank you
Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details
Type-safe project accessors is an incubating feature.
Project accessors enabled, but root project name not explicitly set for 'build-logic'. Checking out the project in different folders will impact the generated code and implicitly the buildscript classpath, breaking caching.
> Task :build-logic:compileKotlin
Could not perform incremental compilation: Could not connect to Kotlin compile daemon
Could not connect to kotlin daemon. Using fallback strategy.
warning: ATTENTION!
-XXLanguage:+DisableCompatibilityModeForNewInference
This mode is not recommended for production use,
as no stability/compatibility guarantees are given on
compiler or generated code. Use it at your own risk!
<=====--------> 40% CONFIGURING [7m 59s]
> :api
> IDLE
forget it sorry for the inconvenience using "git bash" with "./gradle shadowJar" worked, but thank you very much for taking your time to solve this problem ;)
https://bye.wtf/EDTJPdO6 (It's a screenshot)
thank you very much
Hi, is this the help server for the Stronger diamond swords mod?
I made a diamond sword and typed the command /diamondsword 10 and it only gave me 3 diamond swords instead of 9
how do you craft the diamond swords together? It doesnt work for me
i doubt it, this is HelpChat for PlaceholderAPI, and plugins from funnycube and clip
afaik this is not support of a mod like t hat
yeah, I crafted them

what do you mean? 😂
very common mistake here
what is
the author of that mod is actually maranthi so the plugin only recognizes item ids written in maranthi
so instead of diamond sword you'd write "हिरा तलवार"
yeah thats real funny man, minecraft is english not a chinese server 🤣
and why would i write in chinese if my game is made english Lol
yes that's why it is not working
what do you mean XD
i'm telling ya you need to call it हिरा तलवार
I try running the command /papi ecloud download skript and it says theres no skript expansion found anybody have an idea on this?
1.19.2 papi version 2.11.2
what do I need to call that
and why
you need to replace diamond sword in your command with that
the mod is supposed to give you diamond swords or make your one holded stronger
if you write /diamondsword 10 it gives 10-amount of swords in inventory
10 diamond swords is a lot of diamond swords
what are you doing with 10 diamond swords
if you add a my word at the end it will add strength to the current one
i need this to make stronger kits for my server
but its not working
sure but why will it not work
beats me this isn't the help discord for that mod
i suspect that not a single person here has heard of it
considering it doesnt even come up in a google search
Lol it is the most popular mod on forge
first result https://www.curseforge.com/minecraft/mc-mods/mo-creatures#:~:text=Mo'%20Creatures%20is%20a%20mod,clicking%20the%20wiki%20link%20above.
over 7 mill downloads
that looks a lot like a mod that has nothing to do with diamond swords
uhh, have you ever used the mo creatures mod?
it is everything
yesterday it all worked fine and things are good now i switch to cauldron things break I need to use plugins on my server because there is no other way to make my players use things like fly and kit
and i need kit
if it had everything it should have a feature to teach you how to use the command correctly
thats why they created this server
well i guess if it did have everything it would also have this server
there are to many things in the mod lol
that adds up
what is subtraction if not addition but backwards
did you know the word addition reversed makes subtraction
will you pay me for my time
why?
nah i'll take some btc or xmr tho
i'll take $10 for my time
you didnt even do anytihng
i will
haha you are just trying to mess around with me right
I got news I dealt with you are not different
feel free to send the money and i can make you as many diamond swords as you'd like
837qe5doGT1QLnr16qVD5jNx72HFX5LU7LAaFw46Tjj2QstzbSHrUGBfvWFVFjmPf19EYN8b3ULtRZxWe49BVHeQ7G1ayGB
spamming ^
yes spam that address with money
im good 😄
then no diamond sword for u
what was your problem
Bruh some dude uses not-paper server software and wonders why nothing works
Uhh im using fabric, why is my server lagging and not being able to hold 20 players
Get real
rain particles are client side right?
I mean, i cannot use protocol lib for example to interecept rain particles and change it for other particle
(dumb question, but still)
yes
no, this server has no association with that mod
also thats not chinese
thats goan konkani according to google translate, i thought it was hindi at first
rain particles are clientside, yes, but the server tells the client that it is raining
so you have the option to not send that, and instead send your own custom particles
afaik rain isnt particles, they are a cascading texture or something
that seems right because they dont move like normal particles
actually i dont think youll need protocollib at all
you can use a WeatherChangeEvent, then use player.setWeather
@EventHandler
public void onRain(WeatherChangeEvent event)
{
for(Player player: Bukkit.getOnlinePlayers())
{
//if event is rain
// player.setPlayerWeather(WeatherType.CLEAR);
// add them to a list of people to send particles to
// else if event is clear
// remove from list
}
}
bad code but you get the idea
rain is a texture, but there are particles that spawn on the floor but im not sure if they are hardcoded or not
yeah they are
i mean maybe the texture isnt
but the server isn't sending thousands of particle packets
when in the desert, you can't see anything happening in other biomes
so it must make those particles clientside
but making it look like other particle would require getting player location and spawning the particles randomly around the player right?
yes
Any reason windows command prompt shouldn't be displaying colors?
System.out.println("\033[36mcyan\033[0m"); -> ←[36mcyan←[0m
I've also tried "\u001b[36mcyan\u001b[0m", "\u033[36mcyan\u033[0m"
what does the second one look like when printed?
System.out.println("\033[36mcyan\033[0m"); -> ←[36mcyan←[0m
System.out.println("\u001b[36mcyan\u001b[0m"); -> ←[36mcyan←[0m
System.out.println("\\u033[36mcyan\\u033[0m"); -> \u033[36mcyan\u033[0m
that looks like its printing out unicode characters rather then colors
uhhhhh
fabric is a well known and used mod loader
think forge but better
I want to track to know if a player has accepted a provided resource pack. Is there a way to do this through code? I want to display a GUI after they have accepted the pack.
thanks
how can I tell if they have accepted it on a prior join, and it automatically loaded?
I'm confused on what needs to be done here:
@EventHandler
public void ExitTownBorder(PlayerExitsFromTownBorderEvent event) {
// Gets a player's UUID.
UUID uuid = event.getPlayer().getUniqueId();
System.out.println("Player just exited the town border");
// Adds a player's UUID to the protectedPlayers list when exiting a town.
protectedPlayers.add(event.getPlayer().getUniqueId());
Bukkit.getScheduler().runTaskTimer(plugin, (Runnable) protectionTimeLeft, 0, 20);
System.out.println(protectionTimeLeft + " seconds left of protection");
System.out.println("protectedPlayers after adding player: " + protectedPlayers);
}```
This part specifically:
```java
protectedPlayers.add(event.getPlayer().getUniqueId());
Bukkit.getScheduler().runTaskTimer(plugin, (Runnable) protectionTimeLeft, 0, 20);```
This is what I did:
```java
package com.agaloth.townywild.tasks;
import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.UUID;
import static com.agaloth.townywild.listeners.TownyWildTownEventListener.protectedPlayers;
import static com.agaloth.townywild.listeners.TownyWildTownEventListener.protectionTimeLeft;
public class RemoveProtectedPlayerTask implements Runnable {
private final UUID uuid;
public RemoveProtectedPlayerTask(UUID uuid) {
this.uuid = uuid;
}
public void protectionTimeLeft() {
if (protectionTimeLeft.containsKey(uuid)) {
Plugin plugin = Bukkit.getPluginManager().getPlugin(this.toString());
assert plugin != null;
new BukkitRunnable() {
int remainingTime = 15;
public void updateProtectionTime() {
protectedPlayers.add(uuid);
this.remainingTime--;
if (remainingTime < 0) {
protectedPlayers.remove(uuid);
cancel();
}
}
@Override
public void run() {
updateProtectionTime();
}
}.runTaskTimer(plugin, 20, 20);
}
protectionTimeLeft.getOrDefault(uuid, 0);
}
@Override
public void run() {
protectionTimeLeft();
}
}```
Adding protectionTimeLeft would cause a ClassCastException since protectionTimeLeft is a HashMap in TownyWildTownEventListener but I want to take the protectionTimeLeft from RemoveProtectedPlayerTask and adding updateProtectionTime won't work (since it can't find it?) (Players never end up getting deleted from the protectedPlayers map after the countdown is over)
For information: ``if (protectionTimeLeft.containsKey(uuid)) {`` uses ``public static Map<UUID, Integer> protectionTimeLeft = new HashMap<>();`` from TownyWildTownEventListener
Maybe by checking if the state changes to accepted through the process? Depends on if it also changes to that without redownloading
Tried everything. Any ideas?
does anyone know off hand - if calling player.damage(dmg, null) will invoke the EntityDamageEvent with event.getCause() == null?
no, apparently its not nullable
then my question is what happens to the damage cause
would it be possible to create something with worldguard where if the player lands on a block outside of their region they're teleported back to their region?
you mean, if theyre flying, or jumping in the air? then land on solid ground outside the region, they get teleported back?
you'd need to store a history of their last touched spot using onGround (probably deprecated) and then when they touch again, see if theyre within the desired region. If not, teleport them back to their last touched spot inside the region
Everything is possible if you are brave enough
figured it out - DamageCause.CUSTOM
is player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() != Material.AIR) the best way to check if the player is on the ground since the isOnGround() method is deprecated.
uh no that would be the worst tbh
idk the context but I'd consider it safe to use isOnGround
assuming the server has an anticheat
in the vast majority of cases it'll probably be fine
and plus the first check would fail 10000x more than isOnGround anyways
afaik
yeah you can stand on the edge of a block and the block beneath you will be air lol
or like standing on a bottom slab that's got nothing underneath it etc
if you didnt want to use isOnGround couldnt you also just use a raycast that is the width of the player? that would account for the standing on edge.
and then you would just make the raycast a length of 1 block
idk, just a thought. not sure how isOnGround works, for all I know it could use a raycast
Sorry if this is a stupid question but i'm trying to create an inventory gui item that when clicked cycles through different selections in the lore:
Toggle Scoreboard Color (Red)
» Red
Blue
Orange
I'm not sure how to get this working so if anyone can help that would be greatly appreciated (ping ok)
no
please dont
All the ways this will fail:
- A player can stand on the edge of a block
- The player can stand on a shulker entity
- The player can stand on a boat entity
- The player is in cave air
- onGround occurs with YXZ movement order, so a player can be in midair while still being on the ground for one tick
and much more but it's a terrible idea
yeah, standing on a slab
on a 1.8 client, hitting the ground while activating stepping movement so you hit the ground but stop mid-air vertically above the ground
allowing onGround stuff while in water, lava, non-full blocks, etc.
I update a variable outside of a Runnable but I can't use new value of the variable at runnable :/
I work on a KeyVault plugin and I've previously stored the amount of keys using NBT inside the vault item, now I was thinking to use sqlite for storage and the schema looks like this
CREATE TABLE IF NOT EXISTS `vault`
(
id INTEGER PRIMARY KEY,
uuid VARCHAR(36) NOT NULL
);
CREATE TABLE IF NOT EXISTS `key`
(
id INTEGER PRIMARY KEY,
vault_id INTEGER NOT NULL,
name VARCHAR(32) NOT NULL,
amount INTEGER NOT NULL,
FOREIGN KEY (vault_id) REFERENCES vault (id)
);```
The players might get certain type of keys quite often (maybe 1 every second for the low level ones), is it ok if I update the data on database every time?
I will keep an in-memory cache as well for online players, so I won't constantly query the database for the data to update the key vault item visually (to display how many keys are stored inside).
yeah it's fine
i've got a problem with my plugin, i can't find any errors or anything bad in my plugin atm but for some reason every time the plugin tries to load it fails. no errors other than [14:44:11 ERROR]: Could not load 'plugins/KitEditor-1.0.4.jar' in folder 'plugins'
or sometimes it just enables and then immedaitely disables.
i'm about to send the code.
https://paste.helpch.at/tixugoreha.typescript
https://paste.helpch.at/ligefozise.typescript
https://paste.helpch.at/vocixojeyi.java
https://paste.helpch.at/ewafuwawik.typescript
https://paste.helpch.at/ivufoyuxam.typescript
https://paste.helpch.at/tugirenutu.java
https://paste.helpch.at/avuzexacis.java
cool, why not just send in the whole project at this point
(weird how there are no error messages though, usually there's an obvious error message telling why it did not enable)
lol
^
that's literally all of the classes.
I'm joking obviously
you could at least put it all in one paste, not 30 different ones
oh i thought there was a char limit
anyways, any ideas on why this is happening?
any NPE's?
well, remove everything from onEnable and go from there
though
what's this
@Override
public void onEnable() {
Bukkit.getPluginManager().registerEvents((Listener) this, this);
getCommand("editkits").setExecutor(new KitSelectGUI());
getCommand("adddefaultkit").setExecutor(new KitEditorCommand());
kitSelectGUI = new KitSelectGUI();
kitSelectGUI.createInventories();
}
Bukkit.getPluginManager().registerEvents((Listener) this, this);
you're casting main class which is not a listener and registering it
that's your issue
Huh.... So https://wiki.vg/Protocol says the Login Start packet should be Name, Has Player UUID, Player UUID
But I am getting an output that contains the server IP then my username as well as some other data.
The packetsize alone should be more then 16... UUID -> 16, String -> 16, Boolean -> 1
And if I attempt login again the data past the username is removed
the only packet that sends the IP is the handshaking start
so you must not be reading it properly
nevermind, same error
doesn't load at all.
the version is correct (i double checked like three times already)
package me.defusemc.kiteditor;
import org.bukkit.Bukkit;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin implements Listener {
KitSelectGUI kitSelectGUI;
@Override
public void onEnable() {
Bukkit.getPluginManager().registerEvents(this, this);
getCommand("editkits").setExecutor(new KitSelectGUI());
getCommand("adddefaultkit").setExecutor(new KitEditorCommand());
kitSelectGUI = new KitSelectGUI();
kitSelectGUI.createInventories();
}
}
sigh It sends the Handshake and the LoginResponse in the same packet.
why are you registering the Main class as a Listener if it does not have any handlers
also try to use something different than Main, ex. KitsPlugin or something like that
does your plugin.yml have editkits and adddefaultkit defined as commands?
It does.
Now its just the UUID giving me problems lol
yeah, they are defined there
you said it's not a listener so i made it a listener lol
when I remove the listener implementation then it gives me a error:
'registerEvents(org.bukkit.event.Listener, org.bukkit.plugin.Plugin)' in 'org.bukkit.plugin.PluginManager' cannot be applied to '(me.defusemc.kiteditor.Main, me.defusemc.kiteditor.Main)'
it quite literally does not
you're decoding something wrong
they are 100% sent as distinct packets
Yes they are separate. I didn't explain it right. I can read both of there data in succession is what I meant. I thought it would have something between the packets.
Also the way I read the packets was a factor in this. So all data comes in at once.
Anyway I got it to work 😄
Uh yeah no that’s not how sockets work lol
looking forward to your standalone packet framework
technically speaking, the size of second packet is between the packets
now it does
Let me explain it like this then...
When you click login, on DataInputStream I can read both the handshake and the loginstart.
so you can do real fun stuff like sending one packet but it actually having two packets
nice server set up
indeed you can
thanks
maybe, the splitter might get angry at you
Yeah I thought originally it would be separated by something lol
now that you mentioned it,
im gonna look at the legacy code of mc for the third time
might as well make my own packet framework to mess with
the best packet framework would be to copy packetevents 2.0 and rewrite everything except the injector (Injectors suck.) and wrappers
what the fuck is the Varint21FrameDecoder decoder doing
wouldn't this only loop once
oh wait nevermind, i'm stupid
It's letting you send a 21 bit number
so max packet size is 2097152 bytes
yep
any ideas?
package me.defusemc.kiteditor;
import org.bukkit.Bukkit;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin implements Listener {
KitSelectGUI kitSelectGUI;
@Override
public void onEnable() {
Bukkit.getPluginManager().registerEvents(this, this);
getCommand("editkits").setExecutor(new KitSelectGUI());
getCommand("adddefaultkit").setExecutor(new KitEditorCommand());
kitSelectGUI = new KitSelectGUI();
kitSelectGUI.createInventories();
}
}```
give that full error
probably something wrong with your plugin.yml
that's literally the only error LOL
name: KitEditor
version: '${project.version}'
main: me.defusemc.kiteditor.Main
api-version: 1.19
authors: [ Axecy ]
description: Used for the FFA @ DefuseMC
website: dsc.gg/defuse
commands:
editkits:
description: Opens kit editor menu.
adddefaultkit:
description: Sets the default kit for a specific kit.
normally there are descriptions ensuing the "could not load plugin in folder"
and we need that to check the issue
right not descriptions but error stack trace
still kind of descriptions i guess
[16:35:08 INFO]: Closing Thread Pool
[16:35:17 INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD'
[16:35:17 INFO]: Reloading ResourceManager: Default, bukkit
[16:35:18 INFO]: Loaded 7 recipes
[16:35:20 INFO]: Starting minecraft server version 1.17.1
[16:35:20 INFO]: Loading properties
[16:35:20 INFO]: This server is running Paper version git-Paper-411 (MC: 1.17.1) (Implementing API version 1.17.1-R0.1-SNAPSHOT) (Git: 6625db3 on ver/1.17.1)
[16:35:20 INFO]: Using 4 threads for Netty based IO
[16:35:20 INFO]: Server Ping Player Sample Count: 12
[16:35:20 INFO]: Default game type: SURVIVAL
[16:35:20 INFO]: Generating keypair
[16:35:20 INFO]: Starting Minecraft server on 0.0.0.0:25659
[16:35:21 INFO]: Using epoll channel type
[16:35:21 INFO]: Paper: Using libdeflate (Linux x86_64) compression from Velocity.
[16:35:21 INFO]: Paper: Using OpenSSL 1.1.x (Linux x86_64) cipher from Velocity.
[16:35:21 ERROR]: Could not load 'plugins/KitEditor-1.0.4.jar' in folder 'plugins'
[16:35:22 WARN]: [ViaVersion] Blocked protocol version 1.9/107 already covered by upper or lower bound
[16:35:22 WARN]: [ViaVersion] Blocked protocol version 1.12.1/338 already covered by upper or lower bound
[16:35:22 WARN]: [ViaVersion] Blocked protocol version 1.9.2/109 already covered by upper or lower bound
[16:35:22 WARN]: [ViaVersion] Blocked protocol version 1.7-1.7.5/4 already covered by upper or lower bound
nothing.
there is nothing else related to the plugin
[16:35:38 ERROR]: [STDERR] [org.bukkit.craftbukkit.v1_17_R1.legacy.CraftLegacy] Initializing Legacy Material Support. Unless you have legacy plugins and/or data this is a bug!
thats very weird
just wondering, whats the issue here
probably paper loads plugin async and error gets covered
Is it because I should have it implementing listener and then changing the @override to a eventhandler or something by any chance?
try adding pair of ' '
for all the descrptions
i doubt that would change anything
nvm valid yaml

💯