#help-development
1 messages · Page 940 of 1
hello, I have weird question. Is this possible to create "mud" plugin? I have only one idea how to create it but I think it will overloading server. My idea is to summon this Powder snow packets on runnable every tick, on some area like 5x5. Is this possible at all?
and whether such a package exists at all?
cant you just replace the dirt blocks into mud blocks
This piece of code does not work for me (it is not mine). How can I fix this?
public class v1_20_R2 implements SkullSkinSetter {
@Override
public void setSkullWithSkin(Block b, String base64Skin) throws Exception {
b.setType(Material.PLAYER_HEAD, false);
Class<?> gameProfileClass = Class.forName("com.mojang.authlib.GameProfile");
Object gameProfile = gameProfileClass.getConstructor(UUID.class, String.class).newInstance(UUID.randomUUID(), null);
Class<?> propertyClass = Class.forName("com.mojang.authlib.properties.Property");
Object property = propertyClass.getConstructor(String.class, String.class).newInstance("texture", base64Skin);
Object propertiesMap = gameProfileClass.getMethod("getProperties").invoke(gameProfile);
propertiesMap.getClass().getSuperclass().getMethod("put", Object.class, Object.class).invoke(propertiesMap, "textures", property);
Object handle = b.getChunk().getClass().getMethod("getHandle").invoke(b.getChunk());
Class<?> blockPositionClass = Class.forName("net.minecraft.core.BlockPosition");
Object blockPosition = blockPositionClass.getConstructor(int.class, int.class, int.class).newInstance(b.getX(), b.getY(), b.getZ());
@SuppressWarnings("unchecked")
Map<Object, Object> tileMap = (Map<Object, Object> ) handle.getClass().getMethod("E").invoke(handle);
Object skullTile = tileMap.get(blockPosition);
if(skullTile != null) {
skullTile.getClass().getMethod("a", gameProfileClass).invoke(skullTile, gameProfile);
}
b.getState().update(true, false);
}
}
Hello guys, I have a doubt.
For a plugin that requires many events but the events required vary depends on how the config is configurated how would be the best way to register those events?
All events even if they are not used and just put a return in the first line
Or only events that are going to be used?
Just use those that youre using, it's just additional lines of code that does nothing if you're not gonna use it anyways
but I mean give to some other blocks powder snow effect
But then to change it from config a restart of the server is necessary, or can you register events other than in the onEnable method?
or justr summon change block texture packet from powder snow to dirt
I meant like if you dont have lines of code in the event, then its best to not include it. but if you do have code, even if youre not gonna use the events, keep it in
my bad for not clarifying
And using a return line in the start of the event would prevent lag?
Just use the API, there's no need to use refelection and nms for that
Spigot 1.18.1 added the new PlayerProfiles class, which finally allows us to use custom heads without needing any reflection! You can obtain them as normal items, or actually place them down into the world. I’ll show you how both works: Creating a new PlayerProfile First, we gotta create a new PlayerProfile object. To do so,...
Hello, how can I spawn an experience orb with a different size?
Their size is dependent on how much xp they give
if you want to fake their size you can do so with ProtocolLib/PacketEvents
Hum okay, so I have two questions:
- Is there a limited size?
- Can I get the xp a xp orb give?
the max is 64 int
or is that a 32?
- Yes, the sizes are fixed
- Yes: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/ExperienceOrb.html#getExperience()
declaration: package: org.bukkit.entity, interface: ExperienceOrb
so the max size is a 16-bit integer
but I can push to the limit?
so let's remake Clumps
yes
I have been trying to make a quick command to teleport players between worlds (1.20.4, Spigot). However, listing all available worlds only shows the worlds with the levelname provided in server.properties, and not other save files. I am using Bukkit.getWorlds to list the worlds and getServer.getWorld to access the actual worlds. What am I doing wrong, and what is the correct solution?
I haven't found any information about this online, so I'm sure it sounds like a stupid question...
I need help I know hardly Java.( I don't know classes and objects) How I can fix it ```package org.cheese.naukaconfigu.Utility;
import com.sun.org.apache.xpath.internal.operations.Bool;
import org.cheese.naukaconfigu.NaukaConfigu;
public class Zmienne {
private final NaukaConfigu plugin;
public Zmienne(NaukaConfigu plugin) {
this.plugin = plugin;
}
public static String join_message() {
String join_message = **this.plugin**.getConfig().getString("join_message");
return join_message;
}
public static Boolean allow_Heal() {
Boolean allow_Heal = **this.plugin**.getConfig().getBoolean("allow_Heal");
return allow_Heal;
}
}``` The problem is in **** to make it you easier
theres really no lag if you dont use it
it only works when the event fires up
if it doesnt, then you dont need to
but if it does, I guess you could put a return line in the first line
I mean, if the event is registered it will fire the code inside, but won't surpass the if's
then yes, you can put a return line so it doesnt waste its time checking the ifs
you have to use Bukkit#createWorld first to load the world
yea, thanks
Anyone know how to convert net.md_5.bungee.api.chat.BaseComponent[] to net.minecraft.network.chat.BaseComponent[] ?
What's the best way of converting a locale string from Player#getLocale() to a java Locale object?
getLocale won't always match a java Locale
how does paper for example convert the locale string to a java locale in their Player#locale()?
Split getLocale by _ and use Locale(String language, String country)
Just guessing
Going of javadoc
was hoping there was a simpler way, but i guess that's the way to go then. thanks for the help!
Or, in general, just a system/some guidance for constructing net.minecraft.network.chat.BaseComponent[] would be fantastic. 🙂
thanks
CraftChatMessage might have what you need
Vector directionMiddle = middlePoint.toVector().subtract(middle.toVector()).normalize();
drawLine(middle, middlePoint.clone().add(directionMiddle.multiply(BLOCK_SIZE * 2)), 0.025);
double yaw = Math.toDegrees(Math.atan2(-direction.getX(), direction.getZ()));
double pitch = Math.toDegrees(Math.asin(-direction.getY()));
Vector3f rotationVector = new Vector3f((float) pitch, (float) yaw, 0);
EntityArmorStand entityArmorStand = ((CraftArmorStand) armorStand).getHandle();
entityArmorStand.setHeadPose(rotationVector);```
some1 know why the armor stand is not looking right to the line particles?
hm, i really hate maths
actually, haha, it turns out just the generic serializer works
wahts annonys me is that the spigot .setHeadPose methods use euler angles, which greatly lose the precision of a rotation, and vector3 is completely the opposite of euler angles xyz and zyx etc
i was thinking the same, if it's not the math it's something to do with order or degrees/radians
i really dntknow let me see radians
minecraft works mostly in radians as far as i know
now the armor stand dont rotate lul
worse i had already worked on this before with holograms
but i lost the src, where it displayed a customized message, but i only made it rotate 90 degrees and not completely
player.getWorld().spawn(player.getLocation(), TNTPrimed.class, (tnt) -> tnt.setYield(0));
this doesn't work in 1.20.4
java.lang.NoSuchMethodError: 'org.bukkit.entity.Entity org.bukkit.World.spawn(org.bukkit.Location, java.lang.Class, org.bukkit.util.Consumer)'
Could you send the output from /version
> version
[21:33:44 INFO]: Checking version, please wait...
[21:33:44 INFO]: This server is running Paper version git-Paper-459 (MC: 1.20.4) (Implementing API version 1.20.4-R0.1-SNAPSHOT) (Git: 88419b2)
You are 2 version(s) behind
Download the new version at: https://papermc.io/downloads/paper
Previous version: git-Paper-439 (MC: 1.20.4)
its paper but
Recreate the issue on Spigot
yep it's paper oops
is there something in java for formatting numbers ? (1000 -> 1,000) or i have to make a method
i can give you mine
wait, there is
wait a second
obviously from the if choose what you need
You can also use String.format
Well you can always compile the format expression ahead of time to a Formatter
still quiet slow
i mean now it depends on the task, if you call it once in a bluemoon is fine
but if you update it every tick for a hologram or something it'll feel
I don't think there is actually a large difference here
Plus you should really avoid hardcoding the separators
Use the player's locale whenever appropriate, which you can then easily stuff into the formatter
well, this was for servers and i wanted to make sure the behavior will not be affected by each server's locale
oh, that's a thing?
i didn't know that
Well, paper has a method for it. Under spigot you need to do some voodoo to obtain the locale object from Player#getLocale
well, this'll do for this project, i'll leave it to the server owner to decide the separators
Yeah for smaller servers this is quite irrelevant, but once you attract players from outside your home region such behaviour is inexcusable
(for the group seperator you should generally use ' anyways, since that is never confused with anything else)
i see, i'll try to apply the player locale if i can
?paste
how can i get a precise file name in the plugin folder?
JavaPlugin#getFile
Bukkit.getStructureManager().loadStructure didn't load schematics?
I have a really huge plugin that basically uses Player object to store in arraylists everywhere, but then when a player rejoins everything breaks.
Now I have a few options:
-have a wrapper class GamePlayer and just replace the Player object to a new one on a rejoin *the easiest by far
-make it work with UUIDs not sure how to all the code compatible tho
-with strings of player names
What do you think?
uuid
May I ask why do you think like that
Bukkit.getPlayer(uuid)
converting uuid to player is this easy
so you replace all the Player.... with Bukkit.getPlayer(uuid)....
because player names change but uuids dont
What about the 1. Solution that I think would be the best (because I do not need to restore the game after the server reload/restart)
I see
But it will take me as much work for the 1. One as for the 2. One thus I think I should really be focusing on UUIDs?
Use UUIDs
?tryandsee
bonk
I have implemented a TabCompleter class for a command and it works as intended, but how do i return a different list based off the current argument index?
public @Nullable List<String> onTabComplete(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, @NotNull String[] args) {
List<String> tabCompleteList = new ArrayList<>();
//how do i change this per argument??
return tabCompleteList;
}```
(the context for the current command is an online playername then a string from a predetermined list)
Ok that will probably be the best and future proof if I want to store the game progress into a flat file
bunch of if statements
yes, but what indicates the current argument index?
the array length
someone know how can i paste a schematic?
I recommend using the WorldEdit API
https://paste.md-5.net/lofehedopa.coffeescript
i try this but WorldEditException don't work...
?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.
bro i send the code ...
I'm not going to run that code to find the error
Is WorldEdit installed
on the server ?
yes
i install world edit and this time i got another error lol
?paste the new exception
use worldguard util methods to convert the world
i just install worldguard or import it with maven?
you can;t cast a CraftWorld to a Worldguard world
BukkitAdapter.adapt(world);
in the cast?
no
do not cast
replace the cast
ok all work now i think i just messed up my schematic because only the top spawn
some1 can help me with that? still have no solutions
I dont know how to use Lambda... How does one do this?
Does it rotate at all?
replace this with thrown
same thing
It does tho
also doesn't launch projectile require Snowball.class?
Because it works if I just set it after but if there is lag you see the snowball so I dont want to do that
Im trying to set its class as Snowball. Did I mention I suck at Lambda?
then the lambda consumer
do it like this Snowball.class, thrown ->
maybe just do it, stop sucking it lambda
anyone good at math and knows vectors?
I tired lol
try harder
Also thrown.setItem dont work either
you're again using this
"Also thrown.setItem dont work either"
then as i said, snowballs doesn't have a setitem method
...
Then why does this work?
there's no consumer for launchprojectile
How can I make a flag system like that? any1 can help?
wait, let me see in which version it was added
it's not in spigot
there's no consumer for launch projectile
There is, i just had to add vector for some reason. :I
No option to use the deafult
yep
I run on paper
Likely will never switch
There should be a consumer tho tbh
In spigot I mean
i don't really know what this is but take a look at display entities
Yeah do you have any pictures with a few more pixels?
why does that look like just a bunch of dropped items
or block displays
Looks like a PvP server
it might be armor stands
$5 says it’s 1.8
yup, its ctf lmao
ty mate!
Hi there. Why Player#hasPlayedBefore inPlayerLoginEvent always returns false even after rejoining?
It'd be Worth making a bug report If you can reproduce this in its simplest form.
?jira
Make sure you're on the most up to date version of spigot and your test plugin should only try to Recreate this behavior
Aight, will do 👍🏻 Thanks!
Also make sure this happens in PlayerJoinEvent too it's possible not all data is loaded in LoginEvent though I feel this would still be a bug in some case
It doesn't happen to PlayerJoinEvent tho when I tested. Sokay, I'll test with the latest build and see if it still occurs.
@young knoll do you know if this intended?
?jd-s
I’m almost positive that method just checks for their data file existing
So make sure their data file is being created and saved properly
The javasdoc says it's really early in the process
So its possible not even that has been loaded yet or sum
Maybe
Hello, one last question: I am writing a 1.18 plugin, and I depend on a 1.16 plugin (that still works) which allows players to sit down, and keeps track of players which have sat using a hashmap. In my plugin, I look up this hashmap from the 1.16 plugin and check if players are sitting for certain behaviors, however, this throws a java.lang.NoClassDefFoundError: net/minecraft/server/v1_16_R3/World error.
Any advice?
Yeah.
That plugin does work, however.
Like, I can /sit, and sit down on the server, and that plugin loads/runs properly
It's only when I try to interact with that sitting plugin with my own plugin that the error is thrown.
You are probably using a feature that is requiring NMS and that is not used without your interaction
If you don't have NMS code in your own plugin then it surely comes from the other plugin
Idk what you’d need NMS for if it’s just /sit
Slap em on a marker armor stand and done
Yeah, but I DO use NMS in my own plugin
It's just it's 1.18 NMS
lol
Both plugins use NMS, one uses 1.18 NMS, and one uses 1.16 NMS
any
uh
advice?
i can give code snippets
if thou wilt
F
or don't use nms 😉
How can I have player save files per world? I currently have a main lobby and a main server world, and I teleport the player between these areas. However, inventory, health, effects, etc. persist across teleportation. I want there to be a unique save for each world. How can I achieve this effect?
#help-server
Have two servers, theres no good way of isolating plugins between worlds and It is a bad idea in general.
That being said, if you are persistent, Multiverse supports inventories, health etc per world
And if you can't afford two servers, thats a good indicator that you shouldnt be having a lobby world in the first place
is ShapedRecipe#shape() case-sensitive?
yes
ok thanks
well i was asking about it from the development standpoint but alr
ig i can take a look into multiverse source code
oh yeah development side easily
just keep a file per world with the relevant data
then on world change, on join and on leave save and load accordingly
minecraft already has the player .dat files per world saved under the playerdata folder, is there any way i can save/load those? manually saving the majority of that data would be a bit annoying when the game already has it built in lol...
would probably be more of a pain in the ass to parse that then store it yourself
theres not that many datapoints
how can I use value to set skin for head?
What kind of value ? Player name or skin url?
The usual work around is to get a GameProfile using the minecraft texture you want (using mc net skin url) and then apply it to the SKULL item or block
hey anyone help me with an issue
i am trying to do a fake water plugin , i am trying to make it like when a player is in that fake water he gets damage constanstly
BUT it works only with a player is on the surface of the water block i am trying to make it when a player is in the water block its not working
Here is the part of the code :
private void startFakeWaterDamage(Player player) {
new BukkitRunnable() {
@Override
public void run() {
Block block = player.getLocation().getBlock(); // Get the block at the player's location
if (!player.isDead() && block.getType() == Material.WATER && block.hasMetadata(FAKE_WATER_METADATA_KEY)) {
double damageAmount = getConfig().getDouble("Damage-amount", 1.0); // Get damage amount from config
boolean killPlayerOnEnd = getConfig().getBoolean("Kill-player-on-end", true);
if (killPlayerOnEnd) {
if (player.getHealth() <= 0) {
player.setHealth(0);
} else {
player.damage(damageAmount); // Apply damage every tick (adjust as needed)
}
} else {
if (player.getHealth() > damageAmount) {
player.damage(damageAmount); // Apply damage every tick (adjust as needed)
} else {
player.damage(player.getHealth()); // Reduce health to 0 if less than damageAmount
cancel(); // Stop applying damage if player reaches half a heart or less
}
}
} else {
cancel(); // Stop applying damage if player dies or leaves fake water
}
}
}.runTaskTimer(this, 0L, 20L); // 20 ticks = 1 second
}
idk what i did wrong
How do you define the fake water?
I guess that if you place a bucket of fake water, all the connected and resulting water blocks should be fake water right?
Then, Player#getLocation should return the location on the feet of the player I guess, so if the player is swimming, the given block should be maybe one or two blocks up
Yes. When a player places a bucket of fake water, the intention seems to be that not only the block they clicked on becomes fake water, but also all connected and resulting water blocks.
Files#copy(…)
Does isFlying() check if the player is in the air / not on the ground, or just if they have flight enabled?
Latter one, just the toggler checker
is there any thingy that does the former?
Then this might be a little more tricky, especially if it can be very huge water lakes (or ocean). Do you have limitations of block in mind or should it be of any size?
No directly. You have to check by yourself the surrounding blocks (don't forget to check ladders, and not only the block bellow)
that would be a uhh @EventHandler location event no?
Depends. What do you want it for?
Most of the case I can think of would be in the PlayerMoveEvent yep
that's the thing I'm thinking
Because you have to be very careful to check that: the player is not falling, that he is not jumping, etc
what are u trying to do?
Some stupid Flight plugin that takes food from you
there is isOnGround check on player aswell, can be easily bypassed since its clientside check
also make sure to check if the player is using elytra then
I just refactored some old one, and it takes hunger from you even if you're stood on the ground
then just check if onGround
I would also check if the movement is a positive movement. Because I guess you don't want the player to lose food if it is taking a long jump
what's the check? the others are just p.isOnGround()
isGliding i think?
I'm just gonna have it check every 30s and if on the ground not take food if flight is enabled
ty
Oh if it's just legit survival flight then yes the elytra check is enough
yeah isGliding
Just have a Move event and check if the player is gliding
I keep thinking your pfp is some Roblox pfp, then some Runescape pfp @pallid oxide lol
What would you think about this
private boolean isPlayerInFakeWater(Player player) {
Block block = player.getLocation().getBlock().getRelative(BlockFace.DOWN);
if (block.getType() == Material.WATER && block.hasMetadata(FAKE_WATER_METADATA_KEY)) {
return true;
}
return false;
}
private void startFakeWaterDamage(Player player) {
new BukkitRunnable() {
@Override
public void run() {
if (isPlayerInFakeWater(player)) {
boolean killPlayerOnEnd = getConfig().getBoolean("Kill-player-on-end", true);
if (killPlayerOnEnd) {
if (player.getHealth() <= 0) {
player.setHealth(0);
} else {
player.damage(1); // Apply damage every tick (adjust as needed)
}
} else {
if (player.getHealth() > 0.5) {
player.damage(1); // Apply damage every tick (adjust as needed)
} else {
cancel(); // Stop applying damage if player reaches half a heart
}
}
} else {
cancel(); // Stop applying damage if player leaves fake water
}
}
}.runTaskTimer(this, 0L, 20L); // 20 ticks = 1 second
}
private boolean isInFakeWater(Player player) {
Location playerLocation = player.getLocation();
int playerHeight = playerLocation.getBlockY(); // Get the Y-coordinate of the block the player's feet are on
Block footBlock = player.getWorld().getBlockAt(playerLocation.getBlockX(), playerHeight, playerLocation.getBlockZ());
Block headBlock = player.getWorld().getBlockAt(playerLocation.getBlockX(), playerHeight + 1, playerLocation.getBlockZ());
return (footBlock.getType() == Material.WATER || headBlock.getType() == Material.WATER) &&
(footBlock.hasMetadata(FAKE_WATER_METADATA_KEY) || headBlock.hasMetadata(FAKE_WATER_METADATA_KEY));
}
oh it is a Runescape one lol
XD pfp = profile page? i played roblox only once or twise 6-8 years ago:D
that would maybe work but if you place a bucket of water with some particular data I don't think the data will propagate to the other blocks
pfp = profile picture
You would like to look at methods like WorldEdit's drain (check all relative water blocks so you can propagate the data)
i placed NBT tag
but for propagation idk how to handle this now 😩
some roblox word
To every blocks?
NBT tag is applied to the fake water bucket item itself, not to every bloc
So you have to add data to the :
- Exisiting surrounding water (see how WorldEdit did its drain command : check every connected blocks of water)
- Created water flow: monitor the BlockFromToEvent
i made it like the plugin uses metadata on each block to identify it as fake water
or look in source code how minecraft simulates its water physics and replicate it 😂
would probably be more performant
also a bit harder
been on this since last night its a pain 😭
thx ill try and see what i can do about that
sounds like you are just getting started then 😐
This is not an easy problem to be honest because it has a huge performance impact. Feel free to share with us your advancement and ideas so we can help you refine
@EventHandler
public void onBlockFromTo(BlockFromToEvent event) {
Block fromBlock = event.getBlock();
Block toBlock = event.getToBlock();
if (fromBlock.getType() == Material.WATER && fakeWaterBlocks.contains(fromBlock)) {
markAsFakeWater(toBlock);
}
} ```
🤔 idk
what's the difference between plugin.jar vs plugin-shaded.jar? and original-plugin.jar
Basically something like this yes.
You should use PDC to mark the water.
And also I'm not sure but there is maybe multiple kind of water block types
plugin.jar is the one you should use. plugin-shaded.jar is identical to plugin.jar. Original is the jar with no shaded dependencies
maybe by changing markAsFakeWater like that ?
private void markAsFakeWater(Block block) {
if (block.getType() == Material.WATER) {
block.setType(Material.WATER);
block.getPersistentDataContainer().set(new NamespacedKey(this, FAKE_WATER_KEY), PersistentDataType.STRING, "true");
fakeWaterBlocks.add(block);
} else if (block.getType() == Material.WATER_CAULDRON) {
block.setType(Material.WATER_CAULDRON);
block.getPersistentDataContainer().set(new NamespacedKey(this, FAKE_WATER_KEY), PersistentDataType.STRING, "true");
block.setLevel(3);
fakeWaterBlocks.add(block);
}
}```
🥲
its making me crazy ;-;
yo can someone help me out in #help-server
The water flow is actually the easiest. don't overcomplicate with a list.
For the water flow you just have the handle the event BlockFromToEvent.
If the block from is water and have the pdc, the apply pdc to the To block. (Don't try setting a block, or changing a list or whatever)
Then you have one more thing to do (2 in reality):
- When you place the water in exisiting water lake
- When the water flow touches an exisiting water lake
You should create a method like gatherLake(Location location, int maxRadius) that will return all the connected water blocks to the location in a given maxRadius
This is why I say you should inspire from WE's drain method: this command gather all connected water blocks from your location and removes them. You should do the same but instead of removing, just apply the pdc
thx ill try those now and let you know how it goes 😢
Good luck! Stay motivated this is really interesting ahah
and what if that fake block from inside the lake is removed
you now have a bunch of the fake water out of thin air
why I have this problem?
if(loc.getChunk().isLoaded()) {
PlayerProfile profile = getProfile("https://textures.minecraft.net/texture/" + textureURL);
Block block = loc.getBlock();
block.setType(Material.PLAYER_HEAD);
Skull skull = (Skull) block.getState();
skull.setOwnerProfile(profile);
skull.update(false);
}
}
Client issue
for real?
You're probably running a modded client or smth
Vanilla ☠️
yeah
Show that code
Heads might flicker a bit while the client is downloading the skins
Should go away though
Ahah then it's even more a mess 😮💨
But once more the method "gatherLake" could be use to revert
(limited tho)
😯 that is not my plugin, idk where is it
Block block = loc.getBlock();
PlayerProfile profile = getProfile("https://textures.minecraft.net/texture/" + textureURL);
if(loc.getChunk().isLoaded()) {
if(block.getType() != Material.PLAYER_HEAD){
block.setType(Material.PLAYER_HEAD);
Skull skull = (Skull) block.getState();
skull.setOwnerProfile(profile);
skull.update(false);
}
else{
Skull skull = (Skull) block.getState();
if(skull.getOwnerProfile().getTextures() != profile.getTextures()){
skull.setOwnerProfile(profile);
skull.update(false);
}
}
}
}```
I can change the head if it is not equal to the new one?
not really xd
that aughta be a big mess
with a ton of edge cases
well. its possible but u would have to give each their own unique id
haha
even then its still. pretty difficult to get a good system going
Even with that imagine having to recompute all the water sources everytime. Especially if a player is undecise about where to place its bucket lmao
yea thats going to be pretty heavy ;d
Howdy, im fairly inept at coding and all that
im trying to figure out a way to get the PlayerPortalEvent and EntityPortalEvent to trigger only when using nether portals, as an issue im facing with a 1:1 nether overworld plugin is affecting the end portals as well
I cant find any way to differentiate the two portals to ensure that the end doent spawn you in the void
simply check if the teleport cause == NETHER_PORTAL
thank you!
i'll test it out to see if it works
might take me a second, not familiar at all
EntityPortalEvent doesnt have a getCause tho
ah
if you really need to differentiate there. you could theoretically use getFrom() and use the the block material to figure out which portal it is.
Im illiterate, can i post the code here to get a bit of help implementing the get cause for the playerportalevent?
sure
package nether;
import org.bukkit.Location;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityPortalEvent;
import org.bukkit.event.player.PlayerPortalEvent;
public class EventsListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onEntityPortal(EntityPortalEvent event) {
Location from = event.getFrom().clone();
Location to = event.getTo();
from.setWorld(to.getWorld());
event.setTo(from);
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerPortal(PlayerPortalEvent event) {
Location from = event.getFrom().clone();
Location to = event.getTo();
from.setWorld(to.getWorld());
event.setTo(from);
}
}
this is sourced from **omnikeycard / sync-world-and-nether ** on github
if you tell us what it is ur tryna do
I think he wants to make the nether portal teleports you to the exact same location of overworld but in nether
And do that only for nether and not the end
So, the github description is for a 1:1 nether overworld travel, something ive been trying to implement for a bit.
However we faced the problem that the plugin was interacting with the end portals, resulting in funky interactions (teleporting into the void, or in one case the nether, no clue how)
So the solution for this would be to check if the To location is in the end
neat
If this is the case don't change the location
jup^
And is the plugin intended to also change the location if nether ~> overworld?
it should yeah, it makes the portals 1:1 between coords on each
im not too worried about entities, just the player interaction
If this is the case apply the event only if getFrom world is overworld or nether AND the getTo world is not the end
you might also need to mess with PortalCreateEvent though. cuz else ur going to end up with portals at locations other than where u actually spawn
To check this you might want to use the name of the world, or the World.Environment
(I believe you could make a datapack with one file, it would replace the vanilla dimension specification and change the scale so it is 1:1 with overworld)
though idk if PortalCreateEvent is called before or after PlayerPortalEvent it depends on that
if its after it should just create it at the correct destination. if not ur gonna have to generate the portal urself ;dd
(oh look, a datapack exists for this https://modrinth.com/datapack/1-to-1-nether tho not sure how it would do if you want the exact same coordinates)
i'll check that out!
Got intrigued but can't access the code now to get an answer ㅜㅜ
lmfao i was just thinking @wet breach aughta know & they are already typing
it isn't. PlayerPortalEvent -> PortalCreate if a portal doesn't exist And then teleport
if a portal exists, then a create event won't happen
but you will still have the teleport event
PortalEvent happens just before teleporting and they are about to teleport because they are standing in that portal frame for however long it takes
yea i understand that. but if a portal does not exist which will happen first
ye so create happens at destination of portalevent then?
so the order is this PortalEvent - > Create - > Teleport
yea i figured
just can't rely on create event always firing
but you can check that from PortalEvent
as you can figure out ahead of time if a portal is going to get created or not
you dont have to tho. if the portal already exists it would be at the correct destination already
yeah
unless you have a plugin t hat modifies the search radius
using PortalEvent
XD
can make some interesting traveling methods by slightly adjusting that radius lol
yea
you can also make linking portals at specific spots very annoying if you adjust that ;d
lol
I remember once not being able to get back to a portal because of that
it was 3 portals, 2 in the over world and 1 in the nether
you could go through it one way, but not the other well could but you wouldn't end up in the same portal
i guess the 2 in the overworld were going to the same one in the nether right? ;d
I get this warning at IntelliJ, and I noticed when packaging a different plugin, it doesnt appear, its just my plugin. I assume theres an easy fix?
you might have the old maven version or something
i don't know, i had the same error and it fixed by itself over time
give it a try, worse that happens is you are now using updated maven version 😛
i hope they won't pull a minecraft and go to .10
true true
gotta love minecraft pulling weird shit
like having Y axis be vertical
👏
.10 makes sense tho
and Fr33styler, your statement is incorrect, I like y being vertical
actually it makes sense that y is vertical
if you take a grid on paper, y is vertical
if you stand it up that is how it is in MC. So all mojang did was stood it upright
i thought this was just a joke
y is used in math for vertical since before i was born
Hello, can you help me with this error? Already tried all solutionsn i can find...
[13:05:46 ERROR]: Encountered an unexpected exception
java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
at sun.security.util.SignatureFileVerifier.processImpl(SignatureFileVerifier.java:325) ~[?:1.8.0_391]
at sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:267) ~[?:1.8.0_391]
at java.util.jar.JarVerifier.processEntry(JarVerifier.java:329) ~[?:1.8.0_391]
at java.util.jar.JarVerifier.update(JarVerifier.java:239) ~[?:1.8.0_391]
at java.util.jar.JarFile.initializeVerifier(JarFile.java:402) ~[?:1.8.0_391]
at java.util.jar.JarFile.getInputStream(JarFile.java:478) ~[?:1.8.0_391]
at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:181) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:160) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.loadPlugins(CraftServer.java:393) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:269) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1074) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:291) ~[patched_1.16.5.jar:git-Paper-794]
at java.lang.Thread.run(Thread.java:750) [?:1.8.0_391]
well you could make the argument that its in a 2 dimensional plane, and adding z makes it 3d, so it would kinda make sense that y and z be reversed, but any works for me so lol
I have javacord and sqlite dependencies
i didn't say anything, i just said that most people didn't expect it to go to .10 when it happened
warning is still present even after updating
Ik its just a warning but I dont like getting warned
idk i always got thought in school that Z is vertical in a 3d coordinate system
its possible that its coming from something that is being shaded?
so sometimes i forget
You guys care about warnings ?
sometimes I do
because while sometimes you can ignore it, sometimes you might not want to
it is, in many 3d systems
I have had warnings during build with maven for years, never cared :D
I do not like warnings in code tho
sometimes you have to scroll up to see if the build was a success
i guess you can infer that it succeded if you see the warnings
It always says [Build Successful] as like the last line tho ?
but i still scrolled up
i don't remember it being the case for me
what mento showed is what i remembered seeing as the result
well I suppose you could consider z as being vertical in some 3D systems, because in those systems, instead of standing the grid upright, they just inserted the grid horizontally as it is on paper into the system
in this case, z does become vertical
any idea where to look? I honestly am lost lol
again, I probably shouldnt care this much cuz its just a warning
look into your dependencies
if you have build plugins look there also
update the dependencies and plugins to fix it hopefully
is there a function for the spyglass zoom stuff or is it clientside?
if you can't you're out of luck i guess
you mean to "activate the zoom screen" ?
That is clientside
did, still has warnings*
ykw I give up
you can look into what dependencies the project has
?
altho i don't think plugins show up there
I would guide you to Paper discord server
With your patched_1.16.5.jar:git-Paper-794
i think it is not a paper, spigot or bukkit problem
as i red, it means that i included signed jar in my dependencies
gotta use packets 😔
are u able to send more than 1 packet at once?
but i already added excludes, and they didn't help at all
you need to filter out the manifest
i did that
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
Is therre a way to know which dependency is signed?
IntellIJ Bug
What packet is it?
💀
for some reason its still only taking damage on top of the water
on water surface '='
when i am in the water its not working litteraly tried everything
How laggy would be a repeating task every 5 ticks that teleports armor stands?
is this on the shaded plugin or the compiler?
should just exclude the entire meta directory
shaded
i dont even have compiler
how do i get the closest color to a hex color
of like legacy colors
so red, blue, etc
I actually have a method for this
dw i figured it out
i could just use Adventure for it
since im already shading it in
Maps console color codes to hex and vice versa. Contribute to frostalf-games/ConsoleColors development by creating an account on GitHub.
use RGB values, bitshift, then you have your color in hex
pretty simple

