#help-development
1 messages · Page 2251 of 1
You are not. Its not something you cant do because of intelligence but because of knowledge. Big difference.
and well um... the unwillingness to learn that knowledge
7smile7 out here with the wise words
For a circle its even simpler because spigot already has methods that let you rotate a vector around an axis.
i feel like going from 2d to 3d i know absolutely nothing
2d is like 3d but you multiply height for 3d
stuff like this u just copy paste from google my friend
even if u know how to do it i cant be bothered to
public List<Location> horizontalCircleAround(Location center, double radius, int points) {
List<Location> locations = new ArrayList<>();
Vector cursor = new Vector(radius, 0, 0);
double deltaPhi = (2 * Math.PI) / points;
for (int i = 0; i < points; i++) {
locations.add(center.clone().add(cursor));
cursor = cursor.rotateAroundY(deltaPhi);
}
return locations;
}
What do I use instead of ChatComponentText in 1.19
Look at this package:
https://nms.screamingsandals.org/1.19/net/minecraft/network/chat/index.html
Thanks
FormattedText.of()
yeah this doesn't work
Okay so I'm making a plugin right now about Ranks, and I need help about the permission part.
I wanna use "parents", and the problem is idk how to loop thru the ranks untill the rank has no parent.
Component.literal()
Is this what you want??
java.util.UnknownFormatConversionException: Conversion = '%'
huh? it breaks my AsyncPlayerChatEvent listener
Hello I have a question for the performances
Is looking at a player’s coordinates all the time really advisable ?
Depends on what you're making
I want to see if any players are approaching the coordinates on their teleport
Then yeah you will have to track player movement
You can minimize lag by only tracking players in a specific world and using the scheduler instead of a movement listener
But I should still put it in an event, right?
Okay thank u ❤️
im trying to find something to replace this from what I used in 1.18.2
new ChatComponentText(this.d().a())
Yeah Component.literal would be that in 1.19 mojmaps
hmm because thats not showing up as like an option
no just spigot
Then add mojmaps to the project
yeah whats the repo?
thanks
Replace 1.18.2 with 1.19 and update special source to 1.2.4
What is the best way to add or remove a permission from a player ?
You can use Vault
Wdym ?
🙏 thanks
Hi, what is the updated way to check if an ItemStack is dye and get the DyeColor for that dye? Don't want a massive switch statement checking all 16 dyes
You're gonna have to use the switch statement
Else you can create a Map but tbh, the switch statement might actually be faster lol
Hello, how could I make my tab completer have online players? java public class GamemodeSurvival implements TabExecutor { private static final String[] COMMANDS = {"players"};
is there no replacement for the MaterialData Dye?
No because they're all separate materials now
I saw..
You can return null in the tab completer and it will default to player name tab completion
How may I return null?
public static DyeColor getDyeColor(ItemStack itemStack) {
return switch (itemStack.getType()) {
CASE RED_DYE -> DyeColor.RED;
CASE BLACK_DYE -> DyeColor.BLACK;
// etc.
default -> return null;
}
}```
Just a good ole static util method is good enough
private static final String[] COMMANDS = null; just this?
why is it static?
No. In your onTabComplete()
because it's a utility method
mb thought it was public for a second
and this'll be good for checking right? item.getType().toString().endsWith("_DYE")
I mean... I'd avoid it
ok, util it is
It's like 20 lines of code ;p It's really not bad
I'm surprised there is no DYE tag
Sorry, I'm still very confused with the null thing. I currently have java @Override public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) { return null; }
I appear to get this on startup: [15:53:39 ERROR]: Error occurred while enabling RaidTheMine-Core v1.0 (Is it up to date?) java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "com.jordanhaddrick.rtm.Main.getCommand(String)" is null at com.jordanhaddrick.rtm.Main.onEnable(Main.java:23) ~[RaidTheMine-Core.jar:?] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:536) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?] at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugin(CraftServer.java:561) ~[paper-1.19.jar:git-Paper-39] at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugins(CraftServer.java:475) ~[paper-1.19.jar:git-Paper-39] at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:633) ~[paper-1.19.jar:git-Paper-39] at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:419) ~[paper-1.19.jar:git-Paper-39] at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:306) ~[paper-1.19.jar:git-Paper-39] at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1121) ~[paper-1.19.jar:git-Paper-39] at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:302) ~[paper-1.19.jar:git-Paper-39] at java.lang.Thread.run(Thread.java:833) ~[?:?]
My main.java has this: java getCommand("gms").setExecutor(new GamemodeSurvival(this));
Full code: https://paste.pythondiscord.com/acebamotut
Thank you, that worked haha
Block block = event.getClickedBlock();
if (block == null || !block.getType().equals(Material.CAULDRON)) return;
Levelled cauldron = (Levelled)block.getBlockData();
getting CraftBlockData cannot be cast to class Levelled anyone know why?
Surely it should be able to be cast since Levelled extends BlockData
If I did Mob mob = (Mob) event.getRightClicked(); How would I get the whole Mob type based off of event.getRightClicked() off of PlayerInteractEntityEvent instead of just that specifically clicked Mob
What do you mean by "whole Mob type"?
You can get the type of an entity by calling
EntityType type = entity.getType();
A cauldron has no level until it contains something.
At that point it is either of type WATER_CAULDRON or LAVA_CAULDRON
Why won't my PlayerInteractEntityEvent ever fire
When do you expect the event to fire?
When they right click an entity
Did you forget to register the listener?
I'm going to kill myself
Dont. Thats a classic one.
It's fun
Looking for some advice, so: I have a resource web server that has all the resource packs that my plugins use, this server when requested will combine all of the resource packs needed for a server given the plugins that are installed. Each player has their resource pack set through Player#setResourcePack where the url is the one that will return the combined resource pack, however if I make changes to any of the packs it won't update without deleting server-resource-packs. How would I either: get the sha1 from the resource server to pass into the method, or, generate a sha1 within the plugin for the resource pack sent?
Been there. My solution was to create a folder with the current unix timestamp as a name (1656715872 for example) every time when the server starts.
And assemble the resourcepack in there.
This however means that the user will have to download a new resourcepack after each restart.
this was the thing I didn't want to do
How could I check a player's gamemode?
Me neither. But for some reason the hash just wouldnt be enough to force an invalidation....
Player#getGameMode()
so even if I sent another web request to the web server to get the sha1 and pass that into the method it could still not be enough?
For me it wasnt.
mobbystick.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&6Mob Stick"));
mobbystick.addEnchant(Enchantment.PROTECTION_FALL, 1, true);
mobbystick.addItemFlags(ItemFlag.HIDE_ENCHANTS);
mobstick.setItemMeta(mobbystick);
player.getInventory().addItem(mobstick);
So I created an item meta for a Mob Stick that I need to use but whenever I check in my Listener, I use if (item == mobstick) and it never works even though that's the item I'm holding. (The variable item is the item in Player's main hand that's already working). How would I get it to work or how would I check to see if it's the mob stick?
But that was back then for 1.16
Console prints this
ItemStack{BLAZE_ROD x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name=º6Mob Stick, enchants={PROTECTION_FALL=1}, ItemFlags=[HIDE_ENCHANTS]}}
the hash should be generated on the resource server, then held in a file within the pack & available from the zip directory
so like packs/yourpack.zip & packs/yourpack.sha1
== checks for identity (if they have the exact same memory address)
You should never use it unless you are comparing primitives or Enums.
Also: For custom ItemStacks always use the PersistentDataContainer of the ItemStack
?pdc
and 7smile, are you positive the hashes were different?
if the hash is the same it'll use the old version
never tested it myself but just seems illogical
I just remember that for some reason the client wouldnt want the new resourcepack even when i made changes
and recalculated the hash. But that was 2 years ago and i only had like 6 months of programming experience so who knows.
ah interesting
^ FYI, using == for enums is fine because their memory addresses are linked to their ordinal() position, so == automatically checks one.ordinal() == two.ordinal()
storing the sha1 in the .zip, how would I access that sha1 without complicating the plugin side?
This is my current plugin-side:
String resources = ResourceManager.getResources();
player.setResourcePack("http://ADDRESS/spigot-resource-combine?resources=" + resources, null, true);
ZIP files are openeable via code, rar are not
well no, I wouldn't advise unpacking the zip for the hash
that was just for the client incase they wanted to compare, but on second thought you can't really calculate a hash of the zip without adding the file, but then you can't ad dthe hash
I dont get why you would need a hash file... why cant you just lazily calculate it once on the first request?
I wonder if it's possible to make a function that predicts its own hash
sure, but then the server needs to download the zip & calculate for each combination
hashes are unpredictable, that is the whole point of a hash
Like I always imagined a class that could have unbreakable DRM because it would store its own hash and compare it
Maybe it is the servers job to calculate the hash
and it’s only once on load
it’s really up to you how you want to design it
Only makes sense if you provide the web server yourself... thats what i did. The plugin had the resourcepack sources in it.
Then on startup it assembled a resourcepack, started a web server and provided it.
interesting, not sure if putting the resource packs in the plugin is great since that means a new plugin version is needed for every resource pack change
That was not a real problem really. The resourcepack was tightly coupled with the code. We had compile time checks for the resourcepack.
ic
This allowed for dynamic texture generation. We had every single texture as a font character as well.
Man i miss some of the stuff i made back then. Was really pushing what you could do without mods...
I have a hologram using armorstands, but I need to make a part change each second. Do I remove the hologram and then replace it or can I rename it?
Also 7smile7 thats sick
i have a boss plugin and i want to make player death message display boss name instead of entity name when boss kills him
in the player Death event i can't get the entity who killed the player that's the issue
Ok, here is my solution. The resource web server keeps a cache of the combined resource pack buffers and another cache for the sha1's, a sha1 will be generated using the buffer if it is not in the cache. The manager plugin then makes a request to the web server, which sends the sha1 as base64, this then gets decoded and passed into the Player#setResourcePack method.
String resources = ResourceManager.getResources();
String packUrl = "http://ADDRESS/spigot-resource-combine?resources=" + resources;
byte[] sha1 = null;
try {
URL url = new URL(packUrl + "&sha1=true");
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.setRequestMethod("GET");
int status = connection.getResponseCode();
if (status < 300) {
BufferedReader receive = new BufferedReader(new InputStreamReader(connection.getInputStream()));
sha1 = Base64Coder.decode(receive.readLine());
receive.close();
}
connection.disconnect();
} catch (Exception err) {
err.printStackTrace();
}
player.setResourcePack(packUrl, sha1, true);
It does work in getting the client to download a new version of the resourcepack, however it doesn't then load that new pack unless the player rejoins.
It sends this request for every player since the resourcepacks might have changed (though this does mean current players may have different packs but I don't think this matters since new content cannot be added without a server restart)
how do i like:
if the player has cobblestones in his hand;
they extend to inventory soo
really?
due to how client handles them
oh
for example cartography table cant be renamed iirc
doesn't seem to work for me on 1.19
nvm
it works
oh boy
how this one thing
will change my api for good
i thought some GUIS are not renameable just because they are not renameable via the anvil
it seems all inventories are renameable except client ones (player, crafting player, etc.)
Man I was trying to build something which doesnt exist
🤨
🤦
thats what I did too in the first place
and I wasted 7 days of building proper api wrapping around this nonsense
for no reason
🙃 🙃 🙃 🙃
if (sender instanceof Player) {
Player player = (Player) sender;
Player target = player.getServer().getPlayer(args[0]);
if(player.hasPermission("convoca.use"));
if (args.length == 1) {
player.sendTitle("§9Sei atteso in questura....");
}
}else {
sender.sendMessage("§Non sei un giocatore!");
}
return true;
}
}
not work player.sendTitle("§Sei atteso in questura....");
why?
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
this
I just want the title, not even the sub etc. Which one should I use?
Player#sendTitle(String title, String subtitle, int fadeIn, int stay, int fadeOut)
Player#sendTitle(String title, String subtitle)
pain
fun
I mean you only register it once so it would be fine to stream through all Materials and map, filter them to only those containing "DYE"
_DYE
I thought I needed to register a recipe to fix my issue but it hasn't seemed to have fixed it, will take a look again tomorrow
oh yea
did you shit the bed 7smile7?
Ye
I am not familiar with this saying... Du Schlawiener
I was the bed
its 3:30am where you are. I assume you did something nasty in teh bed to make you get up at this time.
Can confirm
I studied all day because i got exams in a week. My sleeping schedule is preparing for my semester break afterwards.
Time has no meaning there.
Damn right, I am in the twilight zone rn
Red firework particles?
how would you even make it red though
spawn a red firework ezpz
uh
Make it red
So, I am suspicious of a player using a server crashing method
Anytime he'd join these errors started showing up
and eventually, the server would crash
Now that I already banned him
no more errors
am i allowed to ask plugin development related questions here?
because I'm very lost currently
I just needed to recompile an old plugin for my server and I'm getting a guava related error it seems
?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. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
well I didn't know if it had to be explicitly spigot related
anyways
this is the line i'm having trouble with:
this.brokenBlocks = (Multimap<String, Location>)ArrayListMultimap.create();
and this is the error I'm getting:
Cannot cast from ArrayListMultimap<Object,Object> to Multimap<String,Location>
here's the whole java file if needed
So this is decompiled code?
well it was open source at one point
the guy deleted his github though, and I couldn't find the source
the plugin's from 2014, but still works
so that's why I'm using it
I'm quite new to java, how would I make java sender.sendMessage(MiniMessage.miniMessage().deserialize(prefix_message + ' ' + gms_other, Placeholder.component("player", Component.text(target)))); target work here?
It's supposed to be a string, but I just need target there.
It has to be a decompiler error. I see no reason its trying to cast an ArrayListMultimap to a MultiMap
damn
Just try java this.brokenBlocks = ArrayListMultimap.create();
it shoudl not need any cast
every coding community is so sweet man
and this is also a reminder to go and atleast give a hug or a kiss for the people u care about ❤️
No idea which coding communities you've been looking at. But its mostly just sarcasm, nihilism, god complexes and coffee.
yeah in spite of the trait of nitpickiness programmers usually possess
is there a way with recent versions of BungeeCord and VersionConnector to get multiple clients to route to appropriately versioned servers?
is it possible to run particles along a raytrace
the whole premise of this server is helping others which i see is quiet nice, but im still new so i've not seen the bad side :0
You can march the ray along by stacking up small vectors
any public discussions about doing this you are aware of?
I can give you a kick start
that'd help
public List<Location> march(Location location, Vector direction, double distance, double delta) {
List<Location> path = new ArrayList<>();
direction.normalize().multiply(delta);
int steps = (int) (distance / delta);
for(int i = 0; i < steps; i++) {
path.add(location.add(direction).clone());
}
return path;
}
With this you can specify a location, a direction, how far you want to march and which distance
you want to have between each step.
sick dude, thanks alot 😄
This however does not stop when a block or entity is hit.
Do you need that? Because then you would have to do small ray traces between each point.
I do want that
To be honest i would actually just ray trace from A to B, get the distance and direction between those two points
and then use the method above to draw a line between them.
This should actually do it
public List<Location> march(Location location, Vector direction, double distance, double delta) {
List<Location> path = new ArrayList<>();
direction.normalize().multiply(delta);
int steps = (int) (distance / delta);
for(int i = 0; i < steps; i++) {
path.add(location.add(direction).clone());
}
return path;
}
public List<Location> marchTrace(Location location, Vector direction, double maxDistance, double delta, RayTraceResult rayTrace) {
if(rayTrace == null) {
return march(location, direction, maxDistance, delta);
}
Vector hitVec = rayTrace.getHitPosition();
double hitDistance = hitVec.subtract(location.toVector()).length();
return march(location, direction, hitDistance, delta);
}
You just need to decide what to do with null ray traces. Either march to max or do nothing.
sick dude thanks so much for the help this makes things infinitely easier
How do I make a Vector "point/aim" to a location?
Assuming you have two locations A and B, then you can define a vector from A->B by
subtracting A from B.
So
B.subtract(A)
Location base = ...;
Location target = ...;
Vector direction = target.toVector().subtract(base.toVector());
is this the place where i can commission a plugin?
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
No, forum is safest
its a pretty simple plugin
there is a record of what you do
also
do plugins need to be custom made for say a papermc server or other types of servers
hi :), im trying to do a bot in discord to automatizate my server on and off, there is any easy whay of tipping in the console? Srry for my english
and also, tp, kick, etc...
Depends how hard a fork it is and what you want.
how difficult would it be to make a plugin that adds a /rotation command that functions exactly the same as /tp, just without the coordinates bit
very simple
im tryna make a vanilla recoil system and mf /tp creates so many issues when im just tryna use it to change rotation
if someone helps me for free, to code the plugin, i will donate them cash
but I also quite didnt understand wym by this:
just without the coordinates bit
so like
you would be able to do
/rotation @p facing entity @r feet
like that
or /rotation @p 0 90
ya know
I think there are enough people which would help you not for money
the only requirement is basic Java
cuz im not making 20 posts and waiting a week on the forum just for tthis basic plugin
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
AAAAAAAAAAAAAAA
^
cope
squid
didnt know this cmd exist
do you know "basic java"
yea
do you know basic java?
yea thats the actual question
Also I like how he said do it for free and donate you cash in the same sentence
like its not completely contrary
lmao
How could I get a player's max health into a variable?
double maxHealth = player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue();
public void setFacing(Player player, Location target) {
Location loc = player.getLocation();
Vector direction = target.toVector().subtract(loc.toVector());
loc.setDirection(direction);
player.teleport(loc);
}```
you might as well be talking to me in italian
give that to whoever you get to write your plugin
it will make a Player face teh location you provide
Yep, the command is the easy bit
The code I just gave you is where most devs will get stuck
oh
math is hard
hey @ancient plank
How could use an if check to determine if a player's flight is enabled/disabled?
Player#getAllowFlight
Thank you very much!
hey guys
hi :D
what are you trying to do
event.setFormat
from ASyncChatEvent
now i even went maniac mode after 2 hours and decomplied half of the plugins on spigot
and they didnt do anything different from mine
paper ig?
i guess
no i use normal spigot
not a fork out of spigot
i tested other plugin
and it worked
there is no ASyncChatEvent in spigot
only AsyncPlayerChatEvent
AsyncPlayerChatEvent is deprecated in Paper, bc you should use AsyncChatEvent
oh i cant send pictures
np I saw it
so
yeah you use Asyncplayerchatevent, but said AsyncChatEvent
i need to implement a library?
there is a difference
the other event doesnt exist in Spigot
so you dont need to care about it
but I thought that you use Paper instead of Spigot bc you said you use AsyncChatEvent which only exists in Paper
whats happening and what should happen
?paste your code
it should be the format
💀 💀 💀 💀
gg
but ill test it now
i spend on it
so many hours
so many
i decomplie so many resources to see how they done it
and it was the saem
like
.
oof that hurts
ofcourse Ntdi
"ofcourse"
the thing in the same class i have more 20 listeners + -
but forgot EventHandler 👀
the rest did work
it really depends on what i do sometimes i put all of them in a single class
some times in sperate
but i dont go all in into mainclass
lol
I always make a new class for each listener, but sometimes 2-3
never used 20 in one class
idk whats the problem of doing it
reminds me of using if else for each of ur commands in the same class
it’s just messy and hard to maintain
yea lmao
just do control+F
kinda frowned apon in spigot
and find quickly what i need
okay bro
like i know eyes will hurt
but all the 20 events have a common goal
beside the chat events
commandexecutor --> gets called correctly but the item frame doesn't gets deleted
public class ConfirmDeletePosterCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
World world = sender.getServer().getWorld(args[3]);
Location location = new Location(world, Double.parseDouble(args[0]), Double.parseDouble(args[1]), Double.parseDouble(args[2]));
Collection<Entity> entities = world.getNearbyEntities(location, 0,0,0);
for (Entity entity : entities) {
if (entity instanceof ItemFrame) {
entity.remove();
}
}
return true;
}
}
itemframe break listener --> only possible problem
public class PosterBreake implements Listener {
@EventHandler
public void blockBreak(HangingBreakEvent e) {
if (e.getCause() == HangingBreakEvent.RemoveCause.DEFAULT) { return; }
e.setCancelled(true);
Entity entity = e.getEntity();
Location location = entity.getLocation();
Collection<Entity> entities = location.getWorld().getNearbyEntities(location, 10, 10, 10);
for (Entity nearbyEntity : entities) {
if (nearbyEntity instanceof Player) {
nearbyEntity.sendMessage("§cDo you really want do destroy this mapart?");
TextComponent clickableYes = new TextComponent("[Yes]");
clickableYes.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/confirmdeleteposter %d %d %d %s".formatted(location.getBlockX(), location.getBlockY(), location.getBlockZ(), location.getWorld().getName())));
nearbyEntity.spigot().sendMessage(clickableYes);
}
}
}
}
thx already for helping!
?paste
sry
i would say this format way better then the paste one
not if you select correct programming language
whats the problem?
it looks exactly the same, so flooding chat is the only argument
yea and makes sense
read comments 😉 thats the reason i wrote it here
its a valid argument
also you need to scroll after a while to get back to your code/read messages
yee, ik, just didn't remember the rule here 🙂 i'll remember next time
do you have a proper argument check?
like args[0-3] ?
nope, but the arguments are correct
[07:59:54] [Server thread/INFO]: Schwerthecht issued server command: /confirmdeleteposter 112 66 -59 world
lickEvent.Action.RUN_COMMAND, "/confirmdeleteposter % no /
oh wait
its working?
oh wait i see
yee, command is executed correctly
how to do better? ^^
print out all the Collection<Entity> entities = world.getNearbyEntities(location, 0,0,0);
calling a command is kinda silly but im on a phone so I cant really write up a better way
ig for u its fine
i just didnt understand
idk how to react in an other way to clickable text... so pls let me now, if you're at home
so if i have 0,0,0 it finds none, but with 1,1,1 it also finds the ones around it xD maybe 0.5,0.5,0.5 works?
shrug idk man
locations are weird
u could try uping the radious
radius*
okee ^^ so i'll try 0.5, thy! ❤️
Why u wanna do 0,0,0?
That's a volume of 0
You can't have anything in nothing
Ur removing itemframes?
jee, that makes sense, but with 1 it deletes all around too
Why just around the player may i ask?
correct
it isn't around player, it's around a location
i just want a clickable text confirmation and you just can react in code to this with a command (afaik)
just cant find the issue 😭
Why PlayerItemConsumeEvent when using potion returns in the method "getReplacement()" null?
i need replace GLASS_BOTTLE when player use potion
@alpine urchin can u help me?
Well that's a random ping
That's why you don't put your GitHub in your bio /s
@md5 can you help me
Get pinged 
how should i use OOP to get the most efficient sql connection and usage
It’s impossible to contact him, that’s my experience 😀
rn i am creating one called "SQLSetup" and one called "SQLUtil" but i don't know if that is the best (SQLSetup is for establishing the connection and basic queries and SQLUtil is a class full of queries that i use often)
Using singletons is always the best approach to minimize useless resource requirements
thats what I use
we've emailed before, not that impossible.
is it possible to get a method from a string
like rs.get + "kills"() or rs.get + "deaths"()
or is valueOf only an enum thingy
uses refliction https://stackoverflow.com/questions/160970/how-do-i-invoke-a-java-method-when-given-the-method-name-as-a-string
ig no easy way
i think you could do getStat(Enum)
its not an enum 😦
instead of getKills() and getDeaths() being separate
you could do strings as well
using a switch statement in getStat
its more of a getInt() and getFloat() that im tryna combine two functions into one
private static int getInt(String name, ResultSet rs) {
try {
int num = rs.getInt(name);
rs.close();
return num;
} catch (SQLException e) {
e.printStackTrace();
}
return 0;
}
private static float getFloat(String name, ResultSet rs) {
try {
float num = rs.getFloat(name);
rs.close();
return num;
} catch (SQLException e) {
e.printStackTrace();
}
return 0;
}```
if you wanna see the code 😛
ah i see
ooo maybe
beautiful, ```java
private static int getInt(String name, ResultSet rs) {
return (int) getObject(name, rs)
}
private static float getFloat(String name, ResultSet rs) {
return (float) getObject(name, rs);
}
private static Object getObject(String name, ResultSet rs) {
try {
Object obj = rs.getObject(name);
rs.close();
return obj;
} catch (SQLException e) {
e.printStackTrace();
}
return 0;
}```
Resultsets close with the statement iirc
Wdym?
like i dont need a rs.close()?
i read on a forum that it was better practice to keep it
No
but that brings down alott of the lines
so thank you ❤️
@humble tulip what are your thoughts on this code? java public static boolean isInDatabase(UUID uuid) { try { ResultSet rs = stmt.executeQuery("SELECT * FROM STATS WHERE ID='" + uuid.toString() + "';"); if (rs.next()) { return true; } } catch (SQLException e) { e.printStackTrace(); } return false; }
What is the result if you run a query and there is not result for it? I think you get and exception or maybe null, so you could check for those
There will be no next so retun null
Maybe some misunderstanding 🙂
You could also check that there is any existing result matching to the query, you check is the result null or maybe the size of the result also could help
Oh and one more trick, in most cases there isn’t required to use the semicolon on the end of the query
I shouldn't do mysql thingys on the main thread, right?
got it 😛
Should I make a new connection each time I want to update smt in the sql db or do I just keep one alive?
Postgres
Connectionpool like hikaricp ^^
what?
Hikari creates and handles a connection pool. It is not a database. It handles the pool and hands you an open connection when you need one
I see
Position: 53
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2676)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2366)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:356)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:490)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:408)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:329)
at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:315)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:291)
at org.postgresql.jdbc.PgStatement.executeUpdate(PgStatement.java:265)
at world.ntdi.postgayy.Stats.SQLRapper.updateValue(SQLRapper.java:74)
at world.ntdi.postgayy.Stats.StatsManager.setKills(StatsManager.java:27)
at world.ntdi.postgayy.Stats.StatsManager.addKills(StatsManager.java:30)
at world.ntdi.postgayy.PostGAYY.main(PostGAYY.java:27)
How can a uuid cause errors?!?!?
UUID uuid = UUID.fromString("e985173d-f10f-4bc0-95cc-613cd49e5573");
the bc0 is in the middle
Why do I get null entity with this one Entity entity = player.getTargetEntity(10); when this player of target is in creative mode?
That's not Spigot API is it?
Also @subtle folio check out try-with-resources.
this is paper api and that just means there is no targeted entity within the range 10
oh okay thanks
Hey everyone !
I'm trying to check if a player is vanished (using Essentials, so using Player#hidePlayer method), but I can't find out how ...
Does anyone know something about it please ? 🙂
It might be worth having a look in the com.earth2me.essentials.User class of essentials
I was wondering if I can do it without essentials API, so I won't depend on this plugin specially
where did u guys learn coding?
Self taught, practice and failing
I'm french so I used this at first: https://koor.fr/Java/Tutorial/Index.wp
For english speakers, there's things like this
I'd advise learning object oriented programming aka OOP first before learning spigot big mistake me not learning that first
public class TeleportBow implements Listener {
public void whatever(ProjectileHitEvent event) {
if (event.getEntity().getShooter() instanceof Player) {
Player player = (Player) event.getEntity().getShooter();
if (player.getInventory().getItemInMainHand().getType().equals(Material.BOW)) {
if (event.getHitBlock() == null) {
player.teleport(event.getHitEntity());
} else if (event.getHitEntity() == null) {
player .teleport(event.getHitBlock().getLocation().add(0,1,0));
}
}
}
}
}
how can i add recipe
Wdym ?
Recipe for what ?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
😅
but i want to add the recipe into this code
its ok if you dont know
I don't understand you request tbh
Why would you add a recipe in this code ?
It's just a listener, there's no point in using a recipe
So I don't know how I could help you
Ah I know how I could: You should use early returns to make your code easer to maintain
Player#canSee
so people can craft it
Thank you, that's what I was looking for 👍
i want the teleport bow to be craftable so people can craft it but i dont know how to make it
Yeah so that's what I've sent to you : https://www.spigotmc.org/wiki/recipe-example/
By creating a custom recipe, players can craft your item
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
🤨
but i want the way to make THIS code as recipe
public class TeleportBow implements Listener {
public void whatever(ProjectileHitEvent event) {
if (event.getEntity().getShooter() instanceof Player) {
Player player = (Player) event.getEntity().getShooter();
if (player.getInventory().getItemInMainHand().getType().equals(Material.BOW)) {
if (event.getHitBlock() == null) {
player.teleport(event.getHitEntity());
} else if (event.getHitEntity() == null) {
player .teleport(event.getHitBlock().getLocation().add(0,1,0));
}
}
}
}
}
please anser my qestion
extends JavaPlugin ?
You can't make a cat barking, as much as you can't transform a Listener in a recipe
🙃
Did you learn Java ?
oh ok
hm
am new
idk
lol
Aaah
just coding for my smp
So you should learn OOP first, before trying spigot
Composition or Inheritance hmm
u have video tutorial
You will earn so much time
i need a tutorial
If we could learn everything with videos, university wouldn't exist
so how can i learn java
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
some good resources
well I learnt 80% of Java just from the internet sources. I am not even into university or college yet
rest of 20% is just still unknown for me
I did too, but we didn't learn from looking tutos or videos (or maybe 5/10%, not much)
Searching on the net is a powerful tool that somes ignore
Im wondering if I should use composition for NMS classes or do inheritance and implement NMS things as a subclass for the base class
and then use a Builder design pattern to build it without client using NMS class level constructors
both approaches seem logical
The second one sounds easier to maintain to me, especially if you need to handle a lot of versions 🤔
i just realized that getting a living entity's eye location doesn't work properly when they're riding another entity
their eye location will be where they would be if they werent riding said entity
is there any workaround to where i can get the true eye location of a riding entity
is it possible to get entities when theyre unloaded?
assuming getting an entities Y returns the correct pos, u could try entity Y + getEyeHeight
Have a custom resource pack with custom chars. Then manage to align everything
But how does that box show up?
what does toolbox mean here
do you mean just a custom gui
in which case yeah the custom char solution will work
The Oriental bench thing ^^
It's custom chars put in the action bar or in title
i know but i still dont understand what hes asking
He's asking how to do it
How to show that thing i guess
oh you mean the little indicator, yeah an action bar or title custom char will work
one character for the whole outline, and offset characters to bring the regular text into position
N.B: you have to be in 1.13+ (or 1.16+ i don't remeber)
1.13 i believe works
if you want this indicator to be positioned relative to where you're looking at the block you'll have to do some complex math magic to get it to look nicely i think, thats probably possible, but i dont do enough mathamfetamine to know how to
I won't say complex ^^ It's just an offset so basically an addition
what do they mean with red-black?
uh oh i dont know any of that
it just means that it won't get too nested apparently
hmm ye
Hi
load balancing type of thing
i want to get distance between 2 location but i found in bukkit have Distance and Distance squared
distance returns the distance
distanceSquared is slightly faster, but returns distance*distance
only difference is that distance(Location) calls sqrt(distanceSquared)
oh ok thank you so much
¯_(ツ)_/¯
yeah you dont wanna call distance too much
any chance that someone wrote a valuesorted treemap impl lol
rewriting the whole thing myself scares me
I have a linked map one 😦
yep nope
is there a way to simulate the EntityDamageByEntityEvent to get the final damage?
Anyone know what could be causing the client to throw a FAILED_DOWNLOAD status when the sha1 changes in the #setResourcePack method?
But then when they rejoin it downloads and loads fine?
It's not really possible
That is as long as the value is mutable
If the value is not mutable, then it is possible
Mutable is that can be changed right?
And why do you need that fourten?
Though at that point I prefer having something like TreeSet<Map.Entry<Key, Value>> with a custom comparator
What do you want to do fourteek?
Probably leaderboard-like functionality
Hmn
It's been far too often that I have needed something like this but I always came back to the TreeSet<Map.Entry>
Is it a table for displaying player status?
uhh well uhh i was thinking about performance
so im currently having a HashMap<K, RemoveQuery<K>> where record RemoveQuery<K>(Consumer<K>, Instant) and i wanted to sort those entries based on the time of the instant
so when i want to execute all the queries in the map which instant is now in the past, i could just iterate thro it and break when those instants arent longer in the past
instead of looping thro a whole map
i guess it works with a normal map too but i was just thinking
How large is the map and how much retrieval needs to be done?
Is your resource pack in a nested folder
its basically used as some internal stuff in a usermap so in my server that map wouldnt be large
but ye
nope
retrieval is done like every five minutes with a runnable
So when you open the zip you don't have to open another folder to get to the contents
Invalid McMeta bad download link are the other two that come to mind
Looping or something else?
download link works, I just used it
here is the generated mcmeta: {"pack":{"pack_format":9,"description":"Backpacks+Netherite Shield"}}
And how often do you expect to insert something to the map?
Right now it really seems like a TreeSet<Map.Entry> linked with a regular HashMap should suffice
this is the code
https://paste.md-5.net/qemozemero.java
and ye its looping thro it every five minutes
and in the stuff im currently using it for, it inserts an entry whenever an user joins the server
I'm not an expert on packs I'd look at mojangs documents regarding the pack.mcmeta and creating valid packs
@heavy marsh check your .minecraft/latest.log
I am not sure what the problem is tbh since the pack does work, but not on the first join, you rejoin and it loads fine
I would use a Deque
a deque is only <E> right, so no keys values?
[Netty Client IO #20/WARN]: Pack application failed: java.lang.RuntimeException: Hash check failure for file C:\Users\#\AppData\Roaming\.minecraft\profiles\Vanilla\server-resource-packs\053bbbf81781d3d464f7d617ea6325991d46baaa, see log, deleting file C:\Users\#\AppData\Roaming\.minecraft\profiles\Vanilla\server-resource-packs\053bbbf81781d3d464f7d617ea6325991d46baaa
yep but i need keys values to be able to run the consumer
what's the line above it
just use a list of entries and sort it by the value
then put it into your map
I'll see if I can improve the performance and open up a PR if needed
[01:06:11] [Render thread/INFO]: Connecting to localhost, 25565
[01:06:12] [Netty Client IO #20/WARN]: File C:\Users\#\AppData\Roaming\.minecraft\profiles\Vanilla\server-resource-packs\053bbbf81781d3d464f7d617ea6325991d46baaa had wrong hash (expected 622002d125fd3089142504df7b618526f6e3f8bf, found e8d528156403330d396ed70acf24b8327ce05f37).
[01:06:12] [Netty Client IO #20/WARN]: Pack application failed: java.lang.RuntimeException: Hash check failure for file C:\Users\#\AppData\Roaming\.minecraft\profiles\Vanilla\server-resource-packs\053bbbf81781d3d464f7d617ea6325991d46baaa, see log, deleting file C:\Users\#\AppData\Roaming\.minecraft\profiles\Vanilla\server-resource-packs\053bbbf81781d3d464f7d617ea6325991d46baaa
[01:06:12] [Render thread/INFO]: [CHAT] SyntheticDev joined the game
whats a pr
a pull request
well it's the wrong sha-1 hash
public relation 
thats what google showed me smh
whatever hash you're telling the client it should be, the client is not receiving the same from the download
yes I know, because the resourcepack content has changed
yes
should the hash be static?
no
🤔
Delete your server pack cache in .minecraft it should resolve your issues
what have you set the hash to
uhhh ok ig
If it's incompatible hashes could be an issue with a cache
It would take too much time to explain my idea to you, you'll get what I mean when I'm done - sorry
👀
What I am trying to solve is how to have the resource pack load when the client joins and the contents of the resoucepack have changed. Since currently the client joins, fails to load the pack since the hash is different, but then doesn't load the new pack?
one sent by my server that handles resource packs, here is the code:
String resources = ResourceManager.getResources();
String packUrl = "http://ADDRESS/spigot-resource-combine?resources=" + resources;
byte[] sha1 = null;
try {
URL url = new URL(packUrl + "&sha1=true");
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.setRequestMethod("GET");
int status = connection.getResponseCode();
if (status < 300) {
BufferedReader receive = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String base64 = receive.readLine();
receive.close();
sha1 = Base64Coder.decode(base64);
}
connection.disconnect();
} catch (Exception err) {
err.printStackTrace();
}
player.setResourcePack(packUrl, sha1, true);
well that complicates things
I have confirmed through logging that the sha1 is received and properly decoded and is equal to the one on the web server
Can someone help me understand why it sends me this error in the console multiple times when I try to damage an entity for example
Could not pass event EntityDamageByEntityEvent to Races v1.0.0
org.bukkit.event.EventException: null
Have you tried manually downloading the zip and checking the hash yourself?
it just seems that the client is unhappy with the hash changing
and the hash is 622002d125fd3089142504df7b618526f6e3f8bf?
is there a way to simulate the EntityDamageByEntityEvent to get the final damage?
that is the old hash
according to the client, you're sending it 622002d125fd3089142504df7b618526f6e3f8bf whilst it's expecting what you said is the current hash e8d528156403330d396ed70acf24b8327ce05f37
expected 622002d125fd3089142504df7b618526f6e3f8bf, found e8d528156403330d396ed70acf24b8327ce05f37?
yes
well of course because the pack has changed
feels like we are going round in circles a little bit 😅
🤔
the found part is the file hash that it downloaded
the expected is what you sent it
hmm
what if you delete your server-resource-packs folder like ysk said?
then it downloads fine
it just doesn't initially work if a client has an old version of the pack (aka the sha1 changes)
what's your client version?
1.19
and applying it works the 2nd time?
and not passing a sha1 is obviously problematic since the client will not download the new version
Can NamespacedKeys have dots? like a maven artifact
yep
you could be right that it's a bug then
i've never been able to reproduce it myself but other people have mentioned it here https://bugs.mojang.com/browse/MC-164316
"I am having a similar issue, but it is not failing to delete the file, it just fails to apply the new pack. This seems to be new 1.17 behavior:"
Hmmm MC bug hopefully they fix thag with 1.19.1 release
probably not
1.19 chat bans 
Never know
it's been open since 2019 and is low priority
That's an oof
here is my janky solution for now then 😕
@EventHandler
public void onResourcePackStatus(PlayerResourcePackStatusEvent event) {
Player player = event.getPlayer();
if (event.getStatus().equals(PlayerResourcePackStatusEvent.Status.FAILED_DOWNLOAD)) {
player.kickPlayer("Server resource pack has changed or resource pack failed to download.\nPlease rejoin.");
}
}
that seems like a pain, unless I send the sha1 in the url?
Yeah
ok let me try that
===
at least according to the bug report that should work
give me like 15 minutes, gotta change the web server behaviour
?paste the whole exception
Your trying to use a value that doesn't exist on LifeSteal.java:135
Am I allowed to do this in OnLoad? https://paste.md-5.net/qalijoguxu.java
alr
idk actually lmao
ill try and seee
i'd do CompletableFuture.runAsync(dbThread::start).thenRun(...)
wouldnt that freeze the server tho?
what goes in there
Runnable
for half a second
ill put this in instead bc yk yk
?tryandsee
dunno what you want to do if the thread is completed?
you probably wanna use a single thread executor and pass it to the future instead
Plugin name please
my plugin?
No the one that allow to see the methods
im on 2022
Ultimate versión?
nope
community baby
2021.1.1 smh
And also your theme is really yup
How to get config data?
check:
killaura:
enable: true
range: 4.5
aps: 7
notify: "e"
This is a config and I would like to know how to get each value from it.
Paper, MC 1.18.2
Han
Github theme, Github Dark dimmed
Why
Why?
@tardy delta https://paste.md-5.net/dipotaquja.java this is what I meant
I think there is a getter for the config
if you need paper support go to their discord
Yeah hahahaha
Here is spigot support tho
Thanks ndi for the tele
Theme,
Speaking of which
Its looks pretty amazing
Paper also supports the Spigot API, so I've been here once.
Where a config wiki page?
three collections now
He?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
So what?
Thanks!
^
Those maps shouldn't be particularly huge
Myes… I haven’t coded that much lately
Mostly cause I was learning Rust :>
owo
Having a LinkedList that is only iterated partially is far more optimal than having a HashMap that has to be fully iterated upon or even sorted
If the setting is set, how to get it?
hmm i understand what youre doing
Reading blocks from unloaded chunks causes a massive lagspike.
Is there a way to perform the loading async and then react sync to the result?
You might even be okay with just having two collections, an DelayQueue and a Map but that system would be a lot more finicky to implement
Yea
How?
Perform the task on another thread and then subsequently take the result and consume it with BukkitScheduler::runTask
(I assume by sync you mean server thread)
So it is safe to load chunks from another thread?
dunno what a delayqueue is
Basically something that does what you want, but just for adding and not for removal iirc
hmm i seem to understand the principle
Well you have chunk snapshot
An unbounded blocking queue of Delayed elements, in which an element can only be taken when its delay has expired.
But iirc doesn’t have anything regarding loading chunks
I want to get the chunk object to read the block states.
Yeah
ChunkSnapshots are capable of doing that async iirc
Idk how up-to-date they are due to thread safety
But up-to-date enough unless you do stuff atomically etc
im bored anyways 😂
It is likely going to be less efficent anyways
DelayQueue is concurrent, which you seem not to care about
A ChunkSnapshot seems to be able only capable of proving materials, not block states.
I'm looking for something like world#getChunkAt() but in an async fassion.
As I think, it's not safe to call this method from another thread, right?
Oh yeah you’re right
I´m confused abut this error https://pastebin.com/LmzLeV9M I know the error, but not way it print error. Look more like the method spigot/bukkit use ignore the if check I have and try load every class in the method i have.
I would presume and say it’s not safe
Might even be caught
hmm true
Does this happen on Spigot too?
should not mater, but yeah I can look on spigot also
https://paste.md-5.net/tuyeqijusi.md I have a jar in my plugins files, but It wont build with it for some reason?
added it as a depencicy in project strucutre aswell
you are building with maven. If maven doesn;t know about that jar it will not include it
Why do you have a jar in your plugins files???
hmph, i cant find the maven repo for Postgres sql JDBC
I cant use it any other way 🙈
Yes you can...
Btw do you build artifacts? Or how do you compile?
Package
does it need a repo?
no
Sorry, misstyped. Hold on.
editing exists ..
Yeah. As in the new version the loading time became way worse. Minecraft even parks the loading call sync.
Eventually this would be up then to a feature request. As Paper seems to have a getChunkAtAsync() method.
Alright thanks guys.
CompletableFuture.supplyAsync(getChunkSync) kekw
No, I think calling getChunk() async is still not safe.
Thtats what the "kekw" was for
I mean you can call it async. Just not from a different thread.
not always
Nope async just means out of sync. So if you want to request 100 chunks and do 10 chunks each tick for 10 ticks
then you computed this workload async.
aaah
For me async just means "not now"
First mistake im seeing:
Never compare objects with == unless you want to check for identity (exact memory address)
For primitives and enums its good but you dont want to use this for Objects like Strings.
So someString == "" will always be false.
it will load the chunk
if its unloaded
and you cant load the chunk async
Next mistake: You are using something else than the PDC to check for custom or tagged items.
You should always use the PDC to tag an ItemStack. Never use the name, lore or other properties.
?pdc
The display name is just, by its name, something you display
Friends everywhere
what you had me do that I failed to do inspired me to try and learn how to do it
Something like this looks fine to me
public class ItemLocker {
private final NamespacedKey lockKey;
public ItemLocker(JavaPlugin plugin) {
this.lockKey = new NamespacedKey(plugin, "item-lock");
}
public void toggleLock(ItemStack itemStack) {
ItemMeta meta = itemStack.getItemMeta();
if(meta == null) {
return;
}
PersistentDataContainer container = meta.getPersistentDataContainer();
if(container.has(lockKey, PersistentDataType.BYTE)) {
container.remove(lockKey);
} else {
container.set(lockKey, PersistentDataType.BYTE, (byte) 1);
}
}
public boolean isLocked(ItemStack itemStack) {
ItemMeta meta = itemStack.getItemMeta();
if(meta == null) {
return false;
}
PersistentDataContainer container = meta.getPersistentDataContainer();
return container.has(lockKey, PersistentDataType.BYTE);
}
}
hey
how do I update a GUI Inventory's items
without closing it
tried Player#getInventory
but that gets their own inventory not the chest/gui inventory
A gui is just an inventory. You can place ItemStacks in there whenever you feel like it.
on spigot https://pastebin.com/y2hhqLaK
yes I know
but it does not update for the player
when I change it
How would I make an ItemStack have limited uses? E.g. I'm making a lightning Blaze rod and want to put 100 uses max.
The lore would also update itself with the uses left.
register each use per player
It looks like a serialization error. are you saving/loading Particles to a config?
and when it reaches the maximum
remove from their inventory
e.g. playerinteractevent
check for the specific item
add player to a hashmap with player and uses
Way I´m confused is I checking the server version and it still try load things I stop the java to read. I know the if checks works but seams it read whole class and ignoring my limit I set .
and deduct each time
Use the persistent data container to store data like uses.
Then on interact you update the ItemStack.
This is dirty but it sounded like what you wanted.
Player player = ...;
Inventory guiInv = player.getOpenInventory().getTopInventory();
guiInv.setItem(10, ...);
player.updateInventory();
ah thanks
this is what I was looking for
Inventory guiInv = player.getOpenInventory().getTopInventory()
Haven't worked with PDC yet so I think it will be a nice practice, thansk
This is expected behavior. If you rename an ItemStack like that in minecraft then it becomes cursive. You need to specify a styling to change the appearance.
If you are using Components in naming you are not using Spigot
As 7smile7 said: #setDisplayName(ChatColor.RESET + name) or the component equivalent should work
most of times im ignoring deprecated things... just use it
thats same but with chatcolor
ItemStack itemStack = new ItemStack(Material.IRON_AXE);
ItemMeta meta = itemStack.getItemMeta();
meta.displayName(Component.text("Mithril Axe").color(NamedTextColor.AQUA));
itemStack.setItemMeta(meta);
This also works
meta.displayName(Component.text("§eMithril Axe"));
Or RGB:
meta.displayName(Component.text("§eMithril Axe").color(TextColor.color(240, 200, 90)));
The class some is the problem https://pastebin.com/PKvKKnjR
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
what adds that #displayName?
Wood based fork
Have you registered this class?
Bleached wood for that matter
interesting
ofc it work fine with out Particle.DustTransition class added.
Thats because DustOptions is not ConfigurationSerializable
wasnt are you talking about display name change? xd
Can confirm that sending a different URL with the changed hash will make the client load the resource pack
is no problem with DustOptions only DustTransition and no I not add that to config (needed to make my own ParticleDustOptions() class for that so that are not the issue).
You have to do the same for DustTransitions
I'm attempting at a multi-world plugin - I have 2 separate worlds with each of their own nether & end dimensions.
I'm having some issues with the end.
-
I use
PlayerPortalEvent#setTo()to teleport to the correct end world. Here I use#getSpawnLocation()of that world. The spawn location of said world appears to also be the spawn location of the fountain. How do I get the correct location where you would normally spawn after entering an end portal? -
I use the same event for when leaving the end, making sure the player goes to the correct dimension, with the player's respawn point. I checked for the TeleportCause if it was == END_PORTAL, but it appears the fountain is actually an END_GATEWAY, as I ended up in the void upon entering it. How can differentiate the player from entering the fountain's portal, and using an actual gateway with enderpearls?
Because extends Particle.DustOptions
does anyone know?
Yea is how I done it, look inside serialize(). I then convert it back in deserialize. but seams it read deserialize and ignore if statements when bukkit/spigot use reflections.
Are there plans to make org.bukkit.block.Biome abstract?
Advancements have to be known when the player joins. So you should be able to just create a bunch of advancements (in a resourcepack) and
change the description, icon, title and type however you please.
resourcepack?
Related to advancements, is there a way to list the player's advancements??
it needs resourcepack?
is there any way to refresh the inventory in the InventoryClickEvent? I need to get what item has been put into the menu
Pretty sure biomes are already data driven in nms. So Spigot will follow that sooner or later.
Yes, it will be a registry eventually
I'm using this to set the player's max health. It's changing the attribute value in the code. I know this because I'm printing out the value right after I change it, but it's not changing my heart amount. Any reason for this?
However right now it still stays an enum due to backwards compat
cant i change title of it without resourcepack?
Did you fix the display for your hearts? Sounds like you pinned it to 10 hearts.
Let me check the protocol.
What do you mean by fix the display? How would you fix the display?
You can specify if the amount of hearts correlate with the players max health.
You can as well just pin it to 10, 20, 30 ... 1 heart.
Ok so how would I just have the player have 5 hearts. I thought doing
player.getAttribute(Attribute.GENERIC_MAX_HEALTH).setbaseValue(10);
would do that. Do I have to do something else?
setHealthScale(double)
setHealthScaled(boolean)
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Player.html#getHealthScale()
declaration: package: org.bukkit.entity, interface: Player
setHealthScaled(boolean) -> defines if the health should scale automatically
Is this new? I didn't even know this was a thing
Cant remember if it every wasnt a thing.
Actually im seeing some packets that let you update advancements on the fly.
I didnt find any api for this. Let me get ProtocolLib and play around with it a bit.
uhh
i think playing with packets is pretty hard
i dont know i can go on this
Because you set it to a fixed location. It doesnt follow the player.
any ideas?
How can I move a location forward based on it's direction?