That depends on how many armorstands are teleported, and if they teleport into unloaded chunks
They are following the player, but having like 20 users or something like that doing the same can cause lag?
probably not heavy at all
Why are you letting them follow the player?
wdym
What is your intention with those armorstands
why not just attach them to the player
this is the goal (already achieved)
the thing is, with 50 players, this may cause lag right? I mean every 5 ticks 50 armor stands are being teleported
Ah i see. Btw an item display could make use of interpolation, making the following around very smooth.
Na i think its a quite reasonable load.
It is already smooth, but I don't have a recording system xd
yea? okay thanks!
armorstands have just lot more checks than displays those are way lighter
What you can do is evenly separate all players into buckets.
So instead of ticking 50 players every 5th tick, you simply tick one bucket (containing 10 players each) every tick.
This will help you evenly distribute the load over several ticks instead of having one tick where the load spikes.
Also described in:
?workdistro
But not all tasks will be ran at the same time
You should only have one task for this
I'm creating the task every time a player move, however until it is not finished another task is not being created
and separating tasks with hashmaps
🤨
what
So you start a task in the PlayerMoveEvent with a delay of 5 ticks?
how can i do that?
no look
let me send
it is not finished as I'm changing the code
Yeah, again. I would not create one task per player.
Just create a single task when the server starts, and then add/remove players to/from the task.
but the pet can be equiped and unequiped
I already have an event for that, that's why i can't do that
Yes. In that case you add/remove the player and his pet.
yea, what i'm doing
btw
to cancel a task i've seen people using cancel(); but that doesn't seem to work
if you just would use what 7smile is rightly suggesting u woulnt need to cancel tasks
Let me start my IDE and show an example
but i can't use that
u havent said anything to suggest you can't tho
.
that system easily supports equiping & unequiping pets
but not all the task will start at the same time
public class PetTask implements Runnable {
private final Set<Pet> activePets = new HashSet<>();
// Call when pet is spawned
public void addPet(Pet pet) {
activePets.add(pet);
}
// Call when pet is despawned
public void removePet(Pet pet) {
activePets.remove(pet);
}
@Override
public void run() {
for(Pet pet : activePets) {
pet.update();
}
}
}
You start this in your onEnable and then add/remove pets when they spawn/despawn
Never have to manage or cancel any tasks ever
bruh why can't i exclude signatures from pom.xml?
[14:25:41 ERROR]: Encountered an unexpected exception
java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
i trying to fix that for 2 days ahhh
the task is moving the armor stand
I think i'm not understanding
I mean, I want to move the pet only when the player moves and only towards the player
You store the player inside the pet object
*The UUID of the player plox
yea
I mean... if you are careful then you could use the Player as well.
in pet#update u can just check if the distance to the owner player becomes above a certain threshhold
after which u can get moving
public class Pet {
private final Player owner;
private final ArmorStand bukkitEntity;
public Pet(Player owner, ArmorStand bukkitEntity) {
this.owner = owner;
this.bukkitEntity = bukkitEntity;
}
private void teleportToOwner() {
}
public void update() {
this.teleportToOwner();
}
}
This could be a pet (with hard references to make it simpler)
Yea
I'm looking for implementing it in the moveevent 1s
Because this will still be following player yaw's
With what @tall dragon suggested your impl could be a bit like this
public class Pet {
private static final double MAX_DEVIATION = 0.25D;
private final Player owner;
private final ArmorStand bukkitEntity;
public Pet(Player owner, ArmorStand bukkitEntity) {
this.owner = owner;
this.bukkitEntity = bukkitEntity;
}
private void teleportToOwner() {
Location target = this.calculateTargetPosition();
Location current = this.bukkitEntity.getLocation();
double distanceFromTarget = current.distance(target);
// Doesnt need to teleport
if(distanceFromTarget < MAX_DEVIATION) {
return;
}
this.bukkitEntity.teleport(target);
}
private Location calculateTargetPosition() {
// TODO: Implement where the Pet should be
}
public void update() {
this.teleportToOwner();
}
}
But its getting pretty spoon feedy already...
And I want if the player is still, the pet as well, even if the player changes yaw
I can stop that if the pet is in the location I want ig
I think that is redundant.
Don't think so
Like the armor stand will still reach it's destiny but if the player is still, it won't follow it's yaw
I don't know if i'm explaining my self
wdym with ticking?
I assume I should also use this runnable system onEnable with adding & removing players, because right now I'm refreshing an auctionhouse GUI like this
@Override
public void decorate(Player player) {
if (!getInventory().getViewers().contains(player)) {
return;
}
if (task != null) {
task.cancel();
}
task = Bukkit.getScheduler().runTaskLater(CustomItems.getINSTANCE(), () -> refreshInventory(player), 20);
}```
```java
public void refreshInventory(Player player) {
for (int i = 0; i < inventory.getSize(); i++) {
this.buttonMap.put(i, GUITemplates.airButton());
}
decorate(player);
}```
You Pet has an update() method.
And this is run every tick as long as the Pet is spawned.
In your update() method, you simply check:
- Is the Entity too far away from its desired position -> If yes: Teleport to desired Position
- Is the Entities looking direction too far from the players looking direction -> If yes: Rotate to desired Rotation
Yeah, def try doing that
So I can make a difference of like 1 or smth and then do the code right?
I think that's a great way of doing it
Ty!
does any1 know what would be the best way of serializing interfaces using gson? with that i mean implementations of the interface of which i dont know the type during runtime. i'll probably have to serialize the classname and then somehow tell gson to use that class for deserializing i guess. but how
Yes. Let me find my impl for that.
Hi , how i can spawn the fake entity using protocolib in 1.20.4 ?
i tried but didn't understand how..
do i do this?
i just wana get the grasp of it
The first int is the entity id
0x01 is the packet id and ProtocolLib already handles that for you
sure
so i put
right?
All entities have a unique id
It's always incrementing for each entity spawned
It's then used to identify the entity in future packets
Random id doesn't guarantee it's unique
what should i do then?
You can use NMS to get an id to use
i don't wana use nms , cuz the plugin will support 1.20.4 , 1.19.4 , and older
maybe even to 1.13.2
or start with a pretty high number. but thats obviously not 100% fool proof either
Then you'll just have to run the risk of it breaking randomly
ok , can you help me finish it ?
i want it to have gravity / invisiable / and armorstand for 1.20.4
just wana see how the code acctully works
Wait i just had a great Idea on how to make this way better.
But let me give you the quick rundown of the current way:
You save the runtime class and data in a top level Json node and then register this as a type hierarchy adapter on your interface.class
Ill come back if my new idea works
Gson gson = new GsonBuilder().disableHtmlEscaping()
.setPrettyPrinting()
.enableComplexMapKeySerialization()
.registerTypeHierarchyAdapter(YourInterface.class, new AbstractClassAdapter())
.registerTypeHierarchyAdapter(AnotherInterface.class, new AbstractClassAdapter())
.registerTypeHierarchyAdapter(SomeAbstractClass.class, new AbstractClassAdapter())
.create();
would this work with multiple implementations of the same interface?
actually yea it does seem like that would work woulnt it
Yes. Example:
You register for Vehicle interface and have a Car class as well as a Motorcycle class.
Then your serialized data would be:
{
"@CLASS": "com.shuri.vehicles.impl.Car"
"@DATA": {
"Tires": 4,
"PS": 96
}
}
{
"@CLASS": "com.shuri.vehicles.impl.Motorcycle"
"@DATA": {
"Color": "Red",
"Vendor": "Yamaha"
}
}
And each will get deserialized as their Runtime class again, because you pull the class directly from the json file:
It doesnt need to be inferred or passed anymore.
yea this is great, thanks!
and do let me know if ur " idea" turns out well
it might be even better
can you help me understand what i put in the first paramter?
its getbooleans i think bcz its a boolean right?
Yes, my idea includes write a TypeAdapterFactory which scans the type hierarchy of a class to check if it contains an abstract class or interface.
This way you dont even have to register your type adapters anymore 🙂
This + a neat wrapper class. Ill let you know if it works.
ah i see, yea that could work
getBooleans().write(2, boo); cause it's the 3rd boolean
you should totally add it to ambrosia 😉
how 2?
1 = 0
My thoughts as well ;P
so that for gravity right?
I have a question about the runnable article: how to choose how many ticks runnuble should perform in 1 iteration
20?
0 for name, 1 for silent, 2 for gravity
which one, self limiting?
no, the booleans are one number less
not sure what u mean
0, 0, 0, 1, 2, 0, 1 if you start at VarInt
correct
that's pretty easy how i didn't understand that before?
hot take: gson sucks in terms of DX
not
run every server life time
about this?
if i for example want to send a entity meta for 1.12.2 < ?
I'm sorry I have no idea, I just started messing with ProtocolLib 2 days ago
hi folks, im trying to run buildtools for 20.4 but keep running into this error.
works fine on other versions, just compiled 20.2 with no issues. does anyone know if there's an issue with 20.4 atm or is this me forgetting how to dev
Patching net\minecraft\advancements\AdvancementHolder.java
Exception in thread "main" java.lang.RuntimeException: Error patching net\minecraft\advancements\AdvancementHolder.java
at org.spigotmc.builder.Builder.lambda$startBuilder$2(Builder.java:617)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1845)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
at org.spigotmc.builder.Builder.startBuilder(Builder.java:568)
at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:60)
Caused by: java.io.FileNotFoundException: work\decompile-c13d4d77\net\minecraft\advancements\AdvancementHolder.java (The system cannot find the path specified)
Did you add the remapped flag?
yep still doesn't work
And you added the dependency and plugin to your pom?
Clear your caches and try again
did you try removing all previously genned files
who said that
it looks like chinese tho
alot of people use it unnecessarily

So much work
But if this works i might be able to just throw anything at my uber Gson instance
kotlinx.serialization my beloved
Ah yes. Because who doesnt love adding a bunch of annotations above half of your classes to make them serializable
its just way too fun
Configurate <3
hey, better than dealing with jsonobject jsonreader stuff
If you properly use Gson then you should never see internals like JsonObject or JsonReader unless you are writing utility for internals yourself.
But you need en/decoder in your cabels because some of the AVI channels need to be multiplexed on some of the LAN channels
i would honestly be down to build this cable
And you could have a wireless transmitter/receiver on those as well.
You sure that this cable doesnt actiually exist?
¯_(ツ)_/¯
how can I get the title of an inventory? because inventory.getView() ist not working
?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.
What do you need the title for?
for checking it in the Inventory Click event
You should never compare titles of inventores for GUIs.
Inventory implements equals() and hashCode().
This means you can simply put them in a Set<Inventory> and check with set.contains()
or create a single inventory somewhere and check if it equals() the clicked inventory.
oh ok tysm
You should look at the NMS packet and not the protocol when using ProtocolLib.
PLib doesnt write into the buffer directly. It sets the fields of the packets via reflections.
does placing and breaking a shulker remove its PDC?
Yes
damn
do you think nms faster or Plib?
in the terms of performance?
We added a method a few months ago that lets you copy over the PDC. Can be used in the break and place event.
nms is always faster than PLib. With the drawback that nms doesnt work for multiple versions but Plib might very well.
The only reason nms doesn't work for multiple versions is because we relocate
i can create a moudle system for that so i can have multi nms versions
A very silly reason
Reflection is objectively worse
With this code the inventory will never open when I right click air, but the right click air action is checked.
public void onPlayerInteract(PlayerInteractEvent event) {
if(!(event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR)) return;
if(event.getItem() == null) return;
//Variables
Player player = event.getPlayer();
//Check for items
ItemMeta itemMeta = event.getItem().getItemMeta();
if(event.getItem().getType() == Material.COMPASS && itemMeta.getDisplayName().equals(inventoryName)){
player.openInventory(inventory);
}
}```
No competition
gonna try packets and see how its gonna go
the ifstatement is pretty confusing but I'm pretty sure you can't click on a block and on the air at the same time, so maybe just use one check
What version are you on? You can definitely use API for this
ik i been doing it with bukkit api for like 3 years
trying to make it diffrent
^_^

but its a "or" comparison.. not &&
sorry to ruin it for ya xD
I mean you're just intentionally making it more difficult for yourself and circumventing the version-independent API
but to each their own
So you want the code to return if the action is not rightclickblock or not rightclickair
no if it is right click block or air i want to execute the code. If its not i want to return
oh nvm, yes
and what is goign wrong?
the inventory will not open when i click the air, only when i click on a block
change || to &&
return if the action is not on a block and not on the air
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if(event.getAction() != Action.RIGHT_CLICK_BLOCK && event.getAction() != Action.RIGHT_CLICK_AIR)) return;
if(event.getItem() == null) return;
//Variables
Player player = event.getPlayer();
//Check for items
ItemMeta itemMeta = event.getItem().getItemMeta();
if(event.getItem().getType() == Material.COMPASS && itemMeta.getDisplayName().equals(inventoryName)){
player.openInventory(inventory);
}
}``` try this
when u right click air ur logic resolves to
if(!(false || true)) -> if(!(true) -> if(false)
oh true
thank you 🙂
hmm.. this is not working
it is still the same problem
but how can i fix this?
u want to open the inv when u right click block or right click air?
yes
ru sure its not another check failing
like the displayname for example
cuz that looks correct
he said it only opens the gui when he clicks on a block so the displayname check should be fine
yes it is..
if(event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR) {
event.getPlayer().sendMessage("test");
}```
when i right click air it is doing nothing and when i click on a block it shows me the message "test" twice
this is weird..
?interactevent
The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.
For example, only executing code if the main hand was used:
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
return; // do not progress past this point |
}
// provide functionality
}
Right click air only fires if you are holding an item
And yeah, the event fires once for each hand
oh ok but still, it does nothing when i click air
well log the action at the top
I don't find the way to let the player look the armor stand lol
I made so if player and the armor stand have a distance of less than 1, to not move the armor stand but that din't work
I dont know what that sentence means
me neither lol
event.getPlayer().sendMessage("" + event.getAction());```
this is never showing me a air click.. the event is not even triggered when clicking air
Do you want to check if the Pet is looking in the same direction as the ArmorStand?
Are you holding an item
No, i would like if the pet is in less than 1block for it to stop moving at all
I did this
yes, but also without a item
double distance = owner.getLocation().distance(pet.getLocation());
if (distance < 1)
return;
but didn't seem to work
nvm
now works xd
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if(e.getItem() == null) return;
if(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
//Variables
Player player = event.getPlayer();
//Check for items
ItemMeta itemMeta = event.getItem().getItemMeta();
if(event.getItem().getType() == Material.COMPASS && itemMeta.getDisplayName().equals(inventoryName)){
player.openInventory(inventory);
}
}
}``` try this
doesnt work too..
so it only works if you right click on a block?
hi while using 1.20.4 iam getting this bug .
cannot access org.bukkit.plugin.java.JavaPlugin
that's why i don't do newer version :p
yes
try replacing if(e.getItem() == null) return; with if(!e.hasItem()) return; although it probably wont make a difference
this is pointless.. the event is not even triggered when I click air
well thats weird

hello, I would like with a command to modify only one part of my config file, only, I searched but at times, it changes all my config file, how can I do?
lmao thats why you should show the full code including the annotation thats apart of the event...
?
just use set
yes.. sorry
yes but it modifies all my config file
What do you mean by modifies all
I'll show you just wait a moment
my config file before ordering
after placing the order
instead of modifying only x, y and z, it modifies all my file
?nocode
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
to modify my config file I do
EthernaPl.getInstance().getConfig().set("general.message.lobby.x", x);
EthernaPl.getInstance().getConfig().set("general.message.lobby.y", y);
EthernaPl.getInstance().getConfig().set("general.message.lobby.z", z);
EthernaPl.getInstance().saveConfig();
no
how you load and modify the config
CommandSetHub.java
Actually this is just invalid yaml
so ofc it doesn't work
my config.yml
general:
error: "This command can only be executed by a player."
prefix: "&f&l[&cEtherna&f&l]&r "
message:
BroadCast:
ERROR: "&c Please specify a message!"
prefix: "&f&l[&cAlert&f&l]"
reload: "&c&l/!\ &fThe server will reload, any changes during reload will be rolled back &c&l/!\\"
lobby:
message: "&aYou have just been teleported to the lobby"
SaveCoMessage: "&bHub coordinates updated."
x:
y:
z:
error: "&c&lNo coordinates have been defined, use the </sethub> command to define the coordinates"
check:
error: "Usage: /viewreports <player>"
NoneReport: "No reports found for player %player%"
ofc ???
ofc = of course
how can I resolve the problem?
try removing the empty keys
but if I delete them, there will be nothing to replace
Hi this is my code for 1.20.4 .. and now i get bugs
it didn't change anything
should be 0 i think
use 0 for uuid index
what should be 0?
idk seems fine yea
0,uuid
but that didn't change anything, it still changes all the files
do u have any errors upon server startup?
non
It doesn't matter where you locate the location data in the config because players aren't supposed to edit it via the config when you have a SetHub command. Just make the set path "hub.x", "hub.y", "hub.z" instead and read it from hub. Of course it's better to fix your yaml format to avoid future problems but if you want a quick fix for now that should do.
the problem is that I would like to make my plugin public (why not ^^)
?
tf is even wrong with his format then
i cant spot it
he has everything in general and the values for x, y, z are empty
i mean i told him to remove the empty values & everything being in general should not cause this issue right?
otherwise, I can't create a 2nd config file?
however I don't know how to create 2 ;-;
its resetting everything because he is replacing the old "general" section with general.message.x, y and z
So I just had to create a new section
understood
yes as i said just make it set to hub.x, hub.y and hub.z
if that were the case his final config would only consist of the z component
you could just save the location directly because Location implements ConfigurationSerializable
so to avoid other problems it is better to delete the general section
set should only replace that at the full path
its probably the save method that sets that path to x, y, z?
that would make very little sense
docs also say it sets the specified path to the given value
i think the set method is for telling it what to set and saveConfig is what actually sets it
didnt u think why set doesnt automatically save
yea of course
but saveConfig has nothing to do with the replacing part
set determines the structure
this yaml issue is giving me braincell lose XD
its more likely his original config is somehow empty
they should find out if the config from getConfig() before editing actually contains all the fields
he sent his code, all he does to the config onEnable is saveDefaultConfig
yea, im really not sure
but im 99% sure set method should not replace everything like that
it never has for me
even if you put only hub.x it doesn't work
what?
show code and file
just the part where u set the location
error: "This command can only be executed by a player."
prefix: "&f&l[&cEtherna&f&l]&r "
BroadCast:
ERROR: "&c Please specify a message!"
prefix: "&f&l[&cAlert&f&l]"
reload: "&c&l/!\ &fThe server will reload, any changes during reload will be rolled back &c&l/!\\"
lobby:
x:
y:
z:
message: "&aYou have just been teleported to the lobby"
SaveCoMessage: "&bHub coordinates updated."
error: "&c&lNo coordinates have been defined, use the </sethub> command to define the coordinates"
check:
error: "Usage: /viewreports <player>"
NoneReport: "No reports found for player %player%"
Before :
oh you put text in there too, i meant put it separately from any text
After
(before after ordering)
error: "This command can only be executed by a player."
prefix: "&f&l[&cEtherna&f&l]&r "
BroadCast:
ERROR: "&c Please specify a message!"
prefix: "&f&l[&cAlert&f&l]"
reload: "&c&l/!\ &fThe server will reload, any changes during reload will be rolled back &c&l/!\\"
lobby:
message: "&aYou have just been teleported to the lobby"
SaveCoMessage: "&bHub coordinates updated."
error: "&c&lNo coordinates have been defined, use the </sethub> command to define the coordinates"
check:
error: "Usage: /viewreports <player>"
NoneReport: "No reports found for player %player%"
sethub:
x:
y:
z:
like that ?
error: "This command can only be executed by a player."
prefix: "&f&l[&cEtherna&f&l]&r "
BroadCast:
ERROR: "&c Please specify a message!"
prefix: "&f&l[&cAlert&f&l]"
reload: "&c&l/!\ &fThe server will reload, any changes during reload will be rolled back &c&l/!\\"
lobby:
message: "&aYou have just been teleported to the lobby"
SaveCoMessage: "&bHub coordinates updated."
error: "&c&lNo coordinates have been defined, use the </sethub> command to define the coordinates"
check:
error: "Usage: /viewreports <player>"
NoneReport: "No reports found for player %player%"
yes
like that ?
could this cause it? somehow its caching an empty config maybe?
i literally said that
so what should I do?
the first time he sent his code i thought of that but i was like "nah no way it cant do such a thing" but we still not 100% sure
ahhhh it’s there!!!
😂
cool so it was that little line...
wait
that always happens
the supsicious line is always there and you're always suspicious of it at the beginning but you only decide to tackle it after trying everything else lmao
just, now she's taking something away from me ""
Before
After
error no longer has a quote
a ok
thanks
just set a / infront of the "
to do what ?
it wont be shown as an error anymore
it marks it as a normal char thus not interpreting it as a string ending or beginning
isnt that \ ?
fair
I can't have a double quote
otherwise no problem, thank you
cuz yml thinks ur string stops at the first " witihout a backslash now
error: "This command can only be executed by a player."
prefix: "&f&l[&cEtherna&f&l]&r "
BroadCast:
ERROR: "&c Please specify a message!"
prefix: "&f&l[&cAlert&f&l]"
reload: "&c&l/!\ &fThe server will reload, any changes during reload will be rolled back &c&l/!\\"
lobby:
message: "&aYou have just been teleported to the lobby"
SaveCoMessage: "&bHub coordinates updated."
error: "&c&lNo coordinates have been defined, run the </sethub> command to define the coordinates"
check:
error: "Usage: /viewreports <player>"
NoneReport: "No reports found for player %player%"
like that ?
this one seems fine the AucunReport is gone
Any ideas about clamping the button and its implementation?
in playerInteract for example
how can i remove the hit delay?
Increase the attack speed
declaration: package: org.bukkit.attribute, enum: Attribute
or are you talking about invulnerability ticks?
both of them
like
remove the hit delay but without making it literally combo fly
im doing this
but i think thats invulnerability
BufferedImage image = ImageIO.read(SumeruTroll.class.getClassLoader().getResourceAsStream("image.jpg"));
MapView mapView = Bukkit.createMap(Bukkit.getWorlds().get(0));
mapView.setScale(MapView.Scale.NORMAL);
mapView.addRenderer(new MapRenderer() {
@Override
public void render(MapView map, MapCanvas canvas, Player player) {
canvas.drawImage(0, 0, MapPalette.resizeImage(image));
}
});
org.bukkit.inventory.ItemStack mapItem = new ItemStack(Material.MAP, 1);
mapItem.setDurability(mapView.getId());
EntityItemFrame item = new EntityItemFrame(((CraftWorld) target.getWorld()).getHandle());
item.setNoGravity(true);
item.setLocation(target.getPlayer().getLocation().getX(),
target.getPlayer().getLocation().getY()+1,
target.getPlayer().getLocation().getZ(), 0.0F, 0.0F);
item.setItem(CraftItemStack.asNMSCopy(mapItem));
for (Player p : Bukkit.getOnlinePlayers()) {
if (p.equals(target)) {
continue;
}
((CraftPlayer) p).getHandle().playerConnection.sendPacket(new PacketPlayOutSpawnEntity(item, 71));
((CraftPlayer) p).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityMetadata(item.getId(), item.getDataWatcher(), false));
}``` I am trying to display a map with an image on the item frame, but for some reason the frame is empty but enlarged
why dont working?
?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.
Do you want to code for a minecraft medieval roleplay server lol
If you want to join me by all means
how can i place for example 9 blocks when player tries to enter an area so he cant do that
so it just blocks him
Guys i'm asking like fifth time, what can i do to fix this error:
[13:05:46 ERROR]: Encountered an unexpected exception
java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
at sun.security.util.SignatureFileVerifier.processImpl(SignatureFileVerifier.java:325) ~[?:1.8.0_391]
at sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:267) ~[?:1.8.0_391]
at java.util.jar.JarVerifier.processEntry(JarVerifier.java:329) ~[?:1.8.0_391]
at java.util.jar.JarVerifier.update(JarVerifier.java:239) ~[?:1.8.0_391]
at java.util.jar.JarFile.initializeVerifier(JarFile.java:402) ~[?:1.8.0_391]
at java.util.jar.JarFile.getInputStream(JarFile.java:478) ~[?:1.8.0_391]
at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:181) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:160) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.loadPlugins(CraftServer.java:393) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:269) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1074) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:291) ~[patched_1.16.5.jar:git-Paper-794]
at java.lang.Thread.run(Thread.java:750) [?:1.8.0_391]
Already:
- Tried using filters and excludes
- Rebuilding the project several times with modified pom.xml
- different core
i did that?
as someone said, i just excluded entire META-INF/ directory
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/</exclude>S
</excludes>
</filter>
</filters>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.timuzkas.linker.Linker</mainClass>
</transformer>
</transformers>
<shadedArtifactAttached>true</shadedArtifactAttached>
</configuration>
</execution>
</executions>
</plugin>
?
?tas
0$
it's completely out of place, isn't it obvious that I already tried it when I said "for some reason the frame is empty but enlarged"
I work for free baby
you asked „like this“